@intent-hq/web 2.317.0 → 2.317.2

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 (262) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{D2MdcX20.js → -oBRwUwo.js} +1 -1
  3. package/web/app/immutable/chunks/{1MM4WffX.js → -pQB0SQC.js} +1 -1
  4. package/web/app/immutable/chunks/{cf1Brjzn.js → 0gFz0POF.js} +1 -1
  5. package/web/app/immutable/chunks/{gUC3lRBd.js → 1HLMWEVR.js} +3 -3
  6. package/web/app/immutable/chunks/{DljOzx1o.js → 2qAiupor.js} +1 -1
  7. package/web/app/immutable/chunks/{GOcCF0xv.js → 3ABUvTUz.js} +1 -1
  8. package/web/app/immutable/chunks/{C_xALoSF.js → 4UMD9xsX.js} +1 -1
  9. package/web/app/immutable/chunks/{Bys31tzi.js → 4gTuF-Ct.js} +1 -1
  10. package/web/app/immutable/chunks/{BlGpoHuO.js → 51i2b0Zy.js} +4 -4
  11. package/web/app/immutable/chunks/{avnay2CS.js → 5FkB6ttu.js} +1 -1
  12. package/web/app/immutable/chunks/{2sa8qIAB.js → 5s1JeAQX.js} +1 -1
  13. package/web/app/immutable/chunks/{WDQu-iPa.js → 70jzMwhc.js} +1 -1
  14. package/web/app/immutable/chunks/{DmgwTJaD.js → 7LP4OqPX.js} +1 -1
  15. package/web/app/immutable/chunks/AZ_GDgFb.js +1 -0
  16. package/web/app/immutable/chunks/{C2_aeUYM.js → B-7x7ULv.js} +1 -1
  17. package/web/app/immutable/chunks/{Ch6n50QZ.js → B-yP-PGc.js} +1 -1
  18. package/web/app/immutable/chunks/{BAcscHZ9.js → B0ViTaXX.js} +1 -1
  19. package/web/app/immutable/chunks/{CYX6S8VK.js → B19l4IVQ.js} +1 -1
  20. package/web/app/immutable/chunks/{DM0CXxx0.js → B1JwdW4Q.js} +1 -1
  21. package/web/app/immutable/chunks/{h1OZX-ME.js → B3DLTfYH.js} +1 -1
  22. package/web/app/immutable/chunks/{CFe8-T5F.js → B4pMa2Ff.js} +1 -1
  23. package/web/app/immutable/chunks/{CO_zjcSy.js → B5U_Qd5T.js} +1 -1
  24. package/web/app/immutable/chunks/{NSkm34Jv.js → B8MMU67d.js} +1 -1
  25. package/web/app/immutable/chunks/{B1NJ5pzL.js → B9pc_pKk.js} +3 -3
  26. package/web/app/immutable/chunks/{DgYP6-Ts.js → BDRH2dQc.js} +1 -1
  27. package/web/app/immutable/chunks/{DLnrKStT.js → BDe_nklR.js} +1 -1
  28. package/web/app/immutable/chunks/{C4Z1vjzd.js → BFCJosLD.js} +1 -1
  29. package/web/app/immutable/chunks/{BqkqHfzf.js → BH-KJlp3.js} +1 -1
  30. package/web/app/immutable/chunks/{BGl5gjhT.js → BJw5wnOV.js} +1 -1
  31. package/web/app/immutable/chunks/{DKZU30Gj.js → BKE1GgFG.js} +1 -1
  32. package/web/app/immutable/chunks/{WU5yHhJ9.js → BLbOCNKp.js} +1 -1
  33. package/web/app/immutable/chunks/{DMQUXENv.js → BPiLsEn1.js} +2 -2
  34. package/web/app/immutable/chunks/{DbZ_zQlq.js → BQ4SUKhz.js} +1 -1
  35. package/web/app/immutable/chunks/{CW0E9xqo.js → BQpiQojj.js} +1 -1
  36. package/web/app/immutable/chunks/{MTqrPgXh.js → BRpw_Wa2.js} +1 -1
  37. package/web/app/immutable/chunks/{COtDauzr.js → BSi1rsrO.js} +1 -1
  38. package/web/app/immutable/chunks/{yLCQj9vq.js → BTtki0b6.js} +1 -1
  39. package/web/app/immutable/chunks/{Cl0jxY31.js → BUjUgUAA.js} +1 -1
  40. package/web/app/immutable/chunks/{DroMvY3m.js → BUz6aP3C.js} +3 -3
  41. package/web/app/immutable/chunks/{CPv5PsAl.js → BWj5RUp1.js} +1 -1
  42. package/web/app/immutable/chunks/{DcDUL2lD.js → BXrsorfX.js} +1 -1
  43. package/web/app/immutable/chunks/{CmwCaFMB.js → BXyOJh3J.js} +2 -2
  44. package/web/app/immutable/chunks/{78ciQIXP.js → BZ0Iewxk.js} +1 -1
  45. package/web/app/immutable/chunks/{BNdZ_9uw.js → BZ3_6s6_.js} +1 -1
  46. package/web/app/immutable/chunks/{DEXbUvgl.js → BZypROSK.js} +1 -1
  47. package/web/app/immutable/chunks/{DcSgegeE.js → B_-M_Rk1.js} +4 -4
  48. package/web/app/immutable/chunks/{DmMf-gSU.js → BcHWqFY-.js} +1 -1
  49. package/web/app/immutable/chunks/Bd8Du0Fd.js +1 -0
  50. package/web/app/immutable/chunks/{DvnqGv6n.js → Be5Er9P3.js} +1 -1
  51. package/web/app/immutable/chunks/{H_E0v0IH.js → BeTxGqXI.js} +3 -3
  52. package/web/app/immutable/chunks/{D21siGJn.js → BefL-1js.js} +3 -3
  53. package/web/app/immutable/chunks/{Bv5S3aez.js → Beo1BUT8.js} +3 -3
  54. package/web/app/immutable/chunks/{XJFhLiIT.js → Bho7eqFf.js} +1 -1
  55. package/web/app/immutable/chunks/{CGvw_v2X.js → BmwCvXG3.js} +1 -1
  56. package/web/app/immutable/chunks/{CYZanEy-.js → BoC-gLSw.js} +1 -1
  57. package/web/app/immutable/chunks/{BTUdYLJq.js → BpkV1q6g.js} +1 -1
  58. package/web/app/immutable/chunks/BqI9uavK.js +2 -0
  59. package/web/app/immutable/chunks/{L-gnvTJU.js → Brobdake.js} +1 -1
  60. package/web/app/immutable/chunks/{Cz7C_97W.js → Bscf_BG7.js} +1 -1
  61. package/web/app/immutable/chunks/{D9I5kjGH.js → BtgBL_Zs.js} +1 -1
  62. package/web/app/immutable/chunks/{C4Go0ZUc.js → BuPHrdQM.js} +1 -1
  63. package/web/app/immutable/chunks/{Bo8ZBCqJ.js → BvdQxsGv.js} +1 -1
  64. package/web/app/immutable/chunks/{CbFHvbCz.js → Bya-ggU-.js} +1 -1
  65. package/web/app/immutable/chunks/{DdCI35A_.js → BypSPjBC.js} +26 -26
  66. package/web/app/immutable/chunks/{3FY3HcmJ.js → C-QwlfDr.js} +1 -1
  67. package/web/app/immutable/chunks/{D5EAAcY_.js → C-e-yd98.js} +1 -1
  68. package/web/app/immutable/chunks/{37Ot8ebN.js → C-eLL0ai.js} +1 -1
  69. package/web/app/immutable/chunks/{CW4Luigb.js → C-oQiQ3z.js} +4 -4
  70. package/web/app/immutable/chunks/{BYzPqnCf.js → C0dWqch7.js} +1 -1
  71. package/web/app/immutable/chunks/{C_dkWQA1.js → C1MXqCUp.js} +2 -2
  72. package/web/app/immutable/chunks/{e1GtcuZv.js → C1wi1pKa.js} +1 -1
  73. package/web/app/immutable/chunks/{C04pXnsd.js → C2gHzjc8.js} +1 -1
  74. package/web/app/immutable/chunks/{CMcSelvo.js → C3Sa4Adg.js} +1 -1
  75. package/web/app/immutable/chunks/{DCkl9dqS.js → C68vqe0o.js} +1 -1
  76. package/web/app/immutable/chunks/{DizHcyTH.js → C6o6HQ6t.js} +1 -1
  77. package/web/app/immutable/chunks/{B1L6cKI-.js → C7G5eU0Q.js} +1 -1
  78. package/web/app/immutable/chunks/{CBVy9_dl.js → C7vWSpiv.js} +1 -1
  79. package/web/app/immutable/chunks/{COZ2SNJx.js → C9abnHnH.js} +1 -1
  80. package/web/app/immutable/chunks/{Ja3gSQQ2.js → C9dseNmc.js} +1 -1
  81. package/web/app/immutable/chunks/C9sYEPAV.js +1 -0
  82. package/web/app/immutable/chunks/{DH5x-Yq6.js → CBMSMN2h.js} +1 -1
  83. package/web/app/immutable/chunks/{ssptyjur.js → CC1bGpw_.js} +1 -1
  84. package/web/app/immutable/chunks/{B47DviaX.js → CFgZJYqX.js} +1 -1
  85. package/web/app/immutable/chunks/{zUDGDDVj.js → CG4aq4mO.js} +1 -1
  86. package/web/app/immutable/chunks/CGE0UuGs.js +2 -0
  87. package/web/app/immutable/chunks/{CSakj4K5.js → CHKHRxNs.js} +1 -1
  88. package/web/app/immutable/chunks/{Bnw1c_hY.js → CJeg57-s.js} +1 -1
  89. package/web/app/immutable/chunks/{L_RZq0s4.js → CK4Yr90U.js} +1 -1
  90. package/web/app/immutable/chunks/{D_niS0o-.js → CNxs5gLd.js} +1 -1
  91. package/web/app/immutable/chunks/{BM3p7pnM.js → CRcCx-zt.js} +1 -1
  92. package/web/app/immutable/chunks/{Cekvr7WJ.js → CRs-kuPG.js} +1 -1
  93. package/web/app/immutable/chunks/{DTRBfwcm.js → CSxQeikv.js} +6 -6
  94. package/web/app/immutable/chunks/{D6ZAQOK2.js → CWbBNWZY.js} +1 -1
  95. package/web/app/immutable/chunks/{DP8Psy6A.js → CYGCz9Jd.js} +2 -2
  96. package/web/app/immutable/chunks/{Dh3jIeqa.js → CZdhGhqW.js} +1 -1
  97. package/web/app/immutable/chunks/{BH9Sx0uO.js → C_sy4_IS.js} +1 -1
  98. package/web/app/immutable/chunks/{CqveaVR5.js → CbwL0mcB.js} +1 -1
  99. package/web/app/immutable/chunks/{Dl2Egpks.js → CcKi_DP7.js} +1 -1
  100. package/web/app/immutable/chunks/{Cbrc9SCK.js → CdYIhP6H.js} +1 -1
  101. package/web/app/immutable/chunks/{BN2r45vo.js → CdwxdSGH.js} +1 -1
  102. package/web/app/immutable/chunks/{CnMPeQg8.js → CeqH6gGg.js} +1 -1
  103. package/web/app/immutable/chunks/{gFd3Neq8.js → Cg8ePZn3.js} +1 -1
  104. package/web/app/immutable/chunks/{sLJTRKQx.js → ChjNagFp.js} +1 -1
  105. package/web/app/immutable/chunks/{Cc639qSq.js → CiY5WTYK.js} +1 -1
  106. package/web/app/immutable/chunks/{UZKstsLl.js → CiohM4ZQ.js} +1 -1
  107. package/web/app/immutable/chunks/{C6eBXrOa.js → CisIj7pL.js} +1 -1
  108. package/web/app/immutable/chunks/{BZddI90c.js → CjMpc_Ln.js} +1 -1
  109. package/web/app/immutable/chunks/{BKF9zMkW.js → Cja4JOdS.js} +1 -1
  110. package/web/app/immutable/chunks/{CmBbNgSg.js → Cjl8Nti8.js} +1 -1
  111. package/web/app/immutable/chunks/{YaCrKYp7.js → CnURdtcx.js} +1 -1
  112. package/web/app/immutable/chunks/{DdGu-kox.js → CnqPz2zD.js} +1 -1
  113. package/web/app/immutable/chunks/{DOryYkjQ.js → CsZRWQFM.js} +1 -1
  114. package/web/app/immutable/chunks/{BH5bBEdq.js → CtUwk2M2.js} +1 -1
  115. package/web/app/immutable/chunks/{CxTpD-K5.js → Cwi8--0W.js} +1 -1
  116. package/web/app/immutable/chunks/CzXnFot6.js +1 -0
  117. package/web/app/immutable/chunks/{C_FwJcIF.js → D000Y3U2.js} +1 -1
  118. package/web/app/immutable/chunks/{PJ8z0v-B.js → D1WNxwkF.js} +1 -1
  119. package/web/app/immutable/chunks/D25d-Koj.js +1 -0
  120. package/web/app/immutable/chunks/{DIRuUXBx.js → D27--FO7.js} +1 -1
  121. package/web/app/immutable/chunks/{J6yrfnLz.js → D2CQaCZ1.js} +1 -1
  122. package/web/app/immutable/chunks/{D2MqWUlq.js → D2bBadyn.js} +1 -1
  123. package/web/app/immutable/chunks/{7srhf39r.js → D3Av1JMy.js} +3 -3
  124. package/web/app/immutable/chunks/{CBZcUhKz.js → D3Nrkkzz.js} +1 -1
  125. package/web/app/immutable/chunks/{CuUeXXzt.js → D4X9mCj-.js} +1 -1
  126. package/web/app/immutable/chunks/{DKwfCr3E.js → D4rfShJ_.js} +1 -1
  127. package/web/app/immutable/chunks/{DHAWV_GR.js → D5hnBZtr.js} +1 -1
  128. package/web/app/immutable/chunks/{BCzNrJEe.js → D6pC8C8o.js} +1 -1
  129. package/web/app/immutable/chunks/{BvB-t2O9.js → D7IWr17d.js} +1 -1
  130. package/web/app/immutable/chunks/{CERj1M8p.js → D8Imihe0.js} +1 -1
  131. package/web/app/immutable/chunks/{BccYWCmP.js → D9o0T9ir.js} +1 -1
  132. package/web/app/immutable/chunks/{W_RYksqv.js → DBaJKI7v.js} +1 -1
  133. package/web/app/immutable/chunks/{CfhDPr30.js → DBsrgEQY.js} +1 -1
  134. package/web/app/immutable/chunks/DC-9q6_j.js +4 -0
  135. package/web/app/immutable/chunks/{Ht2fgYKG.js → DDUX5dm3.js} +4 -4
  136. package/web/app/immutable/chunks/{CsbDr056.js → DFCtaoTZ.js} +2 -2
  137. package/web/app/immutable/chunks/{D-uj1csY.js → DHW0b2jP.js} +8 -8
  138. package/web/app/immutable/chunks/DJ6NhP2E.js +1 -0
  139. package/web/app/immutable/chunks/{DpuVuyCy.js → DKo_4wJv.js} +1 -1
  140. package/web/app/immutable/chunks/{D_-A7-a3.js → DKtu3kW5.js} +1 -1
  141. package/web/app/immutable/chunks/{BtWNHufE.js → DMQ6-OMm.js} +1 -1
  142. package/web/app/immutable/chunks/{DtiKniGk.js → DO9ueLS2.js} +1 -1
  143. package/web/app/immutable/chunks/{ODW3_QQQ.js → DOd57FMZ.js} +1 -1
  144. package/web/app/immutable/chunks/{BoF5X4p9.js → DQ2gC3bu.js} +1 -1
  145. package/web/app/immutable/chunks/{DPmIqgtZ.js → DUjKQudc.js} +3 -3
  146. package/web/app/immutable/chunks/{C5QU6wj-.js → DUxBQfgs.js} +1 -1
  147. package/web/app/immutable/chunks/{DXh7O-mG.js → DUyiOtrK.js} +1 -1
  148. package/web/app/immutable/chunks/{DpiTd0jU.js → DVfPvRIS.js} +1 -1
  149. package/web/app/immutable/chunks/{0T7sNxcZ.js → DX9fSZrc.js} +1 -1
  150. package/web/app/immutable/chunks/{DGZtqpTN.js → DYMvJtQy.js} +1 -1
  151. package/web/app/immutable/chunks/{Dv6NvIa-.js → DYZwkmyf.js} +1 -1
  152. package/web/app/immutable/chunks/{DKWOCcke.js → D_1oX83y.js} +2 -2
  153. package/web/app/immutable/chunks/{CJrxetkR.js → Dc-hoPaD.js} +1 -1
  154. package/web/app/immutable/chunks/{B9JhhaHF.js → Dc0z-1f1.js} +1 -1
  155. package/web/app/immutable/chunks/{Bco_b5Ku.js → Dd6RDWfk.js} +1 -1
  156. package/web/app/immutable/chunks/{DFuME8T0.js → DdOkmX2F.js} +1 -1
  157. package/web/app/immutable/chunks/{T3eo2phD.js → DdgOahmz.js} +1 -1
  158. package/web/app/immutable/chunks/{CgkAypA6.js → Df_KaPO2.js} +2 -2
  159. package/web/app/immutable/chunks/{Dn5ABN6W.js → DfcN0vl7.js} +1 -1
  160. package/web/app/immutable/chunks/{D4EWm27H.js → Dgw2Wjgi.js} +2 -2
  161. package/web/app/immutable/chunks/{DYuU0Arz.js → Dh8_IDIo.js} +1 -1
  162. package/web/app/immutable/chunks/{D-nAlgSv.js → DhRnAAAs.js} +1 -1
  163. package/web/app/immutable/chunks/{DBW7NNdL.js → DiOG4aSP.js} +1 -1
  164. package/web/app/immutable/chunks/{Cxf643iJ.js → DjKRH19J.js} +1 -1
  165. package/web/app/immutable/chunks/{BpeC_-MT.js → DjsRyxTd.js} +1 -1
  166. package/web/app/immutable/chunks/{DKQzovq-.js → DlL3hXg0.js} +2 -2
  167. package/web/app/immutable/chunks/{CzO9GGdp.js → DmU7vUKt.js} +2 -2
  168. package/web/app/immutable/chunks/{fiKabgyF.js → DppOK7dU.js} +1 -1
  169. package/web/app/immutable/chunks/{dyeihP5s.js → DpsivgKH.js} +1 -1
  170. package/web/app/immutable/chunks/{BM-JMWD0.js → DqsogpbZ.js} +1 -1
  171. package/web/app/immutable/chunks/{Dqjk8pvU.js → DrPG1fDs.js} +1 -1
  172. package/web/app/immutable/chunks/{BNLH5vU8.js → DsYVkI49.js} +1 -1
  173. package/web/app/immutable/chunks/{GcCPIK4y.js → DtMv5TQ8.js} +1 -1
  174. package/web/app/immutable/chunks/{CtnmDc5U.js → DugGE-AO.js} +1 -1
  175. package/web/app/immutable/chunks/{B7gGY21y.js → DvnkuohG.js} +1 -1
  176. package/web/app/immutable/chunks/{DeG2Ac-N.js → Dw27dq0-.js} +1 -1
  177. package/web/app/immutable/chunks/{pd-R-VJ_.js → DwBOVRcA.js} +1 -1
  178. package/web/app/immutable/chunks/{DpHVu4cd.js → DwZdimp9.js} +1 -1
  179. package/web/app/immutable/chunks/{DgikbYWH.js → DwqkyGAS.js} +1 -1
  180. package/web/app/immutable/chunks/{DD8iC1J4.js → FHutRMli.js} +1 -1
  181. package/web/app/immutable/chunks/{D2mMBmvL.js → FLKfalOo.js} +1 -1
  182. package/web/app/immutable/chunks/{Dho1VckI.js → FN5msAy_.js} +1 -1
  183. package/web/app/immutable/chunks/{CFY6lIZ1.js → GKBPqrFt.js} +1 -1
  184. package/web/app/immutable/chunks/{DvG_D_NN.js → HiFzG501.js} +1 -1
  185. package/web/app/immutable/chunks/{cDR744Wh.js → IxA57nJL.js} +1 -1
  186. package/web/app/immutable/chunks/{CJEarPic.js → JtPc08so.js} +1 -1
  187. package/web/app/immutable/chunks/{Cs4SXj6b.js → KTsXxUF5.js} +1 -1
  188. package/web/app/immutable/chunks/{T3vgYRzj.js → LPZkKDIt.js} +1 -1
  189. package/web/app/immutable/chunks/{Djcp6v1f.js → LbC7skPD.js} +1 -1
  190. package/web/app/immutable/chunks/{B-XDLOUH.js → MaU6O01C.js} +1 -1
  191. package/web/app/immutable/chunks/{KQXpZ8Ws.js → MzIeIzDc.js} +1 -1
  192. package/web/app/immutable/chunks/{CXMtFxok.js → NySn8Jgs.js} +1 -1
  193. package/web/app/immutable/chunks/{POMSQzHT.js → OXAE4Y56.js} +1 -1
  194. package/web/app/immutable/chunks/{YhsLhIAa.js → PnruPu-v.js} +1 -1
  195. package/web/app/immutable/chunks/{DOBsmdO0.js → S75JqWQs.js} +1 -1
  196. package/web/app/immutable/chunks/{ChfKK8O6.js → SN7QywhL.js} +1 -1
  197. package/web/app/immutable/chunks/{C3YdXEWZ.js → W27HQR6z.js} +1 -1
  198. package/web/app/immutable/chunks/{BcDs9dVa.js → Y2IQMTgy.js} +1 -1
  199. package/web/app/immutable/chunks/{DRji3Jgq.js → ZOX3f8YP.js} +1 -1
  200. package/web/app/immutable/chunks/{DxgBueKf.js → ZqQeKane.js} +1 -1
  201. package/web/app/immutable/chunks/{Bsy8wJg4.js → aNsVO8E4.js} +1 -1
  202. package/web/app/immutable/chunks/d1VpYuEe.js +4 -0
  203. package/web/app/immutable/chunks/{BXf-4olS.js → dkrfHkms.js} +1 -1
  204. package/web/app/immutable/chunks/{Cpq9N-cZ.js → gGle0ySs.js} +1 -1
  205. package/web/app/immutable/chunks/{aAnKrNHf.js → geGZi_w1.js} +1 -1
  206. package/web/app/immutable/chunks/{Chdzh45_.js → iWHbHYgP.js} +1 -1
  207. package/web/app/immutable/chunks/{POr_IUHX.js → ibhfo-VE.js} +1 -1
  208. package/web/app/immutable/chunks/{-Nlmdtho.js → jWThE6-J.js} +1 -1
  209. package/web/app/immutable/chunks/{DwuWRler.js → jiHQQ6wA.js} +1 -1
  210. package/web/app/immutable/chunks/{C1Dz1Ew8.js → jlIjptN1.js} +1 -1
  211. package/web/app/immutable/chunks/{BrQZ2Dsu.js → keABhBJs.js} +1 -1
  212. package/web/app/immutable/chunks/{cDMR84sh.js → ldht3A_H.js} +1 -1
  213. package/web/app/immutable/chunks/{7nZxhE5n.js → m5qFicCP.js} +1 -1
  214. package/web/app/immutable/chunks/{BgIOCdbx.js → n5756WrC.js} +1 -1
  215. package/web/app/immutable/chunks/{B9eFBnbu.js → nGdwLZhF.js} +1 -1
  216. package/web/app/immutable/chunks/{jjBmKMM6.js → nHpG5p0C.js} +1 -1
  217. package/web/app/immutable/chunks/{TfyyLY4T.js → o0LuLePs.js} +1 -1
  218. package/web/app/immutable/chunks/{DAW5vHcX.js → o17TbegD.js} +1 -1
  219. package/web/app/immutable/chunks/{BB-0D-f1.js → oxPAVHuu.js} +1 -1
  220. package/web/app/immutable/chunks/{CQbqgij-.js → pj4mR3lP.js} +1 -1
  221. package/web/app/immutable/chunks/{zXad5N8i.js → r-K_cVbp.js} +1 -1
  222. package/web/app/immutable/chunks/{2_ode0S7.js → rEk7AsyC.js} +1 -1
  223. package/web/app/immutable/chunks/{cmyT5Ste.js → rU5MX2nQ.js} +1 -1
  224. package/web/app/immutable/chunks/{DAMO7X4u.js → uYanh5GD.js} +1 -1
  225. package/web/app/immutable/chunks/{b6em44WJ.js → uxlSCqIr.js} +1 -1
  226. package/web/app/immutable/chunks/{CsfdLqAC.js → vsaQBZyB.js} +1 -1
  227. package/web/app/immutable/chunks/{K2dbGfSN.js → wprVZZpe.js} +1 -1
  228. package/web/app/immutable/chunks/{BEmgVD15.js → x2wsoUAP.js} +1 -1
  229. package/web/app/immutable/chunks/{AgeRGt9n.js → z4Ol2X5C.js} +1 -1
  230. package/web/app/immutable/entry/{app.IKpMMA4c.js → app.CjL_ESb3.js} +3 -3
  231. package/web/app/immutable/entry/start.DVcgL5VV.js +1 -0
  232. package/web/app/immutable/nodes/{0.pdrjpoDI.js → 0.u-mqmdJF.js} +1 -1
  233. package/web/app/immutable/nodes/{1.BA6cXWWv.js → 1.CWA4VVhg.js} +1 -1
  234. package/web/app/immutable/nodes/{10.1sUbjlmF.js → 10.COfYFCM4.js} +1 -1
  235. package/web/app/immutable/nodes/{11.CEkVMeXp.js → 11.CpSfU1GN.js} +1 -1
  236. package/web/app/immutable/nodes/{12.DeIYVacr.js → 12.RwHtMfg8.js} +1 -1
  237. package/web/app/immutable/nodes/{13.DVLyn8WD.js → 13.CGls5oXL.js} +3 -3
  238. package/web/app/immutable/nodes/{14.C_i1Czx9.js → 14.Dd42XRi5.js} +1 -1
  239. package/web/app/immutable/nodes/{15.7M_vr67p.js → 15.B6VjCrjj.js} +1 -1
  240. package/web/app/immutable/nodes/{16.3WccacnP.js → 16.CucYoMvi.js} +2 -2
  241. package/web/app/immutable/nodes/{2.Ddjtp5Dx.js → 2.Ccc1TwNU.js} +4 -4
  242. package/web/app/immutable/nodes/{3.CFJOautq.js → 3.Ce2k2EUY.js} +1 -1
  243. package/web/app/immutable/nodes/{4.D_TbMI2Z.js → 4.m_i1ZxYH.js} +1 -1
  244. package/web/app/immutable/nodes/{5.DjSN4aAb.js → 5.BzAilpoC.js} +2 -2
  245. package/web/app/immutable/nodes/{6.BHOPCP8I.js → 6.C9ZiA6w4.js} +1 -1
  246. package/web/app/immutable/nodes/{7.BxX4NXTv.js → 7.t5Jghx_n.js} +1 -1
  247. package/web/app/immutable/nodes/{8.gIY5eOtx.js → 8.aKcaX52l.js} +9 -9
  248. package/web/app/immutable/nodes/{9.DmagtOOH.js → 9.DeLiPEkd.js} +5 -5
  249. package/web/app/version.json +1 -1
  250. package/web/generated/paraglide.js +45 -45
  251. package/web/index.html +18 -18
  252. package/web/app/immutable/chunks/6zh_liBN.js +0 -1
  253. package/web/app/immutable/chunks/CZMDLdIA.js +0 -2
  254. package/web/app/immutable/chunks/C_NaHwAa.js +0 -4
  255. package/web/app/immutable/chunks/CruGdHPf.js +0 -4
  256. package/web/app/immutable/chunks/DcU8FJ67.js +0 -1
  257. package/web/app/immutable/chunks/Df8cCnvS.js +0 -1
  258. package/web/app/immutable/chunks/Dn5Nqyl8.js +0 -1
  259. package/web/app/immutable/chunks/Ds1KbjtE.js +0 -2
  260. package/web/app/immutable/chunks/JsVsuvN3.js +0 -1
  261. package/web/app/immutable/chunks/pqe4mxuk.js +0 -1
  262. package/web/app/immutable/entry/start.BVs3dcNA.js +0 -1
