@qredence/fleet 0.6.2 → 0.6.4

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 (313) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/web/client/assets/DialogTitle-BwQ9k-MZ.js +1 -0
  3. package/dist/web/client/assets/agent-disclosure-YgLa4c2y.js +1 -0
  4. package/dist/web/client/assets/alert-dialog-BfK7648p.js +1 -0
  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-DdPlRVuL.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-DSxdh_1v.js +1 -0
  22. package/dist/web/client/assets/composer-intent-C5pz72T6.js +62 -0
  23. package/dist/web/client/assets/create-project-dialog-CaXurRpm.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-B9nXTto4.js +1 -0
  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-CpwEwsxA.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-B-fD_O7k.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-BJIGh8ag.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-CPYj2iaw.js} +1 -1
  50. package/dist/web/client/assets/{model-selector-list-CRZCXeBf.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-Bkkx5kmA.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-a7UP_MAw.js +1 -0
  57. package/dist/web/client/assets/{prompt-suggestions-BNyTcyWg.js → prompt-suggestions-ULqmPijZ.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-BqtgZw7Z.js +2 -0
  68. package/dist/web/client/assets/rotate-ccw-DLkfsmG9.js +1 -0
  69. package/dist/web/client/assets/routes-C37r2W1K.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-DF3kuF0P.js +1 -0
  75. package/dist/web/client/assets/settings-dialog-BRWheaBZ.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-C5ukYiUx.js → subagent-chat-panel-B6d4Z3bV.js} +1 -1
  83. package/dist/web/client/assets/subagent-transcript-CQuPs6N4.js +1 -0
  84. package/dist/web/client/assets/{subagents-panel-SJKhaVTr.js → subagents-panel-ajf--C_-.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-BcUIpW6Y.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-Cr5Z97oW.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-Bcq088gZ.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-BZR0i182-OLTGGEDQ.js +96 -0
  108. package/dist/web/server/{artifacts-panel-BN3DgqfV-N73J6N5Y.js → artifacts-panel-BySfu7im-AKBWHYJS.js} +75 -67
  109. package/dist/web/server/{chat-command-palette-G8awyZRw-2QE7FXGT.js → chat-command-palette-BLGKnp-w-OKFIKD3T.js} +52 -43
  110. package/dist/web/server/{chunk-6SOMNRAX.js → chunk-22XP6PHK.js} +56 -17
  111. package/dist/web/server/{chunk-O2UYZT3Z.js → chunk-2GQATGF4.js} +93 -37
  112. package/dist/web/server/{chunk-EDAWH2MT.js → chunk-2HOITUWV.js} +5 -5
  113. package/dist/web/server/{chunk-NZ6KQT2X.js → chunk-2XQYM4KB.js} +2 -2
  114. package/dist/web/server/{chunk-K6PTNSCW.js → chunk-36BG6OPK.js} +2 -2
  115. package/dist/web/server/chunk-3OOZPQZF.js +51 -0
  116. package/dist/web/server/{chunk-YMPJMHXZ.js → chunk-3YYNG52U.js} +5774 -4759
  117. package/dist/web/server/{chunk-NMBH57JT.js → chunk-47TH5VUT.js} +17 -15
  118. package/dist/web/server/{chunk-CCYLHNZJ.js → chunk-4B2PJSK5.js} +150 -1787
  119. package/dist/web/server/chunk-4IVORBQD.js +39 -0
  120. package/dist/web/server/{chunk-CW6KZUKT.js → chunk-4LBXVBM7.js} +5 -5
  121. package/dist/web/server/{chunk-DKD32TRM.js → chunk-5FIJPXUA.js} +3343 -14
  122. package/dist/web/server/{chunk-JVOW2NWC.js → chunk-5VPNOUVY.js} +13 -104
  123. package/dist/web/server/chunk-7LUHWO5G.js +28 -0
  124. package/dist/web/server/chunk-7SZKAHLD.js +25 -0
  125. package/dist/web/server/{chunk-UE32PAV2.js → chunk-ACZS5EEZ.js} +4 -4
  126. package/dist/web/server/{chunk-CAPTFJOC.js → chunk-AWVHN432.js} +4 -4
  127. package/dist/web/server/{chunk-SDV3P3IW.js → chunk-BMXYQRMJ.js} +96 -78
  128. package/dist/web/server/{chunk-OVJYUWSQ.js → chunk-C2YGLMFE.js} +1 -1
  129. package/dist/web/server/{chunk-7HXCGBUP.js → chunk-CIE2PLNB.js} +5 -5
  130. package/dist/web/server/chunk-CMOAC245.js +28 -0
  131. package/dist/web/server/{chunk-7FK6YEMA.js → chunk-CRCVWYBA.js} +2 -9
  132. package/dist/web/server/chunk-DIVIHC5K.js +100 -0
  133. package/dist/web/server/{chunk-XJ6TGSUB.js → chunk-EKVRPCBJ.js} +1 -1
  134. package/dist/web/server/{chunk-ZNFXBGLK.js → chunk-ERYPONRF.js} +1 -1
  135. package/dist/web/server/chunk-F3OV445J.js +25 -0
  136. package/dist/web/server/{chunk-5727TXOK.js → chunk-F5DJQ3PQ.js} +36 -36
  137. package/dist/web/server/{chunk-NCK2FJAD.js → chunk-FAJILEF2.js} +142 -110
  138. package/dist/web/server/{chunk-JPDRUSUD.js → chunk-FF2M3MLP.js} +2 -2
  139. package/dist/web/server/{chunk-IPV4GLJL.js → chunk-FHZAFF2A.js} +7 -24
  140. package/dist/web/server/chunk-FOMB2JR7.js +26 -0
  141. package/dist/web/server/{chunk-43S5N7SH.js → chunk-FVWPODLT.js} +9 -8
  142. package/dist/web/server/chunk-G3WQTXJY.js +25 -0
  143. package/dist/web/server/{chunk-ESM7OCRL.js → chunk-GLNLSEZJ.js} +7 -7
  144. package/dist/web/server/chunk-GNDXVFJY.js +28 -0
  145. package/dist/web/server/chunk-GR765UTQ.js +102 -0
  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-I36LJXNY.js +113 -0
  149. package/dist/web/server/{chunk-ZOVXMNJM.js → chunk-IIPUA4LB.js} +249 -304
  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-4OTHKQMG.js → chunk-JLGBOCFM.js} +145 -111
  154. package/dist/web/server/chunk-JVXQQYXB.js +154 -0
  155. package/dist/web/server/{chunk-FT74GAAH.js → chunk-JZ2WBCIH.js} +674 -669
  156. package/dist/web/server/chunk-KABZXD6N.js +152 -0
  157. package/dist/web/server/{chunk-WB2LJC3R.js → chunk-L2SVMQWB.js} +14 -45
  158. package/dist/web/server/chunk-LOFZS555.js +28 -0
  159. package/dist/web/server/{chunk-MJXXVQNA.js → chunk-LQRH6BP6.js} +25 -18
  160. package/dist/web/server/{chunk-WU6X3GPJ.js → chunk-MTVGA2MH.js} +72 -52
  161. package/dist/web/server/{chunk-DLA5TLKX.js → chunk-NHZRY22Z.js} +110 -39
  162. package/dist/web/server/chunk-NZ5YXXQ5.js +39 -0
  163. package/dist/web/server/chunk-ONWT54IL.js +148 -0
  164. package/dist/web/server/{chunk-E5HALE4M.js → chunk-OYWUPJ72.js} +2 -2
  165. package/dist/web/server/{chunk-YVGCPUAW.js → chunk-PISNXFEK.js} +3 -3
  166. package/dist/web/server/{chunk-33QA7BQJ.js → chunk-PYTU4DGR.js} +16 -10
  167. package/dist/web/server/{chunk-7E76R7MB.js → chunk-QHCQDVCQ.js} +1 -2
  168. package/dist/web/server/{chunk-ENGEUJIH.js → chunk-QN7KFCUW.js} +4321 -3650
  169. package/dist/web/server/chunk-QWWG3YC6.js +25 -0
  170. package/dist/web/server/chunk-RPGWRA2X.js +39 -0
  171. package/dist/web/server/chunk-RPWKCJHL.js +18 -0
  172. package/dist/web/server/chunk-RWYAKZCZ.js +39 -0
  173. package/dist/web/server/chunk-SGMJ5CGW.js +36 -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-BUXJSBE3.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-IXGLKAPN.js → chunk-VHLBXWEN.js} +57 -42
  182. package/dist/web/server/{chunk-OMEDERPG.js → chunk-WU6KNEGU.js} +47 -32
  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-CigfFgAj-QS27NAJH.js +295 -0
  194. package/dist/web/server/{fork-picker-dialog-YKlapaxN-DR5L74ST.js → fork-picker-dialog-B5J-S5Nm-QOMVVHI7.js} +11 -10
  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-RBJUC3AT.js → message-queue-BsrLcNPX-CUCBSF6U.js} +15 -14
  200. package/dist/web/server/{model-selector-list-BmzLiCx9-TK6JGGKU.js → model-selector-list-Csw4nOra-IOMN5JMO.js} +23 -22
  201. package/dist/web/server/openui-renderer-TbIFXEW2-BET2OXM2.js +39 -0
  202. package/dist/web/server/{prompt-suggestions-yPZqX__K-3VGJC4IF.js → prompt-suggestions-D6RXFQF4-7WHYRNMN.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-CPdFlpbe-LAD4MNZB.js → router-RPObiwZR-AFMFSYSZ.js} +2852 -186
  206. package/dist/web/server/{routes-hkom6S6L-DUPPQHPY.js → routes-Dn-deuPY-MDXEQXRU.js} +2219 -2435
  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-WaHHv775-HRUHFSFO.js +229 -0
  212. package/dist/web/server/{settings-dialog-BCEfmgtP-T3WQEZHB.js → settings-dialog-CzeangBl-YKL7CLPF.js} +565 -388
  213. package/dist/web/server/{start-DVUbMfrb-ELVIFRUY.js → start-QK6aG02q-RXFV6K5L.js} +1 -1
  214. package/dist/web/server/{subagent-chat-panel-BTwI1kdB-LKBWA4GD.js → subagent-chat-panel-Fa31QewE-YDPOKN74.js} +49 -46
  215. package/dist/web/server/{subagents-panel-8Z9_csoV-HYMEEBHB.js → subagents-panel-DjOcQxp4-GZYOZOYC.js} +46 -44
  216. package/dist/web/server/tool-timeline-CfuizRid-L3Y3OSCH.js +15 -0
  217. package/dist/web/server/{workspace-panel-BHEB9nRM-TS62SYBA.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-DmQghvw8.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-C24kD2SP.js +0 -52
  225. package/dist/web/client/assets/chat-command-palette-BIwjhE6s.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-BUvM92nt.js +0 -1
  231. package/dist/web/client/assets/command-Dv96gATQ.js +0 -1
  232. package/dist/web/client/assets/createLucideIcon-_dfI7Arx.js +0 -1
  233. package/dist/web/client/assets/dialog-BCb4rQh0.js +0 -1
  234. package/dist/web/client/assets/dist-52wg4XPY.js +0 -1
  235. package/dist/web/client/assets/eye-CDHqtVoE.js +0 -1
  236. package/dist/web/client/assets/file-text-TmalmYrb.js +0 -1
  237. package/dist/web/client/assets/folder-vuNT4shY.js +0 -1
  238. package/dist/web/client/assets/gauge-BsDqNM1A.js +0 -1
  239. package/dist/web/client/assets/globals-DCtBkCSD.css +0 -2
  240. package/dist/web/client/assets/hard-drive-BT7UxHQu.js +0 -1
  241. package/dist/web/client/assets/horizontal-resize-VLjLByUV.js +0 -1
  242. package/dist/web/client/assets/index-BGnQeUYE.js +0 -12
  243. package/dist/web/client/assets/ipython-tool-CkHaO3PW.js +0 -3
  244. package/dist/web/client/assets/is-ref-object-BcRWZ4l7.js +0 -1
  245. package/dist/web/client/assets/loader-circle-B5GIZGxd.js +0 -1
  246. package/dist/web/client/assets/markdown-BHkByC9K.js +0 -2
  247. package/dist/web/client/assets/mermaid-HWGCJPDP-CY3N5ECk.js +0 -1
  248. package/dist/web/client/assets/package-BKBPgwMP.js +0 -1
  249. package/dist/web/client/assets/pencil-CdO6qfv3.js +0 -1
  250. package/dist/web/client/assets/plug-BRROUIw-.js +0 -1
  251. package/dist/web/client/assets/prompt-input-WaGSKZCU.js +0 -1
  252. package/dist/web/client/assets/provider-catalog-C0XBIasJ.js +0 -1
  253. package/dist/web/client/assets/provider-label-Cka0ep0S.js +0 -1
  254. package/dist/web/client/assets/react-CwJFpaho.js +0 -1
  255. package/dist/web/client/assets/react-dom-DX3XddaT.js +0 -1
  256. package/dist/web/client/assets/refresh-cw-l9WPHRkq.js +0 -1
  257. package/dist/web/client/assets/resource-helpers-BuWybA8l.js +0 -2
  258. package/dist/web/client/assets/right-panel-context-CS8tJMzE.js +0 -1
  259. package/dist/web/client/assets/right-panel-registry-BCW7fQTG.js +0 -2
  260. package/dist/web/client/assets/rotate-ccw-CfGhzOv7.js +0 -1
  261. package/dist/web/client/assets/routes-BWe5Iz-2.js +0 -16
  262. package/dist/web/client/assets/safe-external-url-BbAom7Bm.js +0 -1
  263. package/dist/web/client/assets/search-BjcXAUrI.js +0 -1
  264. package/dist/web/client/assets/session-tool-renderer-3E3cv8D0.js +0 -1395
  265. package/dist/web/client/assets/settings-dialog-B8lHq2tT.js +0 -2
  266. package/dist/web/client/assets/sparkles-D8XIY8pN.js +0 -1
  267. package/dist/web/client/assets/square-DQaQu9bp.js +0 -1
  268. package/dist/web/client/assets/square-terminal-BsopiuN7.js +0 -1
  269. package/dist/web/client/assets/subagent-transcript-lqNcSVbH.js +0 -1
  270. package/dist/web/client/assets/sun-D0llhiMU.js +0 -1
  271. package/dist/web/client/assets/switch-D3FhZU-S.js +0 -1
  272. package/dist/web/client/assets/terminal-BQAKkBY6.js +0 -1
  273. package/dist/web/client/assets/toast-lnCWGgSE.js +0 -1
  274. package/dist/web/client/assets/tokens-Ch5WqXC_.js +0 -1
  275. package/dist/web/client/assets/tool-result-B_yb2JoE.js +0 -4
  276. package/dist/web/client/assets/tool-timeline-VnMRQoLS.js +0 -1
  277. package/dist/web/client/assets/triangle-alert-GAYh_5d3.js +0 -1
  278. package/dist/web/client/assets/utils-Brtgag-m.js +0 -1
  279. package/dist/web/client/assets/virtualized-turn-list-BgUgX6tM.js +0 -6
  280. package/dist/web/client/assets/workspace-panel-CKF5JQl2.js +0 -1
  281. package/dist/web/client/assets/wrench-Myc12BTA.js +0 -1
  282. package/dist/web/client/assets/x-BGsDD848.js +0 -1
  283. package/dist/web/server/_tanstack-start-manifest_v-BDPifIFN-DTSNCHBX.js +0 -91
  284. package/dist/web/server/chunk-2ST2ULW7.js +0 -24
  285. package/dist/web/server/chunk-3C4CFCIS.js +0 -19
  286. package/dist/web/server/chunk-3IHTZSBY.js +0 -22
  287. package/dist/web/server/chunk-4QD4PCVP.js +0 -19
  288. package/dist/web/server/chunk-4ZIEVI5O.js +0 -63
  289. package/dist/web/server/chunk-7CNGNFFK.js +0 -23
  290. package/dist/web/server/chunk-AHTO6GDS.js +0 -33
  291. package/dist/web/server/chunk-CHEC7TWB.js +0 -22
  292. package/dist/web/server/chunk-D7ELZVTI.js +0 -33
  293. package/dist/web/server/chunk-GS2IZGRC.js +0 -19
  294. package/dist/web/server/chunk-HFQZLPU2.js +0 -29
  295. package/dist/web/server/chunk-JBLHIEVG.js +0 -22
  296. package/dist/web/server/chunk-JDCCC7A7.js +0 -3382
  297. package/dist/web/server/chunk-JIULUYHT.js +0 -24
  298. package/dist/web/server/chunk-KBWUBWVJ.js +0 -60
  299. package/dist/web/server/chunk-LJ6Y7DBH.js +0 -128
  300. package/dist/web/server/chunk-M5RSPNYN.js +0 -22
  301. package/dist/web/server/chunk-O2DUZJYK.js +0 -19
  302. package/dist/web/server/chunk-OKL5ZRVB.js +0 -33
  303. package/dist/web/server/chunk-OOXWPL22.js +0 -22
  304. package/dist/web/server/chunk-OSMP55KI.js +0 -94
  305. package/dist/web/server/chunk-SFTKGQ7H.js +0 -33
  306. package/dist/web/server/chunk-TNL4YV63.js +0 -29
  307. package/dist/web/server/chunk-UCA4WN66.js +0 -45
  308. package/dist/web/server/chunk-WWJF4RO2.js +0 -19
  309. package/dist/web/server/chunk-X7D6GFQU.js +0 -34
  310. package/dist/web/server/chunk-XA42CHF2.js +0 -22
  311. package/dist/web/server/openui-renderer-moJGf0LA-QCU3PI6H.js +0 -38
  312. package/dist/web/server/session-tool-renderer-CglQ2ky7-2JVYNZG2.js +0 -45
  313. package/dist/web/server/tool-timeline-QL9k5dzA-RLU26HXT.js +0 -16
@@ -0,0 +1,1389 @@
1
+ import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{t as n}from"./react-Cvdyeg_0.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{t as i}from"./utils-Dpy9ZFOr.js";import{c as a,d as o,n as s,o as c,r as l,s as u}from"./ease-2UPBQU5v.js";import{n as d,t as f}from"./use-reduced-motion-CaQBb3Qc.js";import{t as p}from"./createLucideIcon-CQY2ECfR.js";import{i as m,n as h,r as g,t as _}from"./tool-result-C-vs_tjQ.js";import{a as v,i as y,o as b,r as x,s as S}from"./citations-DOkXsdCi.js";import{t as C}from"./check-BTwIaCtI.js";import{t as w}from"./chevron-down-Bse1ggZM.js";import{t as T}from"./chevron-right-BPCB1mOg.js";import{n as E,t as D}from"./safe-external-url-BnEhm9A0.js";import{n as O,t as k}from"./file-text-cqOanUYv.js";import{t as A}from"./circle-check-DBhaebaM.js";import{a as j,n as M,r as N,t as ee}from"./agent-disclosure-YgLa4c2y.js";import{a as te,i as ne,n as re,r as ie,t as ae}from"./ipython-tool-CuSGRhXl.js";import{n as oe,r as se,t as ce}from"./sparkles-C4VQyMox.js";import{t as le}from"./eye-iNSvs0UA.js";import{t as ue}from"./git-branch-DZEh2mM2.js";import{t as de}from"./loader-circle-BmKYM_C4.js";import{t as fe}from"./rotate-ccw-DLkfsmG9.js";import{t as pe}from"./search-Cb6fFWew.js";import{t as me}from"./terminal-Ceucj7us.js";import{t as he}from"./wrench-BYnD147U.js";import{t as ge}from"./x-DEU6H3M-.js";import{t as P}from"./preload-helper-Czpn1I53.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se}from"./dist-CZDnnosQ.js";import{i as Ce,r as we}from"./workspace-path-nav-DmxBrMV6.js";import{n as Te,r as Ee,t as De}from"./collapsible-DsbKpD_Y.js";import{n as Oe,t as ke}from"./range-BWOHiLNe.js";import{s as Ae}from"./surfaces-BULKVm-B.js";var je={name:`chevrons-down`,size:24,node:[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]};je.node;var Me=p(je),Ne={name:`chevrons-up`,size:24,node:[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]};Ne.node;var Pe=p(Ne),Fe={name:`file-plus`,size:24,node:[[`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.node;var Ie=p(Fe),Le={name:`folder-search`,size:24,node:[[`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`}]]};Le.node;var Re=p(Le),F=t(n(),1),I=r(),ze=`__custom__`;function Be(e){return String.fromCharCode(65+e)}function Ve(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(ze),{selectedIds:Array.from(r),customText:i,textValue:``}}function He({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,F.useState)(()=>Ve(u,g?.kind,_).selectedIds),[b,x]=(0,F.useState)(()=>Ve(u,g?.kind,_).customText),[S,C]=(0,F.useState)(()=>Ve(u,g?.kind,_).textValue),w=m>1&&(!!r||!!a),T=h>1,E=h<m,D=h>=m,O=(0,F.useMemo)(()=>new Set(v),[v]),k=D?o:s,A=(0,F.useMemo)(()=>{if(g?.kind===`text`)return S.trim().length>0;let e=v.filter(e=>e!==ze).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])},N=e=>{if(x(e),g){if(g.kind===`single`){y(e.trim().length>0?[ze]:[]);return}y(t=>{let n=t.includes(ze);return e.trim().length>0&&!n?[...t,ze]:e.trim().length===0&&n?t.filter(e=>e!==ze):t})}};return g?(0,I.jsxs)(`div`,{className:i(`flex flex-col gap-2 bg-background px-3 py-2`,p),children:[(0,I.jsx)(`div`,{className:`flex items-center justify-between gap-px`,"data-total-questions":m,children:(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,I.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,I.jsx)(`span`,{children:g.title})]})}),g.kind!==`text`&&(g.options?.length??0)>0&&(0,I.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,I.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,I.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:Be(t)}),(0,I.jsxs)(`span`,{className:`text-sm text-foreground`,children:[e.label,e.description&&(0,I.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,e.description]})]})]},n)}),_&&(0,I.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,I.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(ze)?`border-primary bg-primary text-primary-foreground`:`border-border bg-transparent text-muted-foreground`),children:Be(g.options.length)}),(0,I.jsx)(`input`,{value:b,onChange:e=>N(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,I.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,I.jsxs)(`div`,{className:i(`flex items-center gap-1.5`,w?`justify-between`:`justify-end`),children:[w&&(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,I.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,I.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,I.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[l&&(0,I.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,I.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!==ze),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 Ue(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 We({part:e}){let[t,n]=(0,F.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,F.useState)({}),[d,f]=(0,F.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,F.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,F.useMemo)(()=>!_||i<=1?[]:Array.from({length:i},(e,t)=>({index:t+1,answer:l[t+1]})),[_,l,i]),C=(0,F.useMemo)(()=>_?S.length>0?S.map(e=>`${e.index}: ${e.answer?Ue(e.answer):`Pending`}`).join(` • `):h?Ue(h):l[s]?Ue(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,I.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center justify-between border-b border-border px-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,I.jsx)(v,{className:`size-3.5`}),`Question`]}),y&&(0,I.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,I.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,I.jsx)(E,{className:`size-3.5`})}),(0,I.jsxs)(`span`,{children:[s,` of `,i]}),(0,I.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,I.jsx)(w,{className:`size-3.5`})})]})]}),_?(0,I.jsx)(`div`,{className:`bg-background px-3 py-2 text-xs text-muted-foreground`,children:C}):(0,I.jsx)(He,{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 Ge(e){return e.split(`|`).map(e=>e.trim().split(/\s+/)[0]??``).filter(Boolean).slice(0,4).join(`, `)}function Ke({step:e,state:t,onComplete:n,approval:r}){te(t===`animating`,e.duration,n);let i=t===`animating`,a=e.bashCommand??e.toolDetail,o=Ge(a);return(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center justify-between pr-2 pl-2.5`,children:[(0,I.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden`,children:i?(0,I.jsxs)(ie,{as:`span`,duration:1.2,className:`m-0 inline-flex h-full items-center truncate text-xs leading-none`,children:[`Running command: `,o]}):(0,I.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[`Ran command: `,o]})}),i&&(0,I.jsx)(`svg`,{className:`h-3 w-3 shrink-0 animate-spin text-muted-foreground`,viewBox:`0 0 16 16`,fill:`none`,children:(0,I.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`28`,strokeDashoffset:`7`,strokeLinecap:`round`})})]}),(0,I.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,I.jsxs)(`div`,{className:`break-all`,children:[(0,I.jsx)(`span`,{className:`text-amber-600 select-none dark:text-amber-400`,children:`$ `}),(0,I.jsx)(`span`,{className:`text-foreground`,children:a})]}),!i&&e.bashOutput&&(0,I.jsx)(`div`,{className:`mt-1 max-h-[80px] overflow-hidden whitespace-pre-line text-muted-foreground`,children:e.bashOutput})]}),r&&(0,I.jsx)(ne,{isPending:i,...r})]})}var qe=(0,F.memo)(function({part:e}){let t=e.input?.approval??e.args?.approval,{step:n,stepState:r}=re(e,`Bash`);return(0,I.jsx)(Ke,{step:n,state:r,onComplete:()=>{},approval:t})});function Je(e){let t=(0,F.useRef)(e);return(0,F.useInsertionEffect)(()=>void(t.current=e)),(0,F.useCallback)((...e)=>t.current(...e),[])}var Ye=(0,F.createContext)(void 0);function Xe(){return(0,F.useContext)(Ye)}var Ze={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Qe={display:`contents`};function $e(){return null}var et=`diffs-container`,tt=/(?=^diff --git)/gm,nt=/(?<=\n)/,rt=/^(---|\+\+\+)\s+([^\t\r\n]+)/,it=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,at=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,ot=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,st=`header-prefix`,ct=`header-filename-suffix`,lt=`header-metadata`,ut=`header-custom`,L={dark:`pierre-dark`,light:`pierre-light`},dt=`data-theme-css`,ft=`data-unsafe-css`,pt=`data-diffs-scrollbar-measure`,mt=`--diffs-scrollbar-gutter-measured`,ht=1e5,gt={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...gt});var _t=Object.freeze({fromStart:0,fromEnd:0}),vt={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},yt={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function bt(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function xt({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function R(e,t){return e-(t===0?0:1)}function z(e,t){return R(e,t)+t}function St(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Ct(n,e.startContentIndex)}}function Ct(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 wt({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=bt}){let p=n?.(e),m=r?.(e),h=i?.(e),g=a?.(e);return(0,I.jsxs)(I.Fragment,{children:[p==null?(0,I.jsxs)(I.Fragment,{children:[m!=null&&(0,I.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,I.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),g!=null&&(0,I.jsx)(`div`,{slot:`header-metadata`,children:g})]}):(0,I.jsx)(`div`,{slot:ut,children:p}),o!=null&&l?.map((e,t)=>(0,I.jsx)(`div`,{slot:f(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=Tt(t,e);return(0,I.jsx)(`div`,{slot:n,style:Qe,children:c(t,d)},n)}),s!=null&&(0,I.jsx)(`div`,{slot:`gutter-utility-slot`,style:Ze,children:s(u)})]})}function Tt(e,t){let n=St(e,t);return n==null?void 0:xt({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var Et=new Map,Dt=new Map,Ot=new Map,kt=new Set;function At(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!kt.has(t))return!1;return!0}function jt(e=L){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var Mt=new Set;function Nt(e){let t=[],n=new Set;for(let r of Pt(e.themes)){let e=Lt(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 Nt({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 Nt({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Pt(e){return Ft(e)?[e]:e}function Ft(e){return Lt(e)||It(e)}function It(e){return typeof e.name==`string`&&typeof e.load==`function`}function Lt(e){return typeof e.getThemes==`function`}function Rt(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var zt=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},Bt=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Vt=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Ht(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new zt(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 Bt(i));let c=r,l=s().then(e=>{let a=Rt(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 Vt(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 Ut=Ht();function Wt(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Ut.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Ut.getResolvedTheme(n)??Ut.seedResolvedTheme(n,e);Mt.has(n)||(Mt.add(n),t.loadThemeSync(e))}}function Gt(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(kt.has(n.name))continue;let e=Et.get(n.name);e??(e=n,Et.set(n.name,e)),kt.add(e.name),t.loadLanguageSync(e.data)}}function Kt(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}async function qt(e){if(Kt())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=Dt.get(e);if(t!=null)return t;try{let t=Ot.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Se,e)&&(t=Se[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 Et.has(e)||Et.set(e,n),n});return Dt.set(e,n),await n}finally{Dt.delete(e)}}function Jt(e){return Et.get(e)??qt(e)}function Yt(e){for(let t of jt(e))if(!Mt.has(t))return!1;return!0}function Xt({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Zt(t)}}function Zt(e){return async()=>_e(Rt(await e()))}var Qt=`pierre`,$t=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],en=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],tn=[...en,...$t],nn=new Set(en);function rn(e){return nn.has(e)?`light`:`dark`}var an={"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`},on={"pierre-dark":()=>P(()=>import(`./pierre-dark-CpLgRqie.js`),[]),"pierre-dark-soft":()=>P(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>P(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>P(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>P(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[]),"pierre-light":()=>P(()=>import(`./pierre-light-CoaEpmwp.js`),[]),"pierre-light-soft":()=>P(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>P(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>P(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[]),"pierre-light-tritanopia":()=>P(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[])};function sn(e){return Xt({name:e,collection:Qt,colorScheme:rn(e),displayName:an[e],load:on[e]})}var cn=Nt({themes:tn.map(e=>sn(e))}),ln=`shiki`,un=[`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`],dn=`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(`.`),fn=new Set(un);function pn(e){return fn.has(e)?`light`:`dark`}var mn={andromeeda:()=>P(()=>import(`./andromeeda-vGVdxbeo.js`),[]),"aurora-x":()=>P(()=>import(`./aurora-x-CDeNXAV0.js`),[]),"ayu-dark":()=>P(()=>import(`./ayu-dark-DluEY0Gj.js`),[]),"ayu-light":()=>P(()=>import(`./ayu-light-C3h-C4tm.js`),[]),"ayu-mirage":()=>P(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>P(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]),"catppuccin-latte":()=>P(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>P(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]),"catppuccin-mocha":()=>P(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]),"dark-plus":()=>P(()=>import(`./dark-plus-Cs2F2srj.js`),[]),dracula:()=>P(()=>import(`./dracula-BHWKrbxM.js`),[]),"dracula-soft":()=>P(()=>import(`./dracula-soft-5eyTD99u.js`),[]),"everforest-dark":()=>P(()=>import(`./everforest-dark-sB-x3p7T.js`),[]),"everforest-light":()=>P(()=>import(`./everforest-light-Df2xbC6M.js`),[]),"github-dark":()=>P(()=>import(`./github-dark-C-LZuMrd.js`),[]),"github-dark-default":()=>P(()=>import(`./github-dark-default-DXG-b-1a.js`),[]),"github-dark-dimmed":()=>P(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>P(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]),"github-light":()=>P(()=>import(`./github-light-EUqPIrTm.js`),[]),"github-light-default":()=>P(()=>import(`./github-light-default-BXViO-2h.js`),[]),"github-light-high-contrast":()=>P(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>P(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]),"gruvbox-dark-medium":()=>P(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>P(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>P(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]),"gruvbox-light-medium":()=>P(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>P(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]),horizon:()=>P(()=>import(`./horizon-CE9ld1lL.js`),[]),"horizon-bright":()=>P(()=>import(`./horizon-bright-DSNQnXHK.js`),[]),houston:()=>P(()=>import(`./houston-CsvMBhTu.js`),[]),"kanagawa-dragon":()=>P(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]),"kanagawa-lotus":()=>P(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]),"kanagawa-wave":()=>P(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]),laserwave:()=>P(()=>import(`./laserwave-C_8bwKvT.js`),[]),"light-plus":()=>P(()=>import(`./light-plus-DVQuIRkW.js`),[]),"material-theme":()=>P(()=>import(`./material-theme-Bm3Qr25_.js`),[]),"material-theme-darker":()=>P(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]),"material-theme-lighter":()=>P(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]),"material-theme-ocean":()=>P(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]),"material-theme-palenight":()=>P(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]),"min-dark":()=>P(()=>import(`./min-dark-BSWPekZh.js`),[]),"min-light":()=>P(()=>import(`./min-light-DDpmG2fV.js`),[]),monokai:()=>P(()=>import(`./monokai-B_bV9PQ9.js`),[]),"night-owl":()=>P(()=>import(`./night-owl-DhmEMT88.js`),[]),"night-owl-light":()=>P(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]),nord:()=>P(()=>import(`./nord-Cb4Vim4T.js`),[]),"one-dark-pro":()=>P(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]),"one-light":()=>P(()=>import(`./one-light-D7Lr4KcI.js`),[]),plastic:()=>P(()=>import(`./plastic-DQwYfKfQ.js`),[]),poimandres:()=>P(()=>import(`./poimandres-DRFjx7u4.js`),[]),red:()=>P(()=>import(`./red-DX1BQOs8.js`),[]),"rose-pine":()=>P(()=>import(`./rose-pine-aMsaMD1D.js`),[]),"rose-pine-dawn":()=>P(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]),"rose-pine-moon":()=>P(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]),"slack-dark":()=>P(()=>import(`./slack-dark-DnToyrRv.js`),[]),"slack-ochin":()=>P(()=>import(`./slack-ochin-B2OO5cIa.js`),[]),"snazzy-light":()=>P(()=>import(`./snazzy-light-4G7pJPwS.js`),[]),"solarized-dark":()=>P(()=>import(`./solarized-dark-UdsmMDCL.js`),[]),"solarized-light":()=>P(()=>import(`./solarized-light-C1IUL_tW.js`),[]),"synthwave-84":()=>P(()=>import(`./synthwave-84-nFMaYfgc.js`),[]),"tokyo-night":()=>P(()=>import(`./tokyo-night-oM2G3aXe.js`),[]),vesper:()=>P(()=>import(`./vesper-DdrHHSXu.js`),[]),"vitesse-black":()=>P(()=>import(`./vitesse-black-fwtXNY1n.js`),[]),"vitesse-dark":()=>P(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]),"vitesse-light":()=>P(()=>import(`./vitesse-light-VbXTXTou.js`),[])};function hn(e){return Xt({name:e,collection:ln,colorScheme:pn(e),load:mn[e]})}var gn=Nt({themes:Object.freeze([...un.map(e=>hn(e)),...dn.map(e=>hn(e))])});function _n(e){if(Kt())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(Ut.hasRegisteredTheme(e))return;let t=gn.getTheme(e);if(t!=null){Ut.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function vn(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function yn(e){_n(e);let t=await Ut.resolveTheme(e);return vn(e,t),t}function bn(e){return Ut.getResolvedTheme(e)??yn(e)}var B;async function xn({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){B??=xe({themes:[],langs:[`text`],engine:n===`shiki-wasm`?be(P(()=>import(`./wasm-BnjxR4X6.js`),[])):ye()});let r=Cn(B)?await B:B;B=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=Jt(e);`then`in t?i.push(t):Gt(t,r)}let a=[];for(let t of e){let e=bn(t);`then`in e?a.push(e):Wt(e,B)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{Gt(e,r)}),Promise.all(a).then(e=>{Wt(e,r)})]),r}function Sn(e){if(!(B==null||`then`in B)&&!(e!=null&&(!Yt(e.theme)||!At(e.lang))))return B}function Cn(e=B){return e!=null&&`then`in e}for(let e of cn.getThemes())Ut.registerThemeIfAbsent(e.name,e.load);function wn(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}var Tn=new Map,En={"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 V(e){if(Tn.has(e))return Tn.get(e)??`text`;if(En[e]!=null)return En[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Tn.has(t[1]))return Tn.get(t[1])??`text`;if(En[t[1]]!=null)return En[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Tn.has(n)?Tn.get(n)??`text`:En[n]??`text`}function Dn(e,t){for(let n of t)e.push(n)}function H(e){return{type:`text`,value:e}}function U({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function On({name:e,width:t=16,height:n=16,properties:r}){return U({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[U({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function kn(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 An(e){return U({tagName:`div`,properties:{"data-gutter":``},children:e})}function jn(e,t,n,r={}){return U({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[U({tagName:`span`,properties:{"data-line-number-content":``},children:[H(`${t}`)]})]})}function W(e,t,n){return U({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 Mn(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(H(`
2
+ `)),e}var Nn=Symbol(`no-token`),Pn=Symbol(`multiple-tokens`);function Fn(e){let t=In(e);if(t!=null)return t;let n=Nn,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`){Rn(e,a);for(let t of e.children)Ln(t)}else Ln(e);r.push(e),i=[],a=void 0;return}for(let e of i)Ln(e);r.push(U({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Nn){if(e===Pn){n=Pn;return}if(n===Nn){n=e;return}n!==e&&(n=Pn)}};for(let t of e.children){let e=t.type===`element`?Fn(t):Nn;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 In(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Ln(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Ln(t)}}function Rn(e,t){e.properties[`data-char`]=t}function zn(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+Bn(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 Bn(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 Vn(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=kn(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Fn(a),i.push(Mn(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(Un,Hn),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:Hn}}var Hn=zn({classPrefix:`hl-`}),Un={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 G(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var Wn=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Gn=/^0(?:\.0+)?%?$/;function Kn(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 qn(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 Jn(e){if(e==null)return null;let t=qn(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 Yn(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Wn.test(t))return!0;let n=Kn(t);return n!=null&&Gn.test(n)}function Xn(e,t,n){if(t==null||n==null)return!1;let r=Jn(e),i=Jn(t),a=Jn(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Zn=new WeakMap;function Qn(e){let t=Zn.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;K(r,`editor.background`,i),K(r,`editor.foreground`,a),K(r,`sideBar.background`,o),K(r,`sideBar.foreground`,s),K(r,`input.background`,n[`input.background`]??o),K(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),K(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),K(r,`gitDecoration.addedResourceForeground`,$n(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),K(r,`gitDecoration.modifiedResourceForeground`,$n(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),K(r,`gitDecoration.deletedResourceForeground`,$n(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Yn(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Yn(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(er(l,o)||Xn(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Zn.set(e,u),u}function K(e,t,n){n!=null&&n!==``&&(e[t]=n)}function $n(...e){for(let t of e)if(t!=null&&t!==``)return t}function er(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function tr({theme:e=L,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+=`${G(`global`)}fg:${a.fg};`,r+=`${G(`global`)}bg:${a.bg};`,r+=nr(i,n)}else{let n=t.getTheme(e.dark),i=Qn(n);r+=`${G(`global`)}dark:${i.fg};`,r+=`${G(`global`)}dark-bg:${i.bg};`,r+=nr(n,`dark`),n=t.getTheme(e.light),i=Qn(n),r+=`${G(`global`)}light:${i.fg};`,r+=`${G(`global`)}light-bg:${i.bg};`,r+=nr(n,`light`)}return r}function nr(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${G(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${G(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${G(`global`)}${t}modified-color:${a};`),n}function rr(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 q(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function ir(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function J(e,t){return wn(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function ar(e){let t=e.lang??V(e.name),n=e.lang??(e.prevName==null?`text`:V(e.prevName));return t===`text`&&n===`text`}function or(e){return{...gt,...e}}function sr(e,t){let n=cr(e,t);return t?n:e.diffHeaderHeight+n}function cr(e,t){return e.paddingTop??(t?e.spacing:0)}function lr(e){return e.paddingBottom??e.spacing}function ur(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function dr(e){return[R(e.additionStart,e.additionCount)+1,z(e.additionStart,e.additionCount)+1]}function Y({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 fr(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-z(t.additionStart,t.additionCount),r=e.deletionLines.length-z(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function pr({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-z(n.additionStart,n.additionCount),i=e.deletionLines.length-z(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 X({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=pr({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 mr({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]=dr(a);if(t<o){let s=Y({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=X({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]=dr(a);return t<o+i.fromStart||t>=o+i.rangeSize}function hr({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]=dr(n),l=Y({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=X({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 gr({type:e,metrics:t}){return t.hunkSeparatorHeight??ur(e)}function _r({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function vr({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 yr(e){return e!==`simple`&&e!==`metadata`}function br({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!vr({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=gr({type:e,metrics:t}),a=_r({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function xr({type:e,metrics:t}){if(!yr(e))return;let n=gr({type:e,metrics:t}),r=_r({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Sr({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=Cr({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=R(r.deletionStart,r.deletionCount),s=R(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=Y({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?X({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(Er(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,Er(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(Er(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=Dr(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(Or({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(Er(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 Cr({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=wr({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 wr({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=Y({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?X({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 Tr(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 Er(e,t,n,r,i,a){let[o,s]=Tr(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 Dr(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 Or({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}}function Z(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var kr=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}},Ar=new class extends kr{};function jr(e,t,n){return Ar.diff(e,t,n)}function Mr(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 Nr(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 Pr(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 Fr(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 Ir(e,t){return Pr(e,t,``)}function Lr(e,t){return Fr(e,t,``)}function Rr(e,t){return t.slice(0,zr(e,t))}function zr(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 Br(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 Vr(e,t){if(t)return Ur(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Hr(e,t){if(t)return Ur(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Ur(e,t){if(!t)return[Hr(e),Vr(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Br(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Wr=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Gr=RegExp(`[${Wr}]+|\\s+|[^${Wr}]`,`ug`);new class extends kr{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=Br(e,r)}else n=e.match(Gr)||[];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)&&Kr(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Kr(n,i,r,null,t.intlSegmenter),e}};function Kr(e,t,n,r,i){if(t&&n){let[a,o]=Ur(t.value,i),[s,c]=Ur(n.value,i);if(e){let r=Mr(a,s);e.value=Fr(e.value,s,r),t.value=Ir(t.value,r),n.value=Ir(n.value,r)}if(r){let e=Nr(o,c);r.value=Pr(r.value,c,e),t.value=Lr(t.value,e),n.value=Lr(n.value,e)}}else if(n){if(e){let e=Hr(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Hr(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Hr(r.value,i),[a,o]=Ur(t.value,i),s=Mr(n,a);t.value=Ir(t.value,s);let c=Nr(Ir(n,s),o);t.value=Lr(t.value,c),r.value=Pr(r.value,n,c),e.value=Fr(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Hr(r.value,i),n=Rr(Vr(t.value,i),e);t.value=Lr(t.value,n)}else if(e){let n=Rr(Vr(e.value,i),Hr(t.value,i));t.value=Ir(t.value,n)}}var qr=new class extends kr{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Wr}]+|[^\\S\\n\\r]+|[^${Wr}]`,`ug`);return e.match(t)||[]}};function Jr(e,t,n){return qr.diff(e,t,n)}var Yr=new class extends kr{constructor(){super(...arguments),this.tokenize=Zr}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 Xr(e,t,n){return Yr.diff(e,t,n)}function Zr(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 kr{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 kr{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends kr{constructor(){super(...arguments),this.tokenize=Zr}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($r(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 $r(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]=$r(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]=$r(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends kr{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function ei(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function ti(e){if(!ei(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 ni={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function ri(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;Xr(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Xr(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||oi(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 ii(e,t){if(t||=ni,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=>ii(e,t)).join(`
9
+ `)}let n=[];if(e.isGit){if(t=ni,!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 `+ti(r)+` `+ti(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 `+ti((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+ti((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+ti((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+ti((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(`--- `+ti(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+ti(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 ai(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;ri(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?ii(e,o.headerOptions):void 0)}}))}else{let s=ri(e,t,n,r,i,a,o);return s?ii(s,o?.headerOptions):void 0}}function oi(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 si({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 ci({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 li={forcePlainText:!1};function ui(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=li){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=tr({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)??fi();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)}Sr({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&&di({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}=pi({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 Dn(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else Dn(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function di({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Z(e),t=Z(t),e.length>s||t.length>s))return;let c=o===`char`?jr(e,t):Jr(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?(ci({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),ci({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?ci({item:e,arr:l,enableJoin:d,isLastItem:t}):ci({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(si({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(si({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function fi(){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 pi({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??V(e.name),d=s??V(t.name),{state:f,transformers:p}=Vn(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:G(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:G(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,rr(i.codeToHast(Z(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,rr(i.codeToHast(Z(t.contents),m)))}}var mi=(0,F.createContext)(void 0);function hi(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 gi(e,t){let n=e?.theme??L,r=t?.theme??L,i=_i(e),a=_i(t);return wn(n,r)&&hi(e,t,[`theme`,`parseDiffOptions`])&&hi(i,a)}function _i(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}var vi=new Set,yi=null;function bi(e){vi.add(e),yi??=requestAnimationFrame(Si)}function xi(e){vi.delete(e)&&vi.size===0&&yi!=null&&(cancelAnimationFrame(yi),yi=null)}function Si(e){let t=new Set(vi);vi.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}yi=vi.size>0?requestAnimationFrame(Si):null}function Ci(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function wi(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function Ti(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var Ei=`-1,-1`;function Di(e){return e?.some(e=>e.lineNumber===0)??!1}function Oi(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function ki(e){return e.startingLine===0&&e.totalLines>0}function Ai(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function ji(){return U({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[On({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Mi(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 Ni=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(),xi(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||Ci(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&&Mi(e.composedPath())||($i(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||($i(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if($i(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){$i(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();$i(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);$i(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Ri(i)&&this.hoveredLine?.lineElement===i.lineElement;Li(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Li(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Ri(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Bi(i)&&p!=null){p(i);break}if(zi(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Ri(i))break;Li(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,$i(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),$i(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),$i(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();Mi(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(Ai(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=ve(ji());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);Ii(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(Ui(t));if(Ii(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(Ii(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(Ii(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&&Mi(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Ui(e);if(t&&Mi(n))return;let r=Wi(e);return r==null?this.pathFromAnnotationSlot(e):Ui(r)}pathFromAnnotationSlot(e){let t=Gi(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Ui(t);let n=qi(Ki(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Ui(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Ji(t)?t:Ji(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)}Ci(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,bi(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=()=>{xi(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!Xi(this.renderedSelectedLinesState,n),i=!Xi(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);Vi(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=Qi(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=Qi(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:Hi(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Hi(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:Zi(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:Zi(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 Pi({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:Fi({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 Fi({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 Ii(e){return e!=null&&`kind`in e&&e.kind===`line`}function Li(e){return e!=null&&`kind`in e&&e.kind===`token`}function Ri(e){return Ii(e)||Li(e)}function zi(e){return`type`in e&&e.type===`line-info`}function Bi(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Vi(e){return e===`current`||e===`incoming`||e===`both`}function Hi(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ui(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Wi(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 Gi(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function Ki(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 qi(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 Ji(e){return e!=null&&typeof e.elementFromPoint==`function`}function Yi(e,t){return e===t||Ci(e??void 0,t??void 0)}function Xi(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Yi(e?.range??null,t.range)}function Zi(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Qi(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 $i(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var ea=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),ra(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`?oa(t):sa(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:ta(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:na(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&ia(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 ta(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function na(e){return Math.max(Math.ceil(e),0)}function ra(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?ia(e,{codeWidthChanged:!0,numberWidthChanged:!0}):aa(e))}function ia(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 aa(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 oa(e){e.codeElement.isConnected&&aa(e)}function sa(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 ca(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 la(e,t){return e.endsWith(`\r
15
+ `)?t+`\r
16
+ `:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
17
+ `)?t+`
18
+ `:t}function ua(e){return U({tagName:`div`,children:[U({tagName:`div`,children:e.annotations?.map(e=>U({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function da(e,t){return U({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function fa(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 pa({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 U({tagName:`div`,children:[t===`custom`?U({tagName:`slot`,properties:{name:ut}}):ma({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[ha(r)]],properties:i})}function ma({name:e,prevName:t,iconType:n}){let r=[U({tagName:`slot`,properties:{name:st}}),On({name:fa(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[H(t)]})],properties:{"data-prev-name":``}})),r.push(On({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[H(e)]})],properties:{"data-title":``}})),r.push(U({tagName:`slot`,properties:{name:ct}})),U({tagName:`div`,children:r,properties:{"data-header-content":``}})}function ha(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(U({tagName:`span`,children:[H(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(U({tagName:`span`,children:[H(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(U({tagName:`slot`,properties:{name:lt}})),U({tagName:`div`,children:t,properties:{"data-metadata":``}})}function ga(e){return U({tagName:`pre`,properties:_a(e)})}function _a({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 va(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:jt(t),preferredHighlighter:n}}function ya(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var ba=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
19
+ <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
20
+ <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"/>
21
+ </symbol>
22
+ <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
23
+ <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"/>
24
+ </symbol>
25
+ <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
26
+ <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"/>
27
+ </symbol>
28
+ <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
29
+ <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"/>
30
+ </symbol>
31
+ <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
32
+ <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"/>
33
+ </symbol>
34
+ <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
35
+ <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"/>
36
+ </symbol>
37
+ <symbol id="diffs-icon-expand" viewBox="0 0 16 16">
38
+ <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"/>
39
+ </symbol>
40
+ <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
41
+ <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"/>
42
+ </symbol>
43
+ <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
44
+ <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"/>
45
+ </symbol>
46
+ <symbol id="diffs-icon-plus" viewBox="0 0 16 16">
47
+ <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"/>
48
+ </symbol>
49
+ <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
50
+ <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"/>
51
+ </symbol>
52
+ <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
53
+ <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"/>
54
+ </symbol>
55
+ <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
56
+ <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"/>
57
+ </symbol>
58
+ <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
59
+ <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"/>
60
+ </symbol>
61
+ <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
62
+ <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"/>
63
+ </symbol>
64
+ <symbol id="diffs-icon-symbol-moved" 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.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"/>
66
+ </symbol>
67
+ <symbol id="diffs-icon-symbol-ref" 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.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"/>
69
+ </symbol>
70
+ </svg>`;function xa(e,t){return e==null||t==null?e===t:Ca(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 Sa={};function Ca(e=Sa,t=Sa){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 wa(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Ta(){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 Ea(){let e=document.createElement(`style`);return e.setAttribute(ft,``),e}var Da;function Oa(e){if(Da!=null)return Da;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(pt,`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),Da=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),Da}function ka(e){return`${mt}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var Aa=`@layer base {
71
+ :host {
72
+ --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
73
+ "Courier New", monospace;
74
+ --diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
75
+ "Noto Sans", "Liberation Sans", Arial, sans-serif;
76
+ --diffs-mixer: light-dark(#000, #fff);
77
+ --diffs-gap-fallback: 8px;
78
+ --diffs-scrollbar-gutter-fallback: 6px;
79
+ --diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
80
+ --diffs-added-light: #0dbe4e;
81
+ --diffs-added-dark: #5ecc71;
82
+ --diffs-modified-light: #009fff;
83
+ --diffs-modified-dark: #69b1ff;
84
+ --diffs-deleted-light: #ff2e3f;
85
+ --diffs-deleted-dark: #ff6762;
86
+ --diffs-warning-light: #d5a910;
87
+ --diffs-warning-dark: #ffd452;
88
+ color-scheme: light dark;
89
+ font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
90
+ font-size: var(--diffs-font-size, 13px);
91
+ line-height: var(--diffs-line-height, 20px);
92
+ font-feature-settings: var(--diffs-font-features);
93
+ --diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
94
+ --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))));
95
+ --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))));
96
+ --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))));
97
+ --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))));
98
+ --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
99
+ --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))));
100
+ --diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
101
+ --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)))));
102
+ --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)))));
103
+ --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)))));
104
+ --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))));
105
+ --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)));
106
+ --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))));
107
+ --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)));
108
+ --diffs-selection-base: var(--diffs-modified-base);
109
+ --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)));
110
+ background-color: var(--diffs-bg);
111
+ color: var(--diffs-fg);
112
+ display: block;
113
+ }
114
+
115
+ pre, code, [data-error-wrapper] {
116
+ isolation: isolate;
117
+ font-family: var(--diffs-font-family, var(--diffs-font-fallback));
118
+ outline: none;
119
+ margin: 0;
120
+ padding: 0;
121
+ display: block;
122
+ }
123
+
124
+ pre, code {
125
+ background-color: var(--diffs-bg);
126
+ }
127
+
128
+ code {
129
+ contain: content;
130
+ }
131
+
132
+ input, button {
133
+ font-family: inherit;
134
+ font-size: inherit;
135
+ line-height: inherit;
136
+ }
137
+
138
+ *, :before, :after {
139
+ box-sizing: border-box;
140
+ }
141
+
142
+ [data-icon-sprite] {
143
+ display: none;
144
+ }
145
+
146
+ [data-diffs-header], [data-separator] {
147
+ font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
148
+ }
149
+
150
+ [data-diffs-header][data-sticky] {
151
+ z-index: 1;
152
+ background-color: var(--diffs-bg);
153
+ position: sticky;
154
+ top: 0;
155
+ }
156
+
157
+ [data-file-info] {
158
+ color: var(--fg);
159
+ background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
160
+ border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
161
+ padding: 10px;
162
+ font-weight: 700;
163
+ }
164
+
165
+ [data-diff], [data-file] {
166
+ --diffs-grid-number-column-width: minmax(min-content, max-content);
167
+ --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
168
+
169
+ &[data-dehydrated] {
170
+ --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
171
+ }
172
+
173
+ &:hover [data-code]::-webkit-scrollbar-thumb {
174
+ background-color: var(--diffs-bg-context);
175
+ }
176
+ }
177
+
178
+ @supports (-webkit-touch-callout: none) {
179
+ :host {
180
+ --diffs-scrollbar-gutter-fallback: 0px;
181
+ }
182
+ }
183
+
184
+ [data-line] span, [data-edit-prediction-suffix] span {
185
+ color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
186
+ background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
187
+ font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
188
+ font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
189
+ text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
190
+ }
191
+
192
+ [data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
193
+ --diffs-computed-decoration-bg: var(--diffs-bg);
194
+ --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
195
+ --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
196
+ --diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
197
+ --diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
198
+ --diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
199
+ --diffs-line-bg: var(--diffs-computed-hovered-line-bg);
200
+ color: var(--diffs-fg);
201
+ background-color: var(--diffs-line-bg, var(--diffs-bg));
202
+ }
203
+
204
+ [data-line], [data-no-newline] {
205
+ &[data-decoration-bg] {
206
+ --mix-deco-light: 92%;
207
+ --mix-deco-dark: 85%;
208
+
209
+ &[data-decoration-bg-depth="2"] {
210
+ --mix-deco-light: 88%;
211
+ --mix-deco-dark: 80%;
212
+ }
213
+
214
+ &[data-decoration-bg-depth="3"] {
215
+ --mix-deco-light: 85%;
216
+ --mix-deco-dark: 78%;
217
+ }
218
+
219
+ --diffs-hover-mix-target: var(--diffs-decoration-bg);
220
+ --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
221
+ var(--diffs-bg) var(--mix-deco-light),
222
+ var(--diffs-decoration-bg)), color-mix(in lab,
223
+ var(--diffs-bg) var(--mix-deco-dark),
224
+ var(--diffs-decoration-bg)));
225
+ }
226
+ }
227
+
228
+ [data-line-annotation], [data-gutter-buffer="annotation"] {
229
+ --diffs-annotation-bg: var(--diffs-bg-context);
230
+ --diffs-computed-decoration-bg: var(--diffs-annotation-bg);
231
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
232
+ }
233
+
234
+ [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"] {
235
+ --diffs-computed-decoration-bg: var(--diffs-bg-context);
236
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
237
+ }
238
+
239
+ [data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
240
+ --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
241
+ var(--diffs-bg) 78%,
242
+ var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
243
+ var(--diffs-bg) 68%,
244
+ var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
245
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
246
+ }
247
+
248
+ [data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
249
+ --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
250
+ var(--diffs-bg) 78%,
251
+ var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
252
+ var(--diffs-bg) 68%,
253
+ var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
254
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
255
+ }
256
+
257
+ [data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
258
+ --diffs-computed-decoration-bg: var(--diffs-bg);
259
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
260
+ }
261
+
262
+ :where([data-background]) {
263
+ & [data-gutter-buffer], & [data-column-number] {
264
+ --mix-light: 91%;
265
+ --mix-dark: 85%;
266
+ }
267
+
268
+ & [data-line], & [data-no-newline] {
269
+ --mix-light: 88%;
270
+ --mix-dark: 80%;
271
+ }
272
+
273
+ & [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
274
+ --diffs-diff-line-mix-target: var(--diffs-bg);
275
+
276
+ &[data-line-type="change-deletion"] {
277
+ --diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
278
+ --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
279
+
280
+ &:where([data-gutter-buffer], [data-column-number]) {
281
+ color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
282
+ --diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
283
+ }
284
+
285
+ --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
286
+ var(--diffs-computed-decoration-bg) var(--mix-light),
287
+ var(--diffs-diff-line-mix-target)), color-mix(in lab,
288
+ var(--diffs-computed-decoration-bg) var(--mix-dark),
289
+ var(--diffs-diff-line-mix-target)));
290
+ }
291
+
292
+ &[data-line-type="change-addition"] {
293
+ --diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
294
+ --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
295
+
296
+ &:where([data-gutter-buffer], [data-column-number]) {
297
+ color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
298
+ --diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
299
+ }
300
+
301
+ --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
302
+ var(--diffs-computed-decoration-bg) var(--mix-light),
303
+ var(--diffs-diff-line-mix-target)), color-mix(in lab,
304
+ var(--diffs-computed-decoration-bg) var(--mix-dark),
305
+ var(--diffs-diff-line-mix-target)));
306
+ }
307
+
308
+ &[data-merge-conflict="current"] {
309
+ --diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
310
+ --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
311
+
312
+ &:where([data-gutter-buffer], [data-column-number]) {
313
+ color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
314
+ --diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
315
+ }
316
+
317
+ --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
318
+ var(--diffs-computed-decoration-bg) var(--mix-light),
319
+ var(--diffs-diff-line-mix-target)), color-mix(in lab,
320
+ var(--diffs-computed-decoration-bg) var(--mix-dark),
321
+ var(--diffs-diff-line-mix-target)));
322
+ }
323
+
324
+ &[data-merge-conflict="incoming"] {
325
+ --diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
326
+ --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
327
+
328
+ &:where([data-gutter-buffer], [data-column-number]) {
329
+ color: var(--diffs-modified-base);
330
+ --diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
331
+ }
332
+
333
+ --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
334
+ var(--diffs-computed-decoration-bg) var(--mix-light),
335
+ var(--diffs-diff-line-mix-target)), color-mix(in lab,
336
+ var(--diffs-computed-decoration-bg) var(--mix-dark),
337
+ var(--diffs-diff-line-mix-target)));
338
+ }
339
+ }
340
+ }
341
+
342
+ [data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
343
+ --diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
344
+ --diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
345
+
346
+ &:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
347
+ --mix-selection-light: 82%;
348
+ --mix-selection-dark: 75%;
349
+ --diffs-hover-mix-target: var(--diffs-selection-mix-target);
350
+ }
351
+
352
+ &:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
353
+ --mix-selection-light: 75%;
354
+ --mix-selection-dark: 60%;
355
+ --diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
356
+ --diffs-hover-mix-target: var(--diffs-selection-mix-target);
357
+ }
358
+
359
+ &:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
360
+ --diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
361
+ var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
362
+ var(--mix-selection-light),
363
+ var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
364
+ }
365
+
366
+ &:where([data-editor-overlay]), &[data-selected-line] {
367
+ --diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
368
+ var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
369
+ var(--diffs-selection-mix-target)), color-mix(in lab,
370
+ var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
371
+ var(--diffs-selection-mix-target)));
372
+ }
373
+ }
374
+
375
+ [data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
376
+ --diffs-computed-editor-active-line-bg: color-mix(in lab,
377
+ var(--diffs-computed-selected-line-bg)
378
+ var(--diffs-editor-active-line-source-mix, 100%),
379
+ var(--diffs-selection-emphasis-mix-target));
380
+ }
381
+
382
+ @media (pointer: fine) {
383
+ [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] {
384
+ --diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
385
+ var(--diffs-computed-editor-active-line-bg) 97%,
386
+ var(--diffs-hover-mix-target)), color-mix(in lab,
387
+ var(--diffs-computed-editor-active-line-bg) 91%,
388
+ var(--diffs-hover-mix-target)));
389
+ }
390
+ }
391
+
392
+ [data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
393
+ color: var(--diffs-selection-number-fg);
394
+ }
395
+
396
+ [data-no-newline] {
397
+ user-select: none;
398
+
399
+ & span {
400
+ opacity: .6;
401
+ }
402
+ }
403
+
404
+ [data-diff-type="split"][data-overflow="scroll"] {
405
+ grid-template-columns: 1fr 1fr;
406
+ display: grid;
407
+
408
+ & [data-additions] {
409
+ border-left: 1px solid var(--diffs-bg);
410
+ }
411
+
412
+ & [data-deletions] {
413
+ border-right: 1px solid var(--diffs-bg);
414
+ }
415
+ }
416
+
417
+ [data-code] {
418
+ grid-auto-flow: dense;
419
+ grid-template-columns: var(--diffs-code-grid);
420
+ overflow: var(--diffs-overflow-override, scroll) clip;
421
+ overscroll-behavior-x: none;
422
+ tab-size: var(--diffs-tab-size, 2);
423
+ padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
424
+ padding-bottom: max(0px,
425
+ calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
426
+ var(--diffs-scrollbar-gutter)));
427
+ scrollbar-gutter: stable;
428
+ align-self: flex-start;
429
+ display: grid;
430
+ }
431
+
432
+ [data-diffs-scrollbar-measure] {
433
+ opacity: 0;
434
+ pointer-events: none;
435
+ scrollbar-gutter: auto;
436
+ grid-template-columns: none;
437
+ width: 100px;
438
+ height: 100px;
439
+ padding: 0;
440
+ position: absolute;
441
+ top: -200px;
442
+ left: -200px;
443
+ }
444
+
445
+ [data-container-size] {
446
+ container-type: inline-size;
447
+ }
448
+
449
+ [data-code]::-webkit-scrollbar {
450
+ width: 0;
451
+ height: var(--diffs-scrollbar-gutter);
452
+ }
453
+
454
+ [data-code]::-webkit-scrollbar-track {
455
+ background: none;
456
+ }
457
+
458
+ [data-code]::-webkit-scrollbar-thumb {
459
+ background-color: #0000;
460
+ background-clip: content-box;
461
+ border: 1px solid #0000;
462
+ border-radius: 3px;
463
+ }
464
+
465
+ [data-code]::-webkit-scrollbar-corner {
466
+ background-color: #0000;
467
+ }
468
+
469
+ @supports ((-moz-appearance: none)) {
470
+ [data-code] {
471
+ scrollbar-width: thin;
472
+ scrollbar-color: var(--diffs-bg-context) transparent;
473
+ padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
474
+ }
475
+ }
476
+
477
+ [data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
478
+ & [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
479
+ padding-top: 0;
480
+ }
481
+ }
482
+
483
+ [data-gutter] {
484
+ grid-template-rows: subgrid;
485
+ grid-template-columns: subgrid;
486
+ z-index: 3;
487
+ background-color: var(--diffs-bg);
488
+ grid-column: 1;
489
+ display: grid;
490
+ position: relative;
491
+
492
+ & [data-gutter-buffer], & [data-column-number] {
493
+ border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
494
+ }
495
+ }
496
+
497
+ [data-content] {
498
+ grid-template-rows: subgrid;
499
+ grid-template-columns: subgrid;
500
+ background-color: var(--diffs-bg);
501
+ grid-column: 2;
502
+ min-width: 0;
503
+ display: grid;
504
+ }
505
+
506
+ [data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
507
+ grid-auto-flow: dense;
508
+ grid-template-columns: repeat(2, var(--diffs-code-grid));
509
+ padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
510
+ display: grid;
511
+
512
+ & [data-code] {
513
+ display: contents;
514
+ }
515
+
516
+ & [data-deletions] {
517
+ & [data-gutter] {
518
+ grid-column: 1;
519
+ }
520
+
521
+ & [data-content] {
522
+ border-right: 1px solid var(--diffs-bg);
523
+ grid-column: 2;
524
+ }
525
+ }
526
+
527
+ & [data-additions] {
528
+ & [data-gutter] {
529
+ border-left: 1px solid var(--diffs-bg);
530
+ grid-column: 3;
531
+ }
532
+
533
+ & [data-content] {
534
+ grid-column: 4;
535
+ }
536
+ }
537
+ }
538
+
539
+ [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
540
+ overflow: clip;
541
+ }
542
+
543
+ [data-overflow="scroll"] [data-gutter] {
544
+ position: sticky;
545
+ left: 0;
546
+ }
547
+
548
+ [data-interactive-lines] [data-line] {
549
+ cursor: pointer;
550
+ }
551
+
552
+ [data-interactive-line-numbers] [data-column-number] {
553
+ cursor: pointer;
554
+ touch-action: none;
555
+ }
556
+
557
+ [data-content-buffer], [data-gutter-buffer] {
558
+ user-select: none;
559
+ min-height: 1lh;
560
+ position: relative;
561
+ }
562
+
563
+ [data-gutter-buffer] {
564
+ padding-left: 2ch;
565
+ padding-right: 1ch;
566
+
567
+ &:before {
568
+ content: "";
569
+ min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
570
+ display: block;
571
+ }
572
+ }
573
+
574
+ [data-gutter-buffer="annotation"] {
575
+ --diffs-annotation-bg: var(--diffs-bg-context-gutter);
576
+ min-height: 0;
577
+ }
578
+
579
+ [data-gutter-buffer="buffer"] {
580
+ --diffs-line-bg: var(--diffs-bg-context-gutter);
581
+ }
582
+
583
+ [data-content-buffer] {
584
+ background-position: 5px 0;
585
+ background-size: 8px 8px;
586
+ background-origin: border-box;
587
+ background-image: repeating-linear-gradient(-45deg,
588
+ transparent,
589
+ transparent calc(3px * 1.414),
590
+ var(--diffs-bg-buffer) calc(3px * 1.414),
591
+ var(--diffs-bg-buffer) calc(4px * 1.414));
592
+ grid-column: 1;
593
+ }
594
+
595
+ [data-separator] {
596
+ box-sizing: content-box;
597
+ background-color: var(--diffs-bg);
598
+ }
599
+
600
+ [data-separator="simple"] {
601
+ min-height: 4px;
602
+ }
603
+
604
+ [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
605
+ background-color: var(--diffs-bg-separator);
606
+ }
607
+
608
+ [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
609
+ height: 32px;
610
+ position: relative;
611
+ }
612
+
613
+ [data-separator-wrapper] {
614
+ user-select: none;
615
+ fill: currentColor;
616
+ background-color: var(--diffs-bg);
617
+ align-items: center;
618
+ height: 100%;
619
+ display: flex;
620
+ position: absolute;
621
+ inset-inline: 0;
622
+ }
623
+
624
+ [data-content] [data-separator-wrapper] {
625
+ display: none;
626
+ }
627
+
628
+ [data-separator="metadata"] [data-separator-wrapper] {
629
+ background-color: var(--diffs-bg-separator);
630
+ height: 100%;
631
+ color: var(--diffs-fg-number);
632
+ white-space: nowrap;
633
+ text-overflow: ellipsis;
634
+ min-width: min-content;
635
+ padding-inline: 1ch;
636
+ inset-inline: 100% auto;
637
+ overflow: hidden;
638
+ }
639
+
640
+ [data-separator="line-info"] {
641
+ margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
642
+
643
+ & [data-separator-wrapper] {
644
+ min-width: 16px;
645
+ }
646
+ }
647
+
648
+ [data-separator="line-info-basic"], [data-separator="metadata"] {
649
+ margin-block: 0;
650
+ }
651
+
652
+ [data-separator="line-info"][data-separator-first] {
653
+ margin-top: 0;
654
+ }
655
+
656
+ [data-separator="line-info"][data-separator-last] {
657
+ margin-bottom: 0;
658
+ }
659
+
660
+ [data-expand-index] [data-separator-wrapper] {
661
+ grid-template-columns: 32px auto;
662
+ display: grid;
663
+ }
664
+
665
+ [data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
666
+ grid-template-columns: 32px 32px auto;
667
+ }
668
+
669
+ [data-expand-button], [data-separator-content] {
670
+ background-color: var(--diffs-bg-separator);
671
+ flex: none;
672
+ align-items: center;
673
+ display: flex;
674
+ }
675
+
676
+ [data-expand-index] [data-separator-content]:hover {
677
+ cursor: pointer;
678
+ text-decoration: underline;
679
+ }
680
+
681
+ [data-expand-button] {
682
+ cursor: pointer;
683
+ min-width: 32px;
684
+ color: var(--diffs-fg-number);
685
+ border-right: 2px solid var(--diffs-bg);
686
+ flex-shrink: 0;
687
+ justify-content: center;
688
+ align-self: stretch;
689
+
690
+ &:hover {
691
+ color: var(--diffs-fg);
692
+ }
693
+
694
+ &[data-expand-all-button] {
695
+ display: none;
696
+ }
697
+ }
698
+
699
+ [data-expand-down] [data-icon] {
700
+ transform: scaleY(-1);
701
+ }
702
+
703
+ [data-separator-content] {
704
+ height: 100%;
705
+ color: var(--diffs-fg-number);
706
+ flex: auto;
707
+ justify-content: flex-start;
708
+ padding: 0 1ch;
709
+ overflow: hidden;
710
+ }
711
+
712
+ [data-separator="line-info"], [data-separator="line-info-basic"] {
713
+ & [data-separator-content] {
714
+ user-select: none;
715
+ height: 100%;
716
+ overflow: clip;
717
+ }
718
+ }
719
+
720
+ [data-unmodified-lines] {
721
+ text-overflow: ellipsis;
722
+ white-space: nowrap;
723
+ flex: 0 auto;
724
+ min-width: 0;
725
+ display: block;
726
+ overflow: hidden;
727
+ }
728
+
729
+ @supports (width: 1cqi) {
730
+ [data-unified] {
731
+ & [data-separator="line-info"] [data-separator-wrapper] {
732
+ padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
733
+ width: 100cqi;
734
+
735
+ & [data-separator-content] {
736
+ border-radius: 6px;
737
+ }
738
+ }
739
+
740
+ & [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
741
+ border-top-left-radius: unset;
742
+ border-bottom-left-radius: unset;
743
+ }
744
+ }
745
+
746
+ [data-gutter] {
747
+ & [data-separator="line-info"] [data-separator-wrapper] {
748
+ padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
749
+ }
750
+
751
+ & [data-separator="line-info"] [data-separator-content] {
752
+ border-top-left-radius: 6px;
753
+ border-bottom-left-radius: 6px;
754
+ }
755
+
756
+ & [data-separator="line-info"][data-expand-index] [data-separator-content] {
757
+ border-top-left-radius: unset;
758
+ border-bottom-left-radius: unset;
759
+ }
760
+ }
761
+
762
+ [data-additions] {
763
+ & [data-content] [data-separator="line-info"] {
764
+ background-color: var(--diffs-bg);
765
+
766
+ & [data-separator-wrapper] {
767
+ display: none;
768
+ }
769
+ }
770
+
771
+ & [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
772
+ background-color: var(--diffs-bg-separator);
773
+ border-top-right-radius: 6px;
774
+ border-bottom-right-radius: 6px;
775
+ height: 100%;
776
+ display: block;
777
+
778
+ & [data-separator-content], & [data-expand-button] {
779
+ display: none;
780
+ }
781
+ }
782
+ }
783
+
784
+ [data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
785
+ width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
786
+ }
787
+
788
+ [data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
789
+ background-color: var(--diffs-bg-separator);
790
+ height: 100%;
791
+ margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
792
+ border-top-right-radius: 6px;
793
+ border-bottom-right-radius: 6px;
794
+ display: block;
795
+
796
+ & [data-separator-content], & [data-expand-button] {
797
+ display: none;
798
+ }
799
+ }
800
+
801
+ [data-separator="line-info"] [data-separator-wrapper] {
802
+ & [data-expand-both], & [data-expand-down], & [data-expand-up] {
803
+ border-top-left-radius: 6px;
804
+ border-bottom-left-radius: 6px;
805
+ }
806
+ }
807
+
808
+ @media (pointer: fine) {
809
+ [data-separator="line-info"] [data-separator-wrapper] {
810
+ &[data-separator-multi-button] {
811
+ & [data-expand-up] {
812
+ border-top-left-radius: 6px;
813
+ border-bottom-left-radius: unset;
814
+ }
815
+
816
+ & [data-expand-down] {
817
+ border-bottom-left-radius: 6px;
818
+ border-top-left-radius: unset;
819
+ }
820
+ }
821
+ }
822
+ }
823
+ }
824
+
825
+ @media (pointer: coarse) {
826
+ [data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
827
+ grid-template-columns: 34px 34px auto;
828
+
829
+ & [data-separator-content] {
830
+ grid-column: unset;
831
+ grid-row: unset;
832
+ }
833
+ }
834
+
835
+ @supports (width: 1cqi) {
836
+ [data-separator="line-info"] [data-separator-wrapper] {
837
+ & [data-expand-both], & [data-expand-down], & [data-expand-up] {
838
+ border-top-left-radius: 6px;
839
+ border-bottom-left-radius: 6px;
840
+ }
841
+
842
+ &[data-separator-multi-button] {
843
+ & [data-expand-up] {
844
+ border-top-left-radius: 6px;
845
+ border-bottom-left-radius: 6px;
846
+ }
847
+
848
+ & [data-expand-down] {
849
+ border-bottom-left-radius: unset;
850
+ border-top-left-radius: unset;
851
+ }
852
+ }
853
+ }
854
+ }
855
+ }
856
+
857
+ @media (pointer: fine) {
858
+ [data-separator-wrapper][data-separator-multi-button] {
859
+ grid-template-rows: 50% 50%;
860
+ display: grid;
861
+
862
+ & [data-separator-content] {
863
+ grid-area: 1 / 2 / -1;
864
+ min-width: min-content;
865
+ }
866
+
867
+ & [data-expand-button] {
868
+ grid-column: 1;
869
+ }
870
+ }
871
+
872
+ [data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
873
+ grid-template-columns: 34px auto;
874
+ }
875
+
876
+ [data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
877
+ grid-template-columns: 100% auto;
878
+ }
879
+
880
+ [data-separator="line-info"], [data-separator="line-info-basic"] {
881
+ & [data-separator-multi-button] {
882
+ & [data-expand-up] {
883
+ border-bottom: 1px solid var(--diffs-bg);
884
+ border-right: 2px solid var(--diffs-bg);
885
+ }
886
+
887
+ & [data-expand-down] {
888
+ border-top: 1px solid var(--diffs-bg);
889
+ border-right: 2px solid var(--diffs-bg);
890
+ }
891
+ }
892
+ }
893
+ }
894
+
895
+ [data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
896
+ display: none;
897
+ }
898
+
899
+ [data-line-annotation] {
900
+ min-height: var(--diffs-annotation-min-height, 0);
901
+ z-index: 2;
902
+ }
903
+
904
+ [data-merge-conflict-actions] {
905
+ z-index: 2;
906
+ }
907
+
908
+ [data-separator="custom"] {
909
+ grid-template-columns: subgrid;
910
+ display: grid;
911
+ }
912
+
913
+ [data-line], [data-column-number], [data-no-newline] {
914
+ padding-inline: 1ch;
915
+ position: relative;
916
+ }
917
+
918
+ [data-indicators="classic"] [data-line] {
919
+ padding-inline-start: 2ch;
920
+ }
921
+
922
+ [data-indicators="classic"] {
923
+ & [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
924
+ &[data-no-newline], &[data-line] {
925
+ &:before {
926
+ user-select: none;
927
+ width: 1ch;
928
+ height: 1lh;
929
+ display: inline-block;
930
+ position: absolute;
931
+ top: 0;
932
+ left: 0;
933
+ }
934
+ }
935
+ }
936
+
937
+ & [data-line-type="change-addition"] {
938
+ &[data-line], &[data-no-newline] {
939
+ &:before {
940
+ content: "+";
941
+ color: var(--diffs-addition-base);
942
+ }
943
+ }
944
+ }
945
+
946
+ & [data-line-type="change-deletion"] {
947
+ &[data-line], &[data-no-newline] {
948
+ &:before {
949
+ content: "-";
950
+ color: var(--diffs-deletion-base);
951
+ }
952
+ }
953
+ }
954
+ }
955
+
956
+ [data-indicators="bars"] {
957
+ & [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
958
+ &[data-column-number] {
959
+ &:before {
960
+ content: "";
961
+ user-select: none;
962
+ contain: strict;
963
+ width: 4px;
964
+ height: 100%;
965
+ display: block;
966
+ position: absolute;
967
+ top: 0;
968
+ left: 0;
969
+ }
970
+ }
971
+ }
972
+
973
+ & [data-line-type="change-deletion"] {
974
+ &[data-column-number] {
975
+ &:before {
976
+ background-image: linear-gradient(0deg,
977
+ var(--diffs-bg-deletion) 50%,
978
+ var(--diffs-deletion-base) 50%);
979
+ background-repeat: repeat;
980
+ background-size: 2px 2px;
981
+ background-size: calc(1lh / round(1lh / 2px))
982
+ calc(1lh / round(1lh / 2px));
983
+ }
984
+ }
985
+ }
986
+
987
+ & [data-line-type="change-addition"] {
988
+ &[data-column-number] {
989
+ &:before {
990
+ background-color: var(--diffs-addition-base);
991
+ }
992
+ }
993
+ }
994
+ }
995
+
996
+ [data-overflow="wrap"] {
997
+ & [data-line] {
998
+ white-space: pre-wrap;
999
+ word-break: break-word;
1000
+ }
1001
+
1002
+ & [data-annotation-content] {
1003
+ word-break: break-word;
1004
+ }
1005
+ }
1006
+
1007
+ [data-overflow="scroll"] [data-line] {
1008
+ white-space: pre;
1009
+ min-height: 1lh;
1010
+ }
1011
+
1012
+ [data-column-number] {
1013
+ box-sizing: content-box;
1014
+ text-align: right;
1015
+ user-select: none;
1016
+ color: var(--diffs-fg-number);
1017
+ padding-left: 2ch;
1018
+ }
1019
+
1020
+ [data-line-number-content] {
1021
+ min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
1022
+ z-index: 1;
1023
+ display: inline-block;
1024
+ position: relative;
1025
+ }
1026
+
1027
+ [data-disable-line-numbers] {
1028
+ & [data-gutter-buffer], & [data-column-number] {
1029
+ min-width: 4px;
1030
+ padding: 0;
1031
+
1032
+ &:before {
1033
+ min-width: 0;
1034
+ }
1035
+ }
1036
+
1037
+ & [data-line-number-content] {
1038
+ display: none;
1039
+ }
1040
+
1041
+ & [data-gutter-utility-slot] {
1042
+ right: unset;
1043
+ justify-content: flex-start;
1044
+ left: 0;
1045
+ }
1046
+
1047
+ &[data-indicators="bars"] [data-gutter-utility-slot] {
1048
+ left: 6px;
1049
+ }
1050
+ }
1051
+
1052
+ [data-file][data-disable-line-numbers] {
1053
+ & [data-gutter-buffer], & [data-column-number] {
1054
+ border-right: 0;
1055
+ min-width: 0;
1056
+ }
1057
+ }
1058
+
1059
+ [data-diff-span] {
1060
+ box-decoration-break: clone;
1061
+ border-radius: 3px;
1062
+ }
1063
+
1064
+ [data-line-type="change-addition"] [data-diff-span] {
1065
+ background-color: var(--diffs-bg-addition-emphasis);
1066
+ }
1067
+
1068
+ [data-line-type="change-deletion"] [data-diff-span] {
1069
+ background-color: var(--diffs-bg-deletion-emphasis);
1070
+ }
1071
+
1072
+ [data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
1073
+ color: var(--diffs-fg);
1074
+ padding-left: 1ch;
1075
+ }
1076
+
1077
+ [data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
1078
+ align-items: center;
1079
+ display: flex;
1080
+
1081
+ &:after {
1082
+ color: var(--diffs-fg-conflict-marker);
1083
+ font-size: .75rem;
1084
+ font-style: normal;
1085
+ line-height: 1.25rem;
1086
+ font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
1087
+ padding-left: 1ch;
1088
+ }
1089
+ }
1090
+
1091
+ [data-merge-conflict="marker-start"]:after {
1092
+ content: "(Current Change)";
1093
+ }
1094
+
1095
+ [data-merge-conflict="marker-end"]:after {
1096
+ content: "(Incoming Change)";
1097
+ }
1098
+
1099
+ [data-merge-conflict-actions-content] {
1100
+ min-height: 1.75rem;
1101
+ font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
1102
+ color: var(--diffs-fg);
1103
+ align-items: center;
1104
+ gap: .25rem;
1105
+ padding-inline: .5rem;
1106
+ font-size: .75rem;
1107
+ line-height: 1.2;
1108
+ display: flex;
1109
+ }
1110
+
1111
+ [data-merge-conflict-action] {
1112
+ appearance: none;
1113
+ color: var(--diffs-fg-number);
1114
+ font: inherit;
1115
+ cursor: pointer;
1116
+ background: none;
1117
+ border: 0;
1118
+ padding: 0;
1119
+ font-style: normal;
1120
+ }
1121
+
1122
+ [data-merge-conflict-action]:hover {
1123
+ color: var(--diffs-fg);
1124
+ }
1125
+
1126
+ [data-merge-conflict-action="current"]:hover {
1127
+ color: var(--diffs-addition-base);
1128
+ }
1129
+
1130
+ [data-merge-conflict-action="incoming"]:hover {
1131
+ color: var(--diffs-modified-base);
1132
+ }
1133
+
1134
+ [data-merge-conflict-action-separator] {
1135
+ color: var(--diffs-fg-number);
1136
+ opacity: .6;
1137
+ user-select: none;
1138
+ }
1139
+
1140
+ [data-diffs-header="default"] {
1141
+ background-color: var(--diffs-bg);
1142
+ justify-content: space-between;
1143
+ align-items: center;
1144
+ gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
1145
+ min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
1146
+ z-index: 2;
1147
+ flex-direction: row;
1148
+ padding-inline: 16px;
1149
+ display: flex;
1150
+ position: relative;
1151
+ top: 0;
1152
+ }
1153
+
1154
+ [data-header-content] {
1155
+ align-items: center;
1156
+ gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
1157
+ white-space: nowrap;
1158
+ flex-direction: row;
1159
+ min-width: 0;
1160
+ display: flex;
1161
+ }
1162
+
1163
+ [data-header-content] [data-prev-name], [data-header-content] [data-title] {
1164
+ text-overflow: ellipsis;
1165
+ white-space: nowrap;
1166
+ direction: rtl;
1167
+ min-width: 0;
1168
+ overflow: hidden;
1169
+ }
1170
+
1171
+ [data-prev-name] {
1172
+ opacity: .7;
1173
+ }
1174
+
1175
+ [data-rename-icon] {
1176
+ fill: currentColor;
1177
+ flex-grow: 0;
1178
+ flex-shrink: 0;
1179
+ }
1180
+
1181
+ [data-diffs-header="default"] [data-metadata] {
1182
+ white-space: nowrap;
1183
+ align-items: center;
1184
+ gap: 1ch;
1185
+ display: flex;
1186
+ }
1187
+
1188
+ [data-diffs-header="default"] [data-additions-count] {
1189
+ font-family: var(--diffs-font-family, var(--diffs-font-fallback));
1190
+ color: var(--diffs-addition-base);
1191
+ }
1192
+
1193
+ [data-diffs-header="default"] [data-deletions-count] {
1194
+ font-family: var(--diffs-font-family, var(--diffs-font-fallback));
1195
+ color: var(--diffs-deletion-base);
1196
+ }
1197
+
1198
+ [data-change-icon] {
1199
+ fill: currentColor;
1200
+ flex-shrink: 0;
1201
+ }
1202
+
1203
+ [data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
1204
+ color: var(--diffs-modified-base);
1205
+ }
1206
+
1207
+ [data-change-icon="new"] {
1208
+ color: var(--diffs-addition-base);
1209
+ }
1210
+
1211
+ [data-change-icon="deleted"] {
1212
+ color: var(--diffs-deletion-base);
1213
+ }
1214
+
1215
+ [data-change-icon="file"] {
1216
+ opacity: .6;
1217
+ }
1218
+
1219
+ [data-annotation-content] {
1220
+ z-index: 2;
1221
+ isolation: isolate;
1222
+ white-space: normal;
1223
+ align-self: flex-start;
1224
+ min-width: 0;
1225
+ display: flow-root;
1226
+ position: relative;
1227
+ }
1228
+
1229
+ [data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
1230
+ width: var(--diffs-column-content-width, auto);
1231
+ left: var(--diffs-column-number-width, 0);
1232
+ position: sticky;
1233
+ }
1234
+
1235
+ [data-annotation-slot] {
1236
+ text-wrap-mode: wrap;
1237
+ word-break: normal;
1238
+ white-space-collapse: collapse;
1239
+ }
1240
+
1241
+ [data-gutter-utility-slot] {
1242
+ touch-action: none;
1243
+ justify-content: flex-end;
1244
+ display: flex;
1245
+ position: absolute;
1246
+ top: 0;
1247
+ bottom: 0;
1248
+ right: 0;
1249
+ }
1250
+
1251
+ [data-utility-button] {
1252
+ appearance: none;
1253
+ cursor: pointer;
1254
+ width: 1lh;
1255
+ height: 1lh;
1256
+ font-size: var(--diffs-font-size, 13px);
1257
+ line-height: var(--diffs-line-height, 20px);
1258
+ background-color: var(--diffs-modified-base);
1259
+ color: var(--diffs-bg);
1260
+ fill: currentColor;
1261
+ z-index: 4;
1262
+ touch-action: none;
1263
+ border: none;
1264
+ border-radius: 4px;
1265
+ justify-content: center;
1266
+ align-items: center;
1267
+ margin-right: calc(-1lh + 1ch);
1268
+ padding: 0;
1269
+ display: flex;
1270
+ position: relative;
1271
+
1272
+ &:before {
1273
+ content: "";
1274
+ display: block;
1275
+ position: absolute;
1276
+ inset: 0 0 0 -4px;
1277
+ }
1278
+ }
1279
+
1280
+ [data-decoration-bar-stack] {
1281
+ pointer-events: none;
1282
+ isolation: isolate;
1283
+ z-index: 1;
1284
+ background-color: var(--diffs-decoration-bar-color, transparent);
1285
+ box-sizing: content-box;
1286
+ border-left: 2px solid var(--diffs-bg);
1287
+ border-right: 2px solid var(--diffs-bg);
1288
+ width: 6px;
1289
+ position: absolute;
1290
+ top: 0;
1291
+ bottom: 0;
1292
+ right: -2px;
1293
+
1294
+ [data-decoration-bar-depth="1"] & {
1295
+ background-color: color-mix(in lab,
1296
+ var(--diffs-bg) 20%,
1297
+ var(--diffs-decoration-bar-color, transparent));
1298
+ }
1299
+
1300
+ [data-decoration-bar-depth="2"] & {
1301
+ background-color: color-mix(in lab,
1302
+ var(--diffs-bg) 45%,
1303
+ var(--diffs-decoration-bar-color, transparent));
1304
+ }
1305
+
1306
+ [data-decoration-bar-depth="3"] & {
1307
+ background-color: color-mix(in lab,
1308
+ var(--diffs-bg) 65%,
1309
+ var(--diffs-decoration-bar-color, transparent));
1310
+ }
1311
+
1312
+ [data-decoration-bar-start] & {
1313
+ border-top-left-radius: 5px;
1314
+ border-top-right-radius: 5px;
1315
+ }
1316
+
1317
+ [data-decoration-bar-end] & {
1318
+ z-index: 3;
1319
+ border-bottom-right-radius: 5px;
1320
+ border-bottom-left-radius: 5px;
1321
+ }
1322
+ }
1323
+
1324
+ [data-placeholder] {
1325
+ contain: strict;
1326
+ }
1327
+
1328
+ [data-error-wrapper] {
1329
+ padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
1330
+ var(--diffs-gap-inline, var(--diffs-gap-fallback));
1331
+ scrollbar-width: none;
1332
+ max-height: 400px;
1333
+ overflow: auto;
1334
+
1335
+ & [data-error-message] {
1336
+ color: var(--diffs-deletion-base);
1337
+ font-size: 18px;
1338
+ font-weight: bold;
1339
+ }
1340
+
1341
+ & [data-error-stack] {
1342
+ color: var(--diffs-fg-number);
1343
+ }
1344
+ }
1345
+ }
1346
+
1347
+ @layer theme, rendered, unsafe;
1348
+ `,ja=`@layer base, theme, rendered, unsafe;`,Ma=RegExp(`${Ia(mt)}\\s*:\\s*[^;]+;`);function Na(e){return`${ja}
1349
+ @layer unsafe {
1350
+ ${e}
1351
+ }`}function Pa(e,t=`system`,n){return`${ja}
1352
+ @layer rendered {
1353
+ :host {${t===`system`?``:`
1354
+ color-scheme: ${t};`}
1355
+ ${ka(n)}
1356
+ ${e}
1357
+ }
1358
+ }`}function Fa(e,t){let n=ka(t);return e.replace(Ma,n)}function Ia(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var La=new WeakMap;function Ra(e){return La.get(e)??e}function za(e,t,n){let r=new Map;for(let i of e){let e=Ra(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function Ba(e,t,n){for(let r of t){let t=Ra(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function Va(e,t,n){if(e==null)return n(t);let r=Ra(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function Ha(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Ua({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 Wa(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 Ga({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Ka(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Ka(){let e=document.createElement(`style`);return e.setAttribute(dt,``),e}var qa=void 0;function Ja(){return qa??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Ya(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Xa(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(Aa)),t.adoptedStyleSheets=[e]}connectedCallback(){Oa(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(et,t)}async function Za(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Qa({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=sr(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=Y({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=br({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=$a(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?X({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=xr({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=xr({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=lr(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function $a(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 eo(e,t)}function eo(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 to({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 no(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function ro(e){return{...e,hunks:no(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}var io=1;function ao(e,...t){return`ck${io}:${JSON.stringify([e,...t])}`}function oo(e){return e===``?[]:e.split(nt)}function so(e,t,n){let r=e===`clone`?ro(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return co(r,uo(r,n),fo(r,n));case`rename-pure`:{let e=fo(r,n);po(r,n);let t=oo(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,ho(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function co(e,t,n){let r=oo(t.contents),i=oo(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=lo(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,ho(e,t,n),e}function lo(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(R(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=z(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=z(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function uo(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function fo(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function po(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function mo(e,t,n){return e.cacheKey==null?go(t,n):`${e.cacheKey}:hydrated`}function ho(e,t,n){let r=mo(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function go(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?ao(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var _o=new TextEncoder,vo=new TextDecoder(`utf-8`,{ignoreBOM:!0}),yo=/[\uD800-\uDFFF]/,bo=1024,xo=new Uint8Array(bo);function So(){xo.length!==bo&&(xo=new Uint8Array(bo))}function Q(e){if(e.length===0)return e;if(yo.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;xo.length<t&&(xo=new Uint8Array(t));let{written:n}=_o.encodeInto(e,xo);return vo.decode(xo.subarray(0,n))}var Co=4096,wo=.5;function To(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=Do(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}Eo(t,e)}}function Eo(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 Do(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)>Co)return null;let c=[];for(let t=0;t<n;t++)c.push(ko(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(ko(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+=Ao(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*wo: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 Oo=/\s+/g;function ko(e){return e.replace(Oo,``)}function Ao(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 jo(e,t){try{return Mo(e,t)}finally{So()}}function Mo(e,{cacheKey:t,isGitDiff:n=tt.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=Bo(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Po(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Lo(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?No(i.contents):[],deletionLines:!l&&r!=null&&i!=null?No(r.contents):[],cacheKey:Ho(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(at),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=Q(r.trim()),n!==r&&(c.prevName=Q(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?it:rt):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Q(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Q(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Q(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Q(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Q(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Q(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(ot)??[];t!=null&&(c.prevObjectId=Q(t)),n!=null&&(c.newObjectId=Q(n)),r!=null&&(c.mode=Q(r))}e.startsWith(`rename from `)&&(c.prevName=Q(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Q(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
1359
+ `||s[s.length-1]===`\r`||s[s.length-1]===`\r
1360
+ `||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:Ho(p.hunkContext),hunkSpecs:Q(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(!(Fo(t)&&!Io(t)))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=Uo(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Wo(t);(g==null||g.type!==`change`)&&(g=Go(`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=Wo(t);(g==null||g.type!==`change`)&&(g=Go(`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=Wo(t);(g==null||g.type!==`context`)&&(g=Go(`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]=Z(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Z(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=R(b.additionStart,b.additionCount)+(x===0?0:1),t=R(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(R(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=z(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=z(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),To(c),c}}function No(e){let t=Po(e);for(let e=0;e<t.length;e++)t[e]=Q(t[e]);return t}function Po(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1361
+ `,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 Fo(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Io(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1362
+ `&&n!==`\r`)return!1}return!0}function Lo(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Ro(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Ro(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Ro(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Ro(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=zo(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Ro(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 zo(e){return e.endsWith(`\r
1363
+ `)?e.slice(0,-2):e.endsWith(`
1364
+ `)?e.slice(0,-1):e}function Bo(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:Vo(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=Vo(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function Vo(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function Ho(e){return e==null?e:Q(e)}function Uo(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Wo(e){let t=e.slice(1);return Q(t===``?`
1365
+ `:t)}function Go(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 Ko=`/dev/null`;function qo(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Jo(),a=t??Jo(),o=jo(ai(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?ao(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Jo(){return{name:Ko,contents:``}}var Yo=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 Xo(e,t){let n=qo({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 Zo(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 Qo(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function $o(e,t){return t.length>0&&t.length<e.deletionLines.length&&Qo(t)}function es(e,t,n){let r=e.deletionLines.join(``),i=Zo(t.length,r),a=qo({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 ts(e,t){return es(e,[``],t)}function ns(e,t){if(e.additionLines.length===0)return ts(e,t);if($o(e,e.additionLines))return es(e,e.additionLines,t);let n=e.additionLines,r=Xo(e,t);return is(r,n),r}function rs(e){return e.length>1&&e.at(-1)===``}function is(e,t){if(!rs(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&&z(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,ms(e);return}}}function as(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return os(e,Xo(e,n));let r=Array.from(t);if(r.length===0)return os(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||Z(r)===Z(i))return os(e,Xo(e,n))}let i=ss(e,r);if(i.size===0)return os(e,Xo(e,n));for(let t of i)if(!ls(e,t,n))return os(e,Xo(e,n));return ms(e),fr(e)?os(e,Xo(e,n)):os(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function os(e,t){return Object.assign(e,t),t}function ss(e,t){let n=new Set;for(let r of t){let t=cs(e,r);if(t==null)return new Set;n.add(t)}return n}function cs(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 ls(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=qo({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:(ds(r,s),us(e,t),!0)}function us(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(`
1366
+ `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
1367
+ `)}function ds(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>fs(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,ps(e)}function fs(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function ps(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 ms(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(R(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,ps(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=z(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-z(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var hs=new WeakMap;function gs(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function _s(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 vs(e,t){let n=e.hunks,r=e.additionLines,i=gs(r),a=i===r?e:{...e,additionLines:i},o=Os(n,Ds(a,t),e.deletionLines.length),s=js(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Vs(e),is(e,r),Ps(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function ys(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<Ls(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Ls(r);if(i==null||t<i||o!=null&&o!==s)return vs(e,n);o=s}if(o!=null){if(bs(e,i,o,r,n)){e.editSessionDirty=!0;return}return vs(e,n)}}function bs(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=xs(e),o=e.hunks[n];if(o.hunkContent.some(Ss))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 xs(e){let t=hs.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return hs.set(e,{lines:e.deletionLines,set:n}),n}function Ss(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Cs(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 ws(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=Y({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Rs(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=X({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=Rs(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Ts(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=Rs(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,Rs(i)+i.deletionCount,e.deletionLines.length),n}function Es(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Xo(e,t):ns(e,t)),!0)}function Ds(e,t){if(_s(e.deletionLines,e.additionLines)==null)return[];let n=qo({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=fs(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 Os(e,t,n){let r=e.map((e,t)=>{let n=Rs(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&&ks(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=As(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 ks(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function As(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 js(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`);Ns(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`);Ns(s,c,i,r),r+=c,i+=c,n.push(Ms(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 Ms(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:zs(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Bs(t.additionStart,r),deletionStart:zs(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Bs(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${zs(t.deletionStart,i)},${i} +${zs(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return ps(s),s}function Ns(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Ps(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(Rs(r)!==Rs(i)||r.deletionCount!==i.deletionCount||Ls(r)!==Ls(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Fs(r,i))return!0}return!1}function Fs(e,t){let n=Is(e),r=Is(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*Is(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 Ls(e){return R(e.additionStart,e.additionCount)}function Rs(e){return R(e.deletionStart,e.deletionCount)}function zs(e,t){return t===0?e:e+1}function Bs(e,t){return t===0?e-1:e}function Vs(e){ms(e);for(let t=0;t<e.hunks.length;t++)us(e,t)}function Hs(e){return U({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Us(e){return U({tagName:`div`,children:[U({tagName:`span`,children:[H(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Ws(e){return U({tagName:`div`,children:[On({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 Gs({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(U({tagName:`div`,children:[H(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Ws(`up`)),s++),o||(e.push(Ws(`down`)),s++)):(e.push(Ws(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(U({tagName:`div`,children:[U({tagName:`span`,children:[H(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(U({tagName:`div`,children:[H(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(U({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(U({tagName:`slot`,properties:{name:i}})),U({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 Ks(e,t){return`hunk-separator-${e}-${t}`}function qs(e){let t=e.at(-1);return t==null?0:Math.max(z(t.additionStart,t.additionCount),z(t.deletionStart,t.deletionCount))}var Js=-1,Ys=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Js}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:L},t=bt,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=Yt(e.theme??L)?Sn():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,!e.isPartial&&e.additionLines.length===0){Object.assign(e,ts(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&q(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!J(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!q(t.diff,e)||ar(e)||sc(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!q(n,e)||!q(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);J(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??_t}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=Z(u);s==null&&i&&(a.additionLines[t]=la(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,ts(a,this.options.parseDiffOptions)),u=!0;else if($o(a,a.additionLines))this.applyRecomputePreservingSessionType(a,es(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=ys(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,as(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Cs(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=oc(e),i.code.additionLines=ic(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,ts(r,this.options.parseDiffOptions)),i.code.additionLines[0]=ac(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,ns(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if($o(e,n)){this.applyRecomputePreservingSessionType(e,es(e,n,t));return}this.applyExpansionRemap(vs(e,t))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>ua(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=L,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=ht,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 xn(va(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=sc(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!J(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!ar(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??V(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??L}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||!q(e,n.diff)||!J(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(q(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||ar(e)||sc(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||q(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&Yt(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&Yt(t.theme)}renderDiff(e=this.diff,t=vt){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||ar(e)||sc(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!q(e,this.renderCache.diff),d=!ca(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&ya(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,ya(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??V(e.name),this.highlighter??=Sn();let t=this.highlighter!=null&&Yt(i.theme),n=this.highlighter!=null&&At(this.computedLang),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=vt){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return ga({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=sc(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??V(e.name);let n=this.highlighter!=null&&Yt(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&At(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=ui(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(Sr({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]=ac(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i==null||a==null||!q(i,e)||!J(n,this.getRenderOptions(i).options)||(a.result==null||!a.highlighted||!J(a.options,n)||!q(a.diff,i))&&(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.())}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!J(t,n.options)))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&q(n.diff,e)&&J(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&q(e,n.diff)&&J(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=cc(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:An(),deletionsGutterAST:An(),additionsGutterAST:An(),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=pr({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`,W(void 0,`buffer`,this.size)),h?.push(Hs(this.size))):(x.pushToGutter(`deletions`,W(void 0,`buffer`,this.size)),g?.push(Hs(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,jn(t,n,r,i))};function T(e){C.flush(),a===`unified`?tc(`unified`,e,x):(tc(`deletions`,e,x),tc(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Sr({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&&Qs(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=nc(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=nc(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),ec({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&&Qs(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&$s(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=nc(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=nc(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)}ec({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&$s(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(Us(e)),x.pushToGutter(`unified`,W(e,`metadata`,1))):(x.deletionsContentAST.push(Us(e)),x.pushToGutter(`deletions`,W(e,`metadata`,1)),k||(x.pushToGutter(`additions`,W(void 0,`buffer`,1)),x.additionsContentAST.push(Hs(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(Us(e)),x.pushToGutter(`unified`,W(e,`metadata`,1))):(x.additionsContentAST.push(Us(e)),x.pushToGutter(`additions`,W(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,W(void 0,`buffer`,1)),x.deletionsContentAST.push(Hs(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(qs(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{fileDiff:e,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(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=An(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,da(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(U({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(U({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(U({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return ve(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ve(t==null?e:U({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(!ki(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(Oi(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(Oi(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){ec({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}ec({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return pa({fileOrDiff:e,mode:t,stickyHeader:n})}},Xs=new Intl.PluralRules(`en-US`);function Zs(e){return`${e} unmodified line${Xs.select(e)===`one`?``:`s`}`}function Qs(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function $s(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 ec({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`,W(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`,W(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`,W(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function tc(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,Gs({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Gs({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Gs({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Gs({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Ks(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Zs(n):`More unchanged context may be available`;c.pushToGutter(e,Gs({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Gs({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 nc(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function rc(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function ic(e,t,n,r){let i=rc(e),a=rc(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=ac(e,r.getLineText(e));return l}function ac(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 oc(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function sc(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function cc(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function lc(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function uc(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 dc(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:Ha(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 fc(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function pc(e){let t={...e};return delete t.cacheKey,t}function mc(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??V(e.name),r=t.lang??V(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function hc(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function gc(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&hc(n.lines,t.deletionLines)}var _c=-1,vc=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++_c}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:L},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new ea,this.scrollSyncManager=new Yo,this.interactionManager=new Ni(`diff`,Pi(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??L}getHunksRendererOptions(e){return dc(e)}createHunksRenderer(e){return new Ys(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=R(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Pi(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&&!wn(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Va(this.editSession?.annotations,e,bt);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Ba(t,e,bt))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;xi(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=to(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||Cc(this.pre,xc({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||wc(this.headerElement,Sc({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ya(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?qo(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!fc(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(so(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await Za(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.editSession?.outgoingDiff==null?t==null||this.editSession!=null?!1:(this.installEditSession(e,t.__getDocumentContents(yc(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(q(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(yc(e)),this.editor.__getDocumentSessionState())):(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=za(t,bt,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:oo(t.contents),a=n!=null&&gc(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=pc(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,ms(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??za(this.lineAnnotations,bt),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=to(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!bc(u,this.deletionFile)||!bc(d,this.additionFile)),y=e!=null&&!q(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&ca(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=qo(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Es(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,yt);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!q(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?mc(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??V(i.name),c=Sn({theme:o,lang:s});c==null?xn({themes:jt(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||ya(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Sr({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&mc(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?no(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(yc(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=ro(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=ws(e,this.hunksRenderer.getExpandedHunksMap(),t);return Es(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Ts(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return mr({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return hr({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=dr(o);if(e<s){let c=Y({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=X({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]=dr(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(){bi(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||ar(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!uc(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!lc(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:wa(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Ta();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:wi(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):wi(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=ba;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&q(r,n)?i:void 0)??ve(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,ut,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,st,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,ct,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,lt,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Ea(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Na(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Oa(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=Ga({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Pa(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=Fa(this.themeCSSStyle.textContent??``,Oa(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Ja()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Wa(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=Tc(t[0]),a=Tc(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=ve(i),r.content.innerHTML=ve(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=Ua({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=Ua({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=Ua({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=Tc(r?.[0]),a=Tc(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=Tc(r?.[0]),a=Tc(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=ve(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Wa(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Tc(t[0]),i=Tc(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};xa(u,this.appliedPreAttributes)||(Xa(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 yc(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function bc(e,t){return e==null||t==null?e==null&&t==null:ir(e,t)}function xc({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Sc({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Cc(e,t,n=!1){return!n&&e==null&&t}function wc(e,t,n=!1){return e==null&&t&&!n}function Tc(e){if(e!=null&&e.type===`element`)return e.children??[]}var Ec=3e3,Dc=new Map,Oc=-1,kc=class extends vc{__id=`little-virtualized-file-diff:${++Oc}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Dc,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=or(n)}setMetrics(e,t=!1){let n=or(e);!t&&hi(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache({includeEstimatedHeights:!1}),!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return Di(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!gi(t,e),r=n&&Lc(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Rc(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=Dc,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.getRenderedDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??Dc);let a=this.getLatestAnnotations();if(t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&ki(this.renderRange)){let t=Ac(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=Hc(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.startHydratedEditSession(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=or(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=sr(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return Sr({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=br({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=xr({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??sr(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Sr({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=br({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=xr({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!q(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=so(`clone`,e,t);if(await Za(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(so(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await Za(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return mr({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!q(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??Dc);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=sr(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=Qa({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:zc(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=to(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Vc(s,this.deletionFile)||!Vc(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=qo(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!q(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:!1}:this.updatePendingRender(u,r);if((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),f)this.top??=this.getVirtualizedTop(),g&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.pendingRender=void 0,this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(this.getRenderedDiff()!==this.pendingRender?.diff)throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!q(a,o),renderedDiffChanged:!q(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Bc(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=zc(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=jc(this.cache.heightDeltas),u=sr(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=Pc(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Fc(i,e)*this.metrics.lineHeight+Mc(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Ec}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Mc(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=Y({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?br({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?X({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?xr({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:Ic({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}=Y({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=X({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=zc(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=sr(this.metrics,i),h=e.hunks.length>0?lr(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,N;if(Sr({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?br({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),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=xr({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 ee=Math.round(M-w/2),te=Math.max(0,Math.ceil(p/s)-w),ne=Math.max(0,Math.min(ee,te)),re=ne*s,ie=ee<0?C+ee*s:C,ae=E[ne]??0,oe=re===0?0:g+ae,se=ne+ie/s,ce=se<E.length?v-E[se]:v-(k-t-_);return{startingLine:re,totalLines:ie,bufferBefore:oe,bufferAfter:Math.max(0,ce)}}};function Ac(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===Ei&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function jc(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 Mc({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Nc(e,n);return(t[Nc(e,r)]??0)-(t[i]??0)}function Nc(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 Pc(e){return Math.ceil(e/Ec)*Ec}function Fc(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Ic({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 Lc(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 Rc(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 zc(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Bc(e){return typeof e==`function`?`custom`:e??`line-info`}function Vc(e,t){return e==null||t==null?e==null&&t==null:ir(e,t)}function Hc(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Uc(e,t){return typeof window>`u`&&t!=null?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,I.jsx)(I.Fragment,{children:e})}var Wc=(0,F.createContext)(void 0);function Gc(){return(0,F.useContext)(Wc)}var Kc=typeof window>`u`?F.useEffect:F.useLayoutEffect;function qc({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=Gc(),_=s!==void 0,v=(0,F.useContext)(mi),y=Xe(),b=Je(e=>m?.(e)),x=m==null?void 0:b,S=(0,F.useRef)(null),C=Je(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(S.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),w=h==null?void 0:C,T=(0,F.useMemo)(()=>{if(e!=null)return e;let{current:i}=S,a=i?.filePair;if(i!=null&&a!=null){if(Jc(t,n,a.stale)||Jc(t,n,a.installed))return a.fileDiff;i.filePair=null}return qo(t??null,n??null,r?.parseDiffOptions)},[e,t,n,r?.parseDiffOptions]),E=(0,F.useRef)(null),D=(0,F.useRef)(null),O=Je(()=>{if(y==null)throw Error(`FileDiff: EditContext is not attached`);return y(`file-diff`,i??{},a)}),k=Je(e=>{if(e!=null){if(E.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?E.current=new vc(Xc({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),f?void 0:v,!0):E.current=new kc(Xc({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),g,l,f?void 0:v,!0),p&&D.current==null&&(D.current=Zc(E.current,O)),E.current.hydrate({fileDiff:T,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(E.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);E.current.cleanUp(),E.current=null,D.current=null}});return Kc(()=>{let{current:e}=E;if(e==null)return;let t=Xc({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),n=t!==void 0&&!gi(e.options,t);if(e.setOptions(t),!p&&D.current!=null){let{current:e}=D;D.current=null,e()}let i=Yc(T,o,S);e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),p&&D.current==null&&(D.current=Zc(e,O))}),{fileDiff:T,ref:k,getHoveredLine:(0,F.useCallback)(()=>E.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,F.useCallback)(e=>E.current?.getAnnotationSlotName(e)??bt(e),[])}}function Jc(e,t,n){return Ti(e??void 0,n.oldFile??void 0)&&Ti(t??void 0,n.newFile??void 0)}function Yc(e,t,n){let{current:r}=n;if(r==null)return{fileDiff:e,lineAnnotations:t};let{fileDiff:i,annotations:a}=r,o=e;i!=null&&(q(e,i.stale)?o=i.installed:r.fileDiff=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null),{fileDiff:o,lineAnnotations:s}}function Xc({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return t||r||n||i!=null||a!=null?{...e,controlledSelection:t,renderCustomHeader:n?$e:e?.renderCustomHeader,renderGutterUtility:r?$e:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function Zc(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function Qc({oldFile:e,newFile:t,options:n,editorOptions:r,editStateKey:i,metrics:a,lineAnnotations:o,selectedLines:s,className:c,style:l,prerenderedHTML:u,renderAnnotation:d,renderCustomHeader:f,renderHeaderPrefix:p,renderHeaderFilenameSuffix:m,renderHeaderMetadata:h,renderGutterUtility:g,disableWorkerPool:_=!1,edit:v=!1,onEditChange:y,onEditComplete:b}){let{fileDiff:x,ref:S,getHoveredLine:C,getAnnotationSlotName:w}=qc({oldFile:e,newFile:t,options:n,editorOptions:r,editStateKey:i,metrics:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:u,hasGutterRenderUtility:g!=null,hasCustomHeader:f!=null,disableWorkerPool:_,edit:v,onEditChange:y,onEditComplete:b});return(0,I.jsx)(et,{ref:S,className:c,style:l,children:Uc(wt({fileDiff:x,renderCustomHeader:f,renderHeaderPrefix:p,renderHeaderFilenameSuffix:m,renderHeaderMetadata:h,renderAnnotation:d,lineAnnotations:o,renderGutterUtility:g,getHoveredLine:C,getAnnotationSlotName:w}),u)})}function $c({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,I.jsx)(`svg`,{viewBox:`0 0 32 32`,className:r,children:(0,I.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,I.jsxs)(`svg`,{viewBox:`0 0 32 32`,className:r,children:[(0,I.jsx)(`rect`,{x:`2`,y:`2`,width:`28`,height:`28`,rx:`1.312`,fill:`#f5de19`}),(0,I.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,I.jsxs)(`svg`,{viewBox:`0 0 32 32`,className:r,children:[(0,I.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,I.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 el({step:e,state:t,onComplete:n,input:r,output:i,isCollapsible:a=!1,approval:o,onFilePathClick:s}){te(t===`animating`,e.duration,n);let c=t===`animating`,l=e.filePath?.split(`/`).pop()??e.toolDetail,u=!!l,d=e.toolName===`Write`,[f,p]=F.useState(`light`),[m,h]=F.useState(!a);F.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()}},[]),F.useEffect(()=>{h(!a)},[a]);let g=F.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(`
1368
+ `),u=e.diffLines?.filter(e=>e.type!==`remove`).map(e=>e.content).join(`
1369
+ `),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]),_=F.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=F.useMemo(()=>f===`dark`?`
1370
+ [data-diff],
1371
+ [data-file],
1372
+ [data-diffs-header],
1373
+ [data-error-wrapper],
1374
+ [data-virtualizer-buffer] {
1375
+ --diffs-bg: #000;
1376
+ --diffs-bg-buffer-override: #000;
1377
+ --diffs-bg-context-override: #000;
1378
+ --diffs-bg-hover-override: #0a0a0a;
1379
+ --diffs-bg-separator-override: #0f0f0f;
1380
+ }
1381
+ `: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,I.jsxs)(`div`,{className:`an-edit-tool-card overflow-hidden rounded-chat-tool border border-border bg-muted dark:bg-black`,children:[(0,I.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,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[u&&(0,I.jsx)($c,{filename:l,className:`h-3 w-3 shrink-0`}),c&&!g?(0,I.jsx)(ie,{as:`span`,duration:1.2,className:`text-xs`,children:`Generating...`}):c?(0,I.jsxs)(ie,{as:`span`,duration:1.2,className:`text-xs`,children:[d?`Creating`:`Editing`,` `,l]}):(0,I.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[d?`Created`:`Edited`,` `,e.filePath&&s?(0,I.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,I.jsx)(`span`,{className:`inline-flex gap-2 font-mono text-caption text-muted-foreground`,children:e.diffStats.split(` `).map(e=>(0,I.jsx)(`span`,{className:e.startsWith(`+`)?`text-product-diff-added`:e.startsWith(`-`)?`text-product-diff-removed`:void 0,children:e},e))})]}),g?(0,I.jsx)(`div`,{className:`${y} text-label`,style:_,children:(0,I.jsxs)(`div`,{className:a?`group/edit-diff relative`:`relative`,children:[(0,I.jsx)(`div`,{className:a&&!m?`max-h-[260px] overflow-hidden`:void 0,children:(0,I.jsx)(Qc,{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,I.jsx)(I.Fragment,{children:(0,I.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,I.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,I.jsx)(ne,{isPending:c,...o})]})}var tl=(0,F.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}=re(e,i);return(0,I.jsx)(el,{step:a,state:o,onComplete:()=>{},input:e.input??e.args,output:e.output??e.result,isCollapsible:t,approval:r,onFilePathClick:n})});function nl({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,I.jsxs)(`div`,{className:i(`flex max-w-full items-center gap-1 rounded-chat-tool select-none`,h?`cursor-pointer`:`cursor-default`),children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm text-muted-foreground`,children:[e&&(0,I.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:e}),(0,I.jsx)(`span`,{className:`shrink-0 font-[450] whitespace-nowrap`,children:r&&t?(0,I.jsx)(ie,{as:`span`,duration:1.2,className:`m-0 inline-flex h-4 items-center leading-none`,children:t}):n}),a&&(o?(0,I.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,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-normal text-muted-foreground/60`,children:a})),s]}),c&&(p||m||r)&&(0,I.jsx)(`div`,{children:(0,I.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,I.jsxs)(De,{className:`flex w-full flex-col gap-2`,...l===void 0?{defaultOpen:u}:{open:l,onOpenChange:d},children:[(0,I.jsx)(Ee,{className:`group flex`,disabled:!h,"aria-disabled":!h,children:g}),(0,I.jsx)(Te,{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,I.jsx)(`div`,{className:`flex flex-col gap-1`,children:g})}var rl=(0,F.memo)(function({icon:e,title:t,subtitle:n,isPending:r,onSubtitleClick:i}){let a=e;return(0,I.jsx)(nl,{icon:a?(0,I.jsx)(a,{className:`h-full w-full shrink-0 text-muted-foreground`}):void 0,shimmerLabel:t,completeLabel:t,isAnimating:r,detail:n,onDetailClick:i})}),il=new Map;function al(e){return{state:e.state,inputJson:JSON.stringify(e.input||{}),outputJson:JSON.stringify(e.output||{})}}function ol(e,t){let n=il.get(e),r=al(t);if(!n)return il.set(e,r),!0;let i=n.state!==r.state||n.inputJson!==r.inputJson||n.outputJson!==r.outputJson;return i&&il.set(e,r),i}function sl(e,t){if(e.toolCallId!==t.toolCallId||e.type!==t.type)return!1;let n=t.toolCallId;return n?!ol(n,t):e.state===t.state}function cl(e){return e.output!==void 0&&e.output!==null||e.state===`error`||e.state===`result`}function ll(e,t){return sl(e.part,t.part)?cl(t.part)?!0:e.chatStatus===t.chatStatus:!1}function ul(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 dl(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 fl=[`query`,`question`,`email`,`name`,`id`,`customer`,`url`,`issue`,`body`,`summary`,`title`],pl={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`},ml={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 hl(e){let t=e.displayName.split(` `),n=t[0],r=t.slice(1).join(` `),i=pl[n];return i?r?`${i} ${r}`:i:e.displayName}function gl(e){let t=e.displayName.split(` `),n=t[0],r=t.slice(1).join(` `),i=ml[n];return i?r?`${i} ${r}`:i:e.displayName}function _l(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=fl.indexOf(e),r=fl.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 vl(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 yl(e){let t=vl(e);if(typeof t==`string`)return t.length>3e3?t.slice(0,3e3)+`
1382
+ ...`:t;let n=JSON.stringify(t,null,2);return n.length>3e3?n.slice(0,3e3)+`
1383
+ ...`:n}var bl=(0,F.memo)(function({part:e,mcpInfo:t,chatStatus:n,defaultOpen:r}){let{isPending:i,isInterrupted:a}=dl(e,n),o=(0,F.useMemo)(()=>e.state===`input-streaming`?`Preparing ${t.displayName}`:i?hl(t):gl(t),[e.state,i,t]),s=(0,F.useMemo)(()=>e.state===`input-streaming`?``:_l(e.input),[e.input,e.state]),c=(0,F.useMemo)(()=>e.output?yl(e.output):null,[e.output]),l=(0,F.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,I.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[t.displayName,` interrupted`]}):(0,I.jsx)(`div`,{className:`an-tool-mcp`,children:(0,I.jsx)(nl,{shimmerLabel:o,completeLabel:o,isAnimating:i,detail:s||void 0,trailingContent:void 0,expandable:u,defaultOpen:r,children:l&&(0,I.jsx)(Ce,{className:`text-label`,codeControls:!1,content:l})})})},ll);function xl({className:e,...t}){return(0,I.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,I.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`,opacity:.2}),(0,I.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`})]})}function Sl(e){let t=e.id?.trim();return t?t.endsWith(`.md`)?t:`plan-${t}.md`:`plan-working.md`}var Cl=(0,F.memo)(function({part:e,chatStatus:t}){let{isPending:n}=dl(e,t),r=e.input?.plan,[a,o]=(0,F.useState)(!1),[s,c]=(0,F.useState)(!1),[l,u]=(0,F.useState)(null),[d,f]=(0,F.useState)(!1),[p,m]=(0,F.useState)(``);if(!r)return null;let h=Sl(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,I.jsxs)(`div`,{className:`an-tool-plan overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center justify-between pr-2.5 pl-3`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[n?(0,I.jsx)(xl,{className:`h-3 w-3 shrink-0 animate-spin text-muted-foreground`}):(0,I.jsx)(k,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:h})]}),(0,I.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,I.jsx)(Pe,{className:`h-3.5 w-3.5`}):(0,I.jsx)(Me,{className:`h-3.5 w-3.5`})})]}),(0,I.jsxs)(`div`,{className:`border-t border-border bg-background pt-2`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3`,children:[(0,I.jsx)(`div`,{className:`text-sm text-foreground`,children:r.title}),w?(0,I.jsx)(`div`,{className:`rounded-full border border-border px-2 py-0.5 text-caption text-muted-foreground`,children:w}):null]}),_?(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(`div`,{className:i(`px-3`,`text-sm text-muted-foreground`,!a&&`max-h-[94px] overflow-hidden`),children:(0,I.jsx)(Ce,{content:g,className:`text-sm`})}),!a&&(0,I.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 h-16 pr-2 pb-2 pl-3.5`,children:[(0,I.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,I.jsx)(`div`,{className:`relative flex h-full items-end justify-between`,children:(0,I.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,I.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No plan summary provided.`})]}),(a||!_)&&(0,I.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,I.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,I.jsx)(`div`,{className:`text-caption text-muted-foreground`,children:`Choose what to do with this plan.`}):S?(0,I.jsx)(`div`,{className:`text-caption text-muted-foreground`,children:`Approved`}):null]}),x?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border bg-muted px-3 py-2.5`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.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,I.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,I.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,I.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,I.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,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.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,I.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]})]})},ll);function wl({step:e,animating:t,onStepComplete:n}){return te(t,e.duration,()=>n(e.id)),null}function Tl({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;return(0,I.jsxs)(I.Fragment,{children:[e.map(e=>(0,I.jsx)(wl,{step:e,animating:t[e.id]===`animating`,onStepComplete:n},e.id)),(0,I.jsx)(nl,{shimmerLabel:`Searching...`,completeLabel:`Found ${c} results`,isAnimating:o,expandable:l,defaultOpen:a,children:(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center gap-1 border-b border-border px-2.5 py-0 text-xs`,children:[(0,I.jsx)(`span`,{className:`font-medium text-foreground`,children:`Searched for`}),` `,(0,I.jsxs)(`span`,{className:`truncate text-muted-foreground`,children:[`“`,s,`”`]})]}),(0,I.jsx)(`div`,{className:`max-h-[200px] overflow-y-auto bg-background`,children:(0,I.jsx)(`div`,{className:`flex flex-col gap-1 p-1`,children:r.map(e=>(0,I.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,I.jsx)(`div`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:(0,I.jsx)(k,{className:`h-4 w-4`})}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-foreground/90`,children:e.title}),(0,I.jsx)(`span`,{className:`shrink-0 text-xs whitespace-nowrap text-muted-foreground`,children:e.date||e.source})]},`${e.title}-${e.source}-${e.date}`))})})]})})]})}function El(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 Dl=(0,F.memo)(function({part:e,results:t,defaultOpen:n}){let r=e.type?.replace(`tool-`,``)||`WebSearch`,{step:i,stepState:a}=re(e,r),o={[i.id]:a};return(0,I.jsx)(Tl,{toolSteps:[i],stepStates:o,onStepComplete:()=>{},results:t??El(e.output?.results)??El(e.result?.results),defaultOpen:n})});function Ol(e){return e===`in-progress`?`In progress`:e===`completed`?`Completed`:e===`cancelled`?`Cancelled`:`Pending`}function kl({complete:e}){let t=f()??!1;return(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`relative grid size-6 shrink-0 place-items-center`,children:(0,I.jsx)(d,{initial:!1,mode:`popLayout`,children:e?(0,I.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}:a,className:`absolute size-5.5 overflow-visible text-emerald-500`,children:[(0,I.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`}),(0,I.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:l}})]},`complete`):(0,I.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}:a,className:`absolute grid place-items-center text-muted-foreground`,children:(0,I.jsx)(S,{className:`size-4`})},`todo`)})})}function Al({status:e,progress:t}){let n=f()??!1,r=t===void 0?.68:Math.min(100,Math.max(0,t))/100;return(0,I.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,I.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:l},className:i(e===`in-progress`&&`opacity-20`)}),(0,I.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}:c,style:{transformOrigin:`12px 12px`}}),(0,I.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:l}}),(0,I.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:l}})]})}function jl({items:e,title:t=`To-dos`,open:n,defaultOpen:r=!0,onOpenChange:s,collapseOnComplete:u=!0,maxHeight:p=248,className:m}){let h=f()??!1,g=(0,F.useId)(),_=`${g}-trigger`,v=`${g}-content`,y=(0,F.useRef)(null),b=(0,F.useRef)(!1),[x,S]=(0,F.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,F.useCallback)(e=>{n===void 0&&S(e),s?.(e)},[s,n]);return(0,F.useEffect)(()=>{b.current&&!E&&O(!0),!b.current&&E&&u&&O(!1),b.current=E},[E,u,O]),(0,F.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,I.jsxs)(`section`,{"aria-label":`Agent task list`,className:i(`w-full overflow-hidden rounded-2xl border border-border/70`,m),children:[(0,I.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,I.jsx)(kl,{complete:E}),(0,I.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground/90`,children:t}),(0,I.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,I.jsxs)(`span`,{className:`sr-only`,children:[T,` of `,e.length,` tasks completed`]}),(0,I.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex`,children:[(0,I.jsx)(M,{value:String(T),children:T}),(0,I.jsx)(`span`,{children:`/`}),(0,I.jsx)(`span`,{children:e.length})]})]}),(0,I.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:C?180:0},transition:h?{duration:0}:a,className:`text-muted-foreground/50 transition-colors group-hover:text-muted-foreground`,children:(0,I.jsx)(w,{className:`size-3.5`})})]}),(0,I.jsx)(ee,{id:v,role:`region`,"aria-labelledby":_,open:C,children:(0,I.jsxs)(`div`,{ref:y,className:`scrollbar-hide overflow-y-auto px-2 pb-2`,style:{maxHeight:p},children:[(0,I.jsx)(`ol`,{"aria-live":E?`polite`:`off`,className:`space-y-0`,children:(0,I.jsx)(d,{initial:!1,mode:`popLayout`,children:e.map(e=>{let t=e.status??`pending`;return(0,I.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:l},y:c,layout:c},className:`flex min-h-9 items-center gap-2.5 rounded-xl px-1.5 py-1`,children:[(0,I.jsx)(Al,{status:t,progress:e.progress}),(0,I.jsxs)(`span`,{className:`sr-only`,children:[Ol(t),`: `]}),(0,I.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,I.jsxs)(`span`,{className:`relative inline-block max-w-full`,children:[e.title,(0,I.jsx)(o.span,{"aria-hidden":`true`,initial:!1,animate:{scaleX:+(t===`completed`),opacity:+(t===`completed`)},transition:h?{duration:0}:{duration:.28,ease:l,delay:.06},className:`absolute inset-x-0 top-1/2 h-px origin-left bg-current`})]})}),e.detail?(0,I.jsx)(`span`,{className:`shrink-0 text-sm text-muted-foreground/55`,children:e.detail}):null]},e.id)})})}),!e.length&&(0,I.jsx)(`p`,{className:`px-1.5 py-2 text-sm text-muted-foreground`,children:`No tasks yet`})]})})]})}function Ml(e){return e===`in_progress`||e===`in-progress`?`in-progress`:e===`completed`?`completed`:e===`cancelled`?`cancelled`:`pending`}function Nl(e){return(e??[]).flatMap((e,t)=>{let n=e.title??e.content;return n?[{id:`${t}-${n}`,title:n,status:Ml(e.status)}]:[]})}var Pl=(0,F.memo)(function({part:e}){let t=e.state===`input-streaming`,n=(0,F.useMemo)(()=>Nl(e.input?.todos??e.output?.newTodos),[e.input?.todos,e.output?.newTodos]);return t||n.length===0?(0,I.jsx)(ie,{as:`span`,duration:1.2,className:`m-0 inline-flex h-4 items-center text-label leading-none`,children:`Updating to-dos...`}):(0,I.jsx)(jl,{items:n,title:`Todo list`,defaultOpen:!0,collapseOnComplete:!1,maxHeight:240})},ll);function Fl(e,t){let[n,r]=(0,F.useState)(0);return(0,F.useEffect)(()=>{if(t&&e){r(Date.now()-e);let t=setInterval(()=>{r(Date.now()-e)},1e3);return()=>clearInterval(t)}},[t,e]),n}function Il(e){if(!e)return``;let t=we(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 Ll(e,t){let n=e.split(`
1384
+ `),r=t.split(`
1385
+ `),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 Rl={"tool-Task":{icon:ce,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:ce,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:ce,title:()=>`Skill`,subtitle:e=>e.input?.skill||``,variant:`simple`},"tool-Grep":{icon:pe,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 ${Il(n)}`;return e.length>40?`${e.slice(0,37)}...`:e}return t.length>40?`${t.slice(0,37)}...`:t},variant:`simple`},"tool-Glob":{icon:Re,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:le,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:N,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}=Ll(t,n);return`+${e} -${r}`}return``},variant:`simple`},"tool-Write":{icon:Ie,title:()=>`Create`,subtitle:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||``},variant:`simple`},"tool-Bash":{icon:me,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=>Il(e)),n.length>50?`${n.slice(0,47)}...`:n},variant:`simple`},"tool-IPython":{icon:N,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(`
1386
+ `,1)[0].trim();return n.length>50?`${n.slice(0,47)}...`:n},variant:`simple`},"tool-WebFetch":{icon:se,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:pe,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:ce,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:N,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:me,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=>Il(e)),r.length>50?`${r.slice(0,47)}...`:r},variant:`simple`},"tool-KillShell":{icon:j,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:ue,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Cloning repo`:`Repo cloned`,subtitle:e=>e.input?.repo??``,variant:`simple`},"tool-Thinking":{icon:ce,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Thinking...`:`Thought`,variant:`collapsible`}},zl=`tool-mcp__`,Bl={"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 Vl(e){let t=Bl[e];if(t)return t;if(!e.startsWith(zl))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`}}var Hl=[];function Ul(e,t){return`${e} ${e===1?t:`${t}s`}`}function Wl(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(Ul(i,`file`)),a>0&&s.push(`${a} ${a===1?`search`:`searches`}`),o>0&&s.push(Ul(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 Gl(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 Kl(e,t){let n=[];return e>0&&n.push(Ul(e,`file`)),t>0&&n.push(`${t} ${t===1?`search`:`searches`}`),n.join(`, `)}var ql=(0,F.memo)(function({part:e,nestedTools:t=Hl,chatStatus:n,completeLabel:r,shimmerLabel:a,interruptedLabel:o,maxVisibleTools:s=5,defaultOpen:c,showElapsed:l=!0}){let{isPending:u,isInterrupted:d}=dl(e,n),f=e.input?.description||``,[p,m]=(0,F.useState)(c??!1),[h,g]=(0,F.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,F.useRef)(u),w=(0,F.useRef)(!1),T=(0,F.useRef)(null),{fileCount:E,searchCount:D}=(0,F.useMemo)(()=>Gl(u?t.slice(0,Math.max(h,0)):t),[u,t,h]),O=Kl(E,D),k=(0,F.useRef)(null),A=Fl(_,u);(0,F.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,F.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,F.useEffect)(()=>{!u||!k.current||(k.current.scrollTop=k.current.scrollHeight)},[u,h]);let j=(()=>{if(u&&v)return O;if(!u&&v){let e=Wl(t);if(e)return e}return f?f.length>60?`${f.slice(0,57)}...`:f:``})(),M=ul(!u&&b?b:A);return d&&!e.output?(0,I.jsx)(nl,{completeLabel:o,isAnimating:!1}):(0,I.jsx)(nl,{completeLabel:r,shimmerLabel:a,isAnimating:u,detail:j,expandable:v,expanded:p,onToggleExpand:()=>{w.current=!0,m(e=>!e)},trailingContent:l&&M?(0,I.jsx)(`span`,{className:`shrink-0 font-normal text-muted-foreground/60 tabular-nums`,children:M}):void 0,children:(0,I.jsxs)(`div`,{className:`relative`,children:[u&&p&&S>4&&(0,I.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,I.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=Rl[r.type];if(!i)return null;let{isPending:a,isError:o}=dl(r,n);return(0,I.jsx)(rl,{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 Jl(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}=dl(e,t);return n?`pending`:`success`}var Yl=(0,F.memo)(function({part:e,nestedTools:t,chatStatus:n,toolRenderers:r}){let i=e.type;switch(i){case`tool-Bash`:return(0,I.jsx)(qe,{part:e});case`tool-IPython`:return(0,I.jsx)(ae,{part:e});case`tool-Edit`:case`tool-Write`:return(0,I.jsx)(tl,{part:e});case`tool-WebSearch`:case`tool-Grep`:case`tool-Glob`:return(0,I.jsx)(Dl,{part:e});case`tool-PlanWrite`:return(0,I.jsx)(Cl,{part:e,chatStatus:n});case`tool-TodoWrite`:return(0,I.jsx)(Pl,{part:e,chatStatus:n});case`tool-Question`:return(0,I.jsx)(We,{part:e,chatStatus:n});case`tool-Task`:case`tool-Agent`:{let r=e.type===`tool-Agent`?`Agent`:`Task`;return(0,I.jsx)(ql,{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=Vl(i);if(a){if(r){let t=r[a.toolName];if(t)return(0,I.jsx)(t,{name:a.toolName,input:e.input??{},output:e.output?vl(e.output):void 0,status:Jl(e,n)})}return(0,I.jsx)(bl,{part:e,mcpInfo:a,chatStatus:n})}if(r&&i.startsWith(`tool-`)){let t=i.slice(5),a=r[t];if(a)return(0,I.jsx)(a,{name:t,input:e.input??{},output:e.output??e.result,status:Jl(e,n)})}let o=Rl[i];if(o){let{isPending:t,isError:r}=dl(e,n);return(0,I.jsx)(rl,{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}=dl(e,n);return(0,I.jsx)(rl,{title:c?`Running ${s}`:s,isPending:c,isError:l})}),Xl={queued:`Waiting to generate`,generating:`Generating image`,refining:`Refining details`,complete:`Image ready`,error:`Generation failed`},Zl={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}},Ql={queued:1,generating:1,refining:.48,complete:0,error:0},$l=10,eu=Math.PI*2;function tu({status:e,reduce:t}){return e===`complete`?(0,I.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}):e===`error`?(0,I.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`}):(0,I.jsxs)(o.span,{"aria-hidden":`true`,animate:t?void 0:{rotate:360},transition:{duration:2.4,ease:s,repeat:1/0},className:`grid size-3.5 grid-cols-2 place-items-center gap-0.5`,children:[(0,I.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`}),(0,I.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,I.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,I.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`})]})}function nu({interactive:e,reduce:t,status:n}){let r=y(),i=(0,F.useRef)(null);return(0,F.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/$l)+1,d=Math.ceil(c/$l)+1,f=(s-(i-1)*$l)/2,m=(c-(d-1)*$l)/2;a.fillStyle=l;for(let e=0;e<d;e+=1)for(let t=0;t<i;t+=1){let n=f+t*$l,i=m+e*$l,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,eu),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,I.jsx)(o.div,{"aria-hidden":`true`,initial:!1,animate:{opacity:Ql[n]},transition:{duration:t?0:.4,ease:l},className:`absolute inset-0 overflow-hidden bg-muted`,children:(0,I.jsx)(`canvas`,{ref:i,className:`absolute inset-0 size-full text-foreground`})})}function ru({children:e,status:t=`generating`,label:n,prompt:r,resolution:a=`1024 × 1024`,aspectRatio:s=`1 / 1`,size:c=`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=Zl[t],C=m??Xl[t],w=n??(r?`${C}: ${r}`:C);return(0,I.jsx)(`div`,{"data-slot":`image-generation`,"data-state":t,"aria-busy":x,className:i(`w-full`,_),children:(0,I.jsxs)(`div`,{className:i(`w-full`,c===`compact`&&`mx-auto max-w-52`),children:[(0,I.jsxs)(`div`,{role:`img`,"aria-label":w,style:{aspectRatio:s},className:`relative isolate w-full overflow-hidden rounded-xl bg-muted`,children:[(0,I.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:l},className:i(`absolute inset-0 [&>*]:size-full [&>*]:object-cover [&_img]:size-full [&_img]:object-cover`,v),children:e}),(0,I.jsx)(d,{initial:!1,children:x?(0,I.jsx)(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:b?0:.25,ease:l},className:`absolute inset-0`,children:(0,I.jsx)(nu,{interactive:p,reduce:b,status:t})},`dither-field`):null}),a?(0,I.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:a}):null]}),(0,I.jsx)(d,{initial:!1,children:h||r?(0,I.jsxs)(o.div,{initial:!1,className:`mt-3 text-left`,children:[(0,I.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,I.jsx)(tu,{status:t,reduce:b}):null,(0,I.jsx)(d,{mode:`popLayout`,initial:!1,children:h?(0,I.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:l},children:C},C):null})]}),r?(0,I.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[`“`,r,`”`]}):null]},`status-block`):null}),t===`error`&&g?(0,I.jsxs)(o.button,{type:`button`,onClick:g,whileTap:b?void 0:{scale:.96},transition:u,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,I.jsx)(fe,{"aria-hidden":`true`,className:`size-4`}),`Try again`]}):null]})})}function iu({steps:e,activeIndex:t,className:n,...r}){let a=e.length,o=Oe(t,a),s=o>=a,c=ke(o,a);return(0,I.jsxs)(`div`,{"data-slot":`agent-plan`,className:i(`flex w-full max-w-sm flex-col gap-3`,n),...r,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`span`,{className:`text-body font-medium`,children:`Plan`}),(0,I.jsxs)(`span`,{className:i(Ae,`text-foreground/35 tabular-nums`),children:[o,` of `,a]})]}),(0,I.jsx)(`div`,{className:`bg-foreground/[0.06] h-[3px] w-full overflow-hidden rounded-full`,children:(0,I.jsx)(`span`,{className:`bg-foreground/80 block h-full rounded-full transition-[width] duration-500`,style:{width:`${c}%`}})}),(0,I.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,I.jsxs)(`li`,{className:`flex items-center gap-2.5 text-body`,children:[(0,I.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:n?(0,I.jsx)(C,{className:`text-foreground/35 size-3.5`}):r?(0,I.jsx)(de,{className:`text-foreground/90 size-3.5 animate-spin motion-reduce:animate-none`}):(0,I.jsx)(`span`,{"aria-hidden":!0,className:`bg-foreground/15 size-1.5 rounded-full`})}),(0,I.jsx)(`span`,{className:i(n&&`text-foreground/40`,r&&`text-foreground/90`,!n&&!r&&`text-foreground/35`),children:e})]},e)})})]})}function au(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 ou({presentation:e,className:t}){return(0,I.jsx)(iu,{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 su(e){return e===`approving`?`Approving`:e===`approved`?`Approved`:e===`denied`?`Denied`:e===`running`?`Running`:e===`complete`?`Completed`:e===`error`?`Failed`:`Approval required`}function cu(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 lu({tool:e,title:t=`Allow this tool to run?`,description:n,parameters:r=[],status:s=`pending`,open:c,defaultOpen:p=!1,onOpenChange:m,onApprove:h,onAlwaysAllow:g,onDeny:_,className:v}){let y=f()??!1,b=`${(0,F.useId)()}-details`,x=(0,F.useRef)(s),[S,T]=(0,F.useState)(p),E=c??S,D=(0,F.useCallback)(e=>{c===void 0&&T(e),m?.(e)},[m,c]),k=s===`approving`||s===`running`,A=s===`pending`,j=s===`error`;return(0,F.useEffect)(()=>{x.current===`pending`&&s!==`pending`&&D(!1),x.current=s},[D,s]),(0,I.jsxs)(`div`,{"data-state":s,"aria-busy":k,className:i(`w-full overflow-hidden rounded-2xl border border-border/60 bg-muted/20 text-sm`,v),children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-3 p-4`,children:[(0,I.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`,j&&`text-destructive`),children:k?(0,I.jsx)(de,{className:i(`size-4`,!y&&`animate-spin`)}):j?(0,I.jsx)(O,{className:`size-4`}):s===`denied`?(0,I.jsx)(ge,{className:`size-4`}):s===`approved`||s===`complete`?(0,I.jsx)(C,{className:`size-4`}):(0,I.jsx)(oe,{className:`size-4`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:`font-medium text-foreground`,children:t}),(0,I.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-muted-foreground`,children:e})]}),(0,I.jsx)(`span`,{className:i(`shrink-0 rounded-full border px-2 py-0.5 text-caption font-medium transition-colors`,cu(s)),children:su(s)})]}),n?(0,I.jsx)(`p`,{className:`mt-2 leading-5 text-muted-foreground`,children:n}):null,r.length?(0,I.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,I.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:E?180:0},transition:y?{duration:0}:a,children:(0,I.jsx)(w,{className:`size-3.5`})})]}):null]})]}),(0,I.jsx)(ee,{id:b,open:E,children:(0,I.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,I.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,7rem)_minmax(0,1fr)] items-center gap-3 text-xs`,children:[(0,I.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,I.jsx)(`dd`,{className:`min-w-0 break-words font-mono text-foreground/85`,children:e.value})]},e.id))})}),(0,I.jsx)(d,{initial:!1,children:A?(0,I.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:l},className:`flex flex-wrap items-center gap-2 border-t border-border/60 px-4 py-3`,children:[(0,I.jsx)(o.button,{type:`button`,onClick:h,whileTap:y?void 0:{scale:.97},transition:u,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,I.jsx)(o.button,{type:`button`,onClick:g,whileTap:y?void 0:{scale:.97},transition:u,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,I.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 uu(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function du(e){let t=uu(e);if(t)return t;if(typeof e==`string`)try{return uu(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 fu(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 pu(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`boolean`)return t}}function mu(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function hu(e){return e.output!==void 0&&e.output!==null?e.output:e.result}function gu(e){let t=du(e),n=du(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:mu(s),l=fu(r,`durationMs`,`duration_ms`,`duration`),u=pu(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 _u(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:mu(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:mu(e),language:`json`}]}let i=mu(t);return i.trim()?[{label:`output`,content:i,language:`text`}]:[]}function vu(e,t){return _u(e,t).map(e=>`${e.label}\n${e.content}`).join(`
1387
+
1388
+ `)}function yu(e){return du(e.input)??du(e.args)}function bu(e,...t){for(let n of t){let t=e?.[n];if(Array.isArray(t))return t}}function xu(e,t){return $(t.details??t.record,`diff`,`patch`)??$(e,`diff`,`patch`)}function Su(e,t){return $(e,`path`,`filePath`,`filename`,`file`)??$(t.details??t.record,`path`,`filePath`,`filename`,`file`)??`workspace file`}function Cu(e){return e.split(`
1389
+ `).map((e,t)=>({id:`${t}-${e.slice(0,16)}`,type:e.startsWith(`+`)&&!e.startsWith(`+++`)?`added`:e.startsWith(`-`)&&!e.startsWith(`---`)?`removed`:`context`,content:e}))}function wu(e,t){let n=t.details??t.record,r=du(e?.plan)??du(n?.plan),i=bu(e,`todos`)??bu(r,`todos`,`items`)??bu(n,`todos`,`newTodos`,`items`);return i?i.flatMap((e,t)=>{let n=uu(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 Tu(e){let t=bu(e.details??e.record,`results`,`sources`,`citations`);return t?t.flatMap((e,t)=>{let n=uu(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 Eu(e){return $(e.details??e.record,`url`,`imageUrl`,`image_url`)}function Du(e,t){return uu(e?.approval)??uu(t.details?.approval)??uu(t.record?.approval)}function Ou(e){let t=typeof e.type==`string`?e.type:`Tool`;return t.startsWith(`tool-`)?t.slice(5):t}function ku(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 Au(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 ju(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 Mu(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 Nu=new WeakMap;function Pu(e,t){if(e&&typeof e==`object`){let n=Nu.get(e);if(n&&n.chatStatus===t)return n.value;let r=Fu(e,t);return Nu.set(e,{chatStatus:t,value:r}),r}return Fu(e,t)}function Fu(e,t){let n=uu(e);if(!n)return;let r=Ou(n),i=r.toLowerCase(),a=yu(n),o=hu(n),s=gu(o),c=ku(n,t),l=$(a,`command`,`cmd`,`code`,`script`),u=ju(r,l),d=[];s.durationMs!==void 0&&d.push(`${s.durationMs}ms`),s.kernelRestarted&&d.push(`kernel restarted`);let f=xu(a,s),p=i.includes(`todo`)||i.includes(`plan`)?wu(a,s):[],m=i.includes(`search`)||i.includes(`web`)||i.includes(`source`)||i.includes(`citation`)?Tu(s):[],h=i.includes(`image`)||i.includes(`generat`)?Eu(s):void 0,g=Du(a,s),_=vu(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:Su(a,s),lines:Cu(f),copyText:f}:(l||v||g||d.length>0)&&(b={kind:`output`,content:_,language:Au(r,s.structured),structured:s.structured,sections:_u(s,o),sourceCode:l,sourceLanguage:u,sourceLabel:Mu(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 Iu(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 Lu(e,t){return t.toLowerCase().includes(`bash`)||t.toLowerCase().includes(`shell`)?(0,I.jsx)(me,{"aria-hidden":`true`,className:`size-4`}):e===`success`?(0,I.jsx)(A,{"aria-hidden":`true`,className:`size-4`}):(0,I.jsx)(he,{"aria-hidden":`true`,className:`size-4`})}function Ru({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,I.jsx)(lu,{tool:t,title:`Fleet Prime permission`,description:`This tool reported a permission decision from Fleet Prime.`,parameters:i,status:r})}function zu({code:e,language:t,languageLabel:n,status:r}){return(0,I.jsx)(m,{code:e,language:t,languageLabel:n,status:r===`running`?`streaming`:`complete`,showStatus:!1,maxHeight:160,showLineNumbers:!1,wrap:!0})}var Bu=(0,F.memo)(function({part:e,nestedTools:t,chatStatus:n,toolRenderers:r}){let i=()=>(0,I.jsx)(Yl,{part:e,nestedTools:t,chatStatus:n,toolRenderers:r}),a=Pu(e,n);if(!a||a.lowerName===`question`)return i();let{detail:o,status:s}=a;if(!o)return i();if(o.kind===`todo`){let t=Iu(o.items),n=!!e.input?.pendingDecision;if(a.lowerName===`planwrite`&&n)return i();let r=a.lowerName===`planwrite`&&e.input?.executing?au(t):void 0;return r?(0,I.jsx)(ou,{presentation:r,className:`mb-2`}):(0,I.jsx)(jl,{items:o.items,title:o.title,defaultOpen:!0,collapseOnComplete:!1,maxHeight:240})}if(o.kind===`citations`)return(0,I.jsx)(x,{citations:o.citations,title:`Sources`,defaultOpen:!0});if(o.kind===`image`)return(0,I.jsx)(ru,{status:s===`running`?`generating`:s===`error`?`error`:`complete`,children:(0,I.jsx)(`img`,{src:o.url,alt:`Generated result`,width:640,height:320,loading:`lazy`,decoding:`async`,className:`h-auto max-h-80 w-full object-contain`})});if(o.kind===`diff`)return(0,I.jsx)(g,{file:o.file,lines:o.lines,status:s===`running`?`streaming`:`complete`,language:`diff`,maxHeight:240,copyText:o.copyText,defaultOpen:s===`running`});let c=o.content||`No output.`;return(0,I.jsxs)(_,{tool:`Prime`,title:a.name,status:s,kind:a.lowerName.includes(`bash`)||a.lowerName.includes(`shell`)||a.lowerName.includes(`python`)?`terminal`:`custom`,meta:a.metadata.length>0?a.metadata.join(` · `):void 0,icon:Lu(s,a.name),defaultOpen:s===`running`,collapseOnComplete:!1,maxHeight:240,copyText:c,children:[o.sourceCode?(0,I.jsx)(zu,{code:o.sourceCode,language:o.sourceLanguage??`text`,languageLabel:o.sourceLabel,status:s}):null,o.sections.map(e=>(0,I.jsx)(h,{language:e.language,label:e.label,children:e.content},e.label)),(0,I.jsx)(Ru,{approval:a.approval,name:a.name,status:s})]})}),Vu=e({SessionToolRenderer:()=>Hu}),Hu=(0,F.memo)(function(e){let t=e.part.type;return t===`tool-Thinking`||t===`tool-FleetReasoning`?null:t.startsWith(`tool-`)?(0,I.jsx)(Bu,{...e}):(0,I.jsx)(Yl,{...e})});export{Vu as n,Hu as t};