@intent-hq/web 2.330.0 → 2.331.0

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 (270) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{CEA4WprY.js → -K8wVqNz.js} +1 -1
  3. package/web/app/immutable/chunks/{CNEXeIWq.js → 01xZ54YC.js} +2 -2
  4. package/web/app/immutable/chunks/{DsmIFgBW.js → 0BYYiVms.js} +1 -1
  5. package/web/app/immutable/chunks/{BWBt_0S9.js → 1bECqo-j.js} +1 -1
  6. package/web/app/immutable/chunks/{dhHWeHB7.js → 3QqszLYa.js} +1 -1
  7. package/web/app/immutable/chunks/{CGWrDwo6.js → 4XNONbWq.js} +1 -1
  8. package/web/app/immutable/chunks/{vrmnmJTo.js → 4dgb2d4o.js} +1 -1
  9. package/web/app/immutable/chunks/{CmgsU15D.js → 4q6E5opn.js} +1 -1
  10. package/web/app/immutable/chunks/{DrdCoP-L.js → 5CRwyeUL.js} +2 -2
  11. package/web/app/immutable/chunks/{CrJDbXeR.js → 5mKZ17P9.js} +1 -1
  12. package/web/app/immutable/chunks/{0W7Jbq6n.js → 61i9Nc66.js} +1 -1
  13. package/web/app/immutable/chunks/{DpFreuz_.js → 72TQselO.js} +1 -1
  14. package/web/app/immutable/chunks/{DH_PNr-8.js → 79sYHzZU.js} +1 -1
  15. package/web/app/immutable/chunks/{r_PLSAE7.js → 8mBhsgHs.js} +1 -1
  16. package/web/app/immutable/chunks/{Dvh0fZaP.js → 9DtejLvs.js} +1 -1
  17. package/web/app/immutable/chunks/{Dr4yXXs1.js → 9SVo7XCQ.js} +1 -1
  18. package/web/app/immutable/chunks/{CFP6h_yj.js → A67C19bI.js} +1 -1
  19. package/web/app/immutable/chunks/{4rPACIPc.js → AUoP55vG.js} +1 -1
  20. package/web/app/immutable/chunks/{Cn1b85JG.js → ArzfqCkr.js} +1 -1
  21. package/web/app/immutable/chunks/{ClUsr6sz.js → B-3aWyWM.js} +1 -1
  22. package/web/app/immutable/chunks/{Ck1t7lzU.js → B0CAZcrL.js} +1 -1
  23. package/web/app/immutable/chunks/{V-pYlOFT.js → B0do3DVm.js} +1 -1
  24. package/web/app/immutable/chunks/{DrQfmm9r.js → B0hlE4IJ.js} +1 -1
  25. package/web/app/immutable/chunks/{F5JMTljA.js → B0ztGBdw.js} +1 -1
  26. package/web/app/immutable/chunks/{DoVePPmG.js → B4--vvYs.js} +1 -1
  27. package/web/app/immutable/chunks/{ikj2reaR.js → B4585dIt.js} +1 -1
  28. package/web/app/immutable/chunks/{CAmF3PXk.js → B66L8YEe.js} +1 -1
  29. package/web/app/immutable/chunks/{ByQ08O_R.js → B6hMBAzw.js} +1 -1
  30. package/web/app/immutable/chunks/{D7CwqOyk.js → B7pBUSNy.js} +1 -1
  31. package/web/app/immutable/chunks/{Cx-79P8l.js → B8Qavkks.js} +1 -1
  32. package/web/app/immutable/chunks/{BICcGRy9.js → B9PO2UZy.js} +1 -1
  33. package/web/app/immutable/chunks/{CfG5iS_N.js → B9vJwMca.js} +1 -1
  34. package/web/app/immutable/chunks/{DlOjrEkG.js → BADXJ9gY.js} +1 -1
  35. package/web/app/immutable/chunks/{DiCGl5kq.js → BBIyvTX5.js} +3 -3
  36. package/web/app/immutable/chunks/{z4RHZh7P.js → BD5-GbKS.js} +1 -1
  37. package/web/app/immutable/chunks/{CBoIo15V.js → BD9kDOxT.js} +1 -1
  38. package/web/app/immutable/chunks/{Bi15WK7m.js → BEisWjsh.js} +1 -1
  39. package/web/app/immutable/chunks/{BF3lDslR.js → BEtQ8T77.js} +1 -1
  40. package/web/app/immutable/chunks/{kNiuD9tS.js → BHKTKUUz.js} +1 -1
  41. package/web/app/immutable/chunks/{YSPfcYKn.js → BHhmm7k4.js} +1 -1
  42. package/web/app/immutable/chunks/{C9R-YW9d.js → BHuNDg-W.js} +1 -1
  43. package/web/app/immutable/chunks/{C_nJgshO.js → BJWZv5Sk.js} +1 -1
  44. package/web/app/immutable/chunks/{CMnxgVrV.js → BL-QaGSE.js} +1 -1
  45. package/web/app/immutable/chunks/{DOqguBrF.js → BLwfMBUc.js} +1 -1
  46. package/web/app/immutable/chunks/{1BCEBCxj.js → BMEM9WGe.js} +1 -1
  47. package/web/app/immutable/chunks/{Cpc4w0Bm.js → BNQhz-c4.js} +1 -1
  48. package/web/app/immutable/chunks/{Dqy2jMvN.js → BPu-f3m6.js} +1 -1
  49. package/web/app/immutable/chunks/{B9ylxCBv.js → BRxNa3zf.js} +1 -1
  50. package/web/app/immutable/chunks/{BNC-J9Pl.js → BU2dz_aB.js} +1 -1
  51. package/web/app/immutable/chunks/{D3VNRPKq.js → BVZOiDhO.js} +4 -4
  52. package/web/app/immutable/chunks/{BSVIIPqo.js → BXKILicD.js} +1 -1
  53. package/web/app/immutable/chunks/{CFcAdFFD.js → BX_A8Fz4.js} +1 -1
  54. package/web/app/immutable/chunks/BXdz7Mej.js +1 -0
  55. package/web/app/immutable/chunks/BXyIWb9p.js +1 -0
  56. package/web/app/immutable/chunks/{-CNzmNt8.js → BZ_DkSCc.js} +1 -1
  57. package/web/app/immutable/chunks/{CJ0z1v-C.js → B_X9fjxm.js} +1 -1
  58. package/web/app/immutable/chunks/{D2jMyaf8.js → Bd4BZaTp.js} +1 -1
  59. package/web/app/immutable/chunks/{Cm3D0ZVR.js → Be7sI0Wr.js} +1 -1
  60. package/web/app/immutable/chunks/{DCHEHwiS.js → Bkcm6WO0.js} +1 -1
  61. package/web/app/immutable/chunks/{BLZx5Jln.js → Bkeityp2.js} +1 -1
  62. package/web/app/immutable/chunks/{BLYi9_ai.js → Bl2M7dQb.js} +1 -1
  63. package/web/app/immutable/chunks/{jho6TGJn.js → Blawqk8W.js} +1 -1
  64. package/web/app/immutable/chunks/{BVEChIvV.js → Bncjw5PN.js} +2 -2
  65. package/web/app/immutable/chunks/{jonfRsD6.js → BqjPyYOt.js} +1 -1
  66. package/web/app/immutable/chunks/BrQIXt6A.js +1 -0
  67. package/web/app/immutable/chunks/{dWvje8eu.js → Bs48vxzD.js} +1 -1
  68. package/web/app/immutable/chunks/{CB2xLjY4.js → BsKm9b4M.js} +1 -1
  69. package/web/app/immutable/chunks/{DwAHzX3q.js → Bss6gHyN.js} +1 -1
  70. package/web/app/immutable/chunks/{Bbr8E1-T.js → BtYbNvgG.js} +1 -1
  71. package/web/app/immutable/chunks/{QF0bJN4h.js → BtjBnfiA.js} +1 -1
  72. package/web/app/immutable/chunks/{B4nCDPQA.js → BulkbkYU.js} +1 -1
  73. package/web/app/immutable/chunks/{BFeR9qbJ.js → BurMbBp5.js} +1 -1
  74. package/web/app/immutable/chunks/{lOSCBcaC.js → Bvupquu5.js} +1 -1
  75. package/web/app/immutable/chunks/{B5nDENeQ.js → BxX3m2UX.js} +1 -1
  76. package/web/app/immutable/chunks/{D8tsE2-F.js → By8Sq-ft.js} +1 -1
  77. package/web/app/immutable/chunks/{CTf3pgnM.js → ByQXhpKS.js} +1 -1
  78. package/web/app/immutable/chunks/{bXZvOnOg.js → C-5H7e4K.js} +1 -1
  79. package/web/app/immutable/chunks/{C376IId1.js → C-gRduKt.js} +1 -1
  80. package/web/app/immutable/chunks/{BQVyHt6n.js → C02TD_sM.js} +1 -1
  81. package/web/app/immutable/chunks/{rw7bge4F.js → C05u3DrM.js} +1 -1
  82. package/web/app/immutable/chunks/C1LegaQy.js +1 -0
  83. package/web/app/immutable/chunks/{BN9lTuka.js → C1uebkkA.js} +1 -1
  84. package/web/app/immutable/chunks/{D7e2XTJl.js → C23vUV7W.js} +1 -1
  85. package/web/app/immutable/chunks/{Crq31h4w.js → C2dNFWEv.js} +1 -1
  86. package/web/app/immutable/chunks/{9JfuDVAI.js → C2winPI_.js} +1 -1
  87. package/web/app/immutable/chunks/{CsfPzyL6.js → C4byWn93.js} +1 -1
  88. package/web/app/immutable/chunks/{DShjTjco.js → C6VOY2Ed.js} +1 -1
  89. package/web/app/immutable/chunks/{CTPvu81o.js → C8xZ0qNv.js} +1 -1
  90. package/web/app/immutable/chunks/{BXQHI4eX.js → C9dmGIaz.js} +1 -1
  91. package/web/app/immutable/chunks/{91BV6KFP.js → CBsVLKPu.js} +1 -1
  92. package/web/app/immutable/chunks/{BlCPsgO4.js → CC8PUB7z.js} +2 -2
  93. package/web/app/immutable/chunks/{DRuEOkw4.js → CCxHAHqB.js} +1 -1
  94. package/web/app/immutable/chunks/{rj2N2X77.js → CD3weFBA.js} +1 -1
  95. package/web/app/immutable/chunks/{DUJSEf2g.js → CDYYgEuj.js} +2 -2
  96. package/web/app/immutable/chunks/{0VQsaIc5.js → CDksRI-c.js} +1 -1
  97. package/web/app/immutable/chunks/{BQpK3CeI.js → CFukky70.js} +1 -1
  98. package/web/app/immutable/chunks/{bmdvISxl.js → CH4TOBlm.js} +1 -1
  99. package/web/app/immutable/chunks/{B9GX4VRk.js → CIBo29o4.js} +1 -1
  100. package/web/app/immutable/chunks/{BasqomxX.js → CKOIJ0IP.js} +1 -1
  101. package/web/app/immutable/chunks/{fm9pZz0d.js → CLUAF-ra.js} +3 -3
  102. package/web/app/immutable/chunks/{CBAaIsiA.js → CNMI-zGd.js} +1 -1
  103. package/web/app/immutable/chunks/{XA_y_9lT.js → CNbjMDZm.js} +48 -48
  104. package/web/app/immutable/chunks/{BcNmLUvA.js → CO_V-6EQ.js} +1 -1
  105. package/web/app/immutable/chunks/{CqYT7Dd6.js → CPO35toG.js} +1 -1
  106. package/web/app/immutable/chunks/{CyvkPwON.js → CPa4nnG1.js} +1 -1
  107. package/web/app/immutable/chunks/{B2Pgyqsq.js → CPiRiDCt.js} +1 -1
  108. package/web/app/immutable/chunks/{DwJV5y_l.js → CPizSuTO.js} +1 -1
  109. package/web/app/immutable/chunks/{fthv3J-S.js → CURSeRFX.js} +1 -1
  110. package/web/app/immutable/chunks/{CY94okR1.js → CY6hJTg2.js} +1 -1
  111. package/web/app/immutable/chunks/{BveuvcUn.js → CYl6Lvh4.js} +3 -3
  112. package/web/app/immutable/chunks/{g6g5zZQD.js → CZb8tVz5.js} +1 -1
  113. package/web/app/immutable/chunks/{56Ve4phw.js → C_9ekWa1.js} +4 -4
  114. package/web/app/immutable/chunks/{FZGh-nAC.js → CaHWmzVB.js} +1 -1
  115. package/web/app/immutable/chunks/{CRl3Fhij.js → CbCE1pwF.js} +1 -1
  116. package/web/app/immutable/chunks/{B2ywnjG_.js → CdqUGZeZ.js} +1 -1
  117. package/web/app/immutable/chunks/{C2scFn3X.js → Cf7_9vnO.js} +1 -1
  118. package/web/app/immutable/chunks/{Bx0bz20m.js → Ch0hL0V-.js} +3 -3
  119. package/web/app/immutable/chunks/{C9eE8ZXy.js → ChIqxVTs.js} +1 -1
  120. package/web/app/immutable/chunks/{D84UKAzR.js → CiLnzvU7.js} +1 -1
  121. package/web/app/immutable/chunks/{cYR0zuXX.js → CjMEl34P.js} +1 -1
  122. package/web/app/immutable/chunks/{C0wuuFa7.js → Cl0TebPK.js} +1 -1
  123. package/web/app/immutable/chunks/{CkAAitlR.js → CloY0vJA.js} +1 -1
  124. package/web/app/immutable/chunks/{4Tv95AMr.js → CnAtabD8.js} +1 -1
  125. package/web/app/immutable/chunks/{CCQJkGZ_.js → CoeEqCAd.js} +1 -1
  126. package/web/app/immutable/chunks/{Bx30GctV.js → CqoECVux.js} +1 -1
  127. package/web/app/immutable/chunks/{DwIsNA5R.js → CrKYeBTQ.js} +1 -1
  128. package/web/app/immutable/chunks/{aUxeG-_E.js → Cv1ykEZ5.js} +1 -1
  129. package/web/app/immutable/chunks/{BmS-LVXj.js → CvJKDv5e.js} +1 -1
  130. package/web/app/immutable/chunks/{DYfj3lcw.js → CvTcUzFW.js} +1 -1
  131. package/web/app/immutable/chunks/{8t0Gx_mY.js → CvurNR1W.js} +3 -3
  132. package/web/app/immutable/chunks/{Ddaozz5f.js → CwWxAoHb.js} +1 -1
  133. package/web/app/immutable/chunks/{D7_Jc752.js → Cwey7ct7.js} +1 -1
  134. package/web/app/immutable/chunks/{Bsz0mK8i.js → CxEB7RsJ.js} +1 -1
  135. package/web/app/immutable/chunks/{D-W1GPTx.js → Cxjclr_4.js} +1 -1
  136. package/web/app/immutable/chunks/{BGq45CP4.js → CzHSdjMD.js} +1 -1
  137. package/web/app/immutable/chunks/{DomfbKVx.js → D-TU-2ME.js} +1 -1
  138. package/web/app/immutable/chunks/{BdJ2kTDg.js → D-mqBiUo.js} +1 -1
  139. package/web/app/immutable/chunks/{CTld-PL6.js → D-uhCX3w.js} +1 -1
  140. package/web/app/immutable/chunks/{CRSENXWv.js → D09nC1GH.js} +1 -1
  141. package/web/app/immutable/chunks/{83fIOp0Q.js → D1gMVCw_.js} +1 -1
  142. package/web/app/immutable/chunks/{Mne-RwlA.js → D1pAML4P.js} +1 -1
  143. package/web/app/immutable/chunks/{B4W05Glr.js → D22O0lQY.js} +1 -1
  144. package/web/app/immutable/chunks/{DSKeLath.js → D2gfYd_D.js} +1 -1
  145. package/web/app/immutable/chunks/{DC8fssXE.js → D5iylRNB.js} +1 -1
  146. package/web/app/immutable/chunks/{Qos47XEo.js → D6_4An9q.js} +1 -1
  147. package/web/app/immutable/chunks/{5YCHxLN1.js → D9352X9R.js} +1 -1
  148. package/web/app/immutable/chunks/{B-RrcP34.js → DAeWNQ3N.js} +1 -1
  149. package/web/app/immutable/chunks/{BiuqRP28.js → DAnMADno.js} +1 -1
  150. package/web/app/immutable/chunks/{SrKv1_3m.js → DCfwli1b.js} +1 -1
  151. package/web/app/immutable/chunks/{BBGX-ci7.js → DFxm7j9Z.js} +1 -1
  152. package/web/app/immutable/chunks/{CCagIz8d.js → DHoMpHTR.js} +1 -1
  153. package/web/app/immutable/chunks/{B8TzQVK2.js → DJI9bjVo.js} +1 -1
  154. package/web/app/immutable/chunks/{C6jc4Pti.js → DKgDFDH4.js} +1 -1
  155. package/web/app/immutable/chunks/{s5wpRW1P.js → DLDsTWl7.js} +1 -1
  156. package/web/app/immutable/chunks/{CK_EC_Zv.js → DLDwz3Jk.js} +3 -3
  157. package/web/app/immutable/chunks/{DEkMLJNk.js → DNd6DGz3.js} +1 -1
  158. package/web/app/immutable/chunks/{C9ey9TZx.js → DNjAbZct.js} +1 -1
  159. package/web/app/immutable/chunks/{DJ7wLorJ.js → DPrS1NlO.js} +1 -1
  160. package/web/app/immutable/chunks/{AGFKnm2P.js → DQ9yqoWl.js} +1 -1
  161. package/web/app/immutable/chunks/{D9dP_Ett.js → DQpdaJ6T.js} +1 -1
  162. package/web/app/immutable/chunks/{B_wPEBaI.js → DRJOZJ6-.js} +1 -1
  163. package/web/app/immutable/chunks/{DrIarztw.js → DSkFz5VN.js} +1 -1
  164. package/web/app/immutable/chunks/{BmYE6Ue_.js → DU1KIlN0.js} +1 -1
  165. package/web/app/immutable/chunks/{SI5c1abe.js → DVFTLZww.js} +2 -2
  166. package/web/app/immutable/chunks/{BPdm-e1q.js → DVnXSrnX.js} +1 -1
  167. package/web/app/immutable/chunks/{5lnJq6sM.js → DW-ALZ6y.js} +1 -1
  168. package/web/app/immutable/chunks/{Dax0jHgN.js → DWKuJ6Hr.js} +1 -1
  169. package/web/app/immutable/chunks/{Bjuqq3Zd.js → DWx1UA63.js} +1 -1
  170. package/web/app/immutable/chunks/{D6A4AOD2.js → DXDOTLs_.js} +1 -1
  171. package/web/app/immutable/chunks/{DAWb2dTK.js → DXhnL_QC.js} +1 -1
  172. package/web/app/immutable/chunks/{DsaheIX7.js → DZif8G3V.js} +1 -1
  173. package/web/app/immutable/chunks/{GdXyc5RW.js → DZzjO28f.js} +1 -1
  174. package/web/app/immutable/chunks/{e0dgj-dl.js → DcSenGcU.js} +1 -1
  175. package/web/app/immutable/chunks/{BJYSsWSU.js → DeAvGdvh.js} +1 -1
  176. package/web/app/immutable/chunks/{Bg7GBSBQ.js → DeJsl-aZ.js} +1 -1
  177. package/web/app/immutable/chunks/{DkXjvKmg.js → Dfltx80e.js} +1 -1
  178. package/web/app/immutable/chunks/{CPgenjJJ.js → DhabgDm5.js} +1 -1
  179. package/web/app/immutable/chunks/{BbcTTSnr.js → DiLbGQuc.js} +1 -1
  180. package/web/app/immutable/chunks/{nXIZY1Eq.js → DkvlYl1r.js} +1 -1
  181. package/web/app/immutable/chunks/Dm58JeH4.js +4 -0
  182. package/web/app/immutable/chunks/{CPi21vJ2.js → DnMyotqB.js} +1 -1
  183. package/web/app/immutable/chunks/{BlRn68PY.js → Doc9Z9QQ.js} +1 -1
  184. package/web/app/immutable/chunks/{CsAyqppV.js → Dp5CK5E2.js} +2 -2
  185. package/web/app/immutable/chunks/{HxrVoImD.js → DpZbkRU1.js} +2 -2
  186. package/web/app/immutable/chunks/{743JVs4Q.js → DsYe-lzR.js} +1 -1
  187. package/web/app/immutable/chunks/{DCR2yORR.js → DstArZ_G.js} +1 -1
  188. package/web/app/immutable/chunks/{CGoCQMYw.js → Du45nhw1.js} +1 -1
  189. package/web/app/immutable/chunks/{kHRHwI-x.js → DuqO5YYx.js} +1 -1
  190. package/web/app/immutable/chunks/{DCMUMliQ.js → Dv-MAuki.js} +1 -1
  191. package/web/app/immutable/chunks/{wFOLz40M.js → Dw6H-2WQ.js} +4 -4
  192. package/web/app/immutable/chunks/{D8VQPXfA.js → DxQllgk1.js} +1 -1
  193. package/web/app/immutable/chunks/{CuQGJ_Hl.js → DxXHe9XL.js} +1 -1
  194. package/web/app/immutable/chunks/{DBXDrA8G.js → Dz4zGm0b.js} +1 -1
  195. package/web/app/immutable/chunks/{CLLGUAol.js → DzrG6LRJ.js} +1 -1
  196. package/web/app/immutable/chunks/{Cu6_o9yH.js → ENk3kCNh.js} +1 -1
  197. package/web/app/immutable/chunks/{ecK2Rz_W.js → Ebo0jR7g.js} +1 -1
  198. package/web/app/immutable/chunks/{tIh0qGP0.js → Hqp9lhkv.js} +1 -1
  199. package/web/app/immutable/chunks/{DAyLQqmH.js → IS3lk0hL.js} +1 -1
  200. package/web/app/immutable/chunks/{5EQzwjFU.js → K6c57sYm.js} +1 -1
  201. package/web/app/immutable/chunks/{ErrYu-1b.js → LjFrXSKU.js} +1 -1
  202. package/web/app/immutable/chunks/LuyeE9EP.js +1 -0
  203. package/web/app/immutable/chunks/{Bbtr-1K4.js → LywjnD7L.js} +1 -1
  204. package/web/app/immutable/chunks/{DEBEHaOd.js → MHMez6vJ.js} +1 -1
  205. package/web/app/immutable/chunks/{BOCcnpyu.js → NbM9xEi7.js} +1 -1
  206. package/web/app/immutable/chunks/NqHwC243.js +1 -0
  207. package/web/app/immutable/chunks/{BRz9UwkY.js → OQFffAXE.js} +2 -2
  208. package/web/app/immutable/chunks/{R1PIrMEo.js → Q7GICaZA.js} +4 -4
  209. package/web/app/immutable/chunks/{1kZYk73E.js → RWrc-xf9.js} +1 -1
  210. package/web/app/immutable/chunks/{_vwL6Rxf.js → S4yHrePv.js} +1 -1
  211. package/web/app/immutable/chunks/{CN_bicqw.js → TGii5dZx.js} +1 -1
  212. package/web/app/immutable/chunks/{BUH1cXWe.js → TpzTLNOD.js} +1 -1
  213. package/web/app/immutable/chunks/{CHyrfJgg.js → TwGZmfYW.js} +1 -1
  214. package/web/app/immutable/chunks/{CKdLa-Uz.js → VjR26_WS.js} +1 -1
  215. package/web/app/immutable/chunks/{YNVJCvyF.js → XJvRRqZY.js} +2 -2
  216. package/web/app/immutable/chunks/{B86uOqdH.js → Z2gbRxA0.js} +1 -1
  217. package/web/app/immutable/chunks/{CXgjAj37.js → ZUCHJs0z.js} +1 -1
  218. package/web/app/immutable/chunks/{CnNF86D9.js → aZx3cD8V.js} +1 -1
  219. package/web/app/immutable/chunks/{HBVhNaGe.js → at5Op_FE.js} +1 -1
  220. package/web/app/immutable/chunks/{CYnvHqAo.js → c-xC05gO.js} +3 -3
  221. package/web/app/immutable/chunks/{BFbSkULM.js → dJyv-siL.js} +1 -1
  222. package/web/app/immutable/chunks/{wqG7RsMr.js → dmvnbvsQ.js} +1 -1
  223. package/web/app/immutable/chunks/{B0TS4hgi.js → ediMbqWo.js} +1 -1
  224. package/web/app/immutable/chunks/{BM3phmDM.js → gVaQ50Mb.js} +1 -1
  225. package/web/app/immutable/chunks/{X60wq_Gr.js → hiFoK9HW.js} +1 -1
  226. package/web/app/immutable/chunks/{DccM5_Kz.js → ho_wzPgZ.js} +1 -1
  227. package/web/app/immutable/chunks/{0RMdFti5.js → jkBt9jHY.js} +1 -1
  228. package/web/app/immutable/chunks/{Bvvd2zh3.js → kG7yHiIe.js} +1 -1
  229. package/web/app/immutable/chunks/{BmuAz9YM.js → lAsY7teh.js} +1 -1
  230. package/web/app/immutable/chunks/{BFOOw1dI.js → n4HRXsWs.js} +1 -1
  231. package/web/app/immutable/chunks/{BsjwOa8m.js → nY6Ai7XD.js} +1 -1
  232. package/web/app/immutable/chunks/{CbdCK_T5.js → qYwSdo-K.js} +3 -3
  233. package/web/app/immutable/chunks/{P80wVyai.js → rKiAyfMI.js} +1 -1
  234. package/web/app/immutable/chunks/{ij7Gv2VI.js → sisoY2vh.js} +1 -1
  235. package/web/app/immutable/chunks/{Bq6o_ftd.js → uO0IO955.js} +1 -1
  236. package/web/app/immutable/chunks/{r4Kn8ryM.js → x8V1qvZr.js} +1 -1
  237. package/web/app/immutable/chunks/{Ba12nCEG.js → xOOK71rW.js} +1 -1
  238. package/web/app/immutable/chunks/{Dhqi7cA-.js → zuDkoDer.js} +1 -1
  239. package/web/app/immutable/entry/{app.DGPhT6bY.js → app.S5CWPbDK.js} +3 -3
  240. package/web/app/immutable/entry/start.DinkqhBP.js +1 -0
  241. package/web/app/immutable/nodes/{0.BC-jKADe.js → 0.B4U_qChs.js} +1 -1
  242. package/web/app/immutable/nodes/{1.BElbRM6L.js → 1.pNWMoj9V.js} +1 -1
  243. package/web/app/immutable/nodes/{10.BhzQgaxP.js → 10.CaBIMNie.js} +1 -1
  244. package/web/app/immutable/nodes/{11.AT9-T1cz.js → 11.xKpwCHv6.js} +1 -1
  245. package/web/app/immutable/nodes/{12.UnKFeRcB.js → 12.B4sH0GII.js} +1 -1
  246. package/web/app/immutable/nodes/{13.CPShrjOW.js → 13.CfDkqDId.js} +3 -3
  247. package/web/app/immutable/nodes/{14.lrSpZ_2D.js → 14.BI8ewYLs.js} +1 -1
  248. package/web/app/immutable/nodes/{15.DITl_gdk.js → 15.DDXz42ax.js} +1 -1
  249. package/web/app/immutable/nodes/{16.SMwU6zOj.js → 16.Cxa0f4JH.js} +1 -1
  250. package/web/app/immutable/nodes/{17.EkpTyH-y.js → 17.UGEWL_p3.js} +2 -2
  251. package/web/app/immutable/nodes/{2.eUJUH-2K.js → 2.-Qf9E2iv.js} +5 -5
  252. package/web/app/immutable/nodes/{3.CqDcm_5y.js → 3.DLT-Yg27.js} +1 -1
  253. package/web/app/immutable/nodes/{4.DNZQQAL_.js → 4.DmcEH-RC.js} +1 -1
  254. package/web/app/immutable/nodes/{5.kCfkqAT0.js → 5.BFD4xsaH.js} +1 -1
  255. package/web/app/immutable/nodes/{6.CzeBG3TF.js → 6.RyyedfVo.js} +1 -1
  256. package/web/app/immutable/nodes/{7.C_teQRRk.js → 7.C0oAoj9c.js} +1 -1
  257. package/web/app/immutable/nodes/8.1ulerr0C.js +14 -0
  258. package/web/app/immutable/nodes/{9.BgUq0jQt.js → 9.fVLpMpdp.js} +5 -5
  259. package/web/app/version.json +1 -1
  260. package/web/generated/paraglide.js +49 -49
  261. package/web/index.html +19 -19
  262. package/web/app/immutable/chunks/8obSPONn.js +0 -1
  263. package/web/app/immutable/chunks/B5YXY4gT.js +0 -1
  264. package/web/app/immutable/chunks/BfxAliuB.js +0 -1
  265. package/web/app/immutable/chunks/CijnEJw0.js +0 -1
  266. package/web/app/immutable/chunks/Cq3jmim-.js +0 -1
  267. package/web/app/immutable/chunks/DWwdvItj.js +0 -4
  268. package/web/app/immutable/chunks/DWzc_C3M.js +0 -1
  269. package/web/app/immutable/entry/start.C2NOsCgx.js +0 -1
  270. package/web/app/immutable/nodes/8.Dro0M0JS.js +0 -14