@@ -1,5 +1,5 @@
1
- import{k as za,s as da}from"./CSakj4K5.js";import{j as ua,h as Pt,s as j,l as Vt,k as fe,I as Fa,c as Ba,a as Nn}from"./DwuWRler.js";import{Z as ja,cO as Ha,A as Ua,aX as bn,bT as qa,v as Wa}from"./DIRuUXBx.js";import{bo as c,t as bt,bq as w,a_ as E,by as kt,b as xt,bs as Bn,bu as $e,bt as Qa}from"./DcU8FJ67.js";import{bo as jn,bs as yt,a5 as T,bl as Q,bS as k,bA as A,b_ as y,aD as e,W as g,bO as D,bn as $t,c9 as u,aA as b,ay as J,aB as h,ca as Pe,bH as _,a7 as Qe,b$ as Bt,bV as re,cd as Ct,br as ca,be as on,c5 as Ka,bi as En,bj as Ga,bf as vn,am as Jn,ax as Xn,ai as Va,aj as Ya,c0 as Ja}from"./DYhIMPy1.js";import{s as ga}from"./W_RYksqv.js";import{f as Xa}from"./J6yrfnLz.js";import{k as Za,a as er,H as pa,t as Gt}from"./Cl0jxY31.js";import{r as tr,o as nr,A as Zn,L as ar}from"./DKWOCcke.js";import{S as _n,t as Dn}from"./fiKabgyF.js";import{R as ea}from"./b6em44WJ.js";import{I as fa}from"./POr_IUHX.js";import"./DgYP6-Ts.js";import{aB as hn,cw as rr,ak as sr,az as or,cq as ir,cr as lr,ag as dr,ai as ur,ap as cr,av as gr,k as pr,F as fr,dO as mr,L as vr,ch as _r,bQ as hr}from"./zXad5N8i.js";import{HD as G,cg as zn,ce as ma,ch as wn,qs as wr,Ch as br,fJ as va,Cl as kr,bw as xr,yz as yr,m6 as ta,t1 as $r,ck as Ar,tC as na,n1 as Sr,C1 as Ir,Ck as Cr,c2 as Pr}from"./zUDGDDVj.js";import{K as Tr,A as Rr,ap as Or,ak as Lr,T as Nr}from"./BlGpoHuO.js";import{h as Er}from"./CzO9GGdp.js";import{f as aa}from"./ssptyjur.js";import{h as Dr,g as Mr}from"./BN2r45vo.js";import"./CruGdHPf.js";import{ax as zr,am as Fr,ap as Br,f as Mn,a5 as jr,bc as ra}from"./B1NJ5pzL.js";import"./L_RZq0s4.js";import{c as Hr,r as Ur,q as qr,p as Wr,E as Qr}from"./CXMtFxok.js";import{n as Kr,D as Gr,k as Vr,c as Yr,d as Jr,b as Xr,A as Zr,p as es,P as ts}from"./C_NaHwAa.js";import{F as ns,j as as,bu as rs,i as ss,bH as os}from"./CZMDLdIA.js";import{c as We}from"./-Nlmdtho.js";import{T as is}from"./DAW5vHcX.js";import{ch as _a,cK as ls,cJ as ds,bO as us,x as cs,F as kn,b3 as gs,at as ps,aI as fs,aE as ms,cO as vs,bc as _s,az as hs,X as ws,aJ as bs,a$ as ks,ag as sa,a7 as xs,c2 as ys,af as $s,cA as As,am as Ss,cN as Is,aC as Cs}from"./CMcSelvo.js";import{b as Ps}from"./BaIAhI85.js";import"./Bo8ZBCqJ.js";import{f as Ts}from"./Cbrc9SCK.js";const Rs=80,Os=10,Ls=new ja(Ha,{renderer:{html({text:a}){return Ua(a)},image({tokens:a}){return this.parser.parseInline(a)}}});function Hn(a){const n=document.createElement("template");n.innerHTML=Ls.parseInline(a,{async:!1});for(const o of n.content.querySelectorAll("br"))o.replaceWith(" ");return(n.content.textContent??"").replace(/\s+/g," ").trim()}function Tt(a){return a.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`+([^`]*?)`+/g,"$1").replace(/<[^>]+>/g,"").replace(/\\([\\`*_[\]{}()#+\-.!>])/g,"$1").replace(/[*~]/g,"").replace(/(^|[^A-Za-z0-9])_+/g,"$1").replace(/_+([^A-Za-z0-9]|$)/g,"$1").replace(/\s+/g," ").trim()}function Fn(a,n){return a.slice(n).replace(/^(?:[ \t]*(?:\r\n|\n|\r))+/,"")}function $n(a,n){return!n||n.length>Rs||n.split(/\s+/).length>Os||/[.!?;]$/.test(n)?!1:!/^[ \t]*(?:[-+*][ \t]+|\d+[.)][ \t]+|>|```|~~~|\|)/.test(a)}function Ri(a){const o=a.trim().match(/^\*\*([^\r\n]+)\*\*$/);if(!o)return null;const i=Tt(o[1]);return $n(o[0],i)?i:null}function Un(a,n=!1,o=!0){const i=a.match(/^(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",r=a.slice(i.length).match(/^\*\*([^\r\n]+)\*\*[ \t]*(?:(?:\r\n|\n|\r)|$)/);if(!r)return null;if(n){const f=r[1],v=f.match(/\\+$/)?.[0].length??0;if(f!==f.trim()||f.includes("**")||f.startsWith("*")||f.endsWith("*")||v%2!==0)return null}const p=Tt(r[1]);return $n(r[0],p)?{title:n&&o?Hn(r[1]):p,body:Fn(a,i.length+r[0].length)}:null}function oa(a){const n=[];let o=a;for(;o.trim();){const i=qn(o,!0),d=i.heading?{body:i.body}:Un(o,!0,!1);if(!d)return null;n.push(o.slice(0,o.length-d.body.length)),o=d.body}return n.length?n:null}function Oi(a){const n=[];let o=a;for(;o.trim();){const i=qn(o,!0,Hn),d=i.heading?{title:i.heading,body:i.body}:Un(o,!0);if(!d)return null;n.push(d.title),o=d.body}return n.length?n:null}function Li(a){const n=Es(a),o=[];let i=a;for(n.heading&&(o.push({title:n.heading,body:""}),i=n.body);i;){const d=Un(i);if(!d||d.body.length>=i.length)break;o.push({title:d.title,body:""}),i=d.body}if(o.length===0){const d=a.trim(),r=Tt(d);return!d.includes(`
2
- `)&&$n(d,r)?[{title:r,body:""}]:d?[{title:null,body:d}]:[]}return o[o.length-1].body=i.trim(),o}function Ns(a){const n=a.replace(/^ {0,3}/,"");return!/^(?:\s|>|`{3}|~{3}|(?:[-+*]|\d+[.)])(?:[ \t]|$)|#{1,6}(?:[ \t]|$)|<|\[[^\]]*\]:)/.test(n)&&!/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})$/.test(n)}function qn(a,n=!1,o=Tt){const i=a.match(/^(?:\uFEFF)?(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",d=a.slice(i.length);if(n&&/^(?: {4}| {0,3}\t)/.test(d))return{heading:null,body:a};const r=d.match(/^[ \t]{0,3}#{1,6}[ \t]+([^\r\n]*?)(?:[ \t]+#+)?[ \t]*(?:\r\n|\n|\r|$)/);if(r&&Tt(r[1]))return{heading:o(r[1]),body:Fn(a,i.length+r[0].length)};const p=d.match(/^([^\r\n]+)(?:\r\n|\n|\r)([ \t]{0,3})(?:=+|-+)[ \t]*(?:\r\n|\n|\r|$)/);return p&&(!n||Ns(p[1])&&!p[2].includes(" "))&&Tt(p[1])?{heading:o(p[1]),body:Fn(a,i.length+p[0].length)}:{heading:null,body:a}}function Es(a,{preserveInlineText:n=!1}={}){const o=n?Hn:Tt,i=qn(a,!1,o);if(i.heading)return i;const d=a.match(/^(?:\uFEFF)?(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",p=a.slice(d.length).match(/^([^\r\n]+)(?:\r\n|\n|\r)(?:[ \t]*(?:\r\n|\n|\r))+/);if(p){const f=Tt(p[1]),v=a.slice(d.length+p[0].length);if(v.trim()&&$n(p[1],f))return{heading:o(p[1]),body:v}}return{heading:null,body:a}}const jt="[--operational-row-inline-padding:var(--chat-operational-row-inline-padding,0.5rem)] [--operational-leading-slot-size:1.25rem] [--operational-leading-half-slot-size:0.625rem] [--operational-leading-gap:var(--chat-operational-leading-gap,0.5rem)]",Ni="type-body font-family-child font-normal text-muted-foreground",Ei=`${jt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))]`,Di=`${jt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))] pt-1.5`,Mi=`${jt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))] pt-1`,zi=`${jt} relative min-w-0 max-w-full`,Fi=`${jt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))]`,Bi=`${jt} operational-group-child-row ml-2 min-w-0 w-[calc(100%-0.5rem)] max-w-[calc(100%-0.5rem)]`,ji="pt-6",Hi="text-muted-foreground",Ui="text-muted-foreground",ha="font-normal text-muted-foreground",qi="tool-call-container group relative block w-full min-w-0 max-w-full overflow-hidden type-body font-family-child font-normal text-muted-foreground",Wi="h-[16px]! w-[16px]! shrink-0",Qi=`${jt} relative grid h-7 w-full min-w-0 max-w-full grid-cols-[var(--operational-leading-slot-size)_minmax(0,1fr)_auto] items-center gap-[var(--operational-leading-gap)] overflow-hidden rounded-md px-[var(--operational-row-inline-padding)] type-body transition-colors duration-[var(--motion-fast)] motion-reduce:transition-none`,Ki=`a11y-ignore pointer-events-none flex size-[var(--operational-leading-slot-size)] min-w-[var(--operational-leading-slot-size)] shrink-0 items-center justify-center [&_svg]:size-[16px]! ${ha}`,Gi=`type-body block min-w-0 max-w-full truncate overflow-hidden text-ellipsis whitespace-nowrap border-0 bg-transparent p-0 text-left ${ha}`,Vi="type-body flex min-w-0 shrink-0 items-center gap-1 whitespace-nowrap",Yi="h-[16px]! w-[16px]! shrink-0 opacity-60 transition-transform duration-[var(--motion-fast)] motion-reduce:transition-none";function Ji(a){return za(a,{axis:"y",duration:ua()?0:150})}function ln(a){return a.type==="thinking"||a.type==="tool_use"||a.type==="content_group"}function Xi(a){const n=a?.[0];return!n||ln(n)?"":"pt-4"}function Zi(a,n,o=()=>!0){const i=a[n];if(!i||!o(i)||!ln(i))return!1;let d=n-1;for(;d>=0&&!o(a[d]);)d-=1;return d>=0&&ln(a[d])}function el(a,n,o=()=>!0,i=!1){const d=a[n];if(!d||!o(d))return"";let r=n-1;for(;r>=0&&!o(a[r]);)r-=1;if(r<0)return"";const p=a[r];if(p.type==="thinking"&&d.type==="thinking")return i||oa(p.text??p.content??"")!==null&&oa(d.text??d.content??"")!==null?"":"pt-14";const f=ln(p),v=ln(d);return f&&v?"":p.type==="thinking"&&!v?"pt-6":f||v?"pt-4":"pt-1"}const tl="shrink-0 whitespace-nowrap text-ui text-subtle focus-visible:outline-none focus-visible:text-foreground";function Ds(a){if(a?.status==="halted")return c.agent_node_halted_label();if(a?.status==="resuming")return c.agent_node_resuming_label();if(a?.placement?.target==="remote"||a?.placement?.target==="e2b"){if(a.placementError)return c.remoteAgent_status_failed();if(a.cloudStart)return c.remoteAgent_status_starting();if(a.effectiveIsolation==="pending")return a.setup?.state==="pending"?c.remoteAgent_status_preparingCheckout():a.setup?.state==="running"?c.remoteAgent_status_runningSetup():c.remoteAgent_status_starting()}if(a?.placement&&a.effectiveIsolation==="pending")return c.agent_node_provisioning_label()}var Ms=h('<span class="owner-fill block h-full svelte-sxf8s9"></span>'),zs=h('<dd class="section-note pl-3.5 text-xs text-muted-foreground wrap-anywhere svelte-sxf8s9"> </dd>'),Fs=h('<div class="section-row py-0.5 svelte-sxf8s9"><dt class="flex min-w-0 items-start gap-2 text-sm text-foreground"><span class="owner-key mt-1.5 size-1.5 shrink-0 rounded-full svelte-sxf8s9"></span> <span class="min-w-0 wrap-anywhere"> </span></dt> <dd class="text-xs text-muted-foreground"> </dd> <dd> </dd> <!></div>'),Bs=h('<div class="min-w-0"><dt class="truncate text-sm text-foreground"> </dt> <dd class="text-xs text-muted-foreground wrap-anywhere"> </dd></div>'),js=h('<h4 class="mb-2 mt-4 text-xs font-normal text-muted-foreground"> </h4> <dl class="flex flex-col gap-2"></dl>',1),Hs=h('<section class="min-w-0" data-testid="prompt-breakdown"><div class="mb-3 flex items-baseline justify-between gap-3"><h3 class="text-sm font-medium"> </h3> <span class="shrink-0 text-sm tabular-nums text-muted-foreground"> </span></div> <div class="owner-strip mb-3 flex h-1.5 w-full overflow-hidden svelte-sxf8s9" role="img"></div> <dl class="section-list svelte-sxf8s9"></dl> <!></section>');function wa(a,n){const o=jn();if(new.target)return bt({component:wa,...a});yt(n,!0);let i=w(n,"breakdown",7);function d(l){return Za(l,{maximumFractionDigits:l<1e4?1:0})}function r(l){return l==="intent"?c.agent_contextBreakdown_owner_intent_label():c.agent_contextBreakdown_owner_user_label()}const p=u(()=>i().owners.map(l=>c.agent_contextBreakdown_ownerShare_label({owner:r(l.owner),tokens:d(l.estTokens)})).join(", "));var f={get breakdown(){return i()},set breakdown(l){i(l),b()},$set:kt,$on:(l,M)=>xt(n,l,M)},v=Hs(),R=T(v),S=T(R),m=Q(S,!0),B=k(S,2),O=Q(B,!0);A(R);var de=k(R,2);Pt(de,21,()=>i().owners,l=>l.owner,(l,M)=>{var H=Ms();let x;y(()=>{j(H,"data-owner",e(M).owner),x=Vt(H,"",x,{"flex-grow":e(M).share})}),g(l,H)}),A(de);var L=k(de,2);Pt(L,21,()=>i().rows,l=>l.key,(l,M)=>{var H=Fs(),x=T(H),ee=T(x),K=k(ee,2),ne=Q(K,!0);A(x);var ue=k(x,2),ce=Q(ue,!0),U=k(ue,2),X=Q(U,!0),oe=k(U,2);{var Ce=Ee=>{var W=zs(),P=Q(W,!0);y(ie=>D(P,ie),[()=>[e(M).counted?"":c.agent_contextBreakdown_notCounted_label(),e(M).hint??""].filter(Boolean).join(" · ")]),g(Ee,W)};E(oe,Ee=>{(e(M).hint||!e(M).counted)&&Ee(Ce)})}A(H),y((Ee,W)=>{j(H,"data-counted",e(M).counted),j(ee,"data-owner",e(M).owner),D(ne,e(M).label),D(ce,Ee),fe(U,1,`text-right text-sm tabular-nums ${e(M).counted?"text-foreground":"text-muted-foreground"}`),D(X,W)},[()=>r(e(M).owner),()=>d(e(M).estTokens)]),g(l,H)}),A(L);var C=k(L,2);{var se=l=>{var M=js(),H=J(M),x=Q(H,!0),ee=k(H,2);Pt(ee,21,()=>i().hiddenSkills,K=>K.name,(K,ne)=>{var ue=Bs(),ce=T(ue),U=Q(ce,!0),X=k(ce,2),oe=Q(X,!0);A(ue),y(Ce=>{D(U,e(ne).name),D(oe,Ce)},[()=>[e(ne).detail,e(ne).fix].filter(Boolean).join(" · ")]),g(K,ue)}),A(ee),y(K=>{j(H,"id",`${o}-hidden`),D(x,K),j(ee,"aria-labelledby",`${o}-hidden`)},[()=>c.agent_contextBreakdown_hiddenSkills_title()]),g(l,M)};E(C,l=>{i().hiddenSkills.length>0&&l(se)})}return A(v),y((l,M)=>{j(v,"aria-labelledby",`${o}-title`),j(S,"id",`${o}-title`),D(m,l),D(O,M),j(de,"aria-label",e(p))},[()=>c.agent_contextBreakdown_title(),()=>c.agent_contextBreakdown_tokens_label({tokens:d(i().estTokens)})]),g(a,v),$t(f)}const Us=["intent","user"],qs=["systemPrompt","toolDescription","provider"],xn=a=>typeof a=="object"&&a!==null&&!Array.isArray(a),yn=a=>typeof a=="number"&&Number.isFinite(a)&&a>=0,Ws=a=>a==="intent"||a==="user";function Qs(a,n){if(!xn(a))return null;const{id:o,label:i,owner:d,location:r,chars:p,estTokens:f,controlHint:v}=a;if(typeof o!="string"||typeof i!="string"||!Ws(d)||typeof r!="string"||!qs.includes(r)||!yn(p)||!yn(f))return null;const R=xn(v)&&typeof v.text=="string"&&v.text;return{key:`${n}:${o}`,id:o,label:i,owner:d,chars:p,estTokens:f,counted:r!=="provider",...R?{hint:R}:{}}}function Ks(a){if(!xn(a))return null;const{name:n,reason:o,detail:i,fix:d}=a;return[n,o,i,d].some(r=>typeof r!="string")?null:{name:n,reason:o,detail:i,fix:d}}function Gs(a){if(!xn(a)||a.available!==!0)return null;const{totalChars:n,estTokens:o,sections:i,hiddenSkills:d}=a;if(!yn(n)||!yn(o)||!Array.isArray(i)||!Array.isArray(d))return null;const r=i.map(Qs).filter(f=>f!==null).sort((f,v)=>v.chars-f.chars),p=Us.map(f=>{const v=r.filter(S=>S.counted&&S.owner===f),R=v.reduce((S,m)=>S+m.chars,0);return{owner:f,chars:R,estTokens:v.reduce((S,m)=>S+m.estTokens,0),share:n>0?R/n:0}}).filter(f=>f.chars>0);return{totalChars:n,estTokens:o,rows:r,owners:p,hiddenSkills:d.map(Ks).filter(f=>f!==null)}}async function Vs(a){try{const n=await zr("agent.getSession",{agentId:a});return Gs(n?.session?.promptBreakdown)}catch{return null}}const ia=ns.map(a=>({key:a.path.replace(/^agentFeatures\./,""),label:a.label,description:a.description}));function Ys(a){const n=a.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase().trim();return n.charAt(0).toUpperCase()+n.slice(1)}function Js(a){const n=a??{},o=ia.map(r=>({key:r.key,label:r.label(),description:r.description(),enabled:n[r.key]===!0,known:!0})),i=new Set(ia.map(r=>r.key)),d=[];for(const[r,p]of Object.entries(n))i.has(r)||d.push({key:r,label:Ys(r),description:null,enabled:p===!0,known:!1});return d.sort((r,p)=>r.label.localeCompare(p.label)),o.concat(d)}var Xs=h('<div class="mb-6 border-b border-border pb-6"><!></div>'),Zs=h("<span> </span>"),eo=h('<!> <span class="sr-only"> </span>',1),to=h('<div role="listitem" class="text-xs text-subtle" aria-hidden="true">—</div>'),no=h('<section class="min-w-0"><h4 class="text-sm font-medium mb-3"> </h4> <div role="list" class="space-y-2"></div></section>'),ao=h('<div class="@container"><!> <section><h3 class="text-sm font-medium"> </h3> <p class="mb-4 mt-1 text-sm text-muted-foreground"> </p> <div class="grid grid-cols-1 gap-6 @min-[28rem]:grid-cols-2" data-testid="harness-features-list"></div></section></div>');function ba(a,n){const o=jn();if(new.target)return bt({component:ba,...a});yt(n,!0);let i=w(n,"open",15,!1),d=w(n,"static",7,!1),r=w(n,"version",7),p=w(n,"features",7,null),f=w(n,"agentId",7),v=w(n,"breakdown",7),R=re(null);const S=u(()=>v()===void 0&&!!f());Pe(()=>{if(!i()||!e(S)||!f())return;const L=f();let C=!0;return Vs(L).then(se=>{C&&_(R,{agentId:L,view:se},!0)}),()=>{C=!1}});const m=u(()=>v()!==void 0?v():e(S)&&e(R)&&e(R).agentId===f()?e(R).view:null),B=u(()=>Js(p())),O=u(()=>[{enabled:!0,label:c.chat_shared_valueOn_label(),rows:e(B).filter(L=>L.enabled)},{enabled:!1,label:c.chat_shared_valueOff_label(),rows:e(B).filter(L=>!L.enabled)}]);var de={get open(){return i()},set open(L=!1){i(L),b()},get static(){return d()},set static(L=!1){d(L),b()},get version(){return r()},set version(L){r(L),b()},get features(){return p()},set features(L=null){p(L),b()},get agentId(){return f()},set agentId(L){f(L),b()},get breakdown(){return v()},set breakdown(L){v(L),b()},$set:kt,$on:(L,C)=>xt(n,L,C)};{let L=u(()=>c.chat_harnessFeaturesModal_title({version:r()}));Hr(a,{get static(){return d()},get title(){return e(L)},size:"wide",get open(){return i()},set open(C){i(C)},children:(C,se)=>{var l=ao(),M=T(l);{var H=U=>{var X=Xs(),oe=T(X);wa(oe,{get breakdown(){return e(m)}}),A(X),g(U,X)};E(M,U=>{e(m)&&U(H)})}var x=k(M,2),ee=T(x),K=Q(ee,!0),ne=k(ee,2),ue=Q(ne,!0),ce=k(ne,2);Pt(ce,21,()=>e(O),U=>U.enabled,(U,X)=>{var oe=no(),Ce=T(oe),Ee=Q(Ce,!0),W=k(Ce,2);Pt(W,21,()=>e(X).rows,P=>P.key,(P,ie)=>{Kr(P,{role:"listitem",class:"min-h-0 px-0 py-0 [&_.truncate]:whitespace-normal","data-testid":"harness-feature-state",get"data-feature"(){return e(ie).key},get"data-enabled"(){return e(ie).enabled},title:Ge=>{var q=Qe(),Ze=J(q);{var be=De=>{var Me=eo(),Ve=J(Me);Fr(Ve,{get content(){return e(ie).description},side:"top",size:"sm",children:(At,Rt)=>{var Ot=Zs(),Yt=Q(Ot,!0);y(()=>D(Yt,e(ie).label)),g(At,Ot)},$$slots:{default:!0}});var ke=k(Ve,2),mt=Q(ke,!0);y(()=>D(mt,e(ie).description)),g(De,Me)},Ae=De=>{var Me=Bt();y(()=>D(Me,e(ie).label)),g(De,Me)};E(Ze,De=>{e(ie).description?De(be):De(Ae,-1)})}g(Ge,q)},$$slots:{title:!0}})},P=>{var ie=to();g(P,ie)}),A(W),A(oe),y(()=>{j(oe,"aria-label",e(X).label),D(Ee,e(X).label)}),g(U,oe)}),A(ce),A(x),A(l),y((U,X)=>{j(x,"aria-labelledby",`${o}-capabilities`),j(ee,"id",`${o}-capabilities`),D(K,U),D(ue,X)},[()=>c.chat_harnessFeaturesModal_capabilities_title(),()=>c.chat_harnessFeaturesModal_description()]),g(C,l)},$$slots:{default:!0}})}return $t(de)}var ro=h('<p role="alert" class="type-body text-danger"> </p>');function ka(a,n){if(new.target)return bt({component:ka,...a});yt(n,!0);const o=()=>$e(m,"$outcome$",i),[i,d]=Bn();let r=w(n,"open",15,!1),p=w(n,"agentName",7),f=w(n,"workspaceId",7),v=w(n,"agentId",7);const R=crypto.randomUUID(),S=Ct(""),m=bn(S,R),B=u(()=>o()?.workspaceId===f()&&o().agentId===v()?o():void 0),O=u(()=>e(B)?.status==="pending"),de=u(()=>e(B)?.status==="failed"?e(B).error:"");Pe(()=>{const l=f();return v(),S.set(l),()=>G.dispatch(zn(l,R))}),Pe(()=>{e(B)?.status==="succeeded"&&(r(!1),G.dispatch(ma(f(),R,e(B).requestId)))});function L(){const l=bn.select(G.state,f(),R);l?.agentId===v()&&l.status==="pending"||G.dispatch(wn(f(),R,crypto.randomUUID(),v(),{kind:"retire"}))}var C={get open(){return r()},set open(l=!1){r(l),b()},get agentName(){return p()},set agentName(l){p(l),b()},get workspaceId(){return f()},set workspaceId(l){f(l),b()},get agentId(){return v()},set agentId(l){v(l),b()},$set:kt,$on:(l,M)=>xt(n,l,M)};{const l=K=>{var ne=Qe(),ue=J(ne);{var ce=U=>{var X=ro(),oe=Q(X,!0);y(()=>D(oe,e(de))),g(U,X)};E(ue,U=>{e(de)&&U(ce)})}g(K,ne)};let M=u(()=>c.modals_retireAgent_title()),H=u(()=>c.modals_retireAgent_description({name:p()})),x=u(()=>c.modals_retireAgent_confirm_label()),ee=u(()=>c.modals_bulkActionConfirm_cancel_label());Gr(a,{get title(){return e(M)},get description(){return e(H)},get confirmLabel(){return e(x)},get cancelLabel(){return e(ee)},focusSubmit:!1,focusCancel:!0,get busy(){return e(O)},onConfirm:L,get open(){return r()},set open(K){r(K)},details:l,$$slots:{details:!0}})}var se=$t(C);return d(),se}function so({agentName:a,specialist:n}){const o=n?`{ topLevel: true, specialist: ${JSON.stringify(n)} }`:"{ topLevel: true }",i=n?`and keep the same specialist (${JSON.stringify(n)})`:"and, if you were created with a specialist, pass that exact same `specialist` value in the options";return`Please replace yourself with a fresh top-level agent and run a gradual, coordinated hand-off:
1
+ import{k as za,s as da}from"./CHKHRxNs.js";import{j as ca,h as Pt,s as j,l as Vt,k as fe,I as Fa,c as Ba,a as Nn}from"./jiHQQ6wA.js";import{Z as ja,cO as Ha,A as Ua,aX as bn,bT as qa,v as Wa}from"./D27--FO7.js";import{bo as u,t as bt,bq as w,a_ as E,by as kt,b as xt,bs as Bn,bu as $e,bt as Qa}from"./DJ6NhP2E.js";import{bo as jn,bs as yt,a5 as T,bl as Q,bS as k,bA as A,b_ as y,aD as e,W as g,bO as D,bn as $t,c9 as c,aA as b,ay as J,aB as h,ca as Pe,bH as _,a7 as Qe,b$ as Bt,bV as re,cd as Ct,br as ua,be as on,c5 as Ka,bi as En,bj as Ga,bf as vn,am as Jn,ax as Xn,ai as Va,aj as Ya,c0 as Ja}from"./DYhIMPy1.js";import{s as ga}from"./DBaJKI7v.js";import{f as Xa}from"./D2CQaCZ1.js";import{k as Za,a as er,H as pa,t as Gt}from"./BUjUgUAA.js";import{r as tr,o as nr,A as Zn,L as ar}from"./D_1oX83y.js";import{S as _n,t as Dn}from"./DppOK7dU.js";import{R as ea}from"./uxlSCqIr.js";import{I as fa}from"./ibhfo-VE.js";import"./BDRH2dQc.js";import{aB as hn,cw as rr,ak as sr,az as or,cq as ir,cr as lr,ag as dr,ai as cr,ap as ur,av as gr,k as pr,F as fr,dO as mr,L as vr,ch as _r,bQ as hr}from"./r-K_cVbp.js";import{HD as G,cg as zn,ce as ma,ch as wn,qs as wr,Ch as br,fJ as va,Cl as kr,bw as xr,yz as yr,m6 as ta,t1 as $r,ck as Ar,tC as na,n1 as Sr,C1 as Ir,Ck as Cr,c2 as Pr}from"./CG4aq4mO.js";import{K as Tr,A as Rr,ap as Or,ak as Lr,T as Nr}from"./51i2b0Zy.js";import{h as Er}from"./DmU7vUKt.js";import{f as aa}from"./CC1bGpw_.js";import{h as Dr,g as Mr}from"./CdwxdSGH.js";import"./DC-9q6_j.js";import{ax as zr,am as Fr,ap as Br,f as Mn,a5 as jr,bc as ra}from"./B9pc_pKk.js";import"./CK4Yr90U.js";import{c as Hr,r as Ur,q as qr,p as Wr,E as Qr}from"./NySn8Jgs.js";import{n as Kr,D as Gr,k as Vr,c as Yr,d as Jr,b as Xr,A as Zr,p as es,P as ts}from"./d1VpYuEe.js";import{F as ns,j as as,bn as rs,i as ss,bA as os}from"./CGE0UuGs.js";import{c as We}from"./jWThE6-J.js";import{T as is}from"./o17TbegD.js";import{ch as _a,cK as ls,cJ as ds,bO as cs,x as us,F as kn,b3 as gs,at as ps,aI as fs,aE as ms,cO as vs,bc as _s,az as hs,X as ws,aJ as bs,a$ as ks,ag as sa,a7 as xs,c2 as ys,af as $s,cA as As,am as Ss,cN as Is,aC as Cs}from"./C3Sa4Adg.js";import{b as Ps}from"./BaIAhI85.js";import"./BvdQxsGv.js";import{f as Ts}from"./CdYIhP6H.js";const Rs=80,Os=10,Ls=new ja(Ha,{renderer:{html({text:a}){return Ua(a)},image({tokens:a}){return this.parser.parseInline(a)}}});function Hn(a){const n=document.createElement("template");n.innerHTML=Ls.parseInline(a,{async:!1});for(const o of n.content.querySelectorAll("br"))o.replaceWith(" ");return(n.content.textContent??"").replace(/\s+/g," ").trim()}function Tt(a){return a.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`+([^`]*?)`+/g,"$1").replace(/<[^>]+>/g,"").replace(/\\([\\`*_[\]{}()#+\-.!>])/g,"$1").replace(/[*~]/g,"").replace(/(^|[^A-Za-z0-9])_+/g,"$1").replace(/_+([^A-Za-z0-9]|$)/g,"$1").replace(/\s+/g," ").trim()}function Fn(a,n){return a.slice(n).replace(/^(?:[ \t]*(?:\r\n|\n|\r))+/,"")}function $n(a,n){return!n||n.length>Rs||n.split(/\s+/).length>Os||/[.!?;]$/.test(n)?!1:!/^[ \t]*(?:[-+*][ \t]+|\d+[.)][ \t]+|>|```|~~~|\|)/.test(a)}function Ri(a){const o=a.trim().match(/^\*\*([^\r\n]+)\*\*$/);if(!o)return null;const i=Tt(o[1]);return $n(o[0],i)?i:null}function Un(a,n=!1,o=!0){const i=a.match(/^(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",r=a.slice(i.length).match(/^\*\*([^\r\n]+)\*\*[ \t]*(?:(?:\r\n|\n|\r)|$)/);if(!r)return null;if(n){const f=r[1],v=f.match(/\\+$/)?.[0].length??0;if(f!==f.trim()||f.includes("**")||f.startsWith("*")||f.endsWith("*")||v%2!==0)return null}const p=Tt(r[1]);return $n(r[0],p)?{title:n&&o?Hn(r[1]):p,body:Fn(a,i.length+r[0].length)}:null}function oa(a){const n=[];let o=a;for(;o.trim();){const i=qn(o,!0),d=i.heading?{body:i.body}:Un(o,!0,!1);if(!d)return null;n.push(o.slice(0,o.length-d.body.length)),o=d.body}return n.length?n:null}function Oi(a){const n=[];let o=a;for(;o.trim();){const i=qn(o,!0,Hn),d=i.heading?{title:i.heading,body:i.body}:Un(o,!0);if(!d)return null;n.push(d.title),o=d.body}return n.length?n:null}function Li(a){const n=Es(a),o=[];let i=a;for(n.heading&&(o.push({title:n.heading,body:""}),i=n.body);i;){const d=Un(i);if(!d||d.body.length>=i.length)break;o.push({title:d.title,body:""}),i=d.body}if(o.length===0){const d=a.trim(),r=Tt(d);return!d.includes(`
2
+ `)&&$n(d,r)?[{title:r,body:""}]:d?[{title:null,body:d}]:[]}return o[o.length-1].body=i.trim(),o}function Ns(a){const n=a.replace(/^ {0,3}/,"");return!/^(?:\s|>|`{3}|~{3}|(?:[-+*]|\d+[.)])(?:[ \t]|$)|#{1,6}(?:[ \t]|$)|<|\[[^\]]*\]:)/.test(n)&&!/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})$/.test(n)}function qn(a,n=!1,o=Tt){const i=a.match(/^(?:\uFEFF)?(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",d=a.slice(i.length);if(n&&/^(?: {4}| {0,3}\t)/.test(d))return{heading:null,body:a};const r=d.match(/^[ \t]{0,3}#{1,6}[ \t]+([^\r\n]*?)(?:[ \t]+#+)?[ \t]*(?:\r\n|\n|\r|$)/);if(r&&Tt(r[1]))return{heading:o(r[1]),body:Fn(a,i.length+r[0].length)};const p=d.match(/^([^\r\n]+)(?:\r\n|\n|\r)([ \t]{0,3})(?:=+|-+)[ \t]*(?:\r\n|\n|\r|$)/);return p&&(!n||Ns(p[1])&&!p[2].includes(" "))&&Tt(p[1])?{heading:o(p[1]),body:Fn(a,i.length+p[0].length)}:{heading:null,body:a}}function Es(a,{preserveInlineText:n=!1}={}){const o=n?Hn:Tt,i=qn(a,!1,o);if(i.heading)return i;const d=a.match(/^(?:\uFEFF)?(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",p=a.slice(d.length).match(/^([^\r\n]+)(?:\r\n|\n|\r)(?:[ \t]*(?:\r\n|\n|\r))+/);if(p){const f=Tt(p[1]),v=a.slice(d.length+p[0].length);if(v.trim()&&$n(p[1],f))return{heading:o(p[1]),body:v}}return{heading:null,body:a}}const jt="[--operational-row-inline-padding:var(--chat-operational-row-inline-padding,0.5rem)] [--operational-leading-slot-size:1.25rem] [--operational-leading-half-slot-size:0.625rem] [--operational-leading-gap:var(--chat-operational-leading-gap,0.5rem)]",Ni="type-body font-family-child font-normal text-muted-foreground",Ei=`${jt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))]`,Di=`${jt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))] pt-1.5`,Mi=`${jt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))] pt-1`,zi=`${jt} relative min-w-0 max-w-full`,Fi=`${jt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))]`,Bi=`${jt} operational-group-child-row ml-2 min-w-0 w-[calc(100%-0.5rem)] max-w-[calc(100%-0.5rem)]`,ji="pt-6",Hi="text-muted-foreground",Ui="text-muted-foreground",ha="font-normal text-muted-foreground",qi="tool-call-container group relative block w-full min-w-0 max-w-full overflow-hidden type-body font-family-child font-normal text-muted-foreground",Wi="h-[16px]! w-[16px]! shrink-0",Qi=`${jt} relative grid h-7 w-full min-w-0 max-w-full grid-cols-[var(--operational-leading-slot-size)_minmax(0,1fr)_auto] items-center gap-[var(--operational-leading-gap)] overflow-hidden rounded-md px-[var(--operational-row-inline-padding)] type-body transition-colors duration-[var(--motion-fast)] motion-reduce:transition-none`,Ki=`a11y-ignore pointer-events-none flex size-[var(--operational-leading-slot-size)] min-w-[var(--operational-leading-slot-size)] shrink-0 items-center justify-center [&_svg]:size-[16px]! ${ha}`,Gi=`type-body block min-w-0 max-w-full truncate overflow-hidden text-ellipsis whitespace-nowrap border-0 bg-transparent p-0 text-left ${ha}`,Vi="type-body flex min-w-0 shrink-0 items-center gap-1 whitespace-nowrap",Yi="h-[16px]! w-[16px]! shrink-0 opacity-60 transition-transform duration-[var(--motion-fast)] motion-reduce:transition-none";function Ji(a){return za(a,{axis:"y",duration:ca()?0:150})}function ln(a){return a.type==="thinking"||a.type==="tool_use"||a.type==="content_group"}function Xi(a){const n=a?.[0];return!n||ln(n)?"":"pt-4"}function Zi(a,n,o=()=>!0){const i=a[n];if(!i||!o(i)||!ln(i))return!1;let d=n-1;for(;d>=0&&!o(a[d]);)d-=1;return d>=0&&ln(a[d])}function el(a,n,o=()=>!0,i=!1){const d=a[n];if(!d||!o(d))return"";let r=n-1;for(;r>=0&&!o(a[r]);)r-=1;if(r<0)return"";const p=a[r];if(p.type==="thinking"&&d.type==="thinking")return i||oa(p.text??p.content??"")!==null&&oa(d.text??d.content??"")!==null?"":"pt-14";const f=ln(p),v=ln(d);return f&&v?"":p.type==="thinking"&&!v?"pt-6":f||v?"pt-4":"pt-1"}const tl="shrink-0 whitespace-nowrap text-ui text-subtle focus-visible:outline-none focus-visible:text-foreground";function Ds(a){if(a?.status==="halted")return u.agent_node_halted_label();if(a?.status==="resuming")return u.agent_node_resuming_label();if(a?.placement?.target==="remote"||a?.placement?.target==="e2b"){if(a.placementError)return u.remoteAgent_status_failed();if(a.cloudStart)return u.remoteAgent_status_starting();if(a.effectiveIsolation==="pending")return a.setup?.state==="pending"?u.remoteAgent_status_preparingCheckout():a.setup?.state==="running"?u.remoteAgent_status_runningSetup():u.remoteAgent_status_starting()}if(a?.placement&&a.effectiveIsolation==="pending")return u.agent_node_provisioning_label()}var Ms=h('<span class="owner-fill block h-full svelte-sxf8s9"></span>'),zs=h('<dd class="section-note pl-3.5 text-xs text-muted-foreground wrap-anywhere svelte-sxf8s9"> </dd>'),Fs=h('<div class="section-row py-0.5 svelte-sxf8s9"><dt class="flex min-w-0 items-start gap-2 text-sm text-foreground"><span class="owner-key mt-1.5 size-1.5 shrink-0 rounded-full svelte-sxf8s9"></span> <span class="min-w-0 wrap-anywhere"> </span></dt> <dd class="text-xs text-muted-foreground"> </dd> <dd> </dd> <!></div>'),Bs=h('<div class="min-w-0"><dt class="truncate text-sm text-foreground"> </dt> <dd class="text-xs text-muted-foreground wrap-anywhere"> </dd></div>'),js=h('<h4 class="mb-2 mt-4 text-xs font-normal text-muted-foreground"> </h4> <dl class="flex flex-col gap-2"></dl>',1),Hs=h('<section class="min-w-0" data-testid="prompt-breakdown"><div class="mb-3 flex items-baseline justify-between gap-3"><h3 class="text-sm font-medium"> </h3> <span class="shrink-0 text-sm tabular-nums text-muted-foreground"> </span></div> <div class="owner-strip mb-3 flex h-1.5 w-full overflow-hidden svelte-sxf8s9" role="img"></div> <dl class="section-list svelte-sxf8s9"></dl> <!></section>');function wa(a,n){const o=jn();if(new.target)return bt({component:wa,...a});yt(n,!0);let i=w(n,"breakdown",7);function d(l){return Za(l,{maximumFractionDigits:l<1e4?1:0})}function r(l){return l==="intent"?u.agent_contextBreakdown_owner_intent_label():u.agent_contextBreakdown_owner_user_label()}const p=c(()=>i().owners.map(l=>u.agent_contextBreakdown_ownerShare_label({owner:r(l.owner),tokens:d(l.estTokens)})).join(", "));var f={get breakdown(){return i()},set breakdown(l){i(l),b()},$set:kt,$on:(l,M)=>xt(n,l,M)},v=Hs(),R=T(v),S=T(R),m=Q(S,!0),B=k(S,2),O=Q(B,!0);A(R);var de=k(R,2);Pt(de,21,()=>i().owners,l=>l.owner,(l,M)=>{var H=Ms();let x;y(()=>{j(H,"data-owner",e(M).owner),x=Vt(H,"",x,{"flex-grow":e(M).share})}),g(l,H)}),A(de);var L=k(de,2);Pt(L,21,()=>i().rows,l=>l.key,(l,M)=>{var H=Fs(),x=T(H),ee=T(x),K=k(ee,2),ne=Q(K,!0);A(x);var ce=k(x,2),ue=Q(ce,!0),U=k(ce,2),X=Q(U,!0),oe=k(U,2);{var Ce=Ee=>{var W=zs(),P=Q(W,!0);y(ie=>D(P,ie),[()=>[e(M).counted?"":u.agent_contextBreakdown_notCounted_label(),e(M).hint??""].filter(Boolean).join(" · ")]),g(Ee,W)};E(oe,Ee=>{(e(M).hint||!e(M).counted)&&Ee(Ce)})}A(H),y((Ee,W)=>{j(H,"data-counted",e(M).counted),j(ee,"data-owner",e(M).owner),D(ne,e(M).label),D(ue,Ee),fe(U,1,`text-right text-sm tabular-nums ${e(M).counted?"text-foreground":"text-muted-foreground"}`),D(X,W)},[()=>r(e(M).owner),()=>d(e(M).estTokens)]),g(l,H)}),A(L);var C=k(L,2);{var se=l=>{var M=js(),H=J(M),x=Q(H,!0),ee=k(H,2);Pt(ee,21,()=>i().hiddenSkills,K=>K.name,(K,ne)=>{var ce=Bs(),ue=T(ce),U=Q(ue,!0),X=k(ue,2),oe=Q(X,!0);A(ce),y(Ce=>{D(U,e(ne).name),D(oe,Ce)},[()=>[e(ne).detail,e(ne).fix].filter(Boolean).join(" · ")]),g(K,ce)}),A(ee),y(K=>{j(H,"id",`${o}-hidden`),D(x,K),j(ee,"aria-labelledby",`${o}-hidden`)},[()=>u.agent_contextBreakdown_hiddenSkills_title()]),g(l,M)};E(C,l=>{i().hiddenSkills.length>0&&l(se)})}return A(v),y((l,M)=>{j(v,"aria-labelledby",`${o}-title`),j(S,"id",`${o}-title`),D(m,l),D(O,M),j(de,"aria-label",e(p))},[()=>u.agent_contextBreakdown_title(),()=>u.agent_contextBreakdown_tokens_label({tokens:d(i().estTokens)})]),g(a,v),$t(f)}const Us=["intent","user"],qs=["systemPrompt","toolDescription","provider"],xn=a=>typeof a=="object"&&a!==null&&!Array.isArray(a),yn=a=>typeof a=="number"&&Number.isFinite(a)&&a>=0,Ws=a=>a==="intent"||a==="user";function Qs(a,n){if(!xn(a))return null;const{id:o,label:i,owner:d,location:r,chars:p,estTokens:f,controlHint:v}=a;if(typeof o!="string"||typeof i!="string"||!Ws(d)||typeof r!="string"||!qs.includes(r)||!yn(p)||!yn(f))return null;const R=xn(v)&&typeof v.text=="string"&&v.text;return{key:`${n}:${o}`,id:o,label:i,owner:d,chars:p,estTokens:f,counted:r!=="provider",...R?{hint:R}:{}}}function Ks(a){if(!xn(a))return null;const{name:n,reason:o,detail:i,fix:d}=a;return[n,o,i,d].some(r=>typeof r!="string")?null:{name:n,reason:o,detail:i,fix:d}}function Gs(a){if(!xn(a)||a.available!==!0)return null;const{totalChars:n,estTokens:o,sections:i,hiddenSkills:d}=a;if(!yn(n)||!yn(o)||!Array.isArray(i)||!Array.isArray(d))return null;const r=i.map(Qs).filter(f=>f!==null).sort((f,v)=>v.chars-f.chars),p=Us.map(f=>{const v=r.filter(S=>S.counted&&S.owner===f),R=v.reduce((S,m)=>S+m.chars,0);return{owner:f,chars:R,estTokens:v.reduce((S,m)=>S+m.estTokens,0),share:n>0?R/n:0}}).filter(f=>f.chars>0);return{totalChars:n,estTokens:o,rows:r,owners:p,hiddenSkills:d.map(Ks).filter(f=>f!==null)}}async function Vs(a){try{const n=await zr("agent.getSession",{agentId:a});return Gs(n?.session?.promptBreakdown)}catch{return null}}const ia=ns.map(a=>({key:a.path.replace(/^agentFeatures\./,""),label:a.label,description:a.description}));function Ys(a){const n=a.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase().trim();return n.charAt(0).toUpperCase()+n.slice(1)}function Js(a){const n=a??{},o=ia.map(r=>({key:r.key,label:r.label(),description:r.description(),enabled:n[r.key]===!0,known:!0})),i=new Set(ia.map(r=>r.key)),d=[];for(const[r,p]of Object.entries(n))i.has(r)||d.push({key:r,label:Ys(r),description:null,enabled:p===!0,known:!1});return d.sort((r,p)=>r.label.localeCompare(p.label)),o.concat(d)}var Xs=h('<div class="mb-6 border-b border-border pb-6"><!></div>'),Zs=h("<span> </span>"),eo=h('<!> <span class="sr-only"> </span>',1),to=h('<div role="listitem" class="text-xs text-subtle" aria-hidden="true">—</div>'),no=h('<section class="min-w-0"><h4 class="text-sm font-medium mb-3"> </h4> <div role="list" class="space-y-2"></div></section>'),ao=h('<div class="@container"><!> <section><h3 class="text-sm font-medium"> </h3> <p class="mb-4 mt-1 text-sm text-muted-foreground"> </p> <div class="grid grid-cols-1 gap-6 @min-[28rem]:grid-cols-2" data-testid="harness-features-list"></div></section></div>');function ba(a,n){const o=jn();if(new.target)return bt({component:ba,...a});yt(n,!0);let i=w(n,"open",15,!1),d=w(n,"static",7,!1),r=w(n,"version",7),p=w(n,"features",7,null),f=w(n,"agentId",7),v=w(n,"breakdown",7),R=re(null);const S=c(()=>v()===void 0&&!!f());Pe(()=>{if(!i()||!e(S)||!f())return;const L=f();let C=!0;return Vs(L).then(se=>{C&&_(R,{agentId:L,view:se},!0)}),()=>{C=!1}});const m=c(()=>v()!==void 0?v():e(S)&&e(R)&&e(R).agentId===f()?e(R).view:null),B=c(()=>Js(p())),O=c(()=>[{enabled:!0,label:u.chat_shared_valueOn_label(),rows:e(B).filter(L=>L.enabled)},{enabled:!1,label:u.chat_shared_valueOff_label(),rows:e(B).filter(L=>!L.enabled)}]);var de={get open(){return i()},set open(L=!1){i(L),b()},get static(){return d()},set static(L=!1){d(L),b()},get version(){return r()},set version(L){r(L),b()},get features(){return p()},set features(L=null){p(L),b()},get agentId(){return f()},set agentId(L){f(L),b()},get breakdown(){return v()},set breakdown(L){v(L),b()},$set:kt,$on:(L,C)=>xt(n,L,C)};{let L=c(()=>u.chat_harnessFeaturesModal_title({version:r()}));Hr(a,{get static(){return d()},get title(){return e(L)},size:"wide",get open(){return i()},set open(C){i(C)},children:(C,se)=>{var l=ao(),M=T(l);{var H=U=>{var X=Xs(),oe=T(X);wa(oe,{get breakdown(){return e(m)}}),A(X),g(U,X)};E(M,U=>{e(m)&&U(H)})}var x=k(M,2),ee=T(x),K=Q(ee,!0),ne=k(ee,2),ce=Q(ne,!0),ue=k(ne,2);Pt(ue,21,()=>e(O),U=>U.enabled,(U,X)=>{var oe=no(),Ce=T(oe),Ee=Q(Ce,!0),W=k(Ce,2);Pt(W,21,()=>e(X).rows,P=>P.key,(P,ie)=>{Kr(P,{role:"listitem",class:"min-h-0 px-0 py-0 [&_.truncate]:whitespace-normal","data-testid":"harness-feature-state",get"data-feature"(){return e(ie).key},get"data-enabled"(){return e(ie).enabled},title:Ge=>{var q=Qe(),Ze=J(q);{var be=De=>{var Me=eo(),Ve=J(Me);Fr(Ve,{get content(){return e(ie).description},side:"top",size:"sm",children:(At,Rt)=>{var Ot=Zs(),Yt=Q(Ot,!0);y(()=>D(Yt,e(ie).label)),g(At,Ot)},$$slots:{default:!0}});var ke=k(Ve,2),mt=Q(ke,!0);y(()=>D(mt,e(ie).description)),g(De,Me)},Ae=De=>{var Me=Bt();y(()=>D(Me,e(ie).label)),g(De,Me)};E(Ze,De=>{e(ie).description?De(be):De(Ae,-1)})}g(Ge,q)},$$slots:{title:!0}})},P=>{var ie=to();g(P,ie)}),A(W),A(oe),y(()=>{j(oe,"aria-label",e(X).label),D(Ee,e(X).label)}),g(U,oe)}),A(ue),A(x),A(l),y((U,X)=>{j(x,"aria-labelledby",`${o}-capabilities`),j(ee,"id",`${o}-capabilities`),D(K,U),D(ce,X)},[()=>u.chat_harnessFeaturesModal_capabilities_title(),()=>u.chat_harnessFeaturesModal_description()]),g(C,l)},$$slots:{default:!0}})}return $t(de)}var ro=h('<p role="alert" class="type-body text-danger"> </p>');function ka(a,n){if(new.target)return bt({component:ka,...a});yt(n,!0);const o=()=>$e(m,"$outcome$",i),[i,d]=Bn();let r=w(n,"open",15,!1),p=w(n,"agentName",7),f=w(n,"workspaceId",7),v=w(n,"agentId",7);const R=crypto.randomUUID(),S=Ct(""),m=bn(S,R),B=c(()=>o()?.workspaceId===f()&&o().agentId===v()?o():void 0),O=c(()=>e(B)?.status==="pending"),de=c(()=>e(B)?.status==="failed"?e(B).error:"");Pe(()=>{const l=f();return v(),S.set(l),()=>G.dispatch(zn(l,R))}),Pe(()=>{e(B)?.status==="succeeded"&&(r(!1),G.dispatch(ma(f(),R,e(B).requestId)))});function L(){const l=bn.select(G.state,f(),R);l?.agentId===v()&&l.status==="pending"||G.dispatch(wn(f(),R,crypto.randomUUID(),v(),{kind:"retire"}))}var C={get open(){return r()},set open(l=!1){r(l),b()},get agentName(){return p()},set agentName(l){p(l),b()},get workspaceId(){return f()},set workspaceId(l){f(l),b()},get agentId(){return v()},set agentId(l){v(l),b()},$set:kt,$on:(l,M)=>xt(n,l,M)};{const l=K=>{var ne=Qe(),ce=J(ne);{var ue=U=>{var X=ro(),oe=Q(X,!0);y(()=>D(oe,e(de))),g(U,X)};E(ce,U=>{e(de)&&U(ue)})}g(K,ne)};let M=c(()=>u.modals_retireAgent_title()),H=c(()=>u.modals_retireAgent_description({name:p()})),x=c(()=>u.modals_retireAgent_confirm_label()),ee=c(()=>u.modals_bulkActionConfirm_cancel_label());Gr(a,{get title(){return e(M)},get description(){return e(H)},get confirmLabel(){return e(x)},get cancelLabel(){return e(ee)},focusSubmit:!1,focusCancel:!0,get busy(){return e(O)},onConfirm:L,get open(){return r()},set open(K){r(K)},details:l,$$slots:{details:!0}})}var se=$t(C);return d(),se}function so({agentName:a,specialist:n}){const o=n?`{ topLevel: true, specialist: ${JSON.stringify(n)} }`:"{ topLevel: true }",i=n?`and keep the same specialist (${JSON.stringify(n)})`:"and, if you were created with a specialist, pass that exact same `specialist` value in the options";return`Please replace yourself with a fresh top-level agent and run a gradual, coordinated hand-off:
3
3
 
