@intent-hq/web 2.341.6 → 2.341.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 (142) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{CxjuVNaB.js → 1YAwhu6p.js} +1 -1
  3. package/web/app/immutable/chunks/{Jv-9rt7e.js → 4NWDSoFd.js} +3 -3
  4. package/web/app/immutable/chunks/{jr94KtZQ.js → 6ibsXGup.js} +1 -1
  5. package/web/app/immutable/chunks/{qiaLhGtl.js → 7ojnw3sH.js} +1 -1
  6. package/web/app/immutable/chunks/{BCvU0pY_.js → 81iikGfb.js} +4 -4
  7. package/web/app/immutable/chunks/{al7tOgUm.js → B1I5WM9v.js} +1 -1
  8. package/web/app/immutable/chunks/{krFvILrS.js → B2vzeMIK.js} +1 -1
  9. package/web/app/immutable/chunks/{BwYbkpv0.js → B5nWrdoQ.js} +2 -2
  10. package/web/app/immutable/chunks/{BjpkVlel.js → B6-zId45.js} +1 -1
  11. package/web/app/immutable/chunks/{C5pZr_eO.js → B68RgPt4.js} +1 -1
  12. package/web/app/immutable/chunks/{D4Bvjyun.js → B7I76UX8.js} +1 -1
  13. package/web/app/immutable/chunks/{CflCv6yT.js → B8g9F0km.js} +1 -1
  14. package/web/app/immutable/chunks/{D-FJwCJv.js → B9AYzIYi.js} +1 -1
  15. package/web/app/immutable/chunks/{B8PX7I-9.js → BAZoUnVN.js} +2 -2
  16. package/web/app/immutable/chunks/{qEqgcfxF.js → BC_SYp-o.js} +2 -2
  17. package/web/app/immutable/chunks/{D-rH49j3.js → BCzlGnYf.js} +1 -1
  18. package/web/app/immutable/chunks/{6QGNsSrA.js → BLRecOpc.js} +1 -1
  19. package/web/app/immutable/chunks/{BFAk2LVP.js → BNgq2ZMa.js} +1 -1
  20. package/web/app/immutable/chunks/{BnVJp_cC.js → BXU9MHXS.js} +6 -6
  21. package/web/app/immutable/chunks/{DUyrpeKY.js → BYXO0Gk3.js} +1 -1
  22. package/web/app/immutable/chunks/{CoMKMk85.js → BektlRSU.js} +1 -1
  23. package/web/app/immutable/chunks/{DOK9MM6Z.js → Ben0nAYz.js} +1 -1
  24. package/web/app/immutable/chunks/{CjLHTWF9.js → Bh-O97bI.js} +1 -1
  25. package/web/app/immutable/chunks/{CGJQ5Lrw.js → BiQrgetk.js} +1 -1
  26. package/web/app/immutable/chunks/{nHCGi3DM.js → BjBZP2Sm.js} +1 -1
  27. package/web/app/immutable/chunks/{BC9gAJNT.js → BkLZMMzN.js} +1 -1
  28. package/web/app/immutable/chunks/{CE8tJ75b.js → BmMWCsyJ.js} +2 -2
  29. package/web/app/immutable/chunks/{B2hRa7Yb.js → BnznFsYJ.js} +1 -1
  30. package/web/app/immutable/chunks/{CrA_uKSD.js → Bo29KQce.js} +2 -2
  31. package/web/app/immutable/chunks/{D_NE3d33.js → BoeEuXNl.js} +1 -1
  32. package/web/app/immutable/chunks/{Bvi-Shh7.js → Bp2Nfjmb.js} +1 -1
  33. package/web/app/immutable/chunks/{DzJrfN9j.js → BpB7N1op.js} +1 -1
  34. package/web/app/immutable/chunks/{N1UEVlPw.js → Bq5sL6M1.js} +2 -2
  35. package/web/app/immutable/chunks/{JvJxAzOX.js → BtasFr4u.js} +4 -4
  36. package/web/app/immutable/chunks/{T5qovgYE.js → Bvy2zKDX.js} +3 -3
  37. package/web/app/immutable/chunks/{BRqE1tM8.js → BxF7_wvx.js} +1 -1
  38. package/web/app/immutable/chunks/{BH3meh56.js → BxrOQdnj.js} +1 -1
  39. package/web/app/immutable/chunks/{LLmJZdsw.js → BzARCMDL.js} +1 -1
  40. package/web/app/immutable/chunks/{C7YrFrbw.js → C-4sX4WB.js} +1 -1
  41. package/web/app/immutable/chunks/{CP_M_2ZB.js → C2vrWFtk.js} +1 -1
  42. package/web/app/immutable/chunks/{DAfonYfL.js → C5Fcfi4a.js} +1 -1
  43. package/web/app/immutable/chunks/{CJuyNLgE.js → C69fieuV.js} +1 -1
  44. package/web/app/immutable/chunks/{fkUE5_Q0.js → C9AWwiKL.js} +2 -2
  45. package/web/app/immutable/chunks/{CHtP2-4n.js → C9mV43sF.js} +1 -1
  46. package/web/app/immutable/chunks/{BIGsFVkI.js → CA5qStwv.js} +1 -1
  47. package/web/app/immutable/chunks/{CnNmiU5l.js → CG-AjHmw.js} +1 -1
  48. package/web/app/immutable/chunks/{DfkQEaXV.js → CMw3X-cM.js} +1 -1
  49. package/web/app/immutable/chunks/{CllmVeix.js → CNthkG74.js} +12 -12
  50. package/web/app/immutable/chunks/{6JOWUA0P.js → CQ88uPDU.js} +1 -1
  51. package/web/app/immutable/chunks/{BfyfSZdl.js → CXKyDRyX.js} +1 -1
  52. package/web/app/immutable/chunks/{BP7nlxNq.js → CZnSx3IG.js} +1 -1
  53. package/web/app/immutable/chunks/{2Ao-T8qf.js → CZsqRMpl.js} +1 -1
  54. package/web/app/immutable/chunks/{DGNeAaXl.js → CcbgOGTK.js} +1 -1
  55. package/web/app/immutable/chunks/{BckqRYZs.js → CdckxRoX.js} +1 -1
  56. package/web/app/immutable/chunks/{DtBRtc2i.js → CeCMyC6B.js} +1 -1
  57. package/web/app/immutable/chunks/{C7ByBZsV.js → CeH-8zz-.js} +1 -1
  58. package/web/app/immutable/chunks/{BV5oTCVw.js → CjWE3eOa.js} +1 -1
  59. package/web/app/immutable/chunks/{D2-uQyBY.js → Cjq0T7Yr.js} +1 -1
  60. package/web/app/immutable/chunks/{DDr1O9hn.js → Cobq24L_.js} +1 -1
  61. package/web/app/immutable/chunks/{CevzYtzb.js → CpXdD2pe.js} +1 -1
  62. package/web/app/immutable/chunks/{jBBqXN5m.js → CtxPws6S.js} +1 -1
  63. package/web/app/immutable/chunks/{YTC67ekm.js → CusuNfO9.js} +1 -1
  64. package/web/app/immutable/chunks/{D5Y-wADp.js → Cv7jb4Uj.js} +1 -1
  65. package/web/app/immutable/chunks/{CvYgDxVJ.js → Czy4ZgYr.js} +1 -1
  66. package/web/app/immutable/chunks/{DKTLNGza.js → D-Nl8cp7.js} +1 -1
  67. package/web/app/immutable/chunks/{B0BPiCIq.js → D02vVDIu.js} +1 -1
  68. package/web/app/immutable/chunks/{C5-5Zn5M.js → D0_ubDvW.js} +1 -1
  69. package/web/app/immutable/chunks/{CTqL3PzM.js → D5nioBhi.js} +1 -1
  70. package/web/app/immutable/chunks/{Bl7mtvej.js → D5pBf0jC.js} +1 -1
  71. package/web/app/immutable/chunks/{M-lXDPAs.js → D63pT3ik.js} +1 -1
  72. package/web/app/immutable/chunks/{BV9VbdHN.js → D6S0zdsw.js} +1 -1
  73. package/web/app/immutable/chunks/{D7on2OYy.js → D6a7EVHj.js} +1 -1
  74. package/web/app/immutable/chunks/{DifLuz3S.js → D7mmNGtO.js} +1 -1
  75. package/web/app/immutable/chunks/{DINs12JF.js → DAOXVkCb.js} +1 -1
  76. package/web/app/immutable/chunks/{D3sI15LX.js → DD3CUlXo.js} +1 -1
  77. package/web/app/immutable/chunks/{DUi9RlML.js → DDGVLuT3.js} +1 -1
  78. package/web/app/immutable/chunks/{C_7KXUMJ.js → DDIBsw5o.js} +1 -1
  79. package/web/app/immutable/chunks/{DFNl1TUB.js → DDcw3XhX.js} +1 -1
  80. package/web/app/immutable/chunks/{lDItBJz5.js → DJRflSCY.js} +1 -1
  81. package/web/app/immutable/chunks/{DCg6Psz1.js → DLmrG3a0.js} +1 -1
  82. package/web/app/immutable/chunks/{CXrLqpUL.js → DNTNA0lR.js} +1 -1
  83. package/web/app/immutable/chunks/{oMcc34RE.js → DO_NXLHx.js} +1 -1
  84. package/web/app/immutable/chunks/{C27DSvBR.js → DS0SHFd6.js} +1 -1
  85. package/web/app/immutable/chunks/{D5WJzeDf.js → DSCXs-q3.js} +1 -1
  86. package/web/app/immutable/chunks/{WzteeIMn.js → DUczM7TD.js} +1 -1
  87. package/web/app/immutable/chunks/{DTOx94XM.js → DUdjGJXf.js} +4 -4
  88. package/web/app/immutable/chunks/{DrMWLzGI.js → DUwN32hQ.js} +1 -1
  89. package/web/app/immutable/chunks/{Bvz-dBQx.js → DY0gt_BS.js} +1 -1
  90. package/web/app/immutable/chunks/{R9fjYuJn.js → DYFy2Ldf.js} +1 -1
  91. package/web/app/immutable/chunks/{CdLAF87I.js → DYJDw3uX.js} +1 -1
  92. package/web/app/immutable/chunks/{D87dDGLb.js → DZshGt8n.js} +4 -4
  93. package/web/app/immutable/chunks/{DvM8bJms.js → D_HEyzTO.js} +1 -1
  94. package/web/app/immutable/chunks/{Dci9hnTj.js → D_vngkiW.js} +1 -1
  95. package/web/app/immutable/chunks/{s2w6GV5M.js → DcWx2Amv.js} +1 -1
  96. package/web/app/immutable/chunks/{uxIOvU_P.js → De07dT_P.js} +1 -1
  97. package/web/app/immutable/chunks/{ByIzMOqf.js → DnnZVXl2.js} +1 -1
  98. package/web/app/immutable/chunks/{DAiFFgAJ.js → DsyMO7lt.js} +1 -1
  99. package/web/app/immutable/chunks/{zrlfyKcK.js → Dxrm8R2l.js} +1 -1
  100. package/web/app/immutable/chunks/{jgj4o1Uh.js → Dxy7-YsF.js} +1 -1
  101. package/web/app/immutable/chunks/{DwmpVKoW.js → DywAIT80.js} +1 -1
  102. package/web/app/immutable/chunks/{Cj20eHEu.js → Dz_5oWBH.js} +1 -1
  103. package/web/app/immutable/chunks/{By_-fe-o.js → EYLa5b66.js} +1 -1
  104. package/web/app/immutable/chunks/{Ced1BDxC.js → EZET2SWx.js} +1 -1
  105. package/web/app/immutable/chunks/{DSiABYr8.js → F7t0kUrs.js} +3 -3
  106. package/web/app/immutable/chunks/{BvpSU-JA.js → IIWOz2cn.js} +1 -1
  107. package/web/app/immutable/chunks/{0P3kNdul.js → K1xasT4s.js} +1 -1
  108. package/web/app/immutable/chunks/{CoApDTLs.js → N-8H6MfE.js} +1 -1
  109. package/web/app/immutable/chunks/{uG0ogRPF.js → NmTl74hx.js} +1 -1
  110. package/web/app/immutable/chunks/{CutmAjXi.js → Ou3SFDdl.js} +1 -1
  111. package/web/app/immutable/chunks/{D58pwzPt.js → PCmXghpH.js} +1 -1
  112. package/web/app/immutable/chunks/{DkH0frG1.js → U7DUVyx7.js} +1 -1
  113. package/web/app/immutable/chunks/{BjftfsNw.js → Vz71nOZi.js} +1 -1
  114. package/web/app/immutable/chunks/{Cr71dCQ9.js → XbvlLx0H.js} +1 -1
  115. package/web/app/immutable/chunks/{CJHy-JJE.js → ZX0Y7FB3.js} +1 -1
  116. package/web/app/immutable/chunks/{C4JT0UFD.js → bombbKOB.js} +1 -1
  117. package/web/app/immutable/chunks/{K1_w_nIY.js → dEQD1s3O.js} +1 -1
  118. package/web/app/immutable/chunks/{B6vq-Jnf.js → l-XeMHVA.js} +3 -3
  119. package/web/app/immutable/chunks/{m60HmQ1I.js → s8EWzU2o.js} +1 -1
  120. package/web/app/immutable/chunks/{Dpl1vNuS.js → ufCEqIju.js} +2 -2
  121. package/web/app/immutable/chunks/{SkSVpvq2.js → vYC7k36z.js} +1 -1
  122. package/web/app/immutable/chunks/{CaBVF8lo.js → vajMn1hF.js} +1 -1
  123. package/web/app/immutable/chunks/{DghFeJpM.js → wnsbxXgJ.js} +1 -1
  124. package/web/app/immutable/chunks/{B76iPCB8.js → xrhTb8jJ.js} +3 -3
  125. package/web/app/immutable/entry/{app.BYFXPHEi.js → app.Bbjsnx4F.js} +2 -2
  126. package/web/app/immutable/entry/start.CC-sOLAV.js +1 -0
  127. package/web/app/immutable/nodes/{0.DWqlOy-Q.js → 0.DIrmDdgP.js} +1 -1
  128. package/web/app/immutable/nodes/{1.ldbPcT5e.js → 1.0U9rVILo.js} +1 -1
  129. package/web/app/immutable/nodes/{10.DVqBY3OG.js → 10.DmuyDRUa.js} +1 -1
  130. package/web/app/immutable/nodes/{14.C-M1ZgmW.js → 14.BDU3mo5z.js} +1 -1
  131. package/web/app/immutable/nodes/{17.CFL-PLIe.js → 17.CaPm8EEa.js} +2 -2
  132. package/web/app/immutable/nodes/{2.D3qjCzco.js → 2.BUocyfyX.js} +4 -4
  133. package/web/app/immutable/nodes/{3.T86uAwai.js → 3.DgsM2P-7.js} +1 -1
  134. package/web/app/immutable/nodes/{4.Czq-r5qI.js → 4.BF7b7v6_.js} +1 -1
  135. package/web/app/immutable/nodes/{5.DBiCRujn.js → 5.DnMfc77x.js} +1 -1
  136. package/web/app/immutable/nodes/{6.CSz1iNfF.js → 6.DKcarngt.js} +1 -1
  137. package/web/app/immutable/nodes/{7.DOMZo383.js → 7.CNf5_kic.js} +1 -1
  138. package/web/app/immutable/nodes/{8.fP5NZuL5.js → 8.BHg8aZ3X.js} +4 -4
  139. package/web/app/immutable/nodes/{9.7pp9xb37.js → 9.6MWpxcjv.js} +4 -4
  140. package/web/app/version.json +1 -1
  141. package/web/index.html +9 -9
  142. package/web/app/immutable/entry/start.DE-Q5qIJ.js +0 -1
