@intent-hq/web 2.334.0 → 2.334.1
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/{zobwBhBP.js → 2aqEG8x0.js} +1 -1
- package/web/app/immutable/chunks/{BW9zdIKM.js → 4seVPSlv.js} +1 -1
- package/web/app/immutable/chunks/{BMFAZxzl.js → 5deW2fcc.js} +1 -1
- package/web/app/immutable/chunks/{B29HdkQh.js → 5gwO8o7P.js} +1 -1
- package/web/app/immutable/chunks/{Cn1E5b8h.js → 5iBTGhZe.js} +1 -1
- package/web/app/immutable/chunks/{DvQkR2Is.js → 9x9_-mfx.js} +1 -1
- package/web/app/immutable/chunks/{MItv5vwZ.js → B3IB9jzF.js} +1 -1
- package/web/app/immutable/chunks/{BcRUrG7V.js → B4GGgwli.js} +1 -1
- package/web/app/immutable/chunks/{D-Uzg_w_.js → B4OuSSm9.js} +1 -1
- package/web/app/immutable/chunks/{gVcm9LZ1.js → B8888LoS.js} +1 -1
- package/web/app/immutable/chunks/{dLK087oD.js → B8ouaI3V.js} +1 -1
- package/web/app/immutable/chunks/{DANuQK8j.js → BACRSxRg.js} +1 -1
- package/web/app/immutable/chunks/{DiUyyFSb.js → BAmhsi1_.js} +1 -1
- package/web/app/immutable/chunks/{B6KMCDK3.js → BBH-BNcw.js} +1 -1
- package/web/app/immutable/chunks/{BsYAGCCJ.js → BETOnFVA.js} +1 -1
- package/web/app/immutable/chunks/{B0h3U-Yz.js → BEbbGjvZ.js} +1 -1
- package/web/app/immutable/chunks/{Bvt4TKMh.js → BEycbtuj.js} +1 -1
- package/web/app/immutable/chunks/{C4RucMn0.js → BI01o9a_.js} +1 -1
- package/web/app/immutable/chunks/{CwakGbfV.js → BI3OQg3X.js} +1 -1
- package/web/app/immutable/chunks/{BpidAqRA.js → BJGG6xS6.js} +6 -6
- package/web/app/immutable/chunks/{DAxsY0Gj.js → BMXLxN42.js} +1 -1
- package/web/app/immutable/chunks/{CCGEGA0G.js → BRvPqeED.js} +1 -1
- package/web/app/immutable/chunks/{Ug0dtdu2.js → BV0hRaXE.js} +4 -4
- package/web/app/immutable/chunks/{CwMqpcMm.js → BX5Kqzmw.js} +1 -1
- package/web/app/immutable/chunks/{BIvp5Tt2.js → B_VQj7hH.js} +1 -1
- package/web/app/immutable/chunks/{CBC7YFdV.js → Bbdedrbg.js} +1 -1
- package/web/app/immutable/chunks/{072Tb_6D.js → BcOksEI9.js} +1 -1
- package/web/app/immutable/chunks/{m2BK1mVX.js → BcSES-Dp.js} +1 -1
- package/web/app/immutable/chunks/{Ossh6uZu.js → Bjpp5QFb.js} +1 -1
- package/web/app/immutable/chunks/{BduWPjcR.js → BkLJcH_z.js} +1 -1
- package/web/app/immutable/chunks/{DNEb71Dh.js → BnU-5qYi.js} +1 -1
- package/web/app/immutable/chunks/{CwiXEybf.js → BrgY-0wa.js} +1 -1
- package/web/app/immutable/chunks/{CwKaV1IY.js → BsmVNOQl.js} +1 -1
- package/web/app/immutable/chunks/{wP6HsJDJ.js → BxDyhHLD.js} +1 -1
- package/web/app/immutable/chunks/{BJOBGHF6.js → C--Z5JHB.js} +1 -1
- package/web/app/immutable/chunks/{T2yA2AgY.js → C-IDQ1xK.js} +1 -1
- package/web/app/immutable/chunks/{DZTtqmYJ.js → C043lRmr.js} +1 -1
- package/web/app/immutable/chunks/{DKf1LSfP.js → C0A_RMeu.js} +1 -1
- package/web/app/immutable/chunks/{zP9pbpMh.js → C0VK7z_4.js} +1 -1
- package/web/app/immutable/chunks/{CRLRbkCn.js → C0WAGZJ9.js} +1 -1
- package/web/app/immutable/chunks/{BMMqOSaL.js → C2Hj1FZO.js} +1 -1
- package/web/app/immutable/chunks/{CFS-CWu3.js → C3mDeV9d.js} +1 -1
- package/web/app/immutable/chunks/{BFBxuHtI.js → C3vEbnKP.js} +1 -1
- package/web/app/immutable/chunks/{CKrDMmMA.js → C5VwFEJA.js} +1 -1
- package/web/app/immutable/chunks/{BY2EZOH5.js → C6vcWSYF.js} +1 -1
- package/web/app/immutable/chunks/{B77TCztV.js → CAtd-0zD.js} +1 -1
- package/web/app/immutable/chunks/{DJQSxFj4.js → CEXEpW2y.js} +1 -1
- package/web/app/immutable/chunks/{YkXzGZ8n.js → CEgGFCzF.js} +1 -1
- package/web/app/immutable/chunks/{rNW14wgI.js → CEtwgF3e.js} +1 -1
- package/web/app/immutable/chunks/{HjTnEK4j.js → CFbTpfHS.js} +1 -1
- package/web/app/immutable/chunks/{fJUF_fJi.js → CI96OvIs.js} +1 -1
- package/web/app/immutable/chunks/{Bp1o3thS.js → CIB-2rN9.js} +1 -1
- package/web/app/immutable/chunks/{l8UFOWir.js → CKR6ReFI.js} +3 -3
- package/web/app/immutable/chunks/{wylA95cI.js → CLT3XZ7_.js} +1 -1
- package/web/app/immutable/chunks/{BNhmUsaA.js → CMhVAKzx.js} +1 -1
- package/web/app/immutable/chunks/{DVTVoVn3.js → CPYxy-X1.js} +1 -1
- package/web/app/immutable/chunks/{BpnwXy6U.js → CRdjZtzP.js} +1 -1
- package/web/app/immutable/chunks/CTcbitCM.js +1 -0
- package/web/app/immutable/chunks/{CuXSY9SQ.js → CUWQIUPR.js} +2 -2
- package/web/app/immutable/chunks/{fOffirGV.js → CXexmtc2.js} +1 -1
- package/web/app/immutable/chunks/{1N54IjFy.js → CYAPxNuV.js} +1 -1
- package/web/app/immutable/chunks/{BrK9k8X4.js → CYnSw8gK.js} +1 -1
- package/web/app/immutable/chunks/{DdWD_Vv3.js → CZEeLj55.js} +1 -1
- package/web/app/immutable/chunks/{xD874lNR.js → CrnkHSpK.js} +2 -2
- package/web/app/immutable/chunks/{DwLudbcs.js → Cs1tcw-s.js} +1 -1
- package/web/app/immutable/chunks/{CGiCL1Ov.js → CsabU_jS.js} +1 -1
- package/web/app/immutable/chunks/{CZnrzyHp.js → CsdbM4yO.js} +1 -1
- package/web/app/immutable/chunks/{DhSqfFgd.js → CvkTsTXh.js} +1 -1
- package/web/app/immutable/chunks/{DDRhcF_8.js → CyImu6JF.js} +1 -1
- package/web/app/immutable/chunks/{DF71nvkU.js → Cz-qaXwq.js} +1 -1
- package/web/app/immutable/chunks/{BfiKUtfz.js → D0NsovPG.js} +1 -1
- package/web/app/immutable/chunks/{CwMAKc0Q.js → D8zn-h1a.js} +1 -1
- package/web/app/immutable/chunks/{CJB7cvC2.js → DBdE3z4X.js} +1 -1
- package/web/app/immutable/chunks/{CWYYinAo.js → DBhO1Z-R.js} +1 -1
- package/web/app/immutable/chunks/{AMK506zb.js → DE30zKyE.js} +1 -1
- package/web/app/immutable/chunks/{4AVTvQlm.js → DEA_eMvz.js} +1 -1
- package/web/app/immutable/chunks/{BiRCgfI8.js → DFDLegE6.js} +1 -1
- package/web/app/immutable/chunks/{DqdGC4dy.js → DHwdjtxe.js} +1 -1
- package/web/app/immutable/chunks/{8ZRaDoDY.js → DIyqmlUg.js} +1 -1
- package/web/app/immutable/chunks/{D-JSvqq2.js → DKxrs1sS.js} +2 -2
- package/web/app/immutable/chunks/{B3RoFPrI.js → DPXyAfng.js} +1 -1
- package/web/app/immutable/chunks/{BaeUp1de.js → DPiebq8X.js} +1 -1
- package/web/app/immutable/chunks/{BcvgmgBl.js → DRe7r98g.js} +1 -1
- package/web/app/immutable/chunks/{Cil-vK29.js → DRvCShWO.js} +1 -1
- package/web/app/immutable/chunks/{SpNk3-qf.js → DWJnCcL3.js} +1 -1
- package/web/app/immutable/chunks/{DyEA97Ij.js → DXQ8FQgn.js} +1 -1
- package/web/app/immutable/chunks/{BNcmjmX0.js → DYSyQTlz.js} +1 -1
- package/web/app/immutable/chunks/{BuEytmbB.js → DYUpH2Hg.js} +1 -1
- package/web/app/immutable/chunks/{DySSBJC4.js → DZRICUjW.js} +1 -1
- package/web/app/immutable/chunks/{BBA4Bzbm.js → DafANtkC.js} +1 -1
- package/web/app/immutable/chunks/{B_sZwi21.js → Dbqyis-m.js} +1 -1
- package/web/app/immutable/chunks/{CMpcqAa4.js → De1yQ4of.js} +3 -3
- package/web/app/immutable/chunks/{DKNnPYeR.js → DhIC-K93.js} +1 -1
- package/web/app/immutable/chunks/{t1ZWo-I1.js → Di0Cytfq.js} +1 -1
- package/web/app/immutable/chunks/{BjdHDlxK.js → DkO3fP2t.js} +1 -1
- package/web/app/immutable/chunks/{VLZW5k04.js → DkoS0ApO.js} +1 -1
- package/web/app/immutable/chunks/{B7_YNW7R.js → Do3D3adr.js} +1 -1
- package/web/app/immutable/chunks/{D0BUPqIH.js → Do9Il6aW.js} +4 -4
- package/web/app/immutable/chunks/{DMHPeP9b.js → DsbITls1.js} +1 -1
- package/web/app/immutable/chunks/{DLtIqvYl.js → DulGwXPf.js} +2 -2
- package/web/app/immutable/chunks/{BuCbZihK.js → DuoF8WPm.js} +2 -2
- package/web/app/immutable/chunks/{BRJ8JwtZ.js → DzXiplW2.js} +2 -2
- package/web/app/immutable/chunks/{C-tVLzji.js → Gz-Odby1.js} +1 -1
- package/web/app/immutable/chunks/{03PfIO_9.js → HB5uhQNm.js} +1 -1
- package/web/app/immutable/chunks/{BdYPHOrS.js → ITJu9SqW.js} +1 -1
- package/web/app/immutable/chunks/{Bmyv2TKf.js → JlZEAwzh.js} +1 -1
- package/web/app/immutable/chunks/{DxHHBDex.js → LULQY_VI.js} +1 -1
- package/web/app/immutable/chunks/{ClZsJ0tq.js → MMlRGdRy.js} +1 -1
- package/web/app/immutable/chunks/{BYS_XVzS.js → Oz6u8hl_.js} +1 -1
- package/web/app/immutable/chunks/{CiqS40z1.js → Qx6kHYb-.js} +1 -1
- package/web/app/immutable/chunks/{CYttmgAy.js → TvrcPonj.js} +2 -2
- package/web/app/immutable/chunks/{B94CMzpV.js → V1oMiVfu.js} +1 -1
- package/web/app/immutable/chunks/{D0Nn2MSZ.js → Z9shPzgu.js} +12 -12
- package/web/app/immutable/chunks/{2J-nekl4.js → b8po137L.js} +3 -3
- package/web/app/immutable/chunks/{BHvVwiFl.js → fQAPkS9v.js} +1 -1
- package/web/app/immutable/chunks/{DziBVnxJ.js → kJ4G2_k4.js} +3 -3
- package/web/app/immutable/chunks/{N6ccAT9m.js → kKBf0CYQ.js} +3 -3
- package/web/app/immutable/chunks/{DVWbUaqE.js → mEDFle3S.js} +2 -2
- package/web/app/immutable/chunks/{DWLCZ9bk.js → psHvDGLZ.js} +1 -1
- package/web/app/immutable/chunks/{f7LaE2V_.js → tHW2xu85.js} +4 -4
- package/web/app/immutable/chunks/{Csi1v0mQ.js → vvvz0E4v.js} +1 -1
- package/web/app/immutable/chunks/{BE_5EfDm.js → x67B9CPX.js} +4 -4
- package/web/app/immutable/entry/{app.DzJavKOz.js → app.D0MtdmTS.js} +2 -2
- package/web/app/immutable/entry/start.CBgUCIjA.js +1 -0
- package/web/app/immutable/nodes/{0.DwHYAcJA.js → 0.SQd1rw9F.js} +1 -1
- package/web/app/immutable/nodes/{1.CNlxk-Wb.js → 1.DEkMxnM3.js} +1 -1
- package/web/app/immutable/nodes/{10.Bnp8Ru15.js → 10.BwG-rwIb.js} +1 -1
- package/web/app/immutable/nodes/{14.C5EP7pij.js → 14.D7uqFGya.js} +1 -1
- package/web/app/immutable/nodes/{17.CWgUp0nx.js → 17.CLHcSNQ3.js} +2 -2
- package/web/app/immutable/nodes/{2.i3va2l-3.js → 2.wp3qumBD.js} +4 -4
- package/web/app/immutable/nodes/{3.TRZPY3g1.js → 3.beA-w1Z7.js} +1 -1
- package/web/app/immutable/nodes/{4.Q_cklVfx.js → 4.CApSdQYP.js} +1 -1
- package/web/app/immutable/nodes/{5.DQss9mOg.js → 5.CI2v691d.js} +1 -1
- package/web/app/immutable/nodes/{6.B1fe3H2i.js → 6.CMzDhNh4.js} +1 -1
- package/web/app/immutable/nodes/{7.Bs2GT-JO.js → 7.DLco_Cq5.js} +1 -1
- package/web/app/immutable/nodes/{8.Bhi1HY5b.js → 8.CZiVpecT.js} +4 -4
- package/web/app/immutable/nodes/{9.BWi2XzAl.js → 9.D1WSkrvW.js} +4 -4
- package/web/app/version.json +1 -1
- package/web/index.html +9 -9
- package/web/app/immutable/chunks/DVNTCHDs.js +0 -1
- package/web/app/immutable/entry/start.D3-DqMWL.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
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{B as xt,O as Rt,dG as Be,cG as pe,dr as Pt,al as Bt,b1 as Ge,z as Ot,dS as $t}from"./CArqGgyL.js";import{Ik as A,g as be,nx as x,vC as Ut,Bl as Ye,vE as Lt,Cy as Je,cx as Nt,cy as Ht,ny as Qe,nk as Ft,c as ke,fF as Kt,lN as Wt,cF as jt}from"./Dk1_0x0Q.js";import{e as qt,b as ae,F as Vt,y as re,_ as ve,G as zt,C as Gt,W as Xe,v as Yt,u as Jt,M as Qt}from"./Bdtl8KA4.js";import{D as Oe,a as Xt,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"./BsbCFjWI.js";import{a as et,e as sn}from"./BfDRfZ1x.js";import{f as on}from"./DkPqbYEN.js";import{bo as b,_ as fe}from"./Dso1_H3c.js";import{a8 as tt,az as se,J as he,a as nt,n as at,cP as rt,e as st,aG as it,M as cn,aa as ln,aS as $e,d as le,C as dn,cQ as un,U as mn,a5 as pn,aH as fn,bX as hn}from"./ClZsJ0tq.js";import{bD as gn,bq as yn,aX as wn,by as bn,bs as kn,ax as vn}from"./m5UczIQR.js";import{O as _n,z as Sn}from"./DCCFERAn.js";import{t as q,q as Mn,v as An}from"./Cl-7Au8R.js";import{x as In,J as Tn,ai as En,ar as Cn}from"./CMpcqAa4.js";import{a as Ue,b as Dn,g as xn}from"./DypB-Dwi.js";import{z as Rn}from"./CZ_kVWbN.js";import{C as Pn}from"./BvFAWM27.js";import{i as Bn}from"./DGcTdGo8.js";import{o as $,e as On,l as V,s as E,n as ce,b as $n,d as Un,c as Ln}from"./CIyUrgF0.js";function Cr(e,t){if(e)return e.model}function Nn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Dr({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?xt(e):!1)&&!Nn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function xr(e){return Rt(e.messageMetadata)}function Hn(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 Rr(e){return Hn({...e,createdAt:Date.parse(e.queuedAt)})}const Fn=8*1024*1024,Kn=3*1024*1024;function Wn(e){return Math.ceil(Math.max(0,e)/3)*4}function jn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Kn&&typeof t=="number"&&t===Wn(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 Le(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 qn(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 Vn(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=on;function Pr(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,i=t.speech.error??t.speech.capability?.reason??null,o=Vn(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,L)=>{m[g]=D,L&&(y[g]=L)};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:L})=>!L.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"?Le(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:qn(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?Le(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,zn=["image/png","image/jpeg","image/webp"],Ne=e=>zn.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 Br(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(!Yn(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 Gn(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 Yn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Or(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 $r(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 Qn(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 Ur(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 Qn(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 Zn(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 ea(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=>un(m,r)?$e(e,r,a.getAttachmentInfo):void 0;if(ct(n.data)<=cn)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 ea(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&&ln(m)){const y=await $e(e,r,a.getAttachmentInfo);if(y)return y}throw m}const u=Math.min(mn,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,Zn(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 ta(e,t){return pn(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 na(e,t){return e instanceof Ae?e.retryBlocks:t}async function aa(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??ta(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=dn(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 Lr=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Ae,base64DecodedBytes:ct,imageRetryBlocks:na,placeImageAttachment:Me,toImageReferenceBlocks:aa},Symbol.toStringTag,{value:"Module"}));function dt(){try{return gn()}catch{return null}}function ra(){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:()=>yn(),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 sa(e,t){const n=A.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:x(n.drafts,Vt(e,t))?.clearRevision??0,binding:ra()}}function Nr(e,t,n){const a=sa(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 Hr(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 ia(e){const t=String(e?.message??"");return ft(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function oa(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 ca 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 la(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=oa(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(ia(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 ca(o.image.id,u)}i.push(c)}return i}async function Fr(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 da=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"]),ua=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!da.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>ua.has(r)?r:"other")].join(":")}function Kr(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 ma(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 Gn(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 fn(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(jn(_))),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,pa=.85;async function fa(e,t){const n=Math.round(e.length*3/4/1024),a=await ha(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;ga(d,o,l)||(u="image/jpeg");const h=await c.convertToBlob({type:u,quality:u==="image/jpeg"?pa:void 0}),p=h.type||u,m=await ya(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 ha(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 ga(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 ya(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 wa(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:Sa(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 ba(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(Xt(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 ka(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function va(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 ka(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),ba(l,wa(t,n,i,r)),o}finally{s.close()}}async function _a(e,t,n){const a=await ht(e,t,n,Math.max(t.width,t.height));return fa(await va(a),"image/png")}async function Wr(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 Sa(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 jr(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 qr({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(Q=>Q.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 ma(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 Ma({...n,images:k},a,m.images):[]}catch(w){throw new O("burn",ie(w))}if(m.framePromptBytes.reduce((w,M)=>w+(M??0),0)>Fn)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 Re=n?await pt(i):null;if(u(),n&&(e!==be||Re?.chiefAttachments)){const w=await la({workspaceId:e,binding:i,images:k.map((M,Q)=>{const X=a.find(Et=>Et.id===M.contextItemId);return{image:M,signature:Gt(n,M.id),composite:{base64:v[Q].data,mimeType:v[Q].mimeType},raw:!M.media&&X?.imageData&&X.imageMimeType?{base64:X.imageData,mimeType:X.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?Xe(n).map(({n:w,mark:M})=>[M.id,w]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:g}:p&&{...p,markNumbers:g},L=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/BkLJcH_z.js","/app/immutable/chunks/BuNYZSRv.js","/app/immutable/chunks/DCCFERAn.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/Dso1_H3c.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/CnMdEUN9.js","/app/immutable/chunks/BfNeIJAh.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/m5UczIQR.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/B3KrGqdQ.js","/app/immutable/chunks/HZf189bi.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/Cl-7Au8R.js","/app/immutable/chunks/C7Fm8r7x.js","/app/immutable/chunks/Dk1_0x0Q.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/Bdtl8KA4.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/DAGiwOmW.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/CArqGgyL.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/Cxbk0QV6.js","/app/immutable/chunks/BfDRfZ1x.js","/app/immutable/chunks/D2laB2lQ.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/CZ_kVWbN.js","/app/immutable/chunks/CIqnL4UD.js","/app/immutable/chunks/DXO_adPf.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/TvrcPonj.js","/app/immutable/chunks/CGVLIZz9.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/Bobasviv.js","/app/immutable/chunks/DfBE7crq.js","/app/immutable/chunks/CCPn5VZR.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{B as xt,O as Rt,dG as Be,cG as pe,dr as Pt,al as Bt,b1 as Ge,z as Ot,dS as $t}from"./CArqGgyL.js";import{Ik as A,g as be,nx as x,vC as Ut,Bl as Ye,vE as Lt,Cy as Je,cx as Nt,cy as Ht,ny as Qe,nk as Ft,c as ke,fF as Kt,lN as Wt,cF as jt}from"./Dk1_0x0Q.js";import{e as qt,b as ae,F as Vt,y as re,_ as ve,G as zt,C as Gt,W as Xe,v as Yt,u as Jt,M as Qt}from"./Bdtl8KA4.js";import{D as Oe,a as Xt,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"./BsbCFjWI.js";import{a as et,e as sn}from"./BfDRfZ1x.js";import{f as on}from"./DkPqbYEN.js";import{bo as b,_ as fe}from"./Dso1_H3c.js";import{a8 as tt,az as se,J as he,a as nt,n as at,cP as rt,e as st,aG as it,M as cn,aa as ln,aS as $e,d as le,C as dn,cQ as un,U as mn,a5 as pn,aH as fn,bX as hn}from"./MMlRGdRy.js";import{bD as gn,bq as yn,aX as wn,by as bn,bs as kn,ax as vn}from"./m5UczIQR.js";import{O as _n,z as Sn}from"./DCCFERAn.js";import{t as q,q as Mn,v as An}from"./Cl-7Au8R.js";import{x as In,J as Tn,ai as En,ar as Cn}from"./De1yQ4of.js";import{a as Ue,b as Dn,g as xn}from"./DypB-Dwi.js";import{z as Rn}from"./CZ_kVWbN.js";import{C as Pn}from"./BvFAWM27.js";import{i as Bn}from"./DGcTdGo8.js";import{o as $,e as On,l as V,s as E,n as ce,b as $n,d as Un,c as Ln}from"./CIyUrgF0.js";function Cr(e,t){if(e)return e.model}function Nn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Dr({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?xt(e):!1)&&!Nn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function xr(e){return Rt(e.messageMetadata)}function Hn(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 Rr(e){return Hn({...e,createdAt:Date.parse(e.queuedAt)})}const Fn=8*1024*1024,Kn=3*1024*1024;function Wn(e){return Math.ceil(Math.max(0,e)/3)*4}function jn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Kn&&typeof t=="number"&&t===Wn(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 Le(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 qn(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 Vn(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=on;function Pr(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,i=t.speech.error??t.speech.capability?.reason??null,o=Vn(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,L)=>{m[g]=D,L&&(y[g]=L)};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:L})=>!L.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"?Le(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:qn(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?Le(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,zn=["image/png","image/jpeg","image/webp"],Ne=e=>zn.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 Br(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(!Yn(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 Gn(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 Yn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Or(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 $r(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 Qn(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 Ur(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 Qn(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 Zn(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 ea(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=>un(m,r)?$e(e,r,a.getAttachmentInfo):void 0;if(ct(n.data)<=cn)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 ea(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&&ln(m)){const y=await $e(e,r,a.getAttachmentInfo);if(y)return y}throw m}const u=Math.min(mn,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,Zn(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 ta(e,t){return pn(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 na(e,t){return e instanceof Ae?e.retryBlocks:t}async function aa(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??ta(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=dn(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 Lr=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Ae,base64DecodedBytes:ct,imageRetryBlocks:na,placeImageAttachment:Me,toImageReferenceBlocks:aa},Symbol.toStringTag,{value:"Module"}));function dt(){try{return gn()}catch{return null}}function ra(){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:()=>yn(),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 sa(e,t){const n=A.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:x(n.drafts,Vt(e,t))?.clearRevision??0,binding:ra()}}function Nr(e,t,n){const a=sa(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 Hr(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 ia(e){const t=String(e?.message??"");return ft(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function oa(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 ca 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 la(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=oa(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(ia(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 ca(o.image.id,u)}i.push(c)}return i}async function Fr(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 da=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"]),ua=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!da.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>ua.has(r)?r:"other")].join(":")}function Kr(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 ma(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 Gn(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 fn(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(jn(_))),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,pa=.85;async function fa(e,t){const n=Math.round(e.length*3/4/1024),a=await ha(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;ga(d,o,l)||(u="image/jpeg");const h=await c.convertToBlob({type:u,quality:u==="image/jpeg"?pa:void 0}),p=h.type||u,m=await ya(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 ha(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 ga(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 ya(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 wa(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:Sa(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 ba(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(Xt(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 ka(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function va(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 ka(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),ba(l,wa(t,n,i,r)),o}finally{s.close()}}async function _a(e,t,n){const a=await ht(e,t,n,Math.max(t.width,t.height));return fa(await va(a),"image/png")}async function Wr(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 Sa(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 jr(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 qr({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(Q=>Q.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 ma(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 Ma({...n,images:k},a,m.images):[]}catch(w){throw new O("burn",ie(w))}if(m.framePromptBytes.reduce((w,M)=>w+(M??0),0)>Fn)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 Re=n?await pt(i):null;if(u(),n&&(e!==be||Re?.chiefAttachments)){const w=await la({workspaceId:e,binding:i,images:k.map((M,Q)=>{const X=a.find(Et=>Et.id===M.contextItemId);return{image:M,signature:Gt(n,M.id),composite:{base64:v[Q].data,mimeType:v[Q].mimeType},raw:!M.media&&X?.imageData&&X.imageMimeType?{base64:X.imageData,mimeType:X.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?Xe(n).map(({n:w,mark:M})=>[M.id,w]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:g}:p&&{...p,markNumbers:g},L=n&&D?{...s,imageBlocks:[...C,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Jt(_,D),m.metadata.length?`[Edited capture outputs]
|
|
3
3
|
${JSON.stringify(m.metadata)}`:"",s.workspaceContextStr].filter(Boolean).join(`
|
|
4
4
|
|
|
5
5
|
`),messageMetadata:{...s.messageMetadata,...Yt(_,D),edited_captures:m.metadata}}:s;return u(),L}async function Ma(e,t,n={}){const a=Xe(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 _a({base64:s.imageData,mimeType:s.imageMimeType},r,a.filter(({mark:o})=>o.imageId===r.id));return{type:"image",data:i.base64,mimeType:i.mimeType}}))}const Aa="intent.dock.captureEditorPreview";function Vr(){try{return et()&&localStorage.getItem(Aa)==="1"}catch{return!1}}function zr(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=Qt(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 Gr(e){if(!et())return{ok:!1,error:"unavailable"};try{return await sn().invoke(rn.OPEN,e)??{ok:!1,error:"unavailable"}}catch{return{ok:!1,error:"transport"}}}function Yr(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 Jr(e={}){const t=a=>_n(a,typeof e=="function"?e():e),n=a=>wn(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 Qr(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 Ia(e){try{return new URL(e.pageUrl).hostname||e.pageUrl}catch{return e.pageUrl}}function Xr(e,t){return e.targetAgentId===t}function Zr(e){const t=e.element,n=e.viewport,a=Ia(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(`
|
|
@@ -8,4 +8,4 @@ ${JSON.stringify(m.metadata)}`:"",s.workspaceContextStr].filter(Boolean).join(`
|
|
|
8
8
|
\`\`\`
|
|
9
9
|
${i}
|
|
10
10
|
\`\`\`]`)}return Ta(a.join(`
|
|
11
|
-
`),e)}function es(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}=Ea(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:Ca(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 Da="chat-read:",K=new Map,ye=new Set;function ts(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(t)}function ns(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 as(e){return ye.add(e),()=>ye.delete(e)}function rs(e){return K.has(e)}function ss(e){const t=K.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Da))return!0;return!1}function xa(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!Ye(a.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(Lt(t,r));const s=e.state.pendingSubmissions.byAgentId[t.agentId];return s&&x(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=Ue(e.state);if(!s||!i||!o)return null;const l=In(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&&Ue(e.state)===o;if(!d())return null;e.dispatch(Ut(c,a,Pt.select(e.state,n)));const u=xa(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ye(h.scope,c)&&(!!x(h.operations,u.id)||!!x(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??Tn();return Ra(e,t,n.wsId,pe.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&Bt.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Pa(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 Ba(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&&Ge.select(A.state,e)===n?hn.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=x(o.tombstones,s.id);return x(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([En(e,t).catch(()=>{}),Cn(e,t).catch(()=>{})]);const c=i();if(!c||x(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./BduWPjcR.js").then(m=>m.C);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]),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||x(p.submissions,s.id)?.status!=="uncertain"||Pa(A,e,l)}},cancel:{label:b.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function is(e,t,n){const a=Ge.select(A.state,e),r=a?.submission?await Ba(e,t,a,n):"legacy";if(r){if(r==="legacy"){await A.dispatch(n===void 0?Nt(e,t):Ht(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 os=A.createSelector((e,t)=>{const n=x(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:Qe(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Oa(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==ke.Deleted&&!t.notificationsMuted&&Kt(t)==="topLevel"}function $a(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!Rn(e.metadata,t)?t:null}function Ua(e){return e.status===ke.Error&&!Ot($t(e))}function cs(e,t){return t.filter(n=>Oa(e,n)).flatMap(n=>{const a=Ft(n),r=$a(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:Ua(n)}]})}function ls(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 ds(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=bn(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 us(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 ms(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const ps=A.createSelector(e=>e.homeIntegrations),fs=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=>Qe(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})))),hs=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}),gs=A.createSelector(e=>gt.select(e).map(t=>t.url));let ee=null;function ys(e){return ee=e,()=>{ee===e&&(ee=null)}}function ws(){return ee}function bs(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 ks(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 vs(e){return te=e,()=>{te===e&&(te=null)}}function _s(){return te}function Ss(e){return An(e)}function La(e){return Mn(e)}function Na(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||!Na(n.date,r))&&(n={date:r,label:La(r),messages:[]},t.push(n)),n.messages.push(a)}return t}function Ms(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 As(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"&&!Bn(s)&&(a=s);return n}function Ha(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function je(e,t){const n=new Map;return e.map(a=>{const r=`${t}-${Ha(a.date)}`,s=(n.get(r)??0)+1;return n.set(r,s),{...a,groupKey:s===1?r:`${r}-${s}`}})}function Fa(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 Is(e,t,n){return e=Fa(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 Ts(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 Es=300;function Cs(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,Ka=320;function Ee(e){return Number.isFinite(e)?Math.min(Ka,Math.max(qe,e)):qe}const Wa=.2,ja=.12;function qa(e,t,n=Wa){const a=Ee(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function Ds(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 xs(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:r,currentSpacerHeight:s,viewportHeight:i}=e;let o=e.rowHeightEma;n>0&&r>0&&(o=qa(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*ja||i>0&&u>i?{spacerHeight:d,rowHeightEma:o,applied:!0,scrollTopDelta:d-s}:{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const Va=Pn,za=2;function Rs(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=Va,nearPages:s=za}=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,Ga=1;function Ps(e,t,n=yt){const a=t.timestamp-n;return[...e.filter(r=>r.timestamp>=a),t]}function Bs(e){const{samples:t,viewportHeight:n,windowMs:a=yt,viewportFactor:r=Ga}=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 Os(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 $s(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 Us(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:r,totalMessages:s}=e;return t?!0:n>0?!1:!r&&s<=a}const Ya="intent.drafts.sync",Ja="intent.drafts.changed",Qa=$({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:On().optional()}),wt=$({text:E(),attachments:$n(Qa)}),z={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};Un("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 Za(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 U=null;async function Ls(e,t,n,a,r){const s=U;if(!s)throw new Error("draft-shared-transport-unavailable");const i=()=>{if(U!==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 Ns(e,t){await Promise.resolve(),U&&await U.flush(e,t)}function Hs(){if(!Sn())return null;const e=Za({request:n=>vn(Ya,n),subscribe:n=>kn(a=>{a.method===Ja&&n(a.params)})},()=>Dn(A.state),()=>xn(A.state));U=e;const t=e.dispose;return e.dispose=()=>{U===e&&(U=null),t()},e}const kt=new Map;function vt(e,t){return`${e}\0${t}`}function Fs(e,t){return kt.get(vt(e,t))}function Ks(e,t,n){kt.set(vt(e,t),n)}const Ws=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.userMessageIndexes,n):void 0}),js=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.retryAgents,n):void 0});function er(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 qs(e){return er(Math.max(1e3,Math.round(e/1e3)*1e3))}const tr=new Set(["launch","init","session-create","session-load","prompt"]),nr=new Set(["tool-call","tool-waiting"]);function ar(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Vs(e){return e&&tr.has(e)?"pulse":e&&nr.has(e)?"twist":"bloom"}const _t="stalled";function zs(e,t){const n=ar(e);return!n||n.phase!==_t||typeof t=="number"&&t>n.timestamp?null:n}function Gs(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()}};function Ys(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:e,detail:null}:null}const Js=A.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Qs=A.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),Xs=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}}),Zs=A.createSelector((e,t)=>x(e.questionUi.consumers,t)),rr=3e4,Y=new Map;function ei(e,t){const n=Y.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>Y.delete(e),rr);Y.set(e,{value:t,timer:a})}function ti(e){const t=Y.get(e);if(t)return clearTimeout(t.timer),Y.delete(e),t.value}const St=A.createSelector((e,t,n)=>e.agentWorkers?.byKey[jt(t,n)]??Wt),sr=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"&&sr.select(e,t,n).length>0}),ir=1e3,Mt={requireViewedAndFocused:!0,requireAssistantTail:!0},J=new Map,R=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const or=200;function cr(e,t){if(R.delete(e),R.set(e,t),R.size>or){const n=R.keys().next().value;n!==void 0&&R.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&&(J.has(e)||(W=null,xe(e,Mt)))}function ci(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),xe(t,{requireViewedAndFocused:!1}))}function It(e){const t=J.get(e);t&&(clearTimeout(t.timer),J.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{J.delete(e),xe(e,t)},ir);J.set(e,{timer:n,gates:t})}let ze=null;function lr(){return ze??=Promise.all([fe(()=>import("./CGVLIZz9.js"),__vite__mapDeps([38,17,18,3,19,20,5,7,4,21,13,2,39,40]),import.meta.url),fe(()=>import("./DfBE7crq.js").then(e=>e.p),__vite__mapDeps([41,36,4,3,17,18,19,20,5,7,21,13,2,9,6,8,10,11,12,14,32,31,42,28,35]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),ze}async function xe(e,t){let n=null;try{const{appStore:a,appClient:r}=await lr(),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(R.get(e)===c)return;cr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&R.get(e)===n&&R.delete(e)}catch{n!==null&&R.get(e)===n&&R.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{bs as $,Br as A,zr as B,Kr as C,O as D,Fa as E,jr as F,Ea as G,Da as H,Gn as I,Ns as J,qs as K,Ss as L,ir as M,zs as N,Es as O,li as P,Fs as Q,yt as R,_s as S,cs as T,ws as U,qe as V,ls as W,Gs as X,Vs as Y,rs as Z,ss as _,ts as a,Lr as a0,na as a1,As as a2,Ur as a3,Us as a4,G as a5,Hr as a6,Nr as a7,xr as a8,Os as a9,St as aA,ni as aB,os as aC,Qs as aD,Xs as aE,Js as aF,ps as aG,hs as aH,fs as aI,gs as aJ,gt as aK,Zs as aL,js as aM,Ws as aN,di as aO,Ks as aP,Ts as aQ,$r as aR,ms as aS,$s as aT,ei as aU,ks as aV,Pa as aW,ti as aX,aa as aY,Or as aZ,ci as aa,oi as ab,ri as ac,si as ad,ii as ae,ai as af,Cs as ag,as as ah,Gr as ai,Hn as aj,Ls as ak,Fr as al,es as am,qr as an,Ba as ao,pt as ap,Rr as aq,vs as ar,xs as as,ys as at,ns as au,Ce as av,is as aw,Cr as ax,Ds as ay,sr as az,we as b,Ps as c,Xr as d,Zr as e,Ms as f,Pr as g,Ca as h,Dr as i,sa as j,ra as k,Bs as l,Rs as m,ui as n,us as o,Is as p,Qr as q,Jr as r,Wr as s,Hs as t,Yr as u,Ys as v,ds as w,Vr as x,ge as y,qn as z};
|
|
11
|
+
`),e)}function es(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}=Ea(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:Ca(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 Da="chat-read:",K=new Map,ye=new Set;function ts(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(t)}function ns(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 as(e){return ye.add(e),()=>ye.delete(e)}function rs(e){return K.has(e)}function ss(e){const t=K.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Da))return!0;return!1}function xa(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!Ye(a.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(Lt(t,r));const s=e.state.pendingSubmissions.byAgentId[t.agentId];return s&&x(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=Ue(e.state);if(!s||!i||!o)return null;const l=In(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&&Ue(e.state)===o;if(!d())return null;e.dispatch(Ut(c,a,Pt.select(e.state,n)));const u=xa(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ye(h.scope,c)&&(!!x(h.operations,u.id)||!!x(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??Tn();return Ra(e,t,n.wsId,pe.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&Bt.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Pa(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 Ba(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&&Ge.select(A.state,e)===n?hn.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=x(o.tombstones,s.id);return x(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([En(e,t).catch(()=>{}),Cn(e,t).catch(()=>{})]);const c=i();if(!c||x(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./BkLJcH_z.js").then(m=>m.C);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]),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||x(p.submissions,s.id)?.status!=="uncertain"||Pa(A,e,l)}},cancel:{label:b.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function is(e,t,n){const a=Ge.select(A.state,e),r=a?.submission?await Ba(e,t,a,n):"legacy";if(r){if(r==="legacy"){await A.dispatch(n===void 0?Nt(e,t):Ht(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 os=A.createSelector((e,t)=>{const n=x(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:Qe(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Oa(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==ke.Deleted&&!t.notificationsMuted&&Kt(t)==="topLevel"}function $a(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!Rn(e.metadata,t)?t:null}function Ua(e){return e.status===ke.Error&&!Ot($t(e))}function cs(e,t){return t.filter(n=>Oa(e,n)).flatMap(n=>{const a=Ft(n),r=$a(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:Ua(n)}]})}function ls(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 ds(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=bn(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 us(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 ms(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const ps=A.createSelector(e=>e.homeIntegrations),fs=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=>Qe(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})))),hs=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}),gs=A.createSelector(e=>gt.select(e).map(t=>t.url));let ee=null;function ys(e){return ee=e,()=>{ee===e&&(ee=null)}}function ws(){return ee}function bs(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 ks(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 vs(e){return te=e,()=>{te===e&&(te=null)}}function _s(){return te}function Ss(e){return An(e)}function La(e){return Mn(e)}function Na(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||!Na(n.date,r))&&(n={date:r,label:La(r),messages:[]},t.push(n)),n.messages.push(a)}return t}function Ms(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 As(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"&&!Bn(s)&&(a=s);return n}function Ha(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function je(e,t){const n=new Map;return e.map(a=>{const r=`${t}-${Ha(a.date)}`,s=(n.get(r)??0)+1;return n.set(r,s),{...a,groupKey:s===1?r:`${r}-${s}`}})}function Fa(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 Is(e,t,n){return e=Fa(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 Ts(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 Es=300;function Cs(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,Ka=320;function Ee(e){return Number.isFinite(e)?Math.min(Ka,Math.max(qe,e)):qe}const Wa=.2,ja=.12;function qa(e,t,n=Wa){const a=Ee(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function Ds(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 xs(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:r,currentSpacerHeight:s,viewportHeight:i}=e;let o=e.rowHeightEma;n>0&&r>0&&(o=qa(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*ja||i>0&&u>i?{spacerHeight:d,rowHeightEma:o,applied:!0,scrollTopDelta:d-s}:{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const Va=Pn,za=2;function Rs(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=Va,nearPages:s=za}=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,Ga=1;function Ps(e,t,n=yt){const a=t.timestamp-n;return[...e.filter(r=>r.timestamp>=a),t]}function Bs(e){const{samples:t,viewportHeight:n,windowMs:a=yt,viewportFactor:r=Ga}=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 Os(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 $s(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 Us(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:r,totalMessages:s}=e;return t?!0:n>0?!1:!r&&s<=a}const Ya="intent.drafts.sync",Ja="intent.drafts.changed",Qa=$({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:On().optional()}),wt=$({text:E(),attachments:$n(Qa)}),z={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};Un("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 Za(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 U=null;async function Ls(e,t,n,a,r){const s=U;if(!s)throw new Error("draft-shared-transport-unavailable");const i=()=>{if(U!==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 Ns(e,t){await Promise.resolve(),U&&await U.flush(e,t)}function Hs(){if(!Sn())return null;const e=Za({request:n=>vn(Ya,n),subscribe:n=>kn(a=>{a.method===Ja&&n(a.params)})},()=>Dn(A.state),()=>xn(A.state));U=e;const t=e.dispose;return e.dispose=()=>{U===e&&(U=null),t()},e}const kt=new Map;function vt(e,t){return`${e}\0${t}`}function Fs(e,t){return kt.get(vt(e,t))}function Ks(e,t,n){kt.set(vt(e,t),n)}const Ws=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.userMessageIndexes,n):void 0}),js=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.retryAgents,n):void 0});function er(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 qs(e){return er(Math.max(1e3,Math.round(e/1e3)*1e3))}const tr=new Set(["launch","init","session-create","session-load","prompt"]),nr=new Set(["tool-call","tool-waiting"]);function ar(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Vs(e){return e&&tr.has(e)?"pulse":e&&nr.has(e)?"twist":"bloom"}const _t="stalled";function zs(e,t){const n=ar(e);return!n||n.phase!==_t||typeof t=="number"&&t>n.timestamp?null:n}function Gs(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()}};function Ys(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:e,detail:null}:null}const Js=A.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Qs=A.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),Xs=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}}),Zs=A.createSelector((e,t)=>x(e.questionUi.consumers,t)),rr=3e4,Y=new Map;function ei(e,t){const n=Y.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>Y.delete(e),rr);Y.set(e,{value:t,timer:a})}function ti(e){const t=Y.get(e);if(t)return clearTimeout(t.timer),Y.delete(e),t.value}const St=A.createSelector((e,t,n)=>e.agentWorkers?.byKey[jt(t,n)]??Wt),sr=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"&&sr.select(e,t,n).length>0}),ir=1e3,Mt={requireViewedAndFocused:!0,requireAssistantTail:!0},J=new Map,R=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const or=200;function cr(e,t){if(R.delete(e),R.set(e,t),R.size>or){const n=R.keys().next().value;n!==void 0&&R.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&&(J.has(e)||(W=null,xe(e,Mt)))}function ci(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),xe(t,{requireViewedAndFocused:!1}))}function It(e){const t=J.get(e);t&&(clearTimeout(t.timer),J.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{J.delete(e),xe(e,t)},ir);J.set(e,{timer:n,gates:t})}let ze=null;function lr(){return ze??=Promise.all([fe(()=>import("./CGVLIZz9.js"),__vite__mapDeps([38,17,18,3,19,20,5,7,4,21,13,2,39,40]),import.meta.url),fe(()=>import("./DfBE7crq.js").then(e=>e.p),__vite__mapDeps([41,36,4,3,17,18,19,20,5,7,21,13,2,9,6,8,10,11,12,14,32,31,42,28,35]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),ze}async function xe(e,t){let n=null;try{const{appStore:a,appClient:r}=await lr(),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(R.get(e)===c)return;cr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&R.get(e)===n&&R.delete(e)}catch{n!==null&&R.get(e)===n&&R.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{bs as $,Br as A,zr as B,Kr as C,O as D,Fa as E,jr as F,Ea as G,Da as H,Gn as I,Ns as J,qs as K,Ss as L,ir as M,zs as N,Es as O,li as P,Fs as Q,yt as R,_s as S,cs as T,ws as U,qe as V,ls as W,Gs as X,Vs as Y,rs as Z,ss as _,ts as a,Lr as a0,na as a1,As as a2,Ur as a3,Us as a4,G as a5,Hr as a6,Nr as a7,xr as a8,Os as a9,St as aA,ni as aB,os as aC,Qs as aD,Xs as aE,Js as aF,ps as aG,hs as aH,fs as aI,gs as aJ,gt as aK,Zs as aL,js as aM,Ws as aN,di as aO,Ks as aP,Ts as aQ,$r as aR,ms as aS,$s as aT,ei as aU,ks as aV,Pa as aW,ti as aX,aa as aY,Or as aZ,ci as aa,oi as ab,ri as ac,si as ad,ii as ae,ai as af,Cs as ag,as as ah,Gr as ai,Hn as aj,Ls as ak,Fr as al,es as am,qr as an,Ba as ao,pt as ap,Rr as aq,vs as ar,xs as as,ys as at,ns as au,Ce as av,is as aw,Cr as ax,Ds as ay,sr as az,we as b,Ps as c,Xr as d,Zr as e,Ms as f,Pr as g,Ca as h,Dr as i,sa as j,ra as k,Bs as l,Rs as m,ui as n,us as o,Is as p,Qr as q,Jr as r,Wr as s,Hs as t,Yr as u,Ys as v,ds as w,Vr as x,ge as y,qn as z};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/
|
|
2
|
-
import{bo as v,t as Ht,bq as y,a_ as D,by as jt,b as Wt,br as Vf,bu as St,bs as oa,bt as _i,b7 as fl,ba as Kf,bl as Gf,bb as Jf,bm as Yf,a$ as Xf,b9 as Zf,b8 as Qf,b2 as $f,bf as ep,bg as tp,bk as rp,be as np,bn as ap,b0 as sp,b4 as op,bi as ip,bh as lp,b6 as cp,b5 as dp,b3 as up,bd as fp,bc as pp,bj as gp,b1 as vp,_ as mp}from"./Dso1_H3c.js";import{bI as hp,bj as Cs,aG as bp,bs as Ut,aD as e,a5 as I,bS as m,bA as w,W as d,bn as qt,c9 as u,aA as _,a7 as kt,ay as qe,be as nr,b$ as Rt,aC as xa,bl as R,b_ as k,bO as x,aB as S,bo as Es,ca as It,bH as M,bV as ye,br as Jr,bk as As,c0 as Xn,ai as Oa,cd as $a,aw as En,a as yp,aj as Lr,c7 as _p,c6 as pl,c5 as An,bf as Ks,bz as rd}from"./DYhIMPy1.js";import{G as Gs,I as xp,z as wp}from"./DCCFERAn.js";import{o as kp,i as Sp,u as ae,g as Fn,w as Pn,l as xn,j as lr,v as pt,I as Ps,n as Tt,p as Mr,q as Ip,s as Cp,m as Ep,x as Ap}from"./CnMdEUN9.js";import{s as ln}from"./BfNeIJAh.js";import{c as en}from"./B3KrGqdQ.js";import{I as Ko,t as ar,n as Pp,i as gl,u as vl}from"./Cl-7Au8R.js";import{b as mr}from"./BaIAhI85.js";import{i as nd,bv as Tp,cM as Rp,dG as Mp,ds as Lp,ax as Np,cv as Op,a2 as Dp,cS as Bp,dr as ms,aC as so,c3 as Fp,I as zp,a as Hp,a0 as ml,cY as jp,bT as Wp,M as Up,dm as qp,W as Vp,dx as Kp,af as Gp,at as Jp,g as Yp,u as Xp}from"./CArqGgyL.js";import{c as Zp}from"./D-62MVd3.js";import{k as ra,w as Qp,C as ad,c as $p,R as eg}from"./BuNYZSRv.js";import{f as yt,ap as Za,ai as tg,am as Go,bc as rg}from"./m5UczIQR.js";import{ao as ng,ab as hl,$ as ag,aD as sg,ac as og,h as ig,ad as lg,aW as cg,I as dg,R as ug,au as fg,ah as pg,a0 as gg,a as bl,av as vg,s as mg,n as hg,b0 as bg,m as yg,b2 as Jo,A as yl,ag as _g,b1 as xg,aq as sd,T as od,a7 as wg,a6 as _l,V as kg,L as xl}from"./
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/mEDFle3S.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/Dso1_H3c.js","/app/immutable/chunks/BfNeIJAh.js","/app/immutable/chunks/oJD7n1Ce.js","/app/immutable/chunks/Cl-7Au8R.js","/app/immutable/chunks/CnMdEUN9.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/Dk1_0x0Q.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/Bdtl8KA4.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/chunks/DCCFERAn.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/m5UczIQR.js","/app/immutable/chunks/B3KrGqdQ.js","/app/immutable/chunks/HZf189bi.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/C5vuxPIj.js","/app/immutable/chunks/BuxSPewv.js","/app/immutable/chunks/Az9OQ8Pw.js","/app/immutable/chunks/GY5YfSD1.js","/app/immutable/chunks/DAGiwOmW.js","/app/immutable/chunks/BAOVYkFF.js","/app/immutable/assets/menu-footer.Ck5GCpgU.css","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/CKJpktTE.js","/app/immutable/assets/dialog.BtQTVchw.css","/app/immutable/chunks/BsieX9dN.js","/app/immutable/assets/observe-overflow.CbDLK6fN.css","/app/immutable/chunks/D-v3doGL.js","/app/immutable/chunks/DCD7Mz5K.js","/app/immutable/chunks/9oNS7b_T.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/confirm.UE5obH5A.css","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/BeP4UORy.js","/app/immutable/chunks/DXNrmOAj.js","/app/immutable/chunks/C7Fm8r7x.js","/app/immutable/assets/SettingsPage.D8u26cHZ.css","/app/immutable/chunks/DxFUSFjo.js","/app/immutable/chunks/DuD0elPz.js","/app/immutable/chunks/CC7to1B5.js","/app/immutable/chunks/BuNYZSRv.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/BkLJcH_z.js","/app/immutable/chunks/CArqGgyL.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/Cxbk0QV6.js","/app/immutable/chunks/BfDRfZ1x.js","/app/immutable/chunks/D2laB2lQ.js","/app/immutable/chunks/CZ_kVWbN.js","/app/immutable/chunks/CIqnL4UD.js","/app/immutable/chunks/DXO_adPf.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/TvrcPonj.js","/app/immutable/chunks/C--Z5JHB.js","/app/immutable/chunks/BJGG6xS6.js","/app/immutable/chunks/CI96OvIs.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/B4OuSSm9.js","/app/immutable/assets/directory-picker-service.CzNEA6Ot.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bo as v,t as Ht,bq as y,a_ as D,by as jt,b as Wt,br as Vf,bu as St,bs as oa,bt as _i,b7 as fl,ba as Kf,bl as Gf,bb as Jf,bm as Yf,a$ as Xf,b9 as Zf,b8 as Qf,b2 as $f,bf as ep,bg as tp,bk as rp,be as np,bn as ap,b0 as sp,b4 as op,bi as ip,bh as lp,b6 as cp,b5 as dp,b3 as up,bd as fp,bc as pp,bj as gp,b1 as vp,_ as mp}from"./Dso1_H3c.js";import{bI as hp,bj as Cs,aG as bp,bs as Ut,aD as e,a5 as I,bS as m,bA as w,W as d,bn as qt,c9 as u,aA as _,a7 as kt,ay as qe,be as nr,b$ as Rt,aC as xa,bl as R,b_ as k,bO as x,aB as S,bo as Es,ca as It,bH as M,bV as ye,br as Jr,bk as As,c0 as Xn,ai as Oa,cd as $a,aw as En,a as yp,aj as Lr,c7 as _p,c6 as pl,c5 as An,bf as Ks,bz as rd}from"./DYhIMPy1.js";import{G as Gs,I as xp,z as wp}from"./DCCFERAn.js";import{o as kp,i as Sp,u as ae,g as Fn,w as Pn,l as xn,j as lr,v as pt,I as Ps,n as Tt,p as Mr,q as Ip,s as Cp,m as Ep,x as Ap}from"./CnMdEUN9.js";import{s as ln}from"./BfNeIJAh.js";import{c as en}from"./B3KrGqdQ.js";import{I as Ko,t as ar,n as Pp,i as gl,u as vl}from"./Cl-7Au8R.js";import{b as mr}from"./BaIAhI85.js";import{i as nd,bv as Tp,cM as Rp,dG as Mp,ds as Lp,ax as Np,cv as Op,a2 as Dp,cS as Bp,dr as ms,aC as so,c3 as Fp,I as zp,a as Hp,a0 as ml,cY as jp,bT as Wp,M as Up,dm as qp,W as Vp,dx as Kp,af as Gp,at as Jp,g as Yp,u as Xp}from"./CArqGgyL.js";import{c as Zp}from"./D-62MVd3.js";import{k as ra,w as Qp,C as ad,c as $p,R as eg}from"./BuNYZSRv.js";import{f as yt,ap as Za,ai as tg,am as Go,bc as rg}from"./m5UczIQR.js";import{ao as ng,ab as hl,$ as ag,aD as sg,ac as og,h as ig,ad as lg,aW as cg,I as dg,R as ug,au as fg,ah as pg,a0 as gg,a as bl,av as vg,s as mg,n as hg,b0 as bg,m as yg,b2 as Jo,A as yl,ag as _g,b1 as xg,aq as sd,T as od,a7 as wg,a6 as _l,V as kg,L as xl}from"./x67B9CPX.js";import{F as At,bf as Yo,bJ as Sg,am as Ig,aO as Cg,cK as Eg,bj as xi,bz as Ag,aE as id,aJ as wi,cZ as Js,a9 as Xo,cm as Pg,cb as Tg,ch as ki,cE as ld,bq as Rg,e as Mg,bZ as wl,c7 as Lg,ck as Ng,cV as cd,bT as kl,b6 as Io,bc as fs,aD as Og,ax as Zo,as as dd,ba as ud,bA as Dg,B as Bg,bt as Fg,a4 as fd,cf as zg,aj as pd,cM as gd,cI as Sl,aq as vd,aI as Il,_ as Hg,cu as jg,cT as Wg,aH as Ug,aZ as qg,bM as md,bl as Vg,c3 as Cl,al as hd,aw as Kg,a7 as Gg,a5 as Jg}from"./DAGiwOmW.js";import{c as bd}from"./ChTqQfQN.js";import{g as Yg}from"./C7Fm8r7x.js";import{Ik as Nt,bM as Xg,rQ as El,sq as Zg,J8 as Qg,Je as $g,g as yd,HZ as ev,nw as _d,nM as xd,nL as wd,np as oo,p$ as Si,xP as tv,uT as Hs,ua as Qo,uV as rv,ne as kd,Ip as nv,t5 as av,oz as Sd,rc as Ii,lX as Al,a2 as Pl,qI as sv,qE as ov,qJ as iv,qA as lv,qG as cv,uJ as dv,Ak as Id,Ao as Cd,nN as Tl,be as $o,GI as uv,HV as fv,h9 as pv,h8 as gv,nH as vv,vU as mv,vV as hv,vT as Rl,Bk as Jn,cr as bv,cf as yv,d0 as _v,d7 as xv,Au as wv}from"./Dk1_0x0Q.js";import{bH as kv,bQ as Sv,i as Iv,B as Cv,bT as Ev,ah as Av,aj as Pv,al as Tv,a5 as Rv,a4 as Mv}from"./CZ_kVWbN.js";import{n as Lv,m as Nv,v as ei,ck as Ov,M as Dv,ci as Bv,cb as Fv,aD as Ml,cd as zv,bM as ti,aN as Hv,s as jv,c as hs,d as ri,cf as Ed,cg as ni,bB as Wv,b6 as Uv,bQ as qv,bO as Vv,E as Kv,ce as Ll,bv as Gv,y as Jv}from"./BkLJcH_z.js";import{ch as Yv,cj as Xv,ci as Zv,b0 as Qv,a_ as $v,a$ as em,a3 as tm,ak as Os,aj as rm,az as Nl,aH as nm,ai as am,C as sm,i as om,E as js,cS as im,aV as Ol,cX as lm,af as cm,a7 as dm,r as um,p as fm,aE as pm,c_ as gm,cJ as vm,cC as mm,ct as hm,bR as bm}from"./MMlRGdRy.js";import{i as ym,I as es,c as Dl}from"./C5vuxPIj.js";import"./BuxSPewv.js";import{f as Bl,y as Fl,M as _m,n as xm,m as wm,z as Ad,x as ai,e as bs,W as ts,h as km}from"./mEDFle3S.js";import"./9oNS7b_T.js";import{b as Pd}from"./DuD0elPz.js";import"./CKJpktTE.js";import{z as Ci,P as Sm,p as Im,h as Cm,G as Em,l as Am,i as Pm,M as Tm,H as Rm,t as Ya,a as Mm,K as Lm,k as Nm,R as Om}from"./Az9OQ8Pw.js";import{t as ys,O as Dm,M as Bm,S as ya}from"./GY5YfSD1.js";import{a as Fm}from"./BAOVYkFF.js";import{C as si}from"./tO-hey33.js";import{aQ as zm,aY as Hm,aB as jm,b0 as Wm,aO as Um,aU as qm,a7 as ns,b3 as zl,aK as Vm,aR as Km,aX as Ei,aS as Ai,W as Co,aq as Gm,X as Jm,a_ as Ym,aJ as Xm,aT as Zm,aW as Qm,b6 as $m,b4 as eh,ay as Td,p as th,n as rh,aV as nh,_ as ah,ao as sh,aD as oh,z as ih,aC as lh,a8 as ch}from"./De1yQ4of.js";import{s as oi}from"./CTcbitCM.js";import{M as dh}from"./B-lr2mEf.js";import{s as uh,a as fh}from"./BsieX9dN.js";import{u as Pi,w as ph,v as io,I as gh,A as Hl,e as _s,d as _a,J as jl,c as vh,f as mh,g as Wl,i as hh,b as bh,o as Rd,j as yh,O as _h,x as xh,k as Md,S as wh,N as kh,q as Ul,p as Sh,n as ql,z as Ih,s as Ch}from"./DBdE3z4X.js";import{o as Vl,a as Kl,T as Eo,b as Eh}from"./DuoF8WPm.js";import{O as Ah,y as Ph,j as Th,h as Rh,R as Mh}from"./DfBE7crq.js";import{D as xs}from"./C043lRmr.js";import"./BzOameBd.js";import{C as na}from"./HB5uhQNm.js";import{M as Lh}from"./Do9Il6aW.js";import{g as Ti}from"./oJD7n1Ce.js";import{f as Gl}from"./C--Z5JHB.js";import{c as Ws}from"./C7wbrsvU.js";import{handleIntentLink as Nh}from"./DKxrs1sS.js";import{s as Oh,a as Dh,f as Bh,d as Fh,r as zh,h as Hh,w as ps,g as jh,W as Wh,H as Uh,c as qh,M as Ld}from"./BV0hRaXE.js";import{e as Vh,q as Kh}from"./CIqnL4UD.js";import{showAssistantContent as Gh}from"./DulGwXPf.js";import{o as Ys,c as Jh,n as Yh}from"./B4OuSSm9.js";import{p as Xh}from"./Oz6u8hl_.js";import{m as Zh}from"./-DqWFMjY.js";import{h as Ds}from"./k3FE0FJZ.js";import{i as Nd}from"./BfDRfZ1x.js";import{g as Qh,e as $h,f as eb,h as tb}from"./BvFAWM27.js";import{T as Ao}from"./RlWPb-l5.js";import"./DCD7Mz5K.js";import{i as rb,r as Jl}from"./BBH-BNcw.js";import{a as nb}from"./DxFUSFjo.js";import{a as ab}from"./BdWqymET.js";import{p as sb}from"./4seVPSlv.js";const ob="intent:inline-visual-draft";function cC(r,t){const n=t.title.replace(/\s+/g," ").trim(),a=JSON.stringify({inputs:t.inputs,results:t.results},null,2),s=(a.match(/`+/g)??[]).reduce((c,l)=>Math.max(c,l.length),0),o="`".repeat(Math.max(3,s+1));return`${r}${r?`
|
|
3
3
|
|
|
4
4
|
`:""}${n}
|
|
5
5
|
|
|
@@ -260,7 +260,7 @@ ${r.content}`:a.content=r.content,a):r.old_text!==void 0&&r.new_text!==void 0?(a
|
|
|
260
260
|
`,h0=["background","foreground","card","card-foreground","primary","primary-ink","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","border","input","ring","danger","danger-background","info","info-foreground","success","success-foreground","warning","warning-foreground","font-ui","font-code","text-body-size","text-body-line-height","text-body-weight","text-body-tracking","radius-small","radius-medium","radius-large","app-background","sidebar","sidebar-accent","agent-avatar-surface-active","agent-avatar-foreground","diagram-host-surface","diagram-canvas","diagram-label-surface","diagram-node-surface","diagram-node-hover-surface","diagram-node-outline","diagram-node-title","diagram-metadata","diagram-group-outline","diagram-connector","diagram-connector-hover","diagram-connector-muted","diagram-connector-inactive","diagram-connector-danger","diagram-connector-success","diagram-connector-warning","diagram-connector-active","diagram-accent","diagram-accent-foreground","diagram-node-radius","diagram-group-radius","diagram-connector-width","text-caption-size","text-caption-line-height","text-caption-weight","text-caption-tracking","text-body-strong-size","text-body-strong-line-height","text-body-strong-weight","text-body-strong-tracking","space-1","space-2","space-3","space-4","space-5","space-6","space-7","control-height-compact","control-height-small","control-height-medium","control-height-large","radius-full","spring-fast","spring-fast-exit","spring-fast-ease","spring-moderate","spring-moderate-exit","spring-moderate-ease","spring-slow","spring-slow-exit","spring-slow-ease","spring-exit-ease","motion-fast","motion-standard","motion-slow","ease-standard","ease-emphasized-out","motion-reduced"],jo=96,Bc=2e4,b0=480,ju=512,y0=["default-src 'none'","script-src 'unsafe-inline'","style-src 'unsafe-inline'","img-src data:","connect-src 'none'","font-src data:","media-src 'none'","object-src 'none'","frame-src 'none'","child-src 'none'","worker-src 'none'","manifest-src 'none'","base-uri 'none'","form-action 'none'"].join("; ");function _0(r,t,n,a,s,o){const c=new MessageChannel,l=MessagePort.prototype.postMessage.bind(c.port1);window.parent.postMessage({channel:r,type:"scroll-port"},"*",[c.port2]);const f=(E,z={})=>{window.parent.postMessage({channel:r,type:E,...z},"*")};let i=s?.state??null,p=null,g=!1;Object.defineProperty(window,"intentVisual",{configurable:!1,writable:!1,value:Object.freeze({get state(){return i},publish(E){try{if(!o(E))return!1;const z=JSON.parse(JSON.stringify(E));return i=z.state,p=z,g||(g=!0,requestAnimationFrame(()=>{g=!1,p&&f("snapshot",{snapshot:p}),p=null})),!0}catch{return!1}}})});let T=!1,b=-1,h=innerHeight,A=Number.NaN,P=0,B=0;const F=()=>{if(T=!1,!document.body)return;let E=Math.ceil(Math.max(document.body.scrollHeight,document.body.getBoundingClientRect().height));const z=innerHeight,J=E-z;if(z>h+1&&J>1&&Math.abs(J-A)<=1?P+=1:(z!==h||J<=1)&&(P=0),h=z,A=J,!B&&P>=3){B=Math.max(a,z);const Z="Page height follows the frame (vh units or height: 100%); frame height held.";console.warn(Z),f("layout",{message:Z})}B&&(E=Math.min(E,B)),E!==b&&(b=E,f("resize",{height:E}))},O=()=>{T||(T=!0,requestAnimationFrame(F))},N=E=>{if(!E||typeof E.dark!="boolean"||!E.variables)return;const z=document.documentElement;z.classList.toggle("dark",E.dark),z.style.colorScheme=E.dark?"dark":"light";const J=E.variables["--inline-html-root-font-size"];"--inline-html-root-font-size"in t.variables&&typeof J=="string"&&J.length<512&&z.style.setProperty("--inline-html-root-font-size",J);for(const Z of Object.keys(t.variables)){if(Z==="--inline-html-root-font-size")continue;const Q=E.variables[Z];typeof Q=="string"&&Q.length<512&&z.style.setProperty(Z,Q)}O()};window.addEventListener("message",E=>{E.source!==window.parent||!E.data||E.data.channel!==r||E.data.type==="theme"&&N(E.data.theme)});const U=E=>{if(E.defaultPrevented||!E.isTrusted||E.ctrlKey||E.metaKey||E.shiftKey||!E.deltaY||Math.abs(E.deltaX)>Math.abs(E.deltaY))return;const z=Q=>{const Ie=getComputedStyle(Q);if(Q!==document.scrollingElement&&!/^(auto|scroll|overlay)$/.test(Ie.overflowY)||/^(hidden|clip)$/.test(Ie.overflowY))return!1;const ce=Q.scrollHeight-Q.clientHeight;return ce>1&&(E.deltaY<0?Q.scrollTop>1:Q.scrollTop<ce-1)};if(E.composedPath().some(Q=>Q instanceof Element&&z(Q))||document.scrollingElement&&z(document.scrollingElement))return;const J=E.deltaMode===WheelEvent.DOM_DELTA_LINE?parseFloat(getComputedStyle(document.body).lineHeight)||16:E.deltaMode===WheelEvent.DOM_DELTA_PAGE?innerHeight:1,Z=Math.max(-n,Math.min(n,E.deltaY*J));Number.isFinite(Z)&&(E.preventDefault(),l({deltaY:Z}))};window.addEventListener("wheel",()=>{window.removeEventListener("wheel",U),window.addEventListener("wheel",U,{passive:!1})},{capture:!0,passive:!1}),window.addEventListener("error",E=>{E.message&&f("error",{message:E.message.slice(0,300)})}),window.addEventListener("unhandledrejection",E=>{const z=E.reason;f("error",{message:String(z instanceof Error?z.message:z).slice(0,300)})}),window.addEventListener("click",E=>{const z=E.target instanceof Element?E.target.closest("a, area"):null;if(!z)return;(z.getAttribute("href")??z.getAttribute("xlink:href"))?.startsWith("#")||E.preventDefault()},!0),window.addEventListener("submit",E=>E.preventDefault(),!0),N(t),window.addEventListener("DOMContentLoaded",()=>{new ResizeObserver(O).observe(document.body),new MutationObserver(O).observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),window.addEventListener("resize",O),document.addEventListener("load",O,!0),document.fonts.ready.then(O),f("ready"),O()},{once:!0})}function x0(r,t,n,a,s){const o=document.createElement("iframe");o.setAttribute("sandbox","allow-scripts"),o.setAttribute("referrerpolicy","no-referrer"),o.title=n,o.style.cssText="display:block;width:100%;height:100%;border:0;";let c;const l=f=>{const i=f.data?.deltaY;typeof i=="number"&&Number.isFinite(i)&&i!==0&&Math.abs(i)<=a&&window.parent.postMessage({channel:r,type:"wheel",deltaY:i},"*")};window.addEventListener("message",f=>{const i=f.data;if(!(!i||typeof i!="object"||i.channel!==r)){if(f.source===window.parent&&i.type==="theme"){o.contentWindow?.postMessage({channel:r,type:"theme",theme:i.theme},"*");return}if(!(f.source!==o.contentWindow||f.origin!=="null")){if(i.type==="scroll-port"&&!c&&f.ports.length===1){c=f.ports[0],c.onmessage=l;return}i.type==="resize"&&typeof i.height=="number"&&Number.isFinite(i.height)&&i.height>=0?window.parent.postMessage({channel:r,type:"resize",height:i.height},"*"):i.type==="ready"?window.parent.postMessage({channel:r,type:"ready"},"*"):(i.type==="error"||i.type==="layout")&&typeof i.message=="string"?window.parent.postMessage({channel:r,type:i.type,message:i.message.slice(0,300)},"*"):i.type==="snapshot"&&s(i.snapshot)&&window.parent.postMessage({channel:r,type:"snapshot",snapshot:i.snapshot},"*")}}}),window.addEventListener("DOMContentLoaded",()=>{o.srcdoc=t,document.body.append(o)},{once:!0})}function w0(r,t,n,a,s,o,c,l){const f=document.implementation.createHTMLDocument(""),i=f.createElement("template");i.innerHTML=n,f.body.append(i.content);const p=Z=>{Z.querySelectorAll("meta, base, link, iframe, frame, frameset, object, embed").forEach(Q=>Q.remove()),Z.querySelectorAll("template").forEach(Q=>p(Q.content)),Z.querySelectorAll("a, area").forEach(Q=>{for(const Ie of["href","xlink:href"])Q.getAttribute(Ie)?.startsWith("#")||Q.removeAttribute(Ie);Q.removeAttribute("target"),Q.removeAttribute("ping"),Q.removeAttribute("download")})};p(f);const g=Z=>JSON.stringify(Z).replace(/</g,"\\u003c"),T=f.createElement("meta");T.httpEquiv="Content-Security-Policy",T.content=r.csp;const b=f.createElement("meta");b.setAttribute("charset","utf-8");const h=f.createElement("style"),A=/^data:[\w.+/-]+;base64,[A-Za-z0-9+/=]+$/.test(l)?`@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900;
|
|
261
261
|
font-display: swap; src: url('${l}') format('woff2'); }`:"";h.textContent=`${A}${r.styles}`;const P=f.createElement("script"),B=g([a,s,r.maxScrollDelta,r.lockHeight,t(c)?c:null]);P.textContent=`(${r.bridge})(...${B}, (${r.validate}));`,f.head.prepend(T,b,h,P);const F=`<!doctype html>${f.documentElement.outerHTML}`,O=document.implementation.createHTMLDocument(""),N=O.createElement("meta");N.httpEquiv="Content-Security-Policy",N.content=r.csp.replace("frame-src 'none'","frame-src about:");const U=O.createElement("meta");U.setAttribute("charset","utf-8");const E=O.createElement("style");E.textContent="html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }";const z=O.createElement("script"),J=g([a,F,o,r.maxScrollDelta]);return z.textContent=`(${r.shell})(...${J}, (${r.validate}));`,O.head.prepend(N,U,E,z),`<!doctype html>${O.documentElement.outerHTML}`}const k0=()=>({csp:y0,styles:m0,maxScrollDelta:ju,lockHeight:b0,bridge:_0.toString(),shell:x0.toString(),validate:Ii.toString()});function S0(r,t,n,a,s=null,o=""){return w0(k0(),Ii,r,t,n,a,s,o)}function Fc(r){const t=getComputedStyle(r);return{dark:document.documentElement.classList.contains("dark"),variables:{...Object.fromEntries(h0.map(n=>[`--${n}`,t.getPropertyValue(`--${n}`).trim()])),"--inline-html-root-font-size":getComputedStyle(document.documentElement).fontSize}}}function I0(r,t,n,a,s=null){return S0(r,t,n,a,s,v0)}var C0=S('<p class="type-caption m-0 break-words px-4 pb-2 text-muted-foreground"> </p>'),E0=S('<div class="type-body flex items-center justify-between gap-3 px-4 py-2" role="status"><span class="text-danger"> </span> <!></div> <!>',1),A0=S('<p class="sr-only" role="status"> </p>'),P0=S('<p class="type-body m-0 px-4 py-3 text-muted-foreground" role="status"> </p>'),T0=S('<div class="type-body px-4 py-2 text-danger" role="status"><p class="m-0"> </p> <p class="type-code m-0 break-words"> </p></div>'),R0=S('<iframe sandbox="allow-scripts" referrerpolicy="no-referrer"></iframe>'),M0=S('<div class="space-y-4 p-4" aria-hidden="true"><div class="space-y-2"><!> <!></div> <!> <div class="flex items-center gap-4"><!> <!> <!></div></div>'),L0=S('<span class="type-caption ml-auto text-muted-foreground" role="status"> </span>'),N0=S('<p class="type-caption m-0 break-words px-4 pb-2 text-muted-foreground" role="status"> <!></p>'),O0=S('<th class="min-w-40 px-2 pb-3 align-top font-normal"><!> <div class="mt-1 flex gap-1"><!> <!></div></th>'),D0=S('<td class="max-w-56 px-2 py-2 align-top break-words tabular-nums"> </td>'),B0=S('<tr><th class="max-w-48 py-2 pr-4 align-top font-normal break-words text-muted-foreground"> </th><!></tr>'),F0=S('<div class="overflow-x-auto px-4 pb-4" data-inline-visual-comparison=""><table class="type-body w-full border-separate border-spacing-0 text-left"><thead><tr><th class="min-w-28 pr-4 pb-3 font-normal text-muted-foreground"> </th><th class="min-w-32 px-2 pb-3 align-top font-medium"> </th><!></tr></thead><tbody></tbody></table></div>'),z0=S('<div class="flex flex-wrap items-center gap-1 px-4 py-2" data-inline-visual-actions=""><!> <!> <!> <!> <!></div> <!> <!>',1),H0=S('<div data-inline-html="" class="my-3 min-w-0 overflow-hidden rounded-lg bg-background text-foreground"><div class="flex min-w-0 items-center justify-end gap-1 p-1"><!> <!></div> <!> <!> <div class="relative min-w-0"><!> <!></div> <!></div>');function Wu(r,t){if(new.target)return Ht({component:Wu,...r});Ut(t,!0);const n=720;let a=y(t,"source",7),s=y(t,"isStreaming",7,!1),o=y(t,"isComplete",7,!0),c=y(t,"record",7),l=y(t,"storageStatus",7,"ready"),f=y(t,"onRecordChange",7),i=y(t,"onUseConfiguration",7),p=y(t,"onExport",7),g=y(t,"onRetry",7),T=y(t,"storageError",7),b=y(t,"exportStatus",7),h=y(t,"exportPath",7),A=y(t,"exportError",7),P,B=ye(void 0),F=ye(!1),O=ye(!1),N=ye(0),U=ye(""),E=ye(""),z=ye(!1),J=ye(""),Z=ye(Jr(jo)),Q=ye(n),Ie=ye(""),ce=ye(Al()),oe=ye(void 0),ue,we=ye(void 0),G=ye(!1);const fe=u(()=>c()??e(ce)),ie=u(()=>l()!=="loading"&&(l()!=="error"||!!e(fe).current)),Ne=u(()=>!s()&&o()&&!!a().trim()&&e(ie)),Re=u(()=>Math.min(Bc,Math.max(jo,e(Z)))),ke=u(()=>s()||l()==="loading"?"loading":o()?a().trim()?e(J)?"error":e(z)?"ready":"loading":"empty":"incomplete"),_e=u(()=>s()||l()==="loading"||e(Ne)&&!e(z)&&!e(J));function je(X){const xe={...X,current:e(oe)??X.current};M(ce,xe),f()?.(xe)}function Ue(){const X=e(oe);!X||e(fe).scenarios.length>=Pl||(je({...e(fe),scenarios:[...e(fe).scenarios,{id:crypto.randomUUID(),name:rp({number:vl(e(fe).scenarios.length+1)}),snapshot:structuredClone(X)}]}),M(G,!0))}function le(X,xe){const Ke=xe.trim().slice(0,120);Ke&&je({...e(fe),scenarios:e(fe).scenarios.map(rt=>rt.id===X?{...rt,name:Ke}:rt)})}function $(X){const xe=structuredClone(X);M(oe,xe),M(we,xe),je({...e(fe),current:xe}),M(N,e(N)+1)}function Ze(X){return typeof X=="number"?vl(X):typeof X=="string"?X:JSON.stringify(X)}function V(){!e(B)?.contentWindow||!e(E)||e(B).contentWindow.postMessage({channel:e(E),type:"theme",theme:Fc(P)},"*")}function K(X){let xe=P.parentElement;for(;xe;){const Ke=getComputedStyle(xe),rt=xe.scrollHeight-xe.clientHeight;if(/^(auto|scroll|overlay)$/.test(Ke.overflowY)&&rt>1){if(X<0?xe.scrollTop>0:xe.scrollTop<rt){xe.dispatchEvent(new WheelEvent("wheel",{deltaY:X,bubbles:!0})),xe.scrollTop+=X;return}if(/^(contain|none)$/.test(Ke.overscrollBehaviorY))return}xe=xe.parentElement}window.scrollBy({top:X,behavior:"instant"})}It(()=>{if(!e(F))return;const X=a(),xe=e(Ne);e(N),An(()=>{ue!==X&&(M(ce,Al()),M(oe,void 0),M(G,!1),M(we,void 0),ue=X),M(z,!1),M(J,""),M(Ie,""),M(Z,jo,!0),M(E,crypto.randomUUID(),!0),M(U,xe?I0(X,e(E),Fc(P),fl(),e(we)??e(oe)??e(fe).current):"",!0),M(we,void 0)})}),As(()=>{M(F,!0);const X=ht=>{if(ht.source!==e(B)?.contentWindow||ht.origin!=="null")return;const We=ht.data;if(!(!We||typeof We!="object"||We.channel!==e(E)))if(We.type==="resize"&&typeof We.height=="number"&&Number.isFinite(We.height)&&We.height>=0)M(Z,Math.min(Bc,Math.ceil(We.height)),!0);else if(We.type==="ready")M(z,!0),V();else if(We.type==="error"&&typeof We.message=="string")M(J,We.message.slice(0,300),!0);else if(We.type==="layout"&&typeof We.message=="string")M(Ie,We.message.slice(0,300),!0);else if(We.type==="snapshot"&&e(Ne)&&Ii(We.snapshot)){const mt=We.snapshot;M(oe,mt),je({...e(fe),current:mt})}else We.type==="wheel"&&e(z)&&e(Ne)&&!e(O)&&!e(_e)&&typeof We.deltaY=="number"&&Number.isFinite(We.deltaY)&&We.deltaY!==0&&Math.abs(We.deltaY)<=ju&&K(We.deltaY)},xe=()=>{M(Q,Math.min(n,Math.max(160,Math.floor(window.innerHeight*.8))),!0)},Ke=new MutationObserver(V);Ke.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme"]});const rt=window.matchMedia("(prefers-color-scheme: dark)");return rt.addEventListener("change",V),window.addEventListener("message",X),window.addEventListener("resize",xe),xe(),()=>{Ke.disconnect(),rt.removeEventListener("change",V),window.removeEventListener("message",X),window.removeEventListener("resize",xe)}});var W={get source(){return a()},set source(X){a(X),_()},get isStreaming(){return s()},set isStreaming(X=!1){s(X),_()},get isComplete(){return o()},set isComplete(X=!0){o(X),_()},get record(){return c()},set record(X){c(X),_()},get storageStatus(){return l()},set storageStatus(X="ready"){l(X),_()},get onRecordChange(){return f()},set onRecordChange(X){f(X),_()},get onUseConfiguration(){return i()},set onUseConfiguration(X){i(X),_()},get onExport(){return p()},set onExport(X){p(X),_()},get onRetry(){return g()},set onRetry(X){g(X),_()},get storageError(){return T()},set storageError(X){T(X),_()},get exportStatus(){return b()},set exportStatus(X){b(X),_()},get exportPath(){return h()},set exportPath(X){h(X),_()},get exportError(){return A()},set exportError(X){A(X),_()},$set:jt,$on:(X,xe)=>Wt(t,X,xe)},se=H0(),Ce=I(se),Y=I(Ce);yt(Y,{variant:"ghost",size:"sm",get active(){return e(O)},get"aria-pressed"(){return e(O)},onclick:()=>{M(O,!e(O))},children:(X,xe)=>{nr();var Ke=Rt();k(rt=>x(Ke,rt),[()=>e(O)?Kf():Gf()]),d(X,Ke)},$$slots:{default:!0}});var de=m(Y,2);{let X=u(()=>!e(Ne));yt(de,{variant:"ghost",size:"sm",get disabled(){return e(X)},onclick:()=>{M(N,e(N)+1)},children:(xe,Ke)=>{nr();var rt=Rt();k(ht=>x(rt,ht),[()=>Jf()]),d(xe,rt)},$$slots:{default:!0}})}w(Ce);var Ae=m(Ce,2);{var He=X=>{var xe=E0(),Ke=qe(xe),rt=I(Ke),ht=R(rt,!0),We=m(rt,2);{var mt=dt=>{yt(dt,{variant:"ghost",size:"sm",get onclick(){return g()},children:(Gt,Ft)=>{nr();var Jt=Rt();k(xt=>x(Jt,xt),[()=>np()]),d(Gt,Jt)},$$slots:{default:!0}})};D(We,dt=>{g()&&dt(mt)})}w(Ke);var ot=m(Ke,2);{var it=dt=>{var Gt=C0(),Ft=R(Gt,!0);k(()=>x(Ft,T())),d(dt,Gt)};D(ot,dt=>{T()&&dt(it)})}k(dt=>x(ht,dt),[()=>Yf()]),d(X,xe)};D(Ae,X=>{l()==="error"&&X(He)})}var tt=m(Ae,2);{var ge=X=>{var xe=A0(),Ke=R(xe,!0);k(rt=>x(Ke,rt),[()=>s()?Xf():Zf()]),d(X,xe)},Oe=X=>{var xe=P0(),Ke=R(xe,!0);k(rt=>x(Ke,rt),[()=>o()?$f():Qf()]),d(X,xe)},q=X=>{var xe=T0(),Ke=I(xe),rt=R(Ke,!0),ht=m(Ke,2),We=R(ht,!0);w(xe),k(mt=>{x(rt,mt),x(We,e(J))},[()=>ep()]),d(X,xe)};D(tt,X=>{e(_e)?X(ge):e(Ne)?e(J)&&X(q,2):X(Oe,1)})}var Me=m(tt,2),ve=I(Me);{var L=X=>{var xe=R0();let Ke,rt;mr(xe,ht=>M(B,ht),()=>e(B)),k(ht=>{ae(xe,"title",ht),ae(xe,"srcdoc",e(U)),Ke=pt(xe,1,"block w-full border-0 svelte-1kkow1d",null,Ke,{"preview-hidden":e(O)||e(_e)}),ae(xe,"aria-hidden",e(O)||e(_e)),rt=Pn(xe,"",rt,{height:`${e(Re)}px`})},[()=>fl()]),d(X,xe)};D(ve,X=>{e(Ne)&&e(U)&&X(L)})}var H=m(ve,2);{var me=X=>{na(X,{get code(){return a()},language:"html",noBorder:!0,noMargin:!0,get maxHeight(){return e(Q)}})},$e=X=>{var xe=M0(),Ke=I(xe),rt=I(Ke);Ya(rt,{class:"h-4 w-32 max-w-1/2"});var ht=m(rt,2);Ya(ht,{class:"h-3 w-2/3"}),w(Ke);var We=m(Ke,2);Ya(We,{class:"aspect-video max-h-60 w-full rounded-lg"});var mt=m(We,2),ot=I(mt);Ya(ot,{class:"h-3 w-16"});var it=m(ot,2);Ya(it,{class:"h-2 min-w-0 flex-1"});var dt=m(it,2);Ya(dt,{class:"h-3 w-10"}),w(mt),w(xe),d(X,xe)};D(H,X=>{e(O)?X(me):e(_e)&&X($e,1)})}w(Me);var Pe=m(Me,2);{var ze=X=>{var xe=z0(),Ke=qe(xe),rt=I(Ke);{var ht=Ct=>{{let Yt=u(()=>!e(z)||!!e(J));yt(Ct,{size:"sm",get disabled(){return e(Yt)},onclick:()=>e(oe)&&i()(e(oe)),children:(Mt,be)=>{nr();var re=Rt();k(Ve=>x(re,Ve),[()=>ap()]),d(Mt,re)},$$slots:{default:!0}})}};D(rt,Ct=>{i()&&Ct(ht)})}var We=m(rt,2);{let Ct=u(()=>!e(z)||!!e(J)||e(fe).scenarios.length>=Pl);yt(We,{variant:"ghost",size:"sm",get disabled(){return e(Ct)},onclick:Ue,children:(Yt,Mt)=>{nr();var be=Rt();k(re=>x(be,re),[()=>tp()]),d(Yt,be)},$$slots:{default:!0}})}var mt=m(We,2);{var ot=Ct=>{yt(Ct,{variant:"ghost",size:"sm",get active(){return e(G)},get"aria-expanded"(){return e(G)},onclick:()=>M(G,!e(G)),children:(Yt,Mt)=>{nr();var be=Rt();k(re=>x(be,re),[()=>sp()]),d(Yt,be)},$$slots:{default:!0}})};D(mt,Ct=>{e(fe).scenarios.length&&Ct(ot)})}var it=m(mt,2);{var dt=Ct=>{{let Yt=u(()=>!e(z)||b()==="saving");yt(Ct,{variant:"ghost",size:"sm",get disabled(){return e(Yt)},onclick:()=>p()({...e(fe),current:e(oe)??null}),children:(Mt,be)=>{nr();var re=Rt();k(Ve=>x(re,Ve),[()=>op()]),d(Mt,re)},$$slots:{default:!0}})}};D(it,Ct=>{p()&&Ct(dt)})}var Gt=m(it,2);{var Ft=Ct=>{var Yt=L0(),Mt=R(Yt,!0);k(be=>x(Mt,be),[()=>l()==="saving"?ip():l()==="ready"?lp():""]),d(Ct,Yt)};D(Gt,Ct=>{f()&&Ct(Ft)})}w(Ke);var Jt=m(Ke,2);{var xt=Ct=>{var Yt=N0(),Mt=I(Yt),be=m(Mt);{var re=Ve=>{var lt=Rt();k(()=>x(lt,A())),d(Ve,lt)};D(be,Ve=>{b()==="error"&&A()&&Ve(re)})}w(Yt),k(Ve=>x(Mt,`${Ve??""} `),[()=>b()==="saving"?cp():b()==="saved"?dp({path:h()??""}):up()]),d(Ct,Yt)};D(Jt,Ct=>{b()&&Ct(xt)})}var Vt=m(Jt,2);{var Kt=Ct=>{var Yt=F0(),Mt=I(Yt),be=I(Mt),re=I(be),Ve=I(re),lt=R(Ve,!0),ct=m(Ve),De=R(ct,!0),ne=m(ct);Tt(ne,17,()=>e(fe).scenarios,te=>te.id,(te,Ee)=>{var Se=O0(),Xe=I(Se);{let Te=u(()=>gp());es(Xe,{get value(){return e(Ee).name},get"aria-label"(){return e(Te)},maxlength:120,onblur:Ye=>{Ye.currentTarget.value.trim()||(Ye.currentTarget.value=e(Ee).name),le(e(Ee).id,Ye.currentTarget.value)},onkeydown:Ye=>{Ye.key==="Enter"&&Ye.currentTarget.blur(),Ye.key==="Escape"&&(Ye.currentTarget.value=e(Ee).name,Ye.currentTarget.blur())}})}var Fe=m(Xe,2),Ge=I(Fe);yt(Ge,{variant:"ghost",size:"sm",onclick:()=>$(e(Ee).snapshot),children:(Te,Ye)=>{nr();var Be=Rt();k(et=>x(Be,et),[()=>fp()]),d(Te,Be)},$$slots:{default:!0}});var Qe=m(Ge,2);yt(Qe,{variant:"ghost",size:"sm",onclick:()=>je({...e(fe),scenarios:e(fe).scenarios.filter(Te=>Te.id!==e(Ee).id)}),children:(Te,Ye)=>{nr();var Be=Rt();k(et=>x(Be,et),[()=>pp()]),d(Te,Be)},$$slots:{default:!0}}),w(Fe),w(Se),d(te,Se)}),w(re),w(be);var pe=m(be);Tt(pe,20,()=>["inputs","results"],Mr,(te,Ee)=>{const Se=u(()=>Ee),Xe=u(()=>Array.from(new Set([...Object.keys(e(oe)[e(Se)]),...e(fe).scenarios.flatMap(Qe=>Object.keys(Qe.snapshot[e(Se)]))])));var Fe=kt(),Ge=qe(Fe);Tt(Ge,16,()=>e(Xe),Qe=>Qe,(Qe,Te)=>{var Ye=B0(),Be=I(Ye),et=R(Be,!0),ft=m(Be);Tt(ft,17,()=>[e(oe),...e(fe).scenarios.map(st=>st.snapshot)],Mr,(st,nt)=>{var _t=D0(),vt=R(_t,!0);k(Ot=>x(vt,Ot),[()=>Object.hasOwn(e(nt)[e(Se)],Te)?Ze(e(nt)[e(Se)][Te]):"—"]),d(st,_t)}),w(Ye),k(()=>x(et,Te)),d(Qe,Ye)}),d(te,Fe)}),w(pe),w(Mt),w(Yt),k(te=>{x(lt,e(oe).title),x(De,te)},[()=>vp()]),d(Ct,Yt)};D(Vt,Ct=>{e(G)&&e(fe).scenarios.length&&Ct(Kt)})}d(X,xe)};D(Pe,X=>{e(oe)&&e(Ne)&&X(ze)})}return w(se),mr(se,X=>P=X,()=>P),k(()=>{ae(se,"data-inline-html-status",e(ke)),ae(se,"data-inline-html-layout",e(Ie)?"viewport-locked":void 0),ae(se,"aria-busy",e(_e))}),d(r,se),qt(W)}var j0=S('<div class="w-full min-w-0"><!></div>');function W0(r,t){if(new.target)return Ht({component:W0,...r});Ut(t,!0);const n=()=>St(e(b),"$agent$",s),a=()=>St(e(B),"$entry$",s),[s,o]=oa();let c=y(t,"block",7),l=y(t,"role",7),f=y(t,"workspaceId",7),i=y(t,"agentId",7),p=y(t,"messageId",7),g=y(t,"contentBlockKey",7,""),T=ye(void 0);const b=u(()=>so(i()??"")),h=u(()=>l()==="assistant"&&f()&&i()&&p()&&c().metadata?.fenceClosed&&!c().metadata?.isStreaming&&n()&&!Sd(n())?{workspaceId:f(),agentId:i(),messageId:p(),blockKey:JSON.stringify([g(),c().metadata?.fenceStart??0]),source:c().content}:void 0),A=u(()=>!!(f()&&i()&&p()&&c().metadata?.fenceClosed&&!n())),P=u(()=>e(h)?cv(e(h)):""),B=u(()=>Um(e(P)));It(()=>{e(h)&&Nt.dispatch(sv(e(h)))});function F(Z){!f()||!i()||n()?.retiredAt||e(T)?.dispatchEvent(new CustomEvent(ob,{bubbles:!0,detail:{workspaceId:f(),agentId:i(),snapshot:Z}}))}var O={get block(){return c()},set block(Z){c(Z),_()},get role(){return l()},set role(Z){l(Z),_()},get workspaceId(){return f()},set workspaceId(Z){f(Z),_()},get agentId(){return i()},set agentId(Z){i(Z),_()},get messageId(){return p()},set messageId(Z){p(Z),_()},get contentBlockKey(){return g()},set contentBlockKey(Z=""){g(Z),_()},$set:jt,$on:(Z,Q)=>Wt(t,Z,Q)},N=kt(),U=qe(N);{var E=Z=>{var Q=j0(),Ie=I(Q);{let ce=u(()=>c().metadata?.isStreaming??!1),oe=u(()=>c().metadata?.fenceClosed??!1),ue=u(()=>a()?.record),we=u(()=>e(h)?a()?.status??"loading":e(A)?"loading":"ready"),G=u(()=>a()?.error),fe=u(()=>e(h)?Ue=>Nt.dispatch(lv(e(P),Ue)):void 0),ie=u(()=>f()&&i()&&n()&&!n().retiredAt?F:void 0),Ne=u(()=>e(h)?()=>Nt.dispatch(iv(e(P))):void 0),Re=u(()=>e(h)?Ue=>Nt.dispatch(ov(e(P),crypto.randomUUID(),Ue)):void 0),ke=u(()=>a()?.export?.status),_e=u(()=>a()?.export?.path),je=u(()=>a()?.export?.error);Wu(Ie,{get source(){return c().content},get isStreaming(){return e(ce)},get isComplete(){return e(oe)},get record(){return e(ue)},get storageStatus(){return e(we)},get storageError(){return e(G)},get onRecordChange(){return e(fe)},get onUseConfiguration(){return e(ie)},get onRetry(){return e(Ne)},get onExport(){return e(Re)},get exportStatus(){return e(ke)},get exportPath(){return e(_e)},get exportError(){return e(je)}})}w(Q),mr(Q,ce=>M(T,ce),()=>e(T)),d(Z,Q)},z=Z=>{na(Z,{get code(){return c().content},language:"html"})};D(U,Z=>{l()==="assistant"?Z(E):Z(z,-1)})}d(r,N);var J=qt(O);return o(),J}var U0=S('<div class="digest-card flex items-start gap-2.5 py-5 px-6 my-4 shadow-xs text-base leading-normal border border-border"> </div>');function q0(r,t){if(new.target)return Ht({component:q0,...r});Ut(t,!0);let n=y(t,"digest",7);var a={get digest(){return n()},set digest(c){n(c),_()},$set:jt,$on:(c,l)=>Wt(t,c,l)},s=U0(),o=R(s,!0);return k(()=>x(o,n())),d(r,s),qt(a)}var V0=S('<span class="inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-blue-500/15 text-blue-600 dark:text-blue-400"> </span>'),K0=S('<span class="inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-muted text-muted-foreground"> </span>'),G0=S('<span class="inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-primary/10 text-primary/80"> </span>'),J0=S('<div class="flex items-start gap-3 px-4 py-2.5"><div class="flex-1 min-w-0"><div class="flex items-center gap-2 flex-wrap"><span class="text-sm font-semibold text-foreground"> </span> <!> <!></div> <div class="mt-0.5 text-xs font-mono text-muted-foreground truncate"> </div></div></div>'),Y0=S('<div class="detected-scripts-card my-3 rounded-lg border border-border bg-muted/30 overflow-hidden"><div class="flex items-center gap-2 px-4 py-2.5 border-b border-border bg-muted/40"><!> <span class="text-sm font-semibold text-foreground"> </span></div> <div class="divide-y divide-border"></div> <div class="px-4 py-2 border-t border-border bg-muted/20"><span class="text-xs text-muted-foreground"> </span></div></div>');function X0(r,t){if(new.target)return Ht({component:X0,...r});Ut(t,!0);let n=y(t,"scripts",7);var a={get scripts(){return n()},set scripts(b){n(b),_()},$set:jt,$on:(b,h)=>Wt(t,b,h)},s=Y0(),o=I(s),c=I(o);At(c,{get icon(){return cd},size:"sm",class:"text-primary-ink/70"});var l=m(c,2),f=R(l,!0);w(o);var i=m(o,2);Tt(i,21,n,b=>b.name+b.command,(b,h)=>{var A=J0(),P=I(A),B=I(P),F=I(B),O=R(F,!0),N=m(F,2);{var U=Ie=>{var ce=V0(),oe=R(ce,!0);k(ue=>x(oe,ue),[()=>v.chat_detectedScripts_service_badge()]),d(Ie,ce)},E=Ie=>{var ce=K0(),oe=R(ce,!0);k(ue=>x(oe,ue),[()=>v.chat_detectedScripts_command_badge()]),d(Ie,ce)};D(N,Ie=>{e(h).mode==="service"?Ie(U):Ie(E,-1)})}var z=m(N,2);{var J=Ie=>{var ce=G0(),oe=R(ce,!0);k(()=>x(oe,e(h).category)),d(Ie,ce)};D(z,Ie=>{e(h).category&&e(h).category!=="other"&&Ie(J)})}w(B);var Z=m(B,2),Q=R(Z,!0);w(P),w(A),k(()=>{x(O,e(h).name),x(Q,e(h).command)}),d(b,A)}),w(i);var p=m(i,2),g=I(p),T=R(g,!0);return w(p),w(s),k((b,h)=>{x(f,b),x(T,h)},[()=>v.chat_detectedScripts_title(),()=>n().length===1?v.chat_detectedScripts_count_one({count:ar(n().length)}):v.chat_detectedScripts_count_many({count:ar(n().length)})]),d(r,s),qt(a)}function Z0(r,t){if(new.target)return Ht({component:Z0,...r});Ut(t,!0);let n=y(t,"diff",7),a=y(t,"filePath",7),s=y(t,"language",7),o=y(t,"onApply",7),c=y(t,"onReject",7);function l(){o()?.(),ra.success(v.chat_diffViewer_applied_toast())}function f(){c()?.(),ra.info(v.chat_diffViewer_rejected_toast())}const i=u(()=>{const g=[];return o()&&g.push({label:v.chat_diffViewer_apply_label(),variant:"success",onClick:l}),c()&&g.push({label:v.chat_diffViewer_reject_label(),variant:"danger",onClick:f}),g});var p={get diff(){return n()},set diff(g){n(g),_()},get filePath(){return a()},set filePath(g){a(g),_()},get language(){return s()},set language(g){s(g),_()},get onApply(){return o()},set onApply(g){o(g),_()},get onReject(){return c()},set onReject(g){c(g),_()},$set:jt,$on:(g,T)=>Wt(t,g,T)};{let g=u(()=>a()||v.chat_diffViewer_suggestedChanges_fallback());xs(r,{get patch(){return n()},get fileName(){return e(g)},get language(){return s()},get actions(){return e(i)},collapsible:!0,initialCollapsed:!1,maxHeight:"500px"})}return qt(p)}var Q0=xa('<circle fill="none" style="transition: stroke-dasharray 0.3s ease-out"></circle>'),zc=xa("<circle></circle>"),$0=xa('<svg class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 fill-background" viewBox="0 0 8 6"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.69471 1.69471C7.87687 1.50611 7.97766 1.25351 7.97539 0.991311C7.97311 0.729114 7.86794 0.478302 7.68253 0.292894C7.49712 0.107485 7.24631 0.00231622 6.98411 3.78025e-05C6.72192 -0.00224062 6.46931 0.0985542 6.28071 0.280712L2.98771 3.57371L1.69471 2.28071C1.50611 2.09855 1.25351 1.99776 0.991311 2.00004C0.729114 2.00232 0.478302 2.10749 0.292894 2.29289C0.107485 2.4783 0.00231622 2.72911 3.78025e-05 2.99131C-0.00224062 3.25351 0.0985542 3.50611 0.280712 3.69471L2.28071 5.69471C2.46824 5.88218 2.72255 5.9875 2.98771 5.9875C3.25288 5.9875 3.50718 5.88218 3.69471 5.69471L7.69471 1.69471Z"></path></svg>'),ek=S('<div class="relative"><svg fill="none" xmlns="http://www.w3.org/2000/svg"><circle fill="none"></circle><!></svg> <!></div>');function Vs(r,t){if(new.target)return Ht({component:Vs,...r});Ut(t,!0);let n=y(t,"phase",7),a=y(t,"progress",7,0),s=y(t,"size",7,16),o=y(t,"class",7,""),c=u(()=>s()/2),l=u(()=>e(c)),f=u(()=>e(c)),i=u(()=>s()*.12),p=u(()=>e(c)-e(i)/2),g=u(()=>e(c)*.35),T=u(()=>2*Math.PI*e(g)),b=u(()=>Math.max(0,Math.min(1,a()))*e(T));const h={planning:"#99999999",building:"#54B1F3",reviewing:"#6D7FF5",shipped:"var(--color-foreground)"};let A=u(()=>h[n()]||"currentColor");var P={get phase(){return n()},set phase(ce){n(ce),_()},get progress(){return a()},set progress(ce=0){a(ce),_()},get size(){return s()},set size(ce=16){s(ce),_()},get class(){return o()},set class(ce=""){o(ce),_()},$set:jt,$on:(ce,oe)=>Wt(t,ce,oe)},B=ek(),F=I(B),O=I(F),N=m(O);{var U=ce=>{},E=ce=>{var oe=Q0();k(()=>{ae(oe,"cx",e(l)),ae(oe,"cy",e(f)),ae(oe,"r",e(g)*.8),ae(oe,"stroke",e(A)),ae(oe,"stroke-width",e(g)*1.5),ae(oe,"stroke-dasharray",`${e(b)??""} ${e(T)??""}`),ae(oe,"stroke-dashoffset",e(T)*.25),ae(oe,"transform",`rotate(-90 ${e(l)??""} ${e(f)??""})`)}),d(ce,oe)},z=ce=>{var oe=zc();k(()=>{ae(oe,"cx",e(l)),ae(oe,"cy",e(f)),ae(oe,"r",e(p)*.6),ae(oe,"fill",e(A))}),d(ce,oe)},J=ce=>{var oe=zc();k(()=>{ae(oe,"cx",e(l)),ae(oe,"cy",e(f)),ae(oe,"r",e(p)),ae(oe,"fill",e(A))}),d(ce,oe)};D(N,ce=>{n()==="planning"?ce(U):n()==="building"?ce(E,1):n()==="reviewing"?ce(z,2):n()==="shipped"&&ce(J,3)})}w(F);var Z=m(F,2);{var Q=ce=>{},Ie=ce=>{var oe=$0();k(()=>ae(oe,"width",s()*.5)),d(ce,oe)};D(Z,ce=>{n()==="reviewing"?ce(Q):n()==="shipped"&&ce(Ie,1)})}return w(B),k(()=>{ae(F,"width",s()),ae(F,"height",s()),ae(F,"viewBox",`0 0 ${s()??""} ${s()??""}`),pt(F,0,lr(o())),ae(O,"cx",e(l)),ae(O,"cy",e(f)),ae(O,"r",e(p)),ae(O,"stroke",e(A)),ae(O,"stroke-width",e(i))}),d(r,B),qt(P)}var Hc=S('<span class="flex items-center gap-1"><span class="size-1.5 rounded-full"></span> </span>'),tk=S('<span class="flex items-center gap-1"><span class="size-1.5 rounded-full bg-border"></span> </span>'),jc=S('<span class="text-ui text-subtle truncate"> </span>'),Wc=S('<div class="flex items-center gap-1 mt-0.5"><!> <!></div>'),Uc=S('<div class="flex items-start gap-2"><div class="shrink-0 mt-0.5"><!></div> <div class="flex-1 min-w-0"><div class="text-xs leading-snug truncate"> </div> <!></div></div>'),rk=S('<div class="flex items-center gap-2"><div class="shrink-0"><!></div> <span class="text-ui text-subtle truncate line-through"> </span></div>'),nk=S('<span class="text-ui text-subtle pl-4"> </span>'),ak=S('<div class="flex flex-col gap-0.5 pt-1 border-t border-border"><!> <!></div>'),sk=S('<div class="text-ui text-subtle"> </div>'),ok=S("<!> <!> <!> <!>",1),ik=S('<div class="flex flex-col py-2 px-3 gap-2 max-h-80 overflow-y-auto"><div class="flex items-center justify-between gap-3"><span class="text-xs font-semibold text-foreground"> </span> <div class="flex items-center gap-3 text-ui text-subtle"><!> <!> <!></div></div> <!></div>'),lk=S('<div class="rounded-[0.5px]"></div>');function Uu(r,t){if(new.target)return Ht({component:Uu,...r});Ut(t,!0);let n=y(t,"stats",7),a=y(t,"tasks",23,()=>[]),s=y(t,"maxBars",7,20),o=y(t,"barWidth",7,"1px"),c=y(t,"barHeight",7,"16px"),l=y(t,"gap",7,"1px"),f=y(t,"class",7);const i={completed:"#22c55e",inProgress:"#4F7BF7",notStarted:"var(--border)"};let p=u(()=>{const{completed:N,inProgress:U,notStarted:E,total:z}=n();if(z===0)return[];const J=[...Array(N).fill("completed"),...Array(U).fill("inProgress"),...Array(Math.max(0,E)).fill("notStarted")];return J.length<=s()?J:J.slice(J.length-s())}),g=u(()=>a().filter(N=>N.status==="complete")),T=u(()=>a().filter(N=>N.status==="in_progress"||N.status==="review_required")),b=u(()=>a().filter(N=>N.status!=="complete"&&N.status!=="in_progress"&&N.status!=="review_required"&&N.status!=="cancelled")),h=u(()=>a().filter(N=>N.status==="cancelled")),A=u(()=>a().length>0);var P={get stats(){return n()},set stats(N){n(N),_()},get tasks(){return a()},set tasks(N=[]){a(N),_()},get maxBars(){return s()},set maxBars(N=20){s(N),_()},get barWidth(){return o()},set barWidth(N="1px"){o(N),_()},get barHeight(){return c()},set barHeight(N="16px"){c(N),_()},get gap(){return l()},set gap(N="1px"){l(N),_()},get class(){return f()},set class(N){f(N),_()},$set:jt,$on:(N,U)=>Wt(t,N,U)},B=kt(),F=qe(B);{var O=N=>{Go(N,{side:"top",align:"start",sideOffset:6,contentClass:"max-w-xs p-0",delayDuration:200,disableHoverableContent:!1,content:E=>{var z=ik(),J=I(z),Z=I(J),Q=R(Z,!0),Ie=m(Z,2),ce=I(Ie);{var oe=Re=>{var ke=Hc(),_e=I(ke);Pn(_e,"",{},{"background-color":"#22c55e"});var je=m(_e);w(ke),k(()=>x(je,` ${n().completed??""}`)),d(Re,ke)};D(ce,Re=>{n().completed>0&&Re(oe)})}var ue=m(ce,2);{var we=Re=>{var ke=Hc(),_e=I(ke);Pn(_e,"",{},{"background-color":"#4F7BF7"});var je=m(_e);w(ke),k(()=>x(je,` ${n().inProgress??""}`)),d(Re,ke)};D(ue,Re=>{n().inProgress>0&&Re(we)})}var G=m(ue,2);{var fe=Re=>{var ke=tk(),_e=m(I(ke));w(ke),k(()=>x(_e,` ${n().notStarted??""}`)),d(Re,ke)};D(G,Re=>{n().notStarted>0&&Re(fe)})}w(Ie),w(J);var ie=m(J,2);{var Ne=Re=>{var ke=ok(),_e=qe(ke);Tt(_e,17,()=>e(T),Mr,(V,K)=>{var W=Uc(),se=I(W),Ce=I(se);Eo(Ce,{get status(){return e(K).status},size:14}),w(se);var Y=m(se,2),de=I(Y),Ae=R(de,!0),He=m(de,2);{var tt=ge=>{var Oe=Wc(),q=I(Oe);{let L=u(()=>e(K).agentState||"idle");yl(q,{get agentId(){return e(K).agentId},get state(){return e(L)},size:12,get specialist(){return e(K).agentSpecialist}})}var Me=m(q,2);{var ve=L=>{var H=jc(),me=R(H,!0);k(()=>x(me,e(K).agentName)),d(L,H)};D(Me,L=>{e(K).agentName&&L(ve)})}w(Oe),d(ge,Oe)};D(He,ge=>{e(K).agentId&&ge(tt)})}w(Y),w(W),k(()=>x(Ae,e(K).title)),d(V,W)});var je=m(_e,2);Tt(je,17,()=>e(b),Mr,(V,K)=>{var W=Uc(),se=I(W),Ce=I(se);Eo(Ce,{get status(){return e(K).status},size:14}),w(se);var Y=m(se,2),de=I(Y),Ae=R(de,!0),He=m(de,2);{var tt=ge=>{var Oe=Wc(),q=I(Oe);{let L=u(()=>e(K).agentState||"idle");yl(q,{get agentId(){return e(K).agentId},get state(){return e(L)},size:12,get specialist(){return e(K).agentSpecialist}})}var Me=m(q,2);{var ve=L=>{var H=jc(),me=R(H,!0);k(()=>x(me,e(K).agentName)),d(L,H)};D(Me,L=>{e(K).agentName&&L(ve)})}w(Oe),d(ge,Oe)};D(He,ge=>{e(K).agentId&&ge(tt)})}w(Y),w(W),k(()=>x(Ae,e(K).title)),d(V,W)});var Ue=m(je,2);{var le=V=>{var K=ak(),W=I(K);Tt(W,17,()=>e(g).slice(0,3),Mr,(Y,de)=>{var Ae=rk(),He=I(Ae),tt=I(He);Eo(tt,{status:"complete",size:12}),w(He);var ge=m(He,2),Oe=R(ge,!0);w(Ae),k(()=>x(Oe,e(de).title)),d(Y,Ae)});var se=m(W,2);{var Ce=Y=>{var de=nk(),Ae=R(de,!0);k(He=>x(Ae,He),[()=>v.workspace_taskProgressBar_moreCompleted_label({count:ar(e(g).length-3)})]),d(Y,de)};D(se,Y=>{e(g).length>3&&Y(Ce)})}w(K),d(V,K)};D(Ue,V=>{e(g).length>0&&V(le)})}var $=m(Ue,2);{var Ze=V=>{var K=sk(),W=R(K,!0);k(se=>x(W,se),[()=>v.workspace_taskProgressBar_cancelled_label({count:ar(e(h).length)})]),d(V,K)};D($,V=>{e(h).length>0&&V(Ze)})}d(Re,ke)};D(ie,Re=>{e(A)&&Re(Ne)})}w(z),k(Re=>x(Q,Re),[()=>v.workspace_taskProgressBar_tasksRatio_label({completed:ar(n().completed),total:ar(n().total)})]),d(E,z)},children:(E,z)=>{{let J=u(()=>xn("flex h-auto min-w-0 shrink items-end justify-start cursor-default rounded-none border-0",f())),Z=u(()=>`gap: ${l()}`),Q=u(()=>v.workspace_taskProgressBar_tasksRatio_label({completed:ar(n().completed),total:ar(n().total)}));yt(E,{variant:"plain",type:"button",wrapContent:!1,get class(){return e(J)},get style(){return e(Z)},get"aria-label"(){return e(Q)},"data-task-progress-trigger":!0,children:(Ie,ce)=>{var oe=kt(),ue=qe(oe);Tt(ue,17,()=>e(p),Mr,(we,G)=>{var fe=lk();let ie;k(()=>ie=Pn(fe,"",ie,{width:o(),height:c(),"background-color":i[e(G)]})),d(we,fe)}),d(Ie,oe)},$$slots:{default:!0}})}},$$slots:{content:!0,default:!0}})};D(F,N=>{n().total>0&&N(O)})}return d(r,B),qt(P)}function Ui(r,t){if(new.target)return Ht({component:Ui,...r});Ut(t,!0);let n=y(t,"items",7),a=y(t,"ariaLabel",7),s=y(t,"open",15,!1),o=y(t,"orientation",7,"vertical"),c=y(t,"selection",7),l=y(t,"class",7,"");const f=u(()=>xg(n(),c(),a()));var i={get items(){return n()},set items(p){n(p),_()},get ariaLabel(){return a()},set ariaLabel(p){a(p),_()},get open(){return s()},set open(p=!1){s(p),_()},get orientation(){return o()},set orientation(p="vertical"){o(p),_()},get selection(){return c()},set selection(p){c(p),_()},get class(){return l()},set class(p=""){l(p),_()},$set:jt,$on:(p,g)=>Wt(t,p,g)};return Mm(r,{get actions(){return e(f)},align:"end",get ariaLabel(){return a()},onAction:g=>_g(n(),g)?.onClick(),get open(){return s()},set open(g){s(g)},trigger:(g,T)=>{let b=()=>(T?.()).props;yt(g,_i(b,{variant:"plain",size:"icon-compact",iconOnly:!0,type:"button",get class(){return l()},get"aria-label"(){return a()},onclick:h=>{h.stopPropagation(),b().onclick?.(h)},oncontextmenu:h=>{h.preventDefault(),h.stopPropagation()},children:(h,A)=>{Lm(h,{get orientation(){return o()},class:"size-3.5"})},$$slots:{default:!0}}))},$$slots:{trigger:!0}}),qt(i)}var ck=S('<span class="contents"><!></span>'),dk=S("<!> <!>",1);function qu(r,t){if(new.target)return Ht({component:qu,...r});Ut(t,!0);let n=y(t,"workspaceId",7),a=y(t,"slot",7);const s=u(()=>Yg(a()));let o=ye(null);It(()=>{e(o)&&e(o).workspaceId!==n()&&M(o,null)});function c(h){const A=sd(h);A&&M(o,{...A,workspaceId:n()},!0)}function l(h){h.preventDefault(),h.stopPropagation();const A=h.currentTarget.getBoundingClientRect();M(o,{x:A.left,y:A.bottom+2,returnFocus:h.currentTarget,workspaceId:n()},!0)}function f(){M(o,null)}var i={get workspaceId(){return n()},set workspaceId(h){n(h),_()},get slot(){return a()},set slot(h){a(h),_()},$set:jt,$on:(h,A)=>Wt(t,h,A)},p=dk(),g=qe(p);{let h=u(()=>v.workspace_microKeyBadge_ariaLabel({number:ar(a()+1)})),A=u(()=>v.workspace_microKeyBadge_tooltip({number:ar(a()+1)})),P=u(()=>e(o)!==null);yt(g,{variant:"ghost",size:"icon",type:"button",class:"micro-key-slot-badge size-4 min-w-0 shrink-0 cursor-pointer rounded-[3px] p-0 a11y-ignore",get"aria-label"(){return e(h)},get title(){return e(A)},onclick:l,oncontextmenu:c,onkeydown:c,"aria-haspopup":"menu",get"aria-expanded"(){return e(P)},children:(B,F)=>{var O=ck(),N=I(O);$p(N,{get slot(){return a()},get class(){return`transition-colors ${e(s)??""}`}}),w(O),d(B,O)},$$slots:{default:!0}})}var T=m(g,2);{var b=h=>{{let A=u(()=>e(o)?.x??0),P=u(()=>e(o)?.y??0),B=u(()=>e(o)?.returnFocus),F=u(()=>v.workspace_card_assignMicroKey_label()),O=u(()=>Bh(n(),f));od(h,{get x(){return e(A)},get y(){return e(P)},get returnFocus(){return e(B)},selection:"single",get ariaLabel(){return e(F)},get items(){return e(O)},onClickOutside:f})}};D(T,h=>{e(o)&&h(b)})}return d(r,p),qt(i)}var uk=S('<span class="flex size-4 shrink-0 items-center justify-center"><!></span>'),fk=S('<span data-workspace-card-pin-indicator="" aria-hidden="true"><!></span> <span class="sr-only"> </span>',1),pk=S('<span class="type-caption shrink-0 rounded-sm bg-muted-foreground/10 px-1.5 font-normal text-muted-foreground" data-workspace-card-trailing-label=""> </span>'),gk=S('<span data-workspace-card-pr-item=""><!></span>'),vk=S('<span class="flex shrink-0 items-center" data-workspace-card-pr-list=""><!></span>'),mk=S('<span data-workspace-card-time=""><!></span>'),hk=S('<span aria-hidden="true"><!></span>'),bk=S("<div><!> <!> <!> <!></div>"),yk=S('<div data-workspace-card-hover-surface=""><!></div>'),_k=S('<div role="group" data-workspace-card-row=""><!> <div class="relative z-10 flex shrink-0 items-center gap-1.5"><!> <!> <span class="sr-only"> </span></div> <div class="relative z-10 flex min-w-0 flex-1 items-center gap-2"><span class="flex min-w-0 flex-1 items-center gap-1" data-workspace-card-title-group=""><span dir="ltr" data-workspace-card-title=""><span class="wc-title-text svelte-1ct56pd"> </span></span> <!></span> <!> <!> <!></div> <!></div> <!> <!>',1),xk=S('<div class="relative z-10 flex shrink-0 items-center"><!></div>'),wk=S('<div><!> <!> <span class="font-medium truncate"> </span> <span class="shrink-0 text-muted-foreground">·</span> <span class="truncate text-xs text-muted-foreground"> </span> <!></div>'),kk=S('<div class="text-sm font-semibold truncate"> </div>'),qc=S('<span class="truncate"> </span>'),Sk=S('<span class="text-muted-foreground">·</span>'),Ik=S('<div class="flex items-center gap-1 truncate text-xs text-muted-foreground"><!> <!> <!></div>'),Ck=S('<div><!> <!> <div class="flex items-center gap-2 text-xs"><!> <span class="truncate text-muted-foreground"> </span> <span> </span></div> <!></div>'),Ek=S('<div class="flex items-center gap-2"><!> <span class="text-ui shrink-0 tabular-nums text-muted-foreground"> </span></div>'),Ak=S('<div class="flex items-center justify-between text-ui"><span class="text-muted-foreground"> </span> <span class="tabular-nums"><span class="text-success"> </span> <span class="ml-1 text-danger"> </span></span></div>'),Pk=S('<div class="flex items-center justify-between text-ui"><span class="text-muted-foreground"> </span></div>'),Tk=S('<div class="flex items-center text-ui"><span> </span></div>'),Rk=S('<div class="flex flex-col gap-1 px-3 pb-2.5"><!> <!> <!> <!></div>'),Mk=S('<div class="relative z-10 flex items-center gap-1.5 px-2 pb-2"><!></div>'),Lk=S('<div class="relative z-10 flex items-center gap-1.5 px-2 pb-2"><!> <!></div>'),Nk=S('<div role="group"><!> <div class="flex items-start gap-2.5 px-3 pt-3 pb-2"><!> <div class="flex-1 min-w-0"><div class="text-sm font-medium"> </div> <div class="mt-0.5 line-clamp-2 text-xs leading-snug text-muted-foreground"> </div></div></div> <!> <!></div>');function Vu(r,t){if(new.target)return Ht({component:Vu,...r});Ut(t,!0);const n=()=>St(je,"$prMonitors$",c),a=()=>St(Ue,"$microConnected$",c),s=()=>St($,"$hidesOwnerActions$",c),o=()=>St(le,"$workspaceKeySlot$",c),[c,l]=oa();let f=y(t,"workspace",7),i=y(t,"phase",7),p=y(t,"stats",7),g=y(t,"variant",7,"compact"),T=y(t,"showTime",7,!0),b=y(t,"isRunning",7,!1),h=y(t,"isUnread",7,!1),A=y(t,"isWaiting",7),P=y(t,"isPinned",7,!1),B=y(t,"streamingAgentIds",23,()=>[]),F=y(t,"hasSpec",7,!1),O=y(t,"isAgentRunning",7,!1),N=y(t,"agentDigest",7),U=y(t,"trailingLabel",7),E=y(t,"title",7),z=y(t,"repoName",7),J=y(t,"branch",7),Z=y(t,"onClick",7),Q=y(t,"onAction",7),Ie=y(t,"onTogglePin",7),ce=y(t,"onMarkAsRead",7),oe=y(t,"onOpenInNewWindow",7),ue=y(t,"onHover",7),we=y(t,"highlighted",7,!1),G=y(t,"selected",7,!1),fe=y(t,"highlightId",7),ie=y(t,"suppressHover",7,!1),Ne=y(t,"isolateHoverReveal",7,!1),Re=y(t,"class",7),ke=y(t,"actions",7);const _e=$a("");It(()=>{_e.set(f()?.id??"")});const je=jp(_e),Ue=Zh(),le=Ev(_e),$=Wp(_e),Ze=u(()=>zh(f()??{})),V=u(()=>Hh(e(Ze)));let K=u(()=>f()?Xh.url.pathname===`/workspace/${f().id}`:!1),W=u(()=>f()?`workspace-hover-card-${f().id}`:void 0),se=ye(!1),Ce=ye(null),Y=ye(null);It(()=>{if(!e(Y))return;const ee=Ds(e(Y),{id:fe()});return()=>ee.destroy()});let de=ye(null),Ae=ye(null),He=ye(null),tt=ye(0),ge=ye(0),Oe=u(()=>e(tt)+(e(ge)>0?e(ge)+4:0));function q(){const ee=e(de),gt=e(He);M(tt,ee?Math.max(0,ee.scrollWidth-ee.clientWidth):0,!0),M(ge,ee&>&>.getClientRects().length>0?Math.max(0,ee.getBoundingClientRect().right-gt.getBoundingClientRect().left):0,!0)}It(()=>{const ee=e(de),gt=e(Ae),Dt=e(He);if(!ee||!gt||(q(),typeof ResizeObserver>"u"))return;const ur=new ResizeObserver(q);return ur.observe(ee),ur.observe(gt),Dt&&ur.observe(Dt),()=>ur.disconnect()});let Me=null,ve=null,L=!1,H=!1,me=!1,$e=!1,Pe=!1,ze=!1,X=ye(!1),xe=!1,Ke=null,rt=ye(null),ht=null,We;function mt(){Me!==null&&(clearTimeout(Me),Me=null)}function ot(){ve!==null&&(clearTimeout(ve),ve=null),ht?.(),ht=null}function it(){ot(),M(X,!0),M(se,!0),!Pe&&(Pe=!0,ps.notifyOpened())}function dt(){ot(),clearTimeout(We),M(X,!1),M(se,!1),H=!1,$e=!1,Pe&&(Pe=!1,ps.notifyClosed())}function Gt(){return L||H||me||$e}function Ft(){if(!e(se)){dt();return}ot(),ve=setTimeout(()=>{ve=null,Gt()||dt()},Wh),ht=ps.deferClose(dt)}function Jt(){H=!0,ot()}function xt(){H=!1,!me&&!$e&&Ft()}function Vt(){$e=!0,clearTimeout(We),ot()}function Kt(ee){const gt=ee.relatedTarget instanceof Node?ee.relatedTarget:null;if(gt&&pe()?.contains(gt)||($e=!1,gt&&e(Ce)?.contains(gt)))return;if(gt){!L&&!H&&dt();return}const Dt=ee.target;clearTimeout(We),We=setTimeout(()=>{const ur=document.activeElement,_r=pe()?.contains(ur)||e(Ce)?.contains(ur);ur&&ur!==Dt&&_r||!L&&!H&&dt()},0)}function Ct(){Ke!==null&&clearTimeout(Ke),xe=!0,Ke=setTimeout(()=>{xe=!1,Ke=null},0)}function Yt(ee){const gt=ee.target,Dt=pe();gt instanceof Node&&Dt?.contains(gt)||ee.type==="scroll"&&e(Ce)&> instanceof Node&&!gt.contains(e(Ce))||(ee.type==="pointerdown"&&Ct(),mt(),dt())}It(()=>{if(e(X))return window.addEventListener("pointerdown",Yt,!0),window.addEventListener("scroll",Yt,!0),()=>{window.removeEventListener("pointerdown",Yt,!0),window.removeEventListener("scroll",Yt,!0)}});function Mt(ee){if(ee.key!=="Escape")return;const gt=ee.target;gt instanceof Node&&pe()?.contains(gt)||(ee.preventDefault(),ee.stopPropagation(),ze=me,mt(),dt())}It(()=>{if(e(se))return window.addEventListener("keydown",Mt,!0),()=>window.removeEventListener("keydown",Mt,!0)});const be=u(()=>f()?qp.select(Nt.state,f().id):null),re=u(()=>e(be)?e(be):f()?.activePullRequest?f().activePullRequest:!f()?.prStatus||f().prNumber==null?null:{id:`legacy-pr-${f().prNumber}`,number:f().prNumber,url:f().prUrl??"",title:v.workspace_hoverCard_pullRequest_label(),status:f().prStatus,createdAt:f().updatedAt,updatedAt:f().updatedAt}),Ve=u(()=>Up(f())),lt=u(()=>{if(!f()||e(Ve))return[];const ee=f(),gt=ee.repositoryOwner&&ee.repositoryName?`${ee.repositoryOwner}/${ee.repositoryName}`:void 0;return wg({workspacePRs:ee.pullRequests,activePR:e(re),monitors:n(),workspaceRepo:gt,buildPrUrl:(Dt,ur)=>fm(Dt,ee.repositoryOwner,ee.repositoryName,ur),getDisplayTitle:Dt=>Dt.title})}),ct=u(()=>e(lt)[0]);function De(ee){const gt=ee.resource?.repository.provider==="gitlab"?`${ee.repo} !${ee.number}`:ee.repo?v.workspace_card_prBadge_repoLine_tooltip({repo:ee.repo,number:ee.number}):v.workspace_card_prBadge_label({number:` #${ee.number}`});return[Vp(gt,ee),ee.title,ee.details].filter(Boolean).join(`
|
|
262
262
|
`)}function ne(ee){ee.key==="Enter"&&Z()?.(ee)}function pe(){return e(W)?document.getElementById(e(W)):null}function te(){return Array.from(pe()?.querySelectorAll("button:not(:disabled), a[href]")??[])}function Ee(){const ee=e(Ce)?.querySelector("[data-workspace-card-trigger]"),gt=pe();if(!ee||!gt)return null;const Dt=Array.from(document.querySelectorAll('button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).filter(_r=>_r.tabIndex>=0&&!gt.contains(_r)),ur=Dt.indexOf(ee);return ur>=0?Dt[ur+1]:null}function Se(ee){ze=!!e(Ce)?.contains(ee),dt(),ee.focus({preventScroll:!0})}function Xe(){const ee=e(Ce)?.querySelector("[data-workspace-card-trigger]");ee&&Se(ee)}async function Fe(ee){if(ee.key==="Escape"&&e(se)){ee.preventDefault(),ee.stopPropagation(),dt();return}ee.key!=="ArrowDown"||ie()||!f()||(ee.preventDefault(),ee.stopPropagation(),M(X,!0),M(se,!0),await Xn(),te()[0]?.focus({preventScroll:!0}))}function Ge(ee){const gt=te(),Dt=ee.key==="Tab"&&ee.shiftKey&&ee.currentTarget===gt[0],_r=ee.key==="Tab"&&!ee.shiftKey&&ee.currentTarget===gt.at(-1)?Ee():null;ee.key!=="Escape"&&!Dt&&!_r||(ee.preventDefault(),ee.stopPropagation(),_r?Se(_r):Xe())}function Qe(){L=!0,ot(),ps.settleDeferredCloses(),q(),ue()?.(),f()&&!ie()&&!me&&(mt(),M(X,!0),Me=setTimeout(()=>{Me=null,it()},ps.currentOpenDelay))}function Te(){L=!1,mt(),!me&&!$e&&Ft()}function Ye(){me=!0,mt(),ot(),!ze&&(xe||f()&&!ie()&&(M(X,!0),M(se,!0)))}function Be(ee){const gt=ee.relatedTarget instanceof Node?ee.relatedTarget:null;gt&&e(Ce)?.contains(gt)||(ze=!1,me=!1,!(gt&&pe()?.contains(gt))&&!L&&!H&&dt())}It(()=>{ie()&&(mt(),ot(),dt())});let et=ye(null),ft=ye(!1),st;It(()=>{const ee=f()?.id;st!==ee&&(st=ee,M(ft,!1)),e(et)&&e(et).workspaceId!==f()?.id&&_t()});function nt(ee){if(!f())return;const gt=sd(ee);if(gt){if(M(ft,!1),vt().length===0){M(et,null);return}M(et,{...gt,returnFocus:ee.target instanceof HTMLElement?ee.target.closest("button")??e(Ce)?.querySelector("button")??null:null,workspaceId:f().id},!0)}}function _t(){M(et,null),M(ft,!1)}It(()=>{e(ft)&&M(et,null)}),Cs(()=>{mt(),ot(),Ke!==null&&(clearTimeout(Ke),Ke=null),dt()});function vt(){if(!f())return[];const ee=[];return oe()&&ee.push({id:"open-new-window",label:v.workspace_card_openNewWindow_label(),icon:fd,onClick:()=>{oe()?.(),_t()}}),ee.push(...jh(f().id,{connected:a(),onClose:_t})),s()||(e(Ve)||ee.push({id:"transfer",label:v.workspace_card_transfer_label(),icon:zg,onClick:()=>{Nt.dispatch(dv({workspaceId:f().id,workspaceTitle:f().title})),_t()}}),ee.push({id:"archive",label:v.workspace_card_archive_label(),icon:pd,onClick:()=>{Nt.dispatch(Id(f().id)),_t()}}),ee.push({id:"delete",label:v.workspace_card_deleteSpace_label(),icon:gd,destructive:!0,onClick:()=>{Nt.dispatch(Cd(f().id)),_t()}})),ee}let Ot=u(()=>O()&&N()?N():i()?.subtitle??""),Xt=u(()=>p()&&p().tasks.total>0?p().tasks.completed/p().tasks.total:0),er=u(()=>!!p()&&(p().tasks.total>0||p().files.changed>0||p().commits.total>0||p().pr.hasOpen||p().pr.hasMerged)),dr=u(()=>e(Ve)?void 0:J()),jr=u(()=>!p()||e(Ve)?"":p().pr.hasMerged?v.workspace_card_prMerged_label({number:p().pr.number??""}):p().pr.hasOpen?v.workspace_card_prOpen_label({number:p().pr.number?`#${p().pr.number}`:""}):""),nn=u(()=>i()?.phase==="planning"?O()?{primary:{label:v.workspace_card_showCoordinator_label(),action:"show-coordinator"},secondary:{label:v.workspace_card_pause_label(),action:"pause"}}:F()||(p()?.tasks.total??0)>0?{primary:{label:v.workspace_card_approveStart_label(),action:"approve"},secondary:{label:v.workspace_card_viewSpec_label(),action:"view-spec"}}:{primary:{label:v.workspace_card_showCoordinator_label(),action:"show-coordinator"},secondary:{label:v.workspace_card_viewSpec_label(),action:"view-spec"}}:i()?.phase==="building"?{primary:{label:v.workspace_card_showCoordinator_label(),action:"show-coordinator"},secondary:{label:v.workspace_card_pause_label(),action:"pause"}}:i()?.phase==="reviewing"?{primary:{label:v.workspace_card_createPr_label(),action:"create-pr"},secondary:{label:v.workspace_card_showChanges_label(),action:"show-changes"}}:{primary:{label:v.workspace_card_archive_label(),action:"archive"},secondary:{label:v.workspace_card_showChanges_label(),action:"show-changes"}});const mn={planning:"bg-muted/20 text-muted-foreground",building:"bg-info/15 text-info",reviewing:"bg-primary/15 text-primary",shipped:"bg-foreground/10 text-foreground"};var zn={get workspace(){return f()},set workspace(ee){f(ee),_()},get phase(){return i()},set phase(ee){i(ee),_()},get stats(){return p()},set stats(ee){p(ee),_()},get variant(){return g()},set variant(ee="compact"){g(ee),_()},get showTime(){return T()},set showTime(ee=!0){T(ee),_()},get isRunning(){return b()},set isRunning(ee=!1){b(ee),_()},get isUnread(){return h()},set isUnread(ee=!1){h(ee),_()},get isWaiting(){return A()},set isWaiting(ee){A(ee),_()},get isPinned(){return P()},set isPinned(ee=!1){P(ee),_()},get streamingAgentIds(){return B()},set streamingAgentIds(ee=[]){B(ee),_()},get hasSpec(){return F()},set hasSpec(ee=!1){F(ee),_()},get isAgentRunning(){return O()},set isAgentRunning(ee=!1){O(ee),_()},get agentDigest(){return N()},set agentDigest(ee){N(ee),_()},get trailingLabel(){return U()},set trailingLabel(ee){U(ee),_()},get title(){return E()},set title(ee){E(ee),_()},get repoName(){return z()},set repoName(ee){z(ee),_()},get branch(){return J()},set branch(ee){J(ee),_()},get onClick(){return Z()},set onClick(ee){Z(ee),_()},get onAction(){return Q()},set onAction(ee){Q(ee),_()},get onTogglePin(){return Ie()},set onTogglePin(ee){Ie(ee),_()},get onMarkAsRead(){return ce()},set onMarkAsRead(ee){ce(ee),_()},get onOpenInNewWindow(){return oe()},set onOpenInNewWindow(ee){oe(ee),_()},get onHover(){return ue()},set onHover(ee){ue(ee),_()},get highlighted(){return we()},set highlighted(ee=!1){we(ee),_()},get selected(){return G()},set selected(ee=!1){G(ee),_()},get highlightId(){return fe()},set highlightId(ee){fe(ee),_()},get suppressHover(){return ie()},set suppressHover(ee=!1){ie(ee),_()},get isolateHoverReveal(){return Ne()},set isolateHoverReveal(ee=!1){Ne(ee),_()},get class(){return Re()},set class(ee){Re(ee),_()},get actions(){return ke()},set actions(ee){ke(ee),_()},$set:jt,$on:(ee,gt)=>Wt(t,ee,gt)},Un=kt(),da=qe(Un);{var wr=ee=>{var gt=_k(),Dt=qe(gt);let ur;var _r=I(Dt);{let bt=u(()=>f().title||v.workspace_links_untitled_label()),Pt=u(()=>`workspace-status-state-${f().id}${P()?` workspace-pinned-state-${f().id}`:""}${e(se)?` ${e(W)}`:""}`),pr=u(()=>e(K)?"page":void 0);yt(_r,{variant:"plain",class:"absolute inset-0 z-0 h-auto w-auto rounded-md focus-visible:border-transparent focus-visible:bg-background/50 focus-visible:ring-0",get"aria-label"(){return e(bt)},get"aria-describedby"(){return e(Pt)},get"aria-current"(){return e(pr)},"data-workspace-card-trigger":!0,onkeydown:Fe,onclick:xr=>{xr.stopPropagation(),Z()?.(xr)}})}var kn=m(_r,2),cn=I(kn);{var Hn=bt=>{var Pt=uk(),pr=I(Pt);{var xr=Pr=>{qu(Pr,{get workspaceId(){return f().id},get slot(){return o()}})};D(pr,Pr=>{o()!==null&&Pr(xr)})}w(Pt),d(bt,Pt)};D(cn,bt=>{a()&&bt(Hn)})}var hn=m(cn,2);Go(hn,{get content(){return e(V).tooltip},side:"bottom",sideOffset:4,children:(bt,Pt)=>{Fh(bt,{get status(){return e(Ze)},size:14,decorative:!0,class:"justify-start"})},$$slots:{default:!0}});var Tn=m(hn,2),Zn=R(Tn,!0);w(kn);var Yr=m(kn,2),dn=I(Yr),Zt=I(dn),an=I(Zt),qn=R(an,!0);mr(an,bt=>M(Ae,bt),()=>e(Ae)),w(Zt),mr(Zt,bt=>M(de,bt),()=>e(de));var kr=m(Zt,2);{var Or=bt=>{var Pt=fk(),pr=qe(Pt),xr=I(pr);At(xr,{get icon(){return Sl},size:"xs"}),w(pr);var Pr=m(pr,2),j=R(Pr,!0);k(Le=>{pt(pr,1,`wc-pin-indicator inline-flex shrink-0 items-center text-muted-foreground transition-opacity
|
|
263
|
-
${Ie()?we()?"opacity-0":ie()?"":Ne()?"group-hover/wc:opacity-0 group-focus-within/wc:opacity-0":"group-hover:opacity-0 group-focus-within:opacity-0":""}`,"svelte-1ct56pd"),ae(Pr,"id",`workspace-pinned-state-${f().id??""}`),x(j,Le)},[()=>v.layout_activeCard_pinned_header()]),d(bt,Pt)};D(kr,bt=>{P()&&bt(Or)})}w(dn);var un=m(dn,2);{var la=bt=>{var Pt=pk(),pr=R(Pt,!0);k(()=>x(pr,U())),d(bt,Pt)};D(un,bt=>{U()&&bt(la)})}var Xr=m(un,2);{var Zr=bt=>{const Pt=u(()=>e(ct));var pr=vk(),xr=I(pr);{let Pr=u(()=>De(e(Pt)));Go(xr,{get content(){return e(Pr)},side:"bottom",sideOffset:4,children:(j,Le)=>{var ut=kt(),$t=qe(ut);{var fr=gr=>{{let hr=u(()=>De(e(Pt)));yt(gr,{variant:"plain",size:"icon-compact",iconOnly:!0,get class(){return`size-5 shrink-0 rounded-sm ${e(Pt).foregroundClass??""}`},get"aria-label"(){return e(hr)},"data-workspace-card-pr-item":!0,get"data-pr-identity"(){return e(Pt).identity},get"data-pr-status"(){return e(Pt).status},onclick:sn=>{sn.stopPropagation();const Vn=f().id;mp(async()=>{const{handleLink:Wr}=await import("./
|
|
263
|
+
${Ie()?we()?"opacity-0":ie()?"":Ne()?"group-hover/wc:opacity-0 group-focus-within/wc:opacity-0":"group-hover:opacity-0 group-focus-within:opacity-0":""}`,"svelte-1ct56pd"),ae(Pr,"id",`workspace-pinned-state-${f().id??""}`),x(j,Le)},[()=>v.layout_activeCard_pinned_header()]),d(bt,Pt)};D(kr,bt=>{P()&&bt(Or)})}w(dn);var un=m(dn,2);{var la=bt=>{var Pt=pk(),pr=R(Pt,!0);k(()=>x(pr,U())),d(bt,Pt)};D(un,bt=>{U()&&bt(la)})}var Xr=m(un,2);{var Zr=bt=>{const Pt=u(()=>e(ct));var pr=vk(),xr=I(pr);{let Pr=u(()=>De(e(Pt)));Go(xr,{get content(){return e(Pr)},side:"bottom",sideOffset:4,children:(j,Le)=>{var ut=kt(),$t=qe(ut);{var fr=gr=>{{let hr=u(()=>De(e(Pt)));yt(gr,{variant:"plain",size:"icon-compact",iconOnly:!0,get class(){return`size-5 shrink-0 rounded-sm ${e(Pt).foregroundClass??""}`},get"aria-label"(){return e(hr)},"data-workspace-card-pr-item":!0,get"data-pr-identity"(){return e(Pt).identity},get"data-pr-status"(){return e(Pt).status},onclick:sn=>{sn.stopPropagation();const Vn=f().id;mp(async()=>{const{handleLink:Wr}=await import("./mEDFle3S.js").then(Tr=>Tr.H);return{handleLink:Wr}},__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,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65]),import.meta.url).then(({handleLink:Wr})=>Wr(e(Pt).url,{workspaceId:Vn,event:sn}))},children:(sn,Vn)=>{At(sn,{get icon(){return e(Pt).statusIcon},size:14})},$$slots:{default:!0}})}},sr=gr=>{var hr=gk(),sn=I(hr);At(sn,{get icon(){return e(Pt).statusIcon},size:14}),w(hr),k(Vn=>{pt(hr,1,`inline-flex size-5 shrink-0 items-center justify-center rounded-sm ${e(Pt).foregroundClass??""}`,"svelte-1ct56pd"),ae(hr,"aria-label",Vn),ae(hr,"data-pr-identity",e(Pt).identity),ae(hr,"data-pr-status",e(Pt).status)},[()=>De(e(Pt))]),d(gr,hr)};D($t,gr=>{e(Pt).url?gr(fr):gr(sr,-1)})}d(j,ut)},$$slots:{default:!0}})}w(pr),k(Pr=>ae(pr,"aria-label",Pr),[()=>e(Pt).resource?.repository.provider==="gitlab"?v.workspace_hoverCard_mergeRequest_label():v.workspace_hoverCard_pullRequest_label()]),d(bt,pr)};D(Xr,bt=>{e(ct)&&bt(Zr)})}var Br=m(Xr,2);{var Qn=bt=>{var Pt=mk(),pr=I(Pt);{var xr=j=>{{let Le=u(()=>Tl(f()));eg(j,{get date(){return e(Le)},class:"type-caption whitespace-nowrap tabular-nums text-muted-foreground",compact:!0})}},Pr=u(()=>Tl(f())>0);D(pr,j=>{e(Pr)&&j(xr)})}w(Pt),k(()=>pt(Pt,1,`wc-secondary shrink-0 ${ke()||Ie()||h()&&ce()?we()?"opacity-0":ie()?"":Ne()?"group-hover/wc:opacity-0 group-hover/message:opacity-0":"group-hover:opacity-0 group-hover/message:opacity-0":""}`,"svelte-1ct56pd")),d(bt,Pt)};D(Br,bt=>{T()&&bt(Qn)})}w(Yr);var Pa=m(Yr,2);{var Ba=bt=>{var Pt=bk(),pr=I(Pt);{var xr=fr=>{{let sr=u(()=>P()?"text-primary-ink":"text-muted-foreground"),gr=u(()=>P()?v.workspace_card_unpin_ariaLabel():v.workspace_card_pin_ariaLabel()),hr=u(()=>P()?v.workspace_card_unpin_tooltip():v.workspace_card_pin_tooltip());yt(fr,{variant:"plain",size:"icon-xs",iconOnly:!0,get class(){return`transition-all hover:bg-muted/50 hover:text-foreground focus-visible:border-transparent focus-visible:bg-muted/50 focus-visible:text-foreground focus-visible:ring-0
|
|
264
264
|
${e(sr)??""}`},onclick:sn=>{sn.stopPropagation(),Ie()?.(sn)},get"aria-label"(){return e(gr)},get title(){return e(hr)},children:(sn,Vn)=>{var Wr=hk(),Tr=I(Wr);At(Tr,{get icon(){return Sl},size:"xs"}),w(Wr),d(sn,Wr)},$$slots:{default:!0}})}};D(pr,fr=>{Ie()&&fr(xr)})}var Pr=m(pr,2);{var j=fr=>{{let sr=u(()=>v.workspace_card_markAsRead_label()),gr=u(()=>v.workspace_card_markAsRead_label());yt(fr,{variant:"plain",size:"icon-xs",iconOnly:!0,class:"text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:border-transparent focus-visible:bg-muted/50 focus-visible:text-foreground focus-visible:ring-0",onclick:hr=>{hr.stopPropagation(),ce()?.(hr)},get"aria-label"(){return e(sr)},get title(){return e(gr)},children:(hr,sn)=>{At(hr,{get icon(){return vd},size:"xs"})},$$slots:{default:!0}})}};D(Pr,fr=>{h()&&ce()&&fr(j)})}var Le=m(Pr,2);ln(Le,()=>ke()??Ks);var ut=m(Le,2);{var $t=fr=>{{let sr=u(vt),gr=u(()=>v.workspace_progressCard_actions_ariaLabel());Ui(fr,{get items(){return e(sr)},get ariaLabel(){return e(gr)},class:"flex size-5 cursor-pointer items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground focus-visible:bg-muted/50 focus-visible:text-foreground focus-visible:outline-none",get open(){return e(ft)},set open(hr){M(ft,hr,!0)}})}};D(ut,fr=>{oe()&&fr($t)})}w(Pt),mr(Pt,fr=>M(He,fr),()=>e(He)),k(()=>pt(Pt,1,`wc-actions absolute right-1 top-1/2 z-20 flex -translate-y-1/2 items-center gap-0.5 rounded-md bg-accent/95 px-0.5 focus-within:opacity-100
|
|
265
265
|
${Ne()?"group-focus-within/wc:opacity-100":"group-focus-within:opacity-100"}
|
|
266
266
|
${we()?"opacity-100":ie()?"opacity-0":Ne()?"opacity-0 group-hover/wc:opacity-100":"opacity-0 group-hover:opacity-100"}`,"svelte-1ct56pd")),d(bt,Pt)};D(Pa,bt=>{(ke()||oe()||Ie()||h()&&ce())&&bt(Ba)})}w(Dt),mr(Dt,bt=>M(Ce,bt),()=>e(Ce)),Fn(Dt,(bt,Pt)=>Ds?.(bt,Pt),()=>({id:fe()}));var Qr=m(Dt,2);{var $r=bt=>{Uh(bt,{get id(){return e(W)},get anchor(){return`--workspace-list-${f().id??""}`},position:"right",get anchorElement(){return e(Ce)},class:"w-auto overflow-visible! rounded-lg border-0! bg-background! shadow-none!",onmouseenter:Jt,onmouseleave:xt,onfocusin:Vt,onfocusout:Kt,children:(Pt,pr)=>{var xr=yk(),Pr=I(xr);qh(Pr,{get workspace(){return f()},get activeAgentIds(){return B()},onkeydown:Ge}),w(xr),mr(xr,j=>M(rt,j),()=>e(rt)),En("pointerenter",xr,Jt),En("pointerleave",xr,xt),Lr("focusin",xr,Vt),Lr("focusout",xr,Kt),d(Pt,xr)},$$slots:{default:!0}})};D(Qr,bt=>{e(se)&&!ie()&&bt($r)})}var Rn=m(Qr,2);{var $n=bt=>{const Pt=u(vt);var pr=kt(),xr=qe(pr);{var Pr=j=>{{let Le=u(()=>e(et)?.x??0),ut=u(()=>e(et)?.y??0),$t=u(()=>e(et)?.returnFocus),fr=u(()=>v.workspace_progressCard_actions_ariaLabel());od(j,{get x(){return e(Le)},get y(){return e(ut)},get returnFocus(){return e($t)},get ariaLabel(){return e(fr)},get items(){return e(Pt)},onClickOutside:_t})}};D(xr,j=>{e(Pt).length>0&&j(Pr)})}d(bt,pr)};D(Rn,bt=>{e(et)&&bt($n)})}k((bt,Pt,pr)=>{pt(Dt,1,bt,"svelte-1ct56pd"),ae(Dt,"data-pinned",P()),ae(Dt,"data-highlight-id",fe()),ur=Pn(Dt,"",ur,{"anchor-name":`--workspace-list-${f().id??""}`}),ae(Tn,"id",`workspace-status-state-${f().id??""}`),x(Zn,e(V).accessibleName),pt(Zt,1,`wc-title type-body min-w-0 truncate font-normal!
|