4
4
  1. Create your replacement now: call \`ws.agent.create(${JSON.stringify(a)}, kickoffMessage, ${o})\`. The first argument must be your EXACT current name (${JSON.stringify(a)}) ${i}. Write the kickoff message as a thorough context hand-off: the overall goal, the current state of the work, key notes and files, decisions already made, and open threads.
5
5
 
@@ -9,4 +9,4 @@ import{k as za,s as da}from"./CSakj4K5.js";import{j as ua,h as Pt,s as j,l as Vt
9
9
 
10
10
  4. Have the replacement re-arm equivalents of your background state — hooks (\`ws.hook.*\`), PR monitors (\`ws.pr.monitor\`), event subscriptions, and agent watches — telling it exactly what each one watches and why. Once the replacement confirms its versions are active, cancel your own (anything left over is auto-cancelled when you retire).
11
11
 
12
- 5. Only after you and the replacement MUTUALLY agree the hand-off is complete — and your children and hooks are settled — call \`ws.agent.retire(reason)\` with a short reason to retire yourself.`}var oo=h('<p class="type-caption mb-3 text-muted-foreground"> </p> <!>',1),io=h("<!> <!>",1);function xa(a,n){if(new.target)return bt({component:xa,...a});yt(n,!0);let o=w(n,"open",15,!1),i=w(n,"static",7,!1),d=w(n,"agentName",7),r=w(n,"specialist",7,null),p=w(n,"onSend",7),f=w(n,"onCancel",7),v=re(ca(so({agentName:d(),specialist:r()})));const R=u(()=>e(v).trim().length>0);function S(){o(!1),f()?.()}function m(){if(!e(R))return;const O=e(v);o(!1),p()?.(O)}var B={get open(){return o()},set open(O=!1){o(O),b()},get static(){return i()},set static(O=!1){i(O),b()},get agentName(){return d()},set agentName(O){d(O),b()},get specialist(){return r()},set specialist(O=null){r(O),b()},get onSend(){return p()},set onSend(O){p(O),b()},get onCancel(){return f()},set onCancel(O){f(O),b()},$set:kt,$on:(O,de)=>xt(n,O,de)};{let O=u(()=>c.modals_replaceAgent_title()),de=u(()=>c.modals_replaceAgent_description({name:d()})),L=u(()=>c.modals_replaceAgent_close_ariaLabel()),C=u(()=>c.modals_replaceAgent_send_label()),se=u(()=>c.modals_replaceAgent_cancel_label());Vr(a,{get static(){return i()},get title(){return e(O)},get description(){return e(de)},get closeLabel(){return e(L)},get submitLabel(){return e(C)},get cancelLabel(){return e(se)},get canSubmit(){return e(R)},enterKey:"ignore",focusContent:!0,onSubmit:m,onCancel:S,get open(){return o()},set open(l){o(l)},children:(l,M)=>{var H=Qe(),x=J(H);We(x,()=>Zr,(ee,K)=>{K(ee,{type:"single",children:(ne,ue)=>{var ce=Qe(),U=J(ce);We(U,()=>Yr,(X,oe)=>{oe(X,{value:"instructions",children:(Ce,Ee)=>{var W=io(),P=J(W);We(P,()=>Jr,(lt,Ge)=>{Ge(lt,{inset:!1,children:(q,Ze)=>{on();var be=Bt();y(Ae=>D(be,Ae),[()=>c.modals_replaceAgent_instruction_ariaLabel()]),g(q,be)},$$slots:{default:!0}})});var ie=k(P,2);We(ie,()=>Xr,(lt,Ge)=>{Ge(lt,{inset:!1,children:(q,Ze)=>{var be=oo(),Ae=J(be),De=Q(Ae,!0),Me=k(Ae,2);{let Ve=u(()=>c.modals_replaceAgent_instruction_ariaLabel());is(Me,{get"aria-label"(){return e(Ve)},class:"max-h-72 min-h-48 w-full type-body",get value(){return e(v)},set value(ke){_(v,ke,!0)}})}y(Ve=>D(De,Ve),[()=>c.modals_replaceAgent_editHint_description()]),g(q,be)},$$slots:{default:!0}})}),g(Ce,W)},$$slots:{default:!0}})}),g(ne,ce)},$$slots:{default:!0}})}),g(l,H)},$$slots:{default:!0}})}return $t(B)}function lo(a,n,o){if(!a?.workspaceId||a.retiredAt)return[];const i=wr(a);return[{id:"toggle-background",label:i?c.chat_agentCard_menu_moveToForeground_label():c.chat_agentCard_menu_moveToBackground_label(),icon:_a,disabled:n,onClick:()=>{o(),G.dispatch(br(String(a.workspaceId),String(a.id),!i))}}]}function uo(a,n,o){const i=a?.pinned;return!a||!n||typeof i!="boolean"?[]:!i&&(a.retiredAt||va(a)!=="topLevel")?[]:[{id:"toggle-pinned",label:i?c.chat_agentCard_menu_unpin_label():c.chat_agentCard_menu_pinToTop_label(),icon:i?ls:ds,onClick:()=>{o(),G.dispatch(kr(n,String(a.id),!i))}}]}function co(a){return!(!a||a.harnessFeatures?.peerAgents!==!0||va(a)!=="topLevel"||a.retiredAt)}const go={compact:16};var po=h("<span><!></span>"),fo=h("<div></div>");function ya(a,n){if(new.target)return bt({component:ya,...a});yt(n,!0);let o=w(n,"duration",7,8),i=w(n,"class",7,""),d=w(n,"children",7);var r={get duration(){return o()},set duration(S=8){o(S),b()},get class(){return i()},set class(S=""){i(S),b()},get children(){return d()},set children(S){d(S),b()},$set:kt,$on:(S,m)=>xt(n,S,m)},p=Qe(),f=J(p);{var v=S=>{var m=po();let B;var O=T(m);ga(O,d),A(m),y(()=>{fe(m,1,`shimmer-text ${i()??""}`,"svelte-fys1qu"),B=Vt(m,"",B,{"animation-duration":`${o()??""}s`})}),g(S,m)},R=S=>{var m=fo();let B;y(()=>{fe(m,1,`absolute inset-0 overflow-hidden pointer-events-none z-20 shimmer-overlay ${i()??""}`,"svelte-fys1qu"),B=Vt(m,"",B,{"animation-duration":`${o()??""}s`})}),g(S,m)};E(f,S=>{d()?S(v):S(R,-1)})}return g(a,p),$t(r)}const mo="z-(--layer-popover) flex min-w-0 max-h-(--bits-popover-content-available-height) max-w-[min(calc(100vw_-_var(--space-4)),calc(var(--bits-popover-content-available-width)_-_var(--space-2)))] flex-col overflow-hidden rounded-(--radius-medium) border border-border bg-popover p-[var(--space-1)] text-popover-foreground shadow-(--elevation-overlay) outline-none transition-[opacity,scale] duration-(--motion-standard) ease-(--ease-emphasized-out) data-[starting-style]:scale-[0.98] data-[starting-style]:opacity-0 data-[ending-style]:scale-[0.98] data-[ending-style]:opacity-0 focus-visible:ring-2 focus-visible:ring-ring motion-reduce:scale-100 motion-reduce:transition-none";function vo(a,n){return ua()?{duration:0}:Ts(a,n,{duration:180})}function _o(a,n,o={}){return da(a,{tier:"moderate",y:-2},o)}var ho=h('<span aria-hidden="true"><!></span>'),wo=h('<!> <span dir="auto"><!></span>',1),bo=h('<span class="min-w-0 flex-1 truncate text-left"> </span> <span class="tabular-nums text-muted-foreground"> </span>',1),ko=h('<span class="flex min-w-0 items-center gap-2"><span class="min-w-0 flex-1 truncate"> </span> <span class="tabular-nums text-muted-foreground"> </span></span>'),la=h("<!> <!>",1),xo=h('<div class="flex min-w-0 shrink-0 flex-col gap-1 px-1 pb-2"><div class="relative min-w-0"><!> <!></div> <!></div>'),yo=h('<li class="flex min-h-7 min-w-0 items-start gap-2 overflow-hidden rounded-md px-2 py-1 text-popover-foreground transition-colors duration-(--motion-fast) motion-reduce:transition-none" data-testid="task-progress-row"><!></li>'),$o=h('<div class="shrink-0 px-2 py-1.5 text-muted-foreground" data-testid="task-progress-summary"> </div> <!> <div class="min-h-0 min-w-0 max-h-64 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none focus-visible:ring-2 focus-visible:ring-ring" data-testid="task-progress-scroll-region"><ul class="min-w-0" data-testid="task-progress-list"></ul> <!></div>',1),Ao=h('<span class="inline-flex size-4 items-center justify-center" aria-hidden="true" data-testid="task-progress-checklist-icon"><!></span>'),So=h('<span class="relative z-0 inline-flex shrink-0" data-testid="task-progress-stack-item" data-task-status="completed"><!></span>'),Io=h('<span data-testid="task-progress-stack-item"><!></span>'),Co=h('<span class="relative -ml-1.75 inline-flex shrink-0" data-testid="task-progress-stack-item" data-task-status="overflow"><span class="inline-flex size-3.5 shrink-0 items-center justify-center rounded-full bg-background text-foreground leading-none" aria-hidden="true" data-testid="task-progress-overflow-indicator"><!></span></span>'),Po=h('<span class="isolate flex items-center" aria-hidden="true" data-testid="task-progress-icon-stack"><!> <!> <!></span>'),To=h('<!> <span class="sr-only" role="status" aria-live="polite" aria-atomic="true" data-testid="task-progress-announcement"> </span> <!>',1);function $a(a,n){const o=jn();if(new.target)return bt({component:$a,...a});yt(n,!0);const i=(s,I=vn,le=vn,Be=vn,Se,Te)=>{let Je=Jn(()=>Xn(Se?.(),"")),xe=Jn(()=>Xn(Te?.(),!1));var ae=ho(),ye=T(ae);{var Z=F=>{{let ge=u(()=>e(xe)?14:8),Y=u(()=>e(xe)?"size-(--row-icon-size-regular)!":"size-2!");Fa(F,{get size(){return e(ge)},get class(){return e(Y)}})}},te=F=>{{let ge=u(()=>Sn(I())),Y=u(()=>e(xe)?14:I()==="pending"?6:8),Re=u(()=>e(xe)?"size-(--row-icon-size-regular)!":I()==="pending"?"size-1.5!":"size-2!");kn(F,{get icon(){return e(ge)},get size(){return e(Y)},get class(){return e(Re)}})}};E(ye,F=>{I()==="running"?F(Z):F(te,-1)})}A(ae),y(()=>{fe(ae,1,`inline-flex size-3.5 shrink-0 items-center justify-center rounded-full bg-background text-foreground leading-none ${e(Je)??""}`),j(ae,"data-testid",le()),j(ae,"data-task-status",I()),j(ae,"data-completed-count",Be())}),g(s,ae)},d=(s,I=vn)=>{var le=wo(),Be=J(le);i(Be,()=>I().status,()=>"task-progress-row-status-icon",()=>{},()=>"mt-0.5",()=>!0);var Se=k(Be,2),Te=T(Se);{var Je=ae=>{ya(ae,{duration:3,class:"line-clamp-2 min-w-0",children:(ye,Z)=>{on();var te=Bt();y(()=>D(te,I().title)),g(ye,te)},$$slots:{default:!0}})},xe=ae=>{var ye=Bt();y(()=>D(ye,I().title)),g(ae,ye)};E(Te,ae=>{I().status==="running"?ae(Je):ae(xe,-1)})}A(Se),y(()=>{fe(Se,1,`line-clamp-2 min-w-0 flex-1 ${I().status==="completed"?"text-muted-foreground":"text-popover-foreground"}`),j(Se,"title",I().title),Se.dir=Se.dir}),g(s,le)},r=s=>{var I=$o(),le=J(I),Be=Q(le,!0),Se=k(le,2);{var Te=Z=>{var te=xo(),F=T(te),ge=T(F);{let Oe=u(()=>c.chat_taskProgress_search_placeholder()),Ke=u(()=>c.chat_taskProgress_search_placeholder());fa(ge,{type:"search",size:"compact",class:"pr-8 [&::-webkit-search-cancel-button]:hidden",get placeholder(){return e(Oe)},get"aria-label"(){return e(Ke)},onkeydown:Ut,get ref(){return e(C)},set ref(me){_(C,me,!0)},get value(){return e(B)},set value(me){_(B,me,!0)}})}var Y=k(ge,2);{var Re=Oe=>{{let Ke=u(()=>c.chat_taskProgress_clearSearch_ariaLabel());Mn(Oe,{variant:"ghost-light",size:"icon-compact",class:"absolute right-0.5 top-1/2 -translate-y-1/2",get"aria-label"(){return e(Ke)},onclick:vt,children:(me,_t)=>{ws(me,{"aria-hidden":"true"})},$$slots:{default:!0}})}};E(Y,Oe=>{e(B)&&Oe(Re)})}A(F);var at=k(F,2);We(at,()=>_n.Root,(Oe,Ke)=>{Ke(Oe,{get value(){return e(O)},get items(){return e(Ge)},onchange:me=>_(O,me,!0),get open(){return e(de)},set open(me){_(de,me,!0)},children:(me,_t)=>{var Xe=la(),Et=J(Xe);{let et=u(()=>c.chat_taskProgress_filters_ariaLabel());We(Et,()=>_n.Trigger,(ht,Dt)=>{Dt(ht,{get"aria-label"(){return e(et)},class:"h-(--control-height-small) px-2",children:(St,rt)=>{var Le=bo(),st=J(Le),ut=Q(st,!0),ot=k(st,2),wt=Q(ot,!0);y(Mt=>{D(ut,e(q)?.label),D(wt,Mt)},[()=>Gt(e(q)?.count??0)]),g(St,Le)},$$slots:{default:!0}})})}var pn=k(Et,2);{let et=u(()=>v()?"panel-header-menu bg-background":"");We(pn,()=>_n.Content,(ht,Dt)=>{Dt(ht,{portal:!0,get wrapperId(){return o},get class(){return e(et)},children:(St,rt)=>{var Le=Qe(),st=J(Le);Pt(st,17,()=>e(Ge),ut=>ut.value,(ut,ot)=>{var wt=Qe(),Mt=J(wt);We(Mt,()=>_n.Item,(je,Ne)=>{Ne(je,{get value(){return e(ot).value},get label(){return e(ot).label},children:(tt,t)=>{var $=ko(),ve=T($),it=Q(ve,!0),Kt=k(ve,2),He=Q(Kt,!0);A($),y(ct=>{D(it,e(ot).label),D(He,ct)},[()=>Gt(e(ot).count)]),g(tt,$)},$$slots:{default:!0}})}),g(ut,wt)}),g(St,Le)},$$slots:{default:!0}})})}g(me,Xe)},$$slots:{default:!0}})}),A(te),g(Z,te)};E(Se,Z=>{e(ie)&&Z(Te)})}var Je=k(Se,2);j(Je,"tabindex",0);var xe=T(Je);Pt(xe,29,()=>e(Ye),Z=>Z.id,(Z,te)=>{var F=yo(),ge=T(F);d(ge,()=>e(te)),A(F),y(Y=>{j(F,"data-task-id",e(te).id),j(F,"data-task-status",e(te).status),j(F,"data-panel-menu-row",v()||void 0),j(F,"aria-label",Y)},[()=>c.chat_taskProgress_task_ariaLabel({status:Jt(e(te).status),title:e(te).title})]),er(F,()=>vo,null),pa(3,F,()=>_o),g(Z,F)}),A(xe);var ae=k(xe,2);{var ye=Z=>{Qr(Z,{density:"compact","data-testid":"task-progress-no-matches",title:ge=>{on();var Y=Bt();y(Re=>D(Y,Re),[()=>c.chat_taskProgress_noMatches_label()]),g(ge,Y)},actions:ge=>{Mn(ge,{variant:"ghost",size:"compact",onclick:V,children:(Y,Re)=>{on();var at=Bt();y(Oe=>D(at,Oe),[()=>c.chat_taskProgress_reset_label()]),g(Y,at)},$$slots:{default:!0}})},$$slots:{title:!0,actions:!0}})};E(ae,Z=>{e(Ye).length===0&&Z(ye)})}A(Je),Ps(Je,Z=>_(M,Z),()=>e(M)),y((Z,te)=>{j(le,"data-panel-menu-label",v()||void 0),D(Be,Z),j(Je,"aria-label",te)},[()=>c.chat_taskProgress_summary_label({completed:Gt(e(be).length),total:Gt(p().length)}),()=>c.chat_taskProgress_list_ariaLabel()]),g(s,I)};let p=w(n,"tasks",7),f=w(n,"presentation",7,"status-stack"),v=w(n,"embedded",7,!1),R=w(n,"workspaceId",7),S=w(n,"isActive",7,!0);Pe(()=>{if(!R()||!S())return;const s=R(),I=crypto.randomUUID();return Ka(()=>G.dispatch(xr(s,I))),()=>G.dispatch(yr(s,I))});let m=re(!1),B=re(""),O=re("all"),de=re(!1),L=re(!1),C=re(null),se=re(null),l=re(null),M=re(null),H=re(null),x=re(ca([])),ee=re(!1),K=re(!1),ne=!1,ue=!1,ce=null,U=re(""),X,oe;const Ce=5,Ee=120,W=8,P=["pending","running","waiting","discussion_needed","blocked","review_required","completed"],ie=u(()=>p().length>=W||e(L)),lt=u(()=>P.map(s=>({status:s,count:p().filter(I=>I.status===s).length}))),Ge=u(()=>[{value:"all",label:c.chat_taskProgress_all_label(),count:p().length},...e(lt).filter(({status:s,count:I})=>I>0||e(O)===s).map(({status:s,count:I})=>({value:s,label:Jt(s),count:I}))]),q=u(()=>e(Ge).find(s=>s.value===e(O))),Ze=u(()=>p().filter(s=>s.status!=="completed")),be=u(()=>p().filter(s=>s.status==="completed")),Ae=u(()=>e(Ze).filter(s=>s.status==="running")),De=u(()=>e(Ze).filter(s=>s.status!=="running")),Me=u(()=>e(be).length>0?1:0),Ve=u(()=>e(Ze).length+e(Me)),ke=u(()=>e(Ve)>Ce),mt=u(()=>Ce-e(Me)-(e(ke)?1:0)),At=u(()=>e(Ae).slice(0,e(mt))),Rt=u(()=>e(De).slice(0,Math.max(0,e(mt)-e(At).length))),Ot=u(()=>[...e(Rt),...e(At)]),Yt=u(()=>Math.max(0,e(Ve)-e(Me)-e(Ot).length)),An=u(()=>[...e(Ze),...e(be)]),Ht=u(()=>e(B).trim().toLowerCase()),Ye=u(()=>e(An).filter(s=>(e(O)==="all"||s.status===e(O))&&s.title.toLowerCase().includes(e(Ht)))),dn=u(()=>c.chat_taskProgress_progress_ariaLabel({completed:Gt(e(be).length),total:Gt(p().length)}));Pe(()=>{e(m)?p().length>=W&&_(L,!0):(_(B,""),_(O,"all"),_(de,!1),_(L,!1))}),Pe(()=>{p().length===0&&(_(m,!1),_(H,null),Nt());const s=new Map(p().map(le=>[le.id,`${le.status}\0${le.title}`]));if(!oe){oe=s;return}const I=p().find(le=>oe?.get(le.id)!==s.get(le.id));oe=s,I&&(clearTimeout(X),_(U,""),X=setTimeout(()=>{_(U,c.chat_taskProgress_task_ariaLabel({status:Jt(I.status),title:I.title}),!0)},Ee))}),Pe(()=>{const s=e(se)?.ownerDocument.defaultView;if(!s)return;const I=En(s,"pointerdown",Xt,{capture:!0}),le=En(s,"pointercancel",qt,{capture:!0}),Be=En(s,"focusin",gn,{capture:!0});return()=>{I(),le(),Be()}}),Ga(()=>{clearTimeout(X),_(H,null)}),Pe(()=>{e(m)||_(H,null),Qt()});function Jt(s){return s==="completed"?c.workspace_taskStatus_complete_label():s==="running"?c.workspace_taskStatus_inProgress_label():s==="waiting"?c.workspace_taskStatus_waiting_label():s==="discussion_needed"?c.workspace_taskStatus_discussionNeeded_label():s==="blocked"?c.workspace_taskStatus_blocked_label():s==="review_required"?c.workspace_taskStatus_reviewRequired_label():c.workspace_taskStatus_notStarted_label()}function Sn(s){return s==="completed"?ps:s==="waiting"?fs:s==="discussion_needed"?ms:s==="blocked"?vs:s==="review_required"?_s:hs}function Lt(s){if(_(m,s,!0),!s){_(H,null),ce=null;return}Nt();const I=e(se)?.closest("[data-panel-id]");_(x,I?[I]:[],!0)}function V(){_(O,"all"),vt()}function vt(){_(B,""),e(C)?.focus({preventScroll:!0})}function Ut(s){v()&&s.stopPropagation(),!(s.key!=="ArrowDown"&&s.key!=="PageDown")&&(s.preventDefault(),_(H,"list"),Qt())}function dt(s){return e(se)?.contains(s)||e(l)?.contains(s)||e(l)?.ownerDocument.getElementById(o)?.contains(s)}function Xt(s){!e(m)||s.button!==0||!(s.target instanceof Node)||dt(s.target)||(ce=s.pointerId,Wt())}function qt(s){ce===s.pointerId&&Nt()}function Wt(){_(K,!0),ne=!1,ue=!1}function Nt(){_(K,!1),ne=!1,ue=!1,ce=null}function In(s){s.pointerType==="touch"||e(m)||!e(K)||(ne=!0)}function Cn(s){s.pointerType==="touch"||e(m)||!e(K)||!ne||Nt()}function un(){!e(m)&&e(K)&&(ue=!0)}function Zt(){e(m)||!e(K)||!ue||Nt()}function cn(s){if(s.key==="Tab"&&e(m)){_(ee,!0),Lt(!1);return}if((s.key==="ArrowDown"||s.key==="PageDown")&&e(m)){s.preventDefault(),_(H,s.key==="ArrowDown"&&e(ie)?"search":"list",!0),Qt();return}s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),Lt(!e(m)))}function gn(s){!e(m)||!(s.target instanceof Node)||dt(s.target)||(e(K)&&(ue=!0),_(ee,!0),Lt(!1))}function Qt(){if(!e(m)||!e(H))return;const s=e(H)==="search"?e(C):e(M);s&&(s.focus({preventScroll:!0}),s.ownerDocument.activeElement===s&&_(H,null))}function ze(s){s.preventDefault(),Qt()}function Pn(s){s.preventDefault(),!e(m)&&(_(H,null),e(ee)||e(se)?.focus({preventScroll:!0}),_(ee,!1))}var Tn={get tasks(){return p()},set tasks(s){p(s),b()},get presentation(){return f()},set presentation(s="status-stack"){f(s),b()},get embedded(){return v()},set embedded(s=!1){v(s),b()},get workspaceId(){return R()},set workspaceId(s){R(s),b()},get isActive(){return S()},set isActive(s=!0){S(s),b()},$set:kt,$on:(s,I)=>xt(n,s,I)},en=Qe(),Fe=J(en);{var Rn=s=>{var I=Qe(),le=J(I);We(le,()=>Wr,(Be,Se)=>{Se(Be,{onOpenChange:Lt,get open(){return e(m)},set open(Te){_(m,Te,!0)},children:(Te,Je)=>{var xe=la(),ae=J(xe);We(ae,()=>Ur,(Z,te)=>{te(Z,{get icon(){return us},"data-testid":"task-progress-trigger",children:(F,ge)=>{on();var Y=Bt();y(Re=>D(Y,Re),[()=>c.chat_taskProgress_menu_label()]),g(F,Y)},$$slots:{default:!0}})});var ye=k(ae,2);We(ye,()=>qr,(Z,te)=>{te(Z,{class:"w-72","data-testid":"task-progress-popover",onOpenAutoFocus:F=>{F.preventDefault(),(e(ie)?e(C):e(M))?.focus()},get ref(){return e(l)},set ref(F){_(l,F,!0)},children:(F,ge)=>{r(F)},$$slots:{default:!0}})}),g(Te,xe)},$$slots:{default:!0}})}),g(s,I)},On=s=>{var I=Qe(),le=J(I);We(le,()=>ts,(Be,Se)=>{Se(Be,{onOpenChange:Lt,get open(){return e(m)},set open(Te){_(m,Te,!0)},children:(Te,Je)=>{var xe=To(),ae=J(xe);{let F=u(()=>e(m)||e(K));Br(ae,{get label(){return e(dn)},side:"bottom",delayDuration:300,get disabled(){return e(F)},children:(ge,Y)=>{var Re=Qe(),at=J(Re);{const Oe=(Ke,me)=>{let _t=()=>(me?.()).props;{let Xe=u(()=>f()==="status-stack"?"min-w-(--control-height-small) w-fit":"");Mn(Ke,Qa(_t,{variant:"ghost-light",size:"icon-sm",get active(){return e(m)},get class(){return`transition-[color,opacity,scale] motion-safe:active:scale-[0.97] motion-reduce:scale-100 ${e(Xe)??""}`},get"aria-label"(){return e(dn)},get"aria-expanded"(){return e(m)},onkeydown:cn,onpointerenter:In,onpointerleave:Cn,onblur:un,onfocus:Zt,"data-row-task-action":!0,"data-testid":"task-progress-trigger",children:(Et,pn)=>{var et=Qe(),ht=J(et);{var Dt=rt=>{var Le=Ao(),st=T(Le);cs(st,{get size(){return go.compact},weight:"regular",class:"size-4!"}),A(Le),g(rt,Le)},St=rt=>{var Le=Po(),st=T(Le);{var ut=je=>{var Ne=So(),tt=T(Ne);i(tt,()=>"completed",()=>"task-progress-status-icon",()=>e(be).length),A(Ne),g(je,Ne)};E(st,je=>{e(be).length>0&&je(ut)})}var ot=k(st,2);Pt(ot,19,()=>e(Ot),je=>je.id,(je,Ne,tt)=>{var t=Io();let $;var ve=T(t);i(ve,()=>e(Ne).status,()=>"task-progress-status-icon"),A(t),y(()=>{fe(t,1,`relative inline-flex shrink-0 ${e(be).length>0||e(tt)>0?"-ml-1.75":""}`),j(t,"data-task-id",e(Ne).id),$=Vt(t,"",$,{"z-index":e(Ne).status==="running"?Ce+1:e(tt)+1})}),g(je,t)});var wt=k(ot,2);{var Mt=je=>{var Ne=Co();Vt(Ne,"",{},{"z-index":Ce});var tt=T(Ne),t=T(tt);kn(t,{get icon(){return gs},size:8,class:"size-2!"}),A(tt),A(Ne),y(()=>j(tt,"data-overflow-count",e(Yt))),g(je,Ne)};E(wt,je=>{e(ke)&&je(Mt)})}A(Le),g(rt,Le)};E(ht,rt=>{f()==="checklist"?rt(Dt):rt(St,-1)})}g(Et,et)},$$slots:{default:!0}}))}};We(at,()=>Tr,(Ke,me)=>{me(Ke,{get ref(){return e(se)},set ref(_t){_(se,_t,!0)},child:Oe,$$slots:{child:!0}})})}g(ge,Re)},$$slots:{default:!0}})}var ye=k(ae,2),Z=Q(ye,!0),te=k(ye,2);We(te,()=>jr,(F,ge)=>{ge(F,{children:(Y,Re)=>{var at=Qe(),Oe=J(at);{let Ke=u(()=>c.chat_taskProgress_list_ariaLabel());We(Oe,()=>es,(me,_t)=>{_t(me,{role:"dialog",get"aria-label"(){return e(Ke)},align:"end",side:"bottom",sideOffset:4,get collisionBoundary(){return e(x)},collisionPadding:8,trapFocus:!1,onOpenAutoFocus:ze,onCloseAutoFocus:Pn,onFocusOutside:gn,get class(){return`${mo} type-caption w-72`},"data-testid":"task-progress-popover",get ref(){return e(l)},set ref(Xe){_(l,Xe,!0)},children:(Xe,Et)=>{r(Xe)},$$slots:{default:!0}})})}g(Y,at)},$$slots:{default:!0}})}),y(()=>D(Z,e(U))),g(Te,xe)},$$slots:{default:!0}})}),g(s,I)};E(Fe,s=>{p().length>0&&v()?s(Rn):p().length>0&&s(On,1)})}return g(a,en),$t(Tn)}var Ro=h('<span aria-hidden="true"></span>'),Oo=h('<span class="relative inline-flex size-4 shrink-0 items-center justify-center text-subtle" role="img" data-agent-machine-badge="icon"><!> <!></span>');function Aa(a,n){if(new.target)return bt({component:Aa,...a});yt(n,!0);let o=w(n,"location",7);const i=u(()=>as(o())),d=u(()=>o().cloud?.state??null),r=u(()=>o().state==="unreachable"?"bg-warning":o().state==="revoked"?"bg-danger":e(d)==="paused"?"bg-muted-foreground":e(d)==="starting"||e(d)==="resuming"?"bg-warning":null);var p={get location(){return o()},set location(m){o(m),b()},$set:kt,$on:(m,B)=>xt(n,m,B)},f=Oo(),v=T(f);{let m=u(()=>o().cloud?bs:ks);kn(v,{get icon(){return e(m)},class:"size-3.5!"})}var R=k(v,2);{var S=m=>{var B=Ro();y(()=>fe(B,1,`absolute -right-0.5 -top-0.5 size-1.5 rounded-full ring-1 ring-background ${e(r)??""}`)),g(m,B)};E(R,m=>{e(r)&&m(S)})}return A(f),y(()=>{j(f,"aria-label",e(i)),j(f,"title",e(i)),j(f,"data-agent-machine-state",o().state),j(f,"data-agent-cloud-state",e(d)??void 0)}),g(a,f),$t(p)}function Sa(a,n){if(new.target)return bt({component:Sa,...a});yt(n,!0);const o=()=>$e(S,"$agent$",d),i=()=>$e(m,"$machine$",d),[d,r]=Bn();let p=w(n,"agentId",7),f=w(n,"hidden",7,!1);const v=Ct(void 0),R=Ct(void 0);Pe(()=>{v.set(p())});const S=hn(v);Pe(()=>{R.set(o()?.nodeId)});const m=rs(R),B=u(()=>ss(o(),i()));var O={get agentId(){return p()},set agentId(l){p(l),b()},get hidden(){return f()},set hidden(l=!1){f(l),b()},$set:kt,$on:(l,M)=>xt(n,l,M)},de=Qe(),L=J(de);{var C=l=>{Aa(l,{get location(){return e(B)}})};E(L,l=>{e(B)&&!f()&&l(C)})}g(a,de);var se=$t(O);return r(),se}var Lo=h('<h3 data-testid="agent-card-name"> </h3>'),No=h('<span class="inline-flex shrink-0 items-center text-subtle svelte-jna96u" role="img" data-testid="agent-card-muted-indicator"><!></span>'),Eo=h('<span data-testid="agent-card-status"> </span>'),Do=h("<span> </span>"),Mo=h('<div class="ml-auto px-1 py-0.5 text-ui font-bold bg-muted text-subtle rounded mr-1 svelte-jna96u"> </div>'),zo=h('<div data-testid="agent-card-preview"><!></div>'),Fo=h('<p data-testid="agent-card-preview"> </p>'),Bo=h('<span class="shrink-0 svelte-jna96u"><!></span>'),jo=h('<div class="flex shrink-0 items-center gap-1.5 svelte-jna96u"><!> <!></div>'),Ho=h('<span class="text-subtle svelte-jna96u"> </span>'),Uo=h('<p data-testid="agent-card-attention"> <!></p>'),qo=h('<div class="block w-full min-w-0 max-w-full truncate whitespace-nowrap text-sm text-subtle svelte-jna96u" data-testid="agent-card-preview"><!></div>'),Wo=h('<p class="block w-full min-w-0 max-w-full truncate whitespace-nowrap text-sm text-subtle svelte-jna96u"> </p>'),Qo=h('<p class="block w-full min-w-0 max-w-full truncate whitespace-nowrap text-sm text-subtle svelte-jna96u" data-testid="agent-card-preview"> </p>'),Ko=h('<div class="mt-0.5 w-full min-w-0 max-w-full overflow-hidden svelte-jna96u" data-testid="agent-card-preview-row"><!></div>'),Go=h('<div data-testid="agent-card-avatar-wrapper"><!></div> <div><div><div><div><!> <span aria-hidden="true"></span></div> <!> <!> <!> <!> <!> <!></div> <!></div> <!></div>',1),Vo=h('<div class="relative h-6 w-14 shrink-0 svelte-jna96u"><!> <div class="absolute inset-0 flex items-center justify-end gap-1 svelte-jna96u"><!></div></div>'),Yo=h('<div data-testid="agent-card-trailing-slot"><!> <!></div>'),Jo=h('<div data-testid="agent-list-item"><!> <!></div>'),Xo=h("<!> <!> <!> <!> <!>",1);function Zo(a,n){if(new.target)return bt({component:Zo,...a});yt(n,!0);const o=()=>$e(Ot,"$mutation$",l),i=()=>$e(Yt,"$rename$",l),d=()=>$e(Rt,"$mutationWorkspaceIdStore",l),r=()=>$e(On,"$agent$",l),p=()=>$e(I,"$backgroundPending$",l),f=()=>$e(In,"$nodeCapabilities$",l),v=()=>$e(Cn,"$hubBusy$",l),R=()=>$e(Nt,"$retirementSupported$",l),S=()=>$e(le,"$agentDetailHydrated$",l),m=()=>$e(Je,"$parentAgent$",l),B=()=>$e(Jt,"$hasCapturedQuestion$",l),O=()=>$e(Lt,"$agentIsResponding$",l),de=()=>$e(Sn,"$pendingQuestionRecovery$",l),L=()=>$e(dn,"$agentPermCount",l),C=()=>$e(_t,"$preview$",l),se=()=>$e(ae,"$lineChanges$",l),[l,M]=Bn(),H=t=>{var $=Jo(),ve=T($);Xa(ve,()=>e(V)?"div":"button",!1,(He,ct)=>{Ba(He,()=>({type:e(V)?void 0:"button",class:`flex w-full min-w-0 max-w-full text-left gap-2 transition-colors duration-spring-fast ease-spring-fast motion-reduce:transition-none ${e(V)?"overflow-visible":"overflow-hidden"} ${e(V)?"cursor-text":"cursor-pointer"} group ${P()?`h-9 items-center rounded-md px-2 py-1.5 type-caption font-normal text-foreground dark:hover:bg-muted/60 focus-visible:-outline-offset-2 focus-visible:bg-selected dark:focus-visible:bg-muted focus-visible:outline-1 focus-visible:outline-ring focus-visible:ring-0 ${U()?"bg-selected dark:bg-muted":"bg-transparent hover:bg-hover"}`:W()?`border type-body items-center rounded-md ${lt()}`:"border px-1.75 pt-1.25 pb-1.5"} ${P()?"":U()||oe()?`bg-background border-border ${e(Et)} shadow-xs`:"border-transparent"} ${ie()??""}`,onclick:e(V)?void 0:ht,onkeydown:e(V)?void 0:Tn,oncontextmenu:e(V)?void 0:en,role:e(V)?"presentation":void 0,"aria-disabled":e(V)?void 0:ke(),"aria-current":!e(V)&&P()&&U()?"true":void 0,tabindex:e(V)||ke()?-1:void 0,"data-agent-panel-row":P()?x():void 0}),void 0,void 0,void 0,"svelte-jna96u");var gt=Go(),pt=J(gt),tn=T(pt);{let N=u(()=>P()?"emphasized":"standard");Rr(tn,{get agentId(){return x()},get variant(){return e(N)},get state(){return e(Y)},get specialist(){return e(Re)},get provider(){return be()}})}A(pt);var _e=k(pt,2),Ue=T(_e),It=T(Ue),zt=T(It),fn=T(zt);{var mn=N=>{{let z=u(()=>c.chat_agentCard_menu_rename_label()),Ie=u(()=>P()?"type-caption font-normal text-foreground":W()?"type-body font-normal text-muted-foreground":"text-sm font-normal text-foreground");fa(N,{variant:"inline",type:"text",get"aria-label"(){return e(z)},onblur:cn,onkeydowncapture:Qt,onkeyupcapture:ze,onfocusincapture:ze,onfocusoutcapture:ze,onpointerdowncapture:ze,onpointerupcapture:ze,onmousedowncapture:ze,onmouseupcapture:ze,onclickcapture:ze,ondblclickcapture:ze,oncontextmenucapture:ze,oncopycapture:ze,oncutcapture:ze,onpastecapture:ze,noFocusStyle:!0,get class(){return`inline-edit-input relative z-10 min-w-0 flex-1 truncate border-none bg-transparent hover:bg-transparent ${e(Ie)??""} outline-none! ring-0! focus:outline-none! focus:ring-0! focus-visible:outline-none! focus-visible:ring-0!`},get ref(){return e(Ut)},set ref(qe){_(Ut,qe,!0)},get value(){return e(vt)},set value(qe){_(vt,qe,!0)}})}},Ln=N=>{var z=Lo(),Ie=Q(z,!0);y(()=>{fe(z,1,`relative z-10 cursor-inherit whitespace-nowrap ${P()?"min-w-0 flex-1 truncate type-caption font-normal text-foreground":W()?ie()?"shrink-0 type-body font-normal text-muted-foreground!":"shrink-0 type-body font-normal text-muted-foreground":"shrink-0 text-sm font-normal text-foreground"}`,"svelte-jna96u"),j(z,"data-agent-row-name",P()?"":void 0),D(Ie,e(ye))}),Ya("dblclick",z,Pn),g(N,z)};E(fn,N=>{e(V)?N(mn):N(Ln,-1)})}var nn=k(fn,2);A(zt);var Wn=k(zt,2);{let N=u(()=>W()&&!P());Sa(Wn,{get agentId(){return x()},get hidden(){return e(N)}})}var Qn=k(Wn,2);{var Ia=N=>{var z=No(),Ie=T(z);kn(Ie,{get icon(){return sa},class:"h-3! w-3!"}),A(z),y((qe,Ft)=>{j(z,"aria-label",qe),j(z,"title",Ft)},[()=>c.chat_agentCard_notificationsMuted_tooltip(),()=>c.chat_agentCard_notificationsMuted_tooltip()]),g(N,z)};E(Qn,N=>{e(ge)&&(!W()||P())&&N(Ia)})}var Kn=k(Qn,2);{var Ca=N=>{var z=Eo(),Ie=Q(z,!0);y(()=>{fe(z,1,`${P()?"type-caption":"type-body"} shrink-0 truncate whitespace-nowrap font-normal text-muted-foreground`,"svelte-jna96u"),D(Ie,e(Oe))}),g(N,z)};E(Kn,N=>{e(Oe)&&N(Ca)})}var Gn=k(Kn,2);{var Pa=N=>{var z=Do(),Ie=Q(z,!0);y(qe=>{fe(z,1,`delegated-by-text min-w-0 shrink truncate whitespace-nowrap ${P()?"type-caption":"text-ui"} text-subtle ${P()?"max-w-[40%]":"ml-1"}`,"svelte-jna96u"),D(Ie,qe)},[()=>c.chat_agentCard_delegatedBy_label({name:e(xe)})]),g(N,z)};E(Gn,N=>{e(xe)&&(!W()||P())&&N(Pa)})}var Vn=k(Gn,2);{var Ta=N=>{var z=Mo(),Ie=Q(z,!0);y(qe=>D(Ie,qe),[()=>c.chat_agentCard_background_badge()]),g(N,z)};E(Vn,N=>{K()&&!P()&&N(Ta)})}var Ra=k(Vn,2);{var Oa=N=>{var z=Qe(),Ie=J(z);{var qe=ft=>{var he=zo();fe(he,1,"ml-2.5 min-w-0 flex-1 overflow-hidden whitespace-nowrap text-sm font-normal! text-muted-foreground svelte-jna96u");var pe=T(he);Zn(pe,{get toolUse(){return C().toolUse},showIcon:!1,class:An}),A(he),g(ft,he)},Ft=ft=>{var he=Fo();fe(he,1,"ml-2.5 min-w-0 flex-1 truncate whitespace-nowrap text-sm font-normal! text-muted-foreground svelte-jna96u");var pe=Q(he,!0);Nn(he,(we,nt)=>Dn?.(we,nt),()=>e(et)),y(()=>{j(he,"aria-label",e(et)),D(pe,e(et))}),g(ft,he)};E(Ie,ft=>{C().kind==="live-tool"||C().kind==="last-tool"?ft(qe):ft(Ft,-1)})}g(N,z)};E(Ra,N=>{W()&&!Ee()&&C()&&N(Oa)})}A(It);var La=k(It,2);{var Na=N=>{var z=jo(),Ie=T(z);{var qe=he=>{ar(he,{get additions(){return se().additions},get deletions(){return se().deletions},size:"xs"})};E(Ie,he=>{!P()&&se()&&(se().additions>0||se().deletions>0)&&he(qe)})}var Ft=k(Ie,2);{var ft=he=>{var pe=Bo(),we=T(pe);{let nt=u(()=>P()?"type-caption tabular-nums":"text-ui");ea(we,{get date(){return e(Xe)},compact:!0,get class(){return`${e(nt)??""} text-subtle`}})}A(pe),y(()=>j(pe,"data-agent-row-time",P()?"":void 0)),g(he,pe)};E(Ft,he=>{e(Xe)&&!Ae()&&he(ft)})}A(z),y(()=>j(z,"data-agent-row-trailing",P()?"":void 0)),g(N,z)};E(La,N=>{(!W()||P())&&N(Na)})}A(Ue);var Ea=k(Ue,2);{var Da=N=>{var z=Ko(),Ie=T(z);{var qe=pe=>{var we=Uo(),nt=T(we,!0),an=k(nt);{var rn=sn=>{var Yn=Ho(),Ma=Q(Yn);y(()=>D(Ma,`· ${C().attention.reason??""}`)),g(sn,Yn)};E(an,sn=>{C().attention.reason&&sn(rn)})}A(we),y(sn=>{fe(we,1,`block w-full min-w-0 max-w-full truncate whitespace-nowrap text-sm ${C().attention.kind==="blocker"?"text-red-500":"text-warning-ink"}`,"svelte-jna96u"),D(nt,sn)},[()=>C().attention.kind==="blocker"?c.chat_agentCard_attentionBlocker_label():c.chat_agentCard_attentionDiscussion_label()]),g(pe,we)},Ft=pe=>{var we=qo(),nt=T(we);Zn(nt,{get toolUse(){return C().toolUse},get animate(){return e(F)}}),A(we),g(pe,we)},ft=pe=>{var we=Wo(),nt=Q(we,!0);Nn(we,(an,rn)=>Dn?.(an,rn),()=>C().text),y(()=>D(nt,C().text)),g(pe,we)},he=pe=>{var we=Qo(),nt=Q(we,!0);Nn(we,(an,rn)=>Dn?.(an,rn),()=>C().text),y(()=>D(nt,C().text)),g(pe,we)};E(Ie,pe=>{C().kind==="attention"?pe(qe):C().kind==="live-tool"||C().kind==="last-tool"?pe(Ft,1):C().kind==="report"?pe(ft,2):pe(he,-1)})}A(z),pa(3,z,()=>da,()=>({tier:"fast"})),g(N,z)};E(Ea,N=>{!W()&&!Ee()&&C()&&N(Da)})}A(_e),y(()=>{fe(pt,1,`agent-card-avatar-wrapper relative shrink-0 ${P()?"agent-card-avatar-wrapper--panel":W()?"":"mt-[-0.8px] -mb-1"}`,"svelte-jna96u"),fe(_e,1,`agent-card-content flex min-w-0 max-w-full flex-1 ${e(V)?"overflow-visible":"overflow-hidden"} ${e(Ht)?Ae()?"mr-25":"mr-11":Ae()?"mr-14":""} ${W()||P()?"flex-row items-center gap-2":"flex-col"}`,"svelte-jna96u"),fe(Ue,1,`agent-card-header flex w-full min-w-0 max-w-full items-center gap-1.5 ${e(V)?"overflow-visible":"overflow-hidden"} ${W()?"inline-agent-card-header":P()?"agent-panel-row-header":"pr-1.5"}`,"svelte-jna96u"),fe(It,1,`flex-1 min-w-0 flex items-center ${P()?`gap-1.5 ${e(V)?"overflow-visible":"overflow-hidden"}`:W()?"gap-0":"gap-1.5"} ${ie()||P()?"font-normal":"font-medium"} ${W()?e(V)?"overflow-visible":"overflow-hidden":""}`,"svelte-jna96u"),fe(zt,1,`relative flex min-w-0 items-center ${e(V)||!W()?"flex-1":""} ${e(V)?"overflow-visible":"overflow-hidden"}`,"svelte-jna96u"),fe(nn,1,`pointer-events-none absolute z-0 rounded-(--radius-small) transition-[inset,background-color] duration-(--motion-standard) ease-(--ease-standard) motion-reduce:transition-none ${e(V)?"-inset-x-2 -inset-y-0.5 bg-hover dark:bg-surface-1":"-inset-x-1 -inset-y-0.5 bg-transparent"}`,"svelte-jna96u")}),g(ct,gt)});var it=k(ve,2);{var Kt=He=>{var ct=Yo(),gt=T(ct);{var pt=Ue=>{$a(Ue,{get tasks(){return De()},get presentation(){return Me()}})};E(gt,Ue=>{e(Ht)&&Ue(pt)})}var tn=k(gt,2);{var _e=Ue=>{var It=Vo(),zt=T(It);{var fn=nn=>{ea(nn,{get date(){return e(Xe)},compact:!0,class:"type-caption tabular-nums absolute inset-0 flex items-center justify-end text-right font-normal! text-muted-foreground transition-opacity group-hover/watch:opacity-0 group-focus-within/watch:opacity-0"})};E(zt,nn=>{e(Xe)&&nn(fn)})}var mn=k(zt,2),Ln=T(mn);ga(Ln,Ae),A(mn),A(It),g(Ue,It)};E(tn,Ue=>{Ae()&&Ue(_e)})}A(ct),y(()=>fe(ct,1,`absolute right-3 top-1/2 z-10 flex h-6 shrink-0 -translate-y-1/2 items-center justify-end ${e(Ht)?Ae()?"w-25":"w-11":"w-14"}`,"svelte-jna96u")),g(He,ct)};E(it,He=>{(Ae()||e(Ht))&&He(Kt)})}A($),y(()=>{Vt($,`padding-left: ${X()*10}px; container-type: inline-size;`),fe($,1,`relative w-full min-w-0 max-w-full ${e(V)?"overflow-visible":"overflow-hidden"} agent-card-container`,"svelte-jna96u"),j($,"data-agent-id",x())}),g(t,$)};let x=w(n,"agentId",7),ee=w(n,"agentName",7),K=w(n,"isBackground",7,!1),ne=w(n,"onclick",7),ue=w(n,"completionReport",7),ce=w(n,"lastResponseSummary",7),U=w(n,"selected",7,!1),X=w(n,"depth",7,0),oe=w(n,"showBorder",7,!1),Ce=w(n,"showStateBorder",7,!1),Ee=w(n,"hidePreview",7,!1),W=w(n,"inline",7,!1),P=w(n,"panelRow",7,!1),ie=w(n,"typographyClass",7,""),lt=w(n,"inlineRowClass",7,"px-1.5 py-1"),Ge=w(n,"statusLabel",7),q=w(n,"workspace",7,null),Ze=w(n,"isCompleted",7,!1),be=w(n,"provider",7,void 0),Ae=w(n,"headerActions",7),De=w(n,"taskProgress",23,()=>[]),Me=w(n,"taskProgressPresentation",7,"status-stack"),Ve=w(n,"updatedAt",7,void 0),ke=w(n,"readOnly",7,!1);const mt=crypto.randomUUID(),At=crypto.randomUUID(),Rt=Ct(""),Ot=bn(Rt,mt),Yt=bn(Rt,At);Pe(()=>{const t=e(s);return x(),Rt.set(t),()=>{G.dispatch(zn(t,mt)),G.dispatch(zn(t,At))}}),Pe(()=>{for(const t of[o(),i()])!t||t.workspaceId!==e(s)||t.agentId!==x()||t.status==="pending"||(t.operation.kind==="stop"&&Fe(),G.dispatch(ma(d(),t.id,t.requestId)))});const An="font-normal! text-muted-foreground",Ht=u(()=>De().length>0),Ye=Ct(x());Pe(()=>{Ye.set(x())});const dn=qa(Ye),Jt=Er(Ye),Sn=rr(Ye),Lt=sr(Ye);Pe(()=>{const t=q()?.id;!t||ke()||hn.select(G.state,x())||G.dispatch(ta(String(t),x()))});let V=re(!1),vt=re(""),Ut=re(null),dt=re(null),Xt=re(!1),qt=re(!1),Wt=re(!1);const Nt=or(),In=ir(),Cn=lr();function un(t){const $=r()?.workspaceId;Fe(),$&&G.dispatch(Pr(String($),x(),t))}async function Zt(){ke()||e(V)||(_(vt,e(ye),!0),_(V,!0),await Ja(),e(Ut)?.focus(),e(Ut)?.select())}function cn(){if(!e(V))return;const t=e(vt).trim();if(_(V,!1),_(vt,""),t&&t!==e(ye)){const $=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;$&&G.dispatch(wn($,At,crypto.randomUUID(),x(),{kind:"rename",name:t}))}}function gn(){_(V,!1),_(vt,"")}function Qt(t){t.stopPropagation(),t.key==="Enter"&&!t.isComposing?(t.preventDefault(),cn()):t.key==="Escape"&&(t.preventDefault(),gn())}function ze(t){t.stopPropagation()}function Pn(t){ke()||(t.preventDefault(),t.stopPropagation(),Zt())}function Tn(t){if(!ke()){if(t.key==="ContextMenu"||t.shiftKey&&t.key==="F10"){en(t);return}t.key==="Enter"&&ra({event:t})||ne()&&(t.key==="Enter"||t.key===" ")?(t.preventDefault(),t.stopPropagation(),ht(t)):t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),Zt())}}function en(t){if(ke())return;const $=Or(t);if(!$)return;_(dt,{...$,sourcePanelId:aa(t.currentTarget)},!0),r()?.effectiveIsolation==="isolated"&&G.dispatch($r()),G.dispatch(Ar());const ve=r()?.workspaceId??q()?.id;ve&&G.dispatch(ta(String(ve),x()))}function Fe(){_(dt,null)}function Rn(){const t=[{id:"open",label:c.chat_agentCard_menu_open_label(),icon:xs,onClick:()=>{{const _e=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;_e&&G.dispatch(na(_e,{agentId:x(),sourcePanelId:e(dt)?.sourcePanelId}))}Fe()}},{type:"separator"},{id:"rename",label:c.chat_agentCard_menu_rename_label(),icon:ys,onClick:()=>{Zt(),Fe()}}];if(P()){const _e=r()?.workspaceId??q()?.id;t.push(...uo(r(),_e?String(_e):void 0,Fe))}if(t.push(...lo(r(),p(),Fe)),r()){const _e=e(ge);t.push({id:"toggle-notifications-muted",label:_e?c.chat_agentCard_menu_unmuteNotifications_label():c.chat_agentCard_menu_muteNotifications_label(),icon:_e?$s:sa,onClick:async()=>{const Ue=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;Fe(),Ue&&G.dispatch(Cr(Ue,x(),!_e))}})}const $=r()?.workspaceId??q()?.id,ve=vr(q())||!!$&&_r.select(G.state,String($)),it=r()?.effectiveIsolation==="isolated";f().agentNodes&&it&&!ve&&(t.push({id:"hub-merge",label:c.agent_hub_merge(),disabled:v()||!r()?.checkpoint?.id,onClick:()=>{un("merge")}}),t.push({id:"hub-discard",label:c.agent_hub_discard(),disabled:v(),onClick:()=>{un("discard")}})),e(F)&&(t.push({type:"separator"}),t.push({id:"stop",label:c.chat_agentCard_menu_stop_label(),icon:As,disabled:o()?.agentId===x()&&o().operation.kind==="stop"&&o().status==="pending",onClick:()=>{const _e=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;_e?G.dispatch(wn(_e,mt,crypto.randomUUID(),x(),{kind:"stop"})):Fe()}})),t.push({type:"separator"}),!ke()&&!K()&&co(r())&&t.push({id:"replace-agent",label:c.chat_agentCard_menu_replaceAgent_label(),icon:_a,onClick:()=>{_(qt,!0),Fe()}});const Kt=r()?.workspaceId||q()?.id,He=Kt?String(Kt):void 0,ct=!!He&&hr.select(G.state,He);R()&&He&&r()&&!r().retiredAt&&t.push({id:"retire-agent",label:c.modals_retireAgent_confirm_label(),icon:Ss,onClick:()=>{_(Wt,!0),Fe()}}),ct||t.push({id:"delete",label:c.chat_agentCard_menu_delete_label(),icon:Is,destructive:!0,onClick:()=>{He&&Dr()&&Mr(He).closeTabsByType("agent","agentId",x()),Fe(),He&&G.dispatch(wn(He,mt,crypto.randomUUID(),x(),{kind:"delete",name:ee()||void 0}))}});const gt=e(Re),pt=r()?.harnessVersion,tn=r()?.harnessFeatures!==void 0||S();if((gt||pt)&&t.push({type:"separator"}),gt){const _e=os.select(G.state,gt)??gt;t.push({type:"label",id:"specialist",label:c.chat_agentCard_menu_specialist_label({name:_e})})}return pt&&t.push({id:"harness-version",label:c.chat_agentCard_menu_harnessVersion_label({version:pt}),icon:Cs,disabled:!tn,onClick:()=>{_(Xt,!0),Fe()}}),t}const On=hn(Ye),s=u(()=>String(r()?.workspaceId||q()?.id||"")),I=dr(Ye),le=ur(Ye),Be=u(()=>pr(r())),Se=u(()=>e(Be)?.parentAgentId),Te=Ct("");Pe(()=>{Te.set(e(Se)??"")});const Je=hn(Te),xe=u(()=>e(Se)?m()?.name:void 0),ae=cr(Ye),ye=u(()=>e(Be)?.name||ee()||c.chat_shared_agentName_fallback()),Z=u(()=>Sr(r())),te=u(()=>B()?!0:(O(),r()?.metadata?.pendingQuestionsMessageId,r()?.metadata?.dismissedQuestionsMessageId,de(),Wa(G.state,x(),r()?.messages??[]))),F=u(()=>r()?fr(mr(r())):!1),ge=u(()=>r()?.notificationsMuted===!0),Y=u(()=>Lr(r(),{hasPermissionRequest:L()>0,hasQuestion:e(te),isActive:U(),isCompleted:Ze(),attentionKind:e(Z)?.kind??null})),Re=u(()=>r()?.metadata?.specialist||r()?.agentMetadata?.specialist||null);function at(t){const $=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;$&&G.dispatch(Ir(x(),{wsId:$,text:t,agentName:e(ye)}))}const Oe=u(()=>Ds(r())??Ge()),Ke=Ct(ue()),me=Ct(ce());Pe(()=>{Ke.set(ue()),me.set(ce())});const _t=gr(Ye,Ke,me),Xe=u(()=>Ve()??r()?.updatedAt),Et=u(()=>Ce()?e(Y)==="running"||e(Y)==="responding"?"agent-glow-active":e(Y)==="failed"?"shadow shadow-red-500 shadow-sm":e(Y)==="needs-permission"||e(Y)==="attention-discussion"?"shadow shadow-warning shadow-sm":e(Y)==="attention-blocker"?"shadow shadow-red-500 shadow-sm":e(Y)==="waiting"?"shadow shadow-warning shadow-sm":"glow-transparent":""),pn=u(()=>{const t=C();if(!t||t.kind==="live-tool"||t.kind==="last-tool")return"";if(t.kind!=="attention")return t.text;const $=t.attention.kind==="blocker"?c.chat_agentCard_attentionBlocker_label():c.chat_agentCard_attentionDiscussion_label();return t.attention.reason?`${$} · ${t.attention.reason}`:$});let et=re("");Pe(()=>{const t=e(pn);let $=!1;if(!t){_(et,"");return}return tr(t).then(ve=>{$||_(et,ve,!0)}),()=>{$=!0}});function ht(t){if(!ke())if(ne())ne()(t);else{const $=aa(t.currentTarget),ve=ra({event:t}),it=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;if(!it||nr(t,it,x()))return;G.dispatch(na(it,{agentId:x(),sourcePanelId:$,openInAdjacentPanel:ve}))}}var Dt={get agentId(){return x()},set agentId(t){x(t),b()},get agentName(){return ee()},set agentName(t){ee(t),b()},get isBackground(){return K()},set isBackground(t=!1){K(t),b()},get onclick(){return ne()},set onclick(t){ne(t),b()},get completionReport(){return ue()},set completionReport(t){ue(t),b()},get lastResponseSummary(){return ce()},set lastResponseSummary(t){ce(t),b()},get selected(){return U()},set selected(t=!1){U(t),b()},get depth(){return X()},set depth(t=0){X(t),b()},get showBorder(){return oe()},set showBorder(t=!1){oe(t),b()},get showStateBorder(){return Ce()},set showStateBorder(t=!1){Ce(t),b()},get hidePreview(){return Ee()},set hidePreview(t=!1){Ee(t),b()},get inline(){return W()},set inline(t=!1){W(t),b()},get panelRow(){return P()},set panelRow(t=!1){P(t),b()},get typographyClass(){return ie()},set typographyClass(t=""){ie(t),b()},get inlineRowClass(){return lt()},set inlineRowClass(t="px-1.5 py-1"){lt(t),b()},get statusLabel(){return Ge()},set statusLabel(t){Ge(t),b()},get workspace(){return q()},set workspace(t=null){q(t),b()},get isCompleted(){return Ze()},set isCompleted(t=!1){Ze(t),b()},get provider(){return be()},set provider(t=void 0){be(t),b()},get headerActions(){return Ae()},set headerActions(t){Ae(t),b()},get taskProgress(){return De()},set taskProgress(t=[]){De(t),b()},get taskProgressPresentation(){return Me()},set taskProgressPresentation(t="status-stack"){Me(t),b()},get updatedAt(){return Ve()},set updatedAt(t=void 0){Ve(t),b()},get readOnly(){return ke()},set readOnly(t=!1){ke(t),b()},$set:kt,$on:(t,$)=>xt(n,t,$)},St=Xo(),rt=J(St);H(rt);var Le=k(rt,2);{var st=t=>{{let $=u(Rn);Nr(t,{get x(){return e(dt).x},get y(){return e(dt).y},get returnFocus(){return e(dt).returnFocus},get items(){return e($)},onClickOutside:Fe})}};E(Le,t=>{e(dt)&&!ke()&&t(st)})}var ut=k(Le,2);{var ot=t=>{{let $=u(()=>r()?.harnessFeatures??null);ba(t,{get version(){return r().harnessVersion},get features(){return e($)},get agentId(){return x()},get open(){return e(Xt)},set open(ve){_(Xt,ve,!0)}})}};E(ut,t=>{r()?.harnessVersion&&t(ot)})}var wt=k(ut,2);{var Mt=t=>{{let $=u(()=>r()?.name||ee()||""),ve=u(()=>String(r()?.workspaceId||q()?.id));ka(t,{get agentName(){return e($)},get workspaceId(){return e(ve)},get agentId(){return x()},get open(){return e(Wt)},set open(it){_(Wt,it,!0)}})}};E(wt,t=>{e(Wt)&&t(Mt)})}var je=k(wt,2);{var Ne=t=>{xa(t,{get agentName(){return e(ye)},get specialist(){return e(Re)},onSend:at,get open(){return e(qt)},set open($){_(qt,$,!0)}})};E(je,t=>{e(qt)&&t(Ne)})}g(a,St);var tt=$t(Dt);return M(),tt}Va(["dblclick"]);export{Zo as A,Zi as B,go as C,mo as D,ln as E,co as F,uo as G,ba as H,oa as I,Ji as J,ji as N,Ei as O,xa as R,ya as S,$a as T,Aa as a,Yi as b,qi as c,Wi as d,Ki as e,Qi as f,Gi as g,ha as h,Vi as i,tl as j,Di as k,Fi as l,Bi as m,zi as n,Mi as o,Hi as p,jt as q,Ni as r,Ui as s,ka as t,Es as u,Li as v,Ri as w,Oi as x,el as y,Xi as z};
12
+ 5. Only after you and the replacement MUTUALLY agree the hand-off is complete — and your children and hooks are settled — call \`ws.agent.retire(reason)\` with a short reason to retire yourself.`}var oo=h('<p class="type-caption mb-3 text-muted-foreground"> </p> <!>',1),io=h("<!> <!>",1);function xa(a,n){if(new.target)return bt({component:xa,...a});yt(n,!0);let o=w(n,"open",15,!1),i=w(n,"static",7,!1),d=w(n,"agentName",7),r=w(n,"specialist",7,null),p=w(n,"onSend",7),f=w(n,"onCancel",7),v=re(ua(so({agentName:d(),specialist:r()})));const R=c(()=>e(v).trim().length>0);function S(){o(!1),f()?.()}function m(){if(!e(R))return;const O=e(v);o(!1),p()?.(O)}var B={get open(){return o()},set open(O=!1){o(O),b()},get static(){return i()},set static(O=!1){i(O),b()},get agentName(){return d()},set agentName(O){d(O),b()},get specialist(){return r()},set specialist(O=null){r(O),b()},get onSend(){return p()},set onSend(O){p(O),b()},get onCancel(){return f()},set onCancel(O){f(O),b()},$set:kt,$on:(O,de)=>xt(n,O,de)};{let O=c(()=>u.modals_replaceAgent_title()),de=c(()=>u.modals_replaceAgent_description({name:d()})),L=c(()=>u.modals_replaceAgent_close_ariaLabel()),C=c(()=>u.modals_replaceAgent_send_label()),se=c(()=>u.modals_replaceAgent_cancel_label());Vr(a,{get static(){return i()},get title(){return e(O)},get description(){return e(de)},get closeLabel(){return e(L)},get submitLabel(){return e(C)},get cancelLabel(){return e(se)},get canSubmit(){return e(R)},enterKey:"ignore",focusContent:!0,onSubmit:m,onCancel:S,get open(){return o()},set open(l){o(l)},children:(l,M)=>{var H=Qe(),x=J(H);We(x,()=>Zr,(ee,K)=>{K(ee,{type:"single",children:(ne,ce)=>{var ue=Qe(),U=J(ue);We(U,()=>Yr,(X,oe)=>{oe(X,{value:"instructions",children:(Ce,Ee)=>{var W=io(),P=J(W);We(P,()=>Jr,(lt,Ge)=>{Ge(lt,{inset:!1,children:(q,Ze)=>{on();var be=Bt();y(Ae=>D(be,Ae),[()=>u.modals_replaceAgent_instruction_ariaLabel()]),g(q,be)},$$slots:{default:!0}})});var ie=k(P,2);We(ie,()=>Xr,(lt,Ge)=>{Ge(lt,{inset:!1,children:(q,Ze)=>{var be=oo(),Ae=J(be),De=Q(Ae,!0),Me=k(Ae,2);{let Ve=c(()=>u.modals_replaceAgent_instruction_ariaLabel());is(Me,{get"aria-label"(){return e(Ve)},class:"max-h-72 min-h-48 w-full type-body",get value(){return e(v)},set value(ke){_(v,ke,!0)}})}y(Ve=>D(De,Ve),[()=>u.modals_replaceAgent_editHint_description()]),g(q,be)},$$slots:{default:!0}})}),g(Ce,W)},$$slots:{default:!0}})}),g(ne,ue)},$$slots:{default:!0}})}),g(l,H)},$$slots:{default:!0}})}return $t(B)}function lo(a,n,o){if(!a?.workspaceId||a.retiredAt)return[];const i=wr(a);return[{id:"toggle-background",label:i?u.chat_agentCard_menu_moveToForeground_label():u.chat_agentCard_menu_moveToBackground_label(),icon:_a,disabled:n,onClick:()=>{o(),G.dispatch(br(String(a.workspaceId),String(a.id),!i))}}]}function co(a,n,o){const i=a?.pinned;return!a||!n||typeof i!="boolean"?[]:!i&&(a.retiredAt||va(a)!=="topLevel")?[]:[{id:"toggle-pinned",label:i?u.chat_agentCard_menu_unpin_label():u.chat_agentCard_menu_pinToTop_label(),icon:i?ls:ds,onClick:()=>{o(),G.dispatch(kr(n,String(a.id),!i))}}]}function uo(a){return!(!a||a.harnessFeatures?.peerAgents!==!0||va(a)!=="topLevel"||a.retiredAt)}const go={compact:16};var po=h("<span><!></span>"),fo=h("<div></div>");function ya(a,n){if(new.target)return bt({component:ya,...a});yt(n,!0);let o=w(n,"duration",7,8),i=w(n,"class",7,""),d=w(n,"children",7);var r={get duration(){return o()},set duration(S=8){o(S),b()},get class(){return i()},set class(S=""){i(S),b()},get children(){return d()},set children(S){d(S),b()},$set:kt,$on:(S,m)=>xt(n,S,m)},p=Qe(),f=J(p);{var v=S=>{var m=po();let B;var O=T(m);ga(O,d),A(m),y(()=>{fe(m,1,`shimmer-text ${i()??""}`,"svelte-fys1qu"),B=Vt(m,"",B,{"animation-duration":`${o()??""}s`})}),g(S,m)},R=S=>{var m=fo();let B;y(()=>{fe(m,1,`absolute inset-0 overflow-hidden pointer-events-none z-20 shimmer-overlay ${i()??""}`,"svelte-fys1qu"),B=Vt(m,"",B,{"animation-duration":`${o()??""}s`})}),g(S,m)};E(f,S=>{d()?S(v):S(R,-1)})}return g(a,p),$t(r)}const mo="z-(--layer-popover) flex min-w-0 max-h-(--bits-popover-content-available-height) max-w-[min(calc(100vw_-_var(--space-4)),calc(var(--bits-popover-content-available-width)_-_var(--space-2)))] flex-col overflow-hidden rounded-(--radius-medium) border border-border bg-popover p-[var(--space-1)] text-popover-foreground shadow-(--elevation-overlay) outline-none transition-[opacity,scale] duration-(--motion-standard) ease-(--ease-emphasized-out) data-[starting-style]:scale-[0.98] data-[starting-style]:opacity-0 data-[ending-style]:scale-[0.98] data-[ending-style]:opacity-0 focus-visible:ring-2 focus-visible:ring-ring motion-reduce:scale-100 motion-reduce:transition-none";function vo(a,n){return ca()?{duration:0}:Ts(a,n,{duration:180})}function _o(a,n,o={}){return da(a,{tier:"moderate",y:-2},o)}var ho=h('<span aria-hidden="true"><!></span>'),wo=h('<!> <span dir="auto"><!></span>',1),bo=h('<span class="min-w-0 flex-1 truncate text-left"> </span> <span class="tabular-nums text-muted-foreground"> </span>',1),ko=h('<span class="flex min-w-0 items-center gap-2"><span class="min-w-0 flex-1 truncate"> </span> <span class="tabular-nums text-muted-foreground"> </span></span>'),la=h("<!> <!>",1),xo=h('<div class="flex min-w-0 shrink-0 flex-col gap-1 px-1 pb-2"><div class="relative min-w-0"><!> <!></div> <!></div>'),yo=h('<li class="flex min-h-7 min-w-0 items-start gap-2 overflow-hidden rounded-md px-2 py-1 text-popover-foreground transition-colors duration-(--motion-fast) motion-reduce:transition-none" data-testid="task-progress-row"><!></li>'),$o=h('<div class="shrink-0 px-2 py-1.5 text-muted-foreground" data-testid="task-progress-summary"> </div> <!> <div class="min-h-0 min-w-0 max-h-64 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none focus-visible:ring-2 focus-visible:ring-ring" data-testid="task-progress-scroll-region"><ul class="min-w-0" data-testid="task-progress-list"></ul> <!></div>',1),Ao=h('<span class="inline-flex size-4 items-center justify-center" aria-hidden="true" data-testid="task-progress-checklist-icon"><!></span>'),So=h('<span class="relative z-0 inline-flex shrink-0" data-testid="task-progress-stack-item" data-task-status="completed"><!></span>'),Io=h('<span data-testid="task-progress-stack-item"><!></span>'),Co=h('<span class="relative -ml-1.75 inline-flex shrink-0" data-testid="task-progress-stack-item" data-task-status="overflow"><span class="inline-flex size-3.5 shrink-0 items-center justify-center rounded-full bg-background text-foreground leading-none" aria-hidden="true" data-testid="task-progress-overflow-indicator"><!></span></span>'),Po=h('<span class="isolate flex items-center" aria-hidden="true" data-testid="task-progress-icon-stack"><!> <!> <!></span>'),To=h('<!> <span class="sr-only" role="status" aria-live="polite" aria-atomic="true" data-testid="task-progress-announcement"> </span> <!>',1);function $a(a,n){const o=jn();if(new.target)return bt({component:$a,...a});yt(n,!0);const i=(s,I=vn,le=vn,Be=vn,Se,Te)=>{let Je=Jn(()=>Xn(Se?.(),"")),xe=Jn(()=>Xn(Te?.(),!1));var ae=ho(),ye=T(ae);{var Z=F=>{{let ge=c(()=>e(xe)?14:8),Y=c(()=>e(xe)?"size-(--row-icon-size-regular)!":"size-2!");Fa(F,{get size(){return e(ge)},get class(){return e(Y)}})}},te=F=>{{let ge=c(()=>Sn(I())),Y=c(()=>e(xe)?14:I()==="pending"?6:8),Re=c(()=>e(xe)?"size-(--row-icon-size-regular)!":I()==="pending"?"size-1.5!":"size-2!");kn(F,{get icon(){return e(ge)},get size(){return e(Y)},get class(){return e(Re)}})}};E(ye,F=>{I()==="running"?F(Z):F(te,-1)})}A(ae),y(()=>{fe(ae,1,`inline-flex size-3.5 shrink-0 items-center justify-center rounded-full bg-background text-foreground leading-none ${e(Je)??""}`),j(ae,"data-testid",le()),j(ae,"data-task-status",I()),j(ae,"data-completed-count",Be())}),g(s,ae)},d=(s,I=vn)=>{var le=wo(),Be=J(le);i(Be,()=>I().status,()=>"task-progress-row-status-icon",()=>{},()=>"mt-0.5",()=>!0);var Se=k(Be,2),Te=T(Se);{var Je=ae=>{ya(ae,{duration:3,class:"line-clamp-2 min-w-0",children:(ye,Z)=>{on();var te=Bt();y(()=>D(te,I().title)),g(ye,te)},$$slots:{default:!0}})},xe=ae=>{var ye=Bt();y(()=>D(ye,I().title)),g(ae,ye)};E(Te,ae=>{I().status==="running"?ae(Je):ae(xe,-1)})}A(Se),y(()=>{fe(Se,1,`line-clamp-2 min-w-0 flex-1 ${I().status==="completed"?"text-muted-foreground":"text-popover-foreground"}`),j(Se,"title",I().title),Se.dir=Se.dir}),g(s,le)},r=s=>{var I=$o(),le=J(I),Be=Q(le,!0),Se=k(le,2);{var Te=Z=>{var te=xo(),F=T(te),ge=T(F);{let Oe=c(()=>u.chat_taskProgress_search_placeholder()),Ke=c(()=>u.chat_taskProgress_search_placeholder());fa(ge,{type:"search",size:"compact",class:"pr-8 [&::-webkit-search-cancel-button]:hidden",get placeholder(){return e(Oe)},get"aria-label"(){return e(Ke)},onkeydown:Ut,get ref(){return e(C)},set ref(me){_(C,me,!0)},get value(){return e(B)},set value(me){_(B,me,!0)}})}var Y=k(ge,2);{var Re=Oe=>{{let Ke=c(()=>u.chat_taskProgress_clearSearch_ariaLabel());Mn(Oe,{variant:"ghost-light",size:"icon-compact",class:"absolute right-0.5 top-1/2 -translate-y-1/2",get"aria-label"(){return e(Ke)},onclick:vt,children:(me,_t)=>{ws(me,{"aria-hidden":"true"})},$$slots:{default:!0}})}};E(Y,Oe=>{e(B)&&Oe(Re)})}A(F);var at=k(F,2);We(at,()=>_n.Root,(Oe,Ke)=>{Ke(Oe,{get value(){return e(O)},get items(){return e(Ge)},onchange:me=>_(O,me,!0),get open(){return e(de)},set open(me){_(de,me,!0)},children:(me,_t)=>{var Xe=la(),Et=J(Xe);{let et=c(()=>u.chat_taskProgress_filters_ariaLabel());We(Et,()=>_n.Trigger,(ht,Dt)=>{Dt(ht,{get"aria-label"(){return e(et)},class:"h-(--control-height-small) px-2",children:(St,rt)=>{var Le=bo(),st=J(Le),ct=Q(st,!0),ot=k(st,2),wt=Q(ot,!0);y(Mt=>{D(ct,e(q)?.label),D(wt,Mt)},[()=>Gt(e(q)?.count??0)]),g(St,Le)},$$slots:{default:!0}})})}var pn=k(Et,2);{let et=c(()=>v()?"panel-header-menu bg-background":"");We(pn,()=>_n.Content,(ht,Dt)=>{Dt(ht,{portal:!0,get wrapperId(){return o},get class(){return e(et)},children:(St,rt)=>{var Le=Qe(),st=J(Le);Pt(st,17,()=>e(Ge),ct=>ct.value,(ct,ot)=>{var wt=Qe(),Mt=J(wt);We(Mt,()=>_n.Item,(je,Ne)=>{Ne(je,{get value(){return e(ot).value},get label(){return e(ot).label},children:(tt,t)=>{var $=ko(),ve=T($),it=Q(ve,!0),Kt=k(ve,2),He=Q(Kt,!0);A($),y(ut=>{D(it,e(ot).label),D(He,ut)},[()=>Gt(e(ot).count)]),g(tt,$)},$$slots:{default:!0}})}),g(ct,wt)}),g(St,Le)},$$slots:{default:!0}})})}g(me,Xe)},$$slots:{default:!0}})}),A(te),g(Z,te)};E(Se,Z=>{e(ie)&&Z(Te)})}var Je=k(Se,2);j(Je,"tabindex",0);var xe=T(Je);Pt(xe,29,()=>e(Ye),Z=>Z.id,(Z,te)=>{var F=yo(),ge=T(F);d(ge,()=>e(te)),A(F),y(Y=>{j(F,"data-task-id",e(te).id),j(F,"data-task-status",e(te).status),j(F,"data-panel-menu-row",v()||void 0),j(F,"aria-label",Y)},[()=>u.chat_taskProgress_task_ariaLabel({status:Jt(e(te).status),title:e(te).title})]),er(F,()=>vo,null),pa(3,F,()=>_o),g(Z,F)}),A(xe);var ae=k(xe,2);{var ye=Z=>{Qr(Z,{density:"compact","data-testid":"task-progress-no-matches",title:ge=>{on();var Y=Bt();y(Re=>D(Y,Re),[()=>u.chat_taskProgress_noMatches_label()]),g(ge,Y)},actions:ge=>{Mn(ge,{variant:"ghost",size:"compact",onclick:V,children:(Y,Re)=>{on();var at=Bt();y(Oe=>D(at,Oe),[()=>u.chat_taskProgress_reset_label()]),g(Y,at)},$$slots:{default:!0}})},$$slots:{title:!0,actions:!0}})};E(ae,Z=>{e(Ye).length===0&&Z(ye)})}A(Je),Ps(Je,Z=>_(M,Z),()=>e(M)),y((Z,te)=>{j(le,"data-panel-menu-label",v()||void 0),D(Be,Z),j(Je,"aria-label",te)},[()=>u.chat_taskProgress_summary_label({completed:Gt(e(be).length),total:Gt(p().length)}),()=>u.chat_taskProgress_list_ariaLabel()]),g(s,I)};let p=w(n,"tasks",7),f=w(n,"presentation",7,"status-stack"),v=w(n,"embedded",7,!1),R=w(n,"workspaceId",7),S=w(n,"isActive",7,!0);Pe(()=>{if(!R()||!S())return;const s=R(),I=crypto.randomUUID();return Ka(()=>G.dispatch(xr(s,I))),()=>G.dispatch(yr(s,I))});let m=re(!1),B=re(""),O=re("all"),de=re(!1),L=re(!1),C=re(null),se=re(null),l=re(null),M=re(null),H=re(null),x=re(ua([])),ee=re(!1),K=re(!1),ne=!1,ce=!1,ue=null,U=re(""),X,oe;const Ce=5,Ee=120,W=8,P=["pending","running","waiting","discussion_needed","blocked","review_required","completed"],ie=c(()=>p().length>=W||e(L)),lt=c(()=>P.map(s=>({status:s,count:p().filter(I=>I.status===s).length}))),Ge=c(()=>[{value:"all",label:u.chat_taskProgress_all_label(),count:p().length},...e(lt).filter(({status:s,count:I})=>I>0||e(O)===s).map(({status:s,count:I})=>({value:s,label:Jt(s),count:I}))]),q=c(()=>e(Ge).find(s=>s.value===e(O))),Ze=c(()=>p().filter(s=>s.status!=="completed")),be=c(()=>p().filter(s=>s.status==="completed")),Ae=c(()=>e(Ze).filter(s=>s.status==="running")),De=c(()=>e(Ze).filter(s=>s.status!=="running")),Me=c(()=>e(be).length>0?1:0),Ve=c(()=>e(Ze).length+e(Me)),ke=c(()=>e(Ve)>Ce),mt=c(()=>Ce-e(Me)-(e(ke)?1:0)),At=c(()=>e(Ae).slice(0,e(mt))),Rt=c(()=>e(De).slice(0,Math.max(0,e(mt)-e(At).length))),Ot=c(()=>[...e(Rt),...e(At)]),Yt=c(()=>Math.max(0,e(Ve)-e(Me)-e(Ot).length)),An=c(()=>[...e(Ze),...e(be)]),Ht=c(()=>e(B).trim().toLowerCase()),Ye=c(()=>e(An).filter(s=>(e(O)==="all"||s.status===e(O))&&s.title.toLowerCase().includes(e(Ht)))),dn=c(()=>u.chat_taskProgress_progress_ariaLabel({completed:Gt(e(be).length),total:Gt(p().length)}));Pe(()=>{e(m)?p().length>=W&&_(L,!0):(_(B,""),_(O,"all"),_(de,!1),_(L,!1))}),Pe(()=>{p().length===0&&(_(m,!1),_(H,null),Nt());const s=new Map(p().map(le=>[le.id,`${le.status}\0${le.title}`]));if(!oe){oe=s;return}const I=p().find(le=>oe?.get(le.id)!==s.get(le.id));oe=s,I&&(clearTimeout(X),_(U,""),X=setTimeout(()=>{_(U,u.chat_taskProgress_task_ariaLabel({status:Jt(I.status),title:I.title}),!0)},Ee))}),Pe(()=>{const s=e(se)?.ownerDocument.defaultView;if(!s)return;const I=En(s,"pointerdown",Xt,{capture:!0}),le=En(s,"pointercancel",qt,{capture:!0}),Be=En(s,"focusin",gn,{capture:!0});return()=>{I(),le(),Be()}}),Ga(()=>{clearTimeout(X),_(H,null)}),Pe(()=>{e(m)||_(H,null),Qt()});function Jt(s){return s==="completed"?u.workspace_taskStatus_complete_label():s==="running"?u.workspace_taskStatus_inProgress_label():s==="waiting"?u.workspace_taskStatus_waiting_label():s==="discussion_needed"?u.workspace_taskStatus_discussionNeeded_label():s==="blocked"?u.workspace_taskStatus_blocked_label():s==="review_required"?u.workspace_taskStatus_reviewRequired_label():u.workspace_taskStatus_notStarted_label()}function Sn(s){return s==="completed"?ps:s==="waiting"?fs:s==="discussion_needed"?ms:s==="blocked"?vs:s==="review_required"?_s:hs}function Lt(s){if(_(m,s,!0),!s){_(H,null),ue=null;return}Nt();const I=e(se)?.closest("[data-panel-id]");_(x,I?[I]:[],!0)}function V(){_(O,"all"),vt()}function vt(){_(B,""),e(C)?.focus({preventScroll:!0})}function Ut(s){v()&&s.stopPropagation(),!(s.key!=="ArrowDown"&&s.key!=="PageDown")&&(s.preventDefault(),_(H,"list"),Qt())}function dt(s){return e(se)?.contains(s)||e(l)?.contains(s)||e(l)?.ownerDocument.getElementById(o)?.contains(s)}function Xt(s){!e(m)||s.button!==0||!(s.target instanceof Node)||dt(s.target)||(ue=s.pointerId,Wt())}function qt(s){ue===s.pointerId&&Nt()}function Wt(){_(K,!0),ne=!1,ce=!1}function Nt(){_(K,!1),ne=!1,ce=!1,ue=null}function In(s){s.pointerType==="touch"||e(m)||!e(K)||(ne=!0)}function Cn(s){s.pointerType==="touch"||e(m)||!e(K)||!ne||Nt()}function cn(){!e(m)&&e(K)&&(ce=!0)}function Zt(){e(m)||!e(K)||!ce||Nt()}function un(s){if(s.key==="Tab"&&e(m)){_(ee,!0),Lt(!1);return}if((s.key==="ArrowDown"||s.key==="PageDown")&&e(m)){s.preventDefault(),_(H,s.key==="ArrowDown"&&e(ie)?"search":"list",!0),Qt();return}s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),Lt(!e(m)))}function gn(s){!e(m)||!(s.target instanceof Node)||dt(s.target)||(e(K)&&(ce=!0),_(ee,!0),Lt(!1))}function Qt(){if(!e(m)||!e(H))return;const s=e(H)==="search"?e(C):e(M);s&&(s.focus({preventScroll:!0}),s.ownerDocument.activeElement===s&&_(H,null))}function ze(s){s.preventDefault(),Qt()}function Pn(s){s.preventDefault(),!e(m)&&(_(H,null),e(ee)||e(se)?.focus({preventScroll:!0}),_(ee,!1))}var Tn={get tasks(){return p()},set tasks(s){p(s),b()},get presentation(){return f()},set presentation(s="status-stack"){f(s),b()},get embedded(){return v()},set embedded(s=!1){v(s),b()},get workspaceId(){return R()},set workspaceId(s){R(s),b()},get isActive(){return S()},set isActive(s=!0){S(s),b()},$set:kt,$on:(s,I)=>xt(n,s,I)},en=Qe(),Fe=J(en);{var Rn=s=>{var I=Qe(),le=J(I);We(le,()=>Wr,(Be,Se)=>{Se(Be,{onOpenChange:Lt,get open(){return e(m)},set open(Te){_(m,Te,!0)},children:(Te,Je)=>{var xe=la(),ae=J(xe);We(ae,()=>Ur,(Z,te)=>{te(Z,{get icon(){return cs},"data-testid":"task-progress-trigger",children:(F,ge)=>{on();var Y=Bt();y(Re=>D(Y,Re),[()=>u.chat_taskProgress_menu_label()]),g(F,Y)},$$slots:{default:!0}})});var ye=k(ae,2);We(ye,()=>qr,(Z,te)=>{te(Z,{class:"w-72","data-testid":"task-progress-popover",onOpenAutoFocus:F=>{F.preventDefault(),(e(ie)?e(C):e(M))?.focus()},get ref(){return e(l)},set ref(F){_(l,F,!0)},children:(F,ge)=>{r(F)},$$slots:{default:!0}})}),g(Te,xe)},$$slots:{default:!0}})}),g(s,I)},On=s=>{var I=Qe(),le=J(I);We(le,()=>ts,(Be,Se)=>{Se(Be,{onOpenChange:Lt,get open(){return e(m)},set open(Te){_(m,Te,!0)},children:(Te,Je)=>{var xe=To(),ae=J(xe);{let F=c(()=>e(m)||e(K));Br(ae,{get label(){return e(dn)},side:"bottom",delayDuration:300,get disabled(){return e(F)},children:(ge,Y)=>{var Re=Qe(),at=J(Re);{const Oe=(Ke,me)=>{let _t=()=>(me?.()).props;{let Xe=c(()=>f()==="status-stack"?"min-w-(--control-height-small) w-fit":"");Mn(Ke,Qa(_t,{variant:"ghost-light",size:"icon-sm",get active(){return e(m)},get class(){return`transition-[color,opacity,scale] motion-safe:active:scale-[0.97] motion-reduce:scale-100 ${e(Xe)??""}`},get"aria-label"(){return e(dn)},get"aria-expanded"(){return e(m)},onkeydown:un,onpointerenter:In,onpointerleave:Cn,onblur:cn,onfocus:Zt,"data-row-task-action":!0,"data-testid":"task-progress-trigger",children:(Et,pn)=>{var et=Qe(),ht=J(et);{var Dt=rt=>{var Le=Ao(),st=T(Le);us(st,{get size(){return go.compact},weight:"regular",class:"size-4!"}),A(Le),g(rt,Le)},St=rt=>{var Le=Po(),st=T(Le);{var ct=je=>{var Ne=So(),tt=T(Ne);i(tt,()=>"completed",()=>"task-progress-status-icon",()=>e(be).length),A(Ne),g(je,Ne)};E(st,je=>{e(be).length>0&&je(ct)})}var ot=k(st,2);Pt(ot,19,()=>e(Ot),je=>je.id,(je,Ne,tt)=>{var t=Io();let $;var ve=T(t);i(ve,()=>e(Ne).status,()=>"task-progress-status-icon"),A(t),y(()=>{fe(t,1,`relative inline-flex shrink-0 ${e(be).length>0||e(tt)>0?"-ml-1.75":""}`),j(t,"data-task-id",e(Ne).id),$=Vt(t,"",$,{"z-index":e(Ne).status==="running"?Ce+1:e(tt)+1})}),g(je,t)});var wt=k(ot,2);{var Mt=je=>{var Ne=Co();Vt(Ne,"",{},{"z-index":Ce});var tt=T(Ne),t=T(tt);kn(t,{get icon(){return gs},size:8,class:"size-2!"}),A(tt),A(Ne),y(()=>j(tt,"data-overflow-count",e(Yt))),g(je,Ne)};E(wt,je=>{e(ke)&&je(Mt)})}A(Le),g(rt,Le)};E(ht,rt=>{f()==="checklist"?rt(Dt):rt(St,-1)})}g(Et,et)},$$slots:{default:!0}}))}};We(at,()=>Tr,(Ke,me)=>{me(Ke,{get ref(){return e(se)},set ref(_t){_(se,_t,!0)},child:Oe,$$slots:{child:!0}})})}g(ge,Re)},$$slots:{default:!0}})}var ye=k(ae,2),Z=Q(ye,!0),te=k(ye,2);We(te,()=>jr,(F,ge)=>{ge(F,{children:(Y,Re)=>{var at=Qe(),Oe=J(at);{let Ke=c(()=>u.chat_taskProgress_list_ariaLabel());We(Oe,()=>es,(me,_t)=>{_t(me,{role:"dialog",get"aria-label"(){return e(Ke)},align:"end",side:"bottom",sideOffset:4,get collisionBoundary(){return e(x)},collisionPadding:8,trapFocus:!1,onOpenAutoFocus:ze,onCloseAutoFocus:Pn,onFocusOutside:gn,get class(){return`${mo} type-caption w-72`},"data-testid":"task-progress-popover",get ref(){return e(l)},set ref(Xe){_(l,Xe,!0)},children:(Xe,Et)=>{r(Xe)},$$slots:{default:!0}})})}g(Y,at)},$$slots:{default:!0}})}),y(()=>D(Z,e(U))),g(Te,xe)},$$slots:{default:!0}})}),g(s,I)};E(Fe,s=>{p().length>0&&v()?s(Rn):p().length>0&&s(On,1)})}return g(a,en),$t(Tn)}var Ro=h('<span aria-hidden="true"></span>'),Oo=h('<span class="relative inline-flex size-4 shrink-0 items-center justify-center text-subtle" role="img" data-agent-machine-badge="icon"><!> <!></span>');function Aa(a,n){if(new.target)return bt({component:Aa,...a});yt(n,!0);let o=w(n,"location",7);const i=c(()=>as(o())),d=c(()=>o().cloud?.state??null),r=c(()=>o().state==="unreachable"?"bg-warning":o().state==="revoked"?"bg-danger":e(d)==="paused"?"bg-muted-foreground":e(d)==="starting"||e(d)==="resuming"?"bg-warning":null);var p={get location(){return o()},set location(m){o(m),b()},$set:kt,$on:(m,B)=>xt(n,m,B)},f=Oo(),v=T(f);{let m=c(()=>o().cloud?bs:ks);kn(v,{get icon(){return e(m)},class:"size-3.5!"})}var R=k(v,2);{var S=m=>{var B=Ro();y(()=>fe(B,1,`absolute -right-0.5 -top-0.5 size-1.5 rounded-full ring-1 ring-background ${e(r)??""}`)),g(m,B)};E(R,m=>{e(r)&&m(S)})}return A(f),y(()=>{j(f,"aria-label",e(i)),j(f,"title",e(i)),j(f,"data-agent-machine-state",o().state),j(f,"data-agent-cloud-state",e(d)??void 0)}),g(a,f),$t(p)}function Sa(a,n){if(new.target)return bt({component:Sa,...a});yt(n,!0);const o=()=>$e(S,"$agent$",d),i=()=>$e(m,"$machine$",d),[d,r]=Bn();let p=w(n,"agentId",7),f=w(n,"hidden",7,!1);const v=Ct(void 0),R=Ct(void 0);Pe(()=>{v.set(p())});const S=hn(v);Pe(()=>{R.set(o()?.nodeId)});const m=rs(R),B=c(()=>ss(o(),i()));var O={get agentId(){return p()},set agentId(l){p(l),b()},get hidden(){return f()},set hidden(l=!1){f(l),b()},$set:kt,$on:(l,M)=>xt(n,l,M)},de=Qe(),L=J(de);{var C=l=>{Aa(l,{get location(){return e(B)}})};E(L,l=>{e(B)&&!f()&&l(C)})}g(a,de);var se=$t(O);return r(),se}var Lo=h('<h3 data-testid="agent-card-name"> </h3>'),No=h('<span class="inline-flex shrink-0 items-center text-subtle svelte-jna96u" role="img" data-testid="agent-card-muted-indicator"><!></span>'),Eo=h('<span data-testid="agent-card-status"> </span>'),Do=h("<span> </span>"),Mo=h('<div class="ml-auto px-1 py-0.5 text-ui font-bold bg-muted text-subtle rounded mr-1 svelte-jna96u"> </div>'),zo=h('<div data-testid="agent-card-preview"><!></div>'),Fo=h('<p data-testid="agent-card-preview"> </p>'),Bo=h('<span class="shrink-0 svelte-jna96u"><!></span>'),jo=h('<div class="flex shrink-0 items-center gap-1.5 svelte-jna96u"><!> <!></div>'),Ho=h('<span class="text-subtle svelte-jna96u"> </span>'),Uo=h('<p data-testid="agent-card-attention"> <!></p>'),qo=h('<div class="block w-full min-w-0 max-w-full truncate whitespace-nowrap text-sm text-subtle svelte-jna96u" data-testid="agent-card-preview"><!></div>'),Wo=h('<p class="block w-full min-w-0 max-w-full truncate whitespace-nowrap text-sm text-subtle svelte-jna96u"> </p>'),Qo=h('<p class="block w-full min-w-0 max-w-full truncate whitespace-nowrap text-sm text-subtle svelte-jna96u" data-testid="agent-card-preview"> </p>'),Ko=h('<div class="mt-0.5 w-full min-w-0 max-w-full overflow-hidden svelte-jna96u" data-testid="agent-card-preview-row"><!></div>'),Go=h('<div data-testid="agent-card-avatar-wrapper"><!></div> <div><div><div><div><!> <span aria-hidden="true"></span></div> <!> <!> <!> <!> <!> <!></div> <!></div> <!></div>',1),Vo=h('<div class="relative h-6 w-14 shrink-0 svelte-jna96u"><!> <div class="absolute inset-0 flex items-center justify-end gap-1 svelte-jna96u"><!></div></div>'),Yo=h('<div data-testid="agent-card-trailing-slot"><!> <!></div>'),Jo=h('<div data-testid="agent-list-item"><!> <!></div>'),Xo=h("<!> <!> <!> <!> <!>",1);function Zo(a,n){if(new.target)return bt({component:Zo,...a});yt(n,!0);const o=()=>$e(Ot,"$mutation$",l),i=()=>$e(Yt,"$rename$",l),d=()=>$e(Rt,"$mutationWorkspaceIdStore",l),r=()=>$e(On,"$agent$",l),p=()=>$e(I,"$backgroundPending$",l),f=()=>$e(In,"$nodeCapabilities$",l),v=()=>$e(Cn,"$hubBusy$",l),R=()=>$e(Nt,"$retirementSupported$",l),S=()=>$e(le,"$agentDetailHydrated$",l),m=()=>$e(Je,"$parentAgent$",l),B=()=>$e(Jt,"$hasCapturedQuestion$",l),O=()=>$e(Lt,"$agentIsResponding$",l),de=()=>$e(Sn,"$pendingQuestionRecovery$",l),L=()=>$e(dn,"$agentPermCount",l),C=()=>$e(_t,"$preview$",l),se=()=>$e(ae,"$lineChanges$",l),[l,M]=Bn(),H=t=>{var $=Jo(),ve=T($);Xa(ve,()=>e(V)?"div":"button",!1,(He,ut)=>{Ba(He,()=>({type:e(V)?void 0:"button",class:`flex w-full min-w-0 max-w-full text-left gap-2 transition-colors duration-spring-fast ease-spring-fast motion-reduce:transition-none ${e(V)?"overflow-visible":"overflow-hidden"} ${e(V)?"cursor-text":"cursor-pointer"} group ${P()?`h-9 items-center rounded-md px-2 py-1.5 type-caption font-normal text-foreground dark:hover:bg-muted/60 focus-visible:-outline-offset-2 focus-visible:bg-selected dark:focus-visible:bg-muted focus-visible:outline-1 focus-visible:outline-ring focus-visible:ring-0 ${U()?"bg-selected dark:bg-muted":"bg-transparent hover:bg-hover"}`:W()?`border type-body items-center rounded-md ${lt()}`:"border px-1.75 pt-1.25 pb-1.5"} ${P()?"":U()||oe()?`bg-background border-border ${e(Et)} shadow-xs`:"border-transparent"} ${ie()??""}`,onclick:e(V)?void 0:ht,onkeydown:e(V)?void 0:Tn,oncontextmenu:e(V)?void 0:en,role:e(V)?"presentation":void 0,"aria-disabled":e(V)?void 0:ke(),"aria-current":!e(V)&&P()&&U()?"true":void 0,tabindex:e(V)||ke()?-1:void 0,"data-agent-panel-row":P()?x():void 0}),void 0,void 0,void 0,"svelte-jna96u");var gt=Go(),pt=J(gt),tn=T(pt);{let N=c(()=>P()?"emphasized":"standard");Rr(tn,{get agentId(){return x()},get variant(){return e(N)},get state(){return e(Y)},get specialist(){return e(Re)},get provider(){return be()}})}A(pt);var _e=k(pt,2),Ue=T(_e),It=T(Ue),zt=T(It),fn=T(zt);{var mn=N=>{{let z=c(()=>u.chat_agentCard_menu_rename_label()),Ie=c(()=>P()?"type-caption font-normal text-foreground":W()?"type-body font-normal text-muted-foreground":"text-sm font-normal text-foreground");fa(N,{variant:"inline",type:"text",get"aria-label"(){return e(z)},onblur:un,onkeydowncapture:Qt,onkeyupcapture:ze,onfocusincapture:ze,onfocusoutcapture:ze,onpointerdowncapture:ze,onpointerupcapture:ze,onmousedowncapture:ze,onmouseupcapture:ze,onclickcapture:ze,ondblclickcapture:ze,oncontextmenucapture:ze,oncopycapture:ze,oncutcapture:ze,onpastecapture:ze,noFocusStyle:!0,get class(){return`inline-edit-input relative z-10 min-w-0 flex-1 truncate border-none bg-transparent hover:bg-transparent ${e(Ie)??""} outline-none! ring-0! focus:outline-none! focus:ring-0! focus-visible:outline-none! focus-visible:ring-0!`},get ref(){return e(Ut)},set ref(qe){_(Ut,qe,!0)},get value(){return e(vt)},set value(qe){_(vt,qe,!0)}})}},Ln=N=>{var z=Lo(),Ie=Q(z,!0);y(()=>{fe(z,1,`relative z-10 cursor-inherit whitespace-nowrap ${P()?"min-w-0 flex-1 truncate type-caption font-normal text-foreground":W()?ie()?"shrink-0 type-body font-normal text-muted-foreground!":"shrink-0 type-body font-normal text-muted-foreground":"shrink-0 text-sm font-normal text-foreground"}`,"svelte-jna96u"),j(z,"data-agent-row-name",P()?"":void 0),D(Ie,e(ye))}),Ya("dblclick",z,Pn),g(N,z)};E(fn,N=>{e(V)?N(mn):N(Ln,-1)})}var nn=k(fn,2);A(zt);var Wn=k(zt,2);{let N=c(()=>W()&&!P());Sa(Wn,{get agentId(){return x()},get hidden(){return e(N)}})}var Qn=k(Wn,2);{var Ia=N=>{var z=No(),Ie=T(z);kn(Ie,{get icon(){return sa},class:"h-3! w-3!"}),A(z),y((qe,Ft)=>{j(z,"aria-label",qe),j(z,"title",Ft)},[()=>u.chat_agentCard_notificationsMuted_tooltip(),()=>u.chat_agentCard_notificationsMuted_tooltip()]),g(N,z)};E(Qn,N=>{e(ge)&&(!W()||P())&&N(Ia)})}var Kn=k(Qn,2);{var Ca=N=>{var z=Eo(),Ie=Q(z,!0);y(()=>{fe(z,1,`${P()?"type-caption":"type-body"} shrink-0 truncate whitespace-nowrap font-normal text-muted-foreground`,"svelte-jna96u"),D(Ie,e(Oe))}),g(N,z)};E(Kn,N=>{e(Oe)&&N(Ca)})}var Gn=k(Kn,2);{var Pa=N=>{var z=Do(),Ie=Q(z,!0);y(qe=>{fe(z,1,`delegated-by-text min-w-0 shrink truncate whitespace-nowrap ${P()?"type-caption":"text-ui"} text-subtle ${P()?"max-w-[40%]":"ml-1"}`,"svelte-jna96u"),D(Ie,qe)},[()=>u.chat_agentCard_delegatedBy_label({name:e(xe)})]),g(N,z)};E(Gn,N=>{e(xe)&&(!W()||P())&&N(Pa)})}var Vn=k(Gn,2);{var Ta=N=>{var z=Mo(),Ie=Q(z,!0);y(qe=>D(Ie,qe),[()=>u.chat_agentCard_background_badge()]),g(N,z)};E(Vn,N=>{K()&&!P()&&N(Ta)})}var Ra=k(Vn,2);{var Oa=N=>{var z=Qe(),Ie=J(z);{var qe=ft=>{var he=zo();fe(he,1,"ml-2.5 min-w-0 flex-1 overflow-hidden whitespace-nowrap text-sm font-normal! text-muted-foreground svelte-jna96u");var pe=T(he);Zn(pe,{get toolUse(){return C().toolUse},showIcon:!1,class:An}),A(he),g(ft,he)},Ft=ft=>{var he=Fo();fe(he,1,"ml-2.5 min-w-0 flex-1 truncate whitespace-nowrap text-sm font-normal! text-muted-foreground svelte-jna96u");var pe=Q(he,!0);Nn(he,(we,nt)=>Dn?.(we,nt),()=>e(et)),y(()=>{j(he,"aria-label",e(et)),D(pe,e(et))}),g(ft,he)};E(Ie,ft=>{C().kind==="live-tool"||C().kind==="last-tool"?ft(qe):ft(Ft,-1)})}g(N,z)};E(Ra,N=>{W()&&!Ee()&&C()&&N(Oa)})}A(It);var La=k(It,2);{var Na=N=>{var z=jo(),Ie=T(z);{var qe=he=>{ar(he,{get additions(){return se().additions},get deletions(){return se().deletions},size:"xs"})};E(Ie,he=>{!P()&&se()&&(se().additions>0||se().deletions>0)&&he(qe)})}var Ft=k(Ie,2);{var ft=he=>{var pe=Bo(),we=T(pe);{let nt=c(()=>P()?"type-caption tabular-nums":"text-ui");ea(we,{get date(){return e(Xe)},compact:!0,get class(){return`${e(nt)??""} text-subtle`}})}A(pe),y(()=>j(pe,"data-agent-row-time",P()?"":void 0)),g(he,pe)};E(Ft,he=>{e(Xe)&&!Ae()&&he(ft)})}A(z),y(()=>j(z,"data-agent-row-trailing",P()?"":void 0)),g(N,z)};E(La,N=>{(!W()||P())&&N(Na)})}A(Ue);var Ea=k(Ue,2);{var Da=N=>{var z=Ko(),Ie=T(z);{var qe=pe=>{var we=Uo(),nt=T(we,!0),an=k(nt);{var rn=sn=>{var Yn=Ho(),Ma=Q(Yn);y(()=>D(Ma,`· ${C().attention.reason??""}`)),g(sn,Yn)};E(an,sn=>{C().attention.reason&&sn(rn)})}A(we),y(sn=>{fe(we,1,`block w-full min-w-0 max-w-full truncate whitespace-nowrap text-sm ${C().attention.kind==="blocker"?"text-red-500":"text-warning-ink"}`,"svelte-jna96u"),D(nt,sn)},[()=>C().attention.kind==="blocker"?u.chat_agentCard_attentionBlocker_label():u.chat_agentCard_attentionDiscussion_label()]),g(pe,we)},Ft=pe=>{var we=qo(),nt=T(we);Zn(nt,{get toolUse(){return C().toolUse},get animate(){return e(F)}}),A(we),g(pe,we)},ft=pe=>{var we=Wo(),nt=Q(we,!0);Nn(we,(an,rn)=>Dn?.(an,rn),()=>C().text),y(()=>D(nt,C().text)),g(pe,we)},he=pe=>{var we=Qo(),nt=Q(we,!0);Nn(we,(an,rn)=>Dn?.(an,rn),()=>C().text),y(()=>D(nt,C().text)),g(pe,we)};E(Ie,pe=>{C().kind==="attention"?pe(qe):C().kind==="live-tool"||C().kind==="last-tool"?pe(Ft,1):C().kind==="report"?pe(ft,2):pe(he,-1)})}A(z),pa(3,z,()=>da,()=>({tier:"fast"})),g(N,z)};E(Ea,N=>{!W()&&!Ee()&&C()&&N(Da)})}A(_e),y(()=>{fe(pt,1,`agent-card-avatar-wrapper relative shrink-0 ${P()?"agent-card-avatar-wrapper--panel":W()?"":"mt-[-0.8px] -mb-1"}`,"svelte-jna96u"),fe(_e,1,`agent-card-content flex min-w-0 max-w-full flex-1 ${e(V)?"overflow-visible":"overflow-hidden"} ${e(Ht)?Ae()?"mr-25":"mr-11":Ae()?"mr-14":""} ${W()||P()?"flex-row items-center gap-2":"flex-col"}`,"svelte-jna96u"),fe(Ue,1,`agent-card-header flex w-full min-w-0 max-w-full items-center gap-1.5 ${e(V)?"overflow-visible":"overflow-hidden"} ${W()?"inline-agent-card-header":P()?"agent-panel-row-header":"pr-1.5"}`,"svelte-jna96u"),fe(It,1,`flex-1 min-w-0 flex items-center ${P()?`gap-1.5 ${e(V)?"overflow-visible":"overflow-hidden"}`:W()?"gap-0":"gap-1.5"} ${ie()||P()?"font-normal":"font-medium"} ${W()?e(V)?"overflow-visible":"overflow-hidden":""}`,"svelte-jna96u"),fe(zt,1,`relative flex min-w-0 items-center ${e(V)||!W()?"flex-1":""} ${e(V)?"overflow-visible":"overflow-hidden"}`,"svelte-jna96u"),fe(nn,1,`pointer-events-none absolute z-0 rounded-(--radius-small) transition-[inset,background-color] duration-(--motion-standard) ease-(--ease-standard) motion-reduce:transition-none ${e(V)?"-inset-x-2 -inset-y-0.5 bg-hover dark:bg-surface-1":"-inset-x-1 -inset-y-0.5 bg-transparent"}`,"svelte-jna96u")}),g(ut,gt)});var it=k(ve,2);{var Kt=He=>{var ut=Yo(),gt=T(ut);{var pt=Ue=>{$a(Ue,{get tasks(){return De()},get presentation(){return Me()}})};E(gt,Ue=>{e(Ht)&&Ue(pt)})}var tn=k(gt,2);{var _e=Ue=>{var It=Vo(),zt=T(It);{var fn=nn=>{ea(nn,{get date(){return e(Xe)},compact:!0,class:"type-caption tabular-nums absolute inset-0 flex items-center justify-end text-right font-normal! text-muted-foreground transition-opacity group-hover/watch:opacity-0 group-focus-within/watch:opacity-0"})};E(zt,nn=>{e(Xe)&&nn(fn)})}var mn=k(zt,2),Ln=T(mn);ga(Ln,Ae),A(mn),A(It),g(Ue,It)};E(tn,Ue=>{Ae()&&Ue(_e)})}A(ut),y(()=>fe(ut,1,`absolute right-3 top-1/2 z-10 flex h-6 shrink-0 -translate-y-1/2 items-center justify-end ${e(Ht)?Ae()?"w-25":"w-11":"w-14"}`,"svelte-jna96u")),g(He,ut)};E(it,He=>{(Ae()||e(Ht))&&He(Kt)})}A($),y(()=>{Vt($,`padding-left: ${X()*10}px; container-type: inline-size;`),fe($,1,`relative w-full min-w-0 max-w-full ${e(V)?"overflow-visible":"overflow-hidden"} agent-card-container`,"svelte-jna96u"),j($,"data-agent-id",x())}),g(t,$)};let x=w(n,"agentId",7),ee=w(n,"agentName",7),K=w(n,"isBackground",7,!1),ne=w(n,"onclick",7),ce=w(n,"completionReport",7),ue=w(n,"lastResponseSummary",7),U=w(n,"selected",7,!1),X=w(n,"depth",7,0),oe=w(n,"showBorder",7,!1),Ce=w(n,"showStateBorder",7,!1),Ee=w(n,"hidePreview",7,!1),W=w(n,"inline",7,!1),P=w(n,"panelRow",7,!1),ie=w(n,"typographyClass",7,""),lt=w(n,"inlineRowClass",7,"px-1.5 py-1"),Ge=w(n,"statusLabel",7),q=w(n,"workspace",7,null),Ze=w(n,"isCompleted",7,!1),be=w(n,"provider",7,void 0),Ae=w(n,"headerActions",7),De=w(n,"taskProgress",23,()=>[]),Me=w(n,"taskProgressPresentation",7,"status-stack"),Ve=w(n,"updatedAt",7,void 0),ke=w(n,"readOnly",7,!1);const mt=crypto.randomUUID(),At=crypto.randomUUID(),Rt=Ct(""),Ot=bn(Rt,mt),Yt=bn(Rt,At);Pe(()=>{const t=e(s);return x(),Rt.set(t),()=>{G.dispatch(zn(t,mt)),G.dispatch(zn(t,At))}}),Pe(()=>{for(const t of[o(),i()])!t||t.workspaceId!==e(s)||t.agentId!==x()||t.status==="pending"||(t.operation.kind==="stop"&&Fe(),G.dispatch(ma(d(),t.id,t.requestId)))});const An="font-normal! text-muted-foreground",Ht=c(()=>De().length>0),Ye=Ct(x());Pe(()=>{Ye.set(x())});const dn=qa(Ye),Jt=Er(Ye),Sn=rr(Ye),Lt=sr(Ye);Pe(()=>{const t=q()?.id;!t||ke()||hn.select(G.state,x())||G.dispatch(ta(String(t),x()))});let V=re(!1),vt=re(""),Ut=re(null),dt=re(null),Xt=re(!1),qt=re(!1),Wt=re(!1);const Nt=or(),In=ir(),Cn=lr();function cn(t){const $=r()?.workspaceId;Fe(),$&&G.dispatch(Pr(String($),x(),t))}async function Zt(){ke()||e(V)||(_(vt,e(ye),!0),_(V,!0),await Ja(),e(Ut)?.focus(),e(Ut)?.select())}function un(){if(!e(V))return;const t=e(vt).trim();if(_(V,!1),_(vt,""),t&&t!==e(ye)){const $=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;$&&G.dispatch(wn($,At,crypto.randomUUID(),x(),{kind:"rename",name:t}))}}function gn(){_(V,!1),_(vt,"")}function Qt(t){t.stopPropagation(),t.key==="Enter"&&!t.isComposing?(t.preventDefault(),un()):t.key==="Escape"&&(t.preventDefault(),gn())}function ze(t){t.stopPropagation()}function Pn(t){ke()||(t.preventDefault(),t.stopPropagation(),Zt())}function Tn(t){if(!ke()){if(t.key==="ContextMenu"||t.shiftKey&&t.key==="F10"){en(t);return}t.key==="Enter"&&ra({event:t})||ne()&&(t.key==="Enter"||t.key===" ")?(t.preventDefault(),t.stopPropagation(),ht(t)):t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),Zt())}}function en(t){if(ke())return;const $=Or(t);if(!$)return;_(dt,{...$,sourcePanelId:aa(t.currentTarget)},!0),r()?.effectiveIsolation==="isolated"&&G.dispatch($r()),G.dispatch(Ar());const ve=r()?.workspaceId??q()?.id;ve&&G.dispatch(ta(String(ve),x()))}function Fe(){_(dt,null)}function Rn(){const t=[{id:"open",label:u.chat_agentCard_menu_open_label(),icon:xs,onClick:()=>{{const _e=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;_e&&G.dispatch(na(_e,{agentId:x(),sourcePanelId:e(dt)?.sourcePanelId}))}Fe()}},{type:"separator"},{id:"rename",label:u.chat_agentCard_menu_rename_label(),icon:ys,onClick:()=>{Zt(),Fe()}}];if(P()){const _e=r()?.workspaceId??q()?.id;t.push(...co(r(),_e?String(_e):void 0,Fe))}if(t.push(...lo(r(),p(),Fe)),r()){const _e=e(ge);t.push({id:"toggle-notifications-muted",label:_e?u.chat_agentCard_menu_unmuteNotifications_label():u.chat_agentCard_menu_muteNotifications_label(),icon:_e?$s:sa,onClick:async()=>{const Ue=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;Fe(),Ue&&G.dispatch(Cr(Ue,x(),!_e))}})}const $=r()?.workspaceId??q()?.id,ve=vr(q())||!!$&&_r.select(G.state,String($)),it=r()?.effectiveIsolation==="isolated";f().agentNodes&&it&&!ve&&(t.push({id:"hub-merge",label:u.agent_hub_merge(),disabled:v()||!r()?.checkpoint?.id,onClick:()=>{cn("merge")}}),t.push({id:"hub-discard",label:u.agent_hub_discard(),disabled:v(),onClick:()=>{cn("discard")}})),e(F)&&(t.push({type:"separator"}),t.push({id:"stop",label:u.chat_agentCard_menu_stop_label(),icon:As,disabled:o()?.agentId===x()&&o().operation.kind==="stop"&&o().status==="pending",onClick:()=>{const _e=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;_e?G.dispatch(wn(_e,mt,crypto.randomUUID(),x(),{kind:"stop"})):Fe()}})),t.push({type:"separator"}),!ke()&&!K()&&uo(r())&&t.push({id:"replace-agent",label:u.chat_agentCard_menu_replaceAgent_label(),icon:_a,onClick:()=>{_(qt,!0),Fe()}});const Kt=r()?.workspaceId||q()?.id,He=Kt?String(Kt):void 0,ut=!!He&&hr.select(G.state,He);R()&&He&&r()&&!r().retiredAt&&t.push({id:"retire-agent",label:u.modals_retireAgent_confirm_label(),icon:Ss,onClick:()=>{_(Wt,!0),Fe()}}),ut||t.push({id:"delete",label:u.chat_agentCard_menu_delete_label(),icon:Is,destructive:!0,onClick:()=>{He&&Dr()&&Mr(He).closeTabsByType("agent","agentId",x()),Fe(),He&&G.dispatch(wn(He,mt,crypto.randomUUID(),x(),{kind:"delete",name:ee()||void 0}))}});const gt=e(Re),pt=r()?.harnessVersion,tn=r()?.harnessFeatures!==void 0||S();if((gt||pt)&&t.push({type:"separator"}),gt){const _e=os.select(G.state,gt)??gt;t.push({type:"label",id:"specialist",label:u.chat_agentCard_menu_specialist_label({name:_e})})}return pt&&t.push({id:"harness-version",label:u.chat_agentCard_menu_harnessVersion_label({version:pt}),icon:Cs,disabled:!tn,onClick:()=>{_(Xt,!0),Fe()}}),t}const On=hn(Ye),s=c(()=>String(r()?.workspaceId||q()?.id||"")),I=dr(Ye),le=cr(Ye),Be=c(()=>pr(r())),Se=c(()=>e(Be)?.parentAgentId),Te=Ct("");Pe(()=>{Te.set(e(Se)??"")});const Je=hn(Te),xe=c(()=>e(Se)?m()?.name:void 0),ae=ur(Ye),ye=c(()=>e(Be)?.name||ee()||u.chat_shared_agentName_fallback()),Z=c(()=>Sr(r())),te=c(()=>B()?!0:(O(),r()?.metadata?.pendingQuestionsMessageId,r()?.metadata?.dismissedQuestionsMessageId,de(),Wa(G.state,x(),r()?.messages??[]))),F=c(()=>r()?fr(mr(r())):!1),ge=c(()=>r()?.notificationsMuted===!0),Y=c(()=>Lr(r(),{hasPermissionRequest:L()>0,hasQuestion:e(te),isActive:U(),isCompleted:Ze(),attentionKind:e(Z)?.kind??null})),Re=c(()=>r()?.metadata?.specialist||r()?.agentMetadata?.specialist||null);function at(t){const $=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;$&&G.dispatch(Ir(x(),{wsId:$,text:t,agentName:e(ye)}))}const Oe=c(()=>Ds(r())??Ge()),Ke=Ct(ce()),me=Ct(ue());Pe(()=>{Ke.set(ce()),me.set(ue())});const _t=gr(Ye,Ke,me),Xe=c(()=>Ve()??r()?.updatedAt),Et=c(()=>Ce()?e(Y)==="running"||e(Y)==="responding"?"agent-glow-active":e(Y)==="failed"?"shadow shadow-red-500 shadow-sm":e(Y)==="needs-permission"||e(Y)==="attention-discussion"?"shadow shadow-warning shadow-sm":e(Y)==="attention-blocker"?"shadow shadow-red-500 shadow-sm":e(Y)==="waiting"?"shadow shadow-warning shadow-sm":"glow-transparent":""),pn=c(()=>{const t=C();if(!t||t.kind==="live-tool"||t.kind==="last-tool")return"";if(t.kind!=="attention")return t.text;const $=t.attention.kind==="blocker"?u.chat_agentCard_attentionBlocker_label():u.chat_agentCard_attentionDiscussion_label();return t.attention.reason?`${$} · ${t.attention.reason}`:$});let et=re("");Pe(()=>{const t=e(pn);let $=!1;if(!t){_(et,"");return}return tr(t).then(ve=>{$||_(et,ve,!0)}),()=>{$=!0}});function ht(t){if(!ke())if(ne())ne()(t);else{const $=aa(t.currentTarget),ve=ra({event:t}),it=r()?.workspaceId?String(r().workspaceId):q()?.id?String(q().id):void 0;if(!it||nr(t,it,x()))return;G.dispatch(na(it,{agentId:x(),sourcePanelId:$,openInAdjacentPanel:ve}))}}var Dt={get agentId(){return x()},set agentId(t){x(t),b()},get agentName(){return ee()},set agentName(t){ee(t),b()},get isBackground(){return K()},set isBackground(t=!1){K(t),b()},get onclick(){return ne()},set onclick(t){ne(t),b()},get completionReport(){return ce()},set completionReport(t){ce(t),b()},get lastResponseSummary(){return ue()},set lastResponseSummary(t){ue(t),b()},get selected(){return U()},set selected(t=!1){U(t),b()},get depth(){return X()},set depth(t=0){X(t),b()},get showBorder(){return oe()},set showBorder(t=!1){oe(t),b()},get showStateBorder(){return Ce()},set showStateBorder(t=!1){Ce(t),b()},get hidePreview(){return Ee()},set hidePreview(t=!1){Ee(t),b()},get inline(){return W()},set inline(t=!1){W(t),b()},get panelRow(){return P()},set panelRow(t=!1){P(t),b()},get typographyClass(){return ie()},set typographyClass(t=""){ie(t),b()},get inlineRowClass(){return lt()},set inlineRowClass(t="px-1.5 py-1"){lt(t),b()},get statusLabel(){return Ge()},set statusLabel(t){Ge(t),b()},get workspace(){return q()},set workspace(t=null){q(t),b()},get isCompleted(){return Ze()},set isCompleted(t=!1){Ze(t),b()},get provider(){return be()},set provider(t=void 0){be(t),b()},get headerActions(){return Ae()},set headerActions(t){Ae(t),b()},get taskProgress(){return De()},set taskProgress(t=[]){De(t),b()},get taskProgressPresentation(){return Me()},set taskProgressPresentation(t="status-stack"){Me(t),b()},get updatedAt(){return Ve()},set updatedAt(t=void 0){Ve(t),b()},get readOnly(){return ke()},set readOnly(t=!1){ke(t),b()},$set:kt,$on:(t,$)=>xt(n,t,$)},St=Xo(),rt=J(St);H(rt);var Le=k(rt,2);{var st=t=>{{let $=c(Rn);Nr(t,{get x(){return e(dt).x},get y(){return e(dt).y},get returnFocus(){return e(dt).returnFocus},get items(){return e($)},onClickOutside:Fe})}};E(Le,t=>{e(dt)&&!ke()&&t(st)})}var ct=k(Le,2);{var ot=t=>{{let $=c(()=>r()?.harnessFeatures??null);ba(t,{get version(){return r().harnessVersion},get features(){return e($)},get agentId(){return x()},get open(){return e(Xt)},set open(ve){_(Xt,ve,!0)}})}};E(ct,t=>{r()?.harnessVersion&&t(ot)})}var wt=k(ct,2);{var Mt=t=>{{let $=c(()=>r()?.name||ee()||""),ve=c(()=>String(r()?.workspaceId||q()?.id));ka(t,{get agentName(){return e($)},get workspaceId(){return e(ve)},get agentId(){return x()},get open(){return e(Wt)},set open(it){_(Wt,it,!0)}})}};E(wt,t=>{e(Wt)&&t(Mt)})}var je=k(wt,2);{var Ne=t=>{xa(t,{get agentName(){return e(ye)},get specialist(){return e(Re)},onSend:at,get open(){return e(qt)},set open($){_(qt,$,!0)}})};E(je,t=>{e(qt)&&t(Ne)})}g(a,St);var tt=$t(Dt);return M(),tt}Va(["dblclick"]);export{Zo as A,Zi as B,go as C,mo as D,ln as E,uo as F,co as G,ba as H,oa as I,Ji as J,ji as N,Ei as O,xa as R,ya as S,$a as T,Aa as a,Yi as b,qi as c,Wi as d,Ki as e,Qi as f,Gi as g,ha as h,Vi as i,tl as j,Di as k,Fi as l,Bi as m,zi as n,Mi as o,Hi as p,jt as q,Ni as r,Ui as s,ka as t,Es as u,Li as v,Ri as w,Oi as x,el as y,Xi as z};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BqkqHfzf.js","/app/immutable/chunks/b6em44WJ.js","/app/immutable/chunks/DcU8FJ67.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/DwuWRler.js","/app/immutable/chunks/UyBYtOpv.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/B1NJ5pzL.js","/app/immutable/chunks/W_RYksqv.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/-Nlmdtho.js","/app/immutable/chunks/Bco_b5Ku.js","/app/immutable/chunks/POMSQzHT.js","/app/immutable/chunks/BlOn95cv.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/Cl0jxY31.js","/app/immutable/chunks/cmyT5Ste.js","/app/immutable/chunks/zUDGDDVj.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/D5B1sycf.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/CMcSelvo.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/BN2r45vo.js","/app/immutable/chunks/Dqjk8pvU.js","/app/immutable/chunks/Ch6n50QZ.js"])))=>i.map(i=>d[i]);
2
- var Oh=Object.defineProperty;var Ih=(t,e,i)=>e in t?Oh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var P=(t,e,i)=>Ih(t,typeof e!="symbol"?e+"":e,i);import{cd as $h}from"./DYhIMPy1.js";import{bo as Fs,_ as Bn}from"./DcU8FJ67.js";import{a as ji}from"./BJzHxIyr.js";import{i as Ns}from"./DBW7NNdL.js";import{y as Fh}from"./BM-JMWD0.js";import{t as Nh}from"./L-gnvTJU.js";import{d as Ui}from"./B0Z-1lwJ.js";import{c as zh}from"./ChTqQfQN.js";import{bf as Wh}from"./B1NJ5pzL.js";import{HD as Mt,IF as An,gt as Hh,A$ as Uh,zb as Kh,rb as qh}from"./zUDGDDVj.js";import{F as Vh,M as Gh}from"./Bco_b5Ku.js";import{g as Yh}from"./DH5x-Yq6.js";import{f as Xh,l as jh}from"./CBZcUhKz.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BH-KJlp3.js","/app/immutable/chunks/uxlSCqIr.js","/app/immutable/chunks/DJ6NhP2E.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/jiHQQ6wA.js","/app/immutable/chunks/UyBYtOpv.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/B9pc_pKk.js","/app/immutable/chunks/DBaJKI7v.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/jWThE6-J.js","/app/immutable/chunks/Dd6RDWfk.js","/app/immutable/chunks/OXAE4Y56.js","/app/immutable/chunks/BlOn95cv.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/BUjUgUAA.js","/app/immutable/chunks/rU5MX2nQ.js","/app/immutable/chunks/CG4aq4mO.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/D5B1sycf.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/C3Sa4Adg.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/CdwxdSGH.js","/app/immutable/chunks/DrPG1fDs.js","/app/immutable/chunks/B-yP-PGc.js"])))=>i.map(i=>d[i]);
2
+ var Oh=Object.defineProperty;var Ih=(t,e,i)=>e in t?Oh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var P=(t,e,i)=>Ih(t,typeof e!="symbol"?e+"":e,i);import{cd as $h}from"./DYhIMPy1.js";import{bo as Fs,_ as Bn}from"./DJ6NhP2E.js";import{a as ji}from"./BJzHxIyr.js";import{i as Ns}from"./DiOG4aSP.js";import{y as Fh}from"./DqsogpbZ.js";import{t as Nh}from"./Brobdake.js";import{d as Ui}from"./B0Z-1lwJ.js";import{c as zh}from"./ChTqQfQN.js";import{bf as Wh}from"./B9pc_pKk.js";import{HD as Mt,IF as An,gt as Hh,A$ as Uh,zb as Kh,rb as qh}from"./CG4aq4mO.js";import{F as Vh,M as Gh}from"./Dd6RDWfk.js";import{g as Yh}from"./CBMSMN2h.js";import{f as Xh,l as jh}from"./D3Nrkkzz.js";/**
3
3
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
4
4
  * @license MIT
5
5
  *
@@ -141,6 +141,6 @@ void main() {
141
141
  `))}},lf=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},cf=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},df=0,ur=class{constructor(t){this.value=t,this.id=df++}},uf=2,_f,ut=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new af(t?.onListenerError??dr,this._options?.leakWarningThreshold??of):void 0,this._perfMon=this._options?._profName?new nf(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,e,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new cf(`${o}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||dr)(l),qt.None}if(this._disposed)return qt.None;e&&(t=t.bind(e));let s=new ur(t),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=hf.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof ur?(this._deliveryQueue??=new ff,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=yi(()=>{r?.(),this._removeListener(s)});return i instanceof kn?i.add(n):Array.isArray(i)&&i.push(n),n},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*uf<=e.length){let r=0;for(let n=0;n<e.length;n++)e[n]?e[r++]=e[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=r}}_deliver(t,e){if(!t)return;let i=this._options?.onListenerError||dr;if(!i){t.value(e);return}try{t.value(e)}catch(s){i(s)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof ur)this._deliver(this._listeners,t);else{let e=this._deliveryQueue;e.enqueue(this,t,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},ff=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Dh=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),gf;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof pf?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:En.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Dh})})(gf||={});var pf=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Dh:(this._emitter||(this._emitter=new ut),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},mi="en",_r=!1,ds,Cs=mi,sa=mi,mf,Et,ni=globalThis,Ge;typeof ni.vscode<"u"&&typeof ni.vscode.process<"u"?Ge=ni.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ge=process);var vf=typeof Ge?.versions?.electron=="string",Sf=vf&&Ge?.type==="renderer";if(typeof Ge=="object"){Ge.platform,Ge.platform,_r=Ge.platform==="linux",_r&&Ge.env.SNAP&&Ge.env.SNAP_REVISION,Ge.env.CI||Ge.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ds=mi,Cs=mi;let t=Ge.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);ds=e.userLocale,sa=e.osLocale,Cs=e.resolvedLanguage||mi,mf=e.languagePack?.translationsConfigFile}catch{}}else typeof navigator=="object"&&!Sf?(Et=navigator.userAgent,Et.indexOf("Windows")>=0,Et.indexOf("Macintosh")>=0,(Et.indexOf("Macintosh")>=0||Et.indexOf("iPad")>=0||Et.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_r=Et.indexOf("Linux")>=0,Et?.indexOf("Mobi")>=0,Cs=globalThis._VSCODE_NLS_LANGUAGE||mi,ds=navigator.language.toLowerCase(),sa=ds):console.error("Unable to resolve platform.");var mt=Et,$t=Cs,wf;(t=>{function e(){return $t}t.value=e;function i(){return $t.length===2?$t==="en":$t.length>=3?$t[0]==="e"&&$t[1]==="n"&&$t[2]==="-":!1}t.isDefaultVariant=i;function s(){return $t==="en"}t.isDefault=s})(wf||={});var bf=typeof ni.postMessage=="function"&&!ni.importScripts;(()=>{if(bf){let t=[];ni.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(s,1),n.callback();return}}});let e=0;return i=>{let s=++e;t.push({id:s,callback:i}),ni.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var Cf=!!(mt&&mt.indexOf("Chrome")>=0);mt&&mt.indexOf("Firefox")>=0;!Cf&&mt&&mt.indexOf("Safari")>=0;mt&&mt.indexOf("Edg/")>=0;mt&&mt.indexOf("Android")>=0;function Bh(t,e=0,i){let s=setTimeout(()=>{t()},e);return yi(()=>{clearTimeout(s)})}var yf;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(yf||={});var ra=class Qe{static fromArray(e){return new Qe(i=>{i.emitMany(e)})}static fromPromise(e){return new Qe(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Qe(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new Qe(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ut,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await En.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new Qe(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return Qe.map(this,e)}static filter(e,i){return new Qe(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return Qe.filter(this,e)}static coalesce(e){return Qe.filter(e,i=>!!i)}coalesce(){return Qe.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return Qe.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};ra.EMPTY=ra.fromArray([]);var xf=class extends qt{constructor(t){super(),this._terminal=t,this._linesCacheTimeout=this._register(new Rs),this._linesCacheDisposables=this._register(new Rs),this._register(yi(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=xh(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Bh(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(t){return this._linesCache?.[t]}setLineInCache(t,e){this._linesCache&&(this._linesCache[t]=e)}translateBufferLineToStringWithWrap(t,e){let i=[],s=[0],r=this._terminal.buffer.active.getLine(t);for(;r;){let n=this._terminal.buffer.active.getLine(t+1),o=n?n.isWrapped:!1,a=r.translateToString(!o&&e);if(o&&n){let l=r.getCell(r.length-1);l&&l.getCode()===0&&l.getWidth()===1&&n.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),o)s.push(s[s.length-1]+a.length);else break;t++,r=n}return[i.join(""),s]}},kf=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(t){this._cachedSearchTerm=t}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(t){this._lastSearchOptions=t}isValidSearchTerm(t){return!!(t&&t.length>0)}didOptionsChange(t){return this._lastSearchOptions?t?this._lastSearchOptions.caseSensitive!==t.caseSensitive||this._lastSearchOptions.regex!==t.regex||this._lastSearchOptions.wholeWord!==t.wholeWord:!1:!0}shouldUpdateHighlighting(t,e){return e?.decorations?this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||this.didOptionsChange(e):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Ef=class{constructor(t,e){this._terminal=t,this._lineCache=e}find(t,e,i,s){if(!t||t.length===0){this._terminal.clearSelection();return}if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let r={startRow:e,startCol:i},n=this._findInLine(t,r,s);if(!n)for(let o=e+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=o,r.startCol=0,n=this._findInLine(t,r,s),!n);o++);return n}findNextWithSelection(t,e,i){if(!t||t.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=0,n=0;s&&(i===t?(r=s.end.x,n=s.end.y):(r=s.start.x,n=s.start.y)),this._lineCache.initLinesCache();let o={startRow:n,startCol:r},a=this._findInLine(t,o,e);if(!a)for(let l=n+1;l<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=l,o.startCol=0,a=this._findInLine(t,o,e),!a);l++);if(!a&&n!==0)for(let l=0;l<n&&(o.startRow=l,o.startCol=0,a=this._findInLine(t,o,e),!a);l++);return!a&&s&&(o.startRow=s.start.y,o.startCol=0,a=this._findInLine(t,o,e)),a}findPreviousWithSelection(t,e,i){if(!t||t.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=this._terminal.buffer.active.baseY+this._terminal.rows-1,n=this._terminal.cols,o=!0;this._lineCache.initLinesCache();let a={startRow:r,startCol:n},l;if(s&&(a.startRow=r=s.start.y,a.startCol=n=s.start.x,i!==t&&(l=this._findInLine(t,a,e,!1),l||(a.startRow=r=s.end.y,a.startCol=n=s.end.x))),l||(l=this._findInLine(t,a,e,o)),!l){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let h=r-1;h>=0&&(a.startRow=h,l=this._findInLine(t,a,e,o),!l);h--);}if(!l&&r!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let h=this._terminal.buffer.active.baseY+this._terminal.rows-1;h>=r&&(a.startRow=h,l=this._findInLine(t,a,e,o),!l);h--);return l}_isWholeWord(t,e,i){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(e[t-1]))&&(t+i.length===e.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(e[t+i.length]))}_findInLine(t,e,i={},s=!1){let r=e.startRow,n=e.startCol;if(this._terminal.buffer.active.getLine(r)?.isWrapped){if(s){e.startCol+=this._terminal.cols;return}return e.startRow--,e.startCol+=this._terminal.cols,this._findInLine(t,e,i)}let o=this._lineCache.getLineFromCache(r);o||(o=this._lineCache.translateBufferLineToStringWithWrap(r,!0),this._lineCache.setLineInCache(r,o));let[a,l]=o,h=this._bufferColsToStringOffset(r,n),c=t,d=a;i.regex||(c=i.caseSensitive?t:t.toLowerCase(),d=i.caseSensitive?a:a.toLowerCase());let u=-1;if(i.regex){let f=RegExp(c,i.caseSensitive?"g":"gi"),g;if(s)for(;g=f.exec(d.slice(0,h));)u=f.lastIndex-g[0].length,t=g[0],f.lastIndex-=t.length-1;else g=f.exec(d.slice(h)),g&&g[0].length>0&&(u=h+(f.lastIndex-g[0].length),t=g[0])}else s?h-c.length>=0&&(u=d.lastIndexOf(c,h-c.length)):u=d.indexOf(c,h);if(u>=0){if(i.wholeWord&&!this._isWholeWord(u,d,t))return;let f=0;for(;f<l.length-1&&u>=l[f+1];)f++;let g=f;for(;g<l.length-1&&u+t.length>=l[g+1];)g++;let C=u-l[f],E=u+t.length-l[g],D=this._stringLengthToBufferSize(r+f,C),B=this._stringLengthToBufferSize(r+g,E)-D+this._terminal.cols*(g-f);return{term:t,col:D,row:r+f,size:B}}}_stringLengthToBufferSize(t,e){let i=this._terminal.buffer.active.getLine(t);if(!i)return 0;for(let s=0;s<e;s++){let r=i.getCell(s);if(!r)break;let n=r.getChars();n.length>1&&(e-=n.length-1);let o=i.getCell(s+1);o&&o.getWidth()===0&&e++}return e}_bufferColsToStringOffset(t,e){let i=t,s=0,r=this._terminal.buffer.active.getLine(i);for(;e>0&&r;){for(let n=0;n<e&&n<this._terminal.cols;n++){let o=r.getCell(n);if(!o)break;o.getWidth()&&(s+=o.getCode()===0?1:o.getChars().length)}if(i++,r=this._terminal.buffer.active.getLine(i),r&&!r.isWrapped)break;e-=this._terminal.cols}return s}},Lf=class extends qt{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(yi(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,e){this.clearHighlightDecorations();for(let i of t){let s=this._createResultDecorations(i,e,!1);if(s)for(let r of s)this._storeDecoration(r,i)}}createActiveDecoration(t,e){let i=this._createResultDecorations(t,e,!0);if(i)return{decorations:i,match:t,dispose(){qi(i)}}}clearHighlightDecorations(){qi(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,e){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:e,dispose(){t.dispose()}})}_applyStyles(t,e,i){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),e&&(t.style.outline=`1px solid ${e}`)),i&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,e,i){let s=[],r=t.col,n=t.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;n>0;){let l=Math.min(this._terminal.cols-r,n);s.push([o,r,l]),r=0,n-=l,o++}let a=[];for(let l of s){let h=this._terminal.registerMarker(l[0]),c=this._terminal.registerDecoration({marker:h,x:l[1],width:l[2],backgroundColor:i?e.activeMatchBackground:e.matchBackground,overviewRulerOptions:this._highlightedLines.has(h.line)?void 0:{color:i?e.activeMatchColorOverviewRuler:e.matchOverviewRuler,position:"center"}});if(c){let d=[];d.push(h),d.push(c.onRender(u=>this._applyStyles(u,i?e.activeMatchBorder:e.matchBorder,!1))),d.push(c.onDispose(()=>qi(d))),a.push(c)}}return a.length===0?void 0:a}},Mf=class extends qt{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new ut)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,e){this._searchResults=t.slice(0,e)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let e=0;e<this._searchResults.length;e++){let i=this._searchResults[e];if(i.row===t.row&&i.col===t.col&&i.size===t.size)return e}return-1}fireResultsChanged(t){if(!t)return;let e=-1;this._selectedDecoration&&(e=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:e,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Tf=class extends qt{constructor(t){super(),this._highlightTimeout=this._register(new Rs),this._lineCache=this._register(new Rs),this._state=new kf,this._resultTracker=this._register(new Mf),this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new xf(t),this._engine=new Ef(t,this._lineCache.value),this._decorationManager=new Lf(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(yi(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Bh(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let s=this._findNextAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,s}_highlightAllMatches(t,e){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],s,r=this._engine.find(t,0,0,e);for(;r&&(s?.row!==r.row||s?.col!==r.col)&&!(i.length>=this._highlightLimit);)s=r,i.push(s),r=this._engine.find(t,s.col+s.term.length>=this._terminal.cols?s.row+1:s.row,s.col+s.term.length>=this._terminal.cols?0:s.col+1,e);this._resultTracker.updateResults(i,this._highlightLimit),e.decorations&&this._decorationManager.createHighlightDecorations(i,e.decorations)}_findNextAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findNextWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(s,e?.decorations,i?.noScroll)}findPrevious(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let s=this._findPreviousAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,s}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findPreviousWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(s,e?.decorations,i?.noScroll)}_selectResult(t,e,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),e){let s=this._decorationManager.createActiveDecoration(t,e);s&&(this._resultTracker.selectedDecoration=s)}if(!i&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let s=t.row-this._terminal.buffer.active.viewportY;s-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(s)}return!0}};const Yt=new ji("TerminalStateMachine");var et=(t=>(t.UNINITIALIZED="uninitialized",t.INITIALIZING="initializing",t.CONNECTING="connecting",t.CONNECTED="connected",t.RECONNECTING="reconnecting",t.DISCONNECTED="disconnected",t.ERROR="error",t.DISPOSED="disposed",t))(et||{});class Rf{constructor(e){P(this,"currentState","uninitialized");P(this,"stateListeners",new Map);P(this,"transitionListeners",new Set);P(this,"errorHandlers",new Set);P(this,"transitions",[{from:["uninitialized"],to:"initializing",action:"initialize"},{from:["initializing"],to:"connecting",action:"connect"},{from:["connecting"],to:"connected",action:"connected"},{from:["disconnected","error"],to:"reconnecting",action:"reconnect"},{from:["reconnecting"],to:"connected",action:"reconnected"},{from:["connected","connecting"],to:"disconnected",action:"disconnect"},{from:["initializing","connecting","connected","reconnecting"],to:"error",action:"error"},{from:["uninitialized","initializing","connecting","connected","reconnecting","disconnected","error"],to:"disposed",action:"dispose"}]);this.terminalId=e}getState(){return this.currentState}canTransition(e){const i=this.transitions.find(s=>s.action===e&&s.from.includes(this.currentState));return!(!i||i.guard&&!i.guard())}transition(e){const i=this.transitions.find(r=>r.action===e&&r.from.includes(this.currentState));if(!i)return Yt.warn(`Invalid transition: ${e} from ${this.currentState}`),!1;if(i.guard&&!i.guard())return Yt.warn(`Guard failed for transition: ${e}`),!1;const s=this.currentState;return this.currentState=i.to,Yt.info(`Terminal ${this.terminalId}: ${s} -> ${this.currentState} (${e})`),this.notifyStateListeners(this.currentState),this.notifyTransitionListeners(s,this.currentState),!0}onStateChange(e,i){let s=this.stateListeners.get(e);return s||(s=new Set,this.stateListeners.set(e,s)),s.add(i),()=>{this.stateListeners.get(e)?.delete(i)}}onTransition(e){return this.transitionListeners.add(e),()=>{this.transitionListeners.delete(e)}}onError(e){return this.errorHandlers.add(e),()=>{this.errorHandlers.delete(e)}}reportError(e){Yt.error(`Terminal ${this.terminalId} error:`,e),this.errorHandlers.forEach(i=>{try{i(e)}catch(s){Yt.error("Error handler threw exception:",s)}}),this.currentState!=="disposed"&&this.transition("error")}isHealthy(){return["connected","connecting","reconnecting"].includes(this.currentState)}canAcceptInput(){return this.currentState==="connected"}isDisposed(){return this.currentState==="disposed"}notifyStateListeners(e){this.stateListeners.get(e)?.forEach(i=>{try{i()}catch(s){Yt.error("Error in state listener:",s)}})}notifyTransitionListeners(e,i){this.transitionListeners.forEach(s=>{try{s(e,i)}catch(r){Yt.error("Error in transition listener:",r)}})}dispose(){this.isDisposed()||this.transition("dispose"),this.stateListeners.clear(),this.transitionListeners.clear(),this.errorHandlers.clear()}}const ct=new ji("TerminalBufferManager"),Ln="terminal-buffer-index";let Jt=null,hn=0;const Df=5e3;function Mn(){const t=Date.now();if(Jt&&t-hn<Df)return Jt;try{const e=localStorage.getItem(Ln);if(e){const i=JSON.parse(e);Jt=new Map(i.map(s=>[s.key,s.timestamp]))}else Jt=new Map}catch{Jt=new Map}return hn=t,Jt}function Tn(t){try{const e=Array.from(t.entries()).map(([i,s])=>({key:i,timestamp:s}));localStorage.setItem(Ln,JSON.stringify(e)),Jt=t,hn=Date.now()}catch{}}function na(t,e){const i=Mn();i.set(t,e),Tn(i)}function oa(t){const e=Mn();e.delete(t),Tn(e)}const $e=class $e{constructor(e,i){P(this,"storageKey");P(this,"fallbackStorage",new Map);this.workspaceId=e,this.terminalId=i,this.storageKey=`terminal-buffer-${e}-${i}`}async saveBuffer(e,i,s){try{const n={lines:this.trimBuffer(e),cursorX:i,cursorY:s,timestamp:Date.now(),version:$e.BUFFER_VERSION};if(await this.hasStorageSpace(n))try{return localStorage.setItem(this.storageKey,JSON.stringify(n)),na(this.storageKey,n.timestamp),ct.debug(`Saved buffer for terminal ${this.terminalId}`),!0}catch(o){return ct.warn("localStorage failed, using fallback storage:",o),this.fallbackStorage.set(this.storageKey,n),!0}else{await this.cleanupOldBuffers();try{return localStorage.setItem(this.storageKey,JSON.stringify(n)),na(this.storageKey,n.timestamp),!0}catch{return this.fallbackStorage.set(this.storageKey,n),!0}}}catch(r){return ct.error("Failed to save buffer:",r),!1}}async restoreBuffer(){try{const e=localStorage.getItem(this.storageKey);if(e){const s=JSON.parse(e);if(this.isValidSnapshot(s))return ct.debug(`Restored buffer for terminal ${this.terminalId}`),s;localStorage.removeItem(this.storageKey)}const i=this.fallbackStorage.get(this.storageKey);return i&&this.isValidSnapshot(i)?i:null}catch(e){return ct.error("Failed to restore buffer:",e),null}}async clearBuffer(){try{localStorage.removeItem(this.storageKey),this.fallbackStorage.delete(this.storageKey),oa(this.storageKey)}catch(e){ct.error("Failed to clear buffer:",e)}}trimBuffer(e){for(;e.length>0&&!e[e.length-1].trim();)e.pop();return e.length>$e.MAX_BUFFER_SIZE&&(e=e.slice(-1e4)),e.map(i=>i.length>$e.MAX_LINE_LENGTH?`${i.substring(0,$e.MAX_LINE_LENGTH)}…`:i)}isValidSnapshot(e){return!(e.version!==$e.BUFFER_VERSION||Date.now()-e.timestamp>$e.RETENTION_PERIOD||!Array.isArray(e.lines))}async hasStorageSpace(e){try{const i=JSON.stringify(e).length;if("storage"in navigator&&"estimate"in navigator.storage){const s=await navigator.storage.estimate();return(s.quota||0)-(s.usage||0)>i+$e.STORAGE_QUOTA_BUFFER}return!0}catch{return!0}}async cleanupOldBuffers(){try{const e=[],i=Date.now(),s=Mn();for(const[r,n]of s)i-n>$e.RETENTION_PERIOD&&e.push(r);for(const r of e)localStorage.removeItem(r),oa(r),ct.debug(`Cleaned up old buffer: ${r}`);s.size===0&&await this.rebuildBufferIndex()}catch(e){ct.error("Failed to cleanup old buffers:",e)}}async rebuildBufferIndex(){try{const e=new Map;for(let i=0;i<localStorage.length;i++){const s=localStorage.key(i);if(s?.startsWith("terminal-buffer-")&&s!==Ln)try{const r=localStorage.getItem(s);if(r){const n=JSON.parse(r);e.set(s,n.timestamp)}}catch{}}e.size>0&&(Tn(e),ct.debug(`Rebuilt buffer index with ${e.size} entries`))}catch(e){ct.error("Failed to rebuild buffer index:",e)}}getStats(){try{const e=localStorage.getItem(this.storageKey);if(e){const i=JSON.parse(e);return{size:e.length,lineCount:i.lines.length,age:Date.now()-i.timestamp}}return null}catch{return null}}};P($e,"BUFFER_VERSION",1),P($e,"MAX_BUFFER_SIZE",1e4),P($e,"MAX_LINE_LENGTH",1e3),P($e,"RETENTION_PERIOD",1440*60*1e3),P($e,"STORAGE_QUOTA_BUFFER",100*1024);let Ds=$e;const Oi=new ji("TerminalThemeManager"),Se=class Se{constructor(e){P(this,"currentTheme");P(this,"customTerminalTheme",null);P(this,"themeObserver",null);P(this,"transitionTimeout",null);P(this,"darkModeQuery",null);P(this,"darkModeChangeHandler",null);P(this,"themeChangeHandler",null);this.container=e,this.currentTheme=this.detectSystemTheme(),this.setContainer(this.container??null),this.setupThemeObserver()}setContainer(e){this.transitionTimeout&&(clearTimeout(this.transitionTimeout),this.transitionTimeout=null),this.container&&this.container!==e&&(this.container.style.transition=""),this.container=e,this.container&&(this.container.style.backgroundColor=this.currentTheme.background||"transparent")}getCurrentTheme(){return this.currentTheme}applyTheme(e,i){const s=i||this.detectSystemTheme();if(s.name!==this.currentTheme.name)try{this.container&&(this.container.style.transition=`background-color ${Se.TRANSITION_DURATION}ms ease`),e.options.theme=s,this.container&&(this.container.style.backgroundColor=s.background||"transparent"),e.refresh(0,e.rows-1),this.currentTheme=s,Oi.debug(`Applied theme: ${s.name}`),this.transitionTimeout&&clearTimeout(this.transitionTimeout),this.transitionTimeout=setTimeout(()=>{this.container&&(this.container.style.transition="")},Se.TRANSITION_DURATION)}catch(r){Oi.error("Failed to apply theme:",r)}}detectSystemTheme(){if(this.customTerminalTheme)return this.customTerminalTheme;const e=document.documentElement.classList.contains("dark"),i=document.documentElement.classList.contains("light");if(e)return Se.DARK_THEME;if(i)return Se.LIGHT_THEME;const s=document.documentElement.getAttribute("data-theme");if(s==="dark")return Se.DARK_THEME;if(s==="light")return Se.LIGHT_THEME;const n=getComputedStyle(document.documentElement).getPropertyValue("--background").trim();return n&&this.isColorDark(n)||Nh.isDark()?Se.DARK_THEME:Se.LIGHT_THEME}isColorDark(e){const i=this.colorToRgb(e);return i?(.299*i.r+.587*i.g+.114*i.b)/255<.5:!1}colorToRgb(e){if(e.startsWith("#")){const s=e.slice(1);if(s.length===3)return{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16)};if(s.length===6)return{r:parseInt(s.slice(0,2),16),g:parseInt(s.slice(2,4),16),b:parseInt(s.slice(4,6),16)}}const i=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);return i?{r:parseInt(i[1]),g:parseInt(i[2]),b:parseInt(i[3])}:null}setupThemeObserver(){typeof window>"u"||(this.themeObserver=new MutationObserver(e=>{for(const i of e)if(i.type==="attributes"){const s=i.attributeName;if(s==="class"||s==="data-theme"){const r=this.detectSystemTheme();r.name!==this.currentTheme.name&&(Oi.debug(`Theme change detected: ${this.currentTheme.name} -> ${r.name}`),Ui("terminal-theme-changed",{theme:r}))}}}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),this.darkModeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.darkModeChangeHandler=()=>{Oi.debug("System theme preference changed");const e=this.detectSystemTheme();e.name!==this.currentTheme.name&&Ui("terminal-theme-changed",{theme:e})},this.darkModeQuery.addEventListener("change",this.darkModeChangeHandler),this.themeChangeHandler=e=>{const i=e.detail?.isDark,s=e.detail?.terminalColors;let r;s&&Object.keys(s).length>0?(r={...i?Se.DARK_THEME:Se.LIGHT_THEME,...s,name:"custom",isDark:i},this.customTerminalTheme=r):(this.customTerminalTheme=null,r=i?Se.DARK_THEME:Se.LIGHT_THEME),(r.name!==this.currentTheme.name||s)&&(Oi.debug(`App theme changed to ${r.name}`),Ui("terminal-theme-changed",{theme:r}))},window.addEventListener("theme-changed",this.themeChangeHandler))}dispose(){this.themeObserver&&(this.themeObserver.disconnect(),this.themeObserver=null),this.darkModeQuery&&this.darkModeChangeHandler&&(this.darkModeQuery.removeEventListener("change",this.darkModeChangeHandler),this.darkModeQuery=null,this.darkModeChangeHandler=null),this.themeChangeHandler&&(window.removeEventListener("theme-changed",this.themeChangeHandler),this.themeChangeHandler=null),this.transitionTimeout&&(clearTimeout(this.transitionTimeout),this.transitionTimeout=null),this.setContainer(null)}};P(Se,"TRANSITION_DURATION",200),P(Se,"DARK_THEME",{name:"sleek-dark",isDark:!0,background:"#0B0B0E",foreground:"#e4e4e7",cursor:"#fbbf24",cursorAccent:"#1a1a1a",selectionBackground:"#3f3f46",selectionForeground:"#F7F7F7",selectionInactiveBackground:"#27272a",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#d4d4d8",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f4f4f5"}),P(Se,"LIGHT_THEME",{name:"sleek-light",isDark:!1,background:"#F7F7F8",foreground:"#18181b",cursor:"#f59e0b",cursorAccent:"#F7F7F7",selectionBackground:"#e4e4e7",selectionForeground:"#09090b",selectionInactiveBackground:"#f4f4f5",black:"#18181b",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#e4e4e7",brightBlack:"#71717a",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#F7F7F7"});let ln=Se;const Ft="***",Bf="(?=[A-Za-z_])[A-Za-z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASS|CREDENTIAL|AUTH|PWD)[A-Za-z0-9_]*",Af=new RegExp(`((?:^|(?<=\\s)|&&|;|\\|\\|)\\s*(?:export\\s+)?)(${Bf})(=)("(?:[^"\\\\]|\\\\.)*"|'(?:[^'\\\\]|\\\\.)*'|\\\`[^\\\`]*\\\`|\\S+)`,"gi"),Pf=/(-[Hh]\s+|--header\s+)(['"])(Authorization:\s*)[^'"]*(\2)/gi,Of=/([\w+.-]+:\/\/[^\s@]+):([^\s@]+)@(?=\S)/gi,If=/(curl\s+(?:\S+\s+)*(?:-u|--user)[=\s]\s*)(["']?)([^\s"':]+):([^\s"']+)\2/gi,$f=/(--(?:password|passwd|token|secret|api-key|api-token|auth-token|access-token|client-secret|private-key))(=)("(?:[^"\\\\]|\\\\.)*"|'(?:[^'\\\\]|\\\\.)*'|\S+)/gi,Ff=/(--(?:password|passwd|token|secret|api-key|api-token|auth-token|access-token|client-secret|private-key))\s+("(?:[^"\\\\]|\\\\.)*"|'(?:[^'\\\\]|\\\\.)*'|\S+)/gi,Nf=/((?:mysql|mongosh?|redis-cli|sshpass)\s+(?:\S+\s+)*-[pP])\s+(\S+)/gi,zf=/(mysql\s+(?:\S+\s+)*-[pP])(\S+)/gi;function Ut(t){if(!t)return t;let e=t;return e=e.replace(Pf,`$1$2Authorization: ${Ft}$4`),e=e.replace(If,`$1$2$3:${Ft}$2`),e=e.replace(Of,`$1:${Ft}@`),e=e.replace($f,`$1$2${Ft}`),e=e.replace(Ff,`$1 ${Ft}`),e=e.replace(Nf,`$1 ${Ft}`),e=e.replace(zf,`$1${Ft}`),e=e.replace(Af,`$1$2$3${Ft}`),e}function Op(t){try{const e=new URL(t);return`${e.origin}${e.pathname}`.substring(0,100)}catch{return""}}const Xt=zh("TerminalHistoryTracker"),Qt=class Qt{constructor(){P(this,"histories",new Map);P(this,"MAX_HISTORY_SIZE",10);P(this,"MAX_OUTPUT_LENGTH",500);P(this,"STORAGE_PREFIX","terminal-history-");P(this,"_updateCounter",$h(0));P(this,"updateCounter",{subscribe:this._updateCounter.subscribe});this.loadHistories()}notifyUpdate(){this._updateCounter.update(e=>e+1)}static getInstance(){return Qt.instance||(Qt.instance=new Qt),Qt.instance}getOrCreateHistory(e,i){let s=this.histories.get(e);return s||(s={terminalId:e,workspaceId:i,commands:[],currentOutput:"",isExecuting:!1},this.histories.set(e,s)),s}onCommandStart(e,i,s){const r=this.getOrCreateHistory(e,i),n=Ut(s);r.currentCommand=n,r.currentOutput="",r.isExecuting=!0,r.lastCommand=n,this.notifyUpdate(),Xt.debug(`Command started for terminal ${e}: ${n}`)}onOutput(e,i,s){const r=this.getOrCreateHistory(e,i);r.currentOutput.length<this.MAX_OUTPUT_LENGTH&&(r.currentOutput+=s,r.currentOutput.length>this.MAX_OUTPUT_LENGTH&&(r.currentOutput=`${r.currentOutput.substring(0,this.MAX_OUTPUT_LENGTH)}...`))}onCommandFinish(e,i){const s=this.getOrCreateHistory(e,i);if(s.currentCommand){const r=Ut(s.currentCommand),n={command:r,timestamp:Date.now(),output:s.currentOutput};s.commands.push(n),s.commands.length>this.MAX_HISTORY_SIZE&&(s.commands=s.commands.slice(-this.MAX_HISTORY_SIZE)),s.lastCommand=r,s.lastOutput=s.currentOutput,this.saveHistory(e,s),Xt.debug(`Command finished for terminal ${e}: ${r}`)}s.currentCommand=void 0,s.currentOutput="",s.isExecuting=!1,this.notifyUpdate()}getHistory(e){return this.histories.get(e)}getHistoriesForWorkspace(e){return Array.from(this.histories.values()).filter(i=>i.workspaceId===e)}getLastCommand(e){return this.histories.get(e)?.lastCommand}getLastOutput(e){return this.histories.get(e)?.lastOutput}saveHistory(e,i){try{const s=`${this.STORAGE_PREFIX}${e}`,r={terminalId:i.terminalId,workspaceId:i.workspaceId,commands:i.commands.slice(-5).map(n=>({...n,command:Ut(n.command)})),lastCommand:i.lastCommand?Ut(i.lastCommand):void 0,lastOutput:i.lastOutput?.substring(0,200)};localStorage.setItem(s,JSON.stringify(r))}catch(s){Xt.warn("Failed to save terminal history:",s)}}loadHistories(){try{const e=Object.keys(localStorage).filter(i=>i.startsWith(this.STORAGE_PREFIX));for(const i of e)try{const s=localStorage.getItem(i);if(s){const r=JSON.parse(s);r.terminalId&&this.histories.set(r.terminalId,{...r,currentOutput:"",isExecuting:!1,commands:r.commands||[]})}}catch(s){Xt.warn(`Failed to load terminal history for ${i}:`,s)}Xt.info(`Loaded ${this.histories.size} terminal histories from localStorage`)}catch(e){Xt.error("Failed to load terminal histories:",e)}}clearHistory(e){this.histories.delete(e);try{localStorage.removeItem(`${this.STORAGE_PREFIX}${e}`)}catch(i){Xt.warn("Failed to clear terminal history:",i)}}clearWorkspaceHistories(e){const i=[];for(const[s,r]of this.histories.entries())r.workspaceId===e&&i.push(s);for(const s of i)this.clearHistory(s)}};P(Qt,"instance");let cn=Qt;const Ii=cn.getInstance();function Wf(t,e){return setTimeout(()=>{try{t.dispose()}catch(i){if(e)e(i);else throw i}},0)}const Hf=["panel.focus-next-column","panel.focus-previous-column","global.next-space-alt","global.previous-space-alt"];function Uf(t,e,i){return Hf.some(s=>Vh(t,Gh(s,e),i))}const Kf=Tf,I=new ji("TerminalAdapter"),qf=typeof process<"u"&&process.platform==="win32",Vf=100,Ae=class Ae{constructor(e){P(this,"xterm");P(this,"fitAddon");P(this,"searchAddon");P(this,"webLinksAddon");P(this,"webglAddon",null);P(this,"stateMachine");P(this,"bufferManager");P(this,"themeManager");P(this,"terminalId");P(this,"workspaceId");P(this,"container");P(this,"eventListeners",[]);P(this,"resizeObserver",null);P(this,"reattachFitObserver",null);P(this,"reattachFitTimer",null);P(this,"visibilityObserver",null);P(this,"wasVisible",!0);P(this,"isVisible",!0);P(this,"lastFittedSize",null);P(this,"resizeDebounceTimer",null);P(this,"bufferSaveTimer",null);P(this,"dataDisposable",null);P(this,"resizeDisposable",null);P(this,"selectionDisposable",null);P(this,"ipcCleanup",null);P(this,"themeCleanup",null);P(this,"webglContextLostCleanup",null);P(this,"isDisposed",!1);P(this,"isXtermOpened",!1);P(this,"autoReconnectTimer",null);P(this,"autoReconnectAttempts",0);P(this,"heartbeatTimer",null);P(this,"webglRecoveryAttempts",0);P(this,"exitedNormally",!1);P(this,"lastCwd");P(this,"isExecuting",!1);P(this,"startTime",Date.now());P(this,"commandBuffer","");P(this,"currentLineBuffer","");P(this,"isAtPrompt",!1);P(this,"callbacks");P(this,"terminals");this.workspaceId=e.workspaceId,this.terminalId=e.terminalId||`terminal-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,this.container=e.container,this.terminals=(e.appClient??Fh).terminals,this.callbacks={onReady:e.onReady,onExit:e.onExit,onCommandStart:e.onCommandStart,onCommandFinished:e.onCommandFinished,onCwdChanged:e.onCwdChanged,onError:e.onError,onToggleSearch:e.onToggleSearch},this.stateMachine=new Rf(this.terminalId),this.setupStateMachineListeners(),this.bufferManager=new Ds(this.workspaceId,this.terminalId),this.themeManager=new ln(this.container);const i=e.fontFamily??Yh.select(Mt.state);this.xterm=new nu({allowProposedApi:!0,fontFamily:i,fontSize:13,lineHeight:1.2,letterSpacing:0,cursorBlink:!0,cursorStyle:"block",cursorWidth:1,scrollback:1e4,allowTransparency:!0,windowsPty:qf?{backend:"conpty"}:void 0,macOptionIsMeta:!0,rightClickSelectsWord:!0,convertEol:!0,drawBoldTextInBrightColors:!0,scrollSensitivity:1,theme:this.themeManager.getCurrentTheme()}),this.fitAddon=new hu,this.xterm.loadAddon(this.fitAddon),this.webLinksAddon=new fu((s,r)=>{this.handleLinkClick(r)}),this.xterm.loadAddon(this.webLinksAddon),this.searchAddon=new Kf,this.xterm.loadAddon(this.searchAddon),this.searchAddon.onDidChangeResults(s=>{this.callbacks.onSearchResultsChange?.(s.resultIndex,s.resultCount)})}getSearchDecorations(){return{matchBackground:"#515c6a",matchBorder:"#515c6a",matchOverviewRuler:"#515c6a",activeMatchBackground:"#eab308",activeMatchBorder:"#ca8a04",activeMatchColorOverviewRuler:"#eab308"}}setupStateMachineListeners(){this.stateMachine.onTransition((e,i)=>{i===et.ERROR&&this.handleError(new Error(`Terminal entered error state from ${e}`)),(i===et.DISCONNECTED||i===et.ERROR)&&(this.stopHeartbeat(),this.exitedNormally||this.scheduleAutoReconnect()),i===et.CONNECTED&&(this.autoReconnectAttempts=0,this.cancelAutoReconnect(),this.startHeartbeat())}),this.stateMachine.onError(e=>{this.handleError(e)})}async initialize(e=!1){if(this.isDisposed)throw new Error("Cannot initialize disposed terminal");if(!this.container)throw new Error("Cannot initialize terminal without a container");const i=this.container;if(!this.stateMachine.canTransition("initialize"))throw new Error(`Cannot initialize terminal in state ${this.stateMachine.getState()}`);this.stateMachine.transition("initialize");try{this.isXtermOpened?I.warn(`[initialize] XTerm already opened for terminal ${this.terminalId}, skipping open()`):(this.xterm.open(i),this.isXtermOpened=!0,I.info(`[initialize] XTerm opened for terminal ${this.terminalId}`)),this.themeManager.getCurrentTheme().isDark?this.loadWebglAddon():I.debug("[Renderer] Using Canvas renderer for light theme (better anti-aliasing)"),this.themeManager.applyTheme(this.xterm),this.fitTerminalToContainer()||(I.warn("Container has no dimensions, delaying fit"),setTimeout(()=>{this.fitTerminalToContainer()},100)),this.setupResizeObserver(),this.setupXTermEventHandlers(),this.setupThemeChangeListener();const r=this.xterm.cols,n=this.xterm.rows,o=await this.findBackendTerminal(),a=o!==null;if(!e)if(a)try{const l=await this.terminals.getBuffer(this.terminalId,void 0,this.workspaceId);l&&(I.info(`Restoring ${l.length} bytes of buffered output from backend`),this.xterm.write(l),this.parseTerminalOutput(l))}catch(l){I.warn("Could not restore terminal buffer from backend:",l)}else{const l=await this.bufferManager.restoreBuffer();l&&(I.info("Restoring terminal buffer from local storage"),this.restoreFromSnapshot(l))}this.startBufferAutoSave(),this.stateMachine.transition("connect"),a?(this.setupIpcEventHandlers(),this.stateMachine.transition("connected"),this.resize(r,n),o?.isExecuting===!1&&this.hideCursorOnExit(),this.callbacks.onReady?.()):(I.debug(`[initialize] Terminal ${this.terminalId} creating new PTY`),await this.openPtyConnection(r,n)),requestAnimationFrame(()=>{!this.isDisposed&&this.isVisible&&this.xterm.focus()})}catch(s){throw this.stateMachine.reportError(s),s}}async openPtyConnection(e,i){try{const s=await this.terminals.create({workspaceId:this.workspaceId,cols:e,rows:i});if(!s.success)throw new Error(s.error||Fs.terminal_adapter_openFailed_error());s.id&&(this.terminalId=s.id),this.setupIpcEventHandlers(),this.stateMachine.transition("connected"),this.restoreCursor(),this.callbacks.onReady?.()}catch(s){throw this.stateMachine.reportError(s),s}}async findBackendTerminal(){try{const{terminals:e}=await this.terminals.list(this.workspaceId);return e.find(i=>i.id===this.terminalId)??null}catch(e){return I.warn("Could not check terminal existence:",e),null}}async terminalExistsOnBackend(){return await this.findBackendTerminal()!==null}hideCursorOnExit(){this.isDisposed||(this.xterm.options.cursorBlink=!1,this.xterm.write("\x1B[?25l"))}restoreCursor(){this.isDisposed||(this.xterm.options.cursorBlink=!0,this.xterm.write("\x1B[?25h"))}setupXTermEventHandlers(){this.container&&(this.dataDisposable&&(this.dataDisposable.dispose(),this.dataDisposable=null),this.resizeDisposable&&(this.resizeDisposable.dispose(),this.resizeDisposable=null),this.selectionDisposable&&(this.selectionDisposable.dispose(),this.selectionDisposable=null),this.xterm.attachCustomKeyEventHandler(e=>{const i=navigator.platform.toUpperCase().includes("MAC"),s=i?e.metaKey:e.ctrlKey;return e.metaKey&&e.key==="k"&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?(e.type==="keydown"&&this.clear(),!1):s&&e.key==="j"&&!e.shiftKey&&!e.altKey?(e.type==="keydown"&&Mt.dispatch(An(this.workspaceId)),!1):s&&e.key==="f"&&!e.shiftKey&&!e.altKey?(e.type==="keydown"&&this.callbacks.onToggleSearch?.(),!1):s&&(e.key==="t"||e.key==="T")&&!e.shiftKey&&!e.altKey?(e.type==="keydown"&&Ui("workspace:new-terminal",{workspaceId:this.workspaceId}),!1):s&&(e.key==="w"||e.key==="W")&&!e.shiftKey&&!e.altKey?(e.type==="keydown"&&Mt.dispatch(Hh(this.workspaceId)),!1):Uf(e,Mt.state.userPreferences?.shortcutOverrides??{},i)||s&&e.shiftKey&&!e.altKey&&(e.key==="]"||e.key==="}"||e.key==="["||e.key==="{")?!1:e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.key==="`"||e.key==="~")?(e.type==="keydown"&&(e.shiftKey||e.key==="~"?Ui("workspace:new-terminal",{workspaceId:this.workspaceId}):Mt.dispatch(An(this.workspaceId))),!1):!0}),this.dataDisposable=this.xterm.onData(e=>{this.isDisposed||this.write(e)}),this.resizeDisposable=this.xterm.onResize(({cols:e,rows:i})=>{!this.isDisposed&&this.stateMachine.canAcceptInput()&&this.resize(e,i)}),this.selectionDisposable=this.xterm.onSelectionChange(()=>{}))}setupIpcEventHandlers(){this.ipcCleanup&&(this.ipcCleanup(),this.ipcCleanup=null);let e=!1;const i=this.terminals.subscribeEvents(this.terminalId,{onData:({chunk:s})=>{e||this.isDisposed||this.stateMachine.canAcceptInput()&&(this.xterm.write(s),this.parseTerminalOutput(s))},onExit:({exitCode:s})=>{e||this.isDisposed||(this.exitedNormally=!0,this.hideCursorOnExit(),this.callbacks.onExit?.(s),this.stateMachine.transition("disconnect"))},onCwd:({cwd:s})=>{e||this.isDisposed||(this.lastCwd=s,this.callbacks.onCwdChanged?.(s))}},this.workspaceId);this.ipcCleanup=()=>{e=!0;try{i()}catch(s){I.warn("Failed to unsubscribe terminal events:",s)}}}setupResizeObserver(){if(!this.container||!this.isVisible)return;const e=this.container;this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.resizeDebounceTimer&&(clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=null),this.resizeObserver=new ResizeObserver(()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=setTimeout(()=>{this.fitTerminalToContainer()},100)}),this.resizeObserver.observe(e),this.setupVisibilityObserver()}setupVisibilityObserver(){if(!this.container)return;const e=this.container;this.visibilityObserver&&(this.visibilityObserver.disconnect(),this.visibilityObserver=null),this.visibilityObserver=new IntersectionObserver(i=>{for(const s of i){const r=s.isIntersecting;r&&!this.wasVisible&&(I.debug(`[visibility] Terminal ${this.terminalId} became visible, reconnecting ResizeObserver`),this.resizeObserver||(this.resizeObserver=new ResizeObserver(()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=setTimeout(()=>{this.fitTerminalToContainer()},100)}),this.resizeObserver.observe(e)),this.fitTerminalToContainer()),this.wasVisible=r}}),this.visibilityObserver.observe(e)}loadWebglAddon(){this.disposeWebglAddon();try{this.webglAddon=new X_,this.xterm.loadAddon(this.webglAddon);const e=this.xterm.element?.querySelector("canvas");if(e){const i=s=>{s.preventDefault(),I.warn(`[WebGL] Context lost for terminal ${this.terminalId}, recovering...`),!this.isDisposed&&(this.disposeWebglAddon(),setTimeout(()=>{if(this.isDisposed)return;if(!this.themeManager.getCurrentTheme().isDark){I.info("[WebGL] Skipping WebGL recovery on light theme, using Canvas renderer");return}if(this.webglRecoveryAttempts>=Ae.MAX_WEBGL_RECOVERY_ATTEMPTS){I.warn(`[WebGL] Max recovery attempts (${Ae.MAX_WEBGL_RECOVERY_ATTEMPTS}) reached for terminal ${this.terminalId}, staying on Canvas renderer`);return}this.webglRecoveryAttempts++;try{this.loadWebglAddon(),I.info(`[WebGL] Successfully recovered from context loss (attempt ${this.webglRecoveryAttempts})`)}catch(n){I.warn("[WebGL] Failed to recover from context loss, falling back to Canvas renderer:",n),this.webglAddon=null}},100))};e.addEventListener("webglcontextlost",i),this.webglContextLostCleanup=()=>{e.removeEventListener("webglcontextlost",i)}}}catch(e){I.warn("Failed to load WebGL renderer, falling back to Canvas renderer:",e),this.webglAddon=null}}disposeWebglAddon(){if(this.webglContextLostCleanup&&(this.webglContextLostCleanup(),this.webglContextLostCleanup=null),this.webglAddon){try{this.webglAddon.dispose()}catch(e){I.warn("Error disposing WebGL addon:",e)}this.webglAddon=null}}setupThemeChangeListener(){this.themeCleanup&&(this.themeCleanup(),this.themeCleanup=null);const e=i=>{const s=i.detail?.theme;s&&this.xterm&&(I.info(`[Theme] Theme changed to: ${s.name} (isDark: ${s.isDark})`),this.themeManager.applyTheme(this.xterm,s),s.isDark?this.webglAddon||this.loadWebglAddon():this.webglAddon&&(this.disposeWebglAddon(),I.info("[WebGL] Disposed WebGL addon for light theme (using Canvas renderer)")))};window.addEventListener("terminal-theme-changed",e),this.themeCleanup=()=>{window.removeEventListener("terminal-theme-changed",e)}}parseTerminalOutput(e){Ii.onOutput(this.terminalId,this.workspaceId,e),e.includes("\x1B]133;C\x07")?(this.isExecuting&&(this.isExecuting=!1,this.callbacks.onCommandFinished?.(),Ii.onCommandFinish(this.terminalId,this.workspaceId)),this.commandBuffer="",this.isAtPrompt=!0):e.includes("\x1B]133;A\x07")&&(this.isExecuting||(this.isExecuting=!0,this.callbacks.onCommandStart?.()),this.isAtPrompt=!0,this.commandBuffer="");const i=/[\$%]\s*$/,s=/^.*[\$%]\s+(.+)$/,r=e.split(/\r?\n/);for(const o of r){const a=o.replace(/\x1b\[[0-9;?]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07]*\x07/g,"").replace(/\x1b\][^\x1b]*\x1b\\/g,"").replace(/\x1b[()][AB0-2]/g,"").replace(/\x1b[=>]/g,"").replace(/\x1b[78]/g,"").replace(/\x1b[DME]/g,"").replace(/\x1b[HZ]/g,"").replace(/\x1b[c]/g,"").replace(/\[\?[0-9;]*[a-zA-Z]/g,"").replace(/\x07/g,"").replace(/\x00-\x08\x0b\x0c\x0e-\x1f/g,"").trim();if(!a||/^\[[\?0-9;]*[a-zA-Z]$/.test(a))continue;const l=a.match(s);if(l&&l[1]){const h=l[1].trim(),c=/^[a-zA-Z0-9.\/~]/.test(h);h.length>0&&!this.isExecuting&&c?(I.info(`[TerminalAdapter] Detected command from output: ${Ut(h)}`),Ii.onCommandStart(this.terminalId,this.workspaceId,h),this.isExecuting=!0,this.callbacks.onCommandStart?.()):h.length>0&&!c&&I.debug(`[TerminalAdapter] Skipping suspicious command detection: ${Ut(h)}`)}i.test(a)&&!l&&(this.isExecuting&&(this.isExecuting=!1,this.callbacks.onCommandFinished?.(),Ii.onCommandFinish(this.terminalId,this.workspaceId),I.debug(`[TerminalAdapter] Command finished, prompt detected: ${Ut(a)}`)),this.isAtPrompt=!0,this.commandBuffer="")}const n=e.match(/\x1b\]7;file:\/\/[^/]*([^\x07]*)\x07/);if(n){const o=decodeURIComponent(n[1]);o!==this.lastCwd&&(this.lastCwd=o,this.callbacks.onCwdChanged?.(o))}}startBufferAutoSave(){this.bufferSaveTimer=setInterval(()=>{this.stateMachine?.canAcceptInput()&&this.saveBuffer()},5e3)}async saveBuffer(){try{const e=this.xterm.buffer.active,i=[];for(let s=0;s<e.length;s++){const r=e.getLine(s);r&&i.push(r.translateToString(!0))}await this.bufferManager.saveBuffer(i,e.cursorX,e.cursorY)}catch(e){I.error("Failed to save buffer:",e)}}restoreFromSnapshot(e){if(e.lines&&e.lines.length>0){this.xterm.clear();const i=[...e.lines];for(;i.length>0&&i[i.length-1].trim()==="";)i.pop();const s=/[\$>#%]\s*$/,r=/@[\w-]+/;if(i.length>0){const n=i[i.length-1],o=i.length>1?i[i.length-2]:"";if(s.test(n)&&r.test(n))i.pop();else if(s.test(n)&&n.trim().length<80)i.pop(),i.length>0&&r.test(i[i.length-1])&&i.pop();else if(i.length>=2){const a=o+n;s.test(a)&&r.test(a)&&(i.pop(),i.pop())}}for(let n=0;n<i.length;n++)n<i.length-1?this.xterm.writeln(i[n]):i[n].trim()&&this.xterm.writeln(i[n]);I.debug(`Restored terminal buffer for ${this.terminalId} with ${i.length} lines (prompt removed)`)}}getCommandFromXtermBuffer(){try{const e=this.xterm.buffer.active,i=e.cursorY+e.baseY,s=e.getLine(i);if(!s)return null;const r=s.translateToString(!0);if(!r||!r.trim())return null;const n=r.replace(/\x1b\[[0-9;?]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07]*\x07/g,"").replace(/\x1b[()][AB0-2]/g,"").replace(/\x07/g,"").trim();if(!n)return null;const o=n.match(/^.*[\$%#❯➜]\s+(.+)$/);return o&&o[1]?o[1].trim():null}catch{return null}}write(e){if(!(this.isDisposed||!this.stateMachine.canAcceptInput())){if(e==="\r"||e===`
142
142
  `){const i=this.getCommandFromXtermBuffer(),s=i||this.commandBuffer.trim();s&&(Ii.onCommandStart(this.terminalId,this.workspaceId,s),this.isExecuting=!0,I.debug(`Command executed: ${Ut(s)}${i?" (from xterm buffer)":" (from keystroke buffer)"}`)),this.commandBuffer="",this.currentLineBuffer=""}else e===""||e==="\b"?this.commandBuffer.length>0&&(this.commandBuffer=this.commandBuffer.slice(0,-1)):e===""?(this.commandBuffer="",this.currentLineBuffer=""):e===""?(this.commandBuffer="",this.currentLineBuffer=""):e.match(/[\x00-\x1F\x7F]/)||(this.commandBuffer+=e,this.currentLineBuffer+=e);this.terminals.write(this.terminalId,e,this.workspaceId).then(i=>{i.success||I.error(`[write] Terminal ${this.terminalId}: write failed - ${i.error}`)}).catch(i=>{I.error(`[write] Terminal ${this.terminalId}: transport error - ${i}`),this.isDisposed||this.stateMachine.reportError(i)})}}resize(e,i){this.isDisposed||!this.stateMachine.canAcceptInput()||this.terminals.resize(this.terminalId,e,i,this.workspaceId).catch(s=>{I.error("Failed to resize terminal:",s)})}focus(){!this.isDisposed&&this.isVisible&&this.xterm.focus()}blur(){this.isDisposed||this.xterm.blur()}setVisible(e){if(!(this.isDisposed||this.isVisible===e)){if(this.isVisible=e,this.wasVisible=e,!e){this.xterm.blur(),this.disconnectLayoutObservers();return}this.setupResizeObserver(),requestAnimationFrame(()=>this.fitTerminalToContainer())}}fitTerminalToContainer(){if(this.isDisposed||!this.isVisible||!this.container)return!1;const{width:e,height:i}=this.container.getBoundingClientRect();return e<=0||i<=0?!1:(this.lastFittedSize?.width===e&&this.lastFittedSize.height===i||(this.fitAddon.fit(),this.lastFittedSize={width:e,height:i}),!0)}disconnectLayoutObservers(){this.resizeObserver?.disconnect(),this.resizeObserver=null,this.visibilityObserver?.disconnect(),this.visibilityObserver=null,this.resizeDebounceTimer&&(clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=null)}fitAfterReattach(e){if(this.cancelReattachFit(),this.fitReattachedContainer(e))return;const i=new ResizeObserver(()=>{if(this.reattachFitObserver!==i){i.disconnect();return}this.hasReattachedContainerBox(e)&&(this.reattachFitTimer&&clearTimeout(this.reattachFitTimer),this.reattachFitTimer=setTimeout(()=>{this.reattachFitTimer=null,this.fitReattachedContainer(e)&&this.cancelReattachFit()},Vf))});this.reattachFitObserver=i,i.observe(e)}fitReattachedContainer(e){if(this.isDisposed||this.container!==e)return!0;if(!this.hasReattachedContainerBox(e))return!1;const{width:i,height:s}=e.getBoundingClientRect();return this.fitAddon.fit(),this.lastFittedSize={width:i,height:s},this.xterm.refresh(0,this.xterm.rows-1),!0}hasReattachedContainerBox(e){if(!this.isVisible)return!1;const{width:i,height:s}=e.getBoundingClientRect();return i>0&&s>0}cancelReattachFit(){this.reattachFitObserver?.disconnect(),this.reattachFitObserver=null,this.reattachFitTimer&&(clearTimeout(this.reattachFitTimer),this.reattachFitTimer=null)}clear(){this.isDisposed||this.xterm.clear()}async reattach(e){if(this.isDisposed||this.stateMachine.isDisposed())throw new Error("Cannot reattach disposed terminal");this.cancelAutoReconnect(),this.autoReconnectAttempts=0,this.webglRecoveryAttempts=0,this.exitedNormally=!1,this.setupIpcEventHandlers();const i=this.stateMachine.getState();if(i!==et.CONNECTED){I.info(`[reattach] Terminal ${this.terminalId} not in CONNECTED state (${i}), attempting to restore`);const n=await this.findBackendTerminal();n&&(i===et.DISCONNECTED||i===et.ERROR?(this.stateMachine.transition("reconnect"),this.stateMachine.transition("reconnected")):i===et.CONNECTING&&this.stateMachine.transition("connected"),n.isExecuting===!1&&this.hideCursorOnExit(),I.info(`[reattach] Terminal ${this.terminalId} state restored to ${this.stateMachine.getState()}`))}const s=this.xterm.element;if(s){e.appendChild(s),this.container=e,this.themeManager.setContainer(e),this.disposeWebglAddon(),this.themeManager.applyTheme(this.xterm),this.themeManager.getCurrentTheme().isDark?this.loadWebglAddon():I.debug("[Renderer] Using Canvas renderer after move (light theme)"),this.fitAfterReattach(e),this.setupResizeObserver(),this.setupXTermEventHandlers(),this.commandBuffer="",this.currentLineBuffer="",this.isAtPrompt=!1,this.startHeartbeat(),requestAnimationFrame(()=>{!this.isDisposed&&this.isVisible&&this.xterm.focus()});return}I.warn(`Could not move terminal element, recreating for terminal ${this.terminalId}`),this.container&&(this.container.innerHTML=""),this.disposeWebglAddon(),this.dataDisposable&&(this.dataDisposable.dispose(),this.dataDisposable=null),this.container=e,this.themeManager.setContainer(e),this.isXtermOpened&&I.warn(`[reattach] XTerm was already opened for terminal ${this.terminalId}, calling open() again may cause duplicate handlers`),this.xterm.open(e),this.isXtermOpened=!0,this.themeManager.applyTheme(this.xterm),this.themeManager.getCurrentTheme().isDark?this.loadWebglAddon():I.debug("[Renderer] Using Canvas renderer on reattach (light theme)"),this.fitAfterReattach(e),this.setupXTermEventHandlers(),this.setupResizeObserver(),this.commandBuffer="",this.currentLineBuffer="",this.isAtPrompt=!1,this.startHeartbeat(),requestAnimationFrame(()=>{!this.isDisposed&&this.isVisible&&this.xterm.focus()})}updateCallbacks(e){Object.assign(this.callbacks,e)}updateFontFamily(e){this.isDisposed||this.xterm.options.fontFamily!==e&&(this.xterm.options.fontFamily=e)}findNext(e,i){return this.searchAddon.findNext(e,{caseSensitive:i?.caseSensitive??!1,wholeWord:i?.wholeWord??!1,regex:i?.regex??!1,incremental:!1,decorations:this.getSearchDecorations()})}findPrevious(e,i){return this.searchAddon.findPrevious(e,{caseSensitive:i?.caseSensitive??!1,wholeWord:i?.wholeWord??!1,regex:i?.regex??!1,incremental:!1,decorations:this.getSearchDecorations()})}clearSearch(){this.searchAddon.clearDecorations()}getSelection(){return this.xterm.getSelection()}getInfo(){const e=this.bufferManager.getStats();return{id:this.terminalId,workspaceId:this.workspaceId,state:this.stateMachine.getState(),cwd:this.lastCwd,isExecuting:this.isExecuting,stats:e?{bufferSize:e.size,lineCount:e.lineCount,uptime:Date.now()-this.startTime}:void 0}}startHeartbeat(){this.heartbeatTimer||this.isDisposed||(I.debug(`[heartbeat] Starting for terminal ${this.terminalId} (every ${Ae.HEARTBEAT_INTERVAL_MS}ms)`),this.heartbeatTimer=setInterval(()=>{this.performHealthCheck()},Ae.HEARTBEAT_INTERVAL_MS))}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null,I.debug(`[heartbeat] Stopped for terminal ${this.terminalId}`))}async performHealthCheck(){if(this.isDisposed||!this.ipcCleanup||this.stateMachine.getState()!==et.CONNECTED)return;let e=null;try{const i=await Promise.race([this.terminalExistsOnBackend(),new Promise((s,r)=>{e=setTimeout(()=>r(new Error("Heartbeat timeout")),Ae.HEARTBEAT_TIMEOUT_MS)})]);if(e&&clearTimeout(e),this.isDisposed)return;i||(I.warn(`[heartbeat] Terminal ${this.terminalId}: PTY not found on backend, transitioning to DISCONNECTED`),this.stopHeartbeat(),this.stateMachine.transition("disconnect"))}catch(i){if(e&&clearTimeout(e),this.isDisposed)return;I.warn(`[heartbeat] Terminal ${this.terminalId}: health check failed:`,i),this.stopHeartbeat(),this.stateMachine.transition("disconnect")}}scheduleAutoReconnect(){if(this.isDisposed)return;if(this.autoReconnectAttempts>=Ae.MAX_RECONNECT_ATTEMPTS){I.warn(`[auto-reconnect] Terminal ${this.terminalId}: max reconnect attempts (${Ae.MAX_RECONNECT_ATTEMPTS}) reached, giving up`);return}this.cancelAutoReconnect();const e=Ae.BASE_RECONNECT_DELAY_MS*Math.pow(2,this.autoReconnectAttempts);this.autoReconnectAttempts++,I.info(`[auto-reconnect] Terminal ${this.terminalId}: scheduling attempt ${this.autoReconnectAttempts}/${Ae.MAX_RECONNECT_ATTEMPTS} in ${e}ms`),this.autoReconnectTimer=setTimeout(()=>{this.autoReconnectTimer=null,this.attemptAutoReconnect()},e)}cancelAutoReconnect(){this.autoReconnectTimer&&(clearTimeout(this.autoReconnectTimer),this.autoReconnectTimer=null)}async attemptAutoReconnect(){if(this.isDisposed)return;const e=this.stateMachine.getState();if(e!==et.DISCONNECTED&&e!==et.ERROR){I.debug(`[auto-reconnect] Terminal ${this.terminalId}: skipping, state is ${e}`);return}this.exitedNormally=!1,I.info(`[auto-reconnect] Terminal ${this.terminalId}: attempting reconnect (attempt ${this.autoReconnectAttempts})`);try{const i=await this.findBackendTerminal();if(this.isDisposed)return;i?(I.info(`[auto-reconnect] Terminal ${this.terminalId}: PTY exists on backend, re-establishing connection`),this.setupIpcEventHandlers(),this.stateMachine.transition("reconnect"),this.stateMachine.transition("reconnected"),this.xterm.cols&&this.xterm.rows&&this.resize(this.xterm.cols,this.xterm.rows),i.isExecuting===!1&&this.hideCursorOnExit(),this.callbacks.onReady?.(),I.info(`[auto-reconnect] Terminal ${this.terminalId}: reconnected successfully`)):(I.info(`[auto-reconnect] Terminal ${this.terminalId}: PTY not found, creating new PTY`),await this.reconnect(),I.info(`[auto-reconnect] Terminal ${this.terminalId}: new PTY created successfully`))}catch(i){I.error(`[auto-reconnect] Terminal ${this.terminalId}: attempt ${this.autoReconnectAttempts} failed:`,i),this.scheduleAutoReconnect()}}handleError(e){I.error(`Terminal ${this.terminalId} error:`,e),this.callbacks.onError?.(e),this.isDisposed||this.xterm.writeln(`\r
143
143
  \x1B[31m${Fs.terminal_adapter_errorLine_label({message:e.message})}\x1B[0m\r
144
- `)}handleLinkClick(e){try{if(Wh(e)){I.debug("GitHub URL detected in terminal, opening in external browser",{uri:e,workspaceId:this.workspaceId}),Ns("shell:openExternal",{url:e});return}Bn(async()=>{const{resolveBrowserLinkForOpen:i}=await import("./BqkqHfzf.js").then(s=>s.b);return{resolveBrowserLinkForOpen:i}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url).then(({resolveBrowserLinkForOpen:i})=>i(e)).catch(()=>({url:e})).then(i=>{Bn(async()=>{const{getPanelLayoutManager:s}=await import("./BN2r45vo.js").then(r=>r.p);return{getPanelLayoutManager:s}},__vite__mapDeps([25,17,18,3,19,20,13,5,8,2,11,26,27]),import.meta.url).then(({getPanelLayoutManager:s})=>{s(this.workspaceId).openBrowserPanel(i.url,void 0,void 0,i.requestedUrl),I.debug("Opened URL in browser panel",{uri:e,resolvedUrl:i.url,workspaceId:this.workspaceId})}).catch(s=>{I.warn("Failed to open URL in browser panel, falling back to external browser",{uri:e,error:s}),Ns("shell:openExternal",{url:i.url})})})}catch(i){I.warn("Failed to handle link click",{uri:e,error:i}),Ns("shell:openExternal",{url:e})}}async reconnect(){if(this.isDisposed)throw new Error("Cannot reconnect disposed terminal");if(!this.stateMachine.canTransition("reconnect"))throw new Error(`Cannot reconnect in state ${this.stateMachine.getState()}`);this.exitedNormally=!1,this.stateMachine.transition("reconnect");try{const e=this.xterm.cols,i=this.xterm.rows,s=await this.terminals.create({workspaceId:this.workspaceId,cols:e,rows:i});if(!s.success)throw new Error(s.error||Fs.terminal_adapter_reconnectFailed_error());s.id&&(this.terminalId=s.id),this.setupIpcEventHandlers(),this.stateMachine.transition("reconnected"),this.restoreCursor(),this.callbacks.onReady?.()}catch(e){throw this.stateMachine.reportError(e),e}}detach(){this.ipcCleanup&&(this.ipcCleanup(),this.ipcCleanup=null),this.stopHeartbeat(),this.cancelAutoReconnect(),this.cancelReattachFit(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.visibilityObserver&&(this.visibilityObserver.disconnect(),this.visibilityObserver=null),this.resizeDebounceTimer&&(clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=null);const e=this.xterm.element;e&&e.parentNode&&e.parentNode.removeChild(e),this.themeManager.setContainer(null),this.container=null}dispose(e={}){if(!(this.isDisposed||this.stateMachine.isDisposed())){if(this.isDisposed=!0,this.cancelAutoReconnect(),this.stopHeartbeat(),this.cancelReattachFit(),this.stateMachine.transition("dispose"),this.saveBuffer().catch(()=>{}),this.resizeDebounceTimer&&(clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=null),this.bufferSaveTimer&&(clearInterval(this.bufferSaveTimer),this.bufferSaveTimer=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.visibilityObserver&&(this.visibilityObserver.disconnect(),this.visibilityObserver=null),this.dataDisposable){try{this.dataDisposable.dispose()}catch(i){I.error("Error disposing data handler:",i)}this.dataDisposable=null}if(this.resizeDisposable){try{this.resizeDisposable.dispose()}catch(i){I.error("Error disposing resize handler:",i)}this.resizeDisposable=null}if(this.selectionDisposable){try{this.selectionDisposable.dispose()}catch(i){I.error("Error disposing selection handler:",i)}this.selectionDisposable=null}if(this.ipcCleanup){try{this.ipcCleanup()}catch(i){I.error("Error cleaning up IPC handlers:",i)}this.ipcCleanup=null}if(this.themeCleanup){try{this.themeCleanup()}catch(i){I.error("Error cleaning up theme listener:",i)}this.themeCleanup=null}this.eventListeners.forEach(i=>{try{i()}catch(s){I.error("Error cleaning up event listener:",s)}}),this.eventListeners=[],e.killPty!==!1&&this.terminals.kill(this.terminalId,this.workspaceId).catch(i=>{I.error("Error killing PTY connection:",i)});try{this.searchAddon?.dispose&&this.searchAddon.dispose(),this.webLinksAddon?.dispose&&this.webLinksAddon.dispose(),this.disposeWebglAddon(),this.fitAddon?.dispose&&this.fitAddon.dispose()}catch(i){I.error("Error disposing addons:",i)}try{this.themeManager.dispose()}catch(i){I.error("Error disposing theme manager:",i)}try{this.stateMachine.dispose()}catch(i){I.error("Error disposing state machine:",i)}Wf(this.xterm,i=>{I.error("Error disposing xterm:",i)})}}};P(Ae,"MAX_RECONNECT_ATTEMPTS",5),P(Ae,"BASE_RECONNECT_DELAY_MS",1e3),P(Ae,"HEARTBEAT_INTERVAL_MS",3e4),P(Ae,"HEARTBEAT_TIMEOUT_MS",1e4),P(Ae,"MAX_WEBGL_RECOVERY_ATTEMPTS",3);let dn=Ae;const le=new ji("TerminalManager");class Gf{constructor(){P(this,"terminals",new Map)}saveTerminalMetadata(e,i,s){try{Mt.dispatch(Uh(i,e,s,new Date().toISOString())),le.debug(`[RendererTerminalManager] Saved terminal metadata for ${e}`)}catch(r){le.error("[RendererTerminalManager] Failed to save terminal metadata:",r)}}loadTerminalMetadata(e){try{return Xh.select(Mt.state,e).map(i=>({terminalId:i.id,workspaceId:i.workspaceId??e,createdAt:i.createdAt??"",title:i.customName||jh(i.name)}))}catch(i){le.error("[RendererTerminalManager] Failed to load terminal metadata:",i)}return[]}removeTerminalMetadata(e,i){try{Mt.dispatch(Kh(i,e)),le.debug(`[RendererTerminalManager] Removed terminal metadata for ${e}`)}catch(s){le.error("[RendererTerminalManager] Failed to remove terminal metadata:",s)}}hasTerminal(e){return this.terminals.has(e)}async getOrCreateTerminal(e,i,s,r,n=!1){let o=this.terminals.get(e);if(n&&o&&(le.info(`[RendererTerminalManager] Force creating new terminal, disposing existing: ${e}`),this.disposeTerminal(e),o=void 0),o)if(o.workspaceId!==i)le.warn(`[RendererTerminalManager] Terminal ${e} has mismatched workspaceId (has: ${o.workspaceId}, requested: ${i}). Disposing and recreating.`),this.disposeTerminal(e),o=void 0;else return le.info(`[RendererTerminalManager] Reattaching to existing terminal: ${e} (was attached: ${o.isAttached})`),o.container=s,o.isAttached=!0,await o.adapter.reattach(s),r&&(o.adapter.updateCallbacks(r),r.onReady?.()),le.info(`[RendererTerminalManager] Successfully reattached terminal: ${e}`),o.adapter;le.info(`[RendererTerminalManager] Creating new terminal: ${e}`);const a=new dn({workspaceId:i,terminalId:e,container:s,...r});return o={adapter:a,terminalId:e,workspaceId:i,isAttached:!0,container:s},this.terminals.set(e,o),this.saveTerminalMetadata(e,i),await a.initialize(n),a}isAttachedTo(e,i){const s=this.terminals.get(e);return!!s&&s.isAttached&&s.container===i}detachTerminal(e,i){const s=this.terminals.get(e);if(s){if(i&&s.container!==i){le.info(`[RendererTerminalManager] Ignoring detach from a stale surface: ${e}`);return}le.info(`[RendererTerminalManager] Detaching terminal: ${e}`),s.isAttached=!1,s.adapter.detach(),s.container=null}}disposeTerminal(e,i){const s=this.terminals.get(e);s?(le.info(`[RendererTerminalManager] Disposing terminal: ${e}`),s.adapter.dispose(),this.terminals.delete(e),this.removeTerminalMetadata(e,s.workspaceId)):Mt.dispatch(qh(e,i))}disposeExitedTerminal(e){const i=this.terminals.get(e);i&&(le.info(`[RendererTerminalManager] Disposing exited terminal: ${e}`),i.adapter.dispose({killPty:!1}),this.terminals.delete(e))}clearTerminal(e){const i=this.terminals.get(e);i&&(le.info(`[RendererTerminalManager] Clearing terminal: ${e}`),i.adapter.clear())}getTerminalInfo(e){const i=this.terminals.get(e);return i?i.adapter.getInfo():null}async getBufferContent(e,i){const s=this.terminals.get(e);if(s?.adapter)try{const r=s.adapter.xterm;if(r?.buffer?.active){const n=r.buffer.active,o=[];for(let a=0;a<n.length;a++){const l=n.getLine(a);l&&o.push(l.translateToString(!0))}for(;o.length>0&&!o[o.length-1].trim();)o.pop();if(o.length>0)return o.join(`
144
+ `)}handleLinkClick(e){try{if(Wh(e)){I.debug("GitHub URL detected in terminal, opening in external browser",{uri:e,workspaceId:this.workspaceId}),Ns("shell:openExternal",{url:e});return}Bn(async()=>{const{resolveBrowserLinkForOpen:i}=await import("./BH-KJlp3.js").then(s=>s.b);return{resolveBrowserLinkForOpen:i}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url).then(({resolveBrowserLinkForOpen:i})=>i(e)).catch(()=>({url:e})).then(i=>{Bn(async()=>{const{getPanelLayoutManager:s}=await import("./CdwxdSGH.js").then(r=>r.p);return{getPanelLayoutManager:s}},__vite__mapDeps([25,17,18,3,19,20,13,5,8,2,11,26,27]),import.meta.url).then(({getPanelLayoutManager:s})=>{s(this.workspaceId).openBrowserPanel(i.url,void 0,void 0,i.requestedUrl),I.debug("Opened URL in browser panel",{uri:e,resolvedUrl:i.url,workspaceId:this.workspaceId})}).catch(s=>{I.warn("Failed to open URL in browser panel, falling back to external browser",{uri:e,error:s}),Ns("shell:openExternal",{url:i.url})})})}catch(i){I.warn("Failed to handle link click",{uri:e,error:i}),Ns("shell:openExternal",{url:e})}}async reconnect(){if(this.isDisposed)throw new Error("Cannot reconnect disposed terminal");if(!this.stateMachine.canTransition("reconnect"))throw new Error(`Cannot reconnect in state ${this.stateMachine.getState()}`);this.exitedNormally=!1,this.stateMachine.transition("reconnect");try{const e=this.xterm.cols,i=this.xterm.rows,s=await this.terminals.create({workspaceId:this.workspaceId,cols:e,rows:i});if(!s.success)throw new Error(s.error||Fs.terminal_adapter_reconnectFailed_error());s.id&&(this.terminalId=s.id),this.setupIpcEventHandlers(),this.stateMachine.transition("reconnected"),this.restoreCursor(),this.callbacks.onReady?.()}catch(e){throw this.stateMachine.reportError(e),e}}detach(){this.ipcCleanup&&(this.ipcCleanup(),this.ipcCleanup=null),this.stopHeartbeat(),this.cancelAutoReconnect(),this.cancelReattachFit(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.visibilityObserver&&(this.visibilityObserver.disconnect(),this.visibilityObserver=null),this.resizeDebounceTimer&&(clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=null);const e=this.xterm.element;e&&e.parentNode&&e.parentNode.removeChild(e),this.themeManager.setContainer(null),this.container=null}dispose(e={}){if(!(this.isDisposed||this.stateMachine.isDisposed())){if(this.isDisposed=!0,this.cancelAutoReconnect(),this.stopHeartbeat(),this.cancelReattachFit(),this.stateMachine.transition("dispose"),this.saveBuffer().catch(()=>{}),this.resizeDebounceTimer&&(clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=null),this.bufferSaveTimer&&(clearInterval(this.bufferSaveTimer),this.bufferSaveTimer=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.visibilityObserver&&(this.visibilityObserver.disconnect(),this.visibilityObserver=null),this.dataDisposable){try{this.dataDisposable.dispose()}catch(i){I.error("Error disposing data handler:",i)}this.dataDisposable=null}if(this.resizeDisposable){try{this.resizeDisposable.dispose()}catch(i){I.error("Error disposing resize handler:",i)}this.resizeDisposable=null}if(this.selectionDisposable){try{this.selectionDisposable.dispose()}catch(i){I.error("Error disposing selection handler:",i)}this.selectionDisposable=null}if(this.ipcCleanup){try{this.ipcCleanup()}catch(i){I.error("Error cleaning up IPC handlers:",i)}this.ipcCleanup=null}if(this.themeCleanup){try{this.themeCleanup()}catch(i){I.error("Error cleaning up theme listener:",i)}this.themeCleanup=null}this.eventListeners.forEach(i=>{try{i()}catch(s){I.error("Error cleaning up event listener:",s)}}),this.eventListeners=[],e.killPty!==!1&&this.terminals.kill(this.terminalId,this.workspaceId).catch(i=>{I.error("Error killing PTY connection:",i)});try{this.searchAddon?.dispose&&this.searchAddon.dispose(),this.webLinksAddon?.dispose&&this.webLinksAddon.dispose(),this.disposeWebglAddon(),this.fitAddon?.dispose&&this.fitAddon.dispose()}catch(i){I.error("Error disposing addons:",i)}try{this.themeManager.dispose()}catch(i){I.error("Error disposing theme manager:",i)}try{this.stateMachine.dispose()}catch(i){I.error("Error disposing state machine:",i)}Wf(this.xterm,i=>{I.error("Error disposing xterm:",i)})}}};P(Ae,"MAX_RECONNECT_ATTEMPTS",5),P(Ae,"BASE_RECONNECT_DELAY_MS",1e3),P(Ae,"HEARTBEAT_INTERVAL_MS",3e4),P(Ae,"HEARTBEAT_TIMEOUT_MS",1e4),P(Ae,"MAX_WEBGL_RECOVERY_ATTEMPTS",3);let dn=Ae;const le=new ji("TerminalManager");class Gf{constructor(){P(this,"terminals",new Map)}saveTerminalMetadata(e,i,s){try{Mt.dispatch(Uh(i,e,s,new Date().toISOString())),le.debug(`[RendererTerminalManager] Saved terminal metadata for ${e}`)}catch(r){le.error("[RendererTerminalManager] Failed to save terminal metadata:",r)}}loadTerminalMetadata(e){try{return Xh.select(Mt.state,e).map(i=>({terminalId:i.id,workspaceId:i.workspaceId??e,createdAt:i.createdAt??"",title:i.customName||jh(i.name)}))}catch(i){le.error("[RendererTerminalManager] Failed to load terminal metadata:",i)}return[]}removeTerminalMetadata(e,i){try{Mt.dispatch(Kh(i,e)),le.debug(`[RendererTerminalManager] Removed terminal metadata for ${e}`)}catch(s){le.error("[RendererTerminalManager] Failed to remove terminal metadata:",s)}}hasTerminal(e){return this.terminals.has(e)}async getOrCreateTerminal(e,i,s,r,n=!1){let o=this.terminals.get(e);if(n&&o&&(le.info(`[RendererTerminalManager] Force creating new terminal, disposing existing: ${e}`),this.disposeTerminal(e),o=void 0),o)if(o.workspaceId!==i)le.warn(`[RendererTerminalManager] Terminal ${e} has mismatched workspaceId (has: ${o.workspaceId}, requested: ${i}). Disposing and recreating.`),this.disposeTerminal(e),o=void 0;else return le.info(`[RendererTerminalManager] Reattaching to existing terminal: ${e} (was attached: ${o.isAttached})`),o.container=s,o.isAttached=!0,await o.adapter.reattach(s),r&&(o.adapter.updateCallbacks(r),r.onReady?.()),le.info(`[RendererTerminalManager] Successfully reattached terminal: ${e}`),o.adapter;le.info(`[RendererTerminalManager] Creating new terminal: ${e}`);const a=new dn({workspaceId:i,terminalId:e,container:s,...r});return o={adapter:a,terminalId:e,workspaceId:i,isAttached:!0,container:s},this.terminals.set(e,o),this.saveTerminalMetadata(e,i),await a.initialize(n),a}isAttachedTo(e,i){const s=this.terminals.get(e);return!!s&&s.isAttached&&s.container===i}detachTerminal(e,i){const s=this.terminals.get(e);if(s){if(i&&s.container!==i){le.info(`[RendererTerminalManager] Ignoring detach from a stale surface: ${e}`);return}le.info(`[RendererTerminalManager] Detaching terminal: ${e}`),s.isAttached=!1,s.adapter.detach(),s.container=null}}disposeTerminal(e,i){const s=this.terminals.get(e);s?(le.info(`[RendererTerminalManager] Disposing terminal: ${e}`),s.adapter.dispose(),this.terminals.delete(e),this.removeTerminalMetadata(e,s.workspaceId)):Mt.dispatch(qh(e,i))}disposeExitedTerminal(e){const i=this.terminals.get(e);i&&(le.info(`[RendererTerminalManager] Disposing exited terminal: ${e}`),i.adapter.dispose({killPty:!1}),this.terminals.delete(e))}clearTerminal(e){const i=this.terminals.get(e);i&&(le.info(`[RendererTerminalManager] Clearing terminal: ${e}`),i.adapter.clear())}getTerminalInfo(e){const i=this.terminals.get(e);return i?i.adapter.getInfo():null}async getBufferContent(e,i){const s=this.terminals.get(e);if(s?.adapter)try{const r=s.adapter.xterm;if(r?.buffer?.active){const n=r.buffer.active,o=[];for(let a=0;a<n.length;a++){const l=n.getLine(a);l&&o.push(l.translateToString(!0))}for(;o.length>0&&!o[o.length-1].trim();)o.pop();if(o.length>0)return o.join(`
145
145
  `)}}catch(r){le.warn("[RendererTerminalManager] Failed to read live buffer, falling back:",r)}try{const n=await new Ds(i,e).restoreBuffer();if(n&&n.lines.length>0){const o=[...n.lines];for(;o.length>0&&!o[o.length-1].trim();)o.pop();return o.join(`
146
146
  `)}}catch(r){le.error("[RendererTerminalManager] Failed to read persisted buffer:",r)}return null}disposeWorkspaceTerminals(e){const i=[];for(const[s,r]of this.terminals)r.workspaceId===e&&i.push(s);if(i.length>0){le.info(`[RendererTerminalManager] Disposing ${i.length} terminals for workspace ${e}`);for(const s of i)try{const r=this.terminals.get(s);r&&(r.adapter.dispose(),this.terminals.delete(s))}catch(r){le.error(`[RendererTerminalManager] Failed to dispose terminal ${s}:`,r)}}}disposeAll(){le.info(`[RendererTerminalManager] Disposing all ${this.terminals.size} terminals`);for(const[e,i]of this.terminals)try{i.adapter.dispose()}catch(s){le.error(`[RendererTerminalManager] Failed to dispose terminal ${e}:`,s)}this.terminals.clear()}}typeof window<"u"&&!window.__terminalManager&&(window.__terminalManager=new Gf);const Yf=window.__terminalManager,Ip=Object.freeze(Object.defineProperty({__proto__:null,terminalManager:Yf},Symbol.toStringTag,{value:"Module"}));export{nu as D,fu as L,ln as T,Wf as a,Yf as b,Ip as c,Op as d,hu as o,Ut as s,Ii as t};