@intent-hq/web 2.346.5 → 2.346.7

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.
Files changed (143) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{DTF7vG_w.js → -e8CXeVs.js} +1 -1
  3. package/web/app/immutable/chunks/{D9nAnASO.js → 7uDreJHE.js} +1 -1
  4. package/web/app/immutable/chunks/{F_fGJOrE.js → 87nhMNcH.js} +4 -4
  5. package/web/app/immutable/chunks/{DN7iWx1A.js → AXGmKfvU.js} +1 -1
  6. package/web/app/immutable/chunks/{Kr7mqJM2.js → B-VSh3wf.js} +1 -1
  7. package/web/app/immutable/chunks/{Ce-yH_YC.js → B4kTYcAj.js} +1 -1
  8. package/web/app/immutable/chunks/{CNmaDvF0.js → B4rPFvYB.js} +1 -1
  9. package/web/app/immutable/chunks/{CTAo_xfr.js → B71JNHWD.js} +1 -1
  10. package/web/app/immutable/chunks/{DXzPHXdy.js → B7WyDdGX.js} +1 -1
  11. package/web/app/immutable/chunks/{DQRGzXhc.js → B9W8KfsY.js} +1 -1
  12. package/web/app/immutable/chunks/{CCnkAPpl.js → BDPOc7V6.js} +2 -2
  13. package/web/app/immutable/chunks/{B-A6mwRI.js → BFCqCX6w.js} +3 -3
  14. package/web/app/immutable/chunks/{B_sNRuTe.js → BFM5w46H.js} +2 -2
  15. package/web/app/immutable/chunks/{CIQ9e2U5.js → BMAqdXv7.js} +1 -1
  16. package/web/app/immutable/chunks/{CXcReq9H.js → BNVmW1uZ.js} +1 -1
  17. package/web/app/immutable/chunks/{Cf3tAm27.js → BS2rXad-.js} +1 -1
  18. package/web/app/immutable/chunks/{CIxD8Y3D.js → BTLLp91d.js} +1 -1
  19. package/web/app/immutable/chunks/{BzTDbjTk.js → BXe1baKr.js} +1 -1
  20. package/web/app/immutable/chunks/{C1lZuRMP.js → BZXx4oAF.js} +1 -1
  21. package/web/app/immutable/chunks/{D32UmCj1.js → B_keSK2s.js} +1 -1
  22. package/web/app/immutable/chunks/{Dp2jYKgq.js → B_zHVi1K.js} +1 -1
  23. package/web/app/immutable/chunks/{DT5Q2Jmj.js → Bdc65NEQ.js} +1 -1
  24. package/web/app/immutable/chunks/{C7thT2ms.js → BeQgENlX.js} +2 -2
  25. package/web/app/immutable/chunks/{B23d5Yfo.js → Birl2IVg.js} +1 -1
  26. package/web/app/immutable/chunks/{CYpZUzoj.js → BkihpvKL.js} +1 -1
  27. package/web/app/immutable/chunks/{CJ1Dpkrt.js → BlFd81-v.js} +1 -1
  28. package/web/app/immutable/chunks/{CCvVdljB.js → BlT4teVV.js} +4 -4
  29. package/web/app/immutable/chunks/{DoyVDaTb.js → Bps4iLJn.js} +4 -4
  30. package/web/app/immutable/chunks/{DBlqBvy2.js → Bqoh360O.js} +1 -1
  31. package/web/app/immutable/chunks/{Ds5aPEie.js → BsK6wYXS.js} +1 -1
  32. package/web/app/immutable/chunks/{Cn-YBhRU.js → BvJvc00D.js} +1 -1
  33. package/web/app/immutable/chunks/{CZVjbgX7.js → BvsWgdDN.js} +1 -1
  34. package/web/app/immutable/chunks/{BXx0_hoY.js → BwRzklL-.js} +1 -1
  35. package/web/app/immutable/chunks/{kreze8nM.js → Bz3o8mDx.js} +1 -1
  36. package/web/app/immutable/chunks/{BYHL7f-o.js → Bzwi2DK9.js} +1 -1
  37. package/web/app/immutable/chunks/{ENrq2u9U.js → C-ed1TQP.js} +1 -1
  38. package/web/app/immutable/chunks/{C6zxCrip.js → C77WGAqb.js} +1 -1
  39. package/web/app/immutable/chunks/{B1uzxfut.js → CCm4GqAl.js} +1 -1
  40. package/web/app/immutable/chunks/{rEy1x9l-.js → CHoHyRl1.js} +1 -1
  41. package/web/app/immutable/chunks/{DZV2V5fi.js → CKLDoMvu.js} +1 -1
  42. package/web/app/immutable/chunks/{DdvHgSkO.js → CNe7onyb.js} +1 -1
  43. package/web/app/immutable/chunks/{ryt6otaw.js → COluFRpM.js} +1 -1
  44. package/web/app/immutable/chunks/{B4eFGFID.js → COnjfEGr.js} +1 -1
  45. package/web/app/immutable/chunks/{LhcvTANM.js → CQGCQvNO.js} +1 -1
  46. package/web/app/immutable/chunks/{DijIGUXn.js → CQdlmcpA.js} +1 -1
  47. package/web/app/immutable/chunks/{s0HC56rw.js → CT1ksaco.js} +1 -1
  48. package/web/app/immutable/chunks/{l7dT_A_I.js → CTznmnCI.js} +1 -1
  49. package/web/app/immutable/chunks/{DhL3Eboo.js → CUs0opCC.js} +1 -1
  50. package/web/app/immutable/chunks/{CekMEpak.js → CW7SMyin.js} +1 -1
  51. package/web/app/immutable/chunks/{NDgheiFV.js → CYgkTCkB.js} +1 -1
  52. package/web/app/immutable/chunks/{C7DZvlvi.js → CZZEgzPG.js} +1 -1
  53. package/web/app/immutable/chunks/{DfczcOVE.js → CZh3YXGa.js} +1 -1
  54. package/web/app/immutable/chunks/{CPyvU1r-.js → CZlx42aK.js} +1 -1
  55. package/web/app/immutable/chunks/{aCadB4nL.js → C_8_aIYH.js} +1 -1
  56. package/web/app/immutable/chunks/{DpovJWOP.js → Ca-HFDl4.js} +1 -1
  57. package/web/app/immutable/chunks/{BQLTqtmQ.js → CbVy_SFp.js} +1 -1
  58. package/web/app/immutable/chunks/{QSo6OuKO.js → Cc2zTL0w.js} +1 -1
  59. package/web/app/immutable/chunks/{Dbi5oC7F.js → Chj4eExC.js} +1 -1
  60. package/web/app/immutable/chunks/{BM-Wmgwu.js → CiOVJ92X.js} +1 -1
  61. package/web/app/immutable/chunks/{D-fXqqnE.js → Cj2RYqvI.js} +1 -1
  62. package/web/app/immutable/chunks/{DZRY3xSl.js → CoxfoefW.js} +1 -1
  63. package/web/app/immutable/chunks/{F6m_bVNY.js → CoyCN9J6.js} +1 -1
  64. package/web/app/immutable/chunks/{Cbq5Om9o.js → CpAH86bK.js} +1 -1
  65. package/web/app/immutable/chunks/{_2a4fTCb.js → CqPWbhqQ.js} +1 -1
  66. package/web/app/immutable/chunks/{CcgdffiB.js → CqX9OYLx.js} +1 -1
  67. package/web/app/immutable/chunks/{C_un4XFs.js → CrDXkRmL.js} +3 -3
  68. package/web/app/immutable/chunks/{BgILVAPs.js → CruURYIo.js} +1 -1
  69. package/web/app/immutable/chunks/{CZRQTHTi.js → CsP3_IiP.js} +1 -1
  70. package/web/app/immutable/chunks/{DcqjhmJI.js → CsdYTvLa.js} +1 -1
  71. package/web/app/immutable/chunks/{DzGY80DS.js → CuMYCRBc.js} +1 -1
  72. package/web/app/immutable/chunks/{cDn1Yz-L.js → CvOEFHIi.js} +1 -1
  73. package/web/app/immutable/chunks/{DCjZb7I_.js → CvfICP_e.js} +3 -3
  74. package/web/app/immutable/chunks/{RGzrW3oT.js → CyIRNhfo.js} +1 -1
  75. package/web/app/immutable/chunks/{DZvUc-jV.js → CzTOJ-RC.js} +1 -1
  76. package/web/app/immutable/chunks/{DtgYGVlq.js → D26xAGUV.js} +2 -2
  77. package/web/app/immutable/chunks/{-7gmVeUK.js → D39kn1Kj.js} +1 -1
  78. package/web/app/immutable/chunks/{dcX3GC1e.js → D5XNO0iw.js} +12 -12
  79. package/web/app/immutable/chunks/{B823L8ep.js → D8rDmkBS.js} +1 -1
  80. package/web/app/immutable/chunks/{BhEgU_4W.js → D9JU74lv.js} +1 -1
  81. package/web/app/immutable/chunks/{Bapgv9X7.js → DAdnLTte.js} +1 -1
  82. package/web/app/immutable/chunks/{VBxTbW_s.js → DBLNxGLo.js} +2 -2
  83. package/web/app/immutable/chunks/{BDBW9UZ2.js → DBtReqdq.js} +1 -1
  84. package/web/app/immutable/chunks/{BG8fdwua.js → DDd0mrO_.js} +1 -1
  85. package/web/app/immutable/chunks/{8Gv9_SMI.js → DGPt1Rmr.js} +1 -1
  86. package/web/app/immutable/chunks/{DMa8lRWY.js → DIo6dt4D.js} +1 -1
  87. package/web/app/immutable/chunks/{ZoN-HTET.js → DIzQd2Pc.js} +1 -1
  88. package/web/app/immutable/chunks/{CkD6WGjQ.js → DJtfG0d7.js} +1 -1
  89. package/web/app/immutable/chunks/{pFPptWXo.js → DPWE7gCc.js} +1 -1
  90. package/web/app/immutable/chunks/{C4IXfWJj.js → DQOXI0aG.js} +1 -1
  91. package/web/app/immutable/chunks/{Bv6xs8L-.js → DRfFNuAv.js} +1 -1
  92. package/web/app/immutable/chunks/{CnMfB5o1.js → DYR-Lw2g.js} +2 -2
  93. package/web/app/immutable/chunks/{CxLMdxaj.js → DaGPt6aR.js} +1 -1
  94. package/web/app/immutable/chunks/{k7VteEqF.js → DbwBDRhB.js} +1 -1
  95. package/web/app/immutable/chunks/{CeWSOi2a.js → DdHWhFZW.js} +1 -1
  96. package/web/app/immutable/chunks/{xl-EDhgG.js → Deeg9Eu-.js} +1 -1
  97. package/web/app/immutable/chunks/{A7KY6R2O.js → DgI1Tl0-.js} +1 -1
  98. package/web/app/immutable/chunks/{BuRppXky.js → Dijipve3.js} +1 -1
  99. package/web/app/immutable/chunks/{BZOTEYEY.js → Dj3yCQKZ.js} +1 -1
  100. package/web/app/immutable/chunks/{BrGpSYk2.js → DkrbZVri.js} +3 -3
  101. package/web/app/immutable/chunks/{Hz-7JeWl.js → DpR5pCWV.js} +1 -1
  102. package/web/app/immutable/chunks/{DLJWWJE5.js → DqbmScxl.js} +1 -1
  103. package/web/app/immutable/chunks/{CcAIrTom.js → DsfybZhj.js} +1 -1
  104. package/web/app/immutable/chunks/{BiBFPcjE.js → Dys6C3u0.js} +1 -1
  105. package/web/app/immutable/chunks/{BMg7nPuL.js → DzaZjwWE.js} +4 -4
  106. package/web/app/immutable/chunks/{Cpe1wSXn.js → Exl2b2cW.js} +3 -3
  107. package/web/app/immutable/chunks/{CyHBMY4h.js → FLqL4ipM.js} +1 -1
  108. package/web/app/immutable/chunks/{4c19Vd75.js → Hd61r63s.js} +1 -1
  109. package/web/app/immutable/chunks/{NqvfaOJW.js → HxiDYrBi.js} +2 -2
  110. package/web/app/immutable/chunks/{DUt3xZ1M.js → K8bSaOgl.js} +1 -1
  111. package/web/app/immutable/chunks/{DOQMErS-.js → OzS1Lc27.js} +1 -1
  112. package/web/app/immutable/chunks/{C84ZX8cd.js → QCacuydi.js} +1 -1
  113. package/web/app/immutable/chunks/{DVSId-GR.js → ZbRk-UkQ.js} +1 -1
  114. package/web/app/immutable/chunks/{DatzKkab.js → aKDMgeHa.js} +1 -1
  115. package/web/app/immutable/chunks/{CACc5HER.js → cuI1HNig.js} +1 -1
  116. package/web/app/immutable/chunks/{BgEs_TeL.js → hoB_B0gc.js} +1 -1
  117. package/web/app/immutable/chunks/{DxAPD7L7.js → i_NTivOk.js} +1 -1
  118. package/web/app/immutable/chunks/{CwiHYSkL.js → izSb4qrH.js} +1 -1
  119. package/web/app/immutable/chunks/{ANMlC0NI.js → l0ISWt9F.js} +6 -6
  120. package/web/app/immutable/chunks/{Bz2t5xK9.js → m-YSnsRn.js} +1 -1
  121. package/web/app/immutable/chunks/{doJ1Sz8A.js → nhXrKuzk.js} +2 -2
  122. package/web/app/immutable/chunks/{BsGK8he7.js → uNdiTdeS.js} +1 -1
  123. package/web/app/immutable/chunks/{CO_SSNcv.js → vYw2RcgV.js} +1 -1
  124. package/web/app/immutable/chunks/{DGW5dV5l.js → wZy9ojGD.js} +1 -1
  125. package/web/app/immutable/chunks/{DcWpWnVi.js → zapl_pAB.js} +1 -1
  126. package/web/app/immutable/entry/{app.BbPhoWSk.js → app.DvMxHwjm.js} +2 -2
  127. package/web/app/immutable/entry/start.CdInQEt-.js +1 -0
  128. package/web/app/immutable/nodes/{0.Dw6M_WBs.js → 0.CSBCH_h-.js} +1 -1
  129. package/web/app/immutable/nodes/{1.BH9vg_er.js → 1.BJSseA5f.js} +1 -1
  130. package/web/app/immutable/nodes/{10.CsLCX161.js → 10.BdrqBgeF.js} +1 -1
  131. package/web/app/immutable/nodes/{14.KrsQ8qD7.js → 14.DMwnrSCT.js} +1 -1
  132. package/web/app/immutable/nodes/{18.C9430ImP.js → 18.-WSN77ch.js} +2 -2
  133. package/web/app/immutable/nodes/{2.BvA7ukrZ.js → 2.guxMA4od.js} +4 -4
  134. package/web/app/immutable/nodes/{3.IFM-xmst.js → 3.0mLDvvZX.js} +1 -1
  135. package/web/app/immutable/nodes/{4.XoTkKBlw.js → 4.C3jl9cd0.js} +1 -1
  136. package/web/app/immutable/nodes/{5.k6nEeF1l.js → 5.DNZ2mydt.js} +1 -1
  137. package/web/app/immutable/nodes/{6.B2DQsTaQ.js → 6.BhCpj7WE.js} +1 -1
  138. package/web/app/immutable/nodes/{7.CIgktKus.js → 7.Btgbvayk.js} +1 -1
  139. package/web/app/immutable/nodes/{8.g21Iin89.js → 8.BEZLI5FY.js} +4 -4
  140. package/web/app/immutable/nodes/{9.do1SRV7N.js → 9.DOOOdUl6.js} +4 -4
  141. package/web/app/version.json +1 -1
  142. package/web/index.html +9 -9
  143. package/web/app/immutable/entry/start.CzmyJjmJ.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/Bapgv9X7.js","/app/immutable/chunks/Bv2KudWv.js","/app/immutable/chunks/CEsW1euQ.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/Y9-4hTF9.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/BL2lJmRT.js","/app/immutable/chunks/cFbB-5Cu.js","/app/immutable/chunks/CrWhihJ_.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/q6hitSEG.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/BZQDFgmp.js","/app/immutable/chunks/DOH10_LL.js","/app/immutable/chunks/CIpI7Qrh.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/CPKMQWOs.js","/app/immutable/chunks/C6vwP-ay.js","/app/immutable/chunks/BLgIfeYS.js","/app/immutable/chunks/DU9Ky5os.js","/app/immutable/chunks/tU_ZJtMw.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/CO4a0yRH.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/Mc93eSxl.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/ClH0Gega.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/5GYSXevc.js","/app/immutable/chunks/DNWBkvFP.js","/app/immutable/chunks/CpHzYkzi.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/aos1n-nT.js","/app/immutable/chunks/ddhULx4L.js","/app/immutable/chunks/D-l6NLYy.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/CnMfB5o1.js","/app/immutable/chunks/CqzfYhYr.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/DQlH_Wce.js","/app/immutable/chunks/DLIkH-mx.js","/app/immutable/chunks/aQy6qVNs.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 Rt,O as xt,dG as Be,cG as pe,dr as Pt,al as Bt,b1 as Ge,z as Ot,dS as $t}from"./ClH0Gega.js";import{Iz as A,g as be,nw as R,vM as Ut,Bz as Ye,vO as Lt,CM as Je,cw as Nt,cx as Ht,nx as Qe,nj as Ft,c as ke,fE as Kt,lM as Wt,cE as jt}from"./tU_ZJtMw.js";import{e as qt,b as ae,F as zt,y as re,_ as ve,G as Vt,C as Gt,W as Xe,v as Yt,u as Jt,M as Qt}from"./CO4a0yRH.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"./CEbGQG52.js";import{a as et,e as sn}from"./DNWBkvFP.js";import{f as on}from"./BhpN5y2w.js";import{bo as b,_ as fe}from"./Y9-4hTF9.js";import{a9 as tt,aA as se,J as he,a as nt,n as at,cQ as rt,e as st,aH as it,M as cn,ab as ln,aT as $e,d as le,C as dn,cR as un,U as mn,a6 as pn,aI as fn,bY as hn}from"./D-fXqqnE.js";import{W as gn,L as yn,w as wn,R as bn,M as kn,h as vn}from"./DOH10_LL.js";import{N as _n,z as Sn}from"./CEsW1euQ.js";import{t as q,q as Mn,v as An}from"./BLgIfeYS.js";import{x as In,J as Tn,ai as En,ar as Cn}from"./DCjZb7I_.js";import{a as Ue,b as Dn,g as Rn}from"./DypB-Dwi.js";import{z as xn}from"./aos1n-nT.js";import{C as Pn}from"./BvFAWM27.js";import{i as Bn}from"./TPdIgwsT.js";import{o as $,e as On,l as z,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?Rt(e):!1)&&!Nn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function Rr(e){return xt(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 xr(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 zn(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=zn(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,Vn=["image/png","image/jpeg","image/webp"],Ne=e=>Vn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function 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:R(n.drafts,zt(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=Vt(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 xe=n?await pt(i):null;if(u(),n&&(e!==be||xe?.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/DAdnLTte.js","/app/immutable/chunks/Bv2KudWv.js","/app/immutable/chunks/CEsW1euQ.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/Y9-4hTF9.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/BL2lJmRT.js","/app/immutable/chunks/cFbB-5Cu.js","/app/immutable/chunks/CrWhihJ_.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/q6hitSEG.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/BZQDFgmp.js","/app/immutable/chunks/DOH10_LL.js","/app/immutable/chunks/CIpI7Qrh.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/CPKMQWOs.js","/app/immutable/chunks/C6vwP-ay.js","/app/immutable/chunks/BLgIfeYS.js","/app/immutable/chunks/DU9Ky5os.js","/app/immutable/chunks/tU_ZJtMw.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/CO4a0yRH.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/Mc93eSxl.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/ClH0Gega.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/5GYSXevc.js","/app/immutable/chunks/DNWBkvFP.js","/app/immutable/chunks/CpHzYkzi.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/aos1n-nT.js","/app/immutable/chunks/ddhULx4L.js","/app/immutable/chunks/D-l6NLYy.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/DYR-Lw2g.js","/app/immutable/chunks/CqzfYhYr.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/DQlH_Wce.js","/app/immutable/chunks/DLIkH-mx.js","/app/immutable/chunks/aQy6qVNs.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 Rt,O as xt,dG as Be,cG as pe,dr as Pt,al as Bt,b1 as Ge,z as Ot,dS as $t}from"./ClH0Gega.js";import{Iz as A,g as be,nw as R,vM as Ut,Bz as Ye,vO as Lt,CM as Je,cw as Nt,cx as Ht,nx as Qe,nj as Ft,c as ke,fE as Kt,lM as Wt,cE as jt}from"./tU_ZJtMw.js";import{e as qt,b as ae,F as zt,y as re,_ as ve,G as Vt,C as Gt,W as Xe,v as Yt,u as Jt,M as Qt}from"./CO4a0yRH.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"./CEbGQG52.js";import{a as et,e as sn}from"./DNWBkvFP.js";import{f as on}from"./BhpN5y2w.js";import{bo as b,_ as fe}from"./Y9-4hTF9.js";import{a9 as tt,aA as se,J as he,a as nt,n as at,cQ as rt,e as st,aH as it,M as cn,ab as ln,aT as $e,d as le,C as dn,cR as un,U as mn,a6 as pn,aI as fn,bY as hn}from"./Cj2RYqvI.js";import{W as gn,L as yn,w as wn,R as bn,M as kn,h as vn}from"./DOH10_LL.js";import{N as _n,z as Sn}from"./CEsW1euQ.js";import{t as q,q as Mn,v as An}from"./BLgIfeYS.js";import{x as In,J as Tn,ai as En,ar as Cn}from"./CvfICP_e.js";import{a as Ue,b as Dn,g as Rn}from"./DypB-Dwi.js";import{z as xn}from"./aos1n-nT.js";import{C as Pn}from"./BvFAWM27.js";import{i as Bn}from"./TPdIgwsT.js";import{o as $,e as On,l as z,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?Rt(e):!1)&&!Nn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function Rr(e){return xt(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 xr(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 zn(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=zn(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,Vn=["image/png","image/jpeg","image/webp"],Ne=e=>Vn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function 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:R(n.drafts,zt(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=Vt(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 xe=n?await pt(i):null;if(u(),n&&(e!==be||xe?.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 zr(){try{return et()&&localStorage.getItem(Aa)==="1"}catch{return!1}}function Vr(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 Ra(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&&R(s.submissions,r.id)?r:null}function xa(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=Ra(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ye(h.scope,c)&&(!!R(h.operations,u.id)||!!R(h.submissions,u.id))}}:null}function we(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??Tn();return xa(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=R(o.tombstones,s.id);return R(o.submissions,s.id)||p&&p.reason!=="rejected"?null:we(A,e,l)}if(r.outcome==="accepted")return we(A,e,l);await Promise.all([En(e,t).catch(()=>{}),Cn(e,t).catch(()=>{})]);const c=i();if(!c||R(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./Bapgv9X7.js").then(m=>m.E);return{notify:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41]),import.meta.url);if(i()!==c)return null;let u=!1;const h=()=>{u=!0};return d.warning(b.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${s.id}`,duration:Number.POSITIVE_INFINITY,action:{label:b.agent_chatSend_resend_label(),onClick:()=>{if(u)return;u=!0;const p=i();!p||p.generation!==c.generation||p.submissions!==c.submissions||p.observationVersion!==c.observationVersion||R(p.submissions,s.id)?.status!=="uncertain"||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=R(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&&!xn(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 Rs(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 za=Pn,Va=2;function xs(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=za,nearPages:s=Va}=e;if(n<=0||t>=n)return"serial";const i=Ee(a??Number.NaN);return(n-Math.max(0,t))/i>s*r?"seek":"serial"}const yt=200,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:z("failed").optional(),screen:On().optional()}),wt=$({text:E(),attachments:$n(Qa)}),V={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};Un("kind",[$({...V,kind:z("read")}),$({...V,...ne,kind:z("edit"),origin:E().min(1),sequence:ce().int().positive(),snapshot:wt}),$({...V,...ne,kind:z("flush")}),$({...V,...ne,kind:z("clear"),origin:E().min(1)})]);const bt=$({...V,...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),()=>Rn(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?R(a.userMessageIndexes,n):void 0}),js=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(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 zs(e){return e&&tr.has(e)?"pulse":e&&nr.has(e)?"twist":"bloom"}const _t="stalled";function Vs(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 ze={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:ze.title,message:ze.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)=>R(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,x=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const or=200;function cr(e,t){if(x.delete(e),x.set(e,t),x.size>or){const n=x.keys().next().value;n!==void 0&&x.delete(n)}}function At(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function ai(e){return At(e)?.id??null}function ri(e){De(e,{requireViewedAndFocused:!0})}function si(e){De(e,{requireViewedAndFocused:!1})}function ii(e){Ce(),De(e,Mt)}function oi(e){W===e&&(J.has(e)||(W=null,Re(e,Mt)))}function ci(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),Re(t,{requireViewedAndFocused:!1}))}function It(e){const t=J.get(e);t&&(clearTimeout(t.timer),J.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{J.delete(e),Re(e,t)},ir);J.set(e,{timer:n,gates:t})}let Ve=null;function lr(){return Ve??=Promise.all([fe(()=>import("./CqzfYhYr.js"),__vite__mapDeps([42,21,22,5,23,24,3,8,4,25,15,2,43,44]),import.meta.url),fe(()=>import("./DLIkH-mx.js").then(e=>e.o),__vite__mapDeps([45,40,4,5,21,22,23,24,3,8,25,15,2,13,14,7,9,16,36,35,46,32,39]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),Ve}async function Re(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(x.get(e)===c)return;cr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&x.get(e)===n&&x.delete(e)}catch{n!==null&&x.get(e)===n&&x.delete(e)}}const oe=new Map;function Tt(e,t){return`${e}\0${t}`}function li(e,t){return oe.get(Tt(e,t))}function di(e,t,n){oe.set(Tt(e,t),n)}function ui(e){if(e.length===0)return;const t=new Set(e);for(const n of[...oe.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&oe.delete(n)}}export{bs as $,Br as A,Vr 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,Vs 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,zs 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,Rr 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,xr as aq,vs as ar,Rs 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,xs 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,zr 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 Ra(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&&R(s.submissions,r.id)?r:null}function xa(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=Ra(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ye(h.scope,c)&&(!!R(h.operations,u.id)||!!R(h.submissions,u.id))}}:null}function we(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??Tn();return xa(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=R(o.tombstones,s.id);return R(o.submissions,s.id)||p&&p.reason!=="rejected"?null:we(A,e,l)}if(r.outcome==="accepted")return we(A,e,l);await Promise.all([En(e,t).catch(()=>{}),Cn(e,t).catch(()=>{})]);const c=i();if(!c||R(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./DAdnLTte.js").then(m=>m.E);return{notify:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41]),import.meta.url);if(i()!==c)return null;let u=!1;const h=()=>{u=!0};return d.warning(b.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${s.id}`,duration:Number.POSITIVE_INFINITY,action:{label:b.agent_chatSend_resend_label(),onClick:()=>{if(u)return;u=!0;const p=i();!p||p.generation!==c.generation||p.submissions!==c.submissions||p.observationVersion!==c.observationVersion||R(p.submissions,s.id)?.status!=="uncertain"||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=R(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&&!xn(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 Rs(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 za=Pn,Va=2;function xs(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=za,nearPages:s=Va}=e;if(n<=0||t>=n)return"serial";const i=Ee(a??Number.NaN);return(n-Math.max(0,t))/i>s*r?"seek":"serial"}const yt=200,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:z("failed").optional(),screen:On().optional()}),wt=$({text:E(),attachments:$n(Qa)}),V={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};Un("kind",[$({...V,kind:z("read")}),$({...V,...ne,kind:z("edit"),origin:E().min(1),sequence:ce().int().positive(),snapshot:wt}),$({...V,...ne,kind:z("flush")}),$({...V,...ne,kind:z("clear"),origin:E().min(1)})]);const bt=$({...V,...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),()=>Rn(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?R(a.userMessageIndexes,n):void 0}),js=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(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 zs(e){return e&&tr.has(e)?"pulse":e&&nr.has(e)?"twist":"bloom"}const _t="stalled";function Vs(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 ze={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:ze.title,message:ze.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)=>R(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,x=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const or=200;function cr(e,t){if(x.delete(e),x.set(e,t),x.size>or){const n=x.keys().next().value;n!==void 0&&x.delete(n)}}function At(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function ai(e){return At(e)?.id??null}function ri(e){De(e,{requireViewedAndFocused:!0})}function si(e){De(e,{requireViewedAndFocused:!1})}function ii(e){Ce(),De(e,Mt)}function oi(e){W===e&&(J.has(e)||(W=null,Re(e,Mt)))}function ci(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),Re(t,{requireViewedAndFocused:!1}))}function It(e){const t=J.get(e);t&&(clearTimeout(t.timer),J.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{J.delete(e),Re(e,t)},ir);J.set(e,{timer:n,gates:t})}let Ve=null;function lr(){return Ve??=Promise.all([fe(()=>import("./CqzfYhYr.js"),__vite__mapDeps([42,21,22,5,23,24,3,8,4,25,15,2,43,44]),import.meta.url),fe(()=>import("./DLIkH-mx.js").then(e=>e.o),__vite__mapDeps([45,40,4,5,21,22,23,24,3,8,25,15,2,13,14,7,9,16,36,35,46,32,39]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),Ve}async function Re(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(x.get(e)===c)return;cr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&x.get(e)===n&&x.delete(e)}catch{n!==null&&x.get(e)===n&&x.delete(e)}}const oe=new Map;function Tt(e,t){return`${e}\0${t}`}function li(e,t){return oe.get(Tt(e,t))}function di(e,t,n){oe.set(Tt(e,t),n)}function ui(e){if(e.length===0)return;const t=new Set(e);for(const n of[...oe.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&oe.delete(n)}}export{bs as $,Br as A,Vr 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,Vs 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,zs 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,Rr 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,xr as aq,vs as ar,Rs 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,xs 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,zr as x,ge as y,qn as z};
@@ -1,4 +1,4 @@
1
- import{t as Ke,bq as y,bo as Ce,by as Ue,b as Ve,q as ur,n as vr,r as gr,o as fr,p as hr,s as mr,bu as ht,bs as pr,f as _r,l as xr,g as br,e as wr,d as yr,m as kr,j as $r,i as Sr,h as Cr,k as Nr}from"./Y9-4hTF9.js";import{bs as Je,ca as Xe,aD as e,ay as be,a5 as o,bH as I,bS as n,a7 as Pt,W as i,be as st,b$ as et,b_ as M,bO as C,bA as s,bl as O,bn as qe,bV as we,aA as k,c9 as _,aB as x,br as mt}from"./DYhIMPy1.js";import{ny as Rr,Iz as ct,mG as Tt,e9 as Mr,et as Pr,eu as Ir}from"./tU_ZJtMw.js";import{i as E}from"./BL2lJmRT.js";import{I as He,D as Oe,y as Lr,h as at}from"./BLgIfeYS.js";import{dr as Ar,bf as zr}from"./ClH0Gega.js";import{a9 as jt}from"./Cpe1wSXn.js";import{I as it,g as Be,i as It}from"./BZQDFgmp.js";import{f as xe}from"./q6hitSEG.js";import"./DOH10_LL.js";import{f as Ee,s as Er}from"./cFbB-5Cu.js";import"./CrWhihJ_.js";import{F as fe,_ as Dr,cM as Hr,as as ot,at as pt,bZ as Wr,aR as Tr,bJ as jr,bD as Fr,b5 as Gr,cR as Br,ci as Or,b2 as St,cW as Rt,cm as _t,bk as Kr,cA as Ur,aq as Vr}from"./Mc93eSxl.js";import{i as Jr}from"./dcX3GC1e.js";import{z as Ft,B as qr}from"./C7thT2ms.js";import{H as Gt}from"./CcNhqKh5.js";import{I as Vt}from"./DYxNs3ex.js";import"./-FMYDRBF.js";import{M as Mt}from"./DoyVDaTb.js";import{t as Ct}from"./BS8Oxiwq.js";const Qr=[/^diff --git /,/^index\s/,/^---\s/,/^\+\+\+\s/,/^\/];function Yr($){const r=[];if(!$)return r;const d=$.split(`
1
+ import{t as Ke,bq as y,bo as Ce,by as Ue,b as Ve,q as ur,n as vr,r as gr,o as fr,p as hr,s as mr,bu as ht,bs as pr,f as _r,l as xr,g as br,e as wr,d as yr,m as kr,j as $r,i as Sr,h as Cr,k as Nr}from"./Y9-4hTF9.js";import{bs as Je,ca as Xe,aD as e,ay as be,a5 as o,bH as I,bS as n,a7 as Pt,W as i,be as st,b$ as et,b_ as M,bO as C,bA as s,bl as O,bn as qe,bV as we,aA as k,c9 as _,aB as x,br as mt}from"./DYhIMPy1.js";import{ny as Rr,Iz as ct,mG as Tt,e9 as Mr,et as Pr,eu as Ir}from"./tU_ZJtMw.js";import{i as E}from"./BL2lJmRT.js";import{I as He,D as Oe,y as Lr,h as at}from"./BLgIfeYS.js";import{dr as Ar,bf as zr}from"./ClH0Gega.js";import{a9 as jt}from"./Exl2b2cW.js";import{I as it,g as Be,i as It}from"./BZQDFgmp.js";import{f as xe}from"./q6hitSEG.js";import"./DOH10_LL.js";import{f as Ee,s as Er}from"./cFbB-5Cu.js";import"./CrWhihJ_.js";import{F as fe,_ as Dr,cM as Hr,as as ot,at as pt,bZ as Wr,aR as Tr,bJ as jr,bD as Fr,b5 as Gr,cR as Br,ci as Or,b2 as St,cW as Rt,cm as _t,bk as Kr,cA as Ur,aq as Vr}from"./Mc93eSxl.js";import{i as Jr}from"./D5XNO0iw.js";import{z as Ft,B as qr}from"./BeQgENlX.js";import{H as Gt}from"./CcNhqKh5.js";import{I as Vt}from"./DYxNs3ex.js";import"./-FMYDRBF.js";import{M as Mt}from"./Bps4iLJn.js";import{t as Ct}from"./BS8Oxiwq.js";const Qr=[/^diff --git /,/^index\s/,/^---\s/,/^\+\+\+\s/,/^\/];function Yr($){const r=[];if(!$)return r;const d=$.split(`
2
2
  `);let m=null,b=0,u=0;const T=P=>{const h=P.match(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),J=h?parseInt(h[1],10):0,K=h&&h[2]?parseInt(h[2],10):null,pe=h?parseInt(h[3],10):0,q=h&&h[4]?parseInt(h[4],10):null;m={header:P,oldStart:J,oldLines:K,newStart:pe,newLines:q,lines:[]},r.push(m),b=J,u=pe};for(const P of d){if(P.startsWith("@@")){T(P);continue}if(!m)continue;const h=m;P.startsWith("+")?h.lines.push({type:"addition",content:P.slice(1),oldNum:null,newNum:u++,raw:P}):P.startsWith("-")?h.lines.push({type:"deletion",content:P.slice(1),oldNum:b++,newNum:null,raw:P}):P.startsWith(" ")?h.lines.push({type:"context",content:P.slice(1),oldNum:b++,newNum:u++,raw:P}):Qr.some(J=>J.test(P))||P.trim()===""&&h.lines.push({type:"context",content:"",oldNum:b++,newNum:u++,raw:P})}return r}var Zr=x('<div><!> <!> <!></div> <p class="text-ui text-subtle mt-1"> </p>',1);function Jt($,r){if(new.target)return Ke({component:Jt,...$});Je(r,!0);let d=y(r,"lineNumber",7,0),m=y(r,"fileName",7,""),b=y(r,"onSend",7),u=y(r,"onClose",7),T=y(r,"isSending",7,!1),P=y(r,"class",7,""),h=we(""),J=we(null);Xe(()=>{e(J)&&e(J).focus()});function K(){!e(h).trim()||T()||(b()?.(e(h).trim(),d(),m()),I(h,""))}function pe(L){L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),K()),L.key==="Escape"&&u()?.()}var q={get lineNumber(){return d()},set lineNumber(L=0){d(L),k()},get fileName(){return m()},set fileName(L=""){m(L),k()},get onSend(){return b()},set onSend(L){b(L),k()},get onClose(){return u()},set onClose(L){u(L),k()},get isSending(){return T()},set isSending(L=!1){T(L),k()},get class(){return P()},set class(L=""){P(L),k()},$set:Ue,$on:(L,he)=>Ve(r,L,he)},w=Zr(),D=be(w),de=o(D);{let L=_(()=>Ce.codeReview_inlineComment_askLine_placeholder());Vt(de,{onkeydown:pe,get placeholder(){return e(L)},get disabled(){return T()},class:"flex-1 h-8 rounded-md border border-border bg-background px-3 text-sm placeholder:text-muted-foreground disabled:opacity-50",get ref(){return e(J)},set ref(he){I(J,he,!0)},get value(){return e(h)},set value(he){I(h,he,!0)}})}var ce=n(de,2);{let L=_(()=>!e(h).trim()||T());xe(ce,{type:"button",variant:"primary",onclick:K,get disabled(){return e(L)},class:"h-8 w-8 p-0",children:(he,Ne)=>{var _e=Pt(),S=be(_e);{var z=me=>{it(me,{size:14})},Le=me=>{fe(me,{get icon(){return Dr},class:"h-3.5 w-3.5"})};E(S,me=>{T()?me(z):me(Le,-1)})}i(he,_e)},$$slots:{default:!0}})}var ae=n(ce,2);xe(ae,{type:"button",variant:"ghost",onclick:()=>u()?.(),class:"h-8 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors",children:(L,he)=>{st();var Ne=et();M(_e=>C(Ne,_e),[()=>Ce.codeReview_inlineComment_cancel_label()]),i(L,Ne)},$$slots:{default:!0}}),s(D);var te=n(D,2),ye=O(te,!0);return M(L=>{Ee(D,1,`walkthrough-inline-comment flex items-center gap-2 ${P()??""}`),C(ye,L)},[()=>Ce.codeReview_inlineComment_inputHint_label()]),i($,w),qe(q)}var Xr=x('<div class="text-xs text-slate-400 dark:text-slate-500 mt-1"> </div>'),en=x('<span class="font-medium"> </span> <!>',1),tn=x('<div class="flex items-start gap-3 py-2"><div><!></div> <div class="flex-1 min-w-0"><div class="text-sm leading-relaxed text-slate-700 dark:text-slate-300"><!></div></div></div>'),rn=x('<div class="px-4 pb-3 divide-y divide-border"></div>'),nn=x('<div class="border-t border-border"><!> <!></div>'),an=x('<div class="flex items-center gap-2 px-4 py-2 text-xs text-slate-500 dark:text-slate-400 border-t border-border"><!> <span> </span></div>'),sn=x('<div class="flex items-center gap-2"><!> <!> <!></div> <p class="text-ui text-slate-400 dark:text-slate-500 mt-1"> </p>',1),on=x("<!> <span> </span>",1),ln=x('<div><div class="flex items-start gap-3 px-4 py-3"><div class="shrink-0 mt-0.5"><!></div> <div class="flex-1 min-w-0"><div class="text-sm text-slate-800 dark:text-slate-200 leading-relaxed"><!></div> <!></div> <!></div> <!> <!> <div class="border-t border-border px-4 py-2"><!></div></div>');function qt($,r){if(new.target)return Ke({component:qt,...$});Je(r,!0);let d=y(r,"annotation",7),m=y(r,"lineNumber",7),b=y(r,"fileName",7),u=y(r,"messages",23,()=>[]),T=y(r,"onSendMessage",7),P=y(r,"onClose",7),h=y(r,"isSending",7,!1),J=y(r,"isAgentResponding",7,!1),K=y(r,"timestamp",7),pe=y(r,"class",7,""),q=we(""),w=we(!1),D=we(!1),de=we(null);Xe(()=>{e(w)&&e(de)&&e(de).focus()});function ce(){!e(q).trim()||h()||(T()?.(e(q).trim(),m(),b()),I(q,""))}function ae(a){a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),ce()),a.key==="Escape"&&(e(q)?I(q,""):I(w,!1))}function te(a){switch(a){case"highlight":return Gr;case"context":return Fr;case"explanation":default:return jr}}function ye(a){switch(a){case"highlight":return"text-orange-500";case"context":return"text-blue-500";case"explanation":default:return"text-warning-ink"}}function L(a){return a?Lr(a):""}const he=_(()=>u().length>0);var Ne={get annotation(){return d()},set annotation(a){d(a),k()},get lineNumber(){return m()},set lineNumber(a){m(a),k()},get fileName(){return b()},set fileName(a){b(a),k()},get messages(){return u()},set messages(a=[]){u(a),k()},get onSendMessage(){return T()},set onSendMessage(a){T(a),k()},get onClose(){return P()},set onClose(a){P(a),k()},get isSending(){return h()},set isSending(a=!1){h(a),k()},get isAgentResponding(){return J()},set isAgentResponding(a=!1){J(a),k()},get timestamp(){return K()},set timestamp(a){K(a),k()},get class(){return pe()},set class(a=""){pe(a),k()},$set:Ue,$on:(a,W)=>Ve(r,a,W)},_e=ln(),S=o(_e),z=o(S),Le=o(z);{let a=_(()=>te(d().type)),W=_(()=>ye(d().type));fe(Le,{get icon(){return e(a)},get class(){return`h-4 w-4 ${e(W)??""}`}})}s(z);var me=n(z,2),v=o(me),R=o(v);Mt(R,{get content(){return d().message},className:"[&>*:first-child]:mt-0 [&>*:last-child]:mb-0"}),s(v);var A=n(v,2);{var Z=a=>{var W=Xr(),X=O(W,!0);M(ee=>C(X,ee),[()=>L(K())]),i(a,W)};E(A,a=>{K()&&a(Z)})}s(me);var ie=n(me,2);{var $e=a=>{{let W=_(()=>Ce.codeReview_commentThread_dismiss_tooltip());xe(a,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,get onclick(){return P()},class:"shrink-0 text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300 transition-colors",get title(){return e(W)},children:(X,ee)=>{fe(X,{get icon(){return Hr}})},$$slots:{default:!0}})}};E(ie,a=>{P()&&a($e)})}s(S);var Se=n(S,2);{var ke=a=>{var W=nn(),X=o(W);xe(X,{type:"button",variant:"ghost",onclick:()=>I(D,!e(D)),class:"w-full flex items-center justify-between px-4 py-2 text-sm text-slate-600 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:(Q,se)=>{var Y=en(),c=be(Y),p=O(c,!0),G=n(c,2);{let ue=_(()=>e(D)?ot:pt);fe(G,{get icon(){return e(ue)},class:"h-3 w-3"})}M(ue=>C(p,ue),[()=>Ce.codeReview_commentThread_suggestedChanges_label()]),i(Q,Y)},$$slots:{default:!0}});var ee=n(X,2);{var re=Q=>{var se=rn();Be(se,21,u,Y=>Y.id,(Y,c)=>{var p=tn(),G=o(p),ue=o(G);{let g=_(()=>e(c).type==="user"?Br:Or),N=_(()=>e(c).type==="user"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400");fe(ue,{get icon(){return e(g)},get class(){return`h-2.5 w-2.5 ${e(N)??""}`}})}s(G);var Re=n(G,2),t=o(Re),l=o(t);Mt(l,{get content(){return e(c).content},className:"[&>*:first-child]:mt-0 [&>*:last-child]:mb-0"}),s(t),s(Re),s(p),M(()=>Ee(G,1,`shrink-0 flex h-5 w-5 items-center justify-center rounded-full ${e(c).type==="user"?"bg-blue-100 dark:bg-blue-900/50":"bg-purple-100 dark:bg-purple-900/50"}`)),He(3,p,()=>at,()=>({axis:"y",distance:4,tier:"moderate"})),i(Y,p)}),s(se),He(3,se,()=>Oe,()=>({tier:"moderate"})),i(Q,se)};E(ee,Q=>{e(D)&&Q(re)})}s(W),i(a,W)};E(Se,a=>{e(he)&&a(ke)})}var U=n(Se,2);{var j=a=>{var W=an(),X=o(W);it(X,{size:12});var ee=n(X,2),re=O(ee,!0);s(W),M(Q=>C(re,Q),[()=>Ce.codeReview_commentThread_agentResponding_label()]),i(a,W)};E(U,a=>{J()&&a(j)})}var f=n(U,2),H=o(f);{var F=a=>{var W=sn(),X=be(W),ee=o(X);{let c=_(()=>Ce.codeReview_commentThread_followUp_placeholder());Vt(ee,{onkeydown:ae,get placeholder(){return e(c)},get disabled(){return h()},class:"flex-1 h-8 rounded-md border border-border bg-white dark:bg-slate-800 px-3 text-sm placeholder:text-slate-400 disabled:opacity-50",get ref(){return e(de)},set ref(p){I(de,p,!0)},get value(){return e(q)},set value(p){I(q,p,!0)}})}var re=n(ee,2);{let c=_(()=>!e(q).trim()||h());xe(re,{type:"button",variant:"primary",onclick:ce,get disabled(){return e(c)},class:"h-8 w-8 p-0",children:(p,G)=>{var ue=Pt(),Re=be(ue);{var t=g=>{it(g,{size:14})},l=g=>{fe(g,{get icon(){return Wr},class:"h-3 w-3"})};E(Re,g=>{h()?g(t):g(l,-1)})}i(p,ue)},$$slots:{default:!0}})}var Q=n(re,2);xe(Q,{type:"button",variant:"ghost",onclick:()=>{I(w,!1),I(q,"")},class:"h-8 px-2 text-xs text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200 transition-colors",children:(c,p)=>{st();var G=et();M(ue=>C(G,ue),[()=>Ce.codeReview_commentThread_cancel_label()]),i(c,G)},$$slots:{default:!0}}),s(X);var se=n(X,2),Y=O(se,!0);M(c=>C(Y,c),[()=>Ce.codeReview_commentThread_inputHint_label()]),He(3,X,()=>Oe,()=>({tier:"fast"})),i(a,W)},le=a=>{xe(a,{type:"button",variant:"ghost",onclick:()=>I(w,!0),class:"flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400 hover:text-emerald-700 dark:hover:text-emerald-300 transition-colors",children:(W,X)=>{var ee=on(),re=be(ee);fe(re,{get icon(){return Tr},class:"h-3 w-3"});var Q=n(re,2),se=O(Q,!0);M(Y=>C(se,Y),[()=>Ce.codeReview_commentThread_askQuestion_label()]),i(W,ee)},$$slots:{default:!0}})};E(H,a=>{e(w)?a(F):a(le,-1)})}return s(f),s(_e),M(()=>Ee(_e,1,`walkthrough-comment-thread relative flex w-full flex-col bg-white shadow-sm dark:bg-slate-900 ${pe()??""}`)),He(3,_e,()=>Oe,()=>({tier:"moderate"})),i($,_e),qe(Ne)}var dn=x('<span class="text-emerald-600 dark:text-emerald-400 font-medium"> </span>'),cn=x('<!> <svg class="h-4 w-4 text-ghost shrink-0" viewBox="0 0 16 16" fill="currentColor"><path d="M3.5 1.5A1.5 1.5 0 0 1 5 0h6a1.5 1.5 0 0 1 1.5 1.5v12A1.5 1.5 0 0 1 11 15H5a1.5 1.5 0 0 1-1.5-1.5v-12zm2 0v12h6v-12H5.5z"></path></svg> <div class="flex items-baseline gap-2 flex-1 min-w-0"><span class="text-sm font-medium text-foreground truncate"> </span> <span class="text-xs text-subtle truncate hidden sm:inline"> </span></div> <div class="flex items-center gap-1 text-xs shrink-0"><!></div>',1),un=x('<div class="px-4 pb-3 -mt-1"><p class="text-sm text-subtle"> </p></div>'),vn=x('<div><div><span class="w-12 px-2 text-right text-ui text-subtle tabular-nums"> </span></div> <span> </span> <pre class="flex-1 px-1 whitespace-pre overflow-hidden text-ellipsis"><code class="hljs"></code></pre></div>'),gn=x('<div class="border-t border-border"><div class="font-mono text-xs leading-relaxed text-muted-foreground"><!> <!></div></div>'),fn=x('<span class="text-subtle">·</span> <!>',1),hn=x('<div class="flex items-center justify-end gap-2 px-3 py-1.5 bg-muted/20 border-b border-border text-xs"><!> <!></div>'),Bt=x("<!> <span> </span> <!>",1),mn=x('<div class="ml-20"><!></div>'),pn=x('<div class="ml-20 border-l-2 border-primary-ink/50 bg-muted/20"><div class="p-3"><!></div></div>'),_n=x('<div><div><span class="w-10 px-2 text-right text-ui text-subtle tabular-nums"> </span> <span class="w-10 px-2 text-right text-ui text-subtle tabular-nums"> </span></div> <span> </span> <div class="flex-1 flex items-center min-w-0 pr-2"><pre class="flex-1 px-1 whitespace-pre overflow-x-auto"><code class="hljs"></code></pre> <!></div></div> <!> <!> <!>',1),xn=x("<!> <!>",1),bn=x('<div class="relative"><!> <div class="overflow-x-auto"><div class="font-mono text-xs leading-relaxed min-w-full"></div></div></div>'),wn=x('<div><div class="flex flex-col border-b border-border"><!> <!></div> <!> <!></div>');function Lt($,r){if(new.target)return Ke({component:Lt,...$});Je(r,!0);let d=y(r,"fileName",7),m=y(r,"patch",7),b=y(r,"annotations",23,()=>[]),u=y(r,"initialCollapsed",7,!1),T=y(r,"contextLines",7,3),P=y(r,"onSendMessage",7),h=y(r,"isSending",7,!1),J=y(r,"additions",7,0),K=y(r,"deletions",7,0),pe=y(r,"fileDescription",7,""),q=y(r,"class",7,"");const w=_(()=>Yr(m())),D=_(()=>Rr(d())),de=_(()=>{const t=new Map;return!e(D)||e(D)==="text"||e(D)==="plaintext"||!Gt.getLanguage(e(D))||e(w).forEach(l=>{const g=[];if(l.lines.forEach(N=>{const B=N.content||"",V=`${N.oldNum}-${N.newNum}`;g.push({content:B,key:V})}),g.length!==0)try{const N=g.map(ne=>ne.content).join(`
3
3
  `),V=Gt.highlight(N,{language:e(D)}).value.split(`
4
4
  `);g.forEach((ne,oe)=>{oe<V.length&&t.set(ne.key,V[oe])})}catch(N){console.warn("Failed to highlight hunk:",N)}}),t});let ce=we(mt(u())),ae=we(mt(new Set)),te=we(null);const ye=_(()=>{const t=new Map;for(const l of b()){const g=t.get(l.line)||[];g.push(l),t.set(l.line,g)}return t}),L=_(()=>new Set(b().map(t=>t.line)));function he(t){if(t.type==="deletion")return[];const l=t.newNum;return l==null?[]:e(ye).get(l)||[]}function Ne(t,l,g){if(g.type==="addition"||g.type==="deletion")return!0;const N=g.newNum??g.oldNum;if(N!==null&&e(L).has(N))return!0;const B=e(w)[t];if(!B)return!1;for(let V=Math.max(0,l-T());V<=Math.min(B.lines.length-1,l+T());V++){const ne=B.lines[V];if(ne.type==="addition"||ne.type==="deletion")return!0;const oe=ne.newNum??ne.oldNum;if(oe!==null&&e(L).has(oe))return!0}for(const V of e(ae)){const[ne,oe,ve]=V.split("-").map(Number);if(ne===t&&l>=oe&&l<=ve)return!0}return!1}function _e(t){const l=e(w)[t];if(!l)return[];const g=[];let N=null;for(let B=0;B<l.lines.length;B++){const V=Ne(t,B,l.lines[B]);!V&&N===null?N=B:V&&N!==null&&(g.push({startIndex:N,endIndex:B-1,count:B-N}),N=null)}return N!==null&&g.push({startIndex:N,endIndex:l.lines.length-1,count:l.lines.length-N}),g}function S(t,l,g){const N=`${t}-${l}-${g}`;e(ae).add(N),I(ae,new Set(e(ae)),!0)}function z(){for(let t=0;t<e(w).length;t++){const l=e(w)[t];S(t,0,l.lines.length-1)}}function Le(){I(ae,new Set,!0)}function me(t){const l=`${t.oldNum}-${t.newNum}`,g=e(de).get(l);return g!==void 0?g:v(t.content||"")}function v(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R(t){switch(t.type){case"addition":return"bg-emerald-500/5 dark:bg-emerald-500/10";case"deletion":return"bg-red-500/5 dark:bg-red-500/10";default:return""}}function A(t){switch(t.type){case"addition":return"text-emerald-600 dark:text-emerald-400 font-medium";case"deletion":return"text-red-600 dark:text-red-400 font-medium";default:return"text-transparent"}}function Z(t){switch(t.type){case"addition":return"+";case"deletion":return"-";default:return" "}}function ie(t){switch(t.type){case"addition":return"bg-emerald-500/10 dark:bg-emerald-500/15";case"deletion":return"bg-red-500/10 dark:bg-red-500/15";default:return"bg-muted/30"}}function $e(){I(ce,!e(ce))}function Se(t){I(te,t,!0)}function ke(){I(te,null)}function U(t,l,g){P()?.(t,l,g),I(te,null)}const j=_(()=>()=>{const t=d().split("/");return t[t.length-1]}),f=_(()=>()=>{const t=d().split("/");return t.length<=1?"":t.slice(0,-1).join("/")}),H=_(()=>{for(let t=0;t<e(w).length;t++)if(_e(t).length>0)return!0;return!1}),F=_(()=>{const l=[];for(let g=0;g<e(w).length&&l.length<3;g++){const N=e(w)[g];for(let B=0;B<N.lines.length&&l.length<3;B++){const V=N.lines[B];(V.type==="addition"||V.type==="deletion")&&l.push({line:V,hunkIndex:g,lineIndex:B})}}return l}),le=_(()=>{let t=0;for(const l of e(w))for(const g of l.lines)(g.type==="addition"||g.type==="deletion")&&t++;return t});let a=we(mt(new Map));function W(t){return`${t.file}:${t.line}:${t.type}`}function X(t){return e(a).get(W(t))||[]}var ee={get fileName(){return d()},set fileName(t){d(t),k()},get patch(){return m()},set patch(t){m(t),k()},get annotations(){return b()},set annotations(t=[]){b(t),k()},get initialCollapsed(){return u()},set initialCollapsed(t=!1){u(t),k()},get contextLines(){return T()},set contextLines(t=3){T(t),k()},get onSendMessage(){return P()},set onSendMessage(t){P(t),k()},get isSending(){return h()},set isSending(t=!1){h(t),k()},get additions(){return J()},set additions(t=0){J(t),k()},get deletions(){return K()},set deletions(t=0){K(t),k()},get fileDescription(){return pe()},set fileDescription(t=""){pe(t),k()},get class(){return q()},set class(t=""){q(t),k()},$set:Ue,$on:(t,l)=>Ve(r,t,l)},re=wn(),Q=o(re),se=o(Q);xe(se,{type:"button",variant:"ghost",class:"w-full flex items-center gap-2 px-4 py-3 hover:bg-muted/30 transition-colors text-left group",onclick:$e,children:(t,l)=>{var g=cn(),N=be(g);{let Ie=_(()=>e(ce)?pt:ot);fe(N,{get icon(){return e(Ie)},class:"h-3 w-3 text-ghost shrink-0"})}var B=n(N,4),V=o(B),ne=O(V,!0),oe=n(V,2),ve=O(oe,!0);s(B);var Me=n(B,2),Ae=o(Me);{var We=Ie=>{var ze=dn(),Fe=O(ze);M(()=>C(Fe,`+${J()+K()}`)),i(Ie,ze)};E(Ae,Ie=>{(J()>0||K()>0)&&Ie(We)})}s(Me),M((Ie,ze)=>{C(ne,Ie),C(ve,ze)},[()=>e(j)(),()=>e(f)()]),i(t,g)},$$slots:{default:!0}});var Y=n(se,2);{var c=t=>{var l=un(),g=o(l),N=O(g,!0);s(l),M(()=>C(N,pe())),i(t,l)};E(Y,t=>{pe()&&t(c)})}s(Q);var p=n(Q,2);{var G=t=>{var l=gn(),g=o(l),N=o(g);Be(N,17,()=>e(F),({line:ne,hunkIndex:oe,lineIndex:ve})=>`preview-${oe}-${ve}`,(ne,oe)=>{let ve=()=>e(oe).line;var Me=vn(),Ae=o(Me),We=o(Ae),Ie=O(We,!0);s(Ae);var ze=n(Ae,2),Fe=O(ze,!0),Te=n(ze,2),ge=o(Te);Ft(ge,()=>me(ve()),!0),s(ge),s(Te),s(Me),M((Qe,Ye,Ze,tt)=>{Ee(Me,1,`flex ${Qe??""}`),Ee(Ae,1,`w-12 shrink-0 flex select-none ${Ye??""} border-r border-border`),C(Ie,ve().newNum??ve().oldNum??""),Ee(ze,1,`w-5 shrink-0 text-center select-none ${Ze??""}`),C(Fe,tt)},[()=>R(ve()),()=>ie(ve()),()=>A(ve()),()=>Z(ve())]),i(ne,Me)});var B=n(N,2);{var V=ne=>{xe(ne,{type:"button",variant:"ghost",class:"w-full py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors text-center",onclick:$e,children:(oe,ve)=>{st();var Me=et();M(Ae=>C(Me,Ae),[()=>Ce.codeReview_fileDiff_moreLines_label({count:e(le)-e(F).length})]),i(oe,Me)},$$slots:{default:!0}})};E(B,ne=>{e(le)>e(F).length&&ne(V)})}s(g),s(l),He(3,l,()=>Oe,()=>({tier:"moderate"})),i(t,l)};E(p,t=>{e(ce)&&e(F).length>0&&t(G)})}var ue=n(p,2);{var Re=t=>{var l=bn(),g=o(l);{var N=ne=>{var oe=hn(),ve=o(oe);xe(ve,{type:"button",variant:"ghost",class:"text-muted-foreground hover:text-foreground transition-colors",onclick:z,children:(We,Ie)=>{st();var ze=et();M(Fe=>C(ze,Fe),[()=>Ce.codeReview_fileDiff_expandAll_label()]),i(We,ze)},$$slots:{default:!0}});var Me=n(ve,2);{var Ae=We=>{var Ie=fn(),ze=n(be(Ie),2);xe(ze,{type:"button",variant:"ghost",class:"text-muted-foreground hover:text-foreground transition-colors",onclick:Le,children:(Fe,Te)=>{st();var ge=et();M(Qe=>C(ge,Qe),[()=>Ce.codeReview_fileDiff_collapse_label()]),i(Fe,ge)},$$slots:{default:!0}}),i(We,Ie)};E(Me,We=>{e(ae).size>0&&We(Ae)})}s(oe),i(ne,oe)};E(g,ne=>{e(H)&&ne(N)})}var B=n(g,2),V=o(B);Be(V,21,()=>e(w),It,(ne,oe,ve)=>{const Me=_(()=>_e(ve)),Ae=_(()=>e(Me).find(Te=>Te.startIndex===0));var We=xn(),Ie=be(We);{var ze=Te=>{xe(Te,{type:"button",variant:"ghost",class:"w-full flex items-center justify-center gap-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors border-b border-border",onclick:()=>S(ve,e(Ae).startIndex,e(Ae).endIndex),children:(ge,Qe)=>{var Ye=Bt(),Ze=be(Ye);fe(Ze,{get icon(){return ot},class:"h-2.5 w-2.5"});var tt=n(Ze,2),xt=O(tt,!0),rt=n(tt,2);fe(rt,{get icon(){return ot},class:"h-2.5 w-2.5"}),M(ut=>C(xt,ut),[()=>Ce.codeReview_fileDiff_showHidden_label({count:e(Ae).count})]),i(ge,Ye)},$$slots:{default:!0}})};E(Ie,Te=>{e(Ae)&&Te(ze)})}var Fe=n(Ie,2);Be(Fe,19,()=>e(oe).lines,(Te,ge)=>`${ve}-${ge}`,(Te,ge,Qe)=>{const Ye=_(()=>`${e(ge).oldNum}-${e(ge).newNum}`),Ze=_(()=>he(e(ge))),tt=_(()=>e(te)===e(Ye)),xt=_(()=>Ne(ve,e(Qe),e(ge))),rt=_(()=>e(Me).find(lt=>lt.startIndex===e(Qe)+1));var ut=Pt(),er=be(ut);{var tr=lt=>{var At=_n(),vt=be(At),gt=o(vt),zt=o(gt),rr=O(zt,!0),nr=n(zt,2),ar=O(nr,!0);s(gt);var bt=n(gt,2),sr=O(bt,!0),Et=n(bt,2),wt=o(Et),Dt=o(wt);Ft(Dt,()=>me(e(ge)),!0),s(Dt),s(wt);var or=n(wt,2);{var ir=Pe=>{{let De=_(()=>Ce.codeReview_fileDiff_askLine_tooltip());xe(Pe,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,class:"size-5 opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-primary-ink transition-all shrink-0",onclick:()=>Se(e(Ye)),get title(){return e(De)},children:(je,Ge)=>{fe(je,{get icon(){return St}})},$$slots:{default:!0}})}};E(or,Pe=>{P()&&Pe(ir)})}s(Et),s(vt);var Ht=n(vt,2);Be(Ht,19,()=>e(Ze),(Pe,De)=>`${Pe.line}-${De}`,(Pe,De)=>{var je=mn(),Ge=o(je);{let nt=_(()=>e(ge).newNum??e(ge).oldNum??0),ft=_(()=>X(e(De)));qt(Ge,{get annotation(){return e(De)},get lineNumber(){return e(nt)},get fileName(){return d()},get messages(){return e(ft)},onSendMessage:(yt,kt,$t)=>U(yt,kt,$t),get isSending(){return h()}})}s(je),He(3,je,()=>Oe,()=>({tier:"moderate"})),i(Pe,je)});var Wt=n(Ht,2);{var lr=Pe=>{var De=pn(),je=o(De),Ge=o(je);{let nt=_(()=>e(ge).newNum??e(ge).oldNum??0);Jt(Ge,{get lineNumber(){return e(nt)},get fileName(){return d()},onSend:U,onClose:ke,get isSending(){return h()}})}s(je),s(De),i(Pe,De)};E(Wt,Pe=>{e(tt)&&e(Ze).length===0&&Pe(lr)})}var dr=n(Wt,2);{var cr=Pe=>{xe(Pe,{type:"button",variant:"ghost",class:"w-full flex items-center justify-center gap-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors border-y border-border bg-muted/10",onclick:()=>S(ve,e(rt).startIndex,e(rt).endIndex),children:(De,je)=>{var Ge=Bt(),nt=be(Ge);fe(nt,{get icon(){return St},class:"h-2.5 w-2.5"});var ft=n(nt,2),yt=O(ft,!0),kt=n(ft,2);fe(kt,{get icon(){return St},class:"h-2.5 w-2.5"}),M($t=>C(yt,$t),[()=>Ce.codeReview_fileDiff_showHidden_label({count:e(rt).count})]),i(De,Ge)},$$slots:{default:!0}})};E(dr,Pe=>{e(rt)&&Pe(cr)})}M((Pe,De,je,Ge)=>{Ee(vt,1,`group flex ${Pe??""} hover:bg-accent/30 transition-colors`),Ee(gt,1,`w-20 shrink-0 flex select-none ${De??""} border-r border-border`),C(rr,e(ge).oldNum??""),C(ar,e(ge).newNum??""),Ee(bt,1,`w-5 shrink-0 text-center select-none ${je??""}`),C(sr,Ge)},[()=>R(e(ge)),()=>ie(e(ge)),()=>A(e(ge)),()=>Z(e(ge))]),i(lt,At)};E(er,lt=>{e(xt)&&lt(tr)})}i(Te,ut)}),i(ne,We)}),s(V),s(B),s(l),He(3,l,()=>Oe,()=>({tier:"moderate"})),i(t,l)};E(ue,t=>{e(ce)||t(Re)})}return s(re),M(()=>Ee(re,1,`walkthrough-file-diff overflow-hidden bg-card ${q()??""}`)),i($,re),qe(ee)}var yn=x('<div class="flex items-start gap-3"><div class="shrink-0 mt-0.5"><svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M2 6a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1H8a3 3 0 00-3 3v1.5a1.5 1.5 0 01-3 0V6z" clip-rule="evenodd"></path><path d="M6 12a2 2 0 012-2h8a2 2 0 012 2v2a2 2 0 01-2 2H2h2a2 2 0 002-2v-2z"></path></svg></div> <div class="flex-1 min-w-0"><h4 class="text-sm font-medium text-foreground line-clamp-2"> </h4> <p class="text-xs text-subtle mt-1 line-clamp-2"> </p> <div class="flex items-center gap-1 mt-2 text-xs text-subtle"><svg class="h-3.5 w-3.5" viewBox="0 0 16 16" fill="currentColor"><path d="M3.5 1.5A1.5 1.5 0 0 1 5 0h6a1.5 1.5 0 0 1 1.5 1.5v12A1.5 1.5 0 0 1 11 15H5a1.5 1.5 0 0 1-1.5-1.5v-12z"></path></svg> <span> </span></div></div></div>'),kn=x('<div><div class="mb-4"><h3 class="text-sm font-medium text-subtle"> </h3></div> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3"></div></div>');function Qt($,r){if(new.target)return Ke({component:Qt,...$});Je(r,!0);let d=y(r,"categories",7),m=y(r,"onCategoryClick",7),b=y(r,"class",7,"");function u(w){const D=["bg-blue-500/10 border-blue-500/30 hover:border-blue-500/50","bg-purple-500/10 border-purple-500/30 hover:border-purple-500/50","bg-emerald-500/10 border-emerald-500/30 hover:border-emerald-500/50","bg-warning/10 border-warning/30 hover:border-warning/30","bg-rose-500/10 border-rose-500/30 hover:border-rose-500/50","bg-cyan-500/10 border-cyan-500/30 hover:border-cyan-500/50"];return D[w%D.length]}function T(w){const D=["text-blue-500","text-purple-500","text-emerald-500","text-warning-ink","text-rose-500","text-cyan-500"];return D[w%D.length]}var P={get categories(){return d()},set categories(w){d(w),k()},get onCategoryClick(){return m()},set onCategoryClick(w){m(w),k()},get class(){return b()},set class(w=""){b(w),k()},$set:Ue,$on:(w,D)=>Ve(r,w,D)},h=kn(),J=o(h),K=o(J),pe=O(K,!0);s(J);var q=n(J,2);return Be(q,21,d,It,(w,D,de)=>{{let ce=_(()=>u(de));xe(w,{type:"button",variant:"ghost",get class(){return`text-left p-4 rounded-lg border transition-all duration-spring-moderate ease-spring-moderate motion-reduce:transition-none ${e(ce)??""}`},onclick:()=>m()?.(de),children:(ae,te)=>{var ye=yn(),L=o(ye),he=O(L),Ne=n(L,2),_e=o(Ne),S=O(_e,!0),z=n(_e,2),Le=O(z,!0),me=n(z,2),v=n(o(me),2),R=O(v,!0);s(me),s(Ne),s(ye),M((A,Z)=>{Ee(he,0,`h-5 w-5 ${A??""}`),C(S,e(D).title),C(Le,e(D).description),C(R,Z)},[()=>T(de),()=>e(D).files.length===1?Ce.codeReview_categoriesGrid_fileCount_one({count:e(D).files.length}):Ce.codeReview_categoriesGrid_fileCount_many({count:e(D).files.length})]),i(ae,ye)},$$slots:{default:!0}})}}),s(q),s(h),M(w=>{Ee(h,1,`walkthrough-categories-grid ${b()??""}`),C(pe,w)},[()=>Ce.codeReview_categoriesGrid_whatChanged_title()]),i($,h),qe(P)}var $n=x('<div class="w-0.5 flex-1 bg-border min-h-5"></div>'),Sn=x('<p class="text-sm text-subtle mt-2"> </p>'),Cn=x('<div class="rounded-lg border border-border bg-card p-4"><div class="flex items-center gap-2"><svg class="h-4 w-4 text-ghost" viewBox="0 0 16 16" fill="currentColor"><path d="M3.5 1.5A1.5 1.5 0 0 1 5 0h6a1.5 1.5 0 0 1 1.5 1.5v12A1.5 1.5 0 0 1 11 15H5a1.5 1.5 0 0 1-1.5-1.5v-12z"></path></svg> <span class="text-sm font-medium text-foreground"> </span></div> <!></div>'),Nn=x('<div class="flex gap-4"><div class="relative flex flex-col items-center w-3"><div></div> <div class="absolute top-4 w-2 h-2 rounded-full bg-muted-foreground/30 ring-2 ring-background"></div></div> <div class="flex-1 min-w-0 pb-4"><!></div></div>'),Rn=x('<div><div class="flex items-start gap-4 mb-4"><div class="relative flex flex-col items-center"><div></div> <!></div> <div class="flex-1 min-w-0 -mt-0.5"><h3 class="text-base font-semibold text-foreground"> </h3> <p class="text-sm text-subtle mt-1"> </p></div></div> <div class="relative"></div></div>');function Yt($,r){if(new.target)return Ke({component:Yt,...$});Je(r,!0);let d=y(r,"category",7),m=y(r,"categoryIndex",7),b=y(r,"filePatchMap",7),u=y(r,"isLast",7,!1),T=y(r,"onSendMessage",7),P=y(r,"isSending",7,!1),h=y(r,"class",7,"");function J(S){const z=["bg-blue-500","bg-purple-500","bg-emerald-500","bg-warning","bg-rose-500","bg-cyan-500"];return z[S%z.length]}const K=_(()=>d().files.map(S=>{const z=b().get(S.path);return{...S,patch:z?.patch,additions:z?.additions??0,deletions:z?.deletions??0}}));var pe={get category(){return d()},set category(S){d(S),k()},get categoryIndex(){return m()},set categoryIndex(S){m(S),k()},get filePatchMap(){return b()},set filePatchMap(S){b(S),k()},get isLast(){return u()},set isLast(S=!1){u(S),k()},get onSendMessage(){return T()},set onSendMessage(S){T(S),k()},get isSending(){return P()},set isSending(S=!1){P(S),k()},get class(){return h()},set class(S=""){h(S),k()},$set:Ue,$on:(S,z)=>Ve(r,S,z)},q=Rn(),w=o(q),D=o(w),de=o(D),ce=n(de,2);{var ae=S=>{var z=$n();i(S,z)};E(ce,S=>{(!u()||e(K).length>0)&&S(ae)})}s(D);var te=n(D,2),ye=o(te),L=O(ye,!0),he=n(ye,2),Ne=O(he,!0);s(te),s(w);var _e=n(w,2);return Be(_e,23,()=>e(K),(S,z)=>`${m()}-${z}`,(S,z,Le)=>{var me=Nn(),v=o(me),R=o(v);st(2),s(v);var A=n(v,2),Z=o(A);{var ie=Se=>{Lt(Se,{get fileName(){return e(z).path},get patch(){return e(z).patch},get annotations(){return e(z).annotations},get additions(){return e(z).additions},get deletions(){return e(z).deletions},get fileDescription(){return e(z).summary},get onSendMessage(){return T()},get isSending(){return P()},class:"rounded-lg border border-border overflow-hidden"})},$e=Se=>{var ke=Cn(),U=o(ke),j=n(o(U),2),f=O(j,!0);s(U);var H=n(U,2);{var F=le=>{var a=Sn(),W=O(a,!0);M(()=>C(W,e(z).summary)),i(le,a)};E(H,le=>{e(z).summary&&le(F)})}s(ke),M(()=>C(f,e(z).path)),i(Se,ke)};E(Z,Se=>{e(z).patch?Se(ie):Se($e,-1)})}s(A),s(me),M(()=>Ee(R,1,`w-0.5 flex-1 bg-border ${e(Le)===e(K).length-1&&u()?"h-1/2":""}`)),i(S,me)}),s(_e),s(q),M(S=>{Ee(q,1,`walkthrough-category-section ${h()??""}`),Er(q,"id",`category-${m()??""}`),Ee(de,1,`w-3 h-3 rounded-full ${S??""} ring-4 ring-background shrink-0`),C(L,d().title),C(Ne,d().description)},[()=>J(m())]),i($,q),qe(pe)}var Mn=x('<!> <!> <span class="text-sm font-medium"> </span> <!>',1),Pn=x('<div class="flex items-center gap-2 text-sm text-subtle py-2"><!> <span> </span></div>'),Ot=x("<!> ",1),In=x('<div class="rounded-lg bg-danger-background/10 border border-danger/20 p-4"><p class="text-sm text-danger"> </p> <!></div>'),Ln=x('<h2 class="text-lg font-semibold text-foreground"> </h2>'),An=x('<p class="text-sm text-subtle italic"> </p>'),Kt=x("<div><!></div>"),zn=x('<div class="space-y-8 pt-4"></div>'),En=x('<!> <!> <span class="text-sm font-medium text-subtle"> </span>',1),Dn=x('<div class="space-y-3 pt-2"></div>'),Hn=x('<div class="pt-4 border-t border-border"><!> <!></div>'),Wn=x('<div class="flex justify-end pt-2"><!></div>'),Tn=x('<div class="space-y-6"><!> <!> <!> <!> <!> <!></div>'),jn=x('<div class="px-4 pb-4"><!> <!> <!></div>'),Fn=x('<div class="border-t border-border"><!> <!></div>');function Zt($,r){if(new.target)return Ke({component:Zt,...$});Je(r,!0);let d=y(r,"walkthrough",7),m=y(r,"status",7),b=y(r,"workspaceId",7),u=y(r,"error",7,""),T=y(r,"workspacePath",7),P=y(r,"changes",23,()=>[]),h=y(r,"onSendMessage",7),J=y(r,"isSending",7,!1),K=y(r,"onRegenerate",7),pe=y(r,"showCategoriesGrid",7,!0);const q=_(()=>m()==="running"),w=_(()=>m()==="complete"),D=_(()=>!!u());let de=we(!0),ce=we(!1),ae=we(mt(new Map));const te=_(()=>{if(d()?.categories&&d().categories.length>0)return d().categories;if(d()?.annotations&&d().annotations.length>0){const v=new Map;for(const R of d().annotations){const A=v.get(R.file)||[];A.push(R),v.set(R.file,A)}return[{title:d().title,description:d().overview,files:Array.from(v.entries()).map(([R,A])=>({path:R,annotations:A.sort((Z,ie)=>Z.line-ie.line)}))}]}return[]}),ye=_(()=>{if(!d()?.annotations)return new Map;const v=new Map;for(const R of d().annotations){const A=v.get(R.file)||[];A.push(R),v.set(R.file,A)}for(const[R,A]of v)v.set(R,A.sort((Z,ie)=>Z.line-ie.line));return v}),L=_(()=>{const v=new Set;for(const R of e(te))for(const A of R.files)v.add(A.path);for(const R of e(ye).keys())v.add(R);return v}),he=_(()=>P().filter(v=>!e(L).has(v.relativePath)));Xe(()=>{if(!d()||!T())return;const v=new Set([...e(L),...e(he).map(R=>R.relativePath)]);for(const R of v)e(ae).has(R)||Jr(b(),!0,R).then(A=>{if(A&&A.oldContent!==void 0&&A.newContent!==void 0){const Z=Ne(R,A.oldContent,A.newContent);if(Z){const ie=P().find($e=>$e.relativePath===R);e(ae).set(R,{patch:Z,additions:ie?.stats?.additions??0,deletions:ie?.stats?.deletions??0}),I(ae,new Map(e(ae)),!0)}}}).catch(A=>{console.warn(`Failed to load diff for ${R}:`,A)})});function Ne(v,R,A){const Z=R.split(`
@@ -1,4 +1,4 @@
1
- import{g as Ni}from"./LhcvTANM.js";import{s as Ci}from"./CYpZUzoj.js";import{U as Zs,aZ as jt,V as Qs,a_ as Gt,Y as bi,b0 as vi,b as h,aU as je,ay as _i,X as en,a1 as xi,aP as Mi,bh as wi,aV as Ui,r as Pi,O as Di,am as Fi,W as Bi,ab as $i,aG as ji,aA as Gi,aW as Wi}from"./CCvVdljB.js";function Wt(s){console&&console.error&&console.error(`Error: ${s}`)}function tn(s){console&&console.warn&&console.warn(`Warning: ${s}`)}function sn(s){const e=new Date().getTime(),t=s();return{time:new Date().getTime()-e,value:t}}function nn(s){function e(){}e.prototype=s;const t=new e;function n(){return typeof t.bar}return n(),n(),s}function Ki(s){return Vi(s)?s.LABEL:s.name}function Vi(s){return typeof s.LABEL=="string"&&s.LABEL!==""}class te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}}class K extends te{constructor(e){super([]),this.idx=1,Object.assign(this,ie(e))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class _e extends te{constructor(e){super(e.definition),this.orgText="",Object.assign(this,ie(e))}}class W extends te{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,ie(e))}}class G extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class se extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class ne extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class M extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class q extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class Z extends te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,ie(e))}}class k{constructor(e){this.idx=1,Object.assign(this,ie(e))}accept(e){e.visit(this)}}function zi(s){return s.map(at)}function at(s){function e(t){return t.map(at)}if(s instanceof K){const t={type:"NonTerminal",name:s.nonTerminalName,idx:s.idx};return typeof s.label=="string"&&(t.label=s.label),t}else{if(s instanceof W)return{type:"Alternative",definition:e(s.definition)};if(s instanceof G)return{type:"Option",idx:s.idx,definition:e(s.definition)};if(s instanceof se)return{type:"RepetitionMandatory",idx:s.idx,definition:e(s.definition)};if(s instanceof ne)return{type:"RepetitionMandatoryWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof q)return{type:"RepetitionWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof M)return{type:"Repetition",idx:s.idx,definition:e(s.definition)};if(s instanceof Z)return{type:"Alternation",idx:s.idx,definition:e(s.definition)};if(s instanceof k){const t={type:"Terminal",name:s.terminalType.name,label:Ki(s.terminalType),idx:s.idx};typeof s.label=="string"&&(t.terminalLabel=s.label);const n=s.terminalType.PATTERN;return s.terminalType.PATTERN&&(t.pattern=n instanceof RegExp?n.source:n),t}else{if(s instanceof _e)return{type:"Rule",name:s.name,orgText:s.orgText,definition:e(s.definition)};throw Error("non exhaustive match")}}}function ie(s){return Object.fromEntries(Object.entries(s).filter(([,e])=>e!==void 0))}class xe{visit(e){const t=e;switch(t.constructor){case K:return this.visitNonTerminal(t);case W:return this.visitAlternative(t);case G:return this.visitOption(t);case se:return this.visitRepetitionMandatory(t);case ne:return this.visitRepetitionMandatoryWithSeparator(t);case q:return this.visitRepetitionWithSeparator(t);case M:return this.visitRepetition(t);case Z:return this.visitAlternation(t);case k:return this.visitTerminal(t);case _e:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function Hi(s){return s instanceof W||s instanceof G||s instanceof M||s instanceof se||s instanceof ne||s instanceof q||s instanceof k||s instanceof _e}function Tt(s,e=[]){return s instanceof G||s instanceof M||s instanceof q?!0:s instanceof Z?s.definition.some(n=>Tt(n,e)):s instanceof K&&e.includes(s)?!1:s instanceof te?(s instanceof K&&e.push(s),s.definition.every(n=>Tt(n,e))):!1}function Xi(s){return s instanceof Z}function ee(s){if(s instanceof K)return"SUBRULE";if(s instanceof G)return"OPTION";if(s instanceof Z)return"OR";if(s instanceof se)return"AT_LEAST_ONE";if(s instanceof ne)return"AT_LEAST_ONE_SEP";if(s instanceof q)return"MANY_SEP";if(s instanceof M)return"MANY";if(s instanceof k)return"CONSUME";throw Error("non exhaustive match")}class kt{walk(e,t=[]){e.definition.forEach((n,i)=>{const a=e.definition.slice(i+1);if(n instanceof K)this.walkProdRef(n,a,t);else if(n instanceof k)this.walkTerminal(n,a,t);else if(n instanceof W)this.walkFlat(n,a,t);else if(n instanceof G)this.walkOption(n,a,t);else if(n instanceof se)this.walkAtLeastOne(n,a,t);else if(n instanceof ne)this.walkAtLeastOneSep(n,a,t);else if(n instanceof q)this.walkManySep(n,a,t);else if(n instanceof M)this.walkMany(n,a,t);else if(n instanceof Z)this.walkOr(n,a,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const i=t.concat(n);this.walk(e,i)}walkOption(e,t,n){const i=t.concat(n);this.walk(e,i)}walkAtLeastOne(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkAtLeastOneSep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkMany(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkManySep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkOr(e,t,n){const i=t.concat(n);e.definition.forEach(a=>{const r=new W({definition:[a]});this.walk(r,i)})}}function ys(s,e,t){return[new G({definition:[new k({terminalType:s.separator})].concat(s.definition)})].concat(e,t)}function Je(s){if(s instanceof K)return Je(s.referencedRule);if(s instanceof k)return qi(s);if(Hi(s))return Yi(s);if(Xi(s))return Ji(s);throw Error("non exhaustive match")}function Yi(s){let e=[];const t=s.definition;let n=0,i=t.length>n,a,r=!0;for(;i&&r;)a=t[n],r=Tt(a),e=e.concat(Je(a)),n=n+1,i=t.length>n;return[...new Set(e)]}function Ji(s){const e=s.definition.map(t=>Je(t));return[...new Set(e.flat())]}function qi(s){return[s.terminalType]}const an="_~IN~_";class Zi extends kt{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){const i=ea(e.referencedRule,e.idx)+this.topProd.name,a=t.concat(n),r=new W({definition:a}),l=Je(r);this.follows[i]=l}}function Qi(s){const e={};return s.forEach(t=>{const n=new Zi(t).startWalking();Object.assign(e,n)}),e}function ea(s,e){return s.name+e+an}function S(s){return s.charCodeAt(0)}function Pt(s,e){Array.isArray(s)?s.forEach(function(t){e.push(t)}):e.push(s)}function Fe(s,e){if(s[e]===!0)throw"duplicate flag "+e;s[e],s[e]=!0}function Se(s){if(s===void 0)throw Error("Internal Error - Should never get here!");return!0}function ta(){throw Error("Internal Error - Should never get here!")}function Rs(s){return s.type==="Character"}const gt=[];for(let s=S("0");s<=S("9");s++)gt.push(s);const At=[S("_")].concat(gt);for(let s=S("a");s<=S("z");s++)At.push(s);for(let s=S("A");s<=S("Z");s++)At.push(s);const Os=[S(" "),S("\f"),S(`
1
+ import{g as Ni}from"./CQGCQvNO.js";import{s as Ci}from"./BkihpvKL.js";import{U as Zs,aZ as jt,V as Qs,a_ as Gt,Y as bi,b0 as vi,b as h,aU as je,ay as _i,X as en,a1 as xi,aP as Mi,bh as wi,aV as Ui,r as Pi,O as Di,am as Fi,W as Bi,ab as $i,aG as ji,aA as Gi,aW as Wi}from"./BlT4teVV.js";function Wt(s){console&&console.error&&console.error(`Error: ${s}`)}function tn(s){console&&console.warn&&console.warn(`Warning: ${s}`)}function sn(s){const e=new Date().getTime(),t=s();return{time:new Date().getTime()-e,value:t}}function nn(s){function e(){}e.prototype=s;const t=new e;function n(){return typeof t.bar}return n(),n(),s}function Ki(s){return Vi(s)?s.LABEL:s.name}function Vi(s){return typeof s.LABEL=="string"&&s.LABEL!==""}class te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}}class K extends te{constructor(e){super([]),this.idx=1,Object.assign(this,ie(e))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class _e extends te{constructor(e){super(e.definition),this.orgText="",Object.assign(this,ie(e))}}class W extends te{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,ie(e))}}class G extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class se extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class ne extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class M extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class q extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class Z extends te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,ie(e))}}class k{constructor(e){this.idx=1,Object.assign(this,ie(e))}accept(e){e.visit(this)}}function zi(s){return s.map(at)}function at(s){function e(t){return t.map(at)}if(s instanceof K){const t={type:"NonTerminal",name:s.nonTerminalName,idx:s.idx};return typeof s.label=="string"&&(t.label=s.label),t}else{if(s instanceof W)return{type:"Alternative",definition:e(s.definition)};if(s instanceof G)return{type:"Option",idx:s.idx,definition:e(s.definition)};if(s instanceof se)return{type:"RepetitionMandatory",idx:s.idx,definition:e(s.definition)};if(s instanceof ne)return{type:"RepetitionMandatoryWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof q)return{type:"RepetitionWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof M)return{type:"Repetition",idx:s.idx,definition:e(s.definition)};if(s instanceof Z)return{type:"Alternation",idx:s.idx,definition:e(s.definition)};if(s instanceof k){const t={type:"Terminal",name:s.terminalType.name,label:Ki(s.terminalType),idx:s.idx};typeof s.label=="string"&&(t.terminalLabel=s.label);const n=s.terminalType.PATTERN;return s.terminalType.PATTERN&&(t.pattern=n instanceof RegExp?n.source:n),t}else{if(s instanceof _e)return{type:"Rule",name:s.name,orgText:s.orgText,definition:e(s.definition)};throw Error("non exhaustive match")}}}function ie(s){return Object.fromEntries(Object.entries(s).filter(([,e])=>e!==void 0))}class xe{visit(e){const t=e;switch(t.constructor){case K:return this.visitNonTerminal(t);case W:return this.visitAlternative(t);case G:return this.visitOption(t);case se:return this.visitRepetitionMandatory(t);case ne:return this.visitRepetitionMandatoryWithSeparator(t);case q:return this.visitRepetitionWithSeparator(t);case M:return this.visitRepetition(t);case Z:return this.visitAlternation(t);case k:return this.visitTerminal(t);case _e:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function Hi(s){return s instanceof W||s instanceof G||s instanceof M||s instanceof se||s instanceof ne||s instanceof q||s instanceof k||s instanceof _e}function Tt(s,e=[]){return s instanceof G||s instanceof M||s instanceof q?!0:s instanceof Z?s.definition.some(n=>Tt(n,e)):s instanceof K&&e.includes(s)?!1:s instanceof te?(s instanceof K&&e.push(s),s.definition.every(n=>Tt(n,e))):!1}function Xi(s){return s instanceof Z}function ee(s){if(s instanceof K)return"SUBRULE";if(s instanceof G)return"OPTION";if(s instanceof Z)return"OR";if(s instanceof se)return"AT_LEAST_ONE";if(s instanceof ne)return"AT_LEAST_ONE_SEP";if(s instanceof q)return"MANY_SEP";if(s instanceof M)return"MANY";if(s instanceof k)return"CONSUME";throw Error("non exhaustive match")}class kt{walk(e,t=[]){e.definition.forEach((n,i)=>{const a=e.definition.slice(i+1);if(n instanceof K)this.walkProdRef(n,a,t);else if(n instanceof k)this.walkTerminal(n,a,t);else if(n instanceof W)this.walkFlat(n,a,t);else if(n instanceof G)this.walkOption(n,a,t);else if(n instanceof se)this.walkAtLeastOne(n,a,t);else if(n instanceof ne)this.walkAtLeastOneSep(n,a,t);else if(n instanceof q)this.walkManySep(n,a,t);else if(n instanceof M)this.walkMany(n,a,t);else if(n instanceof Z)this.walkOr(n,a,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const i=t.concat(n);this.walk(e,i)}walkOption(e,t,n){const i=t.concat(n);this.walk(e,i)}walkAtLeastOne(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkAtLeastOneSep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkMany(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkManySep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkOr(e,t,n){const i=t.concat(n);e.definition.forEach(a=>{const r=new W({definition:[a]});this.walk(r,i)})}}function ys(s,e,t){return[new G({definition:[new k({terminalType:s.separator})].concat(s.definition)})].concat(e,t)}function Je(s){if(s instanceof K)return Je(s.referencedRule);if(s instanceof k)return qi(s);if(Hi(s))return Yi(s);if(Xi(s))return Ji(s);throw Error("non exhaustive match")}function Yi(s){let e=[];const t=s.definition;let n=0,i=t.length>n,a,r=!0;for(;i&&r;)a=t[n],r=Tt(a),e=e.concat(Je(a)),n=n+1,i=t.length>n;return[...new Set(e)]}function Ji(s){const e=s.definition.map(t=>Je(t));return[...new Set(e.flat())]}function qi(s){return[s.terminalType]}const an="_~IN~_";class Zi extends kt{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){const i=ea(e.referencedRule,e.idx)+this.topProd.name,a=t.concat(n),r=new W({definition:a}),l=Je(r);this.follows[i]=l}}function Qi(s){const e={};return s.forEach(t=>{const n=new Zi(t).startWalking();Object.assign(e,n)}),e}function ea(s,e){return s.name+e+an}function S(s){return s.charCodeAt(0)}function Pt(s,e){Array.isArray(s)?s.forEach(function(t){e.push(t)}):e.push(s)}function Fe(s,e){if(s[e]===!0)throw"duplicate flag "+e;s[e],s[e]=!0}function Se(s){if(s===void 0)throw Error("Internal Error - Should never get here!");return!0}function ta(){throw Error("Internal Error - Should never get here!")}function Rs(s){return s.type==="Character"}const gt=[];for(let s=S("0");s<=S("9");s++)gt.push(s);const At=[S("_")].concat(gt);for(let s=S("a");s<=S("z");s++)At.push(s);for(let s=S("A");s<=S("Z");s++)At.push(s);const Os=[S(" "),S("\f"),S(`
2
2
  `),S("\r"),S(" "),S("\v"),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S(" "),S("\u2028"),S("\u2029"),S(" "),S(" "),S(" "),S("\uFEFF")],sa=/[0-9a-fA-F]/,tt=/[0-9]/,na=/[1-9]/;class ia{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const t=this.disjunction();this.consumeChar("/");const n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Fe(n,"global");break;case"i":Fe(n,"ignoreCase");break;case"m":Fe(n,"multiLine");break;case"u":Fe(n,"unicode");break;case"y":Fe(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}Se(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return ta()}quantifier(e=!1){let t;const n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let a;this.isDigit()?(a=this.integerIncludingZero(),t={atLeast:i,atMost:a}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;Se(t);break}if(!(e===!0&&t===void 0)&&Se(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t}atom(){let e;const t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Se(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[S(`
3
3
  `),S("\r"),S("\u2028"),S("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=gt;break;case"D":e=gt,t=!0;break;case"s":e=Os;break;case"S":e=Os,t=!0;break;case"w":e=At;break;case"W":e=At,t=!0;break}if(Se(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=S("\f");break;case"n":e=S(`
4
4
  `);break;case"r":e=S("\r");break;case"t":e=S(" ");break;case"v":e=S("\v");break}if(Se(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:S("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:S(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
@@ -1 +1 @@
1
- import{t as F,bq as l,bo as u,by as G,b as H,bu as re,bs as se}from"./Y9-4hTF9.js";import{bs as J,a5 as P,bl as I,bS as m,bA as $,be as z,b$ as N,b_ as k,bO as _,W as v,aD as ae,bn as K,aA as p,c9 as ne,aB as B,c5 as T,a7 as oe,ay as ie}from"./DYhIMPy1.js";import{i as q}from"./BL2lJmRT.js";import{s as W}from"./cFbB-5Cu.js";import{f as A}from"./q6hitSEG.js";import"./DOH10_LL.js";import{D as ce}from"./BzUmccFe.js";import{a6 as de}from"./CCnkAPpl.js";import{Iz as ue,iL as le}from"./tU_ZJtMw.js";var pe=B('<p class="text-sm text-muted-foreground"> </p>'),j=B('<p role="status" class="text-sm"> </p>'),ge=B('<div class="flex max-h-[min(calc(100dvh-8rem),calc(var(--toast-max-height,100dvh)-2rem))] min-h-0 min-w-0 flex-col gap-3" role="group"><div class="min-h-0 space-y-3 overflow-y-auto break-words" role="region" tabindex="0"><p class="font-medium break-words"> </p> <p class="text-sm text-muted-foreground"> </p> <!> <!> <!> <!></div> <div class="flex shrink-0 flex-wrap gap-2"><!> <!> <!></div></div>');function M(y,r){if(new.target)return F({component:M,...y});J(r,!0);let a=l(r,"request",7),g=l(r,"pending",7,!1),b=l(r,"settingUp",7,!1),c=l(r,"guidance",7),d=l(r,"checklist",7),i=l(r,"onDecision",7);var C={get request(){return a()},set request(e){a(e),p()},get pending(){return g()},set pending(e=!1){g(e),p()},get settingUp(){return b()},set settingUp(e=!1){b(e),p()},get guidance(){return c()},set guidance(e){c(e),p()},get checklist(){return d()},set checklist(e){d(e),p()},get onDecision(){return i()},set onDecision(e){i(e),p()},$set:G,$on:(e,t)=>H(r,e,t)},x=ge(),f=P(x),w=P(f),U=I(w,!0),D=m(w,2),n=I(D,!0),h=m(D,2);{var Q=e=>{var t=pe(),s=I(t,!0);k(o=>_(s,o),[()=>u.desktop_consent_claimPrimary({computer:a().computerName})]),v(e,t)};q(h,e=>{a().claimsPrimary&&e(Q)})}var O=m(h,2);{var V=e=>{ce(e,{get checklist(){return d()}})};q(O,e=>{d()&&e(V)})}var S=m(O,2);{var X=e=>{var t=j(),s=I(t,!0);k(()=>_(s,c())),v(e,t)};q(S,e=>{c()&&e(X)})}var Y=m(S,2);{var Z=e=>{var t=j(),s=I(t,!0);k(o=>_(s,o),[()=>u.desktop_consent_pending()]),v(e,t)};q(Y,e=>{g()&&!b()&&e(Z)})}$(f);var E=m(f,2),L=P(E);A(L,{size:"compact",variant:"primary",get disabled(){return g()},onclick:()=>i()("allow_once"),children:(e,t)=>{z();var s=N();k(o=>_(s,o),[()=>u.desktop_consent_once()]),v(e,s)},$$slots:{default:!0}});var R=m(L,2);A(R,{size:"compact",variant:"outline",get disabled(){return g()},onclick:()=>i()("allow_future"),children:(e,t)=>{z();var s=N();k(o=>_(s,o),[()=>u.desktop_consent_future()]),v(e,s)},$$slots:{default:!0}});var ee=m(R,2);{let e=ne(()=>g()&&!b());A(ee,{size:"compact",variant:"ghost",get disabled(){return ae(e)},onclick:()=>i()("deny"),children:(t,s)=>{z();var o=N();k(te=>_(o,te),[()=>u.desktop_consent_deny()]),v(t,o)},$$slots:{default:!0}})}return $(E),$(x),k((e,t,s,o)=>{W(x,"aria-label",e),W(f,"aria-label",t),_(U,s),_(n,o)},[()=>u.desktop_consent_title(),()=>u.desktop_consent_title(),()=>u.desktop_consent_request({agent:a().agentName,computer:a().computerName}),()=>u.desktop_consent_description()]),v(y,x),K(C)}function me(y,r){if(new.target)return F({component:me,...y});J(r,!0);const a=()=>re(C,"$entry",g),[g,b]=se();let c=l(r,"workspaceId",7),d=l(r,"agentId",7),i=l(r,"requestId",7);const C=de(T(()=>c()),T(()=>d()));var x={get workspaceId(){return c()},set workspaceId(n){c(n),p()},get agentId(){return d()},set agentId(n){d(n),p()},get requestId(){return i()},set requestId(n){i(n),p()},$set:G,$on:(n,h)=>H(r,n,h)},f=oe(),w=ie(f);{var U=n=>{M(n,{get request(){return a().pending},get pending(){return a().submitting},get settingUp(){return a().settingUp},get guidance(){return a().error},get checklist(){return a().osChecklist},onDecision:h=>ue.dispatch(le(c(),d(),i(),h))})};q(w,n=>{a()?.pending?.requestId===i()&&n(U)})}v(y,f);var D=K(x);return b(),D}export{me as default};
1
+ import{t as F,bq as l,bo as u,by as G,b as H,bu as re,bs as se}from"./Y9-4hTF9.js";import{bs as J,a5 as P,bl as I,bS as m,bA as $,be as z,b$ as N,b_ as k,bO as _,W as v,aD as ae,bn as K,aA as p,c9 as ne,aB as B,c5 as T,a7 as oe,ay as ie}from"./DYhIMPy1.js";import{i as q}from"./BL2lJmRT.js";import{s as W}from"./cFbB-5Cu.js";import{f as A}from"./q6hitSEG.js";import"./DOH10_LL.js";import{D as ce}from"./BzUmccFe.js";import{a6 as de}from"./BDPOc7V6.js";import{Iz as ue,iL as le}from"./tU_ZJtMw.js";var pe=B('<p class="text-sm text-muted-foreground"> </p>'),j=B('<p role="status" class="text-sm"> </p>'),ge=B('<div class="flex max-h-[min(calc(100dvh-8rem),calc(var(--toast-max-height,100dvh)-2rem))] min-h-0 min-w-0 flex-col gap-3" role="group"><div class="min-h-0 space-y-3 overflow-y-auto break-words" role="region" tabindex="0"><p class="font-medium break-words"> </p> <p class="text-sm text-muted-foreground"> </p> <!> <!> <!> <!></div> <div class="flex shrink-0 flex-wrap gap-2"><!> <!> <!></div></div>');function M(y,r){if(new.target)return F({component:M,...y});J(r,!0);let a=l(r,"request",7),g=l(r,"pending",7,!1),b=l(r,"settingUp",7,!1),c=l(r,"guidance",7),d=l(r,"checklist",7),i=l(r,"onDecision",7);var C={get request(){return a()},set request(e){a(e),p()},get pending(){return g()},set pending(e=!1){g(e),p()},get settingUp(){return b()},set settingUp(e=!1){b(e),p()},get guidance(){return c()},set guidance(e){c(e),p()},get checklist(){return d()},set checklist(e){d(e),p()},get onDecision(){return i()},set onDecision(e){i(e),p()},$set:G,$on:(e,t)=>H(r,e,t)},x=ge(),f=P(x),w=P(f),U=I(w,!0),D=m(w,2),n=I(D,!0),h=m(D,2);{var Q=e=>{var t=pe(),s=I(t,!0);k(o=>_(s,o),[()=>u.desktop_consent_claimPrimary({computer:a().computerName})]),v(e,t)};q(h,e=>{a().claimsPrimary&&e(Q)})}var O=m(h,2);{var V=e=>{ce(e,{get checklist(){return d()}})};q(O,e=>{d()&&e(V)})}var S=m(O,2);{var X=e=>{var t=j(),s=I(t,!0);k(()=>_(s,c())),v(e,t)};q(S,e=>{c()&&e(X)})}var Y=m(S,2);{var Z=e=>{var t=j(),s=I(t,!0);k(o=>_(s,o),[()=>u.desktop_consent_pending()]),v(e,t)};q(Y,e=>{g()&&!b()&&e(Z)})}$(f);var E=m(f,2),L=P(E);A(L,{size:"compact",variant:"primary",get disabled(){return g()},onclick:()=>i()("allow_once"),children:(e,t)=>{z();var s=N();k(o=>_(s,o),[()=>u.desktop_consent_once()]),v(e,s)},$$slots:{default:!0}});var R=m(L,2);A(R,{size:"compact",variant:"outline",get disabled(){return g()},onclick:()=>i()("allow_future"),children:(e,t)=>{z();var s=N();k(o=>_(s,o),[()=>u.desktop_consent_future()]),v(e,s)},$$slots:{default:!0}});var ee=m(R,2);{let e=ne(()=>g()&&!b());A(ee,{size:"compact",variant:"ghost",get disabled(){return ae(e)},onclick:()=>i()("deny"),children:(t,s)=>{z();var o=N();k(te=>_(o,te),[()=>u.desktop_consent_deny()]),v(t,o)},$$slots:{default:!0}})}return $(E),$(x),k((e,t,s,o)=>{W(x,"aria-label",e),W(f,"aria-label",t),_(U,s),_(n,o)},[()=>u.desktop_consent_title(),()=>u.desktop_consent_title(),()=>u.desktop_consent_request({agent:a().agentName,computer:a().computerName}),()=>u.desktop_consent_description()]),v(y,x),K(C)}function me(y,r){if(new.target)return F({component:me,...y});J(r,!0);const a=()=>re(C,"$entry",g),[g,b]=se();let c=l(r,"workspaceId",7),d=l(r,"agentId",7),i=l(r,"requestId",7);const C=de(T(()=>c()),T(()=>d()));var x={get workspaceId(){return c()},set workspaceId(n){c(n),p()},get agentId(){return d()},set agentId(n){d(n),p()},get requestId(){return i()},set requestId(n){i(n),p()},$set:G,$on:(n,h)=>H(r,n,h)},f=oe(),w=ie(f);{var U=n=>{M(n,{get request(){return a().pending},get pending(){return a().submitting},get settingUp(){return a().settingUp},get guidance(){return a().error},get checklist(){return a().osChecklist},onDecision:h=>ue.dispatch(le(c(),d(),i(),h))})};q(w,n=>{a()?.pending?.requestId===i()&&n(U)})}v(y,f);var D=K(x);return b(),D}export{me as default};
@@ -1,4 +1,4 @@
1
- import{aZ as Ae,U as ke,Y as ae,b0 as Fe,V as Pe,a_ as ve,b as o,X as Vt,ay as bt,aW as Lt,B as Ce,r as Le,O as V,aV as Ee,a6 as De}from"./CCvVdljB.js";import{l as ie}from"./CO_SSNcv.js";var Et=(function(){var t=o(function(Y,r,l,x){for(l=l||{},x=Y.length;x--;l[Y[x]]=r);return l},"o"),n=[1,3],f=[1,4],d=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],_=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],u=[1,37],T=[1,36],q=[1,38],m=[1,35],b=[1,43],g=[1,41],A=[1,45],ht=[1,14],xt=[1,23],ft=[1,18],gt=[1,19],ct=[1,20],_t=[1,21],dt=[1,22],i=[1,24],zt=[1,25],It=[1,26],wt=[1,27],Bt=[1,28],Rt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],X=[1,63],H=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Ut=[1,68],Qt=[1,69],Ot=[1,70],Xt=[1,71],Ht=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],K=[1,91],Z=[1,92],J=[1,93],$=[1,100],tt=[1,94],et=[1,97],it=[1,95],at=[1,96],nt=[1,98],st=[1,99],At=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],kt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,x,c,S,e,ut){var s=e.length-1;switch(S){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],c.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),c.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),c.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),c.setAccDescription(this.$);break;case 46:c.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:c.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:c.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:c.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:c.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:c.setXAxisLeftText(e[s-2]),c.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟶ ",c.setXAxisLeftText(e[s-1]);break;case 53:c.setXAxisLeftText(e[s]);break;case 54:c.setYAxisBottomText(e[s-2]),c.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟶ ",c.setYAxisBottomText(e[s-1]);break;case 56:c.setYAxisBottomText(e[s]);break;case 57:c.setQuadrant1Text(e[s]);break;case 58:c.setQuadrant2Text(e[s]);break;case 59:c.setQuadrant3Text(e[s]);break;case 60:c.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:f,55:d,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:f,55:d,56:h,57:p},{18:n,26:9,27:2,28:f,55:d,56:h,57:p},t(y,[2,33],{29:10}),t(_,[2,61]),t(_,[2,62]),t(_,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:u,5:T,10:q,12:m,13:b,14:g,15:A,18:ht,25:xt,35:ft,37:gt,39:ct,41:_t,42:dt,48:i,50:zt,51:It,52:wt,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:d,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:u,5:T,10:q,12:m,13:b,14:g,15:A,18:ht,25:xt,35:ft,37:gt,39:ct,41:_t,42:dt,48:i,50:zt,51:It,52:wt,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Xt,10:Ht,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Xt,10:Ht,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:u,5:T,10:q,12:m,13:b,14:g,15:A,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:u,5:T,10:q,12:m,13:b,14:g,15:A,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{46:[1,102]},t(a,[2,29],{10:At}),t(Zt,[2,27],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:At}),t(a,[2,48],{22:89,16:90,23:105,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:106},t(N,[2,26]),t(a,[2,50],{10:At}),t(Zt,[2,28],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var x=new Error(r);throw x.hash=l,x}},"parseError"),parse:o(function(r){var l=this,x=[0],c=[],S=[null],e=[],ut=this.table,s="",yt=0,Jt=0,me=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),j={yy:{}};for(var Ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ft)&&(j.yy[Ft]=this.yy[Ft]);D.setInput(r,j.yy),j.yy.lexer=D,j.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Pt=D.yylloc;e.push(Pt);var Se=D.options&&D.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){x.length=x.length-2*R,S.length=S.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=c.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(c=R,R=c.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,G,W,vt,rt={},Tt,M,ee,qt;;){if(G=x[x.length-1],this.defaultActions[G]?W=this.defaultActions[G]:((B===null||typeof B>"u")&&(B=te()),W=ut[G]&&ut[G][B]),typeof W>"u"||!W.length||!W[0]){var Ct="";qt=[];for(Tt in ut[G])this.terminals_[Tt]&&Tt>me&&qt.push("'"+this.terminals_[Tt]+"'");D.showPosition?Ct="Parse error on line "+(yt+1)+`:
1
+ import{aZ as Ae,U as ke,Y as ae,b0 as Fe,V as Pe,a_ as ve,b as o,X as Vt,ay as bt,aW as Lt,B as Ce,r as Le,O as V,aV as Ee,a6 as De}from"./BlT4teVV.js";import{l as ie}from"./vYw2RcgV.js";var Et=(function(){var t=o(function(Y,r,l,x){for(l=l||{},x=Y.length;x--;l[Y[x]]=r);return l},"o"),n=[1,3],f=[1,4],d=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],_=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],u=[1,37],T=[1,36],q=[1,38],m=[1,35],b=[1,43],g=[1,41],A=[1,45],ht=[1,14],xt=[1,23],ft=[1,18],gt=[1,19],ct=[1,20],_t=[1,21],dt=[1,22],i=[1,24],zt=[1,25],It=[1,26],wt=[1,27],Bt=[1,28],Rt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],X=[1,63],H=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Ut=[1,68],Qt=[1,69],Ot=[1,70],Xt=[1,71],Ht=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],K=[1,91],Z=[1,92],J=[1,93],$=[1,100],tt=[1,94],et=[1,97],it=[1,95],at=[1,96],nt=[1,98],st=[1,99],At=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],kt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,x,c,S,e,ut){var s=e.length-1;switch(S){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],c.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),c.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),c.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),c.setAccDescription(this.$);break;case 46:c.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:c.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:c.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:c.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:c.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:c.setXAxisLeftText(e[s-2]),c.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟶ ",c.setXAxisLeftText(e[s-1]);break;case 53:c.setXAxisLeftText(e[s]);break;case 54:c.setYAxisBottomText(e[s-2]),c.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟶ ",c.setYAxisBottomText(e[s-1]);break;case 56:c.setYAxisBottomText(e[s]);break;case 57:c.setQuadrant1Text(e[s]);break;case 58:c.setQuadrant2Text(e[s]);break;case 59:c.setQuadrant3Text(e[s]);break;case 60:c.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:f,55:d,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:f,55:d,56:h,57:p},{18:n,26:9,27:2,28:f,55:d,56:h,57:p},t(y,[2,33],{29:10}),t(_,[2,61]),t(_,[2,62]),t(_,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:u,5:T,10:q,12:m,13:b,14:g,15:A,18:ht,25:xt,35:ft,37:gt,39:ct,41:_t,42:dt,48:i,50:zt,51:It,52:wt,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:d,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:u,5:T,10:q,12:m,13:b,14:g,15:A,18:ht,25:xt,35:ft,37:gt,39:ct,41:_t,42:dt,48:i,50:zt,51:It,52:wt,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,10:q,12:m,13:b,14:g,15:A,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Xt,10:Ht,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Xt,10:Ht,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:u,5:T,10:q,12:m,13:b,14:g,15:A,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:u,5:T,10:q,12:m,13:b,14:g,15:A,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:u,5:T,8:X,10:q,12:m,13:b,14:g,15:A,18:H,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{46:[1,102]},t(a,[2,29],{10:At}),t(Zt,[2,27],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:At}),t(a,[2,48],{22:89,16:90,23:105,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:106},t(N,[2,26]),t(a,[2,50],{10:At}),t(Zt,[2,28],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var x=new Error(r);throw x.hash=l,x}},"parseError"),parse:o(function(r){var l=this,x=[0],c=[],S=[null],e=[],ut=this.table,s="",yt=0,Jt=0,me=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),j={yy:{}};for(var Ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ft)&&(j.yy[Ft]=this.yy[Ft]);D.setInput(r,j.yy),j.yy.lexer=D,j.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Pt=D.yylloc;e.push(Pt);var Se=D.options&&D.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){x.length=x.length-2*R,S.length=S.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=c.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(c=R,R=c.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,G,W,vt,rt={},Tt,M,ee,qt;;){if(G=x[x.length-1],this.defaultActions[G]?W=this.defaultActions[G]:((B===null||typeof B>"u")&&(B=te()),W=ut[G]&&ut[G][B]),typeof W>"u"||!W.length||!W[0]){var Ct="";qt=[];for(Tt in ut[G])this.terminals_[Tt]&&Tt>me&&qt.push("'"+this.terminals_[Tt]+"'");D.showPosition?Ct="Parse error on line "+(yt+1)+`:
2
2
  `+D.showPosition()+`
3
3
  Expecting `+qt.join(", ")+", got '"+(this.terminals_[B]||B)+"'":Ct="Parse error on line "+(yt+1)+": Unexpected "+(B==$t?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(Ct,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:Pt,expected:qt})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+B);switch(W[0]){case 1:x.push(B),S.push(D.yytext),e.push(D.yylloc),x.push(W[1]),B=null,Jt=D.yyleng,s=D.yytext,yt=D.yylineno,Pt=D.yylloc;break;case 2:if(M=this.productions_[W[1]][1],rt.$=S[S.length-M],rt._$={first_line:e[e.length-(M||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(M||1)].first_column,last_column:e[e.length-1].last_column},Se&&(rt._$.range=[e[e.length-(M||1)].range[0],e[e.length-1].range[1]]),vt=this.performAction.apply(rt,[s,Jt,yt,j.yy,W[1],S,e].concat(be)),typeof vt<"u")return vt;M&&(x=x.slice(0,-1*M*2),S=S.slice(0,-1*M),e=e.slice(0,-1*M)),x.push(this.productions_[W[1]][0]),S.push(rt.$),e.push(rt._$),ee=ut[x[x.length-2]][x[x.length-1]],x.push(ee);break;case 3:return!0}}return!0},"parse")},qe=(function(){var Y={EOF:1,parseError:o(function(l,x){if(this.yy.parser)this.yy.parser.parseError(l,x);else throw new Error(l)},"parseError"),setInput:o(function(r,l){return this.yy=l||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var l=r.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:o(function(r){var l=r.length,x=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===c.length?this.yylloc.first_column:0)+c[c.length-x.length].length-x[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(r){this.unput(this.match.slice(r))},"less"),pastInput:o(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var r=this.pastInput(),l=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{J as h}from"./D-fXqqnE.js";import{c as v}from"./ChTqQfQN.js";import{O as d}from"./DOH10_LL.js";const g=v("AttachmentImageUrl");function y(t,n){const r=n.split("/").filter(e=>e.length>0).map(e=>encodeURIComponent(e)).join("/");return`workspace-file://${t}/${r}`}const u=new Map,a=new Map;let f=0,m=!1;function p(){m||(m=!0,d(()=>{f+=1,u.clear(),a.clear()}))}function A(t,n){u.delete(`${t}/${n}`)}function F(t,n,r){p();let e=!1,i=!1,o=!1;async function l(){if(!e){if(i){o=!0;return}i=!0;try{const c=await $(t,n);e||r(c)}finally{i=!1,o&&(o=!1,l())}}}const s=d(()=>{l()});return l(),{imageFailed(){e||(A(t,n),r(null))},dispose(){e=!0,s()}}}function $(t,n){p();const r=f,e=`${t}/${n}`,i=u.get(e);if(i)return Promise.resolve(i);const o=a.get(e);if(o)return o;const l=(async()=>{try{const s=await h({attachmentId:n,workspaceId:t});if(r!==f)return null;if(!s.exists)return g.warn("Attachment file missing on disk",{attachmentId:n}),null;const c=y(t,s.path);return u.set(e,c),c}catch(s){return g.warn("Failed to resolve attachment image",{attachmentId:n,error:s}),null}finally{r===f&&a.delete(e)}})();return a.set(e,l),l}export{A as e,F as o,$ as r};
1
+ import{J as h}from"./Cj2RYqvI.js";import{c as v}from"./ChTqQfQN.js";import{O as d}from"./DOH10_LL.js";const g=v("AttachmentImageUrl");function y(t,n){const r=n.split("/").filter(e=>e.length>0).map(e=>encodeURIComponent(e)).join("/");return`workspace-file://${t}/${r}`}const u=new Map,a=new Map;let f=0,m=!1;function p(){m||(m=!0,d(()=>{f+=1,u.clear(),a.clear()}))}function A(t,n){u.delete(`${t}/${n}`)}function F(t,n,r){p();let e=!1,i=!1,o=!1;async function l(){if(!e){if(i){o=!0;return}i=!0;try{const c=await $(t,n);e||r(c)}finally{i=!1,o&&(o=!1,l())}}}const s=d(()=>{l()});return l(),{imageFailed(){e||(A(t,n),r(null))},dispose(){e=!0,s()}}}function $(t,n){p();const r=f,e=`${t}/${n}`,i=u.get(e);if(i)return Promise.resolve(i);const o=a.get(e);if(o)return o;const l=(async()=>{try{const s=await h({attachmentId:n,workspaceId:t});if(r!==f)return null;if(!s.exists)return g.warn("Attachment file missing on disk",{attachmentId:n}),null;const c=y(t,s.path);return u.set(e,c),c}catch(s){return g.warn("Failed to resolve attachment image",{attachmentId:n,error:s}),null}finally{r===f&&a.delete(e)}})();return a.set(e,l),l}export{A as e,F as o,$ as r};