@@ -1 +1 @@
1
- import{b as s}from"./D87dDGLb.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I};
1
+ import{b as s}from"./DZshGt8n.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I};
@@ -1,4 +1,4 @@
1
- import{g as Ni}from"./BFAk2LVP.js";import{s as Ci}from"./DFNl1TUB.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"./D87dDGLb.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"./BNgq2ZMa.js";import{s as Ci}from"./DDcw3XhX.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"./DZshGt8n.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
- var Me=Object.defineProperty;var De=(i,s,e)=>s in i?Me(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var m=(i,s,e)=>De(i,typeof s!="symbol"?s+"":s,e);import{x as Ne,J as oe,Z as ce,ai as q,ar as Ce}from"./DSiABYr8.js";import{bY as Le,cX as le,co as ue,cn as ve}from"./BjpkVlel.js";import{Ix as p,Bd as we,bw as be,c as Fe,KA as de,i8 as me,bI as ke,D8 as z,BC as Ge,f5 as Pe,zH as xe,dS as Ee,f1 as fe,dR as _e,Aa as Ve,Ke as Ue,vR as Be}from"./DNqM68dO.js";import{aC as Ae,dG as he,A as H,P as Re,ay as K}from"./VZEkDWIM.js";import{ax as $e}from"./CR_t_AVn.js";import{c as W}from"./ChTqQfQN.js";import{a as Xe}from"./BdWqymET.js";import{k as Q}from"./B6kyqBFl.js";import"./DYhIMPy1.js";import{bp as n}from"./O1QHAURn.js";import"./CAyg2ijY.js";import"./BBDxUL80.js";import"./B1mZq3ve.js";import{R as ge}from"./BvFAWM27.js";import{L as Ye}from"./CSiaiLHL.js";function We(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new Xe("PerformanceOptimizer"),w=class w{constructor(){m(this,"metricsBuffer");m(this,"metricsIndex",0);m(this,"metricsCount",0);m(this,"MAX_METRICS",500);m(this,"TARGET_RESPONSE_TIME",100);m(this,"memoCache",new Map);m(this,"MEMO_TTL",6e4);m(this,"MAX_CACHE_SIZE",100);m(this,"cacheHits",0);m(this,"cacheMisses",0);m(this,"pendingRequests",new Map);m(this,"requestQueue",[]);m(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let c=0;c<s.length;c+=r){const f=s.slice(c,c+r).map((o,g)=>{const R=Math.floor(g/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(o);d(k)},R)})}),u=await Promise.all(f);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const f=this.getMemoized(a);if(f!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),f;this.cacheMisses++}if(t.coalesce){const f=this.pendingRequests.get(s);if(f)return V.debug("Request coalesced",{operation:s}),f}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const c=await l;t.memoize&&this.memoize(a,c);const E=Z.now()-r;return this.recordMetric(s,E,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),E>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(E),target:this.TARGET_RESPONSE_TIME}),c}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const o=this.metricsBuffer[(e+u)%this.MAX_METRICS];o&&s.push(o)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,o)=>u.duration-o.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const c=a/s.length,E=Math.floor(t.length*.95),f=Math.floor(t.length*.99);return{avgResponseTime:Math.round(c),p95ResponseTime:Math.round(t[E]?.duration||0),p99ResponseTime:Math.round(t[f]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};m(w,"instance");let ee=w;const qe=ee.getInstance(),pe={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},j={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},ze={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function He(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Ke(i,s){return He(i).every(t=>t in s)}function Ie(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function J(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function Qe(i,s){return s&&j[i]&&Ke(j[i],s)?Ie(j[i],s):ze[i]||n.errors_userFriendly_fallback_error()}function Ze(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?pe[e]:pe.GENERAL}const je={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function Je(i){return je[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var D=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(D||{});class Y extends Error{constructor(e,t,r={},a){super(e);m(this,"code");m(this,"context");m(this,"recoverySuggestions");m(this,"userMessage");m(this,"isRecoverable");m(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return Qe(e,this.context)}getDefaultRecoverySuggestions(e){return Je(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return Ze(this.code)}formatMessage(e){return Ie(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const et={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function ie(i){const s=i.toLowerCase();for(const e of et.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const tt="Agent already has an in-flight prompt. Message was not delivered.",v=W("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=ge.DEFAULT_ATTEMPTS,retryDelay:a=ge.BASE_DELAY,exponentialBackoff:l=!0,notify:c=!1,notifyOnRetry:E=!1,context:f={},onError:u,onRetry:o,shouldRetry:g=this.defaultShouldRetry}=t;let R=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const h=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),h}catch(h){if(R=h,v.error(`[${e}] Attempt ${d} failed`,{error:R.message,attempt:d,maxAttempts:r+1,context:f}),u?.(R,d),d<=r&&g(R)){const C=l?a*Math.pow(2,d-1):a;E&&Q.warning(n.agent_errorBoundary_retrying_message({seconds:C/1e3})),o?.(d),v.info(`[${e}] Retrying in ${C}ms`),await this.sleep(C)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${R?.message}`,P=J(R?.message||n.agent_errorBoundary_generic_error()),N=R?.message?.toLowerCase()||"",$=N.includes("no available models")||N.includes("all models exhausted")||N.includes("all models unavailable");throw c&&!$&&Q.error(P),new Y(P,D.OPERATION_FAILED,{originalError:R?.message,detailedMessage:k,attempts:d,context:f})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&Q.error(J(a.message)),new Y(J(a.message),D.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return ie(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof Y?[D.NETWORK_ERROR,D.STREAM_TIMEOUT,D.STREAM_CONNECTION_FAILED,D.PROVIDER_CONNECTION_FAILED,D.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new Y(`${t} timed out after ${e}ms`,D.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,c=[],E=[];for(let f=0;f<s.length;f+=r){const u=s.slice(f,f+r);(await Promise.allSettled(u.map(g=>e(g)))).forEach((g,R)=>{if(g.status==="fulfilled")c.push(g.value);else{const d=g.reason;if(E.push({item:u[R],error:d}),v.error(`[${l}] Batch item failed`,{item:u[R],error:d.message}),!a)throw d}})}return E.length>0&&v.warn(`[${l}] Completed with ${E.length} errors`),{results:c,errors:E}}};m(b,"instance");let te=b;const st=te.getInstance(),se=W("browser/index"),F=new Map,B=new Map;let U;function it(i,s,e){for(const t of s)try{t(e)}catch(r){se.error("Error in agent subscriber callback",{agentId:i,error:r})}}function rt(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Ae.select(e,t);B.get(t)!==a&&(B.set(t,a),it(t,r,a))}})}function at(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ct(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),rt();const a=p.state,l=Ae.select(a,i);return r&&B.set(i,l),l?se.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):se.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const c=F.get(i);c&&(c.delete(s),c.size===0&&(F.delete(i),B.delete(i))),at()}}const y=W("ErrorRecovery"),Se={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||ie(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class nt{constructor(){m(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class ot extends nt{constructor(){super(...arguments);m(this,"activeRecoveries",new Map);m(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=Se.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let c,E=t.initialBackoffMs,f=0;for(let u=1;u<=t.maxRetries;u++){if(f=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const o=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:o,attempts:u,totalTime:Date.now()-a}}catch(o){c=o,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:c.message});const g=c.message.toLowerCase();if(g.includes("interrupted")||g.includes("cancelled")||g.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:c.message});break}if(g.includes("no available models")||g.includes("all models exhausted")||g.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:c.message});break}if(ie(c.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:c.message});break}if(!t.shouldRetry(c,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:c.message});break}if(u<t.maxRetries){const R=Math.random()*.2*E,d=Math.min(E+R,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:c.message}),await this.delay(d,l.signal),E=Math.min(E*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(c,f),this.emit("recovery:failure",{operationId:r,attempts:f,duration:Date.now()-a,error:c?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:c,attempts:f,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const c=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",c);const E=r;r=()=>{t.removeEventListener("abort",c),E()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const ct=new ot,O=new Ye({category:"WorkspaceMetrics"}),lt=100;class ut{constructor(){m(this,"metrics",new Map);m(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>lt;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const dt=new ut,M=W("AgentSend");function A(i){p.dispatch(i)}function Te(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function mt(i){const s=Te(i)&&i.success===!0&&"data"in i?i.data:i;return!Te(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(tt)}async function Lt(i,s,e,t={}){const r=he.select(p.state,e.id);if(!r)return;const a=Ne(i,e.id),l=t.submission,c=!!l&&Le.select(p.state,l.scope)?.supported===!0,E=(o,g,R=!1)=>{l&&A(Be(l.scope,l.id,o,Date.now(),g,R))};let f=!1;const u=()=>(!l||f||ve.select(p.state,l))&&r===he.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let o=await p.dispatch(we(e.id,i));if(u()){if(!o)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));o={...o,isStreaming:o.isStreaming??!1};{if(o&&(o.status==="pending"||!o.id)&&!o.backendSessionId&&o.activationState!==H.ACTIVE&&o.activationState!==H.ACTIVATING){const h=e.id.startsWith("optimistic-"),C=e.worktreePath||e.repositoryPath||e.path;if(!h&&C){M.info("Activating pending session in sendMessage",{agentId:i,status:o.status,activationState:o.activationState,hasBackendSessionId:!!o.backendSessionId});const x=await p.dispatch(be(e.id,i));if(!u())return;x&&(o=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else o&&o.status==="pending"&&o.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:o.backendSessionId,activationState:o.activationState}),o={...o,status:Fe.Active,activationState:H.ACTIVE},A(de({...o,workspaceId:e.id})));if(!o)throw new Error(`Failed to get or create session for agent ${i}`);A(de({...o,workspaceId:e.id}));const R=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)R.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)R.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??oe(),k=t.messageMetadata?.[Re],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[Re]:k}:{}},N={id:me(le()),appMessageId:d,role:"user",contentBlocks:R,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};c||(l&&(E("rejected"),f=!0),A(ke(o.id,N))),A(z(o.id,!0));let $=!1;try{c||await p.dispatch(Ge(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=me(`msg_${le()}`),C=oe(),x=async()=>st.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:o.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(_=>({type:_.type,mimeType:_.mimeType,dataLength:_.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(_=>({type:_.type,fileName:_.fileName,mimeType:_.mimeType,attachmentId:_.attachmentId,size:_.size}))||[]});const Oe=t.model??t.modelId??o.model??void 0;A(Pe(i));const ye=ce(i,e.id),ae=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await $e("agent.sendMessage",{agentId:i,...c&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Oe,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:C,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(_=>{if(u())throw _});if(u()){if(mt(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:o.id}),E("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const _=T.error,I=typeof _=="string"?_:_?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:o.id,queuedMessageId:T.queuedMessage?.id}),(!c||!l||!ue.select(p.state,l))&&A(z(o.id,!1)),c||A(xe(o.id,N.id)),c){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=Ee(s,t),X=K.select(p.state,i,e.id).find(ne=>ne.id===I.id||ne.turnId===L);A(fe(i,I.id,S,L,_e(X??I,S),!X&&!!l&&ue.select(p.state,l),ae))}E("accepted",I,!0),q(i,e.id);return}const _=T.queuedMessage;if(_){const I=T.turnId,G=typeof I=="string"?I:_.turnId;let L=_;if(u()&&ce(i,e.id)===ye){const S=K.select(p.state,i,e.id),X=We(S,_);A(Ve(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:_.id}),await q(i,e.id).catch(()=>{}),L=K.select(p.state,i,e.id).find(S=>S.id===_.id||S.turnId===G));if(u()&&typeof G=="string"){const S=Ee(s,t);A(fe(i,_.id,S,G,_e(L??_,S),!L,ae))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:_.id})}return}}c&&(E("accepted"),q(i,e.id),Ce(i,e.id)),dt.incrementMessageSent(e.id)}},"send message",{retries:c?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),re=c?await x().then(()=>({success:!0,error:void 0})):await ct.executeWithRecovery(x,Se.streaming,`send-message-${i}`);if(!re.success)throw re.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(z(o.id,!1)),!c&&t.messageMetadata&&A(Ue(o.id,N.id,{metadata:P})),c&&E($?"rejected":"uncertain"),h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Ct as a,J as c,We as r,Lt as s};
1
+ var Me=Object.defineProperty;var De=(i,s,e)=>s in i?Me(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var m=(i,s,e)=>De(i,typeof s!="symbol"?s+"":s,e);import{x as Ne,J as oe,Z as ce,ai as q,ar as Ce}from"./F7t0kUrs.js";import{bY as Le,cX as le,co as ue,cn as ve}from"./B6-zId45.js";import{Ix as p,Bd as we,bw as be,c as Fe,KA as de,i8 as me,bI as ke,D8 as z,BC as Ge,f5 as Pe,zH as xe,dS as Ee,f1 as fe,dR as _e,Aa as Ve,Ke as Ue,vR as Be}from"./DNqM68dO.js";import{aC as Ae,dG as he,A as H,P as Re,ay as K}from"./VZEkDWIM.js";import{ax as $e}from"./CR_t_AVn.js";import{c as W}from"./ChTqQfQN.js";import{a as Xe}from"./BdWqymET.js";import{k as Q}from"./B6kyqBFl.js";import"./DYhIMPy1.js";import{bp as n}from"./O1QHAURn.js";import"./CAyg2ijY.js";import"./BBDxUL80.js";import"./B1mZq3ve.js";import{R as ge}from"./BvFAWM27.js";import{L as Ye}from"./CSiaiLHL.js";function We(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new Xe("PerformanceOptimizer"),w=class w{constructor(){m(this,"metricsBuffer");m(this,"metricsIndex",0);m(this,"metricsCount",0);m(this,"MAX_METRICS",500);m(this,"TARGET_RESPONSE_TIME",100);m(this,"memoCache",new Map);m(this,"MEMO_TTL",6e4);m(this,"MAX_CACHE_SIZE",100);m(this,"cacheHits",0);m(this,"cacheMisses",0);m(this,"pendingRequests",new Map);m(this,"requestQueue",[]);m(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let c=0;c<s.length;c+=r){const f=s.slice(c,c+r).map((o,g)=>{const R=Math.floor(g/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(o);d(k)},R)})}),u=await Promise.all(f);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const f=this.getMemoized(a);if(f!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),f;this.cacheMisses++}if(t.coalesce){const f=this.pendingRequests.get(s);if(f)return V.debug("Request coalesced",{operation:s}),f}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const c=await l;t.memoize&&this.memoize(a,c);const E=Z.now()-r;return this.recordMetric(s,E,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),E>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(E),target:this.TARGET_RESPONSE_TIME}),c}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const o=this.metricsBuffer[(e+u)%this.MAX_METRICS];o&&s.push(o)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,o)=>u.duration-o.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const c=a/s.length,E=Math.floor(t.length*.95),f=Math.floor(t.length*.99);return{avgResponseTime:Math.round(c),p95ResponseTime:Math.round(t[E]?.duration||0),p99ResponseTime:Math.round(t[f]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};m(w,"instance");let ee=w;const qe=ee.getInstance(),pe={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},j={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},ze={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function He(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Ke(i,s){return He(i).every(t=>t in s)}function Ie(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function J(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function Qe(i,s){return s&&j[i]&&Ke(j[i],s)?Ie(j[i],s):ze[i]||n.errors_userFriendly_fallback_error()}function Ze(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?pe[e]:pe.GENERAL}const je={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function Je(i){return je[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var D=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(D||{});class Y extends Error{constructor(e,t,r={},a){super(e);m(this,"code");m(this,"context");m(this,"recoverySuggestions");m(this,"userMessage");m(this,"isRecoverable");m(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return Qe(e,this.context)}getDefaultRecoverySuggestions(e){return Je(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return Ze(this.code)}formatMessage(e){return Ie(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const et={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function ie(i){const s=i.toLowerCase();for(const e of et.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const tt="Agent already has an in-flight prompt. Message was not delivered.",v=W("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=ge.DEFAULT_ATTEMPTS,retryDelay:a=ge.BASE_DELAY,exponentialBackoff:l=!0,notify:c=!1,notifyOnRetry:E=!1,context:f={},onError:u,onRetry:o,shouldRetry:g=this.defaultShouldRetry}=t;let R=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const h=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),h}catch(h){if(R=h,v.error(`[${e}] Attempt ${d} failed`,{error:R.message,attempt:d,maxAttempts:r+1,context:f}),u?.(R,d),d<=r&&g(R)){const C=l?a*Math.pow(2,d-1):a;E&&Q.warning(n.agent_errorBoundary_retrying_message({seconds:C/1e3})),o?.(d),v.info(`[${e}] Retrying in ${C}ms`),await this.sleep(C)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${R?.message}`,P=J(R?.message||n.agent_errorBoundary_generic_error()),N=R?.message?.toLowerCase()||"",$=N.includes("no available models")||N.includes("all models exhausted")||N.includes("all models unavailable");throw c&&!$&&Q.error(P),new Y(P,D.OPERATION_FAILED,{originalError:R?.message,detailedMessage:k,attempts:d,context:f})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&Q.error(J(a.message)),new Y(J(a.message),D.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return ie(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof Y?[D.NETWORK_ERROR,D.STREAM_TIMEOUT,D.STREAM_CONNECTION_FAILED,D.PROVIDER_CONNECTION_FAILED,D.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new Y(`${t} timed out after ${e}ms`,D.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,c=[],E=[];for(let f=0;f<s.length;f+=r){const u=s.slice(f,f+r);(await Promise.allSettled(u.map(g=>e(g)))).forEach((g,R)=>{if(g.status==="fulfilled")c.push(g.value);else{const d=g.reason;if(E.push({item:u[R],error:d}),v.error(`[${l}] Batch item failed`,{item:u[R],error:d.message}),!a)throw d}})}return E.length>0&&v.warn(`[${l}] Completed with ${E.length} errors`),{results:c,errors:E}}};m(b,"instance");let te=b;const st=te.getInstance(),se=W("browser/index"),F=new Map,B=new Map;let U;function it(i,s,e){for(const t of s)try{t(e)}catch(r){se.error("Error in agent subscriber callback",{agentId:i,error:r})}}function rt(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Ae.select(e,t);B.get(t)!==a&&(B.set(t,a),it(t,r,a))}})}function at(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ct(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),rt();const a=p.state,l=Ae.select(a,i);return r&&B.set(i,l),l?se.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):se.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const c=F.get(i);c&&(c.delete(s),c.size===0&&(F.delete(i),B.delete(i))),at()}}const y=W("ErrorRecovery"),Se={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||ie(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class nt{constructor(){m(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class ot extends nt{constructor(){super(...arguments);m(this,"activeRecoveries",new Map);m(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=Se.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let c,E=t.initialBackoffMs,f=0;for(let u=1;u<=t.maxRetries;u++){if(f=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const o=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:o,attempts:u,totalTime:Date.now()-a}}catch(o){c=o,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:c.message});const g=c.message.toLowerCase();if(g.includes("interrupted")||g.includes("cancelled")||g.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:c.message});break}if(g.includes("no available models")||g.includes("all models exhausted")||g.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:c.message});break}if(ie(c.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:c.message});break}if(!t.shouldRetry(c,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:c.message});break}if(u<t.maxRetries){const R=Math.random()*.2*E,d=Math.min(E+R,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:c.message}),await this.delay(d,l.signal),E=Math.min(E*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(c,f),this.emit("recovery:failure",{operationId:r,attempts:f,duration:Date.now()-a,error:c?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:c,attempts:f,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const c=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",c);const E=r;r=()=>{t.removeEventListener("abort",c),E()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const ct=new ot,O=new Ye({category:"WorkspaceMetrics"}),lt=100;class ut{constructor(){m(this,"metrics",new Map);m(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>lt;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const dt=new ut,M=W("AgentSend");function A(i){p.dispatch(i)}function Te(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function mt(i){const s=Te(i)&&i.success===!0&&"data"in i?i.data:i;return!Te(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(tt)}async function Lt(i,s,e,t={}){const r=he.select(p.state,e.id);if(!r)return;const a=Ne(i,e.id),l=t.submission,c=!!l&&Le.select(p.state,l.scope)?.supported===!0,E=(o,g,R=!1)=>{l&&A(Be(l.scope,l.id,o,Date.now(),g,R))};let f=!1;const u=()=>(!l||f||ve.select(p.state,l))&&r===he.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let o=await p.dispatch(we(e.id,i));if(u()){if(!o)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));o={...o,isStreaming:o.isStreaming??!1};{if(o&&(o.status==="pending"||!o.id)&&!o.backendSessionId&&o.activationState!==H.ACTIVE&&o.activationState!==H.ACTIVATING){const h=e.id.startsWith("optimistic-"),C=e.worktreePath||e.repositoryPath||e.path;if(!h&&C){M.info("Activating pending session in sendMessage",{agentId:i,status:o.status,activationState:o.activationState,hasBackendSessionId:!!o.backendSessionId});const x=await p.dispatch(be(e.id,i));if(!u())return;x&&(o=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else o&&o.status==="pending"&&o.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:o.backendSessionId,activationState:o.activationState}),o={...o,status:Fe.Active,activationState:H.ACTIVE},A(de({...o,workspaceId:e.id})));if(!o)throw new Error(`Failed to get or create session for agent ${i}`);A(de({...o,workspaceId:e.id}));const R=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)R.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)R.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??oe(),k=t.messageMetadata?.[Re],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[Re]:k}:{}},N={id:me(le()),appMessageId:d,role:"user",contentBlocks:R,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};c||(l&&(E("rejected"),f=!0),A(ke(o.id,N))),A(z(o.id,!0));let $=!1;try{c||await p.dispatch(Ge(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=me(`msg_${le()}`),C=oe(),x=async()=>st.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:o.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(_=>({type:_.type,mimeType:_.mimeType,dataLength:_.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(_=>({type:_.type,fileName:_.fileName,mimeType:_.mimeType,attachmentId:_.attachmentId,size:_.size}))||[]});const Oe=t.model??t.modelId??o.model??void 0;A(Pe(i));const ye=ce(i,e.id),ae=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await $e("agent.sendMessage",{agentId:i,...c&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Oe,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:C,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(_=>{if(u())throw _});if(u()){if(mt(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:o.id}),E("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const _=T.error,I=typeof _=="string"?_:_?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:o.id,queuedMessageId:T.queuedMessage?.id}),(!c||!l||!ue.select(p.state,l))&&A(z(o.id,!1)),c||A(xe(o.id,N.id)),c){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=Ee(s,t),X=K.select(p.state,i,e.id).find(ne=>ne.id===I.id||ne.turnId===L);A(fe(i,I.id,S,L,_e(X??I,S),!X&&!!l&&ue.select(p.state,l),ae))}E("accepted",I,!0),q(i,e.id);return}const _=T.queuedMessage;if(_){const I=T.turnId,G=typeof I=="string"?I:_.turnId;let L=_;if(u()&&ce(i,e.id)===ye){const S=K.select(p.state,i,e.id),X=We(S,_);A(Ve(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:_.id}),await q(i,e.id).catch(()=>{}),L=K.select(p.state,i,e.id).find(S=>S.id===_.id||S.turnId===G));if(u()&&typeof G=="string"){const S=Ee(s,t);A(fe(i,_.id,S,G,_e(L??_,S),!L,ae))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:_.id})}return}}c&&(E("accepted"),q(i,e.id),Ce(i,e.id)),dt.incrementMessageSent(e.id)}},"send message",{retries:c?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),re=c?await x().then(()=>({success:!0,error:void 0})):await ct.executeWithRecovery(x,Se.streaming,`send-message-${i}`);if(!re.success)throw re.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(z(o.id,!1)),!c&&t.messageMetadata&&A(Ue(o.id,N.id,{metadata:P})),c&&E($?"rejected":"uncertain"),h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Ct as a,J as c,We as r,Lt as s};
@@ -1 +1 @@
1
- import{d as p}from"./BV3MrUXO.js";import{D as s,C as l}from"./LLmJZdsw.js";import{selectScriptOutput as o,selectScriptById as f,selectCanReadScriptDefinition as m}from"./CTqL3PzM.js";async function S(i,t,e,r=100){const n=s(o.select(i,t,e)).slice(-r);if(!t||!e)return n;const u=f.select(i,t,e);if(!m.select(i,t,u))return[];try{const c=l(await p.scripts.output(t,e,r));return c.length>0?c.slice(-r):n}catch{return n}}export{S as readScriptContextOutputLines};
1
+ import{d as p}from"./BV3MrUXO.js";import{D as s,C as l}from"./BzARCMDL.js";import{selectScriptOutput as o,selectScriptById as f,selectCanReadScriptDefinition as m}from"./D5nioBhi.js";async function S(i,t,e,r=100){const n=s(o.select(i,t,e)).slice(-r);if(!t||!e)return n;const u=f.select(i,t,e);if(!m.select(i,t,u))return[];try{const c=l(await p.scripts.output(t,e,r));return c.length>0?c.slice(-r):n}catch{return n}}export{S as readScriptContextOutputLines};
@@ -1,4 +1,4 @@
1
- import{t as ct,br as ae,bz as dt,bs as jt,b as ut,a_ as Z,bp as d,bu as Mt,bt as xt,bv as ke}from"./O1QHAURn.js";import{bs as gt,a5 as qe,bf as Dt,bA as Be,W as r,bn as ft,aA as re,aB as H,aD as e,bS as $,c9 as n,a7 as J,ay as m,be as Ye,b$ as et,aC as pt,bo as $a,bV as ce,br as It,ca as je,bH as b,c5 as At,b_ as ve,bO as $e,c0 as Nt,bl as at,aw as Gt,cd as St,bz as wa,bj as Ia}from"./DYhIMPy1.js";import{G as Kt}from"./CovkQMd0.js";import{i as Xt,l as Jt,o as Aa,I as ka,n as kt,g as xa,u as Qt,v as ya}from"./CAyg2ijY.js";import{c as x}from"./C2mPABxH.js";import{b as Yt}from"./BaIAhI85.js";import{an as Ta,ao as Ca,bK as Sa}from"./CflCv6yT.js";import Pa from"./DAiFFgAJ.js";import{D as Ma}from"./Bvr7FizN.js";import{C as zt}from"./BjftfsNw.js";import"./CerLhVOI.js";import{a6 as ea}from"./B8PX7I-9.js";import{Ix as Q,dF as Da,dG as La,gL as ta,iX as Ha,Br as Oa,gr as Ba,iU as aa,iT as Ra,Dp as Fa,Do as Na,Dv as za,D0 as Ea,D3 as Ua,cd as Va,cb as Za,ch as Wa,bW as qa,D2 as ja,ce as Ga,CL as Ka}from"./DNqM68dO.js";import{g as Xa}from"./DfN8_dcw.js";import{a as Ja}from"./DDr1O9hn.js";import{l as Qa,P as Ya,m as er,n as tr,V as Et}from"./Dpl1vNuS.js";import{am as ar,aC as rr,dr as nr,bS as or,c4 as sr,aA as ir,bh as lr,i as cr}from"./VZEkDWIM.js";import{aY as dr,aZ as ur}from"./BjpkVlel.js";import{a as gr}from"./4zDfklj9.js";import{c as fr}from"./ChTqQfQN.js";import{c as pr}from"./C5pZr_eO.js";import{C as mr}from"./2Ao-T8qf.js";import{o as vr}from"./CWDPeeaf.js";import{I as _r,c as hr}from"./BV0i7JjW.js";import"./BH3LKWph.js";import{s as ra}from"./BBDxUL80.js";import{a5 as br,f as lt,am as $r}from"./CR_t_AVn.js";import{D as wr,C as na,T as Ir,F as Ar,H as kr,t as xr,R as yr}from"./Cr71dCQ9.js";import{aR as Tr,cX as oa,F as ht,c_ as $t,B as Cr,aZ as Sr,bn as Pr,cv as Mr,a6 as Dr,cw as Lr,a5 as Hr,cs as Or,aq as Br,aV as Rr,cU as Fr,ac as Nr,cg as zr,aj as Er,cN as Ur}from"./B0f-om7y.js";import{a as Pt,m as Vr}from"./BgCTNfXj.js";import{w as Zr,o as Lt,n as Ht,m as Ot,i as Ut,l as Bt,g as mt,p as Wr,h as qr,M as jr,k as Vt,R as Gr}from"./DV9nY0bt.js";import{B as Kr}from"./DKTLNGza.js";import{K as Xr,a3 as Jr,b7 as Qr}from"./BCvU0pY_.js";import"./CQkmEJ54.js";import{b as Yr}from"./Drd3_KgI.js";import{c as en}from"./C1dHaq0T.js";import"./CqO6BKca.js";import{M as st}from"./C64Iv2ib.js";import{g as tn}from"./CH5tRPYb.js";import{J as Zt,q as an}from"./BVs4aETe.js";import{aw as rn,_ as nn}from"./B6vq-Jnf.js";import{t as wt,p as on}from"./BkT9o_nd.js";import{a as sn,e as ln,d as cn,i as dn}from"./xEfOpOba.js";var un=new Set(["$$slots","$$events","$$legacy","children","class"]),gn=H("<div><!></div>");function sa(f,i){if(new.target)return ct({component:sa,...f});gt(i,!0);let w=ae(i,"children",7),p=ae(i,"class",7),v=jt(i,un);Zr(()=>!1);var T={get children(){return w()},set children(g){w(g),re()},get class(){return p()},set class(g){p(g),re()},$set:dt,$on:(g,M)=>ut(i,g,M)},A=gn();Xt(A,g=>({"data-slot":"menu-footer",class:g,...v}),[()=>Jt("menu-footer type-caption relative z-10 -mx-1.5 -mb-1.5 mt-1.5 border-t border-border bg-muted/20 px-3.5 py-1.5 leading-(--text-caption-line-height) font-normal text-muted-foreground [&_[data-menu-item]]:hover:bg-hover [&_[data-menu-item]]:focus-visible:bg-hover",p())],void 0,void 0,"svelte-1od5b5i");var S=qe(A);return ra(S,()=>w()??Dt),Be(A),r(f,A),ft(T)}var fn=new Set(["$$slots","$$events","$$legacy","children"]),pn=pt('<path d="M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"></path>'),mn=pt('<path d="M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z" opacity="0.2"></path><path d="M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"></path>',1),vn=pt('<path d="M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"></path>'),_n=pt('<path d="M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"></path>'),hn=pt('<path d="M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"></path>'),bn=pt('<path d="M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"></path>'),$n=pt('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function ia(f,i){if(new.target)return ct({component:ia,...f});gt(i,!0);const w=Aa();let p=ae(i,"children",7),v=jt(i,fn),T=n(()=>i.weight??w.weight??"regular"),A=n(()=>i.color??w.color??"currentColor"),S=n(()=>i.size??w.size??"1em"),g=n(()=>i.mirrored??w.mirrored??!1);function M(o){let{weight:I,color:O,size:Le,mirrored:X,...Ne}=o;return Ne}var G={get children(){return p()},set children(o){p(o),re()},$set:dt,$on:(o,I)=>ut(i,o,I)},R=$n();Xt(R,(o,I)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:e(S),height:e(S),fill:e(A),transform:e(g)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...o,...I}),[()=>M(w),()=>M(v)]);var Re=qe(R);{var ne=o=>{var I=J(),O=m(I);ra(O,p),r(o,I)};Z(Re,o=>{p()&&o(ne)})}var c=$(Re,2);{var z=o=>{var I=pn();r(o,I)},Ce=o=>{var I=mn();Ye(),r(o,I)},Ee=o=>{var I=vn();r(o,I)},Fe=o=>{var I=_n();r(o,I)},K=o=>{var I=hn();r(o,I)},de=o=>{var I=bn();r(o,I)},u=o=>{var I=et();I.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),r(o,I)};Z(c,o=>{e(T)==="bold"?o(z):e(T)==="duotone"?o(Ce,1):e(T)==="fill"?o(Ee,2):e(T)==="light"?o(Fe,3):e(T)==="regular"?o(K,4):e(T)==="thin"?o(de,5):o(u,-1)})}return Be(R),r(f,R),ft(G)}var wn=H('<div class="type-caption flex items-center gap-[var(--space-2)] px-[var(--space-2)] py-[var(--space-1)] text-muted-foreground" data-testid="chat-message-navigator-loading"><!> <span> </span></div>'),In=H('<span class="block min-w-0 max-w-full flex-1 overflow-hidden whitespace-nowrap text-left text-ellipsis font-normal"> </span>'),An=H('<div role="listbox" class="mt-[var(--space-1)] min-h-0 min-w-0 flex-1 max-h-72 overflow-x-hidden overflow-y-auto overscroll-contain"></div>'),kn=H('<div class="type-caption px-2 py-6 text-left text-muted-foreground" data-testid="chat-message-navigator-empty"> </div>'),xn=H('<div class="flex min-h-0 min-w-0 max-h-full flex-1 flex-col overflow-hidden" data-testid="chat-message-navigator-panel"><!> <div role="status" aria-live="polite" class="shrink-0" data-testid="chat-message-navigator-loading-region"><!></div> <!></div>'),Wt=H("<!> <!>",1),yn=H('<div class="flex shrink-0 items-center gap-0.5" data-testid="chat-header-navigation-controls"><!> <!></div>');function la(f,i){const w=$a();if(new.target)return ct({component:la,...f});gt(i,!0);const p=t=>{var h=xn(),F=qe(h);{let N=n(()=>d.chat_messageNavigator_search_ariaLabel()),P=n(()=>e(O).length>0?I:void 0),U=n(()=>d.chat_messageNavigator_search_placeholder());_r(F,{get value(){return e(ne)},oninput:nt,onkeydown:q,role:"combobox",get"aria-label"(){return e(N)},get"aria-controls"(){return e(P)},"aria-expanded":"true","aria-autocomplete":"list",get"aria-activedescendant"(){return e(Le)},autocomplete:"off",get placeholder(){return e(U)},class:"type-caption h-(--control-height-medium) w-full min-w-0 shrink-0 rounded-(--radius-small) border border-border bg-card px-[var(--space-2)] text-foreground caret-foreground outline-none placeholder:text-muted-foreground","data-testid":"chat-message-navigator-search",get ref(){return e(Fe)},set ref(B){b(Fe,B,!0)}})}var j=$(F,2),ee=qe(j);{var ye=N=>{var P=wn(),U=qe(P);ka(U,{size:16});var B=$(U,2),Ie=at(B,!0);Be(P),ve(D=>$e(Ie,D),[()=>d.chat_messageNavigator_loading_label()]),r(N,P)};Z(ee,N=>{M()&&N(ye)})}Be(j);var se=$(j,2);{var ie=N=>{var P=An();kt(P,23,()=>e(O),U=>U.id,(U,B,Ie)=>{{let D=n(()=>!e(Re)[e(B).id]),y=n(()=>G()?"":"h-(--control-height-large)");$r(U,{get content(){return e(B).text},get disabled(){return e(D)},side:"left",align:"center",delayDuration:300,size:"sm",get class(){return`block w-full min-w-0 max-w-full ${e(y)??""}`},contentClass:"max-w-[min(28rem,calc(100vw-var(--space-4)))] break-words text-left",children:(_e,ge)=>{{let fe=n(()=>X(e(B).id)),Oe=n(()=>e(Ie)===e(c)),Se=n(()=>Jt(Pt(),hr,"max-w-full cursor-pointer overflow-hidden font-normal text-muted-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",!G()&&"h-(--control-height-large) min-h-(--control-height-large) max-h-(--control-height-large)",G()?"hover:bg-hover hover:text-foreground":"hover:bg-accent/60 hover:text-accent-foreground",e(Ie)===e(c)&&(G()?"bg-selected text-foreground":"bg-accent text-accent-foreground"))),Pe=n(()=>G()||void 0);lt(_e,{type:"button",variant:"plain",labelClass:"overflow-hidden whitespace-nowrap text-left text-ellipsis",get id(){return e(fe)},role:"option",tabindex:-1,get"aria-selected"(){return e(Oe)},get class(){return e(Se)},onclick:()=>void ue(e(B).id),onkeydown:Me=>{(Me.key==="Enter"||Me.key===" ")&&(Me.preventDefault(),ue(e(B).id))},onpointermove:()=>{(e(c)!==e(Ie)||e(z))&&He(e(Ie))},"data-testid":"chat-message-navigator-result",get"data-navigation-message-id"(){return e(B).id},get"data-panel-menu-row"(){return e(Pe)},children:(Me,le)=>{var Ue=In(),Xe=at(Ue,!0);xa(Ue,(Je,Ve)=>vr?.(Je,Ve),()=>Je=>e(Re)[e(B).id]=Je),ve(()=>$e(Xe,e(B).text)),r(Me,Ue)},$$slots:{default:!0}})}},$$slots:{default:!0}})}}),Be(P),ve(()=>Qt(P,"id",I)),Gt("scroll",P,tt),r(N,P)},W=N=>{var P=kn(),U=at(P,!0);ve(B=>$e(U,B),[()=>d.chat_messageNavigator_empty_label()]),r(N,P)};Z(se,N=>{e(O).length>0?N(ie):M()||N(W,1)})}Be(h),r(t,h)};let v=ae(i,"messages",7),T=ae(i,"isAtBottom",7),A=ae(i,"onSelectMessage",7),S=ae(i,"onScrollToBottom",7),g=ae(i,"onOpen",7),M=ae(i,"isLoadingIndex",7,!1),G=ae(i,"embedded",7,!1),R=ce(!1),Re=ce(It({})),ne=ce(""),c=ce(0),z=ce(!0),Ce=null,Ee=!1,Fe=ce(null),K=ce(null),de=ce(null),u=ce(It([])),o=ce(!1);const I=`chat-message-navigator-listbox-${w}`,O=n(()=>{const t=e(ne).trim().toLocaleLowerCase();return t?v().filter(h=>h.text.toLocaleLowerCase().includes(t)):v()}),Le=n(()=>e(O)[e(c)]?X(e(O)[e(c)].id):void 0);function X(t){return`${I}-option-${encodeURIComponent(t)}`}function Ne(t){if(b(R,t,!0),!t)return;const h=e(K)?.closest("[data-panel-id]");b(u,h?[h]:[],!0),b(ne,""),b(z,!0),b(c,Math.max(v().length-1,0),!0),g()?.()}function nt(t){b(ne,t.currentTarget.value,!0),b(z,!0),b(c,Math.max(e(O).length-1,0),!0)}function He(t){b(z,!1),b(c,t,!0),Ce=e(O)[t]?.id??null}function tt(){Ee||b(z,!1)}je(()=>{if(!e(R))return;const t=e(O).length;if(t===0)return;if(e(z)){b(c,t-1),Ce=e(O)[t-1].id;return}const h=At(()=>e(c)),F=Ce===null?-1:e(O).findIndex(j=>j.id===Ce);F>=0?F!==h&&b(c,F,!0):h>=t?(b(c,t-1),Ce=e(O)[t-1].id):Ce=e(O)[h]?.id??null}),je(()=>{if(!e(R)||!e(de)||e(O).length===0)return;const t=e(Le)?document.getElementById(e(Le)):null;t&&(Ee=!0,t.scrollIntoView?.({block:"nearest"}),requestAnimationFrame(()=>{Ee=!1}))});function C(t){t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),Ne(!e(R)))}function E(t){t.preventDefault(),e(Fe)?.focus()}async function xe(){await Nt(),e(R)&&e(Fe)?.focus()}function we(t){return e(de)?.contains(t)?!0:t instanceof Element?t.closest("[data-chat-message-navigator-content]")?.dataset.chatMessageNavigatorContent===w:!1}function oe(t){!e(R)||!(t.target instanceof Node)||e(K)?.contains(t.target)||we(t.target)||(b(o,!0),Ne(!1))}function Y(t){e(o)&&(t.preventDefault(),b(o,!1))}async function ue(t){b(R,!1),await Nt(),await A()(t)}function q(t){if(G()&&t.stopPropagation(),t.key==="Escape"){t.preventDefault(),b(R,!1);return}e(O).length!==0&&(t.key==="ArrowDown"?(t.preventDefault(),He((e(c)+1)%e(O).length)):t.key==="ArrowUp"?(t.preventDefault(),He((e(c)-1+e(O).length)%e(O).length)):t.key==="Home"?(t.preventDefault(),He(0)):t.key==="End"?(t.preventDefault(),He(e(O).length-1)):t.key==="Enter"&&(t.preventDefault(),ue(e(O)[e(c)].id)))}var te={get messages(){return v()},set messages(t){v(t),re()},get isAtBottom(){return T()},set isAtBottom(t){T(t),re()},get onSelectMessage(){return A()},set onSelectMessage(t){A(t),re()},get onScrollToBottom(){return S()},set onScrollToBottom(t){S(t),re()},get onOpen(){return g()},set onOpen(t){g(t),re()},get isLoadingIndex(){return M()},set isLoadingIndex(t=!1){M(t),re()},get embedded(){return G()},set embedded(t=!1){G(t),re()},$set:dt,$on:(t,h)=>ut(i,t,h)},a=J(),s=m(a);{var k=t=>{var h=J(),F=m(h);x(F,()=>Ot,(j,ee)=>{ee(j,{onOpenChange:Ne,get open(){return e(R)},set open(ye){b(R,ye,!0)},children:(ye,se)=>{var ie=Wt(),W=m(ie);x(W,()=>Lt,(P,U)=>{U(P,{get icon(){return Tr},onSelect:xe,"data-testid":"chat-message-navigator-trigger",children:(B,Ie)=>{Ye();var D=et();ve(y=>$e(D,y),[()=>d.chat_messageNavigator_menu_label()]),r(B,D)},$$slots:{default:!0}})});var N=$(W,2);x(N,()=>Ht,(P,U)=>{U(P,{class:"w-[28rem] max-w-[calc(100vw-1rem)]",onOpenAutoFocus:E,get"data-chat-message-navigator-content"(){return w},get ref(){return e(de)},set ref(B){b(de,B,!0)},children:(B,Ie)=>{p(B)},$$slots:{default:!0}})}),r(ye,ie)},$$slots:{default:!0}})}),r(t,h)},_=t=>{var h=yn(),F=qe(h);x(F,()=>Ya,(ee,ye)=>{ye(ee,{onOpenChange:Ne,get open(){return e(R)},set open(se){b(R,se,!0)},children:(se,ie)=>{var W=Wt(),N=m(W);{const U=(B,Ie)=>{let D=()=>(Ie?.()).props;{let y=n(()=>d.chat_messageNavigator_open_ariaLabel()),_e=n(()=>d.chat_messageNavigator_open_ariaLabel());lt(B,Mt(D,{variant:"ghost-light",size:"icon-sm",get active(){return e(R)},get"aria-label"(){return e(y)},get tooltip(){return e(_e)},get tooltipDisabled(){return e(R)},tooltipSide:"bottom",tooltipDelayDuration:300,get"aria-expanded"(){return e(R)},onkeydown:C,"data-testid":"chat-message-navigator-trigger",children:(ge,fe)=>{ia(ge,{get size(){return na.compact},weight:"regular",mirrored:!1,"aria-hidden":"true",class:"size-4!","data-chat-message-navigator-chat-icon":!0})},$$slots:{default:!0}}))}};x(N,()=>Xr,(B,Ie)=>{Ie(B,{get ref(){return e(K)},set ref(D){b(K,D,!0)},child:U,$$slots:{child:!0}})})}var P=$(N,2);x(P,()=>br,(U,B)=>{B(U,{children:(Ie,D)=>{var y=J(),_e=m(y);{let ge=n(()=>d.chat_messageNavigator_open_ariaLabel());x(_e,()=>Qa,(fe,Oe)=>{Oe(fe,{role:"dialog",get"aria-label"(){return e(ge)},align:"end",side:"bottom",sideOffset:4,get collisionBoundary(){return e(u)},collisionPadding:8,trapFocus:!1,onOpenAutoFocus:E,onCloseAutoFocus:Y,onFocusOutside:oe,get"data-chat-message-navigator-content"(){return w},get class(){return`${wr} w-[28rem]`},get ref(){return e(de)},set ref(Se){b(de,Se,!0)},children:(Se,Pe)=>{p(Se)},$$slots:{default:!0}})})}r(Ie,y)},$$slots:{default:!0}})}),r(se,W)},$$slots:{default:!0}})});var j=$(F,2);Kr(j,{get disabled(){return T()},get onclick(){return S()}}),Be(h),r(t,h)};Z(s,t=>{G()?t(k):t(_,-1)})}return r(f,a),ft(te)}function Tn(f,i,w){return[...Object.values(f).flatMap(p=>p.tabs.filter(v=>v.type==="browser"&&v.ownerAgentId===w).map(v=>({tab:v,panelId:p.id,active:p.activeTabId===v.id,hidden:!1}))),...i.filter(p=>p.type==="browser"&&p.ownerAgentId===w).map(p=>({tab:p,active:!1,hidden:!0}))]}const qt=(f,i=Dt)=>{var w=Sn(),p=qe(w);ht(p,{get icon(){return oa},class:"size-(--menu-icon-size) opacity-30"});var v=$(p,2);{var T=A=>{var S=Cn();ve(()=>Qt(S,"src",i().tab.faviconUrl)),Gt("error",S,g=>g.currentTarget.style.display="none"),wa(S),r(A,S)};Z(v,A=>{i().tab.faviconUrl&&A(T)})}Be(w),r(f,w)};var Cn=H('<img alt="" class="absolute inset-0 size-full rounded-sm object-contain"/>'),Sn=H('<span class="relative inline-flex size-(--menu-icon-size) shrink-0 items-center justify-center" aria-hidden="true"><!> <!></span>'),Pn=H('<span class="min-w-0 flex-1 truncate"> </span>'),Mn=H('<span class="inline-flex size-(--menu-icon-size) items-center justify-center" aria-hidden="true"><!></span>'),Dn=H('<div class="flex min-w-0 items-center gap-1"><!> <!></div>'),_t=H("<!> <!>",1),Ln=H('<span class="first-line-icon w-(--menu-icon-size)" aria-hidden="true"><!></span> <span class="min-w-0 flex-1 truncate text-muted-foreground"> </span>',1),Hn=H('<li class="flex min-w-0 items-center gap-1"><!> <!></li>'),On=H("<!> ",1),Bn=H('<div class="my-1 border-t border-border"></div> <!>',1),Rn=H('<ul class="m-0 list-none p-0"></ul> <!>',1);function ca(f,i){if(new.target)return ct({component:ca,...f});gt(i,!0);const w=()=>ke(R,"$panels$",v),p=()=>ke(Re,"$hiddenTabs$",v),[v,T]=xt();let A=ae(i,"workspaceId",7),S=ae(i,"agentId",7),g=ae(i,"entries",7),M=ae(i,"embedded",7,!1);const G=St(A());je(()=>G.set(A()));const R=Zt(G),Re=an(G),ne=n(()=>Tn(w(),p(),S())),c=n(()=>g()??e(ne)),z=n(()=>e(c).length===1?d.chat_browserTabs_trigger_tooltip_one({count:wt(e(c).length)}):d.chat_browserTabs_trigger_tooltip_many({count:wt(e(c).length)}));function Ce(a){const s=a.tab.title.trim();if(s)return s;if(a.tab.browserUrl)try{return new URL(a.tab.browserUrl).host||a.tab.browserUrl}catch{return a.tab.browserUrl}return d.browser_embedded_noUrl_label()}function Ee(a){if(b(K,!1),!g()){if(a.hidden){const s=Zt.select(Q.state,A()),k=Object.values(s).find(_=>_.tabs.some(t=>t.type==="agent"&&t.agentId===S()));Q.dispatch(Oa(A(),a.tab.id,k?.id??null))}else if(a.panelId){const s=tn(A());s.setActiveTab(a.tab.id,a.panelId),o=!0,s.focusPanel(a.panelId)}}}const Fe=crypto.randomUUID();je(()=>{const a=A();if(!(!e(K)||g()))return Q.dispatch(Da(a,Fe)),()=>Q.dispatch(La(a,Fe))});let K=ce(!1),de=ce(null),u=ce(null),o=!1;function I(a){!o&&!e(X)||(a.preventDefault(),o=!1)}function O(a,s){const k=e(de)?.querySelectorAll('[data-testid="browser-tabs-menu-item"]');if(!k?.length)return;let _;if(a.key==="ArrowDown")_=(s+1)%k.length;else if(a.key==="ArrowUp")_=(s-1+k.length)%k.length;else if(a.key==="Home")_=0;else if(a.key==="End")_=k.length-1;else if(a.key==="ArrowRight"){a.preventDefault(),a.currentTarget.closest("li")?.querySelector('[data-testid="browser-tab-close"]')?.focus();return}else return;a.preventDefault(),k[_].focus()}const Le=n(()=>e(c).filter(a=>a.hidden).length);let X=ce(null);function Ne(a,s){return a.hostClientId===void 0||a.hostClientId===s}function nt(a){const s=nn.select(Q.state,a.hostClientId??"",A());Q.dispatch(Ba(a.id,!s.connected))}function He(a){const s=rn.select(Q.state);if(a.kind==="tab"){const{tab:_,panelId:t}=a.entry;Ne(_,s)?Q.dispatch(ta(A(),_.id,t,void 0,{destroy:!0})):nt(_);return}const k=e(c).filter(_=>_.hidden&&!Ne(_.tab,s)).map(_=>_.tab);k.length<e(Le)&&Q.dispatch(Ha(A(),S(),s));for(const _ of k)nt(_)}async function tt(a){if(!g()){if(b(K,!1),ar.select(Q.state,S())){if(M()){const s=a.kind==="hidden";await en({title:s?d.chat_browserTabs_closeHiddenDialog_title():d.chat_browserTabs_closeDialog_title(),description:s?d.chat_browserTabs_closeHiddenDialog_description():d.chat_browserTabs_closeDialog_description(),confirmLabel:s?d.chat_browserTabs_closeHiddenDialog_confirm_label():d.chat_browserTabs_closeDialog_confirm_label(),cancelLabel:d.chat_browserTabs_closeDialog_cancel_label(),destructive:!0})&&He(a)}else b(X,a,!0);return}He(a)}}function C(){const a=e(X);b(X,null),a&&He(a)}function E(){b(X,null)}var xe={get workspaceId(){return A()},set workspaceId(a){A(a),re()},get agentId(){return S()},set agentId(a){S(a),re()},get entries(){return g()},set entries(a){g(a),re()},get embedded(){return M()},set embedded(a=!1){M(a),re()},$set:dt,$on:(a,s)=>ut(i,a,s)},we=_t(),oe=m(we);{var Y=a=>{var s=J(),k=m(s);x(k,()=>Ot,(_,t)=>{t(_,{get open(){return e(K)},set open(h){b(K,h,!0)},children:(h,F)=>{var j=_t(),ee=m(j);x(ee,()=>Lt,(se,ie)=>{ie(se,{get icon(){return oa},"data-testid":"browser-tabs-trigger",children:(W,N)=>{Ye();var P=et();ve(()=>$e(P,e(z))),r(W,P)},$$slots:{default:!0}})});var ye=$(ee,2);x(ye,()=>Ht,(se,ie)=>{ie(se,{class:"w-64",alignIconColumn:!1,onCloseAutoFocus:I,children:(W,N)=>{var P=_t(),U=m(P);kt(U,17,()=>e(c),D=>D.tab.id,(D,y)=>{const _e=n(()=>Ce(e(y)));var ge=Dn(),fe=qe(ge);{const Se=le=>{qt(le,()=>e(y))};let Pe=n(()=>e(y).hidden?"opacity-60":""),Me=n(()=>e(y).hidden||void 0);x(fe,()=>Ut,(le,Ue)=>{Ue(le,{get class(){return`min-w-0 flex-1 ${e(Pe)??""}`},get textValue(){return e(_e)},onclick:()=>Ee(e(y)),"data-testid":"browser-tabs-menu-item",get"data-browser-tab-id"(){return e(y).tab.id},get"data-hidden"(){return e(Me)},leading:Se,children:(Xe,Je)=>{var Ve=Pn(),ot=at(Ve,!0);ve(()=>$e(ot,e(_e))),r(Xe,Ve)},$$slots:{leading:!0,default:!0}})})}var Oe=$(fe,2);{let Se=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(_e)})),Pe=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(_e)})),Me=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(_e)}));x(Oe,()=>Ut,(le,Ue)=>{Ue(le,{class:"size-7 shrink-0 items-center justify-center p-0",get textValue(){return e(Se)},get"aria-label"(){return e(Pe)},get title(){return e(Me)},onSelect:Xe=>Xe.preventDefault(),onclick:()=>tt({kind:"tab",entry:e(y)}),"data-testid":"browser-tab-close",get"data-browser-tab-id"(){return e(y).tab.id},children:(Xe,Je)=>{var Ve=Mn(),ot=qe(Ve);ht(ot,{get icon(){return $t},class:"size-(--menu-icon-size)! shrink-0"}),Be(Ve),r(Xe,Ve)},$$slots:{default:!0}})})}Be(ge),r(D,ge)});var B=$(U,2);{var Ie=D=>{var y=_t(),_e=m(y);x(_e,()=>Bt,(fe,Oe)=>{Oe(fe,{})});var ge=$(_e,2);{let fe=n(()=>d.chat_browserTabs_closeHidden_label({count:wt(e(Le))}));x(ge,()=>st,(Oe,Se)=>{Se(Oe,{get icon(){return $t},get label(){return e(fe)},onSelect:Pe=>Pe.preventDefault(),onclick:()=>tt({kind:"hidden"}),"data-testid":"browser-tabs-close-hidden"})})}r(D,y)};Z(B,D=>{e(Le)>0&&D(Ie)})}r(W,P)},$$slots:{default:!0}})}),r(h,j)},$$slots:{default:!0}})}),r(a,s)},ue=a=>{var s=J(),k=m(s);x(k,()=>tr,(_,t)=>{t(_,{get open(){return e(K)},set open(h){b(K,h,!0)},children:(h,F)=>{var j=_t(),ee=m(j);{const se=(ie,W)=>{lt(ie,Mt(()=>(W?.()).props,{variant:"ghost-light",size:"icon-sm",get active(){return e(K)},get"aria-label"(){return e(z)},get tooltip(){return e(z)},get tooltipDisabled(){return e(K)},tooltipSide:"bottom",tooltipDelayDuration:300,"data-testid":"browser-tabs-trigger",get ref(){return e(u)},set ref(P){b(u,P,!0)},children:(P,U)=>{Cr(P,{get size(){return na.compact},weight:"regular","aria-hidden":"true",class:"size-4!"})},$$slots:{default:!0}}))};x(ee,()=>Jr,(ie,W)=>{W(ie,{child:se,$$slots:{child:!0}})})}var ye=$(ee,2);x(ye,()=>er,(se,ie)=>{ie(se,{trapFocus:!1,align:"end",side:"bottom",sideOffset:4,class:"min-w-52 max-w-80 max-h-[min(var(--bits-popover-content-available-height,calc(100dvh-1rem)),calc(100dvh-1rem))] overflow-y-auto p-1",role:"dialog",get"aria-label"(){return e(z)},onOpenAutoFocus:W=>{W.preventDefault(),e(de)?.querySelector('[data-testid="browser-tabs-menu-item"]')?.focus()},onCloseAutoFocus:I,children:(W,N)=>{var P=Rn(),U=m(P);kt(U,23,()=>e(c),D=>D.tab.id,(D,y,_e)=>{const ge=n(()=>Ce(e(y)));var fe=Hn(),Oe=qe(fe);{let Pe=n(Pt),Me=n(()=>e(y).hidden?"opacity-60":""),le=n(()=>e(y).hidden||void 0);lt(Oe,{variant:"plain",wrapContent:!1,get class(){return`${e(Pe)??""} h-auto min-w-0 flex-1 ${e(Me)??""}`},"data-testid":"browser-tabs-menu-item",get"data-browser-tab-id"(){return e(y).tab.id},get"data-hidden"(){return e(le)},onkeydown:Ue=>O(Ue,e(_e)),onclick:()=>Ee(e(y)),children:(Ue,Xe)=>{var Je=Ln(),Ve=m(Je),ot=qe(Ve);qt(ot,()=>e(y)),Be(Ve);var yt=$(Ve,2),bt=at(yt,!0);ve(()=>$e(bt,e(ge))),r(Ue,Je)},$$slots:{default:!0}})}var Se=$(Oe,2);{let Pe=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(ge)})),Me=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(ge)}));lt(Se,{variant:"plain",size:"icon-compact",type:"button",class:"size-6 shrink-0 focus-visible:ring-1","data-testid":"browser-tab-close",get"data-browser-tab-id"(){return e(y).tab.id},get"aria-label"(){return e(Pe)},get title(){return e(Me)},onkeydown:le=>{le.key!=="Escape"&&le.stopPropagation(),le.key==="ArrowLeft"&&(le.preventDefault(),le.currentTarget.closest("li")?.querySelector('[data-testid="browser-tabs-menu-item"]')?.focus())},onclick:le=>{le.preventDefault(),le.stopPropagation(),tt({kind:"tab",entry:e(y)})},children:(le,Ue)=>{ht(le,{get icon(){return $t},class:"size-3"})},$$slots:{default:!0}})}Be(fe),r(D,fe)}),Be(U),Yt(U,D=>b(de,D),()=>e(de));var B=$(U,2);{var Ie=D=>{var y=Bn(),_e=$(m(y),2);{let ge=n(Pt);lt(_e,{variant:"plain",get class(){return e(ge)},"data-testid":"browser-tabs-close-hidden",onclick:()=>tt({kind:"hidden"}),children:(fe,Oe)=>{var Se=On(),Pe=m(Se);ht(Pe,{get icon(){return $t},class:"size-3"});var Me=$(Pe);ve(le=>$e(Me,` ${le??""}`),[()=>d.chat_browserTabs_closeHidden_label({count:wt(e(Le))})]),r(fe,Se)},$$slots:{default:!0}})}r(D,y)};Z(B,D=>{e(Le)>0&&D(Ie)})}r(W,P)},$$slots:{default:!0}})}),r(h,j)},$$slots:{default:!0}})}),r(a,s)};Z(oe,a=>{e(c).length>0&&M()?a(Y):e(c).length>0&&a(ue,1)})}var q=$(oe,2);{let a=n(()=>e(X)!==null),s=n(()=>e(X)?.kind==="hidden"?d.chat_browserTabs_closeHiddenDialog_title():d.chat_browserTabs_closeDialog_title()),k=n(()=>e(X)?.kind==="hidden"?d.chat_browserTabs_closeHiddenDialog_description():d.chat_browserTabs_closeDialog_description()),_=n(()=>d.chat_browserTabs_closeDialog_close_ariaLabel()),t=n(()=>d.chat_browserTabs_closeDialog_cancel_label()),h=n(()=>e(X)?.kind==="hidden"?d.chat_browserTabs_closeHiddenDialog_confirm_label():d.chat_browserTabs_closeDialog_confirm_label());Yr(q,{get open(){return e(a)},size:"sm",get title(){return e(s)},get description(){return e(k)},get closeLabel(){return e(_)},get cancelLabel(){return e(t)},get submitLabel(){return e(h)},submitVariant:"destructive",focusSubmit:!0,onSubmit:C,onCancel:E,onCloseAutoFocus:F=>{F.preventDefault(),e(u)?.focus()}})}r(f,we);var te=ft(xe);return T(),te}var Fn=H("<!> <!>",1);function da(f,i){if(new.target)return ct({component:da,...f});gt(i,!0);const w=()=>ke(g,"$entry",p),[p,v]=xt();let T=ae(i,"workspaceId",7),A=ae(i,"agentId",7),S=ae(i,"separator",7,!0);const g=ea(At(()=>T()),At(()=>A()));je(()=>{Q.dispatch(aa(T(),A()))});var M={get workspaceId(){return T()},set workspaceId(c){T(c),re()},get agentId(){return A()},set agentId(c){A(c),re()},get separator(){return S()},set separator(c=!0){S(c),re()},$set:dt,$on:(c,z)=>ut(i,c,z)},G=J(),R=m(G);{var Re=c=>{var z=Fn(),Ce=m(z);{var Ee=K=>{var de=J(),u=m(de);x(u,()=>Bt,(o,I)=>{I(o,{})}),r(K,de)};Z(Ce,K=>{S()&&K(Ee)})}var Fe=$(Ce,2);x(Fe,()=>mt,(K,de)=>{de(K,{indicator:"switch",get icon(){return Sr},get checked(){return w().permission.allowed},onSelect:u=>{u.preventDefault();const o=w()?.permission;o&&!w()?.saving&&Q.dispatch(Ra(T(),A(),o.computerId,!o.allowed))},children:(u,o)=>{Ye();var I=et();ve(O=>$e(I,O),[()=>d.settings_agentFeatures_desktopControl_label()]),r(u,I)},$$slots:{default:!0}})}),r(c,z)};Z(R,c=>{w()?.permission&&c(Re)})}r(f,G);var ne=ft(M);return v(),ne}var Ct=H("<!> <!>",1),Nn=H("<!> <!> <!>",1),zn=H('<span class="min-w-0 flex-1"> </span> <span> </span>',1),En=H("<!> <!> <!> <!>",1),Un=H("<!> <!> <!> <!> <!>",1);function ua(f,i){if(new.target)return ct({component:ua,...f});gt(i,!0);const w=()=>ke(de,"$agentSession",S),p=()=>ke(Ce,"$fontStyle",S),v=()=>ke(Ee,"$chatContentWidth",S),T=()=>ke(Fe,"$chatAuroraEnabled",S),A=()=>ke(K,"$collapseToolRuns",S),[S,g]=xt(),M=C=>{var E=J(),xe=m(E);x(xe,()=>Gr,(we,oe)=>{oe(we,{get value(){return p()},onValueChange:O,children:(Y,ue)=>{var q=Ct(),te=m(q);x(te,()=>Vt,(s,k)=>{k(s,{value:"sans",closeOnSelect:!1,children:(_,t)=>{Ye();var h=et();ve(F=>$e(h,F),[()=>d.settings_fontStyle_sans()]),r(_,h)},$$slots:{default:!0}})});var a=$(te,2);x(a,()=>Vt,(s,k)=>{k(s,{value:"monospace",closeOnSelect:!1,children:(_,t)=>{Ye();var h=et();ve(F=>$e(h,F),[()=>d.settings_fontStyle_mono()]),r(_,h)},$$slots:{default:!0}})}),r(Y,q)},$$slots:{default:!0}})}),r(C,E)},G=C=>{var E=Nn(),xe=m(E);{let Y=n(()=>v()==="full");x(xe,()=>mt,(ue,q)=>{q(ue,{indicator:"switch",get icon(){return Dr},get checked(){return e(Y)},closeOnSelect:!1,onCheckedChange:te=>Q.dispatch(Fa(te?"full":"800")),children:(te,a)=>{Ye();var s=et();ve(k=>$e(s,k),[()=>d.settings_appearance_chatContentWidth_label()]),r(te,s)},$$slots:{default:!0}})})}var we=$(xe,2);x(we,()=>mt,(Y,ue)=>{ue(Y,{indicator:"switch",get icon(){return Lr},get checked(){return T()},closeOnSelect:!1,onCheckedChange:q=>Q.dispatch(Na(q)),children:(q,te)=>{Ye();var a=et();ve(s=>$e(a,s),[()=>d.settings_appearance_chatAurora_label()]),r(q,a)},$$slots:{default:!0}})});var oe=$(we,2);x(oe,()=>mt,(Y,ue)=>{ue(Y,{indicator:"switch",get icon(){return Hr},get checked(){return A()},closeOnSelect:!1,onCheckedChange:q=>Q.dispatch(za(q)),children:(q,te)=>{Ye();var a=et();ve(s=>$e(a,s),[()=>d.settings_appearance_collapseToolRuns_label()]),r(q,a)},$$slots:{default:!0}})}),r(C,E)},R=C=>{var E=J(),xe=m(E);{var we=oe=>{var Y=J(),ue=m(Y);x(ue,()=>mt,(q,te)=>{te(q,{indicator:"switch",get icon(){return Or},get checked(){return e(u)},closeOnSelect:!1,onCheckedChange:a=>Q.dispatch(Ua(c(),z(),a?"interactive":"allow")),children:(a,s)=>{Ye();var k=et();ve(_=>$e(k,_),[()=>d.ui_viewSettings_askBeforeTools_label()]),r(a,k)},$$slots:{default:!0}})}),r(oe,Y)};Z(xe,oe=>{e(u)!==void 0&&c()&&z()&&oe(we)})}r(C,E)},Re=C=>{var E=J(),xe=m(E);{var we=oe=>{var Y=J(),ue=m(Y);Kt(ue,()=>`${c()}:${z()}`,q=>{{let te=n(()=>!ne());da(q,{get workspaceId(){return c()},get agentId(){return z()},get separator(){return e(te)}})}}),r(oe,Y)};Z(xe,oe=>{c()&&z()&&oe(we)})}r(C,E)};let ne=ae(i,"embedded",7,!1),c=ae(i,"workspaceId",7),z=ae(i,"agentId",7);const Ce=sn(),Ee=ln(),Fe=cn(),K=dn(),de=rr(Qr(()=>z())),u=n(()=>{const C=w();if(!c()||!C||C.permissionPolicy===void 0)return;const E=C.effectivePermissionPolicy;return typeof E=="string"?E==="interactive":void 0});let o=ce(!1);const I=n(()=>p()==="sans"?d.settings_fontStyle_sans():d.settings_fontStyle_mono());function O(C){C!=="sans"&&C!=="monospace"||Q.dispatch(Ea(C))}var Le={get embedded(){return ne()},set embedded(C=!1){ne(C),re()},get workspaceId(){return c()},set workspaceId(C){c(C),re()},get agentId(){return z()},set agentId(C){z(C),re()},$set:dt,$on:(C,E)=>ut(i,C,E)},X=J(),Ne=m(X);{var nt=C=>{var E=En(),xe=m(E);x(xe,()=>Ot,(ue,q)=>{q(ue,{children:(te,a)=>{var s=Ct(),k=m(s);x(k,()=>Lt,(t,h)=>{h(t,{get icon(){return Pr},iconWeight:"regular",children:(F,j)=>{var ee=zn(),ye=m(ee),se=at(ye,!0),ie=$(ye,2),W=at(ie,!0);ve(N=>{$e(se,N),ya(ie,1,`type-caption ${Vr}`),$e(W,e(I))},[()=>d.ui_viewSettings_font_label()]),r(F,ee)},$$slots:{default:!0}})});var _=$(k,2);{let t=n(()=>d.ui_viewSettings_font_label());x(_,()=>Ht,(h,F)=>{F(h,{get"aria-label"(){return e(t)},children:(j,ee)=>{M(j)},$$slots:{default:!0}})})}r(te,s)},$$slots:{default:!0}})});var we=$(xe,2);G(we);var oe=$(we,2);R(oe);var Y=$(oe,2);Re(Y),r(C,E)},He=C=>{var E=J(),xe=m(E);x(xe,()=>jr,(we,oe)=>{oe(we,{get open(){return e(o)},set open(Y){b(o,Y,!0)},children:(Y,ue)=>{var q=Ct(),te=m(q);{const s=(k,_)=>{let t=()=>(_?.()).props;{let h=n(()=>d.ui_viewSettings_trigger_tooltip()),F=n(()=>d.ui_viewSettings_trigger_tooltip());lt(k,Mt(t,{variant:"ghost-light",size:"icon-xs",get tooltip(){return e(h)},tooltipSide:"bottom",get"aria-label"(){return e(F)},get"aria-expanded"(){return e(o)},"data-testid":"agent-view-settings-trigger",children:(j,ee)=>{ht(j,{get icon(){return Mr},size:"xs"})},$$slots:{default:!0}}))}};x(te,()=>Wr,(k,_)=>{_(k,{child:s,$$slots:{child:!0}})})}var a=$(te,2);{let s=n(()=>d.ui_viewSettings_trigger_tooltip());x(a,()=>qr,(k,_)=>{_(k,{align:"end",class:"w-56",get"aria-label"(){return e(s)},children:(t,h)=>{var F=Un(),j=m(F);M(j);var ee=$(j,2);x(ee,()=>Bt,(W,N)=>{N(W,{})});var ye=$(ee,2);G(ye);var se=$(ye,2);R(se);var ie=$(se,2);Re(ie),r(t,F)},$$slots:{default:!0}})})}r(Y,q)},$$slots:{default:!0}})}),r(C,E)};Z(Ne,C=>{ne()?C(nt):C(He,-1)})}r(f,X);var tt=ft(Le);return g(),tt}function vt(f,i=2){if(f==null)return"";if(typeof f=="string")return f;try{return JSON.stringify(f,null,i)}catch{return String(f)}}function Vn(f){const i=f.name||f.toolName||"unknown",w=f.arguments||f.input||f.parameters||{},p=vt(w),v=f.result,T=f.error;let A=`🔧 Tool: ${i}
1
+ import{t as ct,br as ae,bz as dt,bs as jt,b as ut,a_ as Z,bp as d,bu as Mt,bt as xt,bv as ke}from"./O1QHAURn.js";import{bs as gt,a5 as qe,bf as Dt,bA as Be,W as r,bn as ft,aA as re,aB as H,aD as e,bS as $,c9 as n,a7 as J,ay as m,be as Ye,b$ as et,aC as pt,bo as $a,bV as ce,br as It,ca as je,bH as b,c5 as At,b_ as ve,bO as $e,c0 as Nt,bl as at,aw as Gt,cd as St,bz as wa,bj as Ia}from"./DYhIMPy1.js";import{G as Kt}from"./CovkQMd0.js";import{i as Xt,l as Jt,o as Aa,I as ka,n as kt,g as xa,u as Qt,v as ya}from"./CAyg2ijY.js";import{c as x}from"./C2mPABxH.js";import{b as Yt}from"./BaIAhI85.js";import{an as Ta,ao as Ca,bK as Sa}from"./B8g9F0km.js";import Pa from"./DsyMO7lt.js";import{D as Ma}from"./Bvr7FizN.js";import{C as zt}from"./Vz71nOZi.js";import"./CerLhVOI.js";import{a6 as ea}from"./BAZoUnVN.js";import{Ix as Q,dF as Da,dG as La,gL as ta,iX as Ha,Br as Oa,gr as Ba,iU as aa,iT as Ra,Dp as Fa,Do as Na,Dv as za,D0 as Ea,D3 as Ua,cd as Va,cb as Za,ch as Wa,bW as qa,D2 as ja,ce as Ga,CL as Ka}from"./DNqM68dO.js";import{g as Xa}from"./DfN8_dcw.js";import{a as Ja}from"./Cobq24L_.js";import{l as Qa,P as Ya,m as er,n as tr,V as Et}from"./ufCEqIju.js";import{am as ar,aC as rr,dr as nr,bS as or,c4 as sr,aA as ir,bh as lr,i as cr}from"./VZEkDWIM.js";import{aY as dr,aZ as ur}from"./B6-zId45.js";import{a as gr}from"./4zDfklj9.js";import{c as fr}from"./ChTqQfQN.js";import{c as pr}from"./B68RgPt4.js";import{C as mr}from"./CZsqRMpl.js";import{o as vr}from"./CWDPeeaf.js";import{I as _r,c as hr}from"./BV0i7JjW.js";import"./BH3LKWph.js";import{s as ra}from"./BBDxUL80.js";import{a5 as br,f as lt,am as $r}from"./CR_t_AVn.js";import{D as wr,C as na,T as Ir,F as Ar,H as kr,t as xr,R as yr}from"./XbvlLx0H.js";import{aR as Tr,cX as oa,F as ht,c_ as $t,B as Cr,aZ as Sr,bn as Pr,cv as Mr,a6 as Dr,cw as Lr,a5 as Hr,cs as Or,aq as Br,aV as Rr,cU as Fr,ac as Nr,cg as zr,aj as Er,cN as Ur}from"./B0f-om7y.js";import{a as Pt,m as Vr}from"./BgCTNfXj.js";import{w as Zr,o as Lt,n as Ht,m as Ot,i as Ut,l as Bt,g as mt,p as Wr,h as qr,M as jr,k as Vt,R as Gr}from"./DV9nY0bt.js";import{B as Kr}from"./D-Nl8cp7.js";import{K as Xr,a3 as Jr,b7 as Qr}from"./81iikGfb.js";import"./CQkmEJ54.js";import{b as Yr}from"./Drd3_KgI.js";import{c as en}from"./C1dHaq0T.js";import"./CqO6BKca.js";import{M as st}from"./C64Iv2ib.js";import{g as tn}from"./CH5tRPYb.js";import{J as Zt,q as an}from"./BVs4aETe.js";import{aw as rn,_ as nn}from"./l-XeMHVA.js";import{t as wt,p as on}from"./BkT9o_nd.js";import{a as sn,e as ln,d as cn,i as dn}from"./xEfOpOba.js";var un=new Set(["$$slots","$$events","$$legacy","children","class"]),gn=H("<div><!></div>");function sa(f,i){if(new.target)return ct({component:sa,...f});gt(i,!0);let w=ae(i,"children",7),p=ae(i,"class",7),v=jt(i,un);Zr(()=>!1);var T={get children(){return w()},set children(g){w(g),re()},get class(){return p()},set class(g){p(g),re()},$set:dt,$on:(g,M)=>ut(i,g,M)},A=gn();Xt(A,g=>({"data-slot":"menu-footer",class:g,...v}),[()=>Jt("menu-footer type-caption relative z-10 -mx-1.5 -mb-1.5 mt-1.5 border-t border-border bg-muted/20 px-3.5 py-1.5 leading-(--text-caption-line-height) font-normal text-muted-foreground [&_[data-menu-item]]:hover:bg-hover [&_[data-menu-item]]:focus-visible:bg-hover",p())],void 0,void 0,"svelte-1od5b5i");var S=qe(A);return ra(S,()=>w()??Dt),Be(A),r(f,A),ft(T)}var fn=new Set(["$$slots","$$events","$$legacy","children"]),pn=pt('<path d="M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"></path>'),mn=pt('<path d="M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z" opacity="0.2"></path><path d="M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"></path>',1),vn=pt('<path d="M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"></path>'),_n=pt('<path d="M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"></path>'),hn=pt('<path d="M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"></path>'),bn=pt('<path d="M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"></path>'),$n=pt('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function ia(f,i){if(new.target)return ct({component:ia,...f});gt(i,!0);const w=Aa();let p=ae(i,"children",7),v=jt(i,fn),T=n(()=>i.weight??w.weight??"regular"),A=n(()=>i.color??w.color??"currentColor"),S=n(()=>i.size??w.size??"1em"),g=n(()=>i.mirrored??w.mirrored??!1);function M(o){let{weight:I,color:O,size:Le,mirrored:X,...Ne}=o;return Ne}var G={get children(){return p()},set children(o){p(o),re()},$set:dt,$on:(o,I)=>ut(i,o,I)},R=$n();Xt(R,(o,I)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:e(S),height:e(S),fill:e(A),transform:e(g)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...o,...I}),[()=>M(w),()=>M(v)]);var Re=qe(R);{var ne=o=>{var I=J(),O=m(I);ra(O,p),r(o,I)};Z(Re,o=>{p()&&o(ne)})}var c=$(Re,2);{var z=o=>{var I=pn();r(o,I)},Ce=o=>{var I=mn();Ye(),r(o,I)},Ee=o=>{var I=vn();r(o,I)},Fe=o=>{var I=_n();r(o,I)},K=o=>{var I=hn();r(o,I)},de=o=>{var I=bn();r(o,I)},u=o=>{var I=et();I.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),r(o,I)};Z(c,o=>{e(T)==="bold"?o(z):e(T)==="duotone"?o(Ce,1):e(T)==="fill"?o(Ee,2):e(T)==="light"?o(Fe,3):e(T)==="regular"?o(K,4):e(T)==="thin"?o(de,5):o(u,-1)})}return Be(R),r(f,R),ft(G)}var wn=H('<div class="type-caption flex items-center gap-[var(--space-2)] px-[var(--space-2)] py-[var(--space-1)] text-muted-foreground" data-testid="chat-message-navigator-loading"><!> <span> </span></div>'),In=H('<span class="block min-w-0 max-w-full flex-1 overflow-hidden whitespace-nowrap text-left text-ellipsis font-normal"> </span>'),An=H('<div role="listbox" class="mt-[var(--space-1)] min-h-0 min-w-0 flex-1 max-h-72 overflow-x-hidden overflow-y-auto overscroll-contain"></div>'),kn=H('<div class="type-caption px-2 py-6 text-left text-muted-foreground" data-testid="chat-message-navigator-empty"> </div>'),xn=H('<div class="flex min-h-0 min-w-0 max-h-full flex-1 flex-col overflow-hidden" data-testid="chat-message-navigator-panel"><!> <div role="status" aria-live="polite" class="shrink-0" data-testid="chat-message-navigator-loading-region"><!></div> <!></div>'),Wt=H("<!> <!>",1),yn=H('<div class="flex shrink-0 items-center gap-0.5" data-testid="chat-header-navigation-controls"><!> <!></div>');function la(f,i){const w=$a();if(new.target)return ct({component:la,...f});gt(i,!0);const p=t=>{var h=xn(),F=qe(h);{let N=n(()=>d.chat_messageNavigator_search_ariaLabel()),P=n(()=>e(O).length>0?I:void 0),U=n(()=>d.chat_messageNavigator_search_placeholder());_r(F,{get value(){return e(ne)},oninput:nt,onkeydown:q,role:"combobox",get"aria-label"(){return e(N)},get"aria-controls"(){return e(P)},"aria-expanded":"true","aria-autocomplete":"list",get"aria-activedescendant"(){return e(Le)},autocomplete:"off",get placeholder(){return e(U)},class:"type-caption h-(--control-height-medium) w-full min-w-0 shrink-0 rounded-(--radius-small) border border-border bg-card px-[var(--space-2)] text-foreground caret-foreground outline-none placeholder:text-muted-foreground","data-testid":"chat-message-navigator-search",get ref(){return e(Fe)},set ref(B){b(Fe,B,!0)}})}var j=$(F,2),ee=qe(j);{var ye=N=>{var P=wn(),U=qe(P);ka(U,{size:16});var B=$(U,2),Ie=at(B,!0);Be(P),ve(D=>$e(Ie,D),[()=>d.chat_messageNavigator_loading_label()]),r(N,P)};Z(ee,N=>{M()&&N(ye)})}Be(j);var se=$(j,2);{var ie=N=>{var P=An();kt(P,23,()=>e(O),U=>U.id,(U,B,Ie)=>{{let D=n(()=>!e(Re)[e(B).id]),y=n(()=>G()?"":"h-(--control-height-large)");$r(U,{get content(){return e(B).text},get disabled(){return e(D)},side:"left",align:"center",delayDuration:300,size:"sm",get class(){return`block w-full min-w-0 max-w-full ${e(y)??""}`},contentClass:"max-w-[min(28rem,calc(100vw-var(--space-4)))] break-words text-left",children:(_e,ge)=>{{let fe=n(()=>X(e(B).id)),Oe=n(()=>e(Ie)===e(c)),Se=n(()=>Jt(Pt(),hr,"max-w-full cursor-pointer overflow-hidden font-normal text-muted-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",!G()&&"h-(--control-height-large) min-h-(--control-height-large) max-h-(--control-height-large)",G()?"hover:bg-hover hover:text-foreground":"hover:bg-accent/60 hover:text-accent-foreground",e(Ie)===e(c)&&(G()?"bg-selected text-foreground":"bg-accent text-accent-foreground"))),Pe=n(()=>G()||void 0);lt(_e,{type:"button",variant:"plain",labelClass:"overflow-hidden whitespace-nowrap text-left text-ellipsis",get id(){return e(fe)},role:"option",tabindex:-1,get"aria-selected"(){return e(Oe)},get class(){return e(Se)},onclick:()=>void ue(e(B).id),onkeydown:Me=>{(Me.key==="Enter"||Me.key===" ")&&(Me.preventDefault(),ue(e(B).id))},onpointermove:()=>{(e(c)!==e(Ie)||e(z))&&He(e(Ie))},"data-testid":"chat-message-navigator-result",get"data-navigation-message-id"(){return e(B).id},get"data-panel-menu-row"(){return e(Pe)},children:(Me,le)=>{var Ue=In(),Xe=at(Ue,!0);xa(Ue,(Je,Ve)=>vr?.(Je,Ve),()=>Je=>e(Re)[e(B).id]=Je),ve(()=>$e(Xe,e(B).text)),r(Me,Ue)},$$slots:{default:!0}})}},$$slots:{default:!0}})}}),Be(P),ve(()=>Qt(P,"id",I)),Gt("scroll",P,tt),r(N,P)},W=N=>{var P=kn(),U=at(P,!0);ve(B=>$e(U,B),[()=>d.chat_messageNavigator_empty_label()]),r(N,P)};Z(se,N=>{e(O).length>0?N(ie):M()||N(W,1)})}Be(h),r(t,h)};let v=ae(i,"messages",7),T=ae(i,"isAtBottom",7),A=ae(i,"onSelectMessage",7),S=ae(i,"onScrollToBottom",7),g=ae(i,"onOpen",7),M=ae(i,"isLoadingIndex",7,!1),G=ae(i,"embedded",7,!1),R=ce(!1),Re=ce(It({})),ne=ce(""),c=ce(0),z=ce(!0),Ce=null,Ee=!1,Fe=ce(null),K=ce(null),de=ce(null),u=ce(It([])),o=ce(!1);const I=`chat-message-navigator-listbox-${w}`,O=n(()=>{const t=e(ne).trim().toLocaleLowerCase();return t?v().filter(h=>h.text.toLocaleLowerCase().includes(t)):v()}),Le=n(()=>e(O)[e(c)]?X(e(O)[e(c)].id):void 0);function X(t){return`${I}-option-${encodeURIComponent(t)}`}function Ne(t){if(b(R,t,!0),!t)return;const h=e(K)?.closest("[data-panel-id]");b(u,h?[h]:[],!0),b(ne,""),b(z,!0),b(c,Math.max(v().length-1,0),!0),g()?.()}function nt(t){b(ne,t.currentTarget.value,!0),b(z,!0),b(c,Math.max(e(O).length-1,0),!0)}function He(t){b(z,!1),b(c,t,!0),Ce=e(O)[t]?.id??null}function tt(){Ee||b(z,!1)}je(()=>{if(!e(R))return;const t=e(O).length;if(t===0)return;if(e(z)){b(c,t-1),Ce=e(O)[t-1].id;return}const h=At(()=>e(c)),F=Ce===null?-1:e(O).findIndex(j=>j.id===Ce);F>=0?F!==h&&b(c,F,!0):h>=t?(b(c,t-1),Ce=e(O)[t-1].id):Ce=e(O)[h]?.id??null}),je(()=>{if(!e(R)||!e(de)||e(O).length===0)return;const t=e(Le)?document.getElementById(e(Le)):null;t&&(Ee=!0,t.scrollIntoView?.({block:"nearest"}),requestAnimationFrame(()=>{Ee=!1}))});function C(t){t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),Ne(!e(R)))}function E(t){t.preventDefault(),e(Fe)?.focus()}async function xe(){await Nt(),e(R)&&e(Fe)?.focus()}function we(t){return e(de)?.contains(t)?!0:t instanceof Element?t.closest("[data-chat-message-navigator-content]")?.dataset.chatMessageNavigatorContent===w:!1}function oe(t){!e(R)||!(t.target instanceof Node)||e(K)?.contains(t.target)||we(t.target)||(b(o,!0),Ne(!1))}function Y(t){e(o)&&(t.preventDefault(),b(o,!1))}async function ue(t){b(R,!1),await Nt(),await A()(t)}function q(t){if(G()&&t.stopPropagation(),t.key==="Escape"){t.preventDefault(),b(R,!1);return}e(O).length!==0&&(t.key==="ArrowDown"?(t.preventDefault(),He((e(c)+1)%e(O).length)):t.key==="ArrowUp"?(t.preventDefault(),He((e(c)-1+e(O).length)%e(O).length)):t.key==="Home"?(t.preventDefault(),He(0)):t.key==="End"?(t.preventDefault(),He(e(O).length-1)):t.key==="Enter"&&(t.preventDefault(),ue(e(O)[e(c)].id)))}var te={get messages(){return v()},set messages(t){v(t),re()},get isAtBottom(){return T()},set isAtBottom(t){T(t),re()},get onSelectMessage(){return A()},set onSelectMessage(t){A(t),re()},get onScrollToBottom(){return S()},set onScrollToBottom(t){S(t),re()},get onOpen(){return g()},set onOpen(t){g(t),re()},get isLoadingIndex(){return M()},set isLoadingIndex(t=!1){M(t),re()},get embedded(){return G()},set embedded(t=!1){G(t),re()},$set:dt,$on:(t,h)=>ut(i,t,h)},a=J(),s=m(a);{var k=t=>{var h=J(),F=m(h);x(F,()=>Ot,(j,ee)=>{ee(j,{onOpenChange:Ne,get open(){return e(R)},set open(ye){b(R,ye,!0)},children:(ye,se)=>{var ie=Wt(),W=m(ie);x(W,()=>Lt,(P,U)=>{U(P,{get icon(){return Tr},onSelect:xe,"data-testid":"chat-message-navigator-trigger",children:(B,Ie)=>{Ye();var D=et();ve(y=>$e(D,y),[()=>d.chat_messageNavigator_menu_label()]),r(B,D)},$$slots:{default:!0}})});var N=$(W,2);x(N,()=>Ht,(P,U)=>{U(P,{class:"w-[28rem] max-w-[calc(100vw-1rem)]",onOpenAutoFocus:E,get"data-chat-message-navigator-content"(){return w},get ref(){return e(de)},set ref(B){b(de,B,!0)},children:(B,Ie)=>{p(B)},$$slots:{default:!0}})}),r(ye,ie)},$$slots:{default:!0}})}),r(t,h)},_=t=>{var h=yn(),F=qe(h);x(F,()=>Ya,(ee,ye)=>{ye(ee,{onOpenChange:Ne,get open(){return e(R)},set open(se){b(R,se,!0)},children:(se,ie)=>{var W=Wt(),N=m(W);{const U=(B,Ie)=>{let D=()=>(Ie?.()).props;{let y=n(()=>d.chat_messageNavigator_open_ariaLabel()),_e=n(()=>d.chat_messageNavigator_open_ariaLabel());lt(B,Mt(D,{variant:"ghost-light",size:"icon-sm",get active(){return e(R)},get"aria-label"(){return e(y)},get tooltip(){return e(_e)},get tooltipDisabled(){return e(R)},tooltipSide:"bottom",tooltipDelayDuration:300,get"aria-expanded"(){return e(R)},onkeydown:C,"data-testid":"chat-message-navigator-trigger",children:(ge,fe)=>{ia(ge,{get size(){return na.compact},weight:"regular",mirrored:!1,"aria-hidden":"true",class:"size-4!","data-chat-message-navigator-chat-icon":!0})},$$slots:{default:!0}}))}};x(N,()=>Xr,(B,Ie)=>{Ie(B,{get ref(){return e(K)},set ref(D){b(K,D,!0)},child:U,$$slots:{child:!0}})})}var P=$(N,2);x(P,()=>br,(U,B)=>{B(U,{children:(Ie,D)=>{var y=J(),_e=m(y);{let ge=n(()=>d.chat_messageNavigator_open_ariaLabel());x(_e,()=>Qa,(fe,Oe)=>{Oe(fe,{role:"dialog",get"aria-label"(){return e(ge)},align:"end",side:"bottom",sideOffset:4,get collisionBoundary(){return e(u)},collisionPadding:8,trapFocus:!1,onOpenAutoFocus:E,onCloseAutoFocus:Y,onFocusOutside:oe,get"data-chat-message-navigator-content"(){return w},get class(){return`${wr} w-[28rem]`},get ref(){return e(de)},set ref(Se){b(de,Se,!0)},children:(Se,Pe)=>{p(Se)},$$slots:{default:!0}})})}r(Ie,y)},$$slots:{default:!0}})}),r(se,W)},$$slots:{default:!0}})});var j=$(F,2);Kr(j,{get disabled(){return T()},get onclick(){return S()}}),Be(h),r(t,h)};Z(s,t=>{G()?t(k):t(_,-1)})}return r(f,a),ft(te)}function Tn(f,i,w){return[...Object.values(f).flatMap(p=>p.tabs.filter(v=>v.type==="browser"&&v.ownerAgentId===w).map(v=>({tab:v,panelId:p.id,active:p.activeTabId===v.id,hidden:!1}))),...i.filter(p=>p.type==="browser"&&p.ownerAgentId===w).map(p=>({tab:p,active:!1,hidden:!0}))]}const qt=(f,i=Dt)=>{var w=Sn(),p=qe(w);ht(p,{get icon(){return oa},class:"size-(--menu-icon-size) opacity-30"});var v=$(p,2);{var T=A=>{var S=Cn();ve(()=>Qt(S,"src",i().tab.faviconUrl)),Gt("error",S,g=>g.currentTarget.style.display="none"),wa(S),r(A,S)};Z(v,A=>{i().tab.faviconUrl&&A(T)})}Be(w),r(f,w)};var Cn=H('<img alt="" class="absolute inset-0 size-full rounded-sm object-contain"/>'),Sn=H('<span class="relative inline-flex size-(--menu-icon-size) shrink-0 items-center justify-center" aria-hidden="true"><!> <!></span>'),Pn=H('<span class="min-w-0 flex-1 truncate"> </span>'),Mn=H('<span class="inline-flex size-(--menu-icon-size) items-center justify-center" aria-hidden="true"><!></span>'),Dn=H('<div class="flex min-w-0 items-center gap-1"><!> <!></div>'),_t=H("<!> <!>",1),Ln=H('<span class="first-line-icon w-(--menu-icon-size)" aria-hidden="true"><!></span> <span class="min-w-0 flex-1 truncate text-muted-foreground"> </span>',1),Hn=H('<li class="flex min-w-0 items-center gap-1"><!> <!></li>'),On=H("<!> ",1),Bn=H('<div class="my-1 border-t border-border"></div> <!>',1),Rn=H('<ul class="m-0 list-none p-0"></ul> <!>',1);function ca(f,i){if(new.target)return ct({component:ca,...f});gt(i,!0);const w=()=>ke(R,"$panels$",v),p=()=>ke(Re,"$hiddenTabs$",v),[v,T]=xt();let A=ae(i,"workspaceId",7),S=ae(i,"agentId",7),g=ae(i,"entries",7),M=ae(i,"embedded",7,!1);const G=St(A());je(()=>G.set(A()));const R=Zt(G),Re=an(G),ne=n(()=>Tn(w(),p(),S())),c=n(()=>g()??e(ne)),z=n(()=>e(c).length===1?d.chat_browserTabs_trigger_tooltip_one({count:wt(e(c).length)}):d.chat_browserTabs_trigger_tooltip_many({count:wt(e(c).length)}));function Ce(a){const s=a.tab.title.trim();if(s)return s;if(a.tab.browserUrl)try{return new URL(a.tab.browserUrl).host||a.tab.browserUrl}catch{return a.tab.browserUrl}return d.browser_embedded_noUrl_label()}function Ee(a){if(b(K,!1),!g()){if(a.hidden){const s=Zt.select(Q.state,A()),k=Object.values(s).find(_=>_.tabs.some(t=>t.type==="agent"&&t.agentId===S()));Q.dispatch(Oa(A(),a.tab.id,k?.id??null))}else if(a.panelId){const s=tn(A());s.setActiveTab(a.tab.id,a.panelId),o=!0,s.focusPanel(a.panelId)}}}const Fe=crypto.randomUUID();je(()=>{const a=A();if(!(!e(K)||g()))return Q.dispatch(Da(a,Fe)),()=>Q.dispatch(La(a,Fe))});let K=ce(!1),de=ce(null),u=ce(null),o=!1;function I(a){!o&&!e(X)||(a.preventDefault(),o=!1)}function O(a,s){const k=e(de)?.querySelectorAll('[data-testid="browser-tabs-menu-item"]');if(!k?.length)return;let _;if(a.key==="ArrowDown")_=(s+1)%k.length;else if(a.key==="ArrowUp")_=(s-1+k.length)%k.length;else if(a.key==="Home")_=0;else if(a.key==="End")_=k.length-1;else if(a.key==="ArrowRight"){a.preventDefault(),a.currentTarget.closest("li")?.querySelector('[data-testid="browser-tab-close"]')?.focus();return}else return;a.preventDefault(),k[_].focus()}const Le=n(()=>e(c).filter(a=>a.hidden).length);let X=ce(null);function Ne(a,s){return a.hostClientId===void 0||a.hostClientId===s}function nt(a){const s=nn.select(Q.state,a.hostClientId??"",A());Q.dispatch(Ba(a.id,!s.connected))}function He(a){const s=rn.select(Q.state);if(a.kind==="tab"){const{tab:_,panelId:t}=a.entry;Ne(_,s)?Q.dispatch(ta(A(),_.id,t,void 0,{destroy:!0})):nt(_);return}const k=e(c).filter(_=>_.hidden&&!Ne(_.tab,s)).map(_=>_.tab);k.length<e(Le)&&Q.dispatch(Ha(A(),S(),s));for(const _ of k)nt(_)}async function tt(a){if(!g()){if(b(K,!1),ar.select(Q.state,S())){if(M()){const s=a.kind==="hidden";await en({title:s?d.chat_browserTabs_closeHiddenDialog_title():d.chat_browserTabs_closeDialog_title(),description:s?d.chat_browserTabs_closeHiddenDialog_description():d.chat_browserTabs_closeDialog_description(),confirmLabel:s?d.chat_browserTabs_closeHiddenDialog_confirm_label():d.chat_browserTabs_closeDialog_confirm_label(),cancelLabel:d.chat_browserTabs_closeDialog_cancel_label(),destructive:!0})&&He(a)}else b(X,a,!0);return}He(a)}}function C(){const a=e(X);b(X,null),a&&He(a)}function E(){b(X,null)}var xe={get workspaceId(){return A()},set workspaceId(a){A(a),re()},get agentId(){return S()},set agentId(a){S(a),re()},get entries(){return g()},set entries(a){g(a),re()},get embedded(){return M()},set embedded(a=!1){M(a),re()},$set:dt,$on:(a,s)=>ut(i,a,s)},we=_t(),oe=m(we);{var Y=a=>{var s=J(),k=m(s);x(k,()=>Ot,(_,t)=>{t(_,{get open(){return e(K)},set open(h){b(K,h,!0)},children:(h,F)=>{var j=_t(),ee=m(j);x(ee,()=>Lt,(se,ie)=>{ie(se,{get icon(){return oa},"data-testid":"browser-tabs-trigger",children:(W,N)=>{Ye();var P=et();ve(()=>$e(P,e(z))),r(W,P)},$$slots:{default:!0}})});var ye=$(ee,2);x(ye,()=>Ht,(se,ie)=>{ie(se,{class:"w-64",alignIconColumn:!1,onCloseAutoFocus:I,children:(W,N)=>{var P=_t(),U=m(P);kt(U,17,()=>e(c),D=>D.tab.id,(D,y)=>{const _e=n(()=>Ce(e(y)));var ge=Dn(),fe=qe(ge);{const Se=le=>{qt(le,()=>e(y))};let Pe=n(()=>e(y).hidden?"opacity-60":""),Me=n(()=>e(y).hidden||void 0);x(fe,()=>Ut,(le,Ue)=>{Ue(le,{get class(){return`min-w-0 flex-1 ${e(Pe)??""}`},get textValue(){return e(_e)},onclick:()=>Ee(e(y)),"data-testid":"browser-tabs-menu-item",get"data-browser-tab-id"(){return e(y).tab.id},get"data-hidden"(){return e(Me)},leading:Se,children:(Xe,Je)=>{var Ve=Pn(),ot=at(Ve,!0);ve(()=>$e(ot,e(_e))),r(Xe,Ve)},$$slots:{leading:!0,default:!0}})})}var Oe=$(fe,2);{let Se=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(_e)})),Pe=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(_e)})),Me=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(_e)}));x(Oe,()=>Ut,(le,Ue)=>{Ue(le,{class:"size-7 shrink-0 items-center justify-center p-0",get textValue(){return e(Se)},get"aria-label"(){return e(Pe)},get title(){return e(Me)},onSelect:Xe=>Xe.preventDefault(),onclick:()=>tt({kind:"tab",entry:e(y)}),"data-testid":"browser-tab-close",get"data-browser-tab-id"(){return e(y).tab.id},children:(Xe,Je)=>{var Ve=Mn(),ot=qe(Ve);ht(ot,{get icon(){return $t},class:"size-(--menu-icon-size)! shrink-0"}),Be(Ve),r(Xe,Ve)},$$slots:{default:!0}})})}Be(ge),r(D,ge)});var B=$(U,2);{var Ie=D=>{var y=_t(),_e=m(y);x(_e,()=>Bt,(fe,Oe)=>{Oe(fe,{})});var ge=$(_e,2);{let fe=n(()=>d.chat_browserTabs_closeHidden_label({count:wt(e(Le))}));x(ge,()=>st,(Oe,Se)=>{Se(Oe,{get icon(){return $t},get label(){return e(fe)},onSelect:Pe=>Pe.preventDefault(),onclick:()=>tt({kind:"hidden"}),"data-testid":"browser-tabs-close-hidden"})})}r(D,y)};Z(B,D=>{e(Le)>0&&D(Ie)})}r(W,P)},$$slots:{default:!0}})}),r(h,j)},$$slots:{default:!0}})}),r(a,s)},ue=a=>{var s=J(),k=m(s);x(k,()=>tr,(_,t)=>{t(_,{get open(){return e(K)},set open(h){b(K,h,!0)},children:(h,F)=>{var j=_t(),ee=m(j);{const se=(ie,W)=>{lt(ie,Mt(()=>(W?.()).props,{variant:"ghost-light",size:"icon-sm",get active(){return e(K)},get"aria-label"(){return e(z)},get tooltip(){return e(z)},get tooltipDisabled(){return e(K)},tooltipSide:"bottom",tooltipDelayDuration:300,"data-testid":"browser-tabs-trigger",get ref(){return e(u)},set ref(P){b(u,P,!0)},children:(P,U)=>{Cr(P,{get size(){return na.compact},weight:"regular","aria-hidden":"true",class:"size-4!"})},$$slots:{default:!0}}))};x(ee,()=>Jr,(ie,W)=>{W(ie,{child:se,$$slots:{child:!0}})})}var ye=$(ee,2);x(ye,()=>er,(se,ie)=>{ie(se,{trapFocus:!1,align:"end",side:"bottom",sideOffset:4,class:"min-w-52 max-w-80 max-h-[min(var(--bits-popover-content-available-height,calc(100dvh-1rem)),calc(100dvh-1rem))] overflow-y-auto p-1",role:"dialog",get"aria-label"(){return e(z)},onOpenAutoFocus:W=>{W.preventDefault(),e(de)?.querySelector('[data-testid="browser-tabs-menu-item"]')?.focus()},onCloseAutoFocus:I,children:(W,N)=>{var P=Rn(),U=m(P);kt(U,23,()=>e(c),D=>D.tab.id,(D,y,_e)=>{const ge=n(()=>Ce(e(y)));var fe=Hn(),Oe=qe(fe);{let Pe=n(Pt),Me=n(()=>e(y).hidden?"opacity-60":""),le=n(()=>e(y).hidden||void 0);lt(Oe,{variant:"plain",wrapContent:!1,get class(){return`${e(Pe)??""} h-auto min-w-0 flex-1 ${e(Me)??""}`},"data-testid":"browser-tabs-menu-item",get"data-browser-tab-id"(){return e(y).tab.id},get"data-hidden"(){return e(le)},onkeydown:Ue=>O(Ue,e(_e)),onclick:()=>Ee(e(y)),children:(Ue,Xe)=>{var Je=Ln(),Ve=m(Je),ot=qe(Ve);qt(ot,()=>e(y)),Be(Ve);var yt=$(Ve,2),bt=at(yt,!0);ve(()=>$e(bt,e(ge))),r(Ue,Je)},$$slots:{default:!0}})}var Se=$(Oe,2);{let Pe=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(ge)})),Me=n(()=>d.chat_browserTabs_closeTab_ariaLabel({title:e(ge)}));lt(Se,{variant:"plain",size:"icon-compact",type:"button",class:"size-6 shrink-0 focus-visible:ring-1","data-testid":"browser-tab-close",get"data-browser-tab-id"(){return e(y).tab.id},get"aria-label"(){return e(Pe)},get title(){return e(Me)},onkeydown:le=>{le.key!=="Escape"&&le.stopPropagation(),le.key==="ArrowLeft"&&(le.preventDefault(),le.currentTarget.closest("li")?.querySelector('[data-testid="browser-tabs-menu-item"]')?.focus())},onclick:le=>{le.preventDefault(),le.stopPropagation(),tt({kind:"tab",entry:e(y)})},children:(le,Ue)=>{ht(le,{get icon(){return $t},class:"size-3"})},$$slots:{default:!0}})}Be(fe),r(D,fe)}),Be(U),Yt(U,D=>b(de,D),()=>e(de));var B=$(U,2);{var Ie=D=>{var y=Bn(),_e=$(m(y),2);{let ge=n(Pt);lt(_e,{variant:"plain",get class(){return e(ge)},"data-testid":"browser-tabs-close-hidden",onclick:()=>tt({kind:"hidden"}),children:(fe,Oe)=>{var Se=On(),Pe=m(Se);ht(Pe,{get icon(){return $t},class:"size-3"});var Me=$(Pe);ve(le=>$e(Me,` ${le??""}`),[()=>d.chat_browserTabs_closeHidden_label({count:wt(e(Le))})]),r(fe,Se)},$$slots:{default:!0}})}r(D,y)};Z(B,D=>{e(Le)>0&&D(Ie)})}r(W,P)},$$slots:{default:!0}})}),r(h,j)},$$slots:{default:!0}})}),r(a,s)};Z(oe,a=>{e(c).length>0&&M()?a(Y):e(c).length>0&&a(ue,1)})}var q=$(oe,2);{let a=n(()=>e(X)!==null),s=n(()=>e(X)?.kind==="hidden"?d.chat_browserTabs_closeHiddenDialog_title():d.chat_browserTabs_closeDialog_title()),k=n(()=>e(X)?.kind==="hidden"?d.chat_browserTabs_closeHiddenDialog_description():d.chat_browserTabs_closeDialog_description()),_=n(()=>d.chat_browserTabs_closeDialog_close_ariaLabel()),t=n(()=>d.chat_browserTabs_closeDialog_cancel_label()),h=n(()=>e(X)?.kind==="hidden"?d.chat_browserTabs_closeHiddenDialog_confirm_label():d.chat_browserTabs_closeDialog_confirm_label());Yr(q,{get open(){return e(a)},size:"sm",get title(){return e(s)},get description(){return e(k)},get closeLabel(){return e(_)},get cancelLabel(){return e(t)},get submitLabel(){return e(h)},submitVariant:"destructive",focusSubmit:!0,onSubmit:C,onCancel:E,onCloseAutoFocus:F=>{F.preventDefault(),e(u)?.focus()}})}r(f,we);var te=ft(xe);return T(),te}var Fn=H("<!> <!>",1);function da(f,i){if(new.target)return ct({component:da,...f});gt(i,!0);const w=()=>ke(g,"$entry",p),[p,v]=xt();let T=ae(i,"workspaceId",7),A=ae(i,"agentId",7),S=ae(i,"separator",7,!0);const g=ea(At(()=>T()),At(()=>A()));je(()=>{Q.dispatch(aa(T(),A()))});var M={get workspaceId(){return T()},set workspaceId(c){T(c),re()},get agentId(){return A()},set agentId(c){A(c),re()},get separator(){return S()},set separator(c=!0){S(c),re()},$set:dt,$on:(c,z)=>ut(i,c,z)},G=J(),R=m(G);{var Re=c=>{var z=Fn(),Ce=m(z);{var Ee=K=>{var de=J(),u=m(de);x(u,()=>Bt,(o,I)=>{I(o,{})}),r(K,de)};Z(Ce,K=>{S()&&K(Ee)})}var Fe=$(Ce,2);x(Fe,()=>mt,(K,de)=>{de(K,{indicator:"switch",get icon(){return Sr},get checked(){return w().permission.allowed},onSelect:u=>{u.preventDefault();const o=w()?.permission;o&&!w()?.saving&&Q.dispatch(Ra(T(),A(),o.computerId,!o.allowed))},children:(u,o)=>{Ye();var I=et();ve(O=>$e(I,O),[()=>d.settings_agentFeatures_desktopControl_label()]),r(u,I)},$$slots:{default:!0}})}),r(c,z)};Z(R,c=>{w()?.permission&&c(Re)})}r(f,G);var ne=ft(M);return v(),ne}var Ct=H("<!> <!>",1),Nn=H("<!> <!> <!>",1),zn=H('<span class="min-w-0 flex-1"> </span> <span> </span>',1),En=H("<!> <!> <!> <!>",1),Un=H("<!> <!> <!> <!> <!>",1);function ua(f,i){if(new.target)return ct({component:ua,...f});gt(i,!0);const w=()=>ke(de,"$agentSession",S),p=()=>ke(Ce,"$fontStyle",S),v=()=>ke(Ee,"$chatContentWidth",S),T=()=>ke(Fe,"$chatAuroraEnabled",S),A=()=>ke(K,"$collapseToolRuns",S),[S,g]=xt(),M=C=>{var E=J(),xe=m(E);x(xe,()=>Gr,(we,oe)=>{oe(we,{get value(){return p()},onValueChange:O,children:(Y,ue)=>{var q=Ct(),te=m(q);x(te,()=>Vt,(s,k)=>{k(s,{value:"sans",closeOnSelect:!1,children:(_,t)=>{Ye();var h=et();ve(F=>$e(h,F),[()=>d.settings_fontStyle_sans()]),r(_,h)},$$slots:{default:!0}})});var a=$(te,2);x(a,()=>Vt,(s,k)=>{k(s,{value:"monospace",closeOnSelect:!1,children:(_,t)=>{Ye();var h=et();ve(F=>$e(h,F),[()=>d.settings_fontStyle_mono()]),r(_,h)},$$slots:{default:!0}})}),r(Y,q)},$$slots:{default:!0}})}),r(C,E)},G=C=>{var E=Nn(),xe=m(E);{let Y=n(()=>v()==="full");x(xe,()=>mt,(ue,q)=>{q(ue,{indicator:"switch",get icon(){return Dr},get checked(){return e(Y)},closeOnSelect:!1,onCheckedChange:te=>Q.dispatch(Fa(te?"full":"800")),children:(te,a)=>{Ye();var s=et();ve(k=>$e(s,k),[()=>d.settings_appearance_chatContentWidth_label()]),r(te,s)},$$slots:{default:!0}})})}var we=$(xe,2);x(we,()=>mt,(Y,ue)=>{ue(Y,{indicator:"switch",get icon(){return Lr},get checked(){return T()},closeOnSelect:!1,onCheckedChange:q=>Q.dispatch(Na(q)),children:(q,te)=>{Ye();var a=et();ve(s=>$e(a,s),[()=>d.settings_appearance_chatAurora_label()]),r(q,a)},$$slots:{default:!0}})});var oe=$(we,2);x(oe,()=>mt,(Y,ue)=>{ue(Y,{indicator:"switch",get icon(){return Hr},get checked(){return A()},closeOnSelect:!1,onCheckedChange:q=>Q.dispatch(za(q)),children:(q,te)=>{Ye();var a=et();ve(s=>$e(a,s),[()=>d.settings_appearance_collapseToolRuns_label()]),r(q,a)},$$slots:{default:!0}})}),r(C,E)},R=C=>{var E=J(),xe=m(E);{var we=oe=>{var Y=J(),ue=m(Y);x(ue,()=>mt,(q,te)=>{te(q,{indicator:"switch",get icon(){return Or},get checked(){return e(u)},closeOnSelect:!1,onCheckedChange:a=>Q.dispatch(Ua(c(),z(),a?"interactive":"allow")),children:(a,s)=>{Ye();var k=et();ve(_=>$e(k,_),[()=>d.ui_viewSettings_askBeforeTools_label()]),r(a,k)},$$slots:{default:!0}})}),r(oe,Y)};Z(xe,oe=>{e(u)!==void 0&&c()&&z()&&oe(we)})}r(C,E)},Re=C=>{var E=J(),xe=m(E);{var we=oe=>{var Y=J(),ue=m(Y);Kt(ue,()=>`${c()}:${z()}`,q=>{{let te=n(()=>!ne());da(q,{get workspaceId(){return c()},get agentId(){return z()},get separator(){return e(te)}})}}),r(oe,Y)};Z(xe,oe=>{c()&&z()&&oe(we)})}r(C,E)};let ne=ae(i,"embedded",7,!1),c=ae(i,"workspaceId",7),z=ae(i,"agentId",7);const Ce=sn(),Ee=ln(),Fe=cn(),K=dn(),de=rr(Qr(()=>z())),u=n(()=>{const C=w();if(!c()||!C||C.permissionPolicy===void 0)return;const E=C.effectivePermissionPolicy;return typeof E=="string"?E==="interactive":void 0});let o=ce(!1);const I=n(()=>p()==="sans"?d.settings_fontStyle_sans():d.settings_fontStyle_mono());function O(C){C!=="sans"&&C!=="monospace"||Q.dispatch(Ea(C))}var Le={get embedded(){return ne()},set embedded(C=!1){ne(C),re()},get workspaceId(){return c()},set workspaceId(C){c(C),re()},get agentId(){return z()},set agentId(C){z(C),re()},$set:dt,$on:(C,E)=>ut(i,C,E)},X=J(),Ne=m(X);{var nt=C=>{var E=En(),xe=m(E);x(xe,()=>Ot,(ue,q)=>{q(ue,{children:(te,a)=>{var s=Ct(),k=m(s);x(k,()=>Lt,(t,h)=>{h(t,{get icon(){return Pr},iconWeight:"regular",children:(F,j)=>{var ee=zn(),ye=m(ee),se=at(ye,!0),ie=$(ye,2),W=at(ie,!0);ve(N=>{$e(se,N),ya(ie,1,`type-caption ${Vr}`),$e(W,e(I))},[()=>d.ui_viewSettings_font_label()]),r(F,ee)},$$slots:{default:!0}})});var _=$(k,2);{let t=n(()=>d.ui_viewSettings_font_label());x(_,()=>Ht,(h,F)=>{F(h,{get"aria-label"(){return e(t)},children:(j,ee)=>{M(j)},$$slots:{default:!0}})})}r(te,s)},$$slots:{default:!0}})});var we=$(xe,2);G(we);var oe=$(we,2);R(oe);var Y=$(oe,2);Re(Y),r(C,E)},He=C=>{var E=J(),xe=m(E);x(xe,()=>jr,(we,oe)=>{oe(we,{get open(){return e(o)},set open(Y){b(o,Y,!0)},children:(Y,ue)=>{var q=Ct(),te=m(q);{const s=(k,_)=>{let t=()=>(_?.()).props;{let h=n(()=>d.ui_viewSettings_trigger_tooltip()),F=n(()=>d.ui_viewSettings_trigger_tooltip());lt(k,Mt(t,{variant:"ghost-light",size:"icon-xs",get tooltip(){return e(h)},tooltipSide:"bottom",get"aria-label"(){return e(F)},get"aria-expanded"(){return e(o)},"data-testid":"agent-view-settings-trigger",children:(j,ee)=>{ht(j,{get icon(){return Mr},size:"xs"})},$$slots:{default:!0}}))}};x(te,()=>Wr,(k,_)=>{_(k,{child:s,$$slots:{child:!0}})})}var a=$(te,2);{let s=n(()=>d.ui_viewSettings_trigger_tooltip());x(a,()=>qr,(k,_)=>{_(k,{align:"end",class:"w-56",get"aria-label"(){return e(s)},children:(t,h)=>{var F=Un(),j=m(F);M(j);var ee=$(j,2);x(ee,()=>Bt,(W,N)=>{N(W,{})});var ye=$(ee,2);G(ye);var se=$(ye,2);R(se);var ie=$(se,2);Re(ie),r(t,F)},$$slots:{default:!0}})})}r(Y,q)},$$slots:{default:!0}})}),r(C,E)};Z(Ne,C=>{ne()?C(nt):C(He,-1)})}r(f,X);var tt=ft(Le);return g(),tt}function vt(f,i=2){if(f==null)return"";if(typeof f=="string")return f;try{return JSON.stringify(f,null,i)}catch{return String(f)}}function Vn(f){const i=f.name||f.toolName||"unknown",w=f.arguments||f.input||f.parameters||{},p=vt(w),v=f.result,T=f.error;let A=`🔧 Tool: ${i}
2
2
  Input:
3
3
  ${p}`;return T?A+=`
4
4
  ❌ Error: ${typeof T=="string"?T:vt(T)}`:v!==void 0&&(A+=`
@@ -1 +1 @@
1
- import{b as o}from"./D87dDGLb.js";var c=1;function i(){if(!(typeof globalThis>"u"))return globalThis}o(i,"getCaptureGlobal");function p(){return!!i()?.mermaidCaptureSizes}o(p,"shouldCaptureSizes");function u(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}o(u,"capturedFromLocation");function d(n,r){const t=i();if(!t)return;const e=r.node(),s=((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)??e)?.id??"(unknown)";t.mermaidCapturedSizes??=[];const a={svgId:s,sizes:n};t.mermaidCapturedSizes.push(a),t.mermaidLastCapturedSizes=a}o(d,"emitCapturedSizes");function m(n,r){const t=[];for(const e of r.nodes)e.isGroup||t.push({id:e.id,width:e.width??0,height:e.height??0});t.length!==0&&d({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:u()},nodes:t},n)}o(m,"captureNodeSizes");export{m as captureNodeSizes,p as shouldCaptureSizes};
1
+ import{b as o}from"./DZshGt8n.js";var c=1;function i(){if(!(typeof globalThis>"u"))return globalThis}o(i,"getCaptureGlobal");function p(){return!!i()?.mermaidCaptureSizes}o(p,"shouldCaptureSizes");function u(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}o(u,"capturedFromLocation");function d(n,r){const t=i();if(!t)return;const e=r.node(),s=((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)??e)?.id??"(unknown)";t.mermaidCapturedSizes??=[];const a={svgId:s,sizes:n};t.mermaidCapturedSizes.push(a),t.mermaidLastCapturedSizes=a}o(d,"emitCapturedSizes");function m(n,r){const t=[];for(const e of r.nodes)e.isGroup||t.push({id:e.id,width:e.width??0,height:e.height??0});t.length!==0&&d({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:u()},nodes:t},n)}o(m,"captureNodeSizes");export{m as captureNodeSizes,p as shouldCaptureSizes};
@@ -1 +1 @@
1
- import{C as M}from"./BvFAWM27.js";import{a as v}from"./BdWqymET.js";import{d as C}from"./BV3MrUXO.js";import{Ix as o,Ds as E,CU as _,g as A,uL as O,ul as D,fW as H,Ca as L,Cs as P,Es as R,Ce as x}from"./DNqM68dO.js";import{aZ as p}from"./VZEkDWIM.js";import{d as W}from"./B0Z-1lwJ.js";import{n as B}from"./N1UEVlPw.js";import{o as F,e as q}from"./D7on2OYy.js";const u=new v("OpenMessage"),S=150,y=15e3,N=2,G=[150,400,800,1500,3e3],Y=M;let g;function k(e){return new Promise(t=>setTimeout(t,e))}function m(e,t){const s=o.state,n=s.agentSessions?.byAgentId[e]?.messages,a=s.agentSessions?.historySegmentsByAgentId?.[e]?.messages;return!!(n?.some(r=>r.id===t)||a?.some(r=>r.id===t))}function T(e,t){const s=o.state,n=s.agentSessions?.historySegmentsByAgentId?.[e];n?.detachedFromTail!==!0||n.messages.some(r=>r.id===t)||!s.agentSessions?.byAgentId[e]?.messages?.some(r=>r.id===t)||o.dispatch(H(e))}function I(e){return o.state.chatState?.byAgentId[e]?.transcriptHydration}async function K(e,t,s){const n=Date.now()+y;let a=0;for(;Date.now()<n;){if(s.aborted)return!1;if(m(e,t))return!0;if(a>=N&&I(e)==="settled"&&!p.select(o.state,e).initialHistoryPending)return!1;a++,await k(S)}return!s.aborted&&m(e,t)}async function U(e,t,s,n){const a=Date.now()+y;for(;p.select(o.state,e).initialHistoryPending;){if(n?.aborted||Date.now()>=a)return!1;await k(S)}const r=o.state.agentSessions?.byAgentId[e];if(!r||n?.aborted)return!1;if(m(e,t))return T(e,t),!0;s??=r.workspaceId;const l=p.select(o.state,e);let c={nextToken:l.scrollbackOlderToken,prevToken:l.scrollbackGapToken,olderAnchorId:l.scrollbackOlderTokenAnchorId};o.dispatch(L(e,"seek"));const d=p.select(o.state,e).scrollbackDiscardEpoch,f=()=>!!o.state.agentSessions?.byAgentId[e]&&p.select(o.state,e).scrollbackDiscardEpoch===d;try{const i=await C.agents.getConversation(e,Y,void 0,t,void 0,s);return n?.aborted||!f()||!i.messages.some(h=>h.id===t)?!1:(o.dispatch(P(e,i.messages,i.messages[0]?.seq)),i.nextToken===null&&o.dispatch(R(e)),c={nextToken:i.nextToken,prevToken:i.prevToken,olderAnchorId:i.messages[0]?.id??null},m(e,t))}catch(i){return u.warn("[seekConversationToMessage] Seek fetch failed (message may no longer exist)",{agentId:e,messageId:t,error:i}),!1}finally{f()&&o.dispatch(x(e,c))}}async function ee(e){if(e.signal?.aborted)return;g?.abort(),g=new AbortController;const t=e.signal?AbortSignal.any([g.signal,e.signal]):g.signal,{workspaceId:s,agentId:n,messageId:a,query:r,targetTabId:l}=e;u.info("[openMessage] Deep-opening conversation at message",{workspaceId:s,agentId:n,messageId:a});const c=s===A;c&&!e.contentAlreadyOpen&&(o.dispatch(E(n)),o.dispatch(_(A,n)),o.dispatch(O("chief")));const d=c?"/":q(s);if(!e.contentAlreadyOpen&&typeof window<"u"&&window.location.pathname!==d){try{c?await B(d):await F(s)}catch(w){u.warn("[openMessage] Workspace navigation failed",{workspaceId:s,error:w});return}if(t.aborted)return;if(window.location.pathname!==d){u.warn("[openMessage] Workspace navigation was not confirmed",{workspaceId:s});return}}!e.contentAlreadyOpen&&!c&&o.dispatch(D(s,{agentId:n}));const f=await K(n,a,t);f&&T(n,a);const i=f||await U(n,a,s,t);if(t.aborted)return;if(!i){u.warn("[openMessage] Message not found; conversation opened at tail",{agentId:n,messageId:a});return}const h=`open-message-${Date.now()}-${Math.random().toString(36).slice(2)}`,b={agentId:n,messageId:a,query:r,targetTabId:l,requestId:h,signal:t};for(const w of G)setTimeout(()=>{t.aborted||W("chat:open-message",b)},w)}export{ee as openMessage,U as seekConversationToMessage};
1
+ import{C as M}from"./BvFAWM27.js";import{a as v}from"./BdWqymET.js";import{d as C}from"./BV3MrUXO.js";import{Ix as o,Ds as E,CU as _,g as A,uL as O,ul as D,fW as H,Ca as L,Cs as P,Es as R,Ce as x}from"./DNqM68dO.js";import{aZ as p}from"./VZEkDWIM.js";import{d as W}from"./B0Z-1lwJ.js";import{n as B}from"./Bq5sL6M1.js";import{o as F,e as q}from"./D6a7EVHj.js";const u=new v("OpenMessage"),S=150,y=15e3,N=2,G=[150,400,800,1500,3e3],Y=M;let g;function k(e){return new Promise(t=>setTimeout(t,e))}function m(e,t){const s=o.state,n=s.agentSessions?.byAgentId[e]?.messages,a=s.agentSessions?.historySegmentsByAgentId?.[e]?.messages;return!!(n?.some(r=>r.id===t)||a?.some(r=>r.id===t))}function T(e,t){const s=o.state,n=s.agentSessions?.historySegmentsByAgentId?.[e];n?.detachedFromTail!==!0||n.messages.some(r=>r.id===t)||!s.agentSessions?.byAgentId[e]?.messages?.some(r=>r.id===t)||o.dispatch(H(e))}function I(e){return o.state.chatState?.byAgentId[e]?.transcriptHydration}async function K(e,t,s){const n=Date.now()+y;let a=0;for(;Date.now()<n;){if(s.aborted)return!1;if(m(e,t))return!0;if(a>=N&&I(e)==="settled"&&!p.select(o.state,e).initialHistoryPending)return!1;a++,await k(S)}return!s.aborted&&m(e,t)}async function U(e,t,s,n){const a=Date.now()+y;for(;p.select(o.state,e).initialHistoryPending;){if(n?.aborted||Date.now()>=a)return!1;await k(S)}const r=o.state.agentSessions?.byAgentId[e];if(!r||n?.aborted)return!1;if(m(e,t))return T(e,t),!0;s??=r.workspaceId;const l=p.select(o.state,e);let c={nextToken:l.scrollbackOlderToken,prevToken:l.scrollbackGapToken,olderAnchorId:l.scrollbackOlderTokenAnchorId};o.dispatch(L(e,"seek"));const d=p.select(o.state,e).scrollbackDiscardEpoch,f=()=>!!o.state.agentSessions?.byAgentId[e]&&p.select(o.state,e).scrollbackDiscardEpoch===d;try{const i=await C.agents.getConversation(e,Y,void 0,t,void 0,s);return n?.aborted||!f()||!i.messages.some(h=>h.id===t)?!1:(o.dispatch(P(e,i.messages,i.messages[0]?.seq)),i.nextToken===null&&o.dispatch(R(e)),c={nextToken:i.nextToken,prevToken:i.prevToken,olderAnchorId:i.messages[0]?.id??null},m(e,t))}catch(i){return u.warn("[seekConversationToMessage] Seek fetch failed (message may no longer exist)",{agentId:e,messageId:t,error:i}),!1}finally{f()&&o.dispatch(x(e,c))}}async function ee(e){if(e.signal?.aborted)return;g?.abort(),g=new AbortController;const t=e.signal?AbortSignal.any([g.signal,e.signal]):g.signal,{workspaceId:s,agentId:n,messageId:a,query:r,targetTabId:l}=e;u.info("[openMessage] Deep-opening conversation at message",{workspaceId:s,agentId:n,messageId:a});const c=s===A;c&&!e.contentAlreadyOpen&&(o.dispatch(E(n)),o.dispatch(_(A,n)),o.dispatch(O("chief")));const d=c?"/":q(s);if(!e.contentAlreadyOpen&&typeof window<"u"&&window.location.pathname!==d){try{c?await B(d):await F(s)}catch(w){u.warn("[openMessage] Workspace navigation failed",{workspaceId:s,error:w});return}if(t.aborted)return;if(window.location.pathname!==d){u.warn("[openMessage] Workspace navigation was not confirmed",{workspaceId:s});return}}!e.contentAlreadyOpen&&!c&&o.dispatch(D(s,{agentId:n}));const f=await K(n,a,t);f&&T(n,a);const i=f||await U(n,a,s,t);if(t.aborted)return;if(!i){u.warn("[openMessage] Message not found; conversation opened at tail",{agentId:n,messageId:a});return}const h=`open-message-${Date.now()}-${Math.random().toString(36).slice(2)}`,b={agentId:n,messageId:a,query:r,targetTabId:l,requestId:h,signal:t};for(const w of G)setTimeout(()=>{t.aborted||W("chat:open-message",b)},w)}export{ee as openMessage,U as seekConversationToMessage};
@@ -1 +1 @@
1
- import{t as Ye,br as h,a_ as M,bz as Ze,b as $e,bt as nt,bp as k,bv as je}from"./O1QHAURn.js";import{bo as st,bs as et,a7 as L,ay as y,aD as e,bS as U,W as c,a5 as Pe,bA as De,bH as j,bl as _e,b_ as oe,bO as de,bn as tt,bf as Ve,bV as Ee,aA as v,c9 as w,aB as H,be as it,b$ as lt,bj as dt,cd as ct,ca as Xe,bk as ut}from"./DYhIMPy1.js";import{i as G}from"./RoOfSbrC.js";import{Ix as Le,mT as pt,uB as ft}from"./DNqM68dO.js";import{b8 as ht}from"./CflCv6yT.js";import{cn as vt}from"./VZEkDWIM.js";import{c as gt}from"./ChTqQfQN.js";import{i as Ue,t as He}from"./H2jLkRRS.js";import{w as _t}from"./CovkQMd0.js";import{d as mt}from"./B0Z-1lwJ.js";import{F as Re,as as bt,at as kt,cQ as Je,aV as qe,bc as wt,ak as yt,aj as At,cN as Ge}from"./B0f-om7y.js";import{k as K,w as Ft}from"./B6kyqBFl.js";import{n as Wt,u as Ne,v as xe,g as Te,j as Ct}from"./CAyg2ijY.js";import{s as xt}from"./BBDxUL80.js";import{f as It,ai as Pt,aX as Dt}from"./CR_t_AVn.js";import"./B1mZq3ve.js";import{c as Q}from"./C2mPABxH.js";import{a as Mt,r as Et}from"./By_-fe-o.js";import{M as Ot,t as Be}from"./CWDPeeaf.js";import{l as Ke,o as St,n as Rt,R as Nt,m as Tt,k as Bt,g as zt,i as jt}from"./DV9nY0bt.js";import{m as ze}from"./BgCTNfXj.js";var Vt=H('<img alt="" class="size-4"/>'),Xt=H('<span class="min-w-0 flex-1 text-left"><span class="block truncate"> </span> <span class="block text-muted-foreground" aria-hidden="true" data-menu-action-reason=""> </span></span>'),Lt=H("<span> </span>"),Ut=H('<span data-menu-action-detail=""> </span>'),Ht=H('<span aria-hidden="true"><!></span>'),Qe=H("<!> <!> <!>",1),Jt=H('<div class="my-1 h-px bg-border" role="separator"></div>'),Me=H("<!> <!>",1),qt=H('<!> <p data-menu-action-note=""> </p>',1),Gt=H('<span class="flex size-4 shrink-0 items-center justify-center" aria-hidden="true"><!></span> <!> <!>',1),Kt=H('<p data-menu-action-note=""> </p>'),Qt=H('<div class="pl-4"><!> <!></div>'),Yt=H('<span class="sr-only"> </span>');function me(be,d){const ke=st();if(new.target)return Ye({component:me,...be});et(d,!0);const Ie=(p,r=Ve)=>{var O=L(),S=y(O);{var V=W=>{const x=w(()=>Mt(r().editor));var X=L(),m=y(X);{var f=s=>{var i=Vt();oe(()=>Ne(i,"src",`data:image/png;base64,${r().editor.iconBase64??""}`)),c(s,i)},o=s=>{var i=L(),b=y(i);Q(b,()=>e(x),(T,ae)=>{ae(T,{size:16})}),c(s,i)},N=s=>{{let i=w(()=>Et(r().editor.category));Re(s,{get icon(){return e(i)},size:16})}};M(m,s=>{r().editor.iconBase64?s(f):e(x)?s(o,1):s(N,-1)})}c(W,X)},R=W=>{var x=L(),X=y(x);xt(X,()=>r().iconSnippet),c(W,x)},q=W=>{{let x=w(()=>r().variant==="destructive"?"text-current":"text-muted-foreground");Re(W,{get icon(){return r().icon},get weight(){return J()},size:16,get class(){return e(x)}})}};M(S,W=>{r().editor?W(V):r().iconSnippet?W(R,1):r().icon&&W(q,2)})}c(p,O)},ne=(p,r=Ve)=>{var O=Qe(),S=y(O);{var V=m=>{var f=Xt(),o=Pe(f),N=_e(o,!0);Te(o,(b,T)=>Be?.(b,T),()=>r().label);var s=U(o,2),i=_e(s,!0);De(f),oe(()=>{de(N,r().label),de(i,r().disabledReason)}),c(m,f)},R=m=>{var f=Lt(),o=_e(f,!0);Te(f,(N,s)=>Be?.(N,s),()=>r().label),oe(()=>{xe(f,1,`min-w-0 truncate text-left ${r().detail?"flex-[1_0_auto]":"flex-1"}`),de(o,r().label)}),c(m,f)};M(S,m=>{r().disabledReason?m(V):m(R,-1)})}var q=U(S,2);{var W=m=>{var f=Ut(),o=_e(f,!0);Te(f,(N,s)=>Be?.(N,s),()=>r().detail),oe(()=>{xe(f,1,`ml-4 min-w-0 truncate ${(r().detailTone==="danger"?"text-danger":ze)??""}`),de(o,r().detail)}),c(m,f)};M(q,m=>{r().detail&&m(W)})}var x=U(q,2);{var X=m=>{var f=Ht(),o=Pe(f);Pt(o,{children:(N,s)=>{it();var i=lt();oe(b=>de(i,b),[()=>Dt(r().shortcut)]),c(N,i)},$$slots:{default:!0}}),De(f),oe(()=>xe(f,1,Ct(E()?"ml-4 flex h-lh shrink-0 items-center":"ml-4"))),c(m,f)};M(x,m=>{r().shortcut&&m(X)})}c(p,O)};let we=h(d,"actions",7),E=h(d,"menu",7),J=h(d,"iconWeight",7),u=h(d,"onClose",7),A=h(d,"selection",7),F=Ee(null);function Y(p){p.disabled||p.disabledReason!==void 0||(p.onClick(),u()?.())}var ce={get actions(){return we()},set actions(p){we(p),v()},get menu(){return E()},set menu(p){E(p),v()},get iconWeight(){return J()},set iconWeight(p){J(p),v()},get onClose(){return u()},set onClose(p){u(p),v()},get selection(){return A()},set selection(p){A(p),v()},$set:Ze,$on:(p,r)=>$e(d,p,r)},se=L(),ie=y(se);return Wt(ie,17,we,p=>p.id,(p,r)=>{const O=i=>{Ie(i,()=>e(r))},S=w(()=>!!(e(r).editor||e(r).iconSnippet||e(r).icon)),V=w(()=>e(r).disabled||e(r).disabledReason!==void 0),R=w(()=>e(r).disabledReason?`${ke}-${e(r).id}-reason`:void 0);var q=Qe(),W=y(q);{var x=i=>{var b=L(),T=y(b);{var ae=a=>{var n=L(),g=y(n);Q(g,()=>Ke,(C,P)=>{P(C,{})}),c(a,n)},ue=a=>{var n=Jt();c(a,n)};M(T,a=>{E()?a(ae):a(ue,-1)})}c(i,b)};M(W,i=>{e(r).dividerBefore&&i(x)})}var X=U(W,2);{var m=i=>{var b=L(),T=y(b);{var ae=g=>{var C=L(),P=y(C);Q(P,()=>Tt,(I,D)=>{D(I,{children:(B,Z)=>{var $=Me(),pe=y($);{let te=w(()=>e(S)?O:void 0);Q(pe,()=>St,(fe,he)=>{he(fe,{get leading(){return e(te)},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},get"data-action-id"(){return e(r).id},children:(ve,ye)=>{ne(ve,()=>e(r))},$$slots:{default:!0}})})}var ee=U(pe,2);{let te=w(()=>e(r).note?`${ke}-${e(r).id}-note`:void 0);Q(ee,()=>Rt,(fe,he)=>{he(fe,{class:"w-60",get"aria-describedby"(){return e(te)},children:(ve,ye)=>{var t=Me(),l=y(t);{var _=re=>{var Ae=Me(),Fe=y(Ae);{let Ce=w(()=>e(r).submenu.find(ge=>ge.checked)?.id??"");Q(Fe,()=>Nt,(ge,Se)=>{Se(ge,{get value(){return e(Ce)},get"aria-label"(){return e(r).label},children:(rt,$t)=>{{let at=w(()=>e(r).submenu.filter(ot=>ot.checked!==void 0));me(rt,{get actions(){return e(at)},selection:"single",get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}})}},$$slots:{default:!0}})})}var We=U(Fe,2);{let Ce=w(()=>e(r).submenu.filter(ge=>ge.checked===void 0));me(We,{get actions(){return e(Ce)},get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}})}c(re,Ae)},z=re=>{me(re,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}})};M(l,re=>{e(r).selection==="single"?re(_):re(z,-1)})}var le=U(l,2);{var Oe=re=>{var Ae=qt(),Fe=y(Ae);Q(Fe,()=>Ke,(ge,Se)=>{Se(ge,{})});var We=U(Fe,2),Ce=_e(We,!0);oe(()=>{Ne(We,"id",`${ke}-${e(r).id}-note`),xe(We,1,`type-caption px-2 py-1 ${ze}`),de(Ce,e(r).note)}),c(re,Ae)};M(le,re=>{e(r).note&&re(Oe)})}c(ve,t)},$$slots:{default:!0}})})}c(B,$)},$$slots:{default:!0}})}),c(g,C)},ue=g=>{var C=L(),P=y(C);{let I=w(()=>e(S)?O:void 0);Q(P,()=>Bt,(D,B)=>{B(D,{get leading(){return e(I)},get value(){return e(r).id},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},closeOnSelect:!0,onSelect:()=>Y(e(r)),get"data-action-id"(){return e(r).id},children:(Z,$)=>{ne(Z,()=>e(r))},$$slots:{default:!0}})})}c(g,C)},a=g=>{var C=L(),P=y(C);{let I=w(()=>e(S)?O:void 0);Q(P,()=>zt,(D,B)=>{B(D,{get leading(){return e(I)},get checked(){return e(r).checked},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},closeOnSelect:!0,onSelect:()=>Y(e(r)),get"data-action-id"(){return e(r).id},children:(Z,$)=>{ne(Z,()=>e(r))},$$slots:{default:!0}})})}c(g,C)},n=g=>{var C=L(),P=y(C);{let I=w(()=>e(S)?O:void 0),D=w(()=>e(r).variant==="destructive");Q(P,()=>jt,(B,Z)=>{Z(B,{get leading(){return e(I)},get destructive(){return e(D)},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},onSelect:()=>Y(e(r)),get"data-action-id"(){return e(r).id},children:($,pe)=>{ne($,()=>e(r))},$$slots:{default:!0}})})}c(g,C)};M(T,g=>{e(r).submenu?g(ae):A()==="single"&&e(r).checked!==void 0?g(ue,1):e(r).checked!==void 0?g(a,2):g(n,-1)})}c(i,b)},f=i=>{me(i,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}})},o=i=>{var b=Me(),T=y(b);{let a=w(()=>e(r).variant==="destructive"?"text-danger hover:text-danger":""),n=w(()=>e(r).submenu?e(F)===e(r).id:void 0);It(T,{variant:"ghost",size:"sm",get class(){return`w-full justify-start gap-2 ${e(a)??""}`},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},get"aria-expanded"(){return e(n)},onclick:()=>e(r).submenu?j(F,e(F)===e(r).id?null:e(r).id,!0):Y(e(r)),children:(g,C)=>{var P=Gt(),I=y(P),D=Pe(I);Ie(D,()=>e(r)),De(I);var B=U(I,2);ne(B,()=>e(r));var Z=U(B,2);{var $=ee=>{{let te=w(()=>e(F)===e(r).id?bt:kt);Re(ee,{get icon(){return e(te)},size:12})}},pe=ee=>{var te=L(),fe=y(te);{let he=w(()=>e(r).checked?"checked":"empty");Q(fe,()=>Ot,(ve,ye)=>{ye(ve,{get state(){return e(he)}})})}c(ee,te)};M(Z,ee=>{e(r).submenu?ee($):e(r).checked!==void 0&&ee(pe,1)})}c(g,P)},$$slots:{default:!0}})}var ae=U(T,2);{var ue=a=>{var n=Qt(),g=Pe(n);me(g,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}});var C=U(g,2);{var P=I=>{var D=Kt(),B=_e(D,!0);oe(()=>{xe(D,1,`type-caption px-2 py-1 ${ze}`),de(B,e(r).note)}),c(I,D)};M(C,I=>{e(r).note&&I(P)})}De(n),c(a,n)};M(ae,a=>{e(r).submenu&&e(F)===e(r).id&&a(ue)})}c(i,b)};M(X,i=>{E()?i(m):e(r).id==="open-in"&&e(r).submenu?i(f,1):i(o,-1)})}var N=U(X,2);{var s=i=>{var b=Yt(),T=_e(b,!0);oe(()=>{Ne(b,"id",e(R)),de(T,e(r).disabledReason)}),c(i,b)};M(N,i=>{e(r).disabledReason&&i(s)})}c(p,q)}),c(be,se),tt(ce)}function Zt(be,d){if(new.target)return Ye({component:Zt,...be});et(d,!0);const ke=()=>je(T,"$installedEditors$",ne),Ie=()=>je(ue,"$isWorkspaceHostLocal$",ne),[ne,we]=nt();let E=h(d,"layout",7,"list"),J=h(d,"iconWeight",7),u=h(d,"filePath",7,""),A=h(d,"workspaceId",7,""),F=h(d,"isDirectory",7,!0),Y=h(d,"onDelete",7,void 0),ce=h(d,"onArchive",7,void 0),se=h(d,"onUnarchive",7,void 0),ie=h(d,"isArchived",7,!1),p=h(d,"onClose",7,void 0),r=h(d,"showDeleteOption",7,!0),O=h(d,"showArchiveOption",7,!1),S=h(d,"showPathCopy",7,!0),V=h(d,"showFileNameCopy",7,!1),R=h(d,"showFileActions",7,!0),q=h(d,"workspaceFolderPath",7,""),W=h(d,"isDiff",7,!1),x=h(d,"isWorkspaceRoot",7,!1),X=h(d,"additionalActions",23,()=>[]),m=h(d,"showDeleteFileOption",7,!1),f=h(d,"onFileDeleted",7,void 0);const o=gt("WorkspaceActionsMenu");let N=!1;dt(()=>{N=!0});function s(){N||p()?.()}const i=_t("externalEditors"),b=ct(A());Xe(()=>{b.set(A())});const T=ht(b),ae=w(ke),ue=vt(b);let a=Ee(""),n=Ee(""),g=Ee(!1);ut(()=>{Le.dispatch(pt())}),Xe(()=>{u()&&A()?G("workspace:get",{id:A()}).then(t=>{if(t&&t.success&&t.data){const l=t.data,_=l.worktreePath||l.repositoryPath||l.path,z=q()==="__WORKSPACE_ROOT__"?_:q()||_;if(z){const le=z.replace(/\\/g,"/");x()?j(a,le,!0):Ue(u())?j(a,u().replace(/\\/g,"/"),!0):j(a,`${le}/${u()}`.replace(/\/+/g,"/"),!0),j(n,le,!0),o.info("[WorkspaceActionsMenu] Resolved file path:",{filePath:u(),workspacePath:z,resolvedPath:e(a)})}else j(a,u()),j(n,""),l.status!=="archived"&&l.status!=="deleted"&&o.warn("[WorkspaceActionsMenu] No workspace path found:",l)}else j(a,u()),j(n,""),t?.error&&!t.error.includes("not found")&&o.warn("[WorkspaceActionsMenu] Workspace not available:",t)}).catch(t=>{j(a,u()),j(n,""),t?.message?.includes("not found")||o.error("[WorkspaceActionsMenu] Failed to resolve path:",t)}):(j(a,u()),o.info("[WorkspaceActionsMenu] Using filePath directly:",{filePath:u(),workspaceId:A()}))});async function C(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for VSCode");return}try{if(W()&&!F()){o.info("[WorkspaceActionsMenu] Opening diff in VSCode:",{resolvedPath:e(a)}),await G("vscode:open-git-diff",{filePath:e(a),workspacePath:e(n)||void 0}),s();return}let t=e(a);if(e(n))!F()&&!x()?t={folder:e(n),file:e(a)}:t=e(n);else if(!F()){const l=e(a).includes("\\")?"\\":"/",_=e(a).split(l);_.length>1&&(t={folder:_.slice(0,-1).join(l),file:e(a)})}await G("vscode:open",t),s()}catch(t){o.error("Failed to open in VSCode:",t),K.error(t instanceof Error?t.message:k.ui_workspaceActions_openFailed_error({name:"VS Code"}))}}async function P(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for JetBrains");return}try{let t=e(a);e(n)&&!F()?t={folder:e(n),file:e(a)}:e(n)&&(t=e(n)),await G("jetbrains:open",t),s()}catch(t){o.error("Failed to open in JetBrains:",t),K.error(t instanceof Error?t.message:k.ui_workspaceActions_openFailed_error({name:"JetBrains"}))}}async function I(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for Xcode");return}try{if(A()&&e(n)){Le.dispatch(ft(A(),e(n),F()?void 0:e(a))),s();return}let t=e(a);e(n)&&!F()?t={folder:e(n),file:e(a)}:e(n)&&(t={folder:e(n)}),await G("xcode:open",t),s()}catch(t){o.error("Failed to open in Xcode:",t),K.error(t instanceof Error?t.message:k.ui_workspaceActions_openFailed_error({name:"Xcode"}))}}async function D(t){if(o.info("[WorkspaceActionsMenu] openInEditor called",{editorId:t.id,appName:t.appName,handlerType:t.handlerType,resolvedPath:e(a),isDirectory:F()}),!e(a)){o.warn("[WorkspaceActionsMenu] openInEditor: No resolved path, aborting");return}const l=F()?e(a):e(a).substring(0,e(a).lastIndexOf("/"));o.info(`[WorkspaceActionsMenu] openInEditor: targetPath=${l}, handlerType=${t.handlerType}`);try{switch(t.handlerType){case"finder":o.info("[WorkspaceActionsMenu] openInEditor: Invoking shell:showItemInFolder"),await G("shell:showItemInFolder",{path:l});break;case"vscode":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInVSCode"),await C();return;case"jetbrains":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInJetBrains"),await P();return;case"xcode":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInXcode"),await I();return;case"generic":default:{o.info(`[WorkspaceActionsMenu] openInEditor: Invoking external-editors:open for ${t.id}`);const _=await G("external-editors:open",{editorId:t.id,path:l});o.info("[WorkspaceActionsMenu] openInEditor: external-editors:open result",_);break}}s()}catch(_){o.error(`[WorkspaceActionsMenu] Failed to open in ${t.appName}:`,_),K.error(_ instanceof Error?_.message:k.ui_workspaceActions_openFailed_error({name:t.appName}))}}async function B(){if(!e(a)){o.warn("No resolved path for openWithOther");return}try{let t=e(a);F()&&e(n)&&(t=e(n));const l=await G("external-editors:open-with-other",{path:t});if(!l?.success){l?.error!=="No application selected"&&(o.error("Failed to open with other app:",l?.error),K.error(l?.error||k.ui_workspaceActions_openOtherFailed_error()));return}s()}catch(t){o.error("Failed to open with other app:",t),K.error(t instanceof Error?t.message:k.ui_workspaceActions_openOtherFailed_error())}}async function Z(){if(e(a))try{await navigator.clipboard.writeText(He(e(a))),s()}catch(t){o.error("Failed to copy path:",t)}}async function $(){if(u())try{let t=u().replace(/\\/g,"/");if(Ue(u())&&e(n)){const l=e(n).endsWith("/")?e(n):e(n)+"/";t.startsWith(l)&&(t=t.slice(l.length))}await navigator.clipboard.writeText(He(t)),s()}catch(t){o.error("Failed to copy workspace path:",t)}}async function pe(){if(u())try{const t=u().split(/[/\\]/).pop()||"";await navigator.clipboard.writeText(t),s()}catch(t){o.error("Failed to copy file name:",t)}}function ee(){Y()&&(Y()(),s())}async function te(){if(!(!A()||!e(a)||e(g))){j(g,!0);try{const t=u().split(/[/\\]/).pop()||"file",l=e(a);let _="";try{_=(await G("file:read",{path:l,workspaceId:A()}))?.data?.content??""}catch{}const z=await G("file:delete",{path:l,workspaceId:A()});if(z?.success){f()?.(),s();const le=K.warning(k.ui_workspaceActions_deletedFile_label({name:t}),Ft({duration:15e3,action:{label:k.ui_workspaceActions_undo_label(),onClick:async()=>{try{await G("file:write",{path:l,content:_,workspaceId:A()}),mt("file:changed",{workspaceId:A(),type:"create",filePath:l}),K.dismiss(le)}catch(Oe){o.error("[WorkspaceActionsMenu] Failed to restore file",Oe),K.error(k.ui_workspaceActions_restoreFileFailed_error())}}}}))}else K.error(k.ui_workspaceActions_deleteFileFailedDetail_error({error:z?.error||k.ui_workspaceActions_unknown_error()}))}catch(t){o.error("[WorkspaceActionsMenu] Error deleting file",t),K.error(k.ui_workspaceActions_deleteFileFailed_error())}finally{j(g,!1)}}}function fe(){ie()&&se()?(se()(),s()):!ie()&&ce()&&(ce()(),s())}const he=w(()=>{const t=[];R()&&(i&&Ie()&&t.push({id:"open-in",label:k.ui_openCombo_openInApp_tooltip(),icon:Je,onClick:()=>{},submenu:[...e(ae).map(_=>({id:`editor:${_.id}`,label:k.ui_workspaceActions_openIn_label({name:_.name}),editor:_,onClick:()=>{D(_)}})),{id:"choose-app",label:k.ui_workspaceActions_chooseApp_label(),icon:Je,onClick:()=>{B()}}]}),S()&&t.push({id:"copy-absolute-path",label:k.ui_workspaceActions_copyAbsolutePath_label(),icon:qe,disabled:!e(a),dividerBefore:t.length>0,onClick:()=>{Z()}}),S()&&!x()&&t.push({id:"copy-relative-path",label:k.ui_workspaceActions_copyRelativePath_label(),icon:qe,disabled:!u(),onClick:()=>{$()}}),V()&&!F()&&t.push({id:"copy-file-name",label:k.ui_workspaceActions_copyFileName_label(),icon:wt,disabled:!u(),onClick:()=>{pe()}}));const l=_=>_.map(z=>({...z,submenu:z.submenu?l(z.submenu):void 0,onClick:()=>{z.onClick(),s()}}));return t.push(...l(X())),O()&&(ce()||se())&&t.push({id:"archive-workspace",label:ie()?k.ui_workspaceActions_unarchiveSpace_label():k.ui_workspaceActions_archiveSpace_label(),icon:ie()?yt:At,dividerBefore:t.length>0,onClick:fe}),r()&&Y()&&t.push({id:"delete-workspace",label:k.ui_workspaceActions_deleteSpace_label(),icon:Ge,variant:"destructive",dividerBefore:t.length>0&&t.at(-1)?.id!=="archive-workspace",onClick:ee}),m()&&!F()&&t.push({id:"delete-file",label:k.ui_workspaceActions_deleteFile_label(),icon:Ge,variant:"destructive",disabled:e(g)||!e(a)||!A(),dividerBefore:t.length>0,onClick:()=>{te()}}),t});var ve={get layout(){return E()},set layout(t="list"){E(t),v()},get iconWeight(){return J()},set iconWeight(t){J(t),v()},get filePath(){return u()},set filePath(t=""){u(t),v()},get workspaceId(){return A()},set workspaceId(t=""){A(t),v()},get isDirectory(){return F()},set isDirectory(t=!0){F(t),v()},get onDelete(){return Y()},set onDelete(t=void 0){Y(t),v()},get onArchive(){return ce()},set onArchive(t=void 0){ce(t),v()},get onUnarchive(){return se()},set onUnarchive(t=void 0){se(t),v()},get isArchived(){return ie()},set isArchived(t=!1){ie(t),v()},get onClose(){return p()},set onClose(t=void 0){p(t),v()},get showDeleteOption(){return r()},set showDeleteOption(t=!0){r(t),v()},get showArchiveOption(){return O()},set showArchiveOption(t=!1){O(t),v()},get showPathCopy(){return S()},set showPathCopy(t=!0){S(t),v()},get showFileNameCopy(){return V()},set showFileNameCopy(t=!1){V(t),v()},get showFileActions(){return R()},set showFileActions(t=!0){R(t),v()},get workspaceFolderPath(){return q()},set workspaceFolderPath(t=""){q(t),v()},get isDiff(){return W()},set isDiff(t=!1){W(t),v()},get isWorkspaceRoot(){return x()},set isWorkspaceRoot(t=!1){x(t),v()},get additionalActions(){return X()},set additionalActions(t=[]){X(t),v()},get showDeleteFileOption(){return m()},set showDeleteFileOption(t=!1){m(t),v()},get onFileDeleted(){return f()},set onFileDeleted(t=void 0){f(t),v()},$set:Ze,$on:(t,l)=>$e(d,t,l)};{let t=w(()=>E()!=="list");me(be,{get actions(){return e(he)},get menu(){return e(t)},get iconWeight(){return J()}})}var ye=tt(ve);return we(),ye}export{Zt as default};
1
+ import{t as Ye,br as h,a_ as M,bz as Ze,b as $e,bt as nt,bp as k,bv as je}from"./O1QHAURn.js";import{bo as st,bs as et,a7 as L,ay as y,aD as e,bS as U,W as c,a5 as Pe,bA as De,bH as j,bl as _e,b_ as oe,bO as de,bn as tt,bf as Ve,bV as Ee,aA as v,c9 as w,aB as H,be as it,b$ as lt,bj as dt,cd as ct,ca as Xe,bk as ut}from"./DYhIMPy1.js";import{i as G}from"./RoOfSbrC.js";import{Ix as Le,mT as pt,uB as ft}from"./DNqM68dO.js";import{b8 as ht}from"./B8g9F0km.js";import{cn as vt}from"./VZEkDWIM.js";import{c as gt}from"./ChTqQfQN.js";import{i as Ue,t as He}from"./H2jLkRRS.js";import{w as _t}from"./CovkQMd0.js";import{d as mt}from"./B0Z-1lwJ.js";import{F as Re,as as bt,at as kt,cQ as Je,aV as qe,bc as wt,ak as yt,aj as At,cN as Ge}from"./B0f-om7y.js";import{k as K,w as Ft}from"./B6kyqBFl.js";import{n as Wt,u as Ne,v as xe,g as Te,j as Ct}from"./CAyg2ijY.js";import{s as xt}from"./BBDxUL80.js";import{f as It,ai as Pt,aX as Dt}from"./CR_t_AVn.js";import"./B1mZq3ve.js";import{c as Q}from"./C2mPABxH.js";import{a as Mt,r as Et}from"./EYLa5b66.js";import{M as Ot,t as Be}from"./CWDPeeaf.js";import{l as Ke,o as St,n as Rt,R as Nt,m as Tt,k as Bt,g as zt,i as jt}from"./DV9nY0bt.js";import{m as ze}from"./BgCTNfXj.js";var Vt=H('<img alt="" class="size-4"/>'),Xt=H('<span class="min-w-0 flex-1 text-left"><span class="block truncate"> </span> <span class="block text-muted-foreground" aria-hidden="true" data-menu-action-reason=""> </span></span>'),Lt=H("<span> </span>"),Ut=H('<span data-menu-action-detail=""> </span>'),Ht=H('<span aria-hidden="true"><!></span>'),Qe=H("<!> <!> <!>",1),Jt=H('<div class="my-1 h-px bg-border" role="separator"></div>'),Me=H("<!> <!>",1),qt=H('<!> <p data-menu-action-note=""> </p>',1),Gt=H('<span class="flex size-4 shrink-0 items-center justify-center" aria-hidden="true"><!></span> <!> <!>',1),Kt=H('<p data-menu-action-note=""> </p>'),Qt=H('<div class="pl-4"><!> <!></div>'),Yt=H('<span class="sr-only"> </span>');function me(be,d){const ke=st();if(new.target)return Ye({component:me,...be});et(d,!0);const Ie=(p,r=Ve)=>{var O=L(),S=y(O);{var V=W=>{const x=w(()=>Mt(r().editor));var X=L(),m=y(X);{var f=s=>{var i=Vt();oe(()=>Ne(i,"src",`data:image/png;base64,${r().editor.iconBase64??""}`)),c(s,i)},o=s=>{var i=L(),b=y(i);Q(b,()=>e(x),(T,ae)=>{ae(T,{size:16})}),c(s,i)},N=s=>{{let i=w(()=>Et(r().editor.category));Re(s,{get icon(){return e(i)},size:16})}};M(m,s=>{r().editor.iconBase64?s(f):e(x)?s(o,1):s(N,-1)})}c(W,X)},R=W=>{var x=L(),X=y(x);xt(X,()=>r().iconSnippet),c(W,x)},q=W=>{{let x=w(()=>r().variant==="destructive"?"text-current":"text-muted-foreground");Re(W,{get icon(){return r().icon},get weight(){return J()},size:16,get class(){return e(x)}})}};M(S,W=>{r().editor?W(V):r().iconSnippet?W(R,1):r().icon&&W(q,2)})}c(p,O)},ne=(p,r=Ve)=>{var O=Qe(),S=y(O);{var V=m=>{var f=Xt(),o=Pe(f),N=_e(o,!0);Te(o,(b,T)=>Be?.(b,T),()=>r().label);var s=U(o,2),i=_e(s,!0);De(f),oe(()=>{de(N,r().label),de(i,r().disabledReason)}),c(m,f)},R=m=>{var f=Lt(),o=_e(f,!0);Te(f,(N,s)=>Be?.(N,s),()=>r().label),oe(()=>{xe(f,1,`min-w-0 truncate text-left ${r().detail?"flex-[1_0_auto]":"flex-1"}`),de(o,r().label)}),c(m,f)};M(S,m=>{r().disabledReason?m(V):m(R,-1)})}var q=U(S,2);{var W=m=>{var f=Ut(),o=_e(f,!0);Te(f,(N,s)=>Be?.(N,s),()=>r().detail),oe(()=>{xe(f,1,`ml-4 min-w-0 truncate ${(r().detailTone==="danger"?"text-danger":ze)??""}`),de(o,r().detail)}),c(m,f)};M(q,m=>{r().detail&&m(W)})}var x=U(q,2);{var X=m=>{var f=Ht(),o=Pe(f);Pt(o,{children:(N,s)=>{it();var i=lt();oe(b=>de(i,b),[()=>Dt(r().shortcut)]),c(N,i)},$$slots:{default:!0}}),De(f),oe(()=>xe(f,1,Ct(E()?"ml-4 flex h-lh shrink-0 items-center":"ml-4"))),c(m,f)};M(x,m=>{r().shortcut&&m(X)})}c(p,O)};let we=h(d,"actions",7),E=h(d,"menu",7),J=h(d,"iconWeight",7),u=h(d,"onClose",7),A=h(d,"selection",7),F=Ee(null);function Y(p){p.disabled||p.disabledReason!==void 0||(p.onClick(),u()?.())}var ce={get actions(){return we()},set actions(p){we(p),v()},get menu(){return E()},set menu(p){E(p),v()},get iconWeight(){return J()},set iconWeight(p){J(p),v()},get onClose(){return u()},set onClose(p){u(p),v()},get selection(){return A()},set selection(p){A(p),v()},$set:Ze,$on:(p,r)=>$e(d,p,r)},se=L(),ie=y(se);return Wt(ie,17,we,p=>p.id,(p,r)=>{const O=i=>{Ie(i,()=>e(r))},S=w(()=>!!(e(r).editor||e(r).iconSnippet||e(r).icon)),V=w(()=>e(r).disabled||e(r).disabledReason!==void 0),R=w(()=>e(r).disabledReason?`${ke}-${e(r).id}-reason`:void 0);var q=Qe(),W=y(q);{var x=i=>{var b=L(),T=y(b);{var ae=a=>{var n=L(),g=y(n);Q(g,()=>Ke,(C,P)=>{P(C,{})}),c(a,n)},ue=a=>{var n=Jt();c(a,n)};M(T,a=>{E()?a(ae):a(ue,-1)})}c(i,b)};M(W,i=>{e(r).dividerBefore&&i(x)})}var X=U(W,2);{var m=i=>{var b=L(),T=y(b);{var ae=g=>{var C=L(),P=y(C);Q(P,()=>Tt,(I,D)=>{D(I,{children:(B,Z)=>{var $=Me(),pe=y($);{let te=w(()=>e(S)?O:void 0);Q(pe,()=>St,(fe,he)=>{he(fe,{get leading(){return e(te)},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},get"data-action-id"(){return e(r).id},children:(ve,ye)=>{ne(ve,()=>e(r))},$$slots:{default:!0}})})}var ee=U(pe,2);{let te=w(()=>e(r).note?`${ke}-${e(r).id}-note`:void 0);Q(ee,()=>Rt,(fe,he)=>{he(fe,{class:"w-60",get"aria-describedby"(){return e(te)},children:(ve,ye)=>{var t=Me(),l=y(t);{var _=re=>{var Ae=Me(),Fe=y(Ae);{let Ce=w(()=>e(r).submenu.find(ge=>ge.checked)?.id??"");Q(Fe,()=>Nt,(ge,Se)=>{Se(ge,{get value(){return e(Ce)},get"aria-label"(){return e(r).label},children:(rt,$t)=>{{let at=w(()=>e(r).submenu.filter(ot=>ot.checked!==void 0));me(rt,{get actions(){return e(at)},selection:"single",get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}})}},$$slots:{default:!0}})})}var We=U(Fe,2);{let Ce=w(()=>e(r).submenu.filter(ge=>ge.checked===void 0));me(We,{get actions(){return e(Ce)},get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}})}c(re,Ae)},z=re=>{me(re,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}})};M(l,re=>{e(r).selection==="single"?re(_):re(z,-1)})}var le=U(l,2);{var Oe=re=>{var Ae=qt(),Fe=y(Ae);Q(Fe,()=>Ke,(ge,Se)=>{Se(ge,{})});var We=U(Fe,2),Ce=_e(We,!0);oe(()=>{Ne(We,"id",`${ke}-${e(r).id}-note`),xe(We,1,`type-caption px-2 py-1 ${ze}`),de(Ce,e(r).note)}),c(re,Ae)};M(le,re=>{e(r).note&&re(Oe)})}c(ve,t)},$$slots:{default:!0}})})}c(B,$)},$$slots:{default:!0}})}),c(g,C)},ue=g=>{var C=L(),P=y(C);{let I=w(()=>e(S)?O:void 0);Q(P,()=>Bt,(D,B)=>{B(D,{get leading(){return e(I)},get value(){return e(r).id},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},closeOnSelect:!0,onSelect:()=>Y(e(r)),get"data-action-id"(){return e(r).id},children:(Z,$)=>{ne(Z,()=>e(r))},$$slots:{default:!0}})})}c(g,C)},a=g=>{var C=L(),P=y(C);{let I=w(()=>e(S)?O:void 0);Q(P,()=>zt,(D,B)=>{B(D,{get leading(){return e(I)},get checked(){return e(r).checked},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},closeOnSelect:!0,onSelect:()=>Y(e(r)),get"data-action-id"(){return e(r).id},children:(Z,$)=>{ne(Z,()=>e(r))},$$slots:{default:!0}})})}c(g,C)},n=g=>{var C=L(),P=y(C);{let I=w(()=>e(S)?O:void 0),D=w(()=>e(r).variant==="destructive");Q(P,()=>jt,(B,Z)=>{Z(B,{get leading(){return e(I)},get destructive(){return e(D)},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},onSelect:()=>Y(e(r)),get"data-action-id"(){return e(r).id},children:($,pe)=>{ne($,()=>e(r))},$$slots:{default:!0}})})}c(g,C)};M(T,g=>{e(r).submenu?g(ae):A()==="single"&&e(r).checked!==void 0?g(ue,1):e(r).checked!==void 0?g(a,2):g(n,-1)})}c(i,b)},f=i=>{me(i,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}})},o=i=>{var b=Me(),T=y(b);{let a=w(()=>e(r).variant==="destructive"?"text-danger hover:text-danger":""),n=w(()=>e(r).submenu?e(F)===e(r).id:void 0);It(T,{variant:"ghost",size:"sm",get class(){return`w-full justify-start gap-2 ${e(a)??""}`},get disabled(){return e(V)},get"aria-describedby"(){return e(R)},get"aria-expanded"(){return e(n)},onclick:()=>e(r).submenu?j(F,e(F)===e(r).id?null:e(r).id,!0):Y(e(r)),children:(g,C)=>{var P=Gt(),I=y(P),D=Pe(I);Ie(D,()=>e(r)),De(I);var B=U(I,2);ne(B,()=>e(r));var Z=U(B,2);{var $=ee=>{{let te=w(()=>e(F)===e(r).id?bt:kt);Re(ee,{get icon(){return e(te)},size:12})}},pe=ee=>{var te=L(),fe=y(te);{let he=w(()=>e(r).checked?"checked":"empty");Q(fe,()=>Ot,(ve,ye)=>{ye(ve,{get state(){return e(he)}})})}c(ee,te)};M(Z,ee=>{e(r).submenu?ee($):e(r).checked!==void 0&&ee(pe,1)})}c(g,P)},$$slots:{default:!0}})}var ae=U(T,2);{var ue=a=>{var n=Qt(),g=Pe(n);me(g,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return J()},get onClose(){return u()}});var C=U(g,2);{var P=I=>{var D=Kt(),B=_e(D,!0);oe(()=>{xe(D,1,`type-caption px-2 py-1 ${ze}`),de(B,e(r).note)}),c(I,D)};M(C,I=>{e(r).note&&I(P)})}De(n),c(a,n)};M(ae,a=>{e(r).submenu&&e(F)===e(r).id&&a(ue)})}c(i,b)};M(X,i=>{E()?i(m):e(r).id==="open-in"&&e(r).submenu?i(f,1):i(o,-1)})}var N=U(X,2);{var s=i=>{var b=Yt(),T=_e(b,!0);oe(()=>{Ne(b,"id",e(R)),de(T,e(r).disabledReason)}),c(i,b)};M(N,i=>{e(r).disabledReason&&i(s)})}c(p,q)}),c(be,se),tt(ce)}function Zt(be,d){if(new.target)return Ye({component:Zt,...be});et(d,!0);const ke=()=>je(T,"$installedEditors$",ne),Ie=()=>je(ue,"$isWorkspaceHostLocal$",ne),[ne,we]=nt();let E=h(d,"layout",7,"list"),J=h(d,"iconWeight",7),u=h(d,"filePath",7,""),A=h(d,"workspaceId",7,""),F=h(d,"isDirectory",7,!0),Y=h(d,"onDelete",7,void 0),ce=h(d,"onArchive",7,void 0),se=h(d,"onUnarchive",7,void 0),ie=h(d,"isArchived",7,!1),p=h(d,"onClose",7,void 0),r=h(d,"showDeleteOption",7,!0),O=h(d,"showArchiveOption",7,!1),S=h(d,"showPathCopy",7,!0),V=h(d,"showFileNameCopy",7,!1),R=h(d,"showFileActions",7,!0),q=h(d,"workspaceFolderPath",7,""),W=h(d,"isDiff",7,!1),x=h(d,"isWorkspaceRoot",7,!1),X=h(d,"additionalActions",23,()=>[]),m=h(d,"showDeleteFileOption",7,!1),f=h(d,"onFileDeleted",7,void 0);const o=gt("WorkspaceActionsMenu");let N=!1;dt(()=>{N=!0});function s(){N||p()?.()}const i=_t("externalEditors"),b=ct(A());Xe(()=>{b.set(A())});const T=ht(b),ae=w(ke),ue=vt(b);let a=Ee(""),n=Ee(""),g=Ee(!1);ut(()=>{Le.dispatch(pt())}),Xe(()=>{u()&&A()?G("workspace:get",{id:A()}).then(t=>{if(t&&t.success&&t.data){const l=t.data,_=l.worktreePath||l.repositoryPath||l.path,z=q()==="__WORKSPACE_ROOT__"?_:q()||_;if(z){const le=z.replace(/\\/g,"/");x()?j(a,le,!0):Ue(u())?j(a,u().replace(/\\/g,"/"),!0):j(a,`${le}/${u()}`.replace(/\/+/g,"/"),!0),j(n,le,!0),o.info("[WorkspaceActionsMenu] Resolved file path:",{filePath:u(),workspacePath:z,resolvedPath:e(a)})}else j(a,u()),j(n,""),l.status!=="archived"&&l.status!=="deleted"&&o.warn("[WorkspaceActionsMenu] No workspace path found:",l)}else j(a,u()),j(n,""),t?.error&&!t.error.includes("not found")&&o.warn("[WorkspaceActionsMenu] Workspace not available:",t)}).catch(t=>{j(a,u()),j(n,""),t?.message?.includes("not found")||o.error("[WorkspaceActionsMenu] Failed to resolve path:",t)}):(j(a,u()),o.info("[WorkspaceActionsMenu] Using filePath directly:",{filePath:u(),workspaceId:A()}))});async function C(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for VSCode");return}try{if(W()&&!F()){o.info("[WorkspaceActionsMenu] Opening diff in VSCode:",{resolvedPath:e(a)}),await G("vscode:open-git-diff",{filePath:e(a),workspacePath:e(n)||void 0}),s();return}let t=e(a);if(e(n))!F()&&!x()?t={folder:e(n),file:e(a)}:t=e(n);else if(!F()){const l=e(a).includes("\\")?"\\":"/",_=e(a).split(l);_.length>1&&(t={folder:_.slice(0,-1).join(l),file:e(a)})}await G("vscode:open",t),s()}catch(t){o.error("Failed to open in VSCode:",t),K.error(t instanceof Error?t.message:k.ui_workspaceActions_openFailed_error({name:"VS Code"}))}}async function P(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for JetBrains");return}try{let t=e(a);e(n)&&!F()?t={folder:e(n),file:e(a)}:e(n)&&(t=e(n)),await G("jetbrains:open",t),s()}catch(t){o.error("Failed to open in JetBrains:",t),K.error(t instanceof Error?t.message:k.ui_workspaceActions_openFailed_error({name:"JetBrains"}))}}async function I(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for Xcode");return}try{if(A()&&e(n)){Le.dispatch(ft(A(),e(n),F()?void 0:e(a))),s();return}let t=e(a);e(n)&&!F()?t={folder:e(n),file:e(a)}:e(n)&&(t={folder:e(n)}),await G("xcode:open",t),s()}catch(t){o.error("Failed to open in Xcode:",t),K.error(t instanceof Error?t.message:k.ui_workspaceActions_openFailed_error({name:"Xcode"}))}}async function D(t){if(o.info("[WorkspaceActionsMenu] openInEditor called",{editorId:t.id,appName:t.appName,handlerType:t.handlerType,resolvedPath:e(a),isDirectory:F()}),!e(a)){o.warn("[WorkspaceActionsMenu] openInEditor: No resolved path, aborting");return}const l=F()?e(a):e(a).substring(0,e(a).lastIndexOf("/"));o.info(`[WorkspaceActionsMenu] openInEditor: targetPath=${l}, handlerType=${t.handlerType}`);try{switch(t.handlerType){case"finder":o.info("[WorkspaceActionsMenu] openInEditor: Invoking shell:showItemInFolder"),await G("shell:showItemInFolder",{path:l});break;case"vscode":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInVSCode"),await C();return;case"jetbrains":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInJetBrains"),await P();return;case"xcode":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInXcode"),await I();return;case"generic":default:{o.info(`[WorkspaceActionsMenu] openInEditor: Invoking external-editors:open for ${t.id}`);const _=await G("external-editors:open",{editorId:t.id,path:l});o.info("[WorkspaceActionsMenu] openInEditor: external-editors:open result",_);break}}s()}catch(_){o.error(`[WorkspaceActionsMenu] Failed to open in ${t.appName}:`,_),K.error(_ instanceof Error?_.message:k.ui_workspaceActions_openFailed_error({name:t.appName}))}}async function B(){if(!e(a)){o.warn("No resolved path for openWithOther");return}try{let t=e(a);F()&&e(n)&&(t=e(n));const l=await G("external-editors:open-with-other",{path:t});if(!l?.success){l?.error!=="No application selected"&&(o.error("Failed to open with other app:",l?.error),K.error(l?.error||k.ui_workspaceActions_openOtherFailed_error()));return}s()}catch(t){o.error("Failed to open with other app:",t),K.error(t instanceof Error?t.message:k.ui_workspaceActions_openOtherFailed_error())}}async function Z(){if(e(a))try{await navigator.clipboard.writeText(He(e(a))),s()}catch(t){o.error("Failed to copy path:",t)}}async function $(){if(u())try{let t=u().replace(/\\/g,"/");if(Ue(u())&&e(n)){const l=e(n).endsWith("/")?e(n):e(n)+"/";t.startsWith(l)&&(t=t.slice(l.length))}await navigator.clipboard.writeText(He(t)),s()}catch(t){o.error("Failed to copy workspace path:",t)}}async function pe(){if(u())try{const t=u().split(/[/\\]/).pop()||"";await navigator.clipboard.writeText(t),s()}catch(t){o.error("Failed to copy file name:",t)}}function ee(){Y()&&(Y()(),s())}async function te(){if(!(!A()||!e(a)||e(g))){j(g,!0);try{const t=u().split(/[/\\]/).pop()||"file",l=e(a);let _="";try{_=(await G("file:read",{path:l,workspaceId:A()}))?.data?.content??""}catch{}const z=await G("file:delete",{path:l,workspaceId:A()});if(z?.success){f()?.(),s();const le=K.warning(k.ui_workspaceActions_deletedFile_label({name:t}),Ft({duration:15e3,action:{label:k.ui_workspaceActions_undo_label(),onClick:async()=>{try{await G("file:write",{path:l,content:_,workspaceId:A()}),mt("file:changed",{workspaceId:A(),type:"create",filePath:l}),K.dismiss(le)}catch(Oe){o.error("[WorkspaceActionsMenu] Failed to restore file",Oe),K.error(k.ui_workspaceActions_restoreFileFailed_error())}}}}))}else K.error(k.ui_workspaceActions_deleteFileFailedDetail_error({error:z?.error||k.ui_workspaceActions_unknown_error()}))}catch(t){o.error("[WorkspaceActionsMenu] Error deleting file",t),K.error(k.ui_workspaceActions_deleteFileFailed_error())}finally{j(g,!1)}}}function fe(){ie()&&se()?(se()(),s()):!ie()&&ce()&&(ce()(),s())}const he=w(()=>{const t=[];R()&&(i&&Ie()&&t.push({id:"open-in",label:k.ui_openCombo_openInApp_tooltip(),icon:Je,onClick:()=>{},submenu:[...e(ae).map(_=>({id:`editor:${_.id}`,label:k.ui_workspaceActions_openIn_label({name:_.name}),editor:_,onClick:()=>{D(_)}})),{id:"choose-app",label:k.ui_workspaceActions_chooseApp_label(),icon:Je,onClick:()=>{B()}}]}),S()&&t.push({id:"copy-absolute-path",label:k.ui_workspaceActions_copyAbsolutePath_label(),icon:qe,disabled:!e(a),dividerBefore:t.length>0,onClick:()=>{Z()}}),S()&&!x()&&t.push({id:"copy-relative-path",label:k.ui_workspaceActions_copyRelativePath_label(),icon:qe,disabled:!u(),onClick:()=>{$()}}),V()&&!F()&&t.push({id:"copy-file-name",label:k.ui_workspaceActions_copyFileName_label(),icon:wt,disabled:!u(),onClick:()=>{pe()}}));const l=_=>_.map(z=>({...z,submenu:z.submenu?l(z.submenu):void 0,onClick:()=>{z.onClick(),s()}}));return t.push(...l(X())),O()&&(ce()||se())&&t.push({id:"archive-workspace",label:ie()?k.ui_workspaceActions_unarchiveSpace_label():k.ui_workspaceActions_archiveSpace_label(),icon:ie()?yt:At,dividerBefore:t.length>0,onClick:fe}),r()&&Y()&&t.push({id:"delete-workspace",label:k.ui_workspaceActions_deleteSpace_label(),icon:Ge,variant:"destructive",dividerBefore:t.length>0&&t.at(-1)?.id!=="archive-workspace",onClick:ee}),m()&&!F()&&t.push({id:"delete-file",label:k.ui_workspaceActions_deleteFile_label(),icon:Ge,variant:"destructive",disabled:e(g)||!e(a)||!A(),dividerBefore:t.length>0,onClick:()=>{te()}}),t});var ve={get layout(){return E()},set layout(t="list"){E(t),v()},get iconWeight(){return J()},set iconWeight(t){J(t),v()},get filePath(){return u()},set filePath(t=""){u(t),v()},get workspaceId(){return A()},set workspaceId(t=""){A(t),v()},get isDirectory(){return F()},set isDirectory(t=!0){F(t),v()},get onDelete(){return Y()},set onDelete(t=void 0){Y(t),v()},get onArchive(){return ce()},set onArchive(t=void 0){ce(t),v()},get onUnarchive(){return se()},set onUnarchive(t=void 0){se(t),v()},get isArchived(){return ie()},set isArchived(t=!1){ie(t),v()},get onClose(){return p()},set onClose(t=void 0){p(t),v()},get showDeleteOption(){return r()},set showDeleteOption(t=!0){r(t),v()},get showArchiveOption(){return O()},set showArchiveOption(t=!1){O(t),v()},get showPathCopy(){return S()},set showPathCopy(t=!0){S(t),v()},get showFileNameCopy(){return V()},set showFileNameCopy(t=!1){V(t),v()},get showFileActions(){return R()},set showFileActions(t=!0){R(t),v()},get workspaceFolderPath(){return q()},set workspaceFolderPath(t=""){q(t),v()},get isDiff(){return W()},set isDiff(t=!1){W(t),v()},get isWorkspaceRoot(){return x()},set isWorkspaceRoot(t=!1){x(t),v()},get additionalActions(){return X()},set additionalActions(t=[]){X(t),v()},get showDeleteFileOption(){return m()},set showDeleteFileOption(t=!1){m(t),v()},get onFileDeleted(){return f()},set onFileDeleted(t=void 0){f(t),v()},$set:Ze,$on:(t,l)=>$e(d,t,l)};{let t=w(()=>E()!=="list");me(be,{get actions(){return e(he)},get menu(){return e(t)},get iconWeight(){return J()}})}var ye=tt(ve);return we(),ye}export{Zt as default};