@@ -1,2 +1,2 @@
1
- import{bo as x}from"./8obSPONn.js";function m(e){const n=e.replace(/^#/,"");let r,o,a;if(n.length===3||n.length===4)r=parseInt(n[0]+n[0],16)/255,o=parseInt(n[1]+n[1],16)/255,a=parseInt(n[2]+n[2],16)/255;else if(n.length===6||n.length===8)r=parseInt(n.slice(0,2),16)/255,o=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255;else return"0 0% 0%";const t=Math.max(r,o,a),s=Math.min(r,o,a),c=(t+s)/2;let u=0,g=0;if(t!==s){const p=t-s;switch(g=c>.5?p/(2-t-s):p/(t+s),t){case r:u=((o-a)/p+(o<a?6:0))/6;break;case o:u=((a-r)/p+2)/6;break;case a:u=((r-o)/p+4)/6;break}}const f=Math.round(u*360),d=Math.round(g*100),l=Math.round(c*100);return`${f} ${d}% ${l}%`}function N(e){const n=e.replace(/^#/,"");let r,o,a;if(n.length>=6)r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);else if(n.length>=3)r=parseInt(n[0]+n[0],16),o=parseInt(n[1]+n[1],16),a=parseInt(n[2]+n[2],16);else return!0;return(.299*r+.587*o+.114*a)/255<.5}const X=[["editor.background","--background"],["editor.foreground","--foreground"],["sideBar.background","--sidebar"],["sideBar.foreground","--sidebar-foreground"],["sideBar.border","--sidebar-border"],["editorWidget.background","--card"],["editorWidget.foreground","--card-foreground"],["dropdown.background","--popover"],["dropdown.foreground","--popover-foreground"],["focusBorder","--ring"],["input.background","--input"],["panel.border","--border"],["editorGroup.border","--border"],["button.background","--primary"],["button.foreground","--primary-foreground"],["list.activeSelectionBackground","--secondary"],["list.activeSelectionForeground","--secondary-foreground"],["errorForeground","--danger"],["inputValidation.errorBackground","--danger-background"]];function B(e){const n=e.replace(/^#/,"");return n.length>=6?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]:n.length>=3?[parseInt(n[0]+n[0],16),parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16)]:[0,0,0]}function M(e,n,r){const o=a=>Math.max(0,Math.min(255,Math.round(a)));return`#${o(e).toString(16).padStart(2,"0")}${o(n).toString(16).padStart(2,"0")}${o(r).toString(16).padStart(2,"0")}`}function G(e,n,r){const[o,a,t]=[e,n,r].map(s=>{const c=s/255;return c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)});return .2126*o+.7152*a+.0722*t}function k(e,n){const r=G(...e),o=G(...n),a=Math.max(r,o),t=Math.min(r,o);return(a+.05)/(t+.05)}function F(e){const n=e.match(/^([\d.]+)\s+([\d.]+)%\s+([\d.]+)%$/);if(!n)return[0,0,0];const r=Number(n[1]),o=Number(n[2])/100,a=Number(n[3])/100,t=(1-Math.abs(2*a-1))*o,s=t*(1-Math.abs(r/60%2-1)),c=a-t/2;return(r<60?[t,s,0]:r<120?[s,t,0]:r<180?[0,t,s]:r<240?[0,s,t]:r<300?[s,0,t]:[t,0,s]).map(g=>Math.round((g+c)*255))}function V(e,n,r){const o=F(e),t=F(n).map((s,c)=>s*(1-r)+o[c]*r);return m(M(...t))}function H(e,n){const r=F(e),o=F(n);if(k(r,o)>=4.55)return e;const a=[0,0,0],t=[255,255,255],s=k(a,o)>k(t,o)?a:t;for(let c=1;c<=20;c++){const u=c/20,g=r.map((f,d)=>f*(1-u)+s[d]*u);if(k(g,o)>=4.55)return m(M(...g))}return m(M(...s))}function _(e,n){const r=F(e),o=n.map(F),a=f=>Math.min(...o.map(d=>k(f,d))),t=4.55;if(a(r)>=t)return e;const s=e.match(/^([\d.]+)\s+([\d.]+)%\s+([\d.]+)%$/);if(!s)return e;const c=Number(s[1]);let u,g={value:e,ratio:a(r),distance:0};for(let f=0;f<=100;f++)for(let d=0;d<=100;d++){const l=`${c} ${f}% ${d}%`,p=F(l),b=a(p),i=p.reduce((R,I,A)=>R+(I-r[A])**2,0);b>=t?(!u||i<u.distance)&&(u={value:l,distance:i}):(b>g.ratio||b===g.ratio&&i<g.distance)&&(g={value:l,ratio:b,distance:i})}return u?.value??g.value}function K({fgHex:e,bgHexes:n,descriptionHex:r}){const o=B(e),a=n.map(B);let t;if(r)t=B(r);else{const[f,d,l]=a[0];t=[o[0]*.6+f*.4,o[1]*.6+d*.4,o[2]*.6+l*.4]}const s=4.5,c=20,u=f=>a.every(d=>k(f,d)>=s),g=[...t];for(let f=0;f<c&&!u(t);f++){const d=(f+1)/c;t=[g[0]*(1-d)+o[0]*d,g[1]*(1-d)+o[1]*d,g[2]*(1-d)+o[2]*d]}return m(M(...t))}function Y(e,n,r){const o=B(e),a=B(n),t=G(...o),s=G(...a),c=1.12;if((Math.max(t,s)+.05)/(Math.min(t,s)+.05)>=c)return m(e);const f=t>s||t===s&&!r?[255,255,255]:[0,0,0],d=20;let l=[...o];for(let p=1;p<=d;p++){const b=p/d;l=[o[0]*(1-b)+f[0]*b,o[1]*(1-b)+f[1]*b,o[2]*(1-b)+f[2]*b];const i=G(...l);if((Math.max(i,s)+.05)/(Math.min(i,s)+.05)>=c)break}return m(M(...l))}function O(e){const n=B(e),r=N(e)?[255,255,255]:[0,0,0],o=1.2,a=20;let t=[...n];for(let s=1;s<=a;s++){const c=s/a;if(t=[n[0]*(1-c)+r[0]*c,n[1]*(1-c)+r[1]*c,n[2]*(1-c)+r[2]*c],k(t,n)>=o)break}return m(M(...t))}function $(e,n,r){const o=B(e),a=n.map(B),t=3.1,s=d=>Math.min(...a.map(l=>k(d,l)));if(s(o)>=t)return m(e);const u=r?[255,255,255]:[0,0,0],g=20;let f=[...o];for(let d=1;d<=g;d++){const l=d/g;if(f=[o[0]*(1-l)+u[0]*l,o[1]*(1-l)+u[1]*l,o[2]*(1-l)+u[2]*l],s(f)>=t)break}return m(M(...f))}function j(e){const n=e["editor.background"];if(!n)return null;const r=e.focusBorder??e["button.background"]??e["badge.background"];if(!r)return null;const o=B(n),a=B(r),t=N(n),s=t?.12:.08,c=[o[0]*(1-s)+a[0]*s,o[1]*(1-s)+a[1]*s,o[2]*(1-s)+a[2]*s],u=B(e["editor.foreground"]??(t?"#ffffff":"#000000"));let g=[...a];const f=4.5,d=20,l=b=>k(b,o)>=f&&k(b,c)>=3,p=[...g];for(let b=0;b<d&&!l(g);b++){const i=(b+1)/d;g=[p[0]*(1-i)+u[0]*i,p[1]*(1-i)+u[1]*i,p[2]*(1-i)+u[2]*i]}return{accent:m(M(...c)),accentForeground:m(M(...g))}}function q(e,n){const r={};for(const[i,R]of X){if(r[R])continue;const I=e[i];I&&(r[R]=m(I))}const o=j(e);o&&(r["--accent"]=o.accent,r["--accent-foreground"]=o.accentForeground);const a=e["editor.foreground"],t=e["editor.background"];if(a&&t){const i=[t];e["sideBar.background"]&&i.push(e["sideBar.background"]),e["editorWidget.background"]&&i.push(e["editorWidget.background"]),r["--muted-foreground"]=K({fgHex:a,bgHexes:i,descriptionHex:e.descriptionForeground});const R=e["tab.inactiveBackground"]??e["sideBar.background"]??t,I=N(t);r["--muted"]=Y(R,t,I);const A=[t,e["editorWidget.background"],e["dropdown.background"],e["sideBar.background"]].filter(S=>!!S),P=e["panel.border"]??e["editorGroup.border"],D=e["input.border"]??e["input.background"]??P??t;r["--input"]=$(D,A,I);const W=e.focusBorder??e["button.background"]??P??t;r["--ring"]=$(W,A,I);const y=B(a),w=B(t);{const S=[y[0]*.6+w[0]*.4,y[1]*.6+w[1]*.4,y[2]*.6+w[2]*.4];let C=[...S];const L=4.5,T=20;for(let v=0;v<T&&!(k(C,w)>=L);v++){const h=(v+1)/T;C=[S[0]*(1-h)+y[0]*h,S[1]*(1-h)+y[1]*h,S[2]*(1-h)+y[2]*h]}r["--text-subtle"]=m(M(...C))}{const S=[w[0]*.65+y[0]*.35,w[1]*.65+y[1]*.35,w[2]*.65+y[2]*.35];let C=[...S];const L=2,T=15;for(let v=0;v<T&&!(k(C,w)>=L);v++){const h=(v+1)/T;C=[S[0]*(1-h)+y[0]*h,S[1]*(1-h)+y[1]*h,S[2]*(1-h)+y[2]*h]}r["--text-ghost"]=m(M(...C))}}else e.descriptionForeground&&(r["--muted-foreground"]=m(e.descriptionForeground));t&&(r["--border"]??=O(t),r["--sidebar-border"]??=O(e["sideBar.background"]??t));const s=n?{background:"#1f1f24",foreground:"#f7f7f7",primary:"#009966",primaryForeground:"#171717",secondary:"#1c1c1c",secondaryForeground:"#f7f7f7",muted:"#121217",mutedForeground:"#b8b5c2",accent:"#182c25",accentForeground:"#7de3bd",danger:"#f38b8b",dangerBackground:"#361010",border:"#4d4a52",input:"#121217",ring:"#6eddb4",info:"#72d2fa",infoForeground:"#171717",success:"#22c55e",successForeground:"#171717",warning:"#facc15",warningForeground:"#171717",sidebar:"#0d0d10",sidebarForeground:"#f7f7f7",sidebarAccent:"#242424",sidebarBorder:"#4d4a52"}:{background:"#ffffff",foreground:"#171717",primary:"#007a4d",primaryForeground:"#ffffff",secondary:"#f5f5f5",secondaryForeground:"#171717",muted:"#e8e8e8",mutedForeground:"#474747",accent:"#e7f3ee",accentForeground:"#00663f",danger:"#930b0b",dangerBackground:"#fde7e7",border:"#d9d9d9",input:"#e6e6e6",ring:"#006ac2",info:"#006ac2",infoForeground:"#ffffff",success:"#117a37",successForeground:"#ffffff",warning:"#dc9400",warningForeground:"#171717",sidebar:"#f7f7f8",sidebarForeground:"#171717",sidebarAccent:"#e8e8e8",sidebarBorder:"#d9d9d9"},c=i=>m(s[i]);r["--background"]??=c("background"),r["--foreground"]??=c("foreground"),r["--card"]??=r["--background"],r["--card-foreground"]??=r["--foreground"],r["--popover"]??=r["--card"],r["--popover-foreground"]??=r["--card-foreground"],r["--primary"]??=c("primary"),r["--primary-foreground"]??=c("primaryForeground"),r["--secondary"]??=c("secondary"),r["--secondary-foreground"]??=c("secondaryForeground"),r["--muted"]??=c("muted"),r["--muted-foreground"]??=c("mutedForeground"),r["--accent"]??=c("accent"),r["--accent-foreground"]??=c("accentForeground"),r["--danger"]??=c("danger"),r["--danger-background"]??=c("dangerBackground"),r["--border"]??=c("border"),r["--input"]??=c("input"),r["--ring"]??=c("ring"),r["--info"]=m(e["editorInfo.foreground"]??s.info),r["--info-foreground"]=c("infoForeground"),r["--success"]=m(e["testing.iconPassed"]??e["gitDecoration.addedResourceForeground"]??s.success),r["--success-foreground"]=c("successForeground"),r["--warning"]=m(e["editorWarning.foreground"]??s.warning),r["--warning-foreground"]=c("warningForeground"),r["--sidebar"]??=c("sidebar"),r["--sidebar-foreground"]??=c("sidebarForeground"),r["--sidebar-accent"]=r["--secondary"]??c("sidebarAccent"),r["--sidebar-accent-foreground"]=r["--sidebar-foreground"],r["--sidebar-border"]??=c("sidebarBorder");const u=[["--foreground","--background"],["--card-foreground","--card"],["--popover-foreground","--popover"],["--primary-foreground","--primary"],["--secondary-foreground","--secondary"],["--accent-foreground","--accent"],["--muted-foreground","--muted"],["--info-foreground","--info"],["--success-foreground","--success"],["--warning-foreground","--warning"],["--sidebar-foreground","--sidebar"],["--sidebar-accent-foreground","--sidebar-accent"]];for(const[i,R]of u)r[i]=H(r[i],r[R]);const g=["--danger-background","--background","--card","--popover","--muted","--sidebar"],f=r["--danger"];r["--danger"]=_(f,g.map(i=>r[i]));const d=F(r["--danger"]);g.every(i=>k(d,F(r[i]))>=4.55)||(r["--danger-background"]=r["--background"],r["--danger"]=_(f,g.map(i=>r[i]))),r["--primary-ink"]=_(r["--primary"],[r["--background"],r["--card"]]);const p=r["--warning"],b=[r["--background"],r["--card"]];return r["--warning-ink"]=_(p,[...b,...b.map(i=>V(p,i,.1))]),r}const z=[["terminal.background","background"],["terminal.foreground","foreground"],["terminal.selectionBackground","selectionBackground"],["terminal.selectionForeground","selectionForeground"],["terminalCursor.foreground","cursor"],["terminalCursor.background","cursorAccent"],["terminal.ansiBlack","black"],["terminal.ansiRed","red"],["terminal.ansiGreen","green"],["terminal.ansiYellow","yellow"],["terminal.ansiBlue","blue"],["terminal.ansiMagenta","magenta"],["terminal.ansiCyan","cyan"],["terminal.ansiWhite","white"],["terminal.ansiBrightBlack","brightBlack"],["terminal.ansiBrightRed","brightRed"],["terminal.ansiBrightGreen","brightGreen"],["terminal.ansiBrightYellow","brightYellow"],["terminal.ansiBrightBlue","brightBlue"],["terminal.ansiBrightMagenta","brightMagenta"],["terminal.ansiBrightCyan","brightCyan"],["terminal.ansiBrightWhite","brightWhite"]];function Q(e){const n={};for(const[r,o]of z){const a=e[r];a&&(n[o]=a)}return n}function E(e){return e.replace(/^#/,"")}function U(e,n){const r=n?"vs-dark":"vs",o=[];if(e.tokenColors)for(const t of e.tokenColors){const s=Array.isArray(t.scope)?t.scope:t.scope?[t.scope]:[""];for(const c of s){const u={token:c};t.settings.foreground&&(u.foreground=E(t.settings.foreground)),t.settings.background&&(u.background=E(t.settings.background)),t.settings.fontStyle&&(u.fontStyle=t.settings.fontStyle),o.push(u)}}const a={};if(e.colors)for(const[t,s]of Object.entries(e.colors))a[t]=s;return{base:r,inherit:!0,rules:o,colors:a}}function J(e){let n="",r=0,o=!1;for(;r<e.length;){const a=e[r];if(o){if(a==="\\"){n+=a+(e[r+1]??""),r+=2;continue}a==='"'&&(o=!1),n+=a,r++;continue}if(a==='"'){o=!0,n+=a,r++;continue}if(a==="/"&&e[r+1]==="/"){for(r+=2;r<e.length&&e[r]!==`
1
+ import{bo as x}from"./NqHwC243.js";function m(e){const n=e.replace(/^#/,"");let r,o,a;if(n.length===3||n.length===4)r=parseInt(n[0]+n[0],16)/255,o=parseInt(n[1]+n[1],16)/255,a=parseInt(n[2]+n[2],16)/255;else if(n.length===6||n.length===8)r=parseInt(n.slice(0,2),16)/255,o=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255;else return"0 0% 0%";const t=Math.max(r,o,a),s=Math.min(r,o,a),c=(t+s)/2;let u=0,g=0;if(t!==s){const p=t-s;switch(g=c>.5?p/(2-t-s):p/(t+s),t){case r:u=((o-a)/p+(o<a?6:0))/6;break;case o:u=((a-r)/p+2)/6;break;case a:u=((r-o)/p+4)/6;break}}const f=Math.round(u*360),d=Math.round(g*100),l=Math.round(c*100);return`${f} ${d}% ${l}%`}function N(e){const n=e.replace(/^#/,"");let r,o,a;if(n.length>=6)r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);else if(n.length>=3)r=parseInt(n[0]+n[0],16),o=parseInt(n[1]+n[1],16),a=parseInt(n[2]+n[2],16);else return!0;return(.299*r+.587*o+.114*a)/255<.5}const X=[["editor.background","--background"],["editor.foreground","--foreground"],["sideBar.background","--sidebar"],["sideBar.foreground","--sidebar-foreground"],["sideBar.border","--sidebar-border"],["editorWidget.background","--card"],["editorWidget.foreground","--card-foreground"],["dropdown.background","--popover"],["dropdown.foreground","--popover-foreground"],["focusBorder","--ring"],["input.background","--input"],["panel.border","--border"],["editorGroup.border","--border"],["button.background","--primary"],["button.foreground","--primary-foreground"],["list.activeSelectionBackground","--secondary"],["list.activeSelectionForeground","--secondary-foreground"],["errorForeground","--danger"],["inputValidation.errorBackground","--danger-background"]];function B(e){const n=e.replace(/^#/,"");return n.length>=6?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]:n.length>=3?[parseInt(n[0]+n[0],16),parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16)]:[0,0,0]}function M(e,n,r){const o=a=>Math.max(0,Math.min(255,Math.round(a)));return`#${o(e).toString(16).padStart(2,"0")}${o(n).toString(16).padStart(2,"0")}${o(r).toString(16).padStart(2,"0")}`}function G(e,n,r){const[o,a,t]=[e,n,r].map(s=>{const c=s/255;return c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)});return .2126*o+.7152*a+.0722*t}function k(e,n){const r=G(...e),o=G(...n),a=Math.max(r,o),t=Math.min(r,o);return(a+.05)/(t+.05)}function F(e){const n=e.match(/^([\d.]+)\s+([\d.]+)%\s+([\d.]+)%$/);if(!n)return[0,0,0];const r=Number(n[1]),o=Number(n[2])/100,a=Number(n[3])/100,t=(1-Math.abs(2*a-1))*o,s=t*(1-Math.abs(r/60%2-1)),c=a-t/2;return(r<60?[t,s,0]:r<120?[s,t,0]:r<180?[0,t,s]:r<240?[0,s,t]:r<300?[s,0,t]:[t,0,s]).map(g=>Math.round((g+c)*255))}function V(e,n,r){const o=F(e),t=F(n).map((s,c)=>s*(1-r)+o[c]*r);return m(M(...t))}function H(e,n){const r=F(e),o=F(n);if(k(r,o)>=4.55)return e;const a=[0,0,0],t=[255,255,255],s=k(a,o)>k(t,o)?a:t;for(let c=1;c<=20;c++){const u=c/20,g=r.map((f,d)=>f*(1-u)+s[d]*u);if(k(g,o)>=4.55)return m(M(...g))}return m(M(...s))}function _(e,n){const r=F(e),o=n.map(F),a=f=>Math.min(...o.map(d=>k(f,d))),t=4.55;if(a(r)>=t)return e;const s=e.match(/^([\d.]+)\s+([\d.]+)%\s+([\d.]+)%$/);if(!s)return e;const c=Number(s[1]);let u,g={value:e,ratio:a(r),distance:0};for(let f=0;f<=100;f++)for(let d=0;d<=100;d++){const l=`${c} ${f}% ${d}%`,p=F(l),b=a(p),i=p.reduce((R,I,A)=>R+(I-r[A])**2,0);b>=t?(!u||i<u.distance)&&(u={value:l,distance:i}):(b>g.ratio||b===g.ratio&&i<g.distance)&&(g={value:l,ratio:b,distance:i})}return u?.value??g.value}function K({fgHex:e,bgHexes:n,descriptionHex:r}){const o=B(e),a=n.map(B);let t;if(r)t=B(r);else{const[f,d,l]=a[0];t=[o[0]*.6+f*.4,o[1]*.6+d*.4,o[2]*.6+l*.4]}const s=4.5,c=20,u=f=>a.every(d=>k(f,d)>=s),g=[...t];for(let f=0;f<c&&!u(t);f++){const d=(f+1)/c;t=[g[0]*(1-d)+o[0]*d,g[1]*(1-d)+o[1]*d,g[2]*(1-d)+o[2]*d]}return m(M(...t))}function Y(e,n,r){const o=B(e),a=B(n),t=G(...o),s=G(...a),c=1.12;if((Math.max(t,s)+.05)/(Math.min(t,s)+.05)>=c)return m(e);const f=t>s||t===s&&!r?[255,255,255]:[0,0,0],d=20;let l=[...o];for(let p=1;p<=d;p++){const b=p/d;l=[o[0]*(1-b)+f[0]*b,o[1]*(1-b)+f[1]*b,o[2]*(1-b)+f[2]*b];const i=G(...l);if((Math.max(i,s)+.05)/(Math.min(i,s)+.05)>=c)break}return m(M(...l))}function O(e){const n=B(e),r=N(e)?[255,255,255]:[0,0,0],o=1.2,a=20;let t=[...n];for(let s=1;s<=a;s++){const c=s/a;if(t=[n[0]*(1-c)+r[0]*c,n[1]*(1-c)+r[1]*c,n[2]*(1-c)+r[2]*c],k(t,n)>=o)break}return m(M(...t))}function $(e,n,r){const o=B(e),a=n.map(B),t=3.1,s=d=>Math.min(...a.map(l=>k(d,l)));if(s(o)>=t)return m(e);const u=r?[255,255,255]:[0,0,0],g=20;let f=[...o];for(let d=1;d<=g;d++){const l=d/g;if(f=[o[0]*(1-l)+u[0]*l,o[1]*(1-l)+u[1]*l,o[2]*(1-l)+u[2]*l],s(f)>=t)break}return m(M(...f))}function j(e){const n=e["editor.background"];if(!n)return null;const r=e.focusBorder??e["button.background"]??e["badge.background"];if(!r)return null;const o=B(n),a=B(r),t=N(n),s=t?.12:.08,c=[o[0]*(1-s)+a[0]*s,o[1]*(1-s)+a[1]*s,o[2]*(1-s)+a[2]*s],u=B(e["editor.foreground"]??(t?"#ffffff":"#000000"));let g=[...a];const f=4.5,d=20,l=b=>k(b,o)>=f&&k(b,c)>=3,p=[...g];for(let b=0;b<d&&!l(g);b++){const i=(b+1)/d;g=[p[0]*(1-i)+u[0]*i,p[1]*(1-i)+u[1]*i,p[2]*(1-i)+u[2]*i]}return{accent:m(M(...c)),accentForeground:m(M(...g))}}function q(e,n){const r={};for(const[i,R]of X){if(r[R])continue;const I=e[i];I&&(r[R]=m(I))}const o=j(e);o&&(r["--accent"]=o.accent,r["--accent-foreground"]=o.accentForeground);const a=e["editor.foreground"],t=e["editor.background"];if(a&&t){const i=[t];e["sideBar.background"]&&i.push(e["sideBar.background"]),e["editorWidget.background"]&&i.push(e["editorWidget.background"]),r["--muted-foreground"]=K({fgHex:a,bgHexes:i,descriptionHex:e.descriptionForeground});const R=e["tab.inactiveBackground"]??e["sideBar.background"]??t,I=N(t);r["--muted"]=Y(R,t,I);const A=[t,e["editorWidget.background"],e["dropdown.background"],e["sideBar.background"]].filter(S=>!!S),P=e["panel.border"]??e["editorGroup.border"],D=e["input.border"]??e["input.background"]??P??t;r["--input"]=$(D,A,I);const W=e.focusBorder??e["button.background"]??P??t;r["--ring"]=$(W,A,I);const y=B(a),w=B(t);{const S=[y[0]*.6+w[0]*.4,y[1]*.6+w[1]*.4,y[2]*.6+w[2]*.4];let C=[...S];const L=4.5,T=20;for(let v=0;v<T&&!(k(C,w)>=L);v++){const h=(v+1)/T;C=[S[0]*(1-h)+y[0]*h,S[1]*(1-h)+y[1]*h,S[2]*(1-h)+y[2]*h]}r["--text-subtle"]=m(M(...C))}{const S=[w[0]*.65+y[0]*.35,w[1]*.65+y[1]*.35,w[2]*.65+y[2]*.35];let C=[...S];const L=2,T=15;for(let v=0;v<T&&!(k(C,w)>=L);v++){const h=(v+1)/T;C=[S[0]*(1-h)+y[0]*h,S[1]*(1-h)+y[1]*h,S[2]*(1-h)+y[2]*h]}r["--text-ghost"]=m(M(...C))}}else e.descriptionForeground&&(r["--muted-foreground"]=m(e.descriptionForeground));t&&(r["--border"]??=O(t),r["--sidebar-border"]??=O(e["sideBar.background"]??t));const s=n?{background:"#1f1f24",foreground:"#f7f7f7",primary:"#009966",primaryForeground:"#171717",secondary:"#1c1c1c",secondaryForeground:"#f7f7f7",muted:"#121217",mutedForeground:"#b8b5c2",accent:"#182c25",accentForeground:"#7de3bd",danger:"#f38b8b",dangerBackground:"#361010",border:"#4d4a52",input:"#121217",ring:"#6eddb4",info:"#72d2fa",infoForeground:"#171717",success:"#22c55e",successForeground:"#171717",warning:"#facc15",warningForeground:"#171717",sidebar:"#0d0d10",sidebarForeground:"#f7f7f7",sidebarAccent:"#242424",sidebarBorder:"#4d4a52"}:{background:"#ffffff",foreground:"#171717",primary:"#007a4d",primaryForeground:"#ffffff",secondary:"#f5f5f5",secondaryForeground:"#171717",muted:"#e8e8e8",mutedForeground:"#474747",accent:"#e7f3ee",accentForeground:"#00663f",danger:"#930b0b",dangerBackground:"#fde7e7",border:"#d9d9d9",input:"#e6e6e6",ring:"#006ac2",info:"#006ac2",infoForeground:"#ffffff",success:"#117a37",successForeground:"#ffffff",warning:"#dc9400",warningForeground:"#171717",sidebar:"#f7f7f8",sidebarForeground:"#171717",sidebarAccent:"#e8e8e8",sidebarBorder:"#d9d9d9"},c=i=>m(s[i]);r["--background"]??=c("background"),r["--foreground"]??=c("foreground"),r["--card"]??=r["--background"],r["--card-foreground"]??=r["--foreground"],r["--popover"]??=r["--card"],r["--popover-foreground"]??=r["--card-foreground"],r["--primary"]??=c("primary"),r["--primary-foreground"]??=c("primaryForeground"),r["--secondary"]??=c("secondary"),r["--secondary-foreground"]??=c("secondaryForeground"),r["--muted"]??=c("muted"),r["--muted-foreground"]??=c("mutedForeground"),r["--accent"]??=c("accent"),r["--accent-foreground"]??=c("accentForeground"),r["--danger"]??=c("danger"),r["--danger-background"]??=c("dangerBackground"),r["--border"]??=c("border"),r["--input"]??=c("input"),r["--ring"]??=c("ring"),r["--info"]=m(e["editorInfo.foreground"]??s.info),r["--info-foreground"]=c("infoForeground"),r["--success"]=m(e["testing.iconPassed"]??e["gitDecoration.addedResourceForeground"]??s.success),r["--success-foreground"]=c("successForeground"),r["--warning"]=m(e["editorWarning.foreground"]??s.warning),r["--warning-foreground"]=c("warningForeground"),r["--sidebar"]??=c("sidebar"),r["--sidebar-foreground"]??=c("sidebarForeground"),r["--sidebar-accent"]=r["--secondary"]??c("sidebarAccent"),r["--sidebar-accent-foreground"]=r["--sidebar-foreground"],r["--sidebar-border"]??=c("sidebarBorder");const u=[["--foreground","--background"],["--card-foreground","--card"],["--popover-foreground","--popover"],["--primary-foreground","--primary"],["--secondary-foreground","--secondary"],["--accent-foreground","--accent"],["--muted-foreground","--muted"],["--info-foreground","--info"],["--success-foreground","--success"],["--warning-foreground","--warning"],["--sidebar-foreground","--sidebar"],["--sidebar-accent-foreground","--sidebar-accent"]];for(const[i,R]of u)r[i]=H(r[i],r[R]);const g=["--danger-background","--background","--card","--popover","--muted","--sidebar"],f=r["--danger"];r["--danger"]=_(f,g.map(i=>r[i]));const d=F(r["--danger"]);g.every(i=>k(d,F(r[i]))>=4.55)||(r["--danger-background"]=r["--background"],r["--danger"]=_(f,g.map(i=>r[i]))),r["--primary-ink"]=_(r["--primary"],[r["--background"],r["--card"]]);const p=r["--warning"],b=[r["--background"],r["--card"]];return r["--warning-ink"]=_(p,[...b,...b.map(i=>V(p,i,.1))]),r}const z=[["terminal.background","background"],["terminal.foreground","foreground"],["terminal.selectionBackground","selectionBackground"],["terminal.selectionForeground","selectionForeground"],["terminalCursor.foreground","cursor"],["terminalCursor.background","cursorAccent"],["terminal.ansiBlack","black"],["terminal.ansiRed","red"],["terminal.ansiGreen","green"],["terminal.ansiYellow","yellow"],["terminal.ansiBlue","blue"],["terminal.ansiMagenta","magenta"],["terminal.ansiCyan","cyan"],["terminal.ansiWhite","white"],["terminal.ansiBrightBlack","brightBlack"],["terminal.ansiBrightRed","brightRed"],["terminal.ansiBrightGreen","brightGreen"],["terminal.ansiBrightYellow","brightYellow"],["terminal.ansiBrightBlue","brightBlue"],["terminal.ansiBrightMagenta","brightMagenta"],["terminal.ansiBrightCyan","brightCyan"],["terminal.ansiBrightWhite","brightWhite"]];function Q(e){const n={};for(const[r,o]of z){const a=e[r];a&&(n[o]=a)}return n}function E(e){return e.replace(/^#/,"")}function U(e,n){const r=n?"vs-dark":"vs",o=[];if(e.tokenColors)for(const t of e.tokenColors){const s=Array.isArray(t.scope)?t.scope:t.scope?[t.scope]:[""];for(const c of s){const u={token:c};t.settings.foreground&&(u.foreground=E(t.settings.foreground)),t.settings.background&&(u.background=E(t.settings.background)),t.settings.fontStyle&&(u.fontStyle=t.settings.fontStyle),o.push(u)}}const a={};if(e.colors)for(const[t,s]of Object.entries(e.colors))a[t]=s;return{base:r,inherit:!0,rules:o,colors:a}}function J(e){let n="",r=0,o=!1;for(;r<e.length;){const a=e[r];if(o){if(a==="\\"){n+=a+(e[r+1]??""),r+=2;continue}a==='"'&&(o=!1),n+=a,r++;continue}if(a==='"'){o=!0,n+=a,r++;continue}if(a==="/"&&e[r+1]==="/"){for(r+=2;r<e.length&&e[r]!==`
2
2
  `;)r++;continue}if(a==="/"&&e[r+1]==="*"){for(r+=2;r<e.length&&!(e[r]==="*"&&e[r+1]==="/");)r++;r+=2;continue}n+=a,r++}return n=n.replace(/,(\s*[}\]])/g,"$1"),n}function rr(e){if(!e||typeof e!="object")throw new Error("Invalid theme: expected an object");const n=e;if(!n.colors&&!n.tokenColors)throw new Error('Invalid theme: must contain "colors" or "tokenColors"');const r=n.colors??{};let o;return n.type==="light"||n.type==="hc-light"?o=!1:n.type==="dark"||n.type==="hc-black"?o=!0:r["editor.background"]?o=N(r["editor.background"]):o=!0,{name:n.name??x.settings_themeImport_fallbackName_label(),type:o?"dark":"light",cssVariables:q(r,o),monacoTheme:U(n,o),terminalColors:Q(r),rawColors:{...r}}}export{rr as p,J as s};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/YSPfcYKn.js","/app/immutable/chunks/BLYi9_ai.js","/app/immutable/chunks/BcNmLUvA.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/8obSPONn.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/Crq31h4w.js","/app/immutable/chunks/CXgjAj37.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/CYnvHqAo.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/Mne-RwlA.js","/app/immutable/chunks/C_nJgshO.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/DpFreuz_.js","/app/immutable/chunks/CFP6h_yj.js","/app/immutable/chunks/DomfbKVx.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BFeR9qbJ.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/CAmF3PXk.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/BLZx5Jln.js","/app/immutable/chunks/cYR0zuXX.js","/app/immutable/chunks/B4nCDPQA.js"])))=>i.map(i=>d[i]);
2
- var Nh=Object.defineProperty;var zh=(t,e,i)=>e in t?Nh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var P=(t,e,i)=>zh(t,typeof e!="symbol"?e+"":e,i);import{cd as Wh}from"./DYhIMPy1.js";import{bo as Fs,_ as Bn}from"./8obSPONn.js";import{a as ji}from"./BdWqymET.js";import{i as Ns}from"./C376IId1.js";import{d as Hh}from"./DC8fssXE.js";import{t as Uh}from"./dWvje8eu.js";import{d as Ui}from"./B0Z-1lwJ.js";import{c as Kh}from"./ChTqQfQN.js";import{bf as qh}from"./CYnvHqAo.js";import{Ii as _t,Jl as An,gn as Vh,Bu as Gh,zH as Yh,rA as Xh}from"./DomfbKVx.js";import{O as Pn,S as On,J as In,B as $n}from"./BcNmLUvA.js";import{g as jh}from"./ClUsr6sz.js";import{f as Zh,l as Jh}from"./g6g5zZQD.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BHhmm7k4.js","/app/immutable/chunks/Bl2M7dQb.js","/app/immutable/chunks/CO_V-6EQ.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/NqHwC243.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/C2dNFWEv.js","/app/immutable/chunks/ZUCHJs0z.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/c-xC05gO.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/D1pAML4P.js","/app/immutable/chunks/BJWZv5Sk.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/72TQselO.js","/app/immutable/chunks/A67C19bI.js","/app/immutable/chunks/D-TU-2ME.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BurMbBp5.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/B66L8YEe.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/Bkeityp2.js","/app/immutable/chunks/CjMEl34P.js","/app/immutable/chunks/BulkbkYU.js"])))=>i.map(i=>d[i]);
2
+ var Nh=Object.defineProperty;var zh=(t,e,i)=>e in t?Nh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var P=(t,e,i)=>zh(t,typeof e!="symbol"?e+"":e,i);import{cd as Wh}from"./DYhIMPy1.js";import{bo as Fs,_ as Bn}from"./NqHwC243.js";import{a as ji}from"./BdWqymET.js";import{i as Ns}from"./C-gRduKt.js";import{d as Hh}from"./D5iylRNB.js";import{t as Uh}from"./Bs48vxzD.js";import{d as Ui}from"./B0Z-1lwJ.js";import{c as Kh}from"./ChTqQfQN.js";import{bf as qh}from"./c-xC05gO.js";import{Ii as _t,Jl as An,gn as Vh,Bu as Gh,zH as Yh,rA as Xh}from"./D-TU-2ME.js";import{O as Pn,S as On,J as In,B as $n}from"./CO_V-6EQ.js";import{g as jh}from"./B-3aWyWM.js";import{f as Zh,l as Jh}from"./CZb8tVz5.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
  `))}},df=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},uf=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},_f=0,ur=class{constructor(t){this.value=t,this.id=_f++}},ff=2,gf,ut=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new lf(t?.onListenerError??dr,this._options?.leakWarningThreshold??hf):void 0,this._perfMon=this._options?._profName?new af(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 uf(`${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=cf.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof ur?(this._deliveryQueue??=new pf,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*ff<=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}},pf=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}},Oh=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),mf;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof vf?!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:Oh})})(mf||={});var vf=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?Oh:(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,aa=mi,Sf,Lt,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 wf=typeof Ge?.versions?.electron=="string",bf=wf&&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,aa=e.osLocale,Cs=e.resolvedLanguage||mi,Sf=e.languagePack?.translationsConfigFile}catch{}}else typeof navigator=="object"&&!bf?(Lt=navigator.userAgent,Lt.indexOf("Windows")>=0,Lt.indexOf("Macintosh")>=0,(Lt.indexOf("Macintosh")>=0||Lt.indexOf("iPad")>=0||Lt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_r=Lt.indexOf("Linux")>=0,Lt?.indexOf("Mobi")>=0,Cs=globalThis._VSCODE_NLS_LANGUAGE||mi,ds=navigator.language.toLowerCase(),aa=ds):console.error("Unable to resolve platform.");var vt=Lt,$t=Cs,Cf;(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})(Cf||={});var yf=typeof ni.postMessage=="function"&&!ni.importScripts;(()=>{if(yf){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 xf=!!(vt&&vt.indexOf("Chrome")>=0);vt&&vt.indexOf("Firefox")>=0;!xf&&vt&&vt.indexOf("Safari")>=0;vt&&vt.indexOf("Edg/")>=0;vt&&vt.indexOf("Android")>=0;function Ih(t,e=0,i){let s=setTimeout(()=>{t()},e);return yi(()=>{clearTimeout(s)})}var kf;(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})(kf||={});var ha=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())}};ha.EMPTY=ha.fromArray([]);var Ef=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=Mh(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Ih(()=>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]}},Lf=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}},Mf=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}},Tf=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}},Rf=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()}},Df=class extends qt{constructor(t){super(),this._highlightTimeout=this._register(new Rs),this._lineCache=this._register(new Rs),this._state=new Lf,this._resultTracker=this._register(new Rf),this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new Ef(t),this._engine=new Mf(t,this._lineCache.value),this._decorationManager=new Tf(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=Ih(()=>{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 Bf{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 Af=5e3;function Mn(){const t=Date.now();if(Jt&&t-hn<Af)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 la(t,e){const i=Mn();i.set(t,e),Tn(i)}function ca(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)),la(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)),la(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),ca(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),ca(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)||Uh.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="***",Pf="(?=[A-Za-z_])[A-Za-z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASS|CREDENTIAL|AUTH|PWD)[A-Za-z0-9_]*",Of=new RegExp(`((?:^|(?<=\\s)|&&|;|\\|\\|)\\s*(?:export\\s+)?)(${Pf})(=)("(?:[^"\\\\]|\\\\.)*"|'(?:[^'\\\\]|\\\\.)*'|\\\`[^\\\`]*\\\`|\\S+)`,"gi"),If=/(-[Hh]\s+|--header\s+)(['"])(Authorization:\s*)[^'"]*(\2)/gi,$f=/([\w+.-]+:\/\/[^\s@]+):([^\s@]+)@(?=\S)/gi,Ff=/(curl\s+(?:\S+\s+)*(?:-u|--user)[=\s]\s*)(["']?)([^\s"':]+):([^\s"']+)\2/gi,Nf=/(--(?:password|passwd|token|secret|api-key|api-token|auth-token|access-token|client-secret|private-key))(=)("(?:[^"\\\\]|\\\\.)*"|'(?:[^'\\\\]|\\\\.)*'|\S+)/gi,zf=/(--(?:password|passwd|token|secret|api-key|api-token|auth-token|access-token|client-secret|private-key))\s+("(?:[^"\\\\]|\\\\.)*"|'(?:[^'\\\\]|\\\\.)*'|\S+)/gi,Wf=/((?:mysql|mongosh?|redis-cli|sshpass)\s+(?:\S+\s+)*-[pP])\s+(\S+)/gi,Hf=/(mysql\s+(?:\S+\s+)*-[pP])(\S+)/gi;function Ut(t){if(!t)return t;let e=t;return e=e.replace(If,`$1$2Authorization: ${Ft}$4`),e=e.replace(Ff,`$1$2$3:${Ft}$2`),e=e.replace($f,`$1:${Ft}@`),e=e.replace(Nf,`$1$2${Ft}`),e=e.replace(zf,`$1 ${Ft}`),e=e.replace(Wf,`$1 ${Ft}`),e=e.replace(Hf,`$1${Ft}`),e=e.replace(Of,`$1$2$3${Ft}`),e}function $p(t){try{const e=new URL(t);return`${e.origin}${e.pathname}`.substring(0,100)}catch{return""}}const Xt=Kh("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",Wh(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 Uf(t,e){return setTimeout(()=>{try{t.dispose()}catch(i){if(e)e(i);else throw i}},0)}const Kf=["panel.focus-next-column","panel.focus-previous-column","global.next-space-alt","global.previous-space-alt","navigation.go-to-tab"];function qf(t,e,i,s=!1){const r=o=>Pn(o,e),n=s?r("navigation.go-to-device"):Pn("navigation.go-to-tab",e)===On["navigation.go-to-tab"]?On["navigation.go-to-device"]:null;return n&&In(t,n,i)>=0&&!$n("navigation.go-to-device",t,r,i)?!0:Kf.some(o=>In(t,r(o),i)>=0&&(o!=="navigation.go-to-tab"||!$n(o,t,r,i)))}const Vf=Df,I=new ji("TerminalAdapter"),Gf=typeof process<"u"&&process.platform==="win32",Yf=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??Hh).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 Bf(this.terminalId),this.setupStateMachineListeners(),this.bufferManager=new Ds(this.workspaceId,this.terminalId),this.themeManager=new ln(this.container);const i=e.fontFamily??jh.select(_t.state);this.xterm=new au({allowProposedApi:!0,fontFamily:i,fontSize:13,lineHeight:1.2,letterSpacing:0,cursorBlink:!0,cursorStyle:"block",cursorWidth:1,scrollback:1e4,allowTransparency:!0,windowsPty:Gf?{backend:"conpty"}:void 0,macOptionIsMeta:!0,rightClickSelectsWord:!0,convertEol:!0,drawBoldTextInBrightColors:!0,scrollSensitivity:1,theme:this.themeManager.getCurrentTheme()}),this.fitAddon=new cu,this.xterm.loadAddon(this.fitAddon),this.webLinksAddon=new pu((s,r)=>{this.handleLinkClick(r)}),this.xterm.loadAddon(this.webLinksAddon),this.searchAddon=new Vf,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"&&_t.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"&&_t.dispatch(Vh(this.workspaceId)),!1):qf(e,_t.state.userPreferences?.shortcutOverrides??{},i,_t.state.machineRail?.enabled??!1)||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}):_t.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 Z_,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()},Yf))});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(qh(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("./YSPfcYKn.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,25,26]),import.meta.url).then(({resolveBrowserLinkForOpen:i})=>i(e)).catch(()=>({url:e})).then(i=>{Bn(async()=>{const{getPanelLayoutManager:s}=await import("./BLZx5Jln.js").then(r=>r.p);return{getPanelLayoutManager:s}},__vite__mapDeps([27,17,18,3,19,20,5,7,4,21,13,2,28,29]),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)}Uf(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 Xf{constructor(){P(this,"terminals",new Map)}saveTerminalMetadata(e,i,s){try{_t.dispatch(Gh(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 Zh.select(_t.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{_t.dispatch(Yh(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)):_t.dispatch(Xh(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(qh(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("./BHhmm7k4.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,25,26]),import.meta.url).then(({resolveBrowserLinkForOpen:i})=>i(e)).catch(()=>({url:e})).then(i=>{Bn(async()=>{const{getPanelLayoutManager:s}=await import("./Bkeityp2.js").then(r=>r.p);return{getPanelLayoutManager:s}},__vite__mapDeps([27,17,18,3,19,20,5,7,4,21,13,2,28,29]),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)}Uf(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 Xf{constructor(){P(this,"terminals",new Map)}saveTerminalMetadata(e,i,s){try{_t.dispatch(Gh(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 Zh.select(_t.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{_t.dispatch(Yh(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)):_t.dispatch(Xh(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 Xf);const jf=window.__terminalManager,Fp=Object.freeze(Object.defineProperty({__proto__:null,terminalManager:jf},Symbol.toStringTag,{value:"Module"}));export{au as D,pu as L,ln as T,Uf as a,jf as b,Fp as c,$p as d,cu as o,Ut as s,Ii as t};
@@ -1,2 +1,2 @@
1
- import{O as G,g as j,ao as Q,al as V,aw as J,p as X,a as z}from"./DkXjvKmg.js";import{Ii as l,nw as h,nx as R,Ir as N,bf as T,Y,nj as _,r7 as H,rt as $,k3 as Z,rr as B,IJ as O,qP as ee,fF as q,r8 as P,_ as te,bd as ne,g as se}from"./DomfbKVx.js";import{y as F,aA as oe,v as ie}from"./Dqy2jMvN.js";import{g as x}from"./DypB-Dwi.js";const re=["[WORKSPACE EVENTS]","[TASK WAKE]","[AGENT MESSAGE]"];function ae(e){const t=e.metadata;if(t&&typeof t=="object"){if(t.type==="question_answers")return!1;if(!G(t))return!0}const n=j(e);return re.some(s=>n.startsWith(s))}const K=1440*60*1e3;function ce(e){let t=null;for(const n of e){if(ae({id:n.id,timestamp:n.createdAt,metadata:n.metadata,contentBlocks:[{type:"text",text:n.preview.trimStart()}]}))continue;const s=Date.parse(n.createdAt);Number.isFinite(s)&&(t===null||s>t)&&(t=s)}return t}const de=50,le=20;function W(e,t){return e===null||t!==null&&t>e?t:e}async function Be(e,t){let n,s=null;for(let o=0;o<le;o++){const i=await e({limit:de,nextToken:n});if(!i.ok)return null;const a=i.items;s===null&&a.length>0&&(s=a[a.length-1].id);const d=t?.newestId!=null?a.findIndex(c=>c.id===t.newestId):-1,r=ce(d>=0?a.slice(d+1):a);if(d>=0)return{latest:W(r,t?.latest??null),newestId:s};if(r!==null)return{latest:W(r,t?.latest??null),newestId:s};if(typeof i.nextToken!="string")return{latest:null,newestId:s};n=i.nextToken}return{latest:t?.latest??null,newestId:s}}function ue(e,t){return e!=null&&e<=t&&e>t-K}function ge(e,t){return e!=null&&Number.isFinite(e)&&e>0&&e<=t-K}function fe(e,t){const{workspaceId:n,agentId:s,authority:o,nativePairId:i,evidence:a}=e;if(!n||!s||!o||o!==t)return null;const d=JSON.stringify([n,s]);if(i!==d||a?.id!==d)return null;const r=a.clips.find(c=>c.status==="recording");return!r||r.discarding||!Number.isFinite(r.startedAt)||!Number.isFinite(r.pausedMs??0)||r.pausedAt!=null&&!Number.isFinite(r.pausedAt)?null:{workspaceId:n,agentId:s,clipId:r.id,startedAt:r.startedAt,pausedAt:r.pausedAt??null,pausedMs:r.pausedMs??0}}function We(e,t){return t!==void 0&&e!==t?"ignore":e?"stop":"start"}const De=l.createSelector(e=>{const t=e.dockConversation,n=t.workspaceId&&t.agentId?JSON.stringify([t.workspaceId,t.agentId]):null;return fe({workspaceId:t.workspaceId,agentId:t.agentId,authority:t.authority,nativePairId:t.nativeSpeech.pairId,evidence:n?h(t.evidence,n):null},x(e))});l.createSelector(e=>e.hud.active);l.createSelector(e=>e.hud.feed);l.createSelector(e=>e.hud.usage);l.createSelector(e=>e.hud.usageError);const Ee=l.createSelector(e=>e.hud.rateHistory),Ne=l.createSelector(e=>R(e.workspace.workspaces)),He=l.createSelector(e=>{const t=e.hud.usage?.totals;return t?N(t):0}),qe=l.createSelector(e=>e.hud.burnRatePerMin),Pe=l.createSelector(e=>e.hud.burnTrend),Fe=l.createSelector(e=>{const{health:t,stats:n,lastUpdated:s,hostLocality:o}=e.daemonHealth,i=n?.hostname;return{online:t!=="down",uptimeSeconds:typeof n?.uptimeSeconds=="number"?n.uptimeSeconds:null,version:n?.version??null,fetchedAtMs:s?Date.parse(s):null,remoteHostname:o==="remote"&&i?i.split(".",1)[0]??i:null}}),xe=l.createSelector(e=>e.hud.gridFilter);l.createSelector(e=>e.hud.attentionByWorkspaceId);const Ke=l.createSelector((e,t)=>{const n=e.hud?.questionsByAgentId?.[t];if(!n)return!1;const s=e.agentSessions?.byAgentId[t]?.metadata??{};return!F(s,n.messageId)}),Le=l.createSelector(e=>e.hud.takeoverRequestWorkspaceId);function pe(e,t){return t[String(e.id)]??e.displayStatus}const A=l.createSelector(e=>{const t=e.hud.displayStatusByWorkspaceId;return R(e.workspace.workspaces).filter(n=>n.status!==T.Archived&&n.status!==T.Retired&&n.status!==T.Deleted).map(n=>{const s=pe(n,t);return s&&s!==n.displayStatus?{...n,displayStatus:s}:n})});function I(e){const t=e.agentSummary;return!t||!Array.isArray(t.agents)?[]:t.agents.filter(n=>!!n&&typeof n=="object"&&typeof n.id=="string"&&n.status!=="deleted"&&!ie(n.id))}const Ue=l.createSelector(e=>{const t=Object.fromEntries(Y.map(n=>[n,0]));for(const n of A.select(e))for(const s of I(n))t[y(e,s).bucket]+=1;return t}),Ge=l.createSelector(e=>{const t={idle:0,unread:0,progress:0,attention:0,waiting:0,prOpen:0,prMerged:0,failed:0,completed:0,total:0};for(const n of C.select(e))switch(t.total+=1,n.isUnread&&(t.unread+=1),n.isWaiting&&(t.waiting+=1),n.stateKey){case"wait":case"blocked":t.attention+=1;break;case"failed":t.failed+=1;break;case"in_progress":t.progress+=1;break;case"complete":t.completed+=1;break;case"pr_open":case"pr_ready":case"pr_queued":t.prOpen+=1;break;case"pr_merged":t.prMerged+=1;break;default:t.idle+=1}return t}),ke=l.createSelector(e=>{const t={};for(const n of A.select(e))for(const s of I(n))typeof s.name=="string"&&s.name.length>0&&(t[s.id]=s.name);return t});function D(e){if(!e.sinceTs)return 0;const t=Date.parse(e.sinceTs);return Number.isFinite(t)?t:0}const je=l.createSelector(e=>{const t=e.hud.attentionByWorkspaceId,n=e.hud.questionsByAgentId,s=[];for(const o of A.select(e)){const i=String(o.id);let a=!1;for(const r of b(o,e)){const{bucket:c,attentionKind:u,hasQuestion:g}=r;if(c!=="needs-attention"&&c!=="failed"||!r.topLevel||r.isBackground||S(e,r.id))continue;const k=g?n[r.id]:void 0,f=u?_(e.agentSessions?.byAgentId[r.id])?.reason:void 0,p=k?"question":u??void 0;s.push({workspaceId:i,workspaceTitle:o.title,kind:c==="needs-attention"?"agent_waiting":"agent_failed",...c==="needs-attention"&&p?{signal:p}:{},agentName:r.name,message:k?.question??f??null,sinceTs:r.lastActivityTs}),a=!0}const d=t[i];d&&H(d.attention)&&(s.push({workspaceId:i,workspaceTitle:o.title,kind:"workspace_attention",attention:d.attention,message:null,sinceTs:d.raisedAtTs}),a=!0),L.has(w(o))&&!a&&s.push({workspaceId:i,workspaceTitle:o.title,kind:"workspace_attention",message:null,sinceTs:null})}return s.sort((o,i)=>D(i)-D(o))}),Qe=l.createSelector(e=>{const t=ke.select(e);return e.hud.feed.map(n=>({...n,workspaceTitle:h(e.workspace.workspaces,n.source)?.title??null,resolvedAgentName:n.agentName??(n.agentId?t[n.agentId]??null:null)}))}),Ae={total:0,completed:0,inProgress:0};function w(e){const t=$(e.displayStatus)?e.displayStatus:"not_started";return Z(t)??"not_started"}const L=new Set(["wait","blocked","failed"]);function Se(e,t,n){if(t==="failed"){const o=n.find(a=>a.bucket==="failed"&&!S(e,a.id)),i=o?e.agentSessions?.byAgentId[o.id]?.stopReason:null;return{kind:"failed",text:typeof i=="string"&&i.length>0?i:""}}if(t!=="wait"&&t!=="blocked")return null;const s=n.filter(o=>o.topLevel&&!o.isBackground&&!S(e,o.id));for(const o of s){if(!o.hasQuestion)continue;const i=e.hud.questionsByAgentId[o.id];if(i?.question)return{kind:"question",text:i.question}}for(const o of["blocker","discussion"])for(const i of s){if(i.attentionKind!==o)continue;const a=e.agentSessions?.byAgentId[i.id],d=_(a)?.reason;if(d)return{kind:o,text:d}}return{kind:"pending",text:""}}const m=new Set(["running","needs-attention","failed"]);function E(e){const t=typeof e.lastActivity=="string"?Date.parse(e.lastActivity):NaN;return Number.isFinite(t)?t:-1/0}function he(e){const t=n=>{const s=e.get(n.id)?.bucket;return s!==void 0&&m.has(s)?0:1};return(n,s)=>{const o=n.specialist==="spec-writer",i=s.specialist==="spec-writer";if(o!==i)return o?-1:1;const a=t(n)-t(s);if(a!==0)return a;const d=E(n),r=E(s);return d!==r?r-d:n.id<s.id?-1:n.id>s.id?1:0}}function me(e,t){const n=new Set(e.map(r=>r.id)),s=new Map,o=[];for(const r of e){const c=typeof r.parentAgentId=="string"&&r.parentAgentId!==r.id&&n.has(r.parentAgentId)?r.parentAgentId:null;if(c){const u=s.get(c)??[];u.push(r),s.set(c,u)}else o.push(r)}o.sort(t);for(const r of s.values())r.sort(t);const i=[],a=new Set,d=(r,c,u)=>{if(!a.has(r.id)){a.add(r.id),i.push({info:r,depth:c,parentAgentId:u});for(const g of s.get(r.id)??[])d(g,c+1,r.id)}};for(const r of o)d(r,0,null);for(const r of e)d(r,0,null);return i}function y(e,t){const n=e.agentSessions?.byAgentId[t.id],s=n?.metadata??{},o=n?_(n)?.kind??null:null,i=n?Q.select(e,t.id)||typeof n.status=="string"&&B(n.status):B(t.status),a=n?O(typeof n.status=="string"?n.status:t.status):null,d=!!n&&a!=="failed"&&a!=="done"&&(n.isWaitingForOtherAgents===!0||Array.isArray(n.waitingForAgentIds)&&n.waitingForAgentIds.length>0||Array.isArray(n.waitingOnHooks)&&n.waitingOnHooks.length>0||Array.isArray(n.waitingOnPrMonitors)&&n.waitingOnPrMonitors.length>0||Array.isArray(n.waitingOnScriptMonitors)&&n.waitingOnScriptMonitors.length>0),r=!!n&&(n.turnInFlight===!0||n.liveTurnOpen===!0);let c;n?d&&!r&&n.isStreaming!==!0&&n.isProcessing!==!0?c="idle":V.select(e,t.id)?c="running":i?c="idle":c=O(typeof n.status=="string"?n.status:t.status):c=t.isResponding===!0||t.isStreaming===!0?"running":O(t.status);const u=e.hud.questionsByAgentId[t.id],g=c!=="failed"&&!!u&&!F(s,u.messageId);return{bucket:c==="failed"?"failed":o!==null||g?"needs-attention":c,attentionKind:o,hasQuestion:g,isRunning:c==="running"}}function U(e,t){const n=o=>typeof o=="string"&&o!==e.id?o:null,s=o=>({isBackground:o?.isBackground,createdByAgentId:n(o?.createdByAgentId)});return{parentAgentId:n(e.parentAgentId)??n(t?.parentAgentId),isBackground:e.isBackground??t?.isBackground,metadata:s(t?.metadata),agentMetadata:s(t?.agentMetadata)}}function S(e,t){return e.agentSessions?.byAgentId[t]?.notificationsMuted===!0}function ye(e){if(!e)return null;switch(e.kind){case"attention":return e.attention.reason??null;case"live-tool":case"last-tool":{const t=z(e.toolUse.name,e.toolUse.input||{});return t.hidden?null:[t.verb,t.subject,t.path].filter(Boolean).join(" ").trim()||null}default:{const t=e.text||"";return t?t.includes(`
1
+ import{O as G,g as j,ao as Q,al as V,aw as J,p as X,a as z}from"./Dfltx80e.js";import{Ii as l,nw as h,nx as R,Ir as N,bf as T,Y,nj as _,r7 as H,rt as $,k3 as Z,rr as B,IJ as O,qP as ee,fF as q,r8 as P,_ as te,bd as ne,g as se}from"./D-TU-2ME.js";import{y as F,aA as oe,v as ie}from"./BPu-f3m6.js";import{g as x}from"./DypB-Dwi.js";const re=["[WORKSPACE EVENTS]","[TASK WAKE]","[AGENT MESSAGE]"];function ae(e){const t=e.metadata;if(t&&typeof t=="object"){if(t.type==="question_answers")return!1;if(!G(t))return!0}const n=j(e);return re.some(s=>n.startsWith(s))}const K=1440*60*1e3;function ce(e){let t=null;for(const n of e){if(ae({id:n.id,timestamp:n.createdAt,metadata:n.metadata,contentBlocks:[{type:"text",text:n.preview.trimStart()}]}))continue;const s=Date.parse(n.createdAt);Number.isFinite(s)&&(t===null||s>t)&&(t=s)}return t}const de=50,le=20;function W(e,t){return e===null||t!==null&&t>e?t:e}async function Be(e,t){let n,s=null;for(let o=0;o<le;o++){const i=await e({limit:de,nextToken:n});if(!i.ok)return null;const a=i.items;s===null&&a.length>0&&(s=a[a.length-1].id);const d=t?.newestId!=null?a.findIndex(c=>c.id===t.newestId):-1,r=ce(d>=0?a.slice(d+1):a);if(d>=0)return{latest:W(r,t?.latest??null),newestId:s};if(r!==null)return{latest:W(r,t?.latest??null),newestId:s};if(typeof i.nextToken!="string")return{latest:null,newestId:s};n=i.nextToken}return{latest:t?.latest??null,newestId:s}}function ue(e,t){return e!=null&&e<=t&&e>t-K}function ge(e,t){return e!=null&&Number.isFinite(e)&&e>0&&e<=t-K}function fe(e,t){const{workspaceId:n,agentId:s,authority:o,nativePairId:i,evidence:a}=e;if(!n||!s||!o||o!==t)return null;const d=JSON.stringify([n,s]);if(i!==d||a?.id!==d)return null;const r=a.clips.find(c=>c.status==="recording");return!r||r.discarding||!Number.isFinite(r.startedAt)||!Number.isFinite(r.pausedMs??0)||r.pausedAt!=null&&!Number.isFinite(r.pausedAt)?null:{workspaceId:n,agentId:s,clipId:r.id,startedAt:r.startedAt,pausedAt:r.pausedAt??null,pausedMs:r.pausedMs??0}}function We(e,t){return t!==void 0&&e!==t?"ignore":e?"stop":"start"}const De=l.createSelector(e=>{const t=e.dockConversation,n=t.workspaceId&&t.agentId?JSON.stringify([t.workspaceId,t.agentId]):null;return fe({workspaceId:t.workspaceId,agentId:t.agentId,authority:t.authority,nativePairId:t.nativeSpeech.pairId,evidence:n?h(t.evidence,n):null},x(e))});l.createSelector(e=>e.hud.active);l.createSelector(e=>e.hud.feed);l.createSelector(e=>e.hud.usage);l.createSelector(e=>e.hud.usageError);const Ee=l.createSelector(e=>e.hud.rateHistory),Ne=l.createSelector(e=>R(e.workspace.workspaces)),He=l.createSelector(e=>{const t=e.hud.usage?.totals;return t?N(t):0}),qe=l.createSelector(e=>e.hud.burnRatePerMin),Pe=l.createSelector(e=>e.hud.burnTrend),Fe=l.createSelector(e=>{const{health:t,stats:n,lastUpdated:s,hostLocality:o}=e.daemonHealth,i=n?.hostname;return{online:t!=="down",uptimeSeconds:typeof n?.uptimeSeconds=="number"?n.uptimeSeconds:null,version:n?.version??null,fetchedAtMs:s?Date.parse(s):null,remoteHostname:o==="remote"&&i?i.split(".",1)[0]??i:null}}),xe=l.createSelector(e=>e.hud.gridFilter);l.createSelector(e=>e.hud.attentionByWorkspaceId);const Ke=l.createSelector((e,t)=>{const n=e.hud?.questionsByAgentId?.[t];if(!n)return!1;const s=e.agentSessions?.byAgentId[t]?.metadata??{};return!F(s,n.messageId)}),Le=l.createSelector(e=>e.hud.takeoverRequestWorkspaceId);function pe(e,t){return t[String(e.id)]??e.displayStatus}const A=l.createSelector(e=>{const t=e.hud.displayStatusByWorkspaceId;return R(e.workspace.workspaces).filter(n=>n.status!==T.Archived&&n.status!==T.Retired&&n.status!==T.Deleted).map(n=>{const s=pe(n,t);return s&&s!==n.displayStatus?{...n,displayStatus:s}:n})});function I(e){const t=e.agentSummary;return!t||!Array.isArray(t.agents)?[]:t.agents.filter(n=>!!n&&typeof n=="object"&&typeof n.id=="string"&&n.status!=="deleted"&&!ie(n.id))}const Ue=l.createSelector(e=>{const t=Object.fromEntries(Y.map(n=>[n,0]));for(const n of A.select(e))for(const s of I(n))t[y(e,s).bucket]+=1;return t}),Ge=l.createSelector(e=>{const t={idle:0,unread:0,progress:0,attention:0,waiting:0,prOpen:0,prMerged:0,failed:0,completed:0,total:0};for(const n of C.select(e))switch(t.total+=1,n.isUnread&&(t.unread+=1),n.isWaiting&&(t.waiting+=1),n.stateKey){case"wait":case"blocked":t.attention+=1;break;case"failed":t.failed+=1;break;case"in_progress":t.progress+=1;break;case"complete":t.completed+=1;break;case"pr_open":case"pr_ready":case"pr_queued":t.prOpen+=1;break;case"pr_merged":t.prMerged+=1;break;default:t.idle+=1}return t}),ke=l.createSelector(e=>{const t={};for(const n of A.select(e))for(const s of I(n))typeof s.name=="string"&&s.name.length>0&&(t[s.id]=s.name);return t});function D(e){if(!e.sinceTs)return 0;const t=Date.parse(e.sinceTs);return Number.isFinite(t)?t:0}const je=l.createSelector(e=>{const t=e.hud.attentionByWorkspaceId,n=e.hud.questionsByAgentId,s=[];for(const o of A.select(e)){const i=String(o.id);let a=!1;for(const r of b(o,e)){const{bucket:c,attentionKind:u,hasQuestion:g}=r;if(c!=="needs-attention"&&c!=="failed"||!r.topLevel||r.isBackground||S(e,r.id))continue;const k=g?n[r.id]:void 0,f=u?_(e.agentSessions?.byAgentId[r.id])?.reason:void 0,p=k?"question":u??void 0;s.push({workspaceId:i,workspaceTitle:o.title,kind:c==="needs-attention"?"agent_waiting":"agent_failed",...c==="needs-attention"&&p?{signal:p}:{},agentName:r.name,message:k?.question??f??null,sinceTs:r.lastActivityTs}),a=!0}const d=t[i];d&&H(d.attention)&&(s.push({workspaceId:i,workspaceTitle:o.title,kind:"workspace_attention",attention:d.attention,message:null,sinceTs:d.raisedAtTs}),a=!0),L.has(w(o))&&!a&&s.push({workspaceId:i,workspaceTitle:o.title,kind:"workspace_attention",message:null,sinceTs:null})}return s.sort((o,i)=>D(i)-D(o))}),Qe=l.createSelector(e=>{const t=ke.select(e);return e.hud.feed.map(n=>({...n,workspaceTitle:h(e.workspace.workspaces,n.source)?.title??null,resolvedAgentName:n.agentName??(n.agentId?t[n.agentId]??null:null)}))}),Ae={total:0,completed:0,inProgress:0};function w(e){const t=$(e.displayStatus)?e.displayStatus:"not_started";return Z(t)??"not_started"}const L=new Set(["wait","blocked","failed"]);function Se(e,t,n){if(t==="failed"){const o=n.find(a=>a.bucket==="failed"&&!S(e,a.id)),i=o?e.agentSessions?.byAgentId[o.id]?.stopReason:null;return{kind:"failed",text:typeof i=="string"&&i.length>0?i:""}}if(t!=="wait"&&t!=="blocked")return null;const s=n.filter(o=>o.topLevel&&!o.isBackground&&!S(e,o.id));for(const o of s){if(!o.hasQuestion)continue;const i=e.hud.questionsByAgentId[o.id];if(i?.question)return{kind:"question",text:i.question}}for(const o of["blocker","discussion"])for(const i of s){if(i.attentionKind!==o)continue;const a=e.agentSessions?.byAgentId[i.id],d=_(a)?.reason;if(d)return{kind:o,text:d}}return{kind:"pending",text:""}}const m=new Set(["running","needs-attention","failed"]);function E(e){const t=typeof e.lastActivity=="string"?Date.parse(e.lastActivity):NaN;return Number.isFinite(t)?t:-1/0}function he(e){const t=n=>{const s=e.get(n.id)?.bucket;return s!==void 0&&m.has(s)?0:1};return(n,s)=>{const o=n.specialist==="spec-writer",i=s.specialist==="spec-writer";if(o!==i)return o?-1:1;const a=t(n)-t(s);if(a!==0)return a;const d=E(n),r=E(s);return d!==r?r-d:n.id<s.id?-1:n.id>s.id?1:0}}function me(e,t){const n=new Set(e.map(r=>r.id)),s=new Map,o=[];for(const r of e){const c=typeof r.parentAgentId=="string"&&r.parentAgentId!==r.id&&n.has(r.parentAgentId)?r.parentAgentId:null;if(c){const u=s.get(c)??[];u.push(r),s.set(c,u)}else o.push(r)}o.sort(t);for(const r of s.values())r.sort(t);const i=[],a=new Set,d=(r,c,u)=>{if(!a.has(r.id)){a.add(r.id),i.push({info:r,depth:c,parentAgentId:u});for(const g of s.get(r.id)??[])d(g,c+1,r.id)}};for(const r of o)d(r,0,null);for(const r of e)d(r,0,null);return i}function y(e,t){const n=e.agentSessions?.byAgentId[t.id],s=n?.metadata??{},o=n?_(n)?.kind??null:null,i=n?Q.select(e,t.id)||typeof n.status=="string"&&B(n.status):B(t.status),a=n?O(typeof n.status=="string"?n.status:t.status):null,d=!!n&&a!=="failed"&&a!=="done"&&(n.isWaitingForOtherAgents===!0||Array.isArray(n.waitingForAgentIds)&&n.waitingForAgentIds.length>0||Array.isArray(n.waitingOnHooks)&&n.waitingOnHooks.length>0||Array.isArray(n.waitingOnPrMonitors)&&n.waitingOnPrMonitors.length>0||Array.isArray(n.waitingOnScriptMonitors)&&n.waitingOnScriptMonitors.length>0),r=!!n&&(n.turnInFlight===!0||n.liveTurnOpen===!0);let c;n?d&&!r&&n.isStreaming!==!0&&n.isProcessing!==!0?c="idle":V.select(e,t.id)?c="running":i?c="idle":c=O(typeof n.status=="string"?n.status:t.status):c=t.isResponding===!0||t.isStreaming===!0?"running":O(t.status);const u=e.hud.questionsByAgentId[t.id],g=c!=="failed"&&!!u&&!F(s,u.messageId);return{bucket:c==="failed"?"failed":o!==null||g?"needs-attention":c,attentionKind:o,hasQuestion:g,isRunning:c==="running"}}function U(e,t){const n=o=>typeof o=="string"&&o!==e.id?o:null,s=o=>({isBackground:o?.isBackground,createdByAgentId:n(o?.createdByAgentId)});return{parentAgentId:n(e.parentAgentId)??n(t?.parentAgentId),isBackground:e.isBackground??t?.isBackground,metadata:s(t?.metadata),agentMetadata:s(t?.agentMetadata)}}function S(e,t){return e.agentSessions?.byAgentId[t]?.notificationsMuted===!0}function ye(e){if(!e)return null;switch(e.kind){case"attention":return e.attention.reason??null;case"live-tool":case"last-tool":{const t=z(e.toolUse.name,e.toolUse.input||{});return t.hidden?null:[t.verb,t.subject,t.path].filter(Boolean).join(" ").trim()||null}default:{const t=e.text||"";return t?t.includes(`
2
2
  `)?X(t)||null:t:null}}}function b(e,t){const n=I(e),s=new Map(n.map(i=>[i.id,y(t,i)]));return me(n,he(s)).map(({info:i,depth:a,parentAgentId:d})=>{const r=t.agentSessions?.byAgentId[i.id],c=U(i,r),{bucket:u,attentionKind:g,hasQuestion:k}=s.get(i.id)??y(t,i),f=Array.isArray(r?.waitingForAgentIds)?r.waitingForAgentIds.filter(p=>typeof p=="string"):[];return{id:i.id,name:i.name,bucket:u,lastActivityTs:i.lastActivity??null,line:ye(J.select(t,i.id)),parentAgentId:d,depth:a,treePrefix:"",topLevel:q(c)==="topLevel",isBackground:ee(c),attentionKind:g,hasQuestion:k,isWaitingForAgents:r?.isWaitingForOtherAgents===!0||f.length>0||Array.isArray(r?.waitingOnHooks)&&r.waitingOnHooks.length>0||Array.isArray(r?.waitingOnPrMonitors)&&r.waitingOnPrMonitors.length>0||Array.isArray(r?.waitingOnScriptMonitors)&&r.waitingOnScriptMonitors.length>0,waitingForAgentIds:f}})}function Ie(e){const t=new Set;for(const o of e)for(const i of o.waitingForAgentIds)t.add(i);const n=o=>m.has(o.bucket)||o.isWaitingForAgents||t.has(o.id);return e.filter((o,i)=>{if(n(o))return!0;for(let a=i+1;a<e.length&&!(e[a].depth<=o.depth);a++)if(n(e[a]))return!0;return!1}).map((o,i,a)=>{if(o.depth===0)return{...o,treePrefix:""};let d=!0;for(let r=i+1;r<a.length&&!(a[r].depth<o.depth);r++)if(a[r].depth===o.depth){d=!1;break}return{...o,treePrefix:(o.depth>=2?"│ ":"")+(d?"└─":"├─")}})}const C=l.createSelector(e=>{const t=e.hud.attentionByWorkspaceId,n=oe.select(e);return A.select(e).map(s=>{const o=String(s.id),i=n.indexOf(o),a=t[o]?.attention??(typeof s.attention=="string"&&P(s.attention)?s.attention:null),d=b(s,e),r=w(s),c=e.tokenUsage?.byWorkspaceId[o]?.totals,u=e.workspaceTasks?.byWorkspaceId[o]?.stats,g=typeof s.statusMessage=="string"&&s.statusMessage.trim().length>0?s.statusMessage:null;return{workspaceId:o,title:s.title,repoRef:s.repositoryName?`${s.repositoryOwner?`${s.repositoryOwner}/`:""}${s.repositoryName}`:s.branch,stateKey:r,attention:a,isUnread:a===te,isWaiting:s.waiting===!0,statusMessage:g,attentionSnippet:Se(e,r,d),prNumber:typeof s.prNumber=="number"?s.prNumber:null,keySlot:i===-1?null:i,tasks:u?{total:u.total,completed:u.completed,inProgress:u.inProgress}:Ae,tokens:c?N(c):0,agents:Ie(d)}})}),M=4;function we(e,t,n){const s=e.agentSessions?.byAgentId[n.id];return!s||String(s.workspaceId)!==t||s.pendingDeleteAt||q(U(n,s))!=="topLevel"?!1:!S(e,n.id)}const be=l.createSelector(e=>{const t={},n=e.hud.attentionByWorkspaceId;for(const s of A.select(e)){const o=String(s.id),i=new Map,a=(f,p)=>{const v=i.get(f)??[];v.includes(p)||v.push(p),i.set(f,v)},r=I(s).filter(f=>we(e,o,f));for(const f of r){const p=y(e,f);p.bucket==="failed"?a("failed",f.name):p.hasQuestion?a("question",f.name):p.attentionKind==="blocker"?a("blocker",f.name):p.attentionKind==="discussion"&&a("discussion",f.name),p.isRunning&&a("running",f.name)}const c=w(s);c==="failed"&&!i.has("failed")&&i.set("failed",[]),c==="blocked"&&!i.has("blocker")&&i.set("blocker",[]),c==="wait"&&!i.has("question")&&!i.has("blocker")&&!i.has("discussion")&&i.set("needs_input",[]);const u=n[o]?.attention??(typeof s.attention=="string"&&P(s.attention)?s.attention:null);u==="review_required"&&i.set("review",[]),u==="unread"&&i.set("unread",[]),s.activity==="agent_running"&&!i.has("running")&&i.set("running",[]);const g=ne.flatMap(f=>{const p=i.get(f);return p?[{category:f,count:Math.max(1,p.length),agentNames:p}]:[]});if(g.length===0)continue;const k=g.length>M;t[o]={agentCount:r.length,categories:g,visibleCategories:k?g.slice(0,M-1):g,hiddenCategoryCount:k?g.length-(M-1):0}}return t});l.createSelector(e=>{const t=e.hud.attentionByWorkspaceId;let n=0;for(const s of A.select(e)){let o=!1;for(const d of b(s,e))d.topLevel&&!d.isBackground&&!S(e,d.id)&&(d.bucket==="failed"||d.attentionKind!==null||d.hasQuestion)&&(n+=1,o=!0);const i=t[String(s.id)],a=i!==void 0&&H(i.attention);a&&(n+=1),L.has(w(s))&&!o&&!a&&(n+=1)}return n});function ve(e,t,n,s){const o=s.slice().sort((r,c)=>c.createdAt-r.createdAt);for(const r of o){const u=e.agentSessions?.byAgentId[r.agentId]?.metadata?.completionReport;if(typeof u=="string"&&u.trim().length>0)return u}const i=e.workspaceNotes?.byWorkspaceId[t]?.notes,a=i?h(i,n):void 0,d=a?.content||a?.contentPreview;return typeof d=="string"&&d.trim().length>0?d:null}const Ve=l.createSelector((e,t)=>{const n=C.select(e).find(c=>c.workspaceId===t);if(!n)return null;const s=h(e.workspace.workspaces,t),o=s?b(s,e):[],i=new Map(o.map(c=>[c.id,c])),a=e.taskAgentAssociations?.byWorkspaceId[t]?.byNoteId??{},d=e.workspaceTasks?.byWorkspaceId[t],r=d?R(d.tasks).filter(c=>c.status!=="cancelled").map(c=>{const u=Object.values(a[c.id]??{});return{id:c.id,title:c.title,status:c.status,agents:u.map(g=>i.get(g.agentId)).filter(g=>!!g),report:c.status==="complete"?ve(e,t,c.id,u):null,...c.specLinked!==void 0?{specLinked:c.specLinked}:{},...c.dependsOn?{dependsOn:c.dependsOn}:{},...c.conflictsWith?{conflictsWith:c.conflictsWith}:{},...c.unmetDependsOn?{unmetDependsOn:c.unmetDependsOn}:{}}}):[];return{workspaceId:t,title:n.title,repoRef:n.repoRef,statusMessage:n.statusMessage,keySlot:n.keySlot,stats:n.tasks,tasks:r,activeAgents:o.filter(c=>m.has(c.bucket)),idleAgents:o.filter(c=>!m.has(c.bucket))}}),Te=new Set(["failed","blocker","question","discussion","needs_input","review"]);function Oe(e){for(const t of e?.categories??[])switch(t.category){case"failed":return"failure";case"blocker":return"blocker";case"question":return"question";case"review":return"review"}return"none"}const Je=l.createSelector((e,t="recent")=>{const n=C.select(e),s=be.select(e),o=new Map(A.select(e).map(a=>[String(a.id),a])),i={action:[],unread:[],active:[]};for(const a of n){const d=o.get(a.workspaceId);if(!d||d.id===se||!(t==="older"?ge:ue)(e.hud.dockConversationAtByWorkspaceId[a.workspaceId],e.hud.dockRecencyNow))continue;const r=s[a.workspaceId],c=r?.categories??[],u=c.some(p=>Te.has(p.category)),g=a.isUnread,k=c.some(p=>p.category==="running"),f=u?"action":g?"unread":"active";i[f].push({workspace:d,badgeKind:Oe(r),priorityGroup:f,isUnread:g,isRunning:k,isWaiting:a.isWaiting})}return[...i.action,...i.unread,...i.active].sort((a,d)=>e.hud.dockConversationAtByWorkspaceId[String(d.workspace.id)]-e.hud.dockConversationAtByWorkspaceId[String(a.workspace.id)]||String(a.workspace.id).localeCompare(String(d.workspace.id)))}),Xe=l.createSelector(e=>e.hud.dockPlacement),ze=l.createSelector(e=>e.hud.dockPlacementError),Ye=l.createSelector(e=>e.hud.dockFocusRequest),$e=l.createSelector(e=>e.hud.dockCloseRequest),Ze=l.createSelector(e=>e.hud.dockDragStartResult),et=l.createSelector(e=>e.hud.dockResizeStartResult),tt=l.createSelector(e=>({pending:e.hud.dockMachineSwitching,error:e.hud.dockMachineSwitchError})),nt=l.createSelector(e=>{const t=e.hud.dockEditorCompactRequest,n=e.dockConversation,s=n.workspaceId&&n.agentId?h(n.evidence,JSON.stringify([n.workspaceId,n.agentId])):null,o=!!n.nativeSpeech.activeId||!!s?.annotation||s?.clips.some(i=>i.status==="recording")||e.hardwareConsole.pttRecording||e.hardwareConsole.voiceTranscribing;return t&&!o&&e.hud.active&&t.conversationGeneration===n.generation&&t.authority===x(e)&&t.backendId===e.connections.windowBackendId&&t.workspaceId===e.dockConversation.workspaceId&&t.agentId===e.dockConversation.agentId?t:null});export{Ne as A,Ge as B,be as C,$e as a,Ze as b,nt as c,Ye as d,tt as e,Xe as f,ze as g,De as h,ae as i,et as j,Je as k,Ke as l,Ue as m,je as n,qe as o,Pe as p,Qe as q,We as r,Be as s,xe as t,Ee as u,Fe as v,Le as w,Ve as x,He as y,C as z};
@@ -1,2 +1,2 @@
1
- import{t as Rt,bq as ae,_ as Vr,a_ as re,by as Ut,bu as be,bs as Zt,b as jt,bo as d}from"./8obSPONn.js";import{bs as zt,ca as ke,aD as e,bH as u,a5 as M,bA as P,W as s,bn as Et,bV as O,c9 as i,aA as oe,c6 as Ot,ay as ue,be as Ge,b$ as et,b_ as C,bO as g,bS as p,bl as S,aB as k,bj as Ar,aw as tt,ai as Wr,c5 as pr,a as gr,a7 as je,aj as vt,cd as Nr,br as Br}from"./DYhIMPy1.js";import{G as mr,H as Or}from"./BcNmLUvA.js";import{u as rt,w as yt,v as or,n as Pt}from"./Crq31h4w.js";import{c as St}from"./Mne-RwlA.js";import{b as _r}from"./BaIAhI85.js";import{Ii as A,nw as hr,vm as wr,vl as br,Kw as qr,Kx as Hr,eu as Kr,ev as Xr,JY as ir,lI as qt,Bp as nr,rX as sr,nU as Jr,z1 as Yr,a5 as lr,IO as Gr,J4 as Zr,n7 as Qr,iF as ea,ny as ta,uP as ra,zo as aa,JX as oa}from"./DomfbKVx.js";import{g as ia}from"./DfN8_dcw.js";import{a as na,g as sa,i as la,c as da,h as ca,d as ua,e as dr,f as fa,b as Ht}from"./DCR2yORR.js";import{bz as va,bM as pa,dp as ga}from"./DkXjvKmg.js";import{w as cr,d as ma}from"./r4Kn8ryM.js";import{f as _a}from"./cYR0zuXX.js";import{k as Kt}from"./BLYi9_ai.js";import{f as Fe,ax as ha}from"./CYnvHqAo.js";import"./CXgjAj37.js";import{F as Qe,a8 as wa,aq as ba,aV as xa,a$ as Tt,cn as ya,co as Pa,bi as $a,cM as ka,c3 as Ia}from"./CAmF3PXk.js";import{d as Ca,f as Fa,t as ur}from"./CBoIo15V.js";import{c as Sa}from"./ChTqQfQN.js";import"./CFP6h_yj.js";import{$ as Da}from"./XA_y_9lT.js";import{i as Xt,b as Ta,a as Ma}from"./H2jLkRRS.js";import{C as Yt,p as Ra}from"./AGFKnm2P.js";import{M as Ua}from"./R1PIrMEo.js";import{t as Jt,u as xr}from"./DpFreuz_.js";import"./ikj2reaR.js";import"./DwIsNA5R.js";import{M as Dt}from"./BQVyHt6n.js";import{V as ja}from"./e0dgj-dl.js";import{bQ as za,b4 as Ea}from"./1kZYk73E.js";import{al as La}from"./wFOLz40M.js";const yr=A.createSelector((Y,x)=>hr(Y.pdfPreview.previews,x));var Va=k('<div class="flex shrink-0 flex-wrap items-center justify-center gap-2 border-b border-border p-2"><!> <span aria-live="polite"> </span> <!> <!> <span> </span> <!></div> <div class="min-h-0 flex-1 overflow-auto p-4"><canvas class="mx-auto block" role="img"></canvas></div>',1),Aa=k('<div class="flex h-full min-h-0 flex-col" data-testid="pdf-viewer"><!></div>');function Gt(Y,x){if(new.target)return Rt({component:Gt,...Y});zt(x,!0);const Ie=()=>be(xe,"$preview",at),[at,ie]=Zt();let $=ae(x,"workspaceId",7),ne=ae(x,"filePath",7),Ce=ae(x,"gitRootId",7);const Se=crypto.randomUUID(),xe=yr(Se),_e=new WeakMap;let Q=O(null),He=O(void 0),W=O(1),B=O(1),se=O(!0),z=O(!1),Ee=O(null),We=O(0);const ye=i(()=>Ie()?.error??e(Ee)),De=i(()=>e(ye)==="missing"?d.file_pdf_missing_error():e(ye)==="large"?d.file_pdf_large_error():e(ye)==="invalid"?d.file_pdf_invalid_error():e(ye)==="password"?d.file_pdf_password_error():d.file_pdf_load_error());ke(()=>{const l=$(),y=ne();e(We);const E=crypto.randomUUID();return A.dispatch(wr(Se,E,l,y,...Ce()?[{gitRootId:Ce()}]:[])),()=>{A.dispatch(br(Se,E))}}),ke(()=>{const l=Ie()?.url;let y=!1,E;if(u(Q,null),u(Ee,null),u(se,!0),u(W,1),u(B,1),!!l)return(async()=>{try{const{loadPdfDocument:X}=await Vr(async()=>{const{loadPdfDocument:he}=await import("./cb1JHFKl.js");return{loadPdfDocument:he}},[],import.meta.url);if(y)return;E=X(l);const le=await E.promise;y||u(Q,le)}catch(X){if(y)return;u(Ee,X instanceof Error&&X.name==="PasswordException"?"password":X instanceof Error&&X.name==="InvalidPDFException"?"invalid":"load",!0)}finally{y||u(se,!1)}})(),()=>{y=!0,E?.destroy()}}),ke(()=>{const l=e(Q),y=e(He),E=e(W),X=e(B);if(!l||!y)return;let le=!1,he,U;const de=()=>{if(!U)return;const J=(_e.get(U)??1)-1;J?_e.set(U,J):(_e.delete(U),U.cleanup()),U=void 0};return u(z,!0),(async()=>{try{if(U=await l.getPage(E),_e.set(U,(_e.get(U)??0)+1),le){de();return}const J=U.getViewport({scale:X}),ee=Math.min(window.devicePixelRatio||1,2,Math.sqrt(16e6/(J.width*J.height)));y.width=Math.ceil(J.width*ee),y.height=Math.ceil(J.height*ee),y.style.width=`${J.width}px`,y.style.height=`${J.height}px`,he=U.render({canvas:y,viewport:J,transform:[ee,0,0,ee,0,0]}),await he.promise}catch{le||u(Ee,"invalid")}finally{le||u(z,!1)}})(),()=>{le=!0,he?.cancel(),he?he.promise.then(de,de):de()}});var Ne={get workspaceId(){return $()},set workspaceId(l){$(l),oe()},get filePath(){return ne()},set filePath(l){ne(l),oe()},get gitRootId(){return Ce()},set gitRootId(l){Ce(l),oe()},$set:Ut,$on:(l,y)=>jt(x,l,y)},o=Aa(),c=M(o);{var R=l=>{{const y=X=>{Ge();var le=et();C(()=>g(le,e(De))),s(X,le)};let E=i(()=>d.ui_combobox_retry_label());Ca(l,{onRetry:()=>Ot(We),get retryLabel(){return e(E)},class:"m-auto",message:y,$$slots:{message:!0}})}},m=l=>{{let y=i(()=>d.file_pdf_loading_label());Fa(l,{get label(){return e(y)},count:1,class:"p-4"})}},w=l=>{var y=Va(),E=ue(y),X=M(E);{let ge=i(()=>e(W)<=1);Fe(X,{variant:"ghost",size:"compact",get disabled(){return e(ge)},onclick:()=>Ot(W,-1),children:(Pe,Xe)=>{Ge();var $e=et();C(fe=>g($e,fe),[()=>d.file_pdf_previous_label()]),s(Pe,$e)},$$slots:{default:!0}})}var le=p(X,2),he=S(le,!0),U=p(le,2);{let ge=i(()=>e(W)>=e(Q).numPages);Fe(U,{variant:"ghost",size:"compact",get disabled(){return e(ge)},onclick:()=>Ot(W),children:(Pe,Xe)=>{Ge();var $e=et();C(fe=>g($e,fe),[()=>d.file_pdf_next_label()]),s(Pe,$e)},$$slots:{default:!0}})}var de=p(U,2);{let ge=i(()=>e(B)<=.25);Fe(de,{variant:"ghost",size:"compact",get disabled(){return e(ge)},onclick:()=>u(B,Math.max(.25,e(B)-.25),!0),children:(Pe,Xe)=>{Ge();var $e=et();C(fe=>g($e,fe),[()=>d.editor_fileViewer_zoomOut_tooltip()]),s(Pe,$e)},$$slots:{default:!0}})}var J=p(de,2),ee=S(J,!0),ot=p(J,2);{let ge=i(()=>e(B)>=3);Fe(ot,{variant:"ghost",size:"compact",get disabled(){return e(ge)},onclick:()=>u(B,Math.min(3,e(B)+.25),!0),children:(Pe,Xe)=>{Ge();var $e=et();C(fe=>g($e,fe),[()=>d.editor_fileViewer_zoomIn_tooltip()]),s(Pe,$e)},$$slots:{default:!0}})}P(E);var it=p(E,2),Ke=M(it);let Ze;_r(Ke,ge=>u(He,ge),()=>e(He)),P(it),C((ge,Pe,Xe)=>{g(he,ge),g(ee,Pe),rt(it,"aria-busy",e(z)),rt(Ke,"aria-label",Xe),Ze=yt(Ke,"",Ze,{visibility:e(z)?"hidden":"visible"})},[()=>d.file_pdf_page_label({page:Jt(e(W)),total:Jt(e(Q).numPages)}),()=>xr(e(B),{style:"percent"}),()=>d.file_pdf_canvas_ariaLabel({name:ne(),page:Jt(e(W))})]),s(l,y)};re(c,l=>{e(ye)?l(R):e(se)||Ie()?.status==="loading"?l(m,1):e(Q)&&l(w,2)})}P(o),s(Y,o);var Le=Et(Ne);return ie(),Le}const Wa=A.createSelector((Y,x)=>hr(Y.videoPreview.previews,x));var Na=k('<p role="status"> </p>'),Ba=k('<p role="alert"> </p>'),Oa=k('<div class="flex flex-col items-center gap-3 p-6 text-center text-sm text-subtle"><p class="break-all"> </p> <!> <!></div>'),qa=k('<video controls="" preload="metadata" playsinline="" class="max-w-full max-h-full" data-testid="file-video"> </video>',2),Ha=k('<div class="min-h-0 flex-1 flex items-center justify-center bg-background"><!></div>');function Pr(Y,x){if(new.target)return Rt({component:Pr,...Y});zt(x,!0);const Ie=()=>be(He,"$preview",at),[at,ie]=Zt();let $=ae(x,"sourceUrl",7),ne=ae(x,"fileName",7),Ce=ae(x,"allowDownload",7),Se=ae(x,"downloading",7),xe=ae(x,"onDownload",7),_e=O(null);const Q=crypto.randomUUID(),He=Wa(Q),W=i(()=>Ie()?.status==="loading"),B=i(()=>e(_e)??Ie()?.error);let se=!1,z=!1;Ar(()=>{z=!0,A.dispatch(qr(Q))});function Ee(){if(z||e(W))return;const m=$().startsWith("workspace-file://")?new URL($()):null;if(se||!m||!m.pathname.toLowerCase().endsWith(".mp4")){u(_e,"unsupported");return}se=!0,m.searchParams.set("preview","h264"),A.dispatch(Hr(Q,m.hostname,m.toString()))}function We(m){if(z)return;const w=m.currentTarget.error?.code;w===2?u(_e,"network"):w!==1&&Ee()}var ye={get sourceUrl(){return $()},set sourceUrl(m){$(m),oe()},get fileName(){return ne()},set fileName(m){ne(m),oe()},get allowDownload(){return Ce()},set allowDownload(m){Ce(m),oe()},get downloading(){return Se()},set downloading(m){Se(m),oe()},get onDownload(){return xe()},set onDownload(m){xe(m),oe()},$set:Ut,$on:(m,w)=>jt(x,m,w)},De=Ha(),Ne=M(De);{var o=m=>{var w=Oa(),Le=M(w),l=S(Le,!0),y=p(Le,2);{var E=U=>{var de=Na(),J=S(de,!0);C(ee=>g(J,ee),[()=>d.editor_fileViewer_videoPreparing_label()]),s(U,de)},X=U=>{var de=Ba(),J=S(de,!0);C(ee=>g(J,ee),[()=>e(B)==="network"?d.editor_fileViewer_videoLoad_error():d.editor_fileViewer_videoUnsupported_label()]),s(U,de)};re(y,U=>{e(W)?U(E):U(X,-1)})}var le=p(y,2);{var he=U=>{Fe(U,{variant:"secondary",size:"sm",get onclick(){return xe()},get disabled(){return Se()},children:(de,J)=>{Ge();var ee=et();C(ot=>g(ee,ot),[()=>d.layout_fileTab_downloadFile_label()]),s(de,ee)},$$slots:{default:!0}})};re(le,U=>{Ce()&&U(he)})}P(w),C(()=>g(l,ne())),s(m,w)},c=m=>{var w=qa(),Le=S(w,!0);C(l=>{rt(w,"src",Ie()?.url??$()),g(Le,l)},[()=>d.editor_fileViewer_videoUnsupported_label()]),tt("error",w,We),tt("loadedmetadata",w,l=>{l.currentTarget.videoWidth===0&&Ee()}),s(m,w)};re(Ne,m=>{e(B)||e(W)?m(o):m(c,-1)})}P(De),s(Y,De);var R=Et(ye);return ie(),R}var Ka=k('<!> <span class="text-xs text-subtle min-w-[50px] text-center"> </span> <!> <div class="w-px h-5 bg-border mx-1"></div>',1),Xa=k('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="w-px h-5 bg-border mx-1"></div> <!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),Ja=k('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),Ya=k('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path></svg></div> <div class="text-sm text-subtle mb-4"> </div> <audio controls="" class="w-full max-w-md"><source/> </audio></div>'),Ga=k("<!> ",1),Za=k('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg></div> <p class="text-sm text-subtle mb-4"> </p> <!></div>'),Qa=k('<th class="border border-border px-2 py-1 text-left text-xs font-medium bg-muted"> </th>'),eo=k('<td class="border border-border px-2 py-1 text-xs"> </td>'),to=k("<tr></tr>"),ro=k('<div class="flex-1 overflow-auto p-4"><table class="w-full border-collapse"><thead><tr></tr></thead><tbody></tbody></table></div>'),ao=k('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),oo=k('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),io=k('<div class="h-full flex flex-col"><!></div>');function Mt(Y,x){if(new.target)return Rt({component:Mt,...Y});zt(x,!0);const Ie=t=>{var a=Ka(),f=ue(a);{let D=i(()=>d.editor_fileViewer_zoomOut_tooltip());Fe(f,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:de,get title(){return e(D)},children:(T,q)=>{Qe(T,{get icon(){return ya},size:"sm"})},$$slots:{default:!0}})}var _=p(f,2),h=S(_,!0),j=p(_,2);{let D=i(()=>d.editor_fileViewer_zoomIn_tooltip());Fe(j,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:U,get title(){return e(D)},children:(T,q)=>{Qe(T,{get icon(){return Pa},size:"sm"})},$$slots:{default:!0}})}Ge(2),C(()=>g(h,e(Ee))),s(t,a)},at=Sa("FileViewer");let ie=ae(x,"filePath",7),$=ae(x,"fileContent",7,""),ne=ae(x,"sourceUrl",7),Ce=ae(x,"language",7),Se=ae(x,"isBinary",7),xe=ae(x,"allowDownload",7,!0),_e=ae(x,"onDownload",7),Q=ae(x,"downloading",7,!1);const He=t=>{const a=t.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","webp","bmp","ico","avif"].includes(a)?"image":a==="svg"?"svg":["mp4","webm","ogg","mov","avi"].includes(a)?"video":["mp3","wav","ogg","m4a","flac"].includes(a)?"audio":a==="pdf"?"pdf":["md","markdown"].includes(a)?"markdown":a==="json"?"json":a==="csv"?"csv":["yaml","yml"].includes(a)?"yaml":a==="xml"?"xml":["zip","tar","gz","rar","7z","bz2"].includes(a)?"archive":["exe","dll","so","dylib","wasm"].includes(a)?"binary":"text"},W=i(()=>He(ie())),B=i(()=>ie().split("/").pop()||d.editor_fileViewer_unknown_fallback());let se=O(100),z=O(0);const Ee=i(()=>xr(e(se)/100,{style:"percent",maximumFractionDigits:0}));let We=O(!1),ye=O(0),De=O(0),Ne=O(0),o=O(0),c=O(!1),R=null;function m(){const t=R;R=null,u(c,!1),t?.viewport.hasPointerCapture(t.pointerId)&&t.viewport.releasePointerCapture(t.pointerId)}function w(t){if(t.button!==0||!t.isPrimary||R)return;const a=t.currentTarget;a.setPointerCapture(t.pointerId),R={pointerId:t.pointerId,x:t.clientX,y:t.clientY,viewport:a},u(c,!0),t.preventDefault()}function Le(t){if(!(!R||t.pointerId!==R.pointerId)){if((t.buttons&1)===0){m();return}u(Ne,R.viewport.scrollLeft,!0),u(o,R.viewport.scrollTop,!0),u(ye,e(ye)+(t.clientX-R.x)),u(De,e(De)+(t.clientY-R.y)),R.x=t.clientX,R.y=t.clientY}}function l(t){t.pointerId===R?.pointerId&&m()}ke(()=>{ie(),ne(),e(se),e(z),u(Ne,0),u(o,0)}),ke(()=>(ie(),ne(),pr(()=>{m(),u(ye,0),u(De,0)}),m));const y=t=>{const a=t.split(".").pop()?.toLowerCase();return a==="jpg"||a==="jpeg"?"image/jpeg":a==="png"?"image/png":a==="gif"?"image/gif":a==="webp"?"image/webp":"application/octet-stream"},E=t=>{const a=t.split(".").pop()?.toLowerCase();if(a==="mp4")return"video/mp4";if(a==="webm")return"video/webm"},X=()=>{if(ne())return ne();if(typeof $()=="string")return $().startsWith("data:")||$().startsWith("http")?$():Se()?`data:${y(ie())};base64,${$()}`:`data:${y(ie())};base64,${$()}`;if($()instanceof ArrayBuffer){const a=new Uint8Array($()).reduce((_,h)=>_+String.fromCharCode(h),""),f=btoa(a);return`data:${y(ie())};base64,${f}`}return""},le=()=>{if(ne())return ne();const t=E(ie());if(!t)return"";if(typeof $()=="string")return $().startsWith("data:")||$().startsWith("http")?$():`data:${t};base64,${$()}`;const a=new Uint8Array($()),f=[],_=32768;for(let h=0;h<a.length;h+=_)f.push(String.fromCharCode(...a.subarray(h,h+_)));return`data:${t};base64,${btoa(f.join(""))}`},he=()=>{const t=typeof $()=="string"?new TextEncoder().encode($()):new Uint8Array($()),a=[],f=32768;for(let _=0;_<t.length;_+=f)a.push(String.fromCharCode(...t.subarray(_,_+f)));return`data:image/svg+xml;base64,${btoa(a.join(""))}`},U=()=>{u(se,Math.min(e(se)+25,500),!0)},de=()=>{u(se,Math.max(e(se)-25,25),!0)},J=()=>{u(z,(e(z)+90)%360)},ee=()=>{if(!xe()||Q())return;if(_e()){_e()();return}const t=document.createElement("a");t.href=e(W)==="video"?le():e(W)==="svg"?he():X(),t.download=e(B),t.click()},ot=async()=>{try{const t=X(),a=new Image;a.crossOrigin="anonymous";const f=await new Promise((_,h)=>{a.onload=()=>{const j=document.createElement("canvas");j.width=a.naturalWidth,j.height=a.naturalHeight;const D=j.getContext("2d");if(!D){h(new Error("Failed to get canvas context"));return}D.drawImage(a,0,0),j.toBlob(T=>{T?_(T):h(new Error("Failed to create blob from canvas"))},"image/png",1)},a.onerror=()=>h(new Error("Failed to load image")),a.src=t});await navigator.clipboard.write([new ClipboardItem({"image/png":f})]),u(We,!0),setTimeout(()=>u(We,!1),2e3)}catch(t){at.error("Failed to copy image:",t)}},it=t=>{try{const a=JSON.parse(t);return JSON.stringify(a,null,2)}catch{return t}},Ke=t=>t.split(`
1
+ import{t as Rt,bq as ae,_ as Vr,a_ as re,by as Ut,bu as be,bs as Zt,b as jt,bo as d}from"./NqHwC243.js";import{bs as zt,ca as ke,aD as e,bH as u,a5 as M,bA as P,W as s,bn as Et,bV as O,c9 as i,aA as oe,c6 as Ot,ay as ue,be as Ge,b$ as et,b_ as C,bO as g,bS as p,bl as S,aB as k,bj as Ar,aw as tt,ai as Wr,c5 as pr,a as gr,a7 as je,aj as vt,cd as Nr,br as Br}from"./DYhIMPy1.js";import{G as mr,H as Or}from"./CO_V-6EQ.js";import{u as rt,w as yt,v as or,n as Pt}from"./C2dNFWEv.js";import{c as St}from"./D1pAML4P.js";import{b as _r}from"./BaIAhI85.js";import{Ii as A,nw as hr,vm as wr,vl as br,Kw as qr,Kx as Hr,eu as Kr,ev as Xr,JY as ir,lI as qt,Bp as nr,rX as sr,nU as Jr,z1 as Yr,a5 as lr,IO as Gr,J4 as Zr,n7 as Qr,iF as ea,ny as ta,uP as ra,zo as aa,JX as oa}from"./D-TU-2ME.js";import{g as ia}from"./DfN8_dcw.js";import{a as na,g as sa,i as la,c as da,h as ca,d as ua,e as dr,f as fa,b as Ht}from"./DstArZ_G.js";import{bz as va,bM as pa,dp as ga}from"./Dfltx80e.js";import{w as cr,d as ma}from"./x8V1qvZr.js";import{f as _a}from"./CjMEl34P.js";import{k as Kt}from"./Bl2M7dQb.js";import{f as Fe,ax as ha}from"./c-xC05gO.js";import"./ZUCHJs0z.js";import{F as Qe,a8 as wa,aq as ba,aV as xa,a$ as Tt,cn as ya,co as Pa,bi as $a,cM as ka,c3 as Ia}from"./B66L8YEe.js";import{d as Ca,f as Fa,t as ur}from"./BD9kDOxT.js";import{c as Sa}from"./ChTqQfQN.js";import"./A67C19bI.js";import{$ as Da}from"./CNbjMDZm.js";import{i as Xt,b as Ta,a as Ma}from"./H2jLkRRS.js";import{C as Yt,p as Ra}from"./DQ9yqoWl.js";import{M as Ua}from"./Q7GICaZA.js";import{t as Jt,u as xr}from"./72TQselO.js";import"./B4585dIt.js";import"./CrKYeBTQ.js";import{M as Dt}from"./C02TD_sM.js";import{V as ja}from"./DcSenGcU.js";import{bQ as za,b4 as Ea}from"./RWrc-xf9.js";import{al as La}from"./Dw6H-2WQ.js";const yr=A.createSelector((Y,x)=>hr(Y.pdfPreview.previews,x));var Va=k('<div class="flex shrink-0 flex-wrap items-center justify-center gap-2 border-b border-border p-2"><!> <span aria-live="polite"> </span> <!> <!> <span> </span> <!></div> <div class="min-h-0 flex-1 overflow-auto p-4"><canvas class="mx-auto block" role="img"></canvas></div>',1),Aa=k('<div class="flex h-full min-h-0 flex-col" data-testid="pdf-viewer"><!></div>');function Gt(Y,x){if(new.target)return Rt({component:Gt,...Y});zt(x,!0);const Ie=()=>be(xe,"$preview",at),[at,ie]=Zt();let $=ae(x,"workspaceId",7),ne=ae(x,"filePath",7),Ce=ae(x,"gitRootId",7);const Se=crypto.randomUUID(),xe=yr(Se),_e=new WeakMap;let Q=O(null),He=O(void 0),W=O(1),B=O(1),se=O(!0),z=O(!1),Ee=O(null),We=O(0);const ye=i(()=>Ie()?.error??e(Ee)),De=i(()=>e(ye)==="missing"?d.file_pdf_missing_error():e(ye)==="large"?d.file_pdf_large_error():e(ye)==="invalid"?d.file_pdf_invalid_error():e(ye)==="password"?d.file_pdf_password_error():d.file_pdf_load_error());ke(()=>{const l=$(),y=ne();e(We);const E=crypto.randomUUID();return A.dispatch(wr(Se,E,l,y,...Ce()?[{gitRootId:Ce()}]:[])),()=>{A.dispatch(br(Se,E))}}),ke(()=>{const l=Ie()?.url;let y=!1,E;if(u(Q,null),u(Ee,null),u(se,!0),u(W,1),u(B,1),!!l)return(async()=>{try{const{loadPdfDocument:X}=await Vr(async()=>{const{loadPdfDocument:he}=await import("./cb1JHFKl.js");return{loadPdfDocument:he}},[],import.meta.url);if(y)return;E=X(l);const le=await E.promise;y||u(Q,le)}catch(X){if(y)return;u(Ee,X instanceof Error&&X.name==="PasswordException"?"password":X instanceof Error&&X.name==="InvalidPDFException"?"invalid":"load",!0)}finally{y||u(se,!1)}})(),()=>{y=!0,E?.destroy()}}),ke(()=>{const l=e(Q),y=e(He),E=e(W),X=e(B);if(!l||!y)return;let le=!1,he,U;const de=()=>{if(!U)return;const J=(_e.get(U)??1)-1;J?_e.set(U,J):(_e.delete(U),U.cleanup()),U=void 0};return u(z,!0),(async()=>{try{if(U=await l.getPage(E),_e.set(U,(_e.get(U)??0)+1),le){de();return}const J=U.getViewport({scale:X}),ee=Math.min(window.devicePixelRatio||1,2,Math.sqrt(16e6/(J.width*J.height)));y.width=Math.ceil(J.width*ee),y.height=Math.ceil(J.height*ee),y.style.width=`${J.width}px`,y.style.height=`${J.height}px`,he=U.render({canvas:y,viewport:J,transform:[ee,0,0,ee,0,0]}),await he.promise}catch{le||u(Ee,"invalid")}finally{le||u(z,!1)}})(),()=>{le=!0,he?.cancel(),he?he.promise.then(de,de):de()}});var Ne={get workspaceId(){return $()},set workspaceId(l){$(l),oe()},get filePath(){return ne()},set filePath(l){ne(l),oe()},get gitRootId(){return Ce()},set gitRootId(l){Ce(l),oe()},$set:Ut,$on:(l,y)=>jt(x,l,y)},o=Aa(),c=M(o);{var R=l=>{{const y=X=>{Ge();var le=et();C(()=>g(le,e(De))),s(X,le)};let E=i(()=>d.ui_combobox_retry_label());Ca(l,{onRetry:()=>Ot(We),get retryLabel(){return e(E)},class:"m-auto",message:y,$$slots:{message:!0}})}},m=l=>{{let y=i(()=>d.file_pdf_loading_label());Fa(l,{get label(){return e(y)},count:1,class:"p-4"})}},w=l=>{var y=Va(),E=ue(y),X=M(E);{let ge=i(()=>e(W)<=1);Fe(X,{variant:"ghost",size:"compact",get disabled(){return e(ge)},onclick:()=>Ot(W,-1),children:(Pe,Xe)=>{Ge();var $e=et();C(fe=>g($e,fe),[()=>d.file_pdf_previous_label()]),s(Pe,$e)},$$slots:{default:!0}})}var le=p(X,2),he=S(le,!0),U=p(le,2);{let ge=i(()=>e(W)>=e(Q).numPages);Fe(U,{variant:"ghost",size:"compact",get disabled(){return e(ge)},onclick:()=>Ot(W),children:(Pe,Xe)=>{Ge();var $e=et();C(fe=>g($e,fe),[()=>d.file_pdf_next_label()]),s(Pe,$e)},$$slots:{default:!0}})}var de=p(U,2);{let ge=i(()=>e(B)<=.25);Fe(de,{variant:"ghost",size:"compact",get disabled(){return e(ge)},onclick:()=>u(B,Math.max(.25,e(B)-.25),!0),children:(Pe,Xe)=>{Ge();var $e=et();C(fe=>g($e,fe),[()=>d.editor_fileViewer_zoomOut_tooltip()]),s(Pe,$e)},$$slots:{default:!0}})}var J=p(de,2),ee=S(J,!0),ot=p(J,2);{let ge=i(()=>e(B)>=3);Fe(ot,{variant:"ghost",size:"compact",get disabled(){return e(ge)},onclick:()=>u(B,Math.min(3,e(B)+.25),!0),children:(Pe,Xe)=>{Ge();var $e=et();C(fe=>g($e,fe),[()=>d.editor_fileViewer_zoomIn_tooltip()]),s(Pe,$e)},$$slots:{default:!0}})}P(E);var it=p(E,2),Ke=M(it);let Ze;_r(Ke,ge=>u(He,ge),()=>e(He)),P(it),C((ge,Pe,Xe)=>{g(he,ge),g(ee,Pe),rt(it,"aria-busy",e(z)),rt(Ke,"aria-label",Xe),Ze=yt(Ke,"",Ze,{visibility:e(z)?"hidden":"visible"})},[()=>d.file_pdf_page_label({page:Jt(e(W)),total:Jt(e(Q).numPages)}),()=>xr(e(B),{style:"percent"}),()=>d.file_pdf_canvas_ariaLabel({name:ne(),page:Jt(e(W))})]),s(l,y)};re(c,l=>{e(ye)?l(R):e(se)||Ie()?.status==="loading"?l(m,1):e(Q)&&l(w,2)})}P(o),s(Y,o);var Le=Et(Ne);return ie(),Le}const Wa=A.createSelector((Y,x)=>hr(Y.videoPreview.previews,x));var Na=k('<p role="status"> </p>'),Ba=k('<p role="alert"> </p>'),Oa=k('<div class="flex flex-col items-center gap-3 p-6 text-center text-sm text-subtle"><p class="break-all"> </p> <!> <!></div>'),qa=k('<video controls="" preload="metadata" playsinline="" class="max-w-full max-h-full" data-testid="file-video"> </video>',2),Ha=k('<div class="min-h-0 flex-1 flex items-center justify-center bg-background"><!></div>');function Pr(Y,x){if(new.target)return Rt({component:Pr,...Y});zt(x,!0);const Ie=()=>be(He,"$preview",at),[at,ie]=Zt();let $=ae(x,"sourceUrl",7),ne=ae(x,"fileName",7),Ce=ae(x,"allowDownload",7),Se=ae(x,"downloading",7),xe=ae(x,"onDownload",7),_e=O(null);const Q=crypto.randomUUID(),He=Wa(Q),W=i(()=>Ie()?.status==="loading"),B=i(()=>e(_e)??Ie()?.error);let se=!1,z=!1;Ar(()=>{z=!0,A.dispatch(qr(Q))});function Ee(){if(z||e(W))return;const m=$().startsWith("workspace-file://")?new URL($()):null;if(se||!m||!m.pathname.toLowerCase().endsWith(".mp4")){u(_e,"unsupported");return}se=!0,m.searchParams.set("preview","h264"),A.dispatch(Hr(Q,m.hostname,m.toString()))}function We(m){if(z)return;const w=m.currentTarget.error?.code;w===2?u(_e,"network"):w!==1&&Ee()}var ye={get sourceUrl(){return $()},set sourceUrl(m){$(m),oe()},get fileName(){return ne()},set fileName(m){ne(m),oe()},get allowDownload(){return Ce()},set allowDownload(m){Ce(m),oe()},get downloading(){return Se()},set downloading(m){Se(m),oe()},get onDownload(){return xe()},set onDownload(m){xe(m),oe()},$set:Ut,$on:(m,w)=>jt(x,m,w)},De=Ha(),Ne=M(De);{var o=m=>{var w=Oa(),Le=M(w),l=S(Le,!0),y=p(Le,2);{var E=U=>{var de=Na(),J=S(de,!0);C(ee=>g(J,ee),[()=>d.editor_fileViewer_videoPreparing_label()]),s(U,de)},X=U=>{var de=Ba(),J=S(de,!0);C(ee=>g(J,ee),[()=>e(B)==="network"?d.editor_fileViewer_videoLoad_error():d.editor_fileViewer_videoUnsupported_label()]),s(U,de)};re(y,U=>{e(W)?U(E):U(X,-1)})}var le=p(y,2);{var he=U=>{Fe(U,{variant:"secondary",size:"sm",get onclick(){return xe()},get disabled(){return Se()},children:(de,J)=>{Ge();var ee=et();C(ot=>g(ee,ot),[()=>d.layout_fileTab_downloadFile_label()]),s(de,ee)},$$slots:{default:!0}})};re(le,U=>{Ce()&&U(he)})}P(w),C(()=>g(l,ne())),s(m,w)},c=m=>{var w=qa(),Le=S(w,!0);C(l=>{rt(w,"src",Ie()?.url??$()),g(Le,l)},[()=>d.editor_fileViewer_videoUnsupported_label()]),tt("error",w,We),tt("loadedmetadata",w,l=>{l.currentTarget.videoWidth===0&&Ee()}),s(m,w)};re(Ne,m=>{e(B)||e(W)?m(o):m(c,-1)})}P(De),s(Y,De);var R=Et(ye);return ie(),R}var Ka=k('<!> <span class="text-xs text-subtle min-w-[50px] text-center"> </span> <!> <div class="w-px h-5 bg-border mx-1"></div>',1),Xa=k('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="w-px h-5 bg-border mx-1"></div> <!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),Ja=k('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),Ya=k('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path></svg></div> <div class="text-sm text-subtle mb-4"> </div> <audio controls="" class="w-full max-w-md"><source/> </audio></div>'),Ga=k("<!> ",1),Za=k('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg></div> <p class="text-sm text-subtle mb-4"> </p> <!></div>'),Qa=k('<th class="border border-border px-2 py-1 text-left text-xs font-medium bg-muted"> </th>'),eo=k('<td class="border border-border px-2 py-1 text-xs"> </td>'),to=k("<tr></tr>"),ro=k('<div class="flex-1 overflow-auto p-4"><table class="w-full border-collapse"><thead><tr></tr></thead><tbody></tbody></table></div>'),ao=k('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),oo=k('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),io=k('<div class="h-full flex flex-col"><!></div>');function Mt(Y,x){if(new.target)return Rt({component:Mt,...Y});zt(x,!0);const Ie=t=>{var a=Ka(),f=ue(a);{let D=i(()=>d.editor_fileViewer_zoomOut_tooltip());Fe(f,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:de,get title(){return e(D)},children:(T,q)=>{Qe(T,{get icon(){return ya},size:"sm"})},$$slots:{default:!0}})}var _=p(f,2),h=S(_,!0),j=p(_,2);{let D=i(()=>d.editor_fileViewer_zoomIn_tooltip());Fe(j,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:U,get title(){return e(D)},children:(T,q)=>{Qe(T,{get icon(){return Pa},size:"sm"})},$$slots:{default:!0}})}Ge(2),C(()=>g(h,e(Ee))),s(t,a)},at=Sa("FileViewer");let ie=ae(x,"filePath",7),$=ae(x,"fileContent",7,""),ne=ae(x,"sourceUrl",7),Ce=ae(x,"language",7),Se=ae(x,"isBinary",7),xe=ae(x,"allowDownload",7,!0),_e=ae(x,"onDownload",7),Q=ae(x,"downloading",7,!1);const He=t=>{const a=t.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","webp","bmp","ico","avif"].includes(a)?"image":a==="svg"?"svg":["mp4","webm","ogg","mov","avi"].includes(a)?"video":["mp3","wav","ogg","m4a","flac"].includes(a)?"audio":a==="pdf"?"pdf":["md","markdown"].includes(a)?"markdown":a==="json"?"json":a==="csv"?"csv":["yaml","yml"].includes(a)?"yaml":a==="xml"?"xml":["zip","tar","gz","rar","7z","bz2"].includes(a)?"archive":["exe","dll","so","dylib","wasm"].includes(a)?"binary":"text"},W=i(()=>He(ie())),B=i(()=>ie().split("/").pop()||d.editor_fileViewer_unknown_fallback());let se=O(100),z=O(0);const Ee=i(()=>xr(e(se)/100,{style:"percent",maximumFractionDigits:0}));let We=O(!1),ye=O(0),De=O(0),Ne=O(0),o=O(0),c=O(!1),R=null;function m(){const t=R;R=null,u(c,!1),t?.viewport.hasPointerCapture(t.pointerId)&&t.viewport.releasePointerCapture(t.pointerId)}function w(t){if(t.button!==0||!t.isPrimary||R)return;const a=t.currentTarget;a.setPointerCapture(t.pointerId),R={pointerId:t.pointerId,x:t.clientX,y:t.clientY,viewport:a},u(c,!0),t.preventDefault()}function Le(t){if(!(!R||t.pointerId!==R.pointerId)){if((t.buttons&1)===0){m();return}u(Ne,R.viewport.scrollLeft,!0),u(o,R.viewport.scrollTop,!0),u(ye,e(ye)+(t.clientX-R.x)),u(De,e(De)+(t.clientY-R.y)),R.x=t.clientX,R.y=t.clientY}}function l(t){t.pointerId===R?.pointerId&&m()}ke(()=>{ie(),ne(),e(se),e(z),u(Ne,0),u(o,0)}),ke(()=>(ie(),ne(),pr(()=>{m(),u(ye,0),u(De,0)}),m));const y=t=>{const a=t.split(".").pop()?.toLowerCase();return a==="jpg"||a==="jpeg"?"image/jpeg":a==="png"?"image/png":a==="gif"?"image/gif":a==="webp"?"image/webp":"application/octet-stream"},E=t=>{const a=t.split(".").pop()?.toLowerCase();if(a==="mp4")return"video/mp4";if(a==="webm")return"video/webm"},X=()=>{if(ne())return ne();if(typeof $()=="string")return $().startsWith("data:")||$().startsWith("http")?$():Se()?`data:${y(ie())};base64,${$()}`:`data:${y(ie())};base64,${$()}`;if($()instanceof ArrayBuffer){const a=new Uint8Array($()).reduce((_,h)=>_+String.fromCharCode(h),""),f=btoa(a);return`data:${y(ie())};base64,${f}`}return""},le=()=>{if(ne())return ne();const t=E(ie());if(!t)return"";if(typeof $()=="string")return $().startsWith("data:")||$().startsWith("http")?$():`data:${t};base64,${$()}`;const a=new Uint8Array($()),f=[],_=32768;for(let h=0;h<a.length;h+=_)f.push(String.fromCharCode(...a.subarray(h,h+_)));return`data:${t};base64,${btoa(f.join(""))}`},he=()=>{const t=typeof $()=="string"?new TextEncoder().encode($()):new Uint8Array($()),a=[],f=32768;for(let _=0;_<t.length;_+=f)a.push(String.fromCharCode(...t.subarray(_,_+f)));return`data:image/svg+xml;base64,${btoa(a.join(""))}`},U=()=>{u(se,Math.min(e(se)+25,500),!0)},de=()=>{u(se,Math.max(e(se)-25,25),!0)},J=()=>{u(z,(e(z)+90)%360)},ee=()=>{if(!xe()||Q())return;if(_e()){_e()();return}const t=document.createElement("a");t.href=e(W)==="video"?le():e(W)==="svg"?he():X(),t.download=e(B),t.click()},ot=async()=>{try{const t=X(),a=new Image;a.crossOrigin="anonymous";const f=await new Promise((_,h)=>{a.onload=()=>{const j=document.createElement("canvas");j.width=a.naturalWidth,j.height=a.naturalHeight;const D=j.getContext("2d");if(!D){h(new Error("Failed to get canvas context"));return}D.drawImage(a,0,0),j.toBlob(T=>{T?_(T):h(new Error("Failed to create blob from canvas"))},"image/png",1)},a.onerror=()=>h(new Error("Failed to load image")),a.src=t});await navigator.clipboard.write([new ClipboardItem({"image/png":f})]),u(We,!0),setTimeout(()=>u(We,!1),2e3)}catch(t){at.error("Failed to copy image:",t)}},it=t=>{try{const a=JSON.parse(t);return JSON.stringify(a,null,2)}catch{return t}},Ke=t=>t.split(`
2
2
  `).map(f=>f.split(",").map(_=>_.trim()));var Ze={get filePath(){return ie()},set filePath(t){ie(t),oe()},get fileContent(){return $()},set fileContent(t=""){$(t),oe()},get sourceUrl(){return ne()},set sourceUrl(t){ne(t),oe()},get language(){return Ce()},set language(t){Ce(t),oe()},get isBinary(){return Se()},set isBinary(t){Se(t),oe()},get allowDownload(){return xe()},set allowDownload(t=!0){xe(t),oe()},get onDownload(){return _e()},set onDownload(t){_e(t),oe()},get downloading(){return Q()},set downloading(t=!1){Q(t),oe()},$set:Ut,$on:(t,a)=>jt(x,t,a)},ge=io();tt("blur",gr,m);var Pe=M(ge);{var Xe=t=>{var a=Xa(),f=M(a),_=M(f);Ie(_);var h=p(_,2);{let te=i(()=>d.editor_fileViewer_rotate_tooltip());Fe(h,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:J,get title(){return e(te)},children:(we,Te)=>{Qe(we,{get icon(){return wa},size:"sm"})},$$slots:{default:!0}})}var j=p(h,4);{let te=i(()=>d.editor_fileViewer_copyImage_tooltip());Fe(j,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:ot,get title(){return e(te)},children:(we,Te)=>{var ze=je(),Be=ue(ze);{var Vt=Je=>{Qe(Je,{get icon(){return ba},size:"sm",class:"text-green-500"})},pt=Je=>{Qe(Je,{get icon(){return xa},size:"sm"})};re(Be,Je=>{e(We)?Je(Vt):Je(pt,-1)})}s(we,ze)},$$slots:{default:!0}})}var D=p(j,2);{let te=i(()=>!xe()||Q()),we=i(()=>d.editor_fileViewer_download_tooltip());Fe(D,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:ee,get disabled(){return e(te)},get title(){return e(we)},children:(Te,ze)=>{Qe(Te,{get icon(){return Tt},size:"sm"})},$$slots:{default:!0}})}var T=p(D,2),q=S(T,!0);P(f);var L=p(f,2),G=S(L);P(a),C(te=>{g(q,e(B)),or(L,1,`relative min-h-0 flex-1 overflow-auto bg-checkered flex items-center justify-center p-4 select-none ${e(c)?"cursor-grabbing":"cursor-grab"}`,"svelte-1uj35xu"),yt(L,`--pan-scroll-x: ${e(Ne)??""}px; --pan-scroll-y: ${e(o)??""}px;`),rt(G,"src",te),rt(G,"alt",e(B)),yt(G,`translate: ${e(ye)??""}px ${e(De)??""}px; transform: scale(${e(se)/100}) rotate(${e(z)??""}deg); transition: transform 0.2s;`)},[()=>X()]),vt("pointerdown",L,w),vt("pointermove",L,Le),vt("pointerup",L,l),tt("pointercancel",L,l),tt("lostpointercapture",L,l),s(t,a)},$e=t=>{var a=Ja(),f=M(a),_=M(f);Ie(_);var h=p(_,2);{let L=i(()=>!xe()||Q()),G=i(()=>d.editor_fileViewer_download_tooltip());Fe(h,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:ee,get disabled(){return e(L)},get title(){return e(G)},children:(te,we)=>{Qe(te,{get icon(){return Tt},size:"sm"})},$$slots:{default:!0}})}var j=p(h,2),D=S(j,!0);P(f);var T=p(f,2),q=S(T);P(a),C(L=>{g(D,e(B)),or(T,1,`relative min-h-0 flex-1 overflow-auto bg-checkered flex items-center justify-center p-4 select-none ${e(c)?"cursor-grabbing":"cursor-grab"}`,"svelte-1uj35xu"),yt(T,`--pan-scroll-x: ${e(Ne)??""}px; --pan-scroll-y: ${e(o)??""}px;`),rt(q,"src",L),rt(q,"alt",e(B)),yt(q,`translate: ${e(ye)??""}px ${e(De)??""}px; transform: scale(${e(se)/100});`)},[()=>he()]),vt("pointerdown",T,w),vt("pointermove",T,Le),vt("pointerup",T,l),tt("pointercancel",T,l),tt("lostpointercapture",T,l),s(t,a)},fe=t=>{const a=i(le);var f=je(),_=ue(f);mr(_,()=>ie()+e(a),h=>{Pr(h,{get sourceUrl(){return e(a)},get fileName(){return e(B)},get allowDownload(){return xe()},get downloading(){return Q()},onDownload:ee})}),s(t,f)},nt=t=>{var a=Ya(),f=p(M(a),2),_=S(f,!0),h=p(f,2),j=M(h),D=p(j);P(h),P(a),C((T,q)=>{g(_,e(B)),rt(j,"src",T),g(D,` ${q??""}`)},[()=>X(),()=>d.editor_fileViewer_audioUnsupported_label()]),s(t,a)},$t=t=>{var a=Za(),f=p(M(a),2),_=S(f,!0),h=p(f,2);{let j=i(()=>!xe()||Q());Fe(h,{size:"sm",variant:"secondary",onclick:ee,get disabled(){return e(j)},children:(D,T)=>{var q=Ga(),L=ue(q);Qe(L,{get icon(){return Tt},size:"sm",class:"mr-2"});var G=p(L);C(te=>g(G,` ${te??""}`),[()=>d.editor_fileViewer_downloadPdf_label()]),s(D,q)},$$slots:{default:!0}})}P(a),C(j=>g(_,j),[()=>d.editor_fileViewer_pdfUnavailable_label()]),s(t,a)},ct=t=>{{let a=i(()=>it($().toString()));Yt(t,{get value(){return e(a)},language:"json",get fileName(){return ie()},lineNumbers:!0,readOnly:!0})}},ut=t=>{const a=i(()=>Ke($().toString()));var f=ro(),_=M(f),h=M(_),j=M(h);Pt(j,23,()=>e(a)[0]||[],(T,q)=>`header-${q}-${T}`,(T,q)=>{var L=Qa(),G=S(L,!0);C(()=>g(G,e(q))),s(T,L)}),P(j),P(h);var D=p(h);Pt(D,23,()=>e(a).slice(1),(T,q)=>`row-${q}`,(T,q,L)=>{var G=to();Pt(G,23,()=>e(q),(te,we)=>`cell-${e(L)}-${we}`,(te,we)=>{var Te=eo(),ze=S(Te,!0);C(()=>g(ze,e(we))),s(te,Te)}),P(G),s(T,G)}),P(D),P(_),P(f),s(t,f)},kt=t=>{var a=ao(),f=p(M(a),2),_=S(f,!0),h=p(f,2),j=S(h,!0);P(a),C(D=>{g(_,e(B)),g(j,D)},[()=>d.editor_fileViewer_archive_label()]),s(t,a)},Lt=t=>{var a=oo(),f=p(M(a),2),_=S(f,!0),h=p(f,2),j=S(h,!0);P(a),C(D=>{g(_,e(B)),g(j,D)},[()=>d.editor_fileViewer_binary_label()]),s(t,a)},It=t=>{{let a=i(()=>$().toString());Yt(t,{get value(){return e(a)},get language(){return Ce()},get fileName(){return ie()},lineNumbers:!0,highlightActiveLine:!0})}};re(Pe,t=>{e(W)==="image"?t(Xe):e(W)==="svg"?t($e,1):e(W)==="video"?t(fe,2):e(W)==="audio"?t(nt,3):e(W)==="pdf"?t($t,4):e(W)==="json"?t(ct,5):e(W)==="csv"?t(ut,6):e(W)==="archive"?t(kt,7):e(W)==="binary"?t(Lt,8):t(It,-1)})}return P(ge),s(Y,ge),Et(Ze)}Wr(["pointerdown","pointermove","pointerup"]);const no=/access denied|permission denied|outside (?:the )?workspace/i,so=/file not found|no such file or directory/i;function lo(Y){return no.test(Y)?"access-denied":Y===d.files_read_notFound_error()||so.test(Y)?"not-found":"generic"}function co(Y){switch(Y){case"access-denied":return d.layout_fileTab_errorAccessDenied_label();case"not-found":return d.layout_fileTab_errorNotFound_label();case"generic":return d.layout_fileTab_errorGeneric_label()}}var uo=k("<!> <!>",1),fo=k("<!> <!> <!>",1),vo=k('<div class="flex flex-col items-center justify-center h-full text-subtle gap-2"><p> </p> <p class="text-xs"> </p></div>'),fr=k('<div class="flex h-full items-center justify-center p-4 text-subtle"><p role="alert"> </p></div>'),po=k('<div class="flex h-full items-center justify-center text-subtle"><p> </p></div>'),vr=k('<div class="flex items-center justify-center h-full text-subtle"><p> </p></div>'),go=k('<div class="flex items-center gap-3"><!> <!></div>'),mo=k('<div class="flex flex-col h-full"><div class="flex-1 p-4 space-y-2"></div></div>'),_o=k('<p class="text-xs"> </p>'),ho=k("<li><!></li>"),wo=k('<p class="text-xs mt-2"> </p> <ul class="flex flex-col items-center gap-1"></ul>',1),bo=k('<div class="flex flex-col items-center justify-center h-full text-subtle gap-2"><p class="text-danger" role="alert"> </p> <p class="text-xs font-mono"> </p> <!> <!></div>'),xo=k('<div class="flex flex-col items-center justify-center h-full text-subtle gap-3 p-4"><p> </p> <p class="text-xs break-all"> </p> <!></div>'),yo=k('<div class="h-full overflow-auto p-4"><!></div>');function Po(Y,x){if(new.target)return Rt({component:Po,...Y});zt(x,!0);const Ie=()=>be($e,"$workspace",z),at=()=>be(X,"$fileContentStore",z),ie=()=>be(le,"$fileLoadingStore",z),$=()=>be(he,"$fileSavingStore",z),ne=()=>be(U,"$fileErrorStore",z),Ce=()=>be(de,"$fileNotFoundCandidatesStore",z),Se=()=>be(J,"$isFileBinaryStore",z),xe=()=>be(ee,"$isFileDirtyStore",z),_e=()=>be(ot,"$fileLastUpdatedStore",z),Q=()=>be(it,"$ftChanges$",z),He=()=>be(Xe,"$gutterRead$",z),W=()=>be(De,"$lineWrapping",z),B=()=>be(Ne,"$diffIndicators",z),se=()=>be(ge,"$rootMediaPreview",z),[z,Ee]=Zt(),We=r=>{var n=uo(),I=ue(n);{var F=pe=>{var Ve=je(),Oe=ue(Ve);St(Oe,()=>Dt,(ft,_t)=>{_t(ft,{get icon(){return $a},get label(){return e(_)},disabled:!0})}),s(pe,Ve)};re(I,pe=>{!e(te)&&!e(l)&&!e(t)&&pe(F)})}var ve=p(I,2);{var Me=pe=>{{let Ve=i(()=>!e(Ct)||!e(L)),Oe=i(()=>!e(l)&&(!e(Ct)||!e(L)));ja(pe,{embedded:!0,showFold:!1,showSplit:!1,get showPreview(){return e(Ct)},get previewEnabled(){return e(L)},onTogglePreview:()=>u(L,!e(L)),get showWrap(){return e(Ve)},get wrapEnabled(){return W()},onToggleWrap:()=>A.dispatch(Zr()),get showDiff(){return e(Oe)},get diffEnabled(){return B()},onToggleDiff:()=>A.dispatch(Gr())})}};re(ve,pe=>{o().filePath&&!e(te)&&!e(t)&&pe(Me)})}s(r,n)},ye=r=>{var n=je(),I=ue(n);{var F=ve=>{var Me=fo(),pe=ue(Me);{var Ve=Ae=>{var Ye=je(),lt=ue(Ye);{let ht=i(()=>d.layout_fileTab_goToChanges_tooltip());St(lt,()=>Dt,(wt,bt)=>{bt(wt,{get icon(){return Ia},get label(){return e(ht)},onclick:Tr})})}s(Ae,Ye)};re(pe,Ae=>{e(kr)&&Ae(Ve)})}var Oe=p(pe,2);{var ft=Ae=>{var Ye=je(),lt=ue(Ye);{let ht=i(()=>d.layout_fileTab_downloadFile_label()),wt=i(()=>!e(gt)||e(st));St(lt,()=>Dt,(bt,Wt)=>{Wt(bt,{get icon(){return Tt},get label(){return e(ht)},onclick:Ft,get disabled(){return e(wt)}})})}s(Ae,Ye)};re(Oe,Ae=>{e(Be)&&Ae(ft)})}var _t=p(Oe,2);{let Ae=i(()=>d.layout_fileTab_deleteFile_tooltip());St(_t,()=>Dt,(Ye,lt)=>{lt(Ye,{get icon(){return ka},get label(){return e(Ae)},onclick:Mr,destructive:!0})})}s(ve,Me)};re(I,ve=>{o().filePath&&!e(te)&&!e(l)&&ve(F)})}s(r,n)},De=za(),Ne=Ea();let o=ae(x,"tab",7),c=ae(x,"workspaceId",7),R=ae(x,"isActive",7),m=ae(x,"isPanelFocused",7);ke(()=>{const r=c();if(!(!R()||!r||e(w)))return A.dispatch(Kr(r,"files")),()=>A.dispatch(Xr(r,"files"))});const w=i(()=>typeof o().data?.gitRootId=="string"?o().data.gitRootId:void 0),Le=i(()=>typeof o().data?.gitRootPath=="string"?o().data.gitRootPath:void 0),l=i(()=>!!e(w)),y=i(()=>o().filePath?_a(o().filePath,e(w)):o().filePath),E=Nr(e(y));ke(()=>{E.set(e(y))});const X=na(c(),E),le=sa(c(),E),he=la(c(),E),U=da(c(),E),de=ca(c(),E),J=ua(c(),E),ee=dr(c(),E),ot=fa(c(),E),it=va(c()),Ke=ia(),Ze=crypto.randomUUID(),ge=yr(Ze),Pe=`file-gutter:${crypto.randomUUID()}`,Xe=pa(c(),Pe),$e=ga(c()),fe=i(()=>Ie()?.worktreePath||Ie()?.repositoryPath||Ie()?.path||null),nt=i(at),$t=i(ie),ct=i($),ut=i(ne),kt=i(()=>e(ut)?lo(e(ut)):"generic"),Lt=5,It=i(()=>(Ce()??[]).slice(0,Lt)),t=i(Se),a=i(xe),f=i(_e),_=i(()=>e(ct)?d.ui_saveIndicator_saving_tooltip():e(a)?d.ui_saveIndicator_autoSaving_tooltip():d.ui_saveIndicator_saved_tooltip());let h=O(null),j=O(Br([])),D=O(null),T=O(void 0),q=O(void 0),L=O(!0);ke(()=>{const r=o().data?.line,n=o().data?.jumpTimestamp;!r||n!==void 0&&n===e(q)||(u(q,n,!0),u(T,{line:r},!0),u(L,!1))});const G=i(()=>e(w)?cr(o().filePath,e(Le)):null),te=i(()=>e(w)?!e(G):!!(o().filePath&&(Ta(o().filePath)||e(fe)&&Ma(o().filePath,e(fe))))),we=i(()=>o().filePath&&e(fe)?Xt(o().filePath)?o().filePath:`${e(fe)}/${o().filePath}`:null),Te=i(()=>!!o().filePath&&/\.pdf$/i.test(o().filePath)),ze=i(()=>!!o().filePath&&/\.(?:png|jpe?g|gif|webp|mp4|webm)$/i.test(o().filePath)),Be=i(()=>c()&&/^[A-Za-z0-9._-]+$/.test(c())?cr(o().filePath,e(fe)):null),Vt=i(()=>!e(w)&&e(Be)?e(Be).split("/").slice(0,-1).join("/"):void 0),pt=i(()=>e(Te)||e(ze)?e(Be):null),Je=i(()=>e(w)&&e(ze)?{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",mp4:"video/mp4",webm:"video/webm"}[o().filePath?.split(".").pop()?.toLowerCase()??""]:void 0);ke(()=>{if(!R()||!e(w)||!e(G)||!e(Je))return;const r=crypto.randomUUID();return A.dispatch(wr(Ze,r,c(),e(G),{gitRootId:e(w),mimeType:e(Je)})),()=>A.dispatch(br(Ze,r))});let st=O(!1);const gt=i(()=>!!e(Be)&&!e($t)&&(!e(ze)||e(D)===e(Be))),Qt=i(()=>e(D)&&c()?`workspace-file://${c()}/${e(D).split("/").map(encodeURIComponent).join("/")}`:null),At=i(()=>o().filePath?ta(o().filePath):"plaintext"),Ct=i(()=>e(At)==="markdown");ke(()=>{if(!R()||e(Te)||e(w))return;const r=e(pt),n=o().filePath,I=c(),F=o().id;if(u(D,null),!r||!n||!I)return;let ve=!1;const Me=()=>!ve&&c()===I&&o().id===F&&o().filePath===n;return(async()=>{let pe=!1;try{pe=(await ha("file.stat",{workspaceId:I,path:r}))?.isFile===!0}catch{}if(!Me())return;if(pe){u(D,r,!0);return}if(!/\.(?:png|jpe?g|gif|webp|mp4|webm)$/i.test(r)){u(D,r,!0);return}const{candidates:Ve,truncated:Oe}=await Da(I,r);if(Me()){if(!Oe&&Ve.length===1){A.dispatch(ir(I,n,Ve[0],F));return}u(D,r,!0)}})(),()=>{ve=!0}});function $r(r,n){return!!(r.file===n||r.relativePath===n||r.relativePath&&n.endsWith("/"+r.relativePath)||r.file&&n.endsWith("/"+r.file)||r.relativePath&&r.relativePath.endsWith("/"+n)||r.file&&r.file.endsWith("/"+n))}const mt=i(()=>e(l)||!o().filePath?null:Q().find(r=>$r(r,o().filePath))??null),kr=i(()=>!!e(mt));ke(()=>{if(e(l))return;const r=c(),n=o().filePath,I=e(fe);return()=>{if(!r||!n)return;const F=Ht.select(A.state,r,n);if(F?.kind!=="editable-text")return;const ve=qt(F.localContent),Me=dr.select(A.state,r,n),pe=Xt(n)?n:I?`${I}/${n}`:null;Me&&pe&&A.dispatch(nr(r,n,pe,ve))}}),ke(()=>{const r=o().filePath,n=e(we),I=c();if(!R())return;const F=!e(w)&&!!r&&Xt(r)&&!e(fe);r&&I&&!e(te)&&!e(ze)&&!e(Te)&&!F&&(e(w)&&e(G)&&e(y)?A.dispatch(sr(I,e(y),n??r,{gitRoot:{id:e(w),relativePath:e(G)}})):A.dispatch(sr(I,r,n??r)))});function Ir(){return e(nt)??""}function Cr(r){e(l)||e(t)||!o().filePath||!c()||!e(we)||A.dispatch(oa(c(),o().filePath,qt(r)))}function Fr(){if(e(l)||e(t)||!o().filePath||!e(we)||e(nt)===null||e(ct))return;const r=Ht.select(A.state,c(),o().filePath);r?.kind==="editable-text"&&A.dispatch(nr(c(),o().filePath,e(we),qt(r.localContent)))}function Sr(r){const n=o().filePath;!n||!c()||(A.dispatch(aa(c(),n)),A.dispatch(ir(c(),n,r,o().id)))}ke(()=>{const r=o().filePath,n=e(mt);if(!r||!n){u(j,[],!0);return}if(!R())return;const I=c(),F=crypto.randomUUID();return A.dispatch(Jr(I,Pe,F,{kind:"diffs",path:r,staged:n.stage==="staged"})),()=>{A.dispatch(Yr(I,Pe,F))}}),ke(()=>{const r=He(),n=r?.result?.kind==="diffs"?r.result.chunks:[],I=n.find(F=>F.file===o().filePath)??n[0];u(j,I?Ra(I.chunks.map(F=>({oldStart:F.oldStart,oldLines:F.oldLines,newStart:F.newStart,newLines:F.newLines,lines:F.lines.map(ve=>(ve.type===lr.Addition?"+":ve.type===lr.Deletion?"-":" ")+ve.content)}))):[],!0)});function Dr(r){const n=/Mac|iPhone|iPad|iPod/.test(navigator.userAgent),I=Me=>Or(r,La(Me),n);if(I("editor.save")){r.preventDefault(),e(a)&&!e(ct)&&Fr();return}const F=I("editor.undo")?"undo":I("editor.redo")?"redo":I("editor.toggle-task-list")?"toggle-task-list":I("editor.copy")?"copy":I("editor.select-all")?"select-all":null;if(!F||e(l)&&F!=="copy"&&F!=="select-all")return;F!=="toggle-task-list"&&e(h)?.runShortcut(F)&&r.preventDefault()}function Tr(r){if(!o().filePath||!e(mt))return;const n=r?.metaKey||r?.ctrlKey||!1,F=r?.target?.closest("[data-panel-id]")?.getAttribute("data-panel-id")??void 0;A.dispatch(ra(c(),e(mt),{filePath:o().filePath,changeId:e(mt).id,openInAdjacentPanel:n,sourcePanelId:F}))}async function Ft(){const r=e(Be);if(!(e(l)||!r||!c()||!e(gt)||e(st))){u(st,!0);try{const n=await ma(c(),r,e(fe));!n?.success&&!n?.canceled&&Kt.error(n?.error?.message||d.layout_fileTab_downloadFailed_error())}catch{Kt.error(d.layout_fileTab_downloadFailed_error())}finally{u(st,!1)}}}function Mr(){const r=e(we);if(e(l)||!o().filePath||!c()||!r)return;const n=Qr(Ht.select(A.state,c(),o().filePath));if(!n){Kt.error(d.ui_reversibleActions_failed_error({message:d.fileExplorer_tree_undoUnavailable_error()}));return}A.dispatch(ea(c(),o().filePath,{absolutePath:r,tabId:o().id,snapshot:n}))}ke(()=>{if(!Ke||!R())return;const r={isDirty:!e(l)&&e(a),isSaving:!e(l)&&e(ct)};pr(()=>{Ke.registerActions({display:We,actions:ye}),Ke.registerState(r)})});var Rr={get tab(){return o()},set tab(r){o(r),oe()},get workspaceId(){return c()},set workspaceId(r){c(r),oe()},get isActive(){return R()},set isActive(r){R(r),oe()},get isPanelFocused(){return m()},set isPanelFocused(r){m(r),oe()},$set:Ut,$on:(r,n)=>jt(x,r,n)},er=je();tt("keydown",gr,r=>R()&&Dr(r));var Ur=ue(er);{var jr=r=>{var n=je(),I=ue(n);mr(I,()=>o().filePath,F=>{var ve=je(),Me=ue(ve);{var pe=b=>{var v=vo(),V=M(v),H=S(V,!0),N=p(V,2),Re=S(N,!0);P(v),C(Z=>{g(H,Z),g(Re,o().filePath)},[()=>d.layout_fileTab_outsideWorkspace_label()]),s(b,v)},Ve=b=>{var v=je(),V=ue(v);{var H=N=>{Gt(N,{get workspaceId(){return c()},get filePath(){return e(G)},get gitRootId(){return e(w)}})};re(V,N=>{R()&&N(H)})}s(b,v)},Oe=b=>{var v=je(),V=ue(v);{var H=Z=>{var K=fr(),ce=M(K),Ue=S(ce,!0);P(K),C(me=>g(Ue,me),[()=>d.layout_fileTab_errorLoading_label()]),s(Z,K)},N=Z=>{Mt(Z,{get filePath(){return o().filePath},get sourceUrl(){return se().url},allowDownload:!1})},Re=Z=>{var K=po(),ce=M(K),Ue=S(ce,!0);P(K),C(me=>g(Ue,me),[()=>d.layout_fileTab_preparing_label()]),s(Z,K)};re(V,Z=>{se()?.error?Z(H):se()?.url?Z(N,1):Z(Re,-1)})}s(b,v)},ft=b=>{var v=je(),V=ue(v);{var H=N=>{Gt(N,{get workspaceId(){return c()},get filePath(){return e(pt)}})};re(V,N=>{R()&&N(H)})}s(b,v)},_t=b=>{var v=fr(),V=M(v),H=S(V,!0);P(v),C(N=>g(H,N),[()=>d.file_pdf_load_error()]),s(b,v)},Ae=b=>{{let v=i(()=>e(D)??o().filePath),V=i(()=>!e(l)&&e(gt));Mt(b,{get filePath(){return e(v)},get sourceUrl(){return e(Qt)},onDownload:Ft,get allowDownload(){return e(V)},get downloading(){return e(st)}})}},Ye=b=>{var v=vr(),V=M(v),H=S(V,!0);P(v),C(N=>g(H,N),[()=>d.layout_fileTab_preparing_label()]),s(b,v)},lt=b=>{var v=mo(),V=M(v);Pt(V,20,()=>[...Array(20).keys()],H=>H,(H,N)=>{var Re=go(),Z=M(Re);ur(Z,{class:"h-3 w-8 shrink-0"});var K=p(Z,2);ur(K,{class:"h-3",style:`width: ${30+Math.random()*60}%`}),P(Re),s(H,Re)}),P(V),P(v),s(b,v)},ht=b=>{var v=bo(),V=M(v),H=S(V,!0),N=p(V,2),Re=S(N,!0),Z=p(N,2);{var K=me=>{var qe=_o(),dt=S(qe,!0);C(()=>g(dt,e(ut))),s(me,qe)};re(Z,me=>{e(kt)==="generic"&&me(K)})}var ce=p(Z,2);{var Ue=me=>{var qe=wo(),dt=ue(qe),Nt=S(dt,!0),tr=p(dt,2);Pt(tr,20,()=>e(It),xt=>xt,(xt,rr)=>{var Bt=ho(),Er=M(Bt);Fe(Er,{variant:"link",size:"compact",class:"h-auto p-0 font-mono text-xs",onclick:()=>Sr(rr),children:(Lr,$o)=>{Ge();var ar=et();C(()=>g(ar,rr)),s(Lr,ar)},$$slots:{default:!0}}),P(Bt),s(xt,Bt)}),P(tr),C(xt=>g(Nt,xt),[()=>d.layout_fileTab_didYouMean_label()]),s(me,qe)};re(ce,me=>{e(It).length>0&&me(Ue)})}P(v),C(me=>{g(H,me),g(Re,o().filePath)},[()=>co(e(kt))]),s(b,v)},wt=b=>{var v=xo(),V=M(v),H=S(V,!0),N=p(V,2),Re=S(N,!0),Z=p(N,2);{var K=ce=>{{let Ue=i(()=>!e(gt)||e(st));Fe(ce,{variant:"secondary",size:"sm",onclick:Ft,get disabled(){return e(Ue)},children:(me,qe)=>{Ge();var dt=et();C(Nt=>g(dt,Nt),[()=>d.layout_fileTab_downloadFile_label()]),s(me,dt)},$$slots:{default:!0}})}};re(Z,ce=>{!e(l)&&e(Be)&&ce(K)})}P(v),C(ce=>{g(H,ce),g(Re,o().filePath)},[()=>d.editor_fileViewer_binary_label()]),s(b,v)},bt=b=>{const v=i(()=>o().filePath?.toLowerCase().endsWith(".svg"));var V=je(),H=ue(V);{var N=K=>{{let ce=i(()=>o().filePath||""),Ue=i(()=>!e(l)&&e(gt));Mt(K,{get filePath(){return e(ce)},get fileContent(){return e(nt)},get language(){return e(At)},get isBinary(){return e(t)},onDownload:Ft,get allowDownload(){return e(Ue)},get downloading(){return e(st)}})}},Re=K=>{var ce=yo(),Ue=M(ce);Ua(Ue,{get content(){return e(nt)},get workspaceId(){return c()},get relativeMediaBase(){return e(Vt)},renderRichFencesAsCode:!0,renderDiagrams:!0}),P(ce),s(K,ce)},Z=K=>{var ce=Ir,Ue=Cr;{let me=i(()=>B()?e(j):[]);_r(Yt(K,{get value(){return ce()},set value(qe){Ue(qe)},get language(){return e(At)},get readOnly(){return e(l)},get fileName(){return o().filePath},get workspaceId(){return c()},get filePath(){return o().filePath},get lineWrapping(){return W()},get lineChanges(){return e(me)},get jumpTo(){return e(T)},get externalContentVersion(){return e(f)},get isPanelFocused(){return m()}}),qe=>u(h,qe,!0),()=>e(h))}};re(H,K=>{e(v)?K(N):e(Ct)&&e(L)?K(Re,1):K(Z,-1)})}s(b,V)},Wt=b=>{var v=vr(),V=M(v),H=S(V,!0);P(v),C(N=>g(H,N),[()=>d.layout_fileTab_preparing_label()]),s(b,v)};re(Me,b=>{e(te)?b(pe):e(w)&&e(Te)&&e(G)?b(Ve,1):e(w)&&e(ze)?b(Oe,2):e(Te)&&e(pt)?b(ft,3):e(Te)?b(_t,4):e(Qt)?b(Ae,5):e(ze)?b(Ye,6):e($t)?b(lt,7):e(ut)?b(ht,8):e(t)?b(wt,9):e(nt)!==null?b(bt,10):b(Wt,-1)})}s(F,ve)}),s(r,n)};re(Ur,r=>{o().filePath&&r(jr)})}s(Y,er);var zr=Et(Rr);return Ee(),zr}export{Po as default};