@qredence/fleet 0.6.3 → 0.6.5

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 (314) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/web/client/assets/{DialogTitle-DiAm7YNe.js → DialogTitle-BwQ9k-MZ.js} +1 -1
  3. package/dist/web/client/assets/agent-disclosure-YgLa4c2y.js +1 -0
  4. package/dist/web/client/assets/{alert-dialog-CYE37KMM.js → alert-dialog-BfK7648p.js} +1 -1
  5. package/dist/web/client/assets/analytics-stub-BY-GADyA.js +1 -0
  6. package/dist/web/client/assets/arrow-up-DCwrqIrK.js +1 -0
  7. package/dist/web/client/assets/artifacts-panel-DDlPULVv.js +1 -0
  8. package/dist/web/client/assets/bot-DETalD3q.js +1 -0
  9. package/dist/web/client/assets/{button-Dl0ce3Y5.js → button-BrwYi6QP.js} +1 -1
  10. package/dist/web/client/assets/{card-DCEnYd2G.js → card-BScRdZNS.js} +1 -1
  11. package/dist/web/client/assets/chat-command-palette-AjGusIEp.js +1 -0
  12. package/dist/web/client/assets/chat-helpers-Bj7_hES7.js +1 -0
  13. package/dist/web/client/assets/check-BTwIaCtI.js +1 -0
  14. package/dist/web/client/assets/chevron-down-Bse1ggZM.js +1 -0
  15. package/dist/web/client/assets/chevron-right-BPCB1mOg.js +1 -0
  16. package/dist/web/client/assets/chunk-YOKDWASO-C8deEx7Z.js +143 -0
  17. package/dist/web/client/assets/circle-check-DBhaebaM.js +1 -0
  18. package/dist/web/client/assets/citations-DOkXsdCi.js +1 -0
  19. package/dist/web/client/assets/clsx-DB0hHKMi.js +1 -0
  20. package/dist/web/client/assets/{collapsible-CUxOjhDJ.js → collapsible-DsbKpD_Y.js} +1 -1
  21. package/dist/web/client/assets/{command-Cw4X8Bpk.js → command-DSxdh_1v.js} +1 -1
  22. package/dist/web/client/assets/composer-intent-C5pz72T6.js +62 -0
  23. package/dist/web/client/assets/create-project-dialog-zTSeGUup.js +1 -0
  24. package/dist/web/client/assets/{createBaseUIEventDetails-B58Jldei.js → createBaseUIEventDetails-DklXWq23.js} +1 -1
  25. package/dist/web/client/assets/createLucideIcon-CQY2ECfR.js +1 -0
  26. package/dist/web/client/assets/{dialog-BzcIOvFC.js → dialog-B9nXTto4.js} +1 -1
  27. package/dist/web/client/assets/{dist-DbHxXSgQ.js → dist-BJJVCio8.js} +1 -1
  28. package/dist/web/client/assets/dist-BogNzeK9.js +1 -0
  29. package/dist/web/client/assets/{ease-CMumuPlX.js → ease-2UPBQU5v.js} +1 -1
  30. package/dist/web/client/assets/eye-iNSvs0UA.js +1 -0
  31. package/dist/web/client/assets/file-text-cqOanUYv.js +1 -0
  32. package/dist/web/client/assets/folder-COBtkKZa.js +1 -0
  33. package/dist/web/client/assets/{fork-picker-dialog-BYRr-xTy.js → fork-picker-dialog-DEdHU89A.js} +1 -1
  34. package/dist/web/client/assets/gauge-0Nn96wfZ.js +1 -0
  35. package/dist/web/client/assets/git-branch-DZEh2mM2.js +1 -0
  36. package/dist/web/client/assets/globals-BiAbxPQ2.css +2 -0
  37. package/dist/web/client/assets/hard-drive-B3opVeEB.js +1 -0
  38. package/dist/web/client/assets/{highlighted-body-KPVGNVTW-CgT7gqvs.js → highlighted-body-KPVGNVTW-CZcNaoxi.js} +1 -1
  39. package/dist/web/client/assets/horizontal-resize-5AxYvGLA.js +1 -0
  40. package/dist/web/client/assets/index-NhnAdIsR.js +12 -0
  41. package/dist/web/client/assets/{input-CxZp56Im.js → input-BceH49B1.js} +1 -1
  42. package/dist/web/client/assets/{input-group-D7lAfKHR.js → input-group-DThl_vkS.js} +1 -1
  43. package/dist/web/client/assets/ipython-tool-CuSGRhXl.js +3 -0
  44. package/dist/web/client/assets/is-ref-object-CEXqIz6L.js +1 -0
  45. package/dist/web/client/assets/loader-circle-BmKYM_C4.js +1 -0
  46. package/dist/web/client/assets/markdown-C-Y9gskI.js +2 -0
  47. package/dist/web/client/assets/{markdown-code-CDTRq-HZ.js → markdown-code-BqFVdovL.js} +1 -1
  48. package/dist/web/client/assets/mermaid-HWGCJPDP-CVNXPao6.js +1 -0
  49. package/dist/web/client/assets/{message-queue-Dl8wbCOu.js → message-queue-BoNn57Po.js} +1 -1
  50. package/dist/web/client/assets/{model-selector-list-CHD8lMAl.js → model-selector-list-DDsuJCgB.js} +1 -1
  51. package/dist/web/client/assets/{notify-DjVixft7.js → notify-GSsGEKtR.js} +1 -1
  52. package/dist/web/client/assets/{openui-renderer-C4e9FOVR.js → openui-renderer-l1qI5JDt.js} +41 -41
  53. package/dist/web/client/assets/package-BkC-HSi-.js +1 -0
  54. package/dist/web/client/assets/pencil-Cbgq3ybX.js +1 -0
  55. package/dist/web/client/assets/plug-wCz-036u.js +1 -0
  56. package/dist/web/client/assets/prompt-input-BhVQxoyh.js +1 -0
  57. package/dist/web/client/assets/{prompt-suggestions-BNyTcyWg.js → prompt-suggestions-BRFWFm5y.js} +1 -1
  58. package/dist/web/client/assets/provider-catalog-L0c-bZv6.js +1 -0
  59. package/dist/web/client/assets/provider-label-Buq3HZrP.js +1 -0
  60. package/dist/web/client/assets/react-Cvdyeg_0.js +1 -0
  61. package/dist/web/client/assets/react-dom-B7th3XGm.js +1 -0
  62. package/dist/web/client/assets/refresh-cw-CqPE3kNY.js +1 -0
  63. package/dist/web/client/assets/{repl-panel-L9dmPqio.js → repl-panel-UQN9UFG7.js} +1 -1
  64. package/dist/web/client/assets/resource-helpers-CKbSmzpw.js +2 -0
  65. package/dist/web/client/assets/{resources-panel-mT-aMCvV.js → resources-panel-kp_UjnpX.js} +1 -1
  66. package/dist/web/client/assets/right-panel-context-DHKWoetk.js +1 -0
  67. package/dist/web/client/assets/right-panel-registry-gwgnEeUz.js +2 -0
  68. package/dist/web/client/assets/rotate-ccw-DLkfsmG9.js +1 -0
  69. package/dist/web/client/assets/routes-umGEy_Ak.js +16 -0
  70. package/dist/web/client/assets/safe-external-url-BnEhm9A0.js +1 -0
  71. package/dist/web/client/assets/search-Cb6fFWew.js +1 -0
  72. package/dist/web/client/assets/{session-reasoning-panel-8D2P7iaJ.js → session-reasoning-panel-BAtKTsjn.js} +1 -1
  73. package/dist/web/client/assets/session-tool-renderer-pGdW2MnV.js +1389 -0
  74. package/dist/web/client/assets/{session-tree-panel-CM4_wwrM.js → session-tree-panel-DF3kuF0P.js} +1 -1
  75. package/dist/web/client/assets/settings-dialog-C8YN5D1V.js +2 -0
  76. package/dist/web/client/assets/{skeleton-C3mo31Qu.js → skeleton-D5Y9nBfp.js} +1 -1
  77. package/dist/web/client/assets/{skeleton-loaders-BMa_G4yX.js → skeleton-loaders-DOKGa7CW.js} +1 -1
  78. package/dist/web/client/assets/sparkles-C4VQyMox.js +1 -0
  79. package/dist/web/client/assets/spinner-C3sPnLdu.js +1 -0
  80. package/dist/web/client/assets/square-BbTF3gLc.js +1 -0
  81. package/dist/web/client/assets/square-terminal-BLq2bQVF.js +1 -0
  82. package/dist/web/client/assets/{subagent-chat-panel-BESrXxAR.js → subagent-chat-panel-BIsmzS45.js} +1 -1
  83. package/dist/web/client/assets/subagent-transcript-CEUBL9sF.js +1 -0
  84. package/dist/web/client/assets/{subagents-panel-8aKOwWLs.js → subagents-panel-CFxWpUT0.js} +1 -1
  85. package/dist/web/client/assets/sun-C7zg8Oas.js +1 -0
  86. package/dist/web/client/assets/{surfaces-CpfsGAIA.js → surfaces-BULKVm-B.js} +1 -1
  87. package/dist/web/client/assets/switch-CoSNSJEY.js +1 -0
  88. package/dist/web/client/assets/terminal-Ceucj7us.js +1 -0
  89. package/dist/web/client/assets/toast-CS0pnDlS.js +1 -0
  90. package/dist/web/client/assets/tokens-CtP2s1Y3.js +1 -0
  91. package/dist/web/client/assets/tool-result-C-vs_tjQ.js +4 -0
  92. package/dist/web/client/assets/tool-timeline-B4ci1oJg.js +1 -0
  93. package/dist/web/client/assets/triangle-alert-BuzmrrqI.js +1 -0
  94. package/dist/web/client/assets/types-D5hZ8IyV.js +1 -0
  95. package/dist/web/client/assets/{ui-preferences-aG2U2jjW.js → ui-preferences-1YaENqef.js} +1 -1
  96. package/dist/web/client/assets/{use-presence-7I2qv4qI.js → use-presence-D2YmRKr3.js} +1 -1
  97. package/dist/web/client/assets/{use-reduced-motion-BOcG709U.js → use-reduced-motion-CaQBb3Qc.js} +2 -2
  98. package/dist/web/client/assets/{useBaseUiId-D9ZGPZ6f.js → useBaseUiId-BlzQUkVG.js} +1 -1
  99. package/dist/web/client/assets/{useControlled-CgAAWIy9.js → useControlled-CkQSkSv1.js} +1 -1
  100. package/dist/web/client/assets/utils-Dpy9ZFOr.js +1 -0
  101. package/dist/web/client/assets/virtualized-turn-list-DkJIWXFJ.js +6 -0
  102. package/dist/web/client/assets/workspace-panel-CjKMroC6.js +1 -0
  103. package/dist/web/client/assets/{workspace-path-nav-DqPbETfJ.js → workspace-path-nav-DmxBrMV6.js} +2 -2
  104. package/dist/web/client/assets/wrench-BYnD147U.js +1 -0
  105. package/dist/web/client/assets/x-DEU6H3M-.js +1 -0
  106. package/dist/web/client/bundle-budget.json +6 -6
  107. package/dist/web/server/_tanstack-start-manifest_v-B3Gb4p5p-DO2GL5VM.js +95 -0
  108. package/dist/web/server/{artifacts-panel-CwLVBqyi-CDORJY75.js → artifacts-panel-CGgpyc85-V3KXDVAX.js} +73 -66
  109. package/dist/web/server/{chat-command-palette-DUha04ia-5OV7WVJZ.js → chat-command-palette-BMR7RsuI-U5S4X44U.js} +52 -45
  110. package/dist/web/server/{chunk-ADYZWC5L.js → chunk-22XP6PHK.js} +50 -11
  111. package/dist/web/server/{chunk-XEG4JTND.js → chunk-2HOITUWV.js} +5 -5
  112. package/dist/web/server/{chunk-NZ6KQT2X.js → chunk-2XQYM4KB.js} +2 -2
  113. package/dist/web/server/{chunk-K6PTNSCW.js → chunk-36BG6OPK.js} +2 -2
  114. package/dist/web/server/chunk-3OOZPQZF.js +51 -0
  115. package/dist/web/server/{chunk-DP26GVWH.js → chunk-3YYNG52U.js} +5772 -4758
  116. package/dist/web/server/chunk-4IVORBQD.js +39 -0
  117. package/dist/web/server/{chunk-B2LF64HM.js → chunk-4LBXVBM7.js} +5 -5
  118. package/dist/web/server/{chunk-DKD32TRM.js → chunk-5FIJPXUA.js} +3343 -14
  119. package/dist/web/server/{chunk-O2IC376F.js → chunk-5TXDGMCK.js} +117 -1787
  120. package/dist/web/server/{chunk-YDDDSVNB.js → chunk-5VPNOUVY.js} +7 -5
  121. package/dist/web/server/chunk-7LUHWO5G.js +28 -0
  122. package/dist/web/server/chunk-7SZKAHLD.js +25 -0
  123. package/dist/web/server/{chunk-UE32PAV2.js → chunk-ACZS5EEZ.js} +4 -4
  124. package/dist/web/server/{chunk-CAPTFJOC.js → chunk-AWVHN432.js} +4 -4
  125. package/dist/web/server/{chunk-SDV3P3IW.js → chunk-BMXYQRMJ.js} +96 -78
  126. package/dist/web/server/chunk-BS4D5LRR.js +152 -0
  127. package/dist/web/server/{chunk-OVJYUWSQ.js → chunk-C2YGLMFE.js} +1 -1
  128. package/dist/web/server/chunk-CMOAC245.js +28 -0
  129. package/dist/web/server/{chunk-7FK6YEMA.js → chunk-CRCVWYBA.js} +2 -9
  130. package/dist/web/server/chunk-DIVIHC5K.js +100 -0
  131. package/dist/web/server/{chunk-XJ6TGSUB.js → chunk-EKVRPCBJ.js} +1 -1
  132. package/dist/web/server/{chunk-V5IFFLZQ.js → chunk-ELRLMFHT.js} +192 -142
  133. package/dist/web/server/{chunk-ZNFXBGLK.js → chunk-ERYPONRF.js} +1 -1
  134. package/dist/web/server/chunk-F3OV445J.js +25 -0
  135. package/dist/web/server/{chunk-5727TXOK.js → chunk-F5DJQ3PQ.js} +36 -36
  136. package/dist/web/server/{chunk-XSOUURPF.js → chunk-FAJILEF2.js} +142 -110
  137. package/dist/web/server/{chunk-UM3RHJNZ.js → chunk-FF2M3MLP.js} +2 -2
  138. package/dist/web/server/{chunk-IPV4GLJL.js → chunk-FHZAFF2A.js} +7 -24
  139. package/dist/web/server/chunk-FOMB2JR7.js +26 -0
  140. package/dist/web/server/{chunk-5RTGRTPD.js → chunk-FVWPODLT.js} +7 -6
  141. package/dist/web/server/chunk-G3WQTXJY.js +25 -0
  142. package/dist/web/server/{chunk-KZ35W5M7.js → chunk-G6NMFFZX.js} +41 -36
  143. package/dist/web/server/{chunk-YCCF676T.js → chunk-GLNLSEZJ.js} +7 -7
  144. package/dist/web/server/chunk-GNDXVFJY.js +28 -0
  145. package/dist/web/server/{chunk-HGVJEUV4.js → chunk-GR765UTQ.js} +4 -4
  146. package/dist/web/server/{chunk-RXUMFFUV.js → chunk-GSG3K6RA.js} +2 -2
  147. package/dist/web/server/chunk-HFN4TNR3.js +31 -0
  148. package/dist/web/server/{chunk-ETCO5KZK.js → chunk-I36LJXNY.js} +5 -5
  149. package/dist/web/server/{chunk-3Q3QKLHC.js → chunk-IIPUA4LB.js} +248 -212
  150. package/dist/web/server/{chunk-7PQTPSEE.js → chunk-INWLYZZ6.js} +1 -1
  151. package/dist/web/server/chunk-JCK6B7ZW.js +1677 -0
  152. package/dist/web/server/chunk-JEQQEY6O.js +30 -0
  153. package/dist/web/server/chunk-JVXQQYXB.js +154 -0
  154. package/dist/web/server/chunk-KABZXD6N.js +152 -0
  155. package/dist/web/server/{chunk-FTLJ66KU.js → chunk-L2SVMQWB.js} +12 -43
  156. package/dist/web/server/{chunk-TU2WNRAL.js → chunk-LBUHLBKK.js} +15 -13
  157. package/dist/web/server/chunk-LOFZS555.js +28 -0
  158. package/dist/web/server/{chunk-MJXXVQNA.js → chunk-LQRH6BP6.js} +25 -18
  159. package/dist/web/server/{chunk-WU6X3GPJ.js → chunk-MTVGA2MH.js} +72 -52
  160. package/dist/web/server/{chunk-T2UTBHJ4.js → chunk-N47UN47Y.js} +51 -39
  161. package/dist/web/server/chunk-NZ5YXXQ5.js +39 -0
  162. package/dist/web/server/{chunk-E5HALE4M.js → chunk-OYWUPJ72.js} +2 -2
  163. package/dist/web/server/{chunk-YVGCPUAW.js → chunk-PISNXFEK.js} +3 -3
  164. package/dist/web/server/{chunk-7HXCGBUP.js → chunk-PX7B5BTI.js} +5 -5
  165. package/dist/web/server/{chunk-33QA7BQJ.js → chunk-PYTU4DGR.js} +16 -10
  166. package/dist/web/server/{chunk-7E76R7MB.js → chunk-QHCQDVCQ.js} +1 -2
  167. package/dist/web/server/{chunk-FMAYMBRS.js → chunk-QN7KFCUW.js} +4318 -3649
  168. package/dist/web/server/chunk-QWWG3YC6.js +25 -0
  169. package/dist/web/server/chunk-RPGWRA2X.js +39 -0
  170. package/dist/web/server/chunk-RPWKCJHL.js +18 -0
  171. package/dist/web/server/chunk-RWYAKZCZ.js +39 -0
  172. package/dist/web/server/chunk-SGMJ5CGW.js +36 -0
  173. package/dist/web/server/chunk-SOZKLVNI.js +275 -0
  174. package/dist/web/server/{chunk-BQROC4PL.js → chunk-TNZKPEE6.js} +13 -7
  175. package/dist/web/server/chunk-TSOBRZPG.js +41 -0
  176. package/dist/web/server/{chunk-RJNGEU6C.js → chunk-UIUZ4ETR.js} +2 -2
  177. package/dist/web/server/{chunk-TLNZNR7C.js → chunk-UUDBEYKV.js} +2 -2
  178. package/dist/web/server/{chunk-HQ5TEXHT.js → chunk-UXS5E6OE.js} +4 -4
  179. package/dist/web/server/chunk-V7PDLH3T.js +73 -0
  180. package/dist/web/server/chunk-VCQ65B3G.js +28 -0
  181. package/dist/web/server/{chunk-TR2GA5OF.js → chunk-VHLBXWEN.js} +55 -40
  182. package/dist/web/server/{chunk-S2IBIJIG.js → chunk-WU6KNEGU.js} +46 -31
  183. package/dist/web/server/chunk-X37KO4BO.js +29 -0
  184. package/dist/web/server/chunk-X5AQ7KHU.js +22 -0
  185. package/dist/web/server/chunk-XZCIEF54.js +28 -0
  186. package/dist/web/server/{chunk-7NZ3FJDA.js → chunk-YBCP4V6T.js} +2 -2
  187. package/dist/web/server/{chunk-7UTDOTOU.js → chunk-YKJJDQAK.js} +28 -100
  188. package/dist/web/server/chunk-Z4OTKGMN.js +25 -0
  189. package/dist/web/server/chunk-ZJIELDZL.js +39 -0
  190. package/dist/web/server/{chunk-UDD5W4CR.js → chunk-ZMF45HAO.js} +58 -45
  191. package/dist/web/server/chunk-ZNED4KTU.js +105 -0
  192. package/dist/web/server/chunk-ZNI5AL4B.js +30 -0
  193. package/dist/web/server/create-project-dialog-xhTWmcx1-UQQU3MAT.js +295 -0
  194. package/dist/web/server/{fork-picker-dialog-DeMiLZtS-WTRTTP64.js → fork-picker-dialog-B5J-S5Nm-QOMVVHI7.js} +11 -11
  195. package/dist/web/server/{highlighted-body-KPVGNVTW-Ct6g7FVa-YZHVMLW4.js → highlighted-body-KPVGNVTW-D4Xsgab0-BZNKZ2YE.js} +3 -3
  196. package/dist/web/server/{markdown-BzNejPoZ-6ITTDAV6.js → markdown-DaTMVcnu-37DWI2JW.js} +4 -4
  197. package/dist/web/server/{markdown-code-DAwXuW6m-HHVELO6I.js → markdown-code-Cvz3a-x3-WAD4KC4A.js} +5 -5
  198. package/dist/web/server/{mermaid-HWGCJPDP-Ca26PwPZ-5EWRESLM.js → mermaid-HWGCJPDP-CDDePcVz-4BWFRGWL.js} +2 -2
  199. package/dist/web/server/{message-queue-Demph1x4-GGXJUUKO.js → message-queue-Dg2okv2L-SJTUUJS7.js} +17 -16
  200. package/dist/web/server/{model-selector-list-BeGQHwKV-UJYFO4KX.js → model-selector-list-Csw4nOra-IOMN5JMO.js} +23 -23
  201. package/dist/web/server/openui-renderer-CiWvcD3p-N6I66FOC.js +39 -0
  202. package/dist/web/server/{prompt-suggestions-yPZqX__K-3VGJC4IF.js → prompt-suggestions-h17Gu7u1-BS5SU2FY.js} +5 -5
  203. package/dist/web/server/{repl-panel-CgUF1qUw-3DFD2V53.js → repl-panel-CBwh0VGD-USDEOGGJ.js} +8 -9
  204. package/dist/web/server/{resources-panel-ChUliWV--JITAGS6Q.js → resources-panel-rn64m-sL-7QXEGRNX.js} +9 -10
  205. package/dist/web/server/{router-DfG45nTQ-3VXEUYG5.js → router-DOPFvRSC-G7G75P7U.js} +2663 -163
  206. package/dist/web/server/{routes-B9F9UfF1-UN2IVBMJ.js → routes-i2Ai-ZwX-SMSFONDQ.js} +2233 -2486
  207. package/dist/web/server/server.js +6 -6
  208. package/dist/web/server/{session-insights-panel-xgrkX1Rp-FDNURBXZ.js → session-insights-panel-DKkakWj6-ITHKDXF4.js} +1 -1
  209. package/dist/web/server/{session-reasoning-panel-m1RgcIph-NUXGXVKE.js → session-reasoning-panel-CXMCAM8C-HZMR5JCO.js} +9 -10
  210. package/dist/web/server/session-tool-renderer-jldnNioy-5ATOVAG5.js +46 -0
  211. package/dist/web/server/{session-tree-panel-rS0t1wbf-HNA6AJBY.js → session-tree-panel-WaHHv775-HRUHFSFO.js} +11 -11
  212. package/dist/web/server/{settings-dialog-CqkrDSnm-LFEKSS7Y.js → settings-dialog-C-xwPYy8-TFICZWEM.js} +554 -381
  213. package/dist/web/server/{start-DVUbMfrb-ELVIFRUY.js → start-QK6aG02q-RXFV6K5L.js} +1 -1
  214. package/dist/web/server/{subagent-chat-panel-Cf7QdDqH-DPPSVLSY.js → subagent-chat-panel-VEVu0QXU-DPWJFCYR.js} +50 -47
  215. package/dist/web/server/{subagents-panel-_JsUw-6t-MZWM5P45.js → subagents-panel-Cs3cBcsy-HTQBIYAS.js} +47 -45
  216. package/dist/web/server/tool-timeline-CfuizRid-L3Y3OSCH.js +15 -0
  217. package/dist/web/server/{workspace-panel-BHEB9nRM-Y6KGIVGP.js → workspace-panel-BU50q4Bu-JHTQPR6R.js} +109 -93
  218. package/package.json +1 -1
  219. package/dist/web/client/assets/agent-disclosure-CMrxF7L-.js +0 -1
  220. package/dist/web/client/assets/analytics-stub-C2vgmGm_.js +0 -1
  221. package/dist/web/client/assets/artifacts-panel-ClDpGWOU.js +0 -1
  222. package/dist/web/client/assets/bot-DbB9BKL0.js +0 -1
  223. package/dist/web/client/assets/bundle-mjs-cJTHqqzI.js +0 -1
  224. package/dist/web/client/assets/chat-BVMnC5Qh.js +0 -52
  225. package/dist/web/client/assets/chat-command-palette-YuyaJNbi.js +0 -1
  226. package/dist/web/client/assets/check-B3LlvM65.js +0 -1
  227. package/dist/web/client/assets/chevron-down-DUUprRP5.js +0 -1
  228. package/dist/web/client/assets/chevron-right-NVqQIoiO.js +0 -1
  229. package/dist/web/client/assets/chunk-YOKDWASO-Bte3iwlH.js +0 -143
  230. package/dist/web/client/assets/citations-DXqV2NLy.js +0 -1
  231. package/dist/web/client/assets/createLucideIcon-_dfI7Arx.js +0 -1
  232. package/dist/web/client/assets/dist-52wg4XPY.js +0 -1
  233. package/dist/web/client/assets/eye-CDHqtVoE.js +0 -1
  234. package/dist/web/client/assets/file-text-TmalmYrb.js +0 -1
  235. package/dist/web/client/assets/folder-vuNT4shY.js +0 -1
  236. package/dist/web/client/assets/gauge-BsDqNM1A.js +0 -1
  237. package/dist/web/client/assets/git-branch-CTq9aACS.js +0 -1
  238. package/dist/web/client/assets/globals-BtCXZXL_.css +0 -2
  239. package/dist/web/client/assets/hard-drive-BT7UxHQu.js +0 -1
  240. package/dist/web/client/assets/horizontal-resize-VLjLByUV.js +0 -1
  241. package/dist/web/client/assets/index-B9aXxpOv.js +0 -12
  242. package/dist/web/client/assets/ipython-tool-CkHaO3PW.js +0 -3
  243. package/dist/web/client/assets/is-ref-object-BcRWZ4l7.js +0 -1
  244. package/dist/web/client/assets/loader-circle-B5GIZGxd.js +0 -1
  245. package/dist/web/client/assets/markdown-BHkByC9K.js +0 -2
  246. package/dist/web/client/assets/mermaid-HWGCJPDP-CY3N5ECk.js +0 -1
  247. package/dist/web/client/assets/package-BKBPgwMP.js +0 -1
  248. package/dist/web/client/assets/pencil-CdO6qfv3.js +0 -1
  249. package/dist/web/client/assets/plug-BRROUIw-.js +0 -1
  250. package/dist/web/client/assets/prompt-input-WaGSKZCU.js +0 -1
  251. package/dist/web/client/assets/provider-catalog-ClVvphe0.js +0 -1
  252. package/dist/web/client/assets/provider-label-CwZ-KDxk.js +0 -1
  253. package/dist/web/client/assets/react-CwJFpaho.js +0 -1
  254. package/dist/web/client/assets/react-dom-DX3XddaT.js +0 -1
  255. package/dist/web/client/assets/refresh-cw-l9WPHRkq.js +0 -1
  256. package/dist/web/client/assets/resource-helpers-BuWybA8l.js +0 -2
  257. package/dist/web/client/assets/right-panel-context-CS8tJMzE.js +0 -1
  258. package/dist/web/client/assets/right-panel-registry-BnYCffmM.js +0 -2
  259. package/dist/web/client/assets/rotate-ccw-CfGhzOv7.js +0 -1
  260. package/dist/web/client/assets/routes-DUontXSG.js +0 -16
  261. package/dist/web/client/assets/safe-external-url-BbAom7Bm.js +0 -1
  262. package/dist/web/client/assets/search-BjcXAUrI.js +0 -1
  263. package/dist/web/client/assets/session-tool-renderer-Bd3dsE2D.js +0 -1395
  264. package/dist/web/client/assets/settings-dialog-DMTD9m6z.js +0 -2
  265. package/dist/web/client/assets/sparkles-BY5MFyk6.js +0 -1
  266. package/dist/web/client/assets/square-DQaQu9bp.js +0 -1
  267. package/dist/web/client/assets/square-terminal-BsopiuN7.js +0 -1
  268. package/dist/web/client/assets/subagent-transcript-CAqFJfMj.js +0 -1
  269. package/dist/web/client/assets/sun-D0llhiMU.js +0 -1
  270. package/dist/web/client/assets/switch-D3FhZU-S.js +0 -1
  271. package/dist/web/client/assets/terminal-BQAKkBY6.js +0 -1
  272. package/dist/web/client/assets/toast-lnCWGgSE.js +0 -1
  273. package/dist/web/client/assets/tokens-Ch5WqXC_.js +0 -1
  274. package/dist/web/client/assets/tool-result-B_yb2JoE.js +0 -4
  275. package/dist/web/client/assets/tool-timeline-VnMRQoLS.js +0 -1
  276. package/dist/web/client/assets/triangle-alert-GAYh_5d3.js +0 -1
  277. package/dist/web/client/assets/utils-Brtgag-m.js +0 -1
  278. package/dist/web/client/assets/virtualized-turn-list-mL3ONUUA.js +0 -6
  279. package/dist/web/client/assets/workspace-panel-CKF5JQl2.js +0 -1
  280. package/dist/web/client/assets/wrench-Myc12BTA.js +0 -1
  281. package/dist/web/client/assets/x-BGsDD848.js +0 -1
  282. package/dist/web/server/_tanstack-start-manifest_v-Cm8xE-Rb-TMLYN3GY.js +0 -93
  283. package/dist/web/server/chunk-2ST2ULW7.js +0 -24
  284. package/dist/web/server/chunk-3C4CFCIS.js +0 -19
  285. package/dist/web/server/chunk-3IHTZSBY.js +0 -22
  286. package/dist/web/server/chunk-4QD4PCVP.js +0 -19
  287. package/dist/web/server/chunk-4ZIEVI5O.js +0 -63
  288. package/dist/web/server/chunk-7CNGNFFK.js +0 -23
  289. package/dist/web/server/chunk-AHTO6GDS.js +0 -33
  290. package/dist/web/server/chunk-CHEC7TWB.js +0 -22
  291. package/dist/web/server/chunk-D7ELZVTI.js +0 -33
  292. package/dist/web/server/chunk-DLA5TLKX.js +0 -164
  293. package/dist/web/server/chunk-GS2IZGRC.js +0 -19
  294. package/dist/web/server/chunk-H5D5DX3K.js +0 -75
  295. package/dist/web/server/chunk-HFQZLPU2.js +0 -29
  296. package/dist/web/server/chunk-JBLHIEVG.js +0 -22
  297. package/dist/web/server/chunk-JDCCC7A7.js +0 -3382
  298. package/dist/web/server/chunk-JIULUYHT.js +0 -24
  299. package/dist/web/server/chunk-KBWUBWVJ.js +0 -60
  300. package/dist/web/server/chunk-LJ6Y7DBH.js +0 -128
  301. package/dist/web/server/chunk-M5RSPNYN.js +0 -22
  302. package/dist/web/server/chunk-O2DUZJYK.js +0 -19
  303. package/dist/web/server/chunk-OKL5ZRVB.js +0 -33
  304. package/dist/web/server/chunk-OMPXUTMX.js +0 -33
  305. package/dist/web/server/chunk-OOXWPL22.js +0 -22
  306. package/dist/web/server/chunk-SFTKGQ7H.js +0 -33
  307. package/dist/web/server/chunk-TNL4YV63.js +0 -29
  308. package/dist/web/server/chunk-UCA4WN66.js +0 -45
  309. package/dist/web/server/chunk-WWJF4RO2.js +0 -19
  310. package/dist/web/server/chunk-X7D6GFQU.js +0 -34
  311. package/dist/web/server/chunk-XA42CHF2.js +0 -22
  312. package/dist/web/server/openui-renderer-B4z18Brm-HSMKJ47D.js +0 -39
  313. package/dist/web/server/session-tool-renderer-CT65wuet-RQBMXHEZ.js +0 -46
  314. package/dist/web/server/tool-timeline-QL9k5dzA-RLU26HXT.js +0 -16
