@dylanpiercey/work 0.0.183 → 0.0.184

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 (296) hide show
  1. package/dist/index.mjs +990 -849
  2. package/dist/public/assets/{_Crkl6Skq.js → _516BLrGX.js} +1 -1
  3. package/dist/public/assets/_516BLrGX.js.br +0 -0
  4. package/dist/public/assets/{_CbNQNUKM.js → _7ZQ1bcvQ.js} +1 -1
  5. package/dist/public/assets/_7ZQ1bcvQ.js.br +0 -0
  6. package/dist/public/assets/{_BwsKB5-Z.js → _8B0iE3yV.js} +1 -1
  7. package/dist/public/assets/_8B0iE3yV.js.br +0 -0
  8. package/dist/public/assets/{_DFQFAkcY.js → _B9L--yXd.js} +1 -1
  9. package/dist/public/assets/_B9L--yXd.js.br +0 -0
  10. package/dist/public/assets/_B9sH-HZt.js +1 -0
  11. package/dist/public/assets/{_BI3NzIeD.js → _BDHmzVwb.js} +1 -1
  12. package/dist/public/assets/_BDHmzVwb.js.br +0 -0
  13. package/dist/public/assets/_BDmY4omz.js +1 -0
  14. package/dist/public/assets/{_xucbrtDr.js → _BLRHnHr3.js} +1 -1
  15. package/dist/public/assets/_BLRHnHr3.js.br +0 -0
  16. package/dist/public/assets/_BMleZ3T1.js +1 -0
  17. package/dist/public/assets/_BUhDDilJ.js +1 -0
  18. package/dist/public/assets/{_C52cN7xr.js → _BVwXURXV.js} +1 -1
  19. package/dist/public/assets/_BVwXURXV.js.br +0 -0
  20. package/dist/public/assets/_BcCogonw.js +1 -0
  21. package/dist/public/assets/{_BUnC-0z2.js → _Bevux30L.js} +1 -1
  22. package/dist/public/assets/_Bevux30L.js.br +0 -0
  23. package/dist/public/assets/{_BBU3G50d.js → _BkgfbJc9.js} +1 -1
  24. package/dist/public/assets/_BkgfbJc9.js.br +0 -0
  25. package/dist/public/assets/{_DsPXV5im.js → _BpCRM3ny.js} +1 -1
  26. package/dist/public/assets/_BpCRM3ny.js.br +0 -0
  27. package/dist/public/assets/{_CK8tVuZ0.js → _BqLjoHDb.js} +1 -1
  28. package/dist/public/assets/_BqLjoHDb.js.br +0 -0
  29. package/dist/public/assets/{_DETzykGA.js → _Brf3ihv9.js} +1 -1
  30. package/dist/public/assets/_Brf3ihv9.js.br +0 -0
  31. package/dist/public/assets/{_d2nxQoeM.js → _BrhBcHNc.js} +1 -1
  32. package/dist/public/assets/_BrhBcHNc.js.br +0 -0
  33. package/dist/public/assets/_Bss-BVMr.js +1 -0
  34. package/dist/public/assets/_Bu3NOTIR.js +1 -0
  35. package/dist/public/assets/{_Cc7tDhpB.js → _C09s8ys-.js} +1 -1
  36. package/dist/public/assets/_C09s8ys-.js.br +0 -0
  37. package/dist/public/assets/{_CoPIorrk.js → _C0jLRRGd.js} +1 -1
  38. package/dist/public/assets/_C0jLRRGd.js.br +0 -0
  39. package/dist/public/assets/{_EFMHW4T2.js → _C3bY4kl5.js} +1 -1
  40. package/dist/public/assets/_C3bY4kl5.js.br +0 -0
  41. package/dist/public/assets/{_Cgth191z.js → _C5AzS7w_.js} +1 -1
  42. package/dist/public/assets/_C5AzS7w_.js.br +0 -0
  43. package/dist/public/assets/{_CKPJtnFa.js → _C5F2LB0J.js} +1 -1
  44. package/dist/public/assets/_C5F2LB0J.js.br +0 -0
  45. package/dist/public/assets/{_pkb_sa3o.js → _C7bp-lWn.js} +1 -1
  46. package/dist/public/assets/_C7bp-lWn.js.br +0 -0
  47. package/dist/public/assets/{_B2SRh01x.js → _C9ZUrBp_.js} +1 -1
  48. package/dist/public/assets/_C9ZUrBp_.js.br +0 -0
  49. package/dist/public/assets/{_Yq-HZxJ8.js → _CA86wzsA.js} +1 -1
  50. package/dist/public/assets/_CA86wzsA.js.br +0 -0
  51. package/dist/public/assets/{_C7z2L4aH.js → _CCGnzpyE.js} +1 -1
  52. package/dist/public/assets/_CCGnzpyE.js.br +0 -0
  53. package/dist/public/assets/{_Zz1A-chZ.js → _CGSpCxiD.js} +1 -1
  54. package/dist/public/assets/_CGSpCxiD.js.br +0 -0
  55. package/dist/public/assets/{_BeLJIsfj.js → _CKzQAUqk.js} +1 -1
  56. package/dist/public/assets/_CKzQAUqk.js.br +0 -0
  57. package/dist/public/assets/{_Ba7BRaFC.js → _CM5P028Z.js} +1 -1
  58. package/dist/public/assets/_CM5P028Z.js.br +0 -0
  59. package/dist/public/assets/_COVDrgRh.js +1 -0
  60. package/dist/public/assets/{_CgFZfHJK.js → _CPoFjDtz.js} +1 -1
  61. package/dist/public/assets/_CPoFjDtz.js.br +0 -0
  62. package/dist/public/assets/{_CiAnTpkf.js → _CQJ4Ag1g.js} +1 -1
  63. package/dist/public/assets/_CQJ4Ag1g.js.br +0 -0
  64. package/dist/public/assets/{_CjnEjgIF.js → _CRSCK3l6.js} +1 -1
  65. package/dist/public/assets/_CRSCK3l6.js.br +0 -0
  66. package/dist/public/assets/_CV_GGPNN.js +1 -0
  67. package/dist/public/assets/_CVgDVVCO.js +1 -0
  68. package/dist/public/assets/_CVgDVVCO.js.br +0 -0
  69. package/dist/public/assets/{_CWtgW4OP.js → _CYeZAktI.js} +1 -1
  70. package/dist/public/assets/_CYeZAktI.js.br +0 -0
  71. package/dist/public/assets/{_DP2jZK45.js → _C_G8IpBR.js} +1 -1
  72. package/dist/public/assets/_C_G8IpBR.js.br +0 -0
  73. package/dist/public/assets/{_C1dXWTUE.js → _Ca1l-_ve.js} +1 -1
  74. package/dist/public/assets/_Ca1l-_ve.js.br +0 -0
  75. package/dist/public/assets/{_ByEkgEK4.js → _CbL4gBfT.js} +1 -1
  76. package/dist/public/assets/_CbL4gBfT.js.br +0 -0
  77. package/dist/public/assets/_CeAfNPeV.js +1 -0
  78. package/dist/public/assets/{_BFTISaPx.js → _ChhEzrHb.js} +1 -1
  79. package/dist/public/assets/_ChhEzrHb.js.br +0 -0
  80. package/dist/public/assets/{_Rmhe1IFp.js → _CiGlRWH1.js} +1 -1
  81. package/dist/public/assets/_CiPzkiaq.js +1 -0
  82. package/dist/public/assets/{_A4OO-H1Y.js → _Clp7X-2W.js} +1 -1
  83. package/dist/public/assets/_Clp7X-2W.js.br +0 -0
  84. package/dist/public/assets/{_BSF3lsgA.js → _Coeyfi50.js} +1 -1
  85. package/dist/public/assets/_Coeyfi50.js.br +0 -0
  86. package/dist/public/assets/{_KXOQ2BQK.js → _Cooz7Zy5.js} +1 -1
  87. package/dist/public/assets/_Cooz7Zy5.js.br +0 -0
  88. package/dist/public/assets/{_BfYfTBQi.js → _CpTbuk29.js} +1 -1
  89. package/dist/public/assets/_CpTbuk29.js.br +0 -0
  90. package/dist/public/assets/{_HRljMv8j.js → _CrTMxI09.js} +1 -1
  91. package/dist/public/assets/_CrTMxI09.js.br +0 -0
  92. package/dist/public/assets/{_BGCpirN7.js → _CtfgHAJr.js} +1 -1
  93. package/dist/public/assets/_CtfgHAJr.js.br +0 -0
  94. package/dist/public/assets/{_0lpj5jeB.js → _CyuDJO5U.js} +1 -1
  95. package/dist/public/assets/_CyuDJO5U.js.br +0 -0
  96. package/dist/public/assets/{_B4NbIhfe.js → _D0p9tDcD.js} +1 -1
  97. package/dist/public/assets/_D0p9tDcD.js.br +0 -0
  98. package/dist/public/assets/{_DWGPcRW1.js → _D2DUVmrK.js} +1 -1
  99. package/dist/public/assets/_D2DUVmrK.js.br +0 -0
  100. package/dist/public/assets/{_BsO6N6YJ.js → _D2Ka7B62.js} +1 -1
  101. package/dist/public/assets/_D2Ka7B62.js.br +0 -0
  102. package/dist/public/assets/{_DT3Bz3CL.js → _D3P02MlY.js} +1 -1
  103. package/dist/public/assets/_D3P02MlY.js.br +0 -0
  104. package/dist/public/assets/_D6HCkd6p.js +1 -0
  105. package/dist/public/assets/{_CXtv8Onm.js → _DLbTveFp.js} +1 -1
  106. package/dist/public/assets/_DLbTveFp.js.br +0 -0
  107. package/dist/public/assets/_DLolIAvl.js +1 -0
  108. package/dist/public/assets/_DQd-ev5r.js +1 -0
  109. package/dist/public/assets/{_Bi9VXozo.js → _DQoHlXvh.js} +1 -1
  110. package/dist/public/assets/_DQoHlXvh.js.br +0 -0
  111. package/dist/public/assets/_DSrC_h4J.js +1 -0
  112. package/dist/public/assets/{_CTlSi1ki.js → _DWudthM-.js} +1 -1
  113. package/dist/public/assets/_DWudthM-.js.br +0 -0
  114. package/dist/public/assets/{_ayezUhG7.js → _DXpTM9Vi.js} +1 -1
  115. package/dist/public/assets/_DXpTM9Vi.js.br +0 -0
  116. package/dist/public/assets/_DYSr-hH7.js +1 -0
  117. package/dist/public/assets/_DYXqkZWp.js +1 -0
  118. package/dist/public/assets/_Db3SwGry.js +1 -0
  119. package/dist/public/assets/{_B0Q0bDgS.js → _Dipq1vU2.js} +1 -1
  120. package/dist/public/assets/_Dipq1vU2.js.br +0 -0
  121. package/dist/public/assets/{_LmdVTVlm.js → _Dk6CAjdI.js} +1 -1
  122. package/dist/public/assets/_Dk6CAjdI.js.br +0 -0
  123. package/dist/public/assets/{_BAATWcW2.js → _DlJlr59K.js} +1 -1
  124. package/dist/public/assets/_DlJlr59K.js.br +0 -0
  125. package/dist/public/assets/{_BzxiTX2L.js → _Dlo6LkwP.js} +1 -1
  126. package/dist/public/assets/_Dlo6LkwP.js.br +0 -0
  127. package/dist/public/assets/{_Bf2tK2Yw.js → _DpdQcf3B.js} +1 -1
  128. package/dist/public/assets/_DpdQcf3B.js.br +0 -0
  129. package/dist/public/assets/{_DIFtsv4r.js → _DuXWKTn9.js} +1 -1
  130. package/dist/public/assets/_DuXWKTn9.js.br +0 -0
  131. package/dist/public/assets/{_B-ELyoGG.js → _DwaiIOlQ.js} +109 -109
  132. package/dist/public/assets/_DwaiIOlQ.js.br +0 -0
  133. package/dist/public/assets/{_DkWnppK2.js → _Dww-t9cr.js} +1 -1
  134. package/dist/public/assets/_Dww-t9cr.js.br +0 -0
  135. package/dist/public/assets/{_BCrVxcje.js → _Dww6fe2G.js} +1 -1
  136. package/dist/public/assets/_Dww6fe2G.js.br +0 -0
  137. package/dist/public/assets/{_DD_PZ7J3.js → _DxtIw-r7.js} +1 -1
  138. package/dist/public/assets/_DxtIw-r7.js.br +0 -0
  139. package/dist/public/assets/{_njxgl3po.js → _E64Ecc_G.js} +1 -1
  140. package/dist/public/assets/_E64Ecc_G.js.br +0 -0
  141. package/dist/public/assets/{_YcDjrU6g.js → _ECtgMUpC.js} +1 -1
  142. package/dist/public/assets/_ECtgMUpC.js.br +0 -0
  143. package/dist/public/assets/{_D3Fg0PjR.js → _F72-JU90.js} +1 -1
  144. package/dist/public/assets/_F72-JU90.js.br +0 -0
  145. package/dist/public/assets/{_FioQeeis.js → _HHjGgi0e.js} +1 -1
  146. package/dist/public/assets/{_c7XPoH1H.js → _MkFj2NMq.js} +1 -1
  147. package/dist/public/assets/_MkFj2NMq.js.br +0 -0
  148. package/dist/public/assets/{_CaRSveg_.js → _OE_pAv7U.js} +1 -1
  149. package/dist/public/assets/_OE_pAv7U.js.br +0 -0
  150. package/dist/public/assets/{_DekYS_7z.js → _Vcxhd9Me.js} +1 -1
  151. package/dist/public/assets/_Vcxhd9Me.js.br +0 -0
  152. package/dist/public/assets/{_CyuD2cSo.js → _Xe_buWru.js} +8 -8
  153. package/dist/public/assets/_Xe_buWru.js.br +0 -0
  154. package/dist/public/assets/_XqSyea2F.js +1 -0
  155. package/dist/public/assets/_YcAjEuMR.js +1 -0
  156. package/dist/public/assets/{_3R0Y1WMD.js → _atpdpPnT.js} +1 -1
  157. package/dist/public/assets/_atpdpPnT.js.br +0 -0
  158. package/dist/public/assets/{_BhZhrt7H.js → _dpBVLA_i.js} +1 -1
  159. package/dist/public/assets/_dpBVLA_i.js.br +0 -0
  160. package/dist/public/assets/{_ByGyMP8C.js → _e0cRpaOA.js} +1 -1
  161. package/dist/public/assets/_e0cRpaOA.js.br +0 -0
  162. package/dist/public/assets/{_Df2FRCpi.js → _j5K9UQQ0.js} +1 -1
  163. package/dist/public/assets/_j5K9UQQ0.js.br +0 -0
  164. package/dist/public/assets/{_DRu6mEj2.js → _kNFFJLl0.js} +1 -1
  165. package/dist/public/assets/_kNFFJLl0.js.br +0 -0
  166. package/dist/public/assets/{_C8pHc2Wj.js → _lIZw2vRt.js} +1 -1
  167. package/dist/public/assets/_lIZw2vRt.js.br +0 -0
  168. package/dist/public/assets/{_BD0oYdgL.js → _nGKje9l8.js} +1 -1
  169. package/dist/public/assets/_rcvBMPjo.js +1 -0
  170. package/dist/public/assets/{_CT1-HINh.js → _ygR8LCaC.js} +1 -1
  171. package/dist/public/assets/_ygR8LCaC.js.br +0 -0
  172. package/dist/public/assets/{_BhIHAsvd.js → _z5Tp63M6.js} +1 -1
  173. package/dist/public/assets/_z5Tp63M6.js.br +0 -0
  174. package/dist/public/assets/{_Dw3Y8A6V.js → _zEkM9ipN.js} +1 -1
  175. package/dist/public/assets/_zEkM9ipN.js.br +0 -0
  176. package/dist/public/assets/app-page-BEEZP5zo.css +1 -0
  177. package/dist/public/assets/app-page-BEEZP5zo.css.br +0 -0
  178. package/dist/public/assets/{icon-arrow-down-DnflZ5yW.css → icon-arrow-down-o2Q8gX32.css} +1 -1
  179. package/dist/public/assets/icon-arrow-down-o2Q8gX32.css.br +0 -0
  180. package/dist/public/assets/new-C7VSRXTL.js +1 -0
  181. package/dist/public/assets/review-view-CBpY-Hxd.css +1 -0
  182. package/dist/public/assets/review-view-CBpY-Hxd.css.br +0 -0
  183. package/dist/public/assets/review-view-DZAfy74d.js +2 -0
  184. package/dist/public/assets/settings-C7VSRXTL.js +1 -0
  185. package/dist/public/assets/w-C7VSRXTL.js +1 -0
  186. package/dist/public/assets/w._-C7VSRXTL.js +1 -0
  187. package/dist/public/assets/w._-gvNRHjn_.js +1 -0
  188. package/package.json +1 -1
  189. package/dist/public/assets/_0lpj5jeB.js.br +0 -0
  190. package/dist/public/assets/_3R0Y1WMD.js.br +0 -0
  191. package/dist/public/assets/_A4OO-H1Y.js.br +0 -0
  192. package/dist/public/assets/_B-ELyoGG.js.br +0 -0
  193. package/dist/public/assets/_B0Q0bDgS.js.br +0 -0
  194. package/dist/public/assets/_B2SRh01x.js.br +0 -0
  195. package/dist/public/assets/_B3SF7r5U.js +0 -1
  196. package/dist/public/assets/_B4NbIhfe.js.br +0 -0
  197. package/dist/public/assets/_BAATWcW2.js.br +0 -0
  198. package/dist/public/assets/_BBU3G50d.js.br +0 -0
  199. package/dist/public/assets/_BCrVxcje.js.br +0 -0
  200. package/dist/public/assets/_BFTISaPx.js.br +0 -0
  201. package/dist/public/assets/_BGCpirN7.js.br +0 -0
  202. package/dist/public/assets/_BI3NzIeD.js.br +0 -0
  203. package/dist/public/assets/_BKxMrp5F.js +0 -1
  204. package/dist/public/assets/_BMxRolAa.js +0 -1
  205. package/dist/public/assets/_BSF3lsgA.js.br +0 -0
  206. package/dist/public/assets/_BUnC-0z2.js.br +0 -0
  207. package/dist/public/assets/_BV5cuLsP.js +0 -1
  208. package/dist/public/assets/_BV5cuLsP.js.br +0 -0
  209. package/dist/public/assets/_Ba7BRaFC.js.br +0 -0
  210. package/dist/public/assets/_BeLJIsfj.js.br +0 -0
  211. package/dist/public/assets/_Bf2tK2Yw.js.br +0 -0
  212. package/dist/public/assets/_BfYfTBQi.js.br +0 -0
  213. package/dist/public/assets/_BhIHAsvd.js.br +0 -0
  214. package/dist/public/assets/_BhZhrt7H.js.br +0 -0
  215. package/dist/public/assets/_Bi9VXozo.js.br +0 -0
  216. package/dist/public/assets/_Bisf2eEi.js +0 -1
  217. package/dist/public/assets/_BsO6N6YJ.js.br +0 -0
  218. package/dist/public/assets/_BwsKB5-Z.js.br +0 -0
  219. package/dist/public/assets/_ByEkgEK4.js.br +0 -0
  220. package/dist/public/assets/_ByGyMP8C.js.br +0 -0
  221. package/dist/public/assets/_BzxiTX2L.js.br +0 -0
  222. package/dist/public/assets/_C1dXWTUE.js.br +0 -0
  223. package/dist/public/assets/_C3jNzvMK.js +0 -1
  224. package/dist/public/assets/_C52cN7xr.js.br +0 -0
  225. package/dist/public/assets/_C7z2L4aH.js.br +0 -0
  226. package/dist/public/assets/_C8pHc2Wj.js.br +0 -0
  227. package/dist/public/assets/_CFcwMs1E.js +0 -1
  228. package/dist/public/assets/_CK8tVuZ0.js.br +0 -0
  229. package/dist/public/assets/_CKPJtnFa.js.br +0 -0
  230. package/dist/public/assets/_CT1-HINh.js.br +0 -0
  231. package/dist/public/assets/_CTlSi1ki.js.br +0 -0
  232. package/dist/public/assets/_CWtgW4OP.js.br +0 -0
  233. package/dist/public/assets/_CXtv8Onm.js.br +0 -0
  234. package/dist/public/assets/_CaRSveg_.js.br +0 -0
  235. package/dist/public/assets/_CbNQNUKM.js.br +0 -0
  236. package/dist/public/assets/_Cc7tDhpB.js.br +0 -0
  237. package/dist/public/assets/_CcXz3mdH.js +0 -1
  238. package/dist/public/assets/_CgFZfHJK.js.br +0 -0
  239. package/dist/public/assets/_Cgth191z.js.br +0 -0
  240. package/dist/public/assets/_CiAnTpkf.js.br +0 -0
  241. package/dist/public/assets/_CjnEjgIF.js.br +0 -0
  242. package/dist/public/assets/_CoPIorrk.js.br +0 -0
  243. package/dist/public/assets/_CquUiY4g.js +0 -1
  244. package/dist/public/assets/_Crkl6Skq.js.br +0 -0
  245. package/dist/public/assets/_CvMwK8jY.js +0 -1
  246. package/dist/public/assets/_Cy28-KDv.js +0 -1
  247. package/dist/public/assets/_CypTm9dc.js +0 -1
  248. package/dist/public/assets/_CyuD2cSo.js.br +0 -0
  249. package/dist/public/assets/_D3Fg0PjR.js.br +0 -0
  250. package/dist/public/assets/_DD_PZ7J3.js.br +0 -0
  251. package/dist/public/assets/_DETzykGA.js.br +0 -0
  252. package/dist/public/assets/_DFQFAkcY.js.br +0 -0
  253. package/dist/public/assets/_DIFtsv4r.js.br +0 -0
  254. package/dist/public/assets/_DP2jZK45.js.br +0 -0
  255. package/dist/public/assets/_DR0sgJ8w.js +0 -1
  256. package/dist/public/assets/_DRu6mEj2.js.br +0 -0
  257. package/dist/public/assets/_DT3Bz3CL.js.br +0 -0
  258. package/dist/public/assets/_DWGPcRW1.js.br +0 -0
  259. package/dist/public/assets/_DX2meA0b.js +0 -1
  260. package/dist/public/assets/_DcJWk0F2.js +0 -1
  261. package/dist/public/assets/_DekYS_7z.js.br +0 -0
  262. package/dist/public/assets/_Df2FRCpi.js.br +0 -0
  263. package/dist/public/assets/_DkWnppK2.js.br +0 -0
  264. package/dist/public/assets/_DnObjRuf.js +0 -1
  265. package/dist/public/assets/_DriBHAVU.js +0 -1
  266. package/dist/public/assets/_DrwSFCN4.js +0 -1
  267. package/dist/public/assets/_DsPXV5im.js.br +0 -0
  268. package/dist/public/assets/_Dw3Y8A6V.js.br +0 -0
  269. package/dist/public/assets/_EFMHW4T2.js.br +0 -0
  270. package/dist/public/assets/_HRljMv8j.js.br +0 -0
  271. package/dist/public/assets/_KXOQ2BQK.js.br +0 -0
  272. package/dist/public/assets/_LKaW_wke.js +0 -1
  273. package/dist/public/assets/_LmdVTVlm.js.br +0 -0
  274. package/dist/public/assets/_YcDjrU6g.js.br +0 -0
  275. package/dist/public/assets/_Yq-HZxJ8.js.br +0 -0
  276. package/dist/public/assets/_Zz1A-chZ.js.br +0 -0
  277. package/dist/public/assets/_ayezUhG7.js.br +0 -0
  278. package/dist/public/assets/_c7XPoH1H.js.br +0 -0
  279. package/dist/public/assets/_d2nxQoeM.js.br +0 -0
  280. package/dist/public/assets/_ee8ndpx4.js +0 -1
  281. package/dist/public/assets/_j7obVzPU.js +0 -1
  282. package/dist/public/assets/_njxgl3po.js.br +0 -0
  283. package/dist/public/assets/_p9dnp59X.js +0 -1
  284. package/dist/public/assets/_pkb_sa3o.js.br +0 -0
  285. package/dist/public/assets/_xucbrtDr.js.br +0 -0
  286. package/dist/public/assets/app-page-rXnZguHI.css +0 -1
  287. package/dist/public/assets/app-page-rXnZguHI.css.br +0 -0
  288. package/dist/public/assets/icon-arrow-down-DnflZ5yW.css.br +0 -0
  289. package/dist/public/assets/new-NqoOGnBo.js +0 -1
  290. package/dist/public/assets/review-view-CGsWDCd7.js +0 -2
  291. package/dist/public/assets/review-view-DY0OU8Te.css +0 -1
  292. package/dist/public/assets/review-view-DY0OU8Te.css.br +0 -0
  293. package/dist/public/assets/settings-NqoOGnBo.js +0 -1
  294. package/dist/public/assets/w-NqoOGnBo.js +0 -1
  295. package/dist/public/assets/w._-BYRqNEuI.js +0 -1
  296. package/dist/public/assets/w._-NqoOGnBo.js +0 -1
@@ -1,7 +1,7 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_CaRSveg_.js","assets/_BV5cuLsP.js","assets/_DM-ium3T.js","assets/icon-arrow-down-DnflZ5yW.css","assets/_DFQFAkcY.js","assets/_DWGPcRW1.js","assets/_ByGyMP8C.js","assets/_DkWnppK2.js","assets/_DETzykGA.js","assets/_ayezUhG7.js","assets/_BfYfTBQi.js","assets/_ByEkgEK4.js","assets/_CKPJtnFa.js","assets/_Cc7tDhpB.js","assets/_BwsKB5-Z.js","assets/_BXeXVLqQ.js","assets/_C52cN7xr.js","assets/_EFMHW4T2.js","assets/_FioQeeis.js","assets/_Bf2tK2Yw.js","assets/_YkIvmgMd.js","assets/_bTVj8UrX.js","assets/_BeLJIsfj.js","assets/_BAfg1_wL.js","assets/_gzcpVVnB.js","assets/_BAATWcW2.js","assets/_C1dXWTUE.js","assets/_DekYS_7z.js","assets/_njxgl3po.js","assets/_DP2jZK45.js","assets/_BBU3G50d.js","assets/_0lpj5jeB.js","assets/_DsPXV5im.js","assets/_Dw3Y8A6V.js","assets/_Ba7BRaFC.js","assets/_C8pHc2Wj.js","assets/_Df2FRCpi.js","assets/_DD_PZ7J3.js","assets/_YcDjrU6g.js","assets/_HRljMv8j.js","assets/_BGCpirN7.js","assets/_Zz1A-chZ.js","assets/_LmdVTVlm.js","assets/_BaHq4SXp.js","assets/_BYOwaDjH.js","assets/_CQJs3lWb.js","assets/_CYNrtFtB.js","assets/_DmIc4jLQ.js","assets/_DbYA3moe.js","assets/_CBce3t8t.js","assets/_DYvRD3hg.js","assets/_Dl-2e7rI.js","assets/_woXpYk--.js","assets/_Rmhe1IFp.js","assets/_CiAnTpkf.js","assets/_A4OO-H1Y.js","assets/_KXOQ2BQK.js","assets/_Crkl6Skq.js","assets/_CTlSi1ki.js","assets/_BCrVxcje.js","assets/_Dx-8-gkx.js","assets/_DekxQCZG.js","assets/_C8oCnwJJ.js","assets/_BSF3lsgA.js","assets/_Cgth191z.js","assets/_C7z2L4aH.js","assets/_CgFZfHJK.js","assets/_BUnC-0z2.js","assets/_DIFtsv4r.js","assets/_DRu6mEj2.js","assets/_CT1-HINh.js","assets/_CoPIorrk.js","assets/_BhZhrt7H.js","assets/_DVTAwKKz.js","assets/_d2nxQoeM.js","assets/_DWQbgPoS.js","assets/_DJMQeKeT.js","assets/_CbNQNUKM.js","assets/_BI3NzIeD.js","assets/_CXtv8Onm.js","assets/_DqKBuwfJ.js","assets/_oqKa8noW.js","assets/_CnvKMtbv.js","assets/_IyjqRm3v.js","assets/_rLFTqkRN.js","assets/_CacY0gHj.js","assets/_B5eOa1yu.js","assets/_Dixweg8N.js","assets/_D1A_Heim.js","assets/_O90oeIOV.js","assets/_B2SRh01x.js","assets/_DOwzaHZ0.js","assets/_B3gFvitq.js","assets/_Cfkwpbl8.js","assets/_BiFt_7mu.js","assets/_CMLA9XwU.js","assets/_BFTISaPx.js","assets/_c7XPoH1H.js","assets/_CjnEjgIF.js","assets/_B0Q0bDgS.js","assets/_D3Fg0PjR.js","assets/_Bj61d0ZC.js","assets/_B4NbIhfe.js","assets/_DB-OQ-9y.js","assets/_Cvrh5tZx.js","assets/_BD0oYdgL.js","assets/_Bi9VXozo.js","assets/_L8AbGenz.js","assets/_ByJddavk.js","assets/_pkb_sa3o.js","assets/_CWtgW4OP.js","assets/_xucbrtDr.js","assets/_Yq-HZxJ8.js","assets/_BzxiTX2L.js","assets/_BhIHAsvd.js","assets/_BsO6N6YJ.js","assets/_qdxAdBWQ.js","assets/_Ci_nEsc7.js","assets/_CYpm1nAK.js","assets/_BNLmms1o.js","assets/_CCSX75yM.js","assets/_CyEgAFGc.js","assets/_Dh5ihWbf.js","assets/_B2gwz-sJ.js","assets/_3R0Y1WMD.js","assets/_DT3Bz3CL.js","assets/_CK8tVuZ0.js","assets/_B6D30XZt.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,$t as t,A as n,An as r,At as i,B as a,C as o,Ct as s,D as c,Dn as l,Dt as u,E as d,Et as f,F as p,Ft as m,G as h,H as g,I as _,It as v,J as y,Jt as b,K as x,L as S,M as C,N as w,Nt as T,O as E,On as D,Ot as ee,P as O,Q as te,Qt as ne,R as k,S as re,St as ie,T as ae,Tt as oe,U as se,Ut as ce,V as le,Vt as ue,W as de,Wt as fe,X as pe,Xt as me,Y as he,Yt as ge,Z as _e,Zt as ve,_t as ye,a as be,an as xe,b as Se,bn as Ce,bt as we,c as Te,ct as Ee,d as De,dt as Oe,et as ke,f as Ae,ft as je,gt as Me,h as Ne,ht as Pe,i as Fe,in as Ie,it as Le,j as Re,k as ze,kn as Be,kt as Ve,m as He,mt as Ue,n as We,nt as Ge,o as Ke,on as qe,p as Je,pt as Ye,q as Xe,r as Ze,rn as Qe,rt as $e,s as et,sn as tt,st as nt,t as rt,tt as it,u as at,ut as ot,v as st,vn as ct,vt as lt,w as ut,wt as dt,x as ft,xt as pt,y as mt,yt as A,z as ht}from"./_BV5cuLsP.js";import{A as gt,B as _t,C as vt,D as yt,E as bt,F as xt,G as St,H as j,I as Ct,L as M,M as N,N as P,O as wt,P as Tt,R as F,T as Et,V as I,W as Dt,_ as L,a as R,b as Ot,c as kt,d as At,f as jt,g as Mt,i as z,l as Nt,n as Pt,r as Ft,t as B,u as It,v as V,x as Lt,y as H,z as U}from"./_DM-ium3T.js";var Rt=`diffs-container`,zt=(()=>{try{return!1}catch{return!1}})(),Bt=/(?=^From [a-f0-9]+ .+$)/m,Vt=/(?=^diff --git)/gm,Ht=/(?<=\n)/,Ut=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Wt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Gt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Kt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,qt=`header-prefix`,Jt=`header-filename-suffix`,Yt=`header-metadata`,Xt=`header-custom`,Zt={dark:`pierre-dark`,light:`pierre-light`},Qt=`data-theme-css`,$t=`data-unsafe-css`,en=`data-diffs-scrollbar-measure`,tn=`data-diffs-code-view-header`,nn=`data-diffs-code-view-footer`,rn=`--diffs-scrollbar-gutter-measured`,an=1e5,on={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},sn={...on,hunkLineCount:1},cn={paddingTop:8,paddingBottom:8,gap:8},ln={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},un=Object.freeze({fromStart:0,fromEnd:0}),dn={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},fn={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},pn=new Map,mn=new Map,hn=new Map,gn=new Set;function _n(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!gn.has(t))return!1;return!0}function vn(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(gn.has(n.name))continue;let e=pn.get(n.name);e??(e=n,pn.set(n.name,e));let r=e.data.find(t=>t.name===e.name||t.aliases?.includes(e.name)===!0);if(r==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${e.name}" as its name or an alias.`);t.loadLanguageSync(e.data);try{t.getLanguage(e.name)}catch{throw Error(`attachResolvedLanguages: "${r.name}" is already loaded without alias "${e.name}". Load the alias first or give the grammar a unique name.`)}gn.add(e.name)}}function yn(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var bn=Object.defineProperty,xn=Object.getOwnPropertyDescriptor,Sn=Object.getOwnPropertyNames,Cn=Object.prototype.hasOwnProperty,wn=(e,t)=>{let n={};for(var r in e)bn(n,r,{get:e[r],enumerable:!0});return t||bn(n,Symbol.toStringTag,{value:`Module`}),n},Tn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Sn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Cn.call(e,s)&&s!==n&&bn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=xn(t,s))||r.enumerable});return e},En=(e,t,n)=>(Tn(e,t,`default`),n&&Tn(n,t,`default`)),Dn=[{id:`abap`,name:`ABAP`,import:(()=>B(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>B(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>B(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>B(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>B(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>B(()=>import(`./_CaRSveg_.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>B(()=>import(`./_DkWnppK2.js`),__vite__mapDeps([7,0,1,2,3,4,5,6,8])))},{id:`apache`,name:`Apache Conf`,import:(()=>B(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>B(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>B(()=>import(`./_ayezUhG7.js`),__vite__mapDeps([9,5,1,2,3,6,4,10,11,12])))},{id:`applescript`,name:`AppleScript`,import:(()=>B(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>B(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>B(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>B(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>B(()=>import(`./_Cc7tDhpB.js`),__vite__mapDeps([13,5,1,2,3,6,12,14,15,16])))},{id:`awk`,name:`AWK`,import:(()=>B(()=>import(`./_BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>B(()=>import(`./_B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>B(()=>import(`./_qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>B(()=>import(`./_D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>B(()=>import(`./_DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>B(()=>import(`./_Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>B(()=>import(`./_CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>B(()=>import(`./_CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>B(()=>import(`./_EFMHW4T2.js`),__vite__mapDeps([17,5,1,2,3,6,4,10,11,12,18,19])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>B(()=>import(`./_YkIvmgMd.js`),__vite__mapDeps([20,21])))},{id:`c`,name:`C`,import:(()=>B(()=>import(`./_BeLJIsfj.js`).then(e=>e.n),__vite__mapDeps([22,1,2,3])))},{id:`c3`,name:`C3`,import:(()=>B(()=>import(`./_D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>B(()=>import(`./_CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>B(()=>import(`./_BAfg1_wL.js`),__vite__mapDeps([23,24])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>B(()=>import(`./_BAATWcW2.js`),__vite__mapDeps([25,22,1,2,3])))},{id:`clarity`,name:`Clarity`,import:(()=>B(()=>import(`./_CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>B(()=>import(`./_DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>B(()=>import(`./_Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>B(()=>import(`./_C1dXWTUE.js`),__vite__mapDeps([26,4,1,2,3,5,6,11])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>B(()=>import(`./_C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>B(()=>import(`./_oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>B(()=>import(`./_DekYS_7z.js`),__vite__mapDeps([27,5,1,2,3])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>B(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>B(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>B(()=>import(`./_njxgl3po.js`).then(e=>e.n),__vite__mapDeps([28,1,2,3,29,30,22])))},{id:`crystal`,name:`Crystal`,import:(()=>B(()=>import(`./_0lpj5jeB.js`),__vite__mapDeps([31,5,1,2,3,6,4,19,22,32])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>B(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>B(()=>import(`./_ByGyMP8C.js`).then(e=>e.n),__vite__mapDeps([6,1,2,3])))},{id:`csv`,name:`CSV`,import:(()=>B(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>B(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>B(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>B(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>B(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>B(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>B(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>B(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>B(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>B(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>B(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>B(()=>import(`./_Dw3Y8A6V.js`),__vite__mapDeps([33,4,1,2,3,5,6,14,18])))},{id:`elixir`,name:`Elixir`,import:(()=>B(()=>import(`./_Ba7BRaFC.js`),__vite__mapDeps([34,4,1,2,3,5,6])))},{id:`elm`,name:`Elm`,import:(()=>B(()=>import(`./_C8pHc2Wj.js`),__vite__mapDeps([35,30,1,2,3,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>B(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>B(()=>import(`./_Df2FRCpi.js`),__vite__mapDeps([36,4,1,2,3,5,6,37,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>B(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([43,44])))},{id:`fennel`,name:`Fennel`,import:(()=>B(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>B(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>B(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>B(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([45,46])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>B(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>B(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([47,44])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>B(()=>import(`./_DbYA3moe.js`),__vite__mapDeps([48,49,50])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>B(()=>import(`./_DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>B(()=>import(`./_CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>B(()=>import(`./_CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>B(()=>import(`./_DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>B(()=>import(`./_Dl-2e7rI.js`),__vite__mapDeps([51,52])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>B(()=>import(`./_Rmhe1IFp.js`),__vite__mapDeps([53,32,1,2,3])))},{id:`gleam`,name:`Gleam`,import:(()=>B(()=>import(`./_CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>B(()=>import(`./_CiAnTpkf.js`),__vite__mapDeps([54,5,1,2,3,6,4,14])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>B(()=>import(`./_A4OO-H1Y.js`),__vite__mapDeps([55,5,1,2,3,6,4,14])))},{id:`glsl`,name:`GLSL`,import:(()=>B(()=>import(`./_BBU3G50d.js`).then(e=>e.n),__vite__mapDeps([30,1,2,3,22])))},{id:`gn`,name:`GN`,import:(()=>B(()=>import(`./_ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>B(()=>import(`./_7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>B(()=>import(`./_rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>B(()=>import(`./_HRljMv8j.js`).then(e=>e.n),__vite__mapDeps([39,1,2,3,5,14,16,40])))},{id:`groovy`,name:`Groovy`,import:(()=>B(()=>import(`./_CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>B(()=>import(`./_KXOQ2BQK.js`),__vite__mapDeps([56,4,1,2,3,5,6,19])))},{id:`haml`,name:`Ruby Haml`,import:(()=>B(()=>import(`./_YcDjrU6g.js`).then(e=>e.n),__vite__mapDeps([38,1,2,3,5,6])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>B(()=>import(`./_Crkl6Skq.js`),__vite__mapDeps([57,5,1,2,3,6,4,42])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>B(()=>import(`./_D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>B(()=>import(`./_C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>B(()=>import(`./_Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>B(()=>import(`./_CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>B(()=>import(`./_Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>B(()=>import(`./_DFQFAkcY.js`).then(e=>e.n),__vite__mapDeps([4,1,2,3,5,6])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>B(()=>import(`./_FioQeeis.js`),__vite__mapDeps([18,4,1,2,3,5,6])))},{id:`http`,name:`HTTP`,import:(()=>B(()=>import(`./_CTlSi1ki.js`),__vite__mapDeps([58,10,1,2,3,11,12,32,39,5,14,16,40])))},{id:`hurl`,name:`Hurl`,import:(()=>B(()=>import(`./_BCrVxcje.js`),__vite__mapDeps([59,10,1,2,3,11,60,39,5,14,16,40])))},{id:`hxml`,name:`HXML`,import:(()=>B(()=>import(`./_DekxQCZG.js`),__vite__mapDeps([61,62])))},{id:`hy`,name:`Hy`,import:(()=>B(()=>import(`./_CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>B(()=>import(`./_DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>B(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>B(()=>import(`./_ByEkgEK4.js`).then(e=>e.n),__vite__mapDeps([11,1,2,3])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>B(()=>import(`./_DWGPcRW1.js`).then(e=>e.n),__vite__mapDeps([5,1,2,3])))},{id:`jinja`,name:`Jinja`,import:(()=>B(()=>import(`./_BSF3lsgA.js`),__vite__mapDeps([63,4,1,2,3,5,6])))},{id:`jison`,name:`Jison`,import:(()=>B(()=>import(`./_Cgth191z.js`),__vite__mapDeps([64,5,1,2,3])))},{id:`json`,name:`JSON`,import:(()=>B(()=>import(`./_CKPJtnFa.js`).then(e=>e.n),__vite__mapDeps([12,1,2,3])))},{id:`json5`,name:`JSON5`,import:(()=>B(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>B(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>B(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>B(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>B(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>B(()=>import(`./_BGCpirN7.js`).then(e=>e.n),__vite__mapDeps([40,1,2,3])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>B(()=>import(`./_C7z2L4aH.js`),__vite__mapDeps([65,5,1,2,3,19,24,28,29,30,22,66])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>B(()=>import(`./_BUnC-0z2.js`),__vite__mapDeps([67,5,1,2,3,14,24,32,37,6,4,10,11,19,22,28,29,30,38,39,16,40,41,42,68])))},{id:`kdl`,name:`KDL`,import:(()=>B(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>B(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>B(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>B(()=>import(`./_DRu6mEj2.js`),__vite__mapDeps([69,70,1,2,3,66])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>B(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>B(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>B(()=>import(`./_CoPIorrk.js`),__vite__mapDeps([71,5,1,2,3,6,4,12])))},{id:`llvm`,name:`LLVM IR`,import:(()=>B(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>B(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>B(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>B(()=>import(`./_Zz1A-chZ.js`).then(e=>e.n),__vite__mapDeps([41,1,2,3,22])))},{id:`luau`,name:`Luau`,import:(()=>B(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>B(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>B(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>B(()=>import(`./_BhZhrt7H.js`),__vite__mapDeps([72,6,1,2,3,8,14,73])))},{id:`matlab`,name:`MATLAB`,import:(()=>B(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>B(()=>import(`./_d2nxQoeM.js`),__vite__mapDeps([74,18,4,1,2,3,5,6,42,44])))},{id:`mdx`,name:`MDX`,import:(()=>B(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>B(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>B(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>B(()=>import(`./_fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>B(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>B(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>B(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>B(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([75,76])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>B(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>B(()=>import(`./_CbNQNUKM.js`),__vite__mapDeps([77,41,1,2,3,22])))},{id:`nim`,name:`Nim`,import:(()=>B(()=>import(`./_BI3NzIeD.js`),__vite__mapDeps([78,5,1,2,3,6,4,10,11,22,30,44])))},{id:`nix`,name:`Nix`,import:(()=>B(()=>import(`./_IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>B(()=>import(`./_CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>B(()=>import(`./_DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>B(()=>import(`./_D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>B(()=>import(`./_BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>B(()=>import(`./_O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>B(()=>import(`./_B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>B(()=>import(`./_BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>B(()=>import(`./_CXtv8Onm.js`),__vite__mapDeps([79,5,1,2,3,6,4,8,11,10,12,14,16,19,22,24,80,27,29,28,30,32,81,82,52,83,34,41,42,37,38,39,40,44,43,51,53,84,85,86,66,68,69,70,73,87,78,88,89,90,91,92,93,94,95,96])))},{id:`pascal`,name:`Pascal`,import:(()=>B(()=>import(`./_4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>B(()=>import(`./_DIFtsv4r.js`),__vite__mapDeps([68,5,1,2,3,6,4,10,11,19])))},{id:`php`,name:`PHP`,import:(()=>B(()=>import(`./_B2SRh01x.js`),__vite__mapDeps([90,5,1,2,3,6,4,10,11,12,19])))},{id:`pkl`,name:`Pkl`,import:(()=>B(()=>import(`./_ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>B(()=>import(`./_DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>B(()=>import(`./_BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>B(()=>import(`./_C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>B(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>B(()=>import(`./_DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>B(()=>import(`./_CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>B(()=>import(`./_DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>B(()=>import(`./_iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>B(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>B(()=>import(`./_c7XPoH1H.js`),__vite__mapDeps([97,5,1,2,3,6,4])))},{id:`puppet`,name:`Puppet`,import:(()=>B(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>B(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>B(()=>import(`./_gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>B(()=>import(`./_CjnEjgIF.js`),__vite__mapDeps([98,5,1,2,3])))},{id:`qmldir`,name:`QML Directory`,import:(()=>B(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>B(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>B(()=>import(`./_CgFZfHJK.js`).then(e=>e.n),__vite__mapDeps([66,1,2,3])))},{id:`racket`,name:`Racket`,import:(()=>B(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>B(()=>import(`./_B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>B(()=>import(`./_B0Q0bDgS.js`),__vite__mapDeps([99,4,1,2,3,5,6,81])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>B(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>B(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>B(()=>import(`./_DP2jZK45.js`).then(e=>e.n),__vite__mapDeps([29,1,2,3])))},{id:`rel`,name:`Rel`,import:(()=>B(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>B(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>B(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>B(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>B(()=>import(`./_D3Fg0PjR.js`),__vite__mapDeps([100,5,1,2,3,18,4,6,24,101,28,29,30,22,32,42,37,10,11,19,38,39,14,16,40,41])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>B(()=>import(`./_DD_PZ7J3.js`),__vite__mapDeps([37,5,1,2,3,6,4,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>B(()=>import(`./_Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>B(()=>import(`./_B4NbIhfe.js`),__vite__mapDeps([102,19,1,2,3])))},{id:`sass`,name:`Sass`,import:(()=>B(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>B(()=>import(`./_BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>B(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>B(()=>import(`./_DETzykGA.js`).then(e=>e.n),__vite__mapDeps([8,1,2,3,6])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>B(()=>import(`./_bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>B(()=>import(`./_DB-OQ-9y.js`),__vite__mapDeps([103,104])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>B(()=>import(`./_DsPXV5im.js`).then(e=>e.n),__vite__mapDeps([32,1,2,3])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>B(()=>import(`./_BD0oYdgL.js`),__vite__mapDeps([105,32,1,2,3])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>B(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>B(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>B(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>B(()=>import(`./_Bi9VXozo.js`),__vite__mapDeps([106,4,1,2,3,5,6])))},{id:`sparql`,name:`SPARQL`,import:(()=>B(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([107,108])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>B(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>B(()=>import(`./_Bf2tK2Yw.js`).then(e=>e.n),__vite__mapDeps([19,1,2,3])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>B(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>B(()=>import(`./_pkb_sa3o.js`),__vite__mapDeps([109,19,1,2,3])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>B(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>B(()=>import(`./_CWtgW4OP.js`),__vite__mapDeps([110,5,1,2,3])))},{id:`svelte`,name:`Svelte`,import:(()=>B(()=>import(`./_xucbrtDr.js`),__vite__mapDeps([111,5,1,2,3,6,14,15])))},{id:`swift`,name:`Swift`,import:(()=>B(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>B(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>B(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>B(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>B(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>B(()=>import(`./_CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>B(()=>import(`./_Yq-HZxJ8.js`),__vite__mapDeps([112,5,1,2,3,6,84])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>B(()=>import(`./_DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>B(()=>import(`./_CT1-HINh.js`).then(e=>e.n),__vite__mapDeps([70,1,2,3,66])))},{id:`toml`,name:`TOML`,import:(()=>B(()=>import(`./_CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>B(()=>import(`./_BzxiTX2L.js`),__vite__mapDeps([113,5,1,2,3,6,4,10,11,14,19,30,22])))},{id:`tsv`,name:`TSV`,import:(()=>B(()=>import(`./_sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>B(()=>import(`./_C52cN7xr.js`).then(e=>e.n),__vite__mapDeps([16,1,2,3])))},{id:`turtle`,name:`Turtle`,import:(()=>B(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>B(()=>import(`./_BhIHAsvd.js`),__vite__mapDeps([114,5,1,2,3,6,8,24,37,4,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42,90,12])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>B(()=>import(`./_BwsKB5-Z.js`).then(e=>e.n),__vite__mapDeps([14,1,2,3])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>B(()=>import(`./_BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>B(()=>import(`./_BsO6N6YJ.js`),__vite__mapDeps([115,5,1,2,3,6,4,8,11,10,12,14,16,116,117,19,22,24,80,27,29,28,30,32,81,82,52,83,34,41,42,37,38,39,40,44,43,47,51,53,84,85,57,86,118,66,65,68,69,70,73,119,87,88,90,91,92,93,94,96,120,97,121,122,114,123])))},{id:`v`,name:`V`,import:(()=>B(()=>import(`./_DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>B(()=>import(`./_zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>B(()=>import(`./_DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>B(()=>import(`./_B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>B(()=>import(`./_BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>B(()=>import(`./_DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>B(()=>import(`./_3R0Y1WMD.js`),__vite__mapDeps([124,5,1,2,3,6,4,12,14,18])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>B(()=>import(`./_DT3Bz3CL.js`),__vite__mapDeps([125,5,1,2,3])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>B(()=>import(`./_CK8tVuZ0.js`),__vite__mapDeps([126,5,1,2,3,6,8,15,73,127])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>B(()=>import(`./_CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>B(()=>import(`./_ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>B(()=>import(`./_C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>B(()=>import(`./_BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>B(()=>import(`./_ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>B(()=>import(`./_DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>B(()=>import(`./_DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>B(()=>import(`./_BfYfTBQi.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,11])))},{id:`xsl`,name:`XSL`,import:(()=>B(()=>import(`./_BFTISaPx.js`),__vite__mapDeps([96,10,1,2,3,11])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>B(()=>import(`./_LmdVTVlm.js`).then(e=>e.n),__vite__mapDeps([42,1,2,3])))},{id:`zenscript`,name:`ZenScript`,import:(()=>B(()=>import(`./_BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>B(()=>import(`./_CMLA9XwU.js`),[]))}],On=Object.fromEntries(Dn.map(e=>[e.id,e.import])),kn=Object.fromEntries(Dn.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),An={...On,...kn},jn=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>B(()=>import(`./_vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>B(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>B(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>B(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>B(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>B(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>B(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>B(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>B(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>B(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>B(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>B(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>B(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>B(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>B(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>B(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>B(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>B(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>B(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>B(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>B(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>B(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>B(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>B(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>B(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>B(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>B(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>B(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>B(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>B(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>B(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>B(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>B(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>B(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>B(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>B(()=>import(`./_Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>B(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>B(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>B(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>B(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>B(()=>import(`./_BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>B(()=>import(`./_DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>B(()=>import(`./_B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>B(()=>import(`./_DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>B(()=>import(`./_eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>B(()=>import(`./_Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>B(()=>import(`./_CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>B(()=>import(`./_D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>B(()=>import(`./_DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>B(()=>import(`./_DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>B(()=>import(`./_DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>B(()=>import(`./_aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>B(()=>import(`./_8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>B(()=>import(`./_DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>B(()=>import(`./_DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>B(()=>import(`./_B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>B(()=>import(`./_4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>B(()=>import(`./_UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>B(()=>import(`./_C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>B(()=>import(`./_nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>B(()=>import(`./_oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>B(()=>import(`./_DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>B(()=>import(`./_fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>B(()=>import(`./_BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>B(()=>import(`./_VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),Mn=Be({createOnigurumaEngine:()=>or,getDefaultWasmLoader:()=>ar,loadWasm:()=>$n,setDefaultWasmLoader:()=>ir}),Nn=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Pn(){return 2147483648}function Fn(){return typeof performance<`u`?performance.now():Date.now()}var In=(e,t)=>e+(t-e%t)%t;async function Ln(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=Pn();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,In(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Fn,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var Rn=Object.defineProperty,zn=(e,t,n)=>t in e?Rn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bn=(e,t,n)=>zn(e,typeof t==`symbol`?t:t+``,n),Vn=null;function Hn(e){throw new Nn(e.UTF8ToString(e.getLastOnigError()))}var Un=class e{constructor(t){Bn(this,`utf16Length`),Bn(this,`utf8Length`),Bn(this,`utf16Value`),Bn(this,`utf8Value`),Bn(this,`utf16OffsetToUtf8`),Bn(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Wn=class e{constructor(t){if(Bn(this,`id`,++e.LAST_ID),Bn(this,`_onigBinding`),Bn(this,`content`),Bn(this,`utf16Length`),Bn(this,`utf8Length`),Bn(this,`utf16OffsetToUtf8`),Bn(this,`utf8OffsetToUtf16`),Bn(this,`ptr`),!Vn)throw new Nn(`Must invoke loadWasm first.`);this._onigBinding=Vn,this.content=t;let n=new Un(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Vn.omalloc(1e4),e._sharedPtrInUse=!0,Vn.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Vn)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Bn(Wn,`LAST_ID`,0),Bn(Wn,`_sharedPtr`,0),Bn(Wn,`_sharedPtrInUse`,!1);var Gn=Wn,Kn=class{constructor(e){if(Bn(this,`_onigBinding`),Bn(this,`_ptr`),!Vn)throw new Nn(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Un(e[r]);t[r]=i.createString(Vn),n[r]=i.utf8Length}let r=Vn.omalloc(4*e.length);Vn.HEAPU32.set(t,r/4);let i=Vn.omalloc(4*e.length);Vn.HEAPU32.set(n,i/4);let a=Vn.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)Vn.ofree(t[n]);Vn.ofree(i),Vn.ofree(r),a===0&&Hn(Vn),this._onigBinding=Vn,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Gn(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function qn(e){return typeof e.instantiator==`function`}function Jn(e){return typeof e.default==`function`}function Yn(e){return e.data!==void 0}function Xn(e){return typeof Response<`u`&&e instanceof Response}function Zn(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Qn;function $n(e){if(Qn)return Qn;async function t(){Vn=await Ln(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),qn(n)?n=await n.instantiator(t):Jn(n)?n=await n.default(t):(Yn(n)&&(n=n.data),Xn(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await tr(n)(t):await nr(n)(t):Zn(n)||n instanceof WebAssembly.Module?n=await er(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await er(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Qn=t(),Qn}function er(e){return t=>WebAssembly.instantiate(e,t)}function tr(e){return t=>WebAssembly.instantiateStreaming(e,t)}function nr(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var rr;function ir(e){rr=e}function ar(){return rr}async function or(e){return e&&await $n(e),{createScanner(e){return new Kn(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Gn(e)}}}var sr=wn({});En(sr,Mn);var cr=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function lr(e){return ur(e)}function ur(e){return Array.isArray(e)?dr(e):e instanceof RegExp?e:typeof e==`object`?fr(e):e}function dr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=ur(e[n]);return t}function fr(e){let t={};for(let n in e)t[n]=ur(e[n]);return t}function pr(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function mr(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?mr(e.substring(0,e.length-1)):e.substr(~t+1)}var hr=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,gr=class{static hasCaptures(e){return e!==null&&(hr.lastIndex=0,hr.test(e))}static replaceCaptures(e,t,n){return e.replace(hr,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function _r(e,t){return e<t?-1:+(e>t)}function vr(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=_r(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function yr(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function br(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var xr=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Sr=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Dr(e),t)}static createFromParsedTheme(e,t){return Ar(e,t)}_cachedMatchRoot=new xr(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>wr(e.parent,t.parentScopes));return n?new Er(n.fontStyle,n.foreground,n.background):null}},Cr=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function wr(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Tr(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Tr(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Er=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Dr(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&yr(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&yr(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Or(l,u,e,o,s,c)}}return n}var Or=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},kr=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(kr||{});function Ar(e,t){e.sort((e,t)=>{let n=_r(e.scope,t.scope);return n!==0||(n=vr(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new jr(t),o=new Er(n,a.getId(r),a.getId(i)),s=new Pr(new Nr(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Sr(a,o,s)}var jr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Mr=Object.freeze([]),Nr=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Mr,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Pr=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Nr.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(vr(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Nr(e,t,n,r,i))}},Fr=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Lr(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Ir(e){return e}function Lr(e){return e}function Rr(e,t){let n=[],r=Br(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(zr(i)){let e=[];do e.push(i),i=r.next();while(zr(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function zr(e){return!!e&&!!e.match(/[\w\.:]+/)}function Br(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Vr(e){typeof e.dispose==`function`&&e.dispose()}var Hr=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ur=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Wr=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Gr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Hr(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Wr;for(let n of e)Kr(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Hr){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Kr(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof Hr?Jr({baseGrammar:a,selfGrammar:i},r):qr(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new Hr(e))}function qr(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Yr([r],t,n)}}function Jr(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Yr(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Yr(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Yr(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?pr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Yr(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ti(i);switch(a.kind){case 0:Jr({...t,selfGrammar:t.baseGrammar},n);break;case 1:Jr(t,n);break;case 2:qr(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?qr(a.ruleName,i,n):Jr(i,n)}else a.kind===4?n.add(new Ur(a.scopeName,a.ruleName)):n.add(new Hr(a.scopeName))}}}var Xr=class{kind=0},Zr=class{kind=1},Qr=class{constructor(e){this.ruleName=e}kind=2},$r=class{constructor(e){this.scopeName=e}kind=3},ei=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ti(e){if(e===`$base`)return new Xr;if(e===`$self`)return new Zr;let t=e.indexOf(`#`);return t===-1?new $r(e):t===0?new Qr(e.substring(1)):new ei(e.substring(0,t),e.substring(t+1))}var ni=/\\(\d+)/,ri=/\\(\d+)/g,ii=-1,ai=-2;function oi(e){return e}function si(e){return e}var ci=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=gr.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=gr.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${mr(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:gr.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:gr.replaceCaptures(this._contentName,e,t)}},li=class extends ci{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},ui=class extends ci{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new hi(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new gi,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},di=class extends ci{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new gi,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},fi=class extends ci{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new hi(i,this.id),this.beginCaptures=a,this._end=new hi(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new gi;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},pi=class extends ci{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new hi(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new hi(o,ai),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new gi;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new gi,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},mi=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new li(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new ui(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=pr({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new di(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new pi(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new fi(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ti(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof di||e instanceof fi||e instanceof pi)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},hi=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&ni.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return ri.lastIndex=0,this.source.replace(ri,(e,t)=>br(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},gi=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new _i(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new _i(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},_i=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
3
- `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},vi=class{constructor(e,t){this.languageId=e,this.tokenType=t}},yi=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new vi(e,8),this._embeddedLanguagesMatcher=new bi(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new vi(0,0);_getBasicScopeAttributes=new xr(e=>new vi(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},bi=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>br(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var xi=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Si(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ci(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new xi(i,!0);f()}return new xi(i,!1);function f(){let o=wi(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===ii){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),ki(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof fi){let r=o;ki(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof pi){let r=o;ki(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(ki(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Ci(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof pi&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Oi(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==ai){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),ki(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function wi(e,t,n,r,i,a){let o=Ti(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Ei(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Ti(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Di(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Ei(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Di(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Di(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Oi(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function ki(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Si(e,p,n&&d.start===0,d.start,f,i,!1,0),Vr(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Ai(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Ai=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ji(e,t,n,r,i,a,o,s){return new Fi(e,t,n,r,i,a,o,s)}function Mi(e,t,n,r,i){let a=Rr(t,Ni),o=mi.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Ni(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Pi(t[r],e))return n=r+1,!0;return!1})}function Pi(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Fi=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new yi(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ii(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Rr(e,Ni);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Mi(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Mi(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(oi(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[si(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Ii(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=mi.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Ri.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Fr.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Li.createRootAndLookUpScopeName(a,r,this):Li.createRoot(`unknown`,r),t=new Ri(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
4
- `;let a=this.createOnigString(e),o=a.content.length,s=new Bi(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Si(this,a,i,0,t,s,!0,r);return Vr(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ii(e,t){return e=lr(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Li=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Cr.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Cr(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Cr(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Fr.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Ri=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Li.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:si(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Li.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,oi(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Li.fromExtension(r,n.contentNameScopesList))}},zi=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Rr(e,Ni).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Rr(e,Ni).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Bi=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Fr.set(n,0,Ir(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Fr.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Vi=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,ji(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},Hi=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Vi(Sr.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Sr.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new zi(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new Gr(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},Ui=Ri.NULL;function Wi(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function Gi(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Ki(e){return Array.isArray(e)?e:[e]}async function qi(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Ji(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function Yi(e){return e===`ansi`||Ji(e)}function Xi(e){return e===`none`}function Zi(e){return Xi(e)}var Qi=/(\r?\n)/g;function $i(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(Qi),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var ea={light:`#333333`,dark:`#bbbbbb`},ta={light:`#fffffe`,dark:`#1e1e1e`},na=`__shiki_resolved`;function ra(e){if(e?.[na])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?ea.light:ea.dark,n||=t.type===`light`?ta.light:ta.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,na,{enumerable:!1,writable:!1,value:!0}),t}async function ia(e){return[...new Set((await Promise.all(e.filter(e=>!Yi(e)).map(async e=>await qi(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function aa(e){return(await Promise.all(e.map(async e=>Zi(e)?null:ra(await qi(e))))).filter(e=>!!e)}function oa(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new cr(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var sa=class extends Hi{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=ra(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Sr.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=oa(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new cr(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},ca=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},la=0;function ua(e){la+=1,e.warnings!==!1&&la>=10&&la%10==0&&console.warn(`[Shiki] ${la} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new cr("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(ra),i=new sa(new ca(e.engine,n),r,n,e.langAlias),a;function o(t){return oa(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new cr(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new cr(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await ia(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await aa(e))}function g(){if(t)throw new cr(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--la)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function da(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([aa(e.themes||[]),ia(e.langs||[]),e.engine]);return ua({...e,themes:t,langs:n,engine:r})}var fa=new WeakMap;function pa(e,t){fa.set(e,t)}function ma(e){return fa.get(e)}var ha=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(Ki(n).map(e=>[e,Ui])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return ga(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function ga(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function _a(e,t){if(!(e instanceof ha))throw new cr(`Invalid grammar state`);return e.getInternalStack(t)}var va=/,/,ya=/ /;function ba(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(Ji(e.resolveLangAlias(n.lang||`text`))||Xi(r))return $i(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new cr(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new cr(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Sa(t,o,i,a,n)}function xa(...e){if(e.length===2)return ma(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Ji(i)||Xi(a))throw new cr(`Plain language does not have grammar state`);if(i===`ansi`)throw new cr(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new ha(Ca(n,c,o,s,r).stateStack,c.name,o.name)}function Sa(e,t,n,r,i){let a=Ca(e,t,n,r,i),o=new ha(a.stateStack,t.name,n.name);return pa(a.tokens,o),a.tokens}function Ca(e,t,n,r,i){let a=Wi(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=$i(e),u=i.grammarState?_a(i.grammarState,n.name)??Ui:i.grammarContextCode==null?Ui:Ca(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=Gi(r[Fr.getForeground(s)],a),u=Fr.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=Fr.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(va).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(ya))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?wa(t.scopes):Ta(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function wa(e){return e.map(e=>({scopeName:e}))}function Ta(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Oa(e,i,t.slice(0,r))}}return n}function Ea(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Da(e,t,n){if(!Ea(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Ea(e[r],n[i])&&--r,--i;return r===-1}function Oa(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Da(e,t,n)){r.push(a);break}return r}function ka(e,t,n,r=ba){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:ma(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Aa(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new ha(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&pa(s,c),s}function Aa(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var ja=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Ma=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Ma.prototype.normal={},Ma.prototype.property={},Ma.prototype.space=void 0;function Na(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Ma(n,r,t)}function Pa(e){return e.toLowerCase()}var Fa=class{constructor(e,t){this.attribute=t,this.property=e}};Fa.prototype.attribute=``,Fa.prototype.booleanish=!1,Fa.prototype.boolean=!1,Fa.prototype.commaOrSpaceSeparated=!1,Fa.prototype.commaSeparated=!1,Fa.prototype.defined=!1,Fa.prototype.mustUseProperty=!1,Fa.prototype.number=!1,Fa.prototype.overloadedBoolean=!1,Fa.prototype.property=``,Fa.prototype.spaceSeparated=!1,Fa.prototype.space=void 0;var Ia=Be({boolean:()=>W,booleanish:()=>Ra,commaOrSpaceSeparated:()=>Ha,commaSeparated:()=>Va,number:()=>G,overloadedBoolean:()=>za,spaceSeparated:()=>Ba}),La=0,W=Ua(),Ra=Ua(),za=Ua(),G=Ua(),Ba=Ua(),Va=Ua(),Ha=Ua();function Ua(){return 2**++La}var Wa=Object.keys(Ia),Ga=class extends Fa{constructor(e,t,n,r){let i=-1;if(super(e,t),Ka(this,`space`,r),typeof n==`number`)for(;++i<Wa.length;){let e=Wa[i];Ka(this,Wa[i],(n&Ia[e])===Ia[e])}}};Ga.prototype.defined=!0;function Ka(e,t,n){n&&(e[t]=n)}function qa(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Ga(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Pa(r)]=r,n[Pa(a.attribute)]=r}return new Ma(t,n,e.space)}var Ja=qa({properties:{ariaActiveDescendant:null,ariaAtomic:Ra,ariaAutoComplete:null,ariaBusy:Ra,ariaChecked:Ra,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:Ba,ariaCurrent:null,ariaDescribedBy:Ba,ariaDetails:null,ariaDisabled:Ra,ariaDropEffect:Ba,ariaErrorMessage:null,ariaExpanded:Ra,ariaFlowTo:Ba,ariaGrabbed:Ra,ariaHasPopup:null,ariaHidden:Ra,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ba,ariaLevel:G,ariaLive:null,ariaModal:Ra,ariaMultiLine:Ra,ariaMultiSelectable:Ra,ariaOrientation:null,ariaOwns:Ba,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:Ra,ariaReadOnly:Ra,ariaRelevant:null,ariaRequired:Ra,ariaRoleDescription:Ba,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:Ra,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Ya(e,t){return t in e?e[t]:t}function Xa(e,t){return Ya(e,t.toLowerCase())}var Za=qa({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Va,acceptCharset:Ba,accessKey:Ba,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alpha:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:Ba,autoFocus:W,autoPlay:W,blocking:Ba,capture:null,charSet:null,checked:W,cite:null,className:Ba,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:Ra,controls:W,controlsList:Ba,coords:G|Va,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:za,draggable:Ra,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:Ba,height:G,hidden:za,high:G,href:null,hrefLang:null,htmlFor:Ba,httpEquiv:Ba,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:Ba,itemRef:Ba,itemScope:W,itemType:Ba,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:G,pattern:null,ping:Ba,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:Ba,required:W,reversed:W,rows:G,rowSpan:G,sandbox:Ba,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootCustomElementRegistry:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shadowRootSerializable:W,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:Ra,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:Ra,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ba,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:Ra,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:W,disablePictureInPicture:W,disableRemotePlayback:W,exportParts:Va,part:Ba,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:Xa}),Qa=qa({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Ha,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:Ba,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Va,g2:Va,glyphName:Va,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:Ha,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:G,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ba,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ha,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ha,rev:Ha,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ha,requiredFeatures:Ha,requiredFonts:Ha,requiredFormats:Ha,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:Ha,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ha,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ha,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Ya}),$a=qa({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),eo=qa({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Xa}),to=qa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),no=/[A-Z]/g,ro=/-[a-z]/g,io=/^data[-\w.:]+$/i;function ao(e,t){let n=Pa(t),r=t,i=Fa;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&io.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ro,so);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ro.test(e)){let n=e.replace(no,oo);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ga}return new i(r,t)}function oo(e){return`-`+e.toLowerCase()}function so(e){return e.charAt(1).toUpperCase()}var co=Na([Ja,Za,$a,eo,to],`html`),lo=Na([Ja,Qa,$a,eo,to],`svg`),uo={}.hasOwnProperty;function fo(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&uo.call(t,e)){let n=String(t[e]);i=uo.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var po=/["&'<>`]/g,mo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ho=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,go=/[|\\{}()[\]^$+*?.]/g,_o=new WeakMap;function vo(e,t){return e=e.replace(t.subset?yo(t.subset):po,r),t.subset||t.escapeOnly?e:e.replace(mo,n).replace(ho,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function yo(e){let t=_o.get(e);return t||(t=bo(e),_o.set(e,t)),t}function bo(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(go,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var xo=/[\dA-Fa-f]/;function So(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!xo.test(String.fromCharCode(t))?r:r+`;`}var Co=/\d/;function wo(e,t,n){let r=`&#`+String(e);return n&&t&&!Co.test(String.fromCharCode(t))?r:r+`;`}var To=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),Eo={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},Do=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Oo={}.hasOwnProperty,ko={},Ao;for(Ao in Eo)Oo.call(Eo,Ao)&&(ko[Eo[Ao]]=Ao);var jo=/[^\dA-Za-z]/;function Mo(e,t,n,r){let i=String.fromCharCode(e);if(Oo.call(ko,i)){let e=ko[i],a=`&`+e;return n&&To.includes(e)&&!Do.includes(e)&&(!r||t&&t!==61&&jo.test(String.fromCharCode(t)))?a:a+`;`}return``}function No(e,t,n){let r=So(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Mo(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=wo(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Po(e,t){return vo(e,Object.assign({format:No},t))}var Fo=/^>|^->|<!--|-->|--!>|<!-$/g,Io=[`>`],Lo=[`<`,`>`];function Ro(e,t,n,r){return r.settings.bogusComments?`<?`+Po(e.value,Object.assign({},r.settings.characterReferences,{subset:Io}))+`>`:`<!--`+e.value.replace(Fo,i)+`-->`;function i(e){return Po(e,Object.assign({},r.settings.characterReferences,{subset:Lo}))}}function zo(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Bo(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Vo(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Ho(e){return e.join(` `).trim()}var Uo=/[ \t\n\f\r]/g;function Wo(e){return typeof e==`object`?e.type===`text`&&Go(e.value):Go(e)}function Go(e){return e.replace(Uo,``)===``}var Ko=Yo(1),qo=Yo(-1),Jo=[];function Yo(e){return t;function t(t,n,r){let i=t?t.children:Jo,a=(n||0)+e,o=i[a];if(!r)for(;o&&Wo(o);)a+=e,o=i[a];return o}}var Xo={}.hasOwnProperty;function Zo(e){return t;function t(t,n,r){return Xo.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Qo=Zo({body:ts,caption:$o,colgroup:$o,dd:as,dt:is,head:$o,html:es,li:rs,optgroup:ss,option:cs,p:ns,rp:os,rt:os,tbody:us,td:ps,tfoot:ds,th:ps,thead:ls,tr:fs});function $o(e,t,n){let r=Ko(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Wo(r.value.charAt(0)))}function es(e,t,n){let r=Ko(n,t);return!r||r.type!==`comment`}function ts(e,t,n){let r=Ko(n,t);return!r||r.type!==`comment`}function ns(e,t,n){let r=Ko(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function rs(e,t,n){let r=Ko(n,t);return!r||r.type===`element`&&r.tagName===`li`}function is(e,t,n){let r=Ko(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function as(e,t,n){let r=Ko(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function os(e,t,n){let r=Ko(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function ss(e,t,n){let r=Ko(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function cs(e,t,n){let r=Ko(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function ls(e,t,n){let r=Ko(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function us(e,t,n){let r=Ko(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function ds(e,t,n){return!Ko(n,t)}function fs(e,t,n){let r=Ko(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function ps(e,t,n){let r=Ko(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var ms=Zo({body:_s,colgroup:vs,head:gs,html:hs,tbody:ys});function hs(e){let t=Ko(e,-1);return!t||t.type!==`comment`}function gs(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function _s(e){let t=Ko(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Wo(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function vs(e,t,n){let r=qo(n,t),i=Ko(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Qo(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function ys(e,t,n){let r=qo(n,t),i=Ko(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Qo(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var bs={name:[[`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_OE_pAv7U.js","assets/_CVgDVVCO.js","assets/_DM-ium3T.js","assets/icon-arrow-down-o2Q8gX32.css","assets/_B9L--yXd.js","assets/_D2DUVmrK.js","assets/_e0cRpaOA.js","assets/_Dww-t9cr.js","assets/_Brf3ihv9.js","assets/_DXpTM9Vi.js","assets/_CpTbuk29.js","assets/_CbL4gBfT.js","assets/_C5F2LB0J.js","assets/_C09s8ys-.js","assets/_8B0iE3yV.js","assets/_BXeXVLqQ.js","assets/_BVwXURXV.js","assets/_C3bY4kl5.js","assets/_HHjGgi0e.js","assets/_DpdQcf3B.js","assets/_YkIvmgMd.js","assets/_bTVj8UrX.js","assets/_CKzQAUqk.js","assets/_BAfg1_wL.js","assets/_gzcpVVnB.js","assets/_DlJlr59K.js","assets/_Ca1l-_ve.js","assets/_Vcxhd9Me.js","assets/_E64Ecc_G.js","assets/_C_G8IpBR.js","assets/_BkgfbJc9.js","assets/_CyuDJO5U.js","assets/_BpCRM3ny.js","assets/_zEkM9ipN.js","assets/_CM5P028Z.js","assets/_lIZw2vRt.js","assets/_j5K9UQQ0.js","assets/_DxtIw-r7.js","assets/_ECtgMUpC.js","assets/_CrTMxI09.js","assets/_CtfgHAJr.js","assets/_CGSpCxiD.js","assets/_Dk6CAjdI.js","assets/_BaHq4SXp.js","assets/_BYOwaDjH.js","assets/_CQJs3lWb.js","assets/_CYNrtFtB.js","assets/_DmIc4jLQ.js","assets/_DbYA3moe.js","assets/_CBce3t8t.js","assets/_DYvRD3hg.js","assets/_Dl-2e7rI.js","assets/_woXpYk--.js","assets/_CiGlRWH1.js","assets/_CQJ4Ag1g.js","assets/_Clp7X-2W.js","assets/_Cooz7Zy5.js","assets/_516BLrGX.js","assets/_DWudthM-.js","assets/_Dww6fe2G.js","assets/_Dx-8-gkx.js","assets/_DekxQCZG.js","assets/_C8oCnwJJ.js","assets/_Coeyfi50.js","assets/_C5AzS7w_.js","assets/_CCGnzpyE.js","assets/_CPoFjDtz.js","assets/_Bevux30L.js","assets/_DuXWKTn9.js","assets/_kNFFJLl0.js","assets/_ygR8LCaC.js","assets/_C0jLRRGd.js","assets/_dpBVLA_i.js","assets/_DVTAwKKz.js","assets/_BrhBcHNc.js","assets/_DWQbgPoS.js","assets/_DJMQeKeT.js","assets/_7ZQ1bcvQ.js","assets/_BDHmzVwb.js","assets/_DLbTveFp.js","assets/_DqKBuwfJ.js","assets/_oqKa8noW.js","assets/_CnvKMtbv.js","assets/_IyjqRm3v.js","assets/_rLFTqkRN.js","assets/_CacY0gHj.js","assets/_B5eOa1yu.js","assets/_Dixweg8N.js","assets/_D1A_Heim.js","assets/_O90oeIOV.js","assets/_C9ZUrBp_.js","assets/_DOwzaHZ0.js","assets/_B3gFvitq.js","assets/_Cfkwpbl8.js","assets/_BiFt_7mu.js","assets/_CMLA9XwU.js","assets/_ChhEzrHb.js","assets/_MkFj2NMq.js","assets/_CRSCK3l6.js","assets/_Dipq1vU2.js","assets/_F72-JU90.js","assets/_Bj61d0ZC.js","assets/_D0p9tDcD.js","assets/_DB-OQ-9y.js","assets/_Cvrh5tZx.js","assets/_nGKje9l8.js","assets/_DQoHlXvh.js","assets/_L8AbGenz.js","assets/_ByJddavk.js","assets/_C7bp-lWn.js","assets/_CYeZAktI.js","assets/_BLRHnHr3.js","assets/_CA86wzsA.js","assets/_Dlo6LkwP.js","assets/_z5Tp63M6.js","assets/_D2Ka7B62.js","assets/_qdxAdBWQ.js","assets/_Ci_nEsc7.js","assets/_CYpm1nAK.js","assets/_BNLmms1o.js","assets/_CCSX75yM.js","assets/_CyEgAFGc.js","assets/_Dh5ihWbf.js","assets/_B2gwz-sJ.js","assets/_atpdpPnT.js","assets/_D3P02MlY.js","assets/_BqLjoHDb.js","assets/_B6D30XZt.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,$t as t,A as n,An as r,At as i,B as a,C as o,Ct as s,D as c,Dt as l,E as u,Et as d,F as f,Ft as p,G as m,H as h,I as g,It as _,J as v,Jt as y,K as b,L as x,M as S,Mn as C,N as w,Nt as T,O as E,Ot as D,P as ee,Q as O,Qt as te,R as ne,S as k,Sn as re,St as ie,T as ae,Tt as oe,U as se,Ut as ce,V as le,Vt as ue,W as de,Wt as fe,X as pe,Xt as me,Y as he,Yt as ge,Z as _e,Zt as ve,_t as ye,a as be,an as xe,b as Se,bn as Ce,bt as we,c as Te,cn as Ee,ct as De,d as Oe,dt as ke,en as Ae,et as je,f as Me,ft as Ne,gt as Pe,h as Fe,ht as Ie,i as Le,in as Re,it as ze,j as Be,jn as Ve,k as He,kn as Ue,kt as We,ln as Ge,m as Ke,mt as qe,n as Je,nt as Ye,o as Xe,on as Ze,p as Qe,pt as $e,q as et,r as tt,rt as nt,s as rt,sn as it,st as at,t as ot,tt as st,u as ct,ut as lt,v as ut,vt as dt,w as ft,wt as pt,x as mt,xt as A,y as ht,yt as gt,z as _t}from"./_CVgDVVCO.js";import{A as vt,B as yt,C as bt,D as xt,E as St,F as Ct,G as wt,H as j,I as Tt,L as M,M as N,N as P,O as Et,P as Dt,R as F,T as Ot,V as I,W as kt,_ as L,a as R,b as At,c as jt,d as Mt,f as Nt,g as Pt,i as z,l as Ft,n as It,r as Lt,t as B,u as Rt,v as V,x as zt,y as H,z as U}from"./_DM-ium3T.js";var Bt=`diffs-container`,Vt=(()=>{try{return!1}catch{return!1}})(),Ht=/(?=^From [a-f0-9]+ .+$)/m,Ut=/(?=^diff --git)/gm,Wt=/(?<=\n)/,Gt=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Kt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,qt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Jt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Yt=`header-prefix`,Xt=`header-filename-suffix`,Zt=`header-metadata`,Qt=`header-custom`,$t={dark:`pierre-dark`,light:`pierre-light`},en=`data-theme-css`,tn=`data-unsafe-css`,nn=`data-diffs-scrollbar-measure`,rn=`data-diffs-code-view-header`,an=`data-diffs-code-view-footer`,on=`--diffs-scrollbar-gutter-measured`,sn=1e5,cn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},ln={...cn,hunkLineCount:1},un={paddingTop:8,paddingBottom:8,gap:8},dn={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},fn=Object.freeze({fromStart:0,fromEnd:0}),pn={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},mn={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},hn=new Map,gn=new Map,_n=new Map,vn=new Set;function yn(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!vn.has(t))return!1;return!0}function bn(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(vn.has(n.name))continue;let e=hn.get(n.name);e??(e=n,hn.set(n.name,e));let r=e.data.find(t=>t.name===e.name||t.aliases?.includes(e.name)===!0);if(r==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${e.name}" as its name or an alias.`);t.loadLanguageSync(e.data);try{t.getLanguage(e.name)}catch{throw Error(`attachResolvedLanguages: "${r.name}" is already loaded without alias "${e.name}". Load the alias first or give the grammar a unique name.`)}vn.add(e.name)}}function xn(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var Sn=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,wn=Object.getOwnPropertyNames,Tn=Object.prototype.hasOwnProperty,En=(e,t)=>{let n={};for(var r in e)Sn(n,r,{get:e[r],enumerable:!0});return t||Sn(n,Symbol.toStringTag,{value:`Module`}),n},Dn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=wn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Tn.call(e,s)&&s!==n&&Sn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Cn(t,s))||r.enumerable});return e},On=(e,t,n)=>(Dn(e,t,`default`),n&&Dn(n,t,`default`)),kn=[{id:`abap`,name:`ABAP`,import:(()=>B(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>B(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>B(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>B(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>B(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>B(()=>import(`./_OE_pAv7U.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>B(()=>import(`./_Dww-t9cr.js`),__vite__mapDeps([7,0,1,2,3,4,5,6,8])))},{id:`apache`,name:`Apache Conf`,import:(()=>B(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>B(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>B(()=>import(`./_DXpTM9Vi.js`),__vite__mapDeps([9,5,1,2,3,6,4,10,11,12])))},{id:`applescript`,name:`AppleScript`,import:(()=>B(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>B(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>B(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>B(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>B(()=>import(`./_C09s8ys-.js`),__vite__mapDeps([13,5,1,2,3,6,12,14,15,16])))},{id:`awk`,name:`AWK`,import:(()=>B(()=>import(`./_BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>B(()=>import(`./_B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>B(()=>import(`./_qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>B(()=>import(`./_D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>B(()=>import(`./_DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>B(()=>import(`./_Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>B(()=>import(`./_CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>B(()=>import(`./_CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>B(()=>import(`./_C3bY4kl5.js`),__vite__mapDeps([17,5,1,2,3,6,4,10,11,12,18,19])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>B(()=>import(`./_YkIvmgMd.js`),__vite__mapDeps([20,21])))},{id:`c`,name:`C`,import:(()=>B(()=>import(`./_CKzQAUqk.js`).then(e=>e.n),__vite__mapDeps([22,1,2,3])))},{id:`c3`,name:`C3`,import:(()=>B(()=>import(`./_D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>B(()=>import(`./_CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>B(()=>import(`./_BAfg1_wL.js`),__vite__mapDeps([23,24])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>B(()=>import(`./_DlJlr59K.js`),__vite__mapDeps([25,22,1,2,3])))},{id:`clarity`,name:`Clarity`,import:(()=>B(()=>import(`./_CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>B(()=>import(`./_DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>B(()=>import(`./_Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>B(()=>import(`./_Ca1l-_ve.js`),__vite__mapDeps([26,4,1,2,3,5,6,11])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>B(()=>import(`./_C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>B(()=>import(`./_oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>B(()=>import(`./_Vcxhd9Me.js`),__vite__mapDeps([27,5,1,2,3])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>B(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>B(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>B(()=>import(`./_E64Ecc_G.js`).then(e=>e.n),__vite__mapDeps([28,1,2,3,29,30,22])))},{id:`crystal`,name:`Crystal`,import:(()=>B(()=>import(`./_CyuDJO5U.js`),__vite__mapDeps([31,5,1,2,3,6,4,19,22,32])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>B(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>B(()=>import(`./_e0cRpaOA.js`).then(e=>e.n),__vite__mapDeps([6,1,2,3])))},{id:`csv`,name:`CSV`,import:(()=>B(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>B(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>B(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>B(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>B(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>B(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>B(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>B(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>B(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>B(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>B(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>B(()=>import(`./_zEkM9ipN.js`),__vite__mapDeps([33,4,1,2,3,5,6,14,18])))},{id:`elixir`,name:`Elixir`,import:(()=>B(()=>import(`./_CM5P028Z.js`),__vite__mapDeps([34,4,1,2,3,5,6])))},{id:`elm`,name:`Elm`,import:(()=>B(()=>import(`./_lIZw2vRt.js`),__vite__mapDeps([35,30,1,2,3,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>B(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>B(()=>import(`./_j5K9UQQ0.js`),__vite__mapDeps([36,4,1,2,3,5,6,37,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>B(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([43,44])))},{id:`fennel`,name:`Fennel`,import:(()=>B(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>B(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>B(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>B(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([45,46])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>B(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>B(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([47,44])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>B(()=>import(`./_DbYA3moe.js`),__vite__mapDeps([48,49,50])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>B(()=>import(`./_DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>B(()=>import(`./_CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>B(()=>import(`./_CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>B(()=>import(`./_DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>B(()=>import(`./_Dl-2e7rI.js`),__vite__mapDeps([51,52])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>B(()=>import(`./_CiGlRWH1.js`),__vite__mapDeps([53,32,1,2,3])))},{id:`gleam`,name:`Gleam`,import:(()=>B(()=>import(`./_CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>B(()=>import(`./_CQJ4Ag1g.js`),__vite__mapDeps([54,5,1,2,3,6,4,14])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>B(()=>import(`./_Clp7X-2W.js`),__vite__mapDeps([55,5,1,2,3,6,4,14])))},{id:`glsl`,name:`GLSL`,import:(()=>B(()=>import(`./_BkgfbJc9.js`).then(e=>e.n),__vite__mapDeps([30,1,2,3,22])))},{id:`gn`,name:`GN`,import:(()=>B(()=>import(`./_ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>B(()=>import(`./_7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>B(()=>import(`./_rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>B(()=>import(`./_CrTMxI09.js`).then(e=>e.n),__vite__mapDeps([39,1,2,3,5,14,16,40])))},{id:`groovy`,name:`Groovy`,import:(()=>B(()=>import(`./_CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>B(()=>import(`./_Cooz7Zy5.js`),__vite__mapDeps([56,4,1,2,3,5,6,19])))},{id:`haml`,name:`Ruby Haml`,import:(()=>B(()=>import(`./_ECtgMUpC.js`).then(e=>e.n),__vite__mapDeps([38,1,2,3,5,6])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>B(()=>import(`./_516BLrGX.js`),__vite__mapDeps([57,5,1,2,3,6,4,42])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>B(()=>import(`./_D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>B(()=>import(`./_C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>B(()=>import(`./_Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>B(()=>import(`./_CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>B(()=>import(`./_Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>B(()=>import(`./_B9L--yXd.js`).then(e=>e.n),__vite__mapDeps([4,1,2,3,5,6])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>B(()=>import(`./_HHjGgi0e.js`),__vite__mapDeps([18,4,1,2,3,5,6])))},{id:`http`,name:`HTTP`,import:(()=>B(()=>import(`./_DWudthM-.js`),__vite__mapDeps([58,10,1,2,3,11,12,32,39,5,14,16,40])))},{id:`hurl`,name:`Hurl`,import:(()=>B(()=>import(`./_Dww6fe2G.js`),__vite__mapDeps([59,10,1,2,3,11,60,39,5,14,16,40])))},{id:`hxml`,name:`HXML`,import:(()=>B(()=>import(`./_DekxQCZG.js`),__vite__mapDeps([61,62])))},{id:`hy`,name:`Hy`,import:(()=>B(()=>import(`./_CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>B(()=>import(`./_DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>B(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>B(()=>import(`./_CbL4gBfT.js`).then(e=>e.n),__vite__mapDeps([11,1,2,3])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>B(()=>import(`./_D2DUVmrK.js`).then(e=>e.n),__vite__mapDeps([5,1,2,3])))},{id:`jinja`,name:`Jinja`,import:(()=>B(()=>import(`./_Coeyfi50.js`),__vite__mapDeps([63,4,1,2,3,5,6])))},{id:`jison`,name:`Jison`,import:(()=>B(()=>import(`./_C5AzS7w_.js`),__vite__mapDeps([64,5,1,2,3])))},{id:`json`,name:`JSON`,import:(()=>B(()=>import(`./_C5F2LB0J.js`).then(e=>e.n),__vite__mapDeps([12,1,2,3])))},{id:`json5`,name:`JSON5`,import:(()=>B(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>B(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>B(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>B(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>B(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>B(()=>import(`./_CtfgHAJr.js`).then(e=>e.n),__vite__mapDeps([40,1,2,3])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>B(()=>import(`./_CCGnzpyE.js`),__vite__mapDeps([65,5,1,2,3,19,24,28,29,30,22,66])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>B(()=>import(`./_Bevux30L.js`),__vite__mapDeps([67,5,1,2,3,14,24,32,37,6,4,10,11,19,22,28,29,30,38,39,16,40,41,42,68])))},{id:`kdl`,name:`KDL`,import:(()=>B(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>B(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>B(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>B(()=>import(`./_kNFFJLl0.js`),__vite__mapDeps([69,70,1,2,3,66])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>B(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>B(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>B(()=>import(`./_C0jLRRGd.js`),__vite__mapDeps([71,5,1,2,3,6,4,12])))},{id:`llvm`,name:`LLVM IR`,import:(()=>B(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>B(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>B(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>B(()=>import(`./_CGSpCxiD.js`).then(e=>e.n),__vite__mapDeps([41,1,2,3,22])))},{id:`luau`,name:`Luau`,import:(()=>B(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>B(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>B(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>B(()=>import(`./_dpBVLA_i.js`),__vite__mapDeps([72,6,1,2,3,8,14,73])))},{id:`matlab`,name:`MATLAB`,import:(()=>B(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>B(()=>import(`./_BrhBcHNc.js`),__vite__mapDeps([74,18,4,1,2,3,5,6,42,44])))},{id:`mdx`,name:`MDX`,import:(()=>B(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>B(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>B(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>B(()=>import(`./_fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>B(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>B(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>B(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>B(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([75,76])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>B(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>B(()=>import(`./_7ZQ1bcvQ.js`),__vite__mapDeps([77,41,1,2,3,22])))},{id:`nim`,name:`Nim`,import:(()=>B(()=>import(`./_BDHmzVwb.js`),__vite__mapDeps([78,5,1,2,3,6,4,10,11,22,30,44])))},{id:`nix`,name:`Nix`,import:(()=>B(()=>import(`./_IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>B(()=>import(`./_CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>B(()=>import(`./_DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>B(()=>import(`./_D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>B(()=>import(`./_BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>B(()=>import(`./_O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>B(()=>import(`./_B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>B(()=>import(`./_BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>B(()=>import(`./_DLbTveFp.js`),__vite__mapDeps([79,5,1,2,3,6,4,8,11,10,12,14,16,19,22,24,80,27,29,28,30,32,81,82,52,83,34,41,42,37,38,39,40,44,43,51,53,84,85,86,66,68,69,70,73,87,78,88,89,90,91,92,93,94,95,96])))},{id:`pascal`,name:`Pascal`,import:(()=>B(()=>import(`./_4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>B(()=>import(`./_DuXWKTn9.js`),__vite__mapDeps([68,5,1,2,3,6,4,10,11,19])))},{id:`php`,name:`PHP`,import:(()=>B(()=>import(`./_C9ZUrBp_.js`),__vite__mapDeps([90,5,1,2,3,6,4,10,11,12,19])))},{id:`pkl`,name:`Pkl`,import:(()=>B(()=>import(`./_ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>B(()=>import(`./_DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>B(()=>import(`./_BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>B(()=>import(`./_C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>B(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>B(()=>import(`./_DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>B(()=>import(`./_CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>B(()=>import(`./_DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>B(()=>import(`./_iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>B(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>B(()=>import(`./_MkFj2NMq.js`),__vite__mapDeps([97,5,1,2,3,6,4])))},{id:`puppet`,name:`Puppet`,import:(()=>B(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>B(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>B(()=>import(`./_gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>B(()=>import(`./_CRSCK3l6.js`),__vite__mapDeps([98,5,1,2,3])))},{id:`qmldir`,name:`QML Directory`,import:(()=>B(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>B(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>B(()=>import(`./_CPoFjDtz.js`).then(e=>e.n),__vite__mapDeps([66,1,2,3])))},{id:`racket`,name:`Racket`,import:(()=>B(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>B(()=>import(`./_B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>B(()=>import(`./_Dipq1vU2.js`),__vite__mapDeps([99,4,1,2,3,5,6,81])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>B(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>B(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>B(()=>import(`./_C_G8IpBR.js`).then(e=>e.n),__vite__mapDeps([29,1,2,3])))},{id:`rel`,name:`Rel`,import:(()=>B(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>B(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>B(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>B(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>B(()=>import(`./_F72-JU90.js`),__vite__mapDeps([100,5,1,2,3,18,4,6,24,101,28,29,30,22,32,42,37,10,11,19,38,39,14,16,40,41])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>B(()=>import(`./_DxtIw-r7.js`),__vite__mapDeps([37,5,1,2,3,6,4,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>B(()=>import(`./_Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>B(()=>import(`./_D0p9tDcD.js`),__vite__mapDeps([102,19,1,2,3])))},{id:`sass`,name:`Sass`,import:(()=>B(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>B(()=>import(`./_BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>B(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>B(()=>import(`./_Brf3ihv9.js`).then(e=>e.n),__vite__mapDeps([8,1,2,3,6])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>B(()=>import(`./_bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>B(()=>import(`./_DB-OQ-9y.js`),__vite__mapDeps([103,104])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>B(()=>import(`./_BpCRM3ny.js`).then(e=>e.n),__vite__mapDeps([32,1,2,3])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>B(()=>import(`./_nGKje9l8.js`),__vite__mapDeps([105,32,1,2,3])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>B(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>B(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>B(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>B(()=>import(`./_DQoHlXvh.js`),__vite__mapDeps([106,4,1,2,3,5,6])))},{id:`sparql`,name:`SPARQL`,import:(()=>B(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([107,108])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>B(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>B(()=>import(`./_DpdQcf3B.js`).then(e=>e.n),__vite__mapDeps([19,1,2,3])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>B(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>B(()=>import(`./_C7bp-lWn.js`),__vite__mapDeps([109,19,1,2,3])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>B(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>B(()=>import(`./_CYeZAktI.js`),__vite__mapDeps([110,5,1,2,3])))},{id:`svelte`,name:`Svelte`,import:(()=>B(()=>import(`./_BLRHnHr3.js`),__vite__mapDeps([111,5,1,2,3,6,14,15])))},{id:`swift`,name:`Swift`,import:(()=>B(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>B(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>B(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>B(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>B(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>B(()=>import(`./_CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>B(()=>import(`./_CA86wzsA.js`),__vite__mapDeps([112,5,1,2,3,6,84])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>B(()=>import(`./_DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>B(()=>import(`./_ygR8LCaC.js`).then(e=>e.n),__vite__mapDeps([70,1,2,3,66])))},{id:`toml`,name:`TOML`,import:(()=>B(()=>import(`./_CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>B(()=>import(`./_Dlo6LkwP.js`),__vite__mapDeps([113,5,1,2,3,6,4,10,11,14,19,30,22])))},{id:`tsv`,name:`TSV`,import:(()=>B(()=>import(`./_sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>B(()=>import(`./_BVwXURXV.js`).then(e=>e.n),__vite__mapDeps([16,1,2,3])))},{id:`turtle`,name:`Turtle`,import:(()=>B(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>B(()=>import(`./_z5Tp63M6.js`),__vite__mapDeps([114,5,1,2,3,6,8,24,37,4,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42,90,12])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>B(()=>import(`./_8B0iE3yV.js`).then(e=>e.n),__vite__mapDeps([14,1,2,3])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>B(()=>import(`./_BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>B(()=>import(`./_D2Ka7B62.js`),__vite__mapDeps([115,5,1,2,3,6,4,8,11,10,12,14,16,116,117,19,22,24,80,27,29,28,30,32,81,82,52,83,34,41,42,37,38,39,40,44,43,47,51,53,84,85,57,86,118,66,65,68,69,70,73,119,87,88,90,91,92,93,94,96,120,97,121,122,114,123])))},{id:`v`,name:`V`,import:(()=>B(()=>import(`./_DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>B(()=>import(`./_zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>B(()=>import(`./_DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>B(()=>import(`./_B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>B(()=>import(`./_BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>B(()=>import(`./_DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>B(()=>import(`./_atpdpPnT.js`),__vite__mapDeps([124,5,1,2,3,6,4,12,14,18])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>B(()=>import(`./_D3P02MlY.js`),__vite__mapDeps([125,5,1,2,3])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>B(()=>import(`./_BqLjoHDb.js`),__vite__mapDeps([126,5,1,2,3,6,8,15,73,127])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>B(()=>import(`./_CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>B(()=>import(`./_ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>B(()=>import(`./_C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>B(()=>import(`./_BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>B(()=>import(`./_ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>B(()=>import(`./_DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>B(()=>import(`./_DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>B(()=>import(`./_CpTbuk29.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,11])))},{id:`xsl`,name:`XSL`,import:(()=>B(()=>import(`./_ChhEzrHb.js`),__vite__mapDeps([96,10,1,2,3,11])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>B(()=>import(`./_Dk6CAjdI.js`).then(e=>e.n),__vite__mapDeps([42,1,2,3])))},{id:`zenscript`,name:`ZenScript`,import:(()=>B(()=>import(`./_BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>B(()=>import(`./_CMLA9XwU.js`),[]))}],An=Object.fromEntries(kn.map(e=>[e.id,e.import])),jn=Object.fromEntries(kn.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Mn={...An,...jn},Nn=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>B(()=>import(`./_vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>B(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>B(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>B(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>B(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>B(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>B(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>B(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>B(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>B(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>B(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>B(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>B(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>B(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>B(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>B(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>B(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>B(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>B(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>B(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>B(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>B(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>B(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>B(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>B(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>B(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>B(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>B(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>B(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>B(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>B(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>B(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>B(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>B(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>B(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>B(()=>import(`./_Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>B(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>B(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>B(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>B(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>B(()=>import(`./_BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>B(()=>import(`./_DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>B(()=>import(`./_B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>B(()=>import(`./_DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>B(()=>import(`./_eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>B(()=>import(`./_Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>B(()=>import(`./_CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>B(()=>import(`./_D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>B(()=>import(`./_DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>B(()=>import(`./_DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>B(()=>import(`./_DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>B(()=>import(`./_aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>B(()=>import(`./_8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>B(()=>import(`./_DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>B(()=>import(`./_DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>B(()=>import(`./_B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>B(()=>import(`./_4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>B(()=>import(`./_UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>B(()=>import(`./_C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>B(()=>import(`./_nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>B(()=>import(`./_oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>B(()=>import(`./_DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>B(()=>import(`./_fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>B(()=>import(`./_BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>B(()=>import(`./_VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),Pn=Ve({createOnigurumaEngine:()=>cr,getDefaultWasmLoader:()=>sr,loadWasm:()=>tr,setDefaultWasmLoader:()=>or}),Fn=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function In(){return 2147483648}function Ln(){return typeof performance<`u`?performance.now():Date.now()}var Rn=(e,t)=>e+(t-e%t)%t;async function zn(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=In();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,Rn(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Ln,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var Bn=Object.defineProperty,Vn=(e,t,n)=>t in e?Bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hn=(e,t,n)=>Vn(e,typeof t==`symbol`?t:t+``,n),Un=null;function Wn(e){throw new Fn(e.UTF8ToString(e.getLastOnigError()))}var Gn=class e{constructor(t){Hn(this,`utf16Length`),Hn(this,`utf8Length`),Hn(this,`utf16Value`),Hn(this,`utf8Value`),Hn(this,`utf16OffsetToUtf8`),Hn(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Kn=class e{constructor(t){if(Hn(this,`id`,++e.LAST_ID),Hn(this,`_onigBinding`),Hn(this,`content`),Hn(this,`utf16Length`),Hn(this,`utf8Length`),Hn(this,`utf16OffsetToUtf8`),Hn(this,`utf8OffsetToUtf16`),Hn(this,`ptr`),!Un)throw new Fn(`Must invoke loadWasm first.`);this._onigBinding=Un,this.content=t;let n=new Gn(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Un.omalloc(1e4),e._sharedPtrInUse=!0,Un.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Un)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Hn(Kn,`LAST_ID`,0),Hn(Kn,`_sharedPtr`,0),Hn(Kn,`_sharedPtrInUse`,!1);var qn=Kn,Jn=class{constructor(e){if(Hn(this,`_onigBinding`),Hn(this,`_ptr`),!Un)throw new Fn(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Gn(e[r]);t[r]=i.createString(Un),n[r]=i.utf8Length}let r=Un.omalloc(4*e.length);Un.HEAPU32.set(t,r/4);let i=Un.omalloc(4*e.length);Un.HEAPU32.set(n,i/4);let a=Un.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)Un.ofree(t[n]);Un.ofree(i),Un.ofree(r),a===0&&Wn(Un),this._onigBinding=Un,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new qn(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Yn(e){return typeof e.instantiator==`function`}function Xn(e){return typeof e.default==`function`}function Zn(e){return e.data!==void 0}function Qn(e){return typeof Response<`u`&&e instanceof Response}function $n(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var er;function tr(e){if(er)return er;async function t(){Un=await zn(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Yn(n)?n=await n.instantiator(t):Xn(n)?n=await n.default(t):(Zn(n)&&(n=n.data),Qn(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await rr(n)(t):await ir(n)(t):$n(n)||n instanceof WebAssembly.Module?n=await nr(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await nr(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return er=t(),er}function nr(e){return t=>WebAssembly.instantiate(e,t)}function rr(e){return t=>WebAssembly.instantiateStreaming(e,t)}function ir(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var ar;function or(e){ar=e}function sr(){return ar}async function cr(e){return e&&await tr(e),{createScanner(e){return new Jn(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new qn(e)}}}var lr=En({});On(lr,Pn);var ur=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function dr(e){return fr(e)}function fr(e){return Array.isArray(e)?pr(e):e instanceof RegExp?e:typeof e==`object`?mr(e):e}function pr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=fr(e[n]);return t}function mr(e){let t={};for(let n in e)t[n]=fr(e[n]);return t}function hr(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function gr(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?gr(e.substring(0,e.length-1)):e.substr(~t+1)}var _r=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,vr=class{static hasCaptures(e){return e!==null&&(_r.lastIndex=0,_r.test(e))}static replaceCaptures(e,t,n){return e.replace(_r,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function yr(e,t){return e<t?-1:+(e>t)}function br(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=yr(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function xr(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Sr(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Cr=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},wr=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(kr(e),t)}static createFromParsedTheme(e,t){return Mr(e,t)}_cachedMatchRoot=new Cr(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Er(e.parent,t.parentScopes));return n?new Or(n.fontStyle,n.foreground,n.background):null}},Tr=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Er(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Dr(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Dr(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Or=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function kr(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&xr(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&xr(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Ar(l,u,e,o,s,c)}}return n}var Ar=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},jr=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(jr||{});function Mr(e,t){e.sort((e,t)=>{let n=yr(e.scope,t.scope);return n!==0||(n=br(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Nr(t),o=new Or(n,a.getId(r),a.getId(i)),s=new Ir(new Fr(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new wr(a,o,s)}var Nr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Pr=Object.freeze([]),Fr=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Pr,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Ir=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Fr.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(br(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Fr(e,t,n,r,i))}},Lr=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=zr(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Rr(e){return e}function zr(e){return e}function Br(e,t){let n=[],r=Hr(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Vr(i)){let e=[];do e.push(i),i=r.next();while(Vr(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Vr(e){return!!e&&!!e.match(/[\w\.:]+/)}function Hr(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Ur(e){typeof e.dispose==`function`&&e.dispose()}var Wr=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Gr=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Kr=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},qr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Wr(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Kr;for(let n of e)Jr(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Wr){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Jr(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof Wr?Xr({baseGrammar:a,selfGrammar:i},r):Yr(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new Wr(e))}function Yr(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Zr([r],t,n)}}function Xr(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Zr(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Zr(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Zr(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?hr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Zr(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ri(i);switch(a.kind){case 0:Xr({...t,selfGrammar:t.baseGrammar},n);break;case 1:Xr(t,n);break;case 2:Yr(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?Yr(a.ruleName,i,n):Xr(i,n)}else a.kind===4?n.add(new Gr(a.scopeName,a.ruleName)):n.add(new Wr(a.scopeName))}}}var Qr=class{kind=0},$r=class{kind=1},ei=class{constructor(e){this.ruleName=e}kind=2},ti=class{constructor(e){this.scopeName=e}kind=3},ni=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ri(e){if(e===`$base`)return new Qr;if(e===`$self`)return new $r;let t=e.indexOf(`#`);return t===-1?new ti(e):t===0?new ei(e.substring(1)):new ni(e.substring(0,t),e.substring(t+1))}var ii=/\\(\d+)/,ai=/\\(\d+)/g,oi=-1,si=-2;function ci(e){return e}function li(e){return e}var ui=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=vr.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=vr.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${gr(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:vr.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:vr.replaceCaptures(this._contentName,e,t)}},di=class extends ui{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},fi=class extends ui{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new _i(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new vi,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},pi=class extends ui{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new vi,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},mi=class extends ui{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new _i(i,this.id),this.beginCaptures=a,this._end=new _i(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new vi;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},hi=class extends ui{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new _i(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new _i(o,si),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new vi;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new vi,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},gi=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new di(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new fi(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=hr({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new pi(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new hi(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new mi(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ri(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof pi||e instanceof mi||e instanceof hi)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},_i=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&ii.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return ai.lastIndex=0,this.source.replace(ai,(e,t)=>Sr(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},vi=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new yi(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new yi(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},yi=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
3
+ `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},bi=class{constructor(e,t){this.languageId=e,this.tokenType=t}},xi=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new bi(e,8),this._embeddedLanguagesMatcher=new Si(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new bi(0,0);_getBasicScopeAttributes=new Cr(e=>new bi(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Si=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Sr(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Ci=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function wi(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ti(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Ci(i,!0);f()}return new Ci(i,!1);function f(){let o=Ei(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===oi){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),ji(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof mi){let r=o;ji(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof hi){let r=o;ji(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(ji(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Ti(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof hi&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Ai(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==si){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),ji(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Ei(e,t,n,r,i,a){let o=Di(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Oi(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Di(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=ki(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Oi(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=ki(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function ki(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Ai(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function ji(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));wi(e,p,n&&d.start===0,d.start,f,i,!1,0),Ur(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Mi(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Mi=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Ni(e,t,n,r,i,a,o,s){return new Li(e,t,n,r,i,a,o,s)}function Pi(e,t,n,r,i){let a=Br(t,Fi),o=gi.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Fi(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Ii(t[r],e))return n=r+1,!0;return!1})}function Ii(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Li=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new xi(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ri(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Br(e,Fi);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Pi(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Pi(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(ci(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[li(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Ri(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=gi.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Bi.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Lr.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?zi.createRootAndLookUpScopeName(a,r,this):zi.createRoot(`unknown`,r),t=new Bi(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
4
+ `;let a=this.createOnigString(e),o=a.content.length,s=new Hi(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=wi(this,a,i,0,t,s,!0,r);return Ur(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ri(e,t){return e=dr(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var zi=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Tr.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Tr(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Tr(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Lr.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Bi=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?zi.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:li(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=zi.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,ci(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,zi.fromExtension(r,n.contentNameScopesList))}},Vi=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Br(e,Fi).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Br(e,Fi).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Hi=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Lr.set(n,0,Rr(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Lr.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Ui=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,Ni(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},Wi=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Ui(wr.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(wr.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Vi(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new qr(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},Gi=Bi.NULL;function Ki(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function qi(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Ji(e){return Array.isArray(e)?e:[e]}async function Yi(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Xi(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function Zi(e){return e===`ansi`||Xi(e)}function Qi(e){return e===`none`}function $i(e){return Qi(e)}var ea=/(\r?\n)/g;function ta(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(ea),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var na={light:`#333333`,dark:`#bbbbbb`},ra={light:`#fffffe`,dark:`#1e1e1e`},ia=`__shiki_resolved`;function aa(e){if(e?.[ia])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?na.light:na.dark,n||=t.type===`light`?ra.light:ra.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,ia,{enumerable:!1,writable:!1,value:!0}),t}async function oa(e){return[...new Set((await Promise.all(e.filter(e=>!Zi(e)).map(async e=>await Yi(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function sa(e){return(await Promise.all(e.map(async e=>$i(e)?null:aa(await Yi(e))))).filter(e=>!!e)}function ca(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new ur(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var la=class extends Wi{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=aa(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=wr.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=ca(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new ur(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},ua=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},da=0;function fa(e){da+=1,e.warnings!==!1&&da>=10&&da%10==0&&console.warn(`[Shiki] ${da} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new ur("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(aa),i=new la(new ua(e.engine,n),r,n,e.langAlias),a;function o(t){return ca(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new ur(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new ur(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await oa(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await sa(e))}function g(){if(t)throw new ur(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--da)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function pa(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([sa(e.themes||[]),oa(e.langs||[]),e.engine]);return fa({...e,themes:t,langs:n,engine:r})}var ma=new WeakMap;function ha(e,t){ma.set(e,t)}function ga(e){return ma.get(e)}var _a=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(Ji(n).map(e=>[e,Gi])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return va(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function va(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function ya(e,t){if(!(e instanceof _a))throw new ur(`Invalid grammar state`);return e.getInternalStack(t)}var ba=/,/,xa=/ /;function Sa(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(Xi(e.resolveLangAlias(n.lang||`text`))||Qi(r))return ta(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new ur(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new ur(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return wa(t,o,i,a,n)}function Ca(...e){if(e.length===2)return ga(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Xi(i)||Qi(a))throw new ur(`Plain language does not have grammar state`);if(i===`ansi`)throw new ur(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new _a(Ta(n,c,o,s,r).stateStack,c.name,o.name)}function wa(e,t,n,r,i){let a=Ta(e,t,n,r,i),o=new _a(a.stateStack,t.name,n.name);return ha(a.tokens,o),a.tokens}function Ta(e,t,n,r,i){let a=Ki(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=ta(e),u=i.grammarState?ya(i.grammarState,n.name)??Gi:i.grammarContextCode==null?Gi:Ta(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=qi(r[Lr.getForeground(s)],a),u=Lr.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=Lr.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(ba).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(xa))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?Ea(t.scopes):Da(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function Ea(e){return e.map(e=>({scopeName:e}))}function Da(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Aa(e,i,t.slice(0,r))}}return n}function Oa(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function ka(e,t,n){if(!Oa(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Oa(e[r],n[i])&&--r,--i;return r===-1}function Aa(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(ka(e,t,n)){r.push(a);break}return r}function ja(e,t,n,r=Sa){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:ga(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Ma(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new _a(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&ha(s,c),s}function Ma(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var Na=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Pa=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Pa.prototype.normal={},Pa.prototype.property={},Pa.prototype.space=void 0;function Fa(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Pa(n,r,t)}function Ia(e){return e.toLowerCase()}var La=class{constructor(e,t){this.attribute=t,this.property=e}};La.prototype.attribute=``,La.prototype.booleanish=!1,La.prototype.boolean=!1,La.prototype.commaOrSpaceSeparated=!1,La.prototype.commaSeparated=!1,La.prototype.defined=!1,La.prototype.mustUseProperty=!1,La.prototype.number=!1,La.prototype.overloadedBoolean=!1,La.prototype.property=``,La.prototype.spaceSeparated=!1,La.prototype.space=void 0;var Ra=Ve({boolean:()=>W,booleanish:()=>Ba,commaOrSpaceSeparated:()=>Wa,commaSeparated:()=>Ua,number:()=>G,overloadedBoolean:()=>Va,spaceSeparated:()=>Ha}),za=0,W=Ga(),Ba=Ga(),Va=Ga(),G=Ga(),Ha=Ga(),Ua=Ga(),Wa=Ga();function Ga(){return 2**++za}var Ka=Object.keys(Ra),qa=class extends La{constructor(e,t,n,r){let i=-1;if(super(e,t),Ja(this,`space`,r),typeof n==`number`)for(;++i<Ka.length;){let e=Ka[i];Ja(this,Ka[i],(n&Ra[e])===Ra[e])}}};qa.prototype.defined=!0;function Ja(e,t,n){n&&(e[t]=n)}function Ya(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new qa(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Ia(r)]=r,n[Ia(a.attribute)]=r}return new Pa(t,n,e.space)}var Xa=Ya({properties:{ariaActiveDescendant:null,ariaAtomic:Ba,ariaAutoComplete:null,ariaBusy:Ba,ariaChecked:Ba,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:Ha,ariaCurrent:null,ariaDescribedBy:Ha,ariaDetails:null,ariaDisabled:Ba,ariaDropEffect:Ha,ariaErrorMessage:null,ariaExpanded:Ba,ariaFlowTo:Ha,ariaGrabbed:Ba,ariaHasPopup:null,ariaHidden:Ba,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ha,ariaLevel:G,ariaLive:null,ariaModal:Ba,ariaMultiLine:Ba,ariaMultiSelectable:Ba,ariaOrientation:null,ariaOwns:Ha,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:Ba,ariaReadOnly:Ba,ariaRelevant:null,ariaRequired:Ba,ariaRoleDescription:Ha,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:Ba,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Za(e,t){return t in e?e[t]:t}function Qa(e,t){return Za(e,t.toLowerCase())}var $a=Ya({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Ua,acceptCharset:Ha,accessKey:Ha,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alpha:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:Ha,autoFocus:W,autoPlay:W,blocking:Ha,capture:null,charSet:null,checked:W,cite:null,className:Ha,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:Ba,controls:W,controlsList:Ha,coords:G|Ua,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:Va,draggable:Ba,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:Ha,height:G,hidden:Va,high:G,href:null,hrefLang:null,htmlFor:Ha,httpEquiv:Ha,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:Ha,itemRef:Ha,itemScope:W,itemType:Ha,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:G,pattern:null,ping:Ha,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:Ha,required:W,reversed:W,rows:G,rowSpan:G,sandbox:Ha,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootCustomElementRegistry:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shadowRootSerializable:W,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:Ba,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:Ba,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ha,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:Ba,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:W,disablePictureInPicture:W,disableRemotePlayback:W,exportParts:Ua,part:Ha,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:Qa}),eo=Ya({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Wa,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:Ha,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ua,g2:Ua,glyphName:Ua,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:Wa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:G,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ha,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wa,rev:Wa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wa,requiredFeatures:Wa,requiredFonts:Wa,requiredFormats:Wa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:Wa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wa,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Za}),to=Ya({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),no=Ya({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Qa}),ro=Ya({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),io=/[A-Z]/g,ao=/-[a-z]/g,oo=/^data[-\w.:]+$/i;function so(e,t){let n=Ia(t),r=t,i=La;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&oo.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ao,lo);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ao.test(e)){let n=e.replace(io,co);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=qa}return new i(r,t)}function co(e){return`-`+e.toLowerCase()}function lo(e){return e.charAt(1).toUpperCase()}var uo=Fa([Xa,$a,to,no,ro],`html`),fo=Fa([Xa,eo,to,no,ro],`svg`),po={}.hasOwnProperty;function mo(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&po.call(t,e)){let n=String(t[e]);i=po.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var ho=/["&'<>`]/g,go=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,_o=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,vo=/[|\\{}()[\]^$+*?.]/g,yo=new WeakMap;function bo(e,t){return e=e.replace(t.subset?xo(t.subset):ho,r),t.subset||t.escapeOnly?e:e.replace(go,n).replace(_o,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function xo(e){let t=yo.get(e);return t||(t=So(e),yo.set(e,t)),t}function So(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(vo,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Co=/[\dA-Fa-f]/;function wo(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Co.test(String.fromCharCode(t))?r:r+`;`}var To=/\d/;function Eo(e,t,n){let r=`&#`+String(e);return n&&t&&!To.test(String.fromCharCode(t))?r:r+`;`}var Do=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),Oo={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},ko=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Ao={}.hasOwnProperty,jo={},Mo;for(Mo in Oo)Ao.call(Oo,Mo)&&(jo[Oo[Mo]]=Mo);var No=/[^\dA-Za-z]/;function Po(e,t,n,r){let i=String.fromCharCode(e);if(Ao.call(jo,i)){let e=jo[i],a=`&`+e;return n&&Do.includes(e)&&!ko.includes(e)&&(!r||t&&t!==61&&No.test(String.fromCharCode(t)))?a:a+`;`}return``}function Fo(e,t,n){let r=wo(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Po(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Eo(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Io(e,t){return bo(e,Object.assign({format:Fo},t))}var Lo=/^>|^->|<!--|-->|--!>|<!-$/g,Ro=[`>`],zo=[`<`,`>`];function Bo(e,t,n,r){return r.settings.bogusComments?`<?`+Io(e.value,Object.assign({},r.settings.characterReferences,{subset:Ro}))+`>`:`<!--`+e.value.replace(Lo,i)+`-->`;function i(e){return Io(e,Object.assign({},r.settings.characterReferences,{subset:zo}))}}function Vo(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Ho(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Uo(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Wo(e){return e.join(` `).trim()}var Go=/[ \t\n\f\r]/g;function Ko(e){return typeof e==`object`?e.type===`text`&&qo(e.value):qo(e)}function qo(e){return e.replace(Go,``)===``}var Jo=Zo(1),Yo=Zo(-1),Xo=[];function Zo(e){return t;function t(t,n,r){let i=t?t.children:Xo,a=(n||0)+e,o=i[a];if(!r)for(;o&&Ko(o);)a+=e,o=i[a];return o}}var Qo={}.hasOwnProperty;function $o(e){return t;function t(t,n,r){return Qo.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var es=$o({body:rs,caption:ts,colgroup:ts,dd:ss,dt:os,head:ts,html:ns,li:as,optgroup:ls,option:us,p:is,rp:cs,rt:cs,tbody:fs,td:hs,tfoot:ps,th:hs,thead:ds,tr:ms});function ts(e,t,n){let r=Jo(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Ko(r.value.charAt(0)))}function ns(e,t,n){let r=Jo(n,t);return!r||r.type!==`comment`}function rs(e,t,n){let r=Jo(n,t);return!r||r.type!==`comment`}function is(e,t,n){let r=Jo(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function as(e,t,n){let r=Jo(n,t);return!r||r.type===`element`&&r.tagName===`li`}function os(e,t,n){let r=Jo(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function ss(e,t,n){let r=Jo(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function cs(e,t,n){let r=Jo(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function ls(e,t,n){let r=Jo(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function us(e,t,n){let r=Jo(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function ds(e,t,n){let r=Jo(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function fs(e,t,n){let r=Jo(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function ps(e,t,n){return!Jo(n,t)}function ms(e,t,n){let r=Jo(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function hs(e,t,n){let r=Jo(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var gs=$o({body:ys,colgroup:bs,head:vs,html:_s,tbody:xs});function _s(e){let t=Jo(e,-1);return!t||t.type!==`comment`}function vs(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ys(e){let t=Jo(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Ko(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function bs(e,t,n){let r=Yo(n,t),i=Jo(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&es(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function xs(e,t,n){let r=Yo(n,t),i=Jo(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&es(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Ss={name:[[`
5
5
  \f\r &/=>`.split(``),`
6
6
  \f\r "&'/=>\``.split(``)],[`\0
7
7
  \f\r "&'/<=>`.split(``),`\0
@@ -9,10 +9,10 @@ import{$ as e,$t as t,A as n,An as r,At as i,B as a,C as o,Ct as s,D as c,Dn as
9
9
  \f\r &>`.split(``),`\0
10
10
  \f\r "&'<=>\``.split(``)],[`\0
11
11
  \f\r "&'<=>\``.split(``),`\0
12
- \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function xs(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=lo);let l=Ss(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!ms(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!Qo(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Ss(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Cs(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function Cs(e,t,n){let r=ao(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=Po(r.attribute,Object.assign({},e.settings.characterReferences,{subset:bs.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Vo:Ho)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=Po(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:bs.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Bo(n,o)>Bo(n,e.alternative)&&(o=e.alternative),s=o+Po(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?bs.single:bs.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var ws=[`<`,`&`];function Ts(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Po(e.value,Object.assign({},r.settings.characterReferences,{subset:ws}))}function Es(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Ts(e,t,n,r)}function Ds(e,t,n,r){return r.all(e)}var Os=fo(`type`,{invalid:ks,unknown:As,handlers:{comment:Ro,doctype:zo,element:xs,raw:Es,root:Ds,text:Ts}});function ks(e){throw Error("Expected node, not `"+e+"`")}function As(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var js={},Ms={},Ns=[];function Ps(e,t){let n=t||js,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Fs,all:Is,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||ja,characterReferences:n.characterReferences||Ms,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?lo:co,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Fs(e,t,n){return Os(e,t,n,this)}function Is(e){let t=[],n=e&&e.children||Ns,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var Ls=/\s+/g;function Rs(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(Ls)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(Ls);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var zs=/:?lang=["']([^"']+)["']/g,Bs=/(?:```|~~~)([\w-]+)/g,Vs=/\\begin\{([\w-]+)\}/g,Hs=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,Us=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function Ws(e){let t=$i(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function Gs(e,t,n){let r=new Set;for(let t of e.matchAll(zs)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Bs)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Vs)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Hs)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(Us.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var Ks=[`color`,`background-color`];function qs(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Js(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function Ys(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=Js(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return qs(e,a)})):e}function Xs(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>Zs(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&Ks.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new cr('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function Zs(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&kr.Italic&&(t[`font-style`]=`italic`),e.fontStyle&kr.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&kr.Underline&&n.push(`underline`),e.fontStyle&kr.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function Qs(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function $s(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=Ws(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new cr(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new cr(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new cr(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));ec(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return Ys(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new cr(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=tc(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new cr(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new cr(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Rs(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function ec(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new cr(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new cr(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function tc(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(tc).join(``):``}var nc=[$s()];function rc(e){let t=ic(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...nc]}function ic(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var ac=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],oc={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function sc(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function cc(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function lc(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)oc[r]&&t.push({type:`setDecoration`,value:oc[r]});else if(r<=29){let e=oc[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:ac[r-30]}});else if(r===38){let n=cc(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:ac[r-40]}});else if(r===48){let n=cc(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:ac[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:ac[r-100+8]}})}}return t}function uc(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=sc(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=lc(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var dc={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function fc(e=dc){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<ac.length;e++)r.push(t(ac[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var pc=/#([0-9a-f]{3,8})/i,mc=/var\((--[\w-]+-ansi-[\w-]+)\)/,hc={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function gc(e,t,n){let r=Wi(e,n),i=$i(t),a=fc(Object.fromEntries(ac.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||hc[t]]}))),o=uc();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=Gi(i,r),o=Gi(o,r),n.decorations.has(`dim`)&&(i=_c(i));let s=kr.None;return n.decorations.has(`bold`)&&(s|=kr.Bold),n.decorations.has(`italic`)&&(s|=kr.Italic),n.decorations.has(`underline`)&&(s|=kr.Underline),n.decorations.has(`strikethrough`)&&(s|=kr.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function _c(e){let t=e.match(pc);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(mc);return n?`var(${n[1]}-dim)`:e}function vc(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!Ji(r)&&!Xi(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return gc(r,t,n)}return ba(e,t,n)}function yc(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new cr("`themes` option must not be empty");let p=ka(e,t,n,vc);if(c=ma(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new cr(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>Xs(e,h,u,l,d))),c&&pa(a,c);let g=f.map(e=>Wi(e.theme,n));i=bc(f,m,g,u,l,`fg`,d),r=bc(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=Wi(n.theme,n);a=vc(e,t,n);let l=e.getTheme(n.theme);r=Gi(l.bg,s),i=Gi(l.fg,s),o=l.name,c=ma(a)}else throw new cr("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function bc(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Gi(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new cr('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Gi(t[r][a],n[r])||`inherit`}, ${Gi(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var xc=/^\s+$/,Sc=/^(\s*)(.*?)(\s*)$/;function Cc(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Cc(e,t,n),codeToTokens:(t,n)=>yc(e,t,n)}){let i=t;for(let e of rc(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=yc(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Tc(a):d===`never`&&(a=Ec(a)),f&&(a=Dc(a));let p={...r,get source(){return i}};for(let e of rc(n))a=e.tokens?.call(p,a)||a;return wc(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function wc(e,t,n,r=ma(e)){let i=rc(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:Rs,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
13
- `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=Qs(a.htmlStyle||Zs(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&pa(m,r),m}function Tc(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&kr.Underline||i.fontStyle&kr.Strikethrough));o&&xc.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Ec(e){return e.map(e=>e.flatMap(e=>{if(xc.test(e.content))return e;let t=e.content.match(Sc);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function Dc(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=Qs(e.htmlStyle||Zs(e)),i=Qs(n.htmlStyle||Zs(n)),a=e.fontStyle&&(e.fontStyle&kr.Underline||e.fontStyle&kr.Strikethrough),o=n.fontStyle&&(n.fontStyle&kr.Underline||n.fontStyle&kr.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Oc=Ps;function kc(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Cc(e,t,n),codeToTokens:(t,n)=>yc(e,t,n)},i=Oc(Cc(e,t,n,r));for(let e of rc(n))i=e.postprocess?.call(r,i,n)||i;return i}async function Ac(e){let t=await da(e);return{getLastGrammarState:(...e)=>xa(t,...e),codeToTokensBase:(e,n)=>vc(t,e,n),codeToTokensWithThemes:(e,n)=>ka(t,e,n),codeToTokens:(e,n)=>yc(t,e,n),codeToHast:(e,n)=>Cc(t,e,n),codeToHtml:(e,n)=>kc(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function jc(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,Yi(n))return[];let r=t[n];if(!r)throw new cr(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(Zi(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new cr(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await Ac({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function Mc(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function Nc(e,t){let n=Mc(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var Pc=jc({langs:An,themes:jn,engine:()=>(0,sr.createOnigurumaEngine)(B(()=>import(`./_sWLklcDZ.js`),[]))}),{codeToHtml:Fc,codeToHast:Ic,codeToTokens:Lc,codeToTokensBase:Rc,codeToTokensWithThemes:zc,getSingletonHighlighter:Bc,getLastGrammarState:Vc}=Nc(Pc,{guessEmbeddedLanguages:Gs}),Hc=4294967295,Uc=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:Hc,end:Hc,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function Wc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Gc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Kc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),qc=String.raw;function Jc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Yc=qc`\[\^?`,Xc=`c.? | C(?:-.?)?|${qc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${qc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${qc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${qc`o\{[^\}]*\}?`}|${qc`\d{1,3}`}`,Zc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Qc=new RegExp(qc`
12
+ \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Cs(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=fo);let l=ws(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!gs(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!es(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function ws(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Ts(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function Ts(e,t,n){let r=so(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=Io(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Ss.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Uo:Wo)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=Io(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Ss.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Ho(n,o)>Ho(n,e.alternative)&&(o=e.alternative),s=o+Io(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Ss.single:Ss.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Es=[`<`,`&`];function Ds(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Io(e.value,Object.assign({},r.settings.characterReferences,{subset:Es}))}function Os(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Ds(e,t,n,r)}function ks(e,t,n,r){return r.all(e)}var As=mo(`type`,{invalid:js,unknown:Ms,handlers:{comment:Bo,doctype:Vo,element:Cs,raw:Os,root:ks,text:Ds}});function js(e){throw Error("Expected node, not `"+e+"`")}function Ms(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Ns={},Ps={},Fs=[];function Is(e,t){let n=t||Ns,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Ls,all:Rs,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Na,characterReferences:n.characterReferences||Ps,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?fo:uo,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Ls(e,t,n){return As(e,t,n,this)}function Rs(e){let t=[],n=e&&e.children||Fs,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var zs=/\s+/g;function Bs(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(zs)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(zs);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var Vs=/:?lang=["']([^"']+)["']/g,Hs=/(?:```|~~~)([\w-]+)/g,Us=/\\begin\{([\w-]+)\}/g,Ws=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,Gs=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function Ks(e){let t=ta(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function qs(e,t,n){let r=new Set;for(let t of e.matchAll(Vs)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Hs)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Us)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Ws)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(Gs.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var Js=[`color`,`background-color`];function Ys(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Xs(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function Zs(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=Xs(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return Ys(e,a)})):e}function Qs(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>$s(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&Js.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new ur('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function $s(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&jr.Italic&&(t[`font-style`]=`italic`),e.fontStyle&jr.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&jr.Underline&&n.push(`underline`),e.fontStyle&jr.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function ec(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function tc(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=Ks(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new ur(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new ur(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new ur(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));nc(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return Zs(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new ur(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=rc(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new ur(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new ur(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Bs(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function nc(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new ur(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new ur(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function rc(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(rc).join(``):``}var ic=[tc()];function ac(e){let t=oc(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...ic]}function oc(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var sc=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],cc={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function lc(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function uc(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function dc(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)cc[r]&&t.push({type:`setDecoration`,value:cc[r]});else if(r<=29){let e=cc[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:sc[r-30]}});else if(r===38){let n=uc(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:sc[r-40]}});else if(r===48){let n=uc(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:sc[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:sc[r-100+8]}})}}return t}function fc(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=lc(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=dc(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var pc={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function mc(e=pc){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<sc.length;e++)r.push(t(sc[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var hc=/#([0-9a-f]{3,8})/i,gc=/var\((--[\w-]+-ansi-[\w-]+)\)/,_c={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function vc(e,t,n){let r=Ki(e,n),i=ta(t),a=mc(Object.fromEntries(sc.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||_c[t]]}))),o=fc();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=qi(i,r),o=qi(o,r),n.decorations.has(`dim`)&&(i=yc(i));let s=jr.None;return n.decorations.has(`bold`)&&(s|=jr.Bold),n.decorations.has(`italic`)&&(s|=jr.Italic),n.decorations.has(`underline`)&&(s|=jr.Underline),n.decorations.has(`strikethrough`)&&(s|=jr.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function yc(e){let t=e.match(hc);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(gc);return n?`var(${n[1]}-dim)`:e}function bc(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!Xi(r)&&!Qi(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return vc(r,t,n)}return Sa(e,t,n)}function xc(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new ur("`themes` option must not be empty");let p=ja(e,t,n,bc);if(c=ga(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new ur(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>Qs(e,h,u,l,d))),c&&ha(a,c);let g=f.map(e=>Ki(e.theme,n));i=Sc(f,m,g,u,l,`fg`,d),r=Sc(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=Ki(n.theme,n);a=bc(e,t,n);let l=e.getTheme(n.theme);r=qi(l.bg,s),i=qi(l.fg,s),o=l.name,c=ga(a)}else throw new ur("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Sc(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=qi(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new ur('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${qi(t[r][a],n[r])||`inherit`}, ${qi(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var Cc=/^\s+$/,wc=/^(\s*)(.*?)(\s*)$/;function Tc(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Tc(e,t,n),codeToTokens:(t,n)=>xc(e,t,n)}){let i=t;for(let e of ac(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=xc(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Dc(a):d===`never`&&(a=Oc(a)),f&&(a=kc(a));let p={...r,get source(){return i}};for(let e of ac(n))a=e.tokens?.call(p,a)||a;return Ec(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function Ec(e,t,n,r=ga(e)){let i=ac(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:Bs,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
13
+ `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=ec(a.htmlStyle||$s(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&ha(m,r),m}function Dc(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&jr.Underline||i.fontStyle&jr.Strikethrough));o&&Cc.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Oc(e){return e.map(e=>e.flatMap(e=>{if(Cc.test(e.content))return e;let t=e.content.match(wc);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function kc(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=ec(e.htmlStyle||$s(e)),i=ec(n.htmlStyle||$s(n)),a=e.fontStyle&&(e.fontStyle&jr.Underline||e.fontStyle&jr.Strikethrough),o=n.fontStyle&&(n.fontStyle&jr.Underline||n.fontStyle&jr.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Ac=Is;function jc(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Tc(e,t,n),codeToTokens:(t,n)=>xc(e,t,n)},i=Ac(Tc(e,t,n,r));for(let e of ac(n))i=e.postprocess?.call(r,i,n)||i;return i}async function Mc(e){let t=await pa(e);return{getLastGrammarState:(...e)=>Ca(t,...e),codeToTokensBase:(e,n)=>bc(t,e,n),codeToTokensWithThemes:(e,n)=>ja(t,e,n),codeToTokens:(e,n)=>xc(t,e,n),codeToHast:(e,n)=>Tc(t,e,n),codeToHtml:(e,n)=>jc(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Nc(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,Zi(n))return[];let r=t[n];if(!r)throw new ur(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if($i(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new ur(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await Mc({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function Pc(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function Fc(e,t){let n=Pc(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var Ic=Nc({langs:Mn,themes:Nn,engine:()=>(0,lr.createOnigurumaEngine)(B(()=>import(`./_sWLklcDZ.js`),[]))}),{codeToHtml:Lc,codeToHast:Rc,codeToTokens:zc,codeToTokensBase:Bc,codeToTokensWithThemes:Vc,getSingletonHighlighter:Hc,getLastGrammarState:Uc}=Fc(Ic,{guessEmbeddedLanguages:qs}),Wc=4294967295,Gc=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:Wc,end:Wc,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function Kc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function qc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Jc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),Yc=String.raw;function Xc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Zc=Yc`\[\^?`,Qc=`c.? | C(?:-.?)?|${Yc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Yc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Yc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Yc`o\{[^\}]*\}?`}|${Yc`\d{1,3}`}`,$c=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,el=new RegExp(Yc`
14
14
  \\ (?:
15
- ${Xc}
15
+ ${Qc}
16
16
  | [gk]<[^>]*>?
17
17
  | [gk]'[^']*'?
18
18
  | .
@@ -29,20 +29,20 @@ import{$ as e,$t as t,A as n,An as r,At as i,B as a,C as o,Ct as s,D as c,Dn as
29
29
  )?
30
30
  | \*[^\)]*\)?
31
31
  )?
32
- | (?:${Zc.source})+
33
- | ${Yc}
32
+ | (?:${$c.source})+
33
+ | ${Zc}
34
34
  | .
35
- `.replace(/\s+/g,``),`gsu`),$c=new RegExp(qc`
35
+ `.replace(/\s+/g,``),`gsu`),tl=new RegExp(Yc`
36
36
  \\ (?:
37
- ${Xc}
37
+ ${Qc}
38
38
  | .
39
39
  )
40
40
  | \[:(?:\^?\p{Alpha}+|\^):\]
41
- | ${Yc}
41
+ | ${Zc}
42
42
  | &&
43
43
  | .
44
- `.replace(/\s+/g,``),`gsu`);function el(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=Al(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(Qc.lastIndex=0;s=Qc.exec(e);){let t=tl(a,e,s[0],Qc.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(Qc.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Ml(e,u):e).flat(),flags:r}}function tl(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=nl(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:ol(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:bl(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:sl(n)}}if(a===`K`)return{token:ml(`keep`,n)};if(a===`N`||a===`R`)return{token:pl(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:pl(`any`,n)};if(a===`X`)return{token:pl(`text_segment`,n)};let e=il(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Tl(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:wl(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:_l(`group`,n)};if(n===`(?>`)return{token:_l(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:_l(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:_l(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:_l(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:gl(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
45
- `,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:pl(`dot`,n)}:n===`^`||n===`$`?{token:ol(e.singleline?{"^":qc`\A`,$:qc`\Z`}[n]:n,n)}:n===`|`?{token:al(n)}:Zc.test(n)?{tokens:Nl(n)}:{token:cl(Wc(n),n)}}function nl(e,t,n){let r=[fl(t[1]===`^`,t)],i=1,a;for($c.lastIndex=n;a=$c.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(fl(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(cl(93,e));else if(i--,r.push(ll(e)),!i)break}else{let t=rl(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:$c.lastIndex||e.length}}function rl(e){if(e[0]===`\\`)return il(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Kc.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return pl(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?ul(e):e===`&&`?dl(e):cl(Wc(e),e)}function il(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Cl(e);if(`dDhHsSwW`.includes(n))return Dl(e);if(e.startsWith(qc`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return Ol(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return cl(Wc(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return cl(jl(e),e);if(Sl.has(n))return cl(Sl.get(n),e);if(/\d/.test(n))return hl(t,e);if(e===`\\`)throw Error(qc`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return cl(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function al(e){return{type:`Alternator`,raw:e}}function ol(e,t){return{type:`Assertion`,kind:e,raw:t}}function sl(e){return{type:`Backreference`,raw:e}}function cl(e,t){return{type:`Character`,value:e,raw:t}}function ll(e){return{type:`CharacterClassClose`,raw:e}}function ul(e){return{type:`CharacterClassHyphen`,raw:e}}function dl(e){return{type:`CharacterClassIntersector`,raw:e}}function fl(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function pl(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function ml(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Jc(n.flags),raw:t}}function hl(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function gl(e){return{type:`GroupClose`,raw:e}}function _l(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function vl(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function yl(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function bl(e){return{type:`Subroutine`,raw:e}}var xl=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),Sl=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Cl(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return cl(Wc(t.toUpperCase())-64,e)}function wl(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=kl(n),o=kl(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),ml(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,_l(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Tl(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=xl.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return vl(l,r??null,i?.split(`,`)??null,e)}function El(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return yl(t,n,r,e)}function Dl(e){let t=e[1].toLowerCase();return pl({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function Ol(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return pl(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function kl(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function Al(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function jl(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function Ml(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[sl(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(qc`Octal encoded byte above 177 unsupported "${n}"`)}else r=Wc(t);a.push(cl(r,(e===0?`\\`:``)+t))}return a}function Nl(e){let t=[],n=new RegExp(Zc,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(El(e.slice(0,-1)));continue}}}t.push(El(e))}return t}function Pl(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function Fl(e){return Il.has(e.type)}var Il=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function Ll(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=el(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return ql();case`Assertion`:return Rl(n);case`Backreference`:return zl(n,a);case`Character`:return Zl(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Bl(n,a,t);case`CharacterClassOpen`:return Vl(n,a,t);case`CharacterSet`:return Hl(n,a);case`Directive`:return tu(n.kind,{flags:n.flags});case`GroupOpen`:return Ul(n,a,t);case`NamedCallout`:return au(n.kind,n.tag,n.arguments);case`Quantifier`:return Wl(n,a);case`Subroutine`:return Gl(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=cu(nu(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(qc`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(qc`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function Rl({kind:e}){return Jl(Jc({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===qc`\B`||e===qc`\Y`})}function zl({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,Yl(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return Yl(r)}return i(+r)}function Bl(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),$l(o,e);throw Error(`Invalid character class range`)}return Zl(Wc(`-`))}function Vl({negate:e},t,n){let{tokens:r,walk:i}=t,a=[Ql()],o=r[t.nextIndex],s=yu(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(Ql()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=yu(r[t.nextIndex],o)}let c=Ql({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function Hl({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=vu(n);if(Kc.has(r)&&!o?.has(r))e=`posix`,n=r;else return uu(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?ou(n,{negate:t}):eu(e,{negate:t})}function Ul(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=du(e),l=c.type===`AbsenceFunction`,u=hu(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&Gc(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=bu(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(ql()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(mu(t)||t.type===`CapturingGroup`)throw Error(e)}else if(mu(t)||hu(t)&&t.negate)throw Error(e)}}f=bu(r[t.nextIndex])}return t.nextIndex++,c}function Wl({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!Fl(a))throw Error(`Quantifier requires a repeatable token`);let o=su(e,t,n,a);return i.body.pop(),o}function Gl({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=lu(i);return r.push(o),o}function Kl(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:fu(t?.body)}}function ql(e){return{type:`Alternative`,body:pu(e?.body)}}function Jl(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function Yl(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function Xl(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!gu(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:fu(t?.body)}}function Zl(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function Ql(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:pu(e?.body)}}function $l(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function eu(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function tu(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:Jc(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function nu(e){return{type:`Flags`,...e}}function ru(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:fu(e?.body)}}function iu(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:fu(e?.body)}}function au(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function ou(e,t){let n=!!t?.negate;if(!Kc.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function su(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function cu(e,t){return{type:`Regex`,body:fu(t?.body),flags:e}}function lu(e){return{type:`Subroutine`,ref:e}}function uu(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(vu(e));if(!r){if(n.normalizeUnknownPropertyNames)r=_u(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(qc`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function du({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return Kl(`repeater`);case`atomic`:return ru({atomic:!0});case`capturing`:return Xl(i,{name:n});case`group`:return ru({flags:e});case`lookahead`:case`lookbehind`:return iu({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function fu(e){if(e===void 0)e=[ql()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function pu(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function mu(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function hu(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function gu(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function _u(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function vu(e){return e.replace(/[- _]+/g,``).toLowerCase()}function yu(e,t){let n=t;return Jc(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function bu(e){return Jc(e,`Unclosed group`)}function xu(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){Su(c).splice(Math.max(0,Cu(s)+l),1),l--,u=!0},removeAllNextSiblings(){return Su(c).splice(Cu(s)+1)},removeAllPrevSiblings(){let e=Cu(s)+l;return l-=e,Su(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,Cu(s)+l)]=e:Jc(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(Su(c).splice(Math.max(0,Cu(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,Cu(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function Su(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function Cu(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var wu=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Tu(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Eu(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Du=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function Ou(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===Du.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?Du.CHAR_CLASS:Du.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function ku(e,t,n,r){Ou(e,t,n,r)}function Au(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===Du.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function ju(e,t,n){return!!Au(e,t,0,n)}function Mu(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var Nu=new RegExp(String.raw`(?<noncapturingStart>${wu})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Pu(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(Nu.lastIndex=Number.isNaN(c)?0:c+7;f=Nu.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),Tu(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=Ou(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},Du.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var Fu=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Iu=new RegExp(String.raw`
44
+ `.replace(/\s+/g,``),`gsu`);function nl(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=Ml(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(el.lastIndex=0;s=el.exec(e);){let t=rl(a,e,s[0],el.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(el.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Pl(e,u):e).flat(),flags:r}}function rl(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=il(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:cl(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Sl(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:ll(n)}}if(a===`K`)return{token:gl(`keep`,n)};if(a===`N`||a===`R`)return{token:hl(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:hl(`any`,n)};if(a===`X`)return{token:hl(`text_segment`,n)};let e=ol(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Dl(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:El(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:yl(`group`,n)};if(n===`(?>`)return{token:yl(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:yl(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:yl(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:yl(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:vl(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
45
+ `,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:hl(`dot`,n)}:n===`^`||n===`$`?{token:cl(e.singleline?{"^":Yc`\A`,$:Yc`\Z`}[n]:n,n)}:n===`|`?{token:sl(n)}:$c.test(n)?{tokens:Fl(n)}:{token:ul(Kc(n),n)}}function il(e,t,n){let r=[ml(t[1]===`^`,t)],i=1,a;for(tl.lastIndex=n;a=tl.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(ml(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(ul(93,e));else if(i--,r.push(dl(e)),!i)break}else{let t=al(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:tl.lastIndex||e.length}}function al(e){if(e[0]===`\\`)return ol(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Jc.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return hl(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?fl(e):e===`&&`?pl(e):ul(Kc(e),e)}function ol(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Tl(e);if(`dDhHsSwW`.includes(n))return kl(e);if(e.startsWith(Yc`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return Al(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return ul(Kc(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return ul(Nl(e),e);if(wl.has(n))return ul(wl.get(n),e);if(/\d/.test(n))return _l(t,e);if(e===`\\`)throw Error(Yc`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return ul(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function sl(e){return{type:`Alternator`,raw:e}}function cl(e,t){return{type:`Assertion`,kind:e,raw:t}}function ll(e){return{type:`Backreference`,raw:e}}function ul(e,t){return{type:`Character`,value:e,raw:t}}function dl(e){return{type:`CharacterClassClose`,raw:e}}function fl(e){return{type:`CharacterClassHyphen`,raw:e}}function pl(e){return{type:`CharacterClassIntersector`,raw:e}}function ml(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function hl(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function gl(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Xc(n.flags),raw:t}}function _l(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function vl(e){return{type:`GroupClose`,raw:e}}function yl(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function bl(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function xl(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function Sl(e){return{type:`Subroutine`,raw:e}}var Cl=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),wl=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Tl(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return ul(Kc(t.toUpperCase())-64,e)}function El(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=jl(n),o=jl(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),gl(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,yl(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Dl(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=Cl.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return bl(l,r??null,i?.split(`,`)??null,e)}function Ol(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return xl(t,n,r,e)}function kl(e){let t=e[1].toLowerCase();return hl({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function Al(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return hl(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function jl(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function Ml(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function Nl(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function Pl(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[ll(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(Yc`Octal encoded byte above 177 unsupported "${n}"`)}else r=Kc(t);a.push(ul(r,(e===0?`\\`:``)+t))}return a}function Fl(e){let t=[],n=new RegExp($c,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(Ol(e.slice(0,-1)));continue}}}t.push(Ol(e))}return t}function Il(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function Ll(e){return Rl.has(e.type)}var Rl=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function zl(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=nl(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return Yl();case`Assertion`:return Bl(n);case`Backreference`:return Vl(n,a);case`Character`:return $l(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Hl(n,a,t);case`CharacterClassOpen`:return Ul(n,a,t);case`CharacterSet`:return Wl(n,a);case`Directive`:return ru(n.kind,{flags:n.flags});case`GroupOpen`:return Gl(n,a,t);case`NamedCallout`:return su(n.kind,n.tag,n.arguments);case`Quantifier`:return Kl(n,a);case`Subroutine`:return ql(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=uu(iu(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(Yc`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(Yc`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function Bl({kind:e}){return Xl(Xc({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===Yc`\B`||e===Yc`\Y`})}function Vl({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,Zl(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return Zl(r)}return i(+r)}function Hl(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),tu(o,e);throw Error(`Invalid character class range`)}return $l(Kc(`-`))}function Ul({negate:e},t,n){let{tokens:r,walk:i}=t,a=[eu()],o=r[t.nextIndex],s=xu(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(eu()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=xu(r[t.nextIndex],o)}let c=eu({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function Wl({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=bu(n);if(Jc.has(r)&&!o?.has(r))e=`posix`,n=r;else return fu(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?cu(n,{negate:t}):nu(e,{negate:t})}function Gl(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=pu(e),l=c.type===`AbsenceFunction`,u=_u(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&qc(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=Su(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(Yl()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(gu(t)||t.type===`CapturingGroup`)throw Error(e)}else if(gu(t)||_u(t)&&t.negate)throw Error(e)}}f=Su(r[t.nextIndex])}return t.nextIndex++,c}function Kl({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!Ll(a))throw Error(`Quantifier requires a repeatable token`);let o=lu(e,t,n,a);return i.body.pop(),o}function ql({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=du(i);return r.push(o),o}function Jl(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:mu(t?.body)}}function Yl(e){return{type:`Alternative`,body:hu(e?.body)}}function Xl(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function Zl(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function Ql(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!vu(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:mu(t?.body)}}function $l(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function eu(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:hu(e?.body)}}function tu(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function nu(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function ru(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:Xc(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function iu(e){return{type:`Flags`,...e}}function au(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:mu(e?.body)}}function ou(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:mu(e?.body)}}function su(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function cu(e,t){let n=!!t?.negate;if(!Jc.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function lu(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function uu(e,t){return{type:`Regex`,body:mu(t?.body),flags:e}}function du(e){return{type:`Subroutine`,ref:e}}function fu(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(bu(e));if(!r){if(n.normalizeUnknownPropertyNames)r=yu(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(Yc`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function pu({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return Jl(`repeater`);case`atomic`:return au({atomic:!0});case`capturing`:return Ql(i,{name:n});case`group`:return au({flags:e});case`lookahead`:case`lookbehind`:return ou({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function mu(e){if(e===void 0)e=[Yl()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function hu(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function gu(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function _u(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function vu(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function yu(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function bu(e){return e.replace(/[- _]+/g,``).toLowerCase()}function xu(e,t){let n=t;return Xc(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function Su(e){return Xc(e,`Unclosed group`)}function Cu(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){wu(c).splice(Math.max(0,Tu(s)+l),1),l--,u=!0},removeAllNextSiblings(){return wu(c).splice(Tu(s)+1)},removeAllPrevSiblings(){let e=Tu(s)+l;return l-=e,wu(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,Tu(s)+l)]=e:Xc(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(wu(c).splice(Math.max(0,Tu(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,Tu(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function wu(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function Tu(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var Eu=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Du(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Ou(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var ku=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function Au(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===ku.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?ku.CHAR_CLASS:ku.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function ju(e,t,n,r){Au(e,t,n,r)}function Mu(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===ku.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Nu(e,t,n){return!!Mu(e,t,0,n)}function Pu(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var Fu=new RegExp(String.raw`(?<noncapturingStart>${Eu})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Iu(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(Fu.lastIndex=Number.isNaN(c)?0:c+7;f=Fu.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),Du(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=Au(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},ku.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var Lu=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Ru=new RegExp(String.raw`
46
46
  \\(?: \d+
47
47
  | c[A-Za-z]
48
48
  | [gk]<[^>]+>
@@ -55,9 +55,9 @@ import{$ as e,$t as t,A as n,An as r,At as i,B as a,C as o,Ct as s,D as c,Dn as
55
55
  | [A-Za-z\-]+:
56
56
  | \(DEFINE\)
57
57
  ))?
58
- | (?<qBase>${Fu})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
58
+ | (?<qBase>${Lu})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
59
59
  | \\?.
60
- `.replace(/\s+/g,``),`gsu`);function Lu(e){if(!RegExp(`${Fu}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Iu.lastIndex=0;o=Iu.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Eu(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}Iu.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var Ru=String.raw,zu=Ru`\(\?R=(?<rDepth>[^\)]+)\)|${Ru`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Bu=Ru`\(\?<(?![=!])(?<captureName>[^>]+)>`,Vu=Ru`${Bu}|(?<unnamed>\()(?!\?)`,Hu=new RegExp(Ru`${Bu}|${zu}|\(\?|\\?.`,`gsu`),Uu=`Cannot use multiple overlapping recursions`;function Wu(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(zu,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&ju(e,Ru`\(\?\(DEFINE\)`,Du.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=ju(e,Ru`\\[1-9]`,Du.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(Hu.lastIndex=0;f=Hu.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(Gu(m),l)throw Error(Uu);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(Hu.lastIndex);if(ju(s,zu,Du.DEFAULT))throw Error(Uu);let c=m-1;e=Ku(t,s,c,!1,n,a,d),i=Yu(i,t,c,a.length,0,d);break}if(h){Gu(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Uu);break}if(!u)throw Error(Ru`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Ru`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Mu(e,p);if(o&&ju(m,Ru`${Bu}|\((?!\?)`,Du.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=Ku(_,v,b,!0,n,a,d);i=Yu(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,Hu.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),Hu.lastIndex),s.set(p,Hu.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),Hu.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Gu(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function Ku(e,t,n,r,i,a,o){let s=new Set;r&&ku(e+t,Bu,({groups:{captureName:e}})=>{s.add(e)},Du.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${qu(`(?:${e}`,`forward`,...c)}(?:)${qu(`${t})`,`backward`,...c)}${t}`}function qu(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Ou(e,Ru`${Vu}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),Ju(i,n),s?e:`(?<${t}${l}>`}return Ru`\k<${c}${l}>`},Du.DEFAULT)}return c}function Ju(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Yu(e,t,n,r,i,a){if(e.size&&r){let o=0;ku(t,Vu,()=>o++,Du.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var Xu=String.fromCodePoint,K=String.raw,Zu={},Qu=globalThis.RegExp;Zu.flagGroups=(()=>{try{new Qu(`(?i:)`)}catch{return!1}return!0})(),Zu.unicodeSets=(()=>{try{new Qu(`[[]]`,`v`)}catch{return!1}return!0})(),Zu.bugFlagVLiteralHyphenIsRange=Zu.unicodeSets?(()=>{try{new Qu(K`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,Zu.bugNestedClassIgnoresNegation=Zu.unicodeSets&&new Qu(`[[^a]]`,`v`).test(`a`);function $u(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function ed(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function td(e,t){return rd[e]>=rd[t]}function nd(e,t){if(e==null)throw Error(t??`Value expected`);return e}var rd={ES2025:2025,ES2024:2024,ES2018:2018},id={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function ad(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!id[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=Zu.flagGroups?`ES2025`:Zu.unicodeSets?`ES2024`:`ES2018`),t}var od=`[ -\r ]`,sd=new Set([Xu(304),Xu(305)]),cd=K`[\p{L}\p{M}\p{N}\p{Pc}]`;function ld(e){if(sd.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=pd.get(n),a=dd.get(n),o=fd.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var ud=new Map(`C Other
60
+ `.replace(/\s+/g,``),`gsu`);function zu(e){if(!RegExp(`${Lu}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Ru.lastIndex=0;o=Ru.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Ou(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}Ru.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var Bu=String.raw,Vu=Bu`\(\?R=(?<rDepth>[^\)]+)\)|${Bu`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Hu=Bu`\(\?<(?![=!])(?<captureName>[^>]+)>`,Uu=Bu`${Hu}|(?<unnamed>\()(?!\?)`,Wu=new RegExp(Bu`${Hu}|${Vu}|\(\?|\\?.`,`gsu`),Gu=`Cannot use multiple overlapping recursions`;function Ku(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Vu,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Nu(e,Bu`\(\?\(DEFINE\)`,ku.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Nu(e,Bu`\\[1-9]`,ku.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(Wu.lastIndex=0;f=Wu.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(qu(m),l)throw Error(Gu);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(Wu.lastIndex);if(Nu(s,Vu,ku.DEFAULT))throw Error(Gu);let c=m-1;e=Ju(t,s,c,!1,n,a,d),i=Zu(i,t,c,a.length,0,d);break}if(h){qu(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Gu);break}if(!u)throw Error(Bu`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Bu`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Pu(e,p);if(o&&Nu(m,Bu`${Hu}|\((?!\?)`,ku.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=Ju(_,v,b,!0,n,a,d);i=Zu(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,Wu.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),Wu.lastIndex),s.set(p,Wu.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),Wu.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function qu(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function Ju(e,t,n,r,i,a,o){let s=new Set;r&&ju(e+t,Hu,({groups:{captureName:e}})=>{s.add(e)},ku.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${Yu(`(?:${e}`,`forward`,...c)}(?:)${Yu(`${t})`,`backward`,...c)}${t}`}function Yu(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Au(e,Bu`${Uu}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),Xu(i,n),s?e:`(?<${t}${l}>`}return Bu`\k<${c}${l}>`},ku.DEFAULT)}return c}function Xu(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Zu(e,t,n,r,i,a){if(e.size&&r){let o=0;ju(t,Uu,()=>o++,ku.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var Qu=String.fromCodePoint,K=String.raw,$u={},ed=globalThis.RegExp;$u.flagGroups=(()=>{try{new ed(`(?i:)`)}catch{return!1}return!0})(),$u.unicodeSets=(()=>{try{new ed(`[[]]`,`v`)}catch{return!1}return!0})(),$u.bugFlagVLiteralHyphenIsRange=$u.unicodeSets?(()=>{try{new ed(K`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,$u.bugNestedClassIgnoresNegation=$u.unicodeSets&&new ed(`[[^a]]`,`v`).test(`a`);function td(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function nd(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function rd(e,t){return ad[e]>=ad[t]}function id(e,t){if(e==null)throw Error(t??`Value expected`);return e}var ad={ES2025:2025,ES2024:2024,ES2018:2018},od={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function sd(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!od[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=$u.flagGroups?`ES2025`:$u.unicodeSets?`ES2024`:`ES2018`),t}var cd=`[ -\r ]`,ld=new Set([Qu(304),Qu(305)]),ud=K`[\p{L}\p{M}\p{N}\p{Pc}]`;function dd(e){if(ld.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=hd.get(n),a=pd.get(n),o=md.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var fd=new Map(`C Other
61
61
  Cc Control cntrl
62
62
  Cf Format
63
63
  Cn Unassigned
@@ -147,19 +147,19 @@ Uppercase Upper
147
147
  Variation_Selector VS
148
148
  White_Space space
149
149
  XID_Continue XIDC
150
- XID_Start XIDS`.split(/\s/).map(e=>[vu(e),e])),dd=new Map([[`s`,Xu(383)],[Xu(383),`s`]]),fd=new Map([[Xu(223),Xu(7838)],[Xu(107),Xu(8490)],[Xu(229),Xu(8491)],[Xu(969),Xu(8486)]]),pd=new Map([gd(453),gd(456),gd(459),gd(498),..._d(8072,8079),..._d(8088,8095),..._d(8104,8111),gd(8124),gd(8140),gd(8188)]),md=new Map([[`alnum`,K`[\p{Alpha}\p{Nd}]`],[`alpha`,K`\p{Alpha}`],[`ascii`,K`\p{ASCII}`],[`blank`,K`[\p{Zs}\t]`],[`cntrl`,K`\p{Cc}`],[`digit`,K`\p{Nd}`],[`graph`,K`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,K`\p{Lower}`],[`print`,K`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,K`[\p{P}\p{S}]`],[`space`,K`\p{space}`],[`upper`,K`\p{Upper}`],[`word`,K`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,K`\p{AHex}`]]);function hd(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function gd(e){let t=Xu(e);return[t.toLowerCase(),t]}function _d(e,t){return hd(e,t).map(e=>gd(e))}var vd=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function yd(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Cd(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:td(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};xu(e,bd,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return xu(e,xd,a),xu(e,Sd,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var bd={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=ru();e.body[0].body.push(iu({negate:!0,body:r}),uu(`Any`));let i=ru();i.body[0].body.push(su(`greedy`,0,1/0,e)),n(Hd(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];ed(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Ad(t.get(e));if(n){let t=ru({flags:n});t.body[0].body=e.body,e.body=[Hd(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(Hd(iu({body:[ql({body:[Jl(`string_end`)]}),ql({body:[Zl(10)]})]}),t));else if(c===`line_start`)o(Hd(zd(K`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&Id(e))o(Hd(iu({negate:!0}),t));else if(d)throw Error(K`Uses "\G" in a way that requires a subclass`);else o(Vd(Jl(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(Hd(zd(K`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${cd})(?!${cd})|(?<!${cd})(?=${cd}))`,n=`(?:(?<=${cd})(?=${cd})|(?<!${cd})(?!${cd}))`;o(Hd(zd(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Rd(n)&&(n=kd(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Rd(r)&&(r=kd(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(Hd(Ql({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(Vd(eu(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(Hd(Bd(zd(od),l),t));return}if(s&&(c===`word`||u===`word`)){n(Vd(eu(`word`,{negate:l}),t));return}if(c===`any`)n(Vd(uu(`Any`),t));else if(c===`digit`)n(Vd(uu(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(K`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=K`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Hd(zd(K`(?>\r\n|${i?K`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Vd(uu(`AHex`,{negate:l}),t));else if(c===`newline`)n(Hd(zd(l?`[^
150
+ XID_Start XIDS`.split(/\s/).map(e=>[bu(e),e])),pd=new Map([[`s`,Qu(383)],[Qu(383),`s`]]),md=new Map([[Qu(223),Qu(7838)],[Qu(107),Qu(8490)],[Qu(229),Qu(8491)],[Qu(969),Qu(8486)]]),hd=new Map([vd(453),vd(456),vd(459),vd(498),...yd(8072,8079),...yd(8088,8095),...yd(8104,8111),vd(8124),vd(8140),vd(8188)]),gd=new Map([[`alnum`,K`[\p{Alpha}\p{Nd}]`],[`alpha`,K`\p{Alpha}`],[`ascii`,K`\p{ASCII}`],[`blank`,K`[\p{Zs}\t]`],[`cntrl`,K`\p{Cc}`],[`digit`,K`\p{Nd}`],[`graph`,K`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,K`\p{Lower}`],[`print`,K`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,K`[\p{P}\p{S}]`],[`space`,K`\p{space}`],[`upper`,K`\p{Upper}`],[`word`,K`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,K`\p{AHex}`]]);function _d(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function vd(e){let t=Qu(e);return[t.toLowerCase(),t]}function yd(e,t){return _d(e,t).map(e=>vd(e))}var bd=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function xd(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Td(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:rd(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Cu(e,Sd,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Cu(e,Cd,a),Cu(e,wd,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var Sd={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=au();e.body[0].body.push(ou({negate:!0,body:r}),fu(`Any`));let i=au();i.body[0].body.push(lu(`greedy`,0,1/0,e)),n(Wd(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];nd(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Md(t.get(e));if(n){let t=au({flags:n});t.body[0].body=e.body,e.body=[Wd(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(Wd(ou({body:[Yl({body:[Xl(`string_end`)]}),Yl({body:[$l(10)]})]}),t));else if(c===`line_start`)o(Wd(Vd(K`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&Rd(e))o(Wd(ou({negate:!0}),t));else if(d)throw Error(K`Uses "\G" in a way that requires a subclass`);else o(Ud(Xl(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(Wd(Vd(K`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${ud})(?!${ud})|(?<!${ud})(?=${ud}))`,n=`(?:(?<=${ud})(?=${ud})|(?<!${ud})(?!${ud}))`;o(Wd(Vd(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Bd(n)&&(n=jd(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Bd(r)&&(r=jd(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(Wd(eu({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(Ud(nu(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(Wd(Hd(Vd(cd),l),t));return}if(s&&(c===`word`||u===`word`)){n(Ud(nu(`word`,{negate:l}),t));return}if(c===`any`)n(Ud(fu(`Any`),t));else if(c===`digit`)n(Ud(fu(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(K`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=K`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Wd(Vd(K`(?>\r\n|${i?K`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Ud(fu(`AHex`,{negate:l}),t));else if(c===`newline`)n(Wd(Vd(l?`[^
151
151
  ]`:`(?>\r
152
152
  ?|[
153
- \v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${Xu(e.codePointAt(0)-1)}${Xu(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Hd(zd(`[${e}]`),t))}else n(Hd(Bd(zd(md.get(u)),l),t))}else if(c===`property`)ud.has(vu(u))||(e.key=`sc`);else if(c===`space`)n(Vd(uu(`space`,{negate:l}),t));else if(c===`word`)n(Hd(Bd(zd(cd),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=ru({flags:c});e.body[0].body=o(),i(Hd(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Pl(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(K`Uses "\K" in a way that's unsupported`);let o=iu({behind:!0});o.body[0].body=a(),i(Hd(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(Hd(iu({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=ru();t.body[0].body.push(e.body),e.body=Hd(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=Nd(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(K`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Rd(n)&&(n=kd(n,t),e.ref=n)}},xd={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=Vd(Dd(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&ed(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=ed(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=$u(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?Dd(0):Ed(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Ad(Od(o,e=>e.type===`Group`&&!!e.flags)),t=e?$u(r.globalFlags,e):r.globalFlags;wd(t,r.currentFlags)||(l=ru({flags:jd(t)}),l.body[0].body.push(c))}n(Hd(l,t),{traverse:!s})}},Sd={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Td(t,e));i.length?i.length>1?n(Hd(ru({atomic:!0,body:i.reverse().map(e=>ql({body:[Yl(e.number)]}))}),t)):e.ref=i[0].number:n(Hd(iu({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=Xl();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Cd(e){xu(e,{"*"({node:e,parent:t}){e.parent=t}})}function wd(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Td(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=Md(n.parent);for(let r of t){if(r===n)break;if(r===e||Pd(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function Ed(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=Ed(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function Dd(e){let t=lu(e);return t.isRecursive=!0,t}function Od(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function kd(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function Ad(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function jd({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Md(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Nd(e){let t=e.find(e=>e.kind===`search_start`||Ld(e,{negate:!1})||!Fd(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=Nd(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Pd(e,t){let n=Md(e)??[];for(let e of n)if(e===t||Pd(e,t))return!0;return!1}function Fd({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Id(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function Ld(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Pl(e.body[0],{type:`Assertion`,kind:`search_start`})}function Rd(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function zd(e,t){let n=Ll(e,{...t,unicodePropertyMap:ud}).body;return n.length>1||n[0].body.length>1?ru({body:n}):n[0].body[0]}function Bd(e,t){return e.negate=t,e}function Vd(e,t){return e.parent=t,e}function Hd(e,t){return Cd(e),e.parent=t,e}function Ud(e,t){let n=ad(t),r=td(n.target,`ES2024`),i=td(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];xu(e,Wd,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,nd(Gd[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&ed(f._captureTransfers,e.transferTo,[]).push(t)}),f}var Wd={"*":{enter({node:e},t){if(rf(e)){let n=t.getCurrentModI();t.pushModI(e.flags?$u({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){rf(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Zd(Xu(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Qd(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&vd.has(e.value)&&t.setHasCasedChar()}},Gd={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?K`\B`:K`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=Xu(e),r=$d(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Zd(n)){let e=ld(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);Zu.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(of)&&(o=[Zl(45),...o.filter(e=>!of(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||Zu.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=ru(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=ql({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(Zu.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=$d(n,i),o=$d(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&ef(Qd(e)).forEach(e=>{s.add(Array.isArray(e)?`${$d(e[0],i)}-${$d(e[1],i)}`:$d(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:K`[^\n]`;if(e===`digit`)return t?K`\D`:K`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&vd.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?K`\P`:K`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?K`\W`:K`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=$u(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${tf(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+nf(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:K`\g<${t}&R=${r}>`}},Kd=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),qd=new Set([`-`,`\\`,`]`,`^`,`[`]),Jd=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),Yd=new Map([[9,K`\t`],[10,K`\n`],[11,K`\v`],[12,K`\f`],[13,K`\r`],[8232,K`\u2028`],[8233,K`\u2029`],[65279,K`\uFEFF`]]),Xd=/^\p{Cased}$/u;function Zd(e){return Xd.test(e)}function Qd(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=Xu(e);if(!Zd(t))continue;let o=ld(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function $d(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Yd.has(e))return Yd.get(e);if(e<32||e>126&&e<160||e>262143||t&&af(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?Jd:qd:Kd,a=Xu(e);return(i.has(a)?`\\`:``)+a}function ef(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function tf(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function nf({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function rf({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function af(e){return e>47&&e<58}function of({type:e,value:t}){return e===`Character`&&t===45}var sf=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=lf(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(cf(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=uf(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function cf(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function lf(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)ed(n,t,{}).transferTo=e;return n}function uf(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function df(e,t){let n=ff(e,t);return n.options?new sf(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function ff(e,t){let n=ad(t),r=yd(Ll(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:ud}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Ud(r,n),a=Wu(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Pu(Lu(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function pf(e,t){return df(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function mf(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>pf(e,{target:t.target}),{createScanner(e){return new Uc(e,t)},createString(e){return{content:e}}}}async function hf(e){if(yn())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=mn.get(e);if(t!=null)return t;try{let t=hn.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(An,e)&&(t=An[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return pn.has(e)||pn.set(e,n),n});return mn.set(e,n),await n}finally{mn.delete(e)}}function gf(e){return pn.get(e)??hf(e)}function _f(e=Zt){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var vf=new Set;function yf(e){for(let t of _f(e))if(!vf.has(t))return!1;return!0}function bf(e){let t=[],n=new Set;for(let r of xf(e.themes)){let e=wf(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return bf({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return bf({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function xf(e){return Sf(e)?[e]:e}function Sf(e){return wf(e)||Cf(e)}function Cf(e){return typeof e.name==`string`&&typeof e.load==`function`}function wf(e){return typeof e.getThemes==`function`}function Tf(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Ef=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},Df=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Of=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function kf(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Ef(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new Df(i));let c=r,l=s().then(e=>{let a=Tf(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new Of(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var Af=kf();function jf(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Af.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Af.getResolvedTheme(n)??Af.seedResolvedTheme(n,e);vf.has(n)||(vf.add(n),t.loadThemeSync(e))}}function Mf({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Nf(t)}}function Nf(e){return async()=>ra(Tf(await e()))}var Pf=`pierre`,Ff=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],If=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],Lf=[...If,...Ff],Rf=new Set(If);function zf(e){return Rf.has(e)?`light`:`dark`}var Bf={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},Vf={"pierre-dark":()=>B(()=>import(`./_CpLgRqie.js`),[]),"pierre-dark-soft":()=>B(()=>import(`./_kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>B(()=>import(`./_CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>B(()=>import(`./_B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>B(()=>import(`./_CpjhbsIL.js`),[]),"pierre-light":()=>B(()=>import(`./_CoaEpmwp.js`),[]),"pierre-light-soft":()=>B(()=>import(`./_lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>B(()=>import(`./_D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>B(()=>import(`./_0fSaH845.js`),[]),"pierre-light-tritanopia":()=>B(()=>import(`./_CEbqgOJL.js`),[])};function Hf(e){return Mf({name:e,collection:Pf,colorScheme:zf(e),displayName:Bf[e],load:Vf[e]})}var Uf=bf({themes:Lf.map(e=>Hf(e))}),Wf=`shiki`,Gf=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],Kf=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),qf=new Set(Gf);function Jf(e){return qf.has(e)?`light`:`dark`}var Yf={andromeeda:()=>B(()=>import(`./_vGVdxbeo.js`),[]),"aurora-x":()=>B(()=>import(`./_CDeNXAV0.js`),[]),"ayu-dark":()=>B(()=>import(`./_DluEY0Gj.js`),[]),"ayu-light":()=>B(()=>import(`./_C3h-C4tm.js`),[]),"ayu-mirage":()=>B(()=>import(`./_Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>B(()=>import(`./_C9Q5zVZY.js`),[]),"catppuccin-latte":()=>B(()=>import(`./_CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>B(()=>import(`./_R8nAf1vR.js`),[]),"catppuccin-mocha":()=>B(()=>import(`./_DjuaAJKi.js`),[]),"dark-plus":()=>B(()=>import(`./_Cs2F2srj.js`),[]),dracula:()=>B(()=>import(`./_BHWKrbxM.js`),[]),"dracula-soft":()=>B(()=>import(`./_5eyTD99u.js`),[]),"everforest-dark":()=>B(()=>import(`./_sB-x3p7T.js`),[]),"everforest-light":()=>B(()=>import(`./_Df2xbC6M.js`),[]),"github-dark":()=>B(()=>import(`./_C-LZuMrd.js`),[]),"github-dark-default":()=>B(()=>import(`./_DXG-b-1a.js`),[]),"github-dark-dimmed":()=>B(()=>import(`./_Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>B(()=>import(`./_B_tTalzw.js`),[]),"github-light":()=>B(()=>import(`./_EUqPIrTm.js`),[]),"github-light-default":()=>B(()=>import(`./_BXViO-2h.js`),[]),"github-light-high-contrast":()=>B(()=>import(`./_B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>B(()=>import(`./_C820rvS2.js`),[]),"gruvbox-dark-medium":()=>B(()=>import(`./_BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>B(()=>import(`./_MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>B(()=>import(`./_BC_s9l72.js`),[]),"gruvbox-light-medium":()=>B(()=>import(`./_BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>B(()=>import(`./_BSMLrYjP.js`),[]),horizon:()=>B(()=>import(`./_CE9ld1lL.js`),[]),"horizon-bright":()=>B(()=>import(`./_DSNQnXHK.js`),[]),houston:()=>B(()=>import(`./_CsvMBhTu.js`),[]),"kanagawa-dragon":()=>B(()=>import(`./_Bozd7klA.js`),[]),"kanagawa-lotus":()=>B(()=>import(`./_BmuOG9ZW.js`),[]),"kanagawa-wave":()=>B(()=>import(`./_BML5mF2J.js`),[]),laserwave:()=>B(()=>import(`./_C_8bwKvT.js`),[]),"light-plus":()=>B(()=>import(`./_DVQuIRkW.js`),[]),"material-theme":()=>B(()=>import(`./_Bm3Qr25_.js`),[]),"material-theme-darker":()=>B(()=>import(`./_2IIEA8gg.js`),[]),"material-theme-lighter":()=>B(()=>import(`./_uhdI0v04.js`),[]),"material-theme-ocean":()=>B(()=>import(`./_CHQ94UKr.js`),[]),"material-theme-palenight":()=>B(()=>import(`./_B5W6OYN7.js`),[]),"min-dark":()=>B(()=>import(`./_BSWPekZh.js`),[]),"min-light":()=>B(()=>import(`./_DDpmG2fV.js`),[]),monokai:()=>B(()=>import(`./_B_bV9PQ9.js`),[]),"night-owl":()=>B(()=>import(`./_DhmEMT88.js`),[]),"night-owl-light":()=>B(()=>import(`./_eJ-hLW7d.js`),[]),nord:()=>B(()=>import(`./_Cb4Vim4T.js`),[]),"one-dark-pro":()=>B(()=>import(`./_CLwyXe_n.js`),[]),"one-light":()=>B(()=>import(`./_D7Lr4KcI.js`),[]),plastic:()=>B(()=>import(`./_DQwYfKfQ.js`),[]),poimandres:()=>B(()=>import(`./_DRFjx7u4.js`),[]),red:()=>B(()=>import(`./_DX1BQOs8.js`),[]),"rose-pine":()=>B(()=>import(`./_aMsaMD1D.js`),[]),"rose-pine-dawn":()=>B(()=>import(`./_8PwUyIlP.js`),[]),"rose-pine-moon":()=>B(()=>import(`./_DO-qXg-I.js`),[]),"slack-dark":()=>B(()=>import(`./_DnToyrRv.js`),[]),"slack-ochin":()=>B(()=>import(`./_B2OO5cIa.js`),[]),"snazzy-light":()=>B(()=>import(`./_4G7pJPwS.js`),[]),"solarized-dark":()=>B(()=>import(`./_UdsmMDCL.js`),[]),"solarized-light":()=>B(()=>import(`./_C1IUL_tW.js`),[]),"synthwave-84":()=>B(()=>import(`./_nFMaYfgc.js`),[]),"tokyo-night":()=>B(()=>import(`./_oM2G3aXe.js`),[]),vesper:()=>B(()=>import(`./_DdrHHSXu.js`),[]),"vitesse-black":()=>B(()=>import(`./_fwtXNY1n.js`),[]),"vitesse-dark":()=>B(()=>import(`./_BZCL-v6S.js`),[]),"vitesse-light":()=>B(()=>import(`./_VbXTXTou.js`),[])};function Xf(e){return Mf({name:e,collection:Wf,colorScheme:Jf(e),load:Yf[e]})}var Zf=bf({themes:Object.freeze([...Gf.map(e=>Xf(e)),...Kf.map(e=>Xf(e))])});function Qf(e){if(yn())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Af.hasRegisteredTheme(e))return;let t=Zf.getTheme(e);if(t!=null){Af.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function $f(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function ep(e){Qf(e);let t=await Af.resolveTheme(e);return $f(e,t),t}function tp(e){return Af.getResolvedTheme(e)??ep(e)}var np;async function rp({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){np??=Pc({themes:[],langs:[`text`],engine:n===`shiki-wasm`?or(B(()=>import(`./_sWLklcDZ.js`),[])):mf()});let r=op(np)?await np:np;np=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=gf(e);`then`in t?i.push(t):vn(t,r)}let a=[];for(let t of e){let e=tp(t);`then`in e?a.push(e):jf(e,np)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{vn(e,r)}),Promise.all(a).then(e=>{jf(e,r)})]),r}function ip(e=np){return e!=null&&!(`then`in e)}function ap(e){if(!(np==null||`then`in np)&&(e==null||yf(e.theme)&&_n(e.lang)))return np}function op(e=np){return e!=null&&`then`in e}async function sp(e){await rp(e)}for(let e of Uf.getThemes())Af.registerThemeIfAbsent(e.name,e.load);var cp=new Set,lp=null;function up(e){cp.add(e),lp??=requestAnimationFrame(fp)}function dp(e){cp.delete(e)&&cp.size===0&&lp!=null&&(cancelAnimationFrame(lp),lp=null)}function fp(e){let t=new Set(cp);cp.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}lp=cp.size>0?requestAnimationFrame(fp):null}function pp(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function mp(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function hp(e,t){let n=e?.theme??Zt,r=t?.theme??Zt,i=gp(e),a=gp(t);return mp(n,r)&&pp(e,t,[`theme`,`parseDiffOptions`])&&pp(i,a)}function gp(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function _p(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function vp({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function yp(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function bp(e){return{type:`text`,value:e}}function q({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function xp({name:e,width:t=16,height:n=16,properties:r}){return q({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[q({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function Sp(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function Cp(e){return q({tagName:`div`,properties:{"data-gutter":``},children:e})}function wp(e,t,n,r={}){return q({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[q({tagName:`span`,properties:{"data-line-number-content":``},children:[bp(`${t}`)]})]})}function Tp(e,t,n){return q({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Ep(){return q({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[xp({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Dp(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Op(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var kp=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),dp(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||_p(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||r||i)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&Op(e.composedPath())||(Yp(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;(t!==`disabled`||o||n!=null||r!=null||i!=null||a!=null)&&(Yp(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Yp(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Yp(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Yp(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Yp(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Pp(i)&&this.hoveredLine?.lineElement===i.lineElement;Np(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Np(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Pp(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Ip(i)&&p!=null){p(i);break}if(Fp(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Pp(i))break;Np(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,Yp(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),Yp(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Yp(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();Op(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Dp(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=Ps(Ep());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Mp(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(zp(t));if(Mp(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Mp(n)&&(!t||n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Mp(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Op(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=zp(e);if(t&&Op(n))return;let r=Bp(e);return r==null?this.pathFromAnnotationSlot(e):zp(r)}pathFromAnnotationSlot(e){let t=Vp(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return zp(t);let n=Up(Hp(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:zp(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Wp(t)?t:Wp(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}_p(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,up(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{dp(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!Kp(this.renderedSelectedLinesState,n),i=!Kp(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Lp(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=Jp(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=Jp(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:Rp(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Rp(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:qp(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:qp(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Ap({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:jp({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function jp({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Mp(e){return e!=null&&`kind`in e&&e.kind===`line`}function Np(e){return e!=null&&`kind`in e&&e.kind===`token`}function Pp(e){return Mp(e)||Np(e)}function Fp(e){return`type`in e&&e.type===`line-info`}function Ip(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Lp(e){return e===`current`||e===`incoming`||e===`both`}function Rp(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function zp(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Bp(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Vp(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function Hp(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Up(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Wp(e){return e!=null&&typeof e.elementFromPoint==`function`}function Gp(e,t){return e===t||_p(e??void 0,t??void 0)}function Kp(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Gp(e?.range??null,t.range)}function qp(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Jp(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function Yp(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var Xp=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),$p(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?nm(t):rm(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:Zp(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Qp(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;(i||a)&&(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&em(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function Zp(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Qp(e){return Math.max(Math.ceil(e),0)}function $p(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?em(e,{codeWidthChanged:!0,numberWidthChanged:!0}):tm(e))}function em(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function tm(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function nm(e){e.codeElement.isConnected&&tm(e)}function rm(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function im(e){return Af.hasResolvedThemes(e)}function am(e,t){return mp(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function om(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function sm(e){return q({tagName:`div`,children:[q({tagName:`div`,children:e.annotations?.map(e=>q({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function cm(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function lm({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return q({tagName:`div`,children:[t===`custom`?q({tagName:`slot`,properties:{name:Xt}}):um({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[dm(r)]],properties:i})}function um({name:e,prevName:t,iconType:n}){let r=[q({tagName:`slot`,properties:{name:qt}}),xp({name:cm(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[bp(t)]})],properties:{"data-prev-name":``}})),r.push(xp({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[bp(e)]})],properties:{"data-title":``}})),r.push(q({tagName:`slot`,properties:{name:Jt}})),q({tagName:`div`,children:r,properties:{"data-header-content":``}})}function dm(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(q({tagName:`span`,children:[bp(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(q({tagName:`span`,children:[bp(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(q({tagName:`slot`,properties:{name:Yt}})),q({tagName:`div`,children:t,properties:{"data-metadata":``}})}function fm(e){return q({tagName:`pre`,properties:pm(e)})}function pm({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var mm=new Map,hm=0,gm={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function _m(e){if(mm.has(e))return mm.get(e)??`text`;if(gm[e]!=null)return gm[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(mm.has(t[1]))return mm.get(t[1])??`text`;if(gm[t[1]]!=null)return gm[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return mm.has(n)?mm.get(n)??`text`:gm[n]??`text`}function vm(){return hm}function ym(){return Object.fromEntries(mm)}function bm(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:Array.isArray(e)?e:[e??`text`],themes:_f(t),preferredHighlighter:n}}function xm(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Sm(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Cm(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(bp(`
154
- `)),e}var wm=Symbol(`no-token`),Tm=Symbol(`multiple-tokens`);function Em(e){let t=Dm(e);if(t!=null)return t;let n=wm,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){km(e,a);for(let t of e.children)Om(t)}else Om(e);r.push(e),i=[],a=void 0;return}for(let e of i)Om(e);r.push(q({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==wm){if(e===Tm){n=Tm;return}if(n===wm){n=e;return}n!==e&&(n=Tm)}};for(let t of e.children){let e=t.type===`element`?Em(t):wm;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function Dm(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Om(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Om(t)}}function km(e,t){e.properties[`data-char`]=t}function Am(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+jm(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function jm(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Mm(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=Sp(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Em(a),i.push(Cm(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Pm,Nm),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Nm}}var Nm=Am({classPrefix:`hl-`}),Pm={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Fm(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var Im=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Lm=/^0(?:\.0+)?%?$/;function Rm(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function zm(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Bm(e){if(e==null)return null;let t=zm(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Vm(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Im.test(t))return!0;let n=Rm(t);return n!=null&&Lm.test(n)}function Hm(e,t,n){if(t==null||n==null)return!1;let r=Bm(e),i=Bm(t),a=Bm(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Um=new WeakMap;function Wm(e){let t=Um.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;Gm(r,`editor.background`,i),Gm(r,`editor.foreground`,a),Gm(r,`sideBar.background`,o),Gm(r,`sideBar.foreground`,s),Gm(r,`input.background`,n[`input.background`]??o),Gm(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),Gm(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),Gm(r,`gitDecoration.addedResourceForeground`,Km(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),Gm(r,`gitDecoration.modifiedResourceForeground`,Km(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),Gm(r,`gitDecoration.deletedResourceForeground`,Km(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Vm(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Vm(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(qm(l,o)||Hm(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Um.set(e,u),u}function Gm(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Km(...e){for(let t of e)if(t!=null&&t!==``)return t}function qm(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Jm({theme:e=Zt,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Wm(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Fm(`global`)}fg:${a.fg};`,r+=`${Fm(`global`)}bg:${a.bg};`,r+=Ym(i,n)}else{let n=t.getTheme(e.dark),i=Wm(n);r+=`${Fm(`global`)}dark:${i.fg};`,r+=`${Fm(`global`)}dark-bg:${i.bg};`,r+=Ym(n,`dark`),n=t.getTheme(e.light),i=Wm(n),r+=`${Fm(`global`)}light:${i.fg};`,r+=`${Fm(`global`)}light-bg:${i.bg};`,r+=Ym(n,`light`)}return r}function Ym(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Fm(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Fm(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Fm(`global`)}${t}modified-color:${a};`),n}function Xm(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var Zm=10,Qm=13,$m=4,eh=40;function th(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
153
+ \v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${Qu(e.codePointAt(0)-1)}${Qu(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Wd(Vd(`[${e}]`),t))}else n(Wd(Hd(Vd(gd.get(u)),l),t))}else if(c===`property`)fd.has(bu(u))||(e.key=`sc`);else if(c===`space`)n(Ud(fu(`space`,{negate:l}),t));else if(c===`word`)n(Wd(Hd(Vd(ud),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=au({flags:c});e.body[0].body=o(),i(Wd(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Il(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(K`Uses "\K" in a way that's unsupported`);let o=ou({behind:!0});o.body[0].body=a(),i(Wd(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(Wd(ou({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=au();t.body[0].body.push(e.body),e.body=Wd(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=Fd(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(K`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Bd(n)&&(n=jd(n,t),e.ref=n)}},Cd={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=Ud(kd(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&nd(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=nd(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=td(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?kd(0):Od(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Md(Ad(o,e=>e.type===`Group`&&!!e.flags)),t=e?td(r.globalFlags,e):r.globalFlags;Ed(t,r.currentFlags)||(l=au({flags:Nd(t)}),l.body[0].body.push(c))}n(Wd(l,t),{traverse:!s})}},wd={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Dd(t,e));i.length?i.length>1?n(Wd(au({atomic:!0,body:i.reverse().map(e=>Yl({body:[Zl(e.number)]}))}),t)):e.ref=i[0].number:n(Wd(ou({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=Ql();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Td(e){Cu(e,{"*"({node:e,parent:t}){e.parent=t}})}function Ed(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Dd(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=Pd(n.parent);for(let r of t){if(r===n)break;if(r===e||Id(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function Od(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=Od(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function kd(e){let t=du(e);return t.isRecursive=!0,t}function Ad(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function jd(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function Md(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Nd({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Pd(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Fd(e){let t=e.find(e=>e.kind===`search_start`||zd(e,{negate:!1})||!Ld(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=Fd(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Id(e,t){let n=Pd(e)??[];for(let e of n)if(e===t||Id(e,t))return!0;return!1}function Ld({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Rd(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function zd(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Il(e.body[0],{type:`Assertion`,kind:`search_start`})}function Bd(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Vd(e,t){let n=zl(e,{...t,unicodePropertyMap:fd}).body;return n.length>1||n[0].body.length>1?au({body:n}):n[0].body[0]}function Hd(e,t){return e.negate=t,e}function Ud(e,t){return e.parent=t,e}function Wd(e,t){return Td(e),e.parent=t,e}function Gd(e,t){let n=sd(t),r=rd(n.target,`ES2024`),i=rd(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Cu(e,Kd,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,id(qd[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&nd(f._captureTransfers,e.transferTo,[]).push(t)}),f}var Kd={"*":{enter({node:e},t){if(of(e)){let n=t.getCurrentModI();t.pushModI(e.flags?td({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){of(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){$d(Qu(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),ef(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&bd.has(e.value)&&t.setHasCasedChar()}},qd={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?K`\B`:K`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=Qu(e),r=tf(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&$d(n)){let e=dd(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);$u.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(cf)&&(o=[$l(45),...o.filter(e=>!cf(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||$u.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=au(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=Yl({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!($u.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=tf(n,i),o=tf(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&nf(ef(e)).forEach(e=>{s.add(Array.isArray(e)?`${tf(e[0],i)}-${tf(e[1],i)}`:tf(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:K`[^\n]`;if(e===`digit`)return t?K`\D`:K`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&bd.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?K`\P`:K`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?K`\W`:K`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=td(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${rf(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+af(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:K`\g<${t}&R=${r}>`}},Jd=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),Yd=new Set([`-`,`\\`,`]`,`^`,`[`]),Xd=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),Zd=new Map([[9,K`\t`],[10,K`\n`],[11,K`\v`],[12,K`\f`],[13,K`\r`],[8232,K`\u2028`],[8233,K`\u2029`],[65279,K`\uFEFF`]]),Qd=/^\p{Cased}$/u;function $d(e){return Qd.test(e)}function ef(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=Qu(e);if(!$d(t))continue;let o=dd(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function tf(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Zd.has(e))return Zd.get(e);if(e<32||e>126&&e<160||e>262143||t&&sf(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?Xd:Yd:Jd,a=Qu(e);return(i.has(a)?`\\`:``)+a}function nf(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function rf(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function af({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function of({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function sf(e){return e>47&&e<58}function cf({type:e,value:t}){return e===`Character`&&t===45}var lf=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=df(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(uf(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=ff(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function uf(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function df(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)nd(n,t,{}).transferTo=e;return n}function ff(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function pf(e,t){let n=mf(e,t);return n.options?new lf(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function mf(e,t){let n=sd(t),r=xd(zl(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:fd}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Gd(r,n),a=Ku(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Iu(zu(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function hf(e,t){return pf(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function gf(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>hf(e,{target:t.target}),{createScanner(e){return new Gc(e,t)},createString(e){return{content:e}}}}async function _f(e){if(xn())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=gn.get(e);if(t!=null)return t;try{let t=_n.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Mn,e)&&(t=Mn[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return hn.has(e)||hn.set(e,n),n});return gn.set(e,n),await n}finally{gn.delete(e)}}function vf(e){return hn.get(e)??_f(e)}function yf(e=$t){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var bf=new Set;function xf(e){for(let t of yf(e))if(!bf.has(t))return!1;return!0}function Sf(e){let t=[],n=new Set;for(let r of Cf(e.themes)){let e=Ef(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return Sf({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return Sf({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Cf(e){return wf(e)?[e]:e}function wf(e){return Ef(e)||Tf(e)}function Tf(e){return typeof e.name==`string`&&typeof e.load==`function`}function Ef(e){return typeof e.getThemes==`function`}function Df(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Of=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},kf=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Af=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function jf(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Of(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new kf(i));let c=r,l=s().then(e=>{let a=Df(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new Af(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var Mf=jf();function Nf(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Mf.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Mf.getResolvedTheme(n)??Mf.seedResolvedTheme(n,e);bf.has(n)||(bf.add(n),t.loadThemeSync(e))}}function Pf({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Ff(t)}}function Ff(e){return async()=>aa(Df(await e()))}var If=`pierre`,Lf=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Rf=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],zf=[...Rf,...Lf],Bf=new Set(Rf);function Vf(e){return Bf.has(e)?`light`:`dark`}var Hf={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},Uf={"pierre-dark":()=>B(()=>import(`./_CpLgRqie.js`),[]),"pierre-dark-soft":()=>B(()=>import(`./_kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>B(()=>import(`./_CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>B(()=>import(`./_B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>B(()=>import(`./_CpjhbsIL.js`),[]),"pierre-light":()=>B(()=>import(`./_CoaEpmwp.js`),[]),"pierre-light-soft":()=>B(()=>import(`./_lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>B(()=>import(`./_D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>B(()=>import(`./_0fSaH845.js`),[]),"pierre-light-tritanopia":()=>B(()=>import(`./_CEbqgOJL.js`),[])};function Wf(e){return Pf({name:e,collection:If,colorScheme:Vf(e),displayName:Hf[e],load:Uf[e]})}var Gf=Sf({themes:zf.map(e=>Wf(e))}),Kf=`shiki`,qf=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],Jf=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),Yf=new Set(qf);function Xf(e){return Yf.has(e)?`light`:`dark`}var Zf={andromeeda:()=>B(()=>import(`./_vGVdxbeo.js`),[]),"aurora-x":()=>B(()=>import(`./_CDeNXAV0.js`),[]),"ayu-dark":()=>B(()=>import(`./_DluEY0Gj.js`),[]),"ayu-light":()=>B(()=>import(`./_C3h-C4tm.js`),[]),"ayu-mirage":()=>B(()=>import(`./_Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>B(()=>import(`./_C9Q5zVZY.js`),[]),"catppuccin-latte":()=>B(()=>import(`./_CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>B(()=>import(`./_R8nAf1vR.js`),[]),"catppuccin-mocha":()=>B(()=>import(`./_DjuaAJKi.js`),[]),"dark-plus":()=>B(()=>import(`./_Cs2F2srj.js`),[]),dracula:()=>B(()=>import(`./_BHWKrbxM.js`),[]),"dracula-soft":()=>B(()=>import(`./_5eyTD99u.js`),[]),"everforest-dark":()=>B(()=>import(`./_sB-x3p7T.js`),[]),"everforest-light":()=>B(()=>import(`./_Df2xbC6M.js`),[]),"github-dark":()=>B(()=>import(`./_C-LZuMrd.js`),[]),"github-dark-default":()=>B(()=>import(`./_DXG-b-1a.js`),[]),"github-dark-dimmed":()=>B(()=>import(`./_Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>B(()=>import(`./_B_tTalzw.js`),[]),"github-light":()=>B(()=>import(`./_EUqPIrTm.js`),[]),"github-light-default":()=>B(()=>import(`./_BXViO-2h.js`),[]),"github-light-high-contrast":()=>B(()=>import(`./_B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>B(()=>import(`./_C820rvS2.js`),[]),"gruvbox-dark-medium":()=>B(()=>import(`./_BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>B(()=>import(`./_MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>B(()=>import(`./_BC_s9l72.js`),[]),"gruvbox-light-medium":()=>B(()=>import(`./_BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>B(()=>import(`./_BSMLrYjP.js`),[]),horizon:()=>B(()=>import(`./_CE9ld1lL.js`),[]),"horizon-bright":()=>B(()=>import(`./_DSNQnXHK.js`),[]),houston:()=>B(()=>import(`./_CsvMBhTu.js`),[]),"kanagawa-dragon":()=>B(()=>import(`./_Bozd7klA.js`),[]),"kanagawa-lotus":()=>B(()=>import(`./_BmuOG9ZW.js`),[]),"kanagawa-wave":()=>B(()=>import(`./_BML5mF2J.js`),[]),laserwave:()=>B(()=>import(`./_C_8bwKvT.js`),[]),"light-plus":()=>B(()=>import(`./_DVQuIRkW.js`),[]),"material-theme":()=>B(()=>import(`./_Bm3Qr25_.js`),[]),"material-theme-darker":()=>B(()=>import(`./_2IIEA8gg.js`),[]),"material-theme-lighter":()=>B(()=>import(`./_uhdI0v04.js`),[]),"material-theme-ocean":()=>B(()=>import(`./_CHQ94UKr.js`),[]),"material-theme-palenight":()=>B(()=>import(`./_B5W6OYN7.js`),[]),"min-dark":()=>B(()=>import(`./_BSWPekZh.js`),[]),"min-light":()=>B(()=>import(`./_DDpmG2fV.js`),[]),monokai:()=>B(()=>import(`./_B_bV9PQ9.js`),[]),"night-owl":()=>B(()=>import(`./_DhmEMT88.js`),[]),"night-owl-light":()=>B(()=>import(`./_eJ-hLW7d.js`),[]),nord:()=>B(()=>import(`./_Cb4Vim4T.js`),[]),"one-dark-pro":()=>B(()=>import(`./_CLwyXe_n.js`),[]),"one-light":()=>B(()=>import(`./_D7Lr4KcI.js`),[]),plastic:()=>B(()=>import(`./_DQwYfKfQ.js`),[]),poimandres:()=>B(()=>import(`./_DRFjx7u4.js`),[]),red:()=>B(()=>import(`./_DX1BQOs8.js`),[]),"rose-pine":()=>B(()=>import(`./_aMsaMD1D.js`),[]),"rose-pine-dawn":()=>B(()=>import(`./_8PwUyIlP.js`),[]),"rose-pine-moon":()=>B(()=>import(`./_DO-qXg-I.js`),[]),"slack-dark":()=>B(()=>import(`./_DnToyrRv.js`),[]),"slack-ochin":()=>B(()=>import(`./_B2OO5cIa.js`),[]),"snazzy-light":()=>B(()=>import(`./_4G7pJPwS.js`),[]),"solarized-dark":()=>B(()=>import(`./_UdsmMDCL.js`),[]),"solarized-light":()=>B(()=>import(`./_C1IUL_tW.js`),[]),"synthwave-84":()=>B(()=>import(`./_nFMaYfgc.js`),[]),"tokyo-night":()=>B(()=>import(`./_oM2G3aXe.js`),[]),vesper:()=>B(()=>import(`./_DdrHHSXu.js`),[]),"vitesse-black":()=>B(()=>import(`./_fwtXNY1n.js`),[]),"vitesse-dark":()=>B(()=>import(`./_BZCL-v6S.js`),[]),"vitesse-light":()=>B(()=>import(`./_VbXTXTou.js`),[])};function Qf(e){return Pf({name:e,collection:Kf,colorScheme:Xf(e),load:Zf[e]})}var $f=Sf({themes:Object.freeze([...qf.map(e=>Qf(e)),...Jf.map(e=>Qf(e))])});function ep(e){if(xn())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Mf.hasRegisteredTheme(e))return;let t=$f.getTheme(e);if(t!=null){Mf.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function tp(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function np(e){ep(e);let t=await Mf.resolveTheme(e);return tp(e,t),t}function rp(e){return Mf.getResolvedTheme(e)??np(e)}var ip;async function ap({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){ip??=Ic({themes:[],langs:[`text`],engine:n===`shiki-wasm`?cr(B(()=>import(`./_sWLklcDZ.js`),[])):gf()});let r=cp(ip)?await ip:ip;ip=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=vf(e);`then`in t?i.push(t):bn(t,r)}let a=[];for(let t of e){let e=rp(t);`then`in e?a.push(e):Nf(e,ip)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{bn(e,r)}),Promise.all(a).then(e=>{Nf(e,r)})]),r}function op(e=ip){return e!=null&&!(`then`in e)}function sp(e){if(!(ip==null||`then`in ip)&&(e==null||xf(e.theme)&&yn(e.lang)))return ip}function cp(e=ip){return e!=null&&`then`in e}async function lp(e){await ap(e)}for(let e of Gf.getThemes())Mf.registerThemeIfAbsent(e.name,e.load);var up=new Set,dp=null;function fp(e){up.add(e),dp??=requestAnimationFrame(mp)}function pp(e){up.delete(e)&&up.size===0&&dp!=null&&(cancelAnimationFrame(dp),dp=null)}function mp(e){let t=new Set(up);up.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}dp=up.size>0?requestAnimationFrame(mp):null}function hp(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function gp(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function _p(e,t){let n=e?.theme??$t,r=t?.theme??$t,i=vp(e),a=vp(t);return gp(n,r)&&hp(e,t,[`theme`,`parseDiffOptions`])&&hp(i,a)}function vp(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function yp(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function bp({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function xp(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Sp(e){return{type:`text`,value:e}}function q({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Cp({name:e,width:t=16,height:n=16,properties:r}){return q({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[q({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function wp(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function Tp(e){return q({tagName:`div`,properties:{"data-gutter":``},children:e})}function Ep(e,t,n,r={}){return q({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[q({tagName:`span`,properties:{"data-line-number-content":``},children:[Sp(`${t}`)]})]})}function Dp(e,t,n){return q({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Op(){return q({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Cp({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function kp(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ap(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var jp=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),pp(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||yp(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||r||i)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&Ap(e.composedPath())||(Zp(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;(t!==`disabled`||o||n!=null||r!=null||i!=null||a!=null)&&(Zp(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Zp(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Zp(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Zp(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Zp(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Ip(i)&&this.hoveredLine?.lineElement===i.lineElement;Fp(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Fp(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Ip(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Rp(i)&&p!=null){p(i);break}if(Lp(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Ip(i))break;Fp(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,Zp(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),Zp(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Zp(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();Ap(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(kp(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=Is(Op());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Pp(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Vp(t));if(Pp(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Pp(n)&&(!t||n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Pp(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Ap(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Vp(e);if(t&&Ap(n))return;let r=Hp(e);return r==null?this.pathFromAnnotationSlot(e):Vp(r)}pathFromAnnotationSlot(e){let t=Up(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Vp(t);let n=Gp(Wp(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Vp(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Kp(t)?t:Kp(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}yp(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,fp(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{pp(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!Jp(this.renderedSelectedLinesState,n),i=!Jp(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);zp(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=Xp(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=Xp(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:Bp(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Bp(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Yp(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Yp(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Mp({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Np({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Np({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Pp(e){return e!=null&&`kind`in e&&e.kind===`line`}function Fp(e){return e!=null&&`kind`in e&&e.kind===`token`}function Ip(e){return Pp(e)||Fp(e)}function Lp(e){return`type`in e&&e.type===`line-info`}function Rp(e){return`kind`in e&&e.kind===`merge-conflict-action`}function zp(e){return e===`current`||e===`incoming`||e===`both`}function Bp(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Vp(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Hp(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Up(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function Wp(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Gp(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Kp(e){return e!=null&&typeof e.elementFromPoint==`function`}function qp(e,t){return e===t||yp(e??void 0,t??void 0)}function Jp(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&qp(e?.range??null,t.range)}function Yp(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Xp(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function Zp(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var Qp=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),tm(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?im(t):am(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:$p(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:em(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;(i||a)&&(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&nm(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function $p(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function em(e){return Math.max(Math.ceil(e),0)}function tm(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?nm(e,{codeWidthChanged:!0,numberWidthChanged:!0}):rm(e))}function nm(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function rm(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function im(e){e.codeElement.isConnected&&rm(e)}function am(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function om(e){return Mf.hasResolvedThemes(e)}function sm(e,t){return gp(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function cm(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function lm(e){return q({tagName:`div`,children:[q({tagName:`div`,children:e.annotations?.map(e=>q({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function um(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function dm({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return q({tagName:`div`,children:[t===`custom`?q({tagName:`slot`,properties:{name:Qt}}):fm({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[pm(r)]],properties:i})}function fm({name:e,prevName:t,iconType:n}){let r=[q({tagName:`slot`,properties:{name:Yt}}),Cp({name:um(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[Sp(t)]})],properties:{"data-prev-name":``}})),r.push(Cp({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[Sp(e)]})],properties:{"data-title":``}})),r.push(q({tagName:`slot`,properties:{name:Xt}})),q({tagName:`div`,children:r,properties:{"data-header-content":``}})}function pm(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(q({tagName:`span`,children:[Sp(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(q({tagName:`span`,children:[Sp(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(q({tagName:`slot`,properties:{name:Zt}})),q({tagName:`div`,children:t,properties:{"data-metadata":``}})}function mm(e){return q({tagName:`pre`,properties:hm(e)})}function hm({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var gm=new Map,_m=0,vm={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function ym(e){if(gm.has(e))return gm.get(e)??`text`;if(vm[e]!=null)return vm[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(gm.has(t[1]))return gm.get(t[1])??`text`;if(vm[t[1]]!=null)return vm[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return gm.has(n)?gm.get(n)??`text`:vm[n]??`text`}function bm(){return _m}function xm(){return Object.fromEntries(gm)}function Sm(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:Array.isArray(e)?e:[e??`text`],themes:yf(t),preferredHighlighter:n}}function Cm(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function wm(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Tm(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(Sp(`
154
+ `)),e}var Em=Symbol(`no-token`),Dm=Symbol(`multiple-tokens`);function Om(e){let t=km(e);if(t!=null)return t;let n=Em,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){jm(e,a);for(let t of e.children)Am(t)}else Am(e);r.push(e),i=[],a=void 0;return}for(let e of i)Am(e);r.push(q({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Em){if(e===Dm){n=Dm;return}if(n===Em){n=e;return}n!==e&&(n=Dm)}};for(let t of e.children){let e=t.type===`element`?Om(t):Em;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function km(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Am(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Am(t)}}function jm(e,t){e.properties[`data-char`]=t}function Mm(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+Nm(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function Nm(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Pm(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=wp(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Om(a),i.push(Tm(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Im,Fm),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Fm}}var Fm=Mm({classPrefix:`hl-`}),Im={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Lm(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var Rm=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,zm=/^0(?:\.0+)?%?$/;function Bm(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function Vm(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Hm(e){if(e==null)return null;let t=Vm(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Um(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Rm.test(t))return!0;let n=Bm(t);return n!=null&&zm.test(n)}function Wm(e,t,n){if(t==null||n==null)return!1;let r=Hm(e),i=Hm(t),a=Hm(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Gm=new WeakMap;function Km(e){let t=Gm.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;qm(r,`editor.background`,i),qm(r,`editor.foreground`,a),qm(r,`sideBar.background`,o),qm(r,`sideBar.foreground`,s),qm(r,`input.background`,n[`input.background`]??o),qm(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),qm(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),qm(r,`gitDecoration.addedResourceForeground`,Jm(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),qm(r,`gitDecoration.modifiedResourceForeground`,Jm(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),qm(r,`gitDecoration.deletedResourceForeground`,Jm(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Um(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Um(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Ym(l,o)||Wm(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Gm.set(e,u),u}function qm(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Jm(...e){for(let t of e)if(t!=null&&t!==``)return t}function Ym(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Xm({theme:e=$t,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Km(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Lm(`global`)}fg:${a.fg};`,r+=`${Lm(`global`)}bg:${a.bg};`,r+=Zm(i,n)}else{let n=t.getTheme(e.dark),i=Km(n);r+=`${Lm(`global`)}dark:${i.fg};`,r+=`${Lm(`global`)}dark-bg:${i.bg};`,r+=Zm(n,`dark`),n=t.getTheme(e.light),i=Km(n),r+=`${Lm(`global`)}light:${i.fg};`,r+=`${Lm(`global`)}light-bg:${i.bg};`,r+=Zm(n,`light`)}return r}function Zm(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Lm(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Lm(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Lm(`global`)}${t}modified-color:${a};`),n}function Qm(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var $m=10,eh=13,th=4,nh=40;function rh(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
155
155
  `),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
156
156
  `,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
157
- `,o)),t.push(o),++a===$m){if(o-i<=eh){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===Zm||r===Qm)&&(r===Qm&&n+1<e.length&&e.charCodeAt(n+1)===Zm&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function nh(e){let t=th(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}function rh(e,t){for(let n of t)e.push(n)}var ih={forcePlainText:!1};function ah(e,t,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=ih){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Mm(i),f=a?`text`:e.lang??_m(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Jm({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:Fm(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Fm(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Xm(t.codeToHast(oh(l?sh(c??nh(e.contents),o,s):e.contents),h)),_=l?Array(o):g;return l&&rh(_,g),{code:_,themeStyles:m,baseThemeType:p}}function oh(e){return e.replace(/\r(?!\n)/g,`
158
- `)}function sh(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function ch(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var lh=`-1,-1`;function uh(e){return e?.some(e=>e.lineNumber===0)??!1}function dh(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function fh(e){return e.startingLine===0&&e.totalLines>0}function ph(e,t){return e.endsWith(`\r
157
+ `,o)),t.push(o),++a===th){if(o-i<=nh){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===$m||r===eh)&&(r===eh&&n+1<e.length&&e.charCodeAt(n+1)===$m&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function ih(e){let t=rh(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}function ah(e,t){for(let n of t)e.push(n)}var oh={forcePlainText:!1};function sh(e,t,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=oh){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Pm(i),f=a?`text`:e.lang??ym(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Xm({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:Lm(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Lm(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Qm(t.codeToHast(ch(l?lh(c??ih(e.contents),o,s):e.contents),h)),_=l?Array(o):g;return l&&ah(_,g),{code:_,themeStyles:m,baseThemeType:p}}function ch(e){return e.replace(/\r(?!\n)/g,`
158
+ `)}function lh(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function uh(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var dh=`-1,-1`;function fh(e){return e?.some(e=>e.lineNumber===0)??!1}function ph(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function mh(e){return e.startingLine===0&&e.totalLines>0}function hh(e,t){return e.endsWith(`\r
159
159
  `)?t+`\r
160
160
  `:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
161
161
  `)?t+`
162
- `:t}function mh(e,t){return q({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function hh(e){return(e.lang??_m(e.name))===`text`}function gh(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var _h=-1,vh=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++_h}`;highlighter;file;renderCache;pendingHighlightResult;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;get fileCache(){return this.renderCache?.file}constructor(e={theme:Zt},t=xm,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=yf(e.theme??Zt)?ap():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.file=e,r==null||n&&r.file===e)return;let{options:i}=this.getRenderOptions(e),a=r.file===e,o=t!=null&&ch(r.file,t),{result:s}=r;if(!r.highlighted||s==null||!am(r.options,i)||!a&&!o){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}if(a)return;this.renderCache={...r,file:e,result:{...s,code:[...s.code]}};let{lineCache:c}=this;this.lineCache=c!=null&&t!=null&&gh(c,t)?{cacheKey:void 0,file:e,sourceContents:e.contents,lines:c.lines}:void 0}endEditSession(e){this.editSessionActive=!1,this.pendingHighlightResult=void 0;let{renderCache:t}=this;e!=null&&t!=null&&t.file!==e&&ch(t.file,e)&&(t.file=e)}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.file=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}clearRenderCache(){this.pendingStructuralRows=void 0,this.renderCache=void 0,this.pendingHighlightResult=void 0}hydrate(e){this.file=e;let{options:t}=this.getRenderOptions(e),n=yh(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!am(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!hh(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??_m(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Zt}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!ch(e,n.file)||!am(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getFileForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null)return e;let{renderCache:n}=this;if(n==null)return e;if(ch(n.file,e))return n.file;let r=nh(e.contents),i=e.contents.length===0||hh(e)||yh(r.length,this.getTokenizeMaxLength());return this.canRenderFile(e,t,i)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||ch(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&yf(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&yf(t.theme)}getOrCreateLineCache(e){let{lineCache:t}=this;return(t==null||!gh(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:nh(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return;let{file:i,result:a}=r;if(a==null)return;let o=n?new Map:void 0;this.pendingStructuralRows=o;let s=this.lineCache!=null&&gh(this.lineCache,i)?this.lineCache:void 0;for(let[t,n]of e){if(o==null&&s!=null&&t<s.lines.length){let e=n.map(e=>e[2]).join(``);s.lines[t]=ph(s.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};o==null?a.code[t]=e:o.set(t,e)}a.baseThemeType=t,r.isDirty=!0,o==null&&s!=null&&(i.contents=s.lines.join(``),s.sourceContents=i.contents)}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{file:r,result:i}=n;if(i==null)return;let a=this.lineCache!=null&&gh(this.lineCache,r)?this.lineCache.lines:nh(r.contents),o=nh(e.getText());if(a.length!==o.length){let r=Math.min(a.length,o.length),s=0;for(;s<r&&a[s]===o[s];)s++;let c=0;for(;c<r-s&&a[a.length-1-c]===o[o.length-1-c];)c++;let l=i.code;i.code=Array(o.length);for(let e=0;e<s;e++)i.code[e]=l[e];for(let e=0;e<c;e++)i.code[o.length-1-e]=l[a.length-1-e];if(t!==void 0)for(let[e,n]of t)e<o.length&&(i.code[e]=n);for(let t=s;t<o.length-c;t++)i.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<i.code.length;e++){let t=i.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}n.isDirty=!0}this.lineCache={cacheKey:r.cacheKey,file:r,sourceContents:r.contents,lines:o},this.textDocumentCache.set(r,e),r.contents=e.getText()}renderFile(e=this.file,t=dn){if(this.file=e,e==null){this.pendingHighlightResult=void 0;return}let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getReadyRenderResult(e,n);this.pendingHighlightResult=void 0,i!=null&&(this.renderCache={...i,file:e,renderRange:void 0},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||hh(e)||yh(a.length,this.getTokenizeMaxLength()),c=this.canRenderFile(e,n,s),l=!ch(e,this.renderCache.file),u=!om(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!s&&!l&&Sm(t);c&&!i&&(s||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e)}else{this.computedLang=e.lang??_m(e.name),this.highlighter??=ap();let t=this.highlighter!=null&&yf(n.theme),i=this.highlighter!=null&&_n(this.computedLang),a=!s&&i;if(c&&this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=dn){this.file=e;let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=yh(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??_m(e.name);let n=this.highlighter!=null&&im(_f(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&_n(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:ah(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=Cp(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=fh(t)?dh(this.lineAnnotations):void 0;d!=null&&(c.children.push(Tp(`context`,`annotation`,1)),s.push(sm({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>this.annotationSlotName(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(wp(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(Tp(`context`,`annotation`,1)),s.push(sm({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>this.annotationSlotName(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{file:e,gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return lm({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return Ps(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(q({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Cp();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,mh(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return Ps(t?q({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await rp(bm(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{file:i,renderCache:a}=this;i!=null&&a!=null&&ch(e,i)&&am(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&am(a.options,n)&&ch(a.file,i)||(this.pendingHighlightResult={file:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(n!=null&&am(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&ch(n.file,e)&&am(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{file:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&ch(e,n.file)&&am(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return fm({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function yh(e,t){return e>t}var bh=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
162
+ `:t}function gh(e,t){return q({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function _h(e){return(e.lang??ym(e.name))===`text`}function vh(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var yh=-1,bh=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++yh}`;highlighter;file;renderCache;pendingHighlightResult;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;get fileCache(){return this.renderCache?.file}constructor(e={theme:$t},t=Cm,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=xf(e.theme??$t)?sp():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.file=e,r==null||n&&r.file===e)return;let{options:i}=this.getRenderOptions(e),a=r.file===e,o=t!=null&&uh(r.file,t),{result:s}=r;if(!r.highlighted||s==null||!sm(r.options,i)||!a&&!o){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}if(a)return;this.renderCache={...r,file:e,result:{...s,code:[...s.code]}};let{lineCache:c}=this;this.lineCache=c!=null&&t!=null&&vh(c,t)?{cacheKey:void 0,file:e,sourceContents:e.contents,lines:c.lines}:void 0}endEditSession(e){this.editSessionActive=!1,this.pendingHighlightResult=void 0;let{renderCache:t}=this;e!=null&&t!=null&&t.file!==e&&uh(t.file,e)&&(t.file=e)}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.file=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}clearRenderCache(){this.pendingStructuralRows=void 0,this.renderCache=void 0,this.pendingHighlightResult=void 0}hydrate(e){this.file=e;let{options:t}=this.getRenderOptions(e),n=xh(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!sm(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!_h(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??ym(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??$t}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!uh(e,n.file)||!sm(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getFileForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null)return e;let{renderCache:n}=this;if(n==null)return e;if(uh(n.file,e))return n.file;let r=ih(e.contents),i=e.contents.length===0||_h(e)||xh(r.length,this.getTokenizeMaxLength());return this.canRenderFile(e,t,i)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||uh(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&xf(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&xf(t.theme)}getOrCreateLineCache(e){let{lineCache:t}=this;return(t==null||!vh(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:ih(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return;let{file:i,result:a}=r;if(a==null)return;let o=n?new Map:void 0;this.pendingStructuralRows=o;let s=this.lineCache!=null&&vh(this.lineCache,i)?this.lineCache:void 0;for(let[t,n]of e){if(o==null&&s!=null&&t<s.lines.length){let e=n.map(e=>e[2]).join(``);s.lines[t]=hh(s.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};o==null?a.code[t]=e:o.set(t,e)}a.baseThemeType=t,r.isDirty=!0,o==null&&s!=null&&(i.contents=s.lines.join(``),s.sourceContents=i.contents)}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{file:r,result:i}=n;if(i==null)return;let a=this.lineCache!=null&&vh(this.lineCache,r)?this.lineCache.lines:ih(r.contents),o=ih(e.getText());if(a.length!==o.length){let r=Math.min(a.length,o.length),s=0;for(;s<r&&a[s]===o[s];)s++;let c=0;for(;c<r-s&&a[a.length-1-c]===o[o.length-1-c];)c++;let l=i.code;i.code=Array(o.length);for(let e=0;e<s;e++)i.code[e]=l[e];for(let e=0;e<c;e++)i.code[o.length-1-e]=l[a.length-1-e];if(t!==void 0)for(let[e,n]of t)e<o.length&&(i.code[e]=n);for(let t=s;t<o.length-c;t++)i.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<i.code.length;e++){let t=i.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}n.isDirty=!0}this.lineCache={cacheKey:r.cacheKey,file:r,sourceContents:r.contents,lines:o},this.textDocumentCache.set(r,e),r.contents=e.getText()}renderFile(e=this.file,t=pn){if(this.file=e,e==null){this.pendingHighlightResult=void 0;return}let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getReadyRenderResult(e,n);this.pendingHighlightResult=void 0,i!=null&&(this.renderCache={...i,file:e,renderRange:void 0},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||_h(e)||xh(a.length,this.getTokenizeMaxLength()),c=this.canRenderFile(e,n,s),l=!uh(e,this.renderCache.file),u=!cm(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!s&&!l&&wm(t);c&&!i&&(s||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e)}else{this.computedLang=e.lang??ym(e.name),this.highlighter??=sp();let t=this.highlighter!=null&&xf(n.theme),i=this.highlighter!=null&&yn(this.computedLang),a=!s&&i;if(c&&this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=pn){this.file=e;let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=xh(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??ym(e.name);let n=this.highlighter!=null&&om(yf(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&yn(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:sh(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=Tp(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=mh(t)?ph(this.lineAnnotations):void 0;d!=null&&(c.children.push(Dp(`context`,`annotation`,1)),s.push(lm({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>this.annotationSlotName(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(Ep(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(Dp(`context`,`annotation`,1)),s.push(lm({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>this.annotationSlotName(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{file:e,gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return dm({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return Is(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(q({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Tp();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,gh(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return Is(t?q({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await ap(Sm(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{file:i,renderCache:a}=this;i!=null&&a!=null&&uh(e,i)&&sm(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&sm(a.options,n)&&uh(a.file,i)||(this.pendingHighlightResult={file:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(n!=null&&sm(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&uh(n.file,e)&&sm(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{file:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&uh(e,n.file)&&sm(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return mm({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function xh(e,t){return e>t}var Sh=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
163
163
  <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
164
164
  <path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
165
165
  </symbol>
@@ -211,7 +211,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[vu(e),e])),dd=new Map([[`s`,Xu(383)],[Xu(383
211
211
  <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
212
212
  <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
213
213
  </symbol>
214
- </svg>`;function xh(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Sh(e,t){return e==null||t==null?e===t:wh(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var Ch={};function wh(e=Ch,t=Ch){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function Th(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Eh(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function Dh(){let e=document.createElement(`style`);return e.setAttribute($t,``),e}var Oh=`@layer base {
214
+ </svg>`;function Ch(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function wh(e,t){return e==null||t==null?e===t:Eh(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var Th={};function Eh(e=Th,t=Th){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function Dh(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Oh(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function kh(){let e=document.createElement(`style`);return e.setAttribute(tn,``),e}var Ah=`@layer base {
215
215
  :host {
216
216
  --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
217
217
  "Courier New", monospace;
@@ -1489,47 +1489,47 @@ XID_Start XIDS`.split(/\s/).map(e=>[vu(e),e])),dd=new Map([[`s`,Xu(383)],[Xu(383
1489
1489
  }
1490
1490
 
1491
1491
  @layer theme, rendered, unsafe;
1492
- `,kh;function Ah(e){if(kh!=null)return kh;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(en,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),kh=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),kh}function jh(e){return`${rn}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var Mh=`@layer base, theme, rendered, unsafe;`,Nh=RegExp(`${Lh(rn)}\\s*:\\s*[^;]+;`);function Ph(e){return`${Mh}
1492
+ `,jh;function Mh(e){if(jh!=null)return jh;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(nn,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),jh=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),jh}function Nh(e){return`${on}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var Ph=`@layer base, theme, rendered, unsafe;`,Fh=RegExp(`${zh(on)}\\s*:\\s*[^;]+;`);function Ih(e){return`${Ph}
1493
1493
  @layer unsafe {
1494
1494
  ${e}
1495
- }`}function Fh(e,t=`system`,n){return`${Mh}
1495
+ }`}function Lh(e,t=`system`,n){return`${Ph}
1496
1496
  @layer rendered {
1497
1497
  :host {${t===`system`?``:`
1498
1498
  color-scheme: ${t};`}
1499
- ${jh(n)}
1499
+ ${Nh(n)}
1500
1500
  ${e}
1501
1501
  }
1502
- }`}function Ih(e,t){let n=jh(t);return e.replace(Nh,n)}function Lh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var Rh=new WeakMap;function zh(e){return Rh.get(e)??e}function Bh({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function Vh(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Hh(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function Uh(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function Wh(e,t,n){let r=new Map;for(let i of e){let e=zh(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function Gh(e,t,n){for(let r of t){let t=zh(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function Kh(e,t,n){if(e==null)return n(t);let r=zh(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function qh(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Jh(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:qh(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Yh(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function Xh({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Zh(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Zh(){let e=document.createElement(`style`);return e.setAttribute(Qt,``),e}var Qh=void 0;function $h(){return Qh??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(Oh)),t.adoptedStyleSheets=[e]}connectedCallback(){Ah(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Rt,t)}var eg=[``];function tg(e){let t={...e};return delete t.cacheKey,t}var ng=-1,rg=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++ng}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(e={theme:Zt},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new vh(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new Xp,this.interactionManager=new kp(`file`,Ap(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>Kh(this.editSession?.annotations,e,xm);handleHighlightRender=()=>{this.rerender()};rerender(){this.enabled&&this.file!=null&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Zt}getLatestFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedFile}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}updateExternalFile(e,t){if(ch(this.file,e))return!1;let n=this.editSession!=null;return this.file=e,n||this.editor!=null?this.installEditSession(e,n?void 0:this.editor?.__getDocumentContents(e),!0):this.editSession=void 0,this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=Wh(t,xm,this.editSession.annotations)),!0}installEditSession(e,t,n=!1){let r=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===e.contents,i=tg(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??Wh(this.lineAnnotations,xm)},this.fileRenderer.beginEditSession(i,r?e:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Ap(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!mp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Gh(t,e,xm))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.getLatestAnnotations().length>0}cleanUp(e=!1){let t=this.editor;this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||ig(this.pre,i,this.options.collapsed)||ag(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Vh(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Jh(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderedFile=e,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.getLatestFile()){return e==null?eg:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getLatestFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getLatestFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,file:i,lineAnnotations:r,renderRange:n,externalDocument:this.editSession?.externalReplacement===!0})},o=this.getTheme(),s=i.lang??_m(i.name),c=ap({theme:o,lang:s});c==null?rp({themes:_f(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.externalReplacement=!1)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSession==null?this.file!=null&&this.installEditSession(this.file,e.__getDocumentContents(this.file)):this.fileRenderer.beginEditSession(this.editSession.file);let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(this.fileRenderer.fileCache===t&&(this.renderedFile=t),this.syncRenderViewToEditor()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,file:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{file:a,annotations:o}=n;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=o?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...a},f={file:d,editor:t,originalFile:r,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===r.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}e&&c!=null&&(this.file=c,s!=null&&(this.lineAnnotations=s)),this.editSession=void 0;let{renderedFile:p,file:m}=this;if(this.fileRenderer.endEditSession(m),p!=null&&m!=null&&p!==m&&ch(p,m)&&(this.renderedFile=m),e&&this.fileContainer!=null&&this.rerender(),l)throw u}applyDocumentChange(e,t){let n=this.editSession?.file;if(n==null)throw Error(`File.applyDocumentChange: requires an active edit session`);this.fileRenderer.beginEditSession(n),this.fileRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}updateRenderCache(e,t,n){let r=this.editSession?.file;if(r==null)throw Error(`File.updateRenderCache: requires an active edit session`);this.fileRenderer.beginEditSession(r),this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),m=!ch(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&om(u,this.renderRange)&&!m&&!p&&!f){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(Jh(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderFile(h,fn);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,e.file),this.renderedFile=e?.file??h,this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f||!ch(this.renderedFile,h))||!this.applyPartialRender(h,d,u)){let n=this.fileRenderer.renderFile(h,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyFullRender(n,e),this.renderedFile=n.file}this.applyBuffers(e,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||hh(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!xh(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Th(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Eh();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Dh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Ph(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Ah(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Xh({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Fh(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Ih(this.themeCSSStyle.textContent??``,Ah(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&$h()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=Bh({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=Ps(i.children),t.style.cssText=i.properties.style}else n.innerHTML=Ps(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?Yh(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t,n){if(t==null||n==null)return!1;let{code:r}=this,i=r==null?void 0:this.getColumns(r);if(r==null||i==null)return!1;let a=t.startingLine,o=n.startingLine,s=t.totalLines===1/0?1/0:a+t.totalLines,c=n.totalLines===1/0?1/0:o+n.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(t,n)=>{if(!(n<=0))return this.fileRenderer.renderFile(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??Ps(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Xt,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,qt,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Jt,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Yt,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Uh(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Uh(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=bh;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};Sh(i,this.appliedPreAttributes)||(Hh(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function ig(e,t,n=!1){return!n&&e==null&&t!=null}function ag(e,t,n=!1){return e==null&&t!=null&&!n}function og(e){return{...on,...e}}function sg(e,t){let n=cg(e,t);return t?n:e.diffHeaderHeight+n}function cg(e,t){return e.paddingTop??(t?e.spacing:0)}function lg(e){return e.paddingBottom??e.spacing}function ug(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var dg=5e3,fg=new Map,pg=-1;function mg(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var hg=class extends rg{virtualizer;metrics;__id=`virtualized-file:${++pg}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:fg};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=on,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=og(e);(t||!pp(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache(),!0):!1}hasLineAnnotations(){return this.getLatestAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!hp(t,e),r=mg(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.ghostTextRows=fg,this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){let{heights:t,ghostTextRows:n}=this.cache;if(n===e)return!1;let{lineHeight:r}=this.metrics,i=!1;for(let a of new Set([...n.keys(),...e.keys()])){let o=n.get(a)??0,s=e.get(a)??0;if(s===o)continue;let c=(t.get(a)??r)-o*r+s*r;c===r?t.delete(a):t.set(a,c),i=!0}return this.cache.ghostTextRows=e,i}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.editor?.__getGhostTextRows()??fg;if(e=this.applyGhostTextRows(n),this.placeHolder!=null||t===`scroll`&&this.getLatestAnnotations().length===0&&!this.isResizeDebuggingEnabled())return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let{lineHeight:r}=this.metrics;if(this.code==null)return e;let i=this.code.children[1];if(!(i instanceof HTMLElement))return e;let a=uh(this.getLatestAnnotations());if(this.renderRange!=null&&a&&fh(this.renderRange)){let t=gg(i)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!a&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let a=Number(i),o=t.getBoundingClientRect().height+(n.get(a)??0)*r,s=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(s=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let c=this.getLineHeight(a,s);o!==c&&(e=!0,o===this.metrics.lineHeight*(s?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,o))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));updateCodeViewLayout(e,t,n,r){let i=!ch(this.file,e);i&&this.updateExternalFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o||c;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&this.resetLayoutCache(),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1,a=sg(this.metrics,n);if(r||i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=sg(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!ch(this.getRenderedFile(),this.getLatestFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??fg);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=sg(this.metrics,i),l=lg(this.metrics);if(this.height+=c,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:t.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.file==null)return;let e=this.getLatestFile(),t=e==null?void 0:this.fileRenderer.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!ch(this.getRenderedFile(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1);let i=this.getRenderedFile();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!ch(this.file,t);a&&(this.updateExternalFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,(l||s)&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!d))return this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.fileRenderer.getFileForNextRender(n);return this.pendingRender={latestFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!ch(i,a),renderedFileChanged:!ch(r,a)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%dg===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=sg(this.metrics,i),u=s>0?lg(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=uh(this.getLatestAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=Math.floor(g&&b<t+f?0:(b-(t+f))/o),h=Math.floor(m/a)-Math.floor(y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,w=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-w)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),w=t+(C?.top??f),T=C?.lineIndex??0,E,D,ee,O=C?.lineIndex??0;for(let e=O;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),ee!=null)){if(ee<=0)break;ee--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),w+s>b&&(D??=o),ee==null&&w>=r&&i&&(ee=x),T++,w+=s}if(E==null){if(g)E=0,D=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}D??=E;let te=Math.round(D-y/2),ne=Math.max(0,Math.ceil(s/a)-y),k=Math.max(0,Math.min(te,ne)),re=k*a,ie=te<0?v+te*a:v,ae=S[k]??0,oe=re===0?0:d+ae,se=k+ie/a,ce=se<S.length?p-S[se]:p-(w-t-f);return{startingLine:re,totalLines:ie,bufferBefore:oe,bufferAfter:Math.max(0,ce)}}};function gg(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===lh&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function _g(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function vg(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function yg(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function bg(e){return{...e,hunks:yg(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function xg(e,t){return e-(t===0?0:1)}function Sg(e,t){return xg(e,t)+t}var Cg=1;function wg(e,...t){return`ck${Cg}:${JSON.stringify([e,...t])}`}function Tg(e){return e===``?[]:e.split(Ht)}function Eg(e,t,n){let r=e===`clone`?bg(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Dg(r,kg(r,n),Ag(r,n));case`rename-pure`:{let e=Ag(r,n);jg(r,n);let t=Tg(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,Ng(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Dg(e,t,n){let r=Tg(t.contents),i=Tg(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=Og(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,Ng(e,t,n),e}function Og(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(xg(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=Sg(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=Sg(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function kg(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function Ag(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function jg(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Mg(e,t,n){return e.cacheKey==null?Pg(t,n):`${e.cacheKey}:hydrated`}function Ng(e,t,n){let r=Mg(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function Pg(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?wg(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}function Fg(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Ig=new TextEncoder,Lg=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Rg=/[\uD800-\uDFFF]/,zg=1024,Bg=new Uint8Array(zg);function Vg(){Bg.length!==zg&&(Bg=new Uint8Array(zg))}function Hg(e){if(e.length===0)return e;if(Rg.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Bg.length<t&&(Bg=new Uint8Array(t));let{written:n}=Ig.encodeInto(e,Bg);return Lg.decode(Bg.subarray(0,n))}var Ug=4096,Wg=.5;function Gg(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=qg(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}Kg(t,e)}}function Kg(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function qg(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Ug)return null;let c=[];for(let t=0;t<n;t++)c.push(Yg(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(Yg(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=Xg(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Wg:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var Jg=/\s+/g;function Yg(e){return e.replace(Jg,``)}function Xg(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function Zg(e,t,n=!1,r){let i=h_(e),a=i?i_(e):a_(e),o,s=[];for(let e of a){if(i&&!Vt.test(e)){if(o==null)o=Hg(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!o_(e)){if(o==null)o=Hg(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=$g(e,{cacheKey:t==null?void 0:r==null?wg(`patch-file`,t,String(s.length)):wg(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function Qg(e,t){try{return $g(e,t)}finally{Vg()}}function $g(e,{cacheKey:t,isGitDiff:n=Vt.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=g_(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=r_(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=f_(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?n_(i.contents):[],deletionLines:!l&&r!=null&&i!=null?n_(r.contents):[],cacheKey:v_(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(Gt),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=Hg(r.trim()),n!==r&&(c.prevName=Hg(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Wt:Ut):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Hg(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Hg(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Hg(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Hg(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Hg(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Hg(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Kt)??[];t!=null&&(c.prevObjectId=Hg(t)),n!=null&&(c.newObjectId=Hg(n)),r!=null&&(c.mode=Hg(r))}e.startsWith(`rename from `)&&(c.prevName=Hg(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Hg(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
1502
+ }`}function Rh(e,t){let n=Nh(t);return e.replace(Fh,n)}function zh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var Bh=new WeakMap;function Vh(e){return Bh.get(e)??e}function Hh({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function Uh(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Wh(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function Gh(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function Kh(e,t,n){let r=new Map;for(let i of e){let e=Vh(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function qh(e,t,n){for(let r of t){let t=Vh(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function Jh(e,t,n){if(e==null)return n(t);let r=Vh(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function Yh(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Xh(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Yh(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Zh(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function Qh({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=$h(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function $h(){let e=document.createElement(`style`);return e.setAttribute(en,``),e}var eg=void 0;function tg(){return eg??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(Ah)),t.adoptedStyleSheets=[e]}connectedCallback(){Mh(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Bt,t)}var ng=[``];function rg(e){let t={...e};return delete t.cacheKey,t}var ig=-1,ag=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++ig}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(e={theme:$t},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new bh(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new Qp,this.interactionManager=new jp(`file`,Mp(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>Jh(this.editSession?.annotations,e,Cm);handleHighlightRender=()=>{this.rerender()};rerender(){this.enabled&&this.file!=null&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??$t}getLatestFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedFile}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}updateExternalFile(e,t){if(uh(this.file,e))return!1;let n=this.editSession!=null;return this.file=e,n||this.editor!=null?this.installEditSession(e,n?void 0:this.editor?.__getDocumentContents(e),!0):this.editSession=void 0,this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=Kh(t,Cm,this.editSession.annotations)),!0}installEditSession(e,t,n=!1){let r=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===e.contents,i=rg(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??Kh(this.lineAnnotations,Cm)},this.fileRenderer.beginEditSession(i,r?e:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Mp(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!gp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,qh(t,e,Cm))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.getLatestAnnotations().length>0}cleanUp(e=!1){let t=this.editor;this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||og(this.pre,i,this.options.collapsed)||sg(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Uh(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Xh(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderedFile=e,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.getLatestFile()){return e==null?ng:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getLatestFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getLatestFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,file:i,lineAnnotations:r,renderRange:n,externalDocument:this.editSession?.externalReplacement===!0})},o=this.getTheme(),s=i.lang??ym(i.name),c=sp({theme:o,lang:s});c==null?ap({themes:yf(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.externalReplacement=!1)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSession==null?this.file!=null&&this.installEditSession(this.file,e.__getDocumentContents(this.file)):this.fileRenderer.beginEditSession(this.editSession.file);let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(this.fileRenderer.fileCache===t&&(this.renderedFile=t),this.syncRenderViewToEditor()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,file:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{file:a,annotations:o}=n;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=o?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...a},f={file:d,editor:t,originalFile:r,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===r.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}e&&c!=null&&(this.file=c,s!=null&&(this.lineAnnotations=s)),this.editSession=void 0;let{renderedFile:p,file:m}=this;if(this.fileRenderer.endEditSession(m),p!=null&&m!=null&&p!==m&&uh(p,m)&&(this.renderedFile=m),e&&this.fileContainer!=null&&this.rerender(),l)throw u}applyDocumentChange(e,t){let n=this.editSession?.file;if(n==null)throw Error(`File.applyDocumentChange: requires an active edit session`);this.fileRenderer.beginEditSession(n),this.fileRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}updateRenderCache(e,t,n){let r=this.editSession?.file;if(r==null)throw Error(`File.updateRenderCache: requires an active edit session`);this.fileRenderer.beginEditSession(r),this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),m=!uh(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&cm(u,this.renderRange)&&!m&&!p&&!f){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(Xh(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderFile(h,mn);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,e.file),this.renderedFile=e?.file??h,this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f||!uh(this.renderedFile,h))||!this.applyPartialRender(h,d,u)){let n=this.fileRenderer.renderFile(h,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyFullRender(n,e),this.renderedFile=n.file}this.applyBuffers(e,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||_h(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!Ch(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Dh(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Oh();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=kh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Ih(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Mh(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Qh({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Lh(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Rh(this.themeCSSStyle.textContent??``,Mh(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&tg()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=Hh({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=Is(i.children),t.style.cssText=i.properties.style}else n.innerHTML=Is(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?Zh(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t,n){if(t==null||n==null)return!1;let{code:r}=this,i=r==null?void 0:this.getColumns(r);if(r==null||i==null)return!1;let a=t.startingLine,o=n.startingLine,s=t.totalLines===1/0?1/0:a+t.totalLines,c=n.totalLines===1/0?1/0:o+n.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(t,n)=>{if(!(n<=0))return this.fileRenderer.renderFile(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??Is(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Qt,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Yt,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Xt,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Zt,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Gh(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Gh(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Sh;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};wh(i,this.appliedPreAttributes)||(Wh(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function og(e,t,n=!1){return!n&&e==null&&t!=null}function sg(e,t,n=!1){return e==null&&t!=null&&!n}function cg(e){return{...cn,...e}}function lg(e,t){let n=ug(e,t);return t?n:e.diffHeaderHeight+n}function ug(e,t){return e.paddingTop??(t?e.spacing:0)}function dg(e){return e.paddingBottom??e.spacing}function fg(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var pg=5e3,mg=new Map,hg=-1;function gg(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var _g=class extends ag{virtualizer;metrics;__id=`virtualized-file:${++hg}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:mg};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=cn,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=cg(e);(t||!hp(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache(),!0):!1}hasLineAnnotations(){return this.getLatestAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!_p(t,e),r=gg(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.ghostTextRows=mg,this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){let{heights:t,ghostTextRows:n}=this.cache;if(n===e)return!1;let{lineHeight:r}=this.metrics,i=!1;for(let a of new Set([...n.keys(),...e.keys()])){let o=n.get(a)??0,s=e.get(a)??0;if(s===o)continue;let c=(t.get(a)??r)-o*r+s*r;c===r?t.delete(a):t.set(a,c),i=!0}return this.cache.ghostTextRows=e,i}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.editor?.__getGhostTextRows()??mg;if(e=this.applyGhostTextRows(n),this.placeHolder!=null||t===`scroll`&&this.getLatestAnnotations().length===0&&!this.isResizeDebuggingEnabled())return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let{lineHeight:r}=this.metrics;if(this.code==null)return e;let i=this.code.children[1];if(!(i instanceof HTMLElement))return e;let a=fh(this.getLatestAnnotations());if(this.renderRange!=null&&a&&mh(this.renderRange)){let t=vg(i)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!a&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let a=Number(i),o=t.getBoundingClientRect().height+(n.get(a)??0)*r,s=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(s=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let c=this.getLineHeight(a,s);o!==c&&(e=!0,o===this.metrics.lineHeight*(s?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,o))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));updateCodeViewLayout(e,t,n,r){let i=!uh(this.file,e);i&&this.updateExternalFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o||c;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&this.resetLayoutCache(),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1,a=lg(this.metrics,n);if(r||i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=lg(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!uh(this.getRenderedFile(),this.getLatestFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??mg);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=lg(this.metrics,i),l=dg(this.metrics);if(this.height+=c,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:t.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.file==null)return;let e=this.getLatestFile(),t=e==null?void 0:this.fileRenderer.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!uh(this.getRenderedFile(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1);let i=this.getRenderedFile();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!uh(this.file,t);a&&(this.updateExternalFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,(l||s)&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!d))return this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.fileRenderer.getFileForNextRender(n);return this.pendingRender={latestFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!uh(i,a),renderedFileChanged:!uh(r,a)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%pg===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=lg(this.metrics,i),u=s>0?dg(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=fh(this.getLatestAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=Math.floor(g&&b<t+f?0:(b-(t+f))/o),h=Math.floor(m/a)-Math.floor(y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,w=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-w)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),w=t+(C?.top??f),T=C?.lineIndex??0,E,D,ee,O=C?.lineIndex??0;for(let e=O;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),ee!=null)){if(ee<=0)break;ee--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),w+s>b&&(D??=o),ee==null&&w>=r&&i&&(ee=x),T++,w+=s}if(E==null){if(g)E=0,D=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}D??=E;let te=Math.round(D-y/2),ne=Math.max(0,Math.ceil(s/a)-y),k=Math.max(0,Math.min(te,ne)),re=k*a,ie=te<0?v+te*a:v,ae=S[k]??0,oe=re===0?0:d+ae,se=k+ie/a,ce=se<S.length?p-S[se]:p-(w-t-f);return{startingLine:re,totalLines:ie,bufferBefore:oe,bufferAfter:Math.max(0,ce)}}};function vg(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===dh&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function yg(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function bg(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function xg(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function Sg(e){return{...e,hunks:xg(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function Cg(e,t){return e-(t===0?0:1)}function wg(e,t){return Cg(e,t)+t}var Tg=1;function Eg(e,...t){return`ck${Tg}:${JSON.stringify([e,...t])}`}function Dg(e){return e===``?[]:e.split(Wt)}function Og(e,t,n){let r=e===`clone`?Sg(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return kg(r,jg(r,n),Mg(r,n));case`rename-pure`:{let e=Mg(r,n);Ng(r,n);let t=Dg(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,Fg(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function kg(e,t,n){let r=Dg(t.contents),i=Dg(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=Ag(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,Fg(e,t,n),e}function Ag(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Cg(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=wg(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=wg(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function jg(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function Mg(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Ng(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Pg(e,t,n){return e.cacheKey==null?Ig(t,n):`${e.cacheKey}:hydrated`}function Fg(e,t,n){let r=Pg(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function Ig(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?Eg(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}function Lg(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Rg=new TextEncoder,zg=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Bg=/[\uD800-\uDFFF]/,Vg=1024,Hg=new Uint8Array(Vg);function Ug(){Hg.length!==Vg&&(Hg=new Uint8Array(Vg))}function Wg(e){if(e.length===0)return e;if(Bg.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Hg.length<t&&(Hg=new Uint8Array(t));let{written:n}=Rg.encodeInto(e,Hg);return zg.decode(Hg.subarray(0,n))}var Gg=4096,Kg=.5;function qg(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=Yg(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}Jg(t,e)}}function Jg(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function Yg(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Gg)return null;let c=[];for(let t=0;t<n;t++)c.push(Zg(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(Zg(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=Qg(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Kg:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var Xg=/\s+/g;function Zg(e){return e.replace(Xg,``)}function Qg(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function $g(e,t,n=!1,r){let i=__(e),a=i?o_(e):s_(e),o,s=[];for(let e of a){if(i&&!Ut.test(e)){if(o==null)o=Wg(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!c_(e)){if(o==null)o=Wg(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=t_(e,{cacheKey:t==null?void 0:r==null?Eg(`patch-file`,t,String(s.length)):Eg(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function e_(e,t){try{return t_(e,t)}finally{Ug()}}function t_(e,{cacheKey:t,isGitDiff:n=Ut.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=v_(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=a_(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=m_(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?i_(i.contents):[],deletionLines:!l&&r!=null&&i!=null?i_(r.contents):[],cacheKey:b_(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(qt),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=Wg(r.trim()),n!==r&&(c.prevName=Wg(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Kt:Gt):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Wg(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Wg(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Wg(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Wg(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Wg(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Wg(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Jt)??[];t!=null&&(c.prevObjectId=Wg(t)),n!=null&&(c.newObjectId=Wg(n)),r!=null&&(c.mode=Wg(r))}e.startsWith(`rename from `)&&(c.prevName=Wg(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Wg(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
1503
1503
  `||s[s.length-1]===`\r`||s[s.length-1]===`\r
1504
- `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:v_(p.hunkContext),hunkSpecs:Hg(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!u_(t)||d_(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=y_(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=b_(t);(g==null||g.type!==`change`)&&(g=x_(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=b_(t);(g==null||g.type!==`change`)&&(g=x_(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=b_(t);(g==null||g.type!==`context`)&&(g=x_(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=Fg(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Fg(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=xg(b.additionStart,b.additionCount)+(x===0?0:1),t=xg(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(xg(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Sg(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=Sg(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),Gg(c),c}}function e_(e,t,n=!1){let r=[],i=t_(e)?e.split(Bt):[e];for(let e of i)try{r.push(Zg(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{Vg()}return r}function t_(e){return e.startsWith(`From `)||e.includes(`
1505
- From `)}function n_(e){let t=r_(e);for(let e=0;e<t.length;e++)t[e]=Hg(t[e]);return t}function r_(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1506
- `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function i_(e){return g_(e,`diff --git`)}function a_(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=l_(e,r);if(i<=0&&a<=0){if(s_(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=l_(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=f_(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function o_(e){return s_(e,0)}function s_(e,t){let n=l_(e,t);return c_(e,t,`---`)&&c_(e,n,`+++`)}function c_(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
1507
- `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function l_(e,t){let n=e.indexOf(`
1508
- `,t);return n===-1?e.length:n+1}function u_(e){let t=e[0];return t===`+`||t===`-`||t===` `}function d_(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1509
- `&&n!==`\r`)return!1}return!0}function f_(e){if(!e.startsWith(`@@ -`))return;let t=4,n=p_(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=p_(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=p_(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=p_(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=m_(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function p_(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function m_(e){return e.endsWith(`\r
1504
+ `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:b_(p.hunkContext),hunkSpecs:Wg(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!f_(t)||p_(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=x_(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=S_(t);(g==null||g.type!==`change`)&&(g=C_(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=S_(t);(g==null||g.type!==`change`)&&(g=C_(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=S_(t);(g==null||g.type!==`context`)&&(g=C_(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=Lg(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Lg(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=Cg(b.additionStart,b.additionCount)+(x===0?0:1),t=Cg(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Cg(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=wg(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=wg(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),qg(c),c}}function n_(e,t,n=!1){let r=[],i=r_(e)?e.split(Ht):[e];for(let e of i)try{r.push($g(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{Ug()}return r}function r_(e){return e.startsWith(`From `)||e.includes(`
1505
+ From `)}function i_(e){let t=a_(e);for(let e=0;e<t.length;e++)t[e]=Wg(t[e]);return t}function a_(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1506
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function o_(e){return v_(e,`diff --git`)}function s_(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=d_(e,r);if(i<=0&&a<=0){if(l_(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=d_(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=m_(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function c_(e){return l_(e,0)}function l_(e,t){let n=d_(e,t);return u_(e,t,`---`)&&u_(e,n,`+++`)}function u_(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
1507
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function d_(e,t){let n=e.indexOf(`
1508
+ `,t);return n===-1?e.length:n+1}function f_(e){let t=e[0];return t===`+`||t===`-`||t===` `}function p_(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1509
+ `&&n!==`\r`)return!1}return!0}function m_(e){if(!e.startsWith(`@@ -`))return;let t=4,n=h_(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=h_(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=h_(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=h_(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=g_(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function h_(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function g_(e){return e.endsWith(`\r
1510
1510
  `)?e.slice(0,-2):e.endsWith(`
1511
- `)?e.slice(0,-1):e}function h_(e){return e.startsWith(`diff --git`)||e.includes(`
1512
- diff --git`)}function g_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:__(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=__(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function __(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function v_(e){return e==null?e:Hg(e)}function y_(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function b_(e){let t=e.slice(1);return Hg(t===``?`
1513
- `:t)}function x_(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var S_=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},C_=new class extends S_{};function w_(e,t,n){return C_.diff(e,t,n)}function T_(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function E_(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function D_(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function O_(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function k_(e,t){return D_(e,t,``)}function A_(e,t){return O_(e,t,``)}function j_(e,t){return t.slice(0,M_(e,t))}function M_(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function N_(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function P_(e,t){if(t)return I_(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function F_(e,t){if(t)return I_(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function I_(e,t){if(!t)return[F_(e),P_(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=N_(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var L_=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,R_=RegExp(`[${L_}]+|\\s+|[^${L_}]`,`ug`);new class extends S_{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=N_(e,r)}else n=e.match(R_)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&z_(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&z_(n,i,r,null,t.intlSegmenter),e}};function z_(e,t,n,r,i){if(t&&n){let[a,o]=I_(t.value,i),[s,c]=I_(n.value,i);if(e){let r=T_(a,s);e.value=O_(e.value,s,r),t.value=k_(t.value,r),n.value=k_(n.value,r)}if(r){let e=E_(o,c);r.value=D_(r.value,c,e),t.value=A_(t.value,e),n.value=A_(n.value,e)}}else if(n){if(e){let e=F_(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=F_(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=F_(r.value,i),[a,o]=I_(t.value,i),s=T_(n,a);t.value=k_(t.value,s);let c=E_(k_(n,s),o);t.value=A_(t.value,c),r.value=D_(r.value,n,c),e.value=O_(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=F_(r.value,i),n=j_(P_(t.value,i),e);t.value=A_(t.value,n)}else if(e){let n=j_(P_(e.value,i),F_(t.value,i));t.value=k_(t.value,n)}}var B_=new class extends S_{tokenize(e){let t=RegExp(`(\\r?\\n)|[${L_}]+|[^\\S\\n\\r]+|[^${L_}]`,`ug`);return e.match(t)||[]}};function V_(e,t,n){return B_.diff(e,t,n)}var H_=new class extends S_{constructor(){super(...arguments),this.tokenize=W_}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
1511
+ `)?e.slice(0,-1):e}function __(e){return e.startsWith(`diff --git`)||e.includes(`
1512
+ diff --git`)}function v_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:y_(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=y_(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function y_(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function b_(e){return e==null?e:Wg(e)}function x_(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function S_(e){let t=e.slice(1);return Wg(t===``?`
1513
+ `:t)}function C_(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var w_=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},T_=new class extends w_{};function E_(e,t,n){return T_.diff(e,t,n)}function D_(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function O_(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function k_(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function A_(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function j_(e,t){return k_(e,t,``)}function M_(e,t){return A_(e,t,``)}function N_(e,t){return t.slice(0,P_(e,t))}function P_(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function F_(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function I_(e,t){if(t)return R_(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function L_(e,t){if(t)return R_(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function R_(e,t){if(!t)return[L_(e),I_(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=F_(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var z_=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,B_=RegExp(`[${z_}]+|\\s+|[^${z_}]`,`ug`);new class extends w_{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=F_(e,r)}else n=e.match(B_)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&V_(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&V_(n,i,r,null,t.intlSegmenter),e}};function V_(e,t,n,r,i){if(t&&n){let[a,o]=R_(t.value,i),[s,c]=R_(n.value,i);if(e){let r=D_(a,s);e.value=A_(e.value,s,r),t.value=j_(t.value,r),n.value=j_(n.value,r)}if(r){let e=O_(o,c);r.value=k_(r.value,c,e),t.value=M_(t.value,e),n.value=M_(n.value,e)}}else if(n){if(e){let e=L_(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=L_(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=L_(r.value,i),[a,o]=R_(t.value,i),s=D_(n,a);t.value=j_(t.value,s);let c=O_(j_(n,s),o);t.value=M_(t.value,c),r.value=k_(r.value,n,c),e.value=A_(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=L_(r.value,i),n=N_(I_(t.value,i),e);t.value=M_(t.value,n)}else if(e){let n=N_(I_(e.value,i),L_(t.value,i));t.value=j_(t.value,n)}}var H_=new class extends w_{tokenize(e){let t=RegExp(`(\\r?\\n)|[${z_}]+|[^\\S\\n\\r]+|[^${z_}]`,`ug`);return e.match(t)||[]}};function U_(e,t,n){return H_.diff(e,t,n)}var W_=new class extends w_{constructor(){super(...arguments),this.tokenize=K_}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
1514
1514
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
1515
1515
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
1516
1516
  `)&&(e=e.slice(0,-1)),t.endsWith(`
1517
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function U_(e,t,n){return H_.diff(e,t,n)}function W_(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1518
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function G_(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function K_(e){if(!G_(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var q_={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function J_(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;U_(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(U_(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Z_(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
1519
- `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Y_(e,t){if(t||=q_,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Y_(e,t)).join(`
1520
- `)}let n=[];if(e.isGit){if(t=q_,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+K_(r)+` `+K_(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+K_((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+K_((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+K_((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+K_((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+K_(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+K_(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
1517
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function G_(e,t,n){return W_.diff(e,t,n)}function K_(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1518
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function q_(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function J_(e){if(!q_(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Y_={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function X_(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;G_(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(G_(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||$_(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
1519
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Z_(e,t){if(t||=Y_,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Z_(e,t)).join(`
1520
+ `)}let n=[];if(e.isGit){if(t=Y_,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+J_(r)+` `+J_(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+J_((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+J_((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+J_((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+J_((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+J_(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+J_(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
1521
1521
  `)+`
1522
- `}function X_(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;J_(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Y_(e,o.headerOptions):void 0)}}))}else{let s=J_(e,t,n,r,i,a,o);return s?Y_(s,o?.headerOptions):void 0}}function Z_(e){let t=e.endsWith(`
1522
+ `}function Q_(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;X_(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Z_(e,o.headerOptions):void 0)}}))}else{let s=X_(e,t,n,r,i,a,o);return s?Z_(s,o?.headerOptions):void 0}}function $_(e){let t=e.endsWith(`
1523
1523
  `),n=e.split(`
1524
1524
  `).map(e=>e+`
1525
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var Q_=`/dev/null`;function $_(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??ev(),a=t??ev(),o=Qg(X_(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?wg(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function ev(){return{name:Q_,contents:``}}var tv=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function nv(e,t){return mp(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function rv(e){return q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function iv(e){return q({tagName:`div`,children:[q({tagName:`span`,children:[bp(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function av(e){return q({tagName:`div`,children:[xp({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function ov({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(q({tagName:`div`,children:[bp(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(av(`up`)),s++),o||(e.push(av(`down`)),s++)):(e.push(av(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(q({tagName:`div`,children:[q({tagName:`span`,children:[bp(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(q({tagName:`div`,children:[bp(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(q({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(q({tagName:`slot`,properties:{name:i}})),q({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function sv(e,t){return`hunk-separator-${e}-${t}`}function cv(e){let t=e.at(-1);return t==null?0:Math.max(Sg(t.additionStart,t.additionCount),Sg(t.deletionStart,t.deletionCount))}function lv({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function uv({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function dv(e){return[xg(e.additionStart,e.additionCount)+1,Sg(e.additionStart,e.additionCount)+1]}function fv({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function pv(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-Sg(t.additionStart,t.additionCount),r=e.deletionLines.length-Sg(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function mv({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-Sg(n.additionStart,n.additionCount),i=e.deletionLines.length-Sg(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function hv({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=mv({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function gv({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=dv(a);if(t<o){let s=fv({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=hv({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=dv(a);return t<o+i.fromStart||t>=o+i.rangeSize}function _v({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=dv(n),l=fv({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=hv({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function vv({type:e,metrics:t}){return t.hunkSeparatorHeight??ug(e)}function yv({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function bv({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function xv(e){return e!==`simple`&&e!==`metadata`}function Sv({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!bv({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=vv({type:e,metrics:t}),a=yv({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Cv({type:e,metrics:t}){if(!xv(e))return;let n=vv({type:e,metrics:t}),r=yv({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function wv({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=Tv({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=xg(r.deletionStart,r.deletionCount),s=xg(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=fv({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?hv({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(Ov(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,Ov(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(Ov(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=kv(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(Av({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(Ov(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function Tv({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=Ev({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function Ev({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=fv({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?hv({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function Dv(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function Ov(e,t,n,r,i,a){let[o,s]=Dv(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function kv(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function Av({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var jv={forcePlainText:!1};function Mv(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=jv){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Jm({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??Pv();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}wv({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&Nv({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Fv({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else rh(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else rh(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function Nv({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Fg(e),t=Fg(t),e.length>s||t.length>s))return;let c=o===`char`?w_(e,t):V_(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(uv({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),uv({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?uv({item:e,arr:l,enableJoin:d,isLastItem:t}):uv({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(lv({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(lv({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Pv(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Fv({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??_m(e.name),d=s??_m(t.name),{state:f,transformers:p}=Mm(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Fm(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Fm(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Xm(i.codeToHast(Fg(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Xm(i.codeToHast(Fg(t.contents),m)))}}function Iv(e,t){let n=$_({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Lv(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function Rv(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function zv(e,t){return t.length>0&&t.length<e.deletionLines.length&&Rv(t)}function Bv(e,t,n){let r=e.deletionLines.join(``),i=Lv(t.length,r),a=$_({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Vv(e,t){return Bv(e,[``],t)}function Hv(e,t){if(e.additionLines.length===0)return Vv(e,t);if(zv(e,e.additionLines))return Bv(e,e.additionLines,t);let n=e.additionLines,r=Iv(e,t);return Wv(r,n),r}function Uv(e){return e.length>1&&e.at(-1)===``}function Wv(e,t){if(!Uv(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&Sg(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,ey(e);return}}}function Gv(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Kv(e,Iv(e,n));let r=Array.from(t);if(r.length===0)return Kv(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||Fg(r)===Fg(i))return Kv(e,Iv(e,n))}let i=qv(e,r);if(i.size===0)return Kv(e,Iv(e,n));for(let t of i)if(!Yv(e,t,n))return Kv(e,Iv(e,n));return ey(e),pv(e)?Kv(e,Iv(e,n)):Kv(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Kv(e,t){return Object.assign(e,t),t}function qv(e,t){let n=new Set;for(let r of t){let t=Jv(e,r);if(t==null)return new Set;n.add(t)}return n}function Jv(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function Yv(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=$_({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(Zv(r,s),Xv(e,t),!0)}function Xv(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
1525
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var ev=`/dev/null`;function tv(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??nv(),a=t??nv(),o=e_(Q_(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?Eg(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function nv(){return{name:ev,contents:``}}var rv=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function iv(e,t){return gp(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function av(e){return q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ov(e){return q({tagName:`div`,children:[q({tagName:`span`,children:[Sp(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function sv(e){return q({tagName:`div`,children:[Cp({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function cv({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(q({tagName:`div`,children:[Sp(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(sv(`up`)),s++),o||(e.push(sv(`down`)),s++)):(e.push(sv(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(q({tagName:`div`,children:[q({tagName:`span`,children:[Sp(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(q({tagName:`div`,children:[Sp(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(q({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(q({tagName:`slot`,properties:{name:i}})),q({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function lv(e,t){return`hunk-separator-${e}-${t}`}function uv(e){let t=e.at(-1);return t==null?0:Math.max(wg(t.additionStart,t.additionCount),wg(t.deletionStart,t.deletionCount))}function dv({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function fv({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function pv(e){return[Cg(e.additionStart,e.additionCount)+1,wg(e.additionStart,e.additionCount)+1]}function mv({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function hv(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-wg(t.additionStart,t.additionCount),r=e.deletionLines.length-wg(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function gv({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-wg(n.additionStart,n.additionCount),i=e.deletionLines.length-wg(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function _v({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=gv({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function vv({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=pv(a);if(t<o){let s=mv({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=_v({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=pv(a);return t<o+i.fromStart||t>=o+i.rangeSize}function yv({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=pv(n),l=mv({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=_v({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function bv({type:e,metrics:t}){return t.hunkSeparatorHeight??fg(e)}function xv({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function Sv({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function Cv(e){return e!==`simple`&&e!==`metadata`}function wv({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!Sv({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=bv({type:e,metrics:t}),a=xv({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Tv({type:e,metrics:t}){if(!Cv(e))return;let n=bv({type:e,metrics:t}),r=xv({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Ev({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=Dv({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Cg(r.deletionStart,r.deletionCount),s=Cg(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=mv({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?_v({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(Av(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,Av(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(Av(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=jv(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(Mv({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(Av(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function Dv({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=Ov({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function Ov({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=mv({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?_v({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function kv(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function Av(e,t,n,r,i,a){let[o,s]=kv(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function jv(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function Mv({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var Nv={forcePlainText:!1};function Pv(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Nv){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Xm({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??Iv();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}Ev({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&Fv({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Lv({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else ah(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else ah(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function Fv({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Lg(e),t=Lg(t),e.length>s||t.length>s))return;let c=o===`char`?E_(e,t):U_(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(fv({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),fv({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?fv({item:e,arr:l,enableJoin:d,isLastItem:t}):fv({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(dv({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(dv({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Iv(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Lv({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??ym(e.name),d=s??ym(t.name),{state:f,transformers:p}=Pm(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Lm(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Lm(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Qm(i.codeToHast(Lg(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Qm(i.codeToHast(Lg(t.contents),m)))}}function Rv(e,t){let n=tv({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function zv(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function Bv(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function Vv(e,t){return t.length>0&&t.length<e.deletionLines.length&&Bv(t)}function Hv(e,t,n){let r=e.deletionLines.join(``),i=zv(t.length,r),a=tv({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Uv(e,t){return Hv(e,[``],t)}function Wv(e,t){if(e.additionLines.length===0)return Uv(e,t);if(Vv(e,e.additionLines))return Hv(e,e.additionLines,t);let n=e.additionLines,r=Rv(e,t);return Kv(r,n),r}function Gv(e){return e.length>1&&e.at(-1)===``}function Kv(e,t){if(!Gv(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&wg(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,ny(e);return}}}function qv(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Jv(e,Rv(e,n));let r=Array.from(t);if(r.length===0)return Jv(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||Lg(r)===Lg(i))return Jv(e,Rv(e,n))}let i=Yv(e,r);if(i.size===0)return Jv(e,Rv(e,n));for(let t of i)if(!Zv(e,t,n))return Jv(e,Rv(e,n));return ny(e),hv(e)?Jv(e,Rv(e,n)):Jv(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Jv(e,t){return Object.assign(e,t),t}function Yv(e,t){let n=new Set;for(let r of t){let t=Xv(e,r);if(t==null)return new Set;n.add(t)}return n}function Xv(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function Zv(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=tv({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:($v(r,s),Qv(e,t),!0)}function Qv(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
1526
1526
  `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
1527
- `)}function Zv(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Qv(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,$v(e)}function Qv(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function $v(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function ey(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(xg(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,$v(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=Sg(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-Sg(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var ty=new WeakMap;function ny(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function ry(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function iy(e,t){let n=e.hunks,r=e.additionLines,i=ny(r),a=i===r?e:{...e,additionLines:i},o=my(n,py(a,t),e.deletionLines.length),s=_y(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Dy(e),Wv(e,r),by(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function ay(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<Cy(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Cy(r);if(i==null||t<i||o!=null&&o!==s)return iy(e,n);o=s}if(o!=null){if(oy(e,i,o,r,n)){e.editSessionDirty=!0;return}return iy(e,n)}}function oy(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=sy(e),o=e.hunks[n];if(o.hunkContent.some(cy))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function sy(e){let t=ty.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return ty.set(e,{lines:e.deletionLines,set:n}),n}function cy(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function ly(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function uy(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=fv({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=wy(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=hv({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=wy(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function dy(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=wy(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,wy(i)+i.deletionCount,e.deletionLines.length),n}function fy(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Iv(e,t):Hv(e,t)),!0)}function py(e,t){if(ry(e.deletionLines,e.additionLines)==null)return[];let n=$_({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=Qv(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function my(e,t,n){let r=e.map((e,t)=>{let n=wy(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&hy(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=gy(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function hy(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function gy(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function _y(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);yy(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);yy(s,c,i,r),r+=c,i+=c,n.push(vy(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function vy(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:Ty(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Ey(t.additionStart,r),deletionStart:Ty(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Ey(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Ty(t.deletionStart,i)},${i} +${Ty(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return $v(s),s}function yy(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function by(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(wy(r)!==wy(i)||r.deletionCount!==i.deletionCount||Cy(r)!==Cy(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!xy(r,i))return!0}return!1}function xy(e,t){let n=Sy(e),r=Sy(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*Sy(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function Cy(e){return xg(e.additionStart,e.additionCount)}function wy(e){return xg(e.deletionStart,e.deletionCount)}function Ty(e,t){return t===0?e:e+1}function Ey(e,t){return t===0?e-1:e}function Dy(e){ey(e);for(let t=0;t<e.hunks.length;t++)Xv(e,t)}function Oy(e){let t=e.lang??_m(e.name),n=e.lang??(e.prevName==null?`text`:_m(e.prevName));return t===`text`&&n===`text`}var ky=-1,Ay=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++ky}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:Zt},t=xm,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=yf(e.theme??Zt)?ap():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,!e.isPartial&&e.additionLines.length===0){Object.assign(e,Vv(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&_g(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!nv(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!_g(t.diff,e)||Oy(e)||Uy(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!_g(n,e)||!_g(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);nv(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??un}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=Fg(u);s==null&&i&&(a.additionLines[t]=ph(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,Vv(a,this.options.parseDiffOptions)),u=!0;else if(zv(a,a.additionLines))this.applyRecomputePreservingSessionType(a,Bv(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=ay(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,Gv(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=ly(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=Vy(e),i.code.additionLines=zy(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Vv(r,this.options.parseDiffOptions)),i.code.additionLines[0]=By(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,Hv(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(zv(e,n)){this.applyRecomputePreservingSessionType(e,Bv(e,n,t));return}this.applyExpansionRemap(iy(e,t))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>sm(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=Zt,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=an,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await rp(bm(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Uy(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!nv(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!Oy(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLangs=Hy(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Zt}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!_g(e,n.diff)||!nv(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(_g(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||Oy(e)||Uy(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||_g(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&yf(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&yf(t.theme)}renderDiff(e=this.diff,t=dn){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||Oy(e)||Uy(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!_g(e,this.renderCache.diff),d=!om(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&Sm(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Sm(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=Hy(e),this.highlighter??=ap();let t=this.highlighter!=null&&yf(i.theme),n=this.highlighter!=null&&_n(this.computedLangs),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=dn){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return fm({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Uy(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:Hy(e);let n=this.highlighter!=null&&yf(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&_n(this.computedLangs);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=Mv(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(wv({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=By(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&_g(i,e)&&nv(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&nv(a.options,n)&&_g(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&nv(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&_g(n.diff,e)&&nv(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&_g(e,n.diff)&&nv(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=Wy(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:Cp(),deletionsGutterAST:Cp(),additionsGutterAST:Cp(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=mv({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,Tp(void 0,`buffer`,this.size)),h?.push(rv(this.size))):(x.pushToGutter(`deletions`,Tp(void 0,`buffer`,this.size)),g?.push(rv(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,wp(t,n,r,i))};function T(e){C.flush(),a===`unified`?Iy(`unified`,e,x):(Iy(`deletions`,e,x),Iy(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),wv({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Ny(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Ly(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Ly(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Fy({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Ny(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Py(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=Ly(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Ly(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Fy({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Py(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,ee=(s?.noEOFCR??!1)||E,O=(o?.noEOFCR??!1)||D;if(O||ee){if(a===`split`&&C.flush(),ee){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(iv(e)),x.pushToGutter(`unified`,Tp(e,`metadata`,1))):(x.deletionsContentAST.push(iv(e)),x.pushToGutter(`deletions`,Tp(e,`metadata`,1)),O||(x.pushToGutter(`additions`,Tp(void 0,`buffer`,1)),x.additionsContentAST.push(rv(1))))}if(O){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(iv(e)),x.pushToGutter(`unified`,Tp(e,`metadata`,1))):(x.additionsContentAST.push(iv(e)),x.pushToGutter(`additions`,Tp(e,`metadata`,1)),ee||(x.pushToGutter(`deletions`,Tp(void 0,`buffer`,1)),x.deletionsContentAST.push(rv(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(cv(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,ee=!f&&e.type!==`deleted`,O=!f&&e.type!==`new`,te=x.rowCount>0||D;h=ee&&te?h:void 0,g=O&&te?g:void 0,_=f&&te?_:void 0;let ne=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&te?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:O&&te?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:ee&&te?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:ne,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=Cp(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,mh(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Ps(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Ps(t==null?e:q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!fh(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(dh(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(dh(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Fy({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Fy({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return lm({fileOrDiff:e,mode:t,stickyHeader:n})}},jy=new Intl.PluralRules(`en-US`);function My(e){return`${e} unmodified line${jy.select(e)===`one`?``:`s`}`}function Ny(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Py(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Fy({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,Tp(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,Tp(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,Tp(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Iy(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,ov({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(ov({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,ov({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(ov({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=sv(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?My(n):`More unchanged context may be available`;c.pushToGutter(e,ov({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(ov({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Ly(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function Ry(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function zy(e,t,n,r){let i=Ry(e),a=Ry(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=By(e,r.getLineText(e));return l}function By(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Vy(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function Hy(e){if(e.lang!=null)return[e.lang];let t=_m(e.prevName??e.name),n=_m(e.name);return t===n?[n]:[t,n]}function Uy(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Wy(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Gy(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Ky(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function qy(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Jy({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function Yy(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:qh(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Xy(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Zy(e){let t={...e};return delete t.cacheKey,t}function Qy(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??_m(e.name),r=t.lang??_m(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function $y(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function eb(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&$y(n.lines,t.deletionLines)}var tb=-1,nb=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++tb}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:Zt},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Xp,this.scrollSyncManager=new tv,this.interactionManager=new kp(`diff`,Ap(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Zt}getHunksRendererOptions(e){return Yy(e)}createHunksRenderer(e){return new Ay(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=xg(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Ap(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!mp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Kh(this.editSession?.annotations,e,xm);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Gh(t,e,xm))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;dp(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=Jy(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||sb(this.pre,ab({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||cb(this.headerElement,ob({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Vh(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)e instanceof HTMLElement&&e.tagName.toLowerCase()===`code`&&(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?$_(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!Xy(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(Eg(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await qy(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.editSession?.outgoingDiff==null?t==null||this.editSession!=null?!1:(this.installEditSession(e,t.__getDocumentContents(rb(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(_g(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(rb(e)),this.editor.__getDocumentSessionState())):(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=Wh(t,xm,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Tg(t.contents),a=n!=null&&eb(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=Zy(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,ey(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??Wh(this.lineAnnotations,xm),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=Jy(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!ib(u,this.deletionFile)||!ib(d,this.additionFile)),y=e!=null&&!_g(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&om(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=$_(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(fy(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,fn);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!_g(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?Qy(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??_m(i.name),c=ap({theme:o,lang:s});c==null?rp({themes:_f(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||Sm(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return wv({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&Qy(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?yg(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(rb(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=bg(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=uy(e,this.hunksRenderer.getExpandedHunksMap(),t);return fy(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(dy(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return gv({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return _v({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=dv(o);if(e<s){let c=fv({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=hv({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=dv(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){up(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Oy(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!Ky(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!Gy(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Th(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Eh();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Uh(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Uh(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=bh;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&_g(r,n)?i:void 0)??Ps(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Xt,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,qt,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Jt,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Yt,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Dh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Ph(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Ah(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Xh({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Fh(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Ih(this.themeCSSStyle.textContent??``,Ah(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&$h()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Yh(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=lb(t[0]),a=lb(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Ps(i),r.content.innerHTML=Ps(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Bh({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Bh({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Bh({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=lb(r?.[0]),a=lb(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=lb(r?.[0]),a=lb(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=Ps(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Yh(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=lb(t[0]),i=lb(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};Sh(u,this.appliedPreAttributes)||(Hh(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function rb(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function ib(e,t){return e==null||t==null?e==null&&t==null:vg(e,t)}function ab({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function ob({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function sb(e,t,n=!1){return!n&&e==null&&t}function cb(e,t,n=!1){return e==null&&t&&!n}function lb(e){if(e!=null&&e.type===`element`)return e.children??[]}function ub({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=sg(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=fv({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=Sv({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=db(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?hv({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=Cv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Cv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=lg(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function db(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return fb(e,t)}function fb(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var pb=3e3,mb=new Map,hb=-1,gb=class extends nb{__id=`little-virtualized-file-diff:${++hb}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:mb,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=og(n)}setMetrics(e,t=!1){let n=og(e);(t||!pp(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache({includeEstimatedHeights:!1}),!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return uh(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!hp(t,e),r=n&&wb(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Tb(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=mb,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??mb);let a=this.getLatestAnnotations();if(this.placeHolder!=null||t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&fh(this.renderRange)){let t=_b(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=kb(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.startHydratedEditSession(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=og(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=sg(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return wv({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=Sv({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=Cv({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??sg(this.metrics,n)+this.cache.fileAnnotationHeight,u;return wv({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=Sv({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=Cv({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!_g(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=Eg(`clone`,e,t);if(await qy(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Eg(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await qy(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return gv({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),this.enabled&&this.fileDiff!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!_g(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??mb);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=sg(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=ub({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Eb(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=Jy(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Ob(s,this.deletionFile)||!Ob(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=$_(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!_g(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(this.getRenderedDiff()!==this.pendingRender?.diff)throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!_g(a,o),renderedDiffChanged:!_g(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Db(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Eb(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=vb(this.cache.heightDeltas),u=sg(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=xb(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Sb(i,e)*this.metrics.lineHeight+yb(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=pb}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+yb(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=fv({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?Sv({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?hv({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Cv({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:Cb({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=fv({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=hv({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Eb(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=sg(this.metrics,i),h=e.hunks.length>0?lg(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,ee=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),O=t+(ee?.top??_),te=ee?.renderedLineIndex??0,ne,k,re;if(wv({diff:e,diffStyle:l,startingLine:ee?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?Sv({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;O+=y;let b=te%s===0,x=Math.floor(te/s);if(b&&(E[x]=O-(t+_+y),re!=null)){if(re<=0)return!0;re--}let S=this.getLineHeight(l===`split`?m:h,g);if(O>n-S&&O<r&&(ne??=x),k==null&&O+S>D&&(k=x),re==null&&O>=r&&b&&(re=T),te++,O+=S,c>0||v&&d){let e=Cv({type:u,metrics:this.metrics});e!=null&&(O<r&&O+e.totalHeight>n&&(ne??=x),k==null&&O+e.totalHeight>D&&(k=x),O+=e.totalHeight)}return!1}}),ne==null){if(x)ne=0,k=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}k??=ne;let ie=Math.round(k-w/2),ae=Math.max(0,Math.ceil(p/s)-w),oe=Math.max(0,Math.min(ie,ae)),se=oe*s,ce=ie<0?C+ie*s:C,le=E[oe]??0,ue=se===0?0:g+le,de=oe+ce/s,fe=de<E.length?v-E[de]:v-(O-t-_);return{startingLine:se,totalLines:ce,bufferBefore:ue,bufferAfter:Math.max(0,fe)}}};function _b(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===lh&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function vb(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function yb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=bb(e,n);return(t[bb(e,r)]??0)-(t[i]??0)}function bb(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function xb(e){return Math.ceil(e/pb)*pb}function Sb(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Cb({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function wb(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Tb(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Eb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Db(e){return typeof e==`function`?`custom`:e??`line-info`}function Ob(e,t){return e==null||t==null?e==null&&t==null:vg(e,t)}function kb(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Ab(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:jb(e.items,t.items)}function jb(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function Mb(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(tn,``),t.before(r)):(r.setAttribute(nn,``),t.after(r)),n?.observe(r),r}function Nb(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Pb=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Fb=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Ib=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Lb=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Rb=Symbol(`CodeView.itemOptionsState`);function zb(e,t){Object.defineProperty(e,Rb,{configurable:!1,enumerable:!1,value:t})}function Bb(e){return e[Rb]}function Vb(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Hb=120,Ub=1,Wb=`--diffs-overflow-override`,Gb=12e6,Kb=1e6,qb=2e6,Jb=1e7,Yb=11e6;function Xb(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Zb=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),Qb=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=sn;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;constructor(e={theme:Zt},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??cn}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??sn.hunkLineCount,lineHeight:e?.lineHeight??sn.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??sn.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??sn.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??ln}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return zt&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<Ub||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Zb&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Wb,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Hb)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Wb,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??Mb(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){dp(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let e=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),{record:e,instance:t?.instance}});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear();let t=!1,n;for(let{record:r,instance:i}of e)try{r.editor.cleanUp(`discard`),i?.cleanUp()}catch(e){t||(t=!0,n=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),t)throw n}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(Rt),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))rx(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return yp()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e)),this.syncItemEditors(t),this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=$b(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;ex(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!pp(r,i),o=!pp(n,this.getLayout());o&&this.syncLayout();let s=a||tx(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||nx(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),hp(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(dp(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):up(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{(e.managerState===`initialized`||e.workersFailed)&&(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??Zt;return ip()&&yf(e)?(this.clearReadySubscription(),!0):(mp(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return sp({themes:_f(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=lx(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new gb(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new hg(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&_p(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null){Xb(n);let r=Bb(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Fb)Vb(e,t,()=>this.options[t]);Vb(e,`stickyHeader`,()=>this.options.stickyHeaders),Vb(e,`collapsed`,e=>{let t=Bb(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),Vb(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Bb(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Ib)this.defineItemSharedCallback(e,`file`,t);for(let t of Lb)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Pb)Vb(e,t,()=>this.options[t]);Vb(e,`stickyHeader`,()=>this.options.stickyHeaders),Vb(e,`hunkSeparators`,()=>this.options.hunkSeparators),Vb(e,`collapsed`,e=>{let t=Bb(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),Vb(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Bb(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Ib)this.defineItemSharedCallback(e,`diff`,t);for(let t of Lb)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return zb(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return zb(t,{id:e}),t}updateItemOptionsId(e,t){let n=Bb(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){Vb(e,n,e=>{if(this.options[n]==null)return;let r=Bb(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){Vb(e,n,e=>{let r=Bb(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Yb}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Gb):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=Nb(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=Nb(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>Yb&&t<i,o=n<Kb&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(Jb,r):qb):{pagedScrollTop:Nb(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=Nb(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ix(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ix(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=vp({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),sx(this.stickyContainer,t.element,h),n.virtualizedSetup(),ox(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(sx(this.stickyContainer,t.element,h),ox(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Nb(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=Ub){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=Nb(this.clampScrollTop(e)),i=Nb(t),{scrollPageOffset:a}=this,o=Nb(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||Nb(this.getScrollTop())===Nb(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);Ab(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.height=e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function $b(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function ex(e,t){return!mp(e.theme??Zt,t.theme??Zt)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function tx(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function nx(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function rx(e){return e instanceof SVGElement||Uh(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function ix(e){let t=ax(e.start,e.side),n=ax(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function ax(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function ox(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function sx(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function cx(e){return(e.annotations?.length??0)>0}function lx(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)cx(t.item)&&i.push(t);return i.length>0?i:void 0}function ux(e){let t=[];for(let n of e){let e=pn.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function dx(e){for(let t of Array.isArray(e)?e:[e])if(!pn.has(t))return!1;return!0}async function fx(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=gf(r)??hf(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function px(e){return Af.getResolvedThemes(e)}async function mx(e){for(let t of e)Qf(t);let t=await Af.resolveThemes(e);for(let n=0;n<e.length;n++)$f(e[n],t[n]);return t}function hx(e){return e.map(e=>{let t=e.pr?String(e.pr.number):`-`,n=e.pr&&(e.pr.headRefOid||e.head)||``,r=e.localHead||e.head||``;return`${e.worktree}#${t}:${n}:L${r}`}).sort().join(`\0`)}function gx(e){return e.repos.flatMap(e=>{let t=e.localHead||``,n=e.prs.filter(e=>e.state===`OPEN`||e.state===void 0);return n.length?n.map(n=>`${e.worktree}#${n.number}:${n.headRefOid||``}:L${t}`):[`${e.worktree}#-::L${t}`]}).sort().join(`\0`)}var _x=new WeakMap;function vx(e,t){if(_x.has(e))return _x.get(e);let n=null;if(e.patch)try{n=e_(e.patch,`${t}#${yx(e.patch)}`)[0]?.files[0]??null}catch{n=null}return _x.set(e,n),n}function yx(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${(t>>>0).toString(36)}${e.length.toString(36)}`}var bx=new WeakMap;function xx(e,t){let n=bx.get(e);if(!n){n={additions:new Map,deletions:new Map};for(let t of e.hunks){let r=t.additionStart,i=t.deletionStart,a=t.additionLineIndex,o=t.deletionLineIndex;for(let s of t.hunkContent)if(s.type===`context`)for(let t=0;t<s.lines;t++)n.additions.set(r++,e.additionLines[a++]??``),n.deletions.set(i++,e.deletionLines[o++]??``);else{for(let t=0;t<s.deletions;t++)n.deletions.set(i++,e.deletionLines[o++]??``);for(let t=0;t<s.additions;t++)n.additions.set(r++,e.additionLines[a++]??``)}}bx.set(e,n)}return n[t]}function Sx(e,t,n){let r=xx(e,t);if(!r.size)return!0;let i=n.split(`
1528
- `),a=e=>e.replace(/\r?\n$/,``).replace(/\r$/,``);for(let[e,t]of r){let n=i[e-1];if(n===void 0||a(n)!==a(t))return!1}return!0}var Cx=3;function wx(e,t,n,r){let i=xx(e,t),a=t===`deletions`?`-`:`+`,o=[];for(let e=Math.max(1,n-Cx);e<=r+Cx;e++){let t=i.get(e);if(t==null)continue;let s=e>=n&&e<=r?a:` `;o.push(`${s}${String(e).padStart(4)} | ${t}`)}return o.join(`
1529
- `)}var Tx=r(D(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}))(),1),Ex=Symbol(`IGNORE_RESPONSE`),Dx=1e4,Ox=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},kx=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},Ax=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=Zt,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new Tx.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new Tx.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??Zt,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||nv(a,this.renderOptions))return;let o=_f(e),c=[];if(mp(a.theme,this.renderOptions.theme)||(c=im(o)?px(o):await mx(o)),!s())return;if(this.highlighter!=null)jf(c,this.highlighter);else{let e=await rp({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof Ox||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);Nx(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=_f(this.renderOptions.theme),i=[];if(i=im(r)?px(r):await mx(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=dx(e)?ux(e):await fx(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([rp({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof Ox||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,Fx(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=vm(),i=r>0?ym():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??Dx,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(Fx(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=Mx(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);hh(t)||n!=null&&am(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||hh(e)||t!=null&&am(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return ah(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Oy(t)||n!=null&&nv(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||Oy(e)||t!=null&&nv(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:Mv(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new Ox;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new Ox;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):Nx(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(e=>!_n(e));r.length>0&&rp({themes:_f(this.renderOptions.theme),langs:[`text`,...r],preferredHighlighter:this.preferredHighlighter}).catch(e=>{console.error(e)});let i=n.filter(t=>!e.langs.has(t));if(i.length>0&&(dx(i)?t.request.resolvedLanguages=ux(i):t.request.resolvedLanguages=await fx(i)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,Fx(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw Ex;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(Nx(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(Nx(n))for(let{name:t}of n.request.resolvedLanguages??[])e.langs.add(t);switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!am(i,this.getFileRenderOptions()))throw Ex;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!nv(i,this.getDiffRenderOptions()))throw Ex;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==Ex&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,Nx(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(Nx(t)&&(this.rejectRenderTaskCallbacks(t,new kx),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){jx(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),Nx(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,Fx(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=vm();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=ym())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of Px(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new kx),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new kx),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))Nx(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of Px(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of Px(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of Px(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of Px(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&vg(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&_g(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())Nx(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function jx(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function Mx(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??_m(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??_m(e.request.diff.name)),t.add(e.request.diff.lang??_m(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function Nx(e){return e?.type===`file`||e?.type===`diff`}function Px(e){return e.instances}function Fx(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var Ix;function Lx({poolOptions:e,highlighterOptions:t}){return Ix??=new Ax(e,t),Ix}var Rx=`/assets/worker-BK3lyuKh.js`,zx;function Bx(){return zx??=Lx({poolOptions:{workerFactory:()=>new Worker(Rx,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2)},highlighterOptions:{theme:{dark:`pierre-dark`,light:`pierre-light`}}})}function Vx(e){let t=[],n=[];for(let r of e.trim().split(/\s+/).filter(Boolean)){let e=r.startsWith(`!`),i=e?r.slice(1):r;i&&(e?n:t).push(Hx(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function Hx(e){if(!/[*?]/.test(e))return t=>Ne(e,t);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(t+=`.*`,n++):t+=`[^/]*`:t+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{return t=>Ne(e,t)}}function Ux(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`[data-diff-main]`);if(i){let t=i.getBoundingClientRect(),r=0;if(n.y>=t.bottom-110?r=Math.max(4,Math.min(20,(n.y-(t.bottom-110))/3)):n.y<=t.top+110&&(r=-Math.max(4,Math.min(20,(t.top+110-n.y)/3))),r){i.scrollTop+=r;let a=e().getBoundingClientRect(),o=Math.max(t.top+12,a.top+48),s=Math.min(t.bottom-12,a.bottom-48),c=Math.max(o,Math.min(n.y,s));document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:n.x,clientY:c,pointerId:n.pointerId,pointerType:`touch`,bubbles:!0,composed:!0}))}}requestAnimationFrame(r)};e().addEventListener(`pointerdown`,e=>{e.pointerType!==`mouse`&&e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute?.(`data-column-number`))&&(n={pointerId:e.pointerId,x:e.clientX,y:e.clientY},requestAnimationFrame(r))},{capture:!0,signal:t}),document.addEventListener(`pointermove`,e=>{n&&e.pointerId===n.pointerId&&e.isTrusted&&(n.x=e.clientX,n.y=e.clientY)},{capture:!0,passive:!0,signal:t});for(let e of[`pointerup`,`pointercancel`])document.addEventListener(e,e=>{n&&e.pointerId===n.pointerId&&(n=null)},{capture:!0,signal:t})}var Wx={apng:`image/apng`,avif:`image/avif`,bmp:`image/bmp`,gif:`image/gif`,ico:`image/x-icon`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`,pdf:`application/pdf`};function Gx(e){let t=e.lastIndexOf(`.`),n=Wx[t<0?``:e.slice(t+1).toLowerCase()];return n?{kind:n===`application/pdf`?`pdf`:`image`,type:n}:null}function Kx(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_iB`;for(let n of e){let e=document.createElement(`option`);e.value=n.id,e.textContent=n.title||n.agent,t.append(e)}return t}var qx=(e,t)=>e?.value||t[0]?.id||null;function Jx(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function Yx(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function Xx(e,t,n,r){if(!t){e.className=`_q ${r?T:``} _r`,e.textContent=`Send`;let t=n[0];return t&&(e.title=`Send to ${t.title||t.agent}`),e}let i=document.createElement(`span`);return i.className=`_iz ${r?`_il`:``}`,e.className=`_r _iA`,e.textContent=`Send to`,i.append(e,t),i}function Zx(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function Qx(e,t,n){let r=document.createElement(`div`);r.className=`_ih`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_ik`;let o=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_ii`,r.textContent=e.text;let o=Yx(`Remove`,`_q ${T}`);o.onclick=()=>n.onDelete(e.id);let c=Yx(`Edit`,`_q ${T}`);c.hidden=!n.onEdit,c.onclick=()=>s();let l=t.sessions(),u=l.length>0&&!!n.onSend,d=Yx(`Send`,``);d.dataset.role=`send`,d.hidden=!u;let f=u?Kx(l):null,p=f?`Send to`:`Send`;if(d.onclick=()=>{(async()=>{let t=qx(f,l);if(t&&!d.disabled){Jx([o,c,d],!0,p);try{await n.onSend?.(e.id,t)}finally{Jx([o,c,d],!1,p)}}})()},a.append(c,o),u&&a.append(Xx(d,f,l,!0)),n.drifted){let e=document.createElement(`span`);e.className=`_N ${ue.warn} _im`,e.textContent=`changed since`,e.title=`The file changed here after this comment was written; the agent gets the lines as they were.`,a.append(e)}i.append(r)},s=()=>{i.replaceChildren(),a.replaceChildren();let t=document.createElement(`textarea`);t.value=e.text,t.rows=3,t.className=`_Y _ij`;let r=Yx(`Save`,`_q _r`),s=Yx(`Cancel`,`_q`),c=()=>{let i=t.value.trim();if(!i||i===e.text){o();return}(async()=>{Jx([r,s],!0);try{await n.onEdit?.(e.id,i),e.text=i,o()}catch{Jx([r,s],!1)}})()};r.onclick=c,s.onclick=()=>o(),Zx(t,c,o),a.append(r,s),i.append(t),setTimeout(()=>{t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length)},0)};return o(),r.append(i,a),r}function $x(e,t){let n=document.createElement(`div`);n.className=`_ih`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_Y _ij`;let i=Yx(`Add`,`_q`),a=Yx(`Send`,``);a.dataset.role=`send`;let o=Yx(`Cancel`,`_q`),s=e.sessions(),c=s.length>0&&!!t.onSend;a.hidden=!c;let l=c?Kx(s):null,u=c?Xx(a,l,s,!1):a,d=a.textContent,f=()=>{r.value.trim()&&t.onSave(r.value)},p=()=>{(async()=>{let e=r.value.trim(),n=qx(l,s);if(e&&n&&!a.disabled){Jx([i,a,o],!0,d);try{await t.onSend?.(e,n)}finally{Jx([i,a,o],!1,d)}}})()};i.onclick=f,a.onclick=p,o.onclick=()=>t.onCancel(),Zx(r,c?p:f,()=>t.onCancel());let m=document.createElement(`div`);m.className=`_ik`,m.append(i),c&&m.append(u),m.append(o),n.append(r,m),r.addEventListener(`focus`,()=>{let t=window.visualViewport;if(!t)return;let i=()=>e.reveal(n,!0);t.addEventListener(`resize`,i),r.addEventListener(`blur`,()=>t.removeEventListener(`resize`,i),{once:!0})});let h=(e=0)=>{if(!r.isConnected||!r.getClientRects().length){e<120&&requestAnimationFrame(()=>h(e+1));return}r.focus({preventScroll:!0})};return setTimeout(h,0),n}function eS(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function tS(e,t,n){let r=eS(`div`,`_hU`),i=eS(`span`,`_W`);i.textContent=n;let a=eS(`a`,`_K`);return a.href=e,a.target=`_blank`,a.rel=`noreferrer`,a.textContent=`Open in a new tab`,r.append(i,a),r}function nS(e,t,n){let r=eS(`div`,`_hR`),i=eS(`span`,`_W`);i.textContent=n;let a=eS(`img`,`_hS`);return a.alt=`${n}: ${t}`,a.loading=`lazy`,a.decoding=`async`,a.onload=()=>{i.textContent=`${n} · ${a.naturalWidth} × ${a.naturalHeight}`},a.onerror=()=>{r.replaceChildren(tS(e,t,`This browser can't display this image.`))},a.src=e,r.append(a),{frame:r,meta:i}}function rS(e,t,n){let r=eS(`span`,`_W`);if(r.textContent=n,!navigator.pdfViewerEnabled){let n=eS(`div`,`_hR`);return n.append(tS(e,t,`This browser can't display PDFs inline.`)),{frame:n,meta:r}}let i=eS(`iframe`,`_hT`);return i.src=e,i.title=`${n}: ${t}`,i.loading=`lazy`,{frame:i,meta:r}}function iS(e){let t=eS(`div`,`_hP`);for(let n of e.sides){let r=eS(`div`,`_hQ`),{frame:i,meta:a}=e.kind===`pdf`?rS(n.src,e.name,n.label):nS(n.src,e.name,n.label);r.append(a,i),t.append(r)}return t}function aS(e,t){let n=new Map;for(let t of e)n.set(t.worktree,[...n.get(t.worktree)||[],t]);let r=[`Review feedback:`],i=0;for(let[e,a]of n){let n=(t||[]).find(t=>t.worktree===e);r.push(``),r.push(sS(e,n,a));for(let e of a){i++;let t=e.line_end===0?`whole file`:oS(e);r.push(``),r.push(`${i}. **${e.path}** (${t})`);let n=e.snippet;if(n!=null){let e=lS(n);r.push(``),r.push(uS(`${e}diff\n${n}\n${e}`))}r.push(``),r.push(uS(e.text))}}return r.join(`
1530
- `)}function oS(e){let t=e.side===`deletions`?`Old`:`New`;return e.line_start===e.line_end?`${t} line ${e.line_start}`:`${t} lines ${e.line_start}-${e.line_end}`}function sS(e,t,n){if(t?.head){let n=cS(t.head),r=t.baseSha?cS(t.baseSha):``,i=t.pr?.headRefName||t.branch||`HEAD`;return`${e}/${t.pr?` #${t.pr.number}`:``}: \`${i}\` ${n}${t.base?` vs \`${t.base}\` ${r}`:``}`}let r=[...new Set(n.map(e=>e.head).filter(Boolean))];return r.length?`${e}/: ${r.map(e=>cS(e)).join(`, `)}`:`${e}/`}function cS(e,t=12){return e.slice(0,t)}function lS(e){let t=3,n=/`+/g,r;for(;r=n.exec(e);)t=Math.max(t,r[0].length+1);return"`".repeat(t)}function uS(e){return e.split(`
1527
+ `)}function $v(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>ey(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,ty(e)}function ey(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function ty(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function ny(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Cg(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,ty(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=wg(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-wg(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var ry=new WeakMap;function iy(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function ay(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function oy(e,t){let n=e.hunks,r=e.additionLines,i=iy(r),a=i===r?e:{...e,additionLines:i},o=gy(n,hy(a,t),e.deletionLines.length),s=yy(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,ky(e),Kv(e,r),Sy(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function sy(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<Ty(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Ty(r);if(i==null||t<i||o!=null&&o!==s)return oy(e,n);o=s}if(o!=null){if(cy(e,i,o,r,n)){e.editSessionDirty=!0;return}return oy(e,n)}}function cy(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=ly(e),o=e.hunks[n];if(o.hunkContent.some(uy))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function ly(e){let t=ry.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return ry.set(e,{lines:e.deletionLines,set:n}),n}function uy(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function dy(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function fy(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=mv({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Ey(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=_v({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=Ey(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function py(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=Ey(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,Ey(i)+i.deletionCount,e.deletionLines.length),n}function my(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Rv(e,t):Wv(e,t)),!0)}function hy(e,t){if(ay(e.deletionLines,e.additionLines)==null)return[];let n=tv({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=ey(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function gy(e,t,n){let r=e.map((e,t)=>{let n=Ey(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&_y(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=vy(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function _y(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function vy(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function yy(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);xy(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);xy(s,c,i,r),r+=c,i+=c,n.push(by(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function by(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:Dy(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Oy(t.additionStart,r),deletionStart:Dy(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Oy(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Dy(t.deletionStart,i)},${i} +${Dy(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return ty(s),s}function xy(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Sy(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(Ey(r)!==Ey(i)||r.deletionCount!==i.deletionCount||Ty(r)!==Ty(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Cy(r,i))return!0}return!1}function Cy(e,t){let n=wy(e),r=wy(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*wy(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function Ty(e){return Cg(e.additionStart,e.additionCount)}function Ey(e){return Cg(e.deletionStart,e.deletionCount)}function Dy(e,t){return t===0?e:e+1}function Oy(e,t){return t===0?e-1:e}function ky(e){ny(e);for(let t=0;t<e.hunks.length;t++)Qv(e,t)}function Ay(e){let t=e.lang??ym(e.name),n=e.lang??(e.prevName==null?`text`:ym(e.prevName));return t===`text`&&n===`text`}var jy=-1,My=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++jy}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:$t},t=Cm,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=xf(e.theme??$t)?sp():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,!e.isPartial&&e.additionLines.length===0){Object.assign(e,Uv(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&yg(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!iv(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!yg(t.diff,e)||Ay(e)||Gy(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!yg(n,e)||!yg(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);iv(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??fn}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=Lg(u);s==null&&i&&(a.additionLines[t]=hh(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,Uv(a,this.options.parseDiffOptions)),u=!0;else if(Vv(a,a.additionLines))this.applyRecomputePreservingSessionType(a,Hv(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=sy(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,qv(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=dy(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=Uy(e),i.code.additionLines=Vy(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Uv(r,this.options.parseDiffOptions)),i.code.additionLines[0]=Hy(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,Wv(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(Vv(e,n)){this.applyRecomputePreservingSessionType(e,Hv(e,n,t));return}this.applyExpansionRemap(oy(e,t))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>lm(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=$t,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=sn,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await ap(Sm(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Gy(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!iv(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!Ay(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLangs=Wy(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??$t}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!yg(e,n.diff)||!iv(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(yg(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||Ay(e)||Gy(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||yg(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&xf(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&xf(t.theme)}renderDiff(e=this.diff,t=pn){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||Ay(e)||Gy(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!yg(e,this.renderCache.diff),d=!cm(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&wm(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,wm(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=Wy(e),this.highlighter??=sp();let t=this.highlighter!=null&&xf(i.theme),n=this.highlighter!=null&&yn(this.computedLangs),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=pn){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return mm({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Gy(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:Wy(e);let n=this.highlighter!=null&&xf(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&yn(this.computedLangs);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=Pv(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(Ev({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Hy(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&yg(i,e)&&iv(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&iv(a.options,n)&&yg(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&iv(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&yg(n.diff,e)&&iv(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&yg(e,n.diff)&&iv(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=Ky(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:Tp(),deletionsGutterAST:Tp(),additionsGutterAST:Tp(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=gv({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,Dp(void 0,`buffer`,this.size)),h?.push(av(this.size))):(x.pushToGutter(`deletions`,Dp(void 0,`buffer`,this.size)),g?.push(av(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,Ep(t,n,r,i))};function T(e){C.flush(),a===`unified`?Ry(`unified`,e,x):(Ry(`deletions`,e,x),Ry(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Ev({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Fy(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=zy(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=zy(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Ly({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Fy(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Iy(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=zy(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=zy(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Ly({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Iy(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,ee=(s?.noEOFCR??!1)||E,O=(o?.noEOFCR??!1)||D;if(O||ee){if(a===`split`&&C.flush(),ee){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(ov(e)),x.pushToGutter(`unified`,Dp(e,`metadata`,1))):(x.deletionsContentAST.push(ov(e)),x.pushToGutter(`deletions`,Dp(e,`metadata`,1)),O||(x.pushToGutter(`additions`,Dp(void 0,`buffer`,1)),x.additionsContentAST.push(av(1))))}if(O){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(ov(e)),x.pushToGutter(`unified`,Dp(e,`metadata`,1))):(x.additionsContentAST.push(ov(e)),x.pushToGutter(`additions`,Dp(e,`metadata`,1)),ee||(x.pushToGutter(`deletions`,Dp(void 0,`buffer`,1)),x.deletionsContentAST.push(av(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(uv(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,ee=!f&&e.type!==`deleted`,O=!f&&e.type!==`new`,te=x.rowCount>0||D;h=ee&&te?h:void 0,g=O&&te?g:void 0,_=f&&te?_:void 0;let ne=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&te?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:O&&te?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:ee&&te?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:ne,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=Tp(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,gh(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Is(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Is(t==null?e:q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!mh(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(ph(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(ph(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Ly({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Ly({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return dm({fileOrDiff:e,mode:t,stickyHeader:n})}},Ny=new Intl.PluralRules(`en-US`);function Py(e){return`${e} unmodified line${Ny.select(e)===`one`?``:`s`}`}function Fy(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Iy(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Ly({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,Dp(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,Dp(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,Dp(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Ry(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,cv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(cv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,cv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(cv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=lv(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Py(n):`More unchanged context may be available`;c.pushToGutter(e,cv({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(cv({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function zy(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function By(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Vy(e,t,n,r){let i=By(e),a=By(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=Hy(e,r.getLineText(e));return l}function Hy(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Uy(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function Wy(e){if(e.lang!=null)return[e.lang];let t=ym(e.prevName??e.name),n=ym(e.name);return t===n?[n]:[t,n]}function Gy(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Ky(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function qy(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Jy(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Yy(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Xy({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function Zy(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Yh(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Qy(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function $y(e){let t={...e};return delete t.cacheKey,t}function eb(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??ym(e.name),r=t.lang??ym(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function tb(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function nb(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&tb(n.lines,t.deletionLines)}var rb=-1,ib=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++rb}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:$t},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Qp,this.scrollSyncManager=new rv,this.interactionManager=new jp(`diff`,Mp(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??$t}getHunksRendererOptions(e){return Zy(e)}createHunksRenderer(e){return new My(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=Cg(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Mp(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!gp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Jh(this.editSession?.annotations,e,Cm);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,qh(t,e,Cm))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;pp(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=Xy(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||lb(this.pre,sb({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||ub(this.headerElement,cb({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Uh(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)e instanceof HTMLElement&&e.tagName.toLowerCase()===`code`&&(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?tv(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!Qy(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(Og(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await Yy(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.editSession?.outgoingDiff==null?t==null||this.editSession!=null?!1:(this.installEditSession(e,t.__getDocumentContents(ab(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(yg(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(ab(e)),this.editor.__getDocumentSessionState())):(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=Kh(t,Cm,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Dg(t.contents),a=n!=null&&nb(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=$y(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,ny(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??Kh(this.lineAnnotations,Cm),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=Xy(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!ob(u,this.deletionFile)||!ob(d,this.additionFile)),y=e!=null&&!yg(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&cm(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=tv(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(my(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,mn);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!yg(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?eb(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??ym(i.name),c=sp({theme:o,lang:s});c==null?ap({themes:yf(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||wm(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Ev({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&eb(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?xg(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(ab(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=Sg(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=fy(e,this.hunksRenderer.getExpandedHunksMap(),t);return my(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(py(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return vv({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return yv({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=pv(o);if(e<s){let c=mv({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=_v({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=pv(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){fp(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Ay(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!Jy(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!qy(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Dh(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Oh();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Gh(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Gh(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Sh;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&yg(r,n)?i:void 0)??Is(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Qt,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Yt,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Xt,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Zt,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=kh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Ih(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Mh(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Qh({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Lh(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Rh(this.themeCSSStyle.textContent??``,Mh(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&tg()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Zh(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=db(t[0]),a=db(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Is(i),r.content.innerHTML=Is(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Hh({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Hh({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Hh({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=db(r?.[0]),a=db(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=db(r?.[0]),a=db(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=Is(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Zh(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=db(t[0]),i=db(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};wh(u,this.appliedPreAttributes)||(Wh(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function ab(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function ob(e,t){return e==null||t==null?e==null&&t==null:bg(e,t)}function sb({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function cb({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function lb(e,t,n=!1){return!n&&e==null&&t}function ub(e,t,n=!1){return e==null&&t&&!n}function db(e){if(e!=null&&e.type===`element`)return e.children??[]}function fb({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=lg(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=mv({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=wv({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=pb(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?_v({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=Tv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Tv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=dg(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function pb(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return mb(e,t)}function mb(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var hb=3e3,gb=new Map,_b=-1,vb=class extends ib{__id=`little-virtualized-file-diff:${++_b}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:gb,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=cg(n)}setMetrics(e,t=!1){let n=cg(e);(t||!hp(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache({includeEstimatedHeights:!1}),!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return fh(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!_p(t,e),r=n&&Eb(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Db(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=gb,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??gb);let a=this.getLatestAnnotations();if(this.placeHolder!=null||t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&mh(this.renderRange)){let t=yb(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=jb(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.startHydratedEditSession(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=cg(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=lg(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return Ev({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=wv({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=Tv({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??lg(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Ev({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=wv({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=Tv({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!yg(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=Og(`clone`,e,t);if(await Yy(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Og(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await Yy(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return vv({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),this.enabled&&this.fileDiff!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!yg(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??gb);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=lg(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=fb({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Ob(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=Xy(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Ab(s,this.deletionFile)||!Ab(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=tv(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!yg(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(this.getRenderedDiff()!==this.pendingRender?.diff)throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!yg(a,o),renderedDiffChanged:!yg(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return kb(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Ob(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=bb(this.cache.heightDeltas),u=lg(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=Cb(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+wb(i,e)*this.metrics.lineHeight+xb(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=hb}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+xb(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=mv({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?wv({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?_v({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Tv({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:Tb({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=mv({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=_v({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Ob(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=lg(this.metrics,i),h=e.hunks.length>0?dg(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,ee=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),O=t+(ee?.top??_),te=ee?.renderedLineIndex??0,ne,k,re;if(Ev({diff:e,diffStyle:l,startingLine:ee?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?wv({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;O+=y;let b=te%s===0,x=Math.floor(te/s);if(b&&(E[x]=O-(t+_+y),re!=null)){if(re<=0)return!0;re--}let S=this.getLineHeight(l===`split`?m:h,g);if(O>n-S&&O<r&&(ne??=x),k==null&&O+S>D&&(k=x),re==null&&O>=r&&b&&(re=T),te++,O+=S,c>0||v&&d){let e=Tv({type:u,metrics:this.metrics});e!=null&&(O<r&&O+e.totalHeight>n&&(ne??=x),k==null&&O+e.totalHeight>D&&(k=x),O+=e.totalHeight)}return!1}}),ne==null){if(x)ne=0,k=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}k??=ne;let ie=Math.round(k-w/2),ae=Math.max(0,Math.ceil(p/s)-w),oe=Math.max(0,Math.min(ie,ae)),se=oe*s,ce=ie<0?C+ie*s:C,le=E[oe]??0,ue=se===0?0:g+le,de=oe+ce/s,fe=de<E.length?v-E[de]:v-(O-t-_);return{startingLine:se,totalLines:ce,bufferBefore:ue,bufferAfter:Math.max(0,fe)}}};function yb(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===dh&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function bb(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function xb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Sb(e,n);return(t[Sb(e,r)]??0)-(t[i]??0)}function Sb(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Cb(e){return Math.ceil(e/hb)*hb}function wb(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Tb({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Eb(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Db(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Ob(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function kb(e){return typeof e==`function`?`custom`:e??`line-info`}function Ab(e,t){return e==null||t==null?e==null&&t==null:bg(e,t)}function jb(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Mb(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:Nb(e.items,t.items)}function Nb(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function Pb(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(rn,``),t.before(r)):(r.setAttribute(an,``),t.after(r)),n?.observe(r),r}function Fb(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Ib=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Lb=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Rb=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],zb=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Bb=Symbol(`CodeView.itemOptionsState`);function Vb(e,t){Object.defineProperty(e,Bb,{configurable:!1,enumerable:!1,value:t})}function Hb(e){return e[Bb]}function Ub(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Wb=120,Gb=1,Kb=`--diffs-overflow-override`,qb=12e6,Jb=1e6,Yb=2e6,Xb=1e7,Zb=11e6;function Qb(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var $b=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),ex=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=ln;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;constructor(e={theme:$t},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??un}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??ln.hunkLineCount,lineHeight:e?.lineHeight??ln.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??ln.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??ln.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??dn}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Vt&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<Gb||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),$b&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Kb,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Wb)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Kb,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??Pb(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){pp(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let e=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),{record:e,instance:t?.instance}});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear();let t=!1,n;for(let{record:r,instance:i}of e)try{r.editor.cleanUp(`discard`),i?.cleanUp()}catch(e){t||(t=!0,n=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),t)throw n}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(Bt),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))ax(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return xp()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e)),this.syncItemEditors(t),this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=tx(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;nx(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!hp(r,i),o=!hp(n,this.getLayout());o&&this.syncLayout();let s=a||rx(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||ix(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),_p(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(pp(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):fp(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{(e.managerState===`initialized`||e.workersFailed)&&(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??$t;return op()&&xf(e)?(this.clearReadySubscription(),!0):(gp(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return lp({themes:yf(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=dx(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new vb(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new _g(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&yp(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null){Qb(n);let r=Hb(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Lb)Ub(e,t,()=>this.options[t]);Ub(e,`stickyHeader`,()=>this.options.stickyHeaders),Ub(e,`collapsed`,e=>{let t=Hb(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),Ub(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Hb(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Rb)this.defineItemSharedCallback(e,`file`,t);for(let t of zb)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Ib)Ub(e,t,()=>this.options[t]);Ub(e,`stickyHeader`,()=>this.options.stickyHeaders),Ub(e,`hunkSeparators`,()=>this.options.hunkSeparators),Ub(e,`collapsed`,e=>{let t=Hb(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),Ub(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Hb(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Rb)this.defineItemSharedCallback(e,`diff`,t);for(let t of zb)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return Vb(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return Vb(t,{id:e}),t}updateItemOptionsId(e,t){let n=Hb(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){Ub(e,n,e=>{if(this.options[n]==null)return;let r=Hb(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){Ub(e,n,e=>{let r=Hb(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Zb}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),qb):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=Fb(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=Fb(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>Zb&&t<i,o=n<Jb&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(Xb,r):Yb):{pagedScrollTop:Fb(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=Fb(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ox(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ox(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=bp({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),lx(this.stickyContainer,t.element,h),n.virtualizedSetup(),cx(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(lx(this.stickyContainer,t.element,h),cx(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Fb(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=Gb){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=Fb(this.clampScrollTop(e)),i=Fb(t),{scrollPageOffset:a}=this,o=Fb(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||Fb(this.getScrollTop())===Fb(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);Mb(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.height=e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function tx(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function nx(e,t){return!gp(e.theme??$t,t.theme??$t)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function rx(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function ix(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function ax(e){return e instanceof SVGElement||Gh(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function ox(e){let t=sx(e.start,e.side),n=sx(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function sx(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function cx(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function lx(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function ux(e){return(e.annotations?.length??0)>0}function dx(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)ux(t.item)&&i.push(t);return i.length>0?i:void 0}function fx(e){let t=[];for(let n of e){let e=hn.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function px(e){for(let t of Array.isArray(e)?e:[e])if(!hn.has(t))return!1;return!0}async function mx(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=vf(r)??_f(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function hx(e){return Mf.getResolvedThemes(e)}async function gx(e){for(let t of e)ep(t);let t=await Mf.resolveThemes(e);for(let n=0;n<e.length;n++)tp(e[n],t[n]);return t}function _x(e){return e.map(e=>{let t=e.pr?String(e.pr.number):`-`,n=e.pr&&(e.pr.headRefOid||e.head)||``,r=e.localHead||e.head||``;return`${e.worktree}#${t}:${n}:L${r}`}).sort().join(`\0`)}function vx(e){return e.repos.flatMap(e=>{let t=e.localHead||``,n=e.prs.filter(e=>e.state===`OPEN`||e.state===void 0);return n.length?n.map(n=>`${e.worktree}#${n.number}:${n.headRefOid||``}:L${t}`):[`${e.worktree}#-::L${t}`]}).sort().join(`\0`)}var yx=new WeakMap;function bx(e,t){if(yx.has(e))return yx.get(e);let n=null;if(e.patch)try{n=n_(e.patch,`${t}#${xx(e.patch)}`)[0]?.files[0]??null}catch{n=null}return yx.set(e,n),n}function xx(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${(t>>>0).toString(36)}${e.length.toString(36)}`}var Sx=new WeakMap;function Cx(e,t){let n=Sx.get(e);if(!n){n={additions:new Map,deletions:new Map};for(let t of e.hunks){let r=t.additionStart,i=t.deletionStart,a=t.additionLineIndex,o=t.deletionLineIndex;for(let s of t.hunkContent)if(s.type===`context`)for(let t=0;t<s.lines;t++)n.additions.set(r++,e.additionLines[a++]??``),n.deletions.set(i++,e.deletionLines[o++]??``);else{for(let t=0;t<s.deletions;t++)n.deletions.set(i++,e.deletionLines[o++]??``);for(let t=0;t<s.additions;t++)n.additions.set(r++,e.additionLines[a++]??``)}}Sx.set(e,n)}return n[t]}function wx(e,t,n){let r=Cx(e,t);if(!r.size)return!0;let i=n.split(`
1528
+ `),a=e=>e.replace(/\r?\n$/,``).replace(/\r$/,``);for(let[e,t]of r){let n=i[e-1];if(n===void 0||a(n)!==a(t))return!1}return!0}var Tx=3;function Ex(e,t,n,r){let i=Cx(e,t),a=t===`deletions`?`-`:`+`,o=[];for(let e=Math.max(1,n-Tx);e<=r+Tx;e++){let t=i.get(e);if(t==null)continue;let s=e>=n&&e<=r?a:` `;o.push(`${s}${String(e).padStart(4)} | ${t}`)}return o.join(`
1529
+ `)}var Dx=C(r(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}))(),1),Ox=Symbol(`IGNORE_RESPONSE`),kx=1e4,Ax=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},jx=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},Mx=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=$t,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new Dx.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new Dx.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??$t,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||iv(a,this.renderOptions))return;let o=yf(e),c=[];if(gp(a.theme,this.renderOptions.theme)||(c=om(o)?hx(o):await gx(o)),!s())return;if(this.highlighter!=null)Nf(c,this.highlighter);else{let e=await ap({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof Ax||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);Fx(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=yf(this.renderOptions.theme),i=[];if(i=om(r)?hx(r):await gx(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=px(e)?fx(e):await mx(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([ap({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof Ax||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,Lx(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=bm(),i=r>0?xm():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??kx,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(Lx(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=Px(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);_h(t)||n!=null&&sm(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||_h(e)||t!=null&&sm(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return sh(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Ay(t)||n!=null&&iv(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||Ay(e)||t!=null&&iv(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:Pv(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new Ax;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new Ax;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):Fx(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(e=>!yn(e));r.length>0&&ap({themes:yf(this.renderOptions.theme),langs:[`text`,...r],preferredHighlighter:this.preferredHighlighter}).catch(e=>{console.error(e)});let i=n.filter(t=>!e.langs.has(t));if(i.length>0&&(px(i)?t.request.resolvedLanguages=fx(i):t.request.resolvedLanguages=await mx(i)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,Lx(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw Ox;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(Fx(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(Fx(n))for(let{name:t}of n.request.resolvedLanguages??[])e.langs.add(t);switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!sm(i,this.getFileRenderOptions()))throw Ox;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!iv(i,this.getDiffRenderOptions()))throw Ox;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==Ox&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,Fx(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(Fx(t)&&(this.rejectRenderTaskCallbacks(t,new jx),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){Nx(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),Fx(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,Lx(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=bm();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=xm())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of Ix(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new jx),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new jx),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))Fx(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of Ix(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of Ix(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of Ix(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of Ix(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&bg(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&yg(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())Fx(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function Nx(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function Px(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??ym(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??ym(e.request.diff.name)),t.add(e.request.diff.lang??ym(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function Fx(e){return e?.type===`file`||e?.type===`diff`}function Ix(e){return e.instances}function Lx(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var Rx;function zx({poolOptions:e,highlighterOptions:t}){return Rx??=new Mx(e,t),Rx}var Bx=`/assets/worker-BK3lyuKh.js`,Vx;function Hx(){return Vx??=zx({poolOptions:{workerFactory:()=>new Worker(Bx,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2)},highlighterOptions:{theme:{dark:`pierre-dark`,light:`pierre-light`}}})}function Ux(e){let t=[],n=[];for(let r of e.trim().split(/\s+/).filter(Boolean)){let e=r.startsWith(`!`),i=e?r.slice(1):r;i&&(e?n:t).push(Wx(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function Wx(e){if(!/[*?]/.test(e))return t=>Fe(e,t);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(t+=`.*`,n++):t+=`[^/]*`:t+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{return t=>Fe(e,t)}}function Gx(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`[data-diff-main]`);if(i){let t=i.getBoundingClientRect(),r=0;if(n.y>=t.bottom-110?r=Math.max(4,Math.min(20,(n.y-(t.bottom-110))/3)):n.y<=t.top+110&&(r=-Math.max(4,Math.min(20,(t.top+110-n.y)/3))),r){i.scrollTop+=r;let a=e().getBoundingClientRect(),o=Math.max(t.top+12,a.top+48),s=Math.min(t.bottom-12,a.bottom-48),c=Math.max(o,Math.min(n.y,s));document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:n.x,clientY:c,pointerId:n.pointerId,pointerType:`touch`,bubbles:!0,composed:!0}))}}requestAnimationFrame(r)};e().addEventListener(`pointerdown`,e=>{e.pointerType!==`mouse`&&e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute?.(`data-column-number`))&&(n={pointerId:e.pointerId,x:e.clientX,y:e.clientY},requestAnimationFrame(r))},{capture:!0,signal:t}),document.addEventListener(`pointermove`,e=>{n&&e.pointerId===n.pointerId&&e.isTrusted&&(n.x=e.clientX,n.y=e.clientY)},{capture:!0,passive:!0,signal:t});for(let e of[`pointerup`,`pointercancel`])document.addEventListener(e,e=>{n&&e.pointerId===n.pointerId&&(n=null)},{capture:!0,signal:t})}var Kx={apng:`image/apng`,avif:`image/avif`,bmp:`image/bmp`,gif:`image/gif`,ico:`image/x-icon`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`,pdf:`application/pdf`};function qx(e){let t=e.lastIndexOf(`.`),n=Kx[t<0?``:e.slice(t+1).toLowerCase()];return n?{kind:n===`application/pdf`?`pdf`:`image`,type:n}:null}function Jx(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_jb`;for(let n of e){let e=document.createElement(`option`);e.value=n.id,e.textContent=n.title||n.agent,t.append(e)}return t}var Yx=(e,t)=>e?.value||t[0]?.id||null;function Xx(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function Zx(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function Qx(e,t,n,r){if(!t){e.className=`_q ${r?T:``} _r`,e.textContent=`Send`;let t=n[0];return t&&(e.title=`Send to ${t.title||t.agent}`),e}let i=document.createElement(`span`);return i.className=`_i_ ${r?`_im`:``}`,e.className=`_r _ja`,e.textContent=`Send to`,i.append(e,t),i}function $x(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function eS(e,t,n){let r=document.createElement(`div`);r.className=`_ii`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_il`;let o=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_ij`,r.textContent=e.text;let o=Zx(`Remove`,`_q ${T}`);o.onclick=()=>n.onDelete(e.id);let c=Zx(`Edit`,`_q ${T}`);c.hidden=!n.onEdit,c.onclick=()=>s();let l=t.sessions(),u=l.length>0&&!!n.onSend,d=Zx(`Send`,``);d.dataset.role=`send`,d.hidden=!u;let f=u?Jx(l):null,p=f?`Send to`:`Send`;if(d.onclick=()=>{(async()=>{let t=Yx(f,l);if(t&&!d.disabled){Xx([o,c,d],!0,p);try{await n.onSend?.(e.id,t)}finally{Xx([o,c,d],!1,p)}}})()},a.append(c,o),u&&a.append(Qx(d,f,l,!0)),n.drifted){let e=document.createElement(`span`);e.className=`_N ${ue.warn} _in`,e.textContent=`changed since`,e.title=`The file changed here after this comment was written; the agent gets the lines as they were.`,a.append(e)}i.append(r)},s=()=>{i.replaceChildren(),a.replaceChildren();let t=document.createElement(`textarea`);t.value=e.text,t.rows=3,t.className=`_Y _ik`;let r=Zx(`Save`,`_q _r`),s=Zx(`Cancel`,`_q`),c=()=>{let i=t.value.trim();if(!i||i===e.text){o();return}(async()=>{Xx([r,s],!0);try{await n.onEdit?.(e.id,i),e.text=i,o()}catch{Xx([r,s],!1)}})()};r.onclick=c,s.onclick=()=>o(),$x(t,c,o),a.append(r,s),i.append(t),setTimeout(()=>{t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length)},0)};return o(),r.append(i,a),r}function tS(e,t){let n=document.createElement(`div`);n.className=`_ii`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_Y _ik`;let i=Zx(`Add`,`_q`),a=Zx(`Send`,``);a.dataset.role=`send`;let o=Zx(`Cancel`,`_q`),s=e.sessions(),c=s.length>0&&!!t.onSend;a.hidden=!c;let l=c?Jx(s):null,u=c?Qx(a,l,s,!1):a,d=a.textContent,f=()=>{r.value.trim()&&t.onSave(r.value)},p=()=>{(async()=>{let e=r.value.trim(),n=Yx(l,s);if(e&&n&&!a.disabled){Xx([i,a,o],!0,d);try{await t.onSend?.(e,n)}finally{Xx([i,a,o],!1,d)}}})()};i.onclick=f,a.onclick=p,o.onclick=()=>t.onCancel(),$x(r,c?p:f,()=>t.onCancel());let m=document.createElement(`div`);m.className=`_il`,m.append(i),c&&m.append(u),m.append(o),n.append(r,m),r.addEventListener(`focus`,()=>{let t=window.visualViewport;if(!t)return;let i=()=>e.reveal(n,!0);t.addEventListener(`resize`,i),r.addEventListener(`blur`,()=>t.removeEventListener(`resize`,i),{once:!0})});let h=(e=0)=>{if(!r.isConnected||!r.getClientRects().length){e<120&&requestAnimationFrame(()=>h(e+1));return}r.focus({preventScroll:!0})};return setTimeout(h,0),n}function nS(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function rS(e,t,n){let r=nS(`div`,`_hU`),i=nS(`span`,`_W`);i.textContent=n;let a=nS(`a`,`_K`);return a.href=e,a.target=`_blank`,a.rel=`noreferrer`,a.textContent=`Open in a new tab`,r.append(i,a),r}function iS(e,t,n){let r=nS(`div`,`_hR`),i=nS(`span`,`_W`);i.textContent=n;let a=nS(`img`,`_hS`);return a.alt=`${n}: ${t}`,a.loading=`lazy`,a.decoding=`async`,a.onload=()=>{i.textContent=`${n} · ${a.naturalWidth} × ${a.naturalHeight}`},a.onerror=()=>{r.replaceChildren(rS(e,t,`This browser can't display this image.`))},a.src=e,r.append(a),{frame:r,meta:i}}function aS(e,t,n){let r=nS(`span`,`_W`);if(r.textContent=n,!navigator.pdfViewerEnabled){let n=nS(`div`,`_hR`);return n.append(rS(e,t,`This browser can't display PDFs inline.`)),{frame:n,meta:r}}let i=nS(`iframe`,`_hT`);return i.src=e,i.title=`${n}: ${t}`,i.loading=`lazy`,{frame:i,meta:r}}function oS(e){let t=nS(`div`,`_hP`);for(let n of e.sides){let r=nS(`div`,`_hQ`),{frame:i,meta:a}=e.kind===`pdf`?aS(n.src,e.name,n.label):iS(n.src,e.name,n.label);r.append(a,i),t.append(r)}return t}function sS(e,t){let n=new Map;for(let t of e)n.set(t.worktree,[...n.get(t.worktree)||[],t]);let r=[`Review feedback:`],i=0;for(let[e,a]of n){let n=(t||[]).find(t=>t.worktree===e);r.push(``),r.push(lS(e,n,a));for(let e of a){i++;let t=e.line_end===0?`whole file`:cS(e);r.push(``),r.push(`${i}. **${e.path}** (${t})`);let n=e.snippet;if(n!=null){let e=dS(n);r.push(``),r.push(fS(`${e}diff\n${n}\n${e}`))}r.push(``),r.push(fS(e.text))}}return r.join(`
1530
+ `)}function cS(e){let t=e.side===`deletions`?`Old`:`New`;return e.line_start===e.line_end?`${t} line ${e.line_start}`:`${t} lines ${e.line_start}-${e.line_end}`}function lS(e,t,n){if(t?.head){let n=uS(t.head),r=t.baseSha?uS(t.baseSha):``,i=t.pr?.headRefName||t.branch||`HEAD`;return`${e}/${t.pr?` #${t.pr.number}`:``}: \`${i}\` ${n}${t.base?` vs \`${t.base}\` ${r}`:``}`}let r=[...new Set(n.map(e=>e.head).filter(Boolean))];return r.length?`${e}/: ${r.map(e=>uS(e)).join(`, `)}`:`${e}/`}function uS(e,t=12){return e.slice(0,t)}function dS(e){let t=3,n=/`+/g,r;for(;r=n.exec(e);)t=Math.max(t,r[0].length+1);return"`".repeat(t)}function fS(e){return e.split(`
1531
1531
  `).map(e=>e&&` ${e}`).join(`
1532
- `)}function dS(e){let t=e.replace(/^origin\//,``);return fS(t.includes(`/`)?t.slice(t.lastIndexOf(`/`)+1):t)}function fS(e){return e.replace(/-[a-z0-9]{1,6}$/i,``)||e}function pS(e,t){if(!t)return``;let n=e.replace(/^origin\//,``),r=t.replace(/^origin\//,``);return n.startsWith(`${r}-`)?n.slice(r.length+1):``}function mS(e){let t=fS(e);if(t.length<=20)return t;let n=t.split(`-`);return n.length>1?n[n.length-1]:t}function hS(e,t,n=``,r=``){let i=(e||`base`).replace(/^origin\//,``),a=(t||`HEAD`).replace(/^origin\//,``),o=(n||``).replace(/^origin\//,``),s=!!o&&(a===o||a.startsWith(`${o}-`));return{base:i,head:s?r||dS(o):mS(a),topic:s?pS(a,o):``,title:a===i?i:`${a} vs ${i}`}}function gS(e,t=``,n=``){let r=e.replace(/^origin\//,``);if(!r||r===`HEAD`)return r||`HEAD`;let i=t.replace(/^origin\//,``);if(i&&(r===i||r.startsWith(`${i}-`))){let e=n||dS(i),t=pS(r,i);return t?`${e} [${t}]`:e}return mS(r)}var _S=`search-mark`,vS=`mark.${_S}`,yS=`mark.${_S}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${_S} *,mark.${_S} *::before,mark.${_S} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${_S}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,bS={query:``,hit:null,keys:null},xS=new Map,SS=new WeakMap,CS=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function wS(e,t,n){bS.query=e,bS.hit=t,bS.keys=n?new Set(n):null;for(let[e,t]of xS)kS(e,t,!1);t&&TS(t)}function TS(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of xS)if(i===e.key&&(n=!0,OS(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>TS(e,t+1),n?32:48)})})}function ES(e,t,n){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(i.height===0&&i.width===0)return!1;if(n===`y`){let t=i.top-r.top+e.scrollTop-(r.height/2-i.height/2);return e.scrollTo({top:Math.max(0,t)}),!0}if(e.scrollWidth<=e.clientWidth+1)return!0;let a=Math.min(24,r.width/8);if(i.left>=r.left+a&&i.right<=r.right-a)return!0;let o=i.left-r.left+e.scrollLeft-(r.width/2-i.width/2),s=Math.max(0,e.scrollWidth-e.clientWidth);return e.scrollTo({left:Math.max(0,Math.min(o,s))}),!0}function DS(e,t){let n=t.parentElement,r=e;for(;r&&r!==n;){if(r instanceof HTMLElement&&r.scrollWidth>r.clientWidth+1){let e=getComputedStyle(r).overflowX;if(e===`auto`||e===`scroll`)return r}let e=r.getRootNode(),t=r.parentElement??(e instanceof ShadowRoot?e.host:null);if(t===r)break;r=t}return null}function OS(e,t){let n=e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return!1;let r=n.querySelector(`mark.search-mark.active`)??(()=>{if(t.line<1)return null;let e=[...n.querySelectorAll(`[data-line="${t.line}"]`)],r=t.side||`additions`;return e.find(e=>NS(e)===r)??e[0]??null})();if(!r)return!1;let i=e.closest(`[data-diff-main]`);if(i){if(!ES(i,r,`y`))return!1}else r.scrollIntoView({block:`center`,inline:`nearest`});let a=DS(r,e);return a&&ES(a,r,`x`),!0}function kS(e,t,n=!0){let r=t&&bS.hit?.key===t?bS.hit:null,i=bS.query.trim(),a=!!i&&!!bS.keys&&!!t&&!bS.keys.has(t),o=a?``:CS(i,r);(n||SS.get(e)!==o)&&(SS.set(e,o),RS(e,a?``:i,r),r&&TS(r))}function AS(e,t){return xS.set(e,t),kS(e,t),()=>{xS.delete(e),SS.delete(e)}}function jS(e){kS(e,xS.get(e))}function MS(e){let t=e.querySelectorAll(vS);if(!t.length)return;let n=new Set;for(let e of[...t])e.parentElement&&n.add(e.parentElement),e.replaceWith(...e.childNodes);for(let e of n)e.normalize()}function NS(e){let t=e.closest(`[data-code]`);return t?.hasAttribute(`data-deletions`)?`deletions`:t?.hasAttribute(`data-additions`)?`additions`:(e.getAttribute(`data-line-type`)||``).includes(`deletion`)?`deletions`:`additions`}function PS(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(vS)||n.push(e);return n}function FS(e,t,n){let r=0;for(let i=0;i<e.length;i++){let a=t[i].length;if(n<=r+a)return{node:e[i],offset:Math.min(a,Math.max(0,n-r))};r+=a}let i=e.at(-1);return i?{node:i,offset:t.at(-1)?.length??0}:null}function IS(e,t,n,r,i){let a=FS(e,t,n),o=FS(e,t,r);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=document.createElement(`mark`);c.className=i;try{c.append(s.extractContents()),s.insertNode(c)}catch{}}function LS(e,t,n,r){let i=PS(e);if(!i.length)return;let a=i.map(e=>e.textContent??``),o=a.join(``),s=n?o:o.toLowerCase(),c=[];for(let e=s.indexOf(t);e!==-1;e=s.indexOf(t,e+t.length))c.push([e,e+t.length]);if(!c.length)return;let l=NS(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${_S} active`:_S;for(let e=c.length-1;e>=0;e--)IS(i,a,c[e][0],c[e][1],d)}function RS(e,t,n){let r=[e],i=e.shadowRoot??e.querySelector(`diffs-container`)?.shadowRoot;i&&r.push(i);let a=t.trim(),o=/[A-Z]/.test(a),s=a&&!o?a.toLowerCase():a;for(let e of r)if(MS(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``;(o?e:e.toLowerCase()).includes(s)&&LS(t,s,o,n)}}var zS=`_e1 _4 _l`,BS=`_e7 _cV`,VS=`_fx _u`,HS=Ve,US=(e=>`/${e}&`)(i);function WS(e){u(e.a,`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 13.8214 2.48697 15.5291 3.33782 17L2.5 21.5L7 20.6622C8.47087 21.513 10.1786 22 12 22Z`)}var GS=(e,t)=>ee(e.a,t),KS=(e,t)=>f(e.a,t),qS=(e=>`<div role=group><span>${e}<span aria-hidden=true> </span></span><button type=button aria-label="Copy comments as markdown"></button><!></div>`)(HS),JS=(e=>` D D/${e}& D m b%l`)(US),YS=(e,t)=>z(e.a,`value`,t),XS=F(7,e=>j(e.b,e.f||e.g)),ZS=H(5,XS),QS=H(6,XS),$S=(e,t)=>{YS(e,t[0]?.id),ZS(e,t[0]?.title),QS(e,t[0]?.agent)},eC=e=>{Se(e.a),mt(e.a,14),st(e.a)},tC=e=>{le(e.a),a(e.a,14),ht(e.a)},nC=V(26,e=>{z(e.b,`disabled`,e._._.o),z(e.c,`disabled`,e._._.o)},e=>e._._),rC=I(`k2`,e=>{M(e.b,`click`,function(){let t=e.c;typeof t.showPicker==`function`?t.showPicker():t.focus()}),At(e,`c`)}),iC=e=>{nC(e),oC(e),sC(e),R(e.a,`_iw`),R(e.b,[`_ir`,`_is`,`_ix`]),R(e.c,`_iy`),rC(e)},aC=bt(2,`<option> </option>`,` D `,0,$S),oC=V(27,e=>aC(e,[e._._.q,`id`]),e=>e._._),sC=V(29,e=>It(e,`c`,e._._.v,YC(e)),e=>e._._),cC=V(26,e=>j(e.a,e._._.o?`Sending…`:`Send`),e=>e._._),lC=cC,uC=F(4,e=>j(e.b,e._._.o?`Sending…`:`Send to ${e._._.w||e._._.x}`),2),dC=V(26,e=>{j(e.d,e._._.o?`Sending…`:`Send`),uC(e)},e=>e._._),fC=e=>{dC(e),pC(e),mC(e),R(e.a,[`_iv`,`_iu`]),R(e.c,`_it`)},pC=V(30,uC,e=>e._._),mC=V(31,uC,e=>e._._),hC=P(6,0,e=>z(e.a,`disabled`,e._.o)),gC=I(`k3`,e=>M(e.a,`click`,function(){e._.z()})),_C=e=>{hC._(e),bC._(e),SC._(e),CC._(e),R(e.a,[`_ir`,`_is`]),gC(e)},vC=N(0,`<span> </span><span> </span>`,` D l D `,fC,` `,` `,lC),yC=N(1,`<span><button type=button aria-label="Choose session to send to"></button><select aria-label="Send comments to session" tabindex=-1></select></span>`,` D b `,iC),bC=P(6,0,e=>{vC(e,e._.s>1?0:1),yC(e,e._.s>1?0:1)}),xC=F(2,e=>z(e.a,`title`,`Send comments to ${e._.w||e._.x}`)),SC=P(6,0,xC),CC=P(6,0,xC),wC=N(5,g,(e=>`/${e}&`)(se),tC,ft,(e=>`/${e}&`)(re),eC),TC=Tt(13,e=>{z(e.f,`title`,e.n?`Copied`:`Copy comments as markdown`),wC(e,+!e.n)}),EC=H(25),DC=F(20,e=>EC(e,XC(e)),2),OC=L(dC,cC,nC),kC=Tt(14,e=>{DC(e),hC(e),OC(e)}),AC=N(6,`<button type=button></button><!><!>`,` b%`,_C),jC=H(19,e=>{BC(e,e.t?.id),HC(e,e.t?.title),WC(e,e.t?.agent),AC(e,+!e.t),DC(e)}),MC=F(17,e=>jC(e,e.q.find(t=>t.id===e.p)??e.q[0]??null)),NC=Tt(15,MC),PC=I(`k4`,e=>M(e.f,`click`,function(){(async()=>{await e.m()&&(TC(e,!0),setTimeout(()=>{TC(e,!1)},1500))})()}));function FC(e){R(e.a,`_in`),R(e.b,`_io`),WS(e.c),GS(e.c,18),KS(e.c,`_ip`),R(e.d,`_iq`),R(e.f,`_ir`),TC(e,!1),kC(e,!1),NC(e,null),PC(e)}var IC=L(oC),LC=H(16,e=>{RC(e,e.q.length),MC(e),IC(e)}),RC=H(18,bC),zC=(e,t)=>LC(e,t||[]),BC=H(21,L(sC)),VC=L(pC),HC=H(22,e=>{SC(e),VC(e)}),UC=L(mC),WC=H(23,e=>{CC(e),UC(e)}),GC=(e,t)=>{z(e.a,`aria-label`,t),z(e.b,`title`,t)},KC=(e,t)=>{j(e.e,t>99?`99+`:t),GC(e,`${t} comment${t===1?``:`s`}`)},qC=H(11,DC),JC=H(12),YC=e=>function(t){NC(e._._,t)},XC=e=>()=>{(async()=>{if(e.t&&!e.o){kC(e,!0);try{await e.l(e.t?.id)}finally{kC(e,!1)}}})()};U(`k0`,YC),U(`k1`,XC);var ZC=Ve,QC=(e=>`/${e}&`)(i);function $C(e){u(e.a,`M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H21.4C21.7314 7 22 7.26863 22 7.6V11M2 11V19.4C2 19.7314 2.26863 20 2.6 20H21.4C21.7314 20 22 19.7314 22 19.4V11M2 11H22`)}var ew=(e,t)=>ee(e.a,t),tw=(e,t)=>f(e.a,t),nw=40,rw;function iw(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function aw(e,t){let n=t.trim();if(!n)return[];if(rw&&rw.files===e&&rw.query===n)return rw.hits;let r=cw(e,n);return rw={files:e,query:n,hits:r},r}var ow=new WeakMap;function sw(e){let t=ow.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=xx(e.fileDiff,`additions`),r=xx(e.fileDiff,`deletions`),i=e=>{let t=[];for(let[n,r]of e)t[n-1]=r;return t};t={visible:{additions:new Set(n.keys()),deletions:new Set(r.keys())},newLines:i(n),oldLines:i(r)}}else t={visible:n,newLines:null,oldLines:null};ow.set(e,t)}return t}function cw(e,t){let n=/[A-Z]/.test(t),r=n?t:t.toLowerCase(),i=!/[^\x00-\x7f]/.test(r),a=[];for(let t of e){if(a.length>=200)break;let e=a.length;if(i&&!(n?t.patch??``:(t.patch??``).toLowerCase()).includes(r)){lw(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});continue}let{visible:o,newLines:s,oldLines:c}=sw(t),l=new Set;uw(t,s,`additions`,r,n,l,a,o.additions),uw(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&lw(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path})}return a}function lw(e,t,n){let r=n?e:e.toLowerCase();if(!r.includes(t))return!1;let i=e.lastIndexOf(`/`),a=i>=0?e.slice(i+1):e,o=a.lastIndexOf(`.`);if(o<=0)return!0;let s=a.slice(o+1);if(!(n?s:s.toLowerCase()).includes(t))return!0;let c=e.length-s.length;for(let e=r.indexOf(t);e!==-1;e=r.indexOf(t,e+1))if(e<c)return!0;return!1}function uw(e,t,n,r,i,a,o,s){if(!t||o.length>=200||!s.size)return;let c=0;for(let l=0;l<t.length;l++){if(o.length>=200||c>=nw)return;let u=l+1;if(!s.has(u))continue;let d=t[l];if(d==null)continue;let f=(i?d:d.toLowerCase()).indexOf(r);f<0||n===`deletions`&&a.has(d)||(n===`additions`&&a.add(d),c++,o.push({key:e.key,path:e.path,repo:e.repo,line:u,side:n,preview:dw(d,f,r.length)}))}}function dw(e,t,n){let r=Math.max(0,t-36),i=Math.min(e.length,t+n+36);return(r>0?`…`:``)+e.slice(r,i)+(i<e.length?`…`:``)}var fw=((e,t,n,r)=>`<div><span aria-hidden=true>${e}</span><input type=search enterkeyhint=search autocomplete=off placeholder="Find in review" aria-label="Find in review"><span> </span><button type=button title="Previous match">${t}</button><button type=button title="Next match">${n}</button><button type=button title="Close find">${r}</button></div>`)(Xe,C,Fe,dt),pw=((e,t,n,r)=>` D D/${e}&l b D l D/${t}&l D/${n}&l D/${r}&m`)(y,w,be,oe),mw=I(`j8`,e=>e.ah=!!e.a1),hw=F(44,mw),gw=I(`j7`,e=>Ct(e,{onMount:function(){let t=new AbortController;return document.addEventListener(`keydown`,t=>{if(!e.ah)return;if(t.key===`Escape`){if(document.querySelector(`dialog[open]`)||t.target instanceof HTMLTextAreaElement)return;if(e.y){(e.a4||``).trim()&&(t.preventDefault(),e.as(``));return}t.preventDefault(),e.av();return}let n=t.metaKey||t.ctrlKey;(t.key===`F3`||n&&t.key.toLowerCase()===`g`)&&(t.preventDefault(),e.au(t.shiftKey?-1:1))},{signal:t.signal}),e.an=e.z,e.ao=!!e.a1,e.a1&&!e.y&&e.aw(),{abort:t}},onUpdate:function(){if(e.z!==e.an&&(e.an=e.z,e.a1&&e.aw()),e.a1&&!e.ao)e.ao=!0,e.y||e.aw();else if(!e.a1&&e.ao){e.ao=!1;let t=e.d;t&&document.activeElement===t&&t.blur(),e.al&&=(clearTimeout(e.al),0),wS(``,null),Pw(e,{query:``,hit:null,keys:[]})}},onDestroy:function(){e.al&&clearTimeout(e.al),this.abort.abort(),wS(``,null),Pw(e,{query:``,hit:null,keys:[]})}})),_w=F(59,gw,11),vw=F(29,e=>R(e.a,[`_cD`,e.a0&&`_cM`,!e.a1&&`_cC`])),yw=F(41,e=>j(e.f,e.a1&&(e.a4||``).trim()?e.ab?`${e.ae+1}/${e.ab}`:`0/0`:``),3),bw=F(38,e=>{z(e.g,`disabled`,!e.ab||!e.a1),z(e.i,`disabled`,!e.ab||!e.a1)}),xw=xt(27,e=>{z(e.a,`aria-hidden`,e.a1?`false`:`true`),z(e.d,`tabindex`,e.a1?0:-1),z(e.g,`tabindex`,e.a1?0:-1),z(e.i,`tabindex`,e.a1?0:-1),z(e.k,`tabindex`,e.a1?0:-1),hw(e),_w(e),vw(e),yw(e),bw(e)}),Sw=F(16,e=>xw(e,e.o,e.p)),Cw=H(14,Sw),ww=H(15,Sw),Tw=(e,t)=>Xw(e,t?.length),Ew=F(32,e=>Tw(e,aw(e.x,e.a4||``))),Dw=H(56,_w),Ow=F(53,e=>Dw(e,sT(e)),4),kw=F(55,e=>kt(e,`d`,e.a4||``,cT(e))),Aw=xt(30,e=>{Ew(e),Ow(e),_w(e),kw(e),yw(e)}),jw=F(19,e=>Aw(e,e.r,e.s)),Mw=H(17,jw),Nw=H(18,jw),Pw=xt(33),Fw=F(22,e=>Pw(e,e.u,e.v)),Iw=H(20,Fw),Lw=H(21,Fw),Rw=H(40,e=>{Ow(e),yw(e)}),zw=F(39,e=>Rw(e,e.ab?Math.min(e.a9,e.ab-1):-1)),Bw=H(54,e=>{_w(e),kw(e)}),Vw=F(52,e=>Bw(e,lT(e)),3),Hw=H(51,e=>{Vw(e),Ow(e)}),Uw=F(45,e=>Hw(e,uT(e)),2),Ww=Tt(35,e=>{zw(e),Uw(e)}),Gw=(e,t)=>eT(e,t.open),Kw=(e,t)=>{tT(e,t.timer),nT(e,t.tick),rT(e,t.wasOpen)},qw=H(58,e=>{_t(e,e.aw),_w(e)}),Jw=I(`j6`,e=>{Nt(e,`d`),M(e.d,`keydown`,function(t){if(e.a1){if(t.key===`Escape`){t.preventDefault(),e.y?e.as(``):e.av();return}t.key===`Enter`&&(t.preventDefault(),e.au(t.shiftKey?-1:1))}}),M(e.g,`mousedown`,function(e){e.preventDefault()}),M(e.g,`click`,function(){e.au(-1)}),M(e.i,`mousedown`,function(e){e.preventDefault()}),M(e.i,`click`,function(){e.au(1)}),M(e.k,`mousedown`,function(e){e.preventDefault()}),M(e.k,`click`,function(){e.av()})});function Yw(e){R(e.b,`_cE`),x(e.c),h(e.c,13),de(e.c),R(e.e,`_cH`),Re(e.h),n(e.h,14),ze(e.h),Ze(e.j),We(e.j,14),rt(e.j),s(e.l),ie(e.l,14),pt(e.l),Ww(e,0),Gw(e,{open:!1}),Kw(e,{timer:0,tick:0,wasOpen:!1}),qw(e,dT(e)),Jw(e)}var Xw=H(37,e=>{zw(e),yw(e),bw(e)}),Zw=H(23,e=>{Ew(e),Uw(e),Vw(e)}),Qw=H(57,_w),$w=F(48,e=>Qw(e,fT(e))),eT=H(43,e=>{Uw(e),Vw(e),Ow(e),$w(e),hw(e),_w(e)}),tT=H(47,e=>{Vw(e),Ow(e),$w(e),_w(e)}),nT=H(49,_w),rT=H(50,_w),iT=H(24,e=>{z(e.k,`hidden`,e.y),_w(e)}),aT=H(25,_w),oT=H(26,e=>{R(e.d,[et,e.a0&&`_cO`]),R(e.g,[Ke,e.a0&&`_cP`]),R(e.i,[Ke,e.a0&&`_cP`]),R(e.k,[Ke,e.a0&&`_cP`]),vw(e)}),sT=e=>t=>{e.ah&&(e.al&&=(clearTimeout(e.al),0),e.ap(e.a4||``,(e.ae<0?0:e.ae)+t))},cT=e=>function(t){e.as(t)},lT=e=>t=>{if(!e.ah)return;Aw(e,t),Ww(e,0);let n=aw(e.x,t);wS(t,n[0]??null,iw(n)??void 0),e.al&&clearTimeout(e.al),e.al=setTimeout(()=>{e.al=0,e.ap(t,0)},80)},uT=e=>(t,n)=>{if(!e.ah)return;let r=aw(e.x,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){Ww(e,0),wS(t,null,i),Pw(e,{query:t,hit:null,keys:i});return}Ww(e,(n%r.length+r.length)%r.length);let a=r[e.a9];wS(t,a,iw(r)??void 0),Pw(e,{query:t,hit:a,keys:i})},dT=e=>()=>{let t=e.d;t&&(t.focus(),t.select(),document.activeElement!==t&&setTimeout(()=>{t.focus(),t.select()},0))},fT=e=>()=>{e.d?.blur(),xw(e,!1),e.ah=!1,e.al&&=(clearTimeout(e.al),0),wS(``,null),Pw(e,{query:``,hit:null,keys:[]})};U(`j4`,sT),U(`j1`,cT),U(`j3`,lT),U(`j2`,uT),U(`j0`,dT),U(`j5`,fT);var pT=`<div><span><!> file<!></span><!><span><!><!></span></div>`,mT=` E%c%l%b D%b%m`,hT=P(6,0,e=>j(e.b,e._.p)),gT=I(`y1`,e=>M(e.a,`click`,function(){e._.s()})),_T=e=>{hT._(e),vT._(e),gT(e)},vT=P(6,0,e=>{R(e.a,[`_h5`,{_h4:e._.q}]),z(e.a,`aria-pressed`,e._.q?`true`:`false`),z(e.a,`title`,e._.q?`Show every file`:`Show only files changed since your last visit`)}),yT=P(5,0,e=>j(e.b,e._.n)),bT=I(`y0`,e=>M(e.a,`click`,function(){e._.o()})),xT=e=>{yT._(e),R(e.a,`_h5`),bT(e)},ST=P(3,0,e=>j(e.b,e._.k)),CT=e=>{ST._(e),wT._(e),R(e.a,`_h1`),R(e.c,`_h2`)},wT=P(3,0,e=>j(e.d,e._.l));function TT(e){R(e.a,`_h0`),R(e.e,`_h3`)}var ET=(e,t)=>{j(e.b,t),j(e.c,t===1?``:`s`)},DT=N(3,`<span>+<!></span><span>−<!></span>`,` Db%l Db%`,CT),OT=F(12,e=>DT(e,e.k||e.l?0:1)),kT=H(10,e=>{OT(e),ST(e)}),AT=H(11,e=>{OT(e),wT(e)}),jT=N(5,`<button type=button title="Filtered out of the list — show every file"><!> hidden</button>`,` D%`,xT),MT=H(13,e=>{jT(e,+!e.n),yT(e)}),NT=N(6,`<button type=button><!> new</button>`,` D%`,_T),PT=F(17,e=>NT(e,e.p||e.q?0:1)),FT=H(15,e=>{PT(e),hT(e)}),IT=H(16,e=>{PT(e),vT(e)}),LT=H(14),RT=H(18),zT=`_iR _x`,BT=`<!><!><!>`,VT=V(59,e=>j(e.b,e._._._.a5),e=>e._._._),HT=e=>{VT(e),R(e.a,[`_N`,ue.accent,`_iW`])},UT=F(2,e=>z(e.a,`title`,`${e._._.l?`#${e._._.l.number}`:e._._.p} is already in ${e._._.n}; showing the working tree only`),2),WT=V(45,UT,e=>e._._),GT=e=>{WT(e),KT(e),qT(e),R(e.a,[`_N`,`_iX`])},KT=V(46,e=>{j(e.b,e._._.n),UT(e)},e=>e._._),qT=V(48,UT,e=>e._._),JT=V(49,e=>j(e.b,cS(e._._.u,7)),e=>e._._),YT=e=>{JT(e),R(e.a,[`_N`,`_iX`])},XT=F(7,e=>z(e.a,`title`,`${e._._.a6} · ${e._._.a0.slice(0,7)}…${e._._.a1.slice(0,7)}`),2),ZT=V(55,XT,e=>e._._),QT=e=>{ZT(e),$T(e),tE(e),nE(e),rE(e),iE(e),R(e.a,`_iS`),R(e.b,[`_N`,`_iT`]),R(e.d,[`_P`,`_iV`]),R(e.e,[`_N`,`_iU`])},$T=V(56,XT,e=>e._._),eE=N(6,`<span> </span>`,` D `,HT),tE=V(59,e=>eE(e,+!e._._.a5),e=>e._._),nE=V(60,XT,e=>e._._),rE=V(61,e=>j(e.c,e._._.a7),e=>e._._),iE=V(62,e=>j(e.f,e._._.a8),e=>e._._),aE=F(5,e=>z(e.b,`title`,`${e._._.z}: ${e._._.o} ${e._._.a0} vs ${e._._.n} ${e._._.a1}`),4),oE=V(46,aE,e=>e._._),sE=e=>{oE(e),cE(e),lE(e),uE(e),dE(e),fE(e),pE(e),R(e.a,`_iP`),R(e.b,[`_u`,`_v`,`_iQ`]),R(e.d,zT)},cE=V(47,aE,e=>e._._),lE=V(52,e=>j(e.c,e._._.x),e=>e._._),uE=V(53,e=>z(e.b,`href`,`${e._._.y}/files`),e=>e._._),dE=V(54,e=>{z(e.d,`title`,e._._.z),j(e.e,e._._.z),aE(e)},e=>e._._),fE=V(55,aE,e=>e._._),pE=V(56,aE,e=>e._._),mE=F(2,e=>j(e.b,`${gS(e._._.p,e._._.e,e._._.f)} ${cS(e._._.a3,7)}`),3),hE=V(41,mE,e=>e._._),gE=e=>{hE(e),_E(e),yE(e),bE(e),xE(e),SE(e),R(e.a,[`_N`,`_iX`])},_E=V(42,mE,e=>e._._),vE=F(3,e=>z(e.a,`title`,`This view is ${cS(e._._.a0)} (${e._._.o}); checked out is ${cS(e._._.a3)} (${e._._.p})`),3),yE=V(47,vE,e=>e._._),bE=V(48,e=>{vE(e),mE(e)},e=>e._._),xE=V(55,vE,e=>e._._),SE=V(58,e=>{vE(e),mE(e)},e=>e._._),CE=V(44,e=>z(e.a,`disabled`,e._._.i),e=>e._._),wE=I(`x0`,e=>M(e.a,`click`,function(){e._._.j()})),TE=e=>{CE(e),DE(e),OE(e),kE(e),R(e.a,[`_N`,ue.warn,`_iX`]),wE(e)},EE=F(3,e=>z(e.a,`title`,`origin/${e._._.o} ${e._._.a0} · GitHub ${e._._.a2}. Reload to re-ask GitHub`),2),DE=V(47,EE,e=>e._._),OE=V(55,e=>{j(e.b,cS(e._._.a0,7)),EE(e)},e=>e._._),kE=V(57,e=>{j(e.c,cS(e._._.a2,7)),EE(e)},e=>e._._),AE=N(6,`<span>local <!></span>`,` Db%`,gE),jE=P(0,0,e=>AE(e,+!e._.h)),ME=e=>{jE._(e),FE._(e),LE._(e),zE._(e),BE._(e),HE._(e),WE._(e),R(e.a,`_iO`)},NE=N(1,`<span><a target=_blank rel=noopener>#<!></a><span> </span></span>`,` D Db%l D `,sE),PE=F(7,e=>z(e.a,`data-pr`,e._.l?`${e._.w}/${e._.l.number}`:void 0)),FE=P(0,0,e=>{NE(e,+!e._.l),PE(e)}),IE=N(3,`<span title="One commit against its parent">commit <!></span>`,` Db%`,YT),LE=P(0,0,e=>IE(e,+!e._.u)),RE=N(4,`<button type=button>behind GitHub <!> → <!></button>`,` Db%c%`,TE),zE=P(0,0,e=>RE(e,+!e._.v)),BE=P(0,0,PE),VE=N(2,`<span><span> </span><span aria-hidden=true>vs</span><span> </span><!></span>`,` D D l b D l%`,QT),HE=P(0,0,e=>VE(e,+!e._.ac)),UE=N(5,`<span>already in <!></span>`,` Db%`,GT),WE=P(0,0,e=>UE(e,+!e._.ad)),GE=(e,t)=>{YE(e,t?.pr),oD(e,t?.base),cD(e,t?.branch),dD(e,t?.default_branch),mD(e,t?.contained),gD(e,t?.rev),_D(e,t?.githubDrift),vD(e,t?.worktree),yD(e,t?.head),bD(e,t?.baseSha),xD(e,t?.localHead)},KE=N(0,`<div><!><!><!><!><!><!></div>`,` D%b%b%b%b%b%`,ME),qE=F(40,e=>KE(e,e.l||e.ac||e.u||e.v||e.ad||e.h?0:1),5),JE=L(WT),YE=H(11,e=>{QE(e,e.l?.baseRefName),eD(e,e.l?.headRefName),tD(e,e.l?.number),nD(e,e.l?.url),rD(e,e.l?.title),iD(e,e.l?.headRefOid),qE(e),FE(e),JE(e)}),XE=(e,t)=>{OD(e,t?.topic),kD(e,t?.title),AD(e,t?.base),jD(e,t?.head)},ZE=F(16,e=>XE(e,hS(e.m||e.n,e.o||e.p,e.e,e.f)),5),QE=H(12,ZE),$E=L(DE,yE,cE),eD=H(14,e=>{ZE(e),$E(e)}),tD=H(23,L(lE)),nD=H(24,L(uE)),rD=H(25,L(dE)),iD=H(28,L(kE)),aD=L(oE,KT),oD=H(13,e=>{ZE(e),aD(e)}),sD=L(bE,qT),cD=H(15,e=>{ZE(e),sD(e)}),lD=H(38,e=>{qE(e),HE(e)}),uD=F(37,e=>lD(e,!!e.a5||!!e.e&&e.aa!==e.e||!!e.r&&e.a9!==e.r),4),dD=H(17,uD),fD=H(39,e=>{qE(e),WE(e)}),pD=F(19,e=>fD(e,!!e.s&&e.g>0)),mD=H(18,pD),hD=L(JT),gD=H(20,e=>{qE(e),LE(e),hD(e)}),_D=H(21,e=>{qE(e),zE(e)}),vD=H(22,BE),yD=H(26,L(OE,xE,fE,ZT)),bD=H(27,L(pE,$T)),xD=H(29,L(SE)),SD=H(35,uD),CD=e=>{SD(e,(e.m||e.n).replace(/^origin\//,``))},wD=H(36,uD),TD=e=>{wD(e,(e.o||e.p).replace(/^origin\//,``))},ED=H(3,e=>{GE(e,e.d),CD(e),TD(e)}),DD=L(tE,VT),OD=H(31,e=>{uD(e),DD(e)}),kD=H(32,L(nE)),AD=H(33,L(rE)),jD=H(34,L(iE)),MD=L(hE),ND=H(4,e=>{ZE(e),uD(e),MD(e)}),PD=L(_E),FD=H(5,e=>{ZE(e),PD(e)}),ID=H(6,pD),LD=H(7,e=>{qE(e),jE(e)}),RD=H(8,L(CE)),zD=H(9),BD=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1532
+ `)}function pS(e){let t=e.replace(/^origin\//,``);return mS(t.includes(`/`)?t.slice(t.lastIndexOf(`/`)+1):t)}function mS(e){return e.replace(/-[a-z0-9]{1,6}$/i,``)||e}function hS(e,t){if(!t)return``;let n=e.replace(/^origin\//,``),r=t.replace(/^origin\//,``);return n.startsWith(`${r}-`)?n.slice(r.length+1):``}function gS(e){let t=mS(e);if(t.length<=20)return t;let n=t.split(`-`);return n.length>1?n[n.length-1]:t}function _S(e,t,n=``,r=``){let i=(e||`base`).replace(/^origin\//,``),a=(t||`HEAD`).replace(/^origin\//,``),o=(n||``).replace(/^origin\//,``),s=!!o&&(a===o||a.startsWith(`${o}-`));return{base:i,head:s?r||pS(o):gS(a),topic:s?hS(a,o):``,onWs:s,title:a===i?i:`${a} vs ${i}`}}function vS(e,t=``,n=``){let r=_S(e.base,e.head,t,n),i=(e.base||`base`).replace(/^origin\//,``),a=(e.head||`HEAD`).replace(/^origin\//,``),o=t.replace(/^origin\//,``);return r.topic||o&&a!==o||e.defaultBranch&&i!==e.defaultBranch?{head:r.onWs?``:r.head,topic:r.topic,base:r.base,title:r.title}:null}function yS(e,t=``,n=``){let r=e.replace(/^origin\//,``);if(!r||r===`HEAD`)return r||`HEAD`;let i=t.replace(/^origin\//,``);if(i&&(r===i||r.startsWith(`${i}-`))){let e=n||pS(i),t=hS(r,i);return t?`${e} [${t}]`:e}return gS(r)}var bS=`search-mark`,xS=`mark.${bS}`,SS=`mark.${bS}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${bS} *,mark.${bS} *::before,mark.${bS} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${bS}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,CS={query:``,hit:null,keys:null},wS=new Map,TS=new WeakMap,ES=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function DS(e,t,n){CS.query=e,CS.hit=t,CS.keys=n?new Set(n):null;for(let[e,t]of wS)MS(e,t,!1);t&&OS(t)}function OS(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of wS)if(i===e.key&&(n=!0,jS(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>OS(e,t+1),n?32:48)})})}function kS(e,t,n){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(i.height===0&&i.width===0)return!1;if(n===`y`){let t=i.top-r.top+e.scrollTop-(r.height/2-i.height/2);return e.scrollTo({top:Math.max(0,t)}),!0}if(e.scrollWidth<=e.clientWidth+1)return!0;let a=Math.min(24,r.width/8);if(i.left>=r.left+a&&i.right<=r.right-a)return!0;let o=i.left-r.left+e.scrollLeft-(r.width/2-i.width/2),s=Math.max(0,e.scrollWidth-e.clientWidth);return e.scrollTo({left:Math.max(0,Math.min(o,s))}),!0}function AS(e,t){let n=t.parentElement,r=e;for(;r&&r!==n;){if(r instanceof HTMLElement&&r.scrollWidth>r.clientWidth+1){let e=getComputedStyle(r).overflowX;if(e===`auto`||e===`scroll`)return r}let e=r.getRootNode(),t=r.parentElement??(e instanceof ShadowRoot?e.host:null);if(t===r)break;r=t}return null}function jS(e,t){let n=e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return!1;let r=n.querySelector(`mark.search-mark.active`)??(()=>{if(t.line<1)return null;let e=[...n.querySelectorAll(`[data-line="${t.line}"]`)],r=t.side||`additions`;return e.find(e=>IS(e)===r)??e[0]??null})();if(!r)return!1;let i=e.closest(`[data-diff-main]`);if(i){if(!kS(i,r,`y`))return!1}else r.scrollIntoView({block:`center`,inline:`nearest`});let a=AS(r,e);return a&&kS(a,r,`x`),!0}function MS(e,t,n=!0){let r=t&&CS.hit?.key===t?CS.hit:null,i=CS.query.trim(),a=!!i&&!!CS.keys&&!!t&&!CS.keys.has(t),o=a?``:ES(i,r);(n||TS.get(e)!==o)&&(TS.set(e,o),VS(e,a?``:i,r),r&&OS(r))}function NS(e,t){return wS.set(e,t),MS(e,t),()=>{wS.delete(e),TS.delete(e)}}function PS(e){MS(e,wS.get(e))}function FS(e){let t=e.querySelectorAll(xS);if(!t.length)return;let n=new Set;for(let e of[...t])e.parentElement&&n.add(e.parentElement),e.replaceWith(...e.childNodes);for(let e of n)e.normalize()}function IS(e){let t=e.closest(`[data-code]`);return t?.hasAttribute(`data-deletions`)?`deletions`:t?.hasAttribute(`data-additions`)?`additions`:(e.getAttribute(`data-line-type`)||``).includes(`deletion`)?`deletions`:`additions`}function LS(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(xS)||n.push(e);return n}function RS(e,t,n){let r=0;for(let i=0;i<e.length;i++){let a=t[i].length;if(n<=r+a)return{node:e[i],offset:Math.min(a,Math.max(0,n-r))};r+=a}let i=e.at(-1);return i?{node:i,offset:t.at(-1)?.length??0}:null}function zS(e,t,n,r,i){let a=RS(e,t,n),o=RS(e,t,r);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=document.createElement(`mark`);c.className=i;try{c.append(s.extractContents()),s.insertNode(c)}catch{}}function BS(e,t,n,r){let i=LS(e);if(!i.length)return;let a=i.map(e=>e.textContent??``),o=a.join(``),s=n?o:o.toLowerCase(),c=[];for(let e=s.indexOf(t);e!==-1;e=s.indexOf(t,e+t.length))c.push([e,e+t.length]);if(!c.length)return;let l=IS(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${bS} active`:bS;for(let e=c.length-1;e>=0;e--)zS(i,a,c[e][0],c[e][1],d)}function VS(e,t,n){let r=[e],i=e.shadowRoot??e.querySelector(`diffs-container`)?.shadowRoot;i&&r.push(i);let a=t.trim(),o=/[A-Z]/.test(a),s=a&&!o?a.toLowerCase():a;for(let e of r)if(FS(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``;(o?e:e.toLowerCase()).includes(s)&&BS(t,s,o,n)}}var HS=`_go _4 _l`,US=`_gu _d2`,WS=`_gV _u`,GS=We,KS=(e=>`/${e}&`)(i);function qS(e){l(e.a,`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 13.8214 2.48697 15.5291 3.33782 17L2.5 21.5L7 20.6622C8.47087 21.513 10.1786 22 12 22Z`)}var JS=(e,t)=>D(e.a,t),YS=(e,t)=>d(e.a,t),XS=(e=>`<div role=group><span>${e}<span aria-hidden=true> </span></span><button type=button aria-label="Copy comments as markdown"></button><!></div>`)(GS),ZS=(e=>` D D/${e}& D m b%l`)(KS),QS=(e,t)=>z(e.a,`value`,t),$S=F(7,e=>j(e.b,e.f||e.g)),eC=H(5,$S),tC=H(6,$S),nC=(e,t)=>{QS(e,t[0]?.id),eC(e,t[0]?.title),tC(e,t[0]?.agent)},rC=e=>{Se(e.a),ht(e.a,14),ut(e.a)},iC=e=>{le(e.a),a(e.a,14),_t(e.a)},aC=V(26,e=>{z(e.b,`disabled`,e._._.o),z(e.c,`disabled`,e._._.o)},e=>e._._),oC=I(`k2`,e=>{M(e.b,`click`,function(){let t=e.c;typeof t.showPicker==`function`?t.showPicker():t.focus()}),Mt(e,`c`)}),sC=e=>{aC(e),lC(e),uC(e),R(e.a,`_i7`),R(e.b,[`_i2`,`_i3`,`_i8`]),R(e.c,`_i9`),oC(e)},cC=St(2,`<option> </option>`,` D `,0,nC),lC=V(27,e=>cC(e,[e._._.q,`id`]),e=>e._._),uC=V(29,e=>Rt(e,`c`,e._._.v,QC(e)),e=>e._._),dC=V(26,e=>j(e.a,e._._.o?`Sending…`:`Send`),e=>e._._),fC=dC,pC=F(4,e=>j(e.b,e._._.o?`Sending…`:`Send to ${e._._.w||e._._.x}`),2),mC=V(26,e=>{j(e.d,e._._.o?`Sending…`:`Send`),pC(e)},e=>e._._),hC=e=>{mC(e),gC(e),_C(e),R(e.a,[`_i6`,`_i5`]),R(e.c,`_i4`)},gC=V(30,pC,e=>e._._),_C=V(31,pC,e=>e._._),vC=P(6,0,e=>z(e.a,`disabled`,e._.o)),yC=I(`k3`,e=>M(e.a,`click`,function(){e._.z()})),bC=e=>{vC._(e),CC._(e),TC._(e),EC._(e),R(e.a,[`_i2`,`_i3`]),yC(e)},xC=N(0,`<span> </span><span> </span>`,` D l D `,hC,` `,` `,fC),SC=N(1,`<span><button type=button aria-label="Choose session to send to"></button><select aria-label="Send comments to session" tabindex=-1></select></span>`,` D b `,sC),CC=P(6,0,e=>{xC(e,e._.s>1?0:1),SC(e,e._.s>1?0:1)}),wC=F(2,e=>z(e.a,`title`,`Send comments to ${e._.w||e._.x}`)),TC=P(6,0,wC),EC=P(6,0,wC),DC=N(5,h,(e=>`/${e}&`)(se),iC,mt,(e=>`/${e}&`)(k),rC),OC=Dt(13,e=>{z(e.f,`title`,e.n?`Copied`:`Copy comments as markdown`),DC(e,+!e.n)}),kC=H(25),AC=F(20,e=>kC(e,$C(e)),2),jC=L(mC,dC,aC),MC=Dt(14,e=>{AC(e),vC(e),jC(e)}),NC=N(6,`<button type=button></button><!><!>`,` b%`,bC),PC=H(19,e=>{UC(e,e.t?.id),GC(e,e.t?.title),qC(e,e.t?.agent),NC(e,+!e.t),AC(e)}),FC=F(17,e=>PC(e,e.q.find(t=>t.id===e.p)??e.q[0]??null)),IC=Dt(15,FC),LC=I(`k4`,e=>M(e.f,`click`,function(){(async()=>{await e.m()&&(OC(e,!0),setTimeout(()=>{OC(e,!1)},1500))})()}));function RC(e){R(e.a,`_iY`),R(e.b,`_iZ`),qS(e.c),JS(e.c,18),YS(e.c,`_i0`),R(e.d,`_i1`),R(e.f,`_i2`),OC(e,!1),MC(e,!1),IC(e,null),LC(e)}var zC=L(lC),BC=H(16,e=>{VC(e,e.q.length),FC(e),zC(e)}),VC=H(18,CC),HC=(e,t)=>BC(e,t||[]),UC=H(21,L(uC)),WC=L(gC),GC=H(22,e=>{TC(e),WC(e)}),KC=L(_C),qC=H(23,e=>{EC(e),KC(e)}),JC=(e,t)=>{z(e.a,`aria-label`,t),z(e.b,`title`,t)},YC=(e,t)=>{j(e.e,t>99?`99+`:t),JC(e,`${t} comment${t===1?``:`s`}`)},XC=H(11,AC),ZC=H(12),QC=e=>function(t){IC(e._._,t)},$C=e=>()=>{(async()=>{if(e.t&&!e.o){MC(e,!0);try{await e.l(e.t?.id)}finally{MC(e,!1)}}})()};U(`k0`,QC),U(`k1`,$C);var ew=We,tw=(e=>`/${e}&`)(i);function nw(e){l(e.a,`M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H21.4C21.7314 7 22 7.26863 22 7.6V11M2 11V19.4C2 19.7314 2.26863 20 2.6 20H21.4C21.7314 20 22 19.7314 22 19.4V11M2 11H22`)}var rw=(e,t)=>D(e.a,t),iw=(e,t)=>d(e.a,t),aw=40,ow;function sw(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function cw(e,t){let n=t.trim();if(!n)return[];if(ow&&ow.files===e&&ow.query===n)return ow.hits;let r=dw(e,n);return ow={files:e,query:n,hits:r},r}var lw=new WeakMap;function uw(e){let t=lw.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=Cx(e.fileDiff,`additions`),r=Cx(e.fileDiff,`deletions`),i=e=>{let t=[];for(let[n,r]of e)t[n-1]=r;return t};t={visible:{additions:new Set(n.keys()),deletions:new Set(r.keys())},newLines:i(n),oldLines:i(r)}}else t={visible:n,newLines:null,oldLines:null};lw.set(e,t)}return t}function dw(e,t){let n=/[A-Z]/.test(t),r=n?t:t.toLowerCase(),i=!/[^\x00-\x7f]/.test(r),a=[];for(let t of e){if(a.length>=200)break;let e=a.length;if(i&&!(n?t.patch??``:(t.patch??``).toLowerCase()).includes(r)){fw(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});continue}let{visible:o,newLines:s,oldLines:c}=uw(t),l=new Set;pw(t,s,`additions`,r,n,l,a,o.additions),pw(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&fw(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path})}return a}function fw(e,t,n){let r=n?e:e.toLowerCase();if(!r.includes(t))return!1;let i=e.lastIndexOf(`/`),a=i>=0?e.slice(i+1):e,o=a.lastIndexOf(`.`);if(o<=0)return!0;let s=a.slice(o+1);if(!(n?s:s.toLowerCase()).includes(t))return!0;let c=e.length-s.length;for(let e=r.indexOf(t);e!==-1;e=r.indexOf(t,e+1))if(e<c)return!0;return!1}function pw(e,t,n,r,i,a,o,s){if(!t||o.length>=200||!s.size)return;let c=0;for(let l=0;l<t.length;l++){if(o.length>=200||c>=aw)return;let u=l+1;if(!s.has(u))continue;let d=t[l];if(d==null)continue;let f=(i?d:d.toLowerCase()).indexOf(r);f<0||n===`deletions`&&a.has(d)||(n===`additions`&&a.add(d),c++,o.push({key:e.key,path:e.path,repo:e.repo,line:u,side:n,preview:mw(d,f,r.length)}))}}function mw(e,t,n){let r=Math.max(0,t-36),i=Math.min(e.length,t+n+36);return(r>0?`…`:``)+e.slice(r,i)+(i<e.length?`…`:``)}var hw=((e,t,n,r)=>`<div><span aria-hidden=true>${e}</span><input type=search enterkeyhint=search autocomplete=off placeholder="Find in review" aria-label="Find in review"><span> </span><button type=button title="Previous match">${t}</button><button type=button title="Next match">${n}</button><button type=button title="Close find">${r}</button></div>`)(et,S,Le,pt),gw=((e,t,n,r)=>` D D/${e}&l b D l D/${t}&l D/${n}&l D/${r}&m`)(v,w,be,oe),_w=I(`j8`,e=>e.ah=!!e.a1),vw=F(44,_w),yw=I(`j7`,e=>Tt(e,{onMount:function(){let t=new AbortController;return document.addEventListener(`keydown`,t=>{if(!e.ah)return;if(t.key===`Escape`){if(document.querySelector(`dialog[open]`)||t.target instanceof HTMLTextAreaElement)return;if(e.y){(e.a4||``).trim()&&(t.preventDefault(),e.as(``));return}t.preventDefault(),e.av();return}let n=t.metaKey||t.ctrlKey;(t.key===`F3`||n&&t.key.toLowerCase()===`g`)&&(t.preventDefault(),e.au(t.shiftKey?-1:1))},{signal:t.signal}),e.an=e.z,e.ao=!!e.a1,e.a1&&!e.y&&e.aw(),{abort:t}},onUpdate:function(){if(e.z!==e.an&&(e.an=e.z,e.a1&&e.aw()),e.a1&&!e.ao)e.ao=!0,e.y||e.aw();else if(!e.a1&&e.ao){e.ao=!1;let t=e.d;t&&document.activeElement===t&&t.blur(),e.al&&=(clearTimeout(e.al),0),DS(``,null),Lw(e,{query:``,hit:null,keys:[]})}},onDestroy:function(){e.al&&clearTimeout(e.al),this.abort.abort(),DS(``,null),Lw(e,{query:``,hit:null,keys:[]})}})),bw=F(59,yw,11),xw=F(29,e=>R(e.a,[`_eo`,e.a0&&`_ex`,!e.a1&&`_en`])),Sw=F(41,e=>j(e.f,e.a1&&(e.a4||``).trim()?e.ab?`${e.ae+1}/${e.ab}`:`0/0`:``),3),Cw=F(38,e=>{z(e.g,`disabled`,!e.ab||!e.a1),z(e.i,`disabled`,!e.ab||!e.a1)}),ww=Ct(27,e=>{z(e.a,`aria-hidden`,e.a1?`false`:`true`),z(e.d,`tabindex`,e.a1?0:-1),z(e.g,`tabindex`,e.a1?0:-1),z(e.i,`tabindex`,e.a1?0:-1),z(e.k,`tabindex`,e.a1?0:-1),vw(e),bw(e),xw(e),Sw(e),Cw(e)}),Tw=F(16,e=>ww(e,e.o,e.p)),Ew=H(14,Tw),Dw=H(15,Tw),Ow=(e,t)=>$w(e,t?.length),kw=F(32,e=>Ow(e,cw(e.x,e.a4||``))),Aw=H(56,bw),jw=F(53,e=>Aw(e,uT(e)),4),Mw=F(55,e=>jt(e,`d`,e.a4||``,dT(e))),Nw=Ct(30,e=>{kw(e),jw(e),bw(e),Mw(e),Sw(e)}),Pw=F(19,e=>Nw(e,e.r,e.s)),Fw=H(17,Pw),Iw=H(18,Pw),Lw=Ct(33),Rw=F(22,e=>Lw(e,e.u,e.v)),zw=H(20,Rw),Bw=H(21,Rw),Vw=H(40,e=>{jw(e),Sw(e)}),Hw=F(39,e=>Vw(e,e.ab?Math.min(e.a9,e.ab-1):-1)),Uw=H(54,e=>{bw(e),Mw(e)}),Ww=F(52,e=>Uw(e,fT(e)),3),Gw=H(51,e=>{Ww(e),jw(e)}),Kw=F(45,e=>Gw(e,pT(e)),2),qw=Dt(35,e=>{Hw(e),Kw(e)}),Jw=(e,t)=>rT(e,t.open),Yw=(e,t)=>{iT(e,t.timer),aT(e,t.tick),oT(e,t.wasOpen)},Xw=H(58,e=>{yt(e,e.aw),bw(e)}),Zw=I(`j6`,e=>{Ft(e,`d`),M(e.d,`keydown`,function(t){if(e.a1){if(t.key===`Escape`){t.preventDefault(),e.y?e.as(``):e.av();return}t.key===`Enter`&&(t.preventDefault(),e.au(t.shiftKey?-1:1))}}),M(e.g,`mousedown`,function(e){e.preventDefault()}),M(e.g,`click`,function(){e.au(-1)}),M(e.i,`mousedown`,function(e){e.preventDefault()}),M(e.i,`click`,function(){e.au(1)}),M(e.k,`mousedown`,function(e){e.preventDefault()}),M(e.k,`click`,function(){e.av()})});function Qw(e){R(e.b,`_ep`),b(e.c),m(e.c,13),de(e.c),R(e.e,`_es`),Be(e.h),n(e.h,14),He(e.h),tt(e.j),Je(e.j,14),ot(e.j),s(e.l),ie(e.l,14),A(e.l),qw(e,0),Jw(e,{open:!1}),Yw(e,{timer:0,tick:0,wasOpen:!1}),Xw(e,mT(e)),Zw(e)}var $w=H(37,e=>{Hw(e),Sw(e),Cw(e)}),eT=H(23,e=>{kw(e),Kw(e),Ww(e)}),tT=H(57,bw),nT=F(48,e=>tT(e,hT(e))),rT=H(43,e=>{Kw(e),Ww(e),jw(e),nT(e),vw(e),bw(e)}),iT=H(47,e=>{Ww(e),jw(e),nT(e),bw(e)}),aT=H(49,bw),oT=H(50,bw),sT=H(24,e=>{z(e.k,`hidden`,e.y),bw(e)}),cT=H(25,bw),lT=H(26,e=>{R(e.d,[rt,e.a0&&`_ez`]),R(e.g,[Xe,e.a0&&`_eA`]),R(e.i,[Xe,e.a0&&`_eA`]),R(e.k,[Xe,e.a0&&`_eA`]),xw(e)}),uT=e=>t=>{e.ah&&(e.al&&=(clearTimeout(e.al),0),e.ap(e.a4||``,(e.ae<0?0:e.ae)+t))},dT=e=>function(t){e.as(t)},fT=e=>t=>{if(!e.ah)return;Nw(e,t),qw(e,0);let n=cw(e.x,t);DS(t,n[0]??null,sw(n)??void 0),e.al&&clearTimeout(e.al),e.al=setTimeout(()=>{e.al=0,e.ap(t,0)},80)},pT=e=>(t,n)=>{if(!e.ah)return;let r=cw(e.x,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){qw(e,0),DS(t,null,i),Lw(e,{query:t,hit:null,keys:i});return}qw(e,(n%r.length+r.length)%r.length);let a=r[e.a9];DS(t,a,sw(r)??void 0),Lw(e,{query:t,hit:a,keys:i})},mT=e=>()=>{let t=e.d;t&&(t.focus(),t.select(),document.activeElement!==t&&setTimeout(()=>{t.focus(),t.select()},0))},hT=e=>()=>{e.d?.blur(),ww(e,!1),e.ah=!1,e.al&&=(clearTimeout(e.al),0),DS(``,null),Lw(e,{query:``,hit:null,keys:[]})};U(`j4`,uT),U(`j1`,dT),U(`j3`,fT),U(`j2`,pT),U(`j0`,mT),U(`j5`,hT);var gT=`<div><span><!> file<!></span><!><span><!><!></span></div>`,_T=` E%c%l%b D%b%m`,vT=P(6,0,e=>j(e.b,e._.p)),yT=I(`y1`,e=>M(e.a,`click`,function(){e._.s()})),bT=e=>{vT._(e),xT._(e),yT(e)},xT=P(6,0,e=>{R(e.a,[`_h0`,{_hZ:e._.q}]),z(e.a,`aria-pressed`,e._.q?`true`:`false`),z(e.a,`title`,e._.q?`Show every file`:`Show only files changed since your last visit`)}),ST=P(5,0,e=>j(e.b,e._.n)),CT=I(`y0`,e=>M(e.a,`click`,function(){e._.o()})),wT=e=>{ST._(e),R(e.a,`_h0`),CT(e)},TT=P(3,0,e=>j(e.b,e._.k)),ET=e=>{TT._(e),DT._(e),R(e.a,`_hW`),R(e.c,`_hX`)},DT=P(3,0,e=>j(e.d,e._.l));function OT(e){R(e.a,`_hV`),R(e.e,`_hY`)}var kT=(e,t)=>{j(e.b,t),j(e.c,t===1?``:`s`)},AT=N(3,`<span>+<!></span><span>−<!></span>`,` Db%l Db%`,ET),jT=F(12,e=>AT(e,e.k||e.l?0:1)),MT=H(10,e=>{jT(e),TT(e)}),NT=H(11,e=>{jT(e),DT(e)}),PT=N(5,`<button type=button title="Filtered out of the list — show every file"><!> hidden</button>`,` D%`,wT),FT=H(13,e=>{PT(e,+!e.n),ST(e)}),IT=N(6,`<button type=button><!> new</button>`,` D%`,bT),LT=F(17,e=>IT(e,e.p||e.q?0:1)),RT=H(15,e=>{LT(e),vT(e)}),zT=H(16,e=>{LT(e),xT(e)}),BT=H(14),VT=H(18),HT=`_iD _x`,UT=`<!><!><!>`,WT=V(30,e=>j(e.b,uS(e._._.l,7)),e=>e._._),GT=e=>{WT(e),R(e.a,[`_N`,`_iJ`])},KT=V(33,e=>j(e.c,e._._.p),e=>e._._),qT=e=>{KT(e),JT(e),XT(e),ZT(e),QT(e),$T(e),eE(e),R(e.a,`_iB`),R(e.b,[`_u`,`_v`,`_iC`]),R(e.d,HT)},JT=V(34,e=>z(e.b,`href`,`${e._._.q}/files`),e=>e._._),YT=F(5,e=>z(e.b,`title`,`${e._._.r}: ${e._._.s} ${e._._.t} vs ${e._._.u} ${e._._.v}`),4),XT=V(35,e=>{z(e.d,`title`,e._._.r),j(e.e,e._._.r),YT(e)},e=>e._._),ZT=V(36,YT,e=>e._._),QT=V(37,YT,e=>e._._),$T=V(38,YT,e=>e._._),eE=V(39,YT,e=>e._._),tE=F(2,e=>j(e.b,`${yS(e._._.y,e._._.h,e._._.i)} ${uS(e._._.x,7)}`),3),nE=V(27,tE,e=>e._._),rE=e=>{nE(e),iE(e),oE(e),sE(e),cE(e),lE(e),R(e.a,[`_N`,`_iJ`])},iE=V(28,tE,e=>e._._),aE=F(3,e=>z(e.a,`title`,`This view is ${uS(e._._.t)} (${e._._.s}); checked out is ${uS(e._._.x)} (${e._._.y})`),3),oE=V(36,aE,e=>e._._),sE=V(37,aE,e=>e._._),cE=V(41,e=>{aE(e),tE(e)},e=>e._._),lE=V(42,e=>{aE(e),tE(e)},e=>e._._),uE=V(26,e=>z(e.a,`disabled`,e._._.f),e=>e._._),dE=I(`x0`,e=>M(e.a,`click`,function(){e._._.g()})),fE=e=>{uE(e),mE(e),hE(e),gE(e),R(e.a,[`_N`,ue.warn,`_iJ`]),dE(e)},pE=F(3,e=>z(e.a,`title`,`origin/${e._._.s} ${e._._.t} · GitHub ${e._._.w}. Reload to re-ask GitHub`),2),mE=V(36,pE,e=>e._._),hE=V(37,e=>{j(e.b,uS(e._._.t,7)),pE(e)},e=>e._._),gE=V(40,e=>{j(e.c,uS(e._._.w,7)),pE(e)},e=>e._._),_E=N(4,`<span>local <!></span>`,` Db%`,rE),vE=P(0,0,e=>_E(e,+!e._.e)),yE=e=>{vE._(e),SE._(e),wE._(e),EE._(e),DE._(e),R(e.a,`_iA`)},bE=N(1,`<span><a target=_blank rel=noopener>#<!></a><span> </span></span>`,` D Db%l D `,qT),xE=F(5,e=>z(e.a,`data-pr`,e._.k?`${e._.o}/${e._.k.number}`:void 0)),SE=P(0,0,e=>{bE(e,+!e._.k),xE(e)}),CE=N(2,`<span title="One commit against its parent">commit <!></span>`,` Db%`,GT),wE=P(0,0,e=>CE(e,+!e._.l)),TE=N(3,`<button type=button>behind GitHub <!> → <!></button>`,` Db%c%`,fE),EE=P(0,0,e=>TE(e,+!e._.m)),DE=P(0,0,xE),OE=(e,t)=>{jE(e,t?.pr),RE(e,t?.rev),zE(e,t?.githubDrift),BE(e,t?.worktree),VE(e,t?.head),HE(e,t?.base),UE(e,t?.baseSha),WE(e,t?.localHead),GE(e,t?.branch)},kE=N(0,`<div><!><!><!><!></div>`,` D%b%b%b%`,yE),AE=F(13,e=>kE(e,e.k||e.l||e.m||e.e?0:1),3),jE=H(10,e=>{ME(e,e.k?.number),NE(e,e.k?.url),PE(e,e.k?.title),FE(e,e.k?.headRefName),IE(e,e.k?.headRefOid),AE(e),SE(e)}),ME=H(15,L(KT)),NE=H(16,L(JT)),PE=H(17,L(XT)),FE=H(18,L(mE,oE,ZT)),IE=H(22,L(gE)),LE=L(WT),RE=H(11,e=>{AE(e),wE(e),LE(e)}),zE=H(12,e=>{AE(e),EE(e)}),BE=H(14,DE),VE=H(19,L(hE,sE,QT)),HE=H(20,L($T)),UE=H(21,L(eE)),WE=H(23,L(cE)),GE=H(24,L(lE)),KE=OE,qE=H(4,e=>{AE(e),vE(e)}),JE=H(5,L(uE)),YE=H(6),XE=H(7,L(nE)),ZE=H(8,L(iE)),QE=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1533
1533
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
1534
1534
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
1535
1535
  </symbol>
@@ -1546,72 +1546,72 @@ diff --git`)}function g_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
1546
1546
  <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
1547
1547
  <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
1548
1548
  </symbol>
1549
- </svg>`,VD=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
1549
+ </svg>`,$E=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
1550
1550
  <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
1551
1551
  <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
1552
- </symbol>`,HD=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
1552
+ </symbol>`,eD=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
1553
1553
  <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
1554
- </symbol>`,UD=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
1554
+ </symbol>`,tD=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
1555
1555
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
1556
1556
  <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
1557
- </symbol>`,WD=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
1557
+ </symbol>`,nD=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
1558
1558
  <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
1559
- </symbol>`,GD=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
1559
+ </symbol>`,rD=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
1560
1560
  <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
1561
1561
  <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
1562
- </symbol>`,KD=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
1562
+ </symbol>`,iD=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
1563
1563
  <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
1564
1564
  <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
1565
1565
  <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
1566
- </symbol>`,qD=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
1566
+ </symbol>`,aD=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
1567
1567
  <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
1568
- </symbol>`,JD=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
1568
+ </symbol>`,oD=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
1569
1569
  <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
1570
- </symbol>`,YD=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
1570
+ </symbol>`,sD=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
1571
1571
  <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
1572
- </symbol>`,XD=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
1572
+ </symbol>`,cD=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
1573
1573
  <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
1574
- </symbol>`,ZD=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
1574
+ </symbol>`,lD=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
1575
1575
  <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
1576
1576
  <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
1577
- </symbol>`,QD=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
1577
+ </symbol>`,uD=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
1578
1578
  <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
1579
1579
  <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
1580
1580
  <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
1581
- </symbol>`,$D=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
1581
+ </symbol>`,dD=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
1582
1582
  <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
1583
1583
  <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
1584
- </symbol>`,eO=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
1584
+ </symbol>`,fD=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
1585
1585
  <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
1586
1586
  <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
1587
- </symbol>`,tO=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
1587
+ </symbol>`,pD=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
1588
1588
  <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
1589
1589
  <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
1590
- </symbol>`,nO=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
1590
+ </symbol>`,mD=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
1591
1591
  <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
1592
- </symbol>`,rO=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
1592
+ </symbol>`,hD=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
1593
1593
  <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
1594
- </symbol>`,iO=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
1594
+ </symbol>`,gD=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
1595
1595
  <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
1596
- </symbol>`,aO=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
1596
+ </symbol>`,_D=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
1597
1597
  <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
1598
- </symbol>`,oO=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
1598
+ </symbol>`,vD=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
1599
1599
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
1600
1600
  <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
1601
- </symbol>`,sO=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
1601
+ </symbol>`,yD=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
1602
1602
  <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
1603
1603
  <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
1604
- </symbol>`,cO=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
1604
+ </symbol>`,bD=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
1605
1605
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
1606
1606
  <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
1607
- </symbol>`,lO=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
1607
+ </symbol>`,xD=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
1608
1608
  <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
1609
- </symbol>`,uO=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
1609
+ </symbol>`,SD=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
1610
1610
  <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
1611
- </symbol>`,dO=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
1611
+ </symbol>`,CD=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
1612
1612
  <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
1613
1613
  <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
1614
- </symbol>`,fO=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
1614
+ </symbol>`,wD=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
1615
1615
  <defs>
1616
1616
  <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
1617
1617
  <stop stop-color="currentColor"/>
@@ -1621,82 +1621,82 @@ diff --git`)}function g_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
1621
1621
  <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
1622
1622
  <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
1623
1623
  <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
1624
- </symbol>`,pO=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
1624
+ </symbol>`,TD=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
1625
1625
  <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
1626
1626
  <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
1627
- </symbol>`,mO=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
1627
+ </symbol>`,ED=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
1628
1628
  <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
1629
- </symbol>`,hO=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
1629
+ </symbol>`,DD=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
1630
1630
  <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
1631
- </symbol>`,gO=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
1631
+ </symbol>`,OD=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
1632
1632
  <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
1633
1633
  <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
1634
1634
  <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
1635
1635
  <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
1636
- </symbol>`,_O=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
1636
+ </symbol>`,kD=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
1637
1637
  <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
1638
1638
  <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
1639
- </symbol>`,vO=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
1639
+ </symbol>`,AD=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
1640
1640
  <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
1641
1641
  <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
1642
- </symbol>`,yO=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
1642
+ </symbol>`,jD=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
1643
1643
  <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
1644
- </symbol>`,bO=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
1644
+ </symbol>`,MD=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
1645
1645
  <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
1646
- </symbol>`,xO=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
1646
+ </symbol>`,ND=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
1647
1647
  <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
1648
- </symbol>`,SO=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
1648
+ </symbol>`,PD=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
1649
1649
  <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
1650
1650
  <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
1651
- </symbol>`,CO=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
1651
+ </symbol>`,FD=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
1652
1652
  <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
1653
- </symbol>`,wO=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
1653
+ </symbol>`,ID=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
1654
1654
  <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
1655
1655
  <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
1656
- </symbol>`,TO=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
1656
+ </symbol>`,LD=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
1657
1657
  <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
1658
1658
  <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
1659
- </symbol>`,EO=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
1659
+ </symbol>`,RD=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
1660
1660
  <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
1661
- </symbol>`,DO=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
1661
+ </symbol>`,zD=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
1662
1662
  <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
1663
1663
  <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
1664
- </symbol>`,OO=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
1664
+ </symbol>`,BD=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
1665
1665
  <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
1666
- </symbol>`,kO=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
1666
+ </symbol>`,VD=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
1667
1667
  <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
1668
- </symbol>`,AO=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
1668
+ </symbol>`,HD=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
1669
1669
  <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
1670
1670
  <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
1671
- </symbol>`,jO=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
1671
+ </symbol>`,UD=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
1672
1672
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
1673
1673
  <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
1674
- </symbol>`,MO=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
1674
+ </symbol>`,WD=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
1675
1675
  <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
1676
- </symbol>`,NO=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
1676
+ </symbol>`,GD=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
1677
1677
  <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
1678
1678
  <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
1679
1679
  <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
1680
- </symbol>`,PO=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
1680
+ </symbol>`,KD=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
1681
1681
  <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
1682
1682
  <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
1683
- </symbol>`,FO=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
1683
+ </symbol>`,qD=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
1684
1684
  <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
1685
1685
  <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
1686
1686
  <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
1687
- </symbol>`,IO=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
1687
+ </symbol>`,JD=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
1688
1688
  <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
1689
1689
  <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
1690
- </symbol>`,LO=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
1690
+ </symbol>`,YD=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
1691
1691
  <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
1692
- </symbol>`,RO=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
1692
+ </symbol>`,XD=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
1693
1693
  <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
1694
1694
  <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
1695
- </symbol>`,zO=[UD,JD,XD,ZD,QD,$D,nO,rO,iO,oO,sO,cO,lO,uO,dO,_O,yO,bO,EO,DO,AO,jO,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
1695
+ </symbol>`,ZD=[tD,oD,cD,lD,uD,dD,mD,hD,gD,vD,yD,bD,xD,SD,CD,kD,jD,MD,RD,zD,HD,UD,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
1696
1696
  <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
1697
1697
  <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
1698
- </symbol>`],BO=[VD,HD,WD,GD,KD,qD,YD,eO,tO,aO,fO,pO,mO,hO,gO,vO,xO,SO,CO,wO,TO,OO,kO,MO,NO,PO,FO,IO,LO,RO];function VO(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
1699
- `)}\n</svg>`)}var HO=VO(BD,zO),UO={minimal:BD,standard:HO,complete:VO(HO,BO)},WO={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},GO={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},KO={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},qO=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),JO=new Set([`complete`]);function YO(e){return UO[e===`none`?`minimal`:e]}function XO(e){return`file-tree-builtin-${e}`}function ZO(e){return e!==`none`&&JO.has(e)}function QO(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=WO[t.toLowerCase()];if(i!=null&&(r||qO.has(i)))return i;for(let e of n){if(r){let t=KO[e];if(t!=null)return t}let t=GO[e];if(t!=null&&(r||qO.has(t)))return t}return`default`}var $O=`file-tree-container`,ek=`data-file-tree-style`,tk=`data-file-tree-unsafe-css`,nk=`data-file-tree-scrollbar-measure`,rk=`data-file-tree-scrollbar-gutter-measured`,ik=`--trees-scrollbar-gutter-measured`,ak=`header`,ok=`context-menu`,sk=`context-menu-trigger`;function ck(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function lk(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(ck(e)?`none`:`complete`),colored:e.colored??!0}}var uk=e=>e.trim().toLowerCase(),dk=e=>e.split(`/`).at(-1)??e,fk=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function pk(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function mk(e){let t=lk(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(uk(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=dk(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return pk(l,e);for(let[t,n]of a)if(c.includes(t))return pk(n,e);let u=fk(s);for(let t of u){let n=i.get(t);if(n!=null)return pk(n,e)}let d=QO(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return pk(t,e)}return{name:XO(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:pk(s,e)}}}var hk=5,gk=32,_k=128;function vk(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function yk(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function bk(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function xk(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Sk(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Ck(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function wk(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Ok(e,t)}function Tk(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=xk(e).get(t);if(i===void 0)return;let a=i>>hk;e.childVisibleChunkSums[a]+=r}function Ek(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=kk(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=gk}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Dk(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>hk;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<hk}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function Ok(e,t){if(t.childIds.length<_k){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/gk),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>hk]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function kk(e,t,n,r){let i=Math.min(t.childIds.length,n+gk),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Ak=7,jk=3,Mk=8,Nk=4;function Pk(e,t,n=0){return e<<Nk|n<<jk|t}function Fk(e){return e.depthAndFlags>>>Nk}function Ik(e){return(e.depthAndFlags&Mk)>>jk}function J(e){return(e.depthAndFlags&Mk)!==0}function Lk(e){return e.depthAndFlags&Ak}function Rk(e,t){return(Lk(e)&t)!==0}function zk(e,t){e.depthAndFlags|=t}function Bk(e,t){e.depthAndFlags=Pk(t,Lk(e),Ik(e))}var Vk=Symbol(`benchmarkInstrumentation`);function Hk(e,t){return t==null||Object.defineProperty(e,Vk,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Uk(e){return e==null?null:e[Vk]??null}function Y(e,t,n){return e==null?n():e.measurePhase(t,n)}function Wk(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function Gk(e){return e>=48&&e<=57}function Kk(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Gk(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Gk(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function qk(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Kk(t)}}function Jk(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Yk(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Jk(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Xk(e,t,n){let r=Yk(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Zk(e,t){return Xk(e,t,qk)}function Qk(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function $k(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=Qk(e,r);return a===Qk(t,r)?Zk(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function eA(e,t){return $k(e,t)}function tA(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=qk(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=Qk(e,n);return o===Qk(t,n)?Xk(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function nA(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=qk(r);return e.sortKeyById[t]=i,i}function rA(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function iA(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function aA(e){let{hasTrailingSlash:t,segments:n}=iA(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function oA(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=iA(e);return{requiresDirectory:t,segments:n}}function sA(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[qk(``)]}}function cA(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function lA(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var uA=Symbol(`pathStorePreparedInputKind`);function dA(e,t){return e[uA]=t,e}function fA(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function pA(e,t,n){return n==="default"?eA(e,t):n(fA(e),fA(t))}function mA(){return{depthAndFlags:Pk(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function hA(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function gA(e){return e.isDirectory?e.segments.length:e.segments.length-1}function _A(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function vA(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function yA(e,t={}){return TA(e,t).map(e=>e.path)}function bA(e,t={}){let n=TA(e,t);return dA({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function xA(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return dA({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function SA(e){let t=e,n=t.preparedPaths;if(t[uA]===`prepared`&&n!=null)return n;if(!_A(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function CA(e){let t=e;return t[uA]===`presorted`&&t.presortedPaths!=null||vA(t.presortedPaths)?t.presortedPaths:null}function wA(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function TA(e,t={}){let n=rA(t),r=Uk(t);Wk(r,`workload.inputFiles`,e.length);let i=Y(r,`store.preparePathEntries.parse`,()=>e.map(e=>aA(e)));return Y(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>pA(e,t,n.sort))),i}var EA=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[mA()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=sA();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Uk(e),this.options=rA(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,vk())}appendPaths(e){return Y(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>aA(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Y(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Y(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null){if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Pk(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Pk(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Pk(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=aA(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null){if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Pk(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Pk(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=aA(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Y(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Y(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?tA(this.lastPreparedPath,e,this.segmentSortKeyCache):pA(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=gA(e),i=n==null?0:gA(n),a=n==null?0:hA(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=cA(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Pk(Fk(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Sk(i,s),s}createFileChildUnchecked(e,t){let n=cA(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Pk(Fk(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Sk(r,a),a}getOrCreateDirectoryChild(e,t){let n=cA(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!J(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Pk(Fk(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Sk(r,a),this.directories.set(a,vk()),a}createDirectoryChild(e,t){let n=cA(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Pk(Fk(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Sk(r,a),this.directories.set(a,vk()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!J(n))throw Error(`Path is not a directory: "${t}"`);if(Rk(n,1))throw Error(`Duplicate path: "${t}"`);zk(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,yk());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(J(a)){let t=yk();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;J(n)&&this.directories.set(t,vk());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Sk(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!J(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return wk(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function DA(e,t=`closed`,n=null){let r=kA(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function OA(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function kA(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function AA(e,t){return Rk(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&Fk(t)<=e.defaultExpansion}function jA(e,t,n=e.snapshot.nodes[t]){return n==null||!J(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:AA(e,n)}function MA(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!J(r))return;let i=AA(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function NA(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function PA(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function FA(e,t){let n=NA(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function IA(e,t){let n=NA(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function LA(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function RA(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function zA(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function BA(e,t){e.directoryLoadInfoById.delete(t)}function VA(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function HA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function UA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function WA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function GA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function KA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function qA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function JA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function YA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function XA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function ZA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function QA(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function $A(e,t,n){return{...n,visibleCountDelta:uj(e)-t}}function ej(e,t){let n=uj(e),r=OA();e.transactionStack.push(r);try{t()}catch(t){throw rj(e,r,!1),t}rj(e,r,!0,uj(e)-n)}function tj(e,t){let n=e.instrumentation;if(n==null){nj(e,t);return}Y(n,`store.events.record`,()=>nj(e,t))}function nj(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){cj(e,t);return}n.events.push(t),sj(n,t)}function rj(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?oj(i,t):Y(n,`store.events.batch.merge`,()=>oj(i,t));return}let a=ij(t,r),o=e.instrumentation;if(o==null){cj(e,a);return}Y(o,`store.events.batch.commit`,()=>cj(e,a))}function ij(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function aj(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function oj(e,t){for(let n of t.events)e.events.push(n);aj(e,t)}function sj(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function cj(e,t){let n=e.instrumentation;if(n==null){lj(e,t);return}Y(n,`store.events.emit`,()=>lj(e,t))}function lj(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function uj(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function dj(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!J(n)||Rk(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!J(a)?null:i}function fj(e,t){let n=t;for(;;){let t=dj(e,n);if(t==null)return n;n=t}}function pj(e,t){let n=[t],r=t;for(;;){let t=dj(e,r);if(t==null)return n;n.push(t),r=t}}function mj(e,t){let n=t==null?e.snapshot.rootId:wj(e,t);return n==null?[]:Dj(e,n)}function hj(e,t){let n=aA(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Hj(e,Vj(e,r)),{createdNodeIds:a,directoryId:o}=Oj(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(Rk(n,1))throw Error(`Path already exists: "${t}"`);zk(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Aj(e,o,n.basename),s.add(c);xj(e,o);let l=Hj(e,o);return HA({affectedAncestorIds:Cj(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Uj(i,l)})}function gj(e,t,n){let r=wj(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(Rk(i,2))throw Error(`The root node cannot be removed`);if(J(i)&&Ej(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Hj(e,a),s=zj(e,r);Nj(e,a,r,i.nameId),Bj(e,a),xj(e,a);let c=Hj(e,a);return UA({affectedAncestorIds:Cj(e,a),affectedNodeIds:s,path:t,projectionChanged:Uj(o,c),recursive:n.recursive===!0})}function _j(e,t,n,r){let i=wj(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(Rk(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Lj(e,i,n),c=Hj(e,a.parentId),l=Hj(e,s.parentId),u=lA(e.snapshot.segmentTable,a.nameId),d=cA(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(J(a)&&qj(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=bk(e.snapshot.nodes,Ej(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Rj(e,p,o,Ik(a))===`skip`)return null;let m=a.parentId;Nj(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Kj(e,i),Mj(e,s.parentId,i),Bj(e,m),e.pathCacheVersion++,xj(e,m),s.parentId!==m&&xj(e,s.parentId);let h=Hj(e,m),g=Hj(e,s.parentId);return WA({affectedAncestorIds:[...new Set([...Cj(e,m),...Cj(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Wj([c,l],[h,g]),to:bj(e,i)})}function vj(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function yj(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function bj(e,t){let n=X(e,t),r=vj(e,t);if(r!=null)return r;if(Rk(n,2))return yj(e,t,``);let i=bj(e,n.parentId),a=lA(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return yj(e,t,J(n)?`${o}/`:o)}function xj(e,t){let n=e.instrumentation;if(n==null){Yj(e,t);return}Y(n,`store.recomputeCountsUpwardFrom`,()=>Yj(e,t))}function Sj(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!J(o)){Jj(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Jj(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Cj(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function wj(e,t){if(t.length===0)return e.snapshot.rootId;let n=oA(t);return Tj(e,n.segments,n.requiresDirectory)}function Tj(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=Ej(e,r),a=bk(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!J(i)?null:r}function Ej(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Rk(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Dj(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Rk(n,4))return[];if(!J(n))return[bj(e,t)];if(Ej(e,t).childIds.length===0)return Rk(n,1)&&!Rk(n,2)?[bj(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Rk(n,4)){i.pop();continue}if(!J(n)){r.push(bj(e,t.nodeId)),i.pop();continue}let a=Ej(e,t.nodeId);if(a.childIds.length===0){Rk(n,1)&&!Rk(n,2)&&r.push(bj(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function Oj(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=cA(e.snapshot.segmentTable,i),a=Ej(e,r),o=bk(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!J(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=kj(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function kj(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Pk(Fk(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,vk()),Mj(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Aj(e,t,n){let r=cA(e.snapshot.segmentTable,n),i=Ej(e,t);if(bk(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Zj(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Pk(Fk(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Mj(e,t,o),e.activeNodeCount++,o}function jj(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Pj(e,n,o)<0?i=a:r=a+1}return r}function Mj(e,t,n){let r=Ej(e,t),i=X(e,n);bk(e.snapshot.nodes,r).set(i.nameId,n),Tk(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=jj(e,r,n);r.childIds.splice(a,0,n),Ck(r,a),Ok(e.snapshot.nodes,r)}function Nj(e,t,n,r){let i=Ej(e,t),a=xk(i),o=a.get(n)??-1;bk(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Tk(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Ck(i,o),Ok(e.snapshot.nodes,i))}function Pj(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Fj(e,t,n):r(Ij(e,t),Ij(e,n))}function Fj(e,t,n){let r=X(e,t),i=X(e,n),a=J(r);if(a!==J(i))return a?-1:1;let o=Yk(nA(e.snapshot.segmentTable,r.nameId),nA(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=lA(e.snapshot.segmentTable,r.nameId),c=lA(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Ij(e,t){let n=X(e,t),r=bj(e,t),i=J(n),a=i?r.slice(0,-1):r;return{basename:lA(e.snapshot.segmentTable,n.nameId),depth:Fk(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Lj(e,t,n){let r=X(e,t),i=wj(e,n);if(i!=null){let t=X(e,i);if(J(t))return{basename:lA(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=oA(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=oA(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:Tj(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Rj(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${bj(e,t)}"`);let i=X(e,t);if(Ik(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(J(i)&&Ej(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return zj(e,t),Nj(e,a,t,o),Bj(e,a),xj(e,a),`handled`}function zj(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!J(i)){J(i)&&e.snapshot.directories.delete(t.nodeId),zk(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),BA(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=Ej(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Bj(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||Rk(t,2)||Ej(e,n).childIds.length>0)return;zk(t,1),n=t.parentId===n?null:t.parentId}}function Vj(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=bk(e.snapshot.nodes,Ej(e,n)).get(t);if(i==null||!J(X(e,i)))break;n=i}return n}function Hj(e,t){let n=Gj(e,t);if(n==null)return null;let r=fj(e,n),i=X(e,r),a=n===r?null:pj(e,n).map(t=>bj(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:Ej(e,r).childIds.length>0,path:bj(e,r),terminalKind:Ik(i)})}function Uj(e,t){return Wj([e],[t])}function Wj(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Gj(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||Rk(t,2))return null;if(!jA(e,n,t))return n;n=t.parentId}return null}function Kj(e,t){let n=X(e,t);if(Bk(n,(t===e.snapshot.rootId?-1:Fk(X(e,n.parentId)))+1),!J(n))return;let r=Ej(e,t);for(let t of r.childIds)Kj(e,t)}function qj(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Jj(e,t,n=X(e,t),r=!1){let i=e.instrumentation;if(i==null){Xj(e,t,n,r);return}Y(i,`store.recomputeNodeCounts`,()=>Xj(e,t,n,r))}function Yj(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Jj(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Tk(Ej(e,s),n,a,o),n=s}}function Xj(e,t,n,r){if(!J(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=Ej(e,t);if(r){let t=e.instrumentation;t==null?wk(e.snapshot.nodes,i):Y(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>wk(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Rk(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=dj(e,t)==null?jA(e,t,n)?1+o:1:o}function Zj(e,t,n){let r=bj(e,t);return r.length===0?n:`${r}${n}`}function Qj(e){return e!=null&&!Rk(e,4)}function $j(e,t){let n=e.snapshot.nodes[t];return!Qj(n)||!J(n)||Rk(n,2)?null:n}function eM(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Qj(e.snapshot.nodes[n])&&(t+=1);return t}function tM(e){return Math.max(0,e.valueById.length-1)}function nM(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:eM(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:tM(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function rM(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function iM(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)$j(e,n)!=null&&t.push(bj(e,n));for(let t of e.expandedDirectoryIds)$j(e,t)!=null&&n.push(bj(e,t));return{collapsedPaths:t,expandedPaths:n}}function aM(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)$j(e,n)!=null&&PA(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:bj(e,n)});return t}function oM(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=wj(e,n);t!=null&&MA(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=wj(e,n);t!=null&&MA(e,t,!1,X(e,t))}}function sM(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=wj(e,n.path);t!=null&&$j(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function cM(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function lM(e){let t=e.snapshot.segmentTable,n=sA();for(let r of e.snapshot.nodes)if(Qj(r)){if(Rk(r,2)){r.nameId=0;continue}r.nameId=cA(n,lA(t,r.nameId))}e.snapshot.segmentTable=n}function uM(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Qj(r)||!J(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Qj(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),wk(e.snapshot.nodes,n)}}function dM(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Qj(n))break;--t}e.snapshot.nodes.length=t+1}function fM(e){let t=iM(e),n=aM(e);Y(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>cM(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>lM(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>uM(e)),Y(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>dM(e)),Y(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>oM(e,t)),Y(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>sM(e,n)),Y(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Sj(e,e.snapshot.rootId))}function pM(e){let t=iM(e),n=aM(e),r=Y(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>mj(e)),i=Hk({...e.snapshot.options},e.instrumentation),a=Y(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new EA(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Y(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>oM(e,t)),Y(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>sM(e,n)),Y(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Sj(e,e.snapshot.rootId))}function mM(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function hM(e,t){let n=nM(e);t===`stable`?Y(e.instrumentation,`store.cleanup.stable`,()=>fM(e)):Y(e.instrumentation,`store.cleanup.aggressive`,()=>pM(e));let r=nM(e);return rM(t,t===`stable`,n,r)}var gM=64;function _M(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function vM(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function yM(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function bM(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:zM(e,t.cursor),setSize:t.setSize,subtreeEndIndex:yM(e,t.cursor,t.index,n)}}function xM(e,t,n,r,i,a){let o=Ej(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Ek(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return SM(e,u,l,r+c,i+1,s,o.childIds.length,a)}function SM(e,t,n,r,i,a,o,s){if(!J(X(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=NM(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!J(l)||!jA(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return xM(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function CM(e,t){let n=vM(e);if(t<0||t>=n)return null;let r=xM(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>bj(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=bM(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:zM(e,r.cursor),setSize:r.setSize,subtreeEndIndex:yM(e,r.cursor,r.index,n)}}function wM(e,t,n){let r=e.instrumentation,i=vM(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return RM(e,o+1);let t=[],n=AM(e,a);for(let r=a;r<=o&&n!=null;r++){let r=zM(e,n);t.push(r),n=FM(e,n)}return t}let s=[],c=0,l=0,u=Y(r,`store.getVisibleSlice.selectFirstRow`,()=>AM(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Y(r,`store.getVisibleSlice.materializeRow`,()=>zM(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Y(r,`store.getVisibleSlice.advanceCursor`,()=>FM(e,u))}return Wk(r,`workload.visibleRowsRead`,s.length),Wk(r,`workload.flattenedRowsRead`,c),Wk(r,`workload.flattenedSegmentsRead`,l),s}function TM(e,t=vM(e)){let n=e.instrumentation;return n==null?LM(e,t):Y(n,`store.getVisibleTreeProjection`,()=>LM(e,t))}function EM(e){return IM(TM(e))}function DM(e,t){let n=wj(e,t);if(n==null||n===e.snapshot.rootId||J(X(e,n))&&fj(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=Ej(e,t),s=xk(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Dk(a,n,s),t!==o){let n=X(e,t),a=dj(e,t);if(!jA(e,t,n)&&a!==i)return null;fj(e,t)===t&&(r+=1)}i=t}return r}function OM(e,t){let n=wj(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return jA(e,n,r)?null:(MA(e,n,!0,r),xj(e,n),GA({affectedAncestorIds:Cj(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function kM(e,t){let n=wj(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return jA(e,n,r)?(MA(e,n,!1,r),xj(e,n),KA({affectedAncestorIds:Cj(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function AM(e,t){return t<0||t>=vM(e)?null:jM(e,e.snapshot.rootId,t,-1)}function jM(e,t,n,r){let i=Ej(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Ek(e.snapshot.nodes,i,n):Y(a,`store.getVisibleSlice.selectChildIndex`,()=>Ek(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return MM(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function MM(e,t,n,r){if(!J(X(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=NM(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!J(a)||!jA(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return jM(e,i.terminalNodeId,n-1,i.visibleDepth)}function NM(e,t,n){return J(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:fj(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Y(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>fj(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function PM(e,t){let n=X(e,t);if(!J(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||dj(e,r)!==t}function FM(e,t){let n=X(e,t.terminalNodeId);if(J(n)){let r=Ej(e,t.terminalNodeId);if(jA(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:MM(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=Ej(e,n),o=xk(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return MM(e,s,0,i);PM(e,r)&&i--,r=n}}function IM(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function LM(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(gM);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=_M(o,y);let x,S=_;if(J(v))S=f?fj(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:bj(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&J(C)&&jA(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function RM(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!J(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:bj(e,f)};continue}let h=l?fj(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=zM(e,g);let _=i[h];_!=null&&J(_)&&jA(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function zM(e,t){let n=X(e,t.terminalNodeId),r=J(n)?BM(e,t):null,i=bj(e,t.terminalNodeId),a=lA(e.snapshot.segmentTable,n.nameId),o=J(n)&&Ej(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?pj(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:lA(e.snapshot.segmentTable,r.nameId),nodeId:n,path:bj(e,n)}}):Y(c,`store.getVisibleSlice.flatten.collectSegments`,()=>pj(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:lA(e.snapshot.segmentTable,r.nameId),nodeId:n,path:bj(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:J(n)&&jA(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:J(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function BM(e,t){if(t.headNodeId===t.terminalNodeId)return PA(e,t.terminalNodeId);let n=pj(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=PA(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var VM=8;function HM(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function UM(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&VM)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&VM)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function WM(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!J(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&Ok(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&J(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,Ok(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function GM(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=HM(e.snapshot);UM(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&Ok(n,i)}}function KM(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var qM=class e{#e;constructor(e={}){let t=Uk(e),n=Y(t,`store.builder.create`,()=>new EA(e));if(e.preparedInput!=null){let t=CA(e.preparedInput);t==null?n.appendPreparedPaths(SA(e.preparedInput),!1):n.appendPresortedPaths(t,wA(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Y(t,`store.preparePathEntries`,()=>TA(r,e)))}let r=Y(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Y(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Y(t,`store.state.create`,()=>DA(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Y(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||KM(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Y(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?Y(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>GM(this.#e)):Y(t,`store.state.initializeOpenVisibleCounts`,()=>WM(this.#e)):Y(t,`store.state.recomputeCounts`,()=>Sj(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return yA(e,t)}static prepareInput(e,t={}){return bA(e,t)}static preparePresortedInput(e){return xA(e)}list(e){return Y(this.#e.instrumentation,`store.list`,()=>mj(this.#e,e))}add(e){Y(this.#e.instrumentation,`store.add`,()=>{let t=vM(this.#e);tj(this.#e,$A(this.#e,t,hj(this.#e,e)))})}remove(e,t={}){Y(this.#e.instrumentation,`store.remove`,()=>{let n=vM(this.#e);tj(this.#e,$A(this.#e,n,gj(this.#e,e,t)))})}move(e,t,n={}){Y(this.#e.instrumentation,`store.move`,()=>{let r=vM(this.#e),i=_j(this.#e,e,t,n);i!=null&&tj(this.#e,$A(this.#e,r,i))})}batch(e){ej(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision})}})}getVisibleCount(){return Y(this.#e.instrumentation,`store.getVisibleCount`,()=>vM(this.#e))}getVisibleSlice(e,t){return Y(this.#e.instrumentation,`store.getVisibleSlice`,()=>wM(this.#e,e,t))}getVisibleRowContext(e){return Y(this.#e.instrumentation,`store.getVisibleRowContext`,()=>CM(this.#e,e))}getVisibleTreeProjection(){return EM(this.#e)}getVisibleTreeProjectionData(e){return TM(this.#e,e)}getVisibleIndex(e){return Y(this.#e.instrumentation,`store.getVisibleIndex`,()=>DM(this.#e,e))}getPathInfo(e){return Y(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=wj(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:Fk(n),kind:J(n)?`directory`:`file`,path:bj(this.#e,t)}})}isExpanded(e){return Y(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return jA(this.#e,t,n)})}expand(e){Y(this.#e.instrumentation,`store.expand`,()=>{let t=vM(this.#e),n=OM(this.#e,e);n!=null&&tj(this.#e,$A(this.#e,t,n))})}collapse(e){Y(this.#e.instrumentation,`store.collapse`,()=>{let t=vM(this.#e),n=kM(this.#e,e);n!=null&&tj(this.#e,$A(this.#e,t,n))})}on(e,t){return VA(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return PA(this.#e,t)}markDirectoryUnloaded(e){Y(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(Ej(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=vM(this.#e);IA(this.#e,t),tj(this.#e,$A(this.#e,n,qA({affectedAncestorIds:Cj(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Y(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=vM(this.#e),r=FA(this.#e,t);return tj(this.#e,$A(this.#e,n,JA({affectedAncestorIds:Cj(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Y(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||PA(this.#e,n)!==`loading`||!RA(this.#e,n,e.attemptId))return!1;let r=bj(this.#e,n);this.validateChildPatch(r,t);let i=vM(this.#e),a=[];for(let e of t.operations){JM(r,e);let t=vM(this.#e);switch(e.type){case`add`:a.push($A(this.#e,t,hj(this.#e,e.path)));break;case`remove`:a.push($A(this.#e,t,gj(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=_j(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push($A(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return tj(this.#e,$A(this.#e,i,YA({affectedAncestorIds:Cj(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:bj(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Y(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=vM(this.#e),r=LA(this.#e,t,e.attemptId);return tj(this.#e,$A(this.#e,n,XA({affectedAncestorIds:Cj(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:bj(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Y(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=vM(this.#e),i=zA(this.#e,n,e.attemptId,t);return tj(this.#e,$A(this.#e,r,ZA({affectedAncestorIds:Cj(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:bj(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Y(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(mM(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=vM(this.#e),n=hM(this.#e,e.mode??`stable`);return tj(this.#e,$A(this.#e,t,QA({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=Ej(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??qk(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Yk(nA(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!J(X(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);jA(this.#e,n,i)||(MA(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=X(this.#e,e);if(!jA(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=wj(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!J(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!J(X(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=dj(this.#e,e);if(!jA(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function JM(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`)}}var YM={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function XM(e,t){if(typeof e==`number`)return{itemHeight:t??YM.default.itemHeight,factor:e};let n=YM[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var ZM=YM.default.itemHeight,QM=`@layer base {
1698
+ </symbol>`],QD=[$E,eD,nD,rD,iD,aD,sD,fD,pD,_D,wD,TD,ED,DD,OD,AD,ND,PD,FD,ID,LD,BD,VD,WD,GD,KD,qD,JD,YD,XD];function $D(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
1699
+ `)}\n</svg>`)}var eO=$D(QE,ZD),tO={minimal:QE,standard:eO,complete:$D(eO,QD)},nO={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},rO={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},iO={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},aO=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),oO=new Set([`complete`]);function sO(e){return tO[e===`none`?`minimal`:e]}function cO(e){return`file-tree-builtin-${e}`}function lO(e){return e!==`none`&&oO.has(e)}function uO(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=nO[t.toLowerCase()];if(i!=null&&(r||aO.has(i)))return i;for(let e of n){if(r){let t=iO[e];if(t!=null)return t}let t=rO[e];if(t!=null&&(r||aO.has(t)))return t}return`default`}var dO=`file-tree-container`,fO=`data-file-tree-style`,pO=`data-file-tree-unsafe-css`,mO=`data-file-tree-scrollbar-measure`,hO=`data-file-tree-scrollbar-gutter-measured`,gO=`--trees-scrollbar-gutter-measured`,_O=`header`,vO=`context-menu`,yO=`context-menu-trigger`;function bO(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function xO(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(bO(e)?`none`:`complete`),colored:e.colored??!0}}var SO=e=>e.trim().toLowerCase(),CO=e=>e.split(`/`).at(-1)??e,wO=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function TO(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function EO(e){let t=xO(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(SO(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=CO(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return TO(l,e);for(let[t,n]of a)if(c.includes(t))return TO(n,e);let u=wO(s);for(let t of u){let n=i.get(t);if(n!=null)return TO(n,e)}let d=uO(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return TO(t,e)}return{name:cO(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:TO(s,e)}}}var DO=5,OO=32,kO=128;function AO(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function jO(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function MO(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function NO(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function PO(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function FO(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function IO(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,BO(e,t)}function LO(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=NO(e).get(t);if(i===void 0)return;let a=i>>DO;e.childVisibleChunkSums[a]+=r}function RO(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=VO(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=OO}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function zO(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>DO;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<DO}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function BO(e,t){if(t.childIds.length<kO){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/OO),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>DO]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function VO(e,t,n,r){let i=Math.min(t.childIds.length,n+OO),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var HO=7,UO=3,WO=8,GO=4;function KO(e,t,n=0){return e<<GO|n<<UO|t}function qO(e){return e.depthAndFlags>>>GO}function JO(e){return(e.depthAndFlags&WO)>>UO}function J(e){return(e.depthAndFlags&WO)!==0}function YO(e){return e.depthAndFlags&HO}function XO(e,t){return(YO(e)&t)!==0}function ZO(e,t){e.depthAndFlags|=t}function QO(e,t){e.depthAndFlags=KO(t,YO(e),JO(e))}var $O=Symbol(`benchmarkInstrumentation`);function ek(e,t){return t==null||Object.defineProperty(e,$O,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function tk(e){return e==null?null:e[$O]??null}function Y(e,t,n){return e==null?n():e.measurePhase(t,n)}function nk(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function rk(e){return e>=48&&e<=57}function ik(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!rk(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&rk(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function ak(e){let t=e.toLowerCase();return{lowerValue:t,tokens:ik(t)}}function ok(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function sk(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=ok(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function ck(e,t,n){let r=sk(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function lk(e,t){return ck(e,t,ak)}function uk(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function dk(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=uk(e,r);return a===uk(t,r)?lk(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function fk(e,t){return dk(e,t)}function pk(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=ak(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=uk(e,n);return o===uk(t,n)?ck(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function mk(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=ak(r);return e.sortKeyById[t]=i,i}function hk(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function gk(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function _k(e){let{hasTrailingSlash:t,segments:n}=gk(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function vk(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=gk(e);return{requiresDirectory:t,segments:n}}function yk(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[ak(``)]}}function bk(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function xk(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Sk=Symbol(`pathStorePreparedInputKind`);function Ck(e,t){return e[Sk]=t,e}function wk(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Tk(e,t,n){return n==="default"?fk(e,t):n(wk(e),wk(t))}function Ek(){return{depthAndFlags:KO(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Dk(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function Ok(e){return e.isDirectory?e.segments.length:e.segments.length-1}function kk(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function Ak(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function jk(e,t={}){return Lk(e,t).map(e=>e.path)}function Mk(e,t={}){let n=Lk(e,t);return Ck({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function Nk(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return Ck({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function Pk(e){let t=e,n=t.preparedPaths;if(t[Sk]===`prepared`&&n!=null)return n;if(!kk(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function Fk(e){let t=e;return t[Sk]===`presorted`&&t.presortedPaths!=null||Ak(t.presortedPaths)?t.presortedPaths:null}function Ik(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function Lk(e,t={}){let n=hk(t),r=tk(t);nk(r,`workload.inputFiles`,e.length);let i=Y(r,`store.preparePathEntries.parse`,()=>e.map(e=>_k(e)));return Y(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>Tk(e,t,n.sort))),i}var Rk=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Ek()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=yk();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=tk(e),this.options=hk(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,AO())}appendPaths(e){return Y(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>_k(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Y(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Y(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null){if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:KO(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:KO(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:KO(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=_k(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null){if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:KO(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:KO(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=_k(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Y(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Y(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?pk(this.lastPreparedPath,e,this.segmentSortKeyCache):Tk(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=Ok(e),i=n==null?0:Ok(n),a=n==null?0:Dk(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=bk(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:KO(qO(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),PO(i,s),s}createFileChildUnchecked(e,t){let n=bk(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:KO(qO(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),PO(r,a),a}getOrCreateDirectoryChild(e,t){let n=bk(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!J(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:KO(qO(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),PO(r,a),this.directories.set(a,AO()),a}createDirectoryChild(e,t){let n=bk(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:KO(qO(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),PO(r,a),this.directories.set(a,AO()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!J(n))throw Error(`Path is not a directory: "${t}"`);if(XO(n,1))throw Error(`Duplicate path: "${t}"`);ZO(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,jO());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(J(a)){let t=jO();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;J(n)&&this.directories.set(t,AO());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),PO(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!J(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return IO(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function zk(e,t=`closed`,n=null){let r=Vk(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function Bk(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Vk(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function Hk(e,t){return XO(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&qO(t)<=e.defaultExpansion}function Uk(e,t,n=e.snapshot.nodes[t]){return n==null||!J(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Hk(e,n)}function Wk(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!J(r))return;let i=Hk(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function Gk(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function Kk(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function qk(e,t){let n=Gk(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function Jk(e,t){let n=Gk(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Yk(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Xk(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Zk(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Qk(e,t){e.directoryLoadInfoById.delete(t)}function $k(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function eA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function tA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function nA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function rA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function iA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function aA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function oA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function sA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function cA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function lA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function uA(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function dA(e,t,n){return{...n,visibleCountDelta:SA(e)-t}}function fA(e,t){let n=SA(e),r=Bk();e.transactionStack.push(r);try{t()}catch(t){throw hA(e,r,!1),t}hA(e,r,!0,SA(e)-n)}function pA(e,t){let n=e.instrumentation;if(n==null){mA(e,t);return}Y(n,`store.events.record`,()=>mA(e,t))}function mA(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){bA(e,t);return}n.events.push(t),yA(n,t)}function hA(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?vA(i,t):Y(n,`store.events.batch.merge`,()=>vA(i,t));return}let a=gA(t,r),o=e.instrumentation;if(o==null){bA(e,a);return}Y(o,`store.events.batch.commit`,()=>bA(e,a))}function gA(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function _A(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function vA(e,t){for(let n of t.events)e.events.push(n);_A(e,t)}function yA(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function bA(e,t){let n=e.instrumentation;if(n==null){xA(e,t);return}Y(n,`store.events.emit`,()=>xA(e,t))}function xA(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function SA(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function CA(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!J(n)||XO(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!J(a)?null:i}function wA(e,t){let n=t;for(;;){let t=CA(e,n);if(t==null)return n;n=t}}function TA(e,t){let n=[t],r=t;for(;;){let t=CA(e,r);if(t==null)return n;n.push(t),r=t}}function EA(e,t){let n=t==null?e.snapshot.rootId:IA(e,t);return n==null?[]:zA(e,n)}function DA(e,t){let n=_k(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=ej(e,$A(e,r)),{createdNodeIds:a,directoryId:o}=BA(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(XO(n,1))throw Error(`Path already exists: "${t}"`);ZO(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=HA(e,o,n.basename),s.add(c);NA(e,o);let l=ej(e,o);return eA({affectedAncestorIds:FA(e,c),affectedNodeIds:[...s],path:t,projectionChanged:tj(i,l)})}function OA(e,t,n){let r=IA(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(XO(i,2))throw Error(`The root node cannot be removed`);if(J(i)&&RA(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=ej(e,a),s=ZA(e,r);GA(e,a,r,i.nameId),QA(e,a),NA(e,a);let c=ej(e,a);return tA({affectedAncestorIds:FA(e,a),affectedNodeIds:s,path:t,projectionChanged:tj(o,c),recursive:n.recursive===!0})}function kA(e,t,n,r){let i=IA(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(XO(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=YA(e,i,n),c=ej(e,a.parentId),l=ej(e,s.parentId),u=xk(e.snapshot.segmentTable,a.nameId),d=bk(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(J(a)&&aj(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=MO(e.snapshot.nodes,RA(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&XA(e,p,o,JO(a))===`skip`)return null;let m=a.parentId;GA(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),ij(e,i),WA(e,s.parentId,i),QA(e,m),e.pathCacheVersion++,NA(e,m),s.parentId!==m&&NA(e,s.parentId);let h=ej(e,m),g=ej(e,s.parentId);return nA({affectedAncestorIds:[...new Set([...FA(e,m),...FA(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:nj([c,l],[h,g]),to:MA(e,i)})}function AA(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function jA(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function MA(e,t){let n=X(e,t),r=AA(e,t);if(r!=null)return r;if(XO(n,2))return jA(e,t,``);let i=MA(e,n.parentId),a=xk(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return jA(e,t,J(n)?`${o}/`:o)}function NA(e,t){let n=e.instrumentation;if(n==null){sj(e,t);return}Y(n,`store.recomputeCountsUpwardFrom`,()=>sj(e,t))}function PA(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!J(o)){oj(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){oj(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function FA(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function IA(e,t){if(t.length===0)return e.snapshot.rootId;let n=vk(t);return LA(e,n.segments,n.requiresDirectory)}function LA(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=RA(e,r),a=MO(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!J(i)?null:r}function RA(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||XO(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function zA(e,t){let n=e.snapshot.nodes[t];if(n===void 0||XO(n,4))return[];if(!J(n))return[MA(e,t)];if(RA(e,t).childIds.length===0)return XO(n,1)&&!XO(n,2)?[MA(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||XO(n,4)){i.pop();continue}if(!J(n)){r.push(MA(e,t.nodeId)),i.pop();continue}let a=RA(e,t.nodeId);if(a.childIds.length===0){XO(n,1)&&!XO(n,2)&&r.push(MA(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function BA(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=bk(e.snapshot.segmentTable,i),a=RA(e,r),o=MO(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!J(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=VA(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function VA(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:KO(qO(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,AO()),WA(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function HA(e,t,n){let r=bk(e.snapshot.segmentTable,n),i=RA(e,t);if(MO(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${lj(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:KO(qO(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),WA(e,t,o),e.activeNodeCount++,o}function UA(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}KA(e,n,o)<0?i=a:r=a+1}return r}function WA(e,t,n){let r=RA(e,t),i=X(e,n);MO(e.snapshot.nodes,r).set(i.nameId,n),LO(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=UA(e,r,n);r.childIds.splice(a,0,n),FO(r,a),BO(e.snapshot.nodes,r)}function GA(e,t,n,r){let i=RA(e,t),a=NO(i),o=a.get(n)??-1;MO(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&LO(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),FO(i,o),BO(e.snapshot.nodes,i))}function KA(e,t,n){let r=e.snapshot.options.sort;return r==="default"?qA(e,t,n):r(JA(e,t),JA(e,n))}function qA(e,t,n){let r=X(e,t),i=X(e,n),a=J(r);if(a!==J(i))return a?-1:1;let o=sk(mk(e.snapshot.segmentTable,r.nameId),mk(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=xk(e.snapshot.segmentTable,r.nameId),c=xk(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function JA(e,t){let n=X(e,t),r=MA(e,t),i=J(n),a=i?r.slice(0,-1):r;return{basename:xk(e.snapshot.segmentTable,n.nameId),depth:qO(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function YA(e,t,n){let r=X(e,t),i=IA(e,n);if(i!=null){let t=X(e,i);if(J(t))return{basename:xk(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=vk(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=vk(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:LA(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function XA(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${MA(e,t)}"`);let i=X(e,t);if(JO(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(J(i)&&RA(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return ZA(e,t),GA(e,a,t,o),QA(e,a),NA(e,a),`handled`}function ZA(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!J(i)){J(i)&&e.snapshot.directories.delete(t.nodeId),ZO(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Qk(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=RA(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function QA(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||XO(t,2)||RA(e,n).childIds.length>0)return;ZO(t,1),n=t.parentId===n?null:t.parentId}}function $A(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=MO(e.snapshot.nodes,RA(e,n)).get(t);if(i==null||!J(X(e,i)))break;n=i}return n}function ej(e,t){let n=rj(e,t);if(n==null)return null;let r=wA(e,n),i=X(e,r),a=n===r?null:TA(e,n).map(t=>MA(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:RA(e,r).childIds.length>0,path:MA(e,r),terminalKind:JO(i)})}function tj(e,t){return nj([e],[t])}function nj(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function rj(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||XO(t,2))return null;if(!Uk(e,n,t))return n;n=t.parentId}return null}function ij(e,t){let n=X(e,t);if(QO(n,(t===e.snapshot.rootId?-1:qO(X(e,n.parentId)))+1),!J(n))return;let r=RA(e,t);for(let t of r.childIds)ij(e,t)}function aj(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function oj(e,t,n=X(e,t),r=!1){let i=e.instrumentation;if(i==null){cj(e,t,n,r);return}Y(i,`store.recomputeNodeCounts`,()=>cj(e,t,n,r))}function sj(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(oj(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&LO(RA(e,s),n,a,o),n=s}}function cj(e,t,n,r){if(!J(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=RA(e,t);if(r){let t=e.instrumentation;t==null?IO(e.snapshot.nodes,i):Y(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>IO(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,XO(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=CA(e,t)==null?Uk(e,t,n)?1+o:1:o}function lj(e,t,n){let r=MA(e,t);return r.length===0?n:`${r}${n}`}function uj(e){return e!=null&&!XO(e,4)}function dj(e,t){let n=e.snapshot.nodes[t];return!uj(n)||!J(n)||XO(n,2)?null:n}function fj(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&uj(e.snapshot.nodes[n])&&(t+=1);return t}function pj(e){return Math.max(0,e.valueById.length-1)}function mj(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:fj(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:pj(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function hj(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function gj(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)dj(e,n)!=null&&t.push(MA(e,n));for(let t of e.expandedDirectoryIds)dj(e,t)!=null&&n.push(MA(e,t));return{collapsedPaths:t,expandedPaths:n}}function _j(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)dj(e,n)!=null&&Kk(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:MA(e,n)});return t}function vj(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=IA(e,n);t!=null&&Wk(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=IA(e,n);t!=null&&Wk(e,t,!1,X(e,t))}}function yj(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=IA(e,n.path);t!=null&&dj(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function bj(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function xj(e){let t=e.snapshot.segmentTable,n=yk();for(let r of e.snapshot.nodes)if(uj(r)){if(XO(r,2)){r.nameId=0;continue}r.nameId=bk(n,xk(t,r.nameId))}e.snapshot.segmentTable=n}function Sj(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!uj(r)||!J(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return uj(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),IO(e.snapshot.nodes,n)}}function Cj(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(uj(n))break;--t}e.snapshot.nodes.length=t+1}function wj(e){let t=gj(e),n=_j(e);Y(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>bj(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>xj(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Sj(e)),Y(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Cj(e)),Y(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>vj(e,t)),Y(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>yj(e,n)),Y(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>PA(e,e.snapshot.rootId))}function Tj(e){let t=gj(e),n=_j(e),r=Y(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>EA(e)),i=ek({...e.snapshot.options},e.instrumentation),a=Y(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new Rk(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Y(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>vj(e,t)),Y(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>yj(e,n)),Y(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>PA(e,e.snapshot.rootId))}function Ej(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Dj(e,t){let n=mj(e);t===`stable`?Y(e.instrumentation,`store.cleanup.stable`,()=>wj(e)):Y(e.instrumentation,`store.cleanup.aggressive`,()=>Tj(e));let r=mj(e);return hj(t,t===`stable`,n,r)}var Oj=64;function kj(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function Aj(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function jj(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Mj(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Zj(e,t.cursor),setSize:t.setSize,subtreeEndIndex:jj(e,t.cursor,t.index,n)}}function Nj(e,t,n,r,i,a){let o=RA(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=RO(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Pj(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Pj(e,t,n,r,i,a,o,s){if(!J(X(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=Gj(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!J(l)||!Uk(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Nj(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Fj(e,t){let n=Aj(e);if(t<0||t>=n)return null;let r=Nj(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>MA(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=Mj(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Zj(e,r.cursor),setSize:r.setSize,subtreeEndIndex:jj(e,r.cursor,r.index,n)}}function Ij(e,t,n){let r=e.instrumentation,i=Aj(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Xj(e,o+1);let t=[],n=Hj(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Zj(e,n);t.push(r),n=qj(e,n)}return t}let s=[],c=0,l=0,u=Y(r,`store.getVisibleSlice.selectFirstRow`,()=>Hj(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Y(r,`store.getVisibleSlice.materializeRow`,()=>Zj(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Y(r,`store.getVisibleSlice.advanceCursor`,()=>qj(e,u))}return nk(r,`workload.visibleRowsRead`,s.length),nk(r,`workload.flattenedRowsRead`,c),nk(r,`workload.flattenedSegmentsRead`,l),s}function Lj(e,t=Aj(e)){let n=e.instrumentation;return n==null?Yj(e,t):Y(n,`store.getVisibleTreeProjection`,()=>Yj(e,t))}function Rj(e){return Jj(Lj(e))}function zj(e,t){let n=IA(e,t);if(n==null||n===e.snapshot.rootId||J(X(e,n))&&wA(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=RA(e,t),s=NO(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=zO(a,n,s),t!==o){let n=X(e,t),a=CA(e,t);if(!Uk(e,t,n)&&a!==i)return null;wA(e,t)===t&&(r+=1)}i=t}return r}function Bj(e,t){let n=IA(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return Uk(e,n,r)?null:(Wk(e,n,!0,r),NA(e,n),rA({affectedAncestorIds:FA(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Vj(e,t){let n=IA(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return Uk(e,n,r)?(Wk(e,n,!1,r),NA(e,n),iA({affectedAncestorIds:FA(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Hj(e,t){return t<0||t>=Aj(e)?null:Uj(e,e.snapshot.rootId,t,-1)}function Uj(e,t,n,r){let i=RA(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?RO(e.snapshot.nodes,i,n):Y(a,`store.getVisibleSlice.selectChildIndex`,()=>RO(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Wj(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Wj(e,t,n,r){if(!J(X(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=Gj(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!J(a)||!Uk(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Uj(e,i.terminalNodeId,n-1,i.visibleDepth)}function Gj(e,t,n){return J(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:wA(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Y(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>wA(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Kj(e,t){let n=X(e,t);if(!J(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||CA(e,r)!==t}function qj(e,t){let n=X(e,t.terminalNodeId);if(J(n)){let r=RA(e,t.terminalNodeId);if(Uk(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Wj(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=RA(e,n),o=NO(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return Wj(e,s,0,i);Kj(e,r)&&i--,r=n}}function Jj(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function Yj(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(Oj);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=kj(o,y);let x,S=_;if(J(v))S=f?wA(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:MA(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&J(C)&&Uk(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Xj(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!J(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:MA(e,f)};continue}let h=l?wA(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Zj(e,g);let _=i[h];_!=null&&J(_)&&Uk(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Zj(e,t){let n=X(e,t.terminalNodeId),r=J(n)?Qj(e,t):null,i=MA(e,t.terminalNodeId),a=xk(e.snapshot.segmentTable,n.nameId),o=J(n)&&RA(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?TA(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:xk(e.snapshot.segmentTable,r.nameId),nodeId:n,path:MA(e,n)}}):Y(c,`store.getVisibleSlice.flatten.collectSegments`,()=>TA(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:xk(e.snapshot.segmentTable,r.nameId),nodeId:n,path:MA(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:J(n)&&Uk(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:J(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Qj(e,t){if(t.headNodeId===t.terminalNodeId)return Kk(e,t.terminalNodeId);let n=TA(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Kk(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var $j=8;function eM(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function tM(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&$j)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&$j)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function nM(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!J(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&BO(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&J(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,BO(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function rM(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=eM(e.snapshot);tM(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&BO(n,i)}}function iM(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var aM=class e{#e;constructor(e={}){let t=tk(e),n=Y(t,`store.builder.create`,()=>new Rk(e));if(e.preparedInput!=null){let t=Fk(e.preparedInput);t==null?n.appendPreparedPaths(Pk(e.preparedInput),!1):n.appendPresortedPaths(t,Ik(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Y(t,`store.preparePathEntries`,()=>Lk(r,e)))}let r=Y(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Y(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Y(t,`store.state.create`,()=>zk(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Y(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||iM(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Y(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?Y(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>rM(this.#e)):Y(t,`store.state.initializeOpenVisibleCounts`,()=>nM(this.#e)):Y(t,`store.state.recomputeCounts`,()=>PA(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return jk(e,t)}static prepareInput(e,t={}){return Mk(e,t)}static preparePresortedInput(e){return Nk(e)}list(e){return Y(this.#e.instrumentation,`store.list`,()=>EA(this.#e,e))}add(e){Y(this.#e.instrumentation,`store.add`,()=>{let t=Aj(this.#e);pA(this.#e,dA(this.#e,t,DA(this.#e,e)))})}remove(e,t={}){Y(this.#e.instrumentation,`store.remove`,()=>{let n=Aj(this.#e);pA(this.#e,dA(this.#e,n,OA(this.#e,e,t)))})}move(e,t,n={}){Y(this.#e.instrumentation,`store.move`,()=>{let r=Aj(this.#e),i=kA(this.#e,e,t,n);i!=null&&pA(this.#e,dA(this.#e,r,i))})}batch(e){fA(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision})}})}getVisibleCount(){return Y(this.#e.instrumentation,`store.getVisibleCount`,()=>Aj(this.#e))}getVisibleSlice(e,t){return Y(this.#e.instrumentation,`store.getVisibleSlice`,()=>Ij(this.#e,e,t))}getVisibleRowContext(e){return Y(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Fj(this.#e,e))}getVisibleTreeProjection(){return Rj(this.#e)}getVisibleTreeProjectionData(e){return Lj(this.#e,e)}getVisibleIndex(e){return Y(this.#e.instrumentation,`store.getVisibleIndex`,()=>zj(this.#e,e))}getPathInfo(e){return Y(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=IA(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:qO(n),kind:J(n)?`directory`:`file`,path:MA(this.#e,t)}})}isExpanded(e){return Y(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return Uk(this.#e,t,n)})}expand(e){Y(this.#e.instrumentation,`store.expand`,()=>{let t=Aj(this.#e),n=Bj(this.#e,e);n!=null&&pA(this.#e,dA(this.#e,t,n))})}collapse(e){Y(this.#e.instrumentation,`store.collapse`,()=>{let t=Aj(this.#e),n=Vj(this.#e,e);n!=null&&pA(this.#e,dA(this.#e,t,n))})}on(e,t){return $k(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Kk(this.#e,t)}markDirectoryUnloaded(e){Y(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(RA(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=Aj(this.#e);Jk(this.#e,t),pA(this.#e,dA(this.#e,n,aA({affectedAncestorIds:FA(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Y(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=Aj(this.#e),r=qk(this.#e,t);return pA(this.#e,dA(this.#e,n,oA({affectedAncestorIds:FA(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Y(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Kk(this.#e,n)!==`loading`||!Xk(this.#e,n,e.attemptId))return!1;let r=MA(this.#e,n);this.validateChildPatch(r,t);let i=Aj(this.#e),a=[];for(let e of t.operations){oM(r,e);let t=Aj(this.#e);switch(e.type){case`add`:a.push(dA(this.#e,t,DA(this.#e,e.path)));break;case`remove`:a.push(dA(this.#e,t,OA(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=kA(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(dA(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return pA(this.#e,dA(this.#e,i,sA({affectedAncestorIds:FA(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:MA(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Y(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=Aj(this.#e),r=Yk(this.#e,t,e.attemptId);return pA(this.#e,dA(this.#e,n,cA({affectedAncestorIds:FA(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:MA(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Y(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=Aj(this.#e),i=Zk(this.#e,n,e.attemptId,t);return pA(this.#e,dA(this.#e,r,lA({affectedAncestorIds:FA(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:MA(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Y(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(Ej(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=Aj(this.#e),n=Dj(this.#e,e.mode??`stable`);return pA(this.#e,dA(this.#e,t,uA({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=RA(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??ak(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=sk(mk(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!J(X(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);Uk(this.#e,n,i)||(Wk(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=X(this.#e,e);if(!Uk(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=IA(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!J(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!J(X(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=CA(this.#e,e);if(!Uk(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function oM(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`)}}var sM={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function cM(e,t){if(typeof e==`number`)return{itemHeight:t??sM.default.itemHeight,factor:e};let n=sM[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var lM=sM.default.itemHeight,uM=`@layer base {
1700
1700
  :host {
1701
1701
  --trees-accent: var(--trees-accent-override, #009fff);
1702
1702
  --trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
@@ -2788,15 +2788,15 @@ diff --git`)}function g_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
2788
2788
  }
2789
2789
 
2790
2790
  @layer theme, unsafe;
2791
- `,$M=`@layer base, unsafe;`;function eN(e){return`${$M}
2791
+ `,dM=`@layer base, unsafe;`;function fM(e){return`${dM}
2792
2792
  @layer base {
2793
2793
  ${e}
2794
- }`}function tN(e){return`${$M}
2794
+ }`}function pM(e){return`${dM}
2795
2795
  @layer unsafe {
2796
2796
  ${e}
2797
- }`}var nN=new WeakMap;function rN(e){let t=nN.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(nk,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),nN.set(e,i),i}function iN(e,t){if(!e.isConnected)return;let n=rN(t);if(n==null)return;let r=t.querySelector(`style[${rk}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(rk,``),t.appendChild(i)),i.textContent=`:host { ${ik}: ${n}px; }`}var aN;function oN(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){aN??(aN=new CSSStyleSheet,aN.replaceSync(eN(QM)));let t=!1;try{e.adoptedStyleSheets=[aN],t=!0}catch{}if(t){e.querySelector(`style[${ek}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ek,``),t.textContent=eN(QM),e.prepend(t)}}function sN(e,t){cN(e,t),oN(t),iN(e,t)}function cN(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});sN(this,e)}}if(customElements.define($O,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll($O)))e instanceof HTMLElement&&sN(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var lN=e=>e.startsWith(`f::`)?e.slice(3):e;function uN(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function dN(e,t){return e===``?t:`${e}/${t}`}function fN({files:e,path:t,isFolder:n,nextBasename:r}){let i=lN(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=uN(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=dN(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function pN(e){return e.endsWith(`/`)}function mN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function hN(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function gN(e,t){return t.includes(e)?hN(t):[e]}function _N(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function vN(e,t){return{draggedPaths:e,target:t}}function yN(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(pN(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function bN(e,t){return t.kind===`root`||t.directoryPath==null?mN(e):t.directoryPath}function xN(e,t){let n=e.map(e=>{let n=bN(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function SN(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function CN(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!SN(qM.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function wN(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function TN(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function EN(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function DN(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return EN(e,t.path)?n?e:null:e;case`move`:return TN(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=DN(r,e,n),r==null)return null;return r}}}function ON(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function kN(e){switch(e.operation){case`add`:return{...ON(e),operation:`add`,path:e.path};case`remove`:return{...ON(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...ON(e),from:e.from,operation:`move`,to:e.to}}}function AN(e){return{...ON(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>kN(e)),operation:`batch`}}function jN(e){switch(e.operation){case`add`:case`remove`:case`move`:return kN(e);case`batch`:return AN(e);default:return null}}function MN(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function NN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function PN(e){return NN(e).at(-1)??null}function FN(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function IN(e){return e.endsWith(`/`)}var LN=e=>e.toLowerCase();function RN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function zN(e){return e.endsWith(`/`)?e.slice(0,-1):e}function BN(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var VN=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},HN=Symbol(`FILE_TREE_RENAME_VIEW`),UN=512,WN=512;function GN(e){return e===`top`||e===`center`?e:`nearest`}function KN(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=NN(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function qN(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:KN(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var JN=class e{static{Object.defineProperty(e.prototype,HN,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=CN({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=PN(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:GN(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=WN){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t!=null&&this.#B.has(t)&&this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=gN(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=vN(t.draggedPaths,n);(yN(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}_N(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=vN(e.draggedPaths,t);if(yN(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=xN(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=IN(r),a=zN(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of NN(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=RN(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,IN(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,IN(e)?{recursive:!0}:void 0);return}let t=IN(e),n=fN({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:zN(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(BN(n.sourcePath,t),BN(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=CN({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!MN(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=PN(e),n=FN(e,t),r=null,i=null;for(let e of this.#be()){if(PN(e)!==t)continue;let a=FN(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=NN(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!MN(this.#B,r),a=this.#z!==t;(i||a)&&(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new qM({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of NN(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(LN),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(LN),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of NN(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:VN(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of NN(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of NN(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=qN(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,UN)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=DN(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=DN(this.#c,e,!0),r=[...this.#B].map(t=>DN(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=DN(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return MN(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&wN(e)&&(this.#i=null);let t=wN(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=jN(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},YN=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function XN(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function ZN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function QN(e,t){return t?`${e}/`:e}function $N(e,t=null){let n=YN(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=tP(t);e!=null&&iP({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function eP(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=nP(e);t!=null&&(c=rP({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=tP(e);t!=null&&(c=iP({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:sP(i),statusByPath:i}:e}function tP(e){return nP(e.path)}function nP(e){let t=XN(e);if(t!=null)return{canonicalPath:QN(t.path,t.isDirectory),isDirectory:t.isDirectory}}function rP({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),oP(t,n,e),!0)}function iP({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??aP(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function aP(e,t,n){for(let r of ZN(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function oP(e,t,n){for(let r of ZN(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function sP(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var cP,lP,uP,dP,fP,pP,mP,hP,gP,_P,vP={},yP=[],bP=Array.isArray,xP=yP.slice,SP=Object.assign;function CP(e){e&&e.parentNode&&e.remove()}function wP(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?xP.call(arguments,2):n),TP(e,o,r,i,null)}function TP(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++lP,__i:-1,__u:0};return i==null&&cP.vnode!=null&&cP.vnode(a),a}function EP(e){return e.children}function DP(e,t){this.props=e,this.context=t,this.__g=0}function OP(e,t){if(t==null)return e.__?OP(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?OP(e):null}function kP(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return kP(e)}}function AP(e){(8&e.__g||!(e.__g|=8)||!uP.push(e)||fP++)&&dP==cP.debounceRendering||((dP=cP.debounceRendering)||queueMicrotask)(jP)}function jP(){for(var e,t,n,r,i,a,o,s,c=1;uP.length;)uP.length>c&&uP.sort(pP),e=uP.shift(),c=uP.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=SP({},r)).__v=r.__v+1,cP.vnode&&cP.vnode(n),zP(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??OP(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,VP(a,n,o),n.__e!=i&&kP(n)));fP=0}function MP(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||yP,b=t.length;for(c=NP(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?vP:y[m.__i]||vP,m.__i=f,_=zP(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&WP(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=PP(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function NP(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?TP(null,o,null,null,null):bP(o)?TP(EP,{children:o},null,null,null):o.constructor==null&&o.__b>0?TP(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=FP(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=OP(s)),GP(s,s));return r}function PP(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=PP(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=OP(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function FP(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function IP(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function LP(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||IP(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||IP(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(mP,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=hP,e.addEventListener(t,a?_P:gP,a)):e.removeEventListener(t,a?_P:gP,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function RP(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=hP++;else if(t.u<n.l)return;return n(cP.event?cP.event(t):t)}}}function zP(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,O,te,ne,k=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=cP.__b)&&d(t);n:if(typeof k==`function`)try{if(v=t.props,y=`prototype`in k&&k.prototype.render,b=(d=k.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new k(v,x):(t.__c=f=new DP(v,x),f.constructor=k,f.render=KP),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=SP({},f.__s)),SP(f.__s,k.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&k.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=cP.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=SP({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===EP&&d.key==null&&(E=HP(d.props.children)),s=MP(e,bP(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(D=0,ee=!1,t.__u|=c?160:128,t.__c.__z=[],O=0;O<a.length;O++)(te=a[O])==null||ee||(te.nodeType==8&&te.data==`$s`?(D>0&&t.__c.__z.push(te),D++,a[O]=null):te.nodeType==8&&te.data==`/$s`?(--D>0&&t.__c.__z.push(te),ee=D===0,s=a[O],a[O]=null):D>0&&(t.__c.__z.push(te),a[O]=null));if(!ee){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(ne=a.length;ne--;)CP(a[ne]);BP(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||BP(t);cP.__e(e,t,n)}else s=t.__e=UP(n.__e,t,n,r,i,a,o,c,l,u);return(d=cP.diffed)&&d(t),128&t.__u?void 0:s}function BP(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(BP)}function VP(e,t,n){for(var r=0;r<n.length;r++)WP(n[r],n[++r],n[++r]);cP.__c&&cP.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){cP.__e(e,t.__v)}})}function HP(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:bP(e)?e.map(HP):SP({},e)}function UP(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(cP.__m&&cP.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=xP.call(e.childNodes),v=n.props||vP,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;LP(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||LP(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),MP(b==`template`?e.content:e,bP(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&OP(n,0),s,c,l),a!=null)for(u=a.length;u--;)CP(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||LP(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&LP(e,u,g,v[u],i))}return e}function WP(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){cP.__e(e,n)}}function GP(e,t,n){var r,i;if(cP.unmount&&cP.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||WP(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){cP.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&GP(r[i],t,n||typeof e.type!=`function`);n||CP(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function KP(e,t,n){return this.constructor(e,n)}function qP(e,t){var n,r,i,a;t==document&&(t=document.documentElement),cP.__&&cP.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=wP(EP,null,[e]),i=[],a=[],zP(t,e,r||vP,vP,t.namespaceURI,r?null:t.firstChild?xP.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),VP(i,e,a)}function JP(e,t){e.__u|=32,qP(e,t)}cP={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw fP=0,e}},lP=0,DP.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=SP({},this.state);typeof e==`function`&&(e=e(SP({},n),this.props)),e&&SP(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),AP(this))},DP.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),AP(this))},DP.prototype.render=EP,uP=[],fP=0,pP=function(e,t){return e.__v.__b-t.__v.__b},mP=/(PointerCapture)$|Capture$/i,hP=0,gP=RP(!1),_P=RP(!0);var YP=0;Array.isArray;function Z(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--YP,__i:-1,__u:0,__source:i,__self:a};return cP.vnode&&cP.vnode(l),l}var XP=16,ZP=16,QP={};function $P({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=QP[e]??{width:XP,height:ZP},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Z(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Z(`use`,{href:c})})}var eF=e=>e!==void 0&&/\s/.test(e),tF=(e,t)=>{let n=t=>eF(e[t-1])||eF(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},nF=e=>tF(e,Math.ceil(e.length/2)),rF=e=>{if(e.length<2)return[e,``];let t=nF(e);return[e.slice(0,t),e.slice(t)]},iF=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:nF(e);return[e.slice(0,r),e.slice(r)]},aF=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},oF=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},sF=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},cF=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function lF({children:e,marker:t,variant:n=`default`}){"use no memo";return Z(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Z(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Z(`span`,{"data-truncate-fade":!0}):t})})}function uF(e){"use no memo";let{mode:t,children:n}=e;return Z(`div`,{children:[Z(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Z(`span`,{children:n}):n}),Z(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Z(`span`,{children:n}):n})]})}function dF({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(uF,{mode:t,children:e},`content`),o=Z(lF,{marker:n,mode:t,variant:r},`marker`),s=Z(`div`,{"data-truncate-fill":!0},`fill`);return Z(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Z(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function fF({children:e,...t}){"use no memo";return Z(dF,{mode:`truncate`,...t,children:e})}function pF({children:e,...t}){"use no memo";return Z(dF,{mode:`fruncate`,...t,children:e})}function mF({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Z(fF,{...s,children:t[0]}),l=Z(pF,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Z(`div`,{className:a,style:o});if(e.length<i)return Z(n===`end`?pF:fF,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=rF:r===`extension`?t=iF:r===`leaf-path`&&(t=aF);else if(typeof r==`number`)t=oF,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=sF:e===`first`&&(t=cF)}else typeof r==`function`&&(t=r);t??=rF;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Z(fF,{...s,..._,children:f}),l=Z(pF,{...s,...v,children:p})}return Z(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Z(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Z(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var hF={endIndex:-1,startIndex:-1};function gF(e,t,n){return Math.min(Math.max(e,t),n)}function _F(e,t){return e<0||t<e?hF:{endIndex:t,startIndex:e}}function vF(e){return e.startIndex<0||e.endIndex<e.startIndex}function yF(e,t){return vF(e)?0:(e.endIndex-e.startIndex+1)*t}function bF(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function xF(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function SF(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function CF(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function wF(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function TF(e,t,n){if(e.length===0||t<=0)return[];let r=wF(e),i=SF(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=CF(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function EF(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=gF(t.scrollTop,0,o),c=t.stickyRows??TF(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=bF(s,n,t.itemHeight),m=bF(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?hF:_F(m,xF(u+d,n,t.itemHeight)),y=g+1,b=vF(v)?hF:_F(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=yF(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:vF(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var DF={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},OF={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},kF=`Contains git status items`;function AF(e){return e.current?!0:(e.current=!0,!1)}function jF(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function MF(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return jF({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function NF(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function PF(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function FF(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function IF(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function LF(e,t){return e!=null&&e>0?e:t}function RF(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function zF(e,t,n,r,i=0){let a=jF({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function BF(e,t,n,r,i,a,o=0){let s=MF({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function VF(e,t,n,r,i,a){let o=NF({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function HF(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function UF(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function WF({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Z(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function GF(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function KF(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var qF,JF,YF,XF,ZF=Object.is,QF=0,$F=[],eI=cP,tI=eI.__b,nI=eI.__r,rI=eI.diffed,iI=eI.__c,aI=eI.unmount,oI=eI.__;function sI(e,t){eI.__h&&eI.__h(JF,e,QF||t),QF=0;var n=JF.__H||(JF.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function cI(e){return QF=1,lI(bI,e)}function lI(e,t,n){var r=sI(qF++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):bI(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);ZF(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=JF,!JF.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,ZF(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};JF.__f=!0;var a=JF.shouldComponentUpdate,o=JF.componentWillUpdate;JF.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},JF.shouldComponentUpdate=i}return r.__N||r.__}function uI(e,t){var n=sI(qF++,3);!eI.__s&&yI(n.__H,t)&&(n.__=e,n.u=t,JF.__H.__h.push(n))}function dI(e,t){var n=sI(qF++,4);!eI.__s&&yI(n.__H,t)&&(n.__=e,n.u=t,JF.__h.push(n))}function Q(e){return QF=5,fI(function(){return{current:e}},[])}function fI(e,t){var n=sI(qF++,7);return yI(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function pI(e,t){return QF=8,fI(function(){return e},t)}function mI(){for(var e;e=$F.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(_I),e.__H.__h.forEach(vI),e.__H.__h=[]}catch(t){e.__H.__h=[],eI.__e(t,e.__v)}}eI.__b=function(e){JF=null,tI&&tI(e)},eI.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),oI&&oI(e,t)},eI.__r=function(e){nI&&nI(e),qF=0;var t=(JF=e.__c).__H;t&&(YF===JF?(t.__h=[],JF.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(_I),t.__h.forEach(vI),t.__h=[],qF=0)),YF=JF},eI.diffed=function(e){rI&&rI(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($F.push(t)!==1&&XF===eI.requestAnimationFrame||((XF=eI.requestAnimationFrame)||gI)(mI)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),YF=JF=null},eI.__c=function(e,t){t.some(function(e){try{e.__h.forEach(_I),e.__h=e.__h.filter(function(e){return!e.__||vI(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],eI.__e(n,e.__v)}}),iI&&iI(e,t)},eI.unmount=function(e){aI&&aI(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{_I(e)}catch(e){t=e}}),n.__H=void 0,t&&eI.__e(t,n.__v))};var hI=typeof requestAnimationFrame==`function`;function gI(e){var t,n=function(){clearTimeout(r),hI&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);hI&&(t=requestAnimationFrame(n))}function _I(e){var t=JF,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),JF=t}function vI(e){var t=JF;e.__c=e.__(),JF=t}function yI(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!ZF(t,e[n])})}function bI(e,t){return typeof t==`function`?t(e):t}function xI(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Z(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Z(EP,{children:[Z(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Z(fF,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function SI(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function CI(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function wI(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function TI({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=EF(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:wI(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?wI(u,1,t,o):i&&r<=0&&c.length>0?TF(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var EI=400,DI=40,OI=18;function kI(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?AI(e,t,n):a instanceof HTMLElement?a:null}function AI(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function jI(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function MI(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function NI(){return navigator.vendor!==`Apple Computer, Inc.`}function PI(e,t){let n=e-t.top;if(n<DI)return-Math.ceil((DI-Math.max(0,n))/DI*OI);let r=t.bottom-e;return r<DI?Math.ceil((DI-Math.max(0,r))/DI*OI):0}function FI(e,t){if(e!=null){let t=DF[e];return t==null?null:{text:t,title:OF[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:kF}:null}function II(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function LI(e){return e!=null&&`toggle`in e}function RI(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function zI(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function BI(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function VI(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function HI(e,t){return t&&VI(e)||(e.ctrlKey||e.metaKey)&&RI(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var UI=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function WI(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function GI(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function KI(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function qI(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function JI(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function YI(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function XI(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function ZI(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function QI(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=ZI(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function $I(e,t){return{kind:e.kind,name:CI(e),path:t}}function eL(e){return e==null?void 0:`${e}__tree`}function tL(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function nL(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function rL(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Z(`span`,{title:e.title,children:e.text}):Z(`span`,{title:e.title,children:e.parts.map((e,t)=>Z(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?nL(e.icon)?t(e.icon):{name:e.icon}:nL(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Z(`span`,{title:e.title,children:Z($P,{...n})})}function iL(e){e!=null&&PF(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function aL(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=SI(e);return Z(EP,{children:[e.depth>0?Z(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Z(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Z(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Z($P,{...t(`file-tree-icon-chevron`)}):Z($P,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?xI(e,c,a):c??Z(mF,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:rL(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:rL(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z($P,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function oL(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:ee,resolveIcon:O,renderDecorationForRow:te,openContextMenuForRow:ne,onRowClick:k,onKeyDown:re}=e,ie=SI(t),{isParked:ae=!1,mode:oe=`flow`,style:se}=r,ce=oe===`sticky`,le=_?.get(ie)??null??II(t.ancestorPaths,v,y),ue=t.kind===`directory`&&(b?.has(ie)??!1),de=te(t,ie),fe=FI(le,ue),pe=S&&w,me=de!=null||x||pe,he=pe&&T===`always`,ge=a.getPath()===ie,_e=ge?a.getValue():``,ve=ce||!ge?null:Z(WF,{ref:D,ariaLabel:`Rename ${CI(t)}`,isFlattened:t.isFlattened,value:_e,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ye=aL(t,O,{actionLaneEnabled:pe,customDecoration:de,decorationLaneEnabled:me,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:fe,gitLaneActive:x,renameInput:ve,showDecorativeActionAffordance:he}),be={...GF({ariaLabel:CI(t),domId:t.isFocused?tL(h,ie,ae):void 0,extraStyle:se,features:{actionLaneEnabled:pe,contextMenuButtonVisibility:pe?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:ae,itemHeight:g,mode:oe,row:t,state:{containsGitChange:ue,effectiveGitStatus:le,isContextHovered:s===ie,isDragTarget:l?.kind===`directory`&&l.directoryPath===ie,isDragging:c?.has(ie)===!0,isFocusRinged:t.isFocused&&o===ie},targetPath:ie}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(ie),ne(t,ie,{anchorRect:KI(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ce?void 0:()=>{i.focusMountedPathFromInput(ie)},onKeyDown:ce?void 0:re,ref:e=>{ee(ie,e)}};return!ce&&ge?Z(`div`,{...be,children:ye}):Z(`button`,{...be,type:`button`,draggable:u&&!ae,onDragEnd:u&&!ae?p:void 0,onDragStart:u&&!ae?e=>{f(e,t,ie)}:void 0,onMouseDown:e=>{if(ce){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!ae?e=>{m(e,t,ie)}:void 0,onClick:e=>{k(e,t,ie,oe)},children:ye})}function sL(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(SI(e))).map((n,r)=>oL(e,n,t.start+r))}function cL({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=ZM,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=Q(null),v=Q(null),y=Q(!1),b=Q(null),x=Q(null),S=Q(null),C=Q(null),w=Q(null),T=Q(new Map),E=Q(new Map),D=Q(()=>{}),ee=Q(null),O=Q(0),te=Q(!1),ne=Q(null);ne.current!==t&&(te.current=!1,ne.current=t);let k=Q(!1),re=Q(null),ie=Q(null),ae=Q(!1),oe=Q(null),se=Q(null),ce=Q(null),le=Q(null),ue=Q(null),de=Q(null),fe=Q(null),pe=Q(null),me=Q(!1),he=Q(null),ge=Q(null),_e=Q(null),ve=Q(null),ye=fI(()=>new Map,[]),[,be]=cI(0),xe=Q(!1),[Se,Ce]=cI(null),[we,Te]=cI(null),[Ee,De]=cI(null),[Oe,ke]=cI(null),[Ae,je]=cI(0),[Me,Ne]=cI(null),Pe=Q(Me);Pe.current=Me;let Fe=Q(null),Ie=Q(null),Le=Q(null),Re=Q(null),ze=Q(null),Be=Q(!1),Ve=()=>{Ie.current=null,Le.current=null,Re.current=null},He=(e,t)=>{Ie.current=e,Le.current=null,Re.current=t==null?null:{path:e,scrollTop:t}},Ue=(e,t)=>{Ie.current=null,Le.current={path:e,viewportOffset:t},Re.current=null},We=Q(d===`retain`&&t.isSearchOpen()),[Ge,Ke]=cI(p);uI(()=>{p||Ke(!1)},[p]);let qe=Q(!1),Je=pI(()=>{qe.current=!0,Ke(e=>e&&!1)},[]),[Ye,Xe]=cI(()=>TI({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ze,Qe]=cI(!1);uI(()=>{Qe(!0)},[]);let $e=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,et=e?.contextMenu?.triggerMode??($e?`right-click`:`both`),tt=et===`both`||et===`button`,nt=e?.contextMenu?.buttonVisibility??`when-needed`,rt=et===`both`||et===`right-click`;dI(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ze.current=t,Te(t),ke(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Be.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let it=pI((e,t)=>{JI(T.current,e,t)},[]),at=pI((e,t)=>{JI(E.current,e,t)},[]),ot=pI(e=>{x.current=e},[]),st=pI(e=>YI(e,E.current,T.current),[]),ct=n!=null||r!=null||i!=null,{resolveIcon:lt}=fI(()=>mk(a),[a]),ut=t[HN](),dt=ut.getPath(),ft=dt!=null,pt=t.isSearchOpen(),mt=t.getSearchValue(),A=t.getFocusedPath(),ht=t.getFocusedIndex(),gt=t.getScrollRequest(),_t=t.isDragAndDropEnabled(),vt=t.getDragSession(),yt=fI(()=>vt==null?null:new Set(vt.draggedPaths),[vt]),bt=vt?.target??null,xt=vt?.primaryPath??null,St=eL(o),{overlayHeight:j,overlayRows:Ct,snapshot:M,visibleRows:N}=Ye,P=M.physical.viewportHeight,wt=fI(()=>({end:M.window.endIndex,start:M.window.startIndex}),[M.window.endIndex,M.window.startIndex]),Tt=Ct,F=M.sticky.rows,Et=M.physical.totalHeight,I=M.sticky.height,Dt=fI(()=>new Set(F.map(e=>SI(e.row))),[F]),L=ht>=0&&ht>=wt.start&&ht<=wt.end,R=pI((e,t)=>u?.({item:$I(e,t),row:e})??null,[u]),Ot=pI(e=>PF(e==null?null:T.current.get(e)??null)?!0:PF(S.current),[]),kt=pI(e=>{Ot(t.focusNearestPath(e))},[t,Ot]),At=Q(kt);At.current=kt;let jt=Q(!0),Mt=Q(()=>{}),z=pI((t=!0)=>{let n=Pe.current;n!=null&&(jt.current=jt.current&&t,Ne(null),e?.contextMenu?.onClose?.(),jt.current&&kt(n.path))},[e?.contextMenu,kt]);Mt.current=z;let Nt=pI(e=>{let t=e==null?null:qI(S.current,e);De(e=>e===t?e:t)},[]),Pt=pI((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=st(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;He(n,e?.scrollTop??null),k.current=!0,Ce(e=>e===n?e:n)}i.focus(),Nt(a),jt.current=!0,Ne({anchorRect:r?.anchorRect??null,item:$I(e,n),path:n,source:r?.source??`keyboard`})},[t,st,Nt]),Ft=pI(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=IF(e,P);oe.current=ht<0||e==null?null:Math.max(0,Math.min(ht*s-e.scrollTop,Math.max(0,t-s))),ae.current=!0}t.startRenaming(e)!==!1&&(ke(`focus`),be(e=>e+1))}},[t,ht,s,l,P]),B=pI((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=IF(i,P),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:TI({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,VF(i,a,s,l,u,d),D.current(),Fe.current=n?e:null,!0},[t,s,c,P,h]),It=()=>y.current===!0||ve.current!=null||me.current===!0,V=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Lt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},H=()=>{le.current!=null&&(clearTimeout(le.current),le.current=null),ce.current=null},U=()=>{de.current?.remove(),de.current=null},Rt=()=>{Lt(se.current),se.current=null,ue.current=null},zt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Bt=()=>{pe.current?.(),pe.current=null,ve.current!=null&&(clearTimeout(ve.current),ve.current=null),me.current=!1,he.current=null,_e.current=null,ge.current!=null&&(ge.current.setAttribute(`draggable`,`true`),ge.current.style.removeProperty(`touch-action`),ge.current=null),U(),H(),Rt(),fe.current=null},Vt=(e,n)=>{let r=S.current?.getRootNode(),i=jI(kI(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ht=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){H();return}let r=t.getItem(e.directoryPath),i=LI(r)?r:null;if(i==null||i.isExpanded()){H();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ce.current!==a&&(H(),ce.current=a,le.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Ut=()=>{se.current=null;let e=ue.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=PI(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Ht(Vt(e.clientX,e.clientY)),se.current=V(Ut)},Wt=(e,t)=>{ue.current={clientX:e,clientY:t},se.current??=V(Ut)},Gt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Bt(),U(),H(),Rt(),t.startDrag(r)===!1){e.preventDefault();return}if(fe.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),NI())){let t=MI(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),zt(t),de.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Kt=()=>{U(),H(),Rt(),fe.current=null,t.cancelDrag()},qt=(e,n,r)=>{if(ve.current!=null||me.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;_e.current={clientX:i.clientX,clientY:i.clientY},ge.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!me.current;ve.current!=null&&(clearTimeout(ve.current),ve.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),pe.current===o&&(pe.current=null),t&&(a.setAttribute(`draggable`,`true`),ge.current===a&&(ge.current=null),_e.current=null)},s=e=>{let t=e.touches[0],n=_e.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),pe.current=o,ve.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),ge.current===a&&(ge.current=null),_e.current=null;return}me.current=!0,ge.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),fe.current=n;let e=a.getBoundingClientRect(),s=MI(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),zt(s),de.current=s,he.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=he.current;n!=null&&de.current!=null&&(de.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ht(Vt(t.clientX,t.clientY)),Wt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Vt(n.clientX,n.clientY),t.completeDrag(),Bt()},u=()=>{t.cancelDrag(),Bt()};pe.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},EI)},Jt=e=>{if(Me!=null){if(e.key===`Escape`){z(),e.preventDefault(),e.stopPropagation();return}UI.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(ut.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)ut.cancel();else if(e.key===`Enter`)ut.commit();else return;ke(`focus`),be(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Ft(A??void 0),e.preventDefault(),e.stopPropagation();return}if(pt){if(e.key===`Escape`)ae.current=!1,oe.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=IF(n,P);oe.current=ht<0||n==null?null:Math.max(0,Math.min(ht*s-n.scrollTop,Math.max(0,r-s))),ae.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;ke(`focus`),be(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&zI(e)){t.openSearch(e.key),be(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=$e&&VI(e),r=HI(e,$e),i=r&&S.current!=null?FF(S.current):null,a=r?new Set(XI(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==A&&a.has(o)){let e=C.current;He(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=LI(p)?p:null,h=u!=null&&(Dt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=YI(u,E.current,T.current);e==null||n==null?y=!1:Pt(e,u)}else if((e.ctrlKey||e.metaKey)&&RI(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;ke(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Dt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))He(b,v?.scrollTop??null),k.current=!0,Ce(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ue(b,QI(S.current,v,i,u,s,I,P)),k.current=!0,Ce(e=>e===b?e:b)):Ve()}be(e=>e+1),e.preventDefault(),e.stopPropagation()};dI(()=>{if(f&&pt){if(We.current){We.current=!1;return}PF(w.current)}},[pt,f]),dI(()=>{let e=x.current;switch(UF({hasRenderedInput:e!=null,previousRenamingPath:ie.current,renamingPath:dt})){case`reset`:ie.current=null;return;case`reveal-canonical`:dt!=null&&B(dt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Fe.current=null,ie.current=dt,PF(e),e.select());return}},[wt.end,wt.start,dt,B,Dt]),dI(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=FF(e)?.dataset.itemPath??null;Ce(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,FF(e)!=null){r();return}k.current=!1,Ce(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,Ce(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;Ce(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),dI(()=>{let e=S.current;e!=null&&(M.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[M.physical.scrollTop]),dI(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;ee.current=IF(n,g);let a=()=>{let e=t.getVisibleCount(),r=LF(ee.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Xe(TI({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!te.current){te.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=LF(ee.current,g),i=t.getVisibleRows(e,e)[0]??null;zF(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=t.subscribe(()=>{AF(xe)&&be(e=>e+1),a()}),l=()=>{Be.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,je(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Be.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),Pe.current!=null&&y.current&&Mt.current(),Be.current===!0){y.current=!1;return}Te(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{ee.current=(e[0]==null?null:RF(e[0]))??IF(n,g),a()}):null;return x?.observe(n),()=>{D.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,ee.current=null,x?.disconnect()}},[t,g,s,c,h]),dI(()=>{$e||Me==null||z(!1)},[z,$e,Me]);let Yt=fI(()=>Me==null?null:`${Me.path}::${Me.source}`,[Me]);dI(()=>{if(Yt==null){m?.clearSlotContent(ok);return}let t=Pe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??GI(n.getBoundingClientRect()),close:e=>{Mt.current(e?.restoreFocus??!0)},restoreFocus:()=>{jt.current&&At.current(Pe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(ok,i),e?.contextMenu?.onOpen?.(t.item,r),iL(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&iL(i)}),()=>{m?.clearSlotContent(ok)}},[Yt,e?.contextMenu,m]),dI(()=>{Me!=null&&t.getItem(Me.path)==null&&z()},[z,Me,t]),dI(()=>{if(Me==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(WI(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&z())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),z())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[z,Me]),dI(()=>{let e=C.current,n=S.current;if(e==null||n==null){re.current=A;return}let r=A==null?null:T.current.get(A)??null,i=FF(n),a=i?.dataset.itemPath??null,o=ft&&x.current===i,c=f&&w.current===i,l=ae.current&&!pt,u=oe.current??0,d=Fe.current,p=Ie.current,m=Le.current,g=Re.current,_=i!=null,v=k.current||_,y=re.current!==A,b=p!=null&&p===A&&A!=null,E=!1,ee=!1;if(gt!=null&&gt.id!==O.current){O.current=gt.id;let n=gt.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,P-s))):I;E=!0,ee=BF(e,n,s,P,Et,gt.offset,t)}t.clearScrollRequest(gt.id)}let te=!E&&l&&VF(e,ht,s,P,Et,u),ne=!E&&d!=null&&d===A&&VF(e,ht,s,P,Et,I),ie=!E&&m!=null&&m.path===A&&VF(e,ht,s,P,Et,m.viewportOffset),se=!E&&g!=null&&g.path===A&&e.scrollTop!==g.scrollTop;if(se&&(e.scrollTop=g.scrollTop),(se||ee||ne||ie||te||v&&y&&d!==A&&!b&&zF(e,ht,s,P,I))&&D.current(),E){re.current=A;return}if(!v){re.current=A;return}if(o){re.current=A;return}if(c&&!l){re.current=A;return}if(r==null){l&&ht>=0&&(VF(e,ht,s,P,Et,u),D.current()),re.current=A;return}(y||l||d===A||p===A||m?.path===A||g?.path===A||a==null||a!==A)&&(PF(r),d===A&&(Fe.current=null),p===A&&(Ie.current=null),m?.path===A&&(Le.current=null),g?.path===A&&(Re.current=null),ae.current=!1,oe.current=null),re.current=A},[t,ht,A,L,s,ft,pt,wt,P,f,gt,h,I,Et,N]);let Xt=ht>=0&&ht>=M.visible.startIndex&&ht<=M.visible.endIndex,Zt=A!=null&&Tt.some(e=>SI(e.row)===A),Qt=Xt||Zt,$t=tt&&k.current===!0&&Qt?A:null,en=Oe===`pointer`?we:null,tn=Me?.path??ze.current??en??$t??we,nn=Me?.source===`right-click`;dI(()=>{y.current&&Me==null||Nt(st(tn))},[Me,st,wt,P,Ae,Tt,tn,Nt,N]);let rn=pI(e=>{if(y.current||WI(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&ke(e=>e===`pointer`?e:`pointer`),Te(e=>e===i?e:i)},[]),an=pI(()=>{Te(null)},[]);dI(()=>{if(!_t)return;let e=()=>{Bt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Bt(),t.cancelDrag()}},[t,_t]);let on=e=>{if(!_t||t.getDragSession()==null||me.current)return;let n=jI(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ht(t.getDragSession()?.target??null),Wt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},sn=e=>{if(!_t||t.getDragSession()==null||me.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(H(),Rt(),t.setDragTarget(null))},cn=e=>{_t&&t.getDragSession()!=null&&!me.current&&(e.preventDefault(),Vt(e.clientX,e.clientY),t.completeDrag(),U(),H(),Rt(),fe.current=null)},ln=M.window.height,un=M.window.offsetTop,dn=Math.min(0,P-ln),fn=Math.min(0,P-ln-I),pn=Se===A||ae.current,mn=A!=null&&pn&&!L&&ht>=0?N[ht]??t.getVisibleRows(ht,ht)[0]??null:null,hn=mn==null?null:HF(ht,s,wt,ln),gn=fe.current,_n=xt!=null&&gn!=null&&gn.path===xt&&gn.index>=wt.start&&gn.index<=wt.end,vn=xt!=null&&gn!=null&&gn.path===xt&&!_n&&gn.path!==mn?.path?gn:null,yn=vn==null?null:HF(vn.index,s,wt,ln),bn=BI((ht>=0?N[ht]??t.getVisibleRows(ht,ht)[0]??null:null)?.ancestorPaths.at(-1)??null),xn=pt&&A!=null?tL(o,A,!L):void 0,Sn=Me?.path??(pt?A:Se),Cn=Me?.path??we,wn=st(tn),Tn=$e&&tt&&!nn&&!ft&&wn!=null&&Ee!=null&&tn!=null,En=$e&&(Tn||Me!=null),Dn=Me?.anchorRect,On=Dn==null&&wn!=null&&Ee!=null&&(Me!=null||Tn)?Ee:null,kn=Dn==null?On==null?void 0:{top:`${On}px`}:{left:`${Dn.left}px`,position:`fixed`,right:`auto`,top:`${Dn.top}px`},An=nn?{opacity:`0`}:void 0,jn=pI((e,n,r,i)=>{let a=KF({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:pt,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=M.visible.startIndex&&n.index<=M.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(k.current=!0,Ce(e=>e===c?e:c),ke(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&B(c,{targetOffset:`sticky-parents`})},[t,pt,M.visible.endIndex,M.visible.startIndex,B]),Mn=()=>{if(y.current||!tt||tn==null||wn==null)return;let e=t.getItem(tn);e!=null&&(Nt(wn),jt.current=!0,Ne({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:wn.getAttribute(`aria-label`)??tn,path:e.getPath()},path:e.getPath(),source:`button`}))},Nn={contextHoverPath:Cn,contextMenuButtonTriggerEnabled:tt,contextMenuButtonVisibility:nt,contextMenuEnabled:$e,contextMenuRightClickEnabled:rt,contextMenuTriggerMode:et,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:_t,draggedPathSet:yt,dragTarget:bt,gitLaneActive:ct,gitStatusByPath:n,handleRowDragEnd:Kt,handleRowDragStart:Gt,handleRowTouchStart:qt,ignoredGitDirectories:r,ignoredInheritanceCache:ye,instanceId:o,itemHeight:s,onKeyDown:Jt,onRowClick:jn,openContextMenuForRow:Pt,registerButton:it,registerRenameInput:ot,renameView:ut,renderDecorationForRow:R,resolveIcon:lt,shouldSuppressContextMenu:It,visualFocusPath:Sn},Pn={...Nn,registerButton:at};return Z(`div`,{ref:S,id:St,"data-file-tree-context-menu-button-visibility":$e&&tt?nt:void 0,"data-file-tree-context-menu-trigger-mode":$e?et:void 0,"data-file-tree-has-context-menu-action-lane":$e&&tt?`true`:void 0,"data-file-tree-has-git-lane":ct?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:_t?sn:void 0,onDragOver:_t?on:void 0,onDrop:_t?cn:void 0,onKeyDown:Jt,onPointerLeave:$e?an:void 0,onPointerOver:$e?rn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Z(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:bn}}),Z(`slot`,{name:ak,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":pt?`true`:`false`,children:Z(`input`,{ref:w,"aria-activedescendant":xn,"aria-controls":St,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ge?`true`:void 0,value:mt,onBlur:()=>{(d!==`retain`||qe.current)&&t.closeSearch()},onFocus:Je,onPointerDown:Je,onInput:e=>{Je();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ze&&Tt.length>0?Z(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Z(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${j}px`},children:Tt.map((e,t)=>oL(Pn,e.row,`sticky:${SI(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Tt.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Et}px`},children:[Z(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${un}px`}}),Z(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${ln}px`,top:`${dn}px`,bottom:`${fn}px`},children:[sL(Nn,wt,Dt),mn!=null&&hn!=null?oL(Nn,mn,`parked:${mn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:xt===mn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${hn}px`}}):null,vn!=null&&yn!=null?oL(Nn,vn,`parked-drag:${vn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${yn}px`}}):null]})]})]}),$e?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":En?`true`:`false`,style:kn,children:[Z(`button`,{ref:v,type:`button`,"data-type":sk,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":Me==null?`false`:`true`,"data-visible":Tn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),Me!=null){z();return}Mn()},tabIndex:-1,style:An,children:Z($P,{...lt(`file-tree-icon-ellipsis`)})}),Me==null?null:Z(`slot`,{name:ok})]}):null,Me==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),z()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),z()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var lL={hydrateRoot:(e,t)=>{JP(wP(cL,t),e)},renderRoot:(e,t)=>{qP(wP(cL,t),e)},unmountRoot:e=>{qP(null,e)}};function uL(e,t){lL.renderRoot(e,t)}function dL(e,t){lL.hydrateRoot(e,t)}function fL(e){lL.unmountRoot(e)}var pL=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};function mL(e,t,n){if(!e.s){if(n instanceof hL){if(!n.s)return void(n.o=mL.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(mL.bind(null,e,t),mL.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var hL=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{mL(r,1,a(this.v))}catch(e){mL(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?mL(r,1,t?t(i):i):n?mL(r,1,n(i)):mL(r,2,i)}catch(e){mL(r,2,e)}},r},e}();Array.isArray;var gL=0;function _L(e){return e!=null&&e.length>0?e:(gL+=1,`pst_ft_${gL}`)}function vL({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??ZM)}function yL(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function bL(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function xL(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var SL=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new pL;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=_L(a),this.#p=$N(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=XM(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new JN({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(fL(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=eP(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&uL(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),uL(t.wrapper,this.#w()))}setGitStatus(e){let t=$N(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&uL(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),uL(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),dL(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),uL(r,this.#w())}#C(){return{initialViewportHeight:vL({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(ak,e());return}this.#l.setSlotHtml(ak,this.#e?.header?.html??null)}#k(e){let t=xL(e).find(e=>bL(e)),n=yL(YO(lk(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=xL(e),n=t.find(e=>bL(e)),r=t.filter(e=>e!==n),i=lk(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=yL(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=lk(this.#m);t.colored&&ZO(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${tk}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(tk,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=tN(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return sN(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},CL=`_jZ _n`,wL=`<div><input type=search placeholder="Filter files…" aria-label="Filter files"></div>`,TL=` D l`,EL=F(18,e=>kt(e,`b`,e.l,HL(e))),DL=H(11,EL),OL=F(10,e=>DL(e,(e.j??e.h)||``)),kL=H(17,EL),AL=F(16,e=>kL(e,UL(e))),jL=H(15,AL),ML=F(14,e=>jL(e,WL(e)),2),NL=xt(7,e=>{OL(e),ML(e)}),PL=F(6,e=>NL(e,e.e,e.f)),FL=H(4,PL),IL=H(5,PL),LL=Tt(9,e=>{OL(e),ML(e)}),RL=(e,t)=>VL(e,t.timer),zL=I(`l3`,e=>{Nt(e,`b`),M(e.b,`keydown`,function(t){t.key===`Enter`&&e.p(),t.key===`Escape`&&e.l&&(t.preventDefault(),e.r(``))})});function BL(e){R(e.a,`_jY`),R(e.b,CL),LL(e,null),RL(e,{timer:0}),zL(e)}var VL=H(13,e=>{ML(e),AL(e)}),HL=e=>function(t){e.r(t)},UL=e=>t=>{if(e.n&&clearTimeout(e.n),!t){e.n=0,LL(e,null),NL(e,``);return}LL(e,t),e.n=setTimeout(e.p,150)},WL=e=>()=>{e.n&&=(clearTimeout(e.n),0);let t=e.j===null?e.h||``:e.j;LL(e,null),NL(e,t)};U(`l0`,HL),U(`l2`,UL),U(`l1`,WL);var GL=(e=>`<div><div title="Drag to resize"></div><div>${e}</div><!><div><div></div></div></div>`)(wL),KL=(e=>` D b D/${e}&l%b D m`)(TL),qL={A:`added`,D:`deleted`,M:`modified`,R:`renamed`},JL=4,YL=V(24,e=>j(e.c,e._._.o),e=>e._._),XL=e=>{YL(e),ZL(e),R(e.a,`_jP`),R(e.b,`_jQ`),R(e.d,`_jR`)},ZL=V(25,e=>j(e.e,e._._.p),e=>e._._),QL=V(24,e=>j(e.c,e._._.o),e=>e._._),$L=e=>{QL(e),eR(e),R(e.a,`_jP`),R(e.b,`_jQ`),R(e.d,`_jR`)},eR=V(25,e=>j(e.e,e._._.p),e=>e._._),tR=P(2,0,e=>j(e.c,e._.n)),nR=e=>{tR._(e),aR._(e),oR._(e),sR._(e),R(e.a,`_jL`),R(e.b,`_jO`),R(e.e,`_jS`)},rR=N(3,`<span><span>+<!></span><span>−<!></span></span>`,` D Db%l Db%`,$L),iR=F(6,e=>rR(e,e._.o||e._.p?0:1)),aR=P(2,0,iR),oR=P(2,0,iR),sR=P(2,0,e=>j(e.f,e._.v)),cR=vt(1),lR=F(2,e=>cR(e,e._._.t,()=>({id:e._.h}))),uR=V(38,lR,e=>e._._),dR=e=>{uR(e),fR._(e),R(e.a,`_jT`)},fR=P(3,0,lR),pR=F(8,e=>z(e.a,`title`,e._.q?`${e._.n}: show its files in the review`:`${e._.n}: hide its files from the review`)),mR=P(2,1,e=>{j(e.e,e._.n),pR(e)}),hR=I(`z4`,e=>M(e.a,`click`,function(){e._._.s(e._.h)})),gR=e=>{mR._(e),yR._(e),bR._(e),xR._(e),SR._(e),R(e.a,[`_jL`,`_jM`]),R(e.b,`_jN`),_(e.c),p(e.c,12),O(e.c),R(e.d,`_jO`),R(e.g,`_jS`),hR(e)},_R=N(5,`<span><span>+<!></span><span>−<!></span></span>`,` D Db%l Db%`,XL),vR=F(9,e=>_R(e,e._.o||e._.p?0:1)),yR=P(2,1,vR),bR=P(2,1,vR),xR=P(2,1,e=>{z(e.a,`aria-expanded`,e._.q?`false`:`true`),pR(e)}),SR=P(2,1,e=>j(e.h,e._.v)),CR=F(18,e=>R(e.a,[`_jJ`,{_jG:e._.a2,_jH:e.q,_jI:!e._.a2&&e.h===e._.r}]),3),wR=F(17,e=>z(e.e,`hidden`,e.q||!e.k)),TR=H(16,e=>{CR(e),wR(e),xR(e)}),ER=F(8,e=>TR(e,!e._.a2&&e._.q.has(e.h)),2),DR=Et(6,ER),OR=e=>{DR._(e),kR._(e),jR._(e),NR._(e),R(e.b,`_jK`)},kR=yt(6,17,7,CR),AR=N(3,`<div><!></div>`,` D%`,dR),jR=Et(6,e=>AR(e,+!e._.t)),MR=N(2,`<div><span> </span><!><span> </span></div>`,` D D l%b D `,nR,(e=>`<button type=button><span aria-hidden=true>${e}</span><span> </span><!><span> </span></button>`)(S),(e=>` D D/${e}&l D l%b D m`)(k),gR),NR=Et(6,e=>{R(e.e,[`_jV`,{_jU:e._.a2}]),MR(e,+!e._.a2),ER(e),CR(e)}),PR=H(7,e=>{z(e.a,`data-section`,e.h),z(e.e,`data-tree`,e.h),ER(e),CR(e),fR(e)}),FR=H(21,e=>{SR(e),sR(e)}),IR=F(20,e=>FR(e,e.t?`${e.k}/${e.l}`:`${e.l}`),2),LR=H(19,IR),RR=F(12,e=>LR(e,e.k!==e.l)),zR=H(10,e=>{RR(e),IR(e),wR(e)}),BR=H(11,e=>{RR(e),IR(e)}),VR=(e,t)=>{PR(e,t[0]?.id),zR(e,t[0]?.files?.length),BR(e,t[0]?.total),HR(e,t[0]?.label),WR(e,t[0]?.additions),KR(e,t[0]?.deletions)},HR=H(13,e=>{mR(e),tR(e)}),UR=L(QL,YL),WR=H(14,e=>{yR(e),aR(e),UR(e)}),GR=L(eR,ZL),KR=H(15,e=>{bR(e),oR(e),GR(e)}),qR=vt(1),JR=P(4,0,e=>qR(e,e._.p)),YR=e=>{JR._(e),R(e.a,`_jC`)},XR=xt(24,e=>FL(e.d,e.y)),ZR=F(11,e=>XR(e,e.j,e.k)),QR=H(9,ZR),$R=H(10,ZR),ez=H(34),tz=F(31,e=>ez(e,Dz(e))),nz=Tt(26,e=>{jt(e.a,e.a0==null?void 0:`--tree-w:${e.a0}px`),tz(e)}),rz=Tt(27,e=>R(e.b,[`_jX`,{_jW:e.a1}])),iz=(e,t)=>dz(e,t.id),az=I(`z6`,e=>{M(e.b,`pointerdown`,function(t){e.a6(t)}),M(e.b,`pointermove`,function(t){e.a7(t)}),M(e.b,`pointerup`,function(t){e.a8(t)}),M(e.b,`pointercancel`,function(t){e.a8(t)})});function oz(e){R(e.c,`_jB`),BL(e.d),IL(e.d,Oz(e)),R(e.f,`_jD`),nz(e,t()),rz(e,!1),iz(e,{id:-1}),az(e)}var sz=H(28,e=>{R(e.g,[`_jF`,{_jE:e.a2}]),NR(e)}),cz=(e,t)=>sz(e,t===1),lz=H(32),uz=H(33),dz=H(30,e=>{lz(e,kz(e)),uz(e,Az(e)),tz(e)}),fz=(e,t)=>R(e.a,[`_jA`,{_jz:t===!1}]),pz=N(4,`<div><!></div>`,` D%`,YR),mz=H(15,e=>{pz(e,+!e.p),JR(e)}),hz=bt(6,`<div><div data-head><!><!></div><div></div></div>`,` D D%b%l `,OR,VR),gz=I(`z5`,e=>Ct(e,{sections:e.m,folded:e.q,commentCounts:e.u,newKeys:e.v,onMount:function(){let t=(e,t)=>`${e.id}/${t}`,n=e=>e.files.map(e=>({path:e.path,status:qL[e.status]??`modified`})),r=e=>e.files.map(e=>`${e.path}:${e.status}`).join(`
2798
- `),i=(e,t)=>[...e].map(([e,t])=>`${e}=${t}`).sort().join(`,`)+`|`+[...t].sort().join(`,`),a=new Map,o=t=>e.a.querySelector(`[data-tree="${CSS.escape(t)}"]`),s={raf:0},c=()=>{s.raf=0;let t=this.sections,n=this.folded,r=t.map(e=>({host:o(e.id),rec:a.get(e.id),open:t.length===1||!n.has(e.id)}));if(t.length===1){for(let e of r)e.host&&(e.host.style.height=``);return}let i=r.find(e=>e.rec)?.rec.tree.getItemHeight()||0;if(!i)return;let c=e.g.offsetHeight;for(let e of r)e.host&&(c-=e.host.offsetHeight);let l=Math.max(0,Math.floor((e.f.clientHeight-c)/i)),u=r.filter(e=>e.host&&e.rec&&e.open).map(e=>({host:e.host,want:e.rec.tree.getVisibleCount()})).sort((e,t)=>e.want-t.want);u.forEach((e,t)=>{let n=Math.floor(l/(u.length-t)),r=Math.min(e.want,Math.max(n,JL));l=Math.max(0,l-r),e.host.style.height=`${r*i}px`})},l=()=>{s.raf||=requestAnimationFrame(c)},u=new ResizeObserver(l),d=()=>{u.disconnect(),u.observe(e.f);for(let t of e.a.querySelectorAll(`[data-head]`))u.observe(t)},f=i=>{let s=o(i.id);if(!s)return;let c=new SL({paths:i.files.map(e=>e.path),gitStatus:n(i),initialExpansion:`open`,flattenEmptyDirectories:!0,search:!1,onSelectionChange(n){if(n.length===1){let r=t(i,n[0]);queueMicrotask(()=>e.w(r))}},renderRowDecoration({row:n}){if(n.kind!==`file`)return null;let r=t(i,n.path),a=e.u.has(r),o=e.v.has(r);if(!a&&!o)return null;let s=[];return o&&s.push({text:`●`,color:`var(--accent)`}),a&&s.push({text:`${o?` `:``}✎ ${e.u.get(r)??``}`.trimEnd(),color:`var(--dim)`}),{text:s.map(e=>e.text).join(``),parts:s,title:[o&&`Changed since your last visit`,a&&`Has review comments`].filter(Boolean).join(` · `)}}});c.render({containerWrapper:s});let u=c.subscribe(l);a.set(i.id,{tree:c,sig:r(i),unsub:u})};for(let t of e.m)f(t);return d(),l(),{trees:a,build:f,sig:r,gitStatus:n,marks:i,shownMarks:i(e.u,e.v),frame:s,ro:u,observe:d,schedule:l}},onUpdate:function(){let e=this.marks(this.commentCounts,this.newKeys),t=e!==this.shownMarks;this.shownMarks=e;let n=new Set(this.sections.map(e=>e.id));for(let[e,t]of this.trees)n.has(e)||(t.unsub(),t.tree.cleanUp(),this.trees.delete(e));for(let e of this.sections){let n=this.trees.get(e.id);if(!n){this.build(e);continue}let r=this.sig(e);r===n.sig?t&&n.tree.setGitStatus(this.gitStatus(e)):(n.sig=r,n.tree.resetPaths(e.files.map(e=>e.path)),n.tree.setGitStatus(this.gitStatus(e)))}this.observe(),this.schedule()},onDestroy:function(){cancelAnimationFrame(this.frame.raf),this.ro.disconnect();for(let e of this.trees.values())e.unsub(),e.tree.cleanUp()}})),_z=F(23,gz,4),vz=H(12,e=>{cz(e,e.m?.length),hz(e,[e.m,`id`]),_z(e)}),yz=H(16,e=>{_z(e),DR(e)}),bz=H(20,_z),xz=H(21,_z),Sz=H(22,_z),Cz=H(17,kR),wz=H(18),Tz=L(uR),Ez=H(19,e=>{jR(e),Tz(e)}),Dz=e=>t=>{t.pointerId===e.a4&&(e.a4=-1,rz(e,!1),e.a0!=null&&tt(e.a0))},Oz=e=>t=>{XR(e,t)},kz=e=>t=>{(t.pointerType!==`mouse`||t.button===0)&&(t.preventDefault(),e.a4=t.pointerId,rz(e,!0),e.b.setPointerCapture(t.pointerId))},Az=e=>t=>{if(t.pointerId!==e.a4)return;let n=window.innerWidth-t.clientX;nz(e,Math.min(640,Math.max(200,n)))};U(`z2`,Dz),U(`z3`,Oz),U(`z0`,kz),U(`z1`,Az);var jz=`_js _ba`,Mz=`<!><!><!>`,Nz=e=>R(e.a,`_jw`),Pz=e=>{WS(e.a),GS(e.a,12),KS(e.a,`_jy`)},Fz=e=>R(e.a,[`_A`,`_jx`]),Iz=P(1,0,e=>{z(e.a,`title`,e._.f),j(e.b,e._.f)}),Lz=e=>{Iz._(e),R(e.a,jz)},Rz=P(1,1,e=>j(e.c,e._.m)),zz=e=>{Rz._(e),Bz._(e),R(e.a,`_jk`),R(e.b,`_jn`),R(e.d,`_jo`)},Bz=P(1,1,e=>j(e.e,e._.o)),Vz=N(6,HS,(e=>`/${e}&`)(US),Pz),Hz=F(11,e=>Vz(e,+!e._._._._._.y.has(e.k))),Uz=V(35,Hz,e=>e._._._._._),Wz=I(`i4`,e=>M(e.a,`click`,function(){ZB(e._._._._._,!1)})),Gz=e=>{Uz(e),Jz(e),Xz(e),R(e.a,[`_jr`,`_y`]),R(e.b,`__`),R(e.d,`_jt`),Wz(e)},Kz=N(5,`<span title="Changed since your last visit"></span>`,` `,Fz),qz=F(12,e=>Kz(e,+!e._._._._._.z.has(e.k))),Jz=V(36,qz,e=>e._._._._._),Yz=F(13,e=>z(e.a,`href`,e._._._._._.a1(e.k))),Xz=V(38,Yz,e=>e._._._._._),Zz=H(10,e=>{Yz(e),qz(e),Hz(e)}),Qz=(e,t)=>{z(e.b,`data-status`,t),j(e.c,t)},$z=(e,t)=>j(e.e,t),eB=(e,t)=>{Zz(e,(t?.[0]).file?.key),Qz(e,(t?.[0]).file?.status),$z(e,(t?.[0]).name)},tB=e=>R(e.a,`_jq`),nB=N(1,`<div><bdi><!>/</bdi></div>`,` E%`,Lz),rB=H(5,e=>{nB(e,+!e.f),Iz(e)}),iB=bt(2,`<a><span> </span><span><bdi> </bdi></span><!><!></a>`,` D D l E m%b%`,Gz,eB),aB=(e,t)=>iB(e,[t,e=>e.file.key]),oB=bt(0,`<div><!><!></div>`,` D%b%`,tB,(e,t)=>{rB(e,(t?.[0]).dir),aB(e,(t?.[0]).files)}),sB=F(1,e=>oB(e,[e._._._.a2(e._.f),`dir`])),cB=V(39,sB,e=>e._._._),lB=e=>{cB(e),uB._(e)},uB=P(3,0,sB),dB=vt(1),fB=F(2,e=>dB(e,e._._._.t,()=>({id:e._.g}))),pB=V(33,fB,e=>e._._._),mB=e=>{pB(e),hB._(e),R(e.a,`_jp`)},hB=P(2,0,fB),gB=P(1,0,e=>j(e.e,e._.m)),_B=I(`i3`,e=>M(e.a,`click`,function(){e._._._.s(e._.g)})),vB=e=>{gB._(e),yB._(e),bB._(e),R(e.a,[`_jk`,`_jl`]),R(e.b,`_jm`),_(e.c),p(e.c,12),O(e.c),R(e.d,`_jn`),R(e.f,`_jo`),_B(e)},yB=P(1,0,e=>{z(e.a,`aria-expanded`,e._.n?`false`:`true`),z(e.a,`title`,e._.n?`Show this section's files in the review`:`Hide this section's files from the review`)}),bB=P(1,0,e=>j(e.g,e._.o)),xB=N(3,`<!><!><!>`,`b%`,lB),SB=H(13,e=>{R(e.a,[`_jj`,{_ji:e.n}]),xB(e,+!!e.n),yB(e)}),CB=F(7,e=>SB(e,e._._.a0&&e._._.r.has(e.g)),2),wB=V(32,CB,e=>e._._),TB=e=>{wB(e),DB(e),kB(e)},EB=N(2,`<div><!></div>`,` D%`,mB),DB=V(33,e=>EB(e,+!e._._.t),e=>e._._),OB=N(1,(e=>`<button type=button><span aria-hidden=true>${e}</span><span> </span><span> </span></button>`)(S),(e=>` D D/${e}&l D l D m`)(k),vB,`<div><span> </span><span> </span></div>`,` D D l D `,zz),kB=V(37,e=>{OB(e,+!e._._.a0),CB(e)},e=>e._._),AB=H(6,e=>{CB(e),hB(e)}),jB=H(14,e=>{bB(e),Bz(e)}),MB=F(11,e=>jB(e,e.j===e.k?`${e.k}`:`${e.j}/${e.k}`)),NB=H(9,MB),PB=H(10,MB),FB=(e,t)=>IB(e,t[0]),IB=H(5,e=>{AB(e,e.f?.id),NB(e,e.f?.files?.length),PB(e,e.f?.total),LB(e,e.f?.label),uB(e)}),LB=H(12,e=>{gB(e),Rz(e)}),RB=vt(1),zB=V(31,e=>RB(e,e._._.q),e=>e._._),BB=e=>{zB(e),R(e.a,`_ju`)},VB=bt(11,`<div><!><!><!></div>`,` D%b%b%`,TB,FB),HB=P(0,0,e=>VB(e,[e._.l,`id`])),UB=I(`i5`,e=>{M(e.a,`click`,function(){ZB(e._,!1)}),M(e.f,`click`,function(){ZB(e._,!1)})}),WB=e=>{HB._(e),KB._(e),qB._(e),YB._(e),R(e.a,`_je`),R(e.b,`_jf`),R(e.c,`_jg`),R(e.d,`_jd`),R(e.e,`_z`),R(e.f,[m,`_jc`]),s(e.g),ie(e.g,16),pt(e.g),R(e.h,`_jv`),BL(e.i),IL(e.i,wV(e)),R(e.k,`_jh`),UB(e)},GB=N(9,`<div><!></div>`,` D%`,BB),KB=P(0,0,e=>GB(e,+!e._.q)),qB=P(0,0,e=>FL(e.i,e._.w)),JB=N(12,`<p>No files match.</p>`,` `,Nz),YB=P(0,0,e=>JB(e,+!!e._.a3)),XB=N(0,((e,t)=>`<div></div><div role=dialog aria-label="Jump to file"><div><strong>Files</strong><span></span><button type=button title=Close aria-label=Close>${e}</button></div><div>${t}<!></div><div><!><!></div></div>`)(dt,wL),((e,t)=>` b D D b b D/${e}&m D/${t}&%l D%b%m`)(oe,TL),WB),ZB=xt(20,e=>XB(e,+!e.u)),QB=F(5,e=>ZB(e,e.d,e.e)),$B=H(3,QB),eV=H(4,QB),tV=xt(22,qB),nV=F(8,e=>tV(e,e.g,e.h)),rV=H(6,nV),iV=H(7,nV),aV=H(24,L(Uz)),oV=(e,t)=>aV(e,t||new Set),sV=H(25,L(Jz)),cV=(e,t)=>sV(e,t||new Set),lV=H(26,L(kB)),uV=(e,t)=>lV(e,t>1),dV=H(27,L(Xz)),fV=F(15,e=>dV(e,TV(e))),pV=H(13,fV),mV=H(14,fV),hV=H(28);function gV(e){hV(e,EV)}var _V=H(29,YB),vV=H(11,e=>{uV(e,e.l?.length),_V(e,e.l.reduce((e,t)=>e+t.files.length,0)),HB(e)}),yV=L(zB),bV=H(16,e=>{KB(e),yV(e)}),xV=H(17,L(wB)),SV=H(18),CV=H(19,L(DB,pB)),wV=e=>t=>{tV(e._,t)},TV=e=>t=>b({workspaceId:e.n,view:`diff`,scope:e.o??null,file:t});function EV(e){let t=[],n=new Map;for(let r of e.files){let e=r.label.slice(r.label.indexOf(`/`)+1),i=e.lastIndexOf(`/`),a=i<0?``:e.slice(0,i),o=i<0?e:e.slice(i+1),s=n.get(a);s||(n.set(a,s={dir:a,files:[]}),t.push(s)),s.files.push({file:r,name:o})}return t}U(`i2`,wV),U(`i0`,TV),U(`i1`,EV);var DV=`b%c`,OV=`<!><!><!>`,kV=(e=>`/${e}&`)(mT),AV=pT,jV=((e,t,n,r,i)=>`<div><div><div><div><div><!><h1>Review</h1><!></div><div><!><button title="Refresh diff">${e}</button><!><span><button aria-label=Compare>${t}</button><select aria-label=Compare tabindex=-1><option value=committed>Committed</option><option value=working>Working tree</option><option value=dirty>Uncommitted</option><!></select></span> <div>${n}</div><!></div></div><div><!><!><!><!></div></div><div data-diff-main></div></div>${r}${i}</div>`)($e,Je,fw,GL,Mz),MV=((e,t,n,r,i)=>` D D D D D%b b%l D%b D/${e}&l%b D D/${t}&l Dd%mb D0${n}&l%m D%b%b%b%m l/${r}&/${i}&l`)(Le,He,pw,KL,`b%c`);function NV(e){return e.split(`
2797
+ }`}var mM=new WeakMap;function hM(e){let t=mM.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(mO,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),mM.set(e,i),i}function gM(e,t){if(!e.isConnected)return;let n=hM(t);if(n==null)return;let r=t.querySelector(`style[${hO}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(hO,``),t.appendChild(i)),i.textContent=`:host { ${gO}: ${n}px; }`}var _M;function vM(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){_M??(_M=new CSSStyleSheet,_M.replaceSync(fM(uM)));let t=!1;try{e.adoptedStyleSheets=[_M],t=!0}catch{}if(t){e.querySelector(`style[${fO}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(fO,``),t.textContent=fM(uM),e.prepend(t)}}function yM(e,t){bM(e,t),vM(t),gM(e,t)}function bM(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});yM(this,e)}}if(customElements.define(dO,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(dO)))e instanceof HTMLElement&&yM(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var xM=e=>e.startsWith(`f::`)?e.slice(3):e;function SM(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function CM(e,t){return e===``?t:`${e}/${t}`}function wM({files:e,path:t,isFolder:n,nextBasename:r}){let i=xM(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=SM(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=CM(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function TM(e){return e.endsWith(`/`)}function EM(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function DM(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function OM(e,t){return t.includes(e)?DM(t):[e]}function kM(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function AM(e,t){return{draggedPaths:e,target:t}}function jM(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(TM(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function MM(e,t){return t.kind===`root`||t.directoryPath==null?EM(e):t.directoryPath}function NM(e,t){let n=e.map(e=>{let n=MM(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function PM(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function FM(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!PM(aM.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function IM(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function LM(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function RM(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function zM(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return RM(e,t.path)?n?e:null:e;case`move`:return LM(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=zM(r,e,n),r==null)return null;return r}}}function BM(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function VM(e){switch(e.operation){case`add`:return{...BM(e),operation:`add`,path:e.path};case`remove`:return{...BM(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...BM(e),from:e.from,operation:`move`,to:e.to}}}function HM(e){return{...BM(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>VM(e)),operation:`batch`}}function UM(e){switch(e.operation){case`add`:case`remove`:case`move`:return VM(e);case`batch`:return HM(e);default:return null}}function WM(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function GM(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function KM(e){return GM(e).at(-1)??null}function qM(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function JM(e){return e.endsWith(`/`)}var YM=e=>e.toLowerCase();function XM(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function ZM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function QM(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var $M=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},eN=Symbol(`FILE_TREE_RENAME_VIEW`),tN=512,nN=512;function rN(e){return e===`top`||e===`center`?e:`nearest`}function iN(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=GM(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function aN(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:iN(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var oN=class e{static{Object.defineProperty(e.prototype,eN,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=FM({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=KM(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:rN(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=nN){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t!=null&&this.#B.has(t)&&this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=OM(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=AM(t.draggedPaths,n);(jM(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}kM(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=AM(e.draggedPaths,t);if(jM(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=NM(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=JM(r),a=ZM(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of GM(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=XM(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,JM(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,JM(e)?{recursive:!0}:void 0);return}let t=JM(e),n=wM({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:ZM(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(QM(n.sourcePath,t),QM(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=FM({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!WM(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=KM(e),n=qM(e,t),r=null,i=null;for(let e of this.#be()){if(KM(e)!==t)continue;let a=qM(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=GM(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!WM(this.#B,r),a=this.#z!==t;(i||a)&&(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new aM({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of GM(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(YM),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(YM),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of GM(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:$M(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of GM(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of GM(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=aN(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,tN)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=zM(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=zM(this.#c,e,!0),r=[...this.#B].map(t=>zM(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=zM(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return WM(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&IM(e)&&(this.#i=null);let t=IM(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=UM(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},sN=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function cN(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function lN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function uN(e,t){return t?`${e}/`:e}function dN(e,t=null){let n=sN(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=pN(t);e!=null&&gN({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function fN(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=mN(e);t!=null&&(c=hN({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=pN(e);t!=null&&(c=gN({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:yN(i),statusByPath:i}:e}function pN(e){return mN(e.path)}function mN(e){let t=cN(e);if(t!=null)return{canonicalPath:uN(t.path,t.isDirectory),isDirectory:t.isDirectory}}function hN({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),vN(t,n,e),!0)}function gN({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??_N(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function _N(e,t,n){for(let r of lN(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function vN(e,t,n){for(let r of lN(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function yN(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN={},jN=[],MN=Array.isArray,NN=jN.slice,PN=Object.assign;function FN(e){e&&e.parentNode&&e.remove()}function IN(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?NN.call(arguments,2):n),LN(e,o,r,i,null)}function LN(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++xN,__i:-1,__u:0};return i==null&&bN.vnode!=null&&bN.vnode(a),a}function RN(e){return e.children}function zN(e,t){this.props=e,this.context=t,this.__g=0}function BN(e,t){if(t==null)return e.__?BN(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?BN(e):null}function VN(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return VN(e)}}function HN(e){(8&e.__g||!(e.__g|=8)||!SN.push(e)||wN++)&&CN==bN.debounceRendering||((CN=bN.debounceRendering)||queueMicrotask)(UN)}function UN(){for(var e,t,n,r,i,a,o,s,c=1;SN.length;)SN.length>c&&SN.sort(TN),e=SN.shift(),c=SN.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=PN({},r)).__v=r.__v+1,bN.vnode&&bN.vnode(n),ZN(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??BN(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,$N(a,n,o),n.__e!=i&&VN(n)));wN=0}function WN(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||jN,b=t.length;for(c=GN(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?AN:y[m.__i]||AN,m.__i=f,_=ZN(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&nP(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=KN(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function GN(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?LN(null,o,null,null,null):MN(o)?LN(RN,{children:o},null,null,null):o.constructor==null&&o.__b>0?LN(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=qN(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=BN(s)),rP(s,s));return r}function KN(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=KN(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=BN(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function qN(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function JN(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function YN(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||JN(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||JN(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(EN,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=DN,e.addEventListener(t,a?kN:ON,a)):e.removeEventListener(t,a?kN:ON,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function XN(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=DN++;else if(t.u<n.l)return;return n(bN.event?bN.event(t):t)}}}function ZN(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,O,te,ne,k=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=bN.__b)&&d(t);n:if(typeof k==`function`)try{if(v=t.props,y=`prototype`in k&&k.prototype.render,b=(d=k.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new k(v,x):(t.__c=f=new zN(v,x),f.constructor=k,f.render=iP),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=PN({},f.__s)),PN(f.__s,k.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&k.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=bN.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=PN({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===RN&&d.key==null&&(E=eP(d.props.children)),s=WN(e,MN(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(D=0,ee=!1,t.__u|=c?160:128,t.__c.__z=[],O=0;O<a.length;O++)(te=a[O])==null||ee||(te.nodeType==8&&te.data==`$s`?(D>0&&t.__c.__z.push(te),D++,a[O]=null):te.nodeType==8&&te.data==`/$s`?(--D>0&&t.__c.__z.push(te),ee=D===0,s=a[O],a[O]=null):D>0&&(t.__c.__z.push(te),a[O]=null));if(!ee){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(ne=a.length;ne--;)FN(a[ne]);QN(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||QN(t);bN.__e(e,t,n)}else s=t.__e=tP(n.__e,t,n,r,i,a,o,c,l,u);return(d=bN.diffed)&&d(t),128&t.__u?void 0:s}function QN(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(QN)}function $N(e,t,n){for(var r=0;r<n.length;r++)nP(n[r],n[++r],n[++r]);bN.__c&&bN.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){bN.__e(e,t.__v)}})}function eP(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:MN(e)?e.map(eP):PN({},e)}function tP(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(bN.__m&&bN.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=NN.call(e.childNodes),v=n.props||AN,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;YN(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||YN(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),WN(b==`template`?e.content:e,MN(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&BN(n,0),s,c,l),a!=null)for(u=a.length;u--;)FN(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||YN(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&YN(e,u,g,v[u],i))}return e}function nP(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){bN.__e(e,n)}}function rP(e,t,n){var r,i;if(bN.unmount&&bN.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||nP(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){bN.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&rP(r[i],t,n||typeof e.type!=`function`);n||FN(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function iP(e,t,n){return this.constructor(e,n)}function aP(e,t){var n,r,i,a;t==document&&(t=document.documentElement),bN.__&&bN.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=IN(RN,null,[e]),i=[],a=[],ZN(t,e,r||AN,AN,t.namespaceURI,r?null:t.firstChild?NN.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),$N(i,e,a)}function oP(e,t){e.__u|=32,aP(e,t)}bN={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw wN=0,e}},xN=0,zN.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=PN({},this.state);typeof e==`function`&&(e=e(PN({},n),this.props)),e&&PN(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),HN(this))},zN.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),HN(this))},zN.prototype.render=RN,SN=[],wN=0,TN=function(e,t){return e.__v.__b-t.__v.__b},EN=/(PointerCapture)$|Capture$/i,DN=0,ON=XN(!1),kN=XN(!0);var sP=0;Array.isArray;function Z(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--sP,__i:-1,__u:0,__source:i,__self:a};return bN.vnode&&bN.vnode(l),l}var cP=16,lP=16,uP={};function dP({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=uP[e]??{width:cP,height:lP},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Z(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Z(`use`,{href:c})})}var fP=e=>e!==void 0&&/\s/.test(e),pP=(e,t)=>{let n=t=>fP(e[t-1])||fP(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},mP=e=>pP(e,Math.ceil(e.length/2)),hP=e=>{if(e.length<2)return[e,``];let t=mP(e);return[e.slice(0,t),e.slice(t)]},gP=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:mP(e);return[e.slice(0,r),e.slice(r)]},_P=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},vP=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},yP=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},bP=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function xP({children:e,marker:t,variant:n=`default`}){"use no memo";return Z(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Z(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Z(`span`,{"data-truncate-fade":!0}):t})})}function SP(e){"use no memo";let{mode:t,children:n}=e;return Z(`div`,{children:[Z(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Z(`span`,{children:n}):n}),Z(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Z(`span`,{children:n}):n})]})}function CP({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(SP,{mode:t,children:e},`content`),o=Z(xP,{marker:n,mode:t,variant:r},`marker`),s=Z(`div`,{"data-truncate-fill":!0},`fill`);return Z(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Z(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function wP({children:e,...t}){"use no memo";return Z(CP,{mode:`truncate`,...t,children:e})}function TP({children:e,...t}){"use no memo";return Z(CP,{mode:`fruncate`,...t,children:e})}function EP({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Z(wP,{...s,children:t[0]}),l=Z(TP,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Z(`div`,{className:a,style:o});if(e.length<i)return Z(n===`end`?TP:wP,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=hP:r===`extension`?t=gP:r===`leaf-path`&&(t=_P);else if(typeof r==`number`)t=vP,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=yP:e===`first`&&(t=bP)}else typeof r==`function`&&(t=r);t??=hP;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Z(wP,{...s,..._,children:f}),l=Z(TP,{...s,...v,children:p})}return Z(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Z(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Z(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var DP={endIndex:-1,startIndex:-1};function OP(e,t,n){return Math.min(Math.max(e,t),n)}function kP(e,t){return e<0||t<e?DP:{endIndex:t,startIndex:e}}function AP(e){return e.startIndex<0||e.endIndex<e.startIndex}function jP(e,t){return AP(e)?0:(e.endIndex-e.startIndex+1)*t}function MP(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function NP(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function PP(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function FP(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function IP(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function LP(e,t,n){if(e.length===0||t<=0)return[];let r=IP(e),i=PP(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=FP(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function RP(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=OP(t.scrollTop,0,o),c=t.stickyRows??LP(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=MP(s,n,t.itemHeight),m=MP(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?DP:kP(m,NP(u+d,n,t.itemHeight)),y=g+1,b=AP(v)?DP:kP(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=jP(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:AP(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var zP={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},BP={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},VP=`Contains git status items`;function HP(e){return e.current?!0:(e.current=!0,!1)}function UP(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function WP(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return UP({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function GP(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function KP(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function qP(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function JP(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function YP(e,t){return e!=null&&e>0?e:t}function XP(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function ZP(e,t,n,r,i=0){let a=UP({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function QP(e,t,n,r,i,a,o=0){let s=WP({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function $P(e,t,n,r,i,a){let o=GP({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function eF(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function tF(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function nF({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Z(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function rF(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function iF(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var aF,oF,sF,cF,lF=Object.is,uF=0,dF=[],fF=bN,pF=fF.__b,mF=fF.__r,hF=fF.diffed,gF=fF.__c,_F=fF.unmount,vF=fF.__;function yF(e,t){fF.__h&&fF.__h(oF,e,uF||t),uF=0;var n=oF.__H||(oF.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function bF(e){return uF=1,xF(MF,e)}function xF(e,t,n){var r=yF(aF++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):MF(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);lF(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=oF,!oF.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,lF(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};oF.__f=!0;var a=oF.shouldComponentUpdate,o=oF.componentWillUpdate;oF.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},oF.shouldComponentUpdate=i}return r.__N||r.__}function SF(e,t){var n=yF(aF++,3);!fF.__s&&jF(n.__H,t)&&(n.__=e,n.u=t,oF.__H.__h.push(n))}function CF(e,t){var n=yF(aF++,4);!fF.__s&&jF(n.__H,t)&&(n.__=e,n.u=t,oF.__h.push(n))}function Q(e){return uF=5,wF(function(){return{current:e}},[])}function wF(e,t){var n=yF(aF++,7);return jF(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function TF(e,t){return uF=8,wF(function(){return e},t)}function EF(){for(var e;e=dF.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(kF),e.__H.__h.forEach(AF),e.__H.__h=[]}catch(t){e.__H.__h=[],fF.__e(t,e.__v)}}fF.__b=function(e){oF=null,pF&&pF(e)},fF.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),vF&&vF(e,t)},fF.__r=function(e){mF&&mF(e),aF=0;var t=(oF=e.__c).__H;t&&(sF===oF?(t.__h=[],oF.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(kF),t.__h.forEach(AF),t.__h=[],aF=0)),sF=oF},fF.diffed=function(e){hF&&hF(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(dF.push(t)!==1&&cF===fF.requestAnimationFrame||((cF=fF.requestAnimationFrame)||OF)(EF)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),sF=oF=null},fF.__c=function(e,t){t.some(function(e){try{e.__h.forEach(kF),e.__h=e.__h.filter(function(e){return!e.__||AF(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],fF.__e(n,e.__v)}}),gF&&gF(e,t)},fF.unmount=function(e){_F&&_F(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{kF(e)}catch(e){t=e}}),n.__H=void 0,t&&fF.__e(t,n.__v))};var DF=typeof requestAnimationFrame==`function`;function OF(e){var t,n=function(){clearTimeout(r),DF&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);DF&&(t=requestAnimationFrame(n))}function kF(e){var t=oF,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),oF=t}function AF(e){var t=oF;e.__c=e.__(),oF=t}function jF(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!lF(t,e[n])})}function MF(e,t){return typeof t==`function`?t(e):t}function NF(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Z(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Z(RN,{children:[Z(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Z(wP,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function PF(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function FF(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function IF(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function LF({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=RP(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:IF(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?IF(u,1,t,o):i&&r<=0&&c.length>0?LP(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var RF=400,zF=40,BF=18;function VF(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?HF(e,t,n):a instanceof HTMLElement?a:null}function HF(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function UF(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function WF(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function GF(){return navigator.vendor!==`Apple Computer, Inc.`}function KF(e,t){let n=e-t.top;if(n<zF)return-Math.ceil((zF-Math.max(0,n))/zF*BF);let r=t.bottom-e;return r<zF?Math.ceil((zF-Math.max(0,r))/zF*BF):0}function qF(e,t){if(e!=null){let t=zP[e];return t==null?null:{text:t,title:BP[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:VP}:null}function JF(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function YF(e){return e!=null&&`toggle`in e}function XF(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function ZF(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function QF(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function $F(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function eI(e,t){return t&&$F(e)||(e.ctrlKey||e.metaKey)&&XF(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var tI=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function nI(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function rI(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function iI(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function aI(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function oI(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function sI(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function cI(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function lI(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function uI(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=lI(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function dI(e,t){return{kind:e.kind,name:FF(e),path:t}}function fI(e){return e==null?void 0:`${e}__tree`}function pI(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function mI(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function hI(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Z(`span`,{title:e.title,children:e.text}):Z(`span`,{title:e.title,children:e.parts.map((e,t)=>Z(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?mI(e.icon)?t(e.icon):{name:e.icon}:mI(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Z(`span`,{title:e.title,children:Z(dP,{...n})})}function gI(e){e!=null&&KP(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function _I(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=PF(e);return Z(RN,{children:[e.depth>0?Z(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Z(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Z(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Z(dP,{...t(`file-tree-icon-chevron`)}):Z(dP,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?NF(e,c,a):c??Z(EP,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:hI(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:hI(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(dP,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function vI(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:ee,resolveIcon:O,renderDecorationForRow:te,openContextMenuForRow:ne,onRowClick:k,onKeyDown:re}=e,ie=PF(t),{isParked:ae=!1,mode:oe=`flow`,style:se}=r,ce=oe===`sticky`,le=_?.get(ie)??null??JF(t.ancestorPaths,v,y),ue=t.kind===`directory`&&(b?.has(ie)??!1),de=te(t,ie),fe=qF(le,ue),pe=S&&w,me=de!=null||x||pe,he=pe&&T===`always`,ge=a.getPath()===ie,_e=ge?a.getValue():``,ve=ce||!ge?null:Z(nF,{ref:D,ariaLabel:`Rename ${FF(t)}`,isFlattened:t.isFlattened,value:_e,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ye=_I(t,O,{actionLaneEnabled:pe,customDecoration:de,decorationLaneEnabled:me,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:fe,gitLaneActive:x,renameInput:ve,showDecorativeActionAffordance:he}),be={...rF({ariaLabel:FF(t),domId:t.isFocused?pI(h,ie,ae):void 0,extraStyle:se,features:{actionLaneEnabled:pe,contextMenuButtonVisibility:pe?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:ae,itemHeight:g,mode:oe,row:t,state:{containsGitChange:ue,effectiveGitStatus:le,isContextHovered:s===ie,isDragTarget:l?.kind===`directory`&&l.directoryPath===ie,isDragging:c?.has(ie)===!0,isFocusRinged:t.isFocused&&o===ie},targetPath:ie}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(ie),ne(t,ie,{anchorRect:iI(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ce?void 0:()=>{i.focusMountedPathFromInput(ie)},onKeyDown:ce?void 0:re,ref:e=>{ee(ie,e)}};return!ce&&ge?Z(`div`,{...be,children:ye}):Z(`button`,{...be,type:`button`,draggable:u&&!ae,onDragEnd:u&&!ae?p:void 0,onDragStart:u&&!ae?e=>{f(e,t,ie)}:void 0,onMouseDown:e=>{if(ce){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!ae?e=>{m(e,t,ie)}:void 0,onClick:e=>{k(e,t,ie,oe)},children:ye})}function yI(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(PF(e))).map((n,r)=>vI(e,n,t.start+r))}function bI({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=lM,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=Q(null),v=Q(null),y=Q(!1),b=Q(null),x=Q(null),S=Q(null),C=Q(null),w=Q(null),T=Q(new Map),E=Q(new Map),D=Q(()=>{}),ee=Q(null),O=Q(0),te=Q(!1),ne=Q(null);ne.current!==t&&(te.current=!1,ne.current=t);let k=Q(!1),re=Q(null),ie=Q(null),ae=Q(!1),oe=Q(null),se=Q(null),ce=Q(null),le=Q(null),ue=Q(null),de=Q(null),fe=Q(null),pe=Q(null),me=Q(!1),he=Q(null),ge=Q(null),_e=Q(null),ve=Q(null),ye=wF(()=>new Map,[]),[,be]=bF(0),xe=Q(!1),[Se,Ce]=bF(null),[we,Te]=bF(null),[Ee,De]=bF(null),[Oe,ke]=bF(null),[Ae,je]=bF(0),[Me,Ne]=bF(null),Pe=Q(Me);Pe.current=Me;let Fe=Q(null),Ie=Q(null),Le=Q(null),Re=Q(null),ze=Q(null),Be=Q(!1),Ve=()=>{Ie.current=null,Le.current=null,Re.current=null},He=(e,t)=>{Ie.current=e,Le.current=null,Re.current=t==null?null:{path:e,scrollTop:t}},Ue=(e,t)=>{Ie.current=null,Le.current={path:e,viewportOffset:t},Re.current=null},We=Q(d===`retain`&&t.isSearchOpen()),[Ge,Ke]=bF(p);SF(()=>{p||Ke(!1)},[p]);let qe=Q(!1),Je=TF(()=>{qe.current=!0,Ke(e=>e&&!1)},[]),[Ye,Xe]=bF(()=>LF({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ze,Qe]=bF(!1);SF(()=>{Qe(!0)},[]);let $e=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,et=e?.contextMenu?.triggerMode??($e?`right-click`:`both`),tt=et===`both`||et===`button`,nt=e?.contextMenu?.buttonVisibility??`when-needed`,rt=et===`both`||et===`right-click`;CF(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ze.current=t,Te(t),ke(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Be.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let it=TF((e,t)=>{oI(T.current,e,t)},[]),at=TF((e,t)=>{oI(E.current,e,t)},[]),ot=TF(e=>{x.current=e},[]),st=TF(e=>sI(e,E.current,T.current),[]),ct=n!=null||r!=null||i!=null,{resolveIcon:lt}=wF(()=>EO(a),[a]),ut=t[eN](),dt=ut.getPath(),ft=dt!=null,pt=t.isSearchOpen(),mt=t.getSearchValue(),A=t.getFocusedPath(),ht=t.getFocusedIndex(),gt=t.getScrollRequest(),_t=t.isDragAndDropEnabled(),vt=t.getDragSession(),yt=wF(()=>vt==null?null:new Set(vt.draggedPaths),[vt]),bt=vt?.target??null,xt=vt?.primaryPath??null,St=fI(o),{overlayHeight:Ct,overlayRows:wt,snapshot:j,visibleRows:Tt}=Ye,M=j.physical.viewportHeight,N=wF(()=>({end:j.window.endIndex,start:j.window.startIndex}),[j.window.endIndex,j.window.startIndex]),P=wt,Et=j.sticky.rows,Dt=j.physical.totalHeight,F=j.sticky.height,Ot=wF(()=>new Set(Et.map(e=>PF(e.row))),[Et]),I=ht>=0&&ht>=N.start&&ht<=N.end,kt=TF((e,t)=>u?.({item:dI(e,t),row:e})??null,[u]),L=TF(e=>KP(e==null?null:T.current.get(e)??null)?!0:KP(S.current),[]),R=TF(e=>{L(t.focusNearestPath(e))},[t,L]),At=Q(R);At.current=R;let jt=Q(!0),Mt=Q(()=>{}),Nt=TF((t=!0)=>{let n=Pe.current;n!=null&&(jt.current=jt.current&&t,Ne(null),e?.contextMenu?.onClose?.(),jt.current&&R(n.path))},[e?.contextMenu,R]);Mt.current=Nt;let Pt=TF(e=>{let t=e==null?null:aI(S.current,e);De(e=>e===t?e:t)},[]),z=TF((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=st(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;He(n,e?.scrollTop??null),k.current=!0,Ce(e=>e===n?e:n)}i.focus(),Pt(a),jt.current=!0,Ne({anchorRect:r?.anchorRect??null,item:dI(e,n),path:n,source:r?.source??`keyboard`})},[t,st,Pt]),Ft=TF(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=JP(e,M);oe.current=ht<0||e==null?null:Math.max(0,Math.min(ht*s-e.scrollTop,Math.max(0,t-s))),ae.current=!0}t.startRenaming(e)!==!1&&(ke(`focus`),be(e=>e+1))}},[t,ht,s,l,M]),It=TF((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=JP(i,M),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:LF({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,$P(i,a,s,l,u,d),D.current(),Fe.current=n?e:null,!0},[t,s,c,M,h]),Lt=()=>y.current===!0||ve.current!=null||me.current===!0,B=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Rt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},V=()=>{le.current!=null&&(clearTimeout(le.current),le.current=null),ce.current=null},zt=()=>{de.current?.remove(),de.current=null},H=()=>{Rt(se.current),se.current=null,ue.current=null},U=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Bt=()=>{pe.current?.(),pe.current=null,ve.current!=null&&(clearTimeout(ve.current),ve.current=null),me.current=!1,he.current=null,_e.current=null,ge.current!=null&&(ge.current.setAttribute(`draggable`,`true`),ge.current.style.removeProperty(`touch-action`),ge.current=null),zt(),V(),H(),fe.current=null},Vt=(e,n)=>{let r=S.current?.getRootNode(),i=UF(VF(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ht=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){V();return}let r=t.getItem(e.directoryPath),i=YF(r)?r:null;if(i==null||i.isExpanded()){V();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ce.current!==a&&(V(),ce.current=a,le.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Ut=()=>{se.current=null;let e=ue.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=KF(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Ht(Vt(e.clientX,e.clientY)),se.current=B(Ut)},Wt=(e,t)=>{ue.current={clientX:e,clientY:t},se.current??=B(Ut)},Gt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Bt(),zt(),V(),H(),t.startDrag(r)===!1){e.preventDefault();return}if(fe.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),GF())){let t=WF(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),U(t),de.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Kt=()=>{zt(),V(),H(),fe.current=null,t.cancelDrag()},qt=(e,n,r)=>{if(ve.current!=null||me.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;_e.current={clientX:i.clientX,clientY:i.clientY},ge.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!me.current;ve.current!=null&&(clearTimeout(ve.current),ve.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),pe.current===o&&(pe.current=null),t&&(a.setAttribute(`draggable`,`true`),ge.current===a&&(ge.current=null),_e.current=null)},s=e=>{let t=e.touches[0],n=_e.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),pe.current=o,ve.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),ge.current===a&&(ge.current=null),_e.current=null;return}me.current=!0,ge.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),fe.current=n;let e=a.getBoundingClientRect(),s=WF(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),U(s),de.current=s,he.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=he.current;n!=null&&de.current!=null&&(de.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ht(Vt(t.clientX,t.clientY)),Wt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Vt(n.clientX,n.clientY),t.completeDrag(),Bt()},u=()=>{t.cancelDrag(),Bt()};pe.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},RF)},Jt=e=>{if(Me!=null){if(e.key===`Escape`){Nt(),e.preventDefault(),e.stopPropagation();return}tI.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(ut.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)ut.cancel();else if(e.key===`Enter`)ut.commit();else return;ke(`focus`),be(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Ft(A??void 0),e.preventDefault(),e.stopPropagation();return}if(pt){if(e.key===`Escape`)ae.current=!1,oe.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=JP(n,M);oe.current=ht<0||n==null?null:Math.max(0,Math.min(ht*s-n.scrollTop,Math.max(0,r-s))),ae.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;ke(`focus`),be(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&ZF(e)){t.openSearch(e.key),be(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=$e&&$F(e),r=eI(e,$e),i=r&&S.current!=null?qP(S.current):null,a=r?new Set(cI(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==A&&a.has(o)){let e=C.current;He(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=YF(p)?p:null,h=u!=null&&(Ot.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=sI(u,E.current,T.current);e==null||n==null?y=!1:z(e,u)}else if((e.ctrlKey||e.metaKey)&&XF(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;ke(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Ot.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))He(b,v?.scrollTop??null),k.current=!0,Ce(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ue(b,uI(S.current,v,i,u,s,F,M)),k.current=!0,Ce(e=>e===b?e:b)):Ve()}be(e=>e+1),e.preventDefault(),e.stopPropagation()};CF(()=>{if(f&&pt){if(We.current){We.current=!1;return}KP(w.current)}},[pt,f]),CF(()=>{let e=x.current;switch(tF({hasRenderedInput:e!=null,previousRenamingPath:ie.current,renamingPath:dt})){case`reset`:ie.current=null;return;case`reveal-canonical`:dt!=null&&It(dt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Fe.current=null,ie.current=dt,KP(e),e.select());return}},[N.end,N.start,dt,It,Ot]),CF(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=qP(e)?.dataset.itemPath??null;Ce(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,qP(e)!=null){r();return}k.current=!1,Ce(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,Ce(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;Ce(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),CF(()=>{let e=S.current;e!=null&&(j.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[j.physical.scrollTop]),CF(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;ee.current=JP(n,g);let a=()=>{let e=t.getVisibleCount(),r=YP(ee.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Xe(LF({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!te.current){te.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=YP(ee.current,g),i=t.getVisibleRows(e,e)[0]??null;ZP(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=t.subscribe(()=>{HP(xe)&&be(e=>e+1),a()}),l=()=>{Be.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,je(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Be.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),Pe.current!=null&&y.current&&Mt.current(),Be.current===!0){y.current=!1;return}Te(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{ee.current=(e[0]==null?null:XP(e[0]))??JP(n,g),a()}):null;return x?.observe(n),()=>{D.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,ee.current=null,x?.disconnect()}},[t,g,s,c,h]),CF(()=>{$e||Me==null||Nt(!1)},[Nt,$e,Me]);let Yt=wF(()=>Me==null?null:`${Me.path}::${Me.source}`,[Me]);CF(()=>{if(Yt==null){m?.clearSlotContent(vO);return}let t=Pe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??rI(n.getBoundingClientRect()),close:e=>{Mt.current(e?.restoreFocus??!0)},restoreFocus:()=>{jt.current&&At.current(Pe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(vO,i),e?.contextMenu?.onOpen?.(t.item,r),gI(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&gI(i)}),()=>{m?.clearSlotContent(vO)}},[Yt,e?.contextMenu,m]),CF(()=>{Me!=null&&t.getItem(Me.path)==null&&Nt()},[Nt,Me,t]),CF(()=>{if(Me==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(nI(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Nt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Nt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Nt,Me]),CF(()=>{let e=C.current,n=S.current;if(e==null||n==null){re.current=A;return}let r=A==null?null:T.current.get(A)??null,i=qP(n),a=i?.dataset.itemPath??null,o=ft&&x.current===i,c=f&&w.current===i,l=ae.current&&!pt,u=oe.current??0,d=Fe.current,p=Ie.current,m=Le.current,g=Re.current,_=i!=null,v=k.current||_,y=re.current!==A,b=p!=null&&p===A&&A!=null,E=!1,ee=!1;if(gt!=null&&gt.id!==O.current){O.current=gt.id;let n=gt.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,M-s))):F;E=!0,ee=QP(e,n,s,M,Dt,gt.offset,t)}t.clearScrollRequest(gt.id)}let te=!E&&l&&$P(e,ht,s,M,Dt,u),ne=!E&&d!=null&&d===A&&$P(e,ht,s,M,Dt,F),ie=!E&&m!=null&&m.path===A&&$P(e,ht,s,M,Dt,m.viewportOffset),se=!E&&g!=null&&g.path===A&&e.scrollTop!==g.scrollTop;if(se&&(e.scrollTop=g.scrollTop),(se||ee||ne||ie||te||v&&y&&d!==A&&!b&&ZP(e,ht,s,M,F))&&D.current(),E){re.current=A;return}if(!v){re.current=A;return}if(o){re.current=A;return}if(c&&!l){re.current=A;return}if(r==null){l&&ht>=0&&($P(e,ht,s,M,Dt,u),D.current()),re.current=A;return}(y||l||d===A||p===A||m?.path===A||g?.path===A||a==null||a!==A)&&(KP(r),d===A&&(Fe.current=null),p===A&&(Ie.current=null),m?.path===A&&(Le.current=null),g?.path===A&&(Re.current=null),ae.current=!1,oe.current=null),re.current=A},[t,ht,A,I,s,ft,pt,N,M,f,gt,h,F,Dt,Tt]);let Xt=ht>=0&&ht>=j.visible.startIndex&&ht<=j.visible.endIndex,Zt=A!=null&&P.some(e=>PF(e.row)===A),Qt=Xt||Zt,$t=tt&&k.current===!0&&Qt?A:null,en=Oe===`pointer`?we:null,tn=Me?.path??ze.current??en??$t??we,nn=Me?.source===`right-click`;CF(()=>{y.current&&Me==null||Pt(st(tn))},[Me,st,N,M,Ae,P,tn,Pt,Tt]);let rn=TF(e=>{if(y.current||nI(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&ke(e=>e===`pointer`?e:`pointer`),Te(e=>e===i?e:i)},[]),an=TF(()=>{Te(null)},[]);CF(()=>{if(!_t)return;let e=()=>{Bt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Bt(),t.cancelDrag()}},[t,_t]);let on=e=>{if(!_t||t.getDragSession()==null||me.current)return;let n=UF(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ht(t.getDragSession()?.target??null),Wt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},sn=e=>{if(!_t||t.getDragSession()==null||me.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(V(),H(),t.setDragTarget(null))},cn=e=>{_t&&t.getDragSession()!=null&&!me.current&&(e.preventDefault(),Vt(e.clientX,e.clientY),t.completeDrag(),zt(),V(),H(),fe.current=null)},ln=j.window.height,un=j.window.offsetTop,dn=Math.min(0,M-ln),fn=Math.min(0,M-ln-F),pn=Se===A||ae.current,mn=A!=null&&pn&&!I&&ht>=0?Tt[ht]??t.getVisibleRows(ht,ht)[0]??null:null,hn=mn==null?null:eF(ht,s,N,ln),gn=fe.current,_n=xt!=null&&gn!=null&&gn.path===xt&&gn.index>=N.start&&gn.index<=N.end,vn=xt!=null&&gn!=null&&gn.path===xt&&!_n&&gn.path!==mn?.path?gn:null,yn=vn==null?null:eF(vn.index,s,N,ln),bn=QF((ht>=0?Tt[ht]??t.getVisibleRows(ht,ht)[0]??null:null)?.ancestorPaths.at(-1)??null),xn=pt&&A!=null?pI(o,A,!I):void 0,Sn=Me?.path??(pt?A:Se),Cn=Me?.path??we,wn=st(tn),Tn=$e&&tt&&!nn&&!ft&&wn!=null&&Ee!=null&&tn!=null,En=$e&&(Tn||Me!=null),Dn=Me?.anchorRect,On=Dn==null&&wn!=null&&Ee!=null&&(Me!=null||Tn)?Ee:null,kn=Dn==null?On==null?void 0:{top:`${On}px`}:{left:`${Dn.left}px`,position:`fixed`,right:`auto`,top:`${Dn.top}px`},An=nn?{opacity:`0`}:void 0,jn=TF((e,n,r,i)=>{let a=iF({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:pt,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=j.visible.startIndex&&n.index<=j.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(k.current=!0,Ce(e=>e===c?e:c),ke(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&It(c,{targetOffset:`sticky-parents`})},[t,pt,j.visible.endIndex,j.visible.startIndex,It]),Mn=()=>{if(y.current||!tt||tn==null||wn==null)return;let e=t.getItem(tn);e!=null&&(Pt(wn),jt.current=!0,Ne({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:wn.getAttribute(`aria-label`)??tn,path:e.getPath()},path:e.getPath(),source:`button`}))},Nn={contextHoverPath:Cn,contextMenuButtonTriggerEnabled:tt,contextMenuButtonVisibility:nt,contextMenuEnabled:$e,contextMenuRightClickEnabled:rt,contextMenuTriggerMode:et,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:_t,draggedPathSet:yt,dragTarget:bt,gitLaneActive:ct,gitStatusByPath:n,handleRowDragEnd:Kt,handleRowDragStart:Gt,handleRowTouchStart:qt,ignoredGitDirectories:r,ignoredInheritanceCache:ye,instanceId:o,itemHeight:s,onKeyDown:Jt,onRowClick:jn,openContextMenuForRow:z,registerButton:it,registerRenameInput:ot,renameView:ut,renderDecorationForRow:kt,resolveIcon:lt,shouldSuppressContextMenu:Lt,visualFocusPath:Sn},Pn={...Nn,registerButton:at};return Z(`div`,{ref:S,id:St,"data-file-tree-context-menu-button-visibility":$e&&tt?nt:void 0,"data-file-tree-context-menu-trigger-mode":$e?et:void 0,"data-file-tree-has-context-menu-action-lane":$e&&tt?`true`:void 0,"data-file-tree-has-git-lane":ct?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:_t?sn:void 0,onDragOver:_t?on:void 0,onDrop:_t?cn:void 0,onKeyDown:Jt,onPointerLeave:$e?an:void 0,onPointerOver:$e?rn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Z(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:bn}}),Z(`slot`,{name:_O,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":pt?`true`:`false`,children:Z(`input`,{ref:w,"aria-activedescendant":xn,"aria-controls":St,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ge?`true`:void 0,value:mt,onBlur:()=>{(d!==`retain`||qe.current)&&t.closeSearch()},onFocus:Je,onPointerDown:Je,onInput:e=>{Je();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ze&&P.length>0?Z(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Z(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${Ct}px`},children:P.map((e,t)=>vI(Pn,e.row,`sticky:${PF(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${P.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Dt}px`},children:[Z(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${un}px`}}),Z(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${ln}px`,top:`${dn}px`,bottom:`${fn}px`},children:[yI(Nn,N,Ot),mn!=null&&hn!=null?vI(Nn,mn,`parked:${mn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:xt===mn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${hn}px`}}):null,vn!=null&&yn!=null?vI(Nn,vn,`parked-drag:${vn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${yn}px`}}):null]})]})]}),$e?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":En?`true`:`false`,style:kn,children:[Z(`button`,{ref:v,type:`button`,"data-type":yO,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":Me==null?`false`:`true`,"data-visible":Tn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),Me!=null){Nt();return}Mn()},tabIndex:-1,style:An,children:Z(dP,{...lt(`file-tree-icon-ellipsis`)})}),Me==null?null:Z(`slot`,{name:vO})]}):null,Me==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Nt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Nt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var xI={hydrateRoot:(e,t)=>{oP(IN(bI,t),e)},renderRoot:(e,t)=>{aP(IN(bI,t),e)},unmountRoot:e=>{aP(null,e)}};function SI(e,t){xI.renderRoot(e,t)}function CI(e,t){xI.hydrateRoot(e,t)}function wI(e){xI.unmountRoot(e)}var TI=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};function EI(e,t,n){if(!e.s){if(n instanceof DI){if(!n.s)return void(n.o=EI.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(EI.bind(null,e,t),EI.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var DI=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{EI(r,1,a(this.v))}catch(e){EI(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?EI(r,1,t?t(i):i):n?EI(r,1,n(i)):EI(r,2,i)}catch(e){EI(r,2,e)}},r},e}();Array.isArray;var OI=0;function kI(e){return e!=null&&e.length>0?e:(OI+=1,`pst_ft_${OI}`)}function AI({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??lM)}function jI(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function MI(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function NI(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var PI=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new TI;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=kI(a),this.#p=dN(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=cM(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new oN({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(wI(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=fN(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&SI(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),SI(t.wrapper,this.#w()))}setGitStatus(e){let t=dN(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&SI(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),SI(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),CI(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),SI(r,this.#w())}#C(){return{initialViewportHeight:AI({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(_O,e());return}this.#l.setSlotHtml(_O,this.#e?.header?.html??null)}#k(e){let t=NI(e).find(e=>MI(e)),n=jI(sO(xO(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=NI(e),n=t.find(e=>MI(e)),r=t.filter(e=>e!==n),i=xO(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=jI(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=xO(this.#m);t.colored&&lO(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${pO}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(pO,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=pM(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return yM(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},FI=`_kb _n`,II=`<div><input type=search placeholder="Filter files…" aria-label="Filter files"></div>`,LI=` D l`,RI=F(18,e=>jt(e,`b`,e.l,eL(e))),zI=H(11,RI),BI=F(10,e=>zI(e,(e.j??e.h)||``)),VI=H(17,RI),HI=F(16,e=>VI(e,tL(e))),UI=H(15,HI),WI=F(14,e=>UI(e,nL(e)),2),GI=Ct(7,e=>{BI(e),WI(e)}),KI=F(6,e=>GI(e,e.e,e.f)),qI=H(4,KI),JI=H(5,KI),YI=Dt(9,e=>{BI(e),WI(e)}),XI=(e,t)=>$I(e,t.timer),ZI=I(`l3`,e=>{Ft(e,`b`),M(e.b,`keydown`,function(t){t.key===`Enter`&&e.p(),t.key===`Escape`&&e.l&&(t.preventDefault(),e.r(``))})});function QI(e){R(e.a,`_ka`),R(e.b,FI),YI(e,null),XI(e,{timer:0}),ZI(e)}var $I=H(13,e=>{WI(e),HI(e)}),eL=e=>function(t){e.r(t)},tL=e=>t=>{if(e.n&&clearTimeout(e.n),!t){e.n=0,YI(e,null),GI(e,``);return}YI(e,t),e.n=setTimeout(e.p,150)},nL=e=>()=>{e.n&&=(clearTimeout(e.n),0);let t=e.j===null?e.h||``:e.j;YI(e,null),GI(e,t)};U(`l0`,eL),U(`l2`,tL),U(`l1`,nL);var rL=`b%c`,iL=`<!><!><!>`,aL=(e=>`<div><div title="Drag to resize"></div><div>${e}</div><!><div><div></div></div><!></div>`)(II),oL=(e=>` D b D/${e}&l%b D l%l`)(LI),sL={A:`added`,D:`deleted`,M:`modified`,R:`renamed`},cL=4,lL=V(25,e=>j(e.c,e._._.o),e=>e._._),uL=e=>{lL(e),dL(e),R(e.a,`_jz`),R(e.b,`_jA`),R(e.d,`_jB`)},dL=V(26,e=>j(e.e,e._._.p),e=>e._._),fL=V(25,e=>j(e.c,e._._.o),e=>e._._),pL=e=>{fL(e),mL(e),R(e.a,`_jz`),R(e.b,`_jA`),R(e.d,`_jB`)},mL=V(26,e=>j(e.e,e._._.p),e=>e._._),hL=V(11,e=>j(e.b,e._._.h),e=>e._._),gL=e=>{hL(e),R(e.a,`_jx`)},_L=V(10,e=>j(e.b,e._._.g),e=>e._._),vL=e=>{_L(e),R(e.a,`_jy`)},yL=P(0,0,e=>z(e.a,`title`,e._.f)),bL=e=>{yL._(e),CL._(e),wL._(e),TL._(e),R(e.a,`_jw`)},xL=N(1,`<span> </span>`,` D `,vL,`<span> </span>`,` D `,gL),SL=F(3,e=>xL(e,e._.g?0:e._.h?1:2)),CL=P(0,0,SL),wL=P(0,0,SL),TL=P(0,0,e=>j(e.c,e._.i)),EL=P(2,0,e=>IL(e.d,e._.g)),DL=e=>{EL._(e),OL._(e),jL._(e),ML._(e),NL._(e),R(e.a,`_js`),R(e.b,`_jv`),R(e.f,`_jC`)},OL=P(2,0,e=>j(e.c,e._.n)),kL=N(4,`<span><span>+<!></span><span>−<!></span></span>`,` D Db%l Db%`,pL),AL=F(7,e=>kL(e,e._.o||e._.p?0:1)),jL=P(2,0,AL),ML=P(2,0,AL),NL=P(2,0,e=>j(e.g,e._.v)),PL=N(0,`<span><!> vs <!></span>`,` D%c%`,bL),FL=(e,t)=>{LL(e,t?.title),zL(e,t?.topic),VL(e,t?.head),HL(e,t?.base),PL(e,+!t)},IL=(e,t)=>FL(e,t?.compare),LL=H(5,yL),RL=L(_L),zL=H(6,e=>{CL(e),RL(e)}),BL=L(hL),VL=H(7,e=>{wL(e),BL(e)}),HL=H(8,TL),UL=I(`z6`,e=>M(e.a,`click`,function(){e._._.t(e.l)})),WL=e=>{R(e.a,[`_u`,`_jo`]),R(e.b,`_jp`),g(e.c),f(e.c,10),ee(e.c),R(e.d,`_jq`),UL(e)},GL=F(10,e=>z(e.a,`title`,`${e.h}: show its ${e.j} file${e.j===1?``:`s`} in the review`)),KL=H(7,e=>{j(e.e,e.h),GL(e)}),qL=H(9,GL),JL=(e,t)=>{KL(e,t[0]?.label),qL(e,t[0]?.files?.length),YL(e,t[0]?.id)},YL=H(11),XL=St(0,(e=>`<button type=button aria-expanded=false><span aria-hidden=true>${e}</span><span> </span></button>`)(x),(e=>` D D/${e}&l D m`)(ne),WL,JL),ZL=P(7,0,e=>XL(e,[e._.a5,`id`])),QL=e=>{ZL._(e),R(e.a,`_jn`)},$L=bt(1),eR=F(2,e=>$L(e,e._._.u,()=>({id:e._.h}))),tR=V(42,eR,e=>e._._),nR=e=>{tR(e),rR._(e),R(e.a,`_jD`)},rR=P(3,0,eR),iR=P(2,1,e=>IL(e.f,e._.g)),aR=I(`z5`,e=>M(e.a,`click`,function(){e._._.t(e._.h)})),oR=e=>{iR._(e),cR._(e),dR._(e),fR._(e),pR._(e),mR._(e),R(e.a,[`_js`,`_jt`]),R(e.b,`_ju`),g(e.c),f(e.c,12),ee(e.c),R(e.d,`_jv`),R(e.h,`_jC`),aR(e)},sR=F(9,e=>z(e.a,`title`,e._.q?`${e._.n}: show its files in the review`:`${e._.n}: hide its files from the review`)),cR=P(2,1,e=>{j(e.e,e._.n),sR(e)}),lR=N(6,`<span><span>+<!></span><span>−<!></span></span>`,` D Db%l Db%`,uL),uR=F(10,e=>lR(e,e._.o||e._.p?0:1)),dR=P(2,1,uR),fR=P(2,1,uR),pR=P(2,1,e=>{z(e.a,`aria-expanded`,e._.q?`false`:`true`),sR(e)}),mR=P(2,1,e=>j(e.i,e._.v)),hR=F(18,e=>R(e.a,[`_jm`,{_jj:e._.a3,_jk:e.q,_jl:!e._.a3&&e.h===e._.s}]),3),gR=F(17,e=>z(e.e,`hidden`,e.q||!e.k)),_R=H(16,e=>{hR(e),gR(e),pR(e)}),vR=F(8,e=>_R(e,!e._.a3&&e._.p.has(e.h)),2),yR=Ot(6,vR),bR=e=>{yR._(e),xR._(e),CR._(e),TR._(e),R(e.b,`_jr`)},xR=xt(6,18,7,hR),SR=N(3,`<div><!></div>`,` D%`,nR),CR=Ot(6,e=>SR(e,+!e._.u)),wR=N(2,(e=>`<div><span> </span>${e}<!><span> </span></div>`)(iL),(e=>` D D l/${e}&%b D m`)(rL),DL,((e,t)=>`<button type=button><span aria-hidden=true>${e}</span><span> </span>${t}<!><span> </span></button>`)(x,iL),((e,t)=>` D D/${e}&l D l/${t}&%b D m`)(ne,rL),oR),TR=Ot(6,e=>{R(e.e,[`_jF`,{_jE:e._.a3}]),wR(e,+!e._.a3),vR(e),hR(e)}),ER=H(7,e=>{z(e.a,`data-section`,e.h),z(e.e,`data-tree`,e.h),vR(e),hR(e),rR(e)}),DR=H(21,e=>{mR(e),NL(e)}),OR=F(20,e=>DR(e,e.t?`${e.k}/${e.l}`:`${e.l}`),2),kR=H(19,OR),AR=F(12,e=>kR(e,e.k!==e.l)),jR=H(10,e=>{AR(e),OR(e),gR(e)}),MR=H(11,e=>{AR(e),OR(e)}),NR=(e,t)=>PR(e,t[0]),PR=H(6,e=>{ER(e,e.g?.id),jR(e,e.g?.files?.length),MR(e,e.g?.total),FR(e,e.g?.label),LR(e,e.g?.additions),zR(e,e.g?.deletions),iR(e),EL(e)}),FR=H(13,e=>{cR(e),OL(e)}),IR=L(fL,lL),LR=H(14,e=>{dR(e),jL(e),IR(e)}),RR=L(mL,dL),zR=H(15,e=>{fR(e),ML(e),RR(e)}),BR=bt(1),VR=P(4,0,e=>BR(e,e._.r)),HR=e=>{VR._(e),R(e.a,`_jf`)},UR=Ct(25,e=>qI(e.d,e.z)),WR=F(12,e=>UR(e,e.k,e.l)),GR=H(10,WR),KR=H(11,WR),qR=H(38),JR=F(35,e=>qR(e,wz(e))),YR=Dt(27,e=>{Nt(e.a,e.a1==null?void 0:`--tree-w:${e.a1}px`),JR(e)}),XR=Dt(28,e=>R(e.b,[`_jH`,{_jG:e.a2}])),ZR=(e,t)=>pz(e,t.id),QR=I(`z8`,e=>{M(e.b,`pointerdown`,function(t){e.aa(t)}),M(e.b,`pointermove`,function(t){e.ab(t)}),M(e.b,`pointerup`,function(t){e.ac(t)}),M(e.b,`pointercancel`,function(t){e.ac(t)})});function $R(e){R(e.c,`_je`),QI(e.d),JI(e.d,Tz(e)),R(e.f,`_jg`),YR(e,Ae()),XR(e,!1),ZR(e,{id:-1}),QR(e)}var ez=H(31,e=>{az(e,e.a5?.length),ZL(e)}),tz=F(30,e=>ez(e,e.a3?[]:e.n.filter(t=>e.p.has(t.id))),2),nz=H(29,e=>{R(e.g,[`_ji`,{_jh:e.a3}]),tz(e),TR(e)}),rz=(e,t)=>nz(e,t===1),iz=N(7,`<div role=group aria-label="Folded sections"></div>`,` `,QL),az=(e,t)=>iz(e,+!t),oz=St(6,`<div><div data-head><!><!></div><div></div></div>`,` D D%b%l `,bR,NR),sz=I(`z7`,e=>Tt(e,{sections:e.n,folded:e.p,commentCounts:e.v,newKeys:e.w,onMount:function(){let t=(e,t)=>`${e.id}/${t}`,n=e=>e.files.map(e=>({path:e.path,status:sL[e.status]??`modified`})),r=e=>e.files.map(e=>`${e.path}:${e.status}`).join(`
2798
+ `),i=(e,t)=>[...e].map(([e,t])=>`${e}=${t}`).sort().join(`,`)+`|`+[...t].sort().join(`,`),a=new Map,o=t=>e.a.querySelector(`[data-tree="${CSS.escape(t)}"]`),s={raf:0},c=()=>{s.raf=0;let t=this.sections,n=this.folded,r=t.map(e=>({host:o(e.id),rec:a.get(e.id),open:t.length===1||!n.has(e.id)}));if(t.length===1){for(let e of r)e.host&&(e.host.style.height=``);return}let i=r.find(e=>e.rec&&e.open)?.rec.tree.getItemHeight()||0;if(!i)return;let c=e.g.offsetHeight;for(let e of r)e.host&&(c-=e.host.offsetHeight);let l=Math.max(0,e.f.clientHeight-c),u=Math.floor(l/i),d=r.filter(e=>e.host&&e.rec&&e.open).map(e=>({host:e.host,want:e.rec.tree.getVisibleCount()})).sort((e,t)=>e.want-t.want),f=0,p=null;d.forEach((e,t)=>{let n=Math.floor(u/(d.length-t)),r=Math.min(e.want,Math.max(n,cL));u=Math.max(0,u-r),f+=r*i,r<e.want&&(p=e.host),e.host.style.height=`${r*i}px`});let m=l-f;p&&m>0&&(p.style.height=`${p.offsetHeight+m}px`)},l=()=>{s.raf||=requestAnimationFrame(c)},u=new ResizeObserver(l),d=()=>{u.disconnect(),u.observe(e.f);for(let t of e.a.querySelectorAll(`[data-head]`))u.observe(t)},f=i=>{let s=o(i.id);if(!s)return;let c=new PI({paths:i.files.map(e=>e.path),gitStatus:n(i),initialExpansion:`open`,flattenEmptyDirectories:!0,search:!1,onSelectionChange(n){if(n.length===1){let r=t(i,n[0]);queueMicrotask(()=>e.x(r))}},renderRowDecoration({row:n}){if(n.kind!==`file`)return null;let r=t(i,n.path),a=e.v.has(r),o=e.w.has(r);if(!a&&!o)return null;let s=[];return o&&s.push({text:`●`,color:`var(--accent)`}),a&&s.push({text:`${o?` `:``}✎ ${e.v.get(r)??``}`.trimEnd(),color:`var(--dim)`}),{text:s.map(e=>e.text).join(``),parts:s,title:[o&&`Changed since your last visit`,a&&`Has review comments`].filter(Boolean).join(` · `)}}});c.render({containerWrapper:s});let u=c.subscribe(l);a.set(i.id,{tree:c,sig:r(i),unsub:u})};for(let t of e.n)f(t);return d(),l(),{trees:a,build:f,sig:r,gitStatus:n,marks:i,shownMarks:i(e.v,e.w),frame:s,ro:u,observe:d,schedule:l}},onUpdate:function(){let e=this.marks(this.commentCounts,this.newKeys),t=e!==this.shownMarks;this.shownMarks=e;let n=new Set(this.sections.map(e=>e.id));for(let[e,t]of this.trees)n.has(e)||(t.unsub(),t.tree.cleanUp(),this.trees.delete(e));for(let e of this.sections){let n=this.trees.get(e.id);if(!n){this.build(e);continue}let r=this.sig(e);r===n.sig?t&&n.tree.setGitStatus(this.gitStatus(e)):(n.sig=r,n.tree.resetPaths(e.files.map(e=>e.path)),n.tree.setGitStatus(this.gitStatus(e)))}this.observe(),this.schedule()},onDestroy:function(){cancelAnimationFrame(this.frame.raf),this.ro.disconnect();for(let e of this.trees.values())e.unsub(),e.tree.cleanUp()}})),cz=F(24,sz,4),lz=H(13,e=>{rz(e,e.n?.length),oz(e,[e.n,`id`]),tz(e),cz(e)}),uz=H(15,e=>{tz(e),cz(e),yR(e)}),dz=H(36),fz=H(37),pz=H(34,e=>{dz(e,Ez(e)),fz(e,Dz(e)),JR(e)}),mz=(e,t)=>R(e.a,[`_jd`,{_jc:t===!1}]),hz=N(4,`<div><!></div>`,` D%`,HR),gz=H(17,e=>{hz(e,+!e.r),VR(e)}),_z=H(21,cz),vz=H(22,cz),yz=H(23,cz),bz=H(18,xR),xz=H(19),Sz=L(tR),Cz=H(20,e=>{CR(e),Sz(e)}),wz=e=>t=>{t.pointerId===e.a8&&(e.a8=-1,XR(e,!1),e.a1!=null&&Ge(e.a1))},Tz=e=>t=>{UR(e,t)},Ez=e=>t=>{(t.pointerType!==`mouse`||t.button===0)&&(t.preventDefault(),e.a8=t.pointerId,XR(e,!0),e.b.setPointerCapture(t.pointerId))},Dz=e=>t=>{if(t.pointerId!==e.a8)return;let n=window.innerWidth-t.clientX;YR(e,Math.min(640,Math.max(200,n)))};U(`z2`,wz),U(`z3`,Tz),U(`z0`,Ez),U(`z1`,Dz);var Oz=`_j4 _ba`,kz=`b%c`,Az=`<!><!><!>`,jz=`<!><!><!>`,Mz=e=>R(e.a,`_j8`),Nz=e=>{qS(e.a),JS(e.a,12),YS(e.a,`_j_`)},Pz=e=>R(e.a,[`_A`,`_j9`]),Fz=P(1,0,e=>{z(e.a,`title`,e._.f),j(e.b,e._.f)}),Iz=e=>{Fz._(e),R(e.a,Oz)},Lz=V(11,e=>j(e.b,e._._.h),e=>e._._),Rz=e=>{Lz(e),R(e.a,`_jY`)},zz=V(10,e=>j(e.b,e._._.g),e=>e._._),Bz=e=>{zz(e),R(e.a,`_jZ`)},Vz=P(0,0,e=>z(e.a,`title`,e._.f)),Hz=e=>{Vz._(e),Gz._(e),Kz._(e),qz._(e),R(e.a,`_jX`)},Uz=N(1,`<span> </span>`,` D `,Bz,`<span> </span>`,` D `,Rz),Wz=F(3,e=>Uz(e,e._.g?0:e._.h?1:2)),Gz=P(0,0,Wz),Kz=P(0,0,Wz),qz=P(0,0,e=>j(e.c,e._.i)),Jz=P(1,1,e=>eB(e.d,e._.f)),Yz=e=>{Jz._(e),Xz._(e),Zz._(e),R(e.a,`_jT`),R(e.b,`_jW`),R(e.e,`_j0`)},Xz=P(1,1,e=>j(e.c,e._.m)),Zz=P(1,1,e=>j(e.f,e._.n)),Qz=N(0,`<span><!> vs <!></span>`,` D%c%`,Hz),$z=(e,t)=>{tB(e,t?.title),rB(e,t?.topic),aB(e,t?.head),oB(e,t?.base),Qz(e,+!t)},eB=(e,t)=>$z(e,t?.compare),tB=H(5,Vz),nB=L(zz),rB=H(6,e=>{Gz(e),nB(e)}),iB=L(Lz),aB=H(7,e=>{Kz(e),iB(e)}),oB=H(8,qz),sB=N(6,GS,(e=>`/${e}&`)(KS),Nz),cB=F(11,e=>sB(e,+!e._._._._.y.has(e.k))),lB=V(37,cB,e=>e._._._._),uB=I(`i5`,e=>M(e.a,`click`,function(){CV(e._._._._,!1)})),dB=e=>{lB(e),mB(e),gB(e),R(e.a,[`_j3`,`_y`]),R(e.b,`__`),R(e.d,`_j5`),uB(e)},fB=N(5,`<span title="Changed since your last visit"></span>`,` `,Pz),pB=F(12,e=>fB(e,+!e._._._._.z.has(e.k))),mB=V(38,pB,e=>e._._._._),hB=F(13,e=>z(e.a,`href`,e._._._._.a5(e.k))),gB=V(43,hB,e=>e._._._._),_B=H(10,e=>{hB(e),pB(e),cB(e)}),vB=(e,t)=>{z(e.b,`data-status`,t),j(e.c,t)},yB=(e,t)=>j(e.e,t),bB=(e,t)=>{_B(e,(t?.[0]).file?.key),vB(e,(t?.[0]).file?.status),yB(e,(t?.[0]).name)},xB=e=>R(e.a,`_j2`),SB=N(1,`<div><bdi><!>/</bdi></div>`,` E%`,Iz),CB=H(5,e=>{SB(e,+!e.f),Fz(e)}),wB=St(2,`<a><span> </span><span><bdi> </bdi></span><!><!></a>`,` D D l E m%b%`,dB,bB),TB=(e,t)=>wB(e,[t,e=>e.file.key]),EB=(e,t)=>{CB(e,(t?.[0]).dir),TB(e,(t?.[0]).files)},DB=I(`i6`,e=>M(e.a,`click`,function(){e._._._.s(e.l)})),OB=e=>{R(e.a,[`_u`,`_jQ`]),R(e.b,`_jR`),g(e.c),f(e.c,10),ee(e.c),R(e.d,`_jS`),DB(e)},kB=F(10,e=>z(e.a,`title`,`${e.h}: show its ${e.j} file${e.j===1?``:`s`} in the review`)),AB=H(7,e=>{j(e.e,e.h),kB(e)}),jB=H(9,kB),MB=(e,t)=>{AB(e,t[0]?.label),jB(e,t[0]?.files?.length),NB(e,t[0]?.id)},NB=H(11),PB=St(0,(e=>`<button type=button aria-expanded=false><span aria-hidden=true>${e}</span><span> </span></button>`)(x),(e=>` D D/${e}&l D m`)(ne),OB,MB),FB=V(40,e=>PB(e,[e._._.a2,`id`]),e=>e._._),IB=e=>{FB(e),R(e.a,`_jP`)},LB=bt(1),RB=F(2,e=>LB(e,e._._._.t,()=>({id:e._.l}))),zB=V(35,RB,e=>e._._._),BB=e=>{zB(e),VB._(e),R(e.a,`_j1`)},VB=P(2,0,RB),HB=P(1,0,e=>eB(e.f,e._.f)),UB=I(`i4`,e=>M(e.a,`click`,function(){e._._._.s(e._.l)})),WB=e=>{HB._(e),GB._(e),KB._(e),R(e.a,[`_jT`,`_jU`]),R(e.b,`_jV`),g(e.c),f(e.c,12),ee(e.c),R(e.d,`_jW`),R(e.g,`_j0`),UB(e)},GB=P(1,0,e=>j(e.e,e._.m)),KB=P(1,0,e=>j(e.h,e._.n)),qB=N(2,`<div><!></div>`,` D%`,BB),JB=V(35,e=>qB(e,+!e._._.t),e=>e._._),YB=e=>{JB(e),ZB(e),eV(e),R(e.a,`_jO`)},XB=N(1,((e,t)=>`<button type=button aria-expanded=true title="Hide this section's files from the review"><span aria-hidden=true>${e}</span><span> </span>${t}<span> </span></button>`)(x,Az),((e,t)=>` D D/${e}&l D l/${t}& D m`)(ne,kz),WB,(e=>`<div><span> </span>${e}<span> </span></div>`)(Az),(e=>` D D l/${e}& D m`)(kz),Yz),ZB=V(39,e=>XB(e,+!e._._.a0),e=>e._._),QB=St(3,`<div><!><!></div>`,` D%b%`,xB,EB),$B=F(6,e=>QB(e,[e._._.a6(e.f),`dir`])),eV=V(44,$B,e=>e._._),tV=H(13,e=>{KB(e),Zz(e)}),nV=F(10,e=>tV(e,e.i===e.j?`${e.j}`:`${e.i}/${e.j}`)),rV=H(8,nV),iV=H(9,nV),aV=H(5,e=>{rV(e,e.f?.files?.length),iV(e,e.f?.total),sV(e,e.f?.id),cV(e,e.f?.label),$B(e),HB(e),Jz(e)}),oV=(e,t)=>aV(e,t[0]),sV=H(11,VB),cV=H(12,e=>{GB(e),Xz(e)}),lV=bt(1),uV=V(34,e=>lV(e,e._._.r),e=>e._._),dV=N(9,`<div><!></div>`,` D%`,e=>{uV(e),R(e.a,`_j6`)}),fV=P(0,0,e=>dV(e,+!e._.r)),pV=I(`i7`,e=>{M(e.a,`click`,function(){CV(e._,!1)}),M(e.f,`click`,function(){CV(e._,!1)})}),mV=e=>{fV._(e),hV._(e),_V._(e),yV._(e),xV._(e),R(e.a,`_jK`),R(e.b,`_jL`),R(e.c,`_jM`),R(e.d,`_jJ`),R(e.e,`_z`),R(e.f,[p,`_jI`]),s(e.g),ie(e.g,16),A(e.g),R(e.h,`_j7`),QI(e.i),JI(e.i,nH(e)),R(e.k,`_jN`),pV(e)},hV=P(0,0,e=>qI(e.i,e._.w)),gV=N(13,`<div role=group aria-label="Folded sections"></div>`,` `,IB),_V=P(0,0,e=>gV(e,+!e._.a3)),vV=St(11,`<div><!><!><!></div>`,` D%b%b%`,YB,oV),yV=P(0,0,e=>vV(e,[e._.a4,`id`])),bV=N(12,`<p>No files match.</p>`,` `,Mz),xV=P(0,0,e=>bV(e,+!!e._.a7)),SV=N(0,((e,t)=>`<div></div><div role=dialog aria-label="Jump to file"><div><strong>Files</strong><span></span><button type=button title=Close aria-label=Close>${e}</button></div><div>${t}<!></div><div><!><!></div><!></div>`)(pt,II),((e,t)=>` b D D b b D/${e}&m D/${t}&%l D%b%l%l`)(oe,LI),mV),CV=Ct(20,e=>SV(e,+!e.u)),wV=F(5,e=>CV(e,e.d,e.e)),TV=H(3,wV),EV=H(4,wV),DV=Ct(22,hV),OV=F(8,e=>DV(e,e.g,e.h)),kV=H(6,OV),AV=H(7,OV),jV=H(24,L(lB)),MV=(e,t)=>jV(e,t||new Set),NV=H(25,L(mB)),PV=(e,t)=>NV(e,t||new Set),FV=L(FB),IV=H(28,e=>{HV(e,e.a2?.length),FV(e)}),LV=H(30,yV),RV=F(27,e=>{IV(e,e.a0?e.l.filter(t=>e.n.has(t.id)):[]),LV(e,e.a0?e.l.filter(t=>!e.n.has(t.id)):e.l)},2),zV=L(ZB),BV=H(26,e=>{RV(e),zV(e)}),VV=(e,t)=>BV(e,t>1),HV=H(29,_V),UV=H(33,xV),WV=H(11,e=>{VV(e,e.l?.length),UV(e,e.l.reduce((e,t)=>e+t.files.length,0)),RV(e)}),GV=H(13,RV),KV=H(31,L(gB)),qV=F(16,e=>KV(e,rH(e))),JV=H(14,qV),YV=H(15,qV),XV=H(32);function ZV(e){XV(e,iH)}var QV=L(uV),$V=H(17,e=>{fV(e),QV(e)}),eH=H(18),tH=H(19,L(JB,zB)),nH=e=>t=>{DV(e._,t)},rH=e=>t=>y({workspaceId:e.o,view:`diff`,scope:e.p??null,file:t});function iH(e){let t=[],n=new Map;for(let r of e.files){let e=r.label.slice(r.label.indexOf(`/`)+1),i=e.lastIndexOf(`/`),a=i<0?``:e.slice(0,i),o=i<0?e:e.slice(i+1),s=n.get(a);s||(n.set(a,s={dir:a,files:[]}),t.push(s)),s.files.push({file:r,name:o})}return t}U(`i2`,nH),U(`i0`,rH),U(`i1`,iH);var aH=`b%c`,oH=`<!><!><!>`,sH=(e=>`/${e}&`)(_T),cH=gT,lH=((e,t,n,r,i)=>`<div><div><div><div><div><!><h1>Review</h1><!></div><div><!><button title="Refresh diff">${e}</button><!><span><button aria-label=Compare>${t}</button><select aria-label=Compare tabindex=-1><option value=committed>Committed</option><option value=working>Working tree</option><option value=dirty>Uncommitted</option><!></select></span> <div>${n}</div><!></div></div><div><!><!><!><!></div></div><div data-diff-main></div></div>${r}${i}</div>`)(nt,Qe,hw,aL,jz),uH=((e,t,n,r,i)=>` D D D D D%b b%l D%b D/${e}&l%b D D/${t}&l Dd%mb D0${n}&l%m D%b%b%b%m l/${r}&/${i}&l`)(ze,Ke,gw,oL,`b%c`),dH=new Set;function fH(e){return e.split(`
2799
2799
  `).filter(e=>e[0]===`+`||e[0]===`-`).join(`
2800
- `)}var PV=e=>{JH._(e.a,e._)},FV=(e,t)=>ZH(e.a,t),IV=Lt(`A49`,(e=>`<!>${e}<!>`)(OV),(e=>`b/${e}&b`)(DV),PV,(e,t)=>FV(e,(t?.[0]).id)),LV=e=>{JH._(e.a,e._)},RV=(e,t)=>ZH(e.a,t),zV=Lt(`A47`,(e=>`<!>${e}<!>`)(OV),(e=>`b/${e}&b`)(DV),LV,(e,t)=>RV(e,(t?.[0]).id)),BV=Lt(`A48`,(e=>`<!>${e}<!>`)(AV),(e=>`b/${e}&b`)(kV),e=>{vH._(e.a,e._)}),VV=Lt(`A46`,(e=>`<!>${e}<!>`)(AV),(e=>`b/${e}&b`)(kV),e=>{vH._(e.a,e._)}),HV=wt(0,`<div><div></div><div></div></div>`,` D b `,e=>{R(e.a,`_fg`),R(e.b,[`_ff`,`_fh`]),R(e.c,[`_ff`,`_fi`])}),UV=e=>{R(e.a,`_fe`),HV(e,[2,0,1])},WV=(e,t)=>z(e.a,`value`,`rev:${t}`),GV=(e,t)=>j(e.b,t),KV=bt(0,`<option> </option>`,` D `,0,(e,t)=>{WV(e,t[0]?.sha),GV(e,t[0]?.label)}),qV=P(17,0,e=>KV(e,[e._.de,`sha`])),JV=qV,YV=P(21,0,e=>z(e.a,`hidden`,e._.b9)),XV=I(`A41`,e=>M(e.a,`click`,function(){e._.ee()})),ZV=e=>{YV._(e),R(e.a,[v,`_e8`,`_e0`]),x(e.b),h(e.b,14),de(e.b),XV(e)},QV=P(12,0,e=>{z(e.a,`title`,`Jump to file (${e._.d3})`),z(e.a,`aria-label`,`Jump to file (${e._.d3} files)`),j(e.e,e._.d3>99?`99+`:e._.d3)}),$V=I(`A39`,e=>M(e.a,`click`,function(){HW(e._,!0)})),eH=e=>{QV._(e),R(e.a,[v,`_e0`,`_fj`]),R(e.b,`_fk`),$C(e.c),ew(e.c,20),tw(e.c,`_fl`),R(e.d,`_fm`),$V(e)},tH=P(9,0,e=>{R(e.a,[zS,`_e0`,{_eZ:e._.b7}]),z(e.a,`title`,e._.b7?`Hide file tree`:`Show file tree`)}),nH=I(`A38`,e=>M(e.a,`click`,function(){VW(e._,!e._.b7),qe(e._.b7)})),rH=e=>{tH._(e),d(e.b),ae(e.b,14),ut(e.b),nH(e)},iH=F(2,e=>j(e.b,e._.b6?`This commit is not in any of these repos.`:e._.cl.some(e=>e.unborn)?`No commits yet.`:e._.b5===`dirty`?`Nothing uncommitted.`:e._.cl.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`),2),aH=P(26,0,iH),oH=e=>{aH._(e),sH._(e),cH._(e),R(e.a,`_cj`)},sH=P(26,0,iH),cH=P(26,0,iH),lH=V(203,e=>j(e.b,e._._.b5===`committed`?``:`, showing uncommitted changes only`),e=>e._._),uH=e=>{lH(e),dH(e)},dH=V(5,e=>j(e.a,e._.e)),fH=Ot(`A43`,`<!><!>.`,`%b%`,uH),pH=e=>{ye(e.a),Oe(e.a,fH(e)),Ue(e.a,`warn`),Pe(e.a,`inline`),ot(e.a),Ye(e.a),Me(e.a),je(e.a,{})},mH=(e,t)=>A(e.a,`${t}: base not found`),hH=(e,t)=>{mH(e,t[0]?.worktree),gH(e,t[0]?.base)},gH=H(4,L(dH)),_H=V(202,e=>IT(e.a,e._.b4)),vH=Mt(e=>{_H(e),bH(e),xH(e),SH(e),CH(e),wH(e),TH(e),TT(e.a),RT(e.a,OK(e))}),yH=F(1,e=>MT(e.a,e._.cr-e._.d0)),bH=V(210,yH),xH=V(211,e=>{ET(e.a,e._.d0),yH(e)}),SH=V(213,e=>FT(e.a,e._.d5)),CH=V(217,e=>kT(e.a,e._.do)),wH=V(218,e=>AT(e.a,e._.dp)),TH=V(219,e=>LT(e.a,e._.dr)),EH=F(2,e=>j(e.b,e._.bg.trim()?`No matches in review.`:e._.b4&&!e._.b1?`Nothing changed since your last visit.`:`No files match "${e._.b1}".`),2),DH=P(26,1,EH),OH=e=>{DH._(e),kH._(e),AH._(e),R(e.a,`_cj`)},kH=P(26,1,EH),AH=P(26,1,EH),jH=V(199,e=>j(e.a,e._._.ay),e=>e._._),MH=Ot(`A42`,` `,` `,jH),NH=e=>{ye(e.a),Oe(e.a,MH(e)),Me(e.a,kK(e)),ot(e.a),Ye(e.a),Ue(e.a),Pe(e.a),A(e.a),je(e.a,{})},PH=V(195,e=>ND(e.a,e._._.al||``),e=>e._._),FH=e=>{PH(e),IH(e),LH(e),RH(e),BH(e),VH._(e),HH._(e),UH._(e)},IH=V(196,e=>FD(e.a,e._._.am||``),e=>e._._),LH=V(200,e=>RD(e.a,e._._.az),e=>e._._),RH=V(208,e=>zD(e.a,e._._.cc),e=>e._._),zH=F(1,e=>LD(e.a,e._._.db.has(e._.d))),BH=V(214,zH,e=>e._._),VH=P(0,0,zH),HH=P(0,0,e=>ED(e.a,e._.g)),UH=P(0,0,e=>ID(e.a,e._.i)),WH=N(0,(e=>`<!>${e}<!>`)(BT),(e=>`b/${e}&b`)(`b%c`),FH),GH=(e,t)=>{YH(e,t?.repo),XH(e,t?.files?.length),WH(e,+!t)},KH=F(4,e=>GH(e,e._.dm.get(e.d))),qH=V(216,KH),JH=Mt(qH),YH=H(6,HH),XH=H(8,UH),ZH=H(3,e=>{KH(e),VH(e)}),QH=P(7,0,e=>zC(e.b,e._.ap)),$H=e=>{QH._(e),eU._(e),tU._(e),nU._(e),R(e.a,`_e6`),FC(e.b)},eU=P(7,0,e=>KC(e.b,e._.aw)),tU=P(7,0,e=>JC(e.b,e._.ea)),nU=P(7,0,e=>qC(e.b,e._.eb)),rU=P(5,0,e=>z(e.a,`href`,`/w/${e._.a6}`)),iU=e=>{rU._(e),R(e.a,[v,`_e5`]),_e(e.b),pe(e.b,14),he(e.b)},aU=gt(`A37`,187),oU=H(145,L(BH)),sU=I(`A50`,e=>Ct(e,{active:e.ai,load:e.c7,findOpen:e.b9,shownFiles:e.d2,commentsByFile:e.d6,draft:e.ax,sessions:e.ap,collapsedFiles:e.bk,repos:e.as,onMount:function(){let t=new AbortController,n=()=>e.ap||[],r=(t,n=!0)=>{let r=e.a1,i=t.getBoundingClientRect();if(!i.height)return;let a=r.getBoundingClientRect(),o=getComputedStyle(t),s=i.top-(parseFloat(o.scrollMarginTop)||0),c=i.bottom+(parseFloat(o.scrollMarginBottom)||0),l=0;s<a.top?l=s-a.top:c>a.bottom&&(l=c-a.bottom),l&&r.scrollTo({top:Math.max(0,r.scrollTop+l),behavior:n?`smooth`:`auto`})},i=new WeakMap,a=async(t,n,r)=>{if(!r)return``;let i=new URLSearchParams({worktree:t,path:n,rev:r});return(await Ce(`/api/workspaces/${e.a6}/diff/contents?${i}`)).contents},o={viewer:null},s={key:null,top:null},c=new Map,l,u={draft:!0},d,f=e=>{let t=c.get(e.id);return(!t||t.comment.text!==e.text)&&(t={comment:e}),c.set(e.id,t),t},p=e=>(l!==e&&(l=e,u={draft:!0},d=void 0),u),m=(e,t,n)=>{let r=[];for(let e of t)r.push({side:e.side,lineNumber:e.line_end,metadata:f(e)});return n&&n.key===e&&r.push({side:n.side===`deletions`?`deletions`:`additions`,lineNumber:n.end,metadata:p(n)}),r},h=(e,t,n,r)=>{let i=r?[r]:[];for(let e of t)i.push({lineNumber:0,metadata:f(e)});return n&&n.key===e&&i.push({lineNumber:0,metadata:p(n)}),i.length?i:void 0},g=(e,t,n)=>e.map(e=>`${e.id}:${e.text.length}`).join(`,`)+(t&&t.key===n?`|d${t.side}${t.start}-${t.end}`:``),_=new Map,v=new WeakMap,y=(t,n,r,i)=>{let a=new URLSearchParams({worktree:t,path:n,rev:r});return i&&a.set(`v`,i),`/api/workspaces/${e.a6}/diff/blob?${a}`},b=(t,n)=>{let r=t.binary?Gx(t.path)?.kind:void 0;if(!r||!n)return;let i=e.du(t.repo),a=t.status===`A`,o=t.status===`D`,s=[];if(!a&&n.oldRev&&s.push({label:o?`Deleted`:`Before`,src:y(i,t.oldPath||t.path,n.oldRev)}),!o&&n.newRev&&s.push({label:a?`Added`:`After`,src:y(i,t.path,n.newRev,t.hash)}),!s.length)return;let c=s.map(e=>e.src).join(` `),l=_.get(t.key);return(!l||l.sig!==c)&&(l={sig:c,meta:{preview:{kind:r,name:t.path,sides:s}}},_.set(t.key,l)),{lineNumber:0,metadata:l.meta}},x=t=>{MW(e,{key:t,side:`additions`,start:0,end:0})},S=(t,n)=>{if(!t)return;let r=t.endSide!=null&&t.endSide!==t.side;MW(e,{key:n,side:t.side||`additions`,start:Math.min(t.start,r?t.start:t.end),end:Math.max(t.start,r?t.start:t.end)})},C={theme:{dark:`pierre-dark`,light:`pierre-light`},themeType:nt(),diffStyle:ce()?`unified`:`split`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},enableLineSelection:!0,layout:{paddingTop:0,paddingBottom:24,gap:12},unsafeCSS:` @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } [data-column-number], [data-gutter-utility-slot] { touch-action: none !important; } }`+yS,async loadDiffFiles(t){let n=i.get(t),r=(e.as||[]).find(e=>e.id===n?.repo);if(!n||!r)throw Error(`unknown file`);let[o,s]=await Promise.all([t.type===`new`?Promise.resolve(``):a(n.worktree,t.prevName||n.path,r.oldRev),t.type===`deleted`?Promise.resolve(``):a(n.worktree,n.path,r.newRev)]);if(o==null||s==null)throw FW(e,`${n.path} is too large to expand.`),Error(`diff contents unavailable`);if(t.type!==`new`&&!Sx(t,`deletions`,o)||t.type!==`deleted`&&!Sx(t,`additions`,s))throw FW(e,`${n.path} has changed since this diff was taken — refresh to expand it.`),Error(`diff contents out of date`);return{oldFile:{name:t.prevName||t.name,contents:o},newFile:{name:t.name,contents:s}}},renderCustomHeader(t,n){let r=n.item,i=e.dx(r.id),a=document.createElement(`div`);a.className=`_fp${r.collapsed?` _fq`:``}`;let c=i?.label??r.id;a.title=c;let l=document.createElement(`span`);l.className=`_fr`,l.textContent=`▾`;let u=document.createElement(`span`);u.className=`__`;let d=i?.status||(r.type===`diff`?r.fileDiff.type[0].toUpperCase():`M`);u.dataset.status=d,u.textContent=d;let f=document.createElement(`span`);f.className=`_fs`;let p=document.createElement(`bdi`);if(p.textContent=c,f.append(p),a.append(l,u,f),i?.changedSince){let e=document.createElement(`span`);e.className=`_A _fw`,e.title=`Changed since your last visit`,a.append(e)}let m=i&&e.d6.get(i.label)?.length||0;if(r.type===`file`){let t=document.createElement(`button`);t.type=`button`,t.className=VS,t.textContent=m?`✎ ${m}`:`✎`,t.title=m?`${m} comment${m>1?`s`:``} — add another`:`Comment on this file`,t.setAttribute(`aria-label`,`Comment on this file`),t.onclick=t=>{t.stopPropagation();let n=new Set(e.bk);n.delete(r.id)&&YW(e,n),x(r.id)},a.append(t)}else if(m){let e=document.createElement(`span`);e.className=`_u`,e.textContent=`✎ ${m}`,a.append(e)}if(i&&(i.additions||i.deletions)){let e=document.createElement(`span`);e.className=`_ft`;let t=document.createElement(`span`);t.className=`_fu`,t.textContent=`+${i.additions||0}`;let n=document.createElement(`span`);n.className=`_fv`,n.textContent=`−${i.deletions||0}`,e.append(t,n),a.append(e)}return a.onclick=()=>{s.key=r.id,s.top=o.viewer?.getTopForItem(r.id)??null;let t=new Set(e.bk);t.delete(r.id)||t.add(r.id),YW(e,t)},a},renderAnnotation(t,i){let a=t.metadata||{},o=i.item.id;if(a.preview){let e=v.get(a);return e||v.set(a,e=iS(a.preview)),e}if(a.draft)return d??=$x({sessions:n,reveal:r},{onSave:t=>e.dz(o,t),onSend:(t,n)=>e.ed(o,t,n),onCancel:()=>{MW(e,null)}});let s=a.comment;if(!s)return;let c=i.item.type===`diff`?i.item.fileDiff:null,l=s.snippet!=null&&!!c&&NV(wx(c,s.side,s.line_start,s.line_end))!==NV(s.snippet);return Qx(s,{sessions:n,reveal:r},{onDelete:t=>e.e2(t),onEdit:(t,n)=>e.e3(t,n),onSend:(t,n)=>e.ec(t,n),drifted:l})},onLineSelectionEnd(e,t){t.item.type===`file`?x(t.item.id):S(e,t.item.id)},onPostRender(e,t,n,r){let i=e;if(n===`unmount`){w.get(i)?.(),w.delete(i);return}w.has(i)?jS(i):w.set(i,AS(i,r.item.id))}},w=new Map,T=new Qb(C,Bx());o.viewer=T,T.setup(e.a1);let E=Ee(e=>{C.themeType=e,T.setOptions({...C})});fe()&&Ux(()=>e.a1,t.signal),e.bs.scrollToItem=t=>{D.recs.has(t)&&(e.c0=null,T.scrollTo({type:`item`,id:t,align:`start`,behavior:`instant`}))},e.bs.scrollToLine=(e,t,n)=>T.scrollTo({type:`line`,id:e,lineNumber:t,side:n||`additions`,align:`center`,behavior:`instant`}),e.bs.clearSelection=()=>T.clearSelectedLines();let D={abort:t,viewer:T,unregTheme:E,unsubScroll:T.subscribeToScroll(t=>{e.bw||=requestAnimationFrame(()=>{e.bw=0;let n=null;for(let r of T.getRenderedItems()){let i=T.getTopForItem(r.id);i==null||i>t+1||(!n||i>(T.getTopForItem(n.key)??-1))&&(n={scope:e.b5,key:r.id,off:Math.round(t-i)})}t>0&&(e.bu=n);let r=n?.key??T.getRenderedItems()[0]?.id,i=r&&e.dx(r)?.repo;i&&i!==e.bl&&ZW(e,i)})}),hostUnregs:w,loaded:!1,wasActive:!1,lastNonce:e.aq||0,lastFileNonce:e.ar||0,recs:new Map,order:``,revealedDraft:null,dockedOpen:!1,start:()=>{this.active&&!D.loaded&&(D.loaded=!0,this.load())},pin:t=>{let n=e.a1,r=Date.now(),i=!1,a=()=>{i=!0};for(let e of[`wheel`,`touchstart`,`keydown`])n.addEventListener(e,a,{once:!0,passive:!0});let o=()=>{if(i||!D.recs.has(t.key))return;let e=D.viewer.getTopForItem(t.key);if(e!=null){let n=e+t.off;Math.abs(D.viewer.getScrollTop()-n)>1&&D.viewer.scrollTo({type:`position`,position:n,behavior:`instant`})}Date.now()-r<1500&&requestAnimationFrame(o)};o()},sync:()=>{let t=[],n=new Set,r=!1;for(let a of this.shownFiles){n.add(a.key);let o=D.recs.get(a.key),s=o&&o.patch===a.patch&&o.status===a.status?o.fileDiff:vx(a,a.key),c=this.commentsByFile.get(a.label)||[],l=s?void 0:b(a,(this.repos||[]).find(e=>e.id===a.repo)),u=g(c,this.draft,a.key)+(l?`|p${_.get(a.key).sig}`:``),d=s?void 0:h(a.key,c,this.draft,l),f=this.collapsedFiles.has(a.key);s&&i.set(s,{worktree:e.du(a.repo),path:a.path,repo:a.repo});let p={name:a.path,contents:l?` `:a.binary?`(binary file)`:a.tooLarge?`(file too large to display)`:`(file could not be read)`},v=o;!v||v.item.type===`diff`!=!!s?(v={item:s?{id:a.key,type:`diff`,fileDiff:s,annotations:m(a.key,c,this.draft),collapsed:f,version:(v?.item.version??0)+1}:{id:a.key,type:`file`,file:p,annotations:d,collapsed:f,version:(v?.item.version??0)+1},fileDiff:s,annSig:u,collapsed:f,patch:a.patch,status:a.status},D.recs.set(a.key,v),r=!0):(v.fileDiff!==s||v.annSig!==u||v.collapsed!==f)&&(v.item.type===`diff`&&s?(v.item.fileDiff=s,v.item.annotations=m(a.key,c,this.draft)):v.item.type===`file`&&(v.item.file.contents!==p.contents&&(v.item.file=p),v.item.annotations=d),v.item.collapsed=f,v.item.version=(v.item.version??0)+1,v.fileDiff=s,v.annSig=u,v.collapsed=f,v.patch=a.patch,v.status=a.status,r||D.viewer.updateItem(v.item)),t.push(v.item)}for(let e of[...D.recs.keys()])n.has(e)||D.recs.delete(e);let a=t.map(e=>e.id).join(`
2801
- `);if((r||a!==D.order)&&(D.order=a,D.viewer.setItems(t)),s.key){let{key:e,top:t}=s;s.key=null,t!=null&&t<D.viewer.getScrollTop()&&D.viewer.scrollTo({type:`item`,id:e,align:`start`,behavior:`instant`})}let o=this.draft;o&&o!==D.revealedDraft&&D.recs.has(o.key)&&(D.revealedDraft=o,D.viewer.scrollTo({type:`line`,id:o.key,lineNumber:o.end,side:o.side===`deletions`?`deletions`:`additions`,align:`nearest`,offset:180,behavior:`smooth-auto`}));let c=e.by;c&&D.recs.has(c.key)&&(e.by=null,D.pin(c)),e.c0&&D.recs.has(e.c0)&&e.bs.scrollToItem(e.c0)}};return D.wasActive=!!this.active,this.findOpen&&(D.dockedOpen=!0,e.em(!0)),ct().addEventListener(`review.changed`,t=>{D.loaded&&t.data?.workspaceId===e.a6&&e.ce()},{signal:t.signal}),ct().addEventListener(`status.changed`,t=>{if(!this.active||!D.loaded||e.az)return;let n=t.data,r=n&&n[e.a6];if(!r)return;let i=gx(r);i&&e.bo&&i!==e.bo&&e.cd()},{signal:t.signal}),window.addEventListener(`pagehide`,()=>{this.active&&D.loaded&&(e.ck(),e.c3())},{signal:t.signal}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&this.active&&D.loaded&&e.c3()},{signal:t.signal}),D.start(),D},onUpdate:function(){this.start(),this.active&&this.loaded&&!this.wasActive&&e.cc(),!this.active&&this.loaded&&this.wasActive&&(e.ck(),e.c3()),this.wasActive=!!this.active,!!this.findOpen!==this.dockedOpen&&(this.dockedOpen=!!this.findOpen,e.em(this.dockedOpen));let t=e.aq||0;this.loaded&&e.ag&&t!==this.lastNonce&&e.c5(e.ag),this.lastNonce=t;let n=e.ar||0;this.loaded&&e.ah&&n!==this.lastFileNonce?(e.c4(e.ah),this.lastFileNonce=n):this.loaded&&(this.lastFileNonce=n),e.a7&&e.a7!==e.b5&&e.cf(e.a7,!1),e.a8!==void 0&&(e.a8??null)!==e.b6&&e.cg(e.a8??null),this.draft||this.viewer.clearSelectedLines(),this.sync()},onDestroy:function(){e.bp&&clearTimeout(e.bp),this.loaded&&(e.ck(),e.c3()),this.abort.abort(),this.unsubScroll(),this.unregTheme();for(let e of this.hostUnregs.values())e();this.viewer.cleanUp()}})),$=F(193,sU,43),cU=H(169,$),lU=F(168,e=>cU(e,AK(e)),5),uU=H(183,$),dU=F(179,e=>uU(e,jK(e)),5),fU=H(165,e=>{lU(e),dU(e)}),pU=bt(24,lt,(e=>`/${e}&`)(we),pH,hH),mU=(e,t)=>{xz(e.a2,t),cV(e.a3,t),oK(e,t.size)},hU=H(167,e=>{lU(e),dU(e),$(e)}),gU=H(166,e=>hU(e,NK(e))),_U=(e,t)=>Zw(e.t,t),vU=H(136,e=>{aK(e,e.d2?.length),$(e)}),yU=F(131,e=>vU(e,e.cw.filter(t=>!e.bm.has(t.repo)))),bU=H(156,L(qH)),xU=(e,t)=>{uK(e,t?.additions),dK(e,t?.deletions)},SU=(e,t)=>{vz(e.a2,t),vV(e.a3,t),lK(e,t?.[0]?.id),bU(e,new Map(t.map(e=>[e.id,e]))),xU(e,(()=>{let e=0,n=0;for(let r of t)e+=r.additions,n+=r.deletions;return{additions:e,deletions:n}})())},CU=F(132,e=>SU(e,(()=>{let t=new Map;for(let n of e.cn)t.set(n.worktree,(t.get(n.worktree)||0)+1);return e.cn.map(n=>{let r=e.cw.filter(e=>e.repo===n.id),i=0,a=0;for(let e of r)i+=e.additions||0,a+=e.deletions||0;return{id:n.id,repo:n,label:n.pr&&(t.get(n.worktree)||0)>1?`${n.worktree} #${n.pr.number}`:n.worktree,files:r,additions:i,deletions:a,total:n.files.length}}).filter(e=>e.files.length||!e.total&&e.repo.pr)})())),wU=(e,t)=>{wz(e.a2,t),SV(e.a3,t)},TU=F(133,e=>wU(e,PK(e)),3),EU=H(130,e=>{iK(e,e.cw?.length),yU(e),CU(e),TU(e)}),DU=F(129,e=>EU(e,e.cu?e.ct.filter(t=>e.cu.has(t.key)||t.key===e.bj):e.ct),2),OU=H(127,e=>{_U(e,e.ct.map(e=>({...e,fileDiff:vx(e,e.key)}))),DU(e)}),kU=F(124,e=>OU(e,(()=>{let t=Vx(e.b1);return e.cp.filter(n=>t(n.label)&&(!e.b4||n.changedSince))})()),2),AU=(e,t)=>oV(e.a3,t),jU=(e,t)=>{bz(e.a2,t),AU(e,new Set(t.keys()))},MU=F(141,e=>jU(e,new Map(e.cp.flatMap(t=>{let n=e.d6.get(t.label)?.length;return n?[[t.key,n]]:[]})))),NU=H(123,e=>{nK(e,e.cp?.length),mU(e,new Set(e.cp.filter(e=>e.changedSince).map(e=>e.key))),gU(e,new Map(e.cp.map(e=>[e.key,e]))),kU(e),MU(e)}),PU=F(163,e=>z(e.o,`title`,`${e.dh}\n${e.ds}`)),FU=H(162,PU),IU=F(122,e=>FU(e,e.cn.filter(e=>e.files.length||e.pr).map(t=>{let n=hS(t.pr?.baseRefName||t.base,t.pr?.headRefName||t.branch,e.al||``,e.am||``);return`${t.worktree}: ${n.title}`}).join(`
2802
- `)),2),LU=H(121,e=>{NU(e,e.cn.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.id}/${t.path}`,label:`${e.worktree}/${t.path}`})))),CU(e),IU(e)}),RU=H(151,PU),zU=F(149,e=>RU(e,e.b6?e.de.find(t=>t.sha===e.b6)?.label??cS(e.b6,7):{committed:`Committed`,working:`Working tree`,dirty:`Uncommitted`}[e.b5]),2),BU=H(148,e=>{cK(e,e.de?.length),zU(e),qV(e)}),VU=F(120,e=>{LU(e,e.b6?e.cl.filter(e=>e.rev):e.cl),BU(e,(()=>{let t=new Set,n=[];for(let r of e.cl)for(let e of r.commits||[])t.has(e.sha)||(t.add(e.sha),n.push({sha:e.sha,label:`${r.worktree}#${cS(e.sha,7)} ${e.subject}`}));return e.b6&&!t.has(e.b6)&&n.unshift({sha:e.b6,label:cS(e.b6,7)}),n})())}),HU=H(119,e=>{oU(e,new Set(e.cl.filter(e=>!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)).map(e=>e.id))),fU(e,MK(e)),pU(e,[e.cl.filter(e=>e.baseMissing),`id`]),VU(e),cH(e)}),UU=H(101,$),WU=F(93,e=>UU(e,FK(e)),2),GU=L(RH),KU=H(110,e=>{$(e),GU(e)}),qU=F(106,e=>KU(e,IK(e))),JU=H(111,$),YU=F(109,e=>JU(e,LK(e)),4),XU=F(117,e=>It(e,`q`,e.b6?`rev:${e.b6}`:e.b5,RK(e)),2),ZU=H(116,XU),QU=F(115,e=>ZU(e,t=>{if(t.startsWith(`rev:`)){e.cg(t.slice(4));return}let n=t;if(e.b6&&(wG(e,null),e.ak?.(null),n===e.b5)){e.c7(e.b5);return}e.cf(n)}),5),$U=H(113,e=>{QU(e),$(e)}),eW=F(107,e=>$U(e,zK(e)),2),tW=H(114,e=>{QU(e),$(e)}),nW=F(108,e=>tW(e,BK(e)),3),rW=H(105,e=>{qU(e),YU(e),eW(e),nW(e),QU(e),$(e)}),iW=F(104,e=>rW(e,VK(e)),10),aW=H(103,e=>{iW(e),$(e)}),oW=F(97,e=>aW(e,HK(e)),2),sW=H(118,$),cW=F(55,e=>sW(e,UK(e))),lW=N(9,(e=>`<button>${e}</button>`)(c),(e=>` D/${e}&l`)(E),rH),uW=N(12,(e=>`<button><span aria-hidden=true>${e}<span> </span></span></button>`)(ZC),(e=>` D D/${e}& D n`)(QC),eH),dW=N(21,(e=>`<button title="Find in review (⌘/Ctrl+F)" aria-label="Find in review">${e}</button>`)(Xe),(e=>` D/${e}&l`)(y),ZV),fW=F(147,e=>dW(e,e.dc&&!e.bb?0:1)),pW=H(146,e=>{lW(e,+!e.dc),uW(e,+!e.dc),fW(e)}),mW=F(126,e=>pW(e,!e.as||e.cr>0)),hW=H(180,tU),gW=H(181,nU),_W=H(182,$),vW=F(178,e=>{hW(e,WK(e)),gW(e,GK(e)),_W(e,KK(e))}),yW=H(177,e=>{vW(e),dU(e)}),bW=F(176,e=>yW(e,qK(e)),4),xW=N(25,`<div aria-hidden=true></div>`,` `,UV),SW=F(62,e=>xW(e,!e.as&&e.az?0:1)),CW=N(26,`<p> </p>`,` D `,oH,`<p> </p>`,` D `,OH),wW=F(135,e=>CW(e,e.as&&!e.cr?0:e.as&&!e.d0&&!e.bi?1:2),3),TW=Tt(54,e=>{HU(e,e.as||[]),WU(e),oW(e),cW(e),mW(e),bW(e),SW(e),wW(e),$(e)}),EW=H(140,e=>{MU(e),$(e)}),DW=H(172,$),OW=F(171,e=>DW(e,JK(e))),kW=H(173,$),AW=F(57,e=>kW(e,YK(e))),jW=Tt(56,e=>{mG(e,e.au?.length),EW(e,(()=>{let t=new Map;for(let n of e.au){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),lU(e),OW(e),AW(e),bW(e),vW(e)}),MW=Tt(59,e=>{lU(e),dU(e),$(e)}),NW=N(23,lt,(e=>`/${e}&`)(we),NH),PW=L(jH),FW=Tt(60,e=>{NW(e,+!e.ay),PW(e)}),IW=L(LH),LW=Tt(61,e=>{z(e.k,`disabled`,e.az),ke(e.l,e.az&&`_F`),z(e.o,`disabled`,e.az),z(e.q,`disabled`,e.az),YU(e),SW(e),$(e),IW(e)}),RW=(e,t)=>{$R(e.a2,t),iV(e.a3,t)},zW=L(_H),BW=Tt(66,e=>{iW(e),kU(e),kH(e),zW(e)}),VW=Tt(69,e=>{fz(e.a2,e.b7),tH(e)}),HW=Tt(70,e=>$B(e.a3,e.b8)),UW=I(`A54`,e=>{e.bb&&!e.b9&&EG(e,!0)}),WW=F(74,UW),GW=H(73,e=>{iT(e.t,e.bb),oT(e.t,!e.bb),WW(e),fW(e)}),KW=H(128,DU),qW=e=>{KW(e,e.bg.trim()?new Set(e.bh):null)},JW=Tt(77,e=>{LG(e,e.bf?.query),RG(e,e.bf?.keys),zG(e,e.bf?.hit),qW(e)}),YW=Tt(82,$),XW=F(155,e=>Cz(e.a2,e.bl??e.dk)),ZW=Tt(83,e=>{XW(e),$(e)}),QW=H(102,e=>{Sz(e.a2,ZK(e)),iW(e),$(e)}),$W=F(99,e=>QW(e,QK(e)),4),eG=Tt(84,e=>{yz(e.a2,e.bm),xV(e.a3,e.bm),$W(e),yU(e),TU(e)}),tG=(e,t)=>{VG(e,t.sig),HG(e,t.timer)},nG=(e,t)=>UG(e,t.seq),rG=(e,t)=>Lw(e.t,function(e){t(e)}),iG=H(90,e=>{rG(e,t=>{if(JW(e,t),!t.hit)return;let n=t.hit;setTimeout(()=>{n.line<1?e.bs.scrollToItem(n.key):e.bs.scrollToLine(n.key,n.line,n.side)},0)}),$W(e),oW(e),$(e)}),aG=(e,t)=>{WG(e,t.anchor),GG(e,t.raf)},oG=(e,t)=>{qG(e,t.pos),JG(e,t.jump)},sG=H(161),cG=H(164,e=>{lU(e),dU(e),$(e)}),lG=(e,t)=>gK(e,t.busy),uG=(e,t)=>{CK(e,t.home),wK(e,t.raf)},dG=I(`A52`,e=>{M(e.k,`click`,function(){e.cc()}),M(e.o,`click`,function(){let t=e.q;typeof t.showPicker==`function`?t.showPicker():t.focus()}),At(e,`q`)});function fG(e){Dt(e,19,bK),R(e.a,`_eY`),R(e.b,`_e3`),R(e.c,`_fz`),R(e.d,`_e4`),R(e.e,`_fa`),R(e.g,BS),R(e.i,[`_e2`,`_fy`]),R(e.k,[v,`_e0`]),Ge(e.l),it(e.l,14),R(e.n,`_fb`),Ae(e.p),De(e.p,14),at(e.p),R(e.q,`_fc`),Yw(e.t),ww(e.t,aq(e)),Mw(e.t),Nw(e.t),Iw(e.t),R(e.w,`_fn`),R(e.a1,`_fo`),oz(e.a2),Ez(e.a2,l({content:zV(e)})),gV(e.a3),CV(e.a3,l({content:IV(e)})),eV(e.a3,iq(e)),_t(e,aU(e)),TW(e,null),jW(e,[]),MW(e,null),FW(e,null),LW(e,!1),RW(e,XK(e)),BW(e,!1),VW(e,ne()),HW(e,!1),GW(e,!ce()),JW(e,{query:``,hit:null,keys:[]}),YW(e,new Set),ZW(e,null),eG(e,new Set),tG(e,{sig:``,timer:0}),nG(e,{seq:0}),iG(e,{scrollToItem:tq,scrollToLine:eq,clearSelection:$K}),aG(e,{anchor:null,raf:0}),oG(e,{pos:null,jump:null}),sG(e,nq(e)),cG(e,rq),lG(e,{busy:0}),uG(e,{home:null,raf:0}),dG(e)}var pG=N(7,(e=>`<span>${e}</span>`)(qS),(e=>` D/${e}&l`)(JS),$H),mG=H(58,e=>{pG(e,+!e.aw),eU(e)}),hG=I(`A51`,e=>{e.b1!==ge(e.a6)&&Qe(e.a6,e.b1)}),gG=F(64,hG),_G=Tt(63,e=>{QR(e.a2,e.b1),rV(e.a3,e.b1),kU(e),gG(e),DH(e)}),vG=H(112,$),yG=H(170,e=>{OW(e),bW(e)}),bG=H(32,e=>{pV(e.a3,e.a6),_G(e,ge(e.a6)),vG(e,oq(e)),yG(e,sq(e)),WU(e),iW(e),cW(e),lU(e),AW(e),dU(e),gG(e),$(e),rU(e)}),xG=L(lH),SG=Tt(67,e=>{mV(e.a3,e.b5),iW(e),qU(e),YU(e),eW(e),nW(e),QU(e),zU(e),XU(e),$(e),xG(e),aH(e)}),CG=H(33,e=>{SG(e,e.a7??ve()),$(e)}),wG=Tt(68,e=>{R(e.o,[v,`_e0`,{_eZ:!!e.b6}]),iW(e),nW(e),QU(e),VU(e),zU(e),XU(e),$(e),sH(e)}),TG=H(34,e=>{wG(e,e.a8??null),$(e)}),EG=xt(71,e=>{R(e.s,[`_e_`,{_e9:!e.b9}]),Cw(e.t,e.b9),WW(e),$(e),YV(e)}),DG=F(37,e=>EG(e,e.a9,e.aa)),OG=H(35,DG),kG=H(36,DG),AG=I(`A53`,e=>{e.ai&&window.addEventListener(`keydown`,t=>{!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||(t.preventDefault(),e.ee()))},{capture:!0,signal:Pt(e,0)})}),jG=F(185,e=>{Ft(e,0),AG(e)}),MG=H(184,jG),NG=xt(75,e=>{aT(e.t,e.bd),MG(e,cq(e))}),PG=F(40,e=>NG(e,e.ac,e.ad)),FG=H(38,PG),IG=H(39,PG),LG=H(78,AH),RG=H(79),zG=H(80,e=>{BG(e,e.bi?.key),wW(e)}),BG=H(81,DU),VG=H(86,e=>{iW(e),$(e)}),HG=H(87,e=>{YU(e),$(e)}),UG=H(89,iW),WG=H(92,e=>{WU(e),$(e)}),GG=H(94,$),KG=H(100,iW),qG=H(96,e=>{KG(e,lq(e)),$W(e),oW(e),TU(e),$(e)}),JG=H(98,e=>{$W(e),TU(e),$(e)}),YG=H(41,$W),XG=H(42,e=>{iW(e),$(e)}),ZG=H(43,e=>{iW(e),$(e)}),QG=H(44,e=>{YU(e),jG(e),$(e)}),$G=H(45,eW),eK=H(46,e=>{nW(e),QU(e)}),tK=L(bH),nK=H(125,e=>{let t;e.cr&&(t=l({content:VV(e)})),mz(e.a2,t);let n;e.cr&&(n=l({content:BV(e)})),bV(e.a3,n),mW(e),wW(e),tK(e)}),rK=L(xH),iK=H(134,e=>{wW(e),rK(e)}),aK=H(137,QV),oK=H(139,L(SH)),sK=N(17,`<optgroup label=Commits></optgroup>`,` `,JV),cK=(e,t)=>sK(e,+!t),lK=H(154,XW),uK=H(158,L(CH)),dK=H(159,L(wH)),fK=L(PH),pK=H(47,e=>{IU(e),fK(e)}),mK=L(IH),hK=H(48,e=>{IU(e),mK(e)}),gK=H(175,bW),_K=H(49,bW),vK=N(5,(e=>`<a title="Back to terminal (⌘/Ctrl+Shift+D)">${e}</a>`)(te),(e=>` D/${e}&l`)(e),iU),yK=(e,t)=>vK(e,+!t),bK=St(`A40`,H(187)),xK=H(192,$),SK=F(191,e=>xK(e,uq(e))),CK=H(189,SK),wK=H(190,SK),TK=H(51,e=>{$(e),QH(e)}),EK=H(52,$),DK=H(53,$),OK=e=>function(){BW(e._,!e._.b4)},kK=e=>function(){FW(e._,null)},AK=e=>async(t,n)=>{let r=e.ax,i=e.dx(t);if(MW(e,null),r&&i)try{let t=await Ce(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:e.du(i.repo),path:i.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim(),...e.dv(i,r)})});jW(e,e.au.some(e=>e.id===t.id)?e.au:e.au.concat(t))}catch(t){FW(e,String(t.message||t))}},jK=e=>(t,n,r)=>{let i=e.ax,a=e.dx(t),o=n.trim();if(!i||!a||!o)return Promise.resolve(!1);let s={id:-1,workspace_id:e.a6,worktree:e.du(a.repo),path:a.path,side:i.side===`deletions`?`deletions`:`additions`,line_start:i.start,line_end:i.end,text:o,created_at:``,...e.dv(a,i)};return e.e7([s],{session:r},[])},MK=e=>(t,n)=>{let r=e.cl.find(e=>e.id===t.repo),i=vx(t,t.key),a=n.side===`deletions`?`deletions`:`additions`;return{head:r?.head,snippet:i?wx(i,a,n.start,n.end):void 0}},NK=e=>t=>e.dw.get(t),PK=e=>t=>{let n=new Set(e.bm),r=!n.delete(t);r&&n.add(t);let i=e.cw.filter(e=>!n.has(e.repo)),a=i.findIndex(e=>e.repo===t),o=e.cw.findIndex(e=>e.repo===t),s=r?e.cw.slice(Math.max(o,0)).find(e=>!n.has(e.repo))??i[i.length-1]:i[a];eG(e,n),ZW(e,t),s&&(e.by=null,e.c0=s.key)},FK=e=>()=>{e.as&&Ie(e.a6,e.bu)},IK=e=>()=>e.c7(e.b5,!0),LK=e=>()=>{e.bp&&clearTimeout(e.bp),e.bp=setTimeout(()=>{e.bp=0,e.ai&&!e.az&&e.c7(e.b5,!0)},400)},RK=e=>function(t){e.ci(t)},zK=e=>(t,n=!0)=>{t!==e.b5&&(SG(e,t),n&&xe(t),e.aj?.(t),e.c7(t))},BK=e=>t=>{t!==e.b6&&(wG(e,t),e.ak?.(t),e.c7(e.b5))},VK=e=>async(t=e.b5,n=!1)=>{let r=++e.br;LW(e,!0),FW(e,null);try{let i=new URLSearchParams;t!==`committed`&&i.set(`scope`,t),n&&i.set(`refresh`,`1`),e.b6&&i.set(`rev`,e.b6);let a=await Ce(`/api/workspaces/${e.a6}/diff?${i}`);if(r!==e.br)return;let o=a.sections,s=a;if(TW(e,o),e.b4&&!o.some(e=>e.files.some(e=>e.changedSince))&&BW(e,!1),jW(e,s.comments||[]),e.bo=hx(o),e.ag&&e.c5(e.ag),e.ah)e.c4(e.ah);else if(!e.ag&&!n&&e.br===1){let n=me(e.a6);n&&n.scope===t&&e.c2(n)}}catch(t){if(r!==e.br)return;FW(e,String(t.message||t))}finally{r===e.br&&LW(e,!1)}},HK=e=>t=>{let n=(e.as||[]).find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),r=n?.files[0];n&&r&&(e.by=null,e.bs.scrollToItem(`${n.id}/${r.path}`))},UK=e=>()=>{if(!e.as)return;let t={},n={};for(let r of e.as){t[r.id]=r.head;for(let e of r.files)e.hash&&(n[`${r.worktree}/${e.path}`]=e.hash)}fetch(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`seen`,heads:t,dirty:n}),keepalive:!0}).catch(()=>{})},WK=e=>()=>e.e7(e.au,{clipboard:!0},`all`),GK=e=>t=>e.e7(e.au,{session:t},`all`),KK=e=>(t,n)=>{let r=e.au.find(e=>e.id===t);return r?e.e7([r],{session:n},[t]):Promise.resolve(!1)},qK=e=>async(t,n,r)=>{if(!t.length)return!0;e.e5++;try{let i=aS(t,e.as);if(`clipboard`in n){if(!await o(i))return FW(e,`Copy failed: the clipboard needs HTTPS in this browser.`),!1}else await Ce(`/api/sessions/${n.session}/send`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:`Please address this review feedback, then summarize what you changed.\n\n${i}`,...Te()||{}})}),e.an?.(n.session);if(MW(e,null),r===`all`)jW(e,[]);else{let t=new Set(r);jW(e,e.au.filter(e=>!t.has(e.id)))}return(r===`all`||r.length)&&await e.e0(r).catch(()=>{}),!0}catch(t){return FW(e,String(t.message||t)),!1}finally{e.e5--}},JK=e=>async t=>{jW(e,e.au.filter(e=>e.id!==t)),await e.e0([t]).catch(()=>{})},YK=e=>async(t,n)=>{let r=e.au.find(e=>e.id===t);if(!r)return;let i=n.trim();if(i&&i!==r.text){jW(e,e.au.map(e=>e.id===t?{...e,text:i}:e));try{await Ce(`/api/workspaces/${e.a6}/review/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({text:i})})}catch(n){throw jW(e,e.au.map(e=>e.id===t?r:e)),FW(e,String(n.message||n)),n}}},XK=e=>t=>{_G(e,t)},ZK=e=>function(t){e.c4(t)},QK=e=>t=>{let n=t.slice(0,t.indexOf(`/`));if(e.bm.has(n)){let t=new Set(e.bm);t.delete(n),eG(e,t)}e.by=null,e.c0=t,e.af?.(t),e.bs.scrollToItem(t)};function $K(){}function eq(e,t,n){}function tq(e){}var nq=e=>()=>{_G(e,``),BW(e,!1),JW(e,{query:``,hit:null,keys:[]})};function rq(e){return e.includes(`#`)?e.split(`#`)[0]:e}var iq=e=>t=>{HW(e,t)},aq=e=>t=>{EG(e,t)},oq=e=>async()=>{try{jW(e,(await Ce(`/api/workspaces/${e.a6}/review`)).comments||[])}catch{}},sq=e=>t=>t===`all`?fetch(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})}):Promise.all(t.map(t=>fetch(`/api/workspaces/${e.a6}/review/${t}`,{method:`DELETE`}))),cq=e=>()=>{EG(e,!0),NG(e,+e.bd+1),aU(e)()},lq=e=>t=>{e.by=t},uq=e=>t=>{if(!ce())return;let n=e.s;if(e.ej??=n.parentElement,cancelAnimationFrame(e.ek),!t){e.ej&&n.parentElement!==e.ej&&e.ej.append(n);return}let r=0,i=()=>{let t=document.getElementById(`review-find-host`);t?n.parentElement!==t&&(t.append(n),requestAnimationFrame(()=>setTimeout(aU(e),0))):r++<20&&(e.ek=requestAnimationFrame(i))};i()};U(`A33`,OK),U(`A32`,kK),U(`A21`,AK),U(`A29`,jK),U(`A19`,MK),U(`A20`,NK),U(`A16`,PK),U(`A6`,FK),U(`A10`,IK),U(`A11`,LK),U(`A0`,RK),U(`A13`,zK),U(`A14`,BK),U(`A9`,VK),U(`A8`,HK),U(`A15`,UK),U(`A26`,WK),U(`A27`,GK),U(`A28`,KK),U(`A25`,qK),U(`A23`,JK),U(`A24`,YK),U(`A1`,XK),U(`A34`,ZK),U(`A7`,QK),U(`A4`,$K),U(`A3`,eq),U(`A2`,tq),U(`A17`,nq),U(`A18`,rq),U(`A35`,iq),U(`A31`,aq),U(`A12`,oq),U(`A22`,sq),U(`A30`,cq),U(`A5`,lq),U(`A36`,uq);export{QG as $input_active,OG as $input_findOpen,kG as $input_findOpenChange,FG as $input_findTick,IG as $input_findTickChange,ZG as $input_focusFile,DK as $input_focusFileNonce,EK as $input_focusNonce,XG as $input_focusPr,yK as $input_onExit,YG as $input_onFileChange,eK as $input_onRevChange,$G as $input_onScopeChange,_K as $input_onSent,TG as $input_rev,CG as $input_scope,TK as $input_sessions,pK as $input_workspaceBranch,bG as $input_workspaceId,hK as $input_workspaceName,fG as $setup,jV as $template,MV as $walks};
2800
+ `)}var pH=e=>{AU._(e.a,e._)},mH=(e,t)=>MU(e.a,t),hH=zt(`A50`,(e=>`<!>${e}<!>`)(oH),(e=>`b/${e}&b`)(aH),pH,(e,t)=>mH(e,(t?.[0]).id)),gH=e=>{AU._(e.a,e._)},_H=(e,t)=>MU(e.a,t),vH=zt(`A48`,(e=>`<!>${e}<!>`)(oH),(e=>`b/${e}&b`)(aH),gH,(e,t)=>_H(e,(t?.[0]).id)),yH=zt(`A49`,(e=>`<!>${e}<!>`)(cH),(e=>`b/${e}&b`)(sH),e=>{tU._(e.a,e._)}),bH=zt(`A47`,(e=>`<!>${e}<!>`)(cH),(e=>`b/${e}&b`)(sH),e=>{tU._(e.a,e._)}),xH=Et(0,`<div><div></div><div></div></div>`,` D b `,e=>{R(e.a,`_gE`),R(e.b,[`_gD`,`_gF`]),R(e.c,[`_gD`,`_gG`])}),SH=e=>{R(e.a,`_gC`),xH(e,[2,0,1])},CH=(e,t)=>z(e.a,`value`,`rev:${t}`),wH=(e,t)=>j(e.b,t),TH=St(0,`<option> </option>`,` D `,0,(e,t)=>{CH(e,t[0]?.sha),wH(e,t[0]?.label)}),EH=P(17,0,e=>TH(e,[e._.db,`sha`])),DH=EH,OH=P(26,2,e=>j(e.c,e._.dg)),kH=I(`A44`,e=>M(e.d,`click`,function(){nK(e._,new Set)})),AH=e=>{OH._(e),jH._(e),R(e.a,`_b6`),R(e.d,`_q`),kH(e)},jH=P(26,2,e=>j(e.b,e._.do)),MH=P(21,0,e=>z(e.a,`hidden`,e._.b9)),NH=I(`A41`,e=>M(e.a,`click`,function(){e._.ej()})),PH=e=>{MH._(e),R(e.a,[_,`_gv`,`_gn`]),b(e.b),m(e.b,14),de(e.b),NH(e)},FH=P(12,0,e=>{z(e.a,`title`,`Jump to file (${e._.dq})`),z(e.a,`aria-label`,`Jump to file (${e._.dq} files)`),j(e.e,e._.dq>99?`99+`:e._.dq)}),IH=I(`A39`,e=>M(e.a,`click`,function(){TG(e._,!0)})),LH=e=>{FH._(e),R(e.a,[_,`_gn`,`_gH`]),R(e.b,`_gI`),nw(e.c),rw(e.c,20),iw(e.c,`_gJ`),R(e.d,`_gK`),IH(e)},RH=P(9,0,e=>{R(e.a,[HS,`_gn`,{_gm:e._.b7}]),z(e.a,`title`,e._.b7?`Hide file tree`:`Show file tree`)}),zH=I(`A38`,e=>M(e.a,`click`,function(){wG(e._,!e._.b7),Ee(e._.b7)})),BH=e=>{RH._(e),u(e.b),ae(e.b,14),ft(e.b),zH(e)},VH=F(2,e=>j(e.b,e._.b6?`This commit is not in any of these repos.`:e._.cm.some(e=>e.unborn)?`No commits yet.`:e._.b5===`dirty`?`Nothing uncommitted.`:e._.cm.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`),2),HH=P(26,0,VH),UH=e=>{HH._(e),WH._(e),GH._(e),R(e.a,`_b6`)},WH=P(26,0,VH),GH=P(26,0,VH),KH=V(208,e=>j(e.b,e._._.b5===`committed`?``:`, showing uncommitted changes only`),e=>e._._),qH=e=>{KH(e),JH(e)},JH=V(5,e=>j(e.a,e._.e)),YH=At(`A43`,`<!><!>.`,`%b%`,qH),XH=e=>{ye(e.a),ke(e.a,YH(e)),qe(e.a,`warn`),Ie(e.a,`inline`),lt(e.a),$e(e.a),Pe(e.a),Ne(e.a,{})},ZH=(e,t)=>gt(e.a,`${t}: base not found`),QH=(e,t)=>{ZH(e,t[0]?.worktree),$H(e,t[0]?.base)},$H=H(4,L(JH)),eU=V(207,e=>zT(e.a,e._.b4)),tU=Pt(e=>{eU(e),rU(e),iU(e),aU(e),oU(e),sU(e),cU(e),OT(e.a),VT(e.a,hq(e))}),nU=F(1,e=>FT(e.a,e._.cs-e._.d0)),rU=V(215,nU),iU=V(216,e=>{kT(e.a,e._.d0),nU(e)}),aU=V(217,e=>RT(e.a,e._.d2)),oU=V(224,e=>MT(e.a,e._.dt)),sU=V(225,e=>NT(e.a,e._.du)),cU=V(226,e=>BT(e.a,e._.dw)),lU=F(2,e=>j(e.b,e._.bg.trim()?`No matches in review.`:e._.b4&&!e._.b1?`Nothing changed since your last visit.`:`No files match "${e._.b1}".`),2),uU=P(26,1,lU),dU=e=>{uU._(e),fU._(e),pU._(e),R(e.a,`_b6`)},fU=P(26,1,lU),pU=P(26,1,lU),mU=V(204,e=>j(e.a,e._._.ay),e=>e._._),hU=At(`A42`,` `,` `,mU),gU=e=>{ye(e.a),ke(e.a,hU(e)),Pe(e.a,gq(e)),lt(e.a),$e(e.a),qe(e.a),Ie(e.a),gt(e.a),Ne(e.a,{})},_U=V(200,e=>XE(e.a,e._._.al||``),e=>e._._),vU=e=>{_U(e),yU(e),bU(e),xU(e),CU(e),wU._(e),TU._(e)},yU=V(201,e=>ZE(e.a,e._._.am||``),e=>e._._),bU=V(205,e=>JE(e.a,e._._.az),e=>e._._),xU=V(213,e=>YE(e.a,e._._.cd),e=>e._._),SU=F(1,e=>qE(e.a,e._._.d8.has(e._.d))),CU=V(218,SU,e=>e._._),wU=P(0,0,SU),TU=P(0,0,e=>KE(e.a,e._.g)),EU=N(0,(e=>`<!>${e}<!>`)(UT),(e=>`b/${e}&b`)(`b%c`),vU),DU=(e,t)=>{jU(e,t?.repo),EU(e,+!t)},OU=F(4,e=>DU(e,e._.dl.get(e.d))),kU=V(221,OU),AU=Pt(kU),jU=H(6,TU),MU=H(3,e=>{OU(e),wU(e)}),NU=P(7,0,e=>HC(e.b,e._.ap)),PU=e=>{NU._(e),FU._(e),IU._(e),LU._(e),R(e.a,`_gt`),RC(e.b)},FU=P(7,0,e=>YC(e.b,e._.aw)),IU=P(7,0,e=>ZC(e.b,e._.ef)),LU=P(7,0,e=>XC(e.b,e._.eg)),RU=P(5,0,e=>z(e.a,`href`,`/w/${e._.a6}`)),zU=e=>{RU._(e),R(e.a,[_,`_gs`]),_e(e.b),pe(e.b,14),he(e.b)},BU=vt(`A37`,192),VU=H(142,L(CU)),HU=I(`A51`,e=>Tt(e,{active:e.ai,load:e.c8,findOpen:e.b9,shownFiles:e.dp,commentsByFile:e.d3,draft:e.ax,sessions:e.ap,collapsedFiles:e.bk,repos:e.as,onMount:function(){let t=new AbortController,n=()=>e.ap||[],r=(t,n=!0)=>{let r=e.a1,i=t.getBoundingClientRect();if(!i.height)return;let a=r.getBoundingClientRect(),o=getComputedStyle(t),s=i.top-(parseFloat(o.scrollMarginTop)||0),c=i.bottom+(parseFloat(o.scrollMarginBottom)||0),l=0;s<a.top?l=s-a.top:c>a.bottom&&(l=c-a.bottom),l&&r.scrollTo({top:Math.max(0,r.scrollTop+l),behavior:n?`smooth`:`auto`})},i=new WeakMap,a=async(t,n,r)=>{if(!r)return``;let i=new URLSearchParams({worktree:t,path:n,rev:r});return(await re(`/api/workspaces/${e.a6}/diff/contents?${i}`)).contents},o={viewer:null},s={key:null,top:null},c=new Map,l,u={draft:!0},d,f=e=>{let t=c.get(e.id);return(!t||t.comment.text!==e.text)&&(t={comment:e}),c.set(e.id,t),t},p=e=>(l!==e&&(l=e,u={draft:!0},d=void 0),u),m=(e,t,n)=>{let r=[];for(let e of t)r.push({side:e.side,lineNumber:e.line_end,metadata:f(e)});return n&&n.key===e&&r.push({side:n.side===`deletions`?`deletions`:`additions`,lineNumber:n.end,metadata:p(n)}),r},h=(e,t,n,r)=>{let i=r?[r]:[];for(let e of t)i.push({lineNumber:0,metadata:f(e)});return n&&n.key===e&&i.push({lineNumber:0,metadata:p(n)}),i.length?i:void 0},g=(e,t,n)=>e.map(e=>`${e.id}:${e.text.length}`).join(`,`)+(t&&t.key===n?`|d${t.side}${t.start}-${t.end}`:``),_=new Map,v=new WeakMap,y=(t,n,r,i)=>{let a=new URLSearchParams({worktree:t,path:n,rev:r});return i&&a.set(`v`,i),`/api/workspaces/${e.a6}/diff/blob?${a}`},b=(t,n)=>{let r=t.binary?qx(t.path)?.kind:void 0;if(!r||!n)return;let i=e.dz(t.repo),a=t.status===`A`,o=t.status===`D`,s=[];if(!a&&n.oldRev&&s.push({label:o?`Deleted`:`Before`,src:y(i,t.oldPath||t.path,n.oldRev)}),!o&&n.newRev&&s.push({label:a?`Added`:`After`,src:y(i,t.path,n.newRev,t.hash)}),!s.length)return;let c=s.map(e=>e.src).join(` `),l=_.get(t.key);return(!l||l.sig!==c)&&(l={sig:c,meta:{preview:{kind:r,name:t.path,sides:s}}},_.set(t.key,l)),{lineNumber:0,metadata:l.meta}},x=t=>{hG(e,{key:t,side:`additions`,start:0,end:0})},S=(t,n)=>{if(!t)return;let r=t.endSide!=null&&t.endSide!==t.side;hG(e,{key:n,side:t.side||`additions`,start:Math.min(t.start,r?t.start:t.end),end:Math.max(t.start,r?t.start:t.end)})},C={theme:{dark:`pierre-dark`,light:`pierre-light`},themeType:at(),diffStyle:ce()?`unified`:`split`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},enableLineSelection:!0,layout:{paddingTop:0,paddingBottom:24,gap:12},unsafeCSS:` @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } [data-column-number], [data-gutter-utility-slot] { touch-action: none !important; } }`+SS,async loadDiffFiles(t){let n=i.get(t),r=(e.as||[]).find(e=>e.id===n?.repo);if(!n||!r)throw Error(`unknown file`);let[o,s]=await Promise.all([t.type===`new`?Promise.resolve(``):a(n.worktree,t.prevName||n.path,r.oldRev),t.type===`deleted`?Promise.resolve(``):a(n.worktree,n.path,r.newRev)]);if(o==null||s==null)throw vG(e,`${n.path} is too large to expand.`),Error(`diff contents unavailable`);if(t.type!==`new`&&!wx(t,`deletions`,o)||t.type!==`deleted`&&!wx(t,`additions`,s))throw vG(e,`${n.path} has changed since this diff was taken — refresh to expand it.`),Error(`diff contents out of date`);return{oldFile:{name:t.prevName||t.name,contents:o},newFile:{name:t.name,contents:s}}},renderCustomHeader(t,n){let r=n.item,i=e.e2(r.id),a=document.createElement(`div`);a.className=`_gN${r.collapsed?` _gO`:``}`;let c=i?.label??r.id;a.title=c;let l=document.createElement(`span`);l.className=`_gP`,l.textContent=`▾`;let u=document.createElement(`span`);u.className=`__`;let d=i?.status||(r.type===`diff`?r.fileDiff.type[0].toUpperCase():`M`);u.dataset.status=d,u.textContent=d;let f=document.createElement(`span`);f.className=`_gQ`;let p=document.createElement(`bdi`);if(p.textContent=c,f.append(p),a.append(l,u,f),i?.changedSince){let e=document.createElement(`span`);e.className=`_A _gU`,e.title=`Changed since your last visit`,a.append(e)}let m=i&&e.d3.get(i.label)?.length||0;if(r.type===`file`){let t=document.createElement(`button`);t.type=`button`,t.className=WS,t.textContent=m?`✎ ${m}`:`✎`,t.title=m?`${m} comment${m>1?`s`:``} — add another`:`Comment on this file`,t.setAttribute(`aria-label`,`Comment on this file`),t.onclick=t=>{t.stopPropagation();let n=new Set(e.bk);n.delete(r.id)&&MG(e,n),x(r.id)},a.append(t)}else if(m){let e=document.createElement(`span`);e.className=`_u`,e.textContent=`✎ ${m}`,a.append(e)}if(i&&(i.additions||i.deletions)){let e=document.createElement(`span`);e.className=`_gR`;let t=document.createElement(`span`);t.className=`_gS`,t.textContent=`+${i.additions||0}`;let n=document.createElement(`span`);n.className=`_gT`,n.textContent=`−${i.deletions||0}`,e.append(t,n),a.append(e)}return a.onclick=()=>{s.key=r.id,s.top=o.viewer?.getTopForItem(r.id)??null;let t=new Set(e.bk);t.delete(r.id)||t.add(r.id),MG(e,t)},a},renderAnnotation(t,i){let a=t.metadata||{},o=i.item.id;if(a.preview){let e=v.get(a);return e||v.set(a,e=oS(a.preview)),e}if(a.draft)return d??=tS({sessions:n,reveal:r},{onSave:t=>e.e4(o,t),onSend:(t,n)=>e.ei(o,t,n),onCancel:()=>{hG(e,null)}});let s=a.comment;if(!s)return;let c=i.item.type===`diff`?i.item.fileDiff:null,l=s.snippet!=null&&!!c&&fH(Ex(c,s.side,s.line_start,s.line_end))!==fH(s.snippet);return eS(s,{sessions:n,reveal:r},{onDelete:t=>e.e7(t),onEdit:(t,n)=>e.e8(t,n),onSend:(t,n)=>e.eh(t,n),drifted:l})},onLineSelectionEnd(e,t){t.item.type===`file`?x(t.item.id):S(e,t.item.id)},onPostRender(e,t,n,r){let i=e;if(n===`unmount`){w.get(i)?.(),w.delete(i);return}w.has(i)?PS(i):w.set(i,NS(i,r.item.id))}},w=new Map,T=new ex(C,Hx());o.viewer=T,T.setup(e.a1);let E=De(e=>{C.themeType=e,T.setOptions({...C})});fe()&&Gx(()=>e.a1,t.signal),e.bt.scrollToItem=t=>{D.recs.has(t)&&(e.c1=null,T.scrollTo({type:`item`,id:t,align:`start`,behavior:`instant`}))},e.bt.scrollToLine=(e,t,n)=>T.scrollTo({type:`line`,id:e,lineNumber:t,side:n||`additions`,align:`center`,behavior:`instant`}),e.bt.clearSelection=()=>T.clearSelectedLines();let D={abort:t,viewer:T,unregTheme:E,unsubScroll:T.subscribeToScroll(t=>{e.bx||=requestAnimationFrame(()=>{e.bx=0;let n=null;for(let r of T.getRenderedItems()){let i=T.getTopForItem(r.id);i==null||i>t+1||(!n||i>(T.getTopForItem(n.key)??-1))&&(n={scope:e.b5,key:r.id,off:Math.round(t-i)})}t>0&&(e.bv=n);let r=n?.key??T.getRenderedItems()[0]?.id,i=r&&e.e2(r)?.repo;i&&i!==e.bl&&PG(e,i)})}),hostUnregs:w,loaded:!1,wasActive:!1,lastNonce:e.aq||0,lastFileNonce:e.ar||0,recs:new Map,order:``,revealedDraft:null,dockedOpen:!1,start:()=>{this.active&&!D.loaded&&(D.loaded=!0,this.load())},pin:t=>{let n=e.a1,r=Date.now(),i=!1,a=()=>{i=!0};for(let e of[`wheel`,`touchstart`,`keydown`])n.addEventListener(e,a,{once:!0,passive:!0});let o=()=>{if(i||!D.recs.has(t.key))return;let e=D.viewer.getTopForItem(t.key);if(e!=null){let n=e+t.off;Math.abs(D.viewer.getScrollTop()-n)>1&&D.viewer.scrollTo({type:`position`,position:n,behavior:`instant`})}Date.now()-r<1500&&requestAnimationFrame(o)};o()},sync:()=>{let t=[],n=new Set,r=!1;for(let a of this.shownFiles){n.add(a.key);let o=D.recs.get(a.key),s=o&&o.patch===a.patch&&o.status===a.status?o.fileDiff:bx(a,a.key),c=this.commentsByFile.get(a.label)||[],l=s?void 0:b(a,(this.repos||[]).find(e=>e.id===a.repo)),u=g(c,this.draft,a.key)+(l?`|p${_.get(a.key).sig}`:``),d=s?void 0:h(a.key,c,this.draft,l),f=this.collapsedFiles.has(a.key);s&&i.set(s,{worktree:e.dz(a.repo),path:a.path,repo:a.repo});let p={name:a.path,contents:l?` `:a.binary?`(binary file)`:a.tooLarge?`(file too large to display)`:`(file could not be read)`},v=o;!v||v.item.type===`diff`!=!!s?(v={item:s?{id:a.key,type:`diff`,fileDiff:s,annotations:m(a.key,c,this.draft),collapsed:f,version:(v?.item.version??0)+1}:{id:a.key,type:`file`,file:p,annotations:d,collapsed:f,version:(v?.item.version??0)+1},fileDiff:s,annSig:u,collapsed:f,patch:a.patch,status:a.status},D.recs.set(a.key,v),r=!0):(v.fileDiff!==s||v.annSig!==u||v.collapsed!==f)&&(v.item.type===`diff`&&s?(v.item.fileDiff=s,v.item.annotations=m(a.key,c,this.draft)):v.item.type===`file`&&(v.item.file.contents!==p.contents&&(v.item.file=p),v.item.annotations=d),v.item.collapsed=f,v.item.version=(v.item.version??0)+1,v.fileDiff=s,v.annSig=u,v.collapsed=f,v.patch=a.patch,v.status=a.status,r||D.viewer.updateItem(v.item)),t.push(v.item)}for(let e of[...D.recs.keys()])n.has(e)||D.recs.delete(e);let a=t.map(e=>e.id).join(`
2801
+ `);if((r||a!==D.order)&&(D.order=a,D.viewer.setItems(t)),s.key){let{key:e,top:t}=s;s.key=null,t!=null&&t<D.viewer.getScrollTop()&&D.viewer.scrollTo({type:`item`,id:e,align:`start`,behavior:`instant`})}let o=this.draft;o&&o!==D.revealedDraft&&D.recs.has(o.key)&&(D.revealedDraft=o,D.viewer.scrollTo({type:`line`,id:o.key,lineNumber:o.end,side:o.side===`deletions`?`deletions`:`additions`,align:`nearest`,offset:180,behavior:`smooth-auto`}));let c=e.bz;c&&D.recs.has(c.key)&&(e.bz=null,D.pin(c)),e.c1&&D.recs.has(e.c1)&&e.bt.scrollToItem(e.c1)}};return D.wasActive=!!this.active,this.findOpen&&(D.dockedOpen=!0,e.er(!0)),Ce().addEventListener(`review.changed`,t=>{D.loaded&&t.data?.workspaceId===e.a6&&e.cf()},{signal:t.signal}),Ce().addEventListener(`status.changed`,t=>{if(!this.active||!D.loaded||e.az)return;let n=t.data,r=n&&n[e.a6];if(!r)return;let i=vx(r);i&&e.bp&&i!==e.bp&&e.ce()},{signal:t.signal}),window.addEventListener(`pagehide`,()=>{this.active&&D.loaded&&(e.cl(),e.c4())},{signal:t.signal}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&this.active&&D.loaded&&e.c4()},{signal:t.signal}),D.start(),D},onUpdate:function(){this.start(),this.active&&this.loaded&&!this.wasActive&&e.cd(),!this.active&&this.loaded&&this.wasActive&&(e.cl(),e.c4()),this.wasActive=!!this.active,!!this.findOpen!==this.dockedOpen&&(this.dockedOpen=!!this.findOpen,e.er(this.dockedOpen));let t=e.aq||0;this.loaded&&e.ag&&t!==this.lastNonce&&e.c6(e.ag),this.lastNonce=t;let n=e.ar||0;this.loaded&&e.ah&&n!==this.lastFileNonce?(e.c5(e.ah),this.lastFileNonce=n):this.loaded&&(this.lastFileNonce=n),e.a7&&e.a7!==e.b5&&e.cg(e.a7,!1),e.a8!==void 0&&(e.a8??null)!==e.b6&&e.ch(e.a8??null),this.draft||this.viewer.clearSelectedLines(),this.sync()},onDestroy:function(){e.bq&&clearTimeout(e.bq),this.loaded&&(e.cl(),e.c4()),this.abort.abort(),this.unsubScroll(),this.unregTheme();for(let e of this.hostUnregs.values())e();this.viewer.cleanUp()}})),$=F(198,HU,43),UU=H(174,$),WU=F(173,e=>UU(e,_q(e)),5),GU=H(188,$),KU=F(184,e=>GU(e,vq(e)),5),qU=H(170,e=>{WU(e),KU(e)}),JU=St(24,dt,(e=>`/${e}&`)(we),XH,QH),YU=(e,t)=>{vz(e.a2,t),PV(e.a3,t),WK(e,t.size)},XU=H(172,e=>{WU(e),KU(e),$(e)}),ZU=H(171,e=>XU(e,bq(e))),QU=(e,t)=>eT(e.t,t),$U=H(155,L(kU)),eW=(e,t)=>{tq(e,t?.additions),nq(e,t?.deletions)},tW=(e,t)=>{lz(e.a2,t),WV(e.a3,t),qK(e,t?.length),JK(e,t?.[0]?.id),$U(e,new Map(t.map(e=>[e.id,e]))),eW(e,(()=>{let e=0,n=0;for(let r of t)e+=r.additions,n+=r.deletions;return{additions:e,deletions:n}})())},nW=F(132,e=>tW(e,(()=>{let t=new Map;for(let n of e.co)t.set(n.worktree,(t.get(n.worktree)||0)+1);return e.co.map(n=>{let r=e.cx.filter(e=>e.repo===n.id),i=0,a=0;for(let e of r)i+=e.additions||0,a+=e.deletions||0;return{id:n.id,repo:n,compare:vS({base:n.pr?.baseRefName||n.base,head:n.pr?.headRefName||n.branch,defaultBranch:n.default_branch},e.al||``,e.am||``),label:n.pr&&(t.get(n.worktree)||0)>1?`${n.worktree} #${n.pr.number}`:n.worktree,files:r,additions:i,deletions:a,total:n.files.length}}).filter(e=>e.files.length||!e.total&&e.repo.pr)})()),3),rW=H(159,e=>{eq(e,e.dp?.length),$(e)}),iW=F(157,e=>rW(e,e.cx.filter(t=>!e.dm.has(t.repo)))),aW=(e,t)=>{xz(e.a2,t),eH(e.a3,t)},oW=F(133,e=>aW(e,xq(e)),3),sW=H(131,e=>{UK(e,e.cx?.length),nW(e),iW(e),oW(e)}),cW=F(130,e=>sW(e,e.cv?e.cu.filter(t=>e.cv.has(t.key)||t.key===e.bj):e.cu),2),lW=H(128,e=>{QU(e,e.cu.map(e=>({...e,fileDiff:bx(e,e.key)}))),cW(e)}),uW=F(125,e=>lW(e,(()=>{let t=Ux(e.b1);return e.cq.filter(n=>t(n.label)&&(!e.b4||n.changedSince))})()),2),dW=(e,t)=>MV(e.a3,t),fW=(e,t)=>{_z(e.a2,t),dW(e,new Set(t.keys()))},pW=F(138,e=>fW(e,new Map(e.cq.flatMap(t=>{let n=e.d3.get(t.label)?.length;return n?[[t.key,n]]:[]})))),mW=H(124,e=>{VK(e,e.cq?.length),YU(e,new Set(e.cq.filter(e=>e.changedSince).map(e=>e.key))),ZU(e,new Map(e.cq.map(e=>[e.key,e]))),uW(e),pW(e)}),hW=F(168,e=>z(e.o,`title`,`${e.de}\n${e.dx}`)),gW=H(167,hW),_W=F(123,e=>gW(e,e.co.filter(e=>e.files.length||e.pr).map(t=>{let n=_S(t.pr?.baseRefName||t.base,t.pr?.headRefName||t.branch,e.al||``,e.am||``);return`${t.worktree}: ${n.title}`}).join(`
2802
+ `)),2),vW=H(122,e=>{mW(e,e.co.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.id}/${t.path}`,label:`${e.worktree}/${t.path}`})))),nW(e),_W(e)}),yW=H(148,hW),bW=F(146,e=>yW(e,e.b6?e.db.find(t=>t.sha===e.b6)?.label??uS(e.b6,7):{committed:`Committed`,working:`Working tree`,dirty:`Uncommitted`}[e.b5]),2),xW=H(145,e=>{KK(e,e.db?.length),bW(e),EH(e)}),SW=F(121,e=>{vW(e,e.b6?e.cm.filter(e=>e.rev):e.cm),xW(e,(()=>{let t=new Set,n=[];for(let r of e.cm)for(let e of r.commits||[])t.has(e.sha)||(t.add(e.sha),n.push({sha:e.sha,label:`${r.worktree}#${uS(e.sha,7)} ${e.subject}`}));return e.b6&&!t.has(e.b6)&&n.unshift({sha:e.b6,label:uS(e.b6,7)}),n})())}),CW=H(120,e=>{VU(e,new Set(e.cm.filter(e=>!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)).map(e=>e.id))),qU(e,yq(e)),JU(e,[e.cm.filter(e=>e.baseMissing),`id`]),SW(e),GH(e)}),wW=H(102,$),TW=F(94,e=>wW(e,Sq(e)),2),EW=L(xU),DW=H(111,e=>{$(e),EW(e)}),OW=F(107,e=>DW(e,Cq(e))),kW=H(112,$),AW=F(110,e=>kW(e,wq(e)),4),jW=F(118,e=>Rt(e,`q`,e.b6?`rev:${e.b6}`:e.b5,Tq(e)),2),MW=H(117,jW),NW=F(116,e=>MW(e,t=>{if(t.startsWith(`rev:`)){e.ch(t.slice(4));return}let n=t;if(e.b6&&(lK(e,null),e.ak?.(null),n===e.b5)){e.c8(e.b5);return}e.cg(n)}),5),PW=H(114,e=>{NW(e),$(e)}),FW=F(108,e=>PW(e,Eq(e)),2),IW=H(115,e=>{NW(e),$(e)}),LW=F(109,e=>IW(e,Dq(e)),3),RW=H(106,e=>{OW(e),AW(e),FW(e),LW(e),NW(e),$(e)}),zW=F(105,e=>RW(e,Oq(e)),10),BW=H(104,e=>{zW(e),$(e)}),VW=F(98,e=>BW(e,kq(e)),2),HW=H(119,$),UW=F(55,e=>HW(e,Aq(e))),WW=N(9,(e=>`<button>${e}</button>`)(c),(e=>` D/${e}&l`)(E),BH),GW=N(12,(e=>`<button><span aria-hidden=true>${e}<span> </span></span></button>`)(ew),(e=>` D D/${e}& D n`)(tw),LH),KW=N(21,(e=>`<button title="Find in review (⌘/Ctrl+F)" aria-label="Find in review">${e}</button>`)(et),(e=>` D/${e}&l`)(v),PH),qW=F(144,e=>KW(e,e.d9&&!e.bb?0:1)),JW=H(143,e=>{WW(e,+!e.d9),GW(e,+!e.d9),qW(e)}),YW=F(127,e=>JW(e,!e.as||e.cs>0)),XW=H(185,IU),ZW=H(186,LU),QW=H(187,$),$W=F(183,e=>{XW(e,jq(e)),ZW(e,Mq(e)),QW(e,Nq(e))}),eG=H(182,e=>{$W(e),KU(e)}),tG=F(181,e=>eG(e,Pq(e)),4),nG=N(25,`<div aria-hidden=true></div>`,` `,SH),rG=F(62,e=>nG(e,!e.as&&e.az?0:1)),iG=N(26,`<p> </p>`,` D `,UH,`<p> </p>`,` D `,dU,`<div><span>Every section is folded (<!> of <!>).</span><button>Show all</button></div>`,` Eb%c%l `,AH),aG=F(161,e=>iG(e,e.as&&!e.cs?0:e.as&&!e.d0&&!e.bi?1:e.as&&!e.dq?2:3),4),oG=I(`A52`,e=>{if(e.as){let t=new Set(e.as.map(e=>e.id)),n=[...e.bm].filter(e=>t.has(e)).sort(),r=me(e.a6);(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&xe(e.a6,n)}}),sG=F(85,oG,2),cG=Dt(54,e=>{CW(e,e.as||[]),TW(e),VW(e),UW(e),YW(e),tG(e),rG(e),aG(e),sG(e),$(e)}),lG=H(137,e=>{pW(e),$(e)}),uG=H(177,$),dG=F(176,e=>uG(e,Fq(e))),fG=H(178,$),pG=F(57,e=>fG(e,Iq(e))),mG=Dt(56,e=>{XG(e,e.au?.length),lG(e,(()=>{let t=new Map;for(let n of e.au){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),WU(e),dG(e),pG(e),tG(e),$W(e)}),hG=Dt(59,e=>{WU(e),KU(e),$(e)}),gG=N(23,dt,(e=>`/${e}&`)(we),gU),_G=L(mU),vG=Dt(60,e=>{gG(e,+!e.ay),_G(e)}),yG=L(bU),bG=Dt(61,e=>{z(e.k,`disabled`,e.az),je(e.l,e.az&&`_F`),z(e.o,`disabled`,e.az),z(e.q,`disabled`,e.az),AW(e),rG(e),$(e),yG(e)}),xG=(e,t)=>{KR(e.a2,t),AV(e.a3,t)},SG=L(eU),CG=Dt(66,e=>{zW(e),uW(e),fU(e),SG(e)}),wG=Dt(69,e=>{mz(e.a2,e.b7),RH(e)}),TG=Dt(70,e=>TV(e.a3,e.b8)),EG=I(`A56`,e=>{e.bb&&!e.b9&&dK(e,!0)}),DG=F(74,EG),OG=H(73,e=>{sT(e.t,e.bb),lT(e.t,!e.bb),DG(e),qW(e)}),kG=H(129,cW),AG=e=>{kG(e,e.bg.trim()?new Set(e.bh):null)},jG=Dt(77,e=>{SK(e,e.bf?.query),CK(e,e.bf?.keys),wK(e,e.bf?.hit),AG(e)}),MG=Dt(82,$),NG=F(154,e=>bz(e.a2,e.bl??e.dj)),PG=Dt(83,e=>{NG(e),$(e)}),FG=(e,t)=>{EK(e,t.sig),DK(e,t.timer)},IG=(e,t)=>OK(e,t.seq),LG=(e,t)=>Bw(e.t,function(e){t(e)}),RG=H(103,e=>{yz(e.a2,Rq(e)),zW(e),$(e)}),zG=F(100,e=>RG(e,zq(e)),4),BG=H(91,e=>{LG(e,t=>{if(jG(e,t),!t.hit)return;let n=t.hit;setTimeout(()=>{n.line<1?e.bt.scrollToItem(n.key):e.bt.scrollToLine(n.key,n.line,n.side)},0)}),zG(e),VW(e),$(e)}),VG=(e,t)=>{kK(e,t.anchor),AK(e,t.raf)},HG=(e,t)=>{MK(e,t.pos),NK(e,t.jump)},UG=H(166),WG=H(169,e=>{WU(e),KU(e),$(e)}),GG=(e,t)=>rq(e,t.busy),KG=(e,t)=>{uq(e,t.home),dq(e,t.raf)},qG=I(`A54`,e=>{M(e.k,`click`,function(){e.cd()}),M(e.o,`click`,function(){let t=e.q;typeof t.showPicker==`function`?t.showPicker():t.focus()}),Mt(e,`q`)});function JG(e){kt(e,19,sq),R(e.a,`_gl`),R(e.b,`_gq`),R(e.c,`_gX`),R(e.d,`_gr`),R(e.e,`_gy`),R(e.g,US),R(e.i,[`_gp`,`_gW`]),R(e.k,[_,`_gn`]),Ye(e.l),st(e.l,14),R(e.n,`_gz`),Me(e.p),Oe(e.p,14),ct(e.p),R(e.q,`_gA`),Qw(e.t),Dw(e.t,Kq(e)),Fw(e.t),Iw(e.t),zw(e.t),R(e.w,`_gL`),R(e.a1,`_gM`),$R(e.a2),Cz(e.a2,Ue({content:vH(e)})),ZV(e.a3),tH(e.a3,Ue({content:hH(e)})),EV(e.a3,Gq(e)),yt(e,BU(e)),cG(e,null),mG(e,[]),hG(e,null),vG(e,null),bG(e,!1),xG(e,Lq(e)),CG(e,!1),wG(e,t()),TG(e,!1),OG(e,!ce()),jG(e,{query:``,hit:null,keys:[]}),MG(e,new Set),PG(e,null),FG(e,{sig:``,timer:0}),IG(e,{seq:0}),BG(e,{scrollToItem:Hq,scrollToLine:Vq,clearSelection:Bq}),VG(e,{anchor:null,raf:0}),HG(e,{pos:null,jump:null}),UG(e,Uq(e)),WG(e,Wq),GG(e,{busy:0}),KG(e,{home:null,raf:0}),qG(e)}var YG=N(7,(e=>`<span>${e}</span>`)(XS),(e=>` D/${e}&l`)(ZS),PU),XG=H(58,e=>{YG(e,+!e.aw),FU(e)}),ZG=I(`A53`,e=>{e.b1!==ge(e.a6)&&Re(e.a6,e.b1)}),QG=F(64,ZG),$G=Dt(63,e=>{GR(e.a2,e.b1),kV(e.a3,e.b1),uW(e),QG(e),uU(e)}),eK=H(156,e=>{uz(e.a2,e.dm),GV(e.a3,e.dm),$K(e,e.dm?.size),iW(e)}),tK=F(151,e=>eK(e,e.dg>1?e.bm:dH)),nK=Dt(84,e=>{zG(e),tK(e),oW(e),sG(e)}),rK=H(113,$),iK=H(175,e=>{dG(e),tG(e)}),aK=H(32,e=>{JV(e.a3,e.a6),$G(e,ge(e.a6)),nK(e,new Set(me(e.a6))),rK(e,qq(e)),iK(e,Jq(e)),TW(e),zW(e),UW(e),WU(e),pG(e),KU(e),QG(e),sG(e),$(e),RU(e)}),oK=L(KH),sK=Dt(67,e=>{YV(e.a3,e.b5),zW(e),OW(e),AW(e),FW(e),LW(e),NW(e),bW(e),jW(e),$(e),oK(e),HH(e)}),cK=H(33,e=>{sK(e,e.a7??te()),$(e)}),lK=Dt(68,e=>{R(e.o,[_,`_gn`,{_gm:!!e.b6}]),zW(e),LW(e),NW(e),SW(e),bW(e),jW(e),$(e),WH(e)}),uK=H(34,e=>{lK(e,e.a8??null),$(e)}),dK=Ct(71,e=>{R(e.s,[`_gx`,{_gw:!e.b9}]),Ew(e.t,e.b9),DG(e),$(e),MH(e)}),fK=F(37,e=>dK(e,e.a9,e.aa)),pK=H(35,fK),mK=H(36,fK),hK=I(`A55`,e=>{e.ai&&window.addEventListener(`keydown`,t=>{!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||(t.preventDefault(),e.ej()))},{capture:!0,signal:It(e,0)})}),gK=F(190,e=>{Lt(e,0),hK(e)}),_K=H(189,gK),vK=Ct(75,e=>{cT(e.t,e.bd),_K(e,Yq(e))}),yK=F(40,e=>vK(e,e.ac,e.ad)),bK=H(38,yK),xK=H(39,yK),SK=H(78,pU),CK=H(79),wK=H(80,e=>{TK(e,e.bi?.key),aG(e)}),TK=H(81,cW),EK=H(87,e=>{zW(e),$(e)}),DK=H(88,e=>{AW(e),$(e)}),OK=H(90,zW),kK=H(93,e=>{TW(e),$(e)}),AK=H(95,$),jK=H(101,zW),MK=H(97,e=>{jK(e,Xq(e)),zG(e),VW(e),oW(e),$(e)}),NK=H(99,e=>{zG(e),oW(e),$(e)}),PK=H(41,zG),FK=H(42,e=>{zW(e),$(e)}),IK=H(43,e=>{zW(e),$(e)}),LK=H(44,e=>{AW(e),gK(e),$(e)}),RK=H(45,FW),zK=H(46,e=>{LW(e),NW(e)}),BK=L(rU),VK=H(126,e=>{let t;e.cs&&(t=Ue({content:bH(e)})),gz(e.a2,t);let n;e.cs&&(n=Ue({content:yH(e)})),$V(e.a3,n),YW(e),aG(e),BK(e)}),HK=L(iU),UK=H(134,e=>{aG(e),HK(e)}),WK=H(136,L(aU)),GK=N(17,`<optgroup label=Commits></optgroup>`,` `,DH),KK=(e,t)=>GK(e,+!t),qK=H(150,e=>{tK(e),OH(e)}),JK=H(153,NG),YK=L(_U),XK=H(47,e=>{nW(e),_W(e),YK(e)}),ZK=L(yU),QK=H(48,e=>{nW(e),_W(e),ZK(e)}),$K=H(158,jH),eq=H(160,e=>{aG(e),FH(e)}),tq=H(163,L(oU)),nq=H(164,L(sU)),rq=H(180,tG),iq=H(49,tG),aq=N(5,(e=>`<a title="Back to terminal (⌘/Ctrl+Shift+D)">${e}</a>`)(O),(e=>` D/${e}&l`)(e),zU),oq=(e,t)=>aq(e,+!t),sq=wt(`A40`,H(192)),cq=H(197,$),lq=F(196,e=>cq(e,Zq(e))),uq=H(194,lq),dq=H(195,lq),fq=H(51,e=>{$(e),NU(e)}),pq=H(52,$),mq=H(53,$),hq=e=>function(){CG(e._,!e._.b4)},gq=e=>function(){vG(e._,null)},_q=e=>async(t,n)=>{let r=e.ax,i=e.e2(t);if(hG(e,null),r&&i)try{let t=await re(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:e.dz(i.repo),path:i.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim(),...e.e0(i,r)})});mG(e,e.au.some(e=>e.id===t.id)?e.au:e.au.concat(t))}catch(t){vG(e,String(t.message||t))}},vq=e=>(t,n,r)=>{let i=e.ax,a=e.e2(t),o=n.trim();if(!i||!a||!o)return Promise.resolve(!1);let s={id:-1,workspace_id:e.a6,worktree:e.dz(a.repo),path:a.path,side:i.side===`deletions`?`deletions`:`additions`,line_start:i.start,line_end:i.end,text:o,created_at:``,...e.e0(a,i)};return e.ec([s],{session:r},[])},yq=e=>(t,n)=>{let r=e.cm.find(e=>e.id===t.repo),i=bx(t,t.key),a=n.side===`deletions`?`deletions`:`additions`;return{head:r?.head,snippet:i?Ex(i,a,n.start,n.end):void 0}},bq=e=>t=>e.e1.get(t),xq=e=>t=>{let n=new Set(e.bm),r=!n.delete(t);r&&n.add(t);let i=e.cx.filter(e=>!n.has(e.repo)),a=i.findIndex(e=>e.repo===t),o=e.cx.findIndex(e=>e.repo===t),s=r?e.cx.slice(Math.max(o,0)).find(e=>!n.has(e.repo))??i[i.length-1]:i[a];nK(e,n),PG(e,t),s&&(e.bz=null,e.c1=s.key)},Sq=e=>()=>{e.as&&Ze(e.a6,e.bv)},Cq=e=>()=>e.c8(e.b5,!0),wq=e=>()=>{e.bq&&clearTimeout(e.bq),e.bq=setTimeout(()=>{e.bq=0,e.ai&&!e.az&&e.c8(e.b5,!0)},400)},Tq=e=>function(t){e.cj(t)},Eq=e=>(t,n=!0)=>{t!==e.b5&&(sK(e,t),n&&it(t),e.aj?.(t),e.c8(t))},Dq=e=>t=>{t!==e.b6&&(lK(e,t),e.ak?.(t),e.c8(e.b5))},Oq=e=>async(t=e.b5,n=!1)=>{let r=++e.bs;bG(e,!0),vG(e,null);try{let i=new URLSearchParams;t!==`committed`&&i.set(`scope`,t),n&&i.set(`refresh`,`1`),e.b6&&i.set(`rev`,e.b6);let a=await re(`/api/workspaces/${e.a6}/diff?${i}`);if(r!==e.bs)return;let o=a.sections,s=a;if(cG(e,o),e.b4&&!o.some(e=>e.files.some(e=>e.changedSince))&&CG(e,!1),mG(e,s.comments||[]),e.bp=_x(o),e.ag&&e.c6(e.ag),e.ah)e.c5(e.ah);else if(!e.ag&&!n&&e.bs===1){let n=ve(e.a6);n&&n.scope===t&&e.c3(n)}}catch(t){if(r!==e.bs)return;vG(e,String(t.message||t))}finally{r===e.bs&&bG(e,!1)}},kq=e=>t=>{let n=(e.as||[]).find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),r=n?.files[0];n&&r&&(e.bz=null,e.bt.scrollToItem(`${n.id}/${r.path}`))},Aq=e=>()=>{if(!e.as)return;let t={},n={};for(let r of e.as){t[r.id]=r.head;for(let e of r.files)e.hash&&(n[`${r.worktree}/${e.path}`]=e.hash)}fetch(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`seen`,heads:t,dirty:n}),keepalive:!0}).catch(()=>{})},jq=e=>()=>e.ec(e.au,{clipboard:!0},`all`),Mq=e=>t=>e.ec(e.au,{session:t},`all`),Nq=e=>(t,n)=>{let r=e.au.find(e=>e.id===t);return r?e.ec([r],{session:n},[t]):Promise.resolve(!1)},Pq=e=>async(t,n,r)=>{if(!t.length)return!0;e.ea++;try{let i=sS(t,e.as);if(`clipboard`in n){if(!await o(i))return vG(e,`Copy failed: the clipboard needs HTTPS in this browser.`),!1}else await re(`/api/sessions/${n.session}/send`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:`Please address this review feedback, then summarize what you changed.\n\n${i}`,...Te()||{}})}),e.an?.(n.session);if(hG(e,null),r===`all`)mG(e,[]);else{let t=new Set(r);mG(e,e.au.filter(e=>!t.has(e.id)))}return(r===`all`||r.length)&&await e.e5(r).catch(()=>{}),!0}catch(t){return vG(e,String(t.message||t)),!1}finally{e.ea--}},Fq=e=>async t=>{mG(e,e.au.filter(e=>e.id!==t)),await e.e5([t]).catch(()=>{})},Iq=e=>async(t,n)=>{let r=e.au.find(e=>e.id===t);if(!r)return;let i=n.trim();if(i&&i!==r.text){mG(e,e.au.map(e=>e.id===t?{...e,text:i}:e));try{await re(`/api/workspaces/${e.a6}/review/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({text:i})})}catch(n){throw mG(e,e.au.map(e=>e.id===t?r:e)),vG(e,String(n.message||n)),n}}},Lq=e=>t=>{$G(e,t)},Rq=e=>function(t){e.c5(t)},zq=e=>t=>{let n=t.slice(0,t.indexOf(`/`));if(e.bm.has(n)){let t=new Set(e.bm);t.delete(n),nK(e,t)}e.bz=null,e.c1=t,e.af?.(t),e.bt.scrollToItem(t)};function Bq(){}function Vq(e,t,n){}function Hq(e){}var Uq=e=>()=>{$G(e,``),CG(e,!1),jG(e,{query:``,hit:null,keys:[]})};function Wq(e){return e.includes(`#`)?e.split(`#`)[0]:e}var Gq=e=>t=>{TG(e,t)},Kq=e=>t=>{dK(e,t)},qq=e=>async()=>{try{mG(e,(await re(`/api/workspaces/${e.a6}/review`)).comments||[])}catch{}},Jq=e=>t=>t===`all`?fetch(`/api/workspaces/${e.a6}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})}):Promise.all(t.map(t=>fetch(`/api/workspaces/${e.a6}/review/${t}`,{method:`DELETE`}))),Yq=e=>()=>{dK(e,!0),vK(e,+e.bd+1),BU(e)()},Xq=e=>t=>{e.bz=t},Zq=e=>t=>{if(!ce())return;let n=e.s;if(e.eo??=n.parentElement,cancelAnimationFrame(e.ep),!t){e.eo&&n.parentElement!==e.eo&&e.eo.append(n);return}let r=0,i=()=>{let t=document.getElementById(`review-find-host`);t?n.parentElement!==t&&(t.append(n),requestAnimationFrame(()=>setTimeout(BU(e),0))):r++<20&&(e.ep=requestAnimationFrame(i))};i()};U(`A33`,hq),U(`A32`,gq),U(`A21`,_q),U(`A29`,vq),U(`A19`,yq),U(`A20`,bq),U(`A16`,xq),U(`A6`,Sq),U(`A10`,Cq),U(`A11`,wq),U(`A0`,Tq),U(`A13`,Eq),U(`A14`,Dq),U(`A9`,Oq),U(`A8`,kq),U(`A15`,Aq),U(`A26`,jq),U(`A27`,Mq),U(`A28`,Nq),U(`A25`,Pq),U(`A23`,Fq),U(`A24`,Iq),U(`A1`,Lq),U(`A34`,Rq),U(`A7`,zq),U(`A4`,Bq),U(`A3`,Vq),U(`A2`,Hq),U(`A17`,Uq),U(`A18`,Wq),U(`A35`,Gq),U(`A31`,Kq),U(`A12`,qq),U(`A22`,Jq),U(`A30`,Yq),U(`A5`,Xq),U(`A36`,Zq);export{LK as $input_active,pK as $input_findOpen,mK as $input_findOpenChange,bK as $input_findTick,xK as $input_findTickChange,IK as $input_focusFile,mq as $input_focusFileNonce,pq as $input_focusNonce,FK as $input_focusPr,oq as $input_onExit,PK as $input_onFileChange,zK as $input_onRevChange,RK as $input_onScopeChange,iq as $input_onSent,uK as $input_rev,cK as $input_scope,fq as $input_sessions,XK as $input_workspaceBranch,aK as $input_workspaceId,QK as $input_workspaceName,JG as $setup,lH as $template,uH as $walks};