ryco-cli 0.1.30 → 0.1.31

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 (493) hide show
  1. package/dist/{AcpAdapter-DjP0IHpH.cjs → AcpAdapter-ByUp9-wk.cjs} +71 -51
  2. package/dist/{AcpAdapter-CKWzfB3Q.mjs → AcpAdapter-CY_ANTKu.mjs} +73 -53
  3. package/dist/{AcpNativeLogging-Do0LktDb.mjs → AcpNativeLogging-C7PC6imv.mjs} +30 -4
  4. package/dist/{AcpNativeLogging-5gTPK9Fq.cjs → AcpNativeLogging-OQeAya9d.cjs} +33 -1
  5. package/dist/{AcpRegistryDriver-BblCFfev.cjs → AcpRegistryDriver-CD9GN7rI.cjs} +3 -3
  6. package/dist/{AcpRegistryDriver-BzohT-PC.mjs → AcpRegistryDriver-DMZ5VBWJ.mjs} +4 -4
  7. package/dist/AzureDevOpsSourceControlProvider-5giVYoNi.mjs +2053 -0
  8. package/dist/AzureDevOpsSourceControlProvider-BKMXEUaN.cjs +2055 -0
  9. package/dist/{BitbucketSourceControlProvider-D5UVAc9z.mjs → BitbucketSourceControlProvider-BVUBsEUF.mjs} +63 -23
  10. package/dist/{BitbucketSourceControlProvider-Bvl_q1o2.cjs → BitbucketSourceControlProvider-BWnnrbch.cjs} +62 -22
  11. package/dist/{BunPTY-Dcl1Lp62.mjs → BunPTY-CMbDQ1Xb.mjs} +1 -1
  12. package/dist/{ClaudeDriver-DZkz0QPr.cjs → ClaudeDriver-DCrqouOR.cjs} +1373 -191
  13. package/dist/{ClaudeDriver-BuQ_azDw.mjs → ClaudeDriver-DVOss8cC.mjs} +1375 -193
  14. package/dist/{CodexDriver-6Ph2cjAW.cjs → CodexDriver-CBQPHJqU.cjs} +258 -28
  15. package/dist/{CodexDriver-Bi49RIL4.mjs → CodexDriver-DJoTky7Z.mjs} +261 -31
  16. package/dist/{CodexTextGeneration-C5TIspJA.mjs → CodexTextGeneration-BSgNgfZv.mjs} +6 -6
  17. package/dist/{CodexTextGeneration-sXPR9eld.cjs → CodexTextGeneration-C9MDQmZm.cjs} +7 -7
  18. package/dist/{CopilotDriver-Bcdpz6U_.mjs → CopilotDriver-CUkdPXcH.mjs} +78 -20
  19. package/dist/{CopilotDriver-D6P0xgRX.cjs → CopilotDriver-DbaMDH16.cjs} +76 -18
  20. package/dist/{CursorDriver-CRnDGwEv.mjs → CursorDriver-B-ZilXJB.mjs} +114 -97
  21. package/dist/{CursorDriver-DMJ7sGSx.cjs → CursorDriver-DKQqPbKH.cjs} +114 -97
  22. package/dist/{ForgejoSourceControlProvider-D4jGdaJX.cjs → ForgejoSourceControlProvider-CgpjFECj.cjs} +94 -60
  23. package/dist/{ForgejoSourceControlProvider-Dl_Fk3RY.mjs → ForgejoSourceControlProvider-DemMYUye.mjs} +95 -61
  24. package/dist/{GitHubSourceControlProvider-QMe-zymI.cjs → GitHubSourceControlProvider-C4un6hOK.cjs} +218 -119
  25. package/dist/{GitHubSourceControlProvider-DnwKf0ap.mjs → GitHubSourceControlProvider-CRSDYcjc.mjs} +206 -108
  26. package/dist/GitLabSourceControlProvider-D8W1ZLPh.cjs +2260 -0
  27. package/dist/GitLabSourceControlProvider-DpWkJ0M3.mjs +2258 -0
  28. package/dist/{GrokDriver-jy8JIvYY.cjs → GrokDriver-BQ6G_7ZZ.cjs} +6 -7
  29. package/dist/{GrokDriver-Bvq1jP3S.mjs → GrokDriver-Buvas9-q.mjs} +5 -6
  30. package/dist/{Metrics-CnmjpbWk.mjs → Metrics-C3vLS9rz.mjs} +123 -13
  31. package/dist/{Metrics-C0LSU8s7.cjs → Metrics-DjRPLE98.cjs} +170 -12
  32. package/dist/{NodePTY-D7tFWuQe.mjs → NodePTY-DgnuBruq.mjs} +1 -1
  33. package/dist/{OpenCodeDriver-DhyVaBMT.mjs → OpenCodeDriver-BWEZD841.mjs} +183 -49
  34. package/dist/{OpenCodeDriver-Bu5D19tl.cjs → OpenCodeDriver-qUiX0RLH.cjs} +183 -49
  35. package/dist/{SideQuestionIsolation-B-aE6aBz.mjs → SideQuestionIsolation-B1T-DsR0.mjs} +1 -1
  36. package/dist/{SideQuestionIsolation-CtJ4wX83.cjs → SideQuestionIsolation-BPC-Bxsz.cjs} +1 -1
  37. package/dist/bin.cjs +37021 -10253
  38. package/dist/bin.mjs +36892 -10178
  39. package/dist/client/assets/AccountSettings-B88Q_w9Y.js +1 -0
  40. package/dist/client/assets/AiFocusSettings-Bb0TrCPn.js +1 -0
  41. package/dist/client/assets/{AnimatedHeight-UXn4-nUd.js → AnimatedHeight-epXOsgdm.js} +1 -1
  42. package/dist/client/assets/AppearanceSettings-XS9WRVPU.js +1 -0
  43. package/dist/client/assets/AutomationsDialog-bZckh4Y3.js +1 -0
  44. package/dist/client/assets/AutomationsSummary-wPFZCF49.js +1 -0
  45. package/dist/client/assets/BranchToolbar.logic-DjzLKbbB.js +3 -0
  46. package/dist/client/assets/BrowserPanel-CdBLnnfz.js +1 -0
  47. package/dist/client/assets/ChatRightPanel-BCINd0vP.js +34 -0
  48. package/dist/client/assets/ChatThreadRouteView-BFZ0Si-l.js +1 -0
  49. package/dist/client/assets/ColorSwatchPicker-CGyo99o0.js +1 -0
  50. package/dist/client/assets/CommandPalette.logic-BIOMtnEQ.js +1 -0
  51. package/dist/client/assets/CommandPaletteDialog-Db4LH--z.js +2 -0
  52. package/dist/client/assets/CompositeRoot-DtnwMJKj.js +1 -0
  53. package/dist/client/assets/ComputerUseSettings-CkqCqDsU.js +1 -0
  54. package/dist/client/assets/ConnectionsSettings-B9mxExdG.js +7 -0
  55. package/dist/client/assets/CreatePullRequestDialog-CJ7pNCue.js +1 -0
  56. package/dist/client/assets/CreatePullRequestDialogHost-n4ZjdSr4.js +1 -0
  57. package/dist/client/assets/DiagnosticsSettings-f9rFG9re.js +2 -0
  58. package/dist/client/assets/DiagnosticsSettings.logic-Byf-Bu4S.js +1 -0
  59. package/dist/client/assets/DialogHandle-C0c_rK3I.js +1 -0
  60. package/dist/client/assets/{DialogPopup-NfwDyR5c.js → DialogPopup-BKW1PEEa.js} +1 -1
  61. package/dist/client/assets/DialogRoot-BIubqrv0.js +1 -0
  62. package/dist/client/assets/DialogTitle-BAX_FLoG.js +1 -0
  63. package/dist/client/assets/{DialogViewport-B6w_ROOE.js → DialogViewport-C2iOUx0O.js} +1 -1
  64. package/dist/client/assets/DiffPanel-BkqDt_SS.js +25 -0
  65. package/dist/client/assets/DisclosureRegion-B8556yU0.js +1 -0
  66. package/dist/client/assets/DraftChatThreadRouteView-BKgRKJ2w.js +1 -0
  67. package/dist/client/assets/{ExternalIdentityWeb.logic-BlKX8J9h.js → ExternalIdentityWeb.logic-Cu6suNrN.js} +1 -1
  68. package/dist/client/assets/GlassSurface-DLYYzRdP.js +1 -0
  69. package/dist/client/assets/HostedConnectionControls-CoVqtnrK.js +1 -0
  70. package/dist/client/assets/HostedHubRoot-CM2CwPUr.js +2 -0
  71. package/dist/client/assets/{HostedNativeAuthorizationRoute-j7oSlakZ.js → HostedNativeAuthorizationRoute-Bizmqrh_.js} +2 -2
  72. package/dist/client/assets/HostedNodeRenameDialog-SXWMsTO0.js +1 -0
  73. package/dist/client/assets/HostedRelayTrustNotice-BfTyrBi5.js +1 -0
  74. package/dist/client/assets/InboxStatusGlyph-BPTqzp7l.js +1 -0
  75. package/dist/client/assets/IntegrationsSettingsPanel-DAPvkV4i.js +1 -0
  76. package/dist/client/assets/KeybindingsSettings-B8g-YI2O.js +1 -0
  77. package/dist/client/assets/LazyBrowserPanel-Ds9cdOC_.js +2 -0
  78. package/dist/client/assets/McpServersSettings-Dw6G3ff3.js +6 -0
  79. package/dist/client/assets/MobileSheet-DfgXNWbd.js +1 -0
  80. package/dist/client/assets/ModelTuningDial-DQBAbuNL.js +1 -0
  81. package/dist/client/assets/NewWorktreeDialog-CDZAJmK6.js +4 -0
  82. package/dist/client/assets/NodeSecuritySettings-3MELA9ru.js +1 -0
  83. package/dist/client/assets/NullStore-gT_6_xZE.js +1 -0
  84. package/dist/client/assets/OnboardingDialog-CAAtNnJf.js +1 -0
  85. package/dist/client/assets/OpinionatedPluginsSettings-AiDB0Vl4.js +1 -0
  86. package/dist/client/assets/{PdfAttachmentPreview-C8-hT8KQ.js → PdfAttachmentPreview-BFNW2wjN.js} +2 -2
  87. package/dist/client/assets/{PhoneGetAppInterstitial-Zh0zpBgT.js → PhoneGetAppInterstitial-D8fwZ8E9.js} +1 -1
  88. package/dist/client/assets/PhoneHome-YHgHljA0.js +1 -0
  89. package/dist/client/assets/PhoneSettingsSurface-BVxJppvK.js +2 -0
  90. package/dist/client/assets/PreviewPanel-BYcEnkv9.js +643 -0
  91. package/dist/client/assets/ProjectScriptDialog-K34K2Kzm.js +1 -0
  92. package/dist/client/assets/ProjectsPage-DXnMYLjb.js +1 -0
  93. package/dist/client/assets/PromoteChatDialog-CAY7_wJ-.js +1 -0
  94. package/dist/client/assets/ProviderLimitWindow-CK04BSkM.js +1 -0
  95. package/dist/client/assets/ProviderUpdateLaunchNotification.logic-BMBrDDOC.js +1 -0
  96. package/dist/client/assets/ProvidersSettingsPanel-C85PX9Es.js +1 -0
  97. package/dist/client/assets/PullRequestsPage-C0rgfGwB.js +1 -0
  98. package/dist/client/assets/{QuitShortcutFeedback-Qs9XsuZ4.js → QuitShortcutFeedback-DSkKqETs.js} +1 -1
  99. package/dist/client/assets/RedactedSensitiveText-DQ0YveQd.js +1 -0
  100. package/dist/client/assets/RollingText-BzvpP5fa.js +1 -0
  101. package/dist/client/assets/RootAppShell-BYQ-eGNT.js +6 -0
  102. package/dist/client/assets/{Separator-B6Esv57Y.js → Separator-DpiW19Vw.js} +1 -1
  103. package/dist/client/assets/SettingsPage-BCFN7Ju2.js +2 -0
  104. package/dist/client/assets/SettingsPanels-CP6z2b1x.js +3 -0
  105. package/dist/client/assets/SettingsPanels.editor-D8U-TWWG.js +1 -0
  106. package/dist/client/assets/SettingsSelect-DEhNaz3E.js +1 -0
  107. package/dist/client/assets/Sidebar.logic-D_ODfSpl.js +1 -0
  108. package/dist/client/assets/SimulatorPanel-DCT6fZ0X.js +1 -0
  109. package/dist/client/assets/SourceControlSettings-DxUtvPMK.js +1 -0
  110. package/dist/client/assets/StatisticsPage-C9SrwtM4.js +1 -0
  111. package/dist/client/assets/StatisticsPanel-BMYLETs0.js +1 -0
  112. package/dist/client/assets/ThreadLinkList-BN5z5EpS.js +169 -0
  113. package/dist/client/assets/ThreadTerminalDrawer-CgIFOlR-.js +18 -0
  114. package/dist/client/assets/ThreadWorkspacePanel-DvXoqQPF.js +3 -0
  115. package/dist/client/assets/ToolbarRootContext-8FsV9Cpj.js +1 -0
  116. package/dist/client/assets/TraitsPicker-DcrpJahy.js +1 -0
  117. package/dist/client/assets/Virtualizer-CwXeUPla.js +1345 -0
  118. package/dist/client/assets/WorkspacePullRequestPanel-3mlcJn9G.js +1 -0
  119. package/dist/client/assets/WorkspaceReview-UGbCgXeK.js +2 -0
  120. package/dist/client/assets/{abnfDiagram-N423BO3Z-ByEe3mC0.js → abnfDiagram-N423BO3Z-DVEM6Scc.js} +1 -1
  121. package/dist/client/assets/{activity-CwTUF6lv.js → activity-DVCuAejY.js} +1 -1
  122. package/dist/client/assets/{alert-DQEkrtUJ.js → alert-FV7ZIit_.js} +1 -1
  123. package/dist/client/assets/alert-dialog-CgXR9tED.js +1 -0
  124. package/dist/client/assets/app-window-3xtwqZgI.js +1 -0
  125. package/dist/client/assets/appChrome-COCz-T7w.js +1 -0
  126. package/dist/client/assets/{appearancePreferences-nFx4MHoI.js → appearancePreferences-NnsvXwBe.js} +1 -1
  127. package/dist/client/assets/architecture-7GRP2DOG-DXXb_0_g.js +1 -0
  128. package/dist/client/assets/{architectureDiagram-T3A2C74G-Bd-yxaTr.js → architectureDiagram-T3A2C74G-B6pcKiCj.js} +1 -1
  129. package/dist/client/assets/{arrow-left-DUOpzEbP.js → arrow-left-Blu3LSE2.js} +1 -1
  130. package/dist/client/assets/{arrow-right-HOYJnPKw.js → arrow-right-CO3CH0ne.js} +1 -1
  131. package/dist/client/assets/arrow-up-B69gV2Bq.js +1 -0
  132. package/dist/client/assets/{arrow-up-right-DHnMKuVA.js → arrow-up-right-BbPGFOLA.js} +1 -1
  133. package/dist/client/assets/authorization-Ob6YwWiI.js +1 -0
  134. package/dist/client/assets/autocomplete-RVpjsrDv.js +1 -0
  135. package/dist/client/assets/ban-BIm2PVkE.js +1 -0
  136. package/dist/client/assets/{blockDiagram-VBNYF7ZC-CPDBonMC.js → blockDiagram-VBNYF7ZC-WNerGp9V.js} +1 -1
  137. package/dist/client/assets/{bot-DxjPA7Bw.js → bot-C9nWtaWq.js} +1 -1
  138. package/dist/client/assets/browserState-jt47YsqD.js +1 -0
  139. package/dist/client/assets/{c4Diagram-5PPSVZJV-BM6pAiqT.js → c4Diagram-5PPSVZJV-wp1ioOoM.js} +1 -1
  140. package/dist/client/assets/camera-C13VoW3c.js +1 -0
  141. package/dist/client/assets/capabilities-CfOhq009.js +1 -0
  142. package/dist/client/assets/channel-56r2qL2v.js +1 -0
  143. package/dist/client/assets/{chart-column-Cg7d41tb.js → chart-column-DRv0YtL_.js} +1 -1
  144. package/dist/client/assets/checkbox-CIIIY9FA.js +1 -0
  145. package/dist/client/assets/checks-Dw022Bvy.js +1 -0
  146. package/dist/client/assets/{chunk-2GRJ4B5K-DVKozJ41.js → chunk-2GRJ4B5K-DRl3ILpc.js} +1 -1
  147. package/dist/client/assets/{chunk-4I5QYGJK-BRoMwPkW.js → chunk-4I5QYGJK-CYTRl4bo.js} +1 -1
  148. package/dist/client/assets/{chunk-5RXB4S5H-DFMKyoqP.js → chunk-5RXB4S5H-VCNwRsOa.js} +1 -1
  149. package/dist/client/assets/{chunk-6Q2QTUOP-Ba6UENe9.js → chunk-6Q2QTUOP-DnSeKGPG.js} +1 -1
  150. package/dist/client/assets/{chunk-7Z6QIM7H-B87gYLWH.js → chunk-7Z6QIM7H-Cjilh9TF.js} +1 -1
  151. package/dist/client/assets/{chunk-GF5L2VYU-DZ840GRQ.js → chunk-GF5L2VYU-CGR7AW0t.js} +1 -1
  152. package/dist/client/assets/{chunk-I66GZJ75-BO6p4Aqg.js → chunk-I66GZJ75-CXSn8dDu.js} +1 -1
  153. package/dist/client/assets/{chunk-JQJVKLGR-5dTfVinz.js → chunk-JQJVKLGR-Dro-75lU.js} +1 -1
  154. package/dist/client/assets/{chunk-KBJHAD2P-BeWfBZdP.js → chunk-KBJHAD2P-BDqN2kVf.js} +1 -1
  155. package/dist/client/assets/{chunk-NSK5VX7P-DuRkdn5k.js → chunk-NSK5VX7P-DGo5UczH.js} +1 -1
  156. package/dist/client/assets/{chunk-QR6OTTB3-Duz4Y_uE.js → chunk-QR6OTTB3-RWuyWnBI.js} +1 -1
  157. package/dist/client/assets/{chunk-UBXNYLIW-D-z8URgN.js → chunk-UBXNYLIW-BPRzeB0w.js} +1 -1
  158. package/dist/client/assets/{chunk-W5SLKNZC-AGjFjjoJ.js → chunk-W5SLKNZC-DYWocTFi.js} +1 -1
  159. package/dist/client/assets/{chunk-WRU74C26-BgY3UiXB.js → chunk-WRU74C26-ChbB1jY3.js} +1 -1
  160. package/dist/client/assets/circle-stop-D8B4hRpY.js +1 -0
  161. package/dist/client/assets/circle-x-CNLfrTqR.js +1 -0
  162. package/dist/client/assets/classDiagram-JCYQIIEL-DGvmFev3.js +1 -0
  163. package/dist/client/assets/classDiagram-v2-OCEON4UE-DGvmFev3.js +1 -0
  164. package/dist/client/assets/{clipboard-copy-BWf3JuTE.js → clipboard-copy-DGi8FKNO.js} +1 -1
  165. package/dist/client/assets/clock-3-DmJ4_XPI.js +1 -0
  166. package/dist/client/assets/clock-DZIuPtNG.js +1 -0
  167. package/dist/client/assets/color-picker-BdBXje-a.js +1 -0
  168. package/dist/client/assets/columns-2-CWlMOClK.js +1 -0
  169. package/dist/client/assets/combobox-Dtjtf7AB.js +1 -0
  170. package/dist/client/assets/{cynefin-OW5HDTMX-BuOAGqlK.js → cynefin-OW5HDTMX-TuShvMuM.js} +1 -1
  171. package/dist/client/assets/{cynefinDiagram-MW4NZA55-DqV0Aokp.js → cynefinDiagram-MW4NZA55-B0Edt2Em.js} +1 -1
  172. package/dist/client/assets/{dagre-VZM6K2ZE-D_GFquDW.js → dagre-VZM6K2ZE-D-eiuqHx.js} +1 -1
  173. package/dist/client/assets/{data-list-BJCq3CVP.js → data-list-BAx6jBY1.js} +1 -1
  174. package/dist/client/assets/desktopUpdateAtoms-BjrLa3tl.js +1 -0
  175. package/dist/client/assets/desktopWorkspace-C2wXVBhc.js +1 -0
  176. package/dist/client/assets/{deviceName-C2N8ZRX3.js → deviceName-B4youG0v.js} +1 -1
  177. package/dist/client/assets/{diagram-7IWD3JNH-B1wlsNg2.js → diagram-7IWD3JNH-DgM6lMlR.js} +1 -1
  178. package/dist/client/assets/{diagram-B4RE2ZJO-D-CYoym7.js → diagram-B4RE2ZJO-CyHNDjzV.js} +1 -1
  179. package/dist/client/assets/{diagram-LBJQPF4R-DqJ9NCqt.js → diagram-LBJQPF4R-DDzuLIN5.js} +1 -1
  180. package/dist/client/assets/{diagram-Q27KOJAE-3yp1D2u4.js → diagram-Q27KOJAE-BaBvK9QB.js} +1 -1
  181. package/dist/client/assets/{diagram-UB23O5K3-Byp25nGC.js → diagram-UB23O5K3-CzZ2ewuZ.js} +1 -1
  182. package/dist/client/assets/dialogWords-Cg0YkJVg.js +1 -0
  183. package/dist/client/assets/diffRouteSearch-D2MKN_ah.js +1 -0
  184. package/dist/client/assets/disclosureMotion-cbMJn5-z.js +1 -0
  185. package/dist/client/assets/{download-DsYNYJeu.js → download-TvtXS4hE.js} +1 -1
  186. package/dist/client/assets/{ebnfDiagram-BXEA7PRR-B_IM1l6o.js → ebnfDiagram-BXEA7PRR-CL1vdOKi.js} +1 -1
  187. package/dist/client/assets/editorPreferences-DqKyA-2Z.js +1 -0
  188. package/dist/client/assets/ellipsis-CDK1dNFZ.js +1 -0
  189. package/dist/client/assets/ellipsis-vertical-CwzEUTwV.js +1 -0
  190. package/dist/client/assets/{empty-BbJHvskr.js → empty-BovKoxbn.js} +1 -1
  191. package/dist/client/assets/{erDiagram-JOGREHBK--OtcrCRJ.js → erDiagram-JOGREHBK-DmQR2if6.js} +1 -1
  192. package/dist/client/assets/eventmodeling-NTZA5JFV-D272GIcY.js +1 -0
  193. package/dist/client/assets/external-link-CJeVJZ7s.js +1 -0
  194. package/dist/client/assets/eye-BUmrXqzg.js +1 -0
  195. package/dist/client/assets/file-diff-BWc3mYsz.js +1 -0
  196. package/dist/client/assets/flowDiagram-UKHOOZJN-DLyS38Mm.js +1 -0
  197. package/dist/client/assets/folder-git-2-CPxg5wKP.js +1 -0
  198. package/dist/client/assets/folder-open-DcMymvp1.js +1 -0
  199. package/dist/client/assets/formatCount-B4KLI651.js +1 -0
  200. package/dist/client/assets/{ganttDiagram-PKOTCBZU-w0seBi3Q.js → ganttDiagram-PKOTCBZU-1q2nUL92.js} +1 -1
  201. package/dist/client/assets/git-pull-request-BFPwpm3c.js +1 -0
  202. package/dist/client/assets/{gitGraph-4MIJSDKK-BOJ0lcSW.js → gitGraph-4MIJSDKK-COtwmv2S.js} +1 -1
  203. package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-BMfOCCYn.js → gitGraphDiagram-DS77QQ5N-ChsvaxX4.js} +1 -1
  204. package/dist/client/assets/{group-tVMKGp7Q.js → group-DWWn0dTx.js} +1 -1
  205. package/dist/client/assets/hammer-BXo-EU88.js +1 -0
  206. package/dist/client/assets/hostedConnectionCoordinator-BkAE-RhA.js +1 -0
  207. package/dist/client/assets/{index-BqZvnGNr.js → index-DARIYokI.js} +2 -2
  208. package/dist/client/assets/{info-A6RAGUB7-acjBTQ5o.js → info-A6RAGUB7-CI2qZ9wW.js} +1 -1
  209. package/dist/client/assets/{infoDiagram-6WML65LV-DB01Nc2m.js → infoDiagram-6WML65LV-BPmgcTPH.js} +1 -1
  210. package/dist/client/assets/{input-BDWSVClC.js → input-CCie4mm1.js} +1 -1
  211. package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-KhZTvm-J.js → ishikawaDiagram-WSZJBQD7-LyS9p3Yg.js} +1 -1
  212. package/dist/client/assets/{journeyDiagram-NVQOT4AX-C3JCYk-2.js → journeyDiagram-NVQOT4AX-BYaAmN65.js} +1 -1
  213. package/dist/client/assets/{kanban-definition-27J2QSJJ-Dbo0C1s6.js → kanban-definition-27J2QSJJ-D-pwzqFt.js} +1 -1
  214. package/dist/client/assets/{key-round-CETZqe3h.js → key-round-BlrUTfxB.js} +1 -1
  215. package/dist/client/assets/keyboard-DlBdq6sz.js +1 -0
  216. package/dist/client/assets/label-ChtVI9lp.js +1 -0
  217. package/dist/client/assets/layers-BB-ruGvd.js +1 -0
  218. package/dist/client/assets/lifecycleSuggestionPolicy-0ERe_O53.js +1 -0
  219. package/dist/client/assets/list-checks-BkM_ZRsj.js +1 -0
  220. package/dist/client/assets/loader-3vQnfqIT.js +1 -0
  221. package/dist/client/assets/{log-out-D5-aSBAz.js → log-out-CKq9YiLY.js} +1 -1
  222. package/dist/client/assets/{logging-B_qXVrk6.js → logging-CCg76rgn.js} +1 -1
  223. package/dist/client/assets/main-Ch0bwS-M.js +9 -0
  224. package/dist/client/assets/main-Di0isH9D.css +2 -0
  225. package/dist/client/assets/{mermaid-parser.core-B6Q-3x_q.js → mermaid-parser.core-RK9ah5RM.js} +2 -2
  226. package/dist/client/assets/{mermaidEngine-DksLcesB.js → mermaidEngine-Dr8UsPhH.js} +3 -3
  227. package/dist/client/assets/message-circle-dashed-BrjwqS7-.js +1 -0
  228. package/dist/client/assets/messageQueueDrain-B7R7Qmq6.js +1 -0
  229. package/dist/client/assets/messages-square-cDTkDJv_.js +1 -0
  230. package/dist/client/assets/{mindmap-definition-FAOFIHXS-LaMzRxqw.js → mindmap-definition-FAOFIHXS-DVudWasx.js} +1 -1
  231. package/dist/client/assets/{packet-AYTQ26CC-BHhg59Si.js → packet-AYTQ26CC-DnkTsVhD.js} +1 -1
  232. package/dist/client/assets/panels-top-left-B7jZiLth.js +1 -0
  233. package/dist/client/assets/path-text-3Rfu6lt8.js +1 -0
  234. package/dist/client/assets/{pegDiagram-VL7TDLO6-s7l7UD9d.js → pegDiagram-VL7TDLO6-Do5PIp8B.js} +1 -1
  235. package/dist/client/assets/pencil-Bzg-nc6d.js +1 -0
  236. package/dist/client/assets/{pie-WAS4IAKB-DygX31Z9.js → pie-WAS4IAKB-B_nNQOzn.js} +1 -1
  237. package/dist/client/assets/{pieDiagram-7S7Q4E2Y-bb6I9TtZ.js → pieDiagram-7S7Q4E2Y-D_IG4xwA.js} +1 -1
  238. package/dist/client/assets/{play-DUvOxTpL.js → play-DpXXQ1qB.js} +1 -1
  239. package/dist/client/assets/popover-OWEv6cQz.js +48 -0
  240. package/dist/client/assets/presentationTier-DPVAxTK4.js +1 -0
  241. package/dist/client/assets/previewRouteSearch-BjZdTuSf.js +1 -0
  242. package/dist/client/assets/primary-Cf-xJExj.js +4 -0
  243. package/dist/client/assets/primitives-CxTBN7D4.js +1 -0
  244. package/dist/client/assets/projectCheckouts.logic-DUT4AxXr.js +1 -0
  245. package/dist/client/assets/projectPaths-B8aVmOZX.js +1 -0
  246. package/dist/client/assets/projectPreferences-CzWBItFj.js +1 -0
  247. package/dist/client/assets/providerCapabilities-B2YOPsLN.js +1 -0
  248. package/dist/client/assets/providerDriverMeta-BHHL9uw0.js +1 -0
  249. package/dist/client/assets/providerModels-v9PYbzRE.js +1 -0
  250. package/dist/client/assets/providerStatus-CDPaqb0S.js +1 -0
  251. package/dist/client/assets/pullRequestsModel.logic-Dv_om_C4.js +1 -0
  252. package/dist/client/assets/{qr-code-dbkTo07n.js → qr-code-BlbiBIwH.js} +1 -1
  253. package/dist/client/assets/{qr-code-D4CtBq2F.js → qr-code-DywzVgQC.js} +1 -1
  254. package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-Cj1Y68ZF.js → quadrantDiagram-CIZ2JOQS-DY6fJyrM.js} +1 -1
  255. package/dist/client/assets/{radar-RG4KPBEZ-FHM3ftPp.js → radar-RG4KPBEZ-D9689I5m.js} +1 -1
  256. package/dist/client/assets/radio-group-DVwD6Cuy.js +1 -0
  257. package/dist/client/assets/{railroad-74A4TZTK-CPMn18Cm.js → railroad-74A4TZTK-DVzWbQnl.js} +1 -1
  258. package/dist/client/assets/railroad-abnf-HS5TGJTU-C_2P6umA.js +1 -0
  259. package/dist/client/assets/railroad-ebnf-LZEXJU2U-aGlR3R3z.js +1 -0
  260. package/dist/client/assets/railroad-peg-WCYAUIDC-DCB9oE8y.js +1 -0
  261. package/dist/client/assets/{railroadDiagram-AXF67PYL-DyV3SuDj.js → railroadDiagram-AXF67PYL-D1oJ6Jtl.js} +1 -1
  262. package/dist/client/assets/readCache-B7cDPz2O.js +1 -0
  263. package/dist/client/assets/{refresh-cw-CgDa2Ok_.js → refresh-cw-CRUTivd6.js} +1 -1
  264. package/dist/client/assets/{requirementDiagram-LRYGKXZP-_xEAGWaH.js → requirementDiagram-LRYGKXZP-7RM8iREp.js} +1 -1
  265. package/dist/client/assets/rotate-ccw-BE2ZCwL6.js +1 -0
  266. package/dist/client/assets/roving-radio-group-NMPWrDqe.js +1 -0
  267. package/dist/client/assets/rows-2-DDS4dGTX.js +1 -0
  268. package/dist/client/assets/runtime-DjjjAcTE.js +18 -0
  269. package/dist/client/assets/safePolygon-C1AzMRS4.js +1 -0
  270. package/dist/client/assets/{sankeyDiagram-W5VNT64P-Clf6oTLi.js → sankeyDiagram-W5VNT64P-C1tKAPGN.js} +1 -1
  271. package/dist/client/assets/{save-C8h0AMdl.js → save-OZdkPs_y.js} +1 -1
  272. package/dist/client/assets/scroll-area-80P7vbjw.js +1 -0
  273. package/dist/client/assets/{scrollEdges-BXYnwntN.js → scrollEdges-C0Oc-5qi.js} +1 -1
  274. package/dist/client/assets/select-Cb9FUPHD.js +1 -0
  275. package/dist/client/assets/separator-CO8bC7Wc.js +1 -0
  276. package/dist/client/assets/{sequenceDiagram-SI44F4Z6-CcYtQLSe.js → sequenceDiagram-SI44F4Z6-DGVpb7jL.js} +1 -1
  277. package/dist/client/assets/settings-2-PrRDu6Lc.js +1 -0
  278. package/dist/client/assets/settingsLayout-CRFNCk_D.js +1 -0
  279. package/dist/client/assets/sheet-C5DW7qVO.js +1 -0
  280. package/dist/client/assets/{shield-DPC4oHTi.js → shield-CBHYqlkR.js} +1 -1
  281. package/dist/client/assets/{shield-alert-CwH36qZb.js → shield-alert-Dc2cGwyR.js} +1 -1
  282. package/dist/client/assets/{shield-check-CGD7sEeF.js → shield-check-_wl7R4Js.js} +1 -1
  283. package/dist/client/assets/sidebar-0BBaFNm3.js +1 -0
  284. package/dist/client/assets/sidebarProjectFolders-BjWzbt8C.js +3 -0
  285. package/dist/client/assets/sidebarProjectGrouping-nQRStWrZ.js +1 -0
  286. package/dist/client/assets/sidebarStatusText-BBKuNies.js +1 -0
  287. package/dist/client/assets/sidebarUndo-Dfq1lvyF.js +1 -0
  288. package/dist/client/assets/{skeleton-rS3IgBob.js → skeleton-DfUe6VV_.js} +1 -1
  289. package/dist/client/assets/sliders-horizontal-BGXkwvKv.js +1 -0
  290. package/dist/client/assets/sliding-tabs-BnDSjRU3.js +39 -0
  291. package/dist/client/assets/{smartphone-DgVJfbv3.js → smartphone-OEAQOTdv.js} +1 -1
  292. package/dist/client/assets/spinner-lHRJWsym.js +1 -0
  293. package/dist/client/assets/square-B05NKv3e.js +1 -0
  294. package/dist/client/assets/{star-Cqay-Cae.js → star-C8mHmfZu.js} +1 -1
  295. package/dist/client/assets/{stateDiagram-OKZ733FA-DEKURpRP.js → stateDiagram-OKZ733FA-CCOAegCG.js} +1 -1
  296. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-D60qqBed.js +1 -0
  297. package/dist/client/assets/storeSelectors-BichCKDC.js +1 -0
  298. package/dist/client/assets/surfaceMorph-BTRijmlU.js +1 -0
  299. package/dist/client/assets/{swimlanes-SLNWSIFB-DrR6sbi6.js → swimlanes-SLNWSIFB-CFsLYT4h.js} +1 -1
  300. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-D0SaJgSn.js +8 -0
  301. package/dist/client/assets/switch-oQc7Ifbl.js +1 -0
  302. package/dist/client/assets/text-wrap-DSRdSfDm.js +1 -0
  303. package/dist/client/assets/textarea-VyiIZ0wQ.js +1 -0
  304. package/dist/client/assets/threadPriorityRefreshRuntime-H656C1J_.js +1 -0
  305. package/dist/client/assets/ticker-CPutfhZ4.js +1 -0
  306. package/dist/client/assets/{timeline-definition-Z64GVDOM-bQJvmJx5.js → timeline-definition-Z64GVDOM-B4agmO7R.js} +1 -1
  307. package/dist/client/assets/toggle-DFqtCPt-.js +1 -0
  308. package/dist/client/assets/toggle-group-C5ICmqkI.js +1 -0
  309. package/dist/client/assets/{tokenModePresentation-BkS-mry_.js → tokenModePresentation-umDRm4k1.js} +1 -1
  310. package/dist/client/assets/tooltip-DbqhseXd.js +1 -0
  311. package/dist/client/assets/{treeView-Q6P3EWNA-D4Ex5QTp.js → treeView-Q6P3EWNA-C_S3udFB.js} +1 -1
  312. package/dist/client/assets/{treemap-WGGIJYW6-C4B6Y6qM.js → treemap-WGGIJYW6-B-kUSAkE.js} +1 -1
  313. package/dist/client/assets/undo-2-lyluTGMW.js +1 -0
  314. package/dist/client/assets/{unplug-B1dczi-t.js → unplug-D6iu-qlh.js} +1 -1
  315. package/dist/client/assets/usage-ClF-eUmy.js +1 -0
  316. package/dist/client/assets/useActiveIndicator-R5NWu8Fg.js +1 -0
  317. package/dist/client/assets/useAppSidebarCollapsed-BbMxfio5.js +1 -0
  318. package/dist/client/assets/useAppearancePreference-Ix13pMKy.js +1 -0
  319. package/dist/client/assets/useAtlassian-BYDCc9lv.js +0 -0
  320. package/dist/client/assets/useCheckoutResolution-CR-oOp5-.js +1 -0
  321. package/dist/client/assets/useDesktopRelaunchGuard-Jmh615iZ.js +1 -0
  322. package/dist/client/assets/useDiffFileNavigation-DeuzdD5E.js +15 -0
  323. package/dist/client/assets/useDiffLayout-DhcXwhBL.js +1 -0
  324. package/dist/client/assets/useEnvironmentSettingsTarget-DM6BRDT7.js +1 -0
  325. package/dist/client/assets/useFocus-CV0KIZwg.js +1 -0
  326. package/dist/client/assets/useGit-CUcs7h5_.js +1 -0
  327. package/dist/client/assets/useGitBranchSearch-CeKFtnCL.js +1 -0
  328. package/dist/client/assets/useHostedDraftExecutionTarget-DvQU5UOq.js +1 -0
  329. package/dist/client/assets/useLabelableId-CEgCRi6q.js +1 -0
  330. package/dist/client/assets/useLandingFlash-BfOOlFtW.js +1 -0
  331. package/dist/client/assets/useLogicalProjectSnapshots-CRNZke74.js +1 -0
  332. package/dist/client/assets/useNavigate-sQZthdyT.js +1 -0
  333. package/dist/client/assets/usePageLeadingInsetClass-Bf4nUvx4.js +1 -0
  334. package/dist/client/assets/usePhoneThreadActions-VaQ-mZex.js +1 -0
  335. package/dist/client/assets/usePopupHandleStore-DimKo2Yy.js +1 -0
  336. package/dist/client/assets/usePopupViewport-YeqX_UM3.js +1 -0
  337. package/dist/client/assets/usePresentationTier-B9kCQ4YH.js +1 -0
  338. package/dist/client/assets/useProject-Kt74Z12J.js +1 -0
  339. package/dist/client/assets/useProviderOptionsUpdater-CTzNh2B7.js +2 -0
  340. package/dist/client/assets/usePullRequestFilesViewed-D5Snmzys.js +1 -0
  341. package/dist/client/assets/usePullRequestsModel-DJL5HHbP.js +40 -0
  342. package/dist/client/assets/useScrollLock-CLZ31xsK.js +1 -0
  343. package/dist/client/assets/useSidebarThreadActions-n6EkLATf.js +6 -0
  344. package/dist/client/assets/{useStatistics-B76_r68I.js → useStatistics-DD0mYS4J.js} +14 -14
  345. package/dist/client/assets/{useTheme-B441xg4F.js → useTheme-Bdy-BDs-.js} +1 -1
  346. package/dist/client/assets/useValueChanged-DoumqMnV.js +1 -0
  347. package/dist/client/assets/{user-round-CLy1Qy1Y.js → user-round-BPDXr8Gq.js} +1 -1
  348. package/dist/client/assets/{vennDiagram-T6HMQDX7-8iiroXim.js → vennDiagram-T6HMQDX7-B1UEn_j_.js} +1 -1
  349. package/dist/client/assets/{vscode-icons-CJBVQtq5.js → vscode-icons-Ccy-gzFN.js} +1 -1
  350. package/dist/client/assets/{wardley-WFR3VGLG-DpyNUbTc.js → wardley-WFR3VGLG-gPdyDc-7.js} +1 -1
  351. package/dist/client/assets/{wardleyDiagram-T6FBY63Y-CI7is3QO.js → wardleyDiagram-T6FBY63Y-2aDcwOA4.js} +1 -1
  352. package/dist/client/assets/workspaceLifecycle-OJ1aKksw.js +3 -0
  353. package/dist/client/assets/workspaceMetadataProjection-CyEyJhUa.js +1 -0
  354. package/dist/client/assets/workspaceRouteSearch-CCavUdbH.js +1 -0
  355. package/dist/client/assets/{wrench-7pbbxqrZ.js → wrench-CPUCA_rn.js} +1 -1
  356. package/dist/client/assets/wsTransport-C88seBPA.js +15 -0
  357. package/dist/client/assets/{xychartDiagram-ELKLHX3M-BTEX3m2y.js → xychartDiagram-ELKLHX3M-C1_7Q-1i.js} +1 -1
  358. package/dist/client/favicon.svg +1 -1
  359. package/dist/client/index.html +1 -1
  360. package/dist/collectUint8StreamText-BsLSgI8i.mjs +710 -0
  361. package/dist/collectUint8StreamText-D5olwfpM.cjs +757 -0
  362. package/dist/{deviceHostWorker-L8C9wy38.mjs → deviceHostWorker-B-Dn-6An.mjs} +1 -1
  363. package/dist/{makeManagedServerProvider-CF776SAO.cjs → makeManagedServerProvider-B5tP7tvg.cjs} +1 -1
  364. package/dist/{makeManagedServerProvider-B90UKjnv.mjs → makeManagedServerProvider-B65ipCxM.mjs} +2 -2
  365. package/dist/resource-monitor/linux-arm64/ryco-resource-monitor +0 -0
  366. package/dist/resource-monitor/ryco-resource-monitor +0 -0
  367. package/dist/resource-monitor/ryco-resource-monitor.exe +0 -0
  368. package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
  369. package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
  370. package/dist/{runtimeSession-V3RIy8Ao.mjs → runtimeSession-D_BZ-wRH.mjs} +1 -1
  371. package/dist/{src-CARHuYkT.cjs → src-FmeCeBJ9.cjs} +2291 -72
  372. package/dist/{src-CtsgPPhb.mjs → src-VTj60bUm.mjs} +1974 -61
  373. package/package.json +1 -1
  374. package/dist/AzureDevOpsSourceControlProvider-CKSvfuDS.cjs +0 -190
  375. package/dist/AzureDevOpsSourceControlProvider-DRWSXTml.mjs +0 -188
  376. package/dist/GitLabSourceControlProvider-Cj07OTBD.mjs +0 -186
  377. package/dist/GitLabSourceControlProvider-CvvN5pHt.cjs +0 -188
  378. package/dist/client/assets/AccountSettings-v6-r6gYl.js +0 -1
  379. package/dist/client/assets/AiFocusSettings-BVdLON0q.js +0 -1
  380. package/dist/client/assets/AppearanceSettings-DRChsQnN.js +0 -1
  381. package/dist/client/assets/BranchToolbar.logic-YN3KjVr9.js +0 -3
  382. package/dist/client/assets/BrowserPanel-Dxw3stFP.js +0 -1
  383. package/dist/client/assets/ChatRightPanel-CygpcJiF.js +0 -201
  384. package/dist/client/assets/ChatThreadRouteView-DYLZFHu0.js +0 -1
  385. package/dist/client/assets/CommandPaletteDialog-BRvBzP1R.js +0 -1
  386. package/dist/client/assets/CompositeRoot-BeEGGWwn.js +0 -1
  387. package/dist/client/assets/ComputerUseSettings-Cq8Pi0ZU.js +0 -1
  388. package/dist/client/assets/ConnectionsSettings-RSYtexxd.js +0 -7
  389. package/dist/client/assets/ContextHandoffEndpointLabel-CeGDLNA4.js +0 -4
  390. package/dist/client/assets/DiagnosticsSettings-CDa6MVx4.js +0 -2
  391. package/dist/client/assets/DialogHandle-BE7egDQQ.js +0 -1
  392. package/dist/client/assets/DialogRoot-C4mtzigX.js +0 -1
  393. package/dist/client/assets/DialogTitle-B_Q4DykI.js +0 -1
  394. package/dist/client/assets/DialogTrigger-BSqd4Crj.js +0 -1
  395. package/dist/client/assets/DraftChatThreadRouteView-JW_bXVrM.js +0 -1
  396. package/dist/client/assets/GlassSurface-DDG4eTlj.js +0 -1
  397. package/dist/client/assets/HostedConnectionControls-CscV6hm1.js +0 -1
  398. package/dist/client/assets/HostedHubRoot-gp7-ClBP.js +0 -2
  399. package/dist/client/assets/HostedNodeRenameDialog-D1DSiTpx.js +0 -1
  400. package/dist/client/assets/HostedRelayTrustNotice-B9jp4SRh.js +0 -1
  401. package/dist/client/assets/IntegrationsSettingsPanel-DH7SfWtV.js +0 -2
  402. package/dist/client/assets/KeybindingsSettings-DkgYYSHS.js +0 -7
  403. package/dist/client/assets/LazyBrowserPanel-D4e76vc_.js +0 -2
  404. package/dist/client/assets/McpServersSettings-Dc1kPa-X.js +0 -6
  405. package/dist/client/assets/MobileSheet-lT--mLEz.js +0 -1
  406. package/dist/client/assets/NodeSecuritySettings-DcfSx4KT.js +0 -1
  407. package/dist/client/assets/NullStore-8d2s-Re3.js +0 -1
  408. package/dist/client/assets/OnboardingDialog-CnLjwM6Z.js +0 -1
  409. package/dist/client/assets/OpinionatedPluginsSettings-BTJyS3rN.js +0 -1
  410. package/dist/client/assets/PhoneHome-CIMkuDJF.js +0 -1
  411. package/dist/client/assets/PhoneSettingsSurface-CfZQxJNI.js +0 -2
  412. package/dist/client/assets/ProvidersSettingsPanel-DAVSiwE1.js +0 -1
  413. package/dist/client/assets/RedactedSensitiveText-BHGbQJwB.js +0 -1
  414. package/dist/client/assets/RootAppShell-T056pByH.js +0 -7
  415. package/dist/client/assets/SettingsDialog-BERU2Qg7.js +0 -2
  416. package/dist/client/assets/SettingsPanels-De_XZOQF.js +0 -3
  417. package/dist/client/assets/SettingsPanels.editor-Dkva9gX_.js +0 -2
  418. package/dist/client/assets/SourceControlSettings-B4HS17cB.js +0 -1
  419. package/dist/client/assets/StatisticsPage-Bj2ftFdH.js +0 -1
  420. package/dist/client/assets/StatisticsPanel-Dw7GBBmd.js +0 -1
  421. package/dist/client/assets/StatisticsSettingsLink-_XL3ABoI.js +0 -1
  422. package/dist/client/assets/ThreadTerminalDrawer-CPPzQSXN.js +0 -18
  423. package/dist/client/assets/ThreadWorkspacePanel-DWKU7Omm.js +0 -2073
  424. package/dist/client/assets/appChrome-TkWLAGxk.js +0 -1
  425. package/dist/client/assets/architecture-7GRP2DOG-HS59zfrk.js +0 -1
  426. package/dist/client/assets/authorization-D8dOcEYq.js +0 -1
  427. package/dist/client/assets/badge-2AZ3HfVS.js +0 -1
  428. package/dist/client/assets/capabilities-CsHjxjab.js +0 -1
  429. package/dist/client/assets/channel-Dn3_cOkm.js +0 -1
  430. package/dist/client/assets/chevron-right-Dsw16yGn.js +0 -1
  431. package/dist/client/assets/classDiagram-JCYQIIEL-ZQvrS8No.js +0 -1
  432. package/dist/client/assets/classDiagram-v2-OCEON4UE-ZQvrS8No.js +0 -1
  433. package/dist/client/assets/compiler-runtime-C4g8XhC5.js +0 -1
  434. package/dist/client/assets/desktopWorkspace-_iM6B9Kf.js +0 -1
  435. package/dist/client/assets/editorPreferences-D8q1ItMW.js +0 -1
  436. package/dist/client/assets/eventmodeling-NTZA5JFV-Dj71kuPV.js +0 -1
  437. package/dist/client/assets/flowDiagram-UKHOOZJN-BaAiwuvL.js +0 -1
  438. package/dist/client/assets/hostedConnectionCoordinator-BuRWCvUG.js +0 -1
  439. package/dist/client/assets/hubRoutes-jcMPIFy3.js +0 -1
  440. package/dist/client/assets/kbd-Dxm5Elqj.js +0 -1
  441. package/dist/client/assets/layers-Dqez1Uq8.js +0 -1
  442. package/dist/client/assets/liquidGlass-CA2o_Cq0.js +0 -1
  443. package/dist/client/assets/liquidGlass.worker-icvLJKHf.js +0 -1
  444. package/dist/client/assets/main-BqSANuAs.css +0 -2
  445. package/dist/client/assets/main-DAbEANjY.js +0 -9
  446. package/dist/client/assets/motion-BdscFixQ.js +0 -1
  447. package/dist/client/assets/palette-92ylWqeC.js +0 -1
  448. package/dist/client/assets/perfInstrumentation-BT27w4tn.js +0 -1
  449. package/dist/client/assets/presentationTier-xlIjcFab.js +0 -1
  450. package/dist/client/assets/primary-DZjgHvyf.js +0 -5
  451. package/dist/client/assets/providerDriverMeta-T2YbXzuS.js +0 -1
  452. package/dist/client/assets/providerStatus-DBGvvkyF.js +0 -1
  453. package/dist/client/assets/radio-group-CRnHYWa8.js +0 -1
  454. package/dist/client/assets/railroad-abnf-HS5TGJTU-DxU7Mt1k.js +0 -1
  455. package/dist/client/assets/railroad-ebnf-LZEXJU2U-BYAPVjRd.js +0 -1
  456. package/dist/client/assets/railroad-peg-WCYAUIDC-BOqgR_X7.js +0 -1
  457. package/dist/client/assets/runtime-BwHA1GUS.js +0 -18
  458. package/dist/client/assets/scroll-area-7n2X_RLQ.js +0 -1
  459. package/dist/client/assets/separator-CL1qjMqJ.js +0 -1
  460. package/dist/client/assets/settingsLayout-DxsFwhF0.js +0 -1
  461. package/dist/client/assets/sheet-CGiaw8-i.js +0 -1
  462. package/dist/client/assets/sidebar-Cc6ANbOP.js +0 -1
  463. package/dist/client/assets/sidebarProjectFolders-DO2Uv84F.js +0 -4
  464. package/dist/client/assets/sidebarStatusText-B4AtFXZo.js +0 -1
  465. package/dist/client/assets/sidebarUndo-gdSrfa4O.js +0 -1
  466. package/dist/client/assets/square-Cr9X8U6y.js +0 -1
  467. package/dist/client/assets/src-C3Y_imaX.js +0 -14
  468. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CWtHILqh.js +0 -1
  469. package/dist/client/assets/storeSelectors-CTDWheMy.js +0 -1
  470. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DuaPce9O.js +0 -8
  471. package/dist/client/assets/switch-DnpJB2xv.js +0 -48
  472. package/dist/client/assets/toggle-D10FsFoE.js +0 -1
  473. package/dist/client/assets/toggle-group-BhzbQPEQ.js +0 -1
  474. package/dist/client/assets/tooltip-BlweKBxc.js +0 -1
  475. package/dist/client/assets/usage-BBwaxMif.js +0 -1
  476. package/dist/client/assets/useAppSidebarCollapsed-CFy476E3.js +0 -1
  477. package/dist/client/assets/useAppearancePreference-Dlh9P8iu.js +0 -1
  478. package/dist/client/assets/useBaseUiId-DKOjzmu3.js +0 -1
  479. package/dist/client/assets/useLabelableId-DQbY2GG1.js +0 -1
  480. package/dist/client/assets/useNavigate-B8oXtF30.js +0 -1
  481. package/dist/client/assets/usePhoneThreadActions-6DCLiyJ5.js +0 -1
  482. package/dist/client/assets/usePopupViewport-CNWcP7Od.js +0 -1
  483. package/dist/client/assets/usePresentationTier-hxB7Yv_Q.js +0 -1
  484. package/dist/client/assets/useScrollLock-BbKeKZdj.js +0 -1
  485. package/dist/client/assets/useTriggerFocusGuards-BC4Wb3GI.js +0 -1
  486. package/dist/client/assets/useValueChanged-BkTbyZdO.js +0 -1
  487. package/dist/client/assets/workspaceMetadataProjection-aqZEXDrQ.js +0 -1
  488. package/dist/collectUint8StreamText-BAUF-vzz.mjs +0 -37
  489. package/dist/collectUint8StreamText-vagpNUMJ.cjs +0 -42
  490. package/dist/git-9xWsJYIH.mjs +0 -132
  491. package/dist/git-xIkXFy_l.cjs +0 -218
  492. package/dist/sourceControl-B0D1Op29.cjs +0 -253
  493. package/dist/sourceControl-BiEBxN01.mjs +0 -224