@@ -1,1395 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{t as n}from"./react-CwJFpaho.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{t as i}from"./utils-Brtgag-m.js";import{c as a,f as o,l as s,n as c,o as l,r as u}from"./ease-CMumuPlX.js";import{n as d,t as f}from"./use-reduced-motion-BOcG709U.js";import{t as p}from"./createLucideIcon-_dfI7Arx.js";import{i as m,n as h,r as g,t as _}from"./tool-result-B_yb2JoE.js";import{a as v,i as y,o as b,r as x,s as S}from"./citations-DXqV2NLy.js";import{t as C}from"./check-B3LlvM65.js";import{t as w}from"./chevron-down-DUUprRP5.js";import{t as T}from"./chevron-right-NVqQIoiO.js";import{n as E,t as D}from"./safe-external-url-BbAom7Bm.js";import{n as O,t as k}from"./file-text-TmalmYrb.js";import{n as A,t as j}from"./loader-circle-B5GIZGxd.js";import{a as M,n as ee,r as te,t as ne}from"./agent-disclosure-CMrxF7L-.js";import{a as re,i as ie,n as ae,r as oe,t as se}from"./ipython-tool-CkHaO3PW.js";import{n as ce,r as le,t as ue}from"./sparkles-BY5MFyk6.js";import{t as de}from"./eye-CDHqtVoE.js";import{t as fe}from"./git-branch-CTq9aACS.js";import{t as pe}from"./rotate-ccw-CfGhzOv7.js";import{t as me}from"./search-BjcXAUrI.js";import{t as he}from"./terminal-BQAKkBY6.js";import{t as ge}from"./wrench-Myc12BTA.js";import{t as _e}from"./x-BGsDD848.js";import{t as N}from"./preload-helper-Czpn1I53.js";import{a as ve,i as ye,n as be,o as xe,r as Se,s as Ce}from"./dist-CZDnnosQ.js";import{i as we,r as Te}from"./workspace-path-nav-DqPbETfJ.js";import{n as Ee,r as De,t as Oe}from"./collapsible-CUxOjhDJ.js";import{n as ke,t as Ae}from"./range-BWOHiLNe.js";import{s as je}from"./surfaces-CpfsGAIA.js";var Me=p(`chevrons-down`,[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]),Ne=p(`chevrons-up`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),Pe=p(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Fe=p(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),P=t(n(),1),F=r(),Ie=`__custom__`;function Le(e){return String.fromCharCode(65+e)}function Re(e,t,n){if(!e||e.kind===`skip`)return{selectedIds:[],customText:``,textValue:``};if(t===`text`)return{selectedIds:[],customText:``,textValue:e.text??``};let r=new Set(e.selectedIds??[]),i=e.text??``;return n&&i.trim().length>0&&r.add(Ie),{selectedIds:Array.from(r),customText:i,textValue:``}}function ze({questions:e,questionIndex:t=1,totalQuestions:n,onPreviousQuestion:r,onNextQuestion:a,submitLabel:o=`Send`,nextLabel:s=`Next`,skipLabel:c=`Skip`,allowSkip:l=!0,initialAnswer:u,onSubmit:d,onSkip:f,className:p}){let m=n??e.length,h=Math.max(1,Math.min(t,m)),g=e[h-1],_=g?.allowCustom??!1,[v,y]=(0,P.useState)(()=>Re(u,g?.kind,_).selectedIds),[b,x]=(0,P.useState)(()=>Re(u,g?.kind,_).customText),[S,C]=(0,P.useState)(()=>Re(u,g?.kind,_).textValue),w=m>1&&(!!r||!!a),T=h>1,E=h<m,D=h>=m,O=(0,P.useMemo)(()=>new Set(v),[v]),k=D?o:s,A=(0,P.useMemo)(()=>{if(g?.kind===`text`)return S.trim().length>0;let e=v.filter(e=>e!==Ie).length+ +(b.trim().length>0);if(g?.kind===`single`)return e===1;let t=g?.minSelections??1,n=g?.maxSelections;return e<t||typeof n==`number`&&e>n?!1:e>0},[g?.kind,g?.minSelections,g?.maxSelections,v,b,S]),j=e=>{y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},M=e=>{y([e])},ee=e=>{if(x(e),g){if(g.kind===`single`){y(e.trim().length>0?[Ie]:[]);return}y(t=>{let n=t.includes(Ie);return e.trim().length>0&&!n?[...t,Ie]:e.trim().length===0&&n?t.filter(e=>e!==Ie):t})}};return g?(0,F.jsxs)(`div`,{className:i(`flex flex-col gap-2 bg-background px-3 py-2`,p),children:[(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-px`,"data-total-questions":m,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,F.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded px-1 text-sm font-medium text-muted-foreground`,children:h}),(0,F.jsx)(`span`,{children:g.title})]})}),g.kind!==`text`&&(g.options?.length??0)>0&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-px`,children:[g.options.map((e,t)=>{let n=e.id??e.value??e.label,r=O.has(n);return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{g.kind===`single`?(M(n),_&&x(``)):j(n)},className:`-mx-2 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-secondary`,children:[(0,F.jsx)(`span`,{className:i(`inline-flex h-5 min-w-5 items-center justify-center rounded border px-1 text-sm font-medium`,r?`border-primary bg-primary text-primary-foreground`:`border-border bg-transparent text-muted-foreground`),children:Le(t)}),(0,F.jsxs)(`span`,{className:`text-sm text-foreground`,children:[e.label,e.description&&(0,F.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,e.description]})]})]},n)}),_&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,F.jsx)(`span`,{className:i(`inline-flex h-5 min-w-5 items-center justify-center rounded border px-1 text-sm font-medium`,v.includes(Ie)?`border-primary bg-primary text-primary-foreground`:`border-border bg-transparent text-muted-foreground`),children:Le(g.options.length)}),(0,F.jsx)(`input`,{value:b,onChange:e=>ee(e.target.value),placeholder:g.customPlaceholder??`Type your answer`,className:`h-7 w-full rounded-md border border-border bg-background px-2 text-base text-foreground md:text-sm`})]})]}),g.kind===`text`&&(0,F.jsx)(`textarea`,{value:S,onChange:e=>C(e.target.value),placeholder:g.placeholder??`Type your answer`,rows:3,className:`w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 text-base text-foreground md:text-sm`}),(0,F.jsxs)(`div`,{className:i(`flex items-center gap-1.5`,w?`justify-between`:`justify-end`),children:[w&&(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,F.jsx)(`button`,{type:`button`,onClick:r,disabled:!T,className:`h-6 rounded px-2 text-sm text-muted-foreground hover:text-foreground disabled:opacity-60`,children:`Previous`}),a&&(0,F.jsx)(`button`,{type:`button`,onClick:a,disabled:!E,className:`h-6 rounded px-2 text-sm text-muted-foreground hover:text-foreground disabled:opacity-60`,children:`Next`})]}),(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[l&&(0,F.jsx)(`button`,{type:`button`,onClick:()=>{f?.(),d({kind:`skip`})},className:`h-6 rounded px-2 text-sm text-muted-foreground transition-[background-color,color,transform] duration-150 hover:bg-muted/50 hover:text-foreground active:scale-[0.98]`,children:c}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>{if(!A||!g)return;if(g.kind===`text`){d({kind:`text`,questionId:g.id,text:S.trim()});return}let e=v.filter(e=>e!==Ie),t=b.trim()||void 0;d({kind:g.kind,questionId:g.id,selectedIds:e,text:t||void 0})},disabled:!A,className:`h-6 rounded bg-primary px-2.5 text-sm font-medium text-primary-foreground transition-[background-color,transform] duration-150 hover:bg-primary/90 active:scale-[0.98] disabled:opacity-60 disabled:hover:bg-primary disabled:active:scale-100`,children:k})]})]})]}):null}function Be(e){if(e.kind===`skip`)return`Skipped`;if(e.kind===`text`)return e.text||`Answered`;let t=e.selectedIds?.length?e.selectedIds.join(`, `):``;return e.text?t?`${t} (${e.text})`:e.text:t||`Answered`}function Ve({part:e}){let[t,n]=(0,P.useState)(e.input?.questionIndex??1),r=e.input?.questions??[],i=e.input?.totalQuestions??r.length,a=typeof e.input?.questionIndex==`number`,o=a?e.input?.questionIndex??1:r.length>0?t:e.input?.questionIndex??1,s=Math.max(1,Math.min(o,i)),c=r[s-1],[l,u]=(0,P.useState)({}),[d,f]=(0,P.useState)(e.input?.questionIndex);e.input?.questionIndex!==d&&(f(e.input?.questionIndex),typeof e.input?.questionIndex==`number`&&n(e.input.questionIndex));let[p,m]=(0,P.useState)(e.toolCallId);e.toolCallId!==p&&(m(e.toolCallId),u({}),n(e.input?.questionIndex??1));let h=e.output?.answer,g=Object.keys(l).length,_=i===1?!!h||g>=1:i>0&&g>=i,y=i>1&&!_,b=s>1,x=s<i,S=(0,P.useMemo)(()=>!_||i<=1?[]:Array.from({length:i},(e,t)=>({index:t+1,answer:l[t+1]})),[_,l,i]),C=(0,P.useMemo)(()=>_?S.length>0?S.map(e=>`${e.index}: ${e.answer?Be(e.answer):`Pending`}`).join(` • `):h?Be(h):l[s]?Be(l[s]):`Pending`:``,[_,S,h,l,s]);if(!c)return null;let T=()=>{b&&(e.input?.onPreviousQuestion?.(),a||n(e=>Math.max(1,e-1)))},D=()=>{x&&(e.input?.onNextQuestion?.(),a||n(e=>Math.min(i,e+1)))};return(0,F.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,F.jsxs)(`div`,{className:`flex h-7 items-center justify-between border-b border-border px-3 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(v,{className:`size-3.5`}),`Question`]}),y&&(0,F.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:T,disabled:!b,className:`inline-flex size-5 items-center justify-center rounded-[4px] hover:bg-secondary disabled:opacity-40`,"aria-label":`Previous question`,children:(0,F.jsx)(E,{className:`size-3.5`})}),(0,F.jsxs)(`span`,{children:[s,` of `,i]}),(0,F.jsx)(`button`,{type:`button`,onClick:D,disabled:!x,className:`inline-flex size-5 items-center justify-center rounded-[4px] hover:bg-secondary disabled:opacity-40`,"aria-label":`Next question`,children:(0,F.jsx)(w,{className:`size-3.5`})})]})]}),_?(0,F.jsx)(`div`,{className:`bg-background px-3 py-2 text-xs text-muted-foreground`,children:C}):(0,F.jsx)(ze,{questions:r,questionIndex:s,totalQuestions:i,initialAnswer:l[s],submitLabel:e.input?.submitLabel,nextLabel:e.input?.nextLabel,skipLabel:e.input?.skipLabel,allowSkip:e.input?.allowSkip,onSubmit:t=>{u(e=>({...e,[s]:t})),e.input?.onSubmitAnswer?.(t),s<i&&D()}},`${s}-${c.title}`)]})}function He(e){return e.split(`|`).map(e=>e.trim().split(/\s+/)[0]??``).filter(Boolean).slice(0,4).join(`, `)}function Ue({step:e,state:t,onComplete:n,approval:r}){re(t===`animating`,e.duration,n);let i=t===`animating`,a=e.bashCommand??e.toolDetail,o=He(a);return(0,F.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,F.jsxs)(`div`,{className:`flex h-7 items-center justify-between pr-2 pl-2.5`,children:[(0,F.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden`,children:i?(0,F.jsxs)(oe,{as:`span`,duration:1.2,className:`m-0 inline-flex h-full items-center truncate text-xs leading-none`,children:[`Running command: `,o]}):(0,F.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[`Ran command: `,o]})}),i&&(0,F.jsx)(`svg`,{className:`h-3 w-3 shrink-0 animate-spin text-muted-foreground`,viewBox:`0 0 16 16`,fill:`none`,children:(0,F.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`28`,strokeDashoffset:`7`,strokeLinecap:`round`})})]}),(0,F.jsxs)(`div`,{className:`overflow-hidden border-t border-border bg-background px-2.5 py-1.5 font-mono text-label leading-[16px]`,children:[(0,F.jsxs)(`div`,{className:`break-all`,children:[(0,F.jsx)(`span`,{className:`text-amber-600 select-none dark:text-amber-400`,children:`$ `}),(0,F.jsx)(`span`,{className:`text-foreground`,children:a})]}),!i&&e.bashOutput&&(0,F.jsx)(`div`,{className:`mt-1 max-h-[80px] overflow-hidden whitespace-pre-line text-muted-foreground`,children:e.bashOutput})]}),r&&(0,F.jsx)(ie,{isPending:i,...r})]})}var We=(0,P.memo)(function({part:e}){let t=e.input?.approval??e.args?.approval,{step:n,stepState:r}=ae(e,`Bash`);return(0,F.jsx)(Ue,{step:n,state:r,onComplete:()=>{},approval:t})});function Ge(e){let t=(0,P.useRef)(e);return(0,P.useInsertionEffect)(()=>void(t.current=e)),(0,P.useCallback)((...e)=>t.current(...e),[])}var Ke=(0,P.createContext)(void 0);function qe(){return(0,P.useContext)(Ke)}var Je={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Ye={display:`contents`};function Xe(){return null}var Ze=`diffs-container`,Qe=/(?=^diff --git)/gm,$e=/(?<=\n)/,et=/^(---|\+\+\+)\s+([^\t\r\n]+)/,tt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,nt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,rt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,it=`header-prefix`,at=`header-filename-suffix`,ot=`header-metadata`,st=`header-custom`,I={dark:`pierre-dark`,light:`pierre-light`},ct=`data-theme-css`,lt=`data-unsafe-css`,ut=`data-diffs-scrollbar-measure`,dt=`--diffs-scrollbar-gutter-measured`,ft=1e5,pt={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...pt});var mt=Object.freeze({fromStart:0,fromEnd:0}),ht={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},gt={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function _t(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function vt({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function L(e,t){return e-(t===0?0:1)}function R(e,t){return L(e,t)+t}function yt(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:bt(n,e.startContentIndex)}}function bt(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}function xt({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d}){let f=n?.(e),p=r?.(e),m=i?.(e),h=a?.(e);return(0,F.jsxs)(F.Fragment,{children:[f==null?(0,F.jsxs)(F.Fragment,{children:[p!=null&&(0,F.jsx)(`div`,{slot:`header-prefix`,children:p}),m!=null&&(0,F.jsx)(`div`,{slot:`header-filename-suffix`,children:m}),h!=null&&(0,F.jsx)(`div`,{slot:`header-metadata`,children:h})]}):(0,F.jsx)(`div`,{slot:st,children:f}),o!=null&&l?.map((e,t)=>(0,F.jsx)(`div`,{slot:_t(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=St(t,e);return(0,F.jsx)(`div`,{slot:n,style:Ye,children:c(t,d)},n)}),s!=null&&(0,F.jsx)(`div`,{slot:`gutter-utility-slot`,style:Je,children:s(u)})]})}function St(e,t){let n=yt(e,t);return n==null?void 0:vt({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function Ct(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function wt(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var Tt=new Set;function Et(e){let t=[],n=new Set;for(let r of Dt(e.themes)){let e=At(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return Et({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return Et({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Dt(e){return Ot(e)?[e]:e}function Ot(e){return At(e)||kt(e)}function kt(e){return typeof e.name==`string`&&typeof e.load==`function`}function At(e){return typeof e.getThemes==`function`}function jt(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Mt=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},Nt=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Pt=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Ft(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Mt(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 Nt(i));let c=r,l=s().then(e=>{let a=jt(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 Pt(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 z=Ft();function It(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=z.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,z.getResolvedTheme(n)??z.seedResolvedTheme(n,e);Tt.has(n)||(Tt.add(n),t.loadThemeSync(e))}}var Lt=new Map,Rt=new Map,zt=new Map,Bt=new Set;function Vt(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(Bt.has(n.name))continue;let e=Lt.get(n.name);e??(e=n,Lt.set(n.name,e)),Bt.add(e.name),t.loadLanguageSync(e.data)}}function Ht(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}async function Ut(e){if(Ht())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=Rt.get(e);if(t!=null)return t;try{let t=zt.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Ce,e)&&(t=Ce[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 Lt.has(e)||Lt.set(e,n),n});return Rt.set(e,n),await n}finally{Rt.delete(e)}}function Wt(e){return Lt.get(e)??Ut(e)}function Gt({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Kt(t)}}function Kt(e){return async()=>ve(jt(await e()))}var qt=`pierre`,Jt=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Yt=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],Xt=[...Yt,...Jt],Zt=new Set(Yt);function Qt(e){return Zt.has(e)?`light`:`dark`}var $t={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},en={"pierre-dark":()=>N(()=>import(`./pierre-dark-CpLgRqie.js`),[]),"pierre-dark-soft":()=>N(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>N(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>N(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>N(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[]),"pierre-light":()=>N(()=>import(`./pierre-light-CoaEpmwp.js`),[]),"pierre-light-soft":()=>N(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>N(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>N(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[]),"pierre-light-tritanopia":()=>N(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[])};function tn(e){return Gt({name:e,collection:qt,colorScheme:Qt(e),displayName:$t[e],load:en[e]})}var nn=Et({themes:Xt.map(e=>tn(e))}),rn=`shiki`,an=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],on=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),sn=new Set(an);function cn(e){return sn.has(e)?`light`:`dark`}var ln={andromeeda:()=>N(()=>import(`./andromeeda-vGVdxbeo.js`),[]),"aurora-x":()=>N(()=>import(`./aurora-x-CDeNXAV0.js`),[]),"ayu-dark":()=>N(()=>import(`./ayu-dark-DluEY0Gj.js`),[]),"ayu-light":()=>N(()=>import(`./ayu-light-C3h-C4tm.js`),[]),"ayu-mirage":()=>N(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>N(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]),"catppuccin-latte":()=>N(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>N(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]),"catppuccin-mocha":()=>N(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]),"dark-plus":()=>N(()=>import(`./dark-plus-Cs2F2srj.js`),[]),dracula:()=>N(()=>import(`./dracula-BHWKrbxM.js`),[]),"dracula-soft":()=>N(()=>import(`./dracula-soft-5eyTD99u.js`),[]),"everforest-dark":()=>N(()=>import(`./everforest-dark-sB-x3p7T.js`),[]),"everforest-light":()=>N(()=>import(`./everforest-light-Df2xbC6M.js`),[]),"github-dark":()=>N(()=>import(`./github-dark-C-LZuMrd.js`),[]),"github-dark-default":()=>N(()=>import(`./github-dark-default-DXG-b-1a.js`),[]),"github-dark-dimmed":()=>N(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>N(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]),"github-light":()=>N(()=>import(`./github-light-EUqPIrTm.js`),[]),"github-light-default":()=>N(()=>import(`./github-light-default-BXViO-2h.js`),[]),"github-light-high-contrast":()=>N(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>N(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]),"gruvbox-dark-medium":()=>N(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>N(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>N(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]),"gruvbox-light-medium":()=>N(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>N(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]),horizon:()=>N(()=>import(`./horizon-CE9ld1lL.js`),[]),"horizon-bright":()=>N(()=>import(`./horizon-bright-DSNQnXHK.js`),[]),houston:()=>N(()=>import(`./houston-CsvMBhTu.js`),[]),"kanagawa-dragon":()=>N(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]),"kanagawa-lotus":()=>N(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]),"kanagawa-wave":()=>N(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]),laserwave:()=>N(()=>import(`./laserwave-C_8bwKvT.js`),[]),"light-plus":()=>N(()=>import(`./light-plus-DVQuIRkW.js`),[]),"material-theme":()=>N(()=>import(`./material-theme-Bm3Qr25_.js`),[]),"material-theme-darker":()=>N(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]),"material-theme-lighter":()=>N(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]),"material-theme-ocean":()=>N(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]),"material-theme-palenight":()=>N(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]),"min-dark":()=>N(()=>import(`./min-dark-BSWPekZh.js`),[]),"min-light":()=>N(()=>import(`./min-light-DDpmG2fV.js`),[]),monokai:()=>N(()=>import(`./monokai-B_bV9PQ9.js`),[]),"night-owl":()=>N(()=>import(`./night-owl-DhmEMT88.js`),[]),"night-owl-light":()=>N(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]),nord:()=>N(()=>import(`./nord-Cb4Vim4T.js`),[]),"one-dark-pro":()=>N(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]),"one-light":()=>N(()=>import(`./one-light-D7Lr4KcI.js`),[]),plastic:()=>N(()=>import(`./plastic-DQwYfKfQ.js`),[]),poimandres:()=>N(()=>import(`./poimandres-DRFjx7u4.js`),[]),red:()=>N(()=>import(`./red-DX1BQOs8.js`),[]),"rose-pine":()=>N(()=>import(`./rose-pine-aMsaMD1D.js`),[]),"rose-pine-dawn":()=>N(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]),"rose-pine-moon":()=>N(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]),"slack-dark":()=>N(()=>import(`./slack-dark-DnToyrRv.js`),[]),"slack-ochin":()=>N(()=>import(`./slack-ochin-B2OO5cIa.js`),[]),"snazzy-light":()=>N(()=>import(`./snazzy-light-4G7pJPwS.js`),[]),"solarized-dark":()=>N(()=>import(`./solarized-dark-UdsmMDCL.js`),[]),"solarized-light":()=>N(()=>import(`./solarized-light-C1IUL_tW.js`),[]),"synthwave-84":()=>N(()=>import(`./synthwave-84-nFMaYfgc.js`),[]),"tokyo-night":()=>N(()=>import(`./tokyo-night-oM2G3aXe.js`),[]),vesper:()=>N(()=>import(`./vesper-DdrHHSXu.js`),[]),"vitesse-black":()=>N(()=>import(`./vitesse-black-fwtXNY1n.js`),[]),"vitesse-dark":()=>N(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]),"vitesse-light":()=>N(()=>import(`./vitesse-light-VbXTXTou.js`),[])};function un(e){return Gt({name:e,collection:rn,colorScheme:cn(e),load:ln[e]})}var dn=Et({themes:Object.freeze([...an.map(e=>un(e)),...on.map(e=>un(e))])});function fn(e){if(Ht())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(z.hasRegisteredTheme(e))return;let t=dn.getTheme(e);if(t!=null){z.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function pn(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function mn(e){fn(e);let t=await z.resolveTheme(e);return pn(e,t),t}function hn(e){return z.getResolvedTheme(e)??mn(e)}var B;async function gn({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){B??=Se({themes:[],langs:[`text`],engine:n===`shiki-wasm`?xe(N(()=>import(`./wasm-BnjxR4X6.js`),[])):be()});let r=vn(B)?await B:B;B=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=Wt(e);`then`in t?i.push(t):Vt(t,r)}let a=[];for(let t of e){let e=hn(t);`then`in e?a.push(e):It(e,B)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{Vt(e,r)}),Promise.all(a).then(e=>{It(e,r)})]),r}function _n(){if(B!=null&&!(`then`in B))return B}function vn(e=B){return e!=null&&`then`in e}for(let e of nn.getThemes())z.registerThemeIfAbsent(e.name,e.load);function yn(e=I){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var bn=new Map,xn={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Sn(e){if(bn.has(e))return bn.get(e)??`text`;if(xn[e]!=null)return xn[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(bn.has(t[1]))return bn.get(t[1])??`text`;if(xn[t[1]]!=null)return xn[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return bn.has(n)?bn.get(n)??`text`:xn[n]??`text`}function V(e){return{type:`text`,value:e}}function H({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Cn({name:e,width:t=16,height:n=16,properties:r}){return H({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[H({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function wn(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 Tn(e){return H({tagName:`div`,properties:{"data-gutter":``},children:e})}function En(e,t,n,r={}){return H({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[H({tagName:`span`,properties:{"data-line-number-content":``},children:[V(`${t}`)]})]})}function U(e,t,n){return H({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 Dn(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(V(`
2
- `)),e}var On=Symbol(`no-token`),kn=Symbol(`multiple-tokens`);function An(e){let t=jn(e);if(t!=null)return t;let n=On,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`){Nn(e,a);for(let t of e.children)Mn(t)}else Mn(e);r.push(e),i=[],a=void 0;return}for(let e of i)Mn(e);r.push(H({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==On){if(e===kn){n=kn;return}if(n===On){n=e;return}n!==e&&(n=kn)}};for(let t of e.children){let e=t.type===`element`?An(t):On;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 jn(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Mn(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Mn(t)}}function Nn(e,t){e.properties[`data-char`]=t}function Pn(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+Fn(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function Fn(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 In(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=wn(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&An(a),i.push(Dn(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(Rn,Ln),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Ln}}var Ln=Pn({classPrefix:`hl-`}),Rn={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 W(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var zn=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Bn=/^0(?:\.0+)?%?$/;function Vn(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 Hn(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 Un(e){if(e==null)return null;let t=Hn(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 Wn(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||zn.test(t))return!0;let n=Vn(t);return n!=null&&Bn.test(n)}function Gn(e,t,n){if(t==null||n==null)return!1;let r=Un(e),i=Un(t),a=Un(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Kn=new WeakMap;function qn(e){let t=Kn.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;G(r,`editor.background`,i),G(r,`editor.foreground`,a),G(r,`sideBar.background`,o),G(r,`sideBar.foreground`,s),G(r,`input.background`,n[`input.background`]??o),G(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),G(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),G(r,`gitDecoration.addedResourceForeground`,Jn(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),G(r,`gitDecoration.modifiedResourceForeground`,Jn(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),G(r,`gitDecoration.deletedResourceForeground`,Jn(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Wn(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Wn(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Yn(l,o)||Gn(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Kn.set(e,u),u}function G(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Jn(...e){for(let t of e)if(t!=null&&t!==``)return t}function Yn(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Xn({theme:e=I,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=qn(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${W(`global`)}fg:${a.fg};`,r+=`${W(`global`)}bg:${a.bg};`,r+=Zn(i,n)}else{let n=t.getTheme(e.dark),i=qn(n);r+=`${W(`global`)}dark:${i.fg};`,r+=`${W(`global`)}dark-bg:${i.bg};`,r+=Zn(n,`dark`),n=t.getTheme(e.light),i=qn(n),r+=`${W(`global`)}light:${i.fg};`,r+=`${W(`global`)}light-bg:${i.bg};`,r+=Zn(n,`light`)}return r}function Zn(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${W(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${W(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${W(`global`)}${t}modified-color:${a};`),n}function Qn(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`)}function $n(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function er(e,t){return Ct(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function tr(e){let t=e.lang??Sn(e.name),n=e.lang??(e.prevName==null?`text`:Sn(e.prevName));return t===`text`&&n===`text`}function K(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}function nr(e){return{...pt,...e}}function rr(e,t){let n=ir(e,t);return t?n:e.diffHeaderHeight+n}function ir(e,t){return e.paddingTop??(t?e.spacing:0)}function ar(e){return e.paddingBottom??e.spacing}function or(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function sr(e){return[L(e.additionStart,e.additionCount)+1,R(e.additionStart,e.additionCount)+1]}function q({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 cr(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-R(t.additionStart,t.additionCount),r=e.deletionLines.length-R(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function lr({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-R(n.additionStart,n.additionCount),i=e.deletionLines.length-R(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function J({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=lr({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 ur({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=sr(a);if(t<o){let s=q({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=J({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=sr(a);return t<o+i.fromStart||t>=o+i.rangeSize}function dr({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=sr(n),l=q({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=J({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function fr({type:e,metrics:t}){return t.hunkSeparatorHeight??or(e)}function pr({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function mr({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 hr(e){return e!==`simple`&&e!==`metadata`}function gr({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!mr({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=fr({type:e,metrics:t}),a=pr({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function _r({type:e,metrics:t}){if(!hr(e))return;let n=fr({type:e,metrics:t}),r=pr({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function vr({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=yr({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=L(r.deletionStart,r.deletionCount),s=L(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=q({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?J({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(Sr(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,Sr(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(Sr(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=Cr(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(wr({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(Sr(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function yr({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=br({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 br({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=q({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?J({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 xr(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 Sr(e,t,n,r,i,a){let[o,s]=xr(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 Cr(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 wr({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 Y=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}},Tr=new class extends Y{};function Er(e,t,n){return Tr.diff(e,t,n)}function Dr(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Or(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 kr(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 Ar(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 jr(e,t){return kr(e,t,``)}function Mr(e,t){return Ar(e,t,``)}function Nr(e,t){return t.slice(0,Pr(e,t))}function Pr(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 Fr(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 Ir(e,t){if(t)return Rr(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Lr(e,t){if(t)return Rr(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Rr(e,t){if(!t)return[Lr(e),Ir(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Fr(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var zr=`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}`,Br=RegExp(`[${zr}]+|\\s+|[^${zr}]`,`ug`);new class extends Y{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=Fr(e,r)}else n=e.match(Br)||[];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)&&Vr(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Vr(n,i,r,null,t.intlSegmenter),e}};function Vr(e,t,n,r,i){if(t&&n){let[a,o]=Rr(t.value,i),[s,c]=Rr(n.value,i);if(e){let r=Dr(a,s);e.value=Ar(e.value,s,r),t.value=jr(t.value,r),n.value=jr(n.value,r)}if(r){let e=Or(o,c);r.value=kr(r.value,c,e),t.value=Mr(t.value,e),n.value=Mr(n.value,e)}}else if(n){if(e){let e=Lr(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Lr(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Lr(r.value,i),[a,o]=Rr(t.value,i),s=Dr(n,a);t.value=jr(t.value,s);let c=Or(jr(n,s),o);t.value=Mr(t.value,c),r.value=kr(r.value,n,c),e.value=Ar(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Lr(r.value,i),n=Nr(Ir(t.value,i),e);t.value=Mr(t.value,n)}else if(e){let n=Nr(Ir(e.value,i),Lr(t.value,i));t.value=jr(t.value,n)}}var Hr=new class extends Y{tokenize(e){let t=RegExp(`(\\r?\\n)|[${zr}]+|[^\\S\\n\\r]+|[^${zr}]`,`ug`);return e.match(t)||[]}};function Ur(e,t,n){return Hr.diff(e,t,n)}var Wr=new class extends Y{constructor(){super(...arguments),this.tokenize=Kr}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
3
- `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
4
- `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
5
- `)&&(e=e.slice(0,-1)),t.endsWith(`
6
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Gr(e,t,n){return Wr.diff(e,t,n)}function Kr(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
7
- `));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 qr(e){return e==`.`||e==`!`||e==`?`}new class extends Y{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(qr(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 Y{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Y{constructor(){super(...arguments),this.tokenize=Kr}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(Jr(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 Jr(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;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]=Jr(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]=Jr(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Y{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Yr(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Xr(e){if(!Yr(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 Zr={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Qr(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;Gr(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Gr(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||ti(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(`
8
- `)?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 $r(e,t){if(t||=Zr,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=>$r(e,t)).join(`
9
- `)}let n=[];if(e.isGit){if(t=Zr,!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 `+Xr(r)+` `+Xr(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 `+Xr((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Xr((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Xr((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Xr((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(`--- `+Xr(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Xr(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(`
10
- `)+`
11
- `}function ei(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Qr(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?$r(e,o.headerOptions):void 0)}}))}else{let s=Qr(e,t,n,r,i,a,o);return s?$r(s,o?.headerOptions):void 0}}function ti(e){let t=e.endsWith(`
12
- `),n=e.split(`
13
- `).map(e=>e+`
14
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function ni({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 ri({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])}var ii={forcePlainText:!1};function ai(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=ii){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=Xn({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)??si();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)}vr({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&&oi({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}=ci({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 oi({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=K(e),t=K(t),e.length>s||t.length>s))return;let c=o===`char`?Er(e,t):Ur(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?(ri({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),ri({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?ri({item:e,arr:l,enableJoin:d,isLastItem:t}):ri({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(ni({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(ni({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function si(){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 ci({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=I,...l}}){let u=s??Sn(e.name),d=s??Sn(t.name),{state:f,transformers:p}=In(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:W(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:W(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Qn(i.codeToHast(K(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Qn(i.codeToHast(K(t.contents),m)))}}var li=(0,P.createContext)(void 0);function ui(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 di(e,t){let n=e?.theme??I,r=t?.theme??I,i=fi(e),a=fi(t);return Ct(n,r)&&ui(e,t,[`theme`,`parseDiffOptions`])&&ui(i,a)}function fi(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}var pi=new Set,mi=null;function hi(e){pi.add(e),mi??=requestAnimationFrame(_i)}function gi(e){pi.delete(e)&&pi.size===0&&mi!=null&&(cancelAnimationFrame(mi),mi=null)}function _i(e){let t=new Set(pi);pi.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}mi=pi.size>0?requestAnimationFrame(_i):null}function vi(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}var yi=new TextEncoder,bi=new TextDecoder(`utf-8`,{ignoreBOM:!0}),xi=/[\uD800-\uDFFF]/,Si=1024,Ci=new Uint8Array(Si);function wi(){Ci.length!==Si&&(Ci=new Uint8Array(Si))}function X(e){if(e.length===0)return e;if(xi.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Ci.length<t&&(Ci=new Uint8Array(t));let{written:n}=yi.encodeInto(e,Ci);return bi.decode(Ci.subarray(0,n))}var Ti=4096,Ei=.5;function Di(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=ki(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}Oi(t,e)}}function Oi(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function ki(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Ti)return null;let c=[];for(let t=0;t<n;t++)c.push(ji(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(ji(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=Mi(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Ei:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var Ai=/\s+/g;function ji(e){return e.replace(Ai,``)}function Mi(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function Ni(e,t){try{return Pi(e,t)}finally{wi()}}function Pi(e,{cacheKey:t,isGitDiff:n=Qe.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=Hi(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Ii(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=zi(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?Fi(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Fi(r.contents):[],cacheKey:Wi(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(nt),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=X(r.trim()),n!==r&&(c.prevName=X(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?tt:et):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=X(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=X(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=X(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=X(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=X(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=X(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(rt)??[];t!=null&&(c.prevObjectId=X(t)),n!=null&&(c.newObjectId=X(n)),r!=null&&(c.mode=X(r))}e.startsWith(`rename from `)&&(c.prevName=X(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=X(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
15
- `||s[s.length-1]===`\r`||s[s.length-1]===`\r
16
- `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:Wi(p.hunkContext),hunkSpecs:X(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&Li(t)&&!Ri(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=Gi(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Ki(t);(g==null||g.type!==`change`)&&(g=qi(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=Ki(t);(g==null||g.type!==`change`)&&(g=qi(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=Ki(t);(g==null||g.type!==`context`)&&(g=qi(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=K(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=K(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(L(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=R(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=R(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),Di(c),c}}function Fi(e){let t=Ii(e);for(let e=0;e<t.length;e++)t[e]=X(t[e]);return t}function Ii(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
17
- `,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 Li(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Ri(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
18
- `&&n!==`\r`)return!1}return!0}function zi(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Bi(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Bi(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Bi(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Bi(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=Vi(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Bi(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 Vi(e){return e.endsWith(`\r
19
- `)?e.slice(0,-2):e.endsWith(`
20
- `)?e.slice(0,-1):e}function Hi(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:Ui(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=Ui(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function Ui(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function Wi(e){return e==null?e:X(e)}function Gi(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Ki(e){let t=e.slice(1);return X(t===``?`
21
- `:t)}function qi(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 Ji=`/dev/null`;function Yi(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Xi(),a=t??Xi(),o=Ni(ei(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Xi(){return{name:Ji,contents:``}}function Zi(e,t){let n=Yi({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Qi(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function $i(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function ea(e,t){return t.length>0&&t.length<e.deletionLines.length&&$i(t)}function ta(e,t,n){let r=e.deletionLines.join(``),i=Qi(t.length,r),a=Yi({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function na(e,t){return ta(e,[``],t)}function ra(e,t){if(e.additionLines.length===0)return na(e,t);if(ea(e,e.additionLines))return ta(e,e.additionLines,t);let n=e.additionLines,r=Zi(e,t);return aa(r,n),r}function ia(e){return e.length>1&&e.at(-1)===``}function aa(e,t){if(!ia(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&R(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,ha(e);return}}}function oa(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return sa(e,Zi(e,n));let r=Array.from(t);if(r.length===0)return sa(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||K(r)===K(i))return sa(e,Zi(e,n))}let i=ca(e,r);if(i.size===0)return sa(e,Zi(e,n));for(let t of i)if(!ua(e,t,n))return sa(e,Zi(e,n));return ha(e),cr(e)?sa(e,Zi(e,n)):sa(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function sa(e,t){return Object.assign(e,t),t}function ca(e,t){let n=new Set;for(let r of t){let t=la(e,r);if(t==null)return new Set;n.add(t)}return n}function la(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function ua(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=Yi({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(fa(r,s),da(e,t),!0)}function da(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
22
- `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
23
- `)}function fa(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>pa(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,ma(e)}function pa(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function ma(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function ha(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(L(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,ma(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=R(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-R(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var ga=new WeakMap;function _a(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function va(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function ya(e,t){let n=e.hunks,r=e.additionLines,i=_a(r),a=i===r?e:{...e,additionLines:i},o=ka(n,Oa(a,t),e.deletionLines.length),s=Ma(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Ha(e),aa(e,r),Fa(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function ba(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<Ra(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Ra(r);if(i==null||t<i||o!=null&&o!==s)return ya(e,n);o=s}if(o!=null){if(xa(e,i,o,r,n)){e.editSessionDirty=!0;return}return ya(e,n)}}function xa(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=Sa(e),o=e.hunks[n];if(o.hunkContent.some(Ca))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function Sa(e){let t=ga.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return ga.set(e,{lines:e.deletionLines,set:n}),n}function Ca(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function wa(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function Ta(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=q({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=za(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=J({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=za(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Ea(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=za(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,za(i)+i.deletionCount,e.deletionLines.length),n}function Da(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Zi(e,t):ra(e,t)),!0)}function Oa(e,t){if(va(e.deletionLines,e.additionLines)==null)return[];let n=Yi({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=pa(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function ka(e,t,n){let r=e.map((e,t)=>{let n=za(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&Aa(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=ja(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function Aa(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function ja(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function Ma(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);Pa(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);Pa(s,c,i,r),r+=c,i+=c,n.push(Na(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function Na(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:Ba(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Va(t.additionStart,r),deletionStart:Ba(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Va(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Ba(t.deletionStart,i)},${i} +${Ba(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return ma(s),s}function Pa(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Fa(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(za(r)!==za(i)||r.deletionCount!==i.deletionCount||Ra(r)!==Ra(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Ia(r,i))return!0}return!1}function Ia(e,t){let n=La(e),r=La(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*La(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function Ra(e){return L(e.additionStart,e.additionCount)}function za(e){return L(e.deletionStart,e.deletionCount)}function Ba(e,t){return t===0?e:e+1}function Va(e,t){return t===0?e-1:e}function Ha(e){ha(e);for(let t=0;t<e.hunks.length;t++)da(e,t)}function Ua(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}var Wa=`-1,-1`;function Ga(e){return e?.some(e=>e.lineNumber===0)??!1}function Ka(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function qa(e){return e.startingLine===0&&e.totalLines>0}function Ja(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ya(){return H({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Cn({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Xa(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var Za=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),gi(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||vi(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&Xa(e.composedPath())||(Z(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||(Z(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Z(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Z(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();Z(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Z(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=no(i)&&this.hoveredLine?.lineElement===i.lineElement;to(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),to(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),no(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(io(i)&&p!=null){p(i);break}if(ro(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!no(i))break;to(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,Z(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})()),Z(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Z(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();Xa(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Ja(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=ye(Ya());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);eo(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(so(t));if(eo(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(eo(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(eo(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&&Xa(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=so(e);if(t&&Xa(n))return;let r=co(e);return r==null?this.pathFromAnnotationSlot(e):so(r)}pathFromAnnotationSlot(e){let t=uo(lo(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:so(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=fo(t)?t:fo(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)}vi(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,hi(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{gi(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!mo(this.renderedSelectedLinesState,n),i=!mo(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);ao(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=go(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=go(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:oo(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:oo(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:ho(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:ho(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 Qa({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:$a({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 $a({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 eo(e){return e!=null&&`kind`in e&&e.kind===`line`}function to(e){return e!=null&&`kind`in e&&e.kind===`token`}function no(e){return eo(e)||to(e)}function ro(e){return`type`in e&&e.type===`line-info`}function io(e){return`kind`in e&&e.kind===`merge-conflict-action`}function ao(e){return e===`current`||e===`incoming`||e===`both`}function oo(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function so(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function co(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 lo(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 uo(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 fo(e){return e!=null&&typeof e.elementFromPoint==`function`}function po(e,t){return e===t||vi(e??void 0,t??void 0)}function mo(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&po(e?.range??null,t.range)}function ho(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function go(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 Z(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 _o=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),bo(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?Co(t):wo(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:vo(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:yo(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&xo(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function vo(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function yo(e){return Math.max(Math.ceil(e),0)}function bo(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?xo(e,{codeWidthChanged:!0,numberWidthChanged:!0}):So(e))}function xo(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function So(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function Co(e){e.codeElement.isConnected&&So(e)}function wo(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function To(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 Eo(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!Bt.has(t))return!1;return!0}function Do(e){for(let t of yn(e))if(!Tt.has(t))return!1;return!0}function Oo(e,t){return e.endsWith(`\r
24
- `)?t+`\r
25
- `:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
26
- `)?t+`
27
- `:t}function ko(e){return H({tagName:`div`,children:[H({tagName:`div`,children:e.annotations?.map(e=>H({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Ao(e,t){return H({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function jo(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 Mo({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 H({tagName:`div`,children:[t===`custom`?H({tagName:`slot`,properties:{name:st}}):No({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[Po(r)]],properties:i})}function No({name:e,prevName:t,iconType:n}){let r=[H({tagName:`slot`,properties:{name:it}}),Cn({name:jo(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(H({tagName:`div`,children:[H({tagName:`bdi`,children:[V(t)]})],properties:{"data-prev-name":``}})),r.push(Cn({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(H({tagName:`div`,children:[H({tagName:`bdi`,children:[V(e)]})],properties:{"data-title":``}})),r.push(H({tagName:`slot`,properties:{name:at}})),H({tagName:`div`,children:r,properties:{"data-header-content":``}})}function Po(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(H({tagName:`span`,children:[V(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(H({tagName:`span`,children:[V(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(H({tagName:`slot`,properties:{name:ot}})),H({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Fo(e){return H({tagName:`pre`,properties:Io(e)})}function Io({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;`}}function Lo(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:yn(t),preferredHighlighter:n}}var Ro=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
28
- <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
29
- <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"/>
30
- </symbol>
31
- <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
32
- <path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
33
- </symbol>
34
- <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
35
- <path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
36
- </symbol>
37
- <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
38
- <path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
39
- </symbol>
40
- <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
41
- <path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
42
- </symbol>
43
- <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
44
- <path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
45
- </symbol>
46
- <symbol id="diffs-icon-expand" viewBox="0 0 16 16">
47
- <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
48
- </symbol>
49
- <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
50
- <path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
51
- </symbol>
52
- <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
53
- <path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
54
- </symbol>
55
- <symbol id="diffs-icon-plus" viewBox="0 0 16 16">
56
- <path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
57
- </symbol>
58
- <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
59
- <path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 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.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
60
- </symbol>
61
- <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
62
- <path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 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.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
63
- </symbol>
64
- <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
65
- <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 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.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
66
- </symbol>
67
- <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
68
- <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.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.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
69
- </symbol>
70
- <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
71
- <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.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.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
72
- </symbol>
73
- <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
74
- <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 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.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
75
- </symbol>
76
- <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
77
- <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"/>
78
- </symbol>
79
- </svg>`;function zo(e,t){return e==null||t==null?e===t:Vo(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 Bo={};function Vo(e=Bo,t=Bo){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 Ho(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Uo(){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 Wo(){let e=document.createElement(`style`);return e.setAttribute(lt,``),e}var Go;function Ko(e){if(Go!=null)return Go;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(ut,`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),Go=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),Go}function qo(e){return`${dt}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var Jo=`@layer base {
80
- :host {
81
- --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
82
- "Courier New", monospace;
83
- --diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
84
- "Noto Sans", "Liberation Sans", Arial, sans-serif;
85
- --diffs-mixer: light-dark(#000, #fff);
86
- --diffs-gap-fallback: 8px;
87
- --diffs-scrollbar-gutter-fallback: 6px;
88
- --diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
89
- --diffs-added-light: #0dbe4e;
90
- --diffs-added-dark: #5ecc71;
91
- --diffs-modified-light: #009fff;
92
- --diffs-modified-dark: #69b1ff;
93
- --diffs-deleted-light: #ff2e3f;
94
- --diffs-deleted-dark: #ff6762;
95
- --diffs-warning-light: #d5a910;
96
- --diffs-warning-dark: #ffd452;
97
- color-scheme: light dark;
98
- font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
99
- font-size: var(--diffs-font-size, 13px);
100
- line-height: var(--diffs-line-height, 20px);
101
- font-feature-settings: var(--diffs-font-features);
102
- --diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
103
- --diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));
104
- --diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));
105
- --diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));
106
- --diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));
107
- --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
108
- --diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));
109
- --diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
110
- --diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark)))));
111
- --diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark)))));
112
- --diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark)))));
113
- --diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));
114
- --diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2)));
115
- --diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));
116
- --diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2)));
117
- --diffs-selection-base: var(--diffs-modified-base);
118
- --diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));
119
- background-color: var(--diffs-bg);
120
- color: var(--diffs-fg);
121
- display: block;
122
- }
123
-
124
- pre, code, [data-error-wrapper] {
125
- isolation: isolate;
126
- font-family: var(--diffs-font-family, var(--diffs-font-fallback));
127
- outline: none;
128
- margin: 0;
129
- padding: 0;
130
- display: block;
131
- }
132
-
133
- pre, code {
134
- background-color: var(--diffs-bg);
135
- }
136
-
137
- code {
138
- contain: content;
139
- }
140
-
141
- input, button {
142
- font-family: inherit;
143
- font-size: inherit;
144
- line-height: inherit;
145
- }
146
-
147
- *, :before, :after {
148
- box-sizing: border-box;
149
- }
150
-
151
- [data-icon-sprite] {
152
- display: none;
153
- }
154
-
155
- [data-diffs-header], [data-separator] {
156
- font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
157
- }
158
-
159
- [data-diffs-header][data-sticky] {
160
- z-index: 1;
161
- background-color: var(--diffs-bg);
162
- position: sticky;
163
- top: 0;
164
- }
165
-
166
- [data-file-info] {
167
- color: var(--fg);
168
- background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
169
- border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
170
- padding: 10px;
171
- font-weight: 700;
172
- }
173
-
174
- [data-diff], [data-file] {
175
- --diffs-grid-number-column-width: minmax(min-content, max-content);
176
- --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
177
-
178
- &[data-dehydrated] {
179
- --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
180
- }
181
-
182
- &:hover [data-code]::-webkit-scrollbar-thumb {
183
- background-color: var(--diffs-bg-context);
184
- }
185
- }
186
-
187
- @supports (-webkit-touch-callout: none) {
188
- :host {
189
- --diffs-scrollbar-gutter-fallback: 0px;
190
- }
191
- }
192
-
193
- [data-line] span {
194
- color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
195
- background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
196
- font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
197
- font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
198
- text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
199
- }
200
-
201
- [data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
202
- --diffs-computed-decoration-bg: var(--diffs-bg);
203
- --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
204
- --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
205
- --diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
206
- --diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
207
- --diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
208
- --diffs-line-bg: var(--diffs-computed-hovered-line-bg);
209
- color: var(--diffs-fg);
210
- background-color: var(--diffs-line-bg, var(--diffs-bg));
211
- }
212
-
213
- [data-line], [data-no-newline] {
214
- &[data-decoration-bg] {
215
- --mix-deco-light: 92%;
216
- --mix-deco-dark: 85%;
217
-
218
- &[data-decoration-bg-depth="2"] {
219
- --mix-deco-light: 88%;
220
- --mix-deco-dark: 80%;
221
- }
222
-
223
- &[data-decoration-bg-depth="3"] {
224
- --mix-deco-light: 85%;
225
- --mix-deco-dark: 78%;
226
- }
227
-
228
- --diffs-hover-mix-target: var(--diffs-decoration-bg);
229
- --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
230
- var(--diffs-bg) var(--mix-deco-light),
231
- var(--diffs-decoration-bg)), color-mix(in lab,
232
- var(--diffs-bg) var(--mix-deco-dark),
233
- var(--diffs-decoration-bg)));
234
- }
235
- }
236
-
237
- [data-line-annotation], [data-gutter-buffer="annotation"] {
238
- --diffs-annotation-bg: var(--diffs-bg-context);
239
- --diffs-computed-decoration-bg: var(--diffs-annotation-bg);
240
- --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
241
- }
242
-
243
- [data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] {
244
- --diffs-computed-decoration-bg: var(--diffs-bg-context);
245
- --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
246
- }
247
-
248
- [data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
249
- --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
250
- var(--diffs-bg) 78%,
251
- var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
252
- var(--diffs-bg) 68%,
253
- var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
254
- --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
255
- }
256
-
257
- [data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
258
- --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
259
- var(--diffs-bg) 78%,
260
- var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
261
- var(--diffs-bg) 68%,
262
- var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
263
- --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
264
- }
265
-
266
- [data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
267
- --diffs-computed-decoration-bg: var(--diffs-bg);
268
- --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
269
- }
270
-
271
- :where([data-background]) {
272
- & [data-gutter-buffer], & [data-column-number] {
273
- --mix-light: 91%;
274
- --mix-dark: 85%;
275
- }
276
-
277
- & [data-line], & [data-no-newline] {
278
- --mix-light: 88%;
279
- --mix-dark: 80%;
280
- }
281
-
282
- & [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
283
- --diffs-diff-line-mix-target: var(--diffs-bg);
284
-
285
- &[data-line-type="change-deletion"] {
286
- --diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
287
- --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
288
-
289
- &:where([data-gutter-buffer], [data-column-number]) {
290
- color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
291
- --diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
292
- }
293
-
294
- --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
295
- var(--diffs-computed-decoration-bg) var(--mix-light),
296
- var(--diffs-diff-line-mix-target)), color-mix(in lab,
297
- var(--diffs-computed-decoration-bg) var(--mix-dark),
298
- var(--diffs-diff-line-mix-target)));
299
- }
300
-
301
- &[data-line-type="change-addition"] {
302
- --diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
303
- --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
304
-
305
- &:where([data-gutter-buffer], [data-column-number]) {
306
- color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
307
- --diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
308
- }
309
-
310
- --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
311
- var(--diffs-computed-decoration-bg) var(--mix-light),
312
- var(--diffs-diff-line-mix-target)), color-mix(in lab,
313
- var(--diffs-computed-decoration-bg) var(--mix-dark),
314
- var(--diffs-diff-line-mix-target)));
315
- }
316
-
317
- &[data-merge-conflict="current"] {
318
- --diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
319
- --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
320
-
321
- &:where([data-gutter-buffer], [data-column-number]) {
322
- color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
323
- --diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
324
- }
325
-
326
- --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
327
- var(--diffs-computed-decoration-bg) var(--mix-light),
328
- var(--diffs-diff-line-mix-target)), color-mix(in lab,
329
- var(--diffs-computed-decoration-bg) var(--mix-dark),
330
- var(--diffs-diff-line-mix-target)));
331
- }
332
-
333
- &[data-merge-conflict="incoming"] {
334
- --diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
335
- --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
336
-
337
- &:where([data-gutter-buffer], [data-column-number]) {
338
- color: var(--diffs-modified-base);
339
- --diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
340
- }
341
-
342
- --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
343
- var(--diffs-computed-decoration-bg) var(--mix-light),
344
- var(--diffs-diff-line-mix-target)), color-mix(in lab,
345
- var(--diffs-computed-decoration-bg) var(--mix-dark),
346
- var(--diffs-diff-line-mix-target)));
347
- }
348
- }
349
- }
350
-
351
- [data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
352
- --diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
353
- --diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
354
-
355
- &:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
356
- --mix-selection-light: 82%;
357
- --mix-selection-dark: 75%;
358
- --diffs-hover-mix-target: var(--diffs-selection-mix-target);
359
- }
360
-
361
- &:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
362
- --mix-selection-light: 75%;
363
- --mix-selection-dark: 60%;
364
- --diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
365
- --diffs-hover-mix-target: var(--diffs-selection-mix-target);
366
- }
367
-
368
- &:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
369
- --diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
370
- var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
371
- var(--mix-selection-light),
372
- var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
373
- }
374
-
375
- &:where([data-editor-overlay]), &[data-selected-line] {
376
- --diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
377
- var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
378
- var(--diffs-selection-mix-target)), color-mix(in lab,
379
- var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
380
- var(--diffs-selection-mix-target)));
381
- }
382
- }
383
-
384
- [data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
385
- --diffs-computed-editor-active-line-bg: color-mix(in lab,
386
- var(--diffs-computed-selected-line-bg)
387
- var(--diffs-editor-active-line-source-mix, 100%),
388
- var(--diffs-selection-emphasis-mix-target));
389
- }
390
-
391
- @media (pointer: fine) {
392
- [data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {
393
- --diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
394
- var(--diffs-computed-editor-active-line-bg) 97%,
395
- var(--diffs-hover-mix-target)), color-mix(in lab,
396
- var(--diffs-computed-editor-active-line-bg) 91%,
397
- var(--diffs-hover-mix-target)));
398
- }
399
- }
400
-
401
- [data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
402
- color: var(--diffs-selection-number-fg);
403
- }
404
-
405
- [data-no-newline] {
406
- user-select: none;
407
-
408
- & span {
409
- opacity: .6;
410
- }
411
- }
412
-
413
- [data-diff-type="split"][data-overflow="scroll"] {
414
- grid-template-columns: 1fr 1fr;
415
- display: grid;
416
-
417
- & [data-additions] {
418
- border-left: 1px solid var(--diffs-bg);
419
- }
420
-
421
- & [data-deletions] {
422
- border-right: 1px solid var(--diffs-bg);
423
- }
424
- }
425
-
426
- [data-code] {
427
- grid-auto-flow: dense;
428
- grid-template-columns: var(--diffs-code-grid);
429
- overflow: var(--diffs-overflow-override, scroll) clip;
430
- overscroll-behavior-x: none;
431
- tab-size: var(--diffs-tab-size, 2);
432
- padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
433
- padding-bottom: max(0px,
434
- calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
435
- var(--diffs-scrollbar-gutter)));
436
- scrollbar-gutter: stable;
437
- align-self: flex-start;
438
- display: grid;
439
- }
440
-
441
- [data-diffs-scrollbar-measure] {
442
- opacity: 0;
443
- pointer-events: none;
444
- scrollbar-gutter: auto;
445
- grid-template-columns: none;
446
- width: 100px;
447
- height: 100px;
448
- padding: 0;
449
- position: absolute;
450
- top: -200px;
451
- left: -200px;
452
- }
453
-
454
- [data-container-size] {
455
- container-type: inline-size;
456
- }
457
-
458
- [data-code]::-webkit-scrollbar {
459
- width: 0;
460
- height: var(--diffs-scrollbar-gutter);
461
- }
462
-
463
- [data-code]::-webkit-scrollbar-track {
464
- background: none;
465
- }
466
-
467
- [data-code]::-webkit-scrollbar-thumb {
468
- background-color: #0000;
469
- background-clip: content-box;
470
- border: 1px solid #0000;
471
- border-radius: 3px;
472
- }
473
-
474
- [data-code]::-webkit-scrollbar-corner {
475
- background-color: #0000;
476
- }
477
-
478
- @supports ((-moz-appearance: none)) {
479
- [data-code] {
480
- scrollbar-width: thin;
481
- scrollbar-color: var(--diffs-bg-context) transparent;
482
- padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
483
- }
484
- }
485
-
486
- [data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
487
- & [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
488
- padding-top: 0;
489
- }
490
- }
491
-
492
- [data-gutter] {
493
- grid-template-rows: subgrid;
494
- grid-template-columns: subgrid;
495
- z-index: 3;
496
- background-color: var(--diffs-bg);
497
- grid-column: 1;
498
- display: grid;
499
- position: relative;
500
-
501
- & [data-gutter-buffer], & [data-column-number] {
502
- border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
503
- }
504
- }
505
-
506
- [data-content] {
507
- grid-template-rows: subgrid;
508
- grid-template-columns: subgrid;
509
- background-color: var(--diffs-bg);
510
- grid-column: 2;
511
- min-width: 0;
512
- display: grid;
513
- }
514
-
515
- [data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
516
- grid-auto-flow: dense;
517
- grid-template-columns: repeat(2, var(--diffs-code-grid));
518
- padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
519
- display: grid;
520
-
521
- & [data-code] {
522
- display: contents;
523
- }
524
-
525
- & [data-deletions] {
526
- & [data-gutter] {
527
- grid-column: 1;
528
- }
529
-
530
- & [data-content] {
531
- border-right: 1px solid var(--diffs-bg);
532
- grid-column: 2;
533
- }
534
- }
535
-
536
- & [data-additions] {
537
- & [data-gutter] {
538
- border-left: 1px solid var(--diffs-bg);
539
- grid-column: 3;
540
- }
541
-
542
- & [data-content] {
543
- grid-column: 4;
544
- }
545
- }
546
- }
547
-
548
- [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
549
- overflow: clip;
550
- }
551
-
552
- [data-overflow="scroll"] [data-gutter] {
553
- position: sticky;
554
- left: 0;
555
- }
556
-
557
- [data-interactive-lines] [data-line] {
558
- cursor: pointer;
559
- }
560
-
561
- [data-interactive-line-numbers] [data-column-number] {
562
- cursor: pointer;
563
- touch-action: none;
564
- }
565
-
566
- [data-content-buffer], [data-gutter-buffer] {
567
- user-select: none;
568
- min-height: 1lh;
569
- position: relative;
570
- }
571
-
572
- [data-gutter-buffer] {
573
- padding-left: 2ch;
574
- padding-right: 1ch;
575
-
576
- &:before {
577
- content: "";
578
- min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
579
- display: block;
580
- }
581
- }
582
-
583
- [data-gutter-buffer="annotation"] {
584
- --diffs-annotation-bg: var(--diffs-bg-context-gutter);
585
- min-height: 0;
586
- }
587
-
588
- [data-gutter-buffer="buffer"] {
589
- --diffs-line-bg: var(--diffs-bg-context-gutter);
590
- }
591
-
592
- [data-content-buffer] {
593
- background-position: 5px 0;
594
- background-size: 8px 8px;
595
- background-origin: border-box;
596
- background-image: repeating-linear-gradient(-45deg,
597
- transparent,
598
- transparent calc(3px * 1.414),
599
- var(--diffs-bg-buffer) calc(3px * 1.414),
600
- var(--diffs-bg-buffer) calc(4px * 1.414));
601
- grid-column: 1;
602
- }
603
-
604
- [data-separator] {
605
- box-sizing: content-box;
606
- background-color: var(--diffs-bg);
607
- }
608
-
609
- [data-separator="simple"] {
610
- min-height: 4px;
611
- }
612
-
613
- [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
614
- background-color: var(--diffs-bg-separator);
615
- }
616
-
617
- [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
618
- height: 32px;
619
- position: relative;
620
- }
621
-
622
- [data-separator-wrapper] {
623
- user-select: none;
624
- fill: currentColor;
625
- background-color: var(--diffs-bg);
626
- align-items: center;
627
- height: 100%;
628
- display: flex;
629
- position: absolute;
630
- inset-inline: 0;
631
- }
632
-
633
- [data-content] [data-separator-wrapper] {
634
- display: none;
635
- }
636
-
637
- [data-separator="metadata"] [data-separator-wrapper] {
638
- background-color: var(--diffs-bg-separator);
639
- height: 100%;
640
- color: var(--diffs-fg-number);
641
- white-space: nowrap;
642
- text-overflow: ellipsis;
643
- min-width: min-content;
644
- padding-inline: 1ch;
645
- inset-inline: 100% auto;
646
- overflow: hidden;
647
- }
648
-
649
- [data-separator="line-info"] {
650
- margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
651
-
652
- & [data-separator-wrapper] {
653
- min-width: 16px;
654
- }
655
- }
656
-
657
- [data-separator="line-info-basic"], [data-separator="metadata"] {
658
- margin-block: 0;
659
- }
660
-
661
- [data-separator="line-info"][data-separator-first] {
662
- margin-top: 0;
663
- }
664
-
665
- [data-separator="line-info"][data-separator-last] {
666
- margin-bottom: 0;
667
- }
668
-
669
- [data-expand-index] [data-separator-wrapper] {
670
- grid-template-columns: 32px auto;
671
- display: grid;
672
- }
673
-
674
- [data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
675
- grid-template-columns: 32px 32px auto;
676
- }
677
-
678
- [data-expand-button], [data-separator-content] {
679
- background-color: var(--diffs-bg-separator);
680
- flex: none;
681
- align-items: center;
682
- display: flex;
683
- }
684
-
685
- [data-expand-index] [data-separator-content]:hover {
686
- cursor: pointer;
687
- text-decoration: underline;
688
- }
689
-
690
- [data-expand-button] {
691
- cursor: pointer;
692
- min-width: 32px;
693
- color: var(--diffs-fg-number);
694
- border-right: 2px solid var(--diffs-bg);
695
- flex-shrink: 0;
696
- justify-content: center;
697
- align-self: stretch;
698
-
699
- &:hover {
700
- color: var(--diffs-fg);
701
- }
702
-
703
- &[data-expand-all-button] {
704
- display: none;
705
- }
706
- }
707
-
708
- [data-expand-down] [data-icon] {
709
- transform: scaleY(-1);
710
- }
711
-
712
- [data-separator-content] {
713
- height: 100%;
714
- color: var(--diffs-fg-number);
715
- flex: auto;
716
- justify-content: flex-start;
717
- padding: 0 1ch;
718
- overflow: hidden;
719
- }
720
-
721
- [data-separator="line-info"], [data-separator="line-info-basic"] {
722
- & [data-separator-content] {
723
- user-select: none;
724
- height: 100%;
725
- overflow: clip;
726
- }
727
- }
728
-
729
- [data-unmodified-lines] {
730
- text-overflow: ellipsis;
731
- white-space: nowrap;
732
- flex: 0 auto;
733
- min-width: 0;
734
- display: block;
735
- overflow: hidden;
736
- }
737
-
738
- @supports (width: 1cqi) {
739
- [data-unified] {
740
- & [data-separator="line-info"] [data-separator-wrapper] {
741
- padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
742
- width: 100cqi;
743
-
744
- & [data-separator-content] {
745
- border-radius: 6px;
746
- }
747
- }
748
-
749
- & [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
750
- border-top-left-radius: unset;
751
- border-bottom-left-radius: unset;
752
- }
753
- }
754
-
755
- [data-gutter] {
756
- & [data-separator="line-info"] [data-separator-wrapper] {
757
- padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
758
- }
759
-
760
- & [data-separator="line-info"] [data-separator-content] {
761
- border-top-left-radius: 6px;
762
- border-bottom-left-radius: 6px;
763
- }
764
-
765
- & [data-separator="line-info"][data-expand-index] [data-separator-content] {
766
- border-top-left-radius: unset;
767
- border-bottom-left-radius: unset;
768
- }
769
- }
770
-
771
- [data-additions] {
772
- & [data-content] [data-separator="line-info"] {
773
- background-color: var(--diffs-bg);
774
-
775
- & [data-separator-wrapper] {
776
- display: none;
777
- }
778
- }
779
-
780
- & [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
781
- background-color: var(--diffs-bg-separator);
782
- border-top-right-radius: 6px;
783
- border-bottom-right-radius: 6px;
784
- height: 100%;
785
- display: block;
786
-
787
- & [data-separator-content], & [data-expand-button] {
788
- display: none;
789
- }
790
- }
791
- }
792
-
793
- [data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
794
- width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
795
- }
796
-
797
- [data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
798
- background-color: var(--diffs-bg-separator);
799
- height: 100%;
800
- margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
801
- border-top-right-radius: 6px;
802
- border-bottom-right-radius: 6px;
803
- display: block;
804
-
805
- & [data-separator-content], & [data-expand-button] {
806
- display: none;
807
- }
808
- }
809
-
810
- [data-separator="line-info"] [data-separator-wrapper] {
811
- & [data-expand-both], & [data-expand-down], & [data-expand-up] {
812
- border-top-left-radius: 6px;
813
- border-bottom-left-radius: 6px;
814
- }
815
- }
816
-
817
- @media (pointer: fine) {
818
- [data-separator="line-info"] [data-separator-wrapper] {
819
- &[data-separator-multi-button] {
820
- & [data-expand-up] {
821
- border-top-left-radius: 6px;
822
- border-bottom-left-radius: unset;
823
- }
824
-
825
- & [data-expand-down] {
826
- border-bottom-left-radius: 6px;
827
- border-top-left-radius: unset;
828
- }
829
- }
830
- }
831
- }
832
- }
833
-
834
- @media (pointer: coarse) {
835
- [data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
836
- grid-template-columns: 34px 34px auto;
837
-
838
- & [data-separator-content] {
839
- grid-column: unset;
840
- grid-row: unset;
841
- }
842
- }
843
-
844
- @supports (width: 1cqi) {
845
- [data-separator="line-info"] [data-separator-wrapper] {
846
- & [data-expand-both], & [data-expand-down], & [data-expand-up] {
847
- border-top-left-radius: 6px;
848
- border-bottom-left-radius: 6px;
849
- }
850
-
851
- &[data-separator-multi-button] {
852
- & [data-expand-up] {
853
- border-top-left-radius: 6px;
854
- border-bottom-left-radius: 6px;
855
- }
856
-
857
- & [data-expand-down] {
858
- border-bottom-left-radius: unset;
859
- border-top-left-radius: unset;
860
- }
861
- }
862
- }
863
- }
864
- }
865
-
866
- @media (pointer: fine) {
867
- [data-separator-wrapper][data-separator-multi-button] {
868
- grid-template-rows: 50% 50%;
869
- display: grid;
870
-
871
- & [data-separator-content] {
872
- grid-area: 1 / 2 / -1;
873
- min-width: min-content;
874
- }
875
-
876
- & [data-expand-button] {
877
- grid-column: 1;
878
- }
879
- }
880
-
881
- [data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
882
- grid-template-columns: 34px auto;
883
- }
884
-
885
- [data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
886
- grid-template-columns: 100% auto;
887
- }
888
-
889
- [data-separator="line-info"], [data-separator="line-info-basic"] {
890
- & [data-separator-multi-button] {
891
- & [data-expand-up] {
892
- border-bottom: 1px solid var(--diffs-bg);
893
- border-right: 2px solid var(--diffs-bg);
894
- }
895
-
896
- & [data-expand-down] {
897
- border-top: 1px solid var(--diffs-bg);
898
- border-right: 2px solid var(--diffs-bg);
899
- }
900
- }
901
- }
902
- }
903
-
904
- [data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
905
- display: none;
906
- }
907
-
908
- [data-line-annotation] {
909
- min-height: var(--diffs-annotation-min-height, 0);
910
- z-index: 2;
911
- }
912
-
913
- [data-merge-conflict-actions] {
914
- z-index: 2;
915
- }
916
-
917
- [data-separator="custom"] {
918
- grid-template-columns: subgrid;
919
- display: grid;
920
- }
921
-
922
- [data-line], [data-column-number], [data-no-newline] {
923
- padding-inline: 1ch;
924
- position: relative;
925
- }
926
-
927
- [data-indicators="classic"] [data-line] {
928
- padding-inline-start: 2ch;
929
- }
930
-
931
- [data-indicators="classic"] {
932
- & [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
933
- &[data-no-newline], &[data-line] {
934
- &:before {
935
- user-select: none;
936
- width: 1ch;
937
- height: 1lh;
938
- display: inline-block;
939
- position: absolute;
940
- top: 0;
941
- left: 0;
942
- }
943
- }
944
- }
945
-
946
- & [data-line-type="change-addition"] {
947
- &[data-line], &[data-no-newline] {
948
- &:before {
949
- content: "+";
950
- color: var(--diffs-addition-base);
951
- }
952
- }
953
- }
954
-
955
- & [data-line-type="change-deletion"] {
956
- &[data-line], &[data-no-newline] {
957
- &:before {
958
- content: "-";
959
- color: var(--diffs-deletion-base);
960
- }
961
- }
962
- }
963
- }
964
-
965
- [data-indicators="bars"] {
966
- & [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
967
- &[data-column-number] {
968
- &:before {
969
- content: "";
970
- user-select: none;
971
- contain: strict;
972
- width: 4px;
973
- height: 100%;
974
- display: block;
975
- position: absolute;
976
- top: 0;
977
- left: 0;
978
- }
979
- }
980
- }
981
-
982
- & [data-line-type="change-deletion"] {
983
- &[data-column-number] {
984
- &:before {
985
- background-image: linear-gradient(0deg,
986
- var(--diffs-bg-deletion) 50%,
987
- var(--diffs-deletion-base) 50%);
988
- background-repeat: repeat;
989
- background-size: 2px 2px;
990
- background-size: calc(1lh / round(1lh / 2px))
991
- calc(1lh / round(1lh / 2px));
992
- }
993
- }
994
- }
995
-
996
- & [data-line-type="change-addition"] {
997
- &[data-column-number] {
998
- &:before {
999
- background-color: var(--diffs-addition-base);
1000
- }
1001
- }
1002
- }
1003
- }
1004
-
1005
- [data-overflow="wrap"] {
1006
- & [data-line] {
1007
- white-space: pre-wrap;
1008
- word-break: break-word;
1009
- }
1010
-
1011
- & [data-annotation-content] {
1012
- word-break: break-word;
1013
- }
1014
- }
1015
-
1016
- [data-overflow="scroll"] [data-line] {
1017
- white-space: pre;
1018
- min-height: 1lh;
1019
- }
1020
-
1021
- [data-column-number] {
1022
- box-sizing: content-box;
1023
- text-align: right;
1024
- user-select: none;
1025
- color: var(--diffs-fg-number);
1026
- padding-left: 2ch;
1027
- }
1028
-
1029
- [data-line-number-content] {
1030
- min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
1031
- z-index: 1;
1032
- display: inline-block;
1033
- position: relative;
1034
- }
1035
-
1036
- [data-disable-line-numbers] {
1037
- & [data-gutter-buffer], & [data-column-number] {
1038
- min-width: 4px;
1039
- padding: 0;
1040
-
1041
- &:before {
1042
- min-width: 0;
1043
- }
1044
- }
1045
-
1046
- & [data-line-number-content] {
1047
- display: none;
1048
- }
1049
-
1050
- & [data-gutter-utility-slot] {
1051
- right: unset;
1052
- justify-content: flex-start;
1053
- left: 0;
1054
- }
1055
-
1056
- &[data-indicators="bars"] [data-gutter-utility-slot] {
1057
- left: 6px;
1058
- }
1059
- }
1060
-
1061
- [data-file][data-disable-line-numbers] {
1062
- & [data-gutter-buffer], & [data-column-number] {
1063
- border-right: 0;
1064
- min-width: 0;
1065
- }
1066
- }
1067
-
1068
- [data-diff-span] {
1069
- box-decoration-break: clone;
1070
- border-radius: 3px;
1071
- }
1072
-
1073
- [data-line-type="change-addition"] [data-diff-span] {
1074
- background-color: var(--diffs-bg-addition-emphasis);
1075
- }
1076
-
1077
- [data-line-type="change-deletion"] [data-diff-span] {
1078
- background-color: var(--diffs-bg-deletion-emphasis);
1079
- }
1080
-
1081
- [data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
1082
- color: var(--diffs-fg);
1083
- padding-left: 1ch;
1084
- }
1085
-
1086
- [data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
1087
- align-items: center;
1088
- display: flex;
1089
-
1090
- &:after {
1091
- color: var(--diffs-fg-conflict-marker);
1092
- font-size: .75rem;
1093
- font-style: normal;
1094
- line-height: 1.25rem;
1095
- font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
1096
- padding-left: 1ch;
1097
- }
1098
- }
1099
-
1100
- [data-merge-conflict="marker-start"]:after {
1101
- content: "(Current Change)";
1102
- }
1103
-
1104
- [data-merge-conflict="marker-end"]:after {
1105
- content: "(Incoming Change)";
1106
- }
1107
-
1108
- [data-merge-conflict-actions-content] {
1109
- min-height: 1.75rem;
1110
- font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
1111
- color: var(--diffs-fg);
1112
- align-items: center;
1113
- gap: .25rem;
1114
- padding-inline: .5rem;
1115
- font-size: .75rem;
1116
- line-height: 1.2;
1117
- display: flex;
1118
- }
1119
-
1120
- [data-merge-conflict-action] {
1121
- appearance: none;
1122
- color: var(--diffs-fg-number);
1123
- font: inherit;
1124
- cursor: pointer;
1125
- background: none;
1126
- border: 0;
1127
- padding: 0;
1128
- font-style: normal;
1129
- }
1130
-
1131
- [data-merge-conflict-action]:hover {
1132
- color: var(--diffs-fg);
1133
- }
1134
-
1135
- [data-merge-conflict-action="current"]:hover {
1136
- color: var(--diffs-addition-base);
1137
- }
1138
-
1139
- [data-merge-conflict-action="incoming"]:hover {
1140
- color: var(--diffs-modified-base);
1141
- }
1142
-
1143
- [data-merge-conflict-action-separator] {
1144
- color: var(--diffs-fg-number);
1145
- opacity: .6;
1146
- user-select: none;
1147
- }
1148
-
1149
- [data-diffs-header="default"] {
1150
- background-color: var(--diffs-bg);
1151
- justify-content: space-between;
1152
- align-items: center;
1153
- gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
1154
- min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
1155
- z-index: 2;
1156
- flex-direction: row;
1157
- padding-inline: 16px;
1158
- display: flex;
1159
- position: relative;
1160
- top: 0;
1161
- }
1162
-
1163
- [data-header-content] {
1164
- align-items: center;
1165
- gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
1166
- white-space: nowrap;
1167
- flex-direction: row;
1168
- min-width: 0;
1169
- display: flex;
1170
- }
1171
-
1172
- [data-header-content] [data-prev-name], [data-header-content] [data-title] {
1173
- text-overflow: ellipsis;
1174
- white-space: nowrap;
1175
- direction: rtl;
1176
- min-width: 0;
1177
- overflow: hidden;
1178
- }
1179
-
1180
- [data-prev-name] {
1181
- opacity: .7;
1182
- }
1183
-
1184
- [data-rename-icon] {
1185
- fill: currentColor;
1186
- flex-grow: 0;
1187
- flex-shrink: 0;
1188
- }
1189
-
1190
- [data-diffs-header="default"] [data-metadata] {
1191
- white-space: nowrap;
1192
- align-items: center;
1193
- gap: 1ch;
1194
- display: flex;
1195
- }
1196
-
1197
- [data-diffs-header="default"] [data-additions-count] {
1198
- font-family: var(--diffs-font-family, var(--diffs-font-fallback));
1199
- color: var(--diffs-addition-base);
1200
- }
1201
-
1202
- [data-diffs-header="default"] [data-deletions-count] {
1203
- font-family: var(--diffs-font-family, var(--diffs-font-fallback));
1204
- color: var(--diffs-deletion-base);
1205
- }
1206
-
1207
- [data-change-icon] {
1208
- fill: currentColor;
1209
- flex-shrink: 0;
1210
- }
1211
-
1212
- [data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
1213
- color: var(--diffs-modified-base);
1214
- }
1215
-
1216
- [data-change-icon="new"] {
1217
- color: var(--diffs-addition-base);
1218
- }
1219
-
1220
- [data-change-icon="deleted"] {
1221
- color: var(--diffs-deletion-base);
1222
- }
1223
-
1224
- [data-change-icon="file"] {
1225
- opacity: .6;
1226
- }
1227
-
1228
- [data-annotation-content] {
1229
- z-index: 2;
1230
- isolation: isolate;
1231
- white-space: normal;
1232
- align-self: flex-start;
1233
- min-width: 0;
1234
- display: flow-root;
1235
- position: relative;
1236
- }
1237
-
1238
- [data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
1239
- width: var(--diffs-column-content-width, auto);
1240
- left: var(--diffs-column-number-width, 0);
1241
- position: sticky;
1242
- }
1243
-
1244
- [data-annotation-slot] {
1245
- text-wrap-mode: wrap;
1246
- word-break: normal;
1247
- white-space-collapse: collapse;
1248
- }
1249
-
1250
- [data-gutter-utility-slot] {
1251
- touch-action: none;
1252
- justify-content: flex-end;
1253
- display: flex;
1254
- position: absolute;
1255
- top: 0;
1256
- bottom: 0;
1257
- right: 0;
1258
- }
1259
-
1260
- [data-utility-button] {
1261
- appearance: none;
1262
- cursor: pointer;
1263
- width: 1lh;
1264
- height: 1lh;
1265
- font-size: var(--diffs-font-size, 13px);
1266
- line-height: var(--diffs-line-height, 20px);
1267
- background-color: var(--diffs-modified-base);
1268
- color: var(--diffs-bg);
1269
- fill: currentColor;
1270
- z-index: 4;
1271
- touch-action: none;
1272
- border: none;
1273
- border-radius: 4px;
1274
- justify-content: center;
1275
- align-items: center;
1276
- margin-right: calc(-1lh + 1ch);
1277
- padding: 0;
1278
- display: flex;
1279
- position: relative;
1280
-
1281
- &:before {
1282
- content: "";
1283
- display: block;
1284
- position: absolute;
1285
- inset: 0 0 0 -4px;
1286
- }
1287
- }
1288
-
1289
- [data-decoration-bar-stack] {
1290
- pointer-events: none;
1291
- isolation: isolate;
1292
- z-index: 1;
1293
- background-color: var(--diffs-decoration-bar-color, transparent);
1294
- box-sizing: content-box;
1295
- border-left: 2px solid var(--diffs-bg);
1296
- border-right: 2px solid var(--diffs-bg);
1297
- width: 6px;
1298
- position: absolute;
1299
- top: 0;
1300
- bottom: 0;
1301
- right: -2px;
1302
-
1303
- [data-decoration-bar-depth="1"] & {
1304
- background-color: color-mix(in lab,
1305
- var(--diffs-bg) 20%,
1306
- var(--diffs-decoration-bar-color, transparent));
1307
- }
1308
-
1309
- [data-decoration-bar-depth="2"] & {
1310
- background-color: color-mix(in lab,
1311
- var(--diffs-bg) 45%,
1312
- var(--diffs-decoration-bar-color, transparent));
1313
- }
1314
-
1315
- [data-decoration-bar-depth="3"] & {
1316
- background-color: color-mix(in lab,
1317
- var(--diffs-bg) 65%,
1318
- var(--diffs-decoration-bar-color, transparent));
1319
- }
1320
-
1321
- [data-decoration-bar-start] & {
1322
- border-top-left-radius: 5px;
1323
- border-top-right-radius: 5px;
1324
- }
1325
-
1326
- [data-decoration-bar-end] & {
1327
- z-index: 3;
1328
- border-bottom-right-radius: 5px;
1329
- border-bottom-left-radius: 5px;
1330
- }
1331
- }
1332
-
1333
- [data-placeholder] {
1334
- contain: strict;
1335
- }
1336
-
1337
- [data-error-wrapper] {
1338
- padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
1339
- var(--diffs-gap-inline, var(--diffs-gap-fallback));
1340
- scrollbar-width: none;
1341
- max-height: 400px;
1342
- overflow: auto;
1343
-
1344
- & [data-error-message] {
1345
- color: var(--diffs-deletion-base);
1346
- font-size: 18px;
1347
- font-weight: bold;
1348
- }
1349
-
1350
- & [data-error-stack] {
1351
- color: var(--diffs-fg-number);
1352
- }
1353
- }
1354
- }
1355
-
1356
- @layer theme, rendered, unsafe;
1357
- `,Yo=`@layer base, theme, rendered, unsafe;`,Xo=RegExp(`${es(dt)}\\s*:\\s*[^;]+;`);function Zo(e){return`${Yo}
1358
- @layer unsafe {
1359
- ${e}
1360
- }`}function Qo(e,t=`system`,n){return`${Yo}
1361
- @layer rendered {
1362
- :host {${t===`system`?``:`
1363
- color-scheme: ${t};`}
1364
- ${qo(n)}
1365
- ${e}
1366
- }
1367
- }`}function $o(e,t){let n=qo(t);return e.replace(Xo,n)}function es(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ts(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function ns({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 rs(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function is({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=as(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function as(){let e=document.createElement(`style`);return e.setAttribute(ct,``),e}var os=void 0;function ss(){return os??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function cs(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function ls(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}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(Jo)),t.adoptedStyleSheets=[e]}connectedCallback(){Ko(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Ze,t)}async function us(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function ds({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=rr(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=q({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=gr({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=fs(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?J({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=_r({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=_r({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=ar(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function fs(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 ps(e,t)}function ps(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}}function ms({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function hs(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function gs(e){return e===``?[]:e.split($e)}function _s(e,t,n){let r=e===`clone`?hs(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return vs(r,bs(r,n),xs(r,n));case`rename-pure`:{let e=xs(r,n);Ss(r,n);let t=gs(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,ws(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function vs(e,t,n){let r=gs(t.contents),i=gs(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=ys(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,ws(e,t,n),e}function ys(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(L(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=R(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=R(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function bs(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function xs(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Ss(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Cs(e,t,n){return e.cacheKey==null?Ts(t,n):`${e.cacheKey}:hydrated`}function ws(e,t,n){let r=Cs(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function Ts(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var Es=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 Ds(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Os(e){return H({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ks(e){return H({tagName:`div`,children:[H({tagName:`span`,children:[V(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function As(e){return H({tagName:`div`,children:[Cn({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 js({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(H({tagName:`div`,children:[V(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(As(`up`)),s++),o||(e.push(As(`down`)),s++)):(e.push(As(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(H({tagName:`div`,children:[H({tagName:`span`,children:[V(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(H({tagName:`div`,children:[V(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(H({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(H({tagName:`slot`,properties:{name:i}})),H({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 Ms(e,t){return`hunk-separator-${e}-${t}`}function Ns(e){let t=e.at(-1);return t==null?0:Math.max(R(t.additionStart,t.additionCount),R(t.deletionStart,t.deletionCount))}var Ps=-1,Fs=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Ps}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:I},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Do(e.theme??I)?_n():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,na(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||tr(e.diff)||Xs(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);er(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}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)??mt}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=K(l);c&&(i.additionLines[t]=Oo(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})}}let c=!1;if(o.length>0){if(this.editSessionActive&&!i.isPartial){if(!n){if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,na(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(ea(i,i.additionLines))Object.assign(i,ta(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=ba(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}}else Object.assign(i,oa(i,o,this.options.parseDiffOptions))}return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=wa(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=qs(e,r),n.code.additionLines=Gs(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,na(t,this.options.parseDiffOptions)),n.code.additionLines[0]=Ks(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,ra(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(ea(e,n)){Object.assign(e,ta(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(ya(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>ko(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=I,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=ft,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 gn(Lo(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Xs(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!er(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!tr(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??Sn(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??I}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!$n(e,n.diff)||!er(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=ht){if(e==null)return;let{expandUnchanged:n,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||tr(e)||Xs(e,this.getTokenizeMaxLength()),l=!$n(e,this.renderCache.diff),u=!To(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&Ds(t);o&&(this.renderCache.highlightPending=!0),!o&&(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,Ds(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??Sn(e.name);let t=this.highlighter!=null&&Do(i.theme),n=this.highlighter!=null&&Eo(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.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=ht){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 Fo({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Xs(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Sn(e.name);let n=this.highlighter!=null&&Do(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&Eo(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(),a=ai(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(vr({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Ks(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!er(this.renderCache.options,n)||!$n(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!er(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&$n(e,n.diff)&&er(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1;this.diff=e;let f=a===`unified`,p=Zs(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:Tn(),deletionsGutterAST:Tn(),additionsGutterAST:Tn(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=lr({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,U(void 0,`buffer`,this.size)),h?.push(Os(this.size))):(x.pushToGutter(`deletions`,U(void 0,`buffer`,this.size)),g?.push(Os(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,En(t,n,r,i))};function T(e){C.flush(),a===`unified`?Hs(`unified`,e,x):(Hs(`deletions`,e,x),Hs(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),vr({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&zs(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Us(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Us(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Vs({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&zs(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Bs(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=Us(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Us(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Vs({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Bs(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(ks(e)),x.pushToGutter(`unified`,U(e,`metadata`,1))):(x.deletionsContentAST.push(ks(e)),x.pushToGutter(`deletions`,U(e,`metadata`,1)),k||(x.pushToGutter(`additions`,U(void 0,`buffer`,1)),x.additionsContentAST.push(Os(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(ks(e)),x.pushToGutter(`unified`,U(e,`metadata`,1))):(x.additionsContentAST.push(ks(e)),x.pushToGutter(`additions`,U(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,U(void 0,`buffer`,1)),x.deletionsContentAST.push(Os(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(Ns(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=Tn(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,Ao(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(H({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(H({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(H({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return ye(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ye(t==null?e:H({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(!qa(n))return;let i=e.type===`new`?[]:Is(Ka(this.deletionAnnotations)),a=e.type===`deleted`?[]:Is(Ka(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Vs({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Vs({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(_t(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(_t(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 Mo({fileOrDiff:e,mode:t,stickyHeader:n})}};function Is(e){return e?.map(e=>_t(e))??[]}var Ls=new Intl.PluralRules(`en-US`);function Rs(e){return`${e} unmodified line${Ls.select(e)===`one`?``:`s`}`}function zs(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Bs(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 Vs({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`,U(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`,U(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`,U(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Hs(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,js({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(js({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,js({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(js({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Ms(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Rs(n):`More unchanged context may be available`;c.pushToGutter(e,js({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(js({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Us(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function Ws(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Gs(e,t,n,r){let i=Ws(e),a=Ws(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=Ks(e,r.getLineText(e));return l}function Ks(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function qs(e,t){let n=[],r=Ys(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!Js(i)?i+r:i)}return n}function Js(e){return e.endsWith(`
1368
- `)||e.endsWith(`\r`)}function Ys(e){for(let t of e){if(t.endsWith(`\r
1369
- `))return`\r
1370
- `;if(t.endsWith(`
1371
- `))return`
1372
- `;if(t.endsWith(`\r`))return`\r`}return`
1373
- `}function Xs(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Zs(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Qs(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function $s(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function ec(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:ts(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function tc(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var nc=-1,rc=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++nc}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:I},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new _o,this.scrollSyncManager=new Es,this.interactionManager=new Za(`diff`,Qa(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 ec(e)}createHunksRenderer(e){return new Fs(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=L(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`){if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}c+=n.lines,l+=n.lines,u+=n.lines}else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Qa(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&&!Ct(this.appliedThemeCSS.theme,this.options.theme??I)}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.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.lineAnnotations.length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){gi(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=ms(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),sc(this.pre,ac({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||cc(this.headerElement,oc({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),cs(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Yi(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.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!tc(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(_s(`merge`,e,t),this.setHydratedState(t),await us(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=ms(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!ic(u,this.deletionFile)||!ic(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&To(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Yi(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Da(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,gt);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),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,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||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)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||Ds(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return vr({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=Ta(e,this.hunksRenderer.getExpandedHunksMap(),t);return Da(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Ea(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return ur({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return dr({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=sr(o);if(e<s){let c=q({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=J({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=sr(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){hi(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||tr(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.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||!$s(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}-${_t(r)}`,a=this.annotationCache.get(i);if(a==null||!Qs(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Ho(_t(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=Uo();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.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:Ua(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Ua(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=Ro;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??ye(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,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,st,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,it,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,at,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,ot,u),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}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??=Wo(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Zo(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??I,s=typeof o==`string`?o:{...o},c=Ko(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=is({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Qo(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=$o(this.themeCSSStyle.textContent??``,Ko(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ss()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?rs(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=lc(t[0]),a=lc(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=ye(i),r.content.innerHTML=ye(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=ns({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=ns({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=ns({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({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(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.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`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=lc(r?.[0]),a=lc(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=lc(n?.[0]),i=lc(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=ye(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?rs(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=lc(t[0]),i=lc(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};zo(u,this.appliedPreAttributes)||(ls(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 ic(e,t){return e==null||t==null?e==null&&t==null:wt(e,t)}function ac({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function oc({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function sc(e,t,n=!1){return!n&&e==null&&t}function cc(e,t,n=!1){return e==null&&t&&!n}function lc(e){if(e!=null&&e.type===`element`)return e.children??[]}var uc=3e3,dc=-1,fc=class extends rc{__id=`little-virtualized-file-diff:${++dc}`;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;currentExpandUnchanged;pendingHydratedDiff;pendingExpansions;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=nr(n)}setMetrics(e,t=!1){let n=nr(e);!t&&ui(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||!Ga(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=!di(t,e),r=n&&bc(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:xc(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}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&&qa(this.renderRange)){let t=pc(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=Tc(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());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}prepareCodeViewItem(e,t,n,r){let i=!$n(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=nr(n.metrics),o=!0,s=!0);let{collapsed:c=!1,expandUnchanged:l=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),this.currentExpandUnchanged!==l&&(this.currentExpandUnchanged=l,o=!0,s=!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=rr(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return vr({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=gr({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=_r({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}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}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??rr(this.metrics,t)+this.cache.fileAnnotationHeight,l;return vr({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=gr({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=_r({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.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=_s(`clone`,e,t);if(await us(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(_s(`merge`,e,t),this.setHydratedState(t),await us(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e)return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}consumeCodeViewLayoutChanges(e){let t=!1,n,{pendingExpansions:r,pendingHydratedDiff:i}=this;if(r!=null){this.pendingExpansions=void 0;for(let e of r)this.hunksRenderer.expandHunk(e.hunkIndex,e.direction,e.expansionLineCountOverride),t=!0}return i!=null&&(this.pendingHydratedDiff=void 0,i.expectedDiff===e&&(this.setHydratedState(i.files),n=i.nextDiff)),n==null?t&&(this.forceRenderOverride=!0,this.invalidateDerivedLayoutCache(!0)):(this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0})),n}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.fileDiffCache;if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return ur({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!==void 0&&this.fileDiff!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.fileDiff){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=rr(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getActiveEstimatedHeight(e=this.fileDiff){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.fileDiff){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=ds({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Sc(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.fileDiff){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=ms(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!wc(s,this.deletionFile)||!wc(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Yi(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=this.syncLineAnnotations(r);p&&this.resetLayoutCache({includeEstimatedHeights:!1});let m=t!=null&&t!==this.fileDiff,h=u!=null&&!$n(this.fileDiff,u),g=m||l;if(h&&this.resetLayoutCache({includeEstimatedHeights:!0}),e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(f)this.top??=this.getVirtualizedTop(),h&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,u));else{this.computeApproximateSize(!1,u);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()&&(!g||!f))return this.fileDiff=u,a!=null&&(this.deletionFile=s,this.additionFile=c),h&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let _=this.virtualizer.getWindowSpecs(),v=this.top??0,y=this.computeRenderRangeFromWindow(u,v,_),b=super.render({fileDiff:u,fileContainer:e,renderRange:y,lineAnnotations:r,forceRender:(d??n)||p||h,...a,...i});return this.isSimpleMode()&&b&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),b}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Cc(this.options.hunkSeparators)}approximateLayoutCheckpoints(e=this.fileDiff){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e==null||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Sc(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=mc(this.cache.heightDeltas),u=rr(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=_c(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+vc(i,e)*this.metrics.lineHeight+hc(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=uc}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+hc(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=q({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?gr({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?J({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?_r({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:yc({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=q({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=J({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Sc(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=rr(this.metrics,i),h=e.hunks.length>0?ar(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,ee;if(vr({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?gr({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),ee!=null)){if(ee<=0)return!0;ee--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),ee==null&&k>=r&&b&&(ee=T),A++,k+=S,c>0||v&&d){let e=_r({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null){if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}M??=j;let te=Math.round(M-w/2),ne=Math.max(0,Math.ceil(p/s)-w),re=Math.max(0,Math.min(te,ne)),ie=re*s,ae=te<0?C+te*s:C,oe=E[re]??0,se=ie===0?0:g+oe,ce=re+ae/s,le=ce<E.length?v-E[ce]:v-(k-t-_);return{startingLine:ie,totalLines:ae,bufferBefore:se,bufferAfter:Math.max(0,le)}}};function pc(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===Wa&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function mc(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 hc({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=gc(e,n);return(t[gc(e,r)]??0)-(t[i]??0)}function gc(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 _c(e){return Math.ceil(e/uc)*uc}function vc(e,t){let n=0;for(let r of e)r<t&&n++;return n}function yc({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 bc(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function xc(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Sc(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Cc(e){return typeof e==`function`?`custom`:e??`line-info`}function wc(e,t){return e==null||t==null?e==null&&t==null:wt(e,t)}function Tc(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Ec(e,t){return typeof window>`u`&&t!=null?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,F.jsx)(F.Fragment,{children:e})}var Dc=(0,P.createContext)(void 0);function Oc(){return(0,P.useContext)(Dc)}var kc=typeof window>`u`?P.useEffect:P.useLayoutEffect;function Ac({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=Oc(),f=i!==void 0,p=(0,P.useContext)(li),m=qe(),h=(0,P.useRef)(null),g=Ge(n=>{if(n!=null){if(h.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?h.current=new rc(jc({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new fc(jc({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return kc(()=>{let{current:n}=h;if(n==null)return;let a=jc({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!di(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),kc(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,P.useCallback)(()=>h.current?.getHoveredLine(),[])}}function jc({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?Xe:e?.renderCustomHeader,renderGutterUtility:r?Xe:e?.renderGutterUtility}:e}function Mc({oldFile:e,newFile:t,options:n,editorOptions:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1}){let v=(0,P.useMemo)(()=>Yi(e,t,n?.parseDiffOptions),[e,t,n?.parseDiffOptions]),{ref:y,getHoveredLine:b}=Ac({fileDiff:v,options:n,editorOptions:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_});return(0,F.jsx)(Ze,{ref:y,className:s,style:c,children:Ec(xt({fileDiff:v,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,lineAnnotations:a,renderGutterUtility:h,getHoveredLine:b}),l)})}function Nc({filename:e,className:t}){let n=e.split(`.`).pop()?.toLowerCase()??``,r=t??`w-2.5 h-2.5 shrink-0`;return n===`ts`||n===`tsx`?(0,F.jsx)(`svg`,{viewBox:`0 0 32 32`,className:r,children:(0,F.jsx)(`path`,{d:`M23.827,8.243A4.424,4.424,0,0,1,26.05,9.524a5.853,5.853,0,0,1,.852,1.143c.011.045-1.534,1.083-2.471,1.662-.034.023-.169-.124-.322-.35a2.014,2.014,0,0,0-1.67-1c-1.077-.074-1.771.49-1.766,1.433a1.3,1.3,0,0,0,.153.666c.237.49.677.784,2.059,1.383,2.544,1.095,3.636,1.817,4.31,2.843a5.158,5.158,0,0,1,.416,4.333,4.764,4.764,0,0,1-3.932,2.815,10.9,10.9,0,0,1-2.708-.028,6.531,6.531,0,0,1-3.616-1.884,6.278,6.278,0,0,1-.926-1.371,2.655,2.655,0,0,1,.327-.208c.158-.09.756-.434,1.32-.761L19.1,19.6l.214.312a4.771,4.771,0,0,0,1.35,1.292,3.3,3.3,0,0,0,3.458-.175,1.545,1.545,0,0,0,.2-1.974c-.276-.395-.84-.727-2.443-1.422a8.8,8.8,0,0,1-3.349-2.055,4.687,4.687,0,0,1-.976-1.777,7.116,7.116,0,0,1-.062-2.268,4.332,4.332,0,0,1,3.644-3.374A9,9,0,0,1,23.827,8.243ZM15.484,9.726l.011,1.454h-4.63V24.328H7.6V11.183H2.97V9.755A13.986,13.986,0,0,1,3.01,8.289c.017-.023,2.832-.034,6.245-.028l6.211.017Z`,fill:`#007acc`})}):n===`js`||n===`mjs`||n===`cjs`||n===`jsx`?(0,F.jsxs)(`svg`,{viewBox:`0 0 32 32`,className:r,children:[(0,F.jsx)(`rect`,{x:`2`,y:`2`,width:`28`,height:`28`,rx:`1.312`,fill:`#f5de19`}),(0,F.jsx)(`path`,{d:`M20.809,23.875a2.866,2.866,0,0,0,2.6,1.6c1.09,0,1.787-.545,1.787-1.3,0-.9-.715-1.222-1.916-1.747l-.658-.282c-1.9-.809-3.16-1.822-3.16-3.964,0-1.973,1.5-3.476,3.853-3.476a3.889,3.889,0,0,1,3.742,2.107L25,18.128A1.789,1.789,0,0,0,23.311,17a1.145,1.145,0,0,0-1.259,1.128c0,.789.489,1.109,1.618,1.6l.658.282c2.236.959,3.5,1.936,3.5,4.133,0,2.369-1.861,3.667-4.36,3.667a5.055,5.055,0,0,1-4.795-2.691Zm-9.295.228c.413.733.789,1.353,1.693,1.353.864,0,1.41-.338,1.41-1.653V14.856h2.631v8.982c0,2.724-1.6,3.964-3.929,3.964a4.085,4.085,0,0,1-3.947-2.4Z`,fill:`#000`})]}):n===`json`||n===`jsonc`?(0,F.jsxs)(`svg`,{viewBox:`0 0 32 32`,className:r,children:[(0,F.jsx)(`path`,{d:`M4.014,14.976a2.51,2.51,0,0,0,1.567-.518A2.377,2.377,0,0,0,6.386,13l.129-1.334A5.435,5.435,0,0,1,7.6,9.071,3.157,3.157,0,0,1,10.519,8h1.316v1.86H10.937a1.257,1.257,0,0,0-1.1.465,3.405,3.405,0,0,0-.357,1.585l-.127,1.244a3.283,3.283,0,0,1-.573,1.61A2.482,2.482,0,0,1,7.6,15.537a2.482,2.482,0,0,1,1.18.773A3.283,3.283,0,0,1,9.349,17.9l.127,1.244a3.405,3.405,0,0,0,.357,1.585,1.257,1.257,0,0,0,1.1.465h.9V23.06H10.519A3.157,3.157,0,0,1,7.6,21.981a5.435,5.435,0,0,1-1.082-2.595L6.386,18.05a2.377,2.377,0,0,0-.805-1.456A2.51,2.51,0,0,0,4.014,16.07Z`,fill:`#fbc02d`}),(0,F.jsx)(`path`,{d:`M27.986,16.07a2.51,2.51,0,0,0-1.567.518,2.377,2.377,0,0,0-.805,1.456l-.129,1.334a5.435,5.435,0,0,1-1.082,2.595A3.157,3.157,0,0,1,21.481,23.06H20.165V21.2h.9a1.257,1.257,0,0,0,1.1-.465,3.405,3.405,0,0,0,.357-1.585l.127-1.244a3.283,3.283,0,0,1,.573-1.61,2.482,2.482,0,0,1,1.18-.773,2.482,2.482,0,0,1-1.18-.773,3.283,3.283,0,0,1-.573-1.61L22.527,11.9a3.405,3.405,0,0,0-.357-1.585,1.257,1.257,0,0,0-1.1-.465h-.9V8h1.316a3.157,3.157,0,0,1,2.924,1.071,5.435,5.435,0,0,1,1.082,2.595l.129,1.334A2.377,2.377,0,0,0,26.419,14.458a2.51,2.51,0,0,0,1.567.518Z`,fill:`#fbc02d`})]}):null}function Pc({step:e,state:t,onComplete:n,input:r,output:i,isCollapsible:a=!1,approval:o,onFilePathClick:s}){re(t===`animating`,e.duration,n);let c=t===`animating`,l=e.filePath?.split(`/`).pop()??e.toolDetail,u=!!l,d=e.toolName===`Write`,[f,p]=P.useState(`light`),[m,h]=P.useState(!a);P.useEffect(()=>{if(typeof window>`u`)return;let e=()=>{let e=document.documentElement.classList.contains(`dark`);p(e?`dark`:`light`)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>{t.disconnect()}},[]),P.useEffect(()=>{h(!a)},[a]);let g=P.useMemo(()=>{let t=l||`file`,n=typeof i?.old_content==`string`?i.old_content:void 0,a=typeof i?.content==`string`?i.content:void 0,o=!n&&typeof r?.old_string==`string`?r.old_string:void 0,s=!a&&typeof r?.new_string==`string`?r.new_string:void 0,c=e.diffLines?.filter(e=>e.type!==`add`).map(e=>e.content).join(`
1374
- `),u=e.diffLines?.filter(e=>e.type!==`remove`).map(e=>e.content).join(`
1375
- `),d=o??n??c??``,f=s??a??u??``;return!d&&!f?null:{oldFile:{name:t,contents:d},newFile:{name:t,contents:f}}},[l,r,i,e.diffLines]),_=P.useMemo(()=>f===`dark`?{"--diffs-bg":`#000`,"--diffs-bg-buffer-override":`#000`,"--diffs-bg-context-override":`#000`,"--diffs-bg-hover-override":`#0a0a0a`,"--diffs-bg-separator-override":`#0f0f0f`}:void 0,[f]),v=P.useMemo(()=>f===`dark`?`
1376
- [data-diff],
1377
- [data-file],
1378
- [data-diffs-header],
1379
- [data-error-wrapper],
1380
- [data-virtualizer-buffer] {
1381
- --diffs-bg: #000;
1382
- --diffs-bg-buffer-override: #000;
1383
- --diffs-bg-context-override: #000;
1384
- --diffs-bg-hover-override: #0a0a0a;
1385
- --diffs-bg-separator-override: #0f0f0f;
1386
- }
1387
- `:void 0,[f]),y=`an-edit-diff dark:bg-black dark:[--diffs-bg:#000] dark:[--diffs-bg-buffer-override:#000] dark:[--diffs-bg-context-override:#000] dark:[--diffs-bg-hover-override:#0a0a0a] dark:[--diffs-bg-separator-override:#0f0f0f]`;return(0,F.jsxs)(`div`,{className:`an-edit-tool-card overflow-hidden rounded-chat-tool border border-border bg-muted dark:bg-black`,children:[(0,F.jsxs)(`div`,{className:`flex h-7 items-center justify-between bg-muted px-2.5 py-0 `+(c&&!g?``:`border-b border-border`),children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[u&&(0,F.jsx)(Nc,{filename:l,className:`h-3 w-3 shrink-0`}),c&&!g?(0,F.jsx)(oe,{as:`span`,duration:1.2,className:`text-xs`,children:`Generating...`}):c?(0,F.jsxs)(oe,{as:`span`,duration:1.2,className:`text-xs`,children:[d?`Creating`:`Editing`,` `,l]}):(0,F.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[d?`Created`:`Edited`,` `,e.filePath&&s?(0,F.jsx)(`button`,{type:`button`,onClick:()=>s(e.filePath??``),className:`truncate underline-offset-2 hover:text-foreground hover:underline`,children:l}):l]})]}),e.diffStats&&!c&&(0,F.jsx)(`span`,{className:`inline-flex gap-2 font-mono text-caption text-muted-foreground`,children:e.diffStats.split(` `).map(e=>(0,F.jsx)(`span`,{className:e.startsWith(`+`)?`text-product-diff-added`:e.startsWith(`-`)?`text-product-diff-removed`:void 0,children:e},e))})]}),g?(0,F.jsx)(`div`,{className:`${y} text-label`,style:_,children:(0,F.jsxs)(`div`,{className:a?`group/edit-diff relative`:`relative`,children:[(0,F.jsx)(`div`,{className:a&&!m?`max-h-[260px] overflow-hidden`:void 0,children:(0,F.jsx)(Mc,{oldFile:g.oldFile,newFile:g.newFile,className:y,style:_,options:{theme:{dark:`github-dark`,light:`github-light`},themeType:f,unsafeCSS:v,diffStyle:`unified`,disableFileHeader:!0}},f)}),a&&(0,F.jsx)(F.Fragment,{children:(0,F.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-label":m?`Hide`:`Show more`,className:`group absolute inset-x-0 bottom-0 flex h-16 items-end justify-center pb-2 text-muted-foreground `+(m?`bg-transparent`:`bg-linear-to-b from-transparent to-background`),children:(0,F.jsx)(w,{className:`h-4 w-4 opacity-0 transition-opacity duration-150 group-hover:opacity-100 `+(m?`rotate-180`:`rotate-0`)})})})]})}):null,o&&(0,F.jsx)(ie,{isPending:c,...o})]})}var Fc=(0,P.memo)(function({part:e,isCollapsible:t=!1,onFilePathClick:n}){let r=e.input?.approval??e.args?.approval,i=e.type?.replace(`tool-`,``)||`Edit`,{step:a,stepState:o}=ae(e,i);return(0,F.jsx)(Pc,{step:a,state:o,onComplete:()=>{},input:e.input??e.args,output:e.output??e.result,isCollapsible:t,approval:r,onFilePathClick:n})});function Ic({icon:e,shimmerLabel:t,completeLabel:n,isAnimating:r,detail:a,onDetailClick:o,trailingContent:s,expandable:c=!1,expanded:l,defaultOpen:u=!1,onToggleExpand:d,children:f}){let p=!r,m=l??!1,h=c&&(p||m||r),g=(0,F.jsxs)(`div`,{className:i(`flex max-w-full items-center gap-1 rounded-chat-tool select-none`,h?`cursor-pointer`:`cursor-default`),children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm text-muted-foreground`,children:[e&&(0,F.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:e}),(0,F.jsx)(`span`,{className:`shrink-0 font-[450] whitespace-nowrap`,children:r&&t?(0,F.jsx)(oe,{as:`span`,duration:1.2,className:`m-0 inline-flex h-4 items-center leading-none`,children:t}):n}),a&&(o?(0,F.jsx)(`button`,{type:`button`,onClick:o,className:`min-w-0 flex-1 truncate text-left font-normal text-muted-foreground/60 underline-offset-2 hover:text-muted-foreground hover:underline`,children:a}):(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-normal text-muted-foreground/60`,children:a})),s]}),c&&(p||m||r)&&(0,F.jsx)(`div`,{children:(0,F.jsx)(T,{className:i(`shrink-0 text-muted-foreground transition-transform duration-150 ease-out`,`size-3`,`rotate-0 group-data-panel-open:rotate-90`)})})]});return c?(0,F.jsxs)(Oe,{className:`flex w-full flex-col gap-2`,...l===void 0?{defaultOpen:u}:{open:l,onOpenChange:d},children:[(0,F.jsx)(De,{className:`group flex`,disabled:!h,"aria-disabled":!h,children:g}),(0,F.jsx)(Ee,{className:i(`overflow-hidden`,`h-[var(--collapsible-panel-height)] transition-all duration-150 ease-out`,`data-ending-style:h-0 data-starting-style:h-0`,`[&[hidden]:not([hidden='until-found'])]:hidden`),children:f})]}):(0,F.jsx)(`div`,{className:`flex flex-col gap-1`,children:g})}var Lc=(0,P.memo)(function({icon:e,title:t,subtitle:n,isPending:r,onSubtitleClick:i}){let a=e;return(0,F.jsx)(Ic,{icon:a?(0,F.jsx)(a,{className:`h-full w-full shrink-0 text-muted-foreground`}):void 0,shimmerLabel:t,completeLabel:t,isAnimating:r,detail:n,onDetailClick:i})}),Rc=new Map;function zc(e){return{state:e.state,inputJson:JSON.stringify(e.input||{}),outputJson:JSON.stringify(e.output||{})}}function Bc(e,t){let n=Rc.get(e),r=zc(t);if(!n)return Rc.set(e,r),!0;let i=n.state!==r.state||n.inputJson!==r.inputJson||n.outputJson!==r.outputJson;return i&&Rc.set(e,r),i}function Vc(e,t){if(e.toolCallId!==t.toolCallId||e.type!==t.type)return!1;let n=t.toolCallId;return n?!Bc(n,t):e.state===t.state}function Hc(e){return e.output!==void 0&&e.output!==null||e.state===`error`||e.state===`result`}function Uc(e,t){return Vc(e.part,t.part)?Hc(t.part)?!0:e.chatStatus===t.chatStatus:!1}function Wc(e){if(e<1e3)return``;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return r===0?`${n}m`:`${n}m ${r}s`}function Gc(e,t){let n=e.state!==`output-available`&&e.state!==`output-error`,r=e.state===`output-error`||e.state===`output-available`&&e.output?.success===!1,i=e.state===`output-available`&&!r;return{isPending:n&&t===`streaming`,isError:r,isSuccess:i,isInterrupted:n&&t!==`streaming`&&t!==void 0}}var Kc=[`query`,`question`,`email`,`name`,`id`,`customer`,`url`,`issue`,`body`,`summary`,`title`],qc={List:`Listing`,Get:`Getting`,Create:`Creating`,Update:`Updating`,Delete:`Deleting`,Search:`Searching`,Fetch:`Fetching`,Retrieve:`Retrieving`,Send:`Sending`,Generate:`Generating`,Add:`Adding`,Remove:`Removing`,Modify:`Modifying`,Draft:`Drafting`,Manage:`Managing`,Query:`Querying`,Start:`Starting`,Set:`Setting`,Check:`Checking`,Find:`Finding`},Jc={List:`Listed`,Get:`Got`,Create:`Created`,Update:`Updated`,Delete:`Deleted`,Search:`Searched`,Fetch:`Fetched`,Retrieve:`Retrieved`,Send:`Sent`,Generate:`Generated`,Add:`Added`,Remove:`Removed`,Modify:`Modified`,Draft:`Drafted`,Manage:`Managed`,Query:`Queried`,Start:`Started`,Set:`Set`,Check:`Checked`,Find:`Found`};function Yc(e){let t=e.displayName.split(` `),n=t[0],r=t.slice(1).join(` `),i=qc[n];return i?r?`${i} ${r}`:i:e.displayName}function Xc(e){let t=e.displayName.split(` `),n=t[0],r=t.slice(1).join(` `),i=Jc[n];return i?r?`${i} ${r}`:i:e.displayName}function Zc(e){if(!e||typeof e!=`object`)return``;let t=Object.entries(e).filter(([,e])=>e!=null&&e!==``);if(t.length===0)return``;let n=[...t].sort(([e],[t])=>{let n=Kc.indexOf(e),r=Kc.indexOf(t);return n!==-1&&r!==-1?n-r:n===-1?r===-1?0:1:-1}),r=[];for(let[e,t]of n){if(r.length>=2)break;let n=typeof t==`string`?t:JSON.stringify(t),i=n.length>30?n.slice(0,27)+`...`:n;r.push(`${e}: ${i}`)}return r.join(` `)}function Qc(e){if(!e)return e;if(Array.isArray(e)){let t=[];for(let n of e)n?.type===`text`&&typeof n?.text==`string`&&t.push(n.text);if(t.length>0){let e=t.join(``);try{return JSON.parse(e)}catch{return e}}return e}if(e?.type===`text`&&typeof e?.text==`string`)try{return JSON.parse(e.text)}catch{return e.text}if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}function $c(e){let t=Qc(e);if(typeof t==`string`)return t.length>3e3?t.slice(0,3e3)+`
1388
- ...`:t;let n=JSON.stringify(t,null,2);return n.length>3e3?n.slice(0,3e3)+`
1389
- ...`:n}var el=(0,P.memo)(function({part:e,mcpInfo:t,chatStatus:n,defaultOpen:r}){let{isPending:i,isInterrupted:a}=Gc(e,n),o=(0,P.useMemo)(()=>e.state===`input-streaming`?`Preparing ${t.displayName}`:i?Yc(t):Xc(t),[e.state,i,t]),s=(0,P.useMemo)(()=>e.state===`input-streaming`?``:Zc(e.input),[e.input,e.state]),c=(0,P.useMemo)(()=>e.output?$c(e.output):null,[e.output]),l=(0,P.useMemo)(()=>{if(!c)return null;let e=c.trim();return e?`\`\`\`${e.startsWith(`{`)||e.startsWith(`[`)?`json`:`text`}\n${c}\n\`\`\``:null},[c]),u=!!l&&!i;return a&&!e.output?(0,F.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[t.displayName,` interrupted`]}):(0,F.jsx)(`div`,{className:`an-tool-mcp`,children:(0,F.jsx)(Ic,{shimmerLabel:o,completeLabel:o,isAnimating:i,detail:s||void 0,trailingContent:void 0,expandable:u,defaultOpen:r,children:l&&(0,F.jsx)(we,{className:`text-label`,codeControls:!1,content:l})})})},Uc);function tl({className:e,...t}){return(0,F.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,className:e??`animate-spin text-muted-foreground will-change-transform`,...t,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`,opacity:.2}),(0,F.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`})]})}function nl(e){let t=e.id?.trim();return t?t.endsWith(`.md`)?t:`plan-${t}.md`:`plan-working.md`}var rl=(0,P.memo)(function({part:e,chatStatus:t}){let{isPending:n}=Gc(e,t),r=e.input?.plan,[a,o]=(0,P.useState)(!1),[s,c]=(0,P.useState)(!1),[l,u]=(0,P.useState)(null),[d,f]=(0,P.useState)(!1),[p,m]=(0,P.useState)(``);if(!r)return null;let h=nl(r),g=r.summary?.trim()??``,_=g.length>0,v=e.input?.completed??0,y=e.input?.total??r.todos?.length??0,b=!!e.input?.pendingDecision,x=b&&!n,S=e.input?.approved||s||r.status===`approved`||r.status===`completed`,C=async(e,t,n)=>{if(!(!t||l)){u(e);try{await t(n),e===`execute`&&c(!0),e===`refine`&&(m(``),f(!1))}finally{u(null)}}},w=y>0?`${v}/${y} complete`:b?`Awaiting review`:void 0;return(0,F.jsxs)(`div`,{className:`an-tool-plan overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,F.jsxs)(`div`,{className:`flex h-7 items-center justify-between pr-2.5 pl-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[n?(0,F.jsx)(tl,{className:`h-3 w-3 shrink-0 animate-spin text-muted-foreground`}):(0,F.jsx)(k,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,F.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:h})]}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-label":a?`Collapse plan`:`Expand plan`,className:`inline-flex size-5 items-center justify-center text-muted-foreground`,children:a?(0,F.jsx)(Ne,{className:`h-3.5 w-3.5`}):(0,F.jsx)(Me,{className:`h-3.5 w-3.5`})})]}),(0,F.jsxs)(`div`,{className:`border-t border-border bg-background pt-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3`,children:[(0,F.jsx)(`div`,{className:`text-sm text-foreground`,children:r.title}),w?(0,F.jsx)(`div`,{className:`rounded-full border border-border px-2 py-0.5 text-caption text-muted-foreground`,children:w}):null]}),_?(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(`div`,{className:i(`px-3`,`text-sm text-muted-foreground`,!a&&`max-h-[94px] overflow-hidden`),children:(0,F.jsx)(we,{content:g,className:`text-sm`})}),!a&&(0,F.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 h-16 pr-2 pb-2 pl-3.5`,children:[(0,F.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-full w-full bg-linear-to-b from-transparent from-0% to-background to-50%`}),(0,F.jsx)(`div`,{className:`relative flex h-full items-end justify-between`,children:(0,F.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`-mx-2 h-5 rounded-[4px] px-1.5 text-xs text-muted-foreground hover:text-foreground`,children:`Read detailed plan`})})]})]}):(0,F.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No plan summary provided.`})]}),(a||!_)&&(0,F.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-border bg-muted pt-1.5 pr-2 pb-2 pl-3.5`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`-mx-2 h-5 rounded-[4px] px-1.5 text-xs text-muted-foreground hover:text-foreground`,children:a?`Hide detailed plan`:`Read detailed plan`}),x?(0,F.jsx)(`div`,{className:`text-caption text-muted-foreground`,children:`Choose what to do with this plan.`}):S?(0,F.jsx)(`div`,{className:`text-caption text-muted-foreground`,children:`Approved`}):null]}),x?(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border bg-muted px-3 py-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:()=>C(`execute`,e.input?.onExecute),disabled:!!l,className:`h-7 rounded-[6px] bg-primary px-2.5 text-xs font-medium text-primary-foreground disabled:opacity-60`,children:l===`execute`?`Executing...`:e.input?.executeLabel??`Execute`}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>C(`stay`,e.input?.onStay),disabled:!!l,className:`h-7 rounded-[6px] border border-border px-2.5 text-xs text-foreground disabled:opacity-60`,children:l===`stay`?`Saving...`:e.input?.stayLabel??`Stay`}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),disabled:!!l,className:`h-7 rounded-[6px] border border-border px-2.5 text-xs text-foreground disabled:opacity-60`,children:e.input?.refineLabel??`Refine`})]}),d?(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),rows:3,placeholder:`Describe what should change in the plan`,className:`w-full resize-y rounded-[8px] border border-border bg-background px-3 py-2 text-base text-foreground outline-none focus:border-primary md:text-sm`}),(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),m(``)},disabled:!!l,className:`h-7 rounded-[6px] border border-border px-2.5 text-xs text-foreground disabled:opacity-60`,children:`Cancel`}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>C(`refine`,e.input?.onRefine,p),disabled:!!l,className:`h-7 rounded-[6px] bg-primary px-2.5 text-xs font-medium text-primary-foreground disabled:opacity-60`,children:l===`refine`?`Submitting...`:`Submit refinement`})]})]}):null]}):null]})]})},Uc);function il({toolSteps:e,stepStates:t,onStepComplete:n,results:r=[],defaultOpen:a}){let o=e.some(e=>t[e.id]===`animating`),s=e.find(e=>e.searchQuery)?.searchQuery??`searching...`,c=r.length,l=c>0;function u({step:e}){return re(t[e.id]===`animating`,e.duration,()=>n(e.id)),null}return(0,F.jsxs)(F.Fragment,{children:[e.map(e=>(0,F.jsx)(u,{step:e},e.id)),(0,F.jsx)(Ic,{shimmerLabel:`Searching...`,completeLabel:`Found ${c} results`,isAnimating:o,expandable:l,defaultOpen:a,children:(0,F.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,F.jsxs)(`div`,{className:`flex h-7 items-center gap-1 border-b border-border px-2.5 py-0 text-xs`,children:[(0,F.jsx)(`span`,{className:`font-medium text-foreground`,children:`Searched for`}),` `,(0,F.jsxs)(`span`,{className:`truncate text-muted-foreground`,children:[`“`,s,`”`]})]}),(0,F.jsx)(`div`,{className:`max-h-[200px] overflow-y-auto bg-background`,children:(0,F.jsx)(`div`,{className:`flex flex-col gap-1 p-1`,children:r.map(e=>(0,F.jsxs)(`div`,{className:i(`flex cursor-default items-center gap-2 rounded-[calc(var(--chat-tool-radius)-4px)] px-2 py-1`,`hover:bg-muted/50`),children:[(0,F.jsx)(`div`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:(0,F.jsx)(k,{className:`h-4 w-4`})}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-foreground/90`,children:e.title}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs whitespace-nowrap text-muted-foreground`,children:e.date||e.source})]},`${e.title}-${e.source}-${e.date}`))})})]})})]})}function al(e){if(!Array.isArray(e))return;let t=e.map(e=>{if(!e||typeof e!=`object`)return null;let t=e.source,n=e.title,r=e.date;return typeof t!=`string`||typeof n!=`string`||typeof r!=`string`?null:{source:t,title:n,date:r}}).filter(e=>!!e);return t.length>0?t:void 0}var ol=(0,P.memo)(function({part:e,results:t,defaultOpen:n}){let r=e.type?.replace(`tool-`,``)||`WebSearch`,{step:i,stepState:a}=ae(e,r),o={[i.id]:a};return(0,F.jsx)(il,{toolSteps:[i],stepStates:o,onStepComplete:()=>{},results:t??al(e.output?.results)??al(e.result?.results),defaultOpen:n})});function sl(e){return e===`in-progress`?`In progress`:e===`completed`?`Completed`:e===`cancelled`?`Cancelled`:`Pending`}function cl({complete:e}){let t=f()??!1;return(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`relative grid size-6 shrink-0 place-items-center`,children:(0,F.jsx)(d,{initial:!1,mode:`popLayout`,children:e?(0,F.jsxs)(o.svg,{viewBox:`0 0 24 24`,initial:t?{opacity:1}:{opacity:0,scale:.72},animate:{opacity:1,scale:1},exit:{opacity:0},transition:t?{duration:0}:s,className:`absolute size-5.5 overflow-visible text-emerald-500`,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`}),(0,F.jsx)(o.path,{d:`M7.5 12.25 10.5 15.25 16.75 8.75`,fill:`none`,stroke:`white`,strokeWidth:`2.25`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:t?{pathLength:1}:{pathLength:0},animate:{pathLength:1},transition:t?{duration:0}:{duration:.24,ease:u}})]},`complete`):(0,F.jsx)(o.span,{initial:t?{opacity:1}:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:t?{opacity:0}:{opacity:0,scale:.72},transition:t?{duration:0}:s,className:`absolute grid place-items-center text-muted-foreground`,children:(0,F.jsx)(S,{className:`size-4`})},`todo`)})})}function ll({status:e,progress:t}){let n=f()??!1,r=t===void 0?.68:Math.min(100,Math.max(0,t))/100;return(0,F.jsxs)(o.svg,{"aria-hidden":`true`,viewBox:`0 0 24 24`,initial:!1,className:i(`mx-0.5 size-5 shrink-0 overflow-visible text-muted-foreground`,e===`in-progress`&&`text-foreground`,e===`cancelled`&&`text-rose-600 dark:text-rose-400`),children:[(0,F.jsx)(o.circle,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:e===`pending`?`2 3`:void 0,strokeLinecap:`round`,initial:!1,animate:{fillOpacity:e===`completed`?.06:0},transition:n?{duration:0}:{duration:.18,ease:u},className:i(e===`in-progress`&&`opacity-20`)}),(0,F.jsx)(o.circle,{cx:`12`,cy:`12`,r:`9`,pathLength:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,initial:!1,animate:{pathLength:e===`in-progress`?r:0,opacity:+(e===`in-progress`),rotate:e===`in-progress`&&t===void 0&&!n?360:-90},transition:e===`in-progress`&&t===void 0&&!n?{rotate:{duration:1.1,repeat:1/0,ease:`linear`}}:n?{duration:0}:l,style:{transformOrigin:`12px 12px`}}),(0,F.jsx)(o.path,{d:`M7.5 12.25 10.5 15.25 16.75 8.75`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:!1,animate:{pathLength:+(e===`completed`),opacity:+(e===`completed`)},transition:n?{duration:0}:{duration:.24,ease:u}}),(0,F.jsx)(o.path,{d:`M8.5 8.5 15.5 15.5M15.5 8.5 8.5 15.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,initial:!1,animate:{pathLength:+(e===`cancelled`),opacity:+(e===`cancelled`)},transition:n?{duration:0}:{duration:.2,ease:u}})]})}function ul({items:e,title:t=`To-dos`,open:n,defaultOpen:r=!0,onOpenChange:a,collapseOnComplete:c=!0,maxHeight:p=248,className:m}){let h=f()??!1,g=(0,P.useId)(),_=`${g}-trigger`,v=`${g}-content`,y=(0,P.useRef)(null),b=(0,P.useRef)(!1),[x,S]=(0,P.useState)(r),C=n??x,T=e.filter(e=>e.status===`completed`).length,E=e.length>0&&T===e.length,D=e.length,O=(0,P.useCallback)(e=>{n===void 0&&S(e),a?.(e)},[a,n]);return(0,P.useEffect)(()=>{b.current&&!E&&O(!0),!b.current&&E&&c&&O(!1),b.current=E},[E,c,O]),(0,P.useLayoutEffect)(()=>{let e=y.current;if(!e||D===0)return;let t=requestAnimationFrame(()=>{e.scrollHeight<=e.clientHeight||(typeof e.scrollTo==`function`?e.scrollTo({top:e.scrollHeight,behavior:h?`auto`:`smooth`}):e.scrollTop=e.scrollHeight)});return()=>cancelAnimationFrame(t)},[D,h]),(0,F.jsxs)(`section`,{"aria-label":`Agent task list`,className:i(`w-full overflow-hidden rounded-2xl border border-border/70`,m),children:[(0,F.jsxs)(`button`,{id:_,type:`button`,"aria-expanded":C,"aria-controls":v,onClick:()=>O(!C),className:`group flex h-11 w-full items-center gap-2.5 rounded-2xl px-3.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,F.jsx)(cl,{complete:E}),(0,F.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground/90`,children:t}),(0,F.jsxs)(`span`,{className:i(`shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,E&&`text-emerald-600 dark:text-emerald-400`),children:[(0,F.jsxs)(`span`,{className:`sr-only`,children:[T,` of `,e.length,` tasks completed`]}),(0,F.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex`,children:[(0,F.jsx)(ee,{value:String(T),children:T}),(0,F.jsx)(`span`,{children:`/`}),(0,F.jsx)(`span`,{children:e.length})]})]}),(0,F.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:C?180:0},transition:h?{duration:0}:s,className:`text-muted-foreground/50 transition-colors group-hover:text-muted-foreground`,children:(0,F.jsx)(w,{className:`size-3.5`})})]}),(0,F.jsx)(ne,{id:v,role:`region`,"aria-labelledby":_,open:C,children:(0,F.jsxs)(`div`,{ref:y,className:`scrollbar-hide overflow-y-auto px-2 pb-2`,style:{maxHeight:p},children:[(0,F.jsx)(`ol`,{"aria-live":E?`polite`:`off`,className:`space-y-0`,children:(0,F.jsx)(d,{initial:!1,mode:`popLayout`,children:e.map(e=>{let t=e.status??`pending`;return(0,F.jsxs)(o.li,{layout:`position`,initial:h?{opacity:1}:{opacity:0,y:6},animate:{opacity:1,y:0},exit:h?{opacity:0}:{opacity:0,y:-3},transition:h?{duration:0}:{opacity:{duration:.18,ease:u},y:l,layout:l},className:`flex min-h-9 items-center gap-2.5 rounded-xl px-1.5 py-1`,children:[(0,F.jsx)(ll,{status:t,progress:e.progress}),(0,F.jsxs)(`span`,{className:`sr-only`,children:[sl(t),`: `]}),(0,F.jsx)(`span`,{className:i(`min-w-0 flex-1 truncate text-sm leading-5`,t===`pending`&&`text-muted-foreground/65`,t===`in-progress`&&`text-foreground`,t===`completed`&&`text-muted-foreground/60`,t===`cancelled`&&`text-muted-foreground/55`),children:(0,F.jsxs)(`span`,{className:`relative inline-block max-w-full`,children:[e.title,(0,F.jsx)(o.span,{"aria-hidden":`true`,initial:!1,animate:{scaleX:+(t===`completed`),opacity:+(t===`completed`)},transition:h?{duration:0}:{duration:.28,ease:u,delay:.06},className:`absolute inset-x-0 top-1/2 h-px origin-left bg-current`})]})}),e.detail?(0,F.jsx)(`span`,{className:`shrink-0 text-sm text-muted-foreground/55`,children:e.detail}):null]},e.id)})})}),!e.length&&(0,F.jsx)(`p`,{className:`px-1.5 py-2 text-sm text-muted-foreground`,children:`No tasks yet`})]})})]})}function dl(e){return e===`in_progress`||e===`in-progress`?`in-progress`:e===`completed`?`completed`:e===`cancelled`?`cancelled`:`pending`}function fl(e){return(e??[]).flatMap((e,t)=>{let n=e.title??e.content;return n?[{id:`${t}-${n}`,title:n,status:dl(e.status)}]:[]})}var pl=(0,P.memo)(function({part:e}){let t=e.state===`input-streaming`,n=(0,P.useMemo)(()=>fl(e.input?.todos??e.output?.newTodos),[e.input?.todos,e.output?.newTodos]);return t||n.length===0?(0,F.jsx)(oe,{as:`span`,duration:1.2,className:`m-0 inline-flex h-4 items-center text-label leading-none`,children:`Updating to-dos...`}):(0,F.jsx)(ul,{items:n,title:`Todo list`,defaultOpen:!0,collapseOnComplete:!1,maxHeight:240})},Uc);function ml(e,t){let[n,r]=(0,P.useState)(0);return(0,P.useEffect)(()=>{if(t&&e){r(Date.now()-e);let t=setInterval(()=>{r(Date.now()-e)},1e3);return()=>clearInterval(t)}},[t,e]),n}function hl(e){if(!e)return``;let t=Te(e);if(t!==e)return t;if(e.startsWith(`/`)){let t=e.split(`/`),n=[`apps`,`packages`,`src`,`lib`,`components`],r=t.findIndex(e=>n.includes(e));if(r>0)return t.slice(r).join(`/`)}return e}function gl(e,t){let n=e.split(`
1390
- `),r=t.split(`
1391
- `),i=Math.max(n.length,r.length),a=0,o=0;for(let e=0;e<i;e++)n[e]!==void 0&&r[e]!==void 0?n[e]!==r[e]&&(o++,a++):n[e]===void 0?r[e]!==void 0&&a++:o++;return{addedLines:a,removedLines:o}}var _l={"tool-Task":{icon:ue,title:e=>{let t=e.state!==`output-available`&&e.state!==`output-error`,n=e.input?.subagent_type||`Agent`;return t?`Running ${n}`:`${n} completed`},subtitle:e=>{let t=e.input?.description||``;return t.length>50?`${t.slice(0,47)}...`:t},variant:`simple`},"tool-Agent":{icon:ue,title:e=>{let t=e.state!==`output-available`&&e.state!==`output-error`,n=e.input?.subagent_type||`Agent`;return t?`Running ${n}`:`${n} completed`},subtitle:e=>{let t=e.input?.description||``;return t.length>50?`${t.slice(0,47)}...`:t},variant:`simple`},"tool-Skill":{icon:ue,title:()=>`Skill`,subtitle:e=>e.input?.skill||``,variant:`simple`},"tool-Grep":{icon:me,title:e=>{if(e.state!==`output-available`&&e.state!==`output-error`)return`Grepping`;let t=e.output?.numFiles||0;return t>0?`Grepped ${t} files`:`No matches`},subtitle:e=>{let t=e.input?.pattern||``,n=e.input?.path||``;if(n){let e=`${t} in ${hl(n)}`;return e.length>40?`${e.slice(0,37)}...`:e}return t.length>40?`${t.slice(0,37)}...`:t},variant:`simple`},"tool-Glob":{icon:Fe,title:e=>{if(e.state!==`output-available`&&e.state!==`output-error`)return`Exploring files`;let t=e.output?.numFiles||0;return t>0?`Found ${t} files`:`No files found`},subtitle:e=>{let t=e.input?.pattern||``;return t.length>40?`${t.slice(0,37)}...`:t},variant:`simple`},"tool-Read":{icon:de,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Reading`:`Read`,subtitle:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||``},variant:`simple`},"tool-Edit":{icon:te,title:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||`Edit`},subtitle:e=>{if(e.state!==`output-available`&&e.state!==`output-error`)return``;let t=e.input?.old_string||``,n=e.input?.new_string||``;if(!t&&!n)return``;if(t!==n){let{addedLines:e,removedLines:r}=gl(t,n);return`+${e} -${r}`}return``},variant:`simple`},"tool-Write":{icon:Pe,title:()=>`Create`,subtitle:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||``},variant:`simple`},"tool-Bash":{icon:he,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Running command`:`Ran command`,subtitle:e=>{let t=e.input?.command||``;if(!t)return``;let n=t.replace(/\\\s*\n\s*/g,` `).trim();return n=n.replace(/\/(?:Users|home|root)\/[^\s"']+/g,e=>hl(e)),n.length>50?`${n.slice(0,47)}...`:n},variant:`simple`},"tool-IPython":{icon:te,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Running cell`:`Ran cell`,subtitle:e=>{let t=e.input?.code||``;if(!t)return``;let n=t.split(`
1392
- `,1)[0].trim();return n.length>50?`${n.slice(0,47)}...`:n},variant:`simple`},"tool-WebFetch":{icon:le,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Fetching`:`Fetched`,subtitle:e=>{let t=e.input?.url||``;try{return new URL(t).hostname.replace(`www.`,``)}catch{return t.slice(0,30)}},variant:`simple`},"tool-WebSearch":{icon:me,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Searching web`:`Searched web`,subtitle:e=>{let t=e.input?.query||``;return t.length>40?`${t.slice(0,37)}...`:t},variant:`collapsible`},"tool-TodoWrite":{icon:S,title:e=>{let t=e.state!==`output-available`&&e.state!==`output-error`,n=e.input?.action||`update`;return t?n===`add`?`Adding todo`:`Updating todos`:n===`add`?`Added todo`:`Updated todos`},subtitle:e=>{let t=e.input?.todos||[];return t.length===0?``:`${t.length} ${t.length===1?`item`:`items`}`},variant:`simple`},"tool-PlanWrite":{icon:ue,title:e=>{let t=e.state!==`output-available`&&e.state!==`output-error`,n=e.input?.action||`create`;if(t)return n===`create`?`Creating plan`:n===`approve`?`Approving plan`:`Updating plan`;let r=e.input?.plan?.status;return r===`awaiting_approval`?`Plan ready for review`:r===`approved`?`Plan approved`:r===`completed`?`Plan completed`:n===`create`?`Created plan`:`Updated plan`},variant:`simple`},"tool-ExitPlanMode":{icon:b,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Finishing plan`:`Plan complete`,variant:`simple`},"tool-NotebookEdit":{icon:te,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Editing notebook`:`Edited notebook`,subtitle:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||``},variant:`simple`},"tool-BashOutput":{icon:he,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Getting output`:`Command output`,subtitle:e=>{let t=e.output;if(typeof t==`string`&&t.trim())return t.trim();let n=e.input?.command||``;if(!n)return``;let r=n.replace(/\\\s*\n\s*/g,` `).trim();return r=r.replace(/\/(?:Users|home|root)\/[^\s"']+/g,e=>hl(e)),r.length>50?`${r.slice(0,47)}...`:r},variant:`simple`},"tool-KillShell":{icon:M,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Stopping shell`:`Shell stopped`,subtitle:e=>{let t=e.input?.pid;return typeof t==`number`?`pid ${t}`:``},variant:`simple`},"tool-cloning":{icon:fe,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Cloning repo`:`Repo cloned`,subtitle:e=>e.input?.repo??``,variant:`simple`},"tool-Thinking":{icon:ue,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Thinking...`:`Thought`,variant:`collapsible`}},vl=`tool-mcp__`,yl={"tool-ListMcpResources":{serverName:`mcp`,toolName:`list_resources`,displayName:`List Resources`,category:`list`},"tool-ListMcpResourcesTool":{serverName:`mcp`,toolName:`list_resources`,displayName:`List Resources`,category:`list`},"tool-ReadMcpResource":{serverName:`mcp`,toolName:`read_resource`,displayName:`Read Resource`,category:`get`},"tool-ReadMcpResourceTool":{serverName:`mcp`,toolName:`read_resource`,displayName:`Read Resource`,category:`get`}};function bl(e){let t=yl[e];if(t)return t;if(!e.startsWith(vl))return null;let n=e.slice(10),r=n.indexOf(`__`);if(r===-1)return null;let i=n.slice(0,r),a=n.slice(r+2);return{serverName:i,toolName:a,displayName:a.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim(),category:`other`}}function xl(e,t){return`${e} ${e===1?t:`${t}s`}`}function Sl(e){if(e.length===0)return``;let t=new Set([`tool-Read`,`tool-Edit`,`tool-Write`]),n=new Set([`tool-Search`,`tool-Grep`,`tool-Glob`,`tool-WebSearch`]),r=new Set([`tool-Bash`]),i=0,a=0,o=0;for(let s of e)t.has(s.type)?i+=1:n.has(s.type)?a+=1:r.has(s.type)&&(o+=1);let s=[];return i>0&&s.push(xl(i,`file`)),a>0&&s.push(`${a} ${a===1?`search`:`searches`}`),o>0&&s.push(xl(o,`command`)),s.length===0?``:s.length===1?s[0]:s.length===2?`${s[0]} and ${s[1]}`:`${s.slice(0,-1).join(`, `)}, and ${s[s.length-1]}`}function Cl(e){let t=new Set([`tool-Read`,`tool-Edit`,`tool-Write`]),n=new Set([`tool-Search`,`tool-Grep`,`tool-Glob`,`tool-WebSearch`]),r=0,i=0;for(let a of e)t.has(a.type)?r+=1:n.has(a.type)&&(i+=1);return{fileCount:r,searchCount:i}}function wl(e,t){let n=[];return e>0&&n.push(xl(e,`file`)),t>0&&n.push(`${t} ${t===1?`search`:`searches`}`),n.join(`, `)}var Tl=(0,P.memo)(function({part:e,nestedTools:t=[],chatStatus:n,completeLabel:r,shimmerLabel:a,interruptedLabel:o,maxVisibleTools:s=5,defaultOpen:c,showElapsed:l=!0}){let{isPending:u,isInterrupted:d}=Gc(e,n),f=e.input?.description||``,[p,m]=(0,P.useState)(c??!1),[h,g]=(0,P.useState)(0),_=e.callProviderMetadata?.custom?.startedAt??e.startedAt,v=t.length>0,y=e.toolCallId??e.id??``,b=e.output?.totalDurationMs||e.output?.duration||e.output?.duration_ms,x=Math.max(1,s)*28,S=u?Math.max(h,0):t.length,C=(0,P.useRef)(u),w=(0,P.useRef)(!1),T=(0,P.useRef)(null),{fileCount:E,searchCount:D}=(0,P.useMemo)(()=>Cl(u?t.slice(0,Math.max(h,0)):t),[u,t,h]),O=wl(E,D),k=(0,P.useRef)(null),A=ml(_,u);(0,P.useEffect)(()=>{let e=C.current;return T.current&&=(window.clearTimeout(T.current),null),u&&!e&&!w.current&&c!==!1&&(m(!1),T.current=window.setTimeout(()=>{m(!0)},60)),!u&&e&&(m(!1),w.current=!1),C.current=u,()=>{T.current&&=(window.clearTimeout(T.current),null)}},[c,u]),(0,P.useEffect)(()=>{if(!u||t.length===0){g(t.length);return}let e=1;g(Math.min(e,t.length));let n=setInterval(()=>{e+=1,g(Math.min(e,t.length)),e>=t.length&&clearInterval(n)},450);return()=>clearInterval(n)},[u,t.length,y]),(0,P.useEffect)(()=>{!u||!k.current||(k.current.scrollTop=k.current.scrollHeight)},[u,h]);let j=(()=>{if(u&&v)return O;if(!u&&v){let e=Sl(t);if(e)return e}return f?f.length>60?`${f.slice(0,57)}...`:f:``})(),M=Wc(!u&&b?b:A);return d&&!e.output?(0,F.jsx)(Ic,{completeLabel:o,isAnimating:!1}):(0,F.jsx)(Ic,{completeLabel:r,shimmerLabel:a,isAnimating:u,detail:j,expandable:v,expanded:p,onToggleExpand:()=>{w.current=!0,m(e=>!e)},trailingContent:l&&M?(0,F.jsx)(`span`,{className:`shrink-0 font-normal text-muted-foreground/60 tabular-nums`,children:M}):void 0,children:(0,F.jsxs)(`div`,{className:`relative`,children:[u&&p&&S>4&&(0,F.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-10 bg-linear-to-b from-background to-transparent`}),(0,F.jsx)(`div`,{ref:k,className:i(t.length>1?`flex flex-col gap-2`:void 0,u&&p&&S>4&&`overflow-y-auto`),style:u&&p&&S>4?{height:`${x}px`}:void 0,children:(u?t.slice(0,Math.max(h,0)):t).map((e,t)=>{let r=u?{...e,state:t===h-1?`input-streaming`:`output-available`}:e,i=_l[r.type];if(!i)return null;let{isPending:a,isError:o}=Gc(r,n);return(0,F.jsx)(Lc,{icon:i.icon,title:i.title(r),subtitle:i.subtitle?.(r),isPending:a,isError:o},r.toolCallId??r.id??`${r.type}-${i.title(r)}`)})})]})})});function El(e,t){if(e.state===`input-streaming`)return`streaming`;if(e.state===`output-available`)return`success`;if(e.state===`output-error`)return`error`;let{isPending:n}=Gc(e,t);return n?`pending`:`success`}var Dl=(0,P.memo)(function({part:e,nestedTools:t,chatStatus:n,toolRenderers:r}){let i=e.type;switch(i){case`tool-Bash`:return(0,F.jsx)(We,{part:e});case`tool-IPython`:return(0,F.jsx)(se,{part:e});case`tool-Edit`:case`tool-Write`:return(0,F.jsx)(Fc,{part:e});case`tool-WebSearch`:case`tool-Grep`:case`tool-Glob`:return(0,F.jsx)(ol,{part:e});case`tool-PlanWrite`:return(0,F.jsx)(rl,{part:e,chatStatus:n});case`tool-TodoWrite`:return(0,F.jsx)(pl,{part:e,chatStatus:n});case`tool-Question`:return(0,F.jsx)(Ve,{part:e,chatStatus:n});case`tool-Task`:case`tool-Agent`:{let r=e.type===`tool-Agent`?`Agent`:`Task`;return(0,F.jsx)(Tl,{part:e,nestedTools:t,chatStatus:n,completeLabel:`${r} completed`,shimmerLabel:`Running ${r.toLowerCase()}`,interruptedLabel:`${r} interrupted`,defaultOpen:!1})}case`tool-Thinking`:return null}let a=bl(i);if(a){if(r){let t=r[a.toolName];if(t)return(0,F.jsx)(t,{name:a.toolName,input:e.input??{},output:e.output?Qc(e.output):void 0,status:El(e,n)})}return(0,F.jsx)(el,{part:e,mcpInfo:a,chatStatus:n})}if(r&&i.startsWith(`tool-`)){let t=i.slice(5),a=r[t];if(a)return(0,F.jsx)(a,{name:t,input:e.input??{},output:e.output??e.result,status:El(e,n)})}let o=_l[i];if(o){let{isPending:t,isError:r}=Gc(e,n);return(0,F.jsx)(Lc,{title:o.title(e),subtitle:o.subtitle?.(e),isPending:t,isError:r})}let s=i.startsWith(`tool-`)?i.slice(5):i,{isPending:c,isError:l}=Gc(e,n);return(0,F.jsx)(Lc,{title:c?`Running ${s}`:s,isPending:c,isError:l})}),Ol={queued:`Waiting to generate`,generating:`Generating image`,refining:`Refining details`,complete:`Image ready`,error:`Generation failed`},kl={queued:{filter:`blur(4px) saturate(0.75)`,opacity:0,scale:1.02},generating:{filter:`blur(3px) saturate(0.85)`,opacity:0,scale:1.015},refining:{filter:`blur(1.5px) saturate(0.95)`,opacity:.62,scale:1.005},complete:{filter:`blur(0px) saturate(1)`,opacity:1,scale:1},error:{filter:`blur(2px) saturate(0.5)`,opacity:.28,scale:1}},Al={queued:1,generating:1,refining:.48,complete:0,error:0},jl=10,Ml=Math.PI*2;function Nl({status:e,reduce:t}){return e===`complete`?(0,F.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}):e===`error`?(0,F.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`}):(0,F.jsxs)(o.span,{"aria-hidden":`true`,animate:t?void 0:{rotate:360},transition:{duration:2.4,ease:c,repeat:1/0},className:`grid size-3.5 grid-cols-2 place-items-center gap-0.5`,children:[(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`})]})}function Pl({interactive:e,reduce:t,status:n}){let r=y(),i=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let n=i.current,a=n?.getContext(`2d`);if(!n||!a)return;let o=0,s=0,c=0,l=`currentColor`,u={x:0,y:0,targetX:0,targetY:0,inside:!1},d=e&&r&&!t,f=()=>{let e=n.getBoundingClientRect();s=e.width||n.clientWidth||208,c=e.height||n.clientHeight||208;let t=Math.min(window.devicePixelRatio||1,2);n.width=Math.round(s*t),n.height=Math.round(c*t),a.setTransform(t,0,0,t,0,0),l=window.getComputedStyle(n).color,u.x=s/2,u.y=c/2,u.targetX=u.x,u.targetY=u.y},p=e=>{a.clearRect(0,0,s,c),u.inside||(u.targetX=s/2+(t?0:Math.sin(e/1700)*s*.12),u.targetY=c/2+(t?0:Math.cos(e/2100)*c*.1));let n=t?1:u.inside?.16:.045;u.x+=(u.targetX-u.x)*n,u.y+=(u.targetY-u.y)*n;let r=Math.min(s,c)*.38,i=Math.ceil(s/jl)+1,d=Math.ceil(c/jl)+1,f=(s-(i-1)*jl)/2,m=(c-(d-1)*jl)/2;a.fillStyle=l;for(let e=0;e<d;e+=1)for(let t=0;t<i;t+=1){let n=f+t*jl,i=m+e*jl,o=n-u.x,s=i-u.y,c=Math.hypot(o,s),l=Math.max(0,1-c/r),d=l*l*(3-2*l),p=d*d*9,h=c>0?o/c:0,g=c>0?s/c:0,_=n+h*p,v=i+g*p,y=.65+d*.85;a.globalAlpha=.17+d*.72,a.beginPath(),a.arc(_,v,y,0,Ml),a.fill()}a.globalAlpha=1,t||(o=window.requestAnimationFrame(p))},m=e=>{if(!d)return;let t=n.getBoundingClientRect();u.inside=!0,u.targetX=e.clientX-t.left,u.targetY=e.clientY-t.top},h=()=>{u.inside=!1},g=typeof ResizeObserver>`u`?null:new ResizeObserver(f);return f(),g?.observe(n),n.addEventListener(`pointermove`,m,{passive:!0}),n.addEventListener(`pointerleave`,h),p(0),()=>{o&&window.cancelAnimationFrame(o),g?.disconnect(),n.removeEventListener(`pointermove`,m),n.removeEventListener(`pointerleave`,h)}},[r,e,t]),(0,F.jsx)(o.div,{"aria-hidden":`true`,initial:!1,animate:{opacity:Al[n]},transition:{duration:t?0:.4,ease:u},className:`absolute inset-0 overflow-hidden bg-muted`,children:(0,F.jsx)(`canvas`,{ref:i,className:`absolute inset-0 size-full text-foreground`})})}function Fl({children:e,status:t=`generating`,label:n,prompt:r,resolution:s=`1024 × 1024`,aspectRatio:c=`1 / 1`,size:l=`compact`,interactive:p=!0,statusText:m,showStatus:h=!0,onRetry:g,className:_,mediaClassName:v,statusClassName:y}){let b=f()??!1,x=t===`queued`||t===`generating`||t===`refining`,S=kl[t],C=m??Ol[t],w=n??(r?`${C}: ${r}`:C);return(0,F.jsx)(`div`,{"data-slot":`image-generation`,"data-state":t,"aria-busy":x,className:i(`w-full`,_),children:(0,F.jsxs)(`div`,{className:i(`w-full`,l===`compact`&&`mx-auto max-w-52`),children:[(0,F.jsxs)(`div`,{role:`img`,"aria-label":w,style:{aspectRatio:c},className:`relative isolate w-full overflow-hidden rounded-xl bg-muted`,children:[(0,F.jsx)(o.div,{"aria-hidden":!e||void 0,initial:!1,animate:b?{opacity:S.opacity}:{filter:S.filter,opacity:S.opacity,scale:S.scale},transition:b?{duration:0}:{duration:.4,ease:u},className:i(`absolute inset-0 [&>*]:size-full [&>*]:object-cover [&_img]:size-full [&_img]:object-cover`,v),children:e}),(0,F.jsx)(d,{initial:!1,children:x?(0,F.jsx)(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:b?0:.25,ease:u},className:`absolute inset-0`,children:(0,F.jsx)(Pl,{interactive:p,reduce:b,status:t})},`dither-field`):null}),s?(0,F.jsx)(`span`,{className:`absolute top-2 right-2 z-10 rounded-full bg-background/75 px-2 py-0.5 font-mono text-micro tabular-nums text-muted-foreground`,children:s}):null]}),(0,F.jsx)(d,{initial:!1,children:h||r?(0,F.jsxs)(o.div,{initial:!1,className:`mt-3 text-left`,children:[(0,F.jsxs)(`div`,{"aria-live":`polite`,className:i(h?`flex min-h-5 items-center gap-2`:`contents`,`text-sm font-medium text-foreground`,t===`error`&&`text-destructive`,y),children:[h?(0,F.jsx)(Nl,{status:t,reduce:b}):null,(0,F.jsx)(d,{mode:`popLayout`,initial:!1,children:h?(0,F.jsx)(o.span,{initial:!b&&{opacity:0,y:4},animate:{opacity:1,y:0},exit:b?void 0:{opacity:0,y:-4},transition:{duration:b?0:.15,ease:u},children:C},C):null})]}),r?(0,F.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[`“`,r,`”`]}):null]},`status-block`):null}),t===`error`&&g?(0,F.jsxs)(o.button,{type:`button`,onClick:g,whileTap:b?void 0:{scale:.96},transition:a,className:`mt-3 inline-flex min-h-10 items-center gap-2 rounded-full px-3 text-sm font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,F.jsx)(pe,{"aria-hidden":`true`,className:`size-4`}),`Try again`]}):null]})})}function Il({steps:e,activeIndex:t,className:n,...r}){let a=e.length,o=ke(t,a),s=o>=a,c=Ae(o,a);return(0,F.jsxs)(`div`,{"data-slot":`agent-plan`,className:i(`flex w-full max-w-sm flex-col gap-3`,n),...r,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsx)(`span`,{className:`text-body font-medium`,children:`Plan`}),(0,F.jsxs)(`span`,{className:i(je,`text-foreground/35 tabular-nums`),children:[o,` of `,a]})]}),(0,F.jsx)(`div`,{className:`bg-foreground/[0.06] h-[3px] w-full overflow-hidden rounded-full`,children:(0,F.jsx)(`span`,{className:`bg-foreground/80 block h-full rounded-full transition-[width] duration-500`,style:{width:`${c}%`}})}),(0,F.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:e.map((e,t)=>{let n=s||t<o,r=!s&&t===o;return(0,F.jsxs)(`li`,{className:`flex items-center gap-2.5 text-body`,children:[(0,F.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:n?(0,F.jsx)(C,{className:`text-foreground/35 size-3.5`}):r?(0,F.jsx)(j,{className:`text-foreground/90 size-3.5 animate-spin motion-reduce:animate-none`}):(0,F.jsx)(`span`,{"aria-hidden":!0,className:`bg-foreground/15 size-1.5 rounded-full`})}),(0,F.jsx)(`span`,{className:i(n&&`text-foreground/40`,r&&`text-foreground/90`,!n&&!r&&`text-foreground/35`),children:e})]},e)})})]})}function Ll(e){if(e.length===0)return;let t=e.flatMap(e=>{let t=e.title.trim();return t?[t]:[]});if(t.length!==e.length)return;let n=0;for(;n<e.length&&e[n]?.status===`completed`;)n+=1;if(!e.slice(n+1).some(e=>e.status===`completed`))return{steps:t,activeIndex:n}}function Rl({presentation:e,className:t}){return(0,F.jsx)(Il,{steps:e.steps,activeIndex:e.activeIndex,"aria-label":`Plan progress: ${Math.min(e.activeIndex,e.steps.length)} of ${e.steps.length} steps completed`,className:t})}function zl(e){return e===`approving`?`Approving`:e===`approved`?`Approved`:e===`denied`?`Denied`:e===`running`?`Running`:e===`complete`?`Completed`:e===`error`?`Failed`:`Approval required`}function Bl(e){return e===`pending`?`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`:e===`approving`||e===`running`?`border-primary/30 bg-primary/10 text-primary`:e===`approved`||e===`complete`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-rose-500/30 bg-rose-500/10 text-rose-600 dark:text-rose-400`}function Vl({tool:e,title:t=`Allow this tool to run?`,description:n,parameters:r=[],status:c=`pending`,open:l,defaultOpen:p=!1,onOpenChange:m,onApprove:h,onAlwaysAllow:g,onDeny:_,className:v}){let y=f()??!1,b=`${(0,P.useId)()}-details`,x=(0,P.useRef)(c),[S,T]=(0,P.useState)(p),E=l??S,D=(0,P.useCallback)(e=>{l===void 0&&T(e),m?.(e)},[m,l]),k=c===`approving`||c===`running`,A=c===`pending`,M=c===`error`;return(0,P.useEffect)(()=>{x.current===`pending`&&c!==`pending`&&D(!1),x.current=c},[D,c]),(0,F.jsxs)(`div`,{"data-state":c,"aria-busy":k,className:i(`w-full overflow-hidden rounded-2xl border border-border/60 bg-muted/20 text-sm`,v),children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3 p-4`,children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,className:i(`mt-0.5 grid size-8 shrink-0 place-items-center rounded-xl border border-border/60 bg-background text-muted-foreground`,M&&`text-destructive`),children:k?(0,F.jsx)(j,{className:i(`size-4`,!y&&`animate-spin`)}):M?(0,F.jsx)(O,{className:`size-4`}):c===`denied`?(0,F.jsx)(_e,{className:`size-4`}):c===`approved`||c===`complete`?(0,F.jsx)(C,{className:`size-4`}):(0,F.jsx)(ce,{className:`size-4`})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-foreground`,children:t}),(0,F.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-muted-foreground`,children:e})]}),(0,F.jsx)(`span`,{className:i(`shrink-0 rounded-full border px-2 py-0.5 text-caption font-medium transition-colors`,Bl(c)),children:zl(c)})]}),n?(0,F.jsx)(`p`,{className:`mt-2 leading-5 text-muted-foreground`,children:n}):null,r.length?(0,F.jsxs)(`button`,{type:`button`,"aria-expanded":E,"aria-controls":b,onClick:()=>D(!E),className:`mt-2 inline-flex items-center gap-1 rounded-md text-xs font-medium text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[`View details`,(0,F.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:E?180:0},transition:y?{duration:0}:s,children:(0,F.jsx)(w,{className:`size-3.5`})})]}):null]})]}),(0,F.jsx)(ne,{id:b,open:E,children:(0,F.jsx)(`dl`,{className:`mx-4 mb-4 grid gap-2 rounded-xl border border-border/50 bg-background/70 p-3`,children:r.map(e=>(0,F.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,7rem)_minmax(0,1fr)] items-center gap-3 text-xs`,children:[(0,F.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,F.jsx)(`dd`,{className:`min-w-0 break-words font-mono text-foreground/85`,children:e.value})]},e.id))})}),(0,F.jsx)(d,{initial:!1,children:A?(0,F.jsxs)(o.div,{initial:y?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:y?.12:.22,ease:u},className:`flex flex-wrap items-center gap-2 border-t border-border/60 px-4 py-3`,children:[(0,F.jsx)(o.button,{type:`button`,onClick:h,whileTap:y?void 0:{scale:.97},transition:a,className:`rounded-xl bg-foreground px-3 py-1.5 text-xs font-medium text-background outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:`Allow once`}),g?(0,F.jsx)(o.button,{type:`button`,onClick:g,whileTap:y?void 0:{scale:.97},transition:a,className:`rounded-xl border border-border/60 bg-background px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:`Always allow`}):null,(0,F.jsx)(`button`,{type:`button`,onClick:_,className:`rounded-xl px-3 py-1.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:`Deny`})]}):null})]})}function Q(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function Hl(e){let t=Q(e);if(t)return t;if(typeof e==`string`)try{return Q(JSON.parse(e))}catch{return}}function $(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`string`&&t.trim())return t}}function Ul(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e))return e}}}function Wl(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`boolean`)return t}}function Gl(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Kl(e){return e.output!==void 0&&e.output!==null?e.output:e.result}function ql(e){let t=Hl(e),n=Hl(t?.details),r={...t??{},...n??{}},i=r.result,a=$(r,`stdout`,`standardOutput`,`standard_output`),o=$(r,`stderr`,`standardError`,`standard_error`),s=r.error??r.errorMessage??r.evalue,c=s===void 0?void 0:Gl(s),l=Ul(r,`durationMs`,`duration_ms`,`duration`),u=Wl(r,`kernelRestarted`,`kernel_restarted`),d=new Set([`stdout`,`stderr`,`standardOutput`,`standard_output`,`standardError`,`standard_error`,`error`,`errorMessage`,`evalue`,`durationMs`,`duration_ms`,`duration`,`kernelRestarted`,`kernel_restarted`,`status`,`isError`]),f=Object.keys(r).some(e=>!d.has(e));return{record:t,details:n,stdout:a,stderr:o,result:i,error:c,durationMs:l,kernelRestarted:u,structured:!a&&!o&&!c&&(typeof i==`object`&&!!i||f)}}function Jl(e,t){let n=[];if(e.stdout&&n.push({label:`stdout`,content:e.stdout,language:`text`}),e.stderr&&n.push({label:`stderr`,content:e.stderr,language:`text`}),e.result!==void 0&&n.push({label:`result`,content:Gl(e.result),language:typeof e.result==`object`&&e.result!==null?`json`:`text`}),e.error&&n.push({label:`error`,content:e.error,language:`text`}),n.length>0)return n;let r=e.details??e.record;if(r){let e={...r};if(delete e.details,delete e.isError,Object.keys(e).length>0)return[{label:`result`,content:Gl(e),language:`json`}]}let i=Gl(t);return i.trim()?[{label:`output`,content:i,language:`text`}]:[]}function Yl(e,t){return Jl(e,t).map(e=>`${e.label}\n${e.content}`).join(`
1393
-
1394
- `)}function Xl(e){return Hl(e.input)??Hl(e.args)}function Zl(e,...t){for(let n of t){let t=e?.[n];if(Array.isArray(t))return t}}function Ql(e,t){return $(t.details??t.record,`diff`,`patch`)??$(e,`diff`,`patch`)}function $l(e,t){return $(e,`path`,`filePath`,`filename`,`file`)??$(t.details??t.record,`path`,`filePath`,`filename`,`file`)??`workspace file`}function eu(e){return e.split(`
1395
- `).map((e,t)=>({id:`${t}-${e.slice(0,16)}`,type:e.startsWith(`+`)&&!e.startsWith(`+++`)?`added`:e.startsWith(`-`)&&!e.startsWith(`---`)?`removed`:`context`,content:e}))}function tu(e,t){let n=t.details??t.record,r=Hl(e?.plan)??Hl(n?.plan),i=Zl(e,`todos`)??Zl(r,`todos`,`items`)??Zl(n,`todos`,`newTodos`,`items`);return i?i.flatMap((e,t)=>{let n=Q(e);if(!n)return[];let r=$(n,`content`,`title`,`text`,`label`);if(!r)return[];let i=$(n,`status`),a=i===`in_progress`||i===`in-progress`?`in-progress`:i===`completed`?`completed`:i===`cancelled`?`cancelled`:`pending`;return[{id:`${t}-${r}`,title:r,status:a}]}):[]}function nu(e){let t=Zl(e.details??e.record,`results`,`sources`,`citations`);return t?t.flatMap((e,t)=>{let n=Q(e);if(!n)return[];let r=$(n,`title`,`name`,`snippet`);if(!r)return[];let i=$(n,`url`,`link`),a=i&&D(i)?i:void 0;return[{id:`${t}-${r}`,title:r,url:a,domain:$(n,`domain`,`source`)}]}):[]}function ru(e){return $(e.details??e.record,`url`,`imageUrl`,`image_url`)}function iu(e,t){return Q(e?.approval)??Q(t.details?.approval)??Q(t.record?.approval)}function au(e){let t=typeof e.type==`string`?e.type:`Tool`;return t.startsWith(`tool-`)?t.slice(5):t}function ou(e,t){let n=typeof e.state==`string`?e.state:void 0;return n===`output-error`||n===`error`?`error`:n===`output-available`||n===`complete`||n===`success`?`success`:n===`cancelled`||n===`canceled`||n===`aborted`||n===`interrupted`?`cancelled`:e.error===void 0?n===`input-streaming`||n===`streaming`?t===`streaming`?`running`:`cancelled`:e.output!==void 0||e.result!==void 0?`success`:t===`streaming`?`running`:`cancelled`:`error`}function su(e,t){return t||e.toLowerCase().includes(`json`)?`json`:e.toLowerCase().includes(`bash`)||e.toLowerCase().includes(`shell`)?`bash`:e.toLowerCase().includes(`python`)?`python`:`text`}function cu(e,t){if(!t)return;let n=e.toLowerCase();return n.includes(`bash`)||n.includes(`shell`)?`bash`:n.includes(`python`)?/^\s*%%bash(?:\s|$)/im.test(t)?`bash`:`python`:`text`}function lu(e,t){if(!t)return;let n=e.toLowerCase();return n.includes(`ipython`)?`IPython`:n.includes(`bash`)||n.includes(`shell`)?`Bash`:n.includes(`python`)?`Python`:t===`json`?`JSON`:t===`text`?`Text`:t.toUpperCase()}var uu=new WeakMap;function du(e,t){if(e&&typeof e==`object`){let n=uu.get(e);if(n&&n.chatStatus===t)return n.value;let r=fu(e,t);return uu.set(e,{chatStatus:t,value:r}),r}return fu(e,t)}function fu(e,t){let n=Q(e);if(!n)return;let r=au(n),i=r.toLowerCase(),a=Xl(n),o=Kl(n),s=ql(o),c=ou(n,t),l=$(a,`command`,`cmd`,`code`,`script`),u=cu(r,l),d=[];s.durationMs!==void 0&&d.push(`${s.durationMs}ms`),s.kernelRestarted&&d.push(`kernel restarted`);let f=Ql(a,s),p=i.includes(`todo`)||i.includes(`plan`)?tu(a,s):[],m=i.includes(`search`)||i.includes(`web`)||i.includes(`source`)||i.includes(`citation`)?nu(s):[],h=i.includes(`image`)||i.includes(`generat`)?ru(s):void 0,g=iu(a,s),_=Yl(s,o),v=!!_.trim(),y=typeof n.toolCallId==`string`&&n.toolCallId?n.toolCallId:`${r}-${JSON.stringify(a??{})}`,b;return p.length>0?b={kind:`todo`,title:i.includes(`plan`)?`Plan`:`Todo list`,items:p}:m.length>0?b={kind:`citations`,citations:m}:h?b={kind:`image`,url:h}:f&&(i.includes(`edit`)||i.includes(`write`)||i.includes(`patch`))?b={kind:`diff`,file:$l(a,s),lines:eu(f),copyText:f}:(l||v||g||d.length>0)&&(b={kind:`output`,content:_,language:su(r,s.structured),structured:s.structured,sections:Jl(s,o),sourceCode:l,sourceLanguage:u,sourceLabel:lu(r,u)}),{id:y,name:r,lowerName:i,status:c,input:a,output:o,outputSummary:s,command:l,metadata:d,approval:g,detail:b}}function pu(e){return e.map(e=>({id:String(e.id),title:typeof e.title==`string`?e.title:``,status:e.status===`in-progress`?`in_progress`:e.status===`completed`?`completed`:e.status===`cancelled`?`cancelled`:`pending`}))}function mu(e,t){return t.toLowerCase().includes(`bash`)||t.toLowerCase().includes(`shell`)?(0,F.jsx)(he,{"aria-hidden":`true`,className:`size-4`}):e===`success`?(0,F.jsx)(A,{"aria-hidden":`true`,className:`size-4`}):(0,F.jsx)(ge,{"aria-hidden":`true`,className:`size-4`})}function hu({approval:e,name:t,status:n}){if(!e)return null;let r=n===`running`?`pending`:n===`error`?`error`:`complete`,i=Object.entries(e).flatMap(([e,t])=>typeof t==`object`||typeof t==`function`?[]:[{id:e,label:e,value:String(t)}]);return(0,F.jsx)(Vl,{tool:t,title:`Fleet Prime permission`,description:`This tool reported a permission decision from Fleet Prime.`,parameters:i,status:r})}function gu({code:e,language:t,languageLabel:n,status:r}){return(0,F.jsx)(m,{code:e,language:t,languageLabel:n,status:r===`running`?`streaming`:`complete`,showStatus:!1,maxHeight:160,showLineNumbers:!1,wrap:!0})}var _u=(0,P.memo)(function({part:e,chatStatus:t,fallback:n}){let r=du(e,t);if(!r||r.lowerName===`question`)return n??null;let{detail:i,status:a}=r;if(!i)return n??null;if(i.kind===`todo`){let t=pu(i.items),a=!!e.input?.pendingDecision;if(r.lowerName===`planwrite`&&a)return n??null;let o=r.lowerName===`planwrite`&&e.input?.executing?Ll(t):void 0;return o?(0,F.jsx)(Rl,{presentation:o,className:`mb-2`}):(0,F.jsx)(ul,{items:i.items,title:i.title,defaultOpen:!0,collapseOnComplete:!1,maxHeight:240})}if(i.kind===`citations`)return(0,F.jsx)(x,{citations:i.citations,title:`Sources`,defaultOpen:!0});if(i.kind===`image`)return(0,F.jsx)(Fl,{status:a===`running`?`generating`:a===`error`?`error`:`complete`,children:(0,F.jsx)(`img`,{src:i.url,alt:`Generated result`,width:640,height:320,loading:`lazy`,decoding:`async`,className:`h-auto max-h-80 w-full object-contain`})});if(i.kind===`diff`)return(0,F.jsx)(g,{file:i.file,lines:i.lines,status:a===`running`?`streaming`:`complete`,language:`diff`,maxHeight:240,copyText:i.copyText,defaultOpen:a===`running`});let o=i.content||`No output.`;return(0,F.jsxs)(_,{tool:`Prime`,title:r.name,status:a,kind:r.lowerName.includes(`bash`)||r.lowerName.includes(`shell`)||r.lowerName.includes(`python`)?`terminal`:`custom`,meta:r.metadata.length>0?r.metadata.join(` · `):void 0,icon:mu(a,r.name),defaultOpen:a===`running`,collapseOnComplete:!1,maxHeight:240,copyText:o,children:[i.sourceCode?(0,F.jsx)(gu,{code:i.sourceCode,language:i.sourceLanguage??`text`,languageLabel:i.sourceLabel,status:a}):null,i.sections.map(e=>(0,F.jsx)(h,{language:e.language,label:e.label,children:e.content},e.label)),(0,F.jsx)(hu,{approval:r.approval,name:r.name,status:a})]})}),vu=e({SessionToolRenderer:()=>yu}),yu=(0,P.memo)(function(e){let t=e.part.type;if(t===`tool-Thinking`||t===`tool-FleetReasoning`)return null;let n=(0,F.jsx)(Dl,{...e});return t.startsWith(`tool-`)?(0,F.jsx)(_u,{...e,fallback:n}):n});export{vu as n,yu as t};