@bryanhu/codexly 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (724) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/README.en.md +3 -2
  3. package/README.md +3 -2
  4. package/dist/{chunk-BXOL6SUO.js → chunk-7G5JKKJQ.js} +1 -1
  5. package/dist/chunk-C64TCOGX.js +26 -0
  6. package/dist/{chunk-PZZN5FBZ.js → chunk-DW7IKH5A.js} +131 -131
  7. package/dist/{chunk-UFZBNM7A.js → chunk-IUMX3J22.js} +8 -8
  8. package/dist/{chunk-5YNWOUR2.js → chunk-LRH4LRGC.js} +1 -1
  9. package/dist/{chunk-VBTBWY72.js → chunk-LZBJFLMK.js} +3 -3
  10. package/dist/{chunk-Q2VQAUSH.js → chunk-QE3SPWGR.js} +2 -2
  11. package/dist/{chunk-UR6FEWGU.js → chunk-RVNRCEGR.js} +27 -27
  12. package/dist/chunk-W4XMPSQ6.js +3 -0
  13. package/dist/cli.js +6 -6
  14. package/dist/client/index.js +2 -2
  15. package/dist/command-JURPOVRJ.js +88 -0
  16. package/dist/core/index.js +1 -1
  17. package/dist/protocol/index.js +1 -1
  18. package/dist/providers/claude/index.js +1 -1
  19. package/dist/providers/codex/index.js +1 -1
  20. package/dist/server/index.js +1 -1
  21. package/dist/sqlite-state-worker.js +24 -19
  22. package/dist/token-usage-response-FRCIPFC4.js +1 -0
  23. package/dist/web/.vite/manifest.json +614 -520
  24. package/dist/web/.vite/manifest.json.br +0 -0
  25. package/dist/web/.vite/manifest.json.gz +0 -0
  26. package/dist/web/assets/{abnfDiagram-N423BO3Z-CEEQQmQS.js → abnfDiagram-N423BO3Z-DhOWqv-9.js} +1 -1
  27. package/dist/web/assets/abnfDiagram-N423BO3Z-DhOWqv-9.js.br +0 -0
  28. package/dist/web/assets/abnfDiagram-N423BO3Z-DhOWqv-9.js.gz +0 -0
  29. package/dist/web/assets/activity-BLmbhAyP.js +1 -0
  30. package/dist/web/assets/activity-BLmbhAyP.js.br +0 -0
  31. package/dist/web/assets/activity-BLmbhAyP.js.gz +0 -0
  32. package/dist/web/assets/agent-settings-panel-BtT_fA4k.js +1 -0
  33. package/dist/web/assets/agent-settings-panel-BtT_fA4k.js.br +0 -0
  34. package/dist/web/assets/agent-settings-panel-BtT_fA4k.js.gz +0 -0
  35. package/dist/web/assets/{api-connection-fields-BibbcpNv.js → api-connection-fields-WueUKMmU.js} +1 -1
  36. package/dist/web/assets/api-connection-fields-WueUKMmU.js.br +0 -0
  37. package/dist/web/assets/api-connection-fields-WueUKMmU.js.gz +0 -0
  38. package/dist/web/assets/app-update-dialog-BVYanXEH.js +1 -0
  39. package/dist/web/assets/app-update-dialog-BVYanXEH.js.br +0 -0
  40. package/dist/web/assets/app-update-dialog-BVYanXEH.js.gz +0 -0
  41. package/dist/web/assets/{architectureDiagram-T3A2C74G-CF2Ovr5z.js → architectureDiagram-T3A2C74G-XaZ7JCUm.js} +1 -1
  42. package/dist/web/assets/architectureDiagram-T3A2C74G-XaZ7JCUm.js.br +0 -0
  43. package/dist/web/assets/architectureDiagram-T3A2C74G-XaZ7JCUm.js.gz +0 -0
  44. package/dist/web/assets/archived-tasks-dialog-DvYO0otZ.js +1 -0
  45. package/dist/web/assets/archived-tasks-dialog-DvYO0otZ.js.br +0 -0
  46. package/dist/web/assets/archived-tasks-dialog-DvYO0otZ.js.gz +0 -0
  47. package/dist/web/assets/arrow-down-DUHHdu_G.js +1 -0
  48. package/dist/web/assets/arrow-down-DUHHdu_G.js.br +0 -0
  49. package/dist/web/assets/arrow-down-DUHHdu_G.js.gz +0 -0
  50. package/dist/web/assets/arrow-up-right-pwN3fEpQ.js +1 -0
  51. package/dist/web/assets/arrow-up-right-pwN3fEpQ.js.br +0 -0
  52. package/dist/web/assets/arrow-up-right-pwN3fEpQ.js.gz +0 -0
  53. package/dist/web/assets/{background-image-picker-BSsADQTT.js → background-image-picker-qLNVDW8q.js} +1 -1
  54. package/dist/web/assets/background-image-picker-qLNVDW8q.js.br +0 -0
  55. package/dist/web/assets/background-image-picker-qLNVDW8q.js.gz +0 -0
  56. package/dist/web/assets/calendar-days-CaEmURf6.js +1 -0
  57. package/dist/web/assets/calendar-days-CaEmURf6.js.br +0 -0
  58. package/dist/web/assets/calendar-days-CaEmURf6.js.gz +0 -0
  59. package/dist/web/assets/chevron-left-Dsg_A5qc.js +1 -0
  60. package/dist/web/assets/chevron-left-Dsg_A5qc.js.br +0 -0
  61. package/dist/web/assets/chevron-left-Dsg_A5qc.js.gz +0 -0
  62. package/dist/web/assets/{chunk-5RXB4S5H-Bu1iYp4t.js → chunk-5RXB4S5H-Bbuu-yH3.js} +1 -1
  63. package/dist/web/assets/chunk-5RXB4S5H-Bbuu-yH3.js.br +0 -0
  64. package/dist/web/assets/{chunk-5RXB4S5H-Bu1iYp4t.js.gz → chunk-5RXB4S5H-Bbuu-yH3.js.gz} +0 -0
  65. package/dist/web/assets/{chunk-6Q2QTUOP-8pETCK89.js → chunk-6Q2QTUOP-BN9DLH6W.js} +1 -1
  66. package/dist/web/assets/chunk-6Q2QTUOP-BN9DLH6W.js.br +0 -0
  67. package/dist/web/assets/chunk-6Q2QTUOP-BN9DLH6W.js.gz +0 -0
  68. package/dist/web/assets/{chunk-GF5L2VYU-Clmi3b75.js → chunk-GF5L2VYU-BMWxsfjW.js} +1 -1
  69. package/dist/web/assets/chunk-GF5L2VYU-BMWxsfjW.js.br +0 -0
  70. package/dist/web/assets/{chunk-GF5L2VYU-Clmi3b75.js.gz → chunk-GF5L2VYU-BMWxsfjW.js.gz} +0 -0
  71. package/dist/web/assets/{chunk-JQJVKLGR-TByUBa_A.js → chunk-JQJVKLGR-CEr3AARA.js} +1 -1
  72. package/dist/web/assets/chunk-JQJVKLGR-CEr3AARA.js.br +0 -0
  73. package/dist/web/assets/{chunk-JQJVKLGR-TByUBa_A.js.gz → chunk-JQJVKLGR-CEr3AARA.js.gz} +0 -0
  74. package/dist/web/assets/{classDiagram-JCYQIIEL-CxEYeVQh.js → classDiagram-JCYQIIEL-BrSlNEkX.js} +1 -1
  75. package/dist/web/assets/classDiagram-JCYQIIEL-BrSlNEkX.js.br +0 -0
  76. package/dist/web/assets/classDiagram-JCYQIIEL-BrSlNEkX.js.gz +0 -0
  77. package/dist/web/assets/{classDiagram-v2-OCEON4UE-CxEYeVQh.js → classDiagram-v2-OCEON4UE-BrSlNEkX.js} +1 -1
  78. package/dist/web/assets/classDiagram-v2-OCEON4UE-BrSlNEkX.js.br +0 -0
  79. package/dist/web/assets/classDiagram-v2-OCEON4UE-BrSlNEkX.js.gz +0 -0
  80. package/dist/web/assets/claude-extensions-pane-B5alX6NW.js +1 -0
  81. package/dist/web/assets/claude-extensions-pane-B5alX6NW.js.br +0 -0
  82. package/dist/web/assets/claude-extensions-pane-B5alX6NW.js.gz +0 -0
  83. package/dist/web/assets/{claude-settings-panel-DXKvK9Cx.js → claude-settings-panel-clCfG3vv.js} +1 -1
  84. package/dist/web/assets/claude-settings-panel-clCfG3vv.js.br +0 -0
  85. package/dist/web/assets/claude-settings-panel-clCfG3vv.js.gz +0 -0
  86. package/dist/web/assets/clipboard-rFJYhGgH.js +1 -0
  87. package/dist/web/assets/clipboard-rFJYhGgH.js.br +0 -0
  88. package/dist/web/assets/clipboard-rFJYhGgH.js.gz +0 -0
  89. package/dist/web/assets/code-highlighter-BSgLVO-5.js +3 -0
  90. package/dist/web/assets/code-highlighter-BSgLVO-5.js.br +0 -0
  91. package/dist/web/assets/code-highlighter-BSgLVO-5.js.gz +0 -0
  92. package/dist/web/assets/codex-resources-pane-17q6mdBu.js +1 -0
  93. package/dist/web/assets/codex-resources-pane-17q6mdBu.js.br +0 -0
  94. package/dist/web/assets/codex-resources-pane-17q6mdBu.js.gz +0 -0
  95. package/dist/web/assets/{commit-settings-panel-CDFZi6_m.js → commit-settings-panel-BaCNJ-kP.js} +1 -1
  96. package/dist/web/assets/commit-settings-panel-BaCNJ-kP.js.br +0 -0
  97. package/dist/web/assets/commit-settings-panel-BaCNJ-kP.js.gz +0 -0
  98. package/dist/web/assets/composer-git-menu-DpQl41Lv.js +1 -0
  99. package/dist/web/assets/composer-git-menu-DpQl41Lv.js.br +0 -0
  100. package/dist/web/assets/composer-git-menu-DpQl41Lv.js.gz +0 -0
  101. package/dist/web/assets/{cynefinDiagram-MW4NZA55-BgrsE095.js → cynefinDiagram-MW4NZA55-BRur_bqy.js} +1 -1
  102. package/dist/web/assets/cynefinDiagram-MW4NZA55-BRur_bqy.js.br +0 -0
  103. package/dist/web/assets/cynefinDiagram-MW4NZA55-BRur_bqy.js.gz +0 -0
  104. package/dist/web/assets/{diagram-7IWD3JNH-d6DRTRQU.js → diagram-7IWD3JNH-Dm9goIk0.js} +1 -1
  105. package/dist/web/assets/diagram-7IWD3JNH-Dm9goIk0.js.br +0 -0
  106. package/dist/web/assets/diagram-7IWD3JNH-Dm9goIk0.js.gz +0 -0
  107. package/dist/web/assets/{diagram-LBJQPF4R-BTsB33l7.js → diagram-LBJQPF4R-D5MqQQlL.js} +1 -1
  108. package/dist/web/assets/diagram-LBJQPF4R-D5MqQQlL.js.br +0 -0
  109. package/dist/web/assets/diagram-LBJQPF4R-D5MqQQlL.js.gz +0 -0
  110. package/dist/web/assets/{diagram-Q27KOJAE-BR31NpE4.js → diagram-Q27KOJAE-CT9-om9c.js} +1 -1
  111. package/dist/web/assets/diagram-Q27KOJAE-CT9-om9c.js.br +0 -0
  112. package/dist/web/assets/diagram-Q27KOJAE-CT9-om9c.js.gz +0 -0
  113. package/dist/web/assets/{diagram-UB23O5K3-Giiek6vS.js → diagram-UB23O5K3-BNxdNO9N.js} +1 -1
  114. package/dist/web/assets/diagram-UB23O5K3-BNxdNO9N.js.br +0 -0
  115. package/dist/web/assets/diagram-UB23O5K3-BNxdNO9N.js.gz +0 -0
  116. package/dist/web/assets/{dist-DKGpvUu3.js → dist-AuPj8SgL.js} +3 -3
  117. package/dist/web/assets/dist-AuPj8SgL.js.br +0 -0
  118. package/dist/web/assets/dist-AuPj8SgL.js.gz +0 -0
  119. package/dist/web/assets/{dist-dQCgoXMl.js → dist-B5sI2dlF.js} +1 -1
  120. package/dist/web/assets/dist-B5sI2dlF.js.br +0 -0
  121. package/dist/web/assets/dist-B5sI2dlF.js.gz +0 -0
  122. package/dist/web/assets/{dist-CYMTYgBk.js → dist-BsL649bQ.js} +1 -1
  123. package/dist/web/assets/dist-BsL649bQ.js.br +0 -0
  124. package/dist/web/assets/dist-BsL649bQ.js.gz +0 -0
  125. package/dist/web/assets/{dist-C9Xo-R3R.js → dist-CAE1iZ8f.js} +1 -1
  126. package/dist/web/assets/dist-CAE1iZ8f.js.br +0 -0
  127. package/dist/web/assets/dist-CAE1iZ8f.js.gz +0 -0
  128. package/dist/web/assets/{dist-DQyQRzkb.js → dist-CXzWYcrE.js} +1 -1
  129. package/dist/web/assets/dist-CXzWYcrE.js.br +0 -0
  130. package/dist/web/assets/dist-CXzWYcrE.js.gz +0 -0
  131. package/dist/web/assets/{dist-Cdr0TsB-.js → dist-Ceirvrnz.js} +1 -1
  132. package/dist/web/assets/dist-Ceirvrnz.js.br +0 -0
  133. package/dist/web/assets/dist-Ceirvrnz.js.gz +0 -0
  134. package/dist/web/assets/{dist-BRQ8hrs7.js → dist-CuEOCH4w.js} +1 -1
  135. package/dist/web/assets/dist-CuEOCH4w.js.br +0 -0
  136. package/dist/web/assets/dist-CuEOCH4w.js.gz +0 -0
  137. package/dist/web/assets/{dist-D5aBWTdK.js → dist-DGIEKeyr.js} +1 -1
  138. package/dist/web/assets/dist-DGIEKeyr.js.br +0 -0
  139. package/dist/web/assets/dist-DGIEKeyr.js.gz +0 -0
  140. package/dist/web/assets/{dist-BS9Es7bq.js → dist-DTkOac6l.js} +1 -1
  141. package/dist/web/assets/dist-DTkOac6l.js.br +0 -0
  142. package/dist/web/assets/dist-DTkOac6l.js.gz +0 -0
  143. package/dist/web/assets/{dist-CZxkC4sf.js → dist-D_Wo-IHz.js} +1 -1
  144. package/dist/web/assets/dist-D_Wo-IHz.js.br +0 -0
  145. package/dist/web/assets/dist-D_Wo-IHz.js.gz +0 -0
  146. package/dist/web/assets/{dist-Dda7I8j1.js → dist-Dj9a4Mmk.js} +1 -1
  147. package/dist/web/assets/dist-Dj9a4Mmk.js.br +0 -0
  148. package/dist/web/assets/dist-Dj9a4Mmk.js.gz +0 -0
  149. package/dist/web/assets/{dist-BsHoamEK.js → dist-sWM-W4IA.js} +1 -1
  150. package/dist/web/assets/dist-sWM-W4IA.js.br +0 -0
  151. package/dist/web/assets/dist-sWM-W4IA.js.gz +0 -0
  152. package/dist/web/assets/{dist-ZywOhMVT.js → dist-taplUnD4.js} +1 -1
  153. package/dist/web/assets/dist-taplUnD4.js.br +0 -0
  154. package/dist/web/assets/dist-taplUnD4.js.gz +0 -0
  155. package/dist/web/assets/document-navigation-Da1q1H1O.js +3 -0
  156. package/dist/web/assets/document-navigation-Da1q1H1O.js.br +0 -0
  157. package/dist/web/assets/document-navigation-Da1q1H1O.js.gz +0 -0
  158. package/dist/web/assets/download-Be9bQeP_.js +1 -0
  159. package/dist/web/assets/download-Be9bQeP_.js.br +0 -0
  160. package/dist/web/assets/download-Be9bQeP_.js.gz +0 -0
  161. package/dist/web/assets/{ebnfDiagram-BXEA7PRR-D1qXqma3.js → ebnfDiagram-BXEA7PRR-dyKzv1-Q.js} +1 -1
  162. package/dist/web/assets/ebnfDiagram-BXEA7PRR-dyKzv1-Q.js.br +0 -0
  163. package/dist/web/assets/ebnfDiagram-BXEA7PRR-dyKzv1-Q.js.gz +0 -0
  164. package/dist/web/assets/engine-setup-gate-CsMQae5w.js +1 -0
  165. package/dist/web/assets/engine-setup-gate-CsMQae5w.js.br +0 -0
  166. package/dist/web/assets/engine-setup-gate-CsMQae5w.js.gz +0 -0
  167. package/dist/web/assets/{erDiagram-JOGREHBK-C3UtJXJx.js → erDiagram-JOGREHBK-BmTsV3SL.js} +1 -1
  168. package/dist/web/assets/erDiagram-JOGREHBK-BmTsV3SL.js.br +0 -0
  169. package/dist/web/assets/erDiagram-JOGREHBK-BmTsV3SL.js.gz +0 -0
  170. package/dist/web/assets/{extension-list-FpN59xyu.js → extension-list-snCKzRql.js} +1 -1
  171. package/dist/web/assets/extension-list-snCKzRql.js.br +0 -0
  172. package/dist/web/assets/extension-list-snCKzRql.js.gz +0 -0
  173. package/dist/web/assets/{extension-operation-C25lNEcc.js → extension-operation-DyO98T-k.js} +1 -1
  174. package/dist/web/assets/extension-operation-DyO98T-k.js.br +0 -0
  175. package/dist/web/assets/extension-operation-DyO98T-k.js.gz +0 -0
  176. package/dist/web/assets/external-link-EUD14c1S.js +1 -0
  177. package/dist/web/assets/external-link-EUD14c1S.js.br +0 -0
  178. package/dist/web/assets/external-link-EUD14c1S.js.gz +0 -0
  179. package/dist/web/assets/file-navigation-view-preference-DZIGllo5.js +1 -0
  180. package/dist/web/assets/file-navigation-view-preference-DZIGllo5.js.br +0 -0
  181. package/dist/web/assets/file-navigation-view-preference-DZIGllo5.js.gz +0 -0
  182. package/dist/web/assets/file-review-dialog-DvvuhUCl.js +2 -0
  183. package/dist/web/assets/file-review-dialog-DvvuhUCl.js.br +0 -0
  184. package/dist/web/assets/file-review-dialog-DvvuhUCl.js.gz +0 -0
  185. package/dist/web/assets/{flowDiagram-UKHOOZJN-CkmFxY4S.js → flowDiagram-UKHOOZJN-BGsVtiSj.js} +1 -1
  186. package/dist/web/assets/flowDiagram-UKHOOZJN-BGsVtiSj.js.br +2 -0
  187. package/dist/web/assets/flowDiagram-UKHOOZJN-BGsVtiSj.js.gz +0 -0
  188. package/dist/web/assets/git-commit-review-DrGBeiJa.js +2 -0
  189. package/dist/web/assets/git-commit-review-DrGBeiJa.js.br +0 -0
  190. package/dist/web/assets/git-commit-review-DrGBeiJa.js.gz +0 -0
  191. package/dist/web/assets/git-history-panel-BJ4OnqMO.js +1 -0
  192. package/dist/web/assets/git-history-panel-BJ4OnqMO.js.br +0 -0
  193. package/dist/web/assets/git-history-panel-BJ4OnqMO.js.gz +0 -0
  194. package/dist/web/assets/global-search-dialog-BZOhh2as.js +2 -0
  195. package/dist/web/assets/global-search-dialog-BZOhh2as.js.br +0 -0
  196. package/dist/web/assets/global-search-dialog-BZOhh2as.js.gz +0 -0
  197. package/dist/web/assets/global-settings-about-Cl_afjE6.js +1 -0
  198. package/dist/web/assets/global-settings-about-Cl_afjE6.js.br +0 -0
  199. package/dist/web/assets/global-settings-about-Cl_afjE6.js.gz +0 -0
  200. package/dist/web/assets/global-settings-fields-Cn48Go_s.js +1 -0
  201. package/dist/web/assets/global-settings-fields-Cn48Go_s.js.br +0 -0
  202. package/dist/web/assets/global-settings-fields-Cn48Go_s.js.gz +0 -0
  203. package/dist/web/assets/global-settings-page-YoE4BNgM.js +2 -0
  204. package/dist/web/assets/global-settings-page-YoE4BNgM.js.br +0 -0
  205. package/dist/web/assets/global-settings-page-YoE4BNgM.js.gz +0 -0
  206. package/dist/web/assets/{global-settings-pets-B43_pFUh.js → global-settings-pets-b0XLhN7A.js} +1 -1
  207. package/dist/web/assets/global-settings-pets-b0XLhN7A.js.br +0 -0
  208. package/dist/web/assets/global-settings-pets-b0XLhN7A.js.gz +0 -0
  209. package/dist/web/assets/{highlighted-body-OFNGDK62-DWnfzzs7.js → highlighted-body-OFNGDK62-B9dwCqpt.js} +1 -1
  210. package/dist/web/assets/highlighted-body-OFNGDK62-B9dwCqpt.js.br +0 -0
  211. package/dist/web/assets/highlighted-body-OFNGDK62-B9dwCqpt.js.gz +0 -0
  212. package/dist/web/assets/history-task-timeline-PqOQPY_u.js +1 -0
  213. package/dist/web/assets/history-task-timeline-PqOQPY_u.js.br +0 -0
  214. package/dist/web/assets/history-task-timeline-PqOQPY_u.js.gz +0 -0
  215. package/dist/web/assets/{image-preview-DLbcm8V_.js → image-preview-D-s7cdTe.js} +2 -2
  216. package/dist/web/assets/image-preview-D-s7cdTe.js.br +0 -0
  217. package/dist/web/assets/image-preview-D-s7cdTe.js.gz +0 -0
  218. package/dist/web/assets/image-preview-content-CdIl5BJh.js +41 -0
  219. package/dist/web/assets/image-preview-content-CdIl5BJh.js.br +0 -0
  220. package/dist/web/assets/image-preview-content-CdIl5BJh.js.gz +0 -0
  221. package/dist/web/assets/index-CE2J7Z4y.js +4 -0
  222. package/dist/web/assets/index-CE2J7Z4y.js.br +0 -0
  223. package/dist/web/assets/index-CE2J7Z4y.js.gz +0 -0
  224. package/dist/web/assets/index-DNMb0zwW.css +2 -0
  225. package/dist/web/assets/index-DNMb0zwW.css.br +0 -0
  226. package/dist/web/assets/index-DNMb0zwW.css.gz +0 -0
  227. package/dist/web/assets/{infoDiagram-6WML65LV-DuWGeyW3.js → infoDiagram-6WML65LV-BAIuLIiE.js} +1 -1
  228. package/dist/web/assets/infoDiagram-6WML65LV-BAIuLIiE.js.br +0 -0
  229. package/dist/web/assets/infoDiagram-6WML65LV-BAIuLIiE.js.gz +0 -0
  230. package/dist/web/assets/{initial-deps-DZ-sH4cr.js → initial-deps-DBOKk1z5.js} +1 -1
  231. package/dist/web/assets/{initial-deps-DZ-sH4cr.js.br → initial-deps-DBOKk1z5.js.br} +0 -0
  232. package/dist/web/assets/{initial-deps-DZ-sH4cr.js.gz → initial-deps-DBOKk1z5.js.gz} +0 -0
  233. package/dist/web/assets/initial-deps-DGiIFgQX.js +2 -0
  234. package/dist/web/assets/initial-deps-DGiIFgQX.js.br +0 -0
  235. package/dist/web/assets/initial-deps-DGiIFgQX.js.gz +0 -0
  236. package/dist/web/assets/initial-deps-DgzPJEbl.js +1 -0
  237. package/dist/web/assets/initial-deps-DgzPJEbl.js.br +0 -0
  238. package/dist/web/assets/initial-deps-DgzPJEbl.js.gz +0 -0
  239. package/dist/web/assets/{initial-deps-CilSILfP.js → initial-deps-YY1DxiPl.js} +1 -1
  240. package/dist/web/assets/initial-deps-YY1DxiPl.js.br +0 -0
  241. package/dist/web/assets/initial-deps-YY1DxiPl.js.gz +0 -0
  242. package/dist/web/assets/initial-deps-ZpffyCug.js +41 -0
  243. package/dist/web/assets/initial-deps-ZpffyCug.js.br +0 -0
  244. package/dist/web/assets/initial-deps-ZpffyCug.js.gz +0 -0
  245. package/dist/web/assets/{initial-deps-BeVJyoJH.js → initial-deps-cK7Q2EcP.js} +1 -1
  246. package/dist/web/assets/initial-deps-cK7Q2EcP.js.br +0 -0
  247. package/dist/web/assets/initial-deps-cK7Q2EcP.js.gz +0 -0
  248. package/dist/web/assets/installed-skills-pane-Cyyzl-Bb.js +1 -0
  249. package/dist/web/assets/installed-skills-pane-Cyyzl-Bb.js.br +0 -0
  250. package/dist/web/assets/installed-skills-pane-Cyyzl-Bb.js.gz +0 -0
  251. package/dist/web/assets/{ishikawaDiagram-WSZJBQD7-CKSQLCKs.js → ishikawaDiagram-WSZJBQD7-BHAsHeut.js} +1 -1
  252. package/dist/web/assets/ishikawaDiagram-WSZJBQD7-BHAsHeut.js.br +0 -0
  253. package/dist/web/assets/ishikawaDiagram-WSZJBQD7-BHAsHeut.js.gz +0 -0
  254. package/dist/web/assets/{kanban-definition-27J2QSJJ-Dy_spa9A.js → kanban-definition-27J2QSJJ-DXD7XDKp.js} +1 -1
  255. package/dist/web/assets/kanban-definition-27J2QSJJ-DXD7XDKp.js.br +0 -0
  256. package/dist/web/assets/kanban-definition-27J2QSJJ-DXD7XDKp.js.gz +0 -0
  257. package/dist/web/assets/maximize-2-DsnIK2kb.js +1 -0
  258. package/dist/web/assets/maximize-2-DsnIK2kb.js.br +0 -0
  259. package/dist/web/assets/maximize-2-DsnIK2kb.js.gz +0 -0
  260. package/dist/web/assets/mcp-management-pane-C-lhQebl.js +1 -0
  261. package/dist/web/assets/mcp-management-pane-C-lhQebl.js.br +0 -0
  262. package/dist/web/assets/mcp-management-pane-C-lhQebl.js.gz +0 -0
  263. package/dist/web/assets/mermaid-GHXKKRXX-BNvY3Im7.js +1 -0
  264. package/dist/web/assets/mermaid-GHXKKRXX-BNvY3Im7.js.br +0 -0
  265. package/dist/web/assets/mermaid-GHXKKRXX-BNvY3Im7.js.gz +0 -0
  266. package/dist/web/assets/message-assistant-directive-BGmxIV_g.js +3 -0
  267. package/dist/web/assets/message-assistant-directive-BGmxIV_g.js.br +0 -0
  268. package/dist/web/assets/message-assistant-directive-BGmxIV_g.js.gz +0 -0
  269. package/dist/web/assets/message-response-DHapkIAN.js +151 -0
  270. package/dist/web/assets/message-response-DHapkIAN.js.br +0 -0
  271. package/dist/web/assets/message-response-DHapkIAN.js.gz +0 -0
  272. package/dist/web/assets/{mindmap-definition-FAOFIHXS-BT3bfYzH.js → mindmap-definition-FAOFIHXS-CLTyPTLI.js} +1 -1
  273. package/dist/web/assets/mindmap-definition-FAOFIHXS-CLTyPTLI.js.br +0 -0
  274. package/dist/web/assets/mindmap-definition-FAOFIHXS-CLTyPTLI.js.gz +0 -0
  275. package/dist/web/assets/{model-context-window-input-B1WfG4S_.js → model-context-window-input-dM1RHCkE.js} +1 -1
  276. package/dist/web/assets/model-context-window-input-dM1RHCkE.js.br +0 -0
  277. package/dist/web/assets/model-context-window-input-dM1RHCkE.js.gz +0 -0
  278. package/dist/web/assets/official-plugin-sheet-hYSHhxo1.js +1 -0
  279. package/dist/web/assets/official-plugin-sheet-hYSHhxo1.js.br +0 -0
  280. package/dist/web/assets/official-plugin-sheet-hYSHhxo1.js.gz +0 -0
  281. package/dist/web/assets/official-plugins-pane-C3iFHqyq.js +2 -0
  282. package/dist/web/assets/official-plugins-pane-C3iFHqyq.js.br +0 -0
  283. package/dist/web/assets/official-plugins-pane-C3iFHqyq.js.gz +0 -0
  284. package/dist/web/assets/open-project-path-C3E-UncW.js +1 -0
  285. package/dist/web/assets/open-project-path-C3E-UncW.js.br +0 -0
  286. package/dist/web/assets/open-project-path-C3E-UncW.js.gz +0 -0
  287. package/dist/web/assets/{patch-diff-viewer-_6e4j2Xu.js → patch-diff-viewer-CAlOstmF.js} +24 -24
  288. package/dist/web/assets/patch-diff-viewer-CAlOstmF.js.br +0 -0
  289. package/dist/web/assets/patch-diff-viewer-CAlOstmF.js.gz +0 -0
  290. package/dist/web/assets/{pegDiagram-VL7TDLO6-BDpdrr1s.js → pegDiagram-VL7TDLO6-CEMTFena.js} +1 -1
  291. package/dist/web/assets/pegDiagram-VL7TDLO6-CEMTFena.js.br +0 -0
  292. package/dist/web/assets/pegDiagram-VL7TDLO6-CEMTFena.js.gz +0 -0
  293. package/dist/web/assets/personalization-settings-panel-CjR0RSn0.js +1 -0
  294. package/dist/web/assets/personalization-settings-panel-CjR0RSn0.js.br +0 -0
  295. package/dist/web/assets/personalization-settings-panel-CjR0RSn0.js.gz +0 -0
  296. package/dist/web/assets/{pieDiagram-7S7Q4E2Y-DCypkhSo.js → pieDiagram-7S7Q4E2Y-CTU8oZML.js} +1 -1
  297. package/dist/web/assets/pieDiagram-7S7Q4E2Y-CTU8oZML.js.br +0 -0
  298. package/dist/web/assets/pieDiagram-7S7Q4E2Y-CTU8oZML.js.gz +0 -0
  299. package/dist/web/assets/{project-file-popup-page-zQmKyPor.js → project-file-popup-page-c0wqWaPR.js} +1 -1
  300. package/dist/web/assets/project-file-popup-page-c0wqWaPR.js.br +0 -0
  301. package/dist/web/assets/project-file-popup-page-c0wqWaPR.js.gz +0 -0
  302. package/dist/web/assets/project-sidebar-timeline-B9S9jfdA.js +1 -0
  303. package/dist/web/assets/project-sidebar-timeline-B9S9jfdA.js.br +0 -0
  304. package/dist/web/assets/project-sidebar-timeline-B9S9jfdA.js.gz +0 -0
  305. package/dist/web/assets/project-source-panel-CDbtcBsp.js +2 -0
  306. package/dist/web/assets/project-source-panel-CDbtcBsp.js.br +0 -0
  307. package/dist/web/assets/project-source-panel-CDbtcBsp.js.gz +0 -0
  308. package/dist/web/assets/prompt-input-Qv__0ZYp.js +1 -0
  309. package/dist/web/assets/prompt-input-Qv__0ZYp.js.br +0 -0
  310. package/dist/web/assets/prompt-input-Qv__0ZYp.js.gz +0 -0
  311. package/dist/web/assets/{provider-connection-panel-stjpuDi-.js → provider-connection-panel-CFOjjrpy.js} +1 -1
  312. package/dist/web/assets/provider-connection-panel-CFOjjrpy.js.br +0 -0
  313. package/dist/web/assets/provider-connection-panel-CFOjjrpy.js.gz +0 -0
  314. package/dist/web/assets/{provider-connection-queries-Bi1sUodL.js → provider-connection-queries-DaUJKsqr.js} +1 -1
  315. package/dist/web/assets/provider-connection-queries-DaUJKsqr.js.br +0 -0
  316. package/dist/web/assets/provider-connection-queries-DaUJKsqr.js.gz +0 -0
  317. package/dist/web/assets/{railroadDiagram-AXF67PYL-d16J9qzD.js → railroadDiagram-AXF67PYL-BOpAz8Rl.js} +1 -1
  318. package/dist/web/assets/railroadDiagram-AXF67PYL-BOpAz8Rl.js.br +0 -0
  319. package/dist/web/assets/railroadDiagram-AXF67PYL-BOpAz8Rl.js.gz +0 -0
  320. package/dist/web/assets/{requirementDiagram-LRYGKXZP-C9hUbT7e.js → requirementDiagram-LRYGKXZP-BOIE6jyw.js} +1 -1
  321. package/dist/web/assets/requirementDiagram-LRYGKXZP-BOIE6jyw.js.br +0 -0
  322. package/dist/web/assets/requirementDiagram-LRYGKXZP-BOIE6jyw.js.gz +0 -0
  323. package/dist/web/assets/resources-en-CNabznak.js +1 -0
  324. package/dist/web/assets/resources-en-CNabznak.js.br +0 -0
  325. package/dist/web/assets/resources-en-CNabznak.js.gz +0 -0
  326. package/dist/web/assets/saved-prompts-settings-BIWAIIuI.js +1 -0
  327. package/dist/web/assets/saved-prompts-settings-BIWAIIuI.js.br +0 -0
  328. package/dist/web/assets/saved-prompts-settings-BIWAIIuI.js.gz +0 -0
  329. package/dist/web/assets/scan-C6v7t2yH.js +1 -0
  330. package/dist/web/assets/scan-C6v7t2yH.js.br +1 -0
  331. package/dist/web/assets/scan-C6v7t2yH.js.gz +0 -0
  332. package/dist/web/assets/scheduled-task-date-time-picker-fytjNu3G.js +1 -0
  333. package/dist/web/assets/scheduled-task-date-time-picker-fytjNu3G.js.br +0 -0
  334. package/dist/web/assets/scheduled-task-date-time-picker-fytjNu3G.js.gz +0 -0
  335. package/dist/web/assets/{scheduled-task-floating-ui~scheduled-task-date-time-picker-cReLi3tI.js → scheduled-task-floating-ui~scheduled-task-date-time-picker-CS9ppkbD.js} +1 -1
  336. package/dist/web/assets/scheduled-task-floating-ui~scheduled-task-date-time-picker-CS9ppkbD.js.br +0 -0
  337. package/dist/web/assets/scheduled-task-floating-ui~scheduled-task-date-time-picker-CS9ppkbD.js.gz +0 -0
  338. package/dist/web/assets/scheduled-tasks-container-CcEgcbyX.js +2 -0
  339. package/dist/web/assets/scheduled-tasks-container-CcEgcbyX.js.br +0 -0
  340. package/dist/web/assets/scheduled-tasks-container-CcEgcbyX.js.gz +0 -0
  341. package/dist/web/assets/{sequenceDiagram-SI44F4Z6-CGA84wrP.js → sequenceDiagram-SI44F4Z6-CK-WlrkA.js} +1 -1
  342. package/dist/web/assets/sequenceDiagram-SI44F4Z6-CK-WlrkA.js.br +0 -0
  343. package/dist/web/assets/sequenceDiagram-SI44F4Z6-CK-WlrkA.js.gz +0 -0
  344. package/dist/web/assets/server-A3E6rPSE.js +1 -0
  345. package/dist/web/assets/server-A3E6rPSE.js.br +1 -0
  346. package/dist/web/assets/server-A3E6rPSE.js.gz +0 -0
  347. package/dist/web/assets/{settings-mutation-status-Dke6ycgH.js → settings-mutation-status-C_W3Brzy.js} +1 -1
  348. package/dist/web/assets/settings-mutation-status-C_W3Brzy.js.br +0 -0
  349. package/dist/web/assets/settings-mutation-status-C_W3Brzy.js.gz +0 -0
  350. package/dist/web/assets/settings-save-status-LZlDl2hi.js +1 -0
  351. package/dist/web/assets/settings-save-status-LZlDl2hi.js.br +0 -0
  352. package/dist/web/assets/settings-save-status-LZlDl2hi.js.gz +0 -0
  353. package/dist/web/assets/{shiki-bundle-DoOIe8qx.js → shiki-bundle-BuVlco8m.js} +1 -1
  354. package/dist/web/assets/shiki-bundle-BuVlco8m.js.br +1 -0
  355. package/dist/web/assets/shiki-bundle-BuVlco8m.js.gz +0 -0
  356. package/dist/web/assets/skills-market-container-3F4yAU_u.js +2 -0
  357. package/dist/web/assets/skills-market-container-3F4yAU_u.js.br +0 -0
  358. package/dist/web/assets/skills-market-container-3F4yAU_u.js.gz +0 -0
  359. package/dist/web/assets/split-workspace-menu-content-B-194fx-.js +1 -0
  360. package/dist/web/assets/split-workspace-menu-content-B-194fx-.js.br +2 -0
  361. package/dist/web/assets/split-workspace-menu-content-B-194fx-.js.gz +0 -0
  362. package/dist/web/assets/{stateDiagram-OKZ733FA-D0MVn7g1.js → stateDiagram-OKZ733FA-hLYv6w14.js} +1 -1
  363. package/dist/web/assets/stateDiagram-OKZ733FA-hLYv6w14.js.br +0 -0
  364. package/dist/web/assets/stateDiagram-OKZ733FA-hLYv6w14.js.gz +0 -0
  365. package/dist/web/assets/{stateDiagram-v2-UEYNNEHI-TUsb_3yM.js → stateDiagram-v2-UEYNNEHI-DGFWGBEN.js} +1 -1
  366. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-DGFWGBEN.js.br +0 -0
  367. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-DGFWGBEN.js.gz +0 -0
  368. package/dist/web/assets/{swimlanesDiagram-ULZ7WXOC-8Qb6Pp_Z.js → swimlanesDiagram-ULZ7WXOC-BDqOoYXX.js} +1 -1
  369. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-BDqOoYXX.js.br +0 -0
  370. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-BDqOoYXX.js.gz +0 -0
  371. package/dist/web/assets/{task-timeline-process-history-CZep5llt.js → task-timeline-process-history-FA7FqX65.js} +1 -1
  372. package/dist/web/assets/task-timeline-process-history-FA7FqX65.js.br +0 -0
  373. package/dist/web/assets/task-timeline-process-history-FA7FqX65.js.gz +0 -0
  374. package/dist/web/assets/text-file-editor-Dt1ptrwk.js +14 -0
  375. package/dist/web/assets/text-file-editor-Dt1ptrwk.js.br +0 -0
  376. package/dist/web/assets/text-file-editor-Dt1ptrwk.js.gz +0 -0
  377. package/dist/web/assets/{timeline-definition-Z64GVDOM-DRC7HLeH.js → timeline-definition-Z64GVDOM-C0ggW9ke.js} +1 -1
  378. package/dist/web/assets/timeline-definition-Z64GVDOM-C0ggW9ke.js.br +0 -0
  379. package/dist/web/assets/timeline-definition-Z64GVDOM-C0ggW9ke.js.gz +0 -0
  380. package/dist/web/assets/token-usage-response-oKnLCVhj.js +1 -0
  381. package/dist/web/assets/token-usage-response-oKnLCVhj.js.br +0 -0
  382. package/dist/web/assets/token-usage-response-oKnLCVhj.js.gz +0 -0
  383. package/dist/web/assets/upload-Dc5LJ6y_.js +1 -0
  384. package/dist/web/assets/upload-Dc5LJ6y_.js.br +0 -0
  385. package/dist/web/assets/upload-Dc5LJ6y_.js.gz +0 -0
  386. package/dist/web/assets/usage-statistics-C7zED1sM.css +1 -0
  387. package/dist/web/assets/usage-statistics-C7zED1sM.css.br +0 -0
  388. package/dist/web/assets/usage-statistics-C7zED1sM.css.gz +0 -0
  389. package/dist/web/assets/usage-statistics-CkWR_l2r.js +1 -0
  390. package/dist/web/assets/usage-statistics-CkWR_l2r.js.br +0 -0
  391. package/dist/web/assets/usage-statistics-CkWR_l2r.js.gz +0 -0
  392. package/dist/web/assets/{useMutationState-CuY6Z3bo.js → useMutationState-DZj3iudU.js} +1 -1
  393. package/dist/web/assets/useMutationState-DZj3iudU.js.br +0 -0
  394. package/dist/web/assets/useMutationState-DZj3iudU.js.gz +0 -0
  395. package/dist/web/assets/utils-O47BBoIx.js +1 -0
  396. package/dist/web/assets/utils-O47BBoIx.js.br +0 -0
  397. package/dist/web/assets/utils-O47BBoIx.js.gz +0 -0
  398. package/dist/web/assets/{vennDiagram-T6HMQDX7-B5BRVmyv.js → vennDiagram-T6HMQDX7-SCXL8ux1.js} +1 -1
  399. package/dist/web/assets/vennDiagram-T6HMQDX7-SCXL8ux1.js.br +0 -0
  400. package/dist/web/assets/vennDiagram-T6HMQDX7-SCXL8ux1.js.gz +0 -0
  401. package/dist/web/assets/{wardleyDiagram-T6FBY63Y-BVuPKOmW.js → wardleyDiagram-T6FBY63Y-Cqe5SiO4.js} +1 -1
  402. package/dist/web/assets/wardleyDiagram-T6FBY63Y-Cqe5SiO4.js.br +0 -0
  403. package/dist/web/assets/wardleyDiagram-T6FBY63Y-Cqe5SiO4.js.gz +0 -0
  404. package/dist/web/assets/workbench-inspector-changes-ZSA-8aVd.js +1 -0
  405. package/dist/web/assets/workbench-inspector-changes-ZSA-8aVd.js.br +0 -0
  406. package/dist/web/assets/workbench-inspector-changes-ZSA-8aVd.js.gz +0 -0
  407. package/dist/web/assets/{workbench-pet-canvas-DfV_J-9g.js → workbench-pet-canvas-CHABL440.js} +1 -1
  408. package/dist/web/assets/workbench-pet-canvas-CHABL440.js.br +0 -0
  409. package/dist/web/assets/workbench-pet-canvas-CHABL440.js.gz +0 -0
  410. package/dist/web/assets/workbench-shell-CR4teS_d.js +17 -0
  411. package/dist/web/assets/workbench-shell-CR4teS_d.js.br +0 -0
  412. package/dist/web/assets/workbench-shell-CR4teS_d.js.gz +0 -0
  413. package/dist/web/assets/{xychartDiagram-ELKLHX3M-Cyq1aXDR.js → xychartDiagram-ELKLHX3M-CWXlmFCE.js} +1 -1
  414. package/dist/web/assets/xychartDiagram-ELKLHX3M-CWXlmFCE.js.br +0 -0
  415. package/dist/web/assets/xychartDiagram-ELKLHX3M-CWXlmFCE.js.gz +0 -0
  416. package/dist/web/index.html +9 -9
  417. package/dist/web/index.html.br +0 -0
  418. package/dist/web/index.html.gz +0 -0
  419. package/docs/README.md +3 -1
  420. package/docs/document-workspace.md +49 -0
  421. package/docs/local-catalog.md +9 -0
  422. package/docs/usage-statistics.md +51 -0
  423. package/docs/usage.en.md +13 -1
  424. package/docs/usage.md +13 -1
  425. package/package.json +3 -1
  426. package/dist/chunk-S7LPESTQ.js +0 -3
  427. package/dist/chunk-WE42CHL5.js +0 -26
  428. package/dist/command-SFIOITEA.js +0 -88
  429. package/dist/web/assets/abnfDiagram-N423BO3Z-CEEQQmQS.js.br +0 -0
  430. package/dist/web/assets/abnfDiagram-N423BO3Z-CEEQQmQS.js.gz +0 -0
  431. package/dist/web/assets/agent-settings-panel-BpLGmoGs.js +0 -1
  432. package/dist/web/assets/agent-settings-panel-BpLGmoGs.js.br +0 -0
  433. package/dist/web/assets/agent-settings-panel-BpLGmoGs.js.gz +0 -0
  434. package/dist/web/assets/api-connection-fields-BibbcpNv.js.br +0 -0
  435. package/dist/web/assets/api-connection-fields-BibbcpNv.js.gz +0 -0
  436. package/dist/web/assets/app-update-dialog-DQoACHXt.js +0 -1
  437. package/dist/web/assets/app-update-dialog-DQoACHXt.js.br +0 -0
  438. package/dist/web/assets/app-update-dialog-DQoACHXt.js.gz +0 -0
  439. package/dist/web/assets/architectureDiagram-T3A2C74G-CF2Ovr5z.js.br +0 -0
  440. package/dist/web/assets/architectureDiagram-T3A2C74G-CF2Ovr5z.js.gz +0 -0
  441. package/dist/web/assets/arrow-down-BiCRjuX3.js +0 -1
  442. package/dist/web/assets/arrow-down-BiCRjuX3.js.br +0 -0
  443. package/dist/web/assets/arrow-down-BiCRjuX3.js.gz +0 -0
  444. package/dist/web/assets/arrow-up-right-1gv4rBr2.js +0 -1
  445. package/dist/web/assets/arrow-up-right-1gv4rBr2.js.br +0 -0
  446. package/dist/web/assets/arrow-up-right-1gv4rBr2.js.gz +0 -0
  447. package/dist/web/assets/background-image-picker-BSsADQTT.js.br +0 -0
  448. package/dist/web/assets/background-image-picker-BSsADQTT.js.gz +0 -0
  449. package/dist/web/assets/chunk-5RXB4S5H-Bu1iYp4t.js.br +0 -0
  450. package/dist/web/assets/chunk-6Q2QTUOP-8pETCK89.js.br +0 -0
  451. package/dist/web/assets/chunk-6Q2QTUOP-8pETCK89.js.gz +0 -0
  452. package/dist/web/assets/chunk-GF5L2VYU-Clmi3b75.js.br +0 -0
  453. package/dist/web/assets/chunk-JQJVKLGR-TByUBa_A.js.br +0 -0
  454. package/dist/web/assets/classDiagram-JCYQIIEL-CxEYeVQh.js.br +0 -0
  455. package/dist/web/assets/classDiagram-JCYQIIEL-CxEYeVQh.js.gz +0 -0
  456. package/dist/web/assets/classDiagram-v2-OCEON4UE-CxEYeVQh.js.br +0 -0
  457. package/dist/web/assets/classDiagram-v2-OCEON4UE-CxEYeVQh.js.gz +0 -0
  458. package/dist/web/assets/claude-extensions-pane-CQr8ljAY.js +0 -1
  459. package/dist/web/assets/claude-extensions-pane-CQr8ljAY.js.br +0 -0
  460. package/dist/web/assets/claude-extensions-pane-CQr8ljAY.js.gz +0 -0
  461. package/dist/web/assets/claude-settings-panel-DXKvK9Cx.js.br +0 -0
  462. package/dist/web/assets/claude-settings-panel-DXKvK9Cx.js.gz +0 -0
  463. package/dist/web/assets/clipboard-C55zlT9y.js +0 -1
  464. package/dist/web/assets/clipboard-C55zlT9y.js.br +0 -0
  465. package/dist/web/assets/clipboard-C55zlT9y.js.gz +0 -0
  466. package/dist/web/assets/code-highlighter-DLfpC-2j.js +0 -3
  467. package/dist/web/assets/code-highlighter-DLfpC-2j.js.br +0 -0
  468. package/dist/web/assets/code-highlighter-DLfpC-2j.js.gz +0 -0
  469. package/dist/web/assets/codex-resources-pane-wsrvgVrc.js +0 -1
  470. package/dist/web/assets/codex-resources-pane-wsrvgVrc.js.br +0 -0
  471. package/dist/web/assets/codex-resources-pane-wsrvgVrc.js.gz +0 -0
  472. package/dist/web/assets/commit-settings-panel-CDFZi6_m.js.br +0 -0
  473. package/dist/web/assets/commit-settings-panel-CDFZi6_m.js.gz +0 -0
  474. package/dist/web/assets/composer-git-menu-RXjhQAjt.js +0 -1
  475. package/dist/web/assets/composer-git-menu-RXjhQAjt.js.br +0 -0
  476. package/dist/web/assets/composer-git-menu-RXjhQAjt.js.gz +0 -0
  477. package/dist/web/assets/cynefinDiagram-MW4NZA55-BgrsE095.js.br +0 -0
  478. package/dist/web/assets/cynefinDiagram-MW4NZA55-BgrsE095.js.gz +0 -0
  479. package/dist/web/assets/diagram-7IWD3JNH-d6DRTRQU.js.br +0 -0
  480. package/dist/web/assets/diagram-7IWD3JNH-d6DRTRQU.js.gz +0 -0
  481. package/dist/web/assets/diagram-LBJQPF4R-BTsB33l7.js.br +0 -0
  482. package/dist/web/assets/diagram-LBJQPF4R-BTsB33l7.js.gz +0 -0
  483. package/dist/web/assets/diagram-Q27KOJAE-BR31NpE4.js.br +0 -0
  484. package/dist/web/assets/diagram-Q27KOJAE-BR31NpE4.js.gz +0 -0
  485. package/dist/web/assets/diagram-UB23O5K3-Giiek6vS.js.br +0 -0
  486. package/dist/web/assets/diagram-UB23O5K3-Giiek6vS.js.gz +0 -0
  487. package/dist/web/assets/dist-BRQ8hrs7.js.br +0 -0
  488. package/dist/web/assets/dist-BRQ8hrs7.js.gz +0 -0
  489. package/dist/web/assets/dist-BS9Es7bq.js.br +0 -0
  490. package/dist/web/assets/dist-BS9Es7bq.js.gz +0 -0
  491. package/dist/web/assets/dist-BsHoamEK.js.br +0 -0
  492. package/dist/web/assets/dist-BsHoamEK.js.gz +0 -0
  493. package/dist/web/assets/dist-C9Xo-R3R.js.br +0 -0
  494. package/dist/web/assets/dist-C9Xo-R3R.js.gz +0 -0
  495. package/dist/web/assets/dist-CYMTYgBk.js.br +0 -0
  496. package/dist/web/assets/dist-CYMTYgBk.js.gz +0 -0
  497. package/dist/web/assets/dist-CZxkC4sf.js.br +0 -0
  498. package/dist/web/assets/dist-CZxkC4sf.js.gz +0 -0
  499. package/dist/web/assets/dist-Cdr0TsB-.js.br +0 -0
  500. package/dist/web/assets/dist-Cdr0TsB-.js.gz +0 -0
  501. package/dist/web/assets/dist-D5aBWTdK.js.br +0 -0
  502. package/dist/web/assets/dist-D5aBWTdK.js.gz +0 -0
  503. package/dist/web/assets/dist-DKGpvUu3.js.br +0 -0
  504. package/dist/web/assets/dist-DKGpvUu3.js.gz +0 -0
  505. package/dist/web/assets/dist-DQyQRzkb.js.br +0 -0
  506. package/dist/web/assets/dist-DQyQRzkb.js.gz +0 -0
  507. package/dist/web/assets/dist-Dda7I8j1.js.br +0 -0
  508. package/dist/web/assets/dist-Dda7I8j1.js.gz +0 -0
  509. package/dist/web/assets/dist-ZywOhMVT.js.br +0 -0
  510. package/dist/web/assets/dist-ZywOhMVT.js.gz +0 -0
  511. package/dist/web/assets/dist-dQCgoXMl.js.br +0 -0
  512. package/dist/web/assets/dist-dQCgoXMl.js.gz +0 -0
  513. package/dist/web/assets/download-DSulXOCZ.js +0 -1
  514. package/dist/web/assets/download-DSulXOCZ.js.br +0 -0
  515. package/dist/web/assets/download-DSulXOCZ.js.gz +0 -0
  516. package/dist/web/assets/ebnfDiagram-BXEA7PRR-D1qXqma3.js.br +0 -0
  517. package/dist/web/assets/ebnfDiagram-BXEA7PRR-D1qXqma3.js.gz +0 -0
  518. package/dist/web/assets/engine-setup-gate-BMxHgUPX.js +0 -1
  519. package/dist/web/assets/engine-setup-gate-BMxHgUPX.js.br +0 -0
  520. package/dist/web/assets/engine-setup-gate-BMxHgUPX.js.gz +0 -0
  521. package/dist/web/assets/erDiagram-JOGREHBK-C3UtJXJx.js.br +0 -0
  522. package/dist/web/assets/erDiagram-JOGREHBK-C3UtJXJx.js.gz +0 -0
  523. package/dist/web/assets/extension-list-FpN59xyu.js.br +0 -0
  524. package/dist/web/assets/extension-list-FpN59xyu.js.gz +0 -0
  525. package/dist/web/assets/extension-operation-C25lNEcc.js.br +0 -3
  526. package/dist/web/assets/extension-operation-C25lNEcc.js.gz +0 -0
  527. package/dist/web/assets/external-link-DTvUbh5p.js +0 -1
  528. package/dist/web/assets/external-link-DTvUbh5p.js.br +0 -0
  529. package/dist/web/assets/external-link-DTvUbh5p.js.gz +0 -0
  530. package/dist/web/assets/file-navigation-view-preference-D5PlYpLl.js +0 -1
  531. package/dist/web/assets/file-navigation-view-preference-D5PlYpLl.js.br +0 -0
  532. package/dist/web/assets/file-navigation-view-preference-D5PlYpLl.js.gz +0 -0
  533. package/dist/web/assets/file-review-dialog-B0m1uX8I.js +0 -2
  534. package/dist/web/assets/file-review-dialog-B0m1uX8I.js.br +0 -0
  535. package/dist/web/assets/file-review-dialog-B0m1uX8I.js.gz +0 -0
  536. package/dist/web/assets/flowDiagram-UKHOOZJN-CkmFxY4S.js.br +0 -0
  537. package/dist/web/assets/flowDiagram-UKHOOZJN-CkmFxY4S.js.gz +0 -0
  538. package/dist/web/assets/git-commit-review-BzmpTmCu.js +0 -2
  539. package/dist/web/assets/git-commit-review-BzmpTmCu.js.br +0 -0
  540. package/dist/web/assets/git-commit-review-BzmpTmCu.js.gz +0 -0
  541. package/dist/web/assets/git-history-panel-D0NtL4Ey.js +0 -1
  542. package/dist/web/assets/git-history-panel-D0NtL4Ey.js.br +0 -0
  543. package/dist/web/assets/git-history-panel-D0NtL4Ey.js.gz +0 -0
  544. package/dist/web/assets/global-search-dialog-CfUFXT2P.js +0 -2
  545. package/dist/web/assets/global-search-dialog-CfUFXT2P.js.br +0 -0
  546. package/dist/web/assets/global-search-dialog-CfUFXT2P.js.gz +0 -0
  547. package/dist/web/assets/global-settings-about-0K0nGRC-.js +0 -1
  548. package/dist/web/assets/global-settings-about-0K0nGRC-.js.br +0 -0
  549. package/dist/web/assets/global-settings-about-0K0nGRC-.js.gz +0 -0
  550. package/dist/web/assets/global-settings-fields-Bguzhix9.js +0 -1
  551. package/dist/web/assets/global-settings-fields-Bguzhix9.js.br +0 -0
  552. package/dist/web/assets/global-settings-fields-Bguzhix9.js.gz +0 -0
  553. package/dist/web/assets/global-settings-page-BpfeYCYG.js +0 -2
  554. package/dist/web/assets/global-settings-page-BpfeYCYG.js.br +0 -0
  555. package/dist/web/assets/global-settings-page-BpfeYCYG.js.gz +0 -0
  556. package/dist/web/assets/global-settings-pets-B43_pFUh.js.br +0 -0
  557. package/dist/web/assets/global-settings-pets-B43_pFUh.js.gz +0 -0
  558. package/dist/web/assets/highlighted-body-OFNGDK62-DWnfzzs7.js.br +0 -0
  559. package/dist/web/assets/highlighted-body-OFNGDK62-DWnfzzs7.js.gz +0 -0
  560. package/dist/web/assets/history-task-timeline-BtWNWjvT.js +0 -1
  561. package/dist/web/assets/history-task-timeline-BtWNWjvT.js.br +0 -0
  562. package/dist/web/assets/history-task-timeline-BtWNWjvT.js.gz +0 -0
  563. package/dist/web/assets/image-preview-DLbcm8V_.js.br +0 -0
  564. package/dist/web/assets/image-preview-DLbcm8V_.js.gz +0 -0
  565. package/dist/web/assets/image-preview-content-B8t4zN2r.js +0 -41
  566. package/dist/web/assets/image-preview-content-B8t4zN2r.js.br +0 -0
  567. package/dist/web/assets/image-preview-content-B8t4zN2r.js.gz +0 -0
  568. package/dist/web/assets/index-BUna2uyD.js +0 -4
  569. package/dist/web/assets/index-BUna2uyD.js.br +0 -0
  570. package/dist/web/assets/index-BUna2uyD.js.gz +0 -0
  571. package/dist/web/assets/index-CB0Jmx2g.css +0 -2
  572. package/dist/web/assets/index-CB0Jmx2g.css.br +0 -0
  573. package/dist/web/assets/index-CB0Jmx2g.css.gz +0 -0
  574. package/dist/web/assets/infoDiagram-6WML65LV-DuWGeyW3.js.br +0 -0
  575. package/dist/web/assets/infoDiagram-6WML65LV-DuWGeyW3.js.gz +0 -0
  576. package/dist/web/assets/initial-deps-BeVJyoJH.js.br +0 -0
  577. package/dist/web/assets/initial-deps-BeVJyoJH.js.gz +0 -0
  578. package/dist/web/assets/initial-deps-CRaxZAOH.js +0 -41
  579. package/dist/web/assets/initial-deps-CRaxZAOH.js.br +0 -0
  580. package/dist/web/assets/initial-deps-CRaxZAOH.js.gz +0 -0
  581. package/dist/web/assets/initial-deps-CilSILfP.js.br +0 -0
  582. package/dist/web/assets/initial-deps-CilSILfP.js.gz +0 -0
  583. package/dist/web/assets/initial-deps-CyMAtgCd.js +0 -2
  584. package/dist/web/assets/initial-deps-CyMAtgCd.js.br +0 -0
  585. package/dist/web/assets/initial-deps-CyMAtgCd.js.gz +0 -0
  586. package/dist/web/assets/initial-deps-DNAUCF1H.js +0 -1
  587. package/dist/web/assets/initial-deps-DNAUCF1H.js.br +0 -0
  588. package/dist/web/assets/initial-deps-DNAUCF1H.js.gz +0 -0
  589. package/dist/web/assets/installed-skills-pane-Cp1c9O0j.js +0 -1
  590. package/dist/web/assets/installed-skills-pane-Cp1c9O0j.js.br +0 -0
  591. package/dist/web/assets/installed-skills-pane-Cp1c9O0j.js.gz +0 -0
  592. package/dist/web/assets/ishikawaDiagram-WSZJBQD7-CKSQLCKs.js.br +0 -0
  593. package/dist/web/assets/ishikawaDiagram-WSZJBQD7-CKSQLCKs.js.gz +0 -0
  594. package/dist/web/assets/kanban-definition-27J2QSJJ-Dy_spa9A.js.br +0 -0
  595. package/dist/web/assets/kanban-definition-27J2QSJJ-Dy_spa9A.js.gz +0 -0
  596. package/dist/web/assets/maximize-2-Fh0PepSo.js +0 -1
  597. package/dist/web/assets/maximize-2-Fh0PepSo.js.br +0 -0
  598. package/dist/web/assets/maximize-2-Fh0PepSo.js.gz +0 -0
  599. package/dist/web/assets/mcp-management-pane-C95hsTpS.js +0 -1
  600. package/dist/web/assets/mcp-management-pane-C95hsTpS.js.br +0 -0
  601. package/dist/web/assets/mcp-management-pane-C95hsTpS.js.gz +0 -0
  602. package/dist/web/assets/mermaid-GHXKKRXX-CVt2koup.js +0 -1
  603. package/dist/web/assets/mermaid-GHXKKRXX-CVt2koup.js.br +0 -0
  604. package/dist/web/assets/mermaid-GHXKKRXX-CVt2koup.js.gz +0 -0
  605. package/dist/web/assets/message-assistant-directive-DMoVi7q3.js +0 -3
  606. package/dist/web/assets/message-assistant-directive-DMoVi7q3.js.br +0 -0
  607. package/dist/web/assets/message-assistant-directive-DMoVi7q3.js.gz +0 -0
  608. package/dist/web/assets/message-response-BswwJ_0M.js +0 -151
  609. package/dist/web/assets/message-response-BswwJ_0M.js.br +0 -0
  610. package/dist/web/assets/message-response-BswwJ_0M.js.gz +0 -0
  611. package/dist/web/assets/mindmap-definition-FAOFIHXS-BT3bfYzH.js.br +0 -0
  612. package/dist/web/assets/mindmap-definition-FAOFIHXS-BT3bfYzH.js.gz +0 -0
  613. package/dist/web/assets/model-context-window-input-B1WfG4S_.js.br +0 -0
  614. package/dist/web/assets/model-context-window-input-B1WfG4S_.js.gz +0 -0
  615. package/dist/web/assets/official-plugin-sheet-DIa2udRz.js +0 -1
  616. package/dist/web/assets/official-plugin-sheet-DIa2udRz.js.br +0 -0
  617. package/dist/web/assets/official-plugin-sheet-DIa2udRz.js.gz +0 -0
  618. package/dist/web/assets/official-plugins-pane-DoRHj17k.js +0 -2
  619. package/dist/web/assets/official-plugins-pane-DoRHj17k.js.br +0 -0
  620. package/dist/web/assets/official-plugins-pane-DoRHj17k.js.gz +0 -0
  621. package/dist/web/assets/open-project-path-tkV3GG0_.js +0 -1
  622. package/dist/web/assets/open-project-path-tkV3GG0_.js.br +0 -0
  623. package/dist/web/assets/open-project-path-tkV3GG0_.js.gz +0 -0
  624. package/dist/web/assets/patch-diff-viewer-_6e4j2Xu.js.br +0 -0
  625. package/dist/web/assets/patch-diff-viewer-_6e4j2Xu.js.gz +0 -0
  626. package/dist/web/assets/pdf-preview-C7dU4MfB.js +0 -3
  627. package/dist/web/assets/pdf-preview-C7dU4MfB.js.br +0 -0
  628. package/dist/web/assets/pdf-preview-C7dU4MfB.js.gz +0 -0
  629. package/dist/web/assets/pegDiagram-VL7TDLO6-BDpdrr1s.js.br +0 -0
  630. package/dist/web/assets/pegDiagram-VL7TDLO6-BDpdrr1s.js.gz +0 -0
  631. package/dist/web/assets/personalization-settings-panel-Bn69EkZ8.js +0 -1
  632. package/dist/web/assets/personalization-settings-panel-Bn69EkZ8.js.br +0 -0
  633. package/dist/web/assets/personalization-settings-panel-Bn69EkZ8.js.gz +0 -0
  634. package/dist/web/assets/pieDiagram-7S7Q4E2Y-DCypkhSo.js.br +0 -0
  635. package/dist/web/assets/pieDiagram-7S7Q4E2Y-DCypkhSo.js.gz +0 -0
  636. package/dist/web/assets/project-file-popup-page-zQmKyPor.js.br +0 -0
  637. package/dist/web/assets/project-file-popup-page-zQmKyPor.js.gz +0 -0
  638. package/dist/web/assets/project-source-panel-B073gmHb.js +0 -2
  639. package/dist/web/assets/project-source-panel-B073gmHb.js.br +0 -0
  640. package/dist/web/assets/project-source-panel-B073gmHb.js.gz +0 -0
  641. package/dist/web/assets/prompt-input-CppQfZJu.js +0 -1
  642. package/dist/web/assets/prompt-input-CppQfZJu.js.br +0 -0
  643. package/dist/web/assets/prompt-input-CppQfZJu.js.gz +0 -0
  644. package/dist/web/assets/provider-connection-panel-stjpuDi-.js.br +0 -0
  645. package/dist/web/assets/provider-connection-panel-stjpuDi-.js.gz +0 -0
  646. package/dist/web/assets/provider-connection-queries-Bi1sUodL.js.br +0 -0
  647. package/dist/web/assets/provider-connection-queries-Bi1sUodL.js.gz +0 -0
  648. package/dist/web/assets/railroadDiagram-AXF67PYL-d16J9qzD.js.br +0 -0
  649. package/dist/web/assets/railroadDiagram-AXF67PYL-d16J9qzD.js.gz +0 -0
  650. package/dist/web/assets/requirementDiagram-LRYGKXZP-C9hUbT7e.js.br +0 -0
  651. package/dist/web/assets/requirementDiagram-LRYGKXZP-C9hUbT7e.js.gz +0 -0
  652. package/dist/web/assets/resources-en-yeMes3Ah.js +0 -1
  653. package/dist/web/assets/resources-en-yeMes3Ah.js.br +0 -0
  654. package/dist/web/assets/resources-en-yeMes3Ah.js.gz +0 -0
  655. package/dist/web/assets/scan-DYCzmZAH.js +0 -1
  656. package/dist/web/assets/scan-DYCzmZAH.js.br +0 -2
  657. package/dist/web/assets/scan-DYCzmZAH.js.gz +0 -0
  658. package/dist/web/assets/scheduled-task-date-time-picker-BDHyAcNa.js +0 -1
  659. package/dist/web/assets/scheduled-task-date-time-picker-BDHyAcNa.js.br +0 -0
  660. package/dist/web/assets/scheduled-task-date-time-picker-BDHyAcNa.js.gz +0 -0
  661. package/dist/web/assets/scheduled-task-floating-ui~scheduled-task-date-time-picker-cReLi3tI.js.br +0 -0
  662. package/dist/web/assets/scheduled-task-floating-ui~scheduled-task-date-time-picker-cReLi3tI.js.gz +0 -0
  663. package/dist/web/assets/scheduled-tasks-container-BrEi6mNO.js +0 -2
  664. package/dist/web/assets/scheduled-tasks-container-BrEi6mNO.js.br +0 -0
  665. package/dist/web/assets/scheduled-tasks-container-BrEi6mNO.js.gz +0 -0
  666. package/dist/web/assets/sequenceDiagram-SI44F4Z6-CGA84wrP.js.br +0 -0
  667. package/dist/web/assets/sequenceDiagram-SI44F4Z6-CGA84wrP.js.gz +0 -0
  668. package/dist/web/assets/server-DkIJGjQG.js +0 -1
  669. package/dist/web/assets/server-DkIJGjQG.js.br +0 -2
  670. package/dist/web/assets/server-DkIJGjQG.js.gz +0 -0
  671. package/dist/web/assets/settings-mutation-status-Dke6ycgH.js.br +0 -0
  672. package/dist/web/assets/settings-mutation-status-Dke6ycgH.js.gz +0 -0
  673. package/dist/web/assets/settings-save-status-CUoSP7m5.js +0 -1
  674. package/dist/web/assets/settings-save-status-CUoSP7m5.js.br +0 -0
  675. package/dist/web/assets/settings-save-status-CUoSP7m5.js.gz +0 -0
  676. package/dist/web/assets/shiki-bundle-DoOIe8qx.js.br +0 -2
  677. package/dist/web/assets/shiki-bundle-DoOIe8qx.js.gz +0 -0
  678. package/dist/web/assets/skills-market-container-PCo27WKC.js +0 -2
  679. package/dist/web/assets/skills-market-container-PCo27WKC.js.br +0 -0
  680. package/dist/web/assets/skills-market-container-PCo27WKC.js.gz +0 -0
  681. package/dist/web/assets/sliders-horizontal-DFgw0FeX.js +0 -1
  682. package/dist/web/assets/sliders-horizontal-DFgw0FeX.js.br +0 -0
  683. package/dist/web/assets/sliders-horizontal-DFgw0FeX.js.gz +0 -0
  684. package/dist/web/assets/split-workspace-menu-content-Co-x9yyy.js +0 -1
  685. package/dist/web/assets/split-workspace-menu-content-Co-x9yyy.js.br +0 -2
  686. package/dist/web/assets/split-workspace-menu-content-Co-x9yyy.js.gz +0 -0
  687. package/dist/web/assets/stateDiagram-OKZ733FA-D0MVn7g1.js.br +0 -0
  688. package/dist/web/assets/stateDiagram-OKZ733FA-D0MVn7g1.js.gz +0 -0
  689. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-TUsb_3yM.js.br +0 -0
  690. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-TUsb_3yM.js.gz +0 -0
  691. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-8Qb6Pp_Z.js.br +0 -0
  692. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-8Qb6Pp_Z.js.gz +0 -0
  693. package/dist/web/assets/task-timeline-process-history-CZep5llt.js.br +0 -0
  694. package/dist/web/assets/task-timeline-process-history-CZep5llt.js.gz +0 -0
  695. package/dist/web/assets/text-file-editor-CEKsFPli.js +0 -14
  696. package/dist/web/assets/text-file-editor-CEKsFPli.js.br +0 -0
  697. package/dist/web/assets/text-file-editor-CEKsFPli.js.gz +0 -0
  698. package/dist/web/assets/timeline-definition-Z64GVDOM-DRC7HLeH.js.br +0 -0
  699. package/dist/web/assets/timeline-definition-Z64GVDOM-DRC7HLeH.js.gz +0 -0
  700. package/dist/web/assets/upload-BypRc41z.js +0 -1
  701. package/dist/web/assets/upload-BypRc41z.js.br +0 -0
  702. package/dist/web/assets/upload-BypRc41z.js.gz +0 -0
  703. package/dist/web/assets/useMutationState-CuY6Z3bo.js.br +0 -0
  704. package/dist/web/assets/useMutationState-CuY6Z3bo.js.gz +0 -0
  705. package/dist/web/assets/utils-BjjzKOgD.js +0 -1
  706. package/dist/web/assets/utils-BjjzKOgD.js.br +0 -0
  707. package/dist/web/assets/utils-BjjzKOgD.js.gz +0 -0
  708. package/dist/web/assets/vennDiagram-T6HMQDX7-B5BRVmyv.js.br +0 -0
  709. package/dist/web/assets/vennDiagram-T6HMQDX7-B5BRVmyv.js.gz +0 -0
  710. package/dist/web/assets/wardleyDiagram-T6FBY63Y-BVuPKOmW.js.br +0 -0
  711. package/dist/web/assets/wardleyDiagram-T6FBY63Y-BVuPKOmW.js.gz +0 -0
  712. package/dist/web/assets/workbench-inspector-changes-C-xC1l-l.js +0 -1
  713. package/dist/web/assets/workbench-inspector-changes-C-xC1l-l.js.br +0 -0
  714. package/dist/web/assets/workbench-inspector-changes-C-xC1l-l.js.gz +0 -0
  715. package/dist/web/assets/workbench-pet-canvas-DfV_J-9g.js.br +0 -0
  716. package/dist/web/assets/workbench-pet-canvas-DfV_J-9g.js.gz +0 -0
  717. package/dist/web/assets/workbench-shell-BjJSD8dp.js +0 -17
  718. package/dist/web/assets/workbench-shell-BjJSD8dp.js.br +0 -0
  719. package/dist/web/assets/workbench-shell-BjJSD8dp.js.gz +0 -0
  720. package/dist/web/assets/xychartDiagram-ELKLHX3M-Cyq1aXDR.js.br +0 -0
  721. package/dist/web/assets/xychartDiagram-ELKLHX3M-Cyq1aXDR.js.gz +0 -0
  722. /package/dist/web/assets/{scheduled-task-floating-ui~index~workbench-shell~workbench-inspector-changes~project-source~dp1dands-ClgveiMa.js → scheduled-task-floating-ui~index~workbench-shell~workbench-inspector-changes~project-source~b4s77zfd-ClgveiMa.js} +0 -0
  723. /package/dist/web/assets/{scheduled-task-floating-ui~index~workbench-shell~workbench-inspector-changes~project-source~dp1dands-ClgveiMa.js.br → scheduled-task-floating-ui~index~workbench-shell~workbench-inspector-changes~project-source~b4s77zfd-ClgveiMa.js.br} +0 -0
  724. /package/dist/web/assets/{scheduled-task-floating-ui~index~workbench-shell~workbench-inspector-changes~project-source~dp1dands-ClgveiMa.js.gz → scheduled-task-floating-ui~index~workbench-shell~workbench-inspector-changes~project-source~b4s77zfd-ClgveiMa.js.gz} +0 -0
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/shiki-bundle-DoOIe8qx.js","assets/engine-compile-C-bb4peU.js","assets/lib-21LSAZ-l.js","assets/rolldown-runtime-B0Z9INg1.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./initial-deps-CqwWvUnY.js";import{i as n,t as r}from"./react-runtime-CMZHB3u8.js";import{tt as i}from"./initial-deps-CRaxZAOH.js";import{d as a,f as o,p as s}from"./pdf-preview-C7dU4MfB.js";import"./index-BUna2uyD.js";import{c,i as l,s as u,t as d}from"./engine-compile-C-bb4peU.js";import{l as f}from"./workbench-shell-BjJSD8dp.js";var p=`diffs-container`,m=/(?=^From [a-f0-9]+ .+$)/m,h=/(?=^diff --git)/gm,g=/^(---|\+\+\+)\s+([^\t\r\n]+)/,_=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,v=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,y=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,b=`header-prefix`,x=`header-metadata`,S=`header-custom`,C={dark:`pierre-dark`,light:`pierre-light`},w=`data-theme-css`,T=`data-unsafe-css`,E=`data-diffs-scrollbar-measure`,D=`--diffs-scrollbar-gutter-measured`,O=1e5,ee={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...ee});var te=Object.freeze({fromStart:0,fromEnd:0}),k={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},A={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function j(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 ne(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function re(e,t){let n=e?.theme??C,r=t?.theme??C,i=ie(e),a=ie(t);return ne(n,r)&&j(e,t,[`theme`,`parseDiffOptions`])&&j(i,a)}function ie(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function ae(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function M(e){return{type:`text`,value:e}}function N({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function P({name:e,width:t=16,height:n=16,properties:r}){return N({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[N({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function oe(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 se(e){return N({tagName:`div`,properties:{"data-gutter":``},children:e})}function ce(e,t,n,r={}){return N({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[N({tagName:`span`,properties:{"data-line-number-content":``},children:[M(`${t}`)]})]})}function F(e,t,n){return N({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 le(){return N({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[P({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function ue(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var de=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;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(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}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.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){let n=!(e===this.selectedRange||ae(e??void 0,this.selectedRange??void 0));(this.isSelectionDirty()||n)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}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&&Oe(e.composedPath())||(I(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)&&(I(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(I(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){I(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();I(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);I(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=ge(i)&&this.hoveredLine?.lineElement===i.lineElement;he(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),he(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),ge(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(ve(i)&&p!=null){p(i);break}if(_e(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!ge(i))break;he(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,I(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})()),I(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),I(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();Oe(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{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;let r=this.currentSelectionEnds(),i=r?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),a=r?.top??i;i!=null&&a!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:a,current:i},t&&(this.selectionAnchor={lineNumber:a.lineNumber,side:a.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let n=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.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(ue(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{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),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.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.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=c(le());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);me(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(xe(t));if(me(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(me(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(me(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&&Oe(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=xe(e);if(t&&Oe(n))return;let r=Se(e);return r==null?this.pathFromAnnotationSlot(e):xe(r)}pathFromAnnotationSlot(e){let t=we(Ce(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:xe(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Te(t)?t:Te(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)}ae(r??void 0,i??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,this.queuedSelectionRender??=requestAnimationFrame(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}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;let e=this.pre.querySelectorAll(`[data-selected-line]`);for(let t of e)t.removeAttribute(`data-selected-line`);if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;let{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let n=this.pre.getAttribute(`data-diff-type`)===`split`,r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),Error(`InteractionManager.renderSelection: No valid rowRange`);let i=r.start===r.end,a=Math.min(r.start,r.end),o=Math.max(r.start,r.end);for(let e of t){let[t,r]=e.children,s=r.children.length;if(s!==t.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);for(let e=0;e<s;e++){let s=r.children[e],c=t.children[e];if(!(s instanceof HTMLElement)||!(c instanceof HTMLElement))continue;let l=this.parseLineIndex(s,n);if((l??0)>o)break;if(l==null||l<a)continue;let u=i?`single`:l===a?`first`:l===o?`last`:``;s.setAttribute(`data-selected-line`,u),c.setAttribute(`data-selected-line`,u),c.nextSibling instanceof HTMLElement&&s.nextSibling instanceof HTMLElement&&(s.nextSibling.hasAttribute(`data-line-annotation`)||s.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(i?(u=`last`,s.setAttribute(`data-selected-line`,`first`)):l===a?u=``:l===o&&s.setAttribute(`data-selected-line`,``),s.nextSibling.setAttribute(`data-selected-line`,u),c.nextSibling.setAttribute(`data-selected-line`,u))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.getCurrentSelectionRange()??null)}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);ye(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=De(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=De(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:be(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:be(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:Ee(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:Ee(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 fe({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:pe({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 pe({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 me(e){return e!=null&&`kind`in e&&e.kind===`line`}function he(e){return e!=null&&`kind`in e&&e.kind===`token`}function ge(e){return me(e)||he(e)}function _e(e){return`type`in e&&e.type===`line-info`}function ve(e){return`kind`in e&&e.kind===`merge-conflict-action`}function ye(e){return e===`current`||e===`incoming`||e===`both`}function be(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function xe(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Se(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 Ce(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 we(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 Te(e){return e!=null&&typeof e.elementFromPoint==`function`}function Ee(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function De(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 Oe(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}function I(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 ke=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,t){let n=new Set,r=0,i=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(r===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;r++;let n=i.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 a=e.firstElementChild;a instanceof HTMLElement||(a=null),n==null?(n={type:`code`,codeElement:e,numberElement:a,codeWidth:`auto`,numberWidth:0},this.observedNodes.set(e,n),this.observe(e),a!=null&&(this.observedNodes.set(a,n),this.observe(a))):(this.observedNodes.set(e,n),i.delete(e),n.numberElement===a?n.numberElement==null?n.numberWidth=0:(i.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),i.delete(n.numberElement)),a!=null&&(this.observe(a),i.delete(a),this.observedNodes.set(a,n)),n.numberElement=a,n.numberWidth=0))}if(r>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),r=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 n=r.get(t);n??(n=[],r.set(t,n)),n.push(e)}for(let[e,t]of r){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[r,a]=t,o=r.firstElementChild,s=a.firstElementChild;if(!(r instanceof HTMLElement)||!(a instanceof HTMLElement)||!(o instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=i.get(o);if(c!=null){this.observedNodes.set(o,c),this.observedNodes.set(s,c),i.delete(o),i.delete(s);continue}let l=o.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:r,child:o,childHeight:l},column2:{container:a,child:s,childHeight:u},currentHeight:`auto`},n.add({child1:o,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of n)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);n.clear()}for(let[e,t]of i)this.unobserve(e),t.type===`code`?Me(t):Ne(t);i.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:Ae(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:je(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;if((i||a)&&(t.codeWidth=e,t.numberWidth=r,i&&t.codeElement.style.setProperty(`--diffs-column-width`,`${typeof e==`number`?`${e}px`:`auto`}`),a&&t.codeElement.style.setProperty(`--diffs-column-number-width`,`${r===0?`auto`:`${r}px`}`),i||a&&e!==`auto`)){let n=typeof e==`number`?Math.max(e-r,0):0;t.codeElement.style.setProperty(`--diffs-column-content-width`,`${n>0?`${n}px`:`auto`}`)}}};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 Ae(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function je(e){return Math.max(Math.ceil(e),0)}function Me(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`))}function Ne(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`)}var Pe=new Map,Fe=new Map,Ie=new Map,Le=new Set;function Re(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!Le.has(t))return!1;return!0}function ze(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(Le.has(n.name))continue;let e=Pe.get(n.name);e??(e=n,Pe.set(n.name,e)),Le.add(e.name),t.loadLanguageSync(e.data)}}function Be(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var Ve=s;async function He(e){let t=[];for(let n of e.langs??[]){if(n===`ansi`||n===`text`)continue;if(typeof n!=`string`){t.push(n);continue}let e=Ve[n];t.push((await e()).default)}return l({...e,engine:e.engine??d({forgiving:!0}),langs:t})}function Ue(){return d({forgiving:!0})}async function We(e){if(Be())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=Fe.get(e);if(t!=null)return t;try{let t=Ie.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Ve,e)&&(t=Ve[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 Pe.has(e)||Pe.set(e,n),n});return Fe.set(e,n),await n}finally{Fe.delete(e)}}function Ge(e){return Pe.get(e)??We(e)}var Ke=new Set;function qe(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Je=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},Ye=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Xe=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Ze(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Je(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 Ye(i));let c=r,l=s().then(e=>{let a=qe(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 Xe(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 L=Ze();function Qe(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=L.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,L.getResolvedTheme(n)??L.seedResolvedTheme(n,e);Ke.has(n)||(Ke.add(n),t.loadThemeSync(e))}}function $e(e){return`default`in e?e.default:e}function et(e){return{...e,load:async()=>u($e(await e.load()))}}function tt(e){let t=new Map(e.map(e=>[e.name,e]));return{getTheme:e=>t.get(e),getThemeNames:()=>e.map(e=>e.name),getThemes:()=>e,hasTheme:e=>t.has(e),orderBy:t=>tt([...e].sort(t)),pick:e=>tt(e.map(e=>{let n=t.get(e);if(n===void 0)throw Error(`Theme collection does not contain theme "${e}"`);return n})),registerInto:t=>{for(let n of e)t.registerThemeIfAbsent(n.name,n.load)}}}var nt=tt([]),rt=tt([et({collection:`shiki`,colorScheme:`light`,load:()=>t(()=>import(`./github-light-EUqPIrTm.js`),[]),name:`github-light`}),et({collection:`shiki`,colorScheme:`dark`,load:()=>t(()=>import(`./github-dark-C-LZuMrd.js`),[]),name:`github-dark`})]);function it(e){if(Be())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(L.hasRegisteredTheme(e))return;let t=rt.getTheme(e);if(t!=null){L.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function at(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function ot(e){it(e);let t=await L.resolveTheme(e);return at(e,t),t}function st(e){return L.getResolvedTheme(e)??ot(e)}var R;async function ct({themes:e,langs:n,preferredHighlighter:r=`shiki-js`}){R??=He({themes:[],langs:[`text`],engine:r===`shiki-wasm`?Ue(t(()=>import(`./shiki-bundle-DoOIe8qx.js`),__vite__mapDeps([0,1,2,3]))):d()});let i=ut(R)?await R:R;R=i;let a=[];for(let e of n){if(e===`text`||e===`ansi`)continue;let t=Ge(e);`then`in t?a.push(t):ze(t,i)}let o=[];for(let t of e){let e=st(t);`then`in e?o.push(e):Qe(e,R)}return(a.length>0||o.length>0)&&await Promise.all([Promise.all(a).then(e=>{ze(e,i)}),Promise.all(o).then(e=>{Qe(e,i)})]),i}function lt(){if(R!=null&&!(`then`in R))return R}function ut(e=R){return e!=null&&`then`in e}async function dt(e){await ct(e)}for(let e of nt.getThemes())L.registerThemeIfAbsent(e.name,e.load);function ft(e=C){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function pt(e){for(let t of ft(e))if(!Ke.has(t))return!1;return!0}function mt(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function ht(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 gt(e){return N({tagName:`div`,children:[N({tagName:`div`,children:e.annotations?.map(e=>N({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function _t(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 vt({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 N({tagName:`div`,children:[t===`custom`?N({tagName:`slot`,properties:{name:S}}):yt({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[bt(r)]],properties:i})}function yt({name:e,prevName:t,iconType:n}){let r=[N({tagName:`slot`,properties:{name:b}}),P({name:_t(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(N({tagName:`div`,children:[N({tagName:`bdi`,children:[M(t)]})],properties:{"data-prev-name":``}})),r.push(P({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(N({tagName:`div`,children:[N({tagName:`bdi`,children:[M(e)]})],properties:{"data-title":``}})),N({tagName:`div`,children:r,properties:{"data-header-content":``}})}function bt(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(N({tagName:`span`,children:[M(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(N({tagName:`span`,children:[M(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(N({tagName:`slot`,properties:{name:x}})),N({tagName:`div`,children:t,properties:{"data-metadata":``}})}function xt(e){return N({tagName:`pre`,properties:St(e)})}function St({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 z=new Map,Ct=0,wt={sh:`zsh`,bash:`zsh`,c:`c`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,css:`css`,diff:`diff`,patch:`diff`,env:`dotenv`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,go:`go`,graphql:`graphql`,gql:`graphql`,haml:`haml`,html:`html`,htm:`html`,ini:`ini`,cfg:`ini`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,lua:`lua`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,mdx:`mdx`,pm:`perl`,t:`perl`,php:`php`,phtml:`php`,sql:`sql`,pcss:`postcss`,properties:`properties`,py:`python`,pyw:`python`,pyi:`python`,rb:`ruby`,rbw:`ruby`,regex:`regexp`,rs:`rust`,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`,scss:`scss`,svelte:`svelte`,swift:`swift`,toml:`toml`,ts:`typescript`,tsx:`tsx`,vue:`vue`,xml:`xml`,yaml:`yaml`,yml:`yml`,zsh:`zsh`};function B(e){if(z.has(e))return z.get(e)??`text`;if(wt[e]!=null)return wt[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(z.has(t[1]))return z.get(t[1])??`text`;if(wt[t[1]]!=null)return wt[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return z.has(n)?z.get(n)??`text`:wt[n]??`text`}function Tt(e,t){let n=z.get(e);return n!==t&&(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),z.set(e,t),Ct++,!0)}function Et(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:ft(t),preferredHighlighter:n}}function V(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function H(e){return e.replace(/\n$|\r\n$/,``)}function Dt(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(M(`
3
- `)),e}var Ot=Symbol(`no-token`),kt=Symbol(`multiple-tokens`);function At(e){let t=jt(e);if(t!=null)return t;let n=Ot,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`){Nt(e,a);for(let t of e.children)Mt(t)}else Mt(e);r.push(e),i=[],a=void 0;return}for(let e of i)Mt(e);r.push(N({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Ot){if(e===kt){n=kt;return}if(n===Ot){n=e;return}n!==e&&(n=kt)}};for(let t of e.children){let e=t.type===`element`?At(t):Ot;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 jt(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Mt(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Mt(t)}}function Nt(e,t){e.properties[`data-char`]=t}function Pt(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=t+Ft(typeof e==`string`?e:a(e))+n;return o=r(o),i.has(o)||i.set(o,typeof e==`string`?e:{...e}),o}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 Ft(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 It(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=oe(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&At(a),i.push(Dt(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(Rt,Lt),{state:n,transformers:r,toClass:Lt}}var Lt=Pt({classPrefix:`hl-`}),Rt={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 U(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var zt=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Bt=/^0(?:\.0+)?%?$/;function Vt(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 Ht(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 Ut(e){if(e==null)return null;let t=Ht(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 Wt(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||zt.test(t))return!0;let n=Vt(t);return n!=null&&Bt.test(n)}function Gt(e,t,n){if(t==null||n==null)return!1;let r=Ut(e),i=Ut(t),a=Ut(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Kt=new WeakMap;function qt(e){let t=Kt.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;W(r,`editor.background`,i),W(r,`editor.foreground`,a),W(r,`sideBar.background`,o),W(r,`sideBar.foreground`,s),W(r,`input.background`,n[`input.background`]??o),W(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),W(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),W(r,`gitDecoration.addedResourceForeground`,Jt(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),W(r,`gitDecoration.modifiedResourceForeground`,Jt(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),W(r,`gitDecoration.deletedResourceForeground`,Jt(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Wt(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Wt(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Yt(l,o)||Gt(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Kt.set(e,u),u}function W(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Jt(...e){for(let t of e)if(t!=null&&t!==``)return t}function Yt(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Xt({theme:e=C,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=qt(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${U(`global`)}fg:${a.fg};`,r+=`${U(`global`)}bg:${a.bg};`,r+=Zt(i,n)}else{let n=t.getTheme(e.dark),i=qt(n);r+=`${U(`global`)}dark:${i.fg};`,r+=`${U(`global`)}dark-bg:${i.bg};`,r+=Zt(n,`dark`),n=t.getTheme(e.light),i=qt(n),r+=`${U(`global`)}light:${i.fg};`,r+=`${U(`global`)}light-bg:${i.bg};`,r+=Zt(n,`light`)}return r}function Zt(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${U(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${U(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${U(`global`)}${t}modified-color:${a};`),n}function Qt(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 $t=`-1,-1`;function en(e){return e?.some(e=>e.lineNumber===0)??!1}function tn(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function nn(e){return e.startingLine===0&&e.totalLines>0}function rn(e,t){return N({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function an(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}var on=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/shiki-bundle-BuVlco8m.js","assets/engine-compile-C-bb4peU.js","assets/lib-21LSAZ-l.js","assets/rolldown-runtime-B0Z9INg1.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./initial-deps-CqwWvUnY.js";import{i as n,t as r}from"./react-runtime-CMZHB3u8.js";import{G as i}from"./initial-deps-DGiIFgQX.js";import{it as a}from"./initial-deps-ZpffyCug.js";import{h as o,m as s,p as c}from"./document-navigation-Da1q1H1O.js";import"./index-CE2J7Z4y.js";import{c as l,i as u,s as d,t as f}from"./engine-compile-C-bb4peU.js";import{l as p}from"./workbench-shell-CR4teS_d.js";var m=`diffs-container`,h=/(?=^From [a-f0-9]+ .+$)/m,g=/(?=^diff --git)/gm,_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,v=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,y=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,b=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,x=`header-prefix`,S=`header-metadata`,C=`header-custom`,w={dark:`pierre-dark`,light:`pierre-light`},T=`data-theme-css`,E=`data-unsafe-css`,D=`data-diffs-scrollbar-measure`,O=`--diffs-scrollbar-gutter-measured`,ee=1e5,k={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...k});var A=Object.freeze({fromStart:0,fromEnd:0}),j={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},te={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function ne(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 M(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function re(e,t){let n=e?.theme??w,r=t?.theme??w,i=ie(e),a=ie(t);return M(n,r)&&ne(e,t,[`theme`,`parseDiffOptions`])&&ne(i,a)}function ie(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function ae(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function N(e){return{type:`text`,value:e}}function P({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function oe({name:e,width:t=16,height:n=16,properties:r}){return P({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[P({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function se(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 ce(e){return P({tagName:`div`,properties:{"data-gutter":``},children:e})}function le(e,t,n,r={}){return P({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[P({tagName:`span`,properties:{"data-line-number-content":``},children:[N(`${t}`)]})]})}function F(e,t,n){return P({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 ue(){return P({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[oe({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function de(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var fe=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;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(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}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.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){let n=!(e===this.selectedRange||ae(e??void 0,this.selectedRange??void 0));(this.isSelectionDirty()||n)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}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&&ke(e.composedPath())||(I(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)&&(I(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(I(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){I(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();I(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);I(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=_e(i)&&this.hoveredLine?.lineElement===i.lineElement;ge(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),ge(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),_e(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(ye(i)&&p!=null){p(i);break}if(ve(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!_e(i))break;ge(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,I(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})()),I(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),I(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();ke(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{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;let r=this.currentSelectionEnds(),i=r?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),a=r?.top??i;i!=null&&a!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:a,current:i},t&&(this.selectionAnchor={lineNumber:a.lineNumber,side:a.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let n=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.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(de(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{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),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.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.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=l(ue());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);he(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(Se(t));if(he(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(he(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(he(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&&ke(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Se(e);if(t&&ke(n))return;let r=Ce(e);return r==null?this.pathFromAnnotationSlot(e):Se(r)}pathFromAnnotationSlot(e){let t=Te(we(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:Se(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Ee(t)?t:Ee(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)}ae(r??void 0,i??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,this.queuedSelectionRender??=requestAnimationFrame(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}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;let e=this.pre.querySelectorAll(`[data-selected-line]`);for(let t of e)t.removeAttribute(`data-selected-line`);if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;let{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let n=this.pre.getAttribute(`data-diff-type`)===`split`,r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),Error(`InteractionManager.renderSelection: No valid rowRange`);let i=r.start===r.end,a=Math.min(r.start,r.end),o=Math.max(r.start,r.end);for(let e of t){let[t,r]=e.children,s=r.children.length;if(s!==t.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);for(let e=0;e<s;e++){let s=r.children[e],c=t.children[e];if(!(s instanceof HTMLElement)||!(c instanceof HTMLElement))continue;let l=this.parseLineIndex(s,n);if((l??0)>o)break;if(l==null||l<a)continue;let u=i?`single`:l===a?`first`:l===o?`last`:``;s.setAttribute(`data-selected-line`,u),c.setAttribute(`data-selected-line`,u),c.nextSibling instanceof HTMLElement&&s.nextSibling instanceof HTMLElement&&(s.nextSibling.hasAttribute(`data-line-annotation`)||s.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(i?(u=`last`,s.setAttribute(`data-selected-line`,`first`)):l===a?u=``:l===o&&s.setAttribute(`data-selected-line`,``),s.nextSibling.setAttribute(`data-selected-line`,u),c.nextSibling.setAttribute(`data-selected-line`,u))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.getCurrentSelectionRange()??null)}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);be(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=Oe(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=Oe(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:xe(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:xe(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:De(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:De(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 pe({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:me({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 me({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 he(e){return e!=null&&`kind`in e&&e.kind===`line`}function ge(e){return e!=null&&`kind`in e&&e.kind===`token`}function _e(e){return he(e)||ge(e)}function ve(e){return`type`in e&&e.type===`line-info`}function ye(e){return`kind`in e&&e.kind===`merge-conflict-action`}function be(e){return e===`current`||e===`incoming`||e===`both`}function xe(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Se(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Ce(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 we(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 Te(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 Ee(e){return e!=null&&typeof e.elementFromPoint==`function`}function De(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Oe(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 ke(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}function I(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 Ae=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,t){let n=new Set,r=0,i=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(r===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;r++;let n=i.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 a=e.firstElementChild;a instanceof HTMLElement||(a=null),n==null?(n={type:`code`,codeElement:e,numberElement:a,codeWidth:`auto`,numberWidth:0},this.observedNodes.set(e,n),this.observe(e),a!=null&&(this.observedNodes.set(a,n),this.observe(a))):(this.observedNodes.set(e,n),i.delete(e),n.numberElement===a?n.numberElement==null?n.numberWidth=0:(i.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),i.delete(n.numberElement)),a!=null&&(this.observe(a),i.delete(a),this.observedNodes.set(a,n)),n.numberElement=a,n.numberWidth=0))}if(r>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),r=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 n=r.get(t);n??(n=[],r.set(t,n)),n.push(e)}for(let[e,t]of r){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[r,a]=t,o=r.firstElementChild,s=a.firstElementChild;if(!(r instanceof HTMLElement)||!(a instanceof HTMLElement)||!(o instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=i.get(o);if(c!=null){this.observedNodes.set(o,c),this.observedNodes.set(s,c),i.delete(o),i.delete(s);continue}let l=o.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:r,child:o,childHeight:l},column2:{container:a,child:s,childHeight:u},currentHeight:`auto`},n.add({child1:o,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of n)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);n.clear()}for(let[e,t]of i)this.unobserve(e),t.type===`code`?Ne(t):Pe(t);i.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:je(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Me(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;if((i||a)&&(t.codeWidth=e,t.numberWidth=r,i&&t.codeElement.style.setProperty(`--diffs-column-width`,`${typeof e==`number`?`${e}px`:`auto`}`),a&&t.codeElement.style.setProperty(`--diffs-column-number-width`,`${r===0?`auto`:`${r}px`}`),i||a&&e!==`auto`)){let n=typeof e==`number`?Math.max(e-r,0):0;t.codeElement.style.setProperty(`--diffs-column-content-width`,`${n>0?`${n}px`:`auto`}`)}}};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 je(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Me(e){return Math.max(Math.ceil(e),0)}function Ne(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`))}function Pe(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`)}var Fe=new Map,Ie=new Map,Le=new Map,Re=new Set;function ze(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!Re.has(t))return!1;return!0}function Be(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(Re.has(n.name))continue;let e=Fe.get(n.name);e??(e=n,Fe.set(n.name,e)),Re.add(e.name),t.loadLanguageSync(e.data)}}function Ve(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var He=o;async function Ue(e){let t=[];for(let n of e.langs??[]){if(n===`ansi`||n===`text`)continue;if(typeof n!=`string`){t.push(n);continue}let e=He[n];t.push((await e()).default)}return u({...e,engine:e.engine??f({forgiving:!0}),langs:t})}function We(){return f({forgiving:!0})}async function Ge(e){if(Ve())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=Ie.get(e);if(t!=null)return t;try{let t=Le.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(He,e)&&(t=He[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 Fe.has(e)||Fe.set(e,n),n});return Ie.set(e,n),await n}finally{Ie.delete(e)}}function Ke(e){return Fe.get(e)??Ge(e)}var qe=new Set;function Je(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Ye=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},Xe=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Ze=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Qe(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Ye(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 Xe(i));let c=r,l=s().then(e=>{let a=Je(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 Ze(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 L=Qe();function $e(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=L.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,L.getResolvedTheme(n)??L.seedResolvedTheme(n,e);qe.has(n)||(qe.add(n),t.loadThemeSync(e))}}function et(e){return`default`in e?e.default:e}function tt(e){return{...e,load:async()=>d(et(await e.load()))}}function nt(e){let t=new Map(e.map(e=>[e.name,e]));return{getTheme:e=>t.get(e),getThemeNames:()=>e.map(e=>e.name),getThemes:()=>e,hasTheme:e=>t.has(e),orderBy:t=>nt([...e].sort(t)),pick:e=>nt(e.map(e=>{let n=t.get(e);if(n===void 0)throw Error(`Theme collection does not contain theme "${e}"`);return n})),registerInto:t=>{for(let n of e)t.registerThemeIfAbsent(n.name,n.load)}}}var rt=nt([]),it=nt([tt({collection:`shiki`,colorScheme:`light`,load:()=>t(()=>import(`./github-light-EUqPIrTm.js`),[]),name:`github-light`}),tt({collection:`shiki`,colorScheme:`dark`,load:()=>t(()=>import(`./github-dark-C-LZuMrd.js`),[]),name:`github-dark`})]);function at(e){if(Ve())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(L.hasRegisteredTheme(e))return;let t=it.getTheme(e);if(t!=null){L.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function ot(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function st(e){at(e);let t=await L.resolveTheme(e);return ot(e,t),t}function ct(e){return L.getResolvedTheme(e)??st(e)}var R;async function lt({themes:e,langs:n,preferredHighlighter:r=`shiki-js`}){R??=Ue({themes:[],langs:[`text`],engine:r===`shiki-wasm`?We(t(()=>import(`./shiki-bundle-BuVlco8m.js`),__vite__mapDeps([0,1,2,3]))):f()});let i=dt(R)?await R:R;R=i;let a=[];for(let e of n){if(e===`text`||e===`ansi`)continue;let t=Ke(e);`then`in t?a.push(t):Be(t,i)}let o=[];for(let t of e){let e=ct(t);`then`in e?o.push(e):$e(e,R)}return(a.length>0||o.length>0)&&await Promise.all([Promise.all(a).then(e=>{Be(e,i)}),Promise.all(o).then(e=>{$e(e,i)})]),i}function ut(){if(R!=null&&!(`then`in R))return R}function dt(e=R){return e!=null&&`then`in e}async function ft(e){await lt(e)}for(let e of rt.getThemes())L.registerThemeIfAbsent(e.name,e.load);function pt(e=w){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function mt(e){for(let t of pt(e))if(!qe.has(t))return!1;return!0}function ht(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function gt(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 _t(e){return P({tagName:`div`,children:[P({tagName:`div`,children:e.annotations?.map(e=>P({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function vt(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 yt({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 P({tagName:`div`,children:[t===`custom`?P({tagName:`slot`,properties:{name:C}}):bt({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[xt(r)]],properties:i})}function bt({name:e,prevName:t,iconType:n}){let r=[P({tagName:`slot`,properties:{name:x}}),oe({name:vt(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(P({tagName:`div`,children:[P({tagName:`bdi`,children:[N(t)]})],properties:{"data-prev-name":``}})),r.push(oe({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(P({tagName:`div`,children:[P({tagName:`bdi`,children:[N(e)]})],properties:{"data-title":``}})),P({tagName:`div`,children:r,properties:{"data-header-content":``}})}function xt(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(P({tagName:`span`,children:[N(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(P({tagName:`span`,children:[N(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(P({tagName:`slot`,properties:{name:S}})),P({tagName:`div`,children:t,properties:{"data-metadata":``}})}function St(e){return P({tagName:`pre`,properties:Ct(e)})}function Ct({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 z=new Map,wt=0,Tt={sh:`zsh`,bash:`zsh`,c:`c`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,css:`css`,diff:`diff`,patch:`diff`,env:`dotenv`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,go:`go`,graphql:`graphql`,gql:`graphql`,haml:`haml`,html:`html`,htm:`html`,ini:`ini`,cfg:`ini`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,lua:`lua`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,mdx:`mdx`,pm:`perl`,t:`perl`,php:`php`,phtml:`php`,sql:`sql`,pcss:`postcss`,properties:`properties`,py:`python`,pyw:`python`,pyi:`python`,rb:`ruby`,rbw:`ruby`,regex:`regexp`,rs:`rust`,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`,scss:`scss`,svelte:`svelte`,swift:`swift`,toml:`toml`,ts:`typescript`,tsx:`tsx`,vue:`vue`,xml:`xml`,yaml:`yaml`,yml:`yml`,zsh:`zsh`};function B(e){if(z.has(e))return z.get(e)??`text`;if(Tt[e]!=null)return Tt[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(z.has(t[1]))return z.get(t[1])??`text`;if(Tt[t[1]]!=null)return Tt[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return z.has(n)?z.get(n)??`text`:Tt[n]??`text`}function Et(e,t){let n=z.get(e);return n!==t&&(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),z.set(e,t),wt++,!0)}function Dt(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:pt(t),preferredHighlighter:n}}function V(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function H(e){return e.replace(/\n$|\r\n$/,``)}function Ot(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(N(`
3
+ `)),e}var kt=Symbol(`no-token`),At=Symbol(`multiple-tokens`);function jt(e){let t=Mt(e);if(t!=null)return t;let n=kt,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`){Pt(e,a);for(let t of e.children)Nt(t)}else Nt(e);r.push(e),i=[],a=void 0;return}for(let e of i)Nt(e);r.push(P({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==kt){if(e===At){n=At;return}if(n===kt){n=e;return}n!==e&&(n=At)}};for(let t of e.children){let e=t.type===`element`?jt(t):kt;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 Mt(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Nt(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Nt(t)}}function Pt(e,t){e.properties[`data-char`]=t}function Ft(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=t+It(typeof e==`string`?e:a(e))+n;return o=r(o),i.has(o)||i.set(o,typeof e==`string`?e:{...e}),o}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 It(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 Lt(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=se(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&jt(a),i.push(Ot(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(zt,Rt),{state:n,transformers:r,toClass:Rt}}var Rt=Ft({classPrefix:`hl-`}),zt={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 U(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var Bt=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Vt=/^0(?:\.0+)?%?$/;function Ht(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 Ut(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 Wt(e){if(e==null)return null;let t=Ut(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 Gt(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Bt.test(t))return!0;let n=Ht(t);return n!=null&&Vt.test(n)}function Kt(e,t,n){if(t==null||n==null)return!1;let r=Wt(e),i=Wt(t),a=Wt(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var qt=new WeakMap;function Jt(e){let t=qt.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;W(r,`editor.background`,i),W(r,`editor.foreground`,a),W(r,`sideBar.background`,o),W(r,`sideBar.foreground`,s),W(r,`input.background`,n[`input.background`]??o),W(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),W(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),W(r,`gitDecoration.addedResourceForeground`,Yt(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),W(r,`gitDecoration.modifiedResourceForeground`,Yt(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),W(r,`gitDecoration.deletedResourceForeground`,Yt(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Gt(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Gt(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Xt(l,o)||Kt(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return qt.set(e,u),u}function W(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Yt(...e){for(let t of e)if(t!=null&&t!==``)return t}function Xt(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Zt({theme:e=w,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Jt(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${U(`global`)}fg:${a.fg};`,r+=`${U(`global`)}bg:${a.bg};`,r+=Qt(i,n)}else{let n=t.getTheme(e.dark),i=Jt(n);r+=`${U(`global`)}dark:${i.fg};`,r+=`${U(`global`)}dark-bg:${i.bg};`,r+=Qt(n,`dark`),n=t.getTheme(e.light),i=Jt(n),r+=`${U(`global`)}light:${i.fg};`,r+=`${U(`global`)}light-bg:${i.bg};`,r+=Qt(n,`light`)}return r}function Qt(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${U(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${U(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${U(`global`)}${t}modified-color:${a};`),n}function $t(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 en=`-1,-1`;function tn(e){return e?.some(e=>e.lineNumber===0)??!1}function nn(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function rn(e){return e.startingLine===0&&e.totalLines>0}function an(e,t){return P({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function on(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}var sn=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
4
4
  <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
5
5
  <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"/>
6
6
  </symbol>
@@ -52,7 +52,7 @@ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./initial-deps-
52
52
  <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
53
53
  <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"/>
54
54
  </symbol>
55
- </svg>`;function sn(e,t){return e==null||t==null?e===t:ln(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 cn={};function ln(e=cn,t=cn){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 un(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function dn(){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 fn(){let e=document.createElement(`style`);return e.setAttribute(T,``),e}var pn=`@layer base {
55
+ </svg>`;function cn(e,t){return e==null||t==null?e===t:un(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 ln={};function un(e=ln,t=ln){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 dn(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function fn(){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 pn(){let e=document.createElement(`style`);return e.setAttribute(E,``),e}var mn=`@layer base {
56
56
  :host {
57
57
  --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
58
58
  "Courier New", monospace;
@@ -1371,39 +1371,39 @@ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./initial-deps-
1371
1371
  }
1372
1372
 
1373
1373
  @layer theme, rendered, unsafe;
1374
- `,mn;function hn(e){if(mn!=null)return mn;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(E,`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),mn=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),mn}function gn(e){return`${D}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var _n=`@layer base, theme, rendered, unsafe;`,vn=RegExp(`${Sn(D)}\\s*:\\s*[^;]+;`);function yn(e){return`${_n}
1374
+ `,hn;function gn(e){if(hn!=null)return hn;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(D,`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),hn=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),hn}function _n(e){return`${O}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var vn=`@layer base, theme, rendered, unsafe;`,yn=RegExp(`${Cn(O)}\\s*:\\s*[^;]+;`);function bn(e){return`${vn}
1375
1375
  @layer unsafe {
1376
1376
  ${e}
1377
- }`}function bn(e,t=`system`,n){return`${_n}
1377
+ }`}function xn(e,t=`system`,n){return`${vn}
1378
1378
  @layer rendered {
1379
1379
  :host {${t===`system`?``:`
1380
1380
  color-scheme: ${t};`}
1381
- ${gn(n)}
1381
+ ${_n(n)}
1382
1382
  ${e}
1383
1383
  }
1384
- }`}function xn(e,t){let n=gn(t);return e.replace(vn,n)}function Sn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Cn({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 wn(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Tn(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 En(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function Dn({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=On(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function On(){let e=document.createElement(`style`);return e.setAttribute(w,``),e}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(pn)),t.adoptedStyleSheets=[e]}connectedCallback(){hn(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(p,t)}function kn(e){return{...ee,...e}}function G(e,t){let n=An(e,t);return t?n:e.diffHeaderHeight+n}function An(e,t){return e.paddingTop??(t?e.spacing:0)}function jn(e){return e.paddingBottom??e.spacing}function Mn(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function Nn(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}var Pn=new TextEncoder,Fn=new TextDecoder(`utf-8`,{ignoreBOM:!0}),In=/[\uD800-\uDFFF]/,Ln=1024,K=new Uint8Array(Ln);function Rn(){K.length!==Ln&&(K=new Uint8Array(Ln))}function q(e){if(e.length===0)return e;if(In.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;K.length<t&&(K=new Uint8Array(t));let{written:n}=Pn.encodeInto(e,K);return Fn.decode(K.subarray(0,n))}function zn(e,t,n){try{return Bn(e,t,n)}finally{Rn()}}function Bn(e,t,n=!1){let r=ir(e),i=r?qn(e):Jn(e),a,o=[];for(let e of i){if(r&&!h.test(e)){if(a==null)a=q(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!r&&!Yn(e)){if(a==null)a=q(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=Hn(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function Vn(e,t){try{return Hn(e,t)}finally{Rn()}}function Hn(e,{cacheKey:t,isGitDiff:n=h.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=ar(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Kn(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=tr(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?Gn(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Gn(r.contents):[],cacheKey:sr(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(v),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=q(r.trim()),n!==r&&(c.prevName=q(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?_:g):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=q(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=q(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=q(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=q(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=q(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=q(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(y)??[];t!=null&&(c.prevObjectId=q(t)),n!=null&&(c.newObjectId=q(n)),r!=null&&(c.mode=q(r))}e.startsWith(`rename from `)&&(c.prevName=q(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=q(e.slice(10).trim()))}}continue}let b,x;for(;s.length>0&&(s[s.length-1]===`
1384
+ }`}function Sn(e,t){let n=_n(t);return e.replace(yn,n)}function Cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function wn({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 Tn(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function En(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 Dn(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function On({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=kn(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function kn(){let e=document.createElement(`style`);return e.setAttribute(T,``),e}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(mn)),t.adoptedStyleSheets=[e]}connectedCallback(){gn(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(m,t)}function An(e){return{...k,...e}}function G(e,t){let n=jn(e,t);return t?n:e.diffHeaderHeight+n}function jn(e,t){return e.paddingTop??(t?e.spacing:0)}function Mn(e){return e.paddingBottom??e.spacing}function Nn(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function Pn(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}var Fn=new TextEncoder,In=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ln=/[\uD800-\uDFFF]/,Rn=1024,K=new Uint8Array(Rn);function zn(){K.length!==Rn&&(K=new Uint8Array(Rn))}function q(e){if(e.length===0)return e;if(Ln.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;K.length<t&&(K=new Uint8Array(t));let{written:n}=Fn.encodeInto(e,K);return In.decode(K.subarray(0,n))}function Bn(e,t,n){try{return Vn(e,t,n)}finally{zn()}}function Vn(e,t,n=!1){let r=ar(e),i=r?Jn(e):Yn(e),a,o=[];for(let e of i){if(r&&!g.test(e)){if(a==null)a=q(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!r&&!Xn(e)){if(a==null)a=q(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=Un(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function Hn(e,t){try{return Un(e,t)}finally{zn()}}function Un(e,{cacheKey:t,isGitDiff:n=g.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=or(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=qn(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=nr(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?Kn(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Kn(r.contents):[],cacheKey:cr(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(y),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=q(r.trim()),n!==r&&(c.prevName=q(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?v:_):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=q(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=q(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=q(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=q(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=q(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=q(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(b)??[];t!=null&&(c.prevObjectId=q(t)),n!=null&&(c.newObjectId=q(n)),r!=null&&(c.mode=q(r))}e.startsWith(`rename from `)&&(c.prevName=q(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=q(e.slice(10).trim()))}}continue}let g,x;for(;s.length>0&&(s[s.length-1]===`
1385
1385
  `||s[s.length-1]===`\r`||s[s.length-1]===`\r
1386
- `||s[s.length-1]===``);)s.pop();let{additionStart:S,deletionStart:C}=p;u=l?u:C-1,d=l?d:S-1;let w={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:S,additionLines:m,deletionCount:p.deletionCount,deletionStart:C,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:sr(p.hunkContext),hunkSpecs:q(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},T=0,E=0;for(let e=1;e<s.length;e++){let t=s[e];if(T>=w.additionCount&&E>=w.deletionCount&&!t.startsWith(`\\`)){if(a&&$n(t)&&!er(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}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=cr(n);if(r===`addition`){if(a&&T>=w.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=lr(t);(b==null||b.type!==`change`)&&(b=ur(`change`,u,d),w.hunkContent.push(b)),d++,T++,l&&c.additionLines.push(e),b.additions++,m++,x=`addition`}else if(r===`deletion`){if(a&&E>=w.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=lr(t);(b==null||b.type!==`change`)&&(b=ur(`change`,u,d),w.hunkContent.push(b)),u++,E++,l&&c.deletionLines.push(e),b.deletions++,h++,x=`deletion`}else if(r===`context`){if(a&&(E>=w.deletionCount||T>=w.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=lr(t);(b==null||b.type!==`context`)&&(b=ur(`context`,u,d),w.hunkContent.push(b)),d++,u++,T++,E++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),b.lines++,x=`context`}else if(r===`metadata`&&b!=null){if(b.type===`context`?(w.noEOFCRAdditions=!0,w.noEOFCRDeletions=!0):x===`deletion`?w.noEOFCRDeletions=!0:x===`addition`&&(w.noEOFCRAdditions=!0),l&&(x===`addition`||x===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=H(c.additionLines[e]))}if(l&&(x===`deletion`||x===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=H(c.deletionLines[e]))}}}if(a&&(T!==w.additionCount||E!==w.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);w.additionLines=m,w.deletionLines=h,w.collapsedBefore=Math.max(w.additionStart-1-o,0),c.hunks.push(w),o=w.additionStart+w.additionCount-1;for(let e of w.hunkContent)e.type===`context`?(w.splitLineCount+=e.lines,w.unifiedLineCount+=e.lines):(w.splitLineCount+=Math.max(e.additions,e.deletions),w.unifiedLineCount+=e.deletions+e.additions);w.splitLineStart=c.splitLineCount+w.collapsedBefore,w.unifiedLineStart=c.unifiedLineCount+w.collapsedBefore,c.splitLineCount+=w.collapsedBefore+w.splitLineCount,c.unifiedLineCount+=w.collapsedBefore+w.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=e.additionStart+e.additionCount-1,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),c}}function Un(e,t,n=!1){let r=[],i=Wn(e)?e.split(m):[e];for(let e of i)try{r.push(zn(e,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function Wn(e){return e.startsWith(`From `)||e.includes(`
1387
- From `)}function Gn(e){let t=Kn(e);for(let e=0;e<t.length;e++)t[e]=q(t[e]);return t}function Kn(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1388
- `,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 qn(e){return ar(e,`diff --git`)}function Jn(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=Qn(e,r);if(i<=0&&a<=0){if(Xn(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=Qn(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=tr(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 Yn(e){return Xn(e,0)}function Xn(e,t){let n=Qn(e,t);return Zn(e,t,`---`)&&Zn(e,n,`+++`)}function Zn(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===`
1389
- `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function Qn(e,t){let n=e.indexOf(`
1390
- `,t);return n===-1?e.length:n+1}function $n(e){let t=e[0];return t===`+`||t===`-`||t===` `}function er(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1391
- `&&n!==`\r`)return!1}return!0}function tr(e){if(!e.startsWith(`@@ -`))return;let t=4,n=nr(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=nr(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=nr(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=nr(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=rr(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function nr(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 rr(e){return e.endsWith(`\r
1386
+ `||s[s.length-1]===``);)s.pop();let{additionStart:S,deletionStart:C}=p;u=l?u:C-1,d=l?d:S-1;let w={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:S,additionLines:m,deletionCount:p.deletionCount,deletionStart:C,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:cr(p.hunkContext),hunkSpecs:q(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},T=0,E=0;for(let e=1;e<s.length;e++){let t=s[e];if(T>=w.additionCount&&E>=w.deletionCount&&!t.startsWith(`\\`)){if(a&&er(t)&&!tr(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}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=lr(n);if(r===`addition`){if(a&&T>=w.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=ur(t);(g==null||g.type!==`change`)&&(g=dr(`change`,u,d),w.hunkContent.push(g)),d++,T++,l&&c.additionLines.push(e),g.additions++,m++,x=`addition`}else if(r===`deletion`){if(a&&E>=w.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=ur(t);(g==null||g.type!==`change`)&&(g=dr(`change`,u,d),w.hunkContent.push(g)),u++,E++,l&&c.deletionLines.push(e),g.deletions++,h++,x=`deletion`}else if(r===`context`){if(a&&(E>=w.deletionCount||T>=w.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=ur(t);(g==null||g.type!==`context`)&&(g=dr(`context`,u,d),w.hunkContent.push(g)),d++,u++,T++,E++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,x=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(w.noEOFCRAdditions=!0,w.noEOFCRDeletions=!0):x===`deletion`?w.noEOFCRDeletions=!0:x===`addition`&&(w.noEOFCRAdditions=!0),l&&(x===`addition`||x===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=H(c.additionLines[e]))}if(l&&(x===`deletion`||x===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=H(c.deletionLines[e]))}}}if(a&&(T!==w.additionCount||E!==w.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);w.additionLines=m,w.deletionLines=h,w.collapsedBefore=Math.max(w.additionStart-1-o,0),c.hunks.push(w),o=w.additionStart+w.additionCount-1;for(let e of w.hunkContent)e.type===`context`?(w.splitLineCount+=e.lines,w.unifiedLineCount+=e.lines):(w.splitLineCount+=Math.max(e.additions,e.deletions),w.unifiedLineCount+=e.deletions+e.additions);w.splitLineStart=c.splitLineCount+w.collapsedBefore,w.unifiedLineStart=c.unifiedLineCount+w.collapsedBefore,c.splitLineCount+=w.collapsedBefore+w.splitLineCount,c.unifiedLineCount+=w.collapsedBefore+w.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=e.additionStart+e.additionCount-1,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),c}}function Wn(e,t,n=!1){let r=[],i=Gn(e)?e.split(h):[e];for(let e of i)try{r.push(Bn(e,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function Gn(e){return e.startsWith(`From `)||e.includes(`
1387
+ From `)}function Kn(e){let t=qn(e);for(let e=0;e<t.length;e++)t[e]=q(t[e]);return t}function qn(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1388
+ `,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 Jn(e){return or(e,`diff --git`)}function Yn(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=$n(e,r);if(i<=0&&a<=0){if(Zn(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=$n(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=nr(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 Xn(e){return Zn(e,0)}function Zn(e,t){let n=$n(e,t);return Qn(e,t,`---`)&&Qn(e,n,`+++`)}function Qn(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===`
1389
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function $n(e,t){let n=e.indexOf(`
1390
+ `,t);return n===-1?e.length:n+1}function er(e){let t=e[0];return t===`+`||t===`-`||t===` `}function tr(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1391
+ `&&n!==`\r`)return!1}return!0}function nr(e){if(!e.startsWith(`@@ -`))return;let t=4,n=rr(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=rr(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=rr(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=rr(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=ir(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function rr(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 ir(e){return e.endsWith(`\r
1392
1392
  `)?e.slice(0,-2):e.endsWith(`
1393
- `)?e.slice(0,-1):e}function ir(e){return e.startsWith(`diff --git`)||e.includes(`
1394
- diff --git`)}function ar(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:or(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=or(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function or(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function sr(e){return e==null?e:q(e)}function cr(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function lr(e){let t=e.slice(1);return q(t===``?`
1395
- `:t)}function ur(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 J=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}},dr=new class extends J{};function fr(e,t,n){return dr.diff(e,t,n)}function pr(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 mr(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 hr(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 gr(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 _r(e,t){return hr(e,t,``)}function vr(e,t){return gr(e,t,``)}function yr(e,t){return t.slice(0,br(e,t))}function br(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 xr(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 Sr(e,t){if(t)return Cr(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Y(e,t){if(t)return Cr(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Cr(e,t){if(!t)return[Y(e),Sr(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=xr(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var wr=`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}`,Tr=RegExp(`[${wr}]+|\\s+|[^${wr}]`,`ug`);new class extends J{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=xr(e,r)}else n=e.match(Tr)||[];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)&&Er(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Er(n,i,r,null,t.intlSegmenter),e}};function Er(e,t,n,r,i){if(t&&n){let[a,o]=Cr(t.value,i),[s,c]=Cr(n.value,i);if(e){let r=pr(a,s);e.value=gr(e.value,s,r),t.value=_r(t.value,r),n.value=_r(n.value,r)}if(r){let e=mr(o,c);r.value=hr(r.value,c,e),t.value=vr(t.value,e),n.value=vr(n.value,e)}}else if(n){if(e){let e=Y(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Y(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Y(r.value,i),[a,o]=Cr(t.value,i),s=pr(n,a);t.value=_r(t.value,s);let c=mr(_r(n,s),o);t.value=vr(t.value,c),r.value=hr(r.value,n,c),e.value=gr(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Y(r.value,i),n=yr(Sr(t.value,i),e);t.value=vr(t.value,n)}else if(e){let n=yr(Sr(e.value,i),Y(t.value,i));t.value=_r(t.value,n)}}var Dr=new class extends J{tokenize(e){let t=RegExp(`(\\r?\\n)|[${wr}]+|[^\\S\\n\\r]+|[^${wr}]`,`ug`);return e.match(t)||[]}};function Or(e,t,n){return Dr.diff(e,t,n)}var kr=new class extends J{constructor(){super(...arguments),this.tokenize=jr}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
1393
+ `)?e.slice(0,-1):e}function ar(e){return e.startsWith(`diff --git`)||e.includes(`
1394
+ diff --git`)}function or(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:sr(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=sr(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function sr(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function cr(e){return e==null?e:q(e)}function lr(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function ur(e){let t=e.slice(1);return q(t===``?`
1395
+ `:t)}function dr(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 J=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}},fr=new class extends J{};function pr(e,t,n){return fr.diff(e,t,n)}function mr(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 hr(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 gr(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 _r(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 vr(e,t){return gr(e,t,``)}function yr(e,t){return _r(e,t,``)}function br(e,t){return t.slice(0,xr(e,t))}function xr(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 Sr(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 Cr(e,t){if(t)return wr(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Y(e,t){if(t)return wr(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function wr(e,t){if(!t)return[Y(e),Cr(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Sr(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Tr=`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}`,Er=RegExp(`[${Tr}]+|\\s+|[^${Tr}]`,`ug`);new class extends J{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=Sr(e,r)}else n=e.match(Er)||[];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)&&Dr(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Dr(n,i,r,null,t.intlSegmenter),e}};function Dr(e,t,n,r,i){if(t&&n){let[a,o]=wr(t.value,i),[s,c]=wr(n.value,i);if(e){let r=mr(a,s);e.value=_r(e.value,s,r),t.value=vr(t.value,r),n.value=vr(n.value,r)}if(r){let e=hr(o,c);r.value=gr(r.value,c,e),t.value=yr(t.value,e),n.value=yr(n.value,e)}}else if(n){if(e){let e=Y(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Y(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Y(r.value,i),[a,o]=wr(t.value,i),s=mr(n,a);t.value=vr(t.value,s);let c=hr(vr(n,s),o);t.value=yr(t.value,c),r.value=gr(r.value,n,c),e.value=_r(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Y(r.value,i),n=br(Cr(t.value,i),e);t.value=yr(t.value,n)}else if(e){let n=br(Cr(e.value,i),Y(t.value,i));t.value=vr(t.value,n)}}var Or=new class extends J{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Tr}]+|[^\\S\\n\\r]+|[^${Tr}]`,`ug`);return e.match(t)||[]}};function kr(e,t,n){return Or.diff(e,t,n)}var Ar=new class extends J{constructor(){super(...arguments),this.tokenize=Mr}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
1396
1396
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
1397
1397
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
1398
1398
  `)&&(e=e.slice(0,-1)),t.endsWith(`
1399
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Ar(e,t,n){return kr.diff(e,t,n)}function jr(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1400
- `));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 Mr(e){return e==`.`||e==`!`||e==`?`}new class extends J{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Mr(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends J{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends J{constructor(){super(...arguments),this.tokenize=jr}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Nr(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Nr(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Nr(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Nr(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends J{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Pr(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function X(e){if(!Pr(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 Fr={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Ir(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;Ar(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Ar(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||zr(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(`
1401
- `)?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 Lr(e,t){if(t||=Fr,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=>Lr(e,t)).join(`
1402
- `)}let n=[];if(e.isGit){if(t=Fr,!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 `+X(r)+` `+X(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 `+X((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+X((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+X((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+X((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(`--- `+X(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+X(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(`
1399
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function jr(e,t,n){return Ar.diff(e,t,n)}function Mr(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1400
+ `));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 Nr(e){return e==`.`||e==`!`||e==`?`}new class extends J{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Nr(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends J{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends J{constructor(){super(...arguments),this.tokenize=Mr}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Pr(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Pr(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Pr(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Pr(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends J{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Fr(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function X(e){if(!Fr(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 Ir={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Lr(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;jr(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(jr(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||Br(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(`
1401
+ `)?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 Rr(e,t){if(t||=Ir,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=>Rr(e,t)).join(`
1402
+ `)}let n=[];if(e.isGit){if(t=Ir,!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 `+X(r)+` `+X(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 `+X((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+X((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+X((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+X((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(`--- `+X(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+X(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(`
1403
1403
  `)+`
1404
- `}function Rr(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Ir(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Lr(e,o.headerOptions):void 0)}}))}else{let s=Ir(e,t,n,r,i,a,o);return s?Lr(s,o?.headerOptions):void 0}}function zr(e){let t=e.endsWith(`
1404
+ `}function zr(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Lr(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Rr(e,o.headerOptions):void 0)}}))}else{let s=Lr(e,t,n,r,i,a,o);return s?Rr(s,o?.headerOptions):void 0}}function Br(e){let t=e.endsWith(`
1405
1405
  `),n=e.split(`
1406
1406
  `).map(e=>e+`
1407
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Br(e,t,n,r=!1){let i=Vn(Rr(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:r});if(i==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);return t.lang!=null&&(i.lang=t.lang),i}var Vr=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 Hr(e,t){return ne(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Ur(e){return N({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Wr(e){return N({tagName:`div`,children:[N({tagName:`span`,children:[M(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Gr(e){return N({tagName:`div`,children:[P({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 Z({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(N({tagName:`div`,children:[M(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Gr(`up`)),s++),o||(e.push(Gr(`down`)),s++)):(e.push(Gr(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(N({tagName:`div`,children:[N({tagName:`span`,children:[M(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(N({tagName:`div`,children:[M(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(N({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(N({tagName:`slot`,properties:{name:i}})),N({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 Kr(e,t){return`hunk-separator-${e}-${t}`}function qr(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Jr(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Yr({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 Xr({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 Zr({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 Qr({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-(n.additionLineIndex+n.additionCount),i=e.deletionLines.length-(n.deletionLineIndex+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 $r({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=Qr({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 ei({type:e,metrics:t}){return t.hunkSeparatorHeight??Mn(e)}function ti({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function ni({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 ri(e){return e!==`simple`&&e!==`metadata`}function ii({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!ni({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=ei({type:e,metrics:t}),a=ti({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function ai({type:e,metrics:t}){if(!ri(e))return;let n=ei({type:e,metrics:t}),r=ti({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function oi({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=si({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=c.unifiedCount+e<n,a=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=Zr({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),s=n===c.finalHunkIndex?$r({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,l=o.fromStart+o.fromEnd;function u(e,n){return s==null||s.collapsedLines<=0||s.fromStart+s.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?s.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?s.collapsedLines:0}let d=o.collapsedLines===0;function f(){return d?0:(d=!0,o.collapsedLines)}if(c.shouldSkip(l,l))c.incrementCounts(l,l),f();else{let e=r.unifiedLineStart-o.rangeSize,i=r.splitLineStart-o.rangeSize,a=r.deletionLineIndex-o.rangeSize,s=r.additionLineIndex-o.rangeSize,l=r.deletionStart-o.rangeSize,u=r.additionStart-o.rangeSize;if(ui(c,o.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-o.fromEnd,i=r.splitLineStart-o.fromEnd,a=r.deletionLineIndex-o.fromEnd,s=r.additionLineIndex-o.fromEnd,l=r.deletionStart-o.fromEnd,u=r.additionStart-o.fromEnd,ui(c,o.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}),()=>{f()})))break hunkIterator}let p=r.unifiedLineStart,m=r.splitLineStart,h=r.deletionLineIndex,g=r.additionLineIndex,_=r.deletionStart,v=r.additionStart,y=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===y;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),f();else if(ui(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=p+t,s=m+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:u(o,s),type:`context`,deletionLine:{lineNumber:_+t,lineIndex:h+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:g+t,lineNumber:v+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{f()}))break hunkIterator;p+=e.lines,m+=e.lines,h+=e.lines,g+=e.lines,_+=e.lines,v+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=di(c,e,t);(s[0]?.[0]??0)>0&&f();for(let[l,d]of s)for(let s=l;s<d;s++){let l=u(p+s,t===`unified`?m+(s<e.deletions?s:s-e.deletions):m+s);if(c.emit(fi({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:p,splitLineIndex:m,additionLineIndex:g,deletionLineIndex:h,additionLineNumber:v,deletionLineNumber:_,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}f(),c.incrementCounts(o,a),p+=o,m+=a,h+=e.deletions,g+=e.additions,_+=e.deletions,v+=e.additions}}if(s!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=s,a=r+i;if(ui(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:_+t,lineIndex:h+t,noEOFCR:!1,unifiedLineIndex:p+t,splitLineIndex:m+t},additionLine:{unifiedLineIndex:p+t,splitLineIndex:m+t,lineIndex:g+t,lineNumber:v+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function si({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=ci({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 ci({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=Zr({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?$r({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 li(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 ui(e,t,n,r,i,a){let[o,s]=li(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 di(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 fi({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 pi={forcePlainText:!1};function mi(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=pi){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=Xt({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)??gi();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)}oi({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&&hi({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}=_i({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 f.deletionLines.push(...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 f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function hi({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=H(e),t=H(t),e.length>s||t.length>s))return;let c=o===`char`?fr(e,t):Or(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?(Xr({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Xr({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Xr({item:e,arr:l,enableJoin:d,isLastItem:t}):Xr({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Yr({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Yr({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function gi(){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 _i({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=C,...l}}){let u=s??B(e.name),d=s??B(t.name),{state:f,transformers:p}=It(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:U(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:U(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Qt(i.codeToHast(H(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Qt(i.codeToHast(H(t.contents),m)))}}function vi(e){let t=e.lang??B(e.name),n=e.lang??(e.prevName==null?`text`:B(e.prevName));return t===`text`&&n===`text`}var yi=-1,bi=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++yi}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:C},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=pt(e.theme??C)?lt():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)}clearRenderCache(){this.renderCache=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)??te}getExpandedHunksMap(){return this.expandedHunks}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)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t===`change`?{gutterLineType:e===`deletions`?`change-deletion`:`change-addition`}:{gutterLineType:t}}createAnnotationElement=e=>gt(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=C,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=O,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 ct(Et(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=ki(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Hr(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!vi(e),options:t,result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??B(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:an(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Nn(e,n.diff)||!Hr(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=k){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},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||vi(e)||ki(e,this.getTokenizeMaxLength()),l=!Nn(e,this.renderCache.diff),u=!ht(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Jr(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??B(e.name);let t=this.highlighter!=null&&pt(i.theme),n=this.highlighter!=null&&Re(this.computedLang),r=!c&&n;if(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.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=k){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 xt({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=ki(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??B(e.name);let n=this.highlighter!=null&&pt(this.options.theme??C),r=t||this.highlighter!=null&&Re(this.computedLang);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();return{result:mi(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!this.renderCache.highlighted||!Hr(this.renderCache.options,n)||!Nn(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&Hr(t,n.options))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Nn(e,n.diff)&&Hr(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();this.diff=e;let d=a===`unified`,f=[],p=[],m=[],h=[],{additionLines:g,deletionLines:_}=n,v={rowCount:0,hunkSeparators:u,additionsContentAST:f,deletionsContentAST:p,unifiedContentAST:m,unifiedGutterAST:se(),deletionsGutterAST:se(),additionsGutterAST:se(),expansionLineCount:c,hunkData:h,incrementRowCount(e=1){v.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:v.unifiedGutterAST.children.push(t);break;case`deletions`:v.deletionsGutterAST.children.push(t);break;case`additions`:v.additionsGutterAST.children.push(t)}}},y=Qr({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),b={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`?(v.pushToGutter(`additions`,F(void 0,`buffer`,this.size)),f?.push(Ur(this.size))):(v.pushToGutter(`deletions`,F(void 0,`buffer`,this.size)),p?.push(Ur(this.size))),this.size=0,this.side=void 0}}},x=(e,t,n,r,i)=>{v.pushToGutter(e,ce(t,n,r,i))};function S(e){b.flush(),a===`unified`?Di(`unified`,e,v):(Di(`deletions`,e,v),Di(`additions`,e,v))}this.pushFileLevelAnnotations(e,a,t,v),oi({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,d=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&b.flush(),r>0&&S({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:!e.isPartial});let f=a===`unified`?d:l,p={type:c,hunkIndex:t,lineIndex:f,unifiedLineIndex:d,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(p);n?.before!=null&&wi(n.before,v);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[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});x(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${d},${l}`,u.gutterProperties),i==null?r!=null&&(r=Oi(r,u.contentProperties)):i=Oi(i,u.contentProperties),Ei({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,f),createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&wi(n.after,v)}else{let n=this.getSplitInjectedRowsForLine?.(p);n?.before!=null&&Ti(n.before,v,b);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[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 d=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();if(d!=null){if(b.side!=null&&b.side!==d)throw Error(`DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits`);b.side=d,b.increment()}let m=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,f);if(m!=null&&b.size>0&&b.flush(),s!=null){let e=Oi(r,a.contentProperties);x(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Oi(i,u.contentProperties);x(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Ei({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...m,createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&Ti(n.after,v,b)}let m=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,h=m?n.noEOFCRDeletions:!1,C=m?n.noEOFCRAdditions:!1,w=(s?.noEOFCR??!1)||h,T=(o?.noEOFCR??!1)||C;if(T||w){if(a===`split`&&b.flush(),w){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(v.unifiedContentAST.push(Wr(e)),v.pushToGutter(`unified`,F(e,`metadata`,1))):(v.deletionsContentAST.push(Wr(e)),v.pushToGutter(`deletions`,F(e,`metadata`,1)),T||(v.pushToGutter(`additions`,F(void 0,`buffer`,1)),v.additionsContentAST.push(Ur(1))))}if(T){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(v.unifiedContentAST.push(Wr(e)),v.pushToGutter(`unified`,F(e,`metadata`,1))):(v.additionsContentAST.push(Wr(e)),v.pushToGutter(`additions`,F(e,`metadata`,1)),w||(v.pushToGutter(`deletions`,F(void 0,`buffer`,1)),v.deletionsContentAST.push(Ur(1))))}v.incrementRowCount(1)}i>0&&u!==`simple`&&S({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:i,rangeSize:y,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),v.incrementRowCount(1)}}),a===`split`&&b.flush();let C=Math.max(qr(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,T=!d&&e.type!==`deleted`,E=!d&&e.type!==`new`,D=v.rowCount>0||w;f=T&&D?f:void 0,p=E&&D?p:void 0,m=d&&D?m:void 0;let O=this.createPreElement(p!=null&&f!=null,C);return{unifiedGutterAST:d&&D?v.unifiedGutterAST.children:void 0,unifiedContentAST:m,deletionsGutterAST:E&&D?v.deletionsGutterAST.children:void 0,deletionsContentAST:p,additionsGutterAST:T&&D?v.additionsGutterAST.children:void 0,additionsContentAST:f,hunkData:h,preNode:O,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:C,rowCount:v.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=se(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,rn(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(N({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(N({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(N({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return c(this.renderFullAST(e,t))}renderPartialHTML(e,t){return c(t==null?e:N({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(!nn(n))return;let i=e.type===`new`?[]:xi(tn(this.deletionAnnotations)),a=e.type===`deleted`?[]:xi(tn(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Ei({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Ei({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(V(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(V(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}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return vt({fileOrDiff:e,mode:t,stickyHeader:n})}};function xi(e){return e?.map(e=>V(e))??[]}var Si=new Intl.PluralRules(`en-US`);function Ci(e){return`${e} unmodified line${Si.select(e)===`one`?``:`s`}`}function wi(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Ti(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 Ei({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`,F(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`,F(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`,F(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Di(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,Z({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Z({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Z({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Z({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Kr(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,Z({type:c.hunkSeparators,content:Ci(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Z({type:c.hunkSeparators,content:Ci(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:n,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Oi(e,t){return e==null||e.type!==`element`||t==null?e:{...e,properties:{...e.properties,...t}}}function ki(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Ai(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function ji(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Mi(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:e?.useTokenTransformer,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,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var Ni=-1,Pi=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Ni}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;constructor(e={theme:C},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new ke,this.scrollSyncManager=new Vr,this.interactionManager=new de(`diff`,fe(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()};getHunksRendererOptions(e){return Mi(e)}createHunksRenderer(e){return new bi(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),r,i;hunkIterator:for(let a of this.fileDiff.hunks){let o=t===`deletions`?a.deletionStart:a.additionStart,s=t===`deletions`?a.deletionCount:a.additionCount,c=a.splitLineStart,l=a.unifiedLineStart;if(e<o){let t=o-e;r=Math.max(l-t,0),i=Math.max(c-t,0);break hunkIterator}if(e>=o+s){if(a===n){let t=e-(o+s);r=l+a.unifiedLineCount+t,i=c+a.splitLineCount+t;break hunkIterator}continue}for(let n of a.hunkContent)if(n.type===`context`){if(e<o+n.lines){let t=e-o;i=c+t,r=l+t;break hunkIterator}o+=n.lines,c+=n.lines,l+=n.lines}else{let a=t===`deletions`?n.deletions:n.additions;if(e<o+a){let a=e-o;r=l+(t===`additions`?n.deletions:0)+a,i=c+a;break hunkIterator}o+=a,c+=Math.max(n.deletions,n.additions),l+=n.deletions+n.additions}break hunkIterator}if(r!=null&&i!=null)return[r,i]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(fe(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&&!ne(this.appliedThemeCSS.theme,this.options.theme??C)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.interactionManager.setSelection(e,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,t===`wrap`),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.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.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),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.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,lineAnnotations:i,oldFile:a,newFile:o,fileDiff:s}=e;this.hydrateElements(t,n),Li(this.pre,Fi({fileDiff:s,oldFile:a,newFile:o}),this.options.collapsed)||Ri(this.headerElement,Ii({fileDiff:s,oldFile:a,newFile:o}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:s,oldFile:a,newFile:o,lineAnnotations:i}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),wn(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!=null&&n!=null?Br(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(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.rerender()};render({oldFile:e,newFile:t,fileDiff:n,deferManagers:r=!1,forceRender:i=!1,preventEmit:a=!1,lineAnnotations:o,fileContainer:s,containerWrapper:c,renderRange:l}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let{collapsed:u=!1,themeType:d=`system`}=this.options,f=u?void 0:l,p=this.hasThemeChanged(),m=e!=null&&t!=null&&(!mt(e,this.deletionFile)||!mt(t,this.additionFile)),h=n!=null&&n!==this.fileDiff,g=o!=null&&(o.length>0||this.lineAnnotations.length>0)&&o!==this.lineAnnotations;if(!u&&ht(f,this.renderRange)&&!i&&!g&&!p&&(n!=null&&n===this.fileDiff||n==null&&!m))return this.applyCachedThemeState(d);let{renderRange:_}=this;if(this.renderRange=f,this.deletionFile=e,this.additionFile=t,n==null?e!=null&&t!=null&&m&&(h=!0,this.fileDiff=Br(e,t,this.options.parseDiffOptions)):this.fileDiff=n,h&&(this.cachedHeaderHTML=void 0),o!=null&&this.setLineAnnotations(o),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:v=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),s=this.getOrCreateFileContainer(s,c),this.applyCachedThemeState(d),u){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,A);e!=null&&this.applyThemeState(s,e.themeStyles,d,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,s),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(s);if(!(this.canPartiallyRender(i,g,m||h||p)&&this.applyPartialRender({previousRenderRange:_,renderRange:f}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,f);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(s,t.themeStyles,d,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,s),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.applyBuffers(e,f),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,r||this.flushManagers()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}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)}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.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{fileDiff:e,workerManager:t}=this;if(e==null||t==null||vi(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||t.primeDiffHighlightCache(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.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.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}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||!ji(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;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${V(r)}`,a=this.annotationCache.get(i);if(a==null||!Ai(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:un(V(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}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=dn();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 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:En(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):En(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=on;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&&(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){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??c(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||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderMetadata:o}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,S,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let s=a?.(n)??void 0,l=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,b,s),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,x,l),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=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??=fn(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=yn(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??C,s=typeof o==`string`?o:{...o},c=hn(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=Dn({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:bn(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=xn(this.themeCSSStyle.textContent??``,hn(e)))}applyHunksToDOM(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);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=Cn({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),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=Cn({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),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=Cn({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),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({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!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`)}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=zi(t[0]),i=zi(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)`)}getCodeColumns(e,t,n,r){function i(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}}if(e===`unified`)return i(t);{let e=i(n),t=i(r);return e!=null||t!=null?[e,t]:void 0}}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};sn(u,this.appliedPreAttributes)||(Tn(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 Fi({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Ii({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Li(e,t,n=!1){return!n&&e==null&&t}function Ri(e,t,n=!1){return e==null&&t&&!n}function zi(e){if(e!=null&&e.type===`element`)return e.children??[]}function Bi({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o}){let s=G(t,n),c=s,l=i?!0:a,u=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=Zr({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:l,hunkIndex:n,collapsedContextThreshold:o}),d=(a.fromStart+a.fromEnd)*t.lineHeight;if(s+=d,c+=d,a.collapsedLines>0){let e=ii({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;s+=e,c+=e}s+=i.splitLineCount*t.lineHeight,c+=i.unifiedLineCount*t.lineHeight;let f=Vi(i);s+=f.split*t.lineHeight,c+=f.unified*t.lineHeight;let p=n===u?$r({fileDiff:e,hunkIndex:n,expandedHunks:l,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(p!=null){let e=(p.fromStart+p.fromEnd)*t.lineHeight;if(s+=e,c+=e,p.collapsedLines>0){let e=ai({type:r,metrics:t})?.totalHeight??0;s+=e,c+=e}}}if(e.hunks.length>0){let e=jn(t);s+=e,c+=e}return{splitHeight:s,unifiedHeight:c}}function Vi(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 Hi(e,t)}function Hi(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 Ui=5e3,Wi=-1,Gi=class extends Pi{__id=`little-virtualized-file-diff:${++Wi}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=kn(n)}setMetrics(e,t=!1){let n=kn(e);(t||!j(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!en(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!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=!re(t,e),r=n&&$i(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:ea(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}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&nn(this.renderRange)){let t=Ki(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=na(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());prepareCodeViewItem(e,t,n,r){let i=!Nn(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=kn(n.metrics),o=!0,s=!0);let{collapsed:c=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=G(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return oi({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`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=ii({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=ai({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??G(this.metrics,t)+this.cache.fileAnnotationHeight,l;return oi({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=ii({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=ai({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSimpleMode()&&this.computeApproximateSize(),this.virtualizer.instanceChanged(this,!0)};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(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,this.fileDiff==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1}=this.options,a=G(this.metrics,r);if(this.height+=a,i){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight(),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();let e=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(e==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return e}ensureEstimatedDiffHeights(){if(this.fileDiff==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:r,unifiedHeight:i}=Bi({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=r,this.cache.estimatedUnifiedHeight=i}validateComputedHeight(){if(this.fileContainer==null||this.fileDiff==null)return;let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height})}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,forceRender:i=!1,lineAnnotations:a,...o}={}){let{forceRenderOverride:s,isSetup:c}=this;this.forceRenderOverride=void 0;let l=this.syncLineAnnotations(a);if(l&&this.resetLayoutCache({includeEstimatedHeights:!1}),this.fileDiff??=r??(t!=null&&n!=null?Br(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(c)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();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())return this.renderPlaceholder(this.height);let u=this.virtualizer.getWindowSpecs(),d=this.top??0,f=this.computeRenderRangeFromWindow(this.fileDiff,d,u);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:f,oldFile:t,newFile:n,lineAnnotations:a,forceRender:(s??i)||l,...o})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}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}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return ta(this.options.hunkSeparators)}approximateLayoutCheckpoints(){if(this.cache.checkpoints.length>0||this.fileDiff==null||this.fileDiff.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,r=this.fileDiff.hunks.length-1,i=this.getDiffStyle(),a=this.getHunkSeparatorType(),o=t?!0:this.hunksRenderer.getExpandedHunksMap(),s=qi(this.cache.heightDeltas),c=G(this.metrics,e)+this.cache.fileAnnotationHeight,l=0,u=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=l,o=l+e,u=Xi(a);for(;u<o;){let e=u-a,r=c+(e>0?n:0)+e*this.metrics.lineHeight+Zi(i,e)*this.metrics.lineHeight+Ji(s,t,t+e);this.cache.checkpoints.push({renderedLineIndex:u,lineIndex:t+e,top:r}),u+=Ui}c+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Ji(s,t,t+e)+r,l=o};for(let e=0;e<this.fileDiff.hunks.length;e++){let t=this.fileDiff.hunks[e];if(t==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let s=Zr({isPartial:this.fileDiff.isPartial,rangeSize:t.collapsedBefore,expandedHunks:o,hunkIndex:e,collapsedContextThreshold:n}),c=s.collapsedLines>0?ii({type:a,metrics:this.metrics,hunkIndex:e,hunkSpecs:t.hunkSpecs})?.totalHeight??0:0;u({rowCount:s.fromStart,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.rangeSize});let l=c;u({rowCount:s.fromEnd,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.fromEnd,preSeparatorHeight:l}),s.fromEnd>0&&(l=0);let d=e===r?$r({fileDiff:this.fileDiff,hunkIndex:e,expandedHunks:o,collapsedContextThreshold:n,errorPrefix:`VirtualizedFileDiff`}):void 0,f=d!=null&&d.collapsedLines>0?ai({type:a,metrics:this.metrics})?.totalHeight??0:0,p=d==null?0:d.fromStart+d.fromEnd,m=i===`split`?t.splitLineCount:t.unifiedLineCount,h=i===`split`?t.splitLineStart:t.unifiedLineStart;u({rowCount:m,startLineIndex:h,preSeparatorHeight:l,postSeparatorHeight:p===0?f:0,metadataOffsets:Qi({diffStyle:i,hunk:t,rowCount:m})}),d!=null&&p>0&&u({rowCount:p,startLineIndex:h+m,postSeparatorHeight:f})}this.cache.totalLines=l}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}=Zr({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=$r({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}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=this.height,f=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,l),p=G(this.metrics,i),m=e.hunks.length>0?jn(this.metrics):0,{fileAnnotationHeight:h}=this.cache,g=p+h,_=Math.max(0,d-p-h-m),v=this.hasFileAnnotations(e),y=t+p,b=h>0&&v&&y<r&&y+h>n;if(t<n-d||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};if(f<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),f=this.cache.totalLines>0?this.cache.totalLines:f;let x=Math.ceil(Math.max(r-n,0)/c),S=Math.ceil(x/s)*s+s,C=S/s,w=C,T=[],E=(n+r)/2,D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-S*c*2),s),O=t+(D?.top??g),ee=D?.renderedLineIndex??0,te,k,A;if(oi({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:i,collapsedBefore:a,collapsedAfter:o,deletionLine:c,additionLine:d})=>{let f=d==null?c.splitLineIndex:d.splitLineIndex,p=d==null?c.unifiedLineIndex:d.unifiedLineIndex,m=(d?.noEOFCR??!1)||(c?.noEOFCR??!1),h=(a>0?ii({type:u,metrics:this.metrics,hunkIndex:e,hunkSpecs:i?.hunkSpecs}):void 0)?.totalHeight??0;O+=h;let _=ee%s===0,v=Math.floor(ee/s);if(_&&(T[v]=O-(t+g+h),A!=null)){if(A<=0)return!0;A--}let y=this.getLineHeight(l===`split`?f:p,m);return O>n-y&&O<r&&(te??=v),k==null&&O+y>E&&(k=v),A==null&&O>=r&&_&&(A=w),ee++,O+=y,o>0&&(O+=ai({type:u,metrics:this.metrics})?.totalHeight??0),!1}}),te==null){if(b)te=0,k=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m}}k??=te;let j=Math.round(k-C/2),ne=Math.max(0,Math.ceil(f/s)-C),re=Math.max(0,Math.min(j,ne)),ie=re*s,ae=j<0?S+j*s:S,M=T[re]??0,N=ie===0?0:h+M,P=re+ae/s,oe=P<T.length?_-T[P]:_-(O-t-g);return{startingLine:ie,totalLines:ae,bufferBefore:N,bufferAfter:Math.max(0,oe)}}};function Ki(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===$t&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function qi(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 Ji({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Yi(e,n);return(t[Yi(e,r)]??0)-(t[i]??0)}function Yi(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 Xi(e){return Math.ceil(e/Ui)*Ui}function Zi(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Qi({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 $i(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.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function ea(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 ta(e){return typeof e==`function`?`custom`:e??`line-info`}function na(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function ra({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function ia(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:aa(n,e.startContentIndex)}}function aa(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}var oa={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},sa={display:`contents`};function ca(){return null}var Q=r();function la({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderMergeConflictUtility:s,lineAnnotations:c,getHoveredLine:l,getInstance:u}){let d=n?.(e),f=r?.(e),p=i?.(e);return(0,Q.jsxs)(Q.Fragment,{children:[d==null?(0,Q.jsxs)(Q.Fragment,{children:[f!=null&&(0,Q.jsx)(`div`,{slot:`header-prefix`,children:f}),p!=null&&(0,Q.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,Q.jsx)(`div`,{slot:S,children:d}),a!=null&&c?.map((e,t)=>(0,Q.jsx)(`div`,{slot:V(e),children:a(e)},t)),t!=null&&s!=null&&u!=null&&t.map(t=>{if(t==null)return;let n=ua(t,e);return(0,Q.jsx)(`div`,{slot:n,style:sa,children:s(t,u)},n)}),o!=null&&(0,Q.jsx)(`div`,{slot:`gutter-utility-slot`,style:oa,children:o(l)})]})}function ua(e,t){let n=ia(e,t);return n==null?void 0:ra({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var $=e(n(),1);function da(e){let t=(0,$.useRef)(e);return(0,$.useInsertionEffect)(()=>void(t.current=e)),(0,$.useCallback)((...e)=>t.current(...e),[])}var fa=(0,$.createContext)(void 0);function pa(e,t){return typeof window>`u`&&t!=null?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Q.jsx)(Q.Fragment,{children:e})}var ma=(0,$.createContext)(void 0);function ha(){return(0,$.useContext)(ma)}var ga=typeof window>`u`?$.useEffect:$.useLayoutEffect;function _a({fileDiff:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=ha(),u=r!==void 0,d=(0,$.useContext)(fa),f=(0,$.useRef)(null),p=da(r=>{if(r!=null){if(f.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);l==null?f.current=new Pi(va({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:d,!0):f.current=new Gi(va({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),l,a,c?void 0:d,!0),f.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(f.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);f.current.cleanUp(),f.current=null}});return ga(()=>{let{current:i}=f;if(i==null)return;let a=va({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c=!re(i.options,a);i.setOptions(a),i.render({forceRender:c,fileDiff:e,lineAnnotations:n}),r!==void 0&&i.setSelectedLines(r)}),{ref:p,getHoveredLine:(0,$.useCallback)(()=>f.current?.getHoveredLine(),[])}}function va({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return!t&&!r&&!n?e:{...e,controlledSelection:t,renderCustomHeader:n?ca:e?.renderCustomHeader,renderGutterUtility:r?ca:e?.renderGutterUtility}}function ya({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderGutterUtility:f,disableWorkerPool:m=!1}){let{ref:h,getHoveredLine:g}=_a({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:f!=null,hasCustomHeader:l!=null,disableWorkerPool:m});return(0,Q.jsx)(p,{ref:h,className:a,style:o,children:pa(la({fileDiff:e,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderAnnotation:c,renderGutterUtility:f,lineAnnotations:r,getHoveredLine:g}),s)})}var ba={diffIndicators:`bars`,diffStyle:`unified`,disableFileHeader:!0,hunkSeparators:`line-info-basic`,lineDiffType:`word-alt`,overflow:`scroll`,theme:{dark:`github-dark`,light:`github-light`},themeType:`system`,unsafeCSS:`
1407
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Vr(e,t,n,r=!1){let i=Hn(zr(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:r});if(i==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);return t.lang!=null&&(i.lang=t.lang),i}var Hr=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 Ur(e,t){return M(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Wr(e){return P({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Gr(e){return P({tagName:`div`,children:[P({tagName:`span`,children:[N(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Kr(e){return P({tagName:`div`,children:[oe({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 Z({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(P({tagName:`div`,children:[N(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Kr(`up`)),s++),o||(e.push(Kr(`down`)),s++)):(e.push(Kr(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(P({tagName:`div`,children:[P({tagName:`span`,children:[N(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(P({tagName:`div`,children:[N(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(P({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(P({tagName:`slot`,properties:{name:i}})),P({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 qr(e,t){return`hunk-separator-${e}-${t}`}function Jr(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Yr(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Xr({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 Zr({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 Qr({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 $r({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-(n.additionLineIndex+n.additionCount),i=e.deletionLines.length-(n.deletionLineIndex+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 ei({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=$r({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 ti({type:e,metrics:t}){return t.hunkSeparatorHeight??Nn(e)}function ni({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function ri({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 ii(e){return e!==`simple`&&e!==`metadata`}function ai({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!ri({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=ti({type:e,metrics:t}),a=ni({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function oi({type:e,metrics:t}){if(!ii(e))return;let n=ti({type:e,metrics:t}),r=ni({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function si({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=ci({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=c.unifiedCount+e<n,a=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=Qr({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),s=n===c.finalHunkIndex?ei({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,l=o.fromStart+o.fromEnd;function u(e,n){return s==null||s.collapsedLines<=0||s.fromStart+s.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?s.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?s.collapsedLines:0}let d=o.collapsedLines===0;function f(){return d?0:(d=!0,o.collapsedLines)}if(c.shouldSkip(l,l))c.incrementCounts(l,l),f();else{let e=r.unifiedLineStart-o.rangeSize,i=r.splitLineStart-o.rangeSize,a=r.deletionLineIndex-o.rangeSize,s=r.additionLineIndex-o.rangeSize,l=r.deletionStart-o.rangeSize,u=r.additionStart-o.rangeSize;if(di(c,o.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-o.fromEnd,i=r.splitLineStart-o.fromEnd,a=r.deletionLineIndex-o.fromEnd,s=r.additionLineIndex-o.fromEnd,l=r.deletionStart-o.fromEnd,u=r.additionStart-o.fromEnd,di(c,o.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}),()=>{f()})))break hunkIterator}let p=r.unifiedLineStart,m=r.splitLineStart,h=r.deletionLineIndex,g=r.additionLineIndex,_=r.deletionStart,v=r.additionStart,y=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===y;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),f();else if(di(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=p+t,s=m+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:u(o,s),type:`context`,deletionLine:{lineNumber:_+t,lineIndex:h+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:g+t,lineNumber:v+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{f()}))break hunkIterator;p+=e.lines,m+=e.lines,h+=e.lines,g+=e.lines,_+=e.lines,v+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=fi(c,e,t);(s[0]?.[0]??0)>0&&f();for(let[l,d]of s)for(let s=l;s<d;s++){let l=u(p+s,t===`unified`?m+(s<e.deletions?s:s-e.deletions):m+s);if(c.emit(pi({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:p,splitLineIndex:m,additionLineIndex:g,deletionLineIndex:h,additionLineNumber:v,deletionLineNumber:_,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}f(),c.incrementCounts(o,a),p+=o,m+=a,h+=e.deletions,g+=e.additions,_+=e.deletions,v+=e.additions}}if(s!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=s,a=r+i;if(di(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:_+t,lineIndex:h+t,noEOFCR:!1,unifiedLineIndex:p+t,splitLineIndex:m+t},additionLine:{unifiedLineIndex:p+t,splitLineIndex:m+t,lineIndex:g+t,lineNumber:v+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function ci({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=li({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 li({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=Qr({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?ei({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 ui(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 di(e,t,n,r,i,a){let[o,s]=ui(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 fi(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 pi({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 mi={forcePlainText:!1};function hi(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=mi){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=Zt({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)??_i();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)}si({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&&gi({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}=vi({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 f.deletionLines.push(...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 f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function gi({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=H(e),t=H(t),e.length>s||t.length>s))return;let c=o===`char`?pr(e,t):kr(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?(Zr({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Zr({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Zr({item:e,arr:l,enableJoin:d,isLastItem:t}):Zr({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Xr({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Xr({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function _i(){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 vi({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=w,...l}}){let u=s??B(e.name),d=s??B(t.name),{state:f,transformers:p}=Lt(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:U(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:U(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,$t(i.codeToHast(H(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,$t(i.codeToHast(H(t.contents),m)))}}function yi(e){let t=e.lang??B(e.name),n=e.lang??(e.prevName==null?`text`:B(e.prevName));return t===`text`&&n===`text`}var bi=-1,xi=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++bi}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:w},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=mt(e.theme??w)?ut():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)}clearRenderCache(){this.renderCache=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)??A}getExpandedHunksMap(){return this.expandedHunks}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)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t===`change`?{gutterLineType:e===`deletions`?`change-deletion`:`change-addition`}:{gutterLineType:t}}createAnnotationElement=e=>_t(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=w,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=ee,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 lt(Dt(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Ai(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Ur(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!yi(e),options:t,result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??B(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:on(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Pn(e,n.diff)||!Ur(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=j){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},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||yi(e)||Ai(e,this.getTokenizeMaxLength()),l=!Pn(e,this.renderCache.diff),u=!gt(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Yr(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??B(e.name);let t=this.highlighter!=null&&mt(i.theme),n=this.highlighter!=null&&ze(this.computedLang),r=!c&&n;if(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.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=j){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 St({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Ai(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??B(e.name);let n=this.highlighter!=null&&mt(this.options.theme??w),r=t||this.highlighter!=null&&ze(this.computedLang);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();return{result:hi(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!this.renderCache.highlighted||!Ur(this.renderCache.options,n)||!Pn(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&Ur(t,n.options))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Pn(e,n.diff)&&Ur(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();this.diff=e;let d=a===`unified`,f=[],p=[],m=[],h=[],{additionLines:g,deletionLines:_}=n,v={rowCount:0,hunkSeparators:u,additionsContentAST:f,deletionsContentAST:p,unifiedContentAST:m,unifiedGutterAST:ce(),deletionsGutterAST:ce(),additionsGutterAST:ce(),expansionLineCount:c,hunkData:h,incrementRowCount(e=1){v.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:v.unifiedGutterAST.children.push(t);break;case`deletions`:v.deletionsGutterAST.children.push(t);break;case`additions`:v.additionsGutterAST.children.push(t)}}},y=$r({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),b={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`?(v.pushToGutter(`additions`,F(void 0,`buffer`,this.size)),f?.push(Wr(this.size))):(v.pushToGutter(`deletions`,F(void 0,`buffer`,this.size)),p?.push(Wr(this.size))),this.size=0,this.side=void 0}}},x=(e,t,n,r,i)=>{v.pushToGutter(e,le(t,n,r,i))};function S(e){b.flush(),a===`unified`?Oi(`unified`,e,v):(Oi(`deletions`,e,v),Oi(`additions`,e,v))}this.pushFileLevelAnnotations(e,a,t,v),si({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,d=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&b.flush(),r>0&&S({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:!e.isPartial});let f=a===`unified`?d:l,p={type:c,hunkIndex:t,lineIndex:f,unifiedLineIndex:d,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(p);n?.before!=null&&Ti(n.before,v);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[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});x(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${d},${l}`,u.gutterProperties),i==null?r!=null&&(r=ki(r,u.contentProperties)):i=ki(i,u.contentProperties),Di({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,f),createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&Ti(n.after,v)}else{let n=this.getSplitInjectedRowsForLine?.(p);n?.before!=null&&Ei(n.before,v,b);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[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 d=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();if(d!=null){if(b.side!=null&&b.side!==d)throw Error(`DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits`);b.side=d,b.increment()}let m=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,f);if(m!=null&&b.size>0&&b.flush(),s!=null){let e=ki(r,a.contentProperties);x(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=ki(i,u.contentProperties);x(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Di({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...m,createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&Ei(n.after,v,b)}let m=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,h=m?n.noEOFCRDeletions:!1,C=m?n.noEOFCRAdditions:!1,w=(s?.noEOFCR??!1)||h,T=(o?.noEOFCR??!1)||C;if(T||w){if(a===`split`&&b.flush(),w){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(v.unifiedContentAST.push(Gr(e)),v.pushToGutter(`unified`,F(e,`metadata`,1))):(v.deletionsContentAST.push(Gr(e)),v.pushToGutter(`deletions`,F(e,`metadata`,1)),T||(v.pushToGutter(`additions`,F(void 0,`buffer`,1)),v.additionsContentAST.push(Wr(1))))}if(T){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(v.unifiedContentAST.push(Gr(e)),v.pushToGutter(`unified`,F(e,`metadata`,1))):(v.additionsContentAST.push(Gr(e)),v.pushToGutter(`additions`,F(e,`metadata`,1)),w||(v.pushToGutter(`deletions`,F(void 0,`buffer`,1)),v.deletionsContentAST.push(Wr(1))))}v.incrementRowCount(1)}i>0&&u!==`simple`&&S({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:i,rangeSize:y,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),v.incrementRowCount(1)}}),a===`split`&&b.flush();let C=Math.max(Jr(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,T=!d&&e.type!==`deleted`,E=!d&&e.type!==`new`,D=v.rowCount>0||w;f=T&&D?f:void 0,p=E&&D?p:void 0,m=d&&D?m:void 0;let O=this.createPreElement(p!=null&&f!=null,C);return{unifiedGutterAST:d&&D?v.unifiedGutterAST.children:void 0,unifiedContentAST:m,deletionsGutterAST:E&&D?v.deletionsGutterAST.children:void 0,deletionsContentAST:p,additionsGutterAST:T&&D?v.additionsGutterAST.children:void 0,additionsContentAST:f,hunkData:h,preNode:O,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:C,rowCount:v.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=ce(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,an(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(P({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(P({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(P({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return l(this.renderFullAST(e,t))}renderPartialHTML(e,t){return l(t==null?e:P({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(!rn(n))return;let i=e.type===`new`?[]:Si(nn(this.deletionAnnotations)),a=e.type===`deleted`?[]:Si(nn(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Di({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Di({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(V(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(V(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}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return yt({fileOrDiff:e,mode:t,stickyHeader:n})}};function Si(e){return e?.map(e=>V(e))??[]}var Ci=new Intl.PluralRules(`en-US`);function wi(e){return`${e} unmodified line${Ci.select(e)===`one`?``:`s`}`}function Ti(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Ei(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 Di({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`,F(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`,F(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`,F(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Oi(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,Z({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Z({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Z({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Z({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=qr(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,Z({type:c.hunkSeparators,content:wi(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Z({type:c.hunkSeparators,content:wi(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:n,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function ki(e,t){return e==null||e.type!==`element`||t==null?e:{...e,properties:{...e.properties,...t}}}function Ai(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function ji(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Mi(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Ni(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:e?.useTokenTransformer,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,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var Pi=-1,Fi=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Pi}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;constructor(e={theme:w},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Ae,this.scrollSyncManager=new Hr,this.interactionManager=new fe(`diff`,pe(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()};getHunksRendererOptions(e){return Ni(e)}createHunksRenderer(e){return new xi(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),r,i;hunkIterator:for(let a of this.fileDiff.hunks){let o=t===`deletions`?a.deletionStart:a.additionStart,s=t===`deletions`?a.deletionCount:a.additionCount,c=a.splitLineStart,l=a.unifiedLineStart;if(e<o){let t=o-e;r=Math.max(l-t,0),i=Math.max(c-t,0);break hunkIterator}if(e>=o+s){if(a===n){let t=e-(o+s);r=l+a.unifiedLineCount+t,i=c+a.splitLineCount+t;break hunkIterator}continue}for(let n of a.hunkContent)if(n.type===`context`){if(e<o+n.lines){let t=e-o;i=c+t,r=l+t;break hunkIterator}o+=n.lines,c+=n.lines,l+=n.lines}else{let a=t===`deletions`?n.deletions:n.additions;if(e<o+a){let a=e-o;r=l+(t===`additions`?n.deletions:0)+a,i=c+a;break hunkIterator}o+=a,c+=Math.max(n.deletions,n.additions),l+=n.deletions+n.additions}break hunkIterator}if(r!=null&&i!=null)return[r,i]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(pe(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&&!M(this.appliedThemeCSS.theme,this.options.theme??w)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.interactionManager.setSelection(e,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,t===`wrap`),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.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.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),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.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,lineAnnotations:i,oldFile:a,newFile:o,fileDiff:s}=e;this.hydrateElements(t,n),Ri(this.pre,Ii({fileDiff:s,oldFile:a,newFile:o}),this.options.collapsed)||zi(this.headerElement,Li({fileDiff:s,oldFile:a,newFile:o}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:s,oldFile:a,newFile:o,lineAnnotations:i}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Tn(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!=null&&n!=null?Vr(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(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.rerender()};render({oldFile:e,newFile:t,fileDiff:n,deferManagers:r=!1,forceRender:i=!1,preventEmit:a=!1,lineAnnotations:o,fileContainer:s,containerWrapper:c,renderRange:l}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let{collapsed:u=!1,themeType:d=`system`}=this.options,f=u?void 0:l,p=this.hasThemeChanged(),m=e!=null&&t!=null&&(!ht(e,this.deletionFile)||!ht(t,this.additionFile)),h=n!=null&&n!==this.fileDiff,g=o!=null&&(o.length>0||this.lineAnnotations.length>0)&&o!==this.lineAnnotations;if(!u&&gt(f,this.renderRange)&&!i&&!g&&!p&&(n!=null&&n===this.fileDiff||n==null&&!m))return this.applyCachedThemeState(d);let{renderRange:_}=this;if(this.renderRange=f,this.deletionFile=e,this.additionFile=t,n==null?e!=null&&t!=null&&m&&(h=!0,this.fileDiff=Vr(e,t,this.options.parseDiffOptions)):this.fileDiff=n,h&&(this.cachedHeaderHTML=void 0),o!=null&&this.setLineAnnotations(o),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:v=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),s=this.getOrCreateFileContainer(s,c),this.applyCachedThemeState(d),u){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,te);e!=null&&this.applyThemeState(s,e.themeStyles,d,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,s),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(s);if(!(this.canPartiallyRender(i,g,m||h||p)&&this.applyPartialRender({previousRenderRange:_,renderRange:f}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,f);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(s,t.themeStyles,d,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,s),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.applyBuffers(e,f),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,r||this.flushManagers()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}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)}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.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{fileDiff:e,workerManager:t}=this;if(e==null||t==null||yi(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||t.primeDiffHighlightCache(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.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.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}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||!Mi(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;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${V(r)}`,a=this.annotationCache.get(i);if(a==null||!ji(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:dn(V(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}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=fn();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 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:Dn(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Dn(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=sn;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&&(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){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??l(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||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderMetadata:o}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,C,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let s=a?.(n)??void 0,c=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,x,s),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,S,c),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=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??=pn(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=bn(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??w,s=typeof o==`string`?o:{...o},c=gn(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=On({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:xn(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=Sn(this.themeCSSStyle.textContent??``,gn(e)))}applyHunksToDOM(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);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=wn({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),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=wn({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),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=wn({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),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({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!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`)}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Bi(t[0]),i=Bi(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)`)}getCodeColumns(e,t,n,r){function i(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}}if(e===`unified`)return i(t);{let e=i(n),t=i(r);return e!=null||t!=null?[e,t]:void 0}}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};cn(u,this.appliedPreAttributes)||(En(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 Ii({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Li({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Ri(e,t,n=!1){return!n&&e==null&&t}function zi(e,t,n=!1){return e==null&&t&&!n}function Bi(e){if(e!=null&&e.type===`element`)return e.children??[]}function Vi({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o}){let s=G(t,n),c=s,l=i?!0:a,u=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=Qr({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:l,hunkIndex:n,collapsedContextThreshold:o}),d=(a.fromStart+a.fromEnd)*t.lineHeight;if(s+=d,c+=d,a.collapsedLines>0){let e=ai({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;s+=e,c+=e}s+=i.splitLineCount*t.lineHeight,c+=i.unifiedLineCount*t.lineHeight;let f=Hi(i);s+=f.split*t.lineHeight,c+=f.unified*t.lineHeight;let p=n===u?ei({fileDiff:e,hunkIndex:n,expandedHunks:l,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(p!=null){let e=(p.fromStart+p.fromEnd)*t.lineHeight;if(s+=e,c+=e,p.collapsedLines>0){let e=oi({type:r,metrics:t})?.totalHeight??0;s+=e,c+=e}}}if(e.hunks.length>0){let e=Mn(t);s+=e,c+=e}return{splitHeight:s,unifiedHeight:c}}function Hi(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 Ui(e,t)}function Ui(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 Wi=5e3,Gi=-1,Ki=class extends Fi{__id=`little-virtualized-file-diff:${++Gi}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=An(n)}setMetrics(e,t=!1){let n=An(e);(t||!ne(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!tn(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!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=!re(t,e),r=n&&ea(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:ta(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}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&rn(this.renderRange)){let t=qi(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=ra(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());prepareCodeViewItem(e,t,n,r){let i=!Pn(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=An(n.metrics),o=!0,s=!0);let{collapsed:c=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=G(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return si({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`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=ai({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=oi({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??G(this.metrics,t)+this.cache.fileAnnotationHeight,l;return si({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=ai({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=oi({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSimpleMode()&&this.computeApproximateSize(),this.virtualizer.instanceChanged(this,!0)};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(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,this.fileDiff==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1}=this.options,a=G(this.metrics,r);if(this.height+=a,i){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight(),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();let e=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(e==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return e}ensureEstimatedDiffHeights(){if(this.fileDiff==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:r,unifiedHeight:i}=Vi({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=r,this.cache.estimatedUnifiedHeight=i}validateComputedHeight(){if(this.fileContainer==null||this.fileDiff==null)return;let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height})}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,forceRender:i=!1,lineAnnotations:a,...o}={}){let{forceRenderOverride:s,isSetup:c}=this;this.forceRenderOverride=void 0;let l=this.syncLineAnnotations(a);if(l&&this.resetLayoutCache({includeEstimatedHeights:!1}),this.fileDiff??=r??(t!=null&&n!=null?Vr(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(c)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();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())return this.renderPlaceholder(this.height);let u=this.virtualizer.getWindowSpecs(),d=this.top??0,f=this.computeRenderRangeFromWindow(this.fileDiff,d,u);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:f,oldFile:t,newFile:n,lineAnnotations:a,forceRender:(s??i)||l,...o})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}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}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return na(this.options.hunkSeparators)}approximateLayoutCheckpoints(){if(this.cache.checkpoints.length>0||this.fileDiff==null||this.fileDiff.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,r=this.fileDiff.hunks.length-1,i=this.getDiffStyle(),a=this.getHunkSeparatorType(),o=t?!0:this.hunksRenderer.getExpandedHunksMap(),s=Ji(this.cache.heightDeltas),c=G(this.metrics,e)+this.cache.fileAnnotationHeight,l=0,u=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=l,o=l+e,u=Zi(a);for(;u<o;){let e=u-a,r=c+(e>0?n:0)+e*this.metrics.lineHeight+Qi(i,e)*this.metrics.lineHeight+Yi(s,t,t+e);this.cache.checkpoints.push({renderedLineIndex:u,lineIndex:t+e,top:r}),u+=Wi}c+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Yi(s,t,t+e)+r,l=o};for(let e=0;e<this.fileDiff.hunks.length;e++){let t=this.fileDiff.hunks[e];if(t==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let s=Qr({isPartial:this.fileDiff.isPartial,rangeSize:t.collapsedBefore,expandedHunks:o,hunkIndex:e,collapsedContextThreshold:n}),c=s.collapsedLines>0?ai({type:a,metrics:this.metrics,hunkIndex:e,hunkSpecs:t.hunkSpecs})?.totalHeight??0:0;u({rowCount:s.fromStart,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.rangeSize});let l=c;u({rowCount:s.fromEnd,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.fromEnd,preSeparatorHeight:l}),s.fromEnd>0&&(l=0);let d=e===r?ei({fileDiff:this.fileDiff,hunkIndex:e,expandedHunks:o,collapsedContextThreshold:n,errorPrefix:`VirtualizedFileDiff`}):void 0,f=d!=null&&d.collapsedLines>0?oi({type:a,metrics:this.metrics})?.totalHeight??0:0,p=d==null?0:d.fromStart+d.fromEnd,m=i===`split`?t.splitLineCount:t.unifiedLineCount,h=i===`split`?t.splitLineStart:t.unifiedLineStart;u({rowCount:m,startLineIndex:h,preSeparatorHeight:l,postSeparatorHeight:p===0?f:0,metadataOffsets:$i({diffStyle:i,hunk:t,rowCount:m})}),d!=null&&p>0&&u({rowCount:p,startLineIndex:h+m,postSeparatorHeight:f})}this.cache.totalLines=l}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}=Qr({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=ei({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}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=this.height,f=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,l),p=G(this.metrics,i),m=e.hunks.length>0?Mn(this.metrics):0,{fileAnnotationHeight:h}=this.cache,g=p+h,_=Math.max(0,d-p-h-m),v=this.hasFileAnnotations(e),y=t+p,b=h>0&&v&&y<r&&y+h>n;if(t<n-d||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};if(f<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),f=this.cache.totalLines>0?this.cache.totalLines:f;let x=Math.ceil(Math.max(r-n,0)/c),S=Math.ceil(x/s)*s+s,C=S/s,w=C,T=[],E=(n+r)/2,D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-S*c*2),s),O=t+(D?.top??g),ee=D?.renderedLineIndex??0,k,A,j;if(si({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:i,collapsedBefore:a,collapsedAfter:o,deletionLine:c,additionLine:d})=>{let f=d==null?c.splitLineIndex:d.splitLineIndex,p=d==null?c.unifiedLineIndex:d.unifiedLineIndex,m=(d?.noEOFCR??!1)||(c?.noEOFCR??!1),h=(a>0?ai({type:u,metrics:this.metrics,hunkIndex:e,hunkSpecs:i?.hunkSpecs}):void 0)?.totalHeight??0;O+=h;let _=ee%s===0,v=Math.floor(ee/s);if(_&&(T[v]=O-(t+g+h),j!=null)){if(j<=0)return!0;j--}let y=this.getLineHeight(l===`split`?f:p,m);return O>n-y&&O<r&&(k??=v),A==null&&O+y>E&&(A=v),j==null&&O>=r&&_&&(j=w),ee++,O+=y,o>0&&(O+=oi({type:u,metrics:this.metrics})?.totalHeight??0),!1}}),k==null){if(b)k=0,A=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m}}A??=k;let te=Math.round(A-C/2),ne=Math.max(0,Math.ceil(f/s)-C),M=Math.max(0,Math.min(te,ne)),re=M*s,ie=te<0?S+te*s:S,ae=T[M]??0,N=re===0?0:h+ae,P=M+ie/s,oe=P<T.length?_-T[P]:_-(O-t-g);return{startingLine:re,totalLines:ie,bufferBefore:N,bufferAfter:Math.max(0,oe)}}};function qi(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===en&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Ji(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 Yi({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Xi(e,n);return(t[Xi(e,r)]??0)-(t[i]??0)}function Xi(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 Zi(e){return Math.ceil(e/Wi)*Wi}function Qi(e,t){let n=0;for(let r of e)r<t&&n++;return n}function $i({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 ea(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.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function ta(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 na(e){return typeof e==`function`?`custom`:e??`line-info`}function ra(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function ia({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function aa(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:oa(n,e.startContentIndex)}}function oa(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}var sa={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},ca={display:`contents`};function la(){return null}var Q=r();function ua({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderMergeConflictUtility:s,lineAnnotations:c,getHoveredLine:l,getInstance:u}){let d=n?.(e),f=r?.(e),p=i?.(e);return(0,Q.jsxs)(Q.Fragment,{children:[d==null?(0,Q.jsxs)(Q.Fragment,{children:[f!=null&&(0,Q.jsx)(`div`,{slot:`header-prefix`,children:f}),p!=null&&(0,Q.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,Q.jsx)(`div`,{slot:C,children:d}),a!=null&&c?.map((e,t)=>(0,Q.jsx)(`div`,{slot:V(e),children:a(e)},t)),t!=null&&s!=null&&u!=null&&t.map(t=>{if(t==null)return;let n=da(t,e);return(0,Q.jsx)(`div`,{slot:n,style:ca,children:s(t,u)},n)}),o!=null&&(0,Q.jsx)(`div`,{slot:`gutter-utility-slot`,style:sa,children:o(l)})]})}function da(e,t){let n=aa(e,t);return n==null?void 0:ia({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var $=e(n(),1);function fa(e){let t=(0,$.useRef)(e);return(0,$.useInsertionEffect)(()=>void(t.current=e)),(0,$.useCallback)((...e)=>t.current(...e),[])}var pa=(0,$.createContext)(void 0);function ma(e,t){return typeof window>`u`&&t!=null?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Q.jsx)(Q.Fragment,{children:e})}var ha=(0,$.createContext)(void 0);function ga(){return(0,$.useContext)(ha)}var _a=typeof window>`u`?$.useEffect:$.useLayoutEffect;function va({fileDiff:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=ga(),u=r!==void 0,d=(0,$.useContext)(pa),f=(0,$.useRef)(null),p=fa(r=>{if(r!=null){if(f.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);l==null?f.current=new Fi(ya({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:d,!0):f.current=new Ki(ya({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),l,a,c?void 0:d,!0),f.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(f.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);f.current.cleanUp(),f.current=null}});return _a(()=>{let{current:i}=f;if(i==null)return;let a=ya({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c=!re(i.options,a);i.setOptions(a),i.render({forceRender:c,fileDiff:e,lineAnnotations:n}),r!==void 0&&i.setSelectedLines(r)}),{ref:p,getHoveredLine:(0,$.useCallback)(()=>f.current?.getHoveredLine(),[])}}function ya({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return!t&&!r&&!n?e:{...e,controlledSelection:t,renderCustomHeader:n?la:e?.renderCustomHeader,renderGutterUtility:r?la:e?.renderGutterUtility}}function ba({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderGutterUtility:f,disableWorkerPool:p=!1}){let{ref:h,getHoveredLine:g}=va({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:f!=null,hasCustomHeader:l!=null,disableWorkerPool:p});return(0,Q.jsx)(m,{ref:h,className:a,style:o,children:ma(ua({fileDiff:e,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderAnnotation:c,renderGutterUtility:f,lineAnnotations:r,getHoveredLine:g}),s)})}var xa={diffIndicators:`bars`,diffStyle:`unified`,disableFileHeader:!0,hunkSeparators:`line-info-basic`,lineDiffType:`word-alt`,overflow:`scroll`,theme:{dark:`github-dark`,light:`github-light`},themeType:`system`,unsafeCSS:`
1408
1408
  pre { font-family: var(--ui-font-family-mono); font-size: var(--ui-font-size-body-small); }
1409
- `};function xa(e,t){for(let[t,n]of Object.entries(e))Tt(t,n);for(let[e,n]of Object.entries(t))Tt(e,n);Tt(`Makefile`,`makefile`)}function Sa(e){let t=e.nativeEvent.composedPath().find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-code`));return t===void 0?e.currentTarget.querySelector(`.file-diff-renderer`)?.shadowRoot?.querySelector(`[data-code]`)??null:t}function Ca(e){let t=e.deltaX===0?e.shiftKey?e.deltaY:0:e.deltaX;if(t===0)return;let n=Sa(e);n!==null&&(n.scrollLeft+=t)}function wa({fileDiff:e}){return(0,Q.jsx)(`div`,{className:`min-w-0`,onWheel:Ca,children:(0,Q.jsx)(ya,{className:`file-diff-renderer`,disableWorkerPool:!0,options:ba,fileDiff:e})})}var Ta=class extends $.Component{state={failed:!1,fileDiff:this.props.fileDiff};static getDerivedStateFromProps(e,t){return e.fileDiff===t.fileDiff?null:{failed:!1,fileDiff:e.fileDiff}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}};function Ea(e){if(!(e.trim().length===0||/^(?:Binary files .* differ|GIT binary patch)\r?$/mu.test(e)))try{let t=Un(e,void 0,!0),n=t.length===1&&t[0]?.files.length===1?t[0].files[0]:void 0;return n!==void 0&&n.hunks.length>0?n:void 0}catch{return}}function Da({path:e,fileDiff:t}){let n=B(e),[r,i]=(0,$.useState)(null);return(0,$.useEffect)(()=>{let e=!0;return dt({langs:[n],themes:[`github-dark`,`github-light`]}).catch(()=>{}).finally(()=>{e&&i(n)}),()=>{e=!1}},[n]),r===n?(0,Q.jsx)(wa,{fileDiff:t}):(0,Q.jsx)(`div`,{className:`min-h-24`,role:`status`})}function Oa({path:e,patch:t,preloadLanguage:n=!1,unavailableLabel:r=e}){let i=(0,$.useMemo)(()=>Ea(t),[t]),a=(0,Q.jsx)(`div`,{className:`grid min-h-24 place-items-center text-body-small text-muted-foreground`,role:`status`,children:r});return i===void 0?a:(0,Q.jsx)(Ta,{fileDiff:i,fallback:a,children:n?(0,Q.jsx)(Da,{path:e,fileDiff:i}):(0,Q.jsx)(wa,{fileDiff:i})})}xa(a,o);function ka({change:e}){let{t}=i(`workbench`);return(0,Q.jsx)(Oa,{unavailableLabel:t(`diff.previewUnavailable`),path:e.path,patch:f(e)})}export{ka as default,He as n,Ue as r,Ve as t};
1409
+ `};function Sa(e,t){for(let[t,n]of Object.entries(e))Et(t,n);for(let[e,n]of Object.entries(t))Et(e,n);Et(`Makefile`,`makefile`)}function Ca(e){let t=e.nativeEvent.composedPath().find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-code`));return t===void 0?e.currentTarget.querySelector(`.file-diff-renderer`)?.shadowRoot?.querySelector(`[data-code]`)??null:t}function wa(e){let t=e.deltaX===0?e.shiftKey?e.deltaY:0:e.deltaX;if(t===0)return;let n=Ca(e);n!==null&&(n.scrollLeft+=t)}function Ta({fileDiff:e}){return(0,Q.jsx)(`div`,{className:`min-w-0`,onWheel:wa,children:(0,Q.jsx)(ba,{className:`file-diff-renderer`,disableWorkerPool:!0,options:xa,fileDiff:e})})}var Ea=class extends $.Component{state={failed:!1,fileDiff:this.props.fileDiff};static getDerivedStateFromProps(e,t){return e.fileDiff===t.fileDiff?null:{failed:!1,fileDiff:e.fileDiff}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}};function Da(e){if(!(e.trim().length===0||/^(?:Binary files .* differ|GIT binary patch)\r?$/mu.test(e)))try{let t=Wn(e,void 0,!0),n=t.length===1&&t[0]?.files.length===1?t[0].files[0]:void 0;return n!==void 0&&n.hunks.length>0?n:void 0}catch{return}}function Oa({path:e,fileDiff:t}){let n=B(e),[r,i]=(0,$.useState)(null);return(0,$.useEffect)(()=>{let e=!0;return ft({langs:[n],themes:[`github-dark`,`github-light`]}).catch(()=>{}).finally(()=>{e&&i(n)}),()=>{e=!1}},[n]),r===n?(0,Q.jsx)(Ta,{fileDiff:t}):(0,Q.jsx)(`div`,{className:`min-h-24`,role:`status`})}function ka({path:e,patch:t,preloadLanguage:n=!1,unavailableLabel:r=e}){let a=(0,$.useMemo)(()=>Da(t),[t]),o=(0,Q.jsx)(`div`,{className:`grid min-h-24 place-items-center text-body-small text-muted-foreground`,role:`status`,children:i(r)});return a===void 0?o:(0,Q.jsx)(Ea,{fileDiff:a,fallback:o,children:n?(0,Q.jsx)(Oa,{path:e,fileDiff:a}):(0,Q.jsx)(Ta,{fileDiff:a})})}Sa(c,s);function Aa({change:e}){let{t}=a(`workbench`);return(0,Q.jsx)(ka,{unavailableLabel:t(`diff.previewUnavailable`),path:e.path,patch:p(e)})}export{Aa as default,Ue as n,We as r,He as t};