@@ -0,0 +1 @@
1
+ import{$i as e,ad as t,ol as n}from"./runtime-DjjjAcTE.js";import{i as r}from"./presentationTier-DPVAxTK4.js";import{r as i}from"./input-CCie4mm1.js";var a=r(),o=t();function s(t){let r=(0,a.c)(15),s,c,l,u;r[0]===t?(s=r[1],c=r[2],l=r[3],u=r[4]):({className:s,size:l,unstyled:u,...c}=t,r[0]=t,r[1]=s,r[2]=c,r[3]=l,r[4]=u);let d=l===void 0?`default`:l,f=u!==void 0&&u,p;r[5]!==s||r[6]!==f?(p=e(!f&&`relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]`,s)||void 0,r[5]=s,r[6]=f,r[7]=p):p=r[7];let m;r[8]!==c||r[9]!==d?(m=(0,o.jsx)(i,{render:t=>(0,o.jsx)(`textarea`,{className:e(`field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5`,d===`sm`&&`min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5`,d===`lg`&&`min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5`),"data-slot":`textarea`,...n(t,c)})}),r[8]=c,r[9]=d,r[10]=m):m=r[10];let h;return r[11]!==d||r[12]!==p||r[13]!==m?(h=(0,o.jsx)(`span`,{className:p,"data-size":d,"data-slot":`textarea-control`,children:m}),r[11]=d,r[12]=p,r[13]=m,r[14]=h):h=r[14],h}export{s as t};
@@ -0,0 +1 @@
1
+ import{p as e}from"./runtime-DjjjAcTE.js";var t=6e5,n=1e3;function r(e){return e.connected&&e.supported}function i(e){let i={enabled:!1,intervalMs:t},a=e.initialForeground??!0,o=null,s=null,c=!1,l=new Map,u=new Map,d=new Map,f=()=>{o!==null&&e.timer.clear(o),o=null},p=()=>{s!==null&&e.timer.clear(s),s=null},m=t=>e.listEnvironments().find(e=>e.environmentId===t),h=(e,t)=>{let n=e.get(t.environmentId);return n?.generation===t.generation?n.atMs:null},g=e=>{let t=h(l,e),n=e.lastSuccessfulCheckAtMs;return t===null?n??null:n===void 0?t:Math.max(t,n)},_=(e,t)=>{if(i.intervalMs===0)return!1;let n=g(e);return n===null||t-n>=i.intervalMs},v=(t,n,i)=>{let a=d.get(t.environmentId);if(a?.generation===t.generation)return a.run;let o=e.nowMs();n||u.set(t.environmentId,{generation:t.generation,atMs:o});let s=e.ensureCurrent(t.environmentId,{force:n}).then(()=>{let n=m(t.environmentId);!c&&n!==void 0&&n.generation===t.generation&&r(n)&&l.set(t.environmentId,{generation:t.generation,atMs:e.nowMs()})}).catch(n=>{throw i&&e.onAutomaticFailure?.(t.environmentId,n),n}).finally(()=>{d.get(t.environmentId)?.run===s&&d.delete(t.environmentId)});return d.set(t.environmentId,{generation:t.generation,run:s}),s},y=async t=>{if(c||!i.enabled||!a)return;let n=e.nowMs(),o=e.listEnvironments().filter(r);await Promise.allSettled(o.flatMap(e=>{if(t.onlyStale&&!_(e,n))return[];let r=h(u,e);return!t.initial&&i.intervalMs>0&&r!==null&&n-r<i.intervalMs?[]:[v(e,!1,!0)]}))},b=()=>{if(f(),c||!i.enabled||!a||i.intervalMs===0)return;let t=e.nowMs(),n=e.listEnvironments().filter(r).map(e=>{let n=g(e),r=h(u,e),a=n===null?r:r===null?n:Math.max(n,r);return a===null?0:Math.max(0,i.intervalMs-(t-a))}),s=n.length===0?i.intervalMs:Math.min(...n);o=e.timer.set(()=>{o=null,y({onlyStale:!0,initial:!1}).finally(b)},s)};return{configure:async e=>{if(c)return;let t=!i.enabled&&e.enabled;if(i=e,!i.enabled){f(),p();return}t&&a&&await y({onlyStale:!1,initial:!0}),b()},setForeground:async e=>{if(!(c||a===e)){if(a=e,!a){f(),p();return}i.enabled&&i.intervalMs>0&&await y({onlyStale:!0,initial:!1}),b()}},environmentsChanged:async()=>{!c&&i.enabled&&a&&(i.intervalMs>0&&await y({onlyStale:!0,initial:!1}),b())},relevantInputChanged:()=>{!c&&i.enabled&&a&&i.intervalMs!==0&&(p(),s=e.timer.set(()=>{s=null,y({onlyStale:!0,initial:!1}).finally(b)},n))},refreshNow:async()=>{let t=e.listEnvironments().filter(r),n=await Promise.allSettled(t.map(e=>v(e,!0,!1))),i=[],a=[];return n.forEach((e,n)=>{let r=t[n].environmentId;e.status===`fulfilled`?i.push(r):a.push({environmentId:r,error:e.reason})}),b(),{attempted:t.map(e=>e.environmentId),succeeded:i,failures:a}},getLastSuccessfulCheckAtMs:e=>{let t=m(e);return t===void 0?null:g(t)},dispose:()=>{c=!0,f(),p(),d.clear()}}}var a=new WeakMap;function o(e,t){let n=a.get(e);if(n!==void 0)return n;let r=i(t),o={...r,dispose:()=>{r.dispose(),a.get(e)===o&&a.delete(e)}};return a.set(e,o),o}var s={},c=[],l=o(s,{nowMs:Date.now,timer:{set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)},listEnvironments:()=>c,ensureCurrent:async(t,n)=>{let r=e(t);if(!r)throw Error(`The environment is no longer connected.`);return await r.client.threadPriority.ensureCurrent(n)}});function u(e){c=e}async function d(e){await l.configure(e)}async function f(){await l.environmentsChanged()}function p(){l.relevantInputChanged()}async function m(e){await l.setForeground(e)}async function h(){return await l.refreshNow()}export{m as a,h as i,f as n,u as o,p as r,d as t};
@@ -0,0 +1 @@
1
+ function e(){return typeof window>`u`?null:window}function t(){return typeof document>`u`?null:document}function n({intervalMs:n,windowTarget:r=e(),documentTarget:i=t(),now:a=Date.now}){let o=new Set,s=null,c=!1,l=()=>i?.visibilityState!==`hidden`,u=()=>{let e=a();for(let t of o)t(e)},d=()=>{s!==null&&r&&(r.clearInterval(s),s=null)},f=()=>{s===null&&r&&o.size!==0&&l()&&(s=r.setInterval(u,n))},p=()=>{if(!l()){d();return}u(),f()},m=()=>{!c&&i&&(i.addEventListener(`visibilitychange`,p),c=!0)},h=()=>{c&&i&&(i.removeEventListener(`visibilitychange`,p),c=!1)};return{subscribe(e){o.add(e),m(),e(a()),f();let t=!1;return()=>{t||(t=!0,o.delete(e),o.size===0&&(d(),h()))}}}}var r=n({intervalMs:1e3});export{r as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./arc-BbkdAXW7.js";import{p as t}from"./chunk-NSK5VX7P-DuRkdn5k.js";import{n,t as r}from"./src-BISxbUej.js";import{n as i,t as a}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{J as o,a as s,b as c,et as l,o as u,rt as d,tt as f,x as p}from"./chunk-I66GZJ75-BO6p4Aqg.js";import{a as m}from"./mermaidEngine-DksLcesB.js";var h=(function(){var e=i(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],r=[1,13],a=[1,14],o=[1,15],s=[1,16],c=[1,19],l=[1,20],u={trace:i(function(){},`trace`),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:`error`,6:`EOF`,7:`timeline`,8:`timeline_lr`,9:`timeline_td`,11:`SPACE`,13:`NEWLINE`,14:`title`,15:`acc_title`,16:`acc_title_value`,17:`acc_descr`,18:`acc_descr_value`,19:`acc_descr_multiline_value`,20:`section`,23:`period`,24:`event`},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:i(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 3:r.setDirection(`LR`);break;case 4:r.setDirection(`TD`);break;case 5:this.$=[];break;case 6:a[s-1].push(a[s]),this.$=a[s-1];break;case 7:case 8:this.$=a[s];break;case 9:case 10:this.$=[];break;case 11:r.getCommonDb().setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 12:this.$=a[s].trim(),r.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=a[s].trim(),r.getCommonDb().setAccDescription(this.$);break;case 15:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 18:r.addTask(a[s],0,``),this.$=a[s];break;case 19:r.addEvent(a[s].substr(2)),this.$=a[s]}},`anonymous`),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:r,17:a,19:o,20:s,21:17,22:18,23:c,24:l},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:r,17:a,19:o,20:s,21:17,22:18,23:c,24:l},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:i(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:i(function(e){var t=this,n=[0],r=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){n.length-=2*e,a.length-=e,o.length-=e}i(b,`popStack`);function x(){var e=r.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(r=e,e=r.pop()),e=t.symbols_[e]||e),e}i(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=n[n.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{t as e}from"./arc-BbkdAXW7.js";import{p as t}from"./chunk-NSK5VX7P-DGo5UczH.js";import{n,t as r}from"./src-BISxbUej.js";import{n as i,t as a}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{J as o,a as s,b as c,et as l,o as u,rt as d,tt as f,x as p}from"./chunk-I66GZJ75-CXSn8dDu.js";import{a as m}from"./mermaidEngine-Dr8UsPhH.js";var h=(function(){var e=i(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],r=[1,13],a=[1,14],o=[1,15],s=[1,16],c=[1,19],l=[1,20],u={trace:i(function(){},`trace`),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:`error`,6:`EOF`,7:`timeline`,8:`timeline_lr`,9:`timeline_td`,11:`SPACE`,13:`NEWLINE`,14:`title`,15:`acc_title`,16:`acc_title_value`,17:`acc_descr`,18:`acc_descr_value`,19:`acc_descr_multiline_value`,20:`section`,23:`period`,24:`event`},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:i(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 3:r.setDirection(`LR`);break;case 4:r.setDirection(`TD`);break;case 5:this.$=[];break;case 6:a[s-1].push(a[s]),this.$=a[s-1];break;case 7:case 8:this.$=a[s];break;case 9:case 10:this.$=[];break;case 11:r.getCommonDb().setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 12:this.$=a[s].trim(),r.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=a[s].trim(),r.getCommonDb().setAccDescription(this.$);break;case 15:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 18:r.addTask(a[s],0,``),this.$=a[s];break;case 19:r.addEvent(a[s].substr(2)),this.$=a[s]}},`anonymous`),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:r,17:a,19:o,20:s,21:17,22:18,23:c,24:l},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:r,17:a,19:o,20:s,21:17,22:18,23:c,24:l},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:i(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:i(function(e){var t=this,n=[0],r=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){n.length-=2*e,a.length-=e,o.length-=e}i(b,`popStack`);function x(){var e=r.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(r=e,e=r.pop()),e=t.symbols_[e]||e),e}i(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=n[n.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:n.push(S),a.push(h.yytext),o.push(h.yylloc),n.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(n=n.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),n.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[n[n.length-2]][n[n.length-1]],n.push(A);break;case 3:return!0}}return!0},`parse`)};u.lexer=(function(){return{EOF:1,parseError:i(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:i(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:i(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:i(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:i(function(){return this._more=!0,this},`more`),reject:i(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:i(function(e){this.unput(this.match.slice(e))},`less`),pastInput:i(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:i(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:i(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$i as t,Bc as n,ad as r,al as i,fs as a,hc as o,jc as s}from"./runtime-DjjjAcTE.js";import{t as c}from"./react-CwJFpaho.js";import{E as l}from"./popover-OWEv6cQz.js";import{i as u}from"./presentationTier-DPVAxTK4.js";import{n as d}from"./NullStore-gT_6_xZE.js";import{t as f}from"./useControlled-CgAAWIy9.js";var p=e(c(),1),m=p.createContext(void 0);function h(){return p.useContext(m)}var g=r(),_=p.forwardRef(function(e,t){let{className:r,defaultPressed:a=!1,disabled:c=!1,form:u,onPressedChange:m,pressed:_,render:v,type:y,value:b,nativeButton:x=!0,style:S,...C}=e,w=d(b||void 0),T=h(),E=T?.value??[],D=(c||T?.disabled)??!1,[O,k]=f({controlled:T?w!==void 0&&E.indexOf(w)>-1:_,default:a,name:`Toggle`,state:`pressed`}),{getButtonProps:A,buttonRef:j}=n({disabled:D,native:x}),M={disabled:D,pressed:O},N=[j,t],P=[{"aria-pressed":O,onClick(e){let t=!O,n=o(s,e.nativeEvent);m?.(t,n),!n.isCanceled&&(w&&T?.setGroupValue?.(w,t,n),!n.isCanceled&&k(t))}},C,A],F=i(`button`,e,{enabled:!T,state:M,ref:N,props:P}),I=p.useMemo(()=>({disabled:D,focusableWhenDisabled:!1}),[D]);return T?(0,g.jsx)(l,{tag:`button`,render:v,className:r,style:S,metadata:I,state:M,refs:N,props:P}):F}),v=u(),y=a(`[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer select-none items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base text-foreground outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:top-1/2 pointer-coarse:after:left-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 data-pressed:bg-input/64 data-pressed:text-accent-foreground sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-9 min-w-9 px-[calc(--spacing(2)-1px)] sm:h-8 sm:min-w-8`,lg:`h-10 min-w-10 px-[calc(--spacing(2.5)-1px)] sm:h-9 sm:min-w-9`,sm:`h-8 min-w-8 px-[calc(--spacing(1.5)-1px)] sm:h-7 sm:min-w-7`,xs:`h-7 min-w-7 px-[calc(--spacing(1)-1px)] sm:h-6 sm:min-w-6 rounded-md`},variant:{default:`border-transparent`,outline:`border-input bg-background not-dark:bg-clip-padding shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:data-pressed:bg-input dark:hover:bg-input/64 dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] dark:not-disabled:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/2%)] [:disabled,:active,[data-pressed]]:shadow-none`}}});function b(e){let n=(0,v.c)(12),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,variant:o,size:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==r||n[6]!==a||n[7]!==o?(s=t(y({className:r,size:a,variant:o})),n[5]=r,n[6]=a,n[7]=o,n[8]=s):s=n[8];let c;return n[9]!==i||n[10]!==s?(c=(0,g.jsx)(_,{className:s,"data-slot":`toggle`,...i}),n[9]=i,n[10]=s,n[11]=c):c=n[11],c}export{m as n,b as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$i as t,Ku as n,Lu as r,ad as i,al as a}from"./runtime-DjjjAcTE.js";import{t as o}from"./react-CwJFpaho.js";import{i as s}from"./presentationTier-DPVAxTK4.js";import{t as c}from"./ToolbarRootContext-8FsV9Cpj.js";import{t as l}from"./useControlled-CgAAWIy9.js";import{t as u}from"./CompositeRoot-DtnwMJKj.js";import{n as d,t as f}from"./toggle-DFqtCPt-.js";import"./separator-CO8bC7Wc.js";var p=e(o(),1),m=p.createContext(void 0);function h(){return p.useContext(m)}var g=i(),_=p.forwardRef(function(e,t){let{defaultValue:i,disabled:o=!1,loopFocus:s=!0,onValueChange:f,orientation:m=`horizontal`,multiple:_=!1,value:v,className:y,render:b,style:x,...S}=e,C=c(!0),w=h(),T=i??n,E=v!==void 0||i!==void 0,D=(C?.disabled??!1)||(w?.disabled??!1)||o,[O,k]=l({controlled:v,default:T,name:`ToggleGroup`,state:`value`}),A=r((e,t,n)=>{let r;_?(r=O.slice(),t?r.push(e):r.splice(O.indexOf(e),1)):r=t?[e]:[],f?.(r,n),!n.isCanceled&&k(r)}),j={disabled:D,multiple:_,orientation:m},M=p.useMemo(()=>({disabled:D,setGroupValue:A,value:O,isValueInitialized:E}),[D,A,O,E]),N={role:`group`},P=a(`div`,e,{enabled:!!C,state:j,ref:t,props:[N,S]});return(0,g.jsx)(d.Provider,{value:M,children:C?P:(0,g.jsx)(u,{render:b,className:y,style:x,state:j,refs:[t],props:[N,S],loopFocus:s,enableHomeAndEndKeys:!0,orientation:m})})}),v=s(),y=p.createContext({size:`default`,variant:`default`});function b(e){let n=(0,v.c)(24),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({className:i,variant:o,size:s,orientation:c,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=o===void 0?`default`:o,u=s===void 0?`default`:s,d=c===void 0?`horizontal`:c,f;n[7]!==u||n[8]!==l?(f={size:u,variant:l},n[7]=u,n[8]=l,n[9]=f):f=n[9];let p=f,m=d===`horizontal`?`*:pointer-coarse:after:min-w-auto`:`*:pointer-coarse:after:min-h-auto`,h=l==="default"?`gap-0.5`:d===`horizontal`?`*:not-first:not-data-[slot=separator]:before:-start-[0.5px] *:not-last:not-data-[slot=separator]:before:-end-[0.5px] *:not-first:rounded-s-none *:not-last:rounded-e-none *:not-first:border-s-0 *:not-last:border-e-0 *:not-first:before:rounded-s-none *:not-last:before:rounded-e-none`:`*:not-first:not-data-[slot=separator]:before:-top-[0.5px] *:not-last:not-data-[slot=separator]:before:-bottom-[0.5px] flex-col *:not-first:rounded-t-none *:not-last:rounded-b-none *:not-first:border-t-0 *:not-last:border-b-0 *:not-first:before:rounded-t-none *:not-last:before:rounded-b-none *:data-[slot=toggle]:not-last:before:hidden dark:*:last:before:hidden dark:*:first:before:block`,b;n[10]!==i||n[11]!==m||n[12]!==h?(b=t(`flex w-fit *:focus-visible:z-10 dark:*:[[data-slot=separator]:has(+[data-slot=toggle]:hover)]:before:bg-input/64 dark:*:[[data-slot=separator]:has(+[data-slot=toggle][data-pressed])]:before:bg-input dark:*:[[data-slot=toggle]:hover+[data-slot=separator]]:before:bg-input/64 dark:*:[[data-slot=toggle][data-pressed]+[data-slot=separator]]:before:bg-input`,m,h,i),n[10]=i,n[11]=m,n[12]=h,n[13]=b):b=n[13];let x;n[14]!==r||n[15]!==p?(x=(0,g.jsx)(y.Provider,{value:p,children:r}),n[14]=r,n[15]=p,n[16]=x):x=n[16];let S;return n[17]!==d||n[18]!==a||n[19]!==u||n[20]!==b||n[21]!==x||n[22]!==l?(S=(0,g.jsx)(_,{className:b,"data-size":u,"data-slot":`toggle-group`,"data-variant":l,orientation:d,...a,children:x}),n[17]=d,n[18]=a,n[19]=u,n[20]=b,n[21]=x,n[22]=l,n[23]=S):S=n[23],S}function x(e){let t=(0,v.c)(12),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:o,size:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=p.useContext(y),c=o??s.variant,l=a??s.size,u;return t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==l||t[10]!==c?(u=(0,g.jsx)(f,{className:r,"data-size":l,"data-variant":c,size:l,variant:c,...i,children:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=l,t[10]=c,t[11]=u):u=t[11],u}export{b as n,x as t};
@@ -1 +1 @@
1
- import{ho as e}from"./runtime-BwHA1GUS.js";var t={name:`circle-off`,size:24,node:[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.35 2.69A10 10 0 0 1 21.3 15.65`,key:`1pfsoa`}],[`path`,{d:`M19.08 19.08A10 10 0 1 1 4.92 4.92`,key:`1ablyi`}]]};t.node;var n=e(t),r={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};r.node;var i=e(r),a={name:`scale`,size:24,node:[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]};a.node;var o=e(a),s={off:{label:`Off`,triggerLabel:`Tokens off`,description:`Do not add Ryco token-efficiency instructions.`,icon:n},balanced:{label:`Balanced`,triggerLabel:`Balanced`,description:`Favor concise answers and targeted reads without hiding important detail.`,icon:o},aggressive:{label:`Aggressive`,triggerLabel:`Aggressive`,description:`Minimize prose and avoid copying large outputs unless needed.`,icon:i}},c=Object.keys(s);export{s as n,i as r,c as t};
1
+ import{ws as e}from"./runtime-DjjjAcTE.js";var t={name:`circle-off`,size:24,node:[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.35 2.69A10 10 0 0 1 21.3 15.65`,key:`1pfsoa`}],[`path`,{d:`M19.08 19.08A10 10 0 1 1 4.92 4.92`,key:`1ablyi`}]]};t.node;var n=e(t),r={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};r.node;var i=e(r),a={name:`scale`,size:24,node:[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]};a.node;var o=e(a),s={off:{label:`Off`,triggerLabel:`Tokens off`,description:`Do not add Ryco token-efficiency instructions.`,icon:n},balanced:{label:`Balanced`,triggerLabel:`Balanced`,description:`Favor concise answers and targeted reads without hiding important detail.`,icon:o},aggressive:{label:`Aggressive`,triggerLabel:`Aggressive`,description:`Minimize prose and avoid copying large outputs unless needed.`,icon:i}},c=Object.keys(s);export{s as n,i as r,c as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$i as t,Al as n,Au as r,Gl as i,Gs as a,Hu as o,Iu as s,Ju as c,Ks as l,Lc as u,Lu as d,Rc as f,Ru as p,Su as m,Ul as h,Uu as g,ad as _,al as v,dc as y,el as b,hc as x,jc as S,ku as C,lu as w,ol as T,ql as E,qs as D,qu as O,tc as k,tl as A,uc as j,uu as M,vu as N,wc as ee,xc as te,yu as ne,zu as P}from"./runtime-DjjjAcTE.js";import{t as F}from"./react-CwJFpaho.js";import{i as re}from"./presentationTier-DPVAxTK4.js";import{a as I,b as L,d as R,f as z,g as ie,i as B,m as V,n as ae,o as H,p as U,r as W,s as G,t as K,x as q}from"./NullStore-gT_6_xZE.js";import{a as J,i as oe,n as se,r as Y,t as ce}from"./safePolygon-C1AzMRS4.js";import{t as le}from"./usePopupHandleStore-DimKo2Yy.js";import{t as ue}from"./useFocus-CV0KIZwg.js";import{n as de,t as fe}from"./usePopupViewport-YeqX_UM3.js";var X=e(F(),1),Z=_(),pe=X.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new N,currentIdRef:{current:null},currentContextRef:{current:null}});function me(e,t){e.current=t.current}function he(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=X.useRef(n),a=X.useRef(n),o=X.useRef(null),s=X.useRef(null),c=ne();return g(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:J(i.current,`open`),close:J(n,`close`)}},[n,o,i,a]),(0,Z.jsx)(pe.Provider,{value:X.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function ge(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=X.useContext(pe),[f,p]=X.useState(!1),m=X.useRef(n);return g(()=>{m.current=n},[n]),g(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),g(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:J(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,x(S))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),g(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,me(o,c),d.clear()}},[l,a,o,i,c,d]),X.useMemo(()=>({activeIdRef:a,hasProvider:u,delayRef:o,isInstantPhase:f}),[a,u,o,f])}function _e(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function ve(e){return e!=null&&e.clientX!=null}function ye(e,t={}){let{enabled:r=!0,axis:i=`both`}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),l=a.context.dataRef,u=X.useRef(!1),f=X.useRef(null),[p,h]=X.useState(),[g,_]=X.useState([]),v=d(e=>{a.set(`positionReference`,e)}),y=d((e,t,n)=>{u.current||(!l.current.openEvent||ve(l.current.openEvent))&&a.set(`positionReference`,_e(n??c,{x:e,y:t,axis:i,dataRef:l,pointerType:p}))}),b=d(e=>{o?f.current||(y(e.clientX,e.clientY,e.currentTarget),_([])):y(e.clientX,e.clientY,e.currentTarget)}),x=n(p)?s:o;X.useEffect(()=>{if(!r){v(c);return}if(!x)return;function e(){f.current?.(),f.current=null}let t=C(s);function n(t){let n=M(t);w(s,n)?e():y(t.clientX,t.clientY)}return!l.current.openEvent||ve(l.current.openEvent)?f.current=m(t,`mousemove`,n):v(c),e},[x,r,s,l,c,a,y,v,g]),X.useEffect(()=>()=>{a.set(`positionReference`,null)},[a]),X.useEffect(()=>{r&&!s&&(u.current=!1)},[r,s]),X.useEffect(()=>{!r&&o&&(u.current=!0)},[r,o]);let S=X.useMemo(()=>{function e(e){h(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:b,onMouseEnter:b}},[b]);return X.useMemo(()=>r?{reference:S,trigger:S}:{},[r,S])}var be=X.createContext(void 0);function Q(e){let t=X.useContext(be);if(t===void 0&&!e)throw Error(o(72));return t}var xe={...B,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Se=class extends s{constructor(e,t,n){let r=new k;super(we(e,r,t,n),Te(r),xe)}setOpen=(e,t)=>{G(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,x(f,e))}};function Ce(){let e=new k,t=new K(Object.freeze(we(void 0,e)),Object.freeze(Te(e)),xe);return Object.assign(t,{setOpen:c,cancelPendingOpen:c})}function we(e,t,n,r=!1){return{...W(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function Te(e){return{popupRef:X.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var Ee=p(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=V((e,t)=>new Se({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,_=p.useState(`activeTriggerId`),v=p.useState(`mounted`),y=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),R(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:b,transitionStatus:S}=z(h,p),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=X.useRef(null);g(()=>{m&&t&&p.setOpen(!1,x(te))},[m,t,p]),g(()=>{S===`ending`&&T===`none`||S!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[S,C,T,w,p]),g(()=>{h&&(_??p.set(`payload`,void 0))},[p,_,h]),X.useImperativeHandle(o,()=>({unmount:b,close:()=>p.setOpen(!1,x(ee))}),[b,p]);let D=h||v||!t&&a!==`none`;return(0,Z.jsxs)(be.Provider,{value:p,children:[l&&(0,Z.jsx)(H,{handle:l,store:p}),D&&(0,Z.jsx)(De,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:y}):f]})});function De({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=q(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=ye(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=X.useMemo(()=>T(a.reference,i.reference),[a.reference,i.reference]);return U(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??O}),null}var Oe=X.createContext(void 0);function ke(){return X.useContext(Oe)}var Ae=`data-base-ui-tooltip-trigger`;function je(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(r(n))return n}}let t=e.target;return r(t)?t:null}function Me(e){let t=e;for(;t;){let e=t.closest(`[${Ae}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&r(n.host)?n.host:null}return null}var Ne=P(function(e,t){let{render:r,className:i,style:a,handle:s,payload:c,disabled:l,delay:d,closeOnClick:f=!0,closeDelay:p,id:m,...g}=e,_=Q(!0),y=le(s)??_;if(!y)throw Error(o(82));let b=ae(m),S=y.useState(`isTriggerActive`,b),C=y.useState(`isOpenedByTrigger`,b),T=y.useState(`floatingRootContext`),D=X.useRef(null),O=p??0,{registerTrigger:k,isMountedByThisTrigger:A}=ie(b,D,y,{payload:c,closeOnClick:f,closeDelay:O}),M=ke(),{activeIdRef:N,delayRef:ee,isInstantPhase:te,hasProvider:P}=ge(T,{open:C}),F=oe(T);y.useSyncedValue(`isInstantPhase`,te);let re=y.useState(`disabled`),I=l??re,L=j(I),R=y.useState(`trackCursorAxis`),z=y.useState(`disableHoverablePopup`),B=X.useRef(!1),V=ne(),H=X.useRef(void 0);function U(){return P&&N.current!=null?0:d??M??600}function W(e){let t=D.current;if(!t||!e)return!1;let n=Me(e);return n!==null&&n!==t&&w(t,n)}function G(e){let t=W(e);return B.current=t,t&&(F.openChangeTimeout.clear(),F.restTimeout.clear(),F.restTimeoutPending=!1,V.clear()),t}let K=se(T,{enabled:!I,mouseOnly:!0,move:!1,handleClose:!z&&R!==`both`?ce():null,restMs:U,delay(){return p==null&&P?{close:J(ee.current,`close`)}:{close:O}},triggerElementRef:D,isActiveTrigger:S,isClosing:()=>y.select(`transitionStatus`)===`ending`,shouldOpen(){return!B.current}}),q=ue(T,{enabled:!I}).reference,Y=e=>{let t=B.current,r=je(e),i=G(r),a=D.current,o=a&&r&&w(a,r);if(i&&y.select(`open`)&&y.select(`lastOpenChangeReason`)===`trigger-hover`){y.setOpen(!1,x(u,e));return}if(t&&!i&&o&&!L.current&&!y.select(`open`)&&a&&n(H.current)){let t=()=>{!B.current&&!L.current&&!y.select(`open`)&&y.setOpen(!0,x(u,e,a))},n=U();n===0?(V.clear(),t()):V.start(n,t)}},de=y.useState(`triggerProps`,A);return v(`button`,e,{state:{open:C},ref:[t,k,D],props:[K,q,A||R!==`none`?de:void 0,{onMouseOver(e){Y(e.nativeEvent)},onFocus(e){W(je(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){B.current=!1,V.clear(),H.current=void 0},onPointerEnter(e){H.current=e.pointerType},onPointerDown(e){H.current=e.pointerType,y.set(`closeOnClick`,f),f&&!y.select(`open`)&&y.cancelPendingOpen(e.nativeEvent)},onClick(e){f&&!y.select(`open`)&&y.cancelPendingOpen(e.nativeEvent)},id:b,[h]:I?``:void 0,[Ae]:I?void 0:``},g],stateAttributesMapping:E})}),Pe=X.createContext(void 0);function Fe(){let e=X.useContext(Pe);if(e===void 0)throw Error(o(70));return e}var Ie=X.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Q().useState(`mounted`)||n?(0,Z.jsx)(Pe.Provider,{value:n,children:(0,Z.jsx)(y,{ref:t,...r})}):null}),Le=X.createContext(void 0);function $(){let e=X.useContext(Le);if(e===void 0)throw Error(o(71));return e}var Re=X.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:o=`absolute`,side:s=`top`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=b,style:_,...v}=e,y=Q(),x=Fe(),S=y.useState(`open`),C=y.useState(`mounted`),w=y.useState(`trackCursorAxis`),T=y.useState(`disableHoverablePopup`),E=y.useState(`floatingRootContext`),O=y.useState(`instantType`),k=y.useState(`transitionStatus`),A=y.useState(`adaptiveOrigin`),j=D({anchor:i,positionMethod:o,floatingRootContext:E,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,collisionBoundary:d,collisionPadding:f,sticky:m,arrowPadding:p,disableAnchorTracking:h,keepMounted:x,collisionAvoidance:g,adaptiveOrigin:A}),M=X.useMemo(()=>({open:S,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:w===`none`?O:`tracking-cursor`}),[S,j.side,j.align,j.anchorHidden,w,O]),N=a(e,M,{styles:j.positionerStyles,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,Z.jsx)(Le.Provider,{value:j,children:N})}),ze=X.forwardRef(function(e,t){let{render:n,className:r,style:a,...o}=e,s=Q(),{side:c,align:u}=$(),d=s.useState(`open`),f=s.useState(`instantType`),p=s.useState(`transitionStatus`),m=s.useState(`popupProps`),h=s.useState(`floatingRootContext`),g=s.useState(`disabled`),_=s.useState(`closeDelay`);A({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Y(h,{enabled:!g,closeDelay:_});let y=s.useStateSetter(`popupElement`);return v(`div`,e,{state:{open:d,side:c,align:u,instant:f,transitionStatus:p},ref:[t,s.context.popupRef,y],props:[I,m,l(p),o],stateAttributesMapping:i})}),Be=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=X.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Z.jsx)(Oe.Provider,{value:t,children:(0,Z.jsx)(he,{delay:i,timeoutMs:r,children:e.children})})},Ve=X.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=Q(),c=$(),l=s.useState(`instantType`),{children:u,state:d}=de({store:s,side:c.side,children:a}),f={activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l};return v(`div`,e,{state:f,ref:t,props:[o,{children:u}],stateAttributesMapping:fe})}),He=class extends L{constructor(){super(Ce(),`Tooltip`)}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function Ue(){return new He}var We=re(),Ge=Ue,Ke=Be,qe=Ee;function Je(e){let t=(0,We.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Ne,{"data-slot":`tooltip-trigger`,...e}),t[0]=e,t[1]=n),n}function Ye(e){let n=(0,We.c)(22),r,i,a,o,s,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],l=n[7]):({className:a,align:s,sideOffset:c,side:l,anchor:r,children:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c,n[7]=l);let u=s===void 0?`center`:s,d=c===void 0?4:c,f=l===void 0?`top`:l,p;n[8]===a?p=n[9]:(p=t(`app-surface relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) text-balance rounded-md border not-dark:bg-clip-padding text-popover-foreground text-xs shadow-md/5 transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,a),n[8]=a,n[9]=p);let m;n[10]===i?m=n[11]:(m=(0,Z.jsx)(Ve,{className:`relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,"data-slot":`tooltip-viewport`,children:i}),n[10]=i,n[11]=m);let h;n[12]!==o||n[13]!==p||n[14]!==m?(h=(0,Z.jsx)(ze,{className:p,"data-slot":`tooltip-popup`,...o,children:m}),n[12]=o,n[13]=p,n[14]=m,n[15]=h):h=n[15];let g;return n[16]!==u||n[17]!==r||n[18]!==f||n[19]!==d||n[20]!==h?(g=(0,Z.jsx)(Ie,{children:(0,Z.jsx)(Re,{align:u,anchor:r,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`tooltip-positioner`,side:f,sideOffset:d,children:h})}),n[16]=u,n[17]=r,n[18]=f,n[19]=d,n[20]=h,n[21]=g):g=n[21],g}export{Je as a,Ke as i,Ge as n,Ye as r,qe as t};
@@ -1 +1 @@
1
- import"./chunk-FOHPRMQF-CoA4358r.js";import{c as e}from"./mermaid-parser.core-B6Q-3x_q.js";export{e as createTreeViewServices};
1
+ import"./chunk-FOHPRMQF-CoA4358r.js";import{c as e}from"./mermaid-parser.core-RK9ah5RM.js";export{e as createTreeViewServices};
@@ -1 +1 @@
1
- import"./chunk-FOHPRMQF-CoA4358r.js";import{o as e}from"./mermaid-parser.core-B6Q-3x_q.js";export{e as createTreemapServices};
1
+ import"./chunk-FOHPRMQF-CoA4358r.js";import{o as e}from"./mermaid-parser.core-RK9ah5RM.js";export{e as createTreemapServices};
@@ -0,0 +1 @@
1
+ import{ws as e}from"./runtime-DjjjAcTE.js";var t={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};t.node;var n=e(t);export{n as t};
@@ -1 +1 @@
1
- import{ho as e}from"./runtime-BwHA1GUS.js";var t={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};t.node;var n=e(t);export{n as t};
1
+ import{ws as e}from"./runtime-DjjjAcTE.js";var t={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import"./primary-Cf-xJExj.js";import{J as e,io as t}from"./wsTransport-C88seBPA.js";function n(e){switch(e){case`complete`:return 4;case`partial`:return 3;case`not-found`:return 2;case`failed`:return 1;case`unsupported`:return 0}}function r(e,t){return n(t.source.status)-n(e.source.status)||t.source.scanFinishedAt.localeCompare(e.source.scanFinishedAt)||t.environment.summary.generatedAt.localeCompare(e.environment.summary.generatedAt)||e.environment.environmentId.localeCompare(t.environment.environmentId)}function i(e,t){return{uncachedInputTokens:e.uncachedInputTokens+t.uncachedInputTokens,cachedInputTokens:e.cachedInputTokens+t.cachedInputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens+t.cacheCreationInputTokens,outputTokens:e.outputTokens+t.outputTokens,...e.reasoningTokens===void 0||t.reasoningTokens===void 0?{}:{reasoningTokens:e.reasoningTokens+t.reasoningTokens},totalTokens:e.totalTokens+t.totalTokens}}function a(e,t){if(e.size===0||e.size===1&&e.has(`unpriced`))return`unpriced`;let n=new Set([...e].filter(e=>e!==`unpriced`));return t>0||n.size!==1||e.has(`mixed`)?`mixed`:n.values().next().value??`unpriced`}function o(e){let t=e.filter(e=>e.summary!==void 0&&e.summary.contractVersion===2&&(e.status===`complete`||e.status===`partial`));if(t.length===0)return null;let n=t.flatMap(e=>e.summary.sources.map(t=>({environment:e,source:t}))).toSorted(r),o=new Set,s=new Set,c=[],l=0,u=!1;for(let e of n){let t=`${e.environment.environmentId}\0${e.source.sourceId}`,n=e.source.deduplicationKind===`physical`,r=n&&o.has(e.source.sourceId);n&&!r&&o.add(e.source.sourceId),e.source.deduplicationKind===`environment-only`&&(u=!0),r?l+=1:s.add(t),c.push({...e.source,environmentId:e.environment.environmentId,environmentLabel:e.environment.label,included:!r,...r?{exclusionReason:`duplicate`}:{}})}let d=new Map,f=new Set;for(let e of[...t].toSorted((e,t)=>t.summary.generatedAt.localeCompare(e.summary.generatedAt)))for(let t of e.summary.buckets){let n=`${e.environmentId}\0${t.sourceId}`;if(!s.has(n))continue;if(t.provider===`cursor`&&t.exportRecordId!==void 0){let e=`${t.sourceId}\0${t.exportRecordId}`;if(f.has(e))continue;f.add(e)}let r=`${t.date}\0${t.provider}\0${t.model}`,a=d.get(r);a===void 0&&(a={date:t.date,provider:t.provider,model:t.model,...t.rawModel===void 0?{}:{rawModel:t.rawModel},tokens:{uncachedInputTokens:0,cachedInputTokens:0,cacheCreationInputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0},responseCount:0,sessionCount:0,exportSessionIds:new Set,estimatedCostUsd:0,estimatedCacheSavingsUsd:0,hasCost:!1,hasCacheSavings:!1,pricedTokenCount:0,unpricedTokenCount:0,costSources:new Set,sourceIds:new Set},d.set(r,a)),a.tokens=i(a.tokens,t.tokens),a.responseCount+=t.responseCount,t.provider===`cursor`&&t.exportRecordId!==void 0?t.exportSessionId!==void 0&&a.exportSessionIds.add(`${t.sourceId}\0${t.exportSessionId}`):a.sessionCount+=t.sessionCount,t.estimatedCostUsd!==void 0&&(a.estimatedCostUsd+=t.estimatedCostUsd,a.hasCost=!0),t.estimatedCacheSavingsUsd!==void 0&&(a.estimatedCacheSavingsUsd+=t.estimatedCacheSavingsUsd,a.hasCacheSavings=!0),a.pricedTokenCount+=t.pricedTokenCount,a.unpricedTokenCount+=t.unpricedTokenCount,a.costSources.add(t.costSource),a.sourceIds.add(t.sourceId)}let p=[...d.values()].map(e=>Object.assign({date:e.date,provider:e.provider,model:e.model,tokens:e.tokens,responseCount:e.responseCount,sessionCount:e.sessionCount+e.exportSessionIds.size,pricedTokenCount:e.pricedTokenCount,unpricedTokenCount:e.unpricedTokenCount,costSource:a(e.costSources,e.unpricedTokenCount),sourceIds:[...e.sourceIds].toSorted(),...e.exportSessionIds.size?{exportSessionIds:[...e.exportSessionIds]}:{}},e.rawModel===void 0?{}:{rawModel:e.rawModel},e.hasCost?{estimatedCostUsd:e.estimatedCostUsd}:{},e.hasCacheSavings?{estimatedCacheSavingsUsd:e.estimatedCacheSavingsUsd}:{})).toSorted((e,t)=>e.date.localeCompare(t.date)||e.provider.localeCompare(t.provider)||e.model.localeCompare(t.model)),m=new Map;for(let e of[...t].toSorted((e,t)=>e.summary.generatedAt.localeCompare(t.summary.generatedAt))){let t=new Set(e.summary.sources.filter(e=>e.provider===`cursor`&&e.status===`partial`).map(e=>e.sourceId));for(let n of e.summary.imports??[])t.has(n.sourceId)&&m.set(`${n.sourceId}\0${n.recordId}`,n)}let h=t[0]?.summary;return h?{...h.startDate===void 0?{}:{startDate:h.startDate},endDate:h.endDate,timeZone:h.timeZone,buckets:p,imports:[...m.values()],sources:c.toSorted((e,t)=>Number(t.included)-Number(e.included)||e.provider.localeCompare(t.provider)||e.environmentLabel.localeCompare(t.environmentLabel)),environments:e,duplicateSourceCount:l,environmentOnlyDeduplicationWarning:u}:null}var s=class{#e=0;next(){return this.#e+=1,this.#e}isCurrent(e){return e===this.#e}},c={"7d":7,"30d":30,"90d":90,all:null};function l(e,t){return new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date(e))}function u(e,t,n=Date.now()){let r=l(n,t),i=c[e];return i===null?{endDate:r,timeZone:t,contractVersion:2}:{startDate:l(Date.parse(`${r}T12:00:00.000Z`)-(i-1)*864e5,`UTC`),endDate:r,timeZone:t,contractVersion:2}}var d={reset:`Reset redeemed.`,alreadyRedeemed:`This reset was already redeemed.`,noCredit:`No reset credits are available. No credit was consumed.`,nothingToReset:`There is no eligible limit to reset. No credit was consumed.`};function f(n,r,i){let a={phase:`idle`},o=new Set,s=0,c=!1,l=e=>{a=e;for(let e of o)e()},u,f=()=>u??=(async()=>{if(!i)return;let r=await i.kv.getItem(i.key);if(r===null)return;let o=JSON.parse(r);if(o.scope!==i.key)throw Error(`Stored reset environment mismatch.`);let s=t(e)(o.attempt);if(s.instanceId!==n)throw Error(`Stored reset account mismatch.`);l({...a,attempt:s,phase:`uncertain`})})().catch(e=>{throw u=void 0,e});return{getSnapshot:()=>a,canDispose:()=>o.size===0&&!c&&!a.attempt&&a.phase!==`loading`&&a.phase!==`confirming`,subscribe:e=>(o.add(e),()=>{o.delete(e)}),disconnect(){s++,!c&&l({...a,phase:a.attempt?`uncertain`:`idle`,message:`Reconnect before using reset credits.`})},async load(e,t){if(c||!t())return;let r=++s;l({...a,phase:`loading`});try{if(await f(),r!==s||!t())return;let i=await e.readCodexResetCredits({instanceId:n});if(r!==s||!t())return;l({...a,account:i,phase:a.attempt?`uncertain`:`ready`,...a.attempt?{message:`An earlier result is uncertain. Retry the same attempt for its confirmed account.`}:{message:void 0}})}catch{if(r!==s)return;l({...a,phase:a.attempt?`uncertain`:`error`,message:`Could not load reset credits or the saved attempt. Retry when storage and the provider are available.`})}},requestConfirmation(e){!e||c||a.phase!==`ready`&&a.phase!==`settled`||a.attempt||!a.account?.accountBinding||!(a.account.credits&&a.account.credits.availableCount>0)||l({...a,phase:`confirming`,message:void 0})},cancel(){a.phase===`confirming`&&l({...a,phase:`ready`})},async confirm(e,t){if(c||!t()||a.phase!==`confirming`&&a.phase!==`uncertain`)return;let o=a.attempt?.accountBinding??a.account?.accountBinding;if(!o||a.account?.accountBinding&&a.account.accountBinding!==o)return;let u=a.attempt??{instanceId:n,accountBinding:o,idempotencyKey:r()};s++,c=!0,l({...a,attempt:u,phase:`submitting`,message:void 0});try{i&&await i.kv.setItem(i.key,JSON.stringify({scope:i.key,attempt:u}));let r=await e.readCodexResetCredits({instanceId:n});if(!t()||r.accountBinding!==u.accountBinding){l({...a,account:r,phase:`uncertain`,message:`Account or connection changed. Return to the confirmed account before retrying this attempt.`});return}let o=await e.consumeCodexResetCredit(u);try{i&&await i.kv.removeItem(i.key),l({account:r,phase:`refreshing`,message:`${d[o.outcome]} Refreshing account limits…`})}catch{l({account:r,attempt:u,phase:`uncertain`,message:`Reset outcome confirmed, but its completion could not be saved. Retry the same attempt to reconcile it.`})}try{await e.refreshProviders({instanceId:n});let r=await e.readCodexResetCredits({instanceId:n});l({...a,phase:a.attempt?`uncertain`:`settled`,...t()?{account:r}:{},message:a.attempt?a.message:`${d[o.outcome]} Account limits refreshed.`})}catch{l({...a,phase:a.attempt?`uncertain`:`settled`,message:`${d[o.outcome]} Limits could not be refreshed; refresh usage.`})}}catch{l({...a,attempt:u,phase:`uncertain`,message:`The reset result is uncertain. Retry the same attempt; its key will be reused.`})}finally{c=!1}}}}var p=new Map;function m(e,t,n,r){let i=JSON.stringify([e,t]);if(p.size>=64){for(let[e,t]of p)if(e!==i&&t.canDispose()&&p.delete(e),p.size<64)break}let a=p.get(i);return a||(a=f(t,n,r?{kv:r,key:`ryco:codex-reset-attempt:${i}`}:void 0),p.set(i,a)),a}function h(e){let t=e.credits;return t?t.credits===void 0?[`Credit details are not available; only the count is known.`]:t.credits.length===0?[`No available credit details were returned.`]:t.credits.map(e=>{let t=e.expiresAt===null?`Does not expire`:e.expiresAt===void 0?`Expiry unknown`:`Expires ${new Date(e.expiresAt*1e3).toLocaleString()}`;return`${e.title||`Earned reset`} · ${e.status} · Granted ${new Date(e.grantedAt*1e3).toLocaleString()} · ${t}${e.description?` · ${e.description}`:``}`}):[e.unavailableReason??`Reset credits unavailable.`]}export{o as a,s as i,h as n,u as r,m as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-CwJFpaho.js";import{i as n}from"./presentationTier-DPVAxTK4.js";var r=n(),i=e(t(),1);function a(e){let t=(0,r.c)(11),n=(0,i.useRef)(null),[a,o]=(0,i.useState)(null),[s,c]=(0,i.useState)(!1),l;t[0]===e?l=t[1]:(l=()=>{let t=n.current;if(!t||!e){o(null);return}let r=t.querySelector(`[data-nav-key="${CSS.escape(e)}"]`);if(!r){o(null);return}o(e=>e?.top===r.offsetTop&&e.height===r.offsetHeight?e:{top:r.offsetTop,height:r.offsetHeight})},t[0]=e,t[1]=l);let u=l,d,f;t[2]===u?(d=t[3],f=t[4]):(d=()=>{u()},f=[u],t[2]=u,t[3]=d,t[4]=f),(0,i.useLayoutEffect)(d,f);let p,m;t[5]===u?(p=t[6],m=t[7]):(p=()=>{let e=n.current;if(!e)return;let t=0,r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=requestAnimationFrame(u)});r.observe(e);let i=requestAnimationFrame(()=>c(!0));return()=>{r.disconnect(),cancelAnimationFrame(t),cancelAnimationFrame(i)}},m=[u],t[5]=u,t[6]=p,t[7]=m),(0,i.useEffect)(p,m);let h;return t[8]!==s||t[9]!==a?(h={listRef:n,rect:a,animate:s},t[8]=s,t[9]=a,t[10]=h):h=t[10],h}export{a as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./usePresentationTier-B9kCQ4YH.js";import{h as t}from"./sidebar-0BBaFNm3.js";function n(){let{state:n}=t(),r=e();return n===`collapsed`&&r===`desktop`}export{n as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-CwJFpaho.js";import{i as n}from"./presentationTier-DPVAxTK4.js";import{g as r,h as i,t as a,v as o,y as s}from"./appearancePreferences-NnsvXwBe.js";import{k as c}from"./main-Ch0bwS-M.js";var l=n(),u=e(t(),1);function d(e){if(typeof window>`u`)return()=>{};let t=t=>{t.key===`ryco:appearance-preferences`&&e()};return window.addEventListener(a,e),window.addEventListener(`storage`,t),()=>{window.removeEventListener(a,e),window.removeEventListener(`storage`,t)}}function f(e,t){let n=(0,l.c)(3),a=t?.effective??!1,o;n[0]!==a||n[1]!==e?(o=()=>(a?r():i())[e],n[0]=a,n[1]=e,n[2]=o):o=n[2];let s=o;return(0,u.useSyncExternalStore)(d,s,s)}function p(){return(0,u.useSyncExternalStore)(d,s,s)}function m(e){let t=d(e);if(typeof window>`u`||typeof window.matchMedia!=`function`)return t;let n=window.matchMedia(c);return n.addEventListener(`change`,e),()=>{t(),n.removeEventListener(`change`,e)}}function h(){return(0,u.useSyncExternalStore)(m,o,o)}export{h as n,p as r,f as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,i as n}from"./primary-Cf-xJExj.js";import{ai as r,ar as i,fr as a,ni as o,oi as s,wr as c}from"./runtime-DjjjAcTE.js";import{t as l}from"./react-CwJFpaho.js";import{i as u}from"./presentationTier-DPVAxTK4.js";import{a as d,n as f}from"./projectCheckouts.logic-DUT4AxXr.js";var p=u(),m=e(l(),1),h=8e3;function g(){let e=[],t=[];return n=>{let r=a(n);if(r.length===e.length&&r.every((t,n)=>t===e[n]))return t;e=r;let i=d(r);return(i.length!==t.length||i.some((e,n)=>e!==t[n]))&&(t=i),t}}function _(e){let a=(0,p.c)(14),l=t(),u=n(),d=e??l??null,m;a[0]===d?m=a[1]:(m=e=>d!==null&&i(e,d),a[0]=d,a[1]=m);let h=c(m),g;a[2]===d?g=a[3]:(g=e=>d===null?null:e.byId?.[d]??null,a[2]=d,a[3]=g);let _=r(g),v;a[4]===d?v=a[5]:(v=e=>d===null?null:e.byId?.[d]??null,a[4]=d,a[5]=v);let y=s(v),b=d!==null&&d===l,x;a[6]!==h||a[7]!==b||a[8]!==_||a[9]!==y?(x=f({bootstrapComplete:h,isPrimary:b,saved:y?{connectionState:y.connectionState,disconnectedAt:y.disconnectedAt}:null,savedKnown:_!==null,registryHydrated:o()}),a[6]=h,a[7]=b,a[8]=_,a[9]=y,a[10]=x):x=a[10];let S=x,C=y?.descriptor?.label??_?.label??(b?u?.label??null:null),w;return a[11]!==C||a[12]!==S?(w={sync:S,label:C},a[11]=C,a[12]=S,a[13]=w):w=a[13],w}function v(e,t){let n=(0,p.c)(4),[r,i]=(0,m.useState)(!1),a,o;return n[0]!==e||n[1]!==t?(a=()=>{if(!e)return;let n=window.setTimeout(()=>i(!0),t);return()=>{window.clearTimeout(n),i(!1)}},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,m.useEffect)(a,o),e&&r}export{_ as i,g as n,v as r,h as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./primary-Cf-xJExj.js";import{Gi as n,Zi as r,ad as i,ar as a,cn as o,fr as s,wr as c}from"./runtime-DjjjAcTE.js";import{t as l}from"./react-CwJFpaho.js";import{t as u}from"./toastHelpers-CSQRKo4F.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./alert-dialog-CgXR9tED.js";var v=e(l(),1),y=new Set([`working`,`approval`,`input`,`connecting`]);function b(e,t,n){if(t===null||!n)return null;let r=0;for(let n of e)n.environmentId===t&&n.archivedAt===null&&y.has(o(n))&&(r+=1);return r}function x(e){return e===null?`Agent turns may still be running`:e===1?`1 agent turn is still running`:`${e} agent turns are still running`}function S(e){let t=!1,n=null,r=!1,i=null,a=()=>{n?.(),n=null,i!==null&&(i=null,e.present(null))},o=async n=>{let i=t;t=!1,a(),r=!0;try{let t=n===void 0?void 0:await n(`now`);return n===void 0||i?(await e.restart(),!0):t!==`applied`}finally{r=!1}},s=()=>{if(!t||r)return;let n=e.readActiveTurns();if(n===null||n>0){(i===null||i.activeTurns!==n)&&(i={activeTurns:n},e.present(i));return}o().catch(e.onError)};return{relaunchNow:o,scheduleAfterActiveTurns:async r=>{await r(`deferred`),t=!0,n??=e.subscribe(s),s()},cancel:()=>{t=!1,a()},pending:()=>t}}var C=i();function w(){let e=c.getState(),n=t()?.environmentId??null;return b(s(e),n,a(e,n))}function T(e){n.add(u({type:`error`,title:`Ryco could not restart`,description:e instanceof Error?e.message:`Your saved change applies the next time Ryco starts.`}))}var E=null;function D(){E!==null&&(E=null,k.cancel())}async function O(){let e=window.desktopBridge?.restartApp;if(!e)throw Error(`Desktop restart is unavailable.`);await e()}var k=S({readActiveTurns:w,subscribe:e=>c.subscribe(e),restart:O,present:e=>{if(e===null){let e=E;E=null,e!==null&&n.close(e);return}let t={...u({type:`info`,title:`Ryco restarts when its agents finish`,description:`${x(e.activeTurns)}. Your change is saved and applies when Ryco restarts; dismiss this to restart later yourself.`,timeout:0,actionProps:{children:`Restart now`,onClick:()=>void k.relaunchNow().catch(T)}}),onClose:D};E===null?E=n.add(t):n.update(E,t)},onError:T});function A(e){return async t=>{t===`now`&&await e()}}function j(e,t){return async n=>{let r=await e.setHubLaunchConfig(n===`deferred`?{...t,deferRelaunch:!0}:t);if(n===`now`&&!r.relaunching)return`applied`}}async function M(e){let t;try{t=await e.bridge.getHubLaunchConfig()}catch{return null}let n=e.bridge.restartApp;return t.restartRequired===!0&&n&&await e.guardRelaunch(A(n)),t}function N(){let[e,t]=(0,v.useState)(null),[n,i]=(0,v.useState)(null),a=(0,v.useRef)(null),o=(0,v.useCallback)(e=>{a.current=e,t(e)},[]);(0,v.useEffect)(()=>()=>a.current?.resolve(`cancelled`),[]);let s=(0,v.useCallback)(async(e,t)=>{let n=w();return n===0?await k.relaunchNow(e)?`relaunched`:`applied`:(t?.beforePrompt?.(),new Promise((t,r)=>{o({activeTurns:n,change:e,resolve:t,reject:r})}))},[o]),c=(0,v.useCallback)(e=>{a.current?.resolve(e),o(null)},[o]),l=async e=>{let t=a.current;if(t!==null){i(e);try{if(e===`now`){let e=await k.relaunchNow(t.change);t.resolve(e?`relaunched`:`applied`)}else await k.scheduleAfterActiveTurns(t.change),t.resolve(`scheduled`)}catch(e){t.reject(e)}finally{i(null),o(null)}}};return{guardRelaunch:s,dialog:(0,C.jsx)(_,{open:e!==null,onOpenChange:e=>{!e&&n===null&&c(`cancelled`)},children:(0,C.jsxs)(m,{children:[(0,C.jsxs)(d,{children:[(0,C.jsx)(g,{children:`Restart while agents are working?`}),(0,C.jsx)(h,{children:e===null?null:`${x(e.activeTurns)} on this computer. Applying this change restarts Ryco, which stops ${e.activeTurns===1?`it`:`them`}.`})]}),(0,C.jsxs)(f,{children:[(0,C.jsx)(p,{disabled:n!==null,render:(0,C.jsx)(r,{variant:`outline`,disabled:n!==null}),children:`Cancel`}),(0,C.jsx)(r,{variant:`outline`,disabled:n!==null,onClick:()=>void l(`deferred`),children:`Restart after they finish`}),(0,C.jsx)(r,{variant:`destructive`,disabled:n!==null,onClick:()=>void l(`now`),children:n===`now`?`Restarting…`:`Restart now`})]})]})})}}export{N as i,M as n,A as r,j as t};
@@ -0,0 +1,15 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ad as t}from"./runtime-DjjjAcTE.js";import{t as n}from"./react-CwJFpaho.js";import{R as r}from"./popover-OWEv6cQz.js";import{i}from"./presentationTier-DPVAxTK4.js";import{$ as a,B as o,C as s,Ct as c,E as l,Et as u,H as d,L as f,Q as p,R as m,S as h,St as g,T as _,Tt as v,V as y,X as b,Z as x,_ as S,_t as C,a as w,at as T,b as E,bt as D,c as O,ct as k,d as A,dt as j,et as M,f as N,ft as P,g as F,h as ee,it as te,l as I,lt as ne,m as re,ot as L,p as R,pt as ie,q as z,rt as ae,s as oe,st as se,u as B,ut as ce,v as le,vt as ue,w as V,wt as de,x as H,xt as fe,y as pe,yt as me,z as he}from"./ThreadLinkList-BN5z5EpS.js";import{$ as ge,A as _e,B as ve,C as ye,D as be,E as xe,F as Se,G as Ce,H as we,I as Te,J as Ee,K as De,L as Oe,M as ke,N as Ae,O as je,P as Me,Q as Ne,R as Pe,S as Fe,T as Ie,U as Le,V as Re,W as ze,X as U,Y as Be,Z as Ve,a as He,b as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,j as Ye,k as Xe,l as Ze,m as Qe,n as $e,nt as et,o as tt,p as nt,q as rt,r as it,s as at,tt as ot,u as st,w as ct,x as lt,y as ut}from"./Virtualizer-CwXeUPla.js";function dt({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function ft(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:pt(n,e.startContentIndex)}}function pt(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}var W=t();function mt({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=U}){let p=n?.(e),m=r?.(e),h=i?.(e),g=a?.(e);return(0,W.jsxs)(W.Fragment,{children:[p==null?(0,W.jsxs)(W.Fragment,{children:[m!=null&&(0,W.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,W.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),g!=null&&(0,W.jsx)(`div`,{slot:`header-metadata`,children:g})]}):(0,W.jsx)(`div`,{slot:ne,children:p}),o!=null&&l?.map((e,t)=>(0,W.jsx)(`div`,{slot:f(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=ht(t,e);return(0,W.jsx)(`div`,{slot:n,style:Ne,children:c(t,d)},n)}),s!=null&&(0,W.jsx)(`div`,{slot:`gutter-utility-slot`,style:Ve,children:s(u)})]})}function ht(e,t){let n=ft(e,t);return n==null?void 0:dt({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}async function gt(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function _t({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=H(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=A({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=R({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=vt(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?F({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=S({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=S({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=h(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function vt(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 yt(e,t)}function yt(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 bt({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}}}var xt=1;function St(e,...t){return`ck${xt}:${JSON.stringify([e,...t])}`}function Ct(e){return e===``?[]:e.split(u)}function wt(e,t,n){let r=e===`clone`?Je(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Tt(r,Dt(r,n),Ot(r,n));case`rename-pure`:{let e=Ot(r,n);kt(r,n);let t=Ct(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,jt(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Tt(e,t,n){let r=Ct(t.contents),i=Ct(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=Et(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,jt(e,t,n),e}function Et(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(L(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=T(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=T(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function Dt(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function Ot(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function kt(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function At(e,t,n){return e.cacheKey==null?Mt(t,n):`${e.cacheKey}:hydrated`}function jt(e,t,n){let r=At(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function Mt(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?St(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var Nt=new TextEncoder,Pt=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ft=/[\uD800-\uDFFF]/,It=1024,G=new Uint8Array(It);function Lt(){G.length!==It&&(G=new Uint8Array(It))}function K(e){if(e.length===0)return e;if(Ft.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;G.length<t&&(G=new Uint8Array(t));let{written:n}=Nt.encodeInto(e,G);return Pt.decode(G.subarray(0,n))}var Rt=4096,zt=.5;function Bt(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=Ht(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}Vt(t,e)}}function Vt(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 Ht(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)>Rt)return null;let c=[];for(let t=0;t<n;t++)c.push(Wt(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(Wt(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+=Gt(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*zt: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 Ut=/\s+/g;function Wt(e){return e.replace(Ut,``)}function Gt(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 Kt(e,t,n=!1,r){let i=dn(e),a=i?$t(e):en(e),o,s=[];for(let e of a){if(i&&!fe.test(e)){if(o==null)o=K(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!tn(e)){if(o==null)o=K(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=Jt(e,{cacheKey:t==null?void 0:r==null?St(`patch-file`,t,String(s.length)):St(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function qt(e,t){try{return Jt(e,t)}finally{Lt()}}function Jt(e,{cacheKey:t,isGitDiff:n=fe.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=fn(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Qt(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=cn(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?Zt(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Zt(r.contents):[],cacheKey:mn(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(se),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=K(r.trim()),n!==r&&(c.prevName=K(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?D:me):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=K(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=K(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=K(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=K(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=K(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=K(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(v)??[];t!=null&&(c.prevObjectId=K(t)),n!=null&&(c.newObjectId=K(n)),r!=null&&(c.mode=K(r))}e.startsWith(`rename from `)&&(c.prevName=K(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=K(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
2
+ `||s[s.length-1]===`\r`||s[s.length-1]===`\r
3
+ `||s[s.length-1]===``);)s.pop();let{additionStart:y,deletionStart:b}=p;u=l?u:b-1,d=l?d:y-1;let x={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:y,additionLines:m,deletionCount:p.deletionCount,deletionStart:b,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:mn(p.hunkContext),hunkSpecs:K(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},S=0,C=0;for(let e=1;e<s.length;e++){let t=s[e];if(S>=x.additionCount&&C>=x.deletionCount&&!t.startsWith(`\\`)){if(!on(t)||sn(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=hn(n);if(r===`addition`){if(a&&S>=x.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=gn(t);(g==null||g.type!==`change`)&&(g=_n(`change`,u,d),x.hunkContent.push(g)),d++,S++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&C>=x.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=gn(t);(g==null||g.type!==`change`)&&(g=_n(`change`,u,d),x.hunkContent.push(g)),u++,C++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(C>=x.deletionCount||S>=x.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=gn(t);(g==null||g.type!==`context`)&&(g=_n(`context`,u,d),x.hunkContent.push(g)),d++,u++,S++,C++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(x.noEOFCRAdditions=!0,x.noEOFCRDeletions=!0):_===`deletion`?x.noEOFCRDeletions=!0:_===`addition`&&(x.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=I(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=I(c.deletionLines[e]))}}}if(S!==x.additionCount||C!==x.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${x.deletionCount}/${x.additionCount}, parsed old/new ${C}/${S}`);let e=L(x.additionStart,x.additionCount)+(S===0?0:1),t=L(x.deletionStart,x.deletionCount)+(C===0?0:1);if(!l){let n=e-x.additionStart,r=t-x.deletionStart;x.additionLineIndex+=n,x.deletionLineIndex+=r;for(let e of x.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}x.additionStart=e,x.deletionStart=t,x.additionCount=S,x.deletionCount=C}x.additionLines=m,x.deletionLines=h,x.collapsedBefore=Math.max(L(x.additionStart,x.additionCount)-o,0),c.hunks.push(x),o=T(x.additionStart,x.additionCount);for(let e of x.hunkContent)e.type===`context`?(x.splitLineCount+=e.lines,x.unifiedLineCount+=e.lines):(x.splitLineCount+=Math.max(e.additions,e.deletions),x.unifiedLineCount+=e.deletions+e.additions);x.splitLineStart=c.splitLineCount+x.collapsedBefore,x.unifiedLineStart=c.unifiedLineCount+x.collapsedBefore,c.splitLineCount+=x.collapsedBefore+x.splitLineCount,c.unifiedLineCount+=x.collapsedBefore+x.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=T(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),Bt(c),c}}function Yt(e,t,n=!1){let r=[],i=Xt(e)?e.split(k):[e];for(let e of i)try{r.push(Kt(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{Lt()}return r}function Xt(e){return e.startsWith(`From `)||e.includes(`
4
+ From `)}function Zt(e){let t=Qt(e);for(let e=0;e<t.length;e++)t[e]=K(t[e]);return t}function Qt(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
5
+ `,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 $t(e){return fn(e,`diff --git`)}function en(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=an(e,r);if(i<=0&&a<=0){if(nn(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=an(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=cn(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function tn(e){return nn(e,0)}function nn(e,t){let n=an(e,t);return rn(e,t,`---`)&&rn(e,n,`+++`)}function rn(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
6
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function an(e,t){let n=e.indexOf(`
7
+ `,t);return n===-1?e.length:n+1}function on(e){let t=e[0];return t===`+`||t===`-`||t===` `}function sn(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
8
+ `&&n!==`\r`)return!1}return!0}function cn(e){if(!e.startsWith(`@@ -`))return;let t=4,n=ln(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=ln(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=ln(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=ln(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=un(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function ln(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 un(e){return e.endsWith(`\r
9
+ `)?e.slice(0,-2):e.endsWith(`
10
+ `)?e.slice(0,-1):e}function dn(e){return e.startsWith(`diff --git`)||e.includes(`
11
+ diff --git`)}function fn(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:pn(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=pn(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function pn(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function mn(e){return e==null?e:K(e)}function hn(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function gn(e){let t=e.slice(1);return K(t===``?`
12
+ `:t)}function _n(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 vn=`/dev/null`;function q(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??yn(),a=t??yn(),o=qt(O(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?St(`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 yn(){return{name:vn,contents:``}}var bn=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 J(e,t){let n=q({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 xn(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 Sn(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function Cn(e,t){return t.length>0&&t.length<e.deletionLines.length&&Sn(t)}function wn(e,t,n){let r=e.deletionLines.join(``),i=xn(t.length,r),a=q({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 Tn(e,t){return wn(e,[``],t)}function En(e,t){if(e.additionLines.length===0)return Tn(e,t);if(Cn(e,e.additionLines))return wn(e,e.additionLines,t);let n=e.additionLines,r=J(e,t);return On(r,n),r}function Dn(e){return e.length>1&&e.at(-1)===``}function On(e,t){if(!Dn(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&&T(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,Ln(e);return}}}function kn(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Y(e,J(e,n));let r=Array.from(t);if(r.length===0)return Y(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||I(r)===I(i))return Y(e,J(e,n))}let i=An(e,r);if(i.size===0)return Y(e,J(e,n));for(let t of i)if(!Mn(e,t,n))return Y(e,J(e,n));return Ln(e),le(e)?Y(e,J(e,n)):Y(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Y(e,t){return Object.assign(e,t),t}function An(e,t){let n=new Set;for(let r of t){let t=jn(e,r);if(t==null)return new Set;n.add(t)}return n}function jn(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 Mn(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=q({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:(Pn(r,s),Nn(e,t),!0)}function Nn(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(`
13
+ `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
14
+ `)}function Pn(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Fn(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,In(e)}function Fn(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function In(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 Ln(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(L(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,In(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=T(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-T(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Rn=new WeakMap;function zn(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function Bn(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 Vn(e,t){let n=e.hunks,r=e.additionLines,i=zn(r),a=i===r?e:{...e,additionLines:i},o=Zn(n,Xn(a,t),e.deletionLines.length),s=er(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,lr(e),On(e,r),rr(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function Hn(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<or(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:or(r);if(i==null||t<i||o!=null&&o!==s)return Vn(e,n);o=s}if(o!=null){if(Un(e,i,o,r,n)){e.editSessionDirty=!0;return}return Vn(e,n)}}function Un(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=Wn(e),o=e.hunks[n];if(o.hunkContent.some(Gn))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 Wn(e){let t=Rn.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return Rn.set(e,{lines:e.deletionLines,set:n}),n}function Gn(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Kn(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 qn(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=A({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=X(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=F({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=X(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Jn(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=X(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,X(i)+i.deletionCount,e.deletionLines.length),n}function Yn(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?J(e,t):En(e,t)),!0)}function Xn(e,t){if(Bn(e.deletionLines,e.additionLines)==null)return[];let n=q({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=Fn(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 Zn(e,t,n){let r=e.map((e,t)=>{let n=X(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&&Qn(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=$n(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 Qn(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function $n(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 er(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`);nr(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`);nr(s,c,i,r),r+=c,i+=c,n.push(tr(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 tr(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:sr(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:cr(t.additionStart,r),deletionStart:sr(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:cr(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${sr(t.deletionStart,i)},${i} +${sr(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return In(s),s}function nr(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function rr(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(X(r)!==X(i)||r.deletionCount!==i.deletionCount||or(r)!==or(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!ir(r,i))return!0}return!1}function ir(e,t){let n=ar(e),r=ar(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*ar(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 or(e){return L(e.additionStart,e.additionCount)}function X(e){return L(e.deletionStart,e.deletionCount)}function sr(e,t){return t===0?e:e+1}function cr(e,t){return t===0?e-1:e}function lr(e){Ln(e);for(let t=0;t<e.hunks.length;t++)Nn(e,t)}function ur(e){return o({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function dr(e){return o({tagName:`div`,children:[o({tagName:`span`,children:[d(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function fr(e){return o({tagName:`div`,children:[y({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function Z({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:s}){let c=0,l=[];if(e===`metadata`&&t!=null&&l.push(o({tagName:`div`,children:[d(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(fr(`up`)),c++),s||(e.push(fr(`down`)),c++)):(e.push(fr(!a&&!s?`both`:a?`down`:`up`)),c++)),e.push(o({tagName:`div`,children:[o({tagName:`span`,children:[d(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(o({tagName:`div`,children:[d(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),l.push(o({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":c>1?``:void 0}}))}return e===`custom`&&i!=null&&l.push(o({tagName:`slot`,properties:{name:i}})),o({tagName:`div`,children:l,properties:{"data-separator":l.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":s?``:void 0}})}function pr(e,t){return`hunk-separator-${e}-${t}`}function mr(e){let t=e.at(-1);return t==null?0:Math.max(T(t.additionStart,t.additionCount),T(t.deletionStart,t.deletionCount))}var hr=-1,gr=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++hr}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:P},t=U,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=a(e.theme??P)?x():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,Tn(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&&l(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!V(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||!l(t.diff,e)||s(e)||Or(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||!l(n,e)||!l(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);V(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)??ce}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=I(u);s==null&&i&&(a.additionLines[t]=Me(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,Tn(a,this.options.parseDiffOptions)),u=!0;else if(Cn(a,a.additionLines))this.applyRecomputePreservingSessionType(a,wn(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=Hn(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,kn(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Kn(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=Dr(e),i.code.additionLines=Tr(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Tn(r,this.options.parseDiffOptions)),i.code.additionLines[0]=Er(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,En(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(Cn(e,n)){this.applyRecomputePreservingSessionType(e,wn(e,n,t));return}this.applyExpansionRemap(Vn(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=>Ae(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=P,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=ie,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 p(Xe(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=Or(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!V(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!s(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??z(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??P}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||!l(e,n.diff)||!V(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(l(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||s(e)||Or(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||l(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&a(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&a(t.theme)}renderDiff(e=this.diff,t=j){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:o}=this.getRenderOptions(e),c=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,c!=null&&(this.renderCache={...c,diff:e,renderRange:void 0},o=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let u=e.additionLines.length>0||e.deletionLines.length>0,d=!u||s(e)||Or(e,this.getTokenizeMaxLength()),f=this.canRenderDiff(e,i,d),p=!l(e,this.renderCache.diff),m=!Se(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let a=this.renderCache.result==null&&this.renderCache.highlighted&&!d&&!p&&je(t);f&&!a&&(d||this.renderCache.result==null||!this.renderCache.highlighted&&(p||m))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||p||m||o)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,je(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!d&&u&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??z(e.name),this.highlighter??=x();let t=this.highlighter!=null&&a(i.theme),n=this.highlighter!=null&&te(this.computedLang),r=!d&&n;if(f&&this.highlighter!=null&&t&&(o||d||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,d||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!d&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!d)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=j){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 _e({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Or(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??z(e.name);let n=this.highlighter!=null&&a(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&te(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=oe(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(B({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]=Er(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&&l(i,e)&&V(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&V(a.options,n)&&l(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&&V(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&l(n.diff,e)&&V(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&&l(e,n.diff)&&V(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,p=a===`unified`,h=kr(e,this.options.loadDiffFiles!=null),g=!e.isPartial||h,_=[],v=[],y=[],b=[],{additionLines:x,deletionLines:S}=n,C={rowCount:0,hunkSeparators:u,additionsContentAST:_,deletionsContentAST:v,unifiedContentAST:y,unifiedGutterAST:he(),deletionsGutterAST:he(),additionsGutterAST:he(),expansionLineCount:c,hunkData:b,incrementRowCount(e=1){C.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:C.unifiedGutterAST.children.push(t);break;case`deletions`:C.deletionsGutterAST.children.push(t);break;case`additions`:C.additionsGutterAST.children.push(t)}}},w=ee({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),T={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`?(C.pushToGutter(`additions`,f(void 0,`buffer`,this.size)),_?.push(ur(this.size))):(C.pushToGutter(`deletions`,f(void 0,`buffer`,this.size)),v?.push(ur(this.size))),this.size=0,this.side=void 0}}},E=(e,t,n,r,i)=>{C.pushToGutter(e,m(t,n,r,i))};function D(e){T.flush(),a===`unified`?Sr(`unified`,e,C):(Sr(`deletions`,e,C),Sr(`additions`,e,C))}this.pushFileLevelAnnotations(e,a,t,C),B({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,p=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&T.flush(),r>0&&D({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:g});let m=a===`unified`?p:l,_={type:c,hunkIndex:t,lineIndex:m,unifiedLineIndex:p,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(_);n?.before!=null&&yr(n.before,C);let r=s==null?void 0:S[s.lineIndex],i=o==null?void 0:x[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});E(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${p},${l}`,u.gutterProperties),i==null?r!=null&&(r=Cr(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${p},${l}`}:void 0)):i=Cr(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${p},${l}`}:void 0),xr({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,m),createAnnotationElement:e=>this.createAnnotationElement(e),context:C}),n?.after!=null&&yr(n.after,C)}else{let n=this.getSplitInjectedRowsForLine?.(_);n?.before!=null&&br(n.before,C,T);let r=s==null?void 0:S[s.lineIndex],i=o==null?void 0:x[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`&&T.flush():(T.side!=null&&T.side!==f&&T.flush(),T.side=f,T.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,m);if(p!=null&&T.size>0&&T.flush(),s!=null){let e=Cr(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);E(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Cr(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);E(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}xr({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:C}),n?.after!=null&&br(n.after,C,T)}let v=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,y=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:p===n.unifiedLineStart+n.unifiedLineCount-1),b=v?n.noEOFCRDeletions:!1,O=v?n.noEOFCRAdditions:!1,k=(s?.noEOFCR??!1)||b,A=(o?.noEOFCR??!1)||O;if(A||k){if(a===`split`&&T.flush(),k){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(C.unifiedContentAST.push(dr(e)),C.pushToGutter(`unified`,f(e,`metadata`,1))):(C.deletionsContentAST.push(dr(e)),C.pushToGutter(`deletions`,f(e,`metadata`,1)),A||(C.pushToGutter(`additions`,f(void 0,`buffer`,1)),C.additionsContentAST.push(ur(1))))}if(A){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(C.unifiedContentAST.push(dr(e)),C.pushToGutter(`unified`,f(e,`metadata`,1))):(C.additionsContentAST.push(dr(e)),C.pushToGutter(`additions`,f(e,`metadata`,1)),k||(C.pushToGutter(`deletions`,f(void 0,`buffer`,1)),C.deletionsContentAST.push(ur(1))))}C.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||y&&h)&&D({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:y&&h?`unknown`:i,rangeSize:w,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:g}),C.incrementRowCount(1)}}),a===`split`&&T.flush();let O=Math.max(mr(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),k=t.bufferBefore>0||t.bufferAfter>0,A=!p&&e.type!==`deleted`,j=!p&&e.type!==`new`,M=C.rowCount>0||k;_=A&&M?_:void 0,v=j&&M?v:void 0,y=p&&M?y:void 0;let N=this.createPreElement(v!=null&&_!=null,O);return{fileDiff:e,unifiedGutterAST:p&&M?C.unifiedGutterAST.children:void 0,unifiedContentAST:y,deletionsGutterAST:j&&M?C.deletionsGutterAST.children:void 0,deletionsContentAST:v,additionsGutterAST:A&&M?C.additionsGutterAST.children:void 0,additionsContentAST:_,hunkData:b,preNode:N,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:O,rowCount:C.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=he(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,ke(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(o({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(o({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(o({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return M(this.renderFullAST(e,t))}renderPartialHTML(e,t){return M(t==null?e:o({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(!Le(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(Re(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(Re(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){xr({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}xr({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 Ye({fileOrDiff:e,mode:t,stickyHeader:n})}},_r=new Intl.PluralRules(`en-US`);function vr(e){return`${e} unmodified line${_r.select(e)===`one`?``:`s`}`}function yr(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function br(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 xr({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,f(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,f(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,f(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Sr(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,Z({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Z({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Z({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Z({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=pr(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?vr(n):`More unchanged context may be available`;c.pushToGutter(e,Z({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Z({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 Cr(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function wr(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Tr(e,t,n,r){let i=wr(e),a=wr(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]??=Er(e,r.getLineText(e));return l}function Er(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 Dr(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function Or(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function kr(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ar(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function jr(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 Mr(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:nt(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 Nr(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Pr(e){let t={...e};return delete t.cacheKey,t}function Fr(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??z(e.name),r=t.lang??z(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 Ir(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Lr(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&Ir(n.lines,t.deletionLines)}var Rr=-1,zr=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Rr}`;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:P},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Te,this.scrollSyncManager=new bn,this.interactionManager=new Oe(`diff`,Pe(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??P}getHunksRendererOptions(e){return Mr(e)}createHunksRenderer(e){return new gr(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=L(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(Pe(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!b(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>qe(this.editSession?.annotations,e,U);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,Ke(t,e,U))}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;De(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=bt(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||Wr(this.pre,Hr({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Gr(this.headerElement,Ur({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),at(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?q(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||!Nr(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(wt(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await gt(()=>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(Br(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(l(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(Br(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=Qe(t,U,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Ct(t.contents),a=n!=null&&Lr(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=Pr(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,Ln(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??Qe(this.lineAnnotations,U),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 u=bt(c,`FileDiff.render`),d=u?.oldFile,f=u?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:p=!1,themeType:m=`system`,expandUnchanged:h=!1}=this.options,g=p?void 0:s,_=this.hasThemeChanged(),v=u!=null,y=v&&(!Vr(d,this.deletionFile)||!Vr(f,this.additionFile)),b=e!=null&&!l(e,this.fileDiff),x=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!p&&Se(g,this.renderRange)&&!n&&!x&&!_&&(e!=null&&!b||e==null&&!y)){let e=this.applyCachedThemeState(m);return e&&this.finalizeRender(),e}let S;e==null&&v&&(y||this.fileDiff==null)&&(S=q(u.oldFile,u.newFile,this.options.parseDiffOptions));let{renderRange:C}=this;this.renderRange=g,v?(this.deletionFile=d,this.additionFile=f):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&b?this.updateExternalDiff(e,i):S!=null&&(b=!0,this.updateExternalDiff(S,i)),b&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let w=this.getLatestDiff();if(w==null)return!1;w.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Yn(w,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),h&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:T=!1,disableFileHeader:E=!1}=this.options;if(E&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(m),p){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(w,ue);e!=null&&this.applyThemeState(a,e.themeStyles,m,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??w,this.injectUnsafeCSS()}catch(e){if(T)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,x,y||b||_||!l(this.renderedDiff,w))&&this.applyPartialRender({fileDiff:w,previousRenderRange:C,renderRange:g}))){let t=this.hunksRenderer.renderDiff(w,g);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,m,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,g),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(T)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?Fr(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??z(i.name),c=x({theme:o,lang:s});c==null?p({themes:ae(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||je(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return B({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&&Fr(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?He(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(Br(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=Je(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=qn(e,this.hunksRenderer.getExpandedHunksMap(),t);return Yn(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Jn(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 pe({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 re({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]=N(o);if(e<s){let c=A({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=F({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]=N(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(){rt(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||s(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||!jr(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||!Ar(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Ie(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=ct();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:Ce(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Ce(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=be;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&&l(r,n)?i:void 0)??M(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:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,ne,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let p=u?.(n)??void 0,m=d?.(n)??void 0,h=f?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,de,p),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,g,m),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,c,h),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??=ye(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=lt(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=Fe(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=st({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Ue(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=ut(this.themeCSSStyle.textContent??``,Fe(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Ze()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?We(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=Q(t[0]),a=Q(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=M(i),r.content.innerHTML=M(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=Ge({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=Ge({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=Ge({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=Q(r?.[0]),a=Q(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=Q(r?.[0]),a=Q(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=M(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?We(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=Q(t[0]),i=Q(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};xe(u,this.appliedPreAttributes)||(tt(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 Br(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function Vr(e,t){return e==null||t==null?e==null&&t==null:_(e,t)}function Hr({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Ur({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Wr(e,t,n=!1){return!n&&e==null&&t}function Gr(e,t,n=!1){return e==null&&t&&!n}function Q(e){if(e!=null&&e.type===`element`)return e.children??[]}var Kr=3e3,qr=new Map,Jr=-1,Yr=class extends zr{__id=`little-virtualized-file-diff:${++Jr}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:qr,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=E(n)}setMetrics(e,t=!1){let n=E(e);(t||!Be(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 we(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=!Ee(t,e),r=n&&ri(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:ii(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=qr,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()??qr);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&&Le(this.renderRange)){let t=Xr(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=ci(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=E(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=H(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return B({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=R({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=S({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??H(this.metrics,n)+this.cache.fileAnnotationHeight,u;return B({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=R({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=S({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||!l(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=wt(`clone`,e,t);if(await gt(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(wt(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await gt(()=>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 pe({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,!l(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()??qr);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=H(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}=_t({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:ai(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=bt(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,u=o&&(!si(s,this.deletionFile)||!si(c,this.additionFile)),d=t??this.fileDiff;t==null&&o&&(u||this.fileDiff==null)&&(d=q(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:f,isSetup:p}=this;this.forceRenderOverride=void 0;let m=d!=null&&!l(this.fileDiff,d),h=m||u;if(e=this.getOrCreateFileContainer(e),d==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;m&&this.updateExternalDiff(d,r);let{pendingRenderDiff:g,layoutDiffChanged:_,renderedDiffChanged:v,annotationsChanged:y}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(d)??d)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:!1}:this.updatePendingRender(d,r);if((y||_)&&this.resetLayoutCache({includeEstimatedHeights:_}),p)this.top??=this.getVirtualizedTop(),_&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,g));else{this.computeApproximateSize(!1,g);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()&&(!h||!p))return a!=null&&(this.deletionFile=s,this.additionFile=c),m&&this.clearReusableHeader(),this.pendingRender=void 0,this.renderPlaceholder(this.height);let b=this.virtualizer.getWindowSpecs(),x=this.top??0,S=this.computeRenderRangeFromWindow(g,x,b);return super.render({fileDiff:d,fileContainer:e,renderRange:S,lineAnnotations:r,forceRender:(f??n)||y||v||m,...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:!l(a,o),renderedDiffChanged:!l(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 oi(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=ai(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Zr(this.cache.heightDeltas),u=H(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=ei(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+ti(i,e)*this.metrics.lineHeight+Qr(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Kr}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Qr(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=A({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?R({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?F({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?S({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:ni({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}=A({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=F({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=ai(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=H(this.metrics,i),g=e.hunks.length>0?h(this.metrics):0,{fileAnnotationHeight:_}=this.cache,v=m+_,y=Math.max(0,f-m-_-g),b=this.hasFileAnnotations(e),x=t+m,C=_>0&&b&&x<r&&x+_>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-g};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 w=Math.ceil(Math.max(r-n,0)/c),T=Math.ceil(w/s)*s+s,E=T/s,D=E,O=[],k=(n+r)/2,A=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-T*c*2),s),j=t+(A?.top??v),M=A?.renderedLineIndex??0,N,P,F;if(B({diff:e,diffStyle:l,startingLine:A?.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),_=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?R({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;j+=y;let b=M%s===0,x=Math.floor(M/s);if(b&&(O[x]=j-(t+v+y),F!=null)){if(F<=0)return!0;F--}let C=this.getLineHeight(l===`split`?m:h,g);if(j>n-C&&j<r&&(N??=x),P==null&&j+C>k&&(P=x),F==null&&j>=r&&b&&(F=D),M++,j+=C,c>0||_&&d){let e=S({type:u,metrics:this.metrics});e!=null&&(j<r&&j+e.totalHeight>n&&(N??=x),P==null&&j+e.totalHeight>k&&(P=x),j+=e.totalHeight)}return!1}}),N==null){if(C)N=0,P=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-g}}P??=N;let ee=Math.round(P-E/2),te=Math.max(0,Math.ceil(p/s)-E),I=Math.max(0,Math.min(ee,te)),ne=I*s,re=ee<0?T+ee*s:T,L=O[I]??0,ie=ne===0?0:_+L,z=I+re/s,ae=z<O.length?y-O[z]:y-(j-t-v);return{startingLine:ne,totalLines:re,bufferBefore:ie,bufferAfter:Math.max(0,ae)}}};function Xr(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===ve&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Zr(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 Qr({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=$r(e,n);return(t[$r(e,r)]??0)-(t[i]??0)}function $r(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 ei(e){return Math.ceil(e/Kr)*Kr}function ti(e,t){let n=0;for(let r of e)r<t&&n++;return n}function ni({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 ri(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 ii(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 ai(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function oi(e){return typeof e==`function`?`custom`:e??`line-info`}function si(e,t){return e==null||t==null?e==null&&t==null:_(e,t)}function ci(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var $=e(n(),1),li=typeof window>`u`?$.useEffect:$.useLayoutEffect;function ui({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=$e(),_=s!==void 0,v=(0,$.useContext)(w),y=ot(),b=et(e=>m?.(e)),x=m==null?void 0:b,S=(0,$.useRef)(null),C=et(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}),T=h==null?void 0:C,E=(0,$.useMemo)(()=>{if(e!=null)return e;let{current:i}=S,a=i?.filePair;if(i!=null&&a!=null){if(di(t,n,a.stale)||di(t,n,a.installed))return a.fileDiff;i.filePair=null}return q(t??null,n??null,r?.parseDiffOptions)},[e,t,n,r?.parseDiffOptions]),D=(0,$.useRef)(null),O=(0,$.useRef)(null),k=et(()=>{if(y==null)throw Error(`FileDiff: EditContext is not attached`);return y(`file-diff`,i??{},a)}),A=et(e=>{if(e!=null){if(D.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?D.current=new zr(pi({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:T,options:r}),f?void 0:v,!0):D.current=new Yr(pi({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:T,options:r}),g,l,f?void 0:v,!0),p&&O.current==null&&(O.current=mi(D.current,k)),D.current.hydrate({fileDiff:E,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(D.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);D.current.cleanUp(),D.current=null,O.current=null}});return li(()=>{let{current:e}=D;if(e==null)return;let t=pi({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:T,options:r}),n=t!==void 0&&!Ee(e.options,t);if(e.setOptions(t),!p&&O.current!=null){let{current:e}=O;O.current=null,e()}let i=fi(E,o,S);e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),p&&O.current==null&&(O.current=mi(e,k))}),{fileDiff:E,ref:A,getHoveredLine:(0,$.useCallback)(()=>D.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,$.useCallback)(e=>D.current?.getAnnotationSlotName(e)??U(e),[])}}function di(e,t,n){return ze(e??void 0,n.oldFile??void 0)&&ze(t??void 0,n.newFile??void 0)}function fi(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&&(l(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 pi({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?ge:e?.renderCustomHeader,renderGutterUtility:r?ge:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function mi(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function hi({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S}=ui({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y});return(0,W.jsx)(C,{ref:b,className:s,style:c,children:it(mt({fileDiff:e,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:a,getHoveredLine:x,getAnnotationSlotName:S}),l)})}function gi(e){if(!e.startsWith(`"`))return e;if(!e.endsWith(`"`))return null;let t=[],n={a:`\x07`,b:`\b`,f:`\f`,n:`
15
+ `,r:`\r`,t:` `,v:`\v`,'"':`"`,"\\":`\\`};for(let r=1;r<e.length-1;r++){let i=e[r];if(i===`"`)return null;if(i!==`\\`){let n=e.codePointAt(r);t.push(...new TextEncoder().encode(String.fromCodePoint(n))),n>65535&&r++;continue}let a=e[++r];if(a===void 0)return null;if(/[0-7]/.test(a)){let n=e.slice(r,r+3);if(!/^[0-7]{3}$/.test(n)||parseInt(n,8)>255)return null;t.push(parseInt(n,8)),r+=2}else{let e=n[a];if(e===void 0)return null;t.push(...new TextEncoder().encode(e))}}try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(new Uint8Array(t))}catch{return null}}function _i(e,t){let n=gi(e);return n?.startsWith(t)?n.slice(2):null}function vi(e){let t=e.split(/^@@ /m,1)[0]??``,n=/^--- (.*)$/m.exec(t)?.[1],r=/^\+\+\+ (.*)$/m.exec(t)?.[1],i,a;if(n!==void 0&&r!==void 0){let e=n.endsWith(` `)?n.slice(0,-1):n,t=r.endsWith(` `)?r.slice(0,-1):r;if(i=e===`/dev/null`?null:_i(e,`a/`),a=t===`/dev/null`?null:_i(t,`b/`),e!==`/dev/null`&&i===null||t!==`/dev/null`&&a===null)return null}else{let e=/^diff --git (.*)$/m.exec(t)?.[1];if(!e)return null;let n=[],r=!1;for(let t=0;t<e.length;t++){if(r&&e[t]===`\\`){t++;continue}if(e[t]===`"`&&(r=!r),r||e[t]!==` `)continue;let i=_i(e.slice(0,t),`a/`),a=_i(e.slice(t+1),`b/`);i!==null&&a!==null&&n.push({oldPath:i,newPath:a})}if(n.length!==1)return null;({oldPath:i,newPath:a}=n[0])}let o=a??i;return o?i!==null&&i!==o?{name:o,prevName:i}:{name:o}:null}function yi(e){let t=Array.from(e.matchAll(/^diff --git /gm),e=>e.index);return t.length<2?[e]:[0,...t.slice(1)].map((t,n,r)=>e.slice(t,r[n+1]))}function bi(e,t=`diff-panel`,n){if(!e)return null;let i=e.replace(/^\n+|\n+$/g,``);if(i.trim().length===0)return null;try{let e=new Map;if(n?.patch?.kind===`files`)for(let t of n.patch.files){if(!t.cacheKey)continue;let n=t.cacheKey.slice(0,t.cacheKey.lastIndexOf(`:`)),r=e.get(n)??[];r.push(t),e.set(n,r)}let a=new Map;if(e.size&&n)for(let e of yi(n.source)){let n=e.replace(/^\n+|\n+$/g,``);a.set(r(n,t),n)}let o=yi(i).flatMap(n=>{let i=n.replace(/\n+$/,``),o=r(i,t),s=e.get(o);if(s&&a.get(o)===i)return s;let c=vi(i);if(!c)throw Error(`Unsupported or ambiguous Git file paths.`);return Yt(`${i}\n`,o).flatMap(e=>e.files).map((e,t)=>(e.name=c.name,c.prevName===void 0?delete e.prevName:e.prevName=c.prevName,e.cacheKey=`${o}:${t}`,e))});return o.length>0?{kind:`files`,files:o}:{kind:`raw`,text:i,reason:`Unsupported diff format. Showing raw patch.`}}catch{return{kind:`raw`,text:i,reason:`Failed to parse patch. Showing raw patch.`}}}var xi=class{#e;parse(e,t,n){let r=n===void 0?bi(e,t,this.#e):n;return this.#e=e.trim().length?{source:e,patch:r}:void 0,r}},Si=i();function Ci(e,t,n){let r=t+n;return r>=0&&r<e?r:null}function wi(e,t,n){if(e===0)return-1;let r=0,i=e;for(;r<i;){let e=r+i>>>1;t(e)<=n?r=e+1:i=e}return Math.max(0,r-1)}function Ti(e,t,n){let r=(0,Si.c)(27),[i,a]=(0,$.useState)(null),o;r[0]!==n||r[1]!==t.length||r[2]!==e?(o=()=>{let r=e.current?.querySelector(`.diff-render-surface`);if(!n||!t.length||!r){a(null);return}let i=Array.from(r.querySelectorAll(`[data-diff-file-path]`)),o=0,s=()=>{if(o=0,r.clientHeight===0)return;let e=r.scrollTop>0&&r.scrollHeight-r.clientHeight-r.scrollTop<=1?i.length-1:wi(i.length,e=>i[e].getBoundingClientRect().top,r.getBoundingClientRect().top+8);a(i[e]?.dataset.diffFilePath??null)},c=()=>{o||=requestAnimationFrame(s)},l=new ResizeObserver(c);l.observe(r);for(let e of i)l.observe(e);return r.addEventListener(`scroll`,c,{passive:!0}),c(),()=>{l.disconnect(),r.removeEventListener(`scroll`,c),o&&cancelAnimationFrame(o)}},r[0]=n,r[1]=t.length,r[2]=e,r[3]=o):o=r[3];let s;r[4]!==n||r[5]!==t||r[6]!==e?(s=[n,t,e],r[4]=n,r[5]=t,r[6]=e,r[7]=s):s=r[7],(0,$.useEffect)(o,s);let c;r[8]!==t||r[9]!==i?(c=t.length===0?-1:Math.max(0,t.indexOf(i??``)),r[8]=t,r[9]=i,r[10]=c):c=r[10];let l=c,u;r[11]!==l||r[12]!==t||r[13]!==e?(u=n=>{let r=Ci(t.length,l,n);if(r===null)return;let i=Array.from(e.current?.querySelectorAll(`[data-diff-file-path]`)??[]).find(e=>e.dataset.diffFilePath===t[r]);i&&(i.scrollIntoView({block:`start`,behavior:`instant`}),a(t[r]))},r[11]=l,r[12]=t,r[13]=e,r[14]=u):u=r[14];let d=u,f=t[l]??null,p;r[15]!==l||r[16]!==t.length?(p=Ci(t.length,l,-1),r[15]=l,r[16]=t.length,r[17]=p):p=r[17];let m=p!==null,h;r[18]!==l||r[19]!==t.length?(h=Ci(t.length,l,1),r[18]=l,r[19]=t.length,r[20]=h):h=r[20];let g=h!==null,_;return r[21]!==l||r[22]!==d||r[23]!==f||r[24]!==m||r[25]!==g?(_={index:l,path:f,jump:d,canPrevious:m,canNext:g},r[21]=l,r[22]=d,r[23]=f,r[24]=m,r[25]=g,r[26]=_):_=r[26],_}export{xi as n,hi as r,Ti as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./presentationTier-DPVAxTK4.js";import{m as t,x as n}from"./appearancePreferences-NnsvXwBe.js";import{t as r}from"./useAppearancePreference-Ix13pMKy.js";var i=e();function a(e){n(`diffLayout`,e),t()}function o(){let e=(0,i.c)(2),t=r(`diffLayout`)===`split`?`split`:`stacked`,n;return e[0]===t?n=e[1]:(n=[t,a],e[0]=t,e[1]=n),n}export{o as t};