ryco-cli 0.1.29 → 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.
- package/README.md +37 -0
- package/dist/{AcpAdapter-8CSe4HK7.cjs → AcpAdapter-ByUp9-wk.cjs} +74 -54
- package/dist/{AcpAdapter-CG1wRWcf.mjs → AcpAdapter-CY_ANTKu.mjs} +74 -54
- package/dist/{AcpNativeLogging-B6TtnnKL.mjs → AcpNativeLogging-C7PC6imv.mjs} +30 -4
- package/dist/{AcpNativeLogging-DbjnRnTf.cjs → AcpNativeLogging-OQeAya9d.cjs} +33 -1
- package/dist/{AcpRegistryDriver-16ZTxUs3.cjs → AcpRegistryDriver-CD9GN7rI.cjs} +3 -3
- package/dist/{AcpRegistryDriver-DZFasKaz.mjs → AcpRegistryDriver-DMZ5VBWJ.mjs} +4 -4
- package/dist/AzureDevOpsSourceControlProvider-5giVYoNi.mjs +2053 -0
- package/dist/AzureDevOpsSourceControlProvider-BKMXEUaN.cjs +2055 -0
- package/dist/{BitbucketSourceControlProvider-DplKc8Wo.mjs → BitbucketSourceControlProvider-BVUBsEUF.mjs} +63 -23
- package/dist/{BitbucketSourceControlProvider-B-ZwKj72.cjs → BitbucketSourceControlProvider-BWnnrbch.cjs} +62 -22
- package/dist/{BunPTY-Dcl1Lp62.mjs → BunPTY-CMbDQ1Xb.mjs} +1 -1
- package/dist/{ClaudeDriver-r0lJ9vmE.cjs → ClaudeDriver-DCrqouOR.cjs} +1376 -194
- package/dist/{ClaudeDriver-0gGVop27.mjs → ClaudeDriver-DVOss8cC.mjs} +1377 -195
- package/dist/{CodexDriver-bJAbhSwY.cjs → CodexDriver-CBQPHJqU.cjs} +259 -29
- package/dist/{CodexDriver-baT02xVb.mjs → CodexDriver-DJoTky7Z.mjs} +261 -31
- package/dist/{CodexTextGeneration-Dwp6X3dq.mjs → CodexTextGeneration-BSgNgfZv.mjs} +6 -6
- package/dist/{CodexTextGeneration-DFZ5y4gj.cjs → CodexTextGeneration-C9MDQmZm.cjs} +7 -7
- package/dist/{CopilotDriver-C0OhnSB1.mjs → CopilotDriver-CUkdPXcH.mjs} +78 -20
- package/dist/{CopilotDriver-B_jEqfYQ.cjs → CopilotDriver-DbaMDH16.cjs} +76 -18
- package/dist/{CursorDriver-DinXkGP9.mjs → CursorDriver-B-ZilXJB.mjs} +115 -98
- package/dist/{CursorDriver-BBFEW7ZI.cjs → CursorDriver-DKQqPbKH.cjs} +116 -99
- package/dist/{ForgejoSourceControlProvider-iG9o7aZB.cjs → ForgejoSourceControlProvider-CgpjFECj.cjs} +94 -60
- package/dist/{ForgejoSourceControlProvider-Dr0fxfud.mjs → ForgejoSourceControlProvider-DemMYUye.mjs} +95 -61
- package/dist/{GitHubSourceControlProvider-L1yFpep4.cjs → GitHubSourceControlProvider-C4un6hOK.cjs} +218 -119
- package/dist/{GitHubSourceControlProvider-CnIu0n2Y.mjs → GitHubSourceControlProvider-CRSDYcjc.mjs} +206 -108
- package/dist/GitLabSourceControlProvider-D8W1ZLPh.cjs +2260 -0
- package/dist/GitLabSourceControlProvider-DpWkJ0M3.mjs +2258 -0
- package/dist/{GrokDriver-D_Ylzh5z.cjs → GrokDriver-BQ6G_7ZZ.cjs} +11 -12
- package/dist/{GrokDriver-pX-N6HGS.mjs → GrokDriver-Buvas9-q.mjs} +7 -8
- package/dist/{Metrics-BjqGlIP4.mjs → Metrics-C3vLS9rz.mjs} +1264 -1151
- package/dist/{Metrics-Bf96NJ4j.cjs → Metrics-DjRPLE98.cjs} +1295 -1134
- package/dist/{NodePTY-D7tFWuQe.mjs → NodePTY-DgnuBruq.mjs} +1 -1
- package/dist/{NodeSqliteClient-BGg70C7Q.cjs → NodeSqliteClient-D8bzGgPN.cjs} +1 -1
- package/dist/{OpenCodeDriver-Byu1pf_i.mjs → OpenCodeDriver-BWEZD841.mjs} +184 -50
- package/dist/{OpenCodeDriver-BFEw5t09.cjs → OpenCodeDriver-qUiX0RLH.cjs} +185 -51
- package/dist/{SideQuestionIsolation-81IoAuoi.mjs → SideQuestionIsolation-B1T-DsR0.mjs} +1 -1
- package/dist/{SideQuestionIsolation-CMPkCUP0.cjs → SideQuestionIsolation-BPC-Bxsz.cjs} +1 -1
- package/dist/bin.cjs +50689 -15659
- package/dist/bin.mjs +50578 -15585
- package/dist/client/assets/AccountSettings-B88Q_w9Y.js +1 -0
- package/dist/client/assets/AiFocusSettings-Bb0TrCPn.js +1 -0
- package/dist/client/assets/{AnimatedHeight-BNg7wnTK.js → AnimatedHeight-epXOsgdm.js} +1 -1
- package/dist/client/assets/AppearanceSettings-XS9WRVPU.js +1 -0
- package/dist/client/assets/AutomationsDialog-bZckh4Y3.js +1 -0
- package/dist/client/assets/AutomationsSummary-wPFZCF49.js +1 -0
- package/dist/client/assets/BranchToolbar.logic-DjzLKbbB.js +3 -0
- package/dist/client/assets/BrowserPanel-CdBLnnfz.js +1 -0
- package/dist/client/assets/ChatRightPanel-BCINd0vP.js +34 -0
- package/dist/client/assets/ChatThreadRouteView-BFZ0Si-l.js +1 -0
- package/dist/client/assets/ColorSwatchPicker-CGyo99o0.js +1 -0
- package/dist/client/assets/CommandPalette.logic-BIOMtnEQ.js +1 -0
- package/dist/client/assets/CommandPaletteDialog-Db4LH--z.js +2 -0
- package/dist/client/assets/CompositeRoot-DtnwMJKj.js +1 -0
- package/dist/client/assets/ComputerUseSettings-CkqCqDsU.js +1 -0
- package/dist/client/assets/ConnectionsSettings-B9mxExdG.js +7 -0
- package/dist/client/assets/CreatePullRequestDialog-CJ7pNCue.js +1 -0
- package/dist/client/assets/CreatePullRequestDialogHost-n4ZjdSr4.js +1 -0
- package/dist/client/assets/DiagnosticsSettings-f9rFG9re.js +2 -0
- package/dist/client/assets/DiagnosticsSettings.logic-Byf-Bu4S.js +1 -0
- package/dist/client/assets/DialogHandle-C0c_rK3I.js +1 -0
- package/dist/client/assets/{DialogPopup-DdZlhHuQ.js → DialogPopup-BKW1PEEa.js} +1 -1
- package/dist/client/assets/DialogRoot-BIubqrv0.js +1 -0
- package/dist/client/assets/DialogTitle-BAX_FLoG.js +1 -0
- package/dist/client/assets/{DialogViewport-BwuqbGLY.js → DialogViewport-C2iOUx0O.js} +1 -1
- package/dist/client/assets/DiffPanel-BkqDt_SS.js +25 -0
- package/dist/client/assets/DisclosureRegion-B8556yU0.js +1 -0
- package/dist/client/assets/DraftChatThreadRouteView-BKgRKJ2w.js +1 -0
- package/dist/client/assets/{ExternalIdentityWeb.logic-DsTJQkg-.js → ExternalIdentityWeb.logic-Cu6suNrN.js} +1 -1
- package/dist/client/assets/GlassSurface-DLYYzRdP.js +1 -0
- package/dist/client/assets/HostedConnectionControls-CoVqtnrK.js +1 -0
- package/dist/client/assets/HostedHubRoot-CM2CwPUr.js +2 -0
- package/dist/client/assets/{HostedNativeAuthorizationRoute-BSq_AlY2.js → HostedNativeAuthorizationRoute-Bizmqrh_.js} +2 -2
- package/dist/client/assets/HostedNodeRenameDialog-SXWMsTO0.js +1 -0
- package/dist/client/assets/HostedRelayTrustNotice-BfTyrBi5.js +1 -0
- package/dist/client/assets/InboxStatusGlyph-BPTqzp7l.js +1 -0
- package/dist/client/assets/IntegrationsSettingsPanel-DAPvkV4i.js +1 -0
- package/dist/client/assets/KeybindingsSettings-B8g-YI2O.js +1 -0
- package/dist/client/assets/LazyBrowserPanel-Ds9cdOC_.js +2 -0
- package/dist/client/assets/McpServersSettings-Dw6G3ff3.js +6 -0
- package/dist/client/assets/MobileSheet-DfgXNWbd.js +1 -0
- package/dist/client/assets/ModelTuningDial-DQBAbuNL.js +1 -0
- package/dist/client/assets/NewWorktreeDialog-CDZAJmK6.js +4 -0
- package/dist/client/assets/NodeSecuritySettings-3MELA9ru.js +1 -0
- package/dist/client/assets/NullStore-gT_6_xZE.js +1 -0
- package/dist/client/assets/OnboardingDialog-CAAtNnJf.js +1 -0
- package/dist/client/assets/OpinionatedPluginsSettings-AiDB0Vl4.js +1 -0
- package/dist/client/assets/{PdfAttachmentPreview-CTo1AyZs.js → PdfAttachmentPreview-BFNW2wjN.js} +2 -2
- package/dist/client/assets/{PhoneGetAppInterstitial-DwopOWnQ.js → PhoneGetAppInterstitial-D8fwZ8E9.js} +1 -1
- package/dist/client/assets/PhoneHome-YHgHljA0.js +1 -0
- package/dist/client/assets/PhoneSettingsSurface-BVxJppvK.js +2 -0
- package/dist/client/assets/PreviewPanel-BYcEnkv9.js +643 -0
- package/dist/client/assets/ProjectScriptDialog-K34K2Kzm.js +1 -0
- package/dist/client/assets/ProjectsPage-DXnMYLjb.js +1 -0
- package/dist/client/assets/PromoteChatDialog-CAY7_wJ-.js +1 -0
- package/dist/client/assets/ProviderLimitWindow-CK04BSkM.js +1 -0
- package/dist/client/assets/ProviderUpdateLaunchNotification.logic-BMBrDDOC.js +1 -0
- package/dist/client/assets/ProvidersSettingsPanel-C85PX9Es.js +1 -0
- package/dist/client/assets/PullRequestsPage-C0rgfGwB.js +1 -0
- package/dist/client/assets/{QuitShortcutFeedback-eCvP_MNj.js → QuitShortcutFeedback-DSkKqETs.js} +1 -1
- package/dist/client/assets/RedactedSensitiveText-DQ0YveQd.js +1 -0
- package/dist/client/assets/RollingText-BzvpP5fa.js +1 -0
- package/dist/client/assets/RootAppShell-BYQ-eGNT.js +6 -0
- package/dist/client/assets/{Separator-BiINUUQl.js → Separator-DpiW19Vw.js} +1 -1
- package/dist/client/assets/SettingsPage-BCFN7Ju2.js +2 -0
- package/dist/client/assets/SettingsPanels-CP6z2b1x.js +3 -0
- package/dist/client/assets/SettingsPanels.editor-D8U-TWWG.js +1 -0
- package/dist/client/assets/SettingsSelect-DEhNaz3E.js +1 -0
- package/dist/client/assets/Sidebar.logic-D_ODfSpl.js +1 -0
- package/dist/client/assets/SimulatorPanel-DCT6fZ0X.js +1 -0
- package/dist/client/assets/SourceControlSettings-DxUtvPMK.js +1 -0
- package/dist/client/assets/StatisticsPage-C9SrwtM4.js +1 -0
- package/dist/client/assets/StatisticsPanel-BMYLETs0.js +1 -0
- package/dist/client/assets/ThreadLinkList-BN5z5EpS.js +169 -0
- package/dist/client/assets/ThreadTerminalDrawer-CgIFOlR-.js +18 -0
- package/dist/client/assets/ThreadWorkspacePanel-DvXoqQPF.js +3 -0
- package/dist/client/assets/ToolbarRootContext-8FsV9Cpj.js +1 -0
- package/dist/client/assets/TraitsPicker-DcrpJahy.js +1 -0
- package/dist/client/assets/Virtualizer-CwXeUPla.js +1345 -0
- package/dist/client/assets/WorkspacePullRequestPanel-3mlcJn9G.js +1 -0
- package/dist/client/assets/WorkspaceReview-UGbCgXeK.js +2 -0
- package/dist/client/assets/{abnfDiagram-N423BO3Z-DAmGykdr.js → abnfDiagram-N423BO3Z-DVEM6Scc.js} +1 -1
- package/dist/client/assets/{activity-DRZlu-MC.js → activity-DVCuAejY.js} +1 -1
- package/dist/client/assets/{alert-CwrDisFU.js → alert-FV7ZIit_.js} +1 -1
- package/dist/client/assets/alert-dialog-CgXR9tED.js +1 -0
- package/dist/client/assets/app-window-3xtwqZgI.js +1 -0
- package/dist/client/assets/appChrome-COCz-T7w.js +1 -0
- package/dist/client/assets/{appearancePreferences-nFx4MHoI.js → appearancePreferences-NnsvXwBe.js} +1 -1
- package/dist/client/assets/architecture-7GRP2DOG-DXXb_0_g.js +1 -0
- package/dist/client/assets/{architectureDiagram-T3A2C74G-DypU2ERW.js → architectureDiagram-T3A2C74G-B6pcKiCj.js} +1 -1
- package/dist/client/assets/{arrow-left-XhcJWpRy.js → arrow-left-Blu3LSE2.js} +1 -1
- package/dist/client/assets/{arrow-right-BBs6iTUL.js → arrow-right-CO3CH0ne.js} +1 -1
- package/dist/client/assets/arrow-up-B69gV2Bq.js +1 -0
- package/dist/client/assets/{arrow-up-right-CJ9Vq7nK.js → arrow-up-right-BbPGFOLA.js} +1 -1
- package/dist/client/assets/authorization-Ob6YwWiI.js +1 -0
- package/dist/client/assets/autocomplete-RVpjsrDv.js +1 -0
- package/dist/client/assets/ban-BIm2PVkE.js +1 -0
- package/dist/client/assets/{blockDiagram-VBNYF7ZC-B9MhR9hY.js → blockDiagram-VBNYF7ZC-WNerGp9V.js} +1 -1
- package/dist/client/assets/{bot-D5wgL7pu.js → bot-C9nWtaWq.js} +1 -1
- package/dist/client/assets/browserState-jt47YsqD.js +1 -0
- package/dist/client/assets/{c4Diagram-5PPSVZJV-C22FWSoE.js → c4Diagram-5PPSVZJV-wp1ioOoM.js} +1 -1
- package/dist/client/assets/camera-C13VoW3c.js +1 -0
- package/dist/client/assets/capabilities-CfOhq009.js +1 -0
- package/dist/client/assets/channel-56r2qL2v.js +1 -0
- package/dist/client/assets/{chart-column-D6Lnkklk.js → chart-column-DRv0YtL_.js} +1 -1
- package/dist/client/assets/checkbox-CIIIY9FA.js +1 -0
- package/dist/client/assets/checks-Dw022Bvy.js +1 -0
- package/dist/client/assets/{chunk-2GRJ4B5K-D1tZuCzA.js → chunk-2GRJ4B5K-DRl3ILpc.js} +1 -1
- package/dist/client/assets/{chunk-4I5QYGJK-Clf86zK0.js → chunk-4I5QYGJK-CYTRl4bo.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-B36N5RYZ.js → chunk-5RXB4S5H-VCNwRsOa.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-IAxdzsQJ.js → chunk-6Q2QTUOP-DnSeKGPG.js} +1 -1
- package/dist/client/assets/{chunk-7Z6QIM7H-Ctqebv_4.js → chunk-7Z6QIM7H-Cjilh9TF.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-CAfciJae.js → chunk-GF5L2VYU-CGR7AW0t.js} +1 -1
- package/dist/client/assets/{chunk-I66GZJ75-BZ7XtZf4.js → chunk-I66GZJ75-CXSn8dDu.js} +1 -1
- package/dist/client/assets/{chunk-JQJVKLGR-DVuZCWnv.js → chunk-JQJVKLGR-Dro-75lU.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-DtWbzsRm.js → chunk-KBJHAD2P-BDqN2kVf.js} +1 -1
- package/dist/client/assets/{chunk-NSK5VX7P-BVMz_Hc4.js → chunk-NSK5VX7P-DGo5UczH.js} +1 -1
- package/dist/client/assets/{chunk-QR6OTTB3-DWitTCy-.js → chunk-QR6OTTB3-RWuyWnBI.js} +1 -1
- package/dist/client/assets/{chunk-UBXNYLIW-BuxXXP2s.js → chunk-UBXNYLIW-BPRzeB0w.js} +1 -1
- package/dist/client/assets/{chunk-W5SLKNZC-Bnf3sQl4.js → chunk-W5SLKNZC-DYWocTFi.js} +1 -1
- package/dist/client/assets/{chunk-WRU74C26-xu-KDOon.js → chunk-WRU74C26-ChbB1jY3.js} +1 -1
- package/dist/client/assets/circle-stop-D8B4hRpY.js +1 -0
- package/dist/client/assets/circle-x-CNLfrTqR.js +1 -0
- package/dist/client/assets/classDiagram-JCYQIIEL-DGvmFev3.js +1 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-DGvmFev3.js +1 -0
- package/dist/client/assets/{clipboard-copy-oDSkUUg4.js → clipboard-copy-DGi8FKNO.js} +1 -1
- package/dist/client/assets/clock-3-DmJ4_XPI.js +1 -0
- package/dist/client/assets/clock-DZIuPtNG.js +1 -0
- package/dist/client/assets/color-picker-BdBXje-a.js +1 -0
- package/dist/client/assets/columns-2-CWlMOClK.js +1 -0
- package/dist/client/assets/combobox-Dtjtf7AB.js +1 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-DGNyiNSf.js → cynefin-OW5HDTMX-TuShvMuM.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-_ctibv4i.js → cynefinDiagram-MW4NZA55-B0Edt2Em.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-Bo-bS1Y0.js → dagre-VZM6K2ZE-D-eiuqHx.js} +1 -1
- package/dist/client/assets/{data-list-DLsM39Hp.js → data-list-BAx6jBY1.js} +1 -1
- package/dist/client/assets/desktopUpdateAtoms-BjrLa3tl.js +1 -0
- package/dist/client/assets/desktopWorkspace-C2wXVBhc.js +1 -0
- package/dist/client/assets/{deviceName-z0ZWSq0z.js → deviceName-B4youG0v.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-DSjtw1SY.js → diagram-7IWD3JNH-DgM6lMlR.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-B7fWEvIa.js → diagram-B4RE2ZJO-CyHNDjzV.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-trRYCE5d.js → diagram-LBJQPF4R-DDzuLIN5.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE-_DYcRggk.js → diagram-Q27KOJAE-BaBvK9QB.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-BkMzOHX8.js → diagram-UB23O5K3-CzZ2ewuZ.js} +1 -1
- package/dist/client/assets/dialogWords-Cg0YkJVg.js +1 -0
- package/dist/client/assets/diffRouteSearch-D2MKN_ah.js +1 -0
- package/dist/client/assets/disclosureMotion-cbMJn5-z.js +1 -0
- package/dist/client/assets/{download-CHdS3R_v.js → download-TvtXS4hE.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-DubiOMCG.js → ebnfDiagram-BXEA7PRR-CL1vdOKi.js} +1 -1
- package/dist/client/assets/editorPreferences-DqKyA-2Z.js +1 -0
- package/dist/client/assets/ellipsis-CDK1dNFZ.js +1 -0
- package/dist/client/assets/ellipsis-vertical-CwzEUTwV.js +1 -0
- package/dist/client/assets/{empty-BlBl_Vvw.js → empty-BovKoxbn.js} +1 -1
- package/dist/client/assets/{erDiagram-JOGREHBK-CFDiNfSJ.js → erDiagram-JOGREHBK-DmQR2if6.js} +1 -1
- package/dist/client/assets/eventmodeling-NTZA5JFV-D272GIcY.js +1 -0
- package/dist/client/assets/external-link-CJeVJZ7s.js +1 -0
- package/dist/client/assets/eye-BUmrXqzg.js +1 -0
- package/dist/client/assets/file-diff-BWc3mYsz.js +1 -0
- package/dist/client/assets/flowDiagram-UKHOOZJN-DLyS38Mm.js +1 -0
- package/dist/client/assets/folder-git-2-CPxg5wKP.js +1 -0
- package/dist/client/assets/folder-open-DcMymvp1.js +1 -0
- package/dist/client/assets/formatCount-B4KLI651.js +1 -0
- package/dist/client/assets/{ganttDiagram-PKOTCBZU-DT2XhE-m.js → ganttDiagram-PKOTCBZU-1q2nUL92.js} +1 -1
- package/dist/client/assets/git-pull-request-BFPwpm3c.js +1 -0
- package/dist/client/assets/{gitGraph-4MIJSDKK-BI5UGiqb.js → gitGraph-4MIJSDKK-COtwmv2S.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-CzAB97Rd.js → gitGraphDiagram-DS77QQ5N-ChsvaxX4.js} +1 -1
- package/dist/client/assets/{group-DZJuSiJL.js → group-DWWn0dTx.js} +1 -1
- package/dist/client/assets/hammer-BXo-EU88.js +1 -0
- package/dist/client/assets/hostedConnectionCoordinator-BkAE-RhA.js +1 -0
- package/dist/client/assets/hostedPairing-5n5srRC9.js +1 -0
- package/dist/client/assets/{index-BAJdq3TK.js → index-DARIYokI.js} +2 -2
- package/dist/client/assets/{info-A6RAGUB7-DdGYYgLX.js → info-A6RAGUB7-CI2qZ9wW.js} +1 -1
- package/dist/client/assets/{infoDiagram-6WML65LV-zhUpER6a.js → infoDiagram-6WML65LV-BPmgcTPH.js} +1 -1
- package/dist/client/assets/{input-CzU08wbL.js → input-CCie4mm1.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-BQLkqykE.js → ishikawaDiagram-WSZJBQD7-LyS9p3Yg.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-DBgsbKOF.js → journeyDiagram-NVQOT4AX-BYaAmN65.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-DF-Rr-xs.js → kanban-definition-27J2QSJJ-D-pwzqFt.js} +1 -1
- package/dist/client/assets/{key-round-CvyrSjb2.js → key-round-BlrUTfxB.js} +1 -1
- package/dist/client/assets/keyboard-DlBdq6sz.js +1 -0
- package/dist/client/assets/label-ChtVI9lp.js +1 -0
- package/dist/client/assets/layers-BB-ruGvd.js +1 -0
- package/dist/client/assets/lifecycleSuggestionPolicy-0ERe_O53.js +1 -0
- package/dist/client/assets/list-checks-BkM_ZRsj.js +1 -0
- package/dist/client/assets/loader-3vQnfqIT.js +1 -0
- package/dist/client/assets/{log-out-D3rICSt5.js → log-out-CKq9YiLY.js} +1 -1
- package/dist/client/assets/{logging-C6tXZlGQ.js → logging-CCg76rgn.js} +1 -1
- package/dist/client/assets/main-Ch0bwS-M.js +9 -0
- package/dist/client/assets/main-Di0isH9D.css +2 -0
- package/dist/client/assets/{mermaid-parser.core-BiGKtilP.js → mermaid-parser.core-RK9ah5RM.js} +2 -2
- package/dist/client/assets/{mermaidEngine-Cjfgf3Bg.js → mermaidEngine-Dr8UsPhH.js} +3 -3
- package/dist/client/assets/message-circle-dashed-BrjwqS7-.js +1 -0
- package/dist/client/assets/messageQueueDrain-B7R7Qmq6.js +1 -0
- package/dist/client/assets/messages-square-cDTkDJv_.js +1 -0
- package/dist/client/assets/{mindmap-definition-FAOFIHXS-SiU9JwWJ.js → mindmap-definition-FAOFIHXS-DVudWasx.js} +1 -1
- package/dist/client/assets/{packet-AYTQ26CC-F-HuW5Dr.js → packet-AYTQ26CC-DnkTsVhD.js} +1 -1
- package/dist/client/assets/{pairingUrl-rQM9kSGT.js → pairingUrl-Dn1e2CVw.js} +1 -1
- package/dist/client/assets/panels-top-left-B7jZiLth.js +1 -0
- package/dist/client/assets/path-text-3Rfu6lt8.js +1 -0
- package/dist/client/assets/{pegDiagram-VL7TDLO6-cC-QUd7I.js → pegDiagram-VL7TDLO6-Do5PIp8B.js} +1 -1
- package/dist/client/assets/pencil-Bzg-nc6d.js +1 -0
- package/dist/client/assets/{pie-WAS4IAKB-BI3XUcLN.js → pie-WAS4IAKB-B_nNQOzn.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-BP4gJ4ZK.js → pieDiagram-7S7Q4E2Y-D_IG4xwA.js} +1 -1
- package/dist/client/assets/{play-BJZrOx6T.js → play-DpXXQ1qB.js} +1 -1
- package/dist/client/assets/popover-OWEv6cQz.js +48 -0
- package/dist/client/assets/presentationTier-DPVAxTK4.js +1 -0
- package/dist/client/assets/previewRouteSearch-BjZdTuSf.js +1 -0
- package/dist/client/assets/primary-Cf-xJExj.js +4 -0
- package/dist/client/assets/primitives-CxTBN7D4.js +1 -0
- package/dist/client/assets/projectCheckouts.logic-DUT4AxXr.js +1 -0
- package/dist/client/assets/projectPaths-B8aVmOZX.js +1 -0
- package/dist/client/assets/projectPreferences-CzWBItFj.js +1 -0
- package/dist/client/assets/providerCapabilities-B2YOPsLN.js +1 -0
- package/dist/client/assets/providerDriverMeta-BHHL9uw0.js +1 -0
- package/dist/client/assets/providerModels-v9PYbzRE.js +1 -0
- package/dist/client/assets/providerStatus-CDPaqb0S.js +1 -0
- package/dist/client/assets/pullRequestsModel.logic-Dv_om_C4.js +1 -0
- package/dist/client/assets/{qr-code-BFO8lV1M.js → qr-code-BlbiBIwH.js} +1 -1
- package/dist/client/assets/{qr-code-Cmfz5JKf.js → qr-code-DywzVgQC.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-DO-N1m-q.js → quadrantDiagram-CIZ2JOQS-DY6fJyrM.js} +1 -1
- package/dist/client/assets/{radar-RG4KPBEZ-CfayXQ5F.js → radar-RG4KPBEZ-D9689I5m.js} +1 -1
- package/dist/client/assets/radio-group-DVwD6Cuy.js +1 -0
- package/dist/client/assets/{railroad-74A4TZTK-CT6f-etT.js → railroad-74A4TZTK-DVzWbQnl.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-C_2P6umA.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-aGlR3R3z.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-DCB9oE8y.js +1 -0
- package/dist/client/assets/{railroadDiagram-AXF67PYL-DC8egbob.js → railroadDiagram-AXF67PYL-D1oJ6Jtl.js} +1 -1
- package/dist/client/assets/readCache-B7cDPz2O.js +1 -0
- package/dist/client/assets/{refresh-cw-K_hU8_ld.js → refresh-cw-CRUTivd6.js} +1 -1
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-DJMzcLk_.js → requirementDiagram-LRYGKXZP-7RM8iREp.js} +1 -1
- package/dist/client/assets/rotate-ccw-BE2ZCwL6.js +1 -0
- package/dist/client/assets/roving-radio-group-NMPWrDqe.js +1 -0
- package/dist/client/assets/rows-2-DDS4dGTX.js +1 -0
- package/dist/client/assets/runtime-DjjjAcTE.js +18 -0
- package/dist/client/assets/safePolygon-C1AzMRS4.js +1 -0
- package/dist/client/assets/{sankeyDiagram-W5VNT64P-YR6aIYLj.js → sankeyDiagram-W5VNT64P-C1tKAPGN.js} +1 -1
- package/dist/client/assets/{save-Mh-PA_2P.js → save-OZdkPs_y.js} +1 -1
- package/dist/client/assets/scroll-area-80P7vbjw.js +1 -0
- package/dist/client/assets/{scrollEdges-Zcpuz3un.js → scrollEdges-C0Oc-5qi.js} +1 -1
- package/dist/client/assets/select-Cb9FUPHD.js +1 -0
- package/dist/client/assets/separator-CO8bC7Wc.js +1 -0
- package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BVeSqWDA.js → sequenceDiagram-SI44F4Z6-DGVpb7jL.js} +1 -1
- package/dist/client/assets/settings-2-PrRDu6Lc.js +1 -0
- package/dist/client/assets/settingsLayout-CRFNCk_D.js +1 -0
- package/dist/client/assets/sheet-C5DW7qVO.js +1 -0
- package/dist/client/assets/{shield-i098Bm_B.js → shield-CBHYqlkR.js} +1 -1
- package/dist/client/assets/{shield-alert-CXmR7fM9.js → shield-alert-Dc2cGwyR.js} +1 -1
- package/dist/client/assets/{shield-check-CdFhWT_o.js → shield-check-_wl7R4Js.js} +1 -1
- package/dist/client/assets/sidebar-0BBaFNm3.js +1 -0
- package/dist/client/assets/sidebarProjectFolders-BjWzbt8C.js +3 -0
- package/dist/client/assets/sidebarProjectGrouping-nQRStWrZ.js +1 -0
- package/dist/client/assets/sidebarStatusText-BBKuNies.js +1 -0
- package/dist/client/assets/sidebarUndo-Dfq1lvyF.js +1 -0
- package/dist/client/assets/{skeleton-BwFgUtuE.js → skeleton-DfUe6VV_.js} +1 -1
- package/dist/client/assets/sliders-horizontal-BGXkwvKv.js +1 -0
- package/dist/client/assets/sliding-tabs-BnDSjRU3.js +39 -0
- package/dist/client/assets/{smartphone-DGfizz51.js → smartphone-OEAQOTdv.js} +1 -1
- package/dist/client/assets/spinner-lHRJWsym.js +1 -0
- package/dist/client/assets/square-B05NKv3e.js +1 -0
- package/dist/client/assets/{star-J3x3fktG.js → star-C8mHmfZu.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-DoIZN669.js → stateDiagram-OKZ733FA-CCOAegCG.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-D60qqBed.js +1 -0
- package/dist/client/assets/storeSelectors-BichCKDC.js +1 -0
- package/dist/client/assets/surfaceMorph-BTRijmlU.js +1 -0
- package/dist/client/assets/{swimlanes-SLNWSIFB-BoFLigyK.js → swimlanes-SLNWSIFB-CFsLYT4h.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-D0SaJgSn.js +8 -0
- package/dist/client/assets/switch-oQc7Ifbl.js +1 -0
- package/dist/client/assets/text-wrap-DSRdSfDm.js +1 -0
- package/dist/client/assets/textarea-VyiIZ0wQ.js +1 -0
- package/dist/client/assets/threadPriorityRefreshRuntime-H656C1J_.js +1 -0
- package/dist/client/assets/ticker-CPutfhZ4.js +1 -0
- package/dist/client/assets/{timeline-definition-Z64GVDOM-D65EmNWc.js → timeline-definition-Z64GVDOM-B4agmO7R.js} +1 -1
- package/dist/client/assets/toggle-DFqtCPt-.js +1 -0
- package/dist/client/assets/toggle-group-C5ICmqkI.js +1 -0
- package/dist/client/assets/{tokenModePresentation-C0-NgmX5.js → tokenModePresentation-umDRm4k1.js} +1 -1
- package/dist/client/assets/tooltip-DbqhseXd.js +1 -0
- package/dist/client/assets/{treeView-Q6P3EWNA-C2S-OPgI.js → treeView-Q6P3EWNA-C_S3udFB.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-6Ovsu9iH.js → treemap-WGGIJYW6-B-kUSAkE.js} +1 -1
- package/dist/client/assets/undo-2-lyluTGMW.js +1 -0
- package/dist/client/assets/{unplug-BEfcl9Ht.js → unplug-D6iu-qlh.js} +1 -1
- package/dist/client/assets/usage-ClF-eUmy.js +1 -0
- package/dist/client/assets/useActiveIndicator-R5NWu8Fg.js +1 -0
- package/dist/client/assets/useAppSidebarCollapsed-BbMxfio5.js +1 -0
- package/dist/client/assets/useAppearancePreference-Ix13pMKy.js +1 -0
- package/dist/client/assets/useAtlassian-BYDCc9lv.js +0 -0
- package/dist/client/assets/useCheckoutResolution-CR-oOp5-.js +1 -0
- package/dist/client/assets/useDesktopRelaunchGuard-Jmh615iZ.js +1 -0
- package/dist/client/assets/useDiffFileNavigation-DeuzdD5E.js +15 -0
- package/dist/client/assets/useDiffLayout-DhcXwhBL.js +1 -0
- package/dist/client/assets/useEnvironmentSettingsTarget-DM6BRDT7.js +1 -0
- package/dist/client/assets/useFocus-CV0KIZwg.js +1 -0
- package/dist/client/assets/useGit-CUcs7h5_.js +1 -0
- package/dist/client/assets/useGitBranchSearch-CeKFtnCL.js +1 -0
- package/dist/client/assets/useHostedDraftExecutionTarget-DvQU5UOq.js +1 -0
- package/dist/client/assets/useLabelableId-CEgCRi6q.js +1 -0
- package/dist/client/assets/useLandingFlash-BfOOlFtW.js +1 -0
- package/dist/client/assets/useLogicalProjectSnapshots-CRNZke74.js +1 -0
- package/dist/client/assets/useNavigate-sQZthdyT.js +1 -0
- package/dist/client/assets/usePageLeadingInsetClass-Bf4nUvx4.js +1 -0
- package/dist/client/assets/usePhoneThreadActions-VaQ-mZex.js +1 -0
- package/dist/client/assets/usePopupHandleStore-DimKo2Yy.js +1 -0
- package/dist/client/assets/usePopupViewport-YeqX_UM3.js +1 -0
- package/dist/client/assets/usePresentationTier-B9kCQ4YH.js +1 -0
- package/dist/client/assets/useProject-Kt74Z12J.js +1 -0
- package/dist/client/assets/useProviderOptionsUpdater-CTzNh2B7.js +2 -0
- package/dist/client/assets/usePullRequestFilesViewed-D5Snmzys.js +1 -0
- package/dist/client/assets/usePullRequestsModel-DJL5HHbP.js +40 -0
- package/dist/client/assets/useScrollLock-CLZ31xsK.js +1 -0
- package/dist/client/assets/useSidebarThreadActions-n6EkLATf.js +6 -0
- package/dist/client/assets/{useStatistics-D55-xLMz.js → useStatistics-DD0mYS4J.js} +14 -14
- package/dist/client/assets/{useTheme-B441xg4F.js → useTheme-Bdy-BDs-.js} +1 -1
- package/dist/client/assets/useValueChanged-DoumqMnV.js +1 -0
- package/dist/client/assets/{user-round-C-U7TZKG.js → user-round-BPDXr8Gq.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-fZAexcYr.js → vennDiagram-T6HMQDX7-B1UEn_j_.js} +1 -1
- package/dist/client/assets/{vscode-icons-BYX6fBsM.js → vscode-icons-Ccy-gzFN.js} +1 -1
- package/dist/client/assets/{wardley-WFR3VGLG-gdYWSMxK.js → wardley-WFR3VGLG-gPdyDc-7.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-iDJxQb70.js → wardleyDiagram-T6FBY63Y-2aDcwOA4.js} +1 -1
- package/dist/client/assets/workspaceLifecycle-OJ1aKksw.js +3 -0
- package/dist/client/assets/workspaceMetadataProjection-CyEyJhUa.js +1 -0
- package/dist/client/assets/workspaceRouteSearch-CCavUdbH.js +1 -0
- package/dist/client/assets/{wrench-D79uBUSl.js → wrench-CPUCA_rn.js} +1 -1
- package/dist/client/assets/wsTransport-C88seBPA.js +15 -0
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-B4cfMwpJ.js → xychartDiagram-ELKLHX3M-C1_7Q-1i.js} +1 -1
- package/dist/client/favicon.svg +1 -1
- package/dist/client/index.html +1 -1
- package/dist/collectUint8StreamText-BsLSgI8i.mjs +710 -0
- package/dist/collectUint8StreamText-D5olwfpM.cjs +757 -0
- package/dist/{deviceHostWorker-L8C9wy38.mjs → deviceHostWorker-B-Dn-6An.mjs} +1 -1
- package/dist/{deviceHostWorker-CYnrwfrv.cjs → deviceHostWorker-D4HauWIV.cjs} +1 -1
- package/dist/{makeManagedServerProvider-CUwxc0Pn.cjs → makeManagedServerProvider-B5tP7tvg.cjs} +2 -2
- package/dist/{makeManagedServerProvider-B_lPFNpL.mjs → makeManagedServerProvider-B65ipCxM.mjs} +2 -2
- package/dist/resource-monitor/linux-arm64/ryco-resource-monitor +0 -0
- package/dist/resource-monitor/ryco-resource-monitor +0 -0
- package/dist/resource-monitor/ryco-resource-monitor.exe +0 -0
- package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
- package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
- package/dist/{rolldown-runtime-LGfotAqq.cjs → rolldown-runtime-HbSU0i7K.cjs} +7 -0
- package/dist/{runtimeSession-V3RIy8Ao.mjs → runtimeSession-D_BZ-wRH.mjs} +1 -1
- package/dist/{src-BzVJd3Me.cjs → src-FmeCeBJ9.cjs} +3408 -308
- package/dist/{src-7E1M4gTQ.mjs → src-VTj60bUm.mjs} +2154 -140
- package/package.json +1 -1
- package/dist/AzureDevOpsSourceControlProvider-DmJD1-WL.cjs +0 -190
- package/dist/AzureDevOpsSourceControlProvider-d5Ogsspk.mjs +0 -188
- package/dist/GitLabSourceControlProvider-BZdwXdJl.mjs +0 -186
- package/dist/GitLabSourceControlProvider-CrcBR6KQ.cjs +0 -188
- package/dist/client/assets/AccountSettings-FN7pwqYA.js +0 -1
- package/dist/client/assets/AiFocusSettings-xcDAMaqH.js +0 -1
- package/dist/client/assets/AppearanceSettings-BvsvAOsG.js +0 -1
- package/dist/client/assets/BranchToolbar.logic-DFsXV3Qs.js +0 -3
- package/dist/client/assets/BrowserPanel-D-g_xDZs.js +0 -1
- package/dist/client/assets/ChatRightPanel-Bm906qNi.js +0 -201
- package/dist/client/assets/ChatThreadRouteView-CATwakjI.js +0 -1
- package/dist/client/assets/CommandPaletteDialog-Obv1bvxj.js +0 -1
- package/dist/client/assets/CompositeRoot-CfkIdky8.js +0 -1
- package/dist/client/assets/ComputerUseSettings-ljYmTHea.js +0 -1
- package/dist/client/assets/ConnectionsSettings-CIXs7x_E.js +0 -7
- package/dist/client/assets/ContextHandoffEndpointLabel-BzI4Wi1i.js +0 -4
- package/dist/client/assets/DiagnosticsSettings-DGX_2T2M.js +0 -2
- package/dist/client/assets/DialogHandle-CTtSYpsC.js +0 -1
- package/dist/client/assets/DialogRoot-k2_0SNKA.js +0 -1
- package/dist/client/assets/DialogTitle-Du7CAbaO.js +0 -1
- package/dist/client/assets/DialogTrigger-VpFh8Xza.js +0 -1
- package/dist/client/assets/DraftChatThreadRouteView-Cmc5HpWf.js +0 -1
- package/dist/client/assets/GlassSurface-BlWIlQ0s.js +0 -1
- package/dist/client/assets/HostedConnectionControls-ySHqwr4K.js +0 -1
- package/dist/client/assets/HostedHubRoot-Caz8PElK.js +0 -2
- package/dist/client/assets/HostedNodeRenameDialog-ChxJdr-Z.js +0 -1
- package/dist/client/assets/HostedRelayTrustNotice-DPVrIfj_.js +0 -1
- package/dist/client/assets/IntegrationsSettingsPanel-eAq5h-D5.js +0 -2
- package/dist/client/assets/KeybindingsSettings-D1XaEVGH.js +0 -7
- package/dist/client/assets/LazyBrowserPanel-B6POLJh3.js +0 -2
- package/dist/client/assets/McpServersSettings-DqLA6n5v.js +0 -6
- package/dist/client/assets/MobileSheet-CtQIYRlY.js +0 -1
- package/dist/client/assets/NodeSecuritySettings-Skm7GQDl.js +0 -1
- package/dist/client/assets/NullStore-b8PhjwPZ.js +0 -1
- package/dist/client/assets/OnboardingDialog-8-fKvY5H.js +0 -1
- package/dist/client/assets/OpinionatedPluginsSettings-BIJfJ34L.js +0 -1
- package/dist/client/assets/PhoneHome-CUzxhhR4.js +0 -1
- package/dist/client/assets/PhoneSettingsSurface-BK2RHmYJ.js +0 -2
- package/dist/client/assets/ProvidersSettingsPanel-DPxL7AsR.js +0 -1
- package/dist/client/assets/RedactedSensitiveText-DH4mWpB6.js +0 -1
- package/dist/client/assets/RootAppShell-DwiWD4Cy.js +0 -7
- package/dist/client/assets/SettingsDialog-CE8qy0qL.js +0 -2
- package/dist/client/assets/SettingsPanels-BYknk6GO.js +0 -3
- package/dist/client/assets/SettingsPanels.editor-64bM0lhg.js +0 -2
- package/dist/client/assets/SourceControlSettings-BbveiAj3.js +0 -1
- package/dist/client/assets/StatisticsPage-CAO_tCeC.js +0 -1
- package/dist/client/assets/StatisticsPanel-SNlgMv2o.js +0 -1
- package/dist/client/assets/StatisticsSettingsLink-BpkNubL2.js +0 -1
- package/dist/client/assets/ThreadTerminalDrawer-9x_kqQPy.js +0 -18
- package/dist/client/assets/ThreadWorkspacePanel-BXE17C4x.js +0 -2073
- package/dist/client/assets/appChrome-B_VWWDFj.js +0 -1
- package/dist/client/assets/architecture-7GRP2DOG-CQNNG5gU.js +0 -1
- package/dist/client/assets/authorization-BugIGt5e.js +0 -1
- package/dist/client/assets/badge-BswOCwph.js +0 -1
- package/dist/client/assets/capabilities-Bj_X9FZ-.js +0 -1
- package/dist/client/assets/channel-BtX-w3CK.js +0 -1
- package/dist/client/assets/chevron-right-Ddq5gL-L.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-BgDa3HFl.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-BgDa3HFl.js +0 -1
- package/dist/client/assets/compiler-runtime-C4g8XhC5.js +0 -1
- package/dist/client/assets/desktopWorkspace-Ocqt625W.js +0 -1
- package/dist/client/assets/editorPreferences-DVhg0CXd.js +0 -1
- package/dist/client/assets/eventmodeling-NTZA5JFV-DpzGHjmu.js +0 -1
- package/dist/client/assets/flowDiagram-UKHOOZJN-CaDVMm72.js +0 -1
- package/dist/client/assets/hostedConnectionCoordinator-BztHfGNt.js +0 -1
- package/dist/client/assets/hostedPairing-CqhLPQqG.js +0 -1
- package/dist/client/assets/hubRoutes-DExWSvVE.js +0 -1
- package/dist/client/assets/kbd-DKuvGqFP.js +0 -1
- package/dist/client/assets/layers-CwP65mnC.js +0 -1
- package/dist/client/assets/liquidGlass-CA2o_Cq0.js +0 -1
- package/dist/client/assets/liquidGlass.worker-icvLJKHf.js +0 -1
- package/dist/client/assets/main-BqSANuAs.css +0 -2
- package/dist/client/assets/main-RFllWEko.js +0 -9
- package/dist/client/assets/motion-C9rN_t9p.js +0 -1
- package/dist/client/assets/palette-gaqgtube.js +0 -1
- package/dist/client/assets/perfInstrumentation-BT27w4tn.js +0 -1
- package/dist/client/assets/presentationTier-xlIjcFab.js +0 -1
- package/dist/client/assets/primary-CQh_KHGG.js +0 -5
- package/dist/client/assets/providerDriverMeta-LJ2vJxm-.js +0 -1
- package/dist/client/assets/providerStatus-DBGvvkyF.js +0 -1
- package/dist/client/assets/radio-group-BueX1AVO.js +0 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-B890iayj.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-C079Tzw6.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-DxvOX5Rh.js +0 -1
- package/dist/client/assets/runtime-OM-uAtaj.js +0 -18
- package/dist/client/assets/scroll-area-BC-LB_zE.js +0 -1
- package/dist/client/assets/separator-yx1r9ZDw.js +0 -1
- package/dist/client/assets/settingsLayout-BbjDM-p0.js +0 -1
- package/dist/client/assets/sheet-CpEwjOWn.js +0 -1
- package/dist/client/assets/sidebar-DayQTDZp.js +0 -1
- package/dist/client/assets/sidebarProjectFolders-DXqx3OlZ.js +0 -4
- package/dist/client/assets/sidebarStatusText-kdA6QMZS.js +0 -1
- package/dist/client/assets/sidebarUndo-BHFfJj0k.js +0 -1
- package/dist/client/assets/square-Cd2WS1gv.js +0 -1
- package/dist/client/assets/src-DHNjfMxR.js +0 -14
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-BnzsGHaN.js +0 -1
- package/dist/client/assets/storeSelectors-D60AAN01.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-BnA-oDvU.js +0 -8
- package/dist/client/assets/switch-D9inWKdd.js +0 -48
- package/dist/client/assets/toggle-group-YNqzWsK0.js +0 -1
- package/dist/client/assets/toggle-wMq3LLn1.js +0 -1
- package/dist/client/assets/tooltip-mwOCSCXF.js +0 -1
- package/dist/client/assets/usage-DF8oQrsy.js +0 -1
- package/dist/client/assets/useAppSidebarCollapsed-C0jpPtER.js +0 -1
- package/dist/client/assets/useAppearancePreference-Dlh9P8iu.js +0 -1
- package/dist/client/assets/useBaseUiId-Bz8dcyjd.js +0 -1
- package/dist/client/assets/useLabelableId-C8bc9a0F.js +0 -1
- package/dist/client/assets/useNavigate-01O5dMQe.js +0 -1
- package/dist/client/assets/usePhoneThreadActions-BIdh81kF.js +0 -1
- package/dist/client/assets/usePopupViewport-DYYZwfTW.js +0 -1
- package/dist/client/assets/usePresentationTier-hxB7Yv_Q.js +0 -1
- package/dist/client/assets/useScrollLock-BO185DkJ.js +0 -1
- package/dist/client/assets/useTriggerFocusGuards-CMLVr18J.js +0 -1
- package/dist/client/assets/useValueChanged-DSyRHPje.js +0 -1
- package/dist/client/assets/workspaceMetadataProjection-So9-wSEZ.js +0 -1
- package/dist/collectUint8StreamText-BAUF-vzz.mjs +0 -37
- package/dist/collectUint8StreamText-vagpNUMJ.cjs +0 -42
- package/dist/git-BKwGfw8A.mjs +0 -132
- package/dist/git-Dn5wrgFY.cjs +0 -218
- package/dist/sourceControl-B0D1Op29.cjs +0 -253
- package/dist/sourceControl-BiEBxN01.mjs +0 -224
|
@@ -1,2073 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t,Kt as n,Ut as r,Yt as i,an as a,on as o,qt as s}from"./primary-CQh_KHGG.js";import{Aa as c,Il as l,Ll as u,_ as d,b as f,la as p,v as m,y as h}from"./src-DHNjfMxR.js";import{$l as g,Ar as _,Bn as v,En as y,Gn as b,Jn as x,Jr as S,Kn as C,Kr as w,Lr as T,Qr as E,Qt as D,Rt as O,Ul as k,Un as A,Vr as j,Wn as M,Wt as N,Yr as P,_a as F,ao as ee,bi as te,bn as ne,ci as re,dn as ie,do as I,ei as L,fn as ae,fo as oe,go as se,gr as ce,hn as le,ho as R,hu as z,jr as B,ln as ue,mn as de,mo as V,mt as H,oo as fe,or as pe,p as me,pn as he,po as ge,qn as _e,so as ve,sr as ye,ui as be,ut as xe,vn as Se,y as U,yi as Ce}from"./runtime-OM-uAtaj.js";import{t as we}from"./react-CwJFpaho.js";import{Dr as Te,Gt as Ee,J as De,K as Oe,Lr as W,Q as G,Qt as K,X as ke,Y as Ae,Z as je,Zt as Me,br as Ne,cr as Pe,dr as Fe,mr as Ie,qt as Le,ur as Re,wr as ze}from"./switch-D9inWKdd.js";import{t as Be}from"./compiler-runtime-C4g8XhC5.js";import{i as Ve,n as He,t as Ue}from"./tooltip-mwOCSCXF.js";import{t as We}from"./badge-BswOCwph.js";import{c as Ge}from"./hostedConnectionCoordinator-BztHfGNt.js";import{t as Ke}from"./useNavigate-01O5dMQe.js";import{$ as qe,$t as Je,At as Ye,B as Xe,Bt as Ze,C as Qe,Ct as q,D as $e,Dt as et,E as tt,Et as nt,F as rt,Ft as it,G as at,Gt as ot,H as st,Ht as ct,I as lt,It as ut,J as dt,Jt as ft,K as pt,Kt as mt,L as ht,Lt as gt,M as _t,Mt as vt,N as yt,Nt as bt,O as xt,Ot as St,P as Ct,Pt as wt,Q as Tt,Qt as Et,R as Dt,Rt as Ot,S as kt,St as At,T as jt,Tt as Mt,U as Nt,Ut as Pt,V as Ft,Vt as It,W as Lt,Wt as Rt,X as zt,Xt as Bt,Y as Vt,Yt as Ht,Z as Ut,Zt as Wt,_n as Gt,_t as Kt,an as qt,at as Jt,b as Yt,bt as Xt,cn as Zt,ct as Qt,dt as $t,en,et as tn,fn as nn,ft as rn,gt as an,hn as on,ht as sn,in as cn,it as ln,j as un,jt as dn,k as fn,kt as pn,lt as mn,mt as hn,nn as gn,nt as _n,on as vn,ot as yn,pt as bn,q as xn,qt as Sn,rn as Cn,rt as wn,sn as Tn,st as En,tn as Dn,tt as On,ut as kn,v as An,vn as jn,vt as Mn,w as Nn,wt as Pn,x as Fn,xt as In,y as Ln,yn as Rn,yt as zn,z as Bn,zt as Vn}from"./ChatRightPanel-Bm906qNi.js";import{t as Hn}from"./arrow-left-XhcJWpRy.js";import{t as Un}from"./bot-D5wgL7pu.js";import{A as Wn,D as Gn,N as Kn,et as qn,j as Jn}from"./ContextHandoffEndpointLabel-BzI4Wi1i.js";import{t as Yn}from"./chevron-right-Ddq5gL-L.js";import{r as Xn}from"./tokenModePresentation-C0-NgmX5.js";import{a as Zn,t as Qn}from"./capabilities-Bj_X9FZ-.js";import{x as $n}from"./SettingsPanels.editor-64bM0lhg.js";import{n as er,t as tr}from"./LazyBrowserPanel-B6POLJh3.js";import{t as nr}from"./refresh-cw-K_hU8_ld.js";import{t as rr}from"./save-Mh-PA_2P.js";import{t as ir}from"./smartphone-DGfizz51.js";import{t as ar}from"./ThreadTerminalDrawer-9x_kqQPy.js";import{n as or}from"./editorPreferences-DVhg0CXd.js";import{t as sr}from"./unplug-BEfcl9Ht.js";import{t as cr}from"./wrench-D79uBUSl.js";import"./storeSelectors-D60AAN01.js";import{t as lr}from"./scroll-area-BC-LB_zE.js";import{i as ur,r as dr,t as fr}from"./alert-CwrDisFU.js";import{n as pr,t as mr}from"./sidebarStatusText-kdA6QMZS.js";import{n as hr}from"./appChrome-B_VWWDFj.js";import{t as gr}from"./useTheme-B441xg4F.js";import{n as _r,r as vr,t as yr}from"./toggle-group-YNqzWsK0.js";import{t as br}from"./toggle-wMq3LLn1.js";import{A as xr,C as Sr,D as Cr,E as wr,M as Tr,N as Er,O as Dr,S as Or,T as kr,_ as Ar,d as jr,et as Mr,g as Nr,h as Pr,j as Fr,k as Ir,m as Lr,mt as Rr,p as zr,ut as Br,v as Vr,w as Hr,x as Ur,y as Wr}from"./main-RFllWEko.js";var Gr={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};Gr.node;var Kr=R(Gr),qr={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};qr.node;var Jr=R(qr),Yr={name:`circle-stop`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]],aliases:[`stop-circle`]};Yr.node;var Xr=R(Yr),Zr={name:`columns-2`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]],aliases:[`columns`]};Zr.node;var Qr=R(Zr),$r={name:`disc-3`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M6 12c0-1.7.7-3.2 1.8-4.2`,key:`oqkarx`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M18 12c0 1.7-.7 3.2-1.8 4.2`,key:`1eah9h`}]]};$r.node;var ei=R($r),ti={name:`git-compare`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]};ti.node;var ni=R(ti),ri={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};ri.node;var ii=R(ri),ai={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};ai.node;var oi=R(ai),si={name:`monitor-off`,size:24,node:[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M17 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 1.184-1.826`,key:`cv7jms`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v10a2 2 0 0 1-.293 1.042`,key:`z8ni2w`}]]};si.node;var ci=R(si),li={name:`panel-right-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]};li.node;var ui=R(li),di={name:`panel-right-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]};di.node;var fi=R(di),pi={name:`panels-top-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]],aliases:[`layout`]};pi.node;var mi=R(pi),hi={name:`pilcrow`,size:24,node:[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]};hi.node;var gi=R(hi),_i={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};_i.node;var vi=R(_i),yi={name:`rows-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]],aliases:[`panels-top-bottom`]};yi.node;var bi=R(yi),xi={name:`text-wrap`,size:24,node:[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]],aliases:[`wrap-text`]};xi.node;var Si=R(xi),Ci={name:`volume-1`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}]]};Ci.node;var wi=R(Ci),Ti={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};Ti.node;var Ei=R(Ti);function Di(e){let t=[...e.messages.map(e=>({kind:`message`,id:`message:${e.id}`,at:e.createdAt,...e.sequence===void 0?{}:{sequence:e.sequence},message:e})),...e.entries.map(e=>({kind:`tool`,id:`tool:${e.id}`,at:e.startedAt??e.createdAt,...e.sequence===void 0?{}:{sequence:e.sequence},tool:e}))],n=t.every(e=>e.sequence!==void 0);return t.toSorted((e,t)=>n&&e.sequence!==void 0&&t.sequence!==void 0&&e.sequence!==t.sequence?e.sequence-t.sequence:e.at.localeCompare(t.at)||e.id.localeCompare(t.id))}var Oi=new Set,ki=null;function Ai(e){Oi.add(e),ki??=requestAnimationFrame(Mi)}function ji(e){Oi.delete(e)&&Oi.size===0&&ki!=null&&(cancelAnimationFrame(ki),ki=null)}function Mi(e){let t=new Set(Oi);Oi.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}ki=Oi.size>0?requestAnimationFrame(Mi):null}function Ni(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function Pi(e,t){let n=e?.theme??Ze,r=t?.theme??Ze,i=Fi(e),a=Fi(t);return nt(n,r)&&Ni(e,t,[`theme`,`parseDiffOptions`])&&Ni(i,a)}function Fi(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function Ii(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Li({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function Ri(){return q({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Pn({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function zi(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Bi(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var Vi=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),ji(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||Ii(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||r||i)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&Bi(e.composedPath())||(sa(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;(t!==`disabled`||o||n!=null||r!=null||i!=null||a!=null)&&(sa(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(sa(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){sa(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();sa(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);sa(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Ki(i)&&this.hoveredLine?.lineElement===i.lineElement;Gi(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Gi(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Ki(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Ji(i)&&p!=null){p(i);break}if(qi(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Ki(i))break;Gi(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,sa(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),sa(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),sa(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();Bi(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(zi(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=dn(Ri());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Wi(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Zi(t));if(Wi(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Wi(n)&&(!t||n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Wi(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Bi(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Zi(e);if(t&&Bi(n))return;let r=Qi(e);return r==null?this.pathFromAnnotationSlot(e):Zi(r)}pathFromAnnotationSlot(e){let t=$i(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Zi(t);let n=ta(ea(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Zi(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=na(t)?t:na(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Ii(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,Ai(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{ji(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!ia(this.renderedSelectedLinesState,n),i=!ia(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Yi(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=oa(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=oa(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:Xi(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Xi(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:aa(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:aa(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Hi({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Ui({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Ui({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Wi(e){return e!=null&&`kind`in e&&e.kind===`line`}function Gi(e){return e!=null&&`kind`in e&&e.kind===`token`}function Ki(e){return Wi(e)||Gi(e)}function qi(e){return`type`in e&&e.type===`line-info`}function Ji(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Yi(e){return e===`current`||e===`incoming`||e===`both`}function Xi(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Zi(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Qi(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function $i(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function ea(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function ta(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function na(e){return e!=null&&typeof e.elementFromPoint==`function`}function ra(e,t){return e===t||Ii(e??void 0,t??void 0)}function ia(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&ra(e?.range??null,t.range)}function aa(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function oa(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function sa(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var ca=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),da(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?ma(t):ha(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:la(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:ua(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;(i||a)&&(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&fa(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function la(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function ua(e){return Math.max(Math.ceil(e),0)}function da(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?fa(e,{codeWidthChanged:!0,numberWidthChanged:!0}):pa(e))}function fa(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function pa(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function ma(e){e.codeElement.isConnected&&pa(e)}function ha(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function ga(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function _a(e){return q({tagName:`div`,children:[q({tagName:`div`,children:e.annotations?.map(e=>q({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function va(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function ya({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return q({tagName:`div`,children:[t===`custom`?q({tagName:`slot`,properties:{name:gt}}):ba({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[xa(r)]],properties:i})}function ba({name:e,prevName:t,iconType:n}){let r=[q({tagName:`slot`,properties:{name:Et}}),Pn({name:va(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[Mt(t)]})],properties:{"data-prev-name":``}})),r.push(Pn({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[Mt(e)]})],properties:{"data-title":``}})),r.push(q({tagName:`slot`,properties:{name:Bt}})),q({tagName:`div`,children:r,properties:{"data-header-content":``}})}function xa(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(q({tagName:`span`,children:[Mt(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(q({tagName:`span`,children:[Mt(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(q({tagName:`slot`,properties:{name:Wt}})),q({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Sa(e){return q({tagName:`pre`,properties:Ca(e)})}function Ca({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function wa(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:Ye(t),preferredHighlighter:n}}function Ta(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Ea(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var Da={compositeOverBg:Qt,contrastRatio:mn,deriveMutedFg:kn,hoverWouldEraseText:$t,isDarkSurface:rn,isFullyTransparent:bn,pickReadableForeground:hn,relativeLuminance:sn,surfacesMatch:an};function Oa(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var ka=`-1,-1`;function Aa(e){return e?.some(e=>e.lineNumber===0)??!1}function ja(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function Ma(e){return e.startingLine===0&&e.totalLines>0}function Na(e,t){return e.endsWith(`\r
|
|
2
|
-
`)?t+`\r
|
|
3
|
-
`:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
|
|
4
|
-
`)?t+`
|
|
5
|
-
`:t}function Pa(e,t){return q({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function Fa(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var Ia=-1,La=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++Ia}`;highlighter;file;renderCache;pendingHighlightResult;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;get fileCache(){return this.renderCache?.file}constructor(e={theme:Ze},t=Ta,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=pn(e.theme??Ze)?et():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.file=e,r==null||n&&r.file===e)return;let{options:i}=this.getRenderOptions(e),a=r.file===e,o=t!=null&&Oa(r.file,t),{result:s}=r;if(!r.highlighted||s==null||!Mn(r.options,i)||!a&&!o){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}if(a)return;this.renderCache={...r,file:e,result:{...s,code:[...s.code]}};let{lineCache:c}=this;this.lineCache=c!=null&&t!=null&&Fa(c,t)?{cacheKey:void 0,file:e,sourceContents:e.contents,lines:c.lines}:void 0}endEditSession(e){this.editSessionActive=!1,this.pendingHighlightResult=void 0;let{renderCache:t}=this;e!=null&&t!=null&&t.file!==e&&Oa(t.file,e)&&(t.file=e)}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.file=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}clearRenderCache(){this.pendingStructuralRows=void 0,this.renderCache=void 0,this.pendingHighlightResult=void 0}hydrate(e){this.file=e;let{options:t}=this.getRenderOptions(e),n=Ra(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!Mn(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!wn(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??Kt(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Ze}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!Oa(e,n.file)||!Mn(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getFileForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null)return e;let{renderCache:n}=this;if(n==null)return e;if(Oa(n.file,e))return n.file;let r=En(e.contents),i=e.contents.length===0||wn(e)||Ra(r.length,this.getTokenizeMaxLength());return this.canRenderFile(e,t,i)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||Oa(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&pn(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&pn(t.theme)}getOrCreateLineCache(e){let{lineCache:t}=this;return(t==null||!Fa(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:En(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return;let{file:i,result:a}=r;if(a==null)return;let o=n?new Map:void 0;this.pendingStructuralRows=o;let s=this.lineCache!=null&&Fa(this.lineCache,i)?this.lineCache:void 0;for(let[t,n]of e){if(o==null&&s!=null&&t<s.lines.length){let e=n.map(e=>e[2]).join(``);s.lines[t]=Na(s.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};o==null?a.code[t]=e:o.set(t,e)}a.baseThemeType=t,r.isDirty=!0,o==null&&s!=null&&(i.contents=s.lines.join(``),s.sourceContents=i.contents)}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{file:r,result:i}=n;if(i==null)return;let a=this.lineCache!=null&&Fa(this.lineCache,r)?this.lineCache.lines:En(r.contents),o=En(e.getText());if(a.length!==o.length){let r=Math.min(a.length,o.length),s=0;for(;s<r&&a[s]===o[s];)s++;let c=0;for(;c<r-s&&a[a.length-1-c]===o[o.length-1-c];)c++;let l=i.code;i.code=Array(o.length);for(let e=0;e<s;e++)i.code[e]=l[e];for(let e=0;e<c;e++)i.code[o.length-1-e]=l[a.length-1-e];if(t!==void 0)for(let[e,n]of t)e<o.length&&(i.code[e]=n);for(let t=s;t<o.length-c;t++)i.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<i.code.length;e++){let t=i.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}n.isDirty=!0}this.lineCache={cacheKey:r.cacheKey,file:r,sourceContents:r.contents,lines:o},this.textDocumentCache.set(r,e),r.contents=e.getText()}renderFile(e=this.file,t=Vn){if(this.file=e,e==null){this.pendingHighlightResult=void 0;return}let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getReadyRenderResult(e,n);this.pendingHighlightResult=void 0,i!=null&&(this.renderCache={...i,file:e,renderRange:void 0},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||wn(e)||Ra(a.length,this.getTokenizeMaxLength()),c=this.canRenderFile(e,n,s),l=!Oa(e,this.renderCache.file),u=!ga(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!s&&!l&&Ea(t);c&&!i&&(s||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e)}else{this.computedLang=e.lang??Kt(e.name),this.highlighter??=et();let t=this.highlighter!=null&&pn(n.theme),i=this.highlighter!=null&&wt(this.computedLang),a=!s&&i;if(c&&this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=Vn){this.file=e;let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=Ra(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Kt(e.name);let n=this.highlighter!=null&&zn(Ye(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&wt(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:ln(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=At(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=Ma(t)?ja(this.lineAnnotations):void 0;d!=null&&(c.children.push(Xt(`context`,`annotation`,1)),s.push(_a({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>this.annotationSlotName(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(In(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(Xt(`context`,`annotation`,1)),s.push(_a({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>this.annotationSlotName(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{file:e,gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return ya({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return dn(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(q({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=At();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,Pa(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return dn(t?q({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await St(wa(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{file:i,renderCache:a}=this;i!=null&&a!=null&&Oa(e,i)&&Mn(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Mn(a.options,n)&&Oa(a.file,i)||(this.pendingHighlightResult={file:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(n!=null&&Mn(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&Oa(n.file,e)&&Mn(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{file:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Oa(e,n.file)&&Mn(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return Sa({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Ra(e,t){return e>t}var za=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
6
|
-
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
7
|
-
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
8
|
-
</symbol>
|
|
9
|
-
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
10
|
-
<path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
|
|
11
|
-
</symbol>
|
|
12
|
-
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
13
|
-
<path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
|
|
14
|
-
</symbol>
|
|
15
|
-
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
16
|
-
<path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
|
|
17
|
-
</symbol>
|
|
18
|
-
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
19
|
-
<path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
|
|
20
|
-
</symbol>
|
|
21
|
-
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
22
|
-
<path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
|
|
23
|
-
</symbol>
|
|
24
|
-
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
25
|
-
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
|
|
26
|
-
</symbol>
|
|
27
|
-
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
28
|
-
<path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
|
|
29
|
-
</symbol>
|
|
30
|
-
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
31
|
-
<path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
|
|
32
|
-
</symbol>
|
|
33
|
-
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
34
|
-
<path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
|
|
35
|
-
</symbol>
|
|
36
|
-
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
37
|
-
<path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
38
|
-
</symbol>
|
|
39
|
-
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
40
|
-
<path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
41
|
-
</symbol>
|
|
42
|
-
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
43
|
-
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
|
|
44
|
-
</symbol>
|
|
45
|
-
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
46
|
-
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
|
|
47
|
-
</symbol>
|
|
48
|
-
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
49
|
-
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
|
|
50
|
-
</symbol>
|
|
51
|
-
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
52
|
-
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
|
|
53
|
-
</symbol>
|
|
54
|
-
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
55
|
-
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
|
|
56
|
-
</symbol>
|
|
57
|
-
</svg>`;function Ba(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Va(e,t){return e==null||t==null?e===t:Ua(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var Ha={};function Ua(e=Ha,t=Ha){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function Wa(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Ga(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function Ka(){let e=document.createElement(`style`);return e.setAttribute(gn,``),e}var qa=`@layer base {
|
|
58
|
-
:host {
|
|
59
|
-
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
60
|
-
"Courier New", monospace;
|
|
61
|
-
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
62
|
-
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
63
|
-
--diffs-mixer: light-dark(#000, #fff);
|
|
64
|
-
--diffs-gap-fallback: 8px;
|
|
65
|
-
--diffs-scrollbar-gutter-fallback: 6px;
|
|
66
|
-
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
67
|
-
--diffs-added-light: #0dbe4e;
|
|
68
|
-
--diffs-added-dark: #5ecc71;
|
|
69
|
-
--diffs-modified-light: #009fff;
|
|
70
|
-
--diffs-modified-dark: #69b1ff;
|
|
71
|
-
--diffs-deleted-light: #ff2e3f;
|
|
72
|
-
--diffs-deleted-dark: #ff6762;
|
|
73
|
-
--diffs-warning-light: #d5a910;
|
|
74
|
-
--diffs-warning-dark: #ffd452;
|
|
75
|
-
color-scheme: light dark;
|
|
76
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
77
|
-
font-size: var(--diffs-font-size, 13px);
|
|
78
|
-
line-height: var(--diffs-line-height, 20px);
|
|
79
|
-
font-feature-settings: var(--diffs-font-features);
|
|
80
|
-
--diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
|
|
81
|
-
--diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));
|
|
82
|
-
--diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));
|
|
83
|
-
--diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));
|
|
84
|
-
--diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));
|
|
85
|
-
--diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
|
|
86
|
-
--diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));
|
|
87
|
-
--diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
|
|
88
|
-
--diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark)))));
|
|
89
|
-
--diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark)))));
|
|
90
|
-
--diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark)))));
|
|
91
|
-
--diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));
|
|
92
|
-
--diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2)));
|
|
93
|
-
--diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));
|
|
94
|
-
--diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2)));
|
|
95
|
-
--diffs-selection-base: var(--diffs-modified-base);
|
|
96
|
-
--diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));
|
|
97
|
-
background-color: var(--diffs-bg);
|
|
98
|
-
color: var(--diffs-fg);
|
|
99
|
-
display: block;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
pre, code, [data-error-wrapper] {
|
|
103
|
-
isolation: isolate;
|
|
104
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
105
|
-
outline: none;
|
|
106
|
-
margin: 0;
|
|
107
|
-
padding: 0;
|
|
108
|
-
display: block;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
pre, code {
|
|
112
|
-
background-color: var(--diffs-bg);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
code {
|
|
116
|
-
contain: content;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
input, button {
|
|
120
|
-
font-family: inherit;
|
|
121
|
-
font-size: inherit;
|
|
122
|
-
line-height: inherit;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
*, :before, :after {
|
|
126
|
-
box-sizing: border-box;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
[data-icon-sprite] {
|
|
130
|
-
display: none;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
[data-diffs-header], [data-separator] {
|
|
134
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
[data-diffs-header][data-sticky] {
|
|
138
|
-
z-index: 1;
|
|
139
|
-
background-color: var(--diffs-bg);
|
|
140
|
-
position: sticky;
|
|
141
|
-
top: 0;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
[data-file-info] {
|
|
145
|
-
color: var(--fg);
|
|
146
|
-
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
147
|
-
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
148
|
-
padding: 10px;
|
|
149
|
-
font-weight: 700;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
[data-diff], [data-file] {
|
|
153
|
-
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
154
|
-
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
155
|
-
|
|
156
|
-
&[data-dehydrated] {
|
|
157
|
-
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
161
|
-
background-color: var(--diffs-bg-context);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
@supports (-webkit-touch-callout: none) {
|
|
166
|
-
:host {
|
|
167
|
-
--diffs-scrollbar-gutter-fallback: 0px;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
[data-line] span, [data-edit-prediction-suffix] span {
|
|
172
|
-
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
173
|
-
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
174
|
-
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
175
|
-
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
176
|
-
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
|
|
180
|
-
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
181
|
-
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
182
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
183
|
-
--diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
|
|
184
|
-
--diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
|
|
185
|
-
--diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
|
|
186
|
-
--diffs-line-bg: var(--diffs-computed-hovered-line-bg);
|
|
187
|
-
color: var(--diffs-fg);
|
|
188
|
-
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
[data-line], [data-no-newline] {
|
|
192
|
-
&[data-decoration-bg] {
|
|
193
|
-
--mix-deco-light: 92%;
|
|
194
|
-
--mix-deco-dark: 85%;
|
|
195
|
-
|
|
196
|
-
&[data-decoration-bg-depth="2"] {
|
|
197
|
-
--mix-deco-light: 88%;
|
|
198
|
-
--mix-deco-dark: 80%;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
&[data-decoration-bg-depth="3"] {
|
|
202
|
-
--mix-deco-light: 85%;
|
|
203
|
-
--mix-deco-dark: 78%;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
--diffs-hover-mix-target: var(--diffs-decoration-bg);
|
|
207
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
208
|
-
var(--diffs-bg) var(--mix-deco-light),
|
|
209
|
-
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
210
|
-
var(--diffs-bg) var(--mix-deco-dark),
|
|
211
|
-
var(--diffs-decoration-bg)));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
216
|
-
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
217
|
-
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
218
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
[data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] {
|
|
222
|
-
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
223
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
227
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
228
|
-
var(--diffs-bg) 78%,
|
|
229
|
-
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
230
|
-
var(--diffs-bg) 68%,
|
|
231
|
-
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
232
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
236
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
237
|
-
var(--diffs-bg) 78%,
|
|
238
|
-
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
239
|
-
var(--diffs-bg) 68%,
|
|
240
|
-
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
241
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
245
|
-
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
246
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
:where([data-background]) {
|
|
250
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
251
|
-
--mix-light: 91%;
|
|
252
|
-
--mix-dark: 85%;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
& [data-line], & [data-no-newline] {
|
|
256
|
-
--mix-light: 88%;
|
|
257
|
-
--mix-dark: 80%;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
261
|
-
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
262
|
-
|
|
263
|
-
&[data-line-type="change-deletion"] {
|
|
264
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
265
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
266
|
-
|
|
267
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
268
|
-
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
269
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
273
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
274
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
275
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
276
|
-
var(--diffs-diff-line-mix-target)));
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
&[data-line-type="change-addition"] {
|
|
280
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
281
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
282
|
-
|
|
283
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
284
|
-
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
285
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
289
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
290
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
291
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
292
|
-
var(--diffs-diff-line-mix-target)));
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
&[data-merge-conflict="current"] {
|
|
296
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
297
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
298
|
-
|
|
299
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
300
|
-
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
301
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
305
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
306
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
307
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
308
|
-
var(--diffs-diff-line-mix-target)));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
&[data-merge-conflict="incoming"] {
|
|
312
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
313
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
314
|
-
|
|
315
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
316
|
-
color: var(--diffs-modified-base);
|
|
317
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
321
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
322
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
323
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
324
|
-
var(--diffs-diff-line-mix-target)));
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
|
|
330
|
-
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
331
|
-
--diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
|
|
332
|
-
|
|
333
|
-
&:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
334
|
-
--mix-selection-light: 82%;
|
|
335
|
-
--mix-selection-dark: 75%;
|
|
336
|
-
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
&:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
|
|
340
|
-
--mix-selection-light: 75%;
|
|
341
|
-
--mix-selection-dark: 60%;
|
|
342
|
-
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
343
|
-
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
&:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
347
|
-
--diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
|
|
348
|
-
var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
|
|
349
|
-
var(--mix-selection-light),
|
|
350
|
-
var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
&:where([data-editor-overlay]), &[data-selected-line] {
|
|
354
|
-
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
355
|
-
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
356
|
-
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
357
|
-
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
358
|
-
var(--diffs-selection-mix-target)));
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
[data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
|
|
363
|
-
--diffs-computed-editor-active-line-bg: color-mix(in lab,
|
|
364
|
-
var(--diffs-computed-selected-line-bg)
|
|
365
|
-
var(--diffs-editor-active-line-source-mix, 100%),
|
|
366
|
-
var(--diffs-selection-emphasis-mix-target));
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
@media (pointer: fine) {
|
|
370
|
-
[data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {
|
|
371
|
-
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
372
|
-
var(--diffs-computed-editor-active-line-bg) 97%,
|
|
373
|
-
var(--diffs-hover-mix-target)), color-mix(in lab,
|
|
374
|
-
var(--diffs-computed-editor-active-line-bg) 91%,
|
|
375
|
-
var(--diffs-hover-mix-target)));
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
[data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
|
|
380
|
-
color: var(--diffs-selection-number-fg);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
[data-no-newline] {
|
|
384
|
-
user-select: none;
|
|
385
|
-
|
|
386
|
-
& span {
|
|
387
|
-
opacity: .6;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
[data-diff-type="split"][data-overflow="scroll"] {
|
|
392
|
-
grid-template-columns: 1fr 1fr;
|
|
393
|
-
display: grid;
|
|
394
|
-
|
|
395
|
-
& [data-additions] {
|
|
396
|
-
border-left: 1px solid var(--diffs-bg);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
& [data-deletions] {
|
|
400
|
-
border-right: 1px solid var(--diffs-bg);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
[data-code] {
|
|
405
|
-
grid-auto-flow: dense;
|
|
406
|
-
grid-template-columns: var(--diffs-code-grid);
|
|
407
|
-
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
408
|
-
overscroll-behavior-x: none;
|
|
409
|
-
tab-size: var(--diffs-tab-size, 2);
|
|
410
|
-
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
411
|
-
padding-bottom: max(0px,
|
|
412
|
-
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
413
|
-
var(--diffs-scrollbar-gutter)));
|
|
414
|
-
scrollbar-gutter: stable;
|
|
415
|
-
align-self: flex-start;
|
|
416
|
-
display: grid;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
[data-diffs-scrollbar-measure] {
|
|
420
|
-
opacity: 0;
|
|
421
|
-
pointer-events: none;
|
|
422
|
-
scrollbar-gutter: auto;
|
|
423
|
-
grid-template-columns: none;
|
|
424
|
-
width: 100px;
|
|
425
|
-
height: 100px;
|
|
426
|
-
padding: 0;
|
|
427
|
-
position: absolute;
|
|
428
|
-
top: -200px;
|
|
429
|
-
left: -200px;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
[data-container-size] {
|
|
433
|
-
container-type: inline-size;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
[data-code]::-webkit-scrollbar {
|
|
437
|
-
width: 0;
|
|
438
|
-
height: var(--diffs-scrollbar-gutter);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
[data-code]::-webkit-scrollbar-track {
|
|
442
|
-
background: none;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
[data-code]::-webkit-scrollbar-thumb {
|
|
446
|
-
background-color: #0000;
|
|
447
|
-
background-clip: content-box;
|
|
448
|
-
border: 1px solid #0000;
|
|
449
|
-
border-radius: 3px;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
[data-code]::-webkit-scrollbar-corner {
|
|
453
|
-
background-color: #0000;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
@supports ((-moz-appearance: none)) {
|
|
457
|
-
[data-code] {
|
|
458
|
-
scrollbar-width: thin;
|
|
459
|
-
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
460
|
-
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
465
|
-
& [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
466
|
-
padding-top: 0;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
[data-gutter] {
|
|
471
|
-
grid-template-rows: subgrid;
|
|
472
|
-
grid-template-columns: subgrid;
|
|
473
|
-
z-index: 3;
|
|
474
|
-
background-color: var(--diffs-bg);
|
|
475
|
-
grid-column: 1;
|
|
476
|
-
display: grid;
|
|
477
|
-
position: relative;
|
|
478
|
-
|
|
479
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
480
|
-
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
[data-content] {
|
|
485
|
-
grid-template-rows: subgrid;
|
|
486
|
-
grid-template-columns: subgrid;
|
|
487
|
-
background-color: var(--diffs-bg);
|
|
488
|
-
grid-column: 2;
|
|
489
|
-
min-width: 0;
|
|
490
|
-
display: grid;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
[data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
494
|
-
grid-auto-flow: dense;
|
|
495
|
-
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
496
|
-
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
497
|
-
display: grid;
|
|
498
|
-
|
|
499
|
-
& [data-code] {
|
|
500
|
-
display: contents;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
& [data-deletions] {
|
|
504
|
-
& [data-gutter] {
|
|
505
|
-
grid-column: 1;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
& [data-content] {
|
|
509
|
-
border-right: 1px solid var(--diffs-bg);
|
|
510
|
-
grid-column: 2;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
& [data-additions] {
|
|
515
|
-
& [data-gutter] {
|
|
516
|
-
border-left: 1px solid var(--diffs-bg);
|
|
517
|
-
grid-column: 3;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
& [data-content] {
|
|
521
|
-
grid-column: 4;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
|
|
527
|
-
overflow: clip;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
[data-overflow="scroll"] [data-gutter] {
|
|
531
|
-
position: sticky;
|
|
532
|
-
left: 0;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
[data-interactive-lines] [data-line] {
|
|
536
|
-
cursor: pointer;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
[data-interactive-line-numbers] [data-column-number] {
|
|
540
|
-
cursor: pointer;
|
|
541
|
-
touch-action: none;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
[data-content-buffer], [data-gutter-buffer] {
|
|
545
|
-
user-select: none;
|
|
546
|
-
min-height: 1lh;
|
|
547
|
-
position: relative;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
[data-gutter-buffer] {
|
|
551
|
-
padding-left: 2ch;
|
|
552
|
-
padding-right: 1ch;
|
|
553
|
-
|
|
554
|
-
&:before {
|
|
555
|
-
content: "";
|
|
556
|
-
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
557
|
-
display: block;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
[data-gutter-buffer="annotation"] {
|
|
562
|
-
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
563
|
-
min-height: 0;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
[data-gutter-buffer="buffer"] {
|
|
567
|
-
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
[data-content-buffer] {
|
|
571
|
-
background-position: 5px 0;
|
|
572
|
-
background-size: 8px 8px;
|
|
573
|
-
background-origin: border-box;
|
|
574
|
-
background-image: repeating-linear-gradient(-45deg,
|
|
575
|
-
transparent,
|
|
576
|
-
transparent calc(3px * 1.414),
|
|
577
|
-
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
578
|
-
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
579
|
-
grid-column: 1;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
[data-separator] {
|
|
583
|
-
box-sizing: content-box;
|
|
584
|
-
background-color: var(--diffs-bg);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
[data-separator="simple"] {
|
|
588
|
-
min-height: 4px;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
592
|
-
background-color: var(--diffs-bg-separator);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
596
|
-
height: 32px;
|
|
597
|
-
position: relative;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
[data-separator-wrapper] {
|
|
601
|
-
user-select: none;
|
|
602
|
-
fill: currentColor;
|
|
603
|
-
background-color: var(--diffs-bg);
|
|
604
|
-
align-items: center;
|
|
605
|
-
height: 100%;
|
|
606
|
-
display: flex;
|
|
607
|
-
position: absolute;
|
|
608
|
-
inset-inline: 0;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
[data-content] [data-separator-wrapper] {
|
|
612
|
-
display: none;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
[data-separator="metadata"] [data-separator-wrapper] {
|
|
616
|
-
background-color: var(--diffs-bg-separator);
|
|
617
|
-
height: 100%;
|
|
618
|
-
color: var(--diffs-fg-number);
|
|
619
|
-
white-space: nowrap;
|
|
620
|
-
text-overflow: ellipsis;
|
|
621
|
-
min-width: min-content;
|
|
622
|
-
padding-inline: 1ch;
|
|
623
|
-
inset-inline: 100% auto;
|
|
624
|
-
overflow: hidden;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
[data-separator="line-info"] {
|
|
628
|
-
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
629
|
-
|
|
630
|
-
& [data-separator-wrapper] {
|
|
631
|
-
min-width: 16px;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
636
|
-
margin-block: 0;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
[data-separator="line-info"][data-separator-first] {
|
|
640
|
-
margin-top: 0;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
[data-separator="line-info"][data-separator-last] {
|
|
644
|
-
margin-bottom: 0;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
[data-expand-index] [data-separator-wrapper] {
|
|
648
|
-
grid-template-columns: 32px auto;
|
|
649
|
-
display: grid;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
653
|
-
grid-template-columns: 32px 32px auto;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
[data-expand-button], [data-separator-content] {
|
|
657
|
-
background-color: var(--diffs-bg-separator);
|
|
658
|
-
flex: none;
|
|
659
|
-
align-items: center;
|
|
660
|
-
display: flex;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
[data-expand-index] [data-separator-content]:hover {
|
|
664
|
-
cursor: pointer;
|
|
665
|
-
text-decoration: underline;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
[data-expand-button] {
|
|
669
|
-
cursor: pointer;
|
|
670
|
-
min-width: 32px;
|
|
671
|
-
color: var(--diffs-fg-number);
|
|
672
|
-
border-right: 2px solid var(--diffs-bg);
|
|
673
|
-
flex-shrink: 0;
|
|
674
|
-
justify-content: center;
|
|
675
|
-
align-self: stretch;
|
|
676
|
-
|
|
677
|
-
&:hover {
|
|
678
|
-
color: var(--diffs-fg);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
&[data-expand-all-button] {
|
|
682
|
-
display: none;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
[data-expand-down] [data-icon] {
|
|
687
|
-
transform: scaleY(-1);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
[data-separator-content] {
|
|
691
|
-
height: 100%;
|
|
692
|
-
color: var(--diffs-fg-number);
|
|
693
|
-
flex: auto;
|
|
694
|
-
justify-content: flex-start;
|
|
695
|
-
padding: 0 1ch;
|
|
696
|
-
overflow: hidden;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
700
|
-
& [data-separator-content] {
|
|
701
|
-
user-select: none;
|
|
702
|
-
height: 100%;
|
|
703
|
-
overflow: clip;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
[data-unmodified-lines] {
|
|
708
|
-
text-overflow: ellipsis;
|
|
709
|
-
white-space: nowrap;
|
|
710
|
-
flex: 0 auto;
|
|
711
|
-
min-width: 0;
|
|
712
|
-
display: block;
|
|
713
|
-
overflow: hidden;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
@supports (width: 1cqi) {
|
|
717
|
-
[data-unified] {
|
|
718
|
-
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
719
|
-
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
720
|
-
width: 100cqi;
|
|
721
|
-
|
|
722
|
-
& [data-separator-content] {
|
|
723
|
-
border-radius: 6px;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
728
|
-
border-top-left-radius: unset;
|
|
729
|
-
border-bottom-left-radius: unset;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
[data-gutter] {
|
|
734
|
-
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
735
|
-
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
& [data-separator="line-info"] [data-separator-content] {
|
|
739
|
-
border-top-left-radius: 6px;
|
|
740
|
-
border-bottom-left-radius: 6px;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
744
|
-
border-top-left-radius: unset;
|
|
745
|
-
border-bottom-left-radius: unset;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
[data-additions] {
|
|
750
|
-
& [data-content] [data-separator="line-info"] {
|
|
751
|
-
background-color: var(--diffs-bg);
|
|
752
|
-
|
|
753
|
-
& [data-separator-wrapper] {
|
|
754
|
-
display: none;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
759
|
-
background-color: var(--diffs-bg-separator);
|
|
760
|
-
border-top-right-radius: 6px;
|
|
761
|
-
border-bottom-right-radius: 6px;
|
|
762
|
-
height: 100%;
|
|
763
|
-
display: block;
|
|
764
|
-
|
|
765
|
-
& [data-separator-content], & [data-expand-button] {
|
|
766
|
-
display: none;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
772
|
-
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
776
|
-
background-color: var(--diffs-bg-separator);
|
|
777
|
-
height: 100%;
|
|
778
|
-
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
779
|
-
border-top-right-radius: 6px;
|
|
780
|
-
border-bottom-right-radius: 6px;
|
|
781
|
-
display: block;
|
|
782
|
-
|
|
783
|
-
& [data-separator-content], & [data-expand-button] {
|
|
784
|
-
display: none;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
789
|
-
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
790
|
-
border-top-left-radius: 6px;
|
|
791
|
-
border-bottom-left-radius: 6px;
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
@media (pointer: fine) {
|
|
796
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
797
|
-
&[data-separator-multi-button] {
|
|
798
|
-
& [data-expand-up] {
|
|
799
|
-
border-top-left-radius: 6px;
|
|
800
|
-
border-bottom-left-radius: unset;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
& [data-expand-down] {
|
|
804
|
-
border-bottom-left-radius: 6px;
|
|
805
|
-
border-top-left-radius: unset;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
@media (pointer: coarse) {
|
|
813
|
-
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
814
|
-
grid-template-columns: 34px 34px auto;
|
|
815
|
-
|
|
816
|
-
& [data-separator-content] {
|
|
817
|
-
grid-column: unset;
|
|
818
|
-
grid-row: unset;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
@supports (width: 1cqi) {
|
|
823
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
824
|
-
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
825
|
-
border-top-left-radius: 6px;
|
|
826
|
-
border-bottom-left-radius: 6px;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
&[data-separator-multi-button] {
|
|
830
|
-
& [data-expand-up] {
|
|
831
|
-
border-top-left-radius: 6px;
|
|
832
|
-
border-bottom-left-radius: 6px;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
& [data-expand-down] {
|
|
836
|
-
border-bottom-left-radius: unset;
|
|
837
|
-
border-top-left-radius: unset;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
@media (pointer: fine) {
|
|
845
|
-
[data-separator-wrapper][data-separator-multi-button] {
|
|
846
|
-
grid-template-rows: 50% 50%;
|
|
847
|
-
display: grid;
|
|
848
|
-
|
|
849
|
-
& [data-separator-content] {
|
|
850
|
-
grid-area: 1 / 2 / -1;
|
|
851
|
-
min-width: min-content;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
& [data-expand-button] {
|
|
855
|
-
grid-column: 1;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
860
|
-
grid-template-columns: 34px auto;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
864
|
-
grid-template-columns: 100% auto;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
868
|
-
& [data-separator-multi-button] {
|
|
869
|
-
& [data-expand-up] {
|
|
870
|
-
border-bottom: 1px solid var(--diffs-bg);
|
|
871
|
-
border-right: 2px solid var(--diffs-bg);
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
& [data-expand-down] {
|
|
875
|
-
border-top: 1px solid var(--diffs-bg);
|
|
876
|
-
border-right: 2px solid var(--diffs-bg);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
883
|
-
display: none;
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
[data-line-annotation] {
|
|
887
|
-
min-height: var(--diffs-annotation-min-height, 0);
|
|
888
|
-
z-index: 2;
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
[data-merge-conflict-actions] {
|
|
892
|
-
z-index: 2;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
[data-separator="custom"] {
|
|
896
|
-
grid-template-columns: subgrid;
|
|
897
|
-
display: grid;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
[data-line], [data-column-number], [data-no-newline] {
|
|
901
|
-
padding-inline: 1ch;
|
|
902
|
-
position: relative;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
[data-indicators="classic"] [data-line] {
|
|
906
|
-
padding-inline-start: 2ch;
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
[data-indicators="classic"] {
|
|
910
|
-
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
911
|
-
&[data-no-newline], &[data-line] {
|
|
912
|
-
&:before {
|
|
913
|
-
user-select: none;
|
|
914
|
-
width: 1ch;
|
|
915
|
-
height: 1lh;
|
|
916
|
-
display: inline-block;
|
|
917
|
-
position: absolute;
|
|
918
|
-
top: 0;
|
|
919
|
-
left: 0;
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
& [data-line-type="change-addition"] {
|
|
925
|
-
&[data-line], &[data-no-newline] {
|
|
926
|
-
&:before {
|
|
927
|
-
content: "+";
|
|
928
|
-
color: var(--diffs-addition-base);
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
& [data-line-type="change-deletion"] {
|
|
934
|
-
&[data-line], &[data-no-newline] {
|
|
935
|
-
&:before {
|
|
936
|
-
content: "-";
|
|
937
|
-
color: var(--diffs-deletion-base);
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
[data-indicators="bars"] {
|
|
944
|
-
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
945
|
-
&[data-column-number] {
|
|
946
|
-
&:before {
|
|
947
|
-
content: "";
|
|
948
|
-
user-select: none;
|
|
949
|
-
contain: strict;
|
|
950
|
-
width: 4px;
|
|
951
|
-
height: 100%;
|
|
952
|
-
display: block;
|
|
953
|
-
position: absolute;
|
|
954
|
-
top: 0;
|
|
955
|
-
left: 0;
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
& [data-line-type="change-deletion"] {
|
|
961
|
-
&[data-column-number] {
|
|
962
|
-
&:before {
|
|
963
|
-
background-image: linear-gradient(0deg,
|
|
964
|
-
var(--diffs-bg-deletion) 50%,
|
|
965
|
-
var(--diffs-deletion-base) 50%);
|
|
966
|
-
background-repeat: repeat;
|
|
967
|
-
background-size: 2px 2px;
|
|
968
|
-
background-size: calc(1lh / round(1lh / 2px))
|
|
969
|
-
calc(1lh / round(1lh / 2px));
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
& [data-line-type="change-addition"] {
|
|
975
|
-
&[data-column-number] {
|
|
976
|
-
&:before {
|
|
977
|
-
background-color: var(--diffs-addition-base);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
[data-overflow="wrap"] {
|
|
984
|
-
& [data-line] {
|
|
985
|
-
white-space: pre-wrap;
|
|
986
|
-
word-break: break-word;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
& [data-annotation-content] {
|
|
990
|
-
word-break: break-word;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
[data-overflow="scroll"] [data-line] {
|
|
995
|
-
white-space: pre;
|
|
996
|
-
min-height: 1lh;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
[data-column-number] {
|
|
1000
|
-
box-sizing: content-box;
|
|
1001
|
-
text-align: right;
|
|
1002
|
-
user-select: none;
|
|
1003
|
-
color: var(--diffs-fg-number);
|
|
1004
|
-
padding-left: 2ch;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
[data-line-number-content] {
|
|
1008
|
-
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1009
|
-
z-index: 1;
|
|
1010
|
-
display: inline-block;
|
|
1011
|
-
position: relative;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
[data-disable-line-numbers] {
|
|
1015
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
1016
|
-
min-width: 4px;
|
|
1017
|
-
padding: 0;
|
|
1018
|
-
|
|
1019
|
-
&:before {
|
|
1020
|
-
min-width: 0;
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
& [data-line-number-content] {
|
|
1025
|
-
display: none;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
& [data-gutter-utility-slot] {
|
|
1029
|
-
right: unset;
|
|
1030
|
-
justify-content: flex-start;
|
|
1031
|
-
left: 0;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
1035
|
-
left: 6px;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
[data-file][data-disable-line-numbers] {
|
|
1040
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
1041
|
-
border-right: 0;
|
|
1042
|
-
min-width: 0;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
[data-diff-span] {
|
|
1047
|
-
box-decoration-break: clone;
|
|
1048
|
-
border-radius: 3px;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
[data-line-type="change-addition"] [data-diff-span] {
|
|
1052
|
-
background-color: var(--diffs-bg-addition-emphasis);
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
[data-line-type="change-deletion"] [data-diff-span] {
|
|
1056
|
-
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
1060
|
-
color: var(--diffs-fg);
|
|
1061
|
-
padding-left: 1ch;
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
1065
|
-
align-items: center;
|
|
1066
|
-
display: flex;
|
|
1067
|
-
|
|
1068
|
-
&:after {
|
|
1069
|
-
color: var(--diffs-fg-conflict-marker);
|
|
1070
|
-
font-size: .75rem;
|
|
1071
|
-
font-style: normal;
|
|
1072
|
-
line-height: 1.25rem;
|
|
1073
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1074
|
-
padding-left: 1ch;
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
[data-merge-conflict="marker-start"]:after {
|
|
1079
|
-
content: "(Current Change)";
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
[data-merge-conflict="marker-end"]:after {
|
|
1083
|
-
content: "(Incoming Change)";
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
[data-merge-conflict-actions-content] {
|
|
1087
|
-
min-height: 1.75rem;
|
|
1088
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1089
|
-
color: var(--diffs-fg);
|
|
1090
|
-
align-items: center;
|
|
1091
|
-
gap: .25rem;
|
|
1092
|
-
padding-inline: .5rem;
|
|
1093
|
-
font-size: .75rem;
|
|
1094
|
-
line-height: 1.2;
|
|
1095
|
-
display: flex;
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
[data-merge-conflict-action] {
|
|
1099
|
-
appearance: none;
|
|
1100
|
-
color: var(--diffs-fg-number);
|
|
1101
|
-
font: inherit;
|
|
1102
|
-
cursor: pointer;
|
|
1103
|
-
background: none;
|
|
1104
|
-
border: 0;
|
|
1105
|
-
padding: 0;
|
|
1106
|
-
font-style: normal;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
[data-merge-conflict-action]:hover {
|
|
1110
|
-
color: var(--diffs-fg);
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
[data-merge-conflict-action="current"]:hover {
|
|
1114
|
-
color: var(--diffs-addition-base);
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
[data-merge-conflict-action="incoming"]:hover {
|
|
1118
|
-
color: var(--diffs-modified-base);
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
[data-merge-conflict-action-separator] {
|
|
1122
|
-
color: var(--diffs-fg-number);
|
|
1123
|
-
opacity: .6;
|
|
1124
|
-
user-select: none;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
[data-diffs-header="default"] {
|
|
1128
|
-
background-color: var(--diffs-bg);
|
|
1129
|
-
justify-content: space-between;
|
|
1130
|
-
align-items: center;
|
|
1131
|
-
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1132
|
-
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
1133
|
-
z-index: 2;
|
|
1134
|
-
flex-direction: row;
|
|
1135
|
-
padding-inline: 16px;
|
|
1136
|
-
display: flex;
|
|
1137
|
-
position: relative;
|
|
1138
|
-
top: 0;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
[data-header-content] {
|
|
1142
|
-
align-items: center;
|
|
1143
|
-
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1144
|
-
white-space: nowrap;
|
|
1145
|
-
flex-direction: row;
|
|
1146
|
-
min-width: 0;
|
|
1147
|
-
display: flex;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
1151
|
-
text-overflow: ellipsis;
|
|
1152
|
-
white-space: nowrap;
|
|
1153
|
-
direction: rtl;
|
|
1154
|
-
min-width: 0;
|
|
1155
|
-
overflow: hidden;
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
[data-prev-name] {
|
|
1159
|
-
opacity: .7;
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
[data-rename-icon] {
|
|
1163
|
-
fill: currentColor;
|
|
1164
|
-
flex-grow: 0;
|
|
1165
|
-
flex-shrink: 0;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
[data-diffs-header="default"] [data-metadata] {
|
|
1169
|
-
white-space: nowrap;
|
|
1170
|
-
align-items: center;
|
|
1171
|
-
gap: 1ch;
|
|
1172
|
-
display: flex;
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
[data-diffs-header="default"] [data-additions-count] {
|
|
1176
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1177
|
-
color: var(--diffs-addition-base);
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
[data-diffs-header="default"] [data-deletions-count] {
|
|
1181
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1182
|
-
color: var(--diffs-deletion-base);
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
[data-change-icon] {
|
|
1186
|
-
fill: currentColor;
|
|
1187
|
-
flex-shrink: 0;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
1191
|
-
color: var(--diffs-modified-base);
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
[data-change-icon="new"] {
|
|
1195
|
-
color: var(--diffs-addition-base);
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
[data-change-icon="deleted"] {
|
|
1199
|
-
color: var(--diffs-deletion-base);
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
[data-change-icon="file"] {
|
|
1203
|
-
opacity: .6;
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
[data-annotation-content] {
|
|
1207
|
-
z-index: 2;
|
|
1208
|
-
isolation: isolate;
|
|
1209
|
-
white-space: normal;
|
|
1210
|
-
align-self: flex-start;
|
|
1211
|
-
min-width: 0;
|
|
1212
|
-
display: flow-root;
|
|
1213
|
-
position: relative;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
1217
|
-
width: var(--diffs-column-content-width, auto);
|
|
1218
|
-
left: var(--diffs-column-number-width, 0);
|
|
1219
|
-
position: sticky;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
[data-annotation-slot] {
|
|
1223
|
-
text-wrap-mode: wrap;
|
|
1224
|
-
word-break: normal;
|
|
1225
|
-
white-space-collapse: collapse;
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
[data-gutter-utility-slot] {
|
|
1229
|
-
touch-action: none;
|
|
1230
|
-
justify-content: flex-end;
|
|
1231
|
-
display: flex;
|
|
1232
|
-
position: absolute;
|
|
1233
|
-
top: 0;
|
|
1234
|
-
bottom: 0;
|
|
1235
|
-
right: 0;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
[data-utility-button] {
|
|
1239
|
-
appearance: none;
|
|
1240
|
-
cursor: pointer;
|
|
1241
|
-
width: 1lh;
|
|
1242
|
-
height: 1lh;
|
|
1243
|
-
font-size: var(--diffs-font-size, 13px);
|
|
1244
|
-
line-height: var(--diffs-line-height, 20px);
|
|
1245
|
-
background-color: var(--diffs-modified-base);
|
|
1246
|
-
color: var(--diffs-bg);
|
|
1247
|
-
fill: currentColor;
|
|
1248
|
-
z-index: 4;
|
|
1249
|
-
touch-action: none;
|
|
1250
|
-
border: none;
|
|
1251
|
-
border-radius: 4px;
|
|
1252
|
-
justify-content: center;
|
|
1253
|
-
align-items: center;
|
|
1254
|
-
margin-right: calc(-1lh + 1ch);
|
|
1255
|
-
padding: 0;
|
|
1256
|
-
display: flex;
|
|
1257
|
-
position: relative;
|
|
1258
|
-
|
|
1259
|
-
&:before {
|
|
1260
|
-
content: "";
|
|
1261
|
-
display: block;
|
|
1262
|
-
position: absolute;
|
|
1263
|
-
inset: 0 0 0 -4px;
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
[data-decoration-bar-stack] {
|
|
1268
|
-
pointer-events: none;
|
|
1269
|
-
isolation: isolate;
|
|
1270
|
-
z-index: 1;
|
|
1271
|
-
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
1272
|
-
box-sizing: content-box;
|
|
1273
|
-
border-left: 2px solid var(--diffs-bg);
|
|
1274
|
-
border-right: 2px solid var(--diffs-bg);
|
|
1275
|
-
width: 6px;
|
|
1276
|
-
position: absolute;
|
|
1277
|
-
top: 0;
|
|
1278
|
-
bottom: 0;
|
|
1279
|
-
right: -2px;
|
|
1280
|
-
|
|
1281
|
-
[data-decoration-bar-depth="1"] & {
|
|
1282
|
-
background-color: color-mix(in lab,
|
|
1283
|
-
var(--diffs-bg) 20%,
|
|
1284
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
[data-decoration-bar-depth="2"] & {
|
|
1288
|
-
background-color: color-mix(in lab,
|
|
1289
|
-
var(--diffs-bg) 45%,
|
|
1290
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
[data-decoration-bar-depth="3"] & {
|
|
1294
|
-
background-color: color-mix(in lab,
|
|
1295
|
-
var(--diffs-bg) 65%,
|
|
1296
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
[data-decoration-bar-start] & {
|
|
1300
|
-
border-top-left-radius: 5px;
|
|
1301
|
-
border-top-right-radius: 5px;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
[data-decoration-bar-end] & {
|
|
1305
|
-
z-index: 3;
|
|
1306
|
-
border-bottom-right-radius: 5px;
|
|
1307
|
-
border-bottom-left-radius: 5px;
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
[data-placeholder] {
|
|
1312
|
-
contain: strict;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
[data-error-wrapper] {
|
|
1316
|
-
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1317
|
-
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1318
|
-
scrollbar-width: none;
|
|
1319
|
-
max-height: 400px;
|
|
1320
|
-
overflow: auto;
|
|
1321
|
-
|
|
1322
|
-
& [data-error-message] {
|
|
1323
|
-
color: var(--diffs-deletion-base);
|
|
1324
|
-
font-size: 18px;
|
|
1325
|
-
font-weight: bold;
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
& [data-error-stack] {
|
|
1329
|
-
color: var(--diffs-fg-number);
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
@layer theme, rendered, unsafe;
|
|
1335
|
-
`,Ja;function Ya(e){if(Ja!=null)return Ja;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(Rt,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),Ja=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),Ja}function Xa(e){return`${Pt}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var Za=`@layer base, theme, rendered, unsafe;`,Qa=RegExp(`${no(Pt)}\\s*:\\s*[^;]+;`);function $a(e){return`${Za}
|
|
1336
|
-
@layer unsafe {
|
|
1337
|
-
${e}
|
|
1338
|
-
}`}function eo(e,t=`system`,n){return`${Za}
|
|
1339
|
-
@layer rendered {
|
|
1340
|
-
:host {${t===`system`?``:`
|
|
1341
|
-
color-scheme: ${t};`}
|
|
1342
|
-
${Xa(n)}
|
|
1343
|
-
${e}
|
|
1344
|
-
}
|
|
1345
|
-
}`}function to(e,t){let n=Xa(t);return e.replace(Qa,n)}function no(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var ro=new WeakMap;function io(e){return ro.get(e)??e}function ao(e,t){ro.set(e,t)}function oo({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function so(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function co(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function lo(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function uo(e,t,n){let r=new Map;for(let i of e){let e=io(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function fo(e,t,n){for(let r of t){let t=io(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function po(e,t,n){if(e==null)return n(t);let r=io(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function mo(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function ho(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:mo(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function go(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function _o({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=vo(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function vo(){let e=document.createElement(`style`);return e.setAttribute(Dn,``),e}var yo=void 0,bo=void 0;function xo(){return yo??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(Co())}function So(){return bo??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Co(){let e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??`unknown`}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(qa)),t.adoptedStyleSheets=[e]}connectedCallback(){Ya(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(ot,t)}var wo=[``];function To(e){let t={...e};return delete t.cacheKey,t}var Eo=-1,Do=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++Eo}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(e={theme:Ze},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new La(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new ca,this.interactionManager=new Vi(`file`,Hi(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>po(this.editSession?.annotations,e,Ta);handleHighlightRender=()=>{this.rerender()};rerender(){this.enabled&&this.file!=null&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Ze}getLatestFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedFile}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}updateExternalFile(e,t){if(Oa(this.file,e))return!1;let n=this.editSession!=null;return this.file=e,n||this.editor!=null?this.installEditSession(e,n?void 0:this.editor?.__getDocumentContents(e),!0):this.editSession=void 0,this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=uo(t,Ta,this.editSession.annotations)),!0}installEditSession(e,t,n=!1){let r=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===e.contents,i=To(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??uo(this.lineAnnotations,Ta)},this.fileRenderer.beginEditSession(i,r?e:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Hi(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!nt(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,fo(t,e,Ta))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.getLatestAnnotations().length>0}cleanUp(e=!1){let t=this.editor;this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||Oo(this.pre,i,this.options.collapsed)||ko(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),so(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(ho(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderedFile=e,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.getLatestFile()){return e==null?wo:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getLatestFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getLatestFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,file:i,lineAnnotations:r,renderRange:n,externalDocument:this.editSession?.externalReplacement===!0})},o=this.getTheme(),s=i.lang??Kt(i.name),c=et({theme:o,lang:s});c==null?St({themes:Ye(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.externalReplacement=!1)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSession==null?this.file!=null&&this.installEditSession(this.file,e.__getDocumentContents(this.file)):this.fileRenderer.beginEditSession(this.editSession.file);let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(this.fileRenderer.fileCache===t&&(this.renderedFile=t),this.syncRenderViewToEditor()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,file:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{file:a,annotations:o}=n;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=o?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...a},f={file:d,editor:t,originalFile:r,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===r.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}e&&c!=null&&(this.file=c,s!=null&&(this.lineAnnotations=s)),this.editSession=void 0;let{renderedFile:p,file:m}=this;if(this.fileRenderer.endEditSession(m),p!=null&&m!=null&&p!==m&&Oa(p,m)&&(this.renderedFile=m),e&&this.fileContainer!=null&&this.rerender(),l)throw u}applyDocumentChange(e,t){let n=this.editSession?.file;if(n==null)throw Error(`File.applyDocumentChange: requires an active edit session`);this.fileRenderer.beginEditSession(n),this.fileRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}updateRenderCache(e,t,n){let r=this.editSession?.file;if(r==null)throw Error(`File.updateRenderCache: requires an active edit session`);this.fileRenderer.beginEditSession(r),this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),m=!Oa(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&ga(u,this.renderRange)&&!m&&!p&&!f){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(ho(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderFile(h,mt);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,e.file),this.renderedFile=e?.file??h,this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f||!Oa(this.renderedFile,h))||!this.applyPartialRender(h,d,u)){let n=this.fileRenderer.renderFile(h,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyFullRender(n,e),this.renderedFile=n.file}this.applyBuffers(e,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||wn(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!Ba(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Wa(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Ga();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Ka(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=$a(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=Ya(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=_o({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:eo(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=to(this.themeCSSStyle.textContent??``,Ya(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&So()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=oo({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=dn(i.children),t.style.cssText=i.properties.style}else n.innerHTML=dn(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?go(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t,n){if(t==null||n==null)return!1;let{code:r}=this,i=r==null?void 0:this.getColumns(r);if(r==null||i==null)return!1;let a=t.startingLine,o=n.startingLine,s=t.totalLines===1/0?1/0:a+t.totalLines,c=n.totalLines===1/0?1/0:o+n.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(t,n)=>{if(!(n<=0))return this.fileRenderer.renderFile(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??dn(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,gt,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Et,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Bt,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Wt,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:lo(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):lo(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=za;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};Va(i,this.appliedPreAttributes)||(co(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Oo(e,t,n=!1){return!n&&e==null&&t!=null}function ko(e,t,n=!1){return e==null&&t!=null&&!n}var Ao=5e3,jo=new Map,Mo=-1;function No(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var Po=class extends Do{virtualizer;metrics;__id=`virtualized-file:${++Mo}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:jo};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=ct,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=tn(e);(t||!Ni(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache(),!0):!1}hasLineAnnotations(){return this.getLatestAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Pi(t,e),r=No(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.ghostTextRows=jo,this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){let{heights:t,ghostTextRows:n}=this.cache;if(n===e)return!1;let{lineHeight:r}=this.metrics,i=!1;for(let a of new Set([...n.keys(),...e.keys()])){let o=n.get(a)??0,s=e.get(a)??0;if(s===o)continue;let c=(t.get(a)??r)-o*r+s*r;c===r?t.delete(a):t.set(a,c),i=!0}return this.cache.ghostTextRows=e,i}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.editor?.__getGhostTextRows()??jo;if(e=this.applyGhostTextRows(n),t===`scroll`&&this.getLatestAnnotations().length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let{lineHeight:r}=this.metrics;if(this.code==null)return e;let i=this.code.children[1];if(!(i instanceof HTMLElement))return e;let a=Aa(this.getLatestAnnotations());if(this.renderRange!=null&&a&&Ma(this.renderRange)){let t=Fo(i)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!a&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let a=Number(i),o=t.getBoundingClientRect().height+(n.get(a)??0)*r,s=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(s=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let c=this.getLineHeight(a,s);o!==c&&(e=!0,o===this.metrics.lineHeight*(s?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,o))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));updateCodeViewLayout(e,t,n,r){let i=!Oa(this.file,e);i&&this.updateExternalFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o||c;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&this.resetLayoutCache(),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1,a=On(this.metrics,n);if(r||i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=On(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!Oa(this.getRenderedFile(),this.getLatestFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??jo);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=On(this.metrics,i),l=_n(this.metrics);if(this.height+=c,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:t.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.file==null)return;let e=this.getLatestFile(),t=e==null?void 0:this.fileRenderer.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!Oa(this.getRenderedFile(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1);let i=this.getRenderedFile();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!Oa(this.file,t);a&&(this.updateExternalFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:!1}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,(l||s)&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),s&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!1),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!d))return this.pendingRender=void 0,this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.fileRenderer.getFileForNextRender(n);return this.pendingRender={latestFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!Oa(i,a),renderedFileChanged:!Oa(r,a)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%Ao===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=On(this.metrics,i),u=s>0?_n(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=Aa(this.getLatestAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=Math.floor(g&&b<t+f?0:(b-(t+f))/o),h=Math.floor(m/a)-Math.floor(y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,w=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-w)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),w=t+(C?.top??f),T=C?.lineIndex??0,E,D,O,k=C?.lineIndex??0;for(let e=k;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),O!=null)){if(O<=0)break;O--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),w+s>b&&(D??=o),O==null&&w>=r&&i&&(O=x),T++,w+=s}if(E==null){if(g)E=0,D=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}D??=E;let A=Math.round(D-y/2),j=Math.max(0,Math.ceil(s/a)-y),M=Math.max(0,Math.min(A,j)),N=M*a,P=A<0?v+A*a:v,F=S[M]??0,ee=N===0?0:d+F,te=M+P/a,ne=te<S.length?p-S[te]:p-(w-t-f);return{startingLine:N,totalLines:P,bufferBefore:ee,bufferAfter:Math.max(0,ne)}}};function Fo(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===ka&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Io(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function Lo(e){return{...e,hunks:Io(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}var Ro=1;function zo(e,...t){return`ck${Ro}:${JSON.stringify([e,...t])}`}function Bo(e){return e===``?[]:e.split(en)}function Vo(e,t,n){let r=e===`clone`?Lo(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Ho(r,Wo(r,n),Go(r,n));case`rename-pure`:{let e=Go(r,n);Ko(r,n);let t=Bo(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,Jo(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Ho(e,t,n){let r=Bo(t.contents),i=Bo(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=Uo(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,Jo(e,t,n),e}function Uo(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(Ut(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=zt(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=zt(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function Wo(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function Go(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Ko(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function qo(e,t,n){return e.cacheKey==null?Yo(t,n):`${e.cacheKey}:hydrated`}function Jo(e,t,n){let r=qo(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function Yo(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?zo(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var Xo=new TextEncoder,Zo=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Qo=/[\uD800-\uDFFF]/,$o=1024,es=new Uint8Array($o);function ts(){es.length!==$o&&(es=new Uint8Array($o))}function ns(e){if(e.length===0)return e;if(Qo.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;es.length<t&&(es=new Uint8Array(t));let{written:n}=Xo.encodeInto(e,es);return Zo.decode(es.subarray(0,n))}var rs=4096,is=.5;function as(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=ss(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}os(t,e)}}function os(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 ss(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)>rs)return null;let c=[];for(let t=0;t<n;t++)c.push(ls(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(ls(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+=us(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*is: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 cs=/\s+/g;function ls(e){return e.replace(cs,``)}function us(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 ds(e,t,n=!1,r){let i=ks(e),a=i?vs(e):ys(e),o,s=[];for(let e of a){if(i&&!Ht.test(e)){if(o==null)o=ns(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!bs(e)){if(o==null)o=ns(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=ps(e,{cacheKey:t==null?void 0:r==null?zo(`patch-file`,t,String(s.length)):zo(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function fs(e,t){try{return ps(e,t)}finally{ts()}}function ps(e,{cacheKey:t,isGitDiff:n=Ht.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=As(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=_s(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Es(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?gs(i.contents):[],deletionLines:!l&&r!=null&&i!=null?gs(r.contents):[],cacheKey:Ms(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(it),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=ns(r.trim()),n!==r&&(c.prevName=ns(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?ft:Sn):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=ns(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=ns(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=ns(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=ns(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=ns(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=ns(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(Je)??[];t!=null&&(c.prevObjectId=ns(t)),n!=null&&(c.newObjectId=ns(n)),r!=null&&(c.mode=ns(r))}e.startsWith(`rename from `)&&(c.prevName=ns(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=ns(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
1346
|
-
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
1347
|
-
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:Ms(p.hunkContext),hunkSpecs:ns(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!ws(t)||Ts(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=Ns(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Ps(t);(g==null||g.type!==`change`)&&(g=Fs(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=Ps(t);(g==null||g.type!==`change`)&&(g=Fs(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=Ps(t);(g==null||g.type!==`context`)&&(g=Fs(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=Vt(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Vt(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=Ut(b.additionStart,b.additionCount)+(x===0?0:1),t=Ut(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Ut(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=zt(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=zt(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),as(c),c}}function ms(e,t,n=!1){let r=[],i=hs(e)?e.split(ut):[e];for(let e of i)try{r.push(ds(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{ts()}return r}function hs(e){return e.startsWith(`From `)||e.includes(`
|
|
1348
|
-
From `)}function gs(e){let t=_s(e);for(let e=0;e<t.length;e++)t[e]=ns(t[e]);return t}function _s(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
1349
|
-
`,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 vs(e){return As(e,`diff --git`)}function ys(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=Cs(e,r);if(i<=0&&a<=0){if(xs(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=Cs(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=Es(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 bs(e){return xs(e,0)}function xs(e,t){let n=Cs(e,t);return Ss(e,t,`---`)&&Ss(e,n,`+++`)}function Ss(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===`
|
|
1350
|
-
`||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function Cs(e,t){let n=e.indexOf(`
|
|
1351
|
-
`,t);return n===-1?e.length:n+1}function ws(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Ts(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
1352
|
-
`&&n!==`\r`)return!1}return!0}function Es(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Ds(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Ds(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Ds(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Ds(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=Os(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Ds(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 Os(e){return e.endsWith(`\r
|
|
1353
|
-
`)?e.slice(0,-2):e.endsWith(`
|
|
1354
|
-
`)?e.slice(0,-1):e}function ks(e){return e.startsWith(`diff --git`)||e.includes(`
|
|
1355
|
-
diff --git`)}function As(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:js(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=js(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function js(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function Ms(e){return e==null?e:ns(e)}function Ns(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Ps(e){let t=e.slice(1);return ns(t===``?`
|
|
1356
|
-
`:t)}function Fs(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 Is=`/dev/null`;function Ls(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Rs(),a=t??Rs(),o=fs(dt(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?zo(`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 Rs(){return{name:Is,contents:``}}var zs=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 Bs(e){return q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Vs(e){return q({tagName:`div`,children:[q({tagName:`span`,children:[Mt(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Hs(e){return q({tagName:`div`,children:[Pn({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 Us({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(q({tagName:`div`,children:[Mt(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Hs(`up`)),s++),o||(e.push(Hs(`down`)),s++)):(e.push(Hs(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(q({tagName:`div`,children:[q({tagName:`span`,children:[Mt(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(q({tagName:`div`,children:[Mt(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(q({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(q({tagName:`slot`,properties:{name:i}})),q({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function Ws(e,t){return`hunk-separator-${e}-${t}`}function Gs(e){let t=e.at(-1);return t==null?0:Math.max(zt(t.additionStart,t.additionCount),zt(t.deletionStart,t.deletionCount))}function Ks(e,t){let n=Ls({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 qs(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 Js(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function Ys(e,t){return t.length>0&&t.length<e.deletionLines.length&&Js(t)}function Xs(e,t,n){let r=e.deletionLines.join(``),i=qs(t.length,r),a=Ls({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 Zs(e,t){return Xs(e,[``],t)}function Qs(e,t){if(e.additionLines.length===0)return Zs(e,t);if(Ys(e,e.additionLines))return Xs(e,e.additionLines,t);let n=e.additionLines,r=Ks(e,t);return ec(r,n),r}function $s(e){return e.length>1&&e.at(-1)===``}function ec(e,t){if(!$s(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&&zt(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,uc(e);return}}}function tc(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return nc(e,Ks(e,n));let r=Array.from(t);if(r.length===0)return nc(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||Vt(r)===Vt(i))return nc(e,Ks(e,n))}let i=rc(e,r);if(i.size===0)return nc(e,Ks(e,n));for(let t of i)if(!ac(e,t,n))return nc(e,Ks(e,n));return uc(e),at(e)?nc(e,Ks(e,n)):nc(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function nc(e,t){return Object.assign(e,t),t}function rc(e,t){let n=new Set;for(let r of t){let t=ic(e,r);if(t==null)return new Set;n.add(t)}return n}function ic(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 ac(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=Ls({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:(sc(r,s),oc(e,t),!0)}function oc(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(`
|
|
1357
|
-
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
1358
|
-
`)}function sc(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>cc(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,lc(e)}function cc(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function lc(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 uc(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Ut(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,lc(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=zt(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-zt(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var dc=new WeakMap;function fc(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function pc(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 mc(e,t){let n=e.hunks,r=e.additionLines,i=fc(r),a=i===r?e:{...e,additionLines:i},o=wc(n,Cc(a,t),e.deletionLines.length),s=Dc(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Lc(e),ec(e,r),Ac(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function hc(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<Nc(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Nc(r);if(i==null||t<i||o!=null&&o!==s)return mc(e,n);o=s}if(o!=null){if(gc(e,i,o,r,n)){e.editSessionDirty=!0;return}return mc(e,n)}}function gc(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=_c(e),o=e.hunks[n];if(o.hunkContent.some(vc))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 _c(e){let t=dc.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return dc.set(e,{lines:e.deletionLines,set:n}),n}function vc(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function yc(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 bc(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=Dt({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Pc(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=Nt({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=Pc(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function xc(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=Pc(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,Pc(i)+i.deletionCount,e.deletionLines.length),n}function Sc(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Ks(e,t):Qs(e,t)),!0)}function Cc(e,t){if(pc(e.deletionLines,e.additionLines)==null)return[];let n=Ls({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=cc(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 wc(e,t,n){let r=e.map((e,t)=>{let n=Pc(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&&Tc(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=Ec(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 Tc(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function Ec(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 Dc(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`);kc(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`);kc(s,c,i,r),r+=c,i+=c,n.push(Oc(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 Oc(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:Fc(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Ic(t.additionStart,r),deletionStart:Fc(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Ic(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Fc(t.deletionStart,i)},${i} +${Fc(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return lc(s),s}function kc(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Ac(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(Pc(r)!==Pc(i)||r.deletionCount!==i.deletionCount||Nc(r)!==Nc(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!jc(r,i))return!0}return!1}function jc(e,t){let n=Mc(e),r=Mc(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*Mc(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 Nc(e){return Ut(e.additionStart,e.additionCount)}function Pc(e){return Ut(e.deletionStart,e.deletionCount)}function Fc(e,t){return t===0?e:e+1}function Ic(e,t){return t===0?e-1:e}function Lc(e){uc(e);for(let t=0;t<e.hunks.length;t++)oc(e,t)}var Rc=-1,zc=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Rc}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:Ze},t=Ta,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=pn(e.theme??Ze)?et():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,Zs(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&&qe(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!xn(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||!qe(t.diff,e)||rt(e)||Zc(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||!qe(n,e)||!qe(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);xn(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)??Ot}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=Vt(u);s==null&&i&&(a.additionLines[t]=Na(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,Zs(a,this.options.parseDiffOptions)),u=!0;else if(Ys(a,a.additionLines))this.applyRecomputePreservingSessionType(a,Xs(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=hc(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,tc(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=yc(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=Xc(e),i.code.additionLines=Jc(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Zs(r,this.options.parseDiffOptions)),i.code.additionLines[0]=Yc(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,Qs(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(Ys(e,n)){this.applyRecomputePreservingSessionType(e,Xs(e,n,t));return}this.applyExpansionRemap(mc(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=>_a(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=Ze,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=It,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 St(wa(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=Zc(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!xn(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!rt(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??Kt(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Ze}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||!qe(e,n.diff)||!xn(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(qe(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||rt(e)||Zc(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||qe(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&pn(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&pn(t.theme)}renderDiff(e=this.diff,t=Vn){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||rt(e)||Zc(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!qe(e,this.renderCache.diff),d=!ga(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&Ea(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Ea(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??Kt(e.name),this.highlighter??=et();let t=this.highlighter!=null&&pn(i.theme),n=this.highlighter!=null&&wt(this.computedLang),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Vn){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 Sa({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Zc(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Kt(e.name);let n=this.highlighter!=null&&pn(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&wt(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=lt(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(ht({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]=Yc(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&&qe(i,e)&&xn(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&xn(a.options,n)&&qe(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&&xn(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&qe(n.diff,e)&&xn(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&&qe(e,n.diff)&&xn(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=Qc(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:At(),deletionsGutterAST:At(),additionsGutterAST:At(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=st({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,Xt(void 0,`buffer`,this.size)),h?.push(Bs(this.size))):(x.pushToGutter(`deletions`,Xt(void 0,`buffer`,this.size)),g?.push(Bs(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,In(t,n,r,i))};function T(e){C.flush(),a===`unified`?Gc(`unified`,e,x):(Gc(`deletions`,e,x),Gc(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),ht({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Hc(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Kc(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Kc(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Wc({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Hc(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Uc(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=Kc(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Kc(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Wc({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Uc(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(Vs(e)),x.pushToGutter(`unified`,Xt(e,`metadata`,1))):(x.deletionsContentAST.push(Vs(e)),x.pushToGutter(`deletions`,Xt(e,`metadata`,1)),k||(x.pushToGutter(`additions`,Xt(void 0,`buffer`,1)),x.additionsContentAST.push(Bs(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(Vs(e)),x.pushToGutter(`unified`,Xt(e,`metadata`,1))):(x.additionsContentAST.push(Vs(e)),x.pushToGutter(`additions`,Xt(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,Xt(void 0,`buffer`,1)),x.deletionsContentAST.push(Bs(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(Gs(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=At(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,Pa(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return dn(this.renderFullAST(e,t))}renderPartialHTML(e,t){return dn(t==null?e:q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!Ma(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(ja(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(ja(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Wc({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Wc({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 ya({fileOrDiff:e,mode:t,stickyHeader:n})}},Bc=new Intl.PluralRules(`en-US`);function Vc(e){return`${e} unmodified line${Bc.select(e)===`one`?``:`s`}`}function Hc(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Uc(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 Wc({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`,Xt(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`,Xt(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`,Xt(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Gc(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,Us({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Us({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Us({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Us({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Ws(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Vc(n):`More unchanged context may be available`;c.pushToGutter(e,Us({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Us({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 Kc(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function qc(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Jc(e,t,n,r){let i=qc(e),a=qc(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]??=Yc(e,r.getLineText(e));return l}function Yc(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 Xc(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function Zc(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Qc(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function $c(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function el(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function tl(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function nl({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function rl(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:mo(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 il(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function al(e){let t={...e};return delete t.cacheKey,t}function ol(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??Kt(e.name),r=t.lang??Kt(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 sl(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function cl(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&sl(n.lines,t.deletionLines)}var ll=-1,ul=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++ll}`;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:Ze},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new ca,this.scrollSyncManager=new zs,this.interactionManager=new Vi(`diff`,Hi(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??Ze}getHunksRendererOptions(e){return rl(e)}createHunksRenderer(e){return new zc(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=Ut(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(Hi(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&&!nt(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>po(this.editSession?.annotations,e,Ta);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,fo(t,e,Ta))}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;ji(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=nl(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||hl(this.pre,pl({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||gl(this.headerElement,ml({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),so(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?Ls(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||!il(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(Vo(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await tl(()=>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(dl(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(qe(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(dl(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=uo(t,Ta,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Bo(t.contents),a=n!=null&&cl(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=al(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,uc(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??uo(this.lineAnnotations,Ta),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=nl(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!fl(u,this.deletionFile)||!fl(d,this.additionFile)),y=e!=null&&!qe(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&ga(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Ls(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Sc(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,mt);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!qe(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?ol(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??Kt(i.name),c=et({theme:o,lang:s});c==null?St({themes:Ye(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||Ea(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return ht({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&&ol(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?Io(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(dl(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=Lo(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=bc(e,this.hunksRenderer.getExpandedHunksMap(),t);return Sc(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(xc(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 pt({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 Ft({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]=Bn(o);if(e<s){let c=Dt({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=Nt({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]=Bn(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(){Ai(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||rt(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||!el(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||!$c(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Wa(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Ga();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:lo(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):lo(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=za;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&&qe(r,n)?i:void 0)??dn(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,gt,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Et,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Bt,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Wt,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Ka(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=$a(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=Ya(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=_o({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:eo(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=to(this.themeCSSStyle.textContent??``,Ya(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&So()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?go(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=_l(t[0]),a=_l(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=dn(i),r.content.innerHTML=dn(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=oo({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=oo({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=oo({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=_l(r?.[0]),a=_l(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=_l(r?.[0]),a=_l(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=dn(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?go(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=_l(t[0]),i=_l(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};Va(u,this.appliedPreAttributes)||(co(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 dl(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function fl(e,t){return e==null||t==null?e==null&&t==null:Tt(e,t)}function pl({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function ml({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function hl(e,t,n=!1){return!n&&e==null&&t}function gl(e,t,n=!1){return e==null&&t&&!n}function _l(e){if(e!=null&&e.type===`element`)return e.children??[]}function vl({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=On(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=Dt({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=Xe({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=yl(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?Nt({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=Lt({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Lt({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=_n(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function yl(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 bl(e,t)}function bl(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var xl=3e3,Sl=new Map,Cl=-1,wl=class extends ul{__id=`little-virtualized-file-diff:${++Cl}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Sl,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=tn(n)}setMetrics(e,t=!1){let n=tn(e);(t||!Ni(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 Aa(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=!Pi(t,e),r=n&&Ml(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Nl(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=Sl,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()??Sl);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&&Ma(this.renderRange)){let t=Tl(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=Ll(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=tn(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=On(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return ht({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=Xe({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=Lt({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??On(this.metrics,n)+this.cache.fileAnnotationHeight,u;return ht({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=Xe({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=Lt({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||!qe(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=Vo(`clone`,e,t);if(await tl(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Vo(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await tl(()=>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 pt({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,!qe(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()??Sl);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=On(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}=vl({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Pl(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=nl(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Il(s,this.deletionFile)||!Il(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Ls(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!qe(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:!1}:this.updatePendingRender(u,r);if((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),f)this.top??=this.getVirtualizedTop(),g&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.pendingRender=void 0,this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(this.getRenderedDiff()!==this.pendingRender?.diff)throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!qe(a,o),renderedDiffChanged:!qe(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 Fl(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=Pl(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=El(this.cache.heightDeltas),u=On(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=kl(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Al(i,e)*this.metrics.lineHeight+Dl(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=xl}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Dl(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=Dt({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?Xe({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?Nt({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Lt({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:jl({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}=Dt({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Nt({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=Pl(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=On(this.metrics,i),h=e.hunks.length>0?_n(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(ht({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?Xe({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=Lt({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null){if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}M??=j;let P=Math.round(M-w/2),F=Math.max(0,Math.ceil(p/s)-w),ee=Math.max(0,Math.min(P,F)),te=ee*s,ne=P<0?C+P*s:C,re=E[ee]??0,ie=te===0?0:g+re,I=ee+ne/s,L=I<E.length?v-E[I]:v-(k-t-_);return{startingLine:te,totalLines:ne,bufferBefore:ie,bufferAfter:Math.max(0,L)}}};function Tl(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===ka&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function El(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 Dl({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Ol(e,n);return(t[Ol(e,r)]??0)-(t[i]??0)}function Ol(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 kl(e){return Math.ceil(e/xl)*xl}function Al(e,t){let n=0;for(let r of e)r<t&&n++;return n}function jl({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 Ml(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 Nl(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 Pl(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Fl(e){return typeof e==`function`?`custom`:e??`line-info`}function Il(e,t){return e==null||t==null?e==null&&t==null:Tt(e,t)}function Ll(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Rl({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function zl(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Bl(n,e.startContentIndex)}}function Bl(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function Vl(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var Hl=1e3,Ul=Hl*4,Wl=[0,1e-6,.99999,1],Gl={overscrollSize:Hl,intersectionObserverMargin:Ul,resizeDebugging:!1},Kl=0,ql=-1,Jl=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++ql}`;config;type=`simple`;intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Gl,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Wl,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),Ai(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),Ai(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),Ai(this.computeRenderRangeAndEmit)}requestHeightReconcile(e){this.reconcileQueue.add(e),Ai(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=Li({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: content size change`,this.__id,{sizeChange:e-Kl,newSize:e}),Kl=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: scroller size change`,this.__id,{sizeChange:e-Kl,newSize:e}),Kl=e))}t&&Ai(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw Error(`Virtualizer.setupWindow: Invalid setup method`);window.addEventListener(`scroll`,this.handleWindowScroll,{passive:!0}),window.addEventListener(`resize`,this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw Error(`Virtualizer.setupElement: Invalid setup method`);this.root.addEventListener(`scroll`,this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){ji(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleElementScroll),window.removeEventListener(`scroll`,this.handleWindowScroll),window.removeEventListener(`resize`,this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(e){return this.getScrollTop()+Yl(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error(`Virtualizer.connect: instance is already connected...`);return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),Ai(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.instancesChanged.delete(t),this.reconcileQueue.delete(t),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),Ai(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,Ai(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{!e.__STOP&&this.root!=null&&this.root instanceof Document&&(this.scrollDirty=!0,Ai(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,Ai(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty,n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let e=Li({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&Vl(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),i=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&i.add(e);for(let e of this.instancesChanged)i.has(e)||e.onRender(t)&&i.add(e);this.scrollFix(r);for(let e of i)this.reconcileQueue.delete(e),e.reconcileHeights();for(let e of this.reconcileQueue)e.reconcileHeights()&&(n=!0);this.reconcileQueue.clear(),n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&Ai(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=Yl(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=Yl(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:`instant`}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:`instant`}),this.markDOMDirty()}getScrollAnchor(e){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=Yl(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=Yl(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);e!=null&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&Ai(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=this.clampScrollTop(e),this.scrollTop=e,e}scrollTo({top:e,behavior:t=`auto`}){let{root:n}=this;if(n==null)return;let r=this.clampScrollTop(e);n instanceof Document?window.scrollTo({top:r,behavior:t}):n.scrollTo({top:r,behavior:t}),this.scrollDirty=!0,Ai(this.computeRenderRangeAndEmit)}clampScrollTop(e){return Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function Yl(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}var J=e(we(),1),Y=Be(),X=g();function Xl(e){let t=(0,Y.c)(56),{entry:n,running:r}=e,i=n.rawCommand??n.command,a;t[0]===n?a=t[1]:(a=cn(n),t[0]=n,t[1]=a);let o=a,s,c,l,u;t[2]!==n.label||t[3]!==n.toolTitle||t[4]!==i||t[5]!==r||t[6]!==o?(s=i?qt(i,o===`running`&&r):null,c=n.toolTitle??n.label,l=/^(read|readfile|read_file)$/i.test(c),u=s?.verb.toLowerCase().includes(`search`)||/search|grep|glob/i.test(c),t[2]=n.label,t[3]=n.toolTitle,t[4]=i,t[5]=r,t[6]=o,t[7]=s,t[8]=c,t[9]=l,t[10]=u):(s=t[7],c=t[8],l=t[9],u=t[10]);let d=u?Ie:l||s?.verb===`Read`?Te:s?Fe:cr,f=s?.verb??(l?`Read`:c),p;t[11]!==s?.target||t[12]!==n.changedFiles||t[13]!==n.detail?(p=s?.target??n.changedFiles?.join(`, `)??n.detail,t[11]=s?.target,t[12]=n.changedFiles,t[13]=n.detail,t[14]=p):p=t[14];let m=p,h=o===`running`?r?`Running`:`No completion received`:o===`failed`?`Failed`:`Completed`,g;t[15]===n?g=t[16]:(g=Cn(n),t[15]=n,t[16]=g);let _=g,v;t[17]===d?v=t[18]:(v=(0,X.jsx)(d,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),t[17]=d,t[18]=v);let y;t[19]!==f||t[20]!==m?(y=m&&m!==f?(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` · `,m]}):null,t[19]=f,t[20]=m,t[21]=y):y=t[21];let b;t[22]!==f||t[23]!==y?(b=(0,X.jsxs)(`span`,{className:`block break-words font-medium`,children:[f,y]}),t[22]=f,t[23]=y,t[24]=b):b=t[24];let x=o===`failed`?`text-destructive`:`text-muted-foreground/70`,S=_?` · ${_}`:``,C;t[25]!==h||t[26]!==x||t[27]!==S?(C=(0,X.jsxs)(`span`,{className:x,children:[h,S]}),t[25]=h,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;t[29]!==C||t[30]!==b?(w=(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[b,C]}),t[29]=C,t[30]=b,t[31]=w):w=t[31];let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,X.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground transition-transform group-open:rotate-90`,children:`›`}),t[32]=T):T=t[32];let E;t[33]!==w||t[34]!==v?(E=(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-start gap-2 rounded px-1 py-2 text-xs outline-none hover:bg-accent/35 focus-visible:ring-2 focus-visible:ring-ring`,children:[v,w,T]}),t[33]=w,t[34]=v,t[35]=E):E=t[35];let D;t[36]===i?D=t[37]:(D=i?(0,X.jsx)(`pre`,{"aria-label":`Command`,className:`overflow-auto whitespace-pre-wrap break-words rounded bg-muted/40 p-2 font-mono`,children:i}):null,t[36]=i,t[37]=D);let O;t[38]!==n.detail||t[39]!==i||t[40]!==m?(O=n.detail&&n.detail!==m&&n.detail!==i?(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-muted-foreground`,children:n.detail}):null,t[38]=n.detail,t[39]=i,t[40]=m,t[41]=O):O=t[41];let k;t[42]!==n.output||t[43]!==r||t[44]!==o?(k=n.output?(0,X.jsx)(`pre`,{"aria-label":`Tool output`,className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/30 p-2 font-mono leading-relaxed`,children:n.output}):(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:o===`running`&&r?`Waiting for tool output…`:`No output was captured for this tool.`}),t[42]=n.output,t[43]=r,t[44]=o,t[45]=k):k=t[45];let A;t[46]===n.exitCode?A=t[47]:(A=n.exitCode===void 0?null:(0,X.jsxs)(`p`,{className:`font-mono text-muted-foreground`,children:[`Exit code `,n.exitCode]}),t[46]=n.exitCode,t[47]=A);let j;t[48]!==D||t[49]!==O||t[50]!==k||t[51]!==A?(j=(0,X.jsxs)(`div`,{className:`space-y-2 pb-3 pl-6 text-xs`,children:[D,O,k,A]}),t[48]=D,t[49]=O,t[50]=k,t[51]=A,t[52]=j):j=t[52];let M;return t[53]!==E||t[54]!==j?(M=(0,X.jsxs)(`details`,{"data-agent-tool":!0,className:`group min-w-0 border-b border-border/35 py-1 last:border-0`,children:[E,j]}),t[53]=E,t[54]=j,t[55]=M):M=t[55],M}function Zl(e){let t=(0,Y.c)(10),{subagent:n,running:r}=e,i;t[0]===n?i=t[1]:(i=Di(n),t[0]=n,t[1]=i);let a=i;if(a.length===0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{className:`p-4 text-xs leading-relaxed text-muted-foreground`,children:`No detailed activity has been captured. Status and usage remain available when the provider reports them.`}),t[2]=e):e=t[2],e}let o;if(t[3]!==r||t[4]!==a){let e;t[6]===r?e=t[7]:(e=e=>e.kind===`tool`?(0,X.jsx)(Xl,{entry:e.tool,running:r},e.id):(0,X.jsx)(`article`,{"data-agent-message":!0,className:`min-w-0 border-l-2 border-border/50 py-2 pl-3 text-sm`,children:(0,X.jsx)(fn,{text:e.message.text,cwd:void 0,isStreaming:!1})},e.id),t[6]=r,t[7]=e),o=a.map(e),t[3]=r,t[4]=a,t[5]=o}else o=t[5];let s;return t[8]===o?s=t[9]:(s=(0,X.jsx)(`div`,{"data-agent-timeline":!0,className:`min-w-0 space-y-2 px-3 py-3`,children:o}),t[8]=o,t[9]=s),s}var Ql={pending:{dotClass:`bg-info`,label:`Queued`},running:{dotClass:`bg-info`,label:`Running`},waiting:{dotClass:`bg-info`,label:`Waiting`},idle:{dotClass:`bg-muted-foreground/50`,label:`Idle · resumable`},completed:{dotClass:`bg-success`,label:`Completed`},failed:{dotClass:`bg-destructive`,label:`Failed`},cancelled:{dotClass:`bg-muted-foreground/60`,label:`Stopped`},interrupted:{dotClass:`bg-muted-foreground/60`,label:`Interrupted`}},$l=(0,J.createContext)({identities:new Map,onOpenAgent:null});function eu(e){let t=(0,Y.c)(4),{status:n}=e,r=Ql[n],i;t[0]===r.dotClass?i=t[1]:(i=L(`size-1.5 shrink-0 rounded-full`,r.dotClass),t[0]=r.dotClass,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,X.jsx)(`span`,{"aria-hidden":!0,className:i}),t[2]=i,t[3]=a),a}function tu(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/60);if(n===0)return`${t}s`;let r=Math.floor(n/60);return r===0?`${n}m ${String(t%60).padStart(2,`0`)}s`:`${r}h ${String(n%60).padStart(2,`0`)}m`}function nu(e,t){let n=Date.parse(e),r=t?Date.parse(t):Date.now();return Number.isNaN(n)||Number.isNaN(r)?``:tu((r-n)/1e3)}function ru(e){return e.usage?.durationMs===void 0?e.startedAt&&e.completedAt?nu(e.startedAt,e.completedAt):null:tu(e.usage.durationMs/1e3)}function iu(e){let t=(0,Y.c)(12),{agent:n}=e,r=(0,J.useRef)(null),i=n.status===`running`||n.status===`waiting`,a=n.startedAt,o,s;if(t[0]!==i||t[1]!==a?(o=()=>{if(!i||!a)return;let e=()=>{r.current&&(r.current.textContent=nu(a,null))};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},s=[i,a],t[0]=i,t[1]=a,t[2]=o,t[3]=s):(o=t[2],s=t[3]),(0,J.useEffect)(o,s),!i){let e;t[4]===n?e=t[5]:(e=ru(n),t[4]=n,t[5]=e);let r=e,i;return t[6]===r?i=t[7]:(i=r?(0,X.jsx)(`span`,{className:`tabular-nums`,children:r}):null,t[6]=r,t[7]=i),i}if(!a)return null;let c;t[8]===a?c=t[9]:(c=nu(a,null),t[8]=a,t[9]=c);let l;return t[10]===c?l=t[11]:(l=(0,X.jsx)(`span`,{ref:r,className:`tabular-nums`,children:c}),t[10]=c,t[11]=l),l}function au(e,t){return/^structured[\s_-]?output$/i.test(e)?t?`Delivering result`:`Delivered result`:t?`Using ${e}`:e}function ou(e){return e.status===`running`||e.status===`pending`||e.status===`waiting`?e.progress??(e.lastToolName?au(e.lastToolName,!0):null)??e.result??e.error:e.error??e.result??e.progress??(e.lastToolName?au(e.lastToolName,!1):null)}function su(e){let t=(0,Y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`divide-y divide-border/30`,children:n}),t[0]=n,t[1]=r),r}function cu(e){let t=(0,Y.c)(11),{title:n}=e,r=`${n} pending`,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex size-7 items-center justify-center rounded-lg border border-dashed border-border/60 bg-background/30 text-muted-foreground/55`,children:(0,X.jsx)(Zn,{className:`size-3.5`})}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,X.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground/75`,children:n}),t[1]=n,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground/65`,children:`Waiting for this stage to start`}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,X.jsxs)(`span`,{className:`min-w-0`,children:[a,o]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[.68rem] text-muted-foreground/65`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-muted-foreground/40`}),`Pending`]}),t[6]=c):c=t[6];let l;return t[7]!==r||t[8]!==s||t[9]!==n?(l=(0,X.jsxs)(`div`,{"data-workflow-pending-step":!0,"data-phase-title":n,"aria-label":r,className:`grid h-14 grid-cols-[1.75rem_minmax(0,1fr)_auto] items-center gap-x-2 rounded-md px-1.5 py-1 text-left`,children:[i,s,c]}),t[7]=r,t[8]=s,t[9]=n,t[10]=l):l=t[10],l}function lu(e){let t=(0,Y.c)(72),{agent:n}=e,{identities:r,onOpenAgent:i}=(0,J.use)($l),a=Ql[n.status],o;t[0]===n?o=t[1]:(o=ou(n),t[0]=n,t[1]=o);let s=o,c;t[2]!==n.effort||t[3]!==n.model?(c=ie(n.model,n.effort),t[2]=n.effort,t[3]=n.model,t[4]=c):c=t[4];let l=c,u,d,f;t[5]!==n.id||t[6]!==n.title||t[7]!==r?(d=r.get(n.id),u=d?.codename??n.title,f=d?.role&&!le(d.role,u)&&!le(d.role,n.title)?d.role:null,t[5]=n.id,t[6]=n.title,t[7]=r,t[8]=u,t[9]=d,t[10]=f):(u=t[8],d=t[9],f=t[10]);let p=f,m=d?.taskLabel??n.title,h;t[11]===n.usage?h=t[12]:(h=n.usage?`${ae(n.usage.totalTokens)} tok`:`— tok`,t[11]=n.usage,t[12]=h);let g=n.usage?.toolUses===void 0?null:`${n.usage.toolUses} tools`,_=n.activationCount>1?`run ${n.activationCount}`:null,v;t[13]!==l||t[14]!==h||t[15]!==g||t[16]!==_?(v=[l,h,g,_].filter(uu),t[13]=l,t[14]=h,t[15]=g,t[16]=_,t[17]=v):v=t[17];let y=v,b=d?.avatarKey??n.id,x;t[18]===b?x=t[19]:(x=(0,X.jsx)(xt,{name:b,className:`size-5`}),t[18]=b,t[19]=x);let S;t[20]===n.status?S=t[21]:(S=(0,X.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 grid size-2.5 place-items-center rounded-full bg-background ring-1 ring-background`,children:(0,X.jsx)(eu,{status:n.status})}),t[20]=n.status,t[21]=S);let C;t[22]!==S||t[23]!==x?(C=(0,X.jsxs)(`span`,{"aria-hidden":!0,className:`relative col-start-1 row-span-3 row-start-1 mt-0.5 flex size-7 items-center justify-center rounded-lg border border-border/45 bg-background/45`,children:[x,S]}),t[22]=S,t[23]=x,t[24]=C):C=t[24];let w;t[25]===u?w=t[26]:(w=(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold tracking-[-0.01em]`,children:u}),t[25]=u,t[26]=w);let T;t[27]===p?T=t[28]:(T=p?(0,X.jsx)(`span`,{className:`max-w-32 shrink-0 truncate rounded-sm border border-border/60 bg-background/40 px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:p}):null,t[27]=p,t[28]=T);let E;t[29]!==w||t[30]!==T?(E=(0,X.jsxs)(`span`,{className:`col-start-2 row-start-1 flex min-w-0 items-center gap-1.5`,children:[w,T]}),t[29]=w,t[30]=T,t[31]=E):E=t[31];let D;t[32]===a.label?D=t[33]:(D=(0,X.jsx)(`span`,{children:a.label}),t[32]=a.label,t[33]=D);let O;t[34]===n?O=t[35]:(O=(0,X.jsx)(iu,{agent:n}),t[34]=n,t[35]=O);let k;t[36]===n.status?k=t[37]:(k=n.status===`completed`?(0,X.jsx)(V,{"aria-hidden":!0,className:`size-3 text-success`}):null,t[36]=n.status,t[37]=k);let A;t[38]!==D||t[39]!==O||t[40]!==k?(A=(0,X.jsx)(`span`,{className:`col-start-3 row-start-1 min-w-14 text-right font-mono text-[.7rem] text-muted-foreground/80`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[D,O,k]})}),t[38]=D,t[39]=O,t[40]=k,t[41]=A):A=t[41];let j;t[42]===m?j=t[43]:(j=(0,X.jsx)(`span`,{className:`col-start-2 col-end-4 row-start-2 block truncate text-[11px] text-foreground/65`,title:m,children:m}),t[42]=m,t[43]=j);let M=n.status===`failed`?`text-destructive-foreground`:`text-muted-foreground`,N;t[44]===M?N=t[45]:(N=L(`col-start-2 row-start-3 block min-w-0 truncate text-xs`,M),t[44]=M,t[45]=N);let P=s??a.label,F=s??a.label,ee;t[46]!==N||t[47]!==P||t[48]!==F?(ee=(0,X.jsx)(`span`,{className:N,title:P,children:F}),t[46]=N,t[47]=P,t[48]=F,t[49]=ee):ee=t[49];let te=y.join(` · `),ne;t[50]===te?ne=t[51]:(ne=(0,X.jsx)(`span`,{className:`col-start-3 row-start-3 max-w-40 truncate text-right font-mono text-[.68rem] tabular-nums text-muted-foreground/65`,children:te}),t[50]=te,t[51]=ne);let re;t[52]===a.label?re=t[53]:(re=(0,X.jsx)(`span`,{className:`sr-only`,children:a.label}),t[52]=a.label,t[53]=re);let I;t[54]!==C||t[55]!==E||t[56]!==A||t[57]!==j||t[58]!==ee||t[59]!==ne||t[60]!==re?(I=(0,X.jsxs)(X.Fragment,{children:[C,E,A,j,ee,ne,re]}),t[54]=C,t[55]=E,t[56]=A,t[57]=j,t[58]=ee,t[59]=ne,t[60]=re,t[61]=I):I=t[61];let oe=I,se=i&&`hover:bg-accent/35 focus-visible:ring-2 focus-visible:ring-ring/50`,ce;t[62]===se?ce=t[63]:(ce=L(`grid h-[4.5rem] w-full grid-cols-[1.75rem_minmax(0,1fr)_auto] grid-rows-[1.375rem_1.125rem_1rem] items-center gap-x-2 rounded-md px-1.5 py-1 text-left outline-none transition-colors`,se),t[62]=se,t[63]=ce);let R=ce,z;return t[64]!==n.id||t[65]!==R||t[66]!==u||t[67]!==oe||t[68]!==i||t[69]!==p||t[70]!==a.label?(z=i?(0,X.jsx)(`button`,{type:`button`,className:R,"data-agent-row":!0,"data-agent-id":n.id,onClick:()=>i(n.id),"aria-label":`Open ${u}${p?`, ${p}`:``} transcript. ${a.label}.`,children:oe}):(0,X.jsx)(`div`,{className:R,"data-agent-row":!0,"data-agent-id":n.id,children:oe}),t[64]=n.id,t[65]=R,t[66]=u,t[67]=oe,t[68]=i,t[69]=p,t[70]=a.label,t[71]=z):z=t[71],z}function uu(e){return e!==null}function du(e){let t=e.workflow.status;return t!==`completed`&&t!==`failed`&&t!==`cancelled`&&t!==`interrupted`}function fu(e){return[...e.phases.flatMap(e=>e.members),...e.unphasedMembers]}function pu(e){let t=(0,Y.c)(4),{group:n}=e;if(n.phases.length===0)return null;let r;t[0]===n.phases?r=t[1]:(r=n.phases.map(mu),t[0]=n.phases,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-1 gap-y-1 px-1.5 pb-1 pt-1.5`,children:r}),t[2]=r,t[3]=i),i}function mu(e,t){return(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0?(0,X.jsx)(Yn,{"aria-hidden":!0,className:`size-3 text-muted-foreground/40`}):null,(0,X.jsxs)(`div`,{className:L(`flex items-center gap-1 rounded-sm border px-1.5 py-0.5`,e.state===`running`?`border-info/40`:e.state===`done`?`border-success/30`:`border-border/50`),children:[(0,X.jsxs)(`span`,{className:L(`font-mono text-[.65rem]`,e.state===`running`?`text-info-foreground`:e.state===`done`?`text-success-foreground`:`text-muted-foreground/70`),children:[e.state===`done`?`✓ `:``,e.title]}),(0,X.jsx)(`span`,{className:`flex items-center gap-0.5`,children:e.members.length===0?(0,X.jsx)(`span`,{className:`font-mono text-[.6rem] text-muted-foreground/50`,children:`–`}):e.members.map(hu)})]})]},e.index)}function hu(e){return(0,X.jsx)(eu,{status:e.status},e.id)}var gu=15e3;function _u(e){let t=(0,Y.c)(28),{environmentId:n,threadId:r,scriptPath:i,onClose:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={state:`loading`},t[0]=o):o=t[0];let[s,c]=(0,J.useState)(o),[l,u]=(0,J.useState)(0),d;t[1]!==n||t[2]!==i||t[3]!==r?(d=()=>{let e=!1,t;c({state:`loading`});let a=ye(n)?.orchestration.getWorkflowScript;if(!a){c({state:`failed`});return}let o=new Promise((e,n)=>{t=setTimeout(()=>n(Error(`workflow script fetch timed out`)),gu)});return Promise.race([a({threadId:r,scriptPath:i}),o]).then(t=>{e||c({state:`loaded`,contents:t.contents,truncated:t.truncated})}).catch(()=>{e||c({state:`failed`})}).finally(()=>{t!==void 0&&clearTimeout(t)}),()=>{e=!0,t!==void 0&&clearTimeout(t)}},t[1]=n,t[2]=i,t[3]=r,t[4]=d):d=t[4];let f;t[5]!==l||t[6]!==n||t[7]!==i||t[8]!==r?(f=[n,r,i,l],t[5]=l,t[6]=n,t[7]=i,t[8]=r,t[9]=f):f=t[9],(0,J.useEffect)(d,f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(Kr,{"aria-hidden":!0,className:`size-3 text-muted-foreground`}),t[10]=p):p=t[10];let m;t[11]===i?m=t[12]:(m=i.split(`/`).at(-1),t[11]=i,t[12]=m);let h;t[13]===m?h=t[14]:(h=(0,X.jsx)(`span`,{className:`truncate font-mono text-[.65rem] text-muted-foreground`,children:m}),t[13]=m,t[14]=h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(ee,{"aria-hidden":!0,className:`size-3`}),t[15]=g):g=t[15];let _;t[16]===a?_=t[17]:(_=(0,X.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Close script`,className:`ml-auto text-muted-foreground hover:text-foreground`,children:g}),t[16]=a,t[17]=_);let v;t[18]!==h||t[19]!==_?(v=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 px-2 py-1`,children:[p,h,_]}),t[18]=h,t[19]=_,t[20]=v):v=t[20];let y;t[21]!==s.contents||t[22]!==s.state||t[23]!==s.truncated?(y=(0,X.jsx)(`div`,{className:`max-h-72 overflow-auto p-2`,children:s.state===`loaded`?(0,X.jsxs)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[.7rem] leading-relaxed text-foreground/90`,children:[s.contents,s.truncated?`
|
|
1359
|
-
… (truncated)`:``]}):s.state===`failed`?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`p`,{className:`text-xs text-destructive-foreground`,children:`Could not load the script.`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>u(vu),className:`text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground`,children:`Retry`})]}):(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading…`})}),t[21]=s.contents,t[22]=s.state,t[23]=s.truncated,t[24]=y):y=t[24];let b;return t[25]!==y||t[26]!==v?(b=(0,X.jsxs)(`div`,{className:`mx-1.5 mb-1 rounded-md border border-border/60 bg-background/60`,children:[v,y]}),t[25]=y,t[26]=v,t[27]=b):b=t[27],b}function vu(e){return e+1}function yu(e){let t=(0,Y.c)(33),{phase:n,defaultOpen:r}=e,[i,a]=(0,J.useState)(r!==void 0&&r||n.state===`running`),o=(0,J.useRef)(n.state),s,c;t[0]===n.state?(s=t[1],c=t[2]):(s=()=>{o.current!==`running`&&n.state===`running`&&a(!0),o.current=n.state},c=[n.state],t[0]=n.state,t[1]=s,t[2]=c),(0,J.useEffect)(s,c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>a(Su),t[3]=l):l=t[3];let u=n.state===`done`?`text-success-foreground`:n.state===`running`?`text-info-foreground`:`text-muted-foreground/70`,d;t[4]===u?d=t[5]:(d=L(`mt-2 flex w-full items-center gap-1.5 rounded-sm px-1.5 text-left text-[.65rem] font-medium uppercase tracking-wider hover:bg-accent/40`,u),t[4]=u,t[5]=d);let f;t[6]===i?f=t[7]:(f=i?(0,X.jsx)(ge,{"aria-hidden":!0,className:`size-3 shrink-0`}):(0,X.jsx)(Yn,{"aria-hidden":!0,className:`size-3 shrink-0`}),t[6]=i,t[7]=f);let p;t[8]===n.state?p=t[9]:(p=n.state===`done`?(0,X.jsx)(V,{"aria-hidden":!0,className:`size-3`}):null,t[8]=n.state,t[9]=p);let m;t[10]===n.title?m=t[11]:(m=(0,X.jsx)(`span`,{children:n.title}),t[10]=n.title,t[11]=m);let h=n.state===`pending`&&n.members.length===0?`pending`:n.state===`done`?`${n.settledCount} done`:`${n.activeCount} active · ${n.settledCount} done`,g;t[12]===h?g=t[13]:(g=(0,X.jsx)(`span`,{className:`font-normal normal-case text-muted-foreground/70`,children:h}),t[12]=h,t[13]=g);let _;t[14]!==i||t[15]!==n.members?(_=!i&&n.members.length>0?(0,X.jsx)(`span`,{className:`ml-auto flex items-center gap-0.5`,children:n.members.map(xu)}):null,t[14]=i,t[15]=n.members,t[16]=_):_=t[16];let v;t[17]!==i||t[18]!==g||t[19]!==_||t[20]!==d||t[21]!==f||t[22]!==p||t[23]!==m?(v=(0,X.jsxs)(`button`,{type:`button`,onClick:l,"aria-expanded":i,className:d,children:[f,p,m,g,_]}),t[17]=i,t[18]=g,t[19]=_,t[20]=d,t[21]=f,t[22]=p,t[23]=m,t[24]=v):v=t[24];let y;t[25]!==i||t[26]!==n.members||t[27]!==n.state||t[28]!==n.title?(y=i?(0,X.jsx)(su,{children:n.members.length===0&&n.state===`pending`?(0,X.jsx)(cu,{title:n.title}):n.members.map(bu)}):null,t[25]=i,t[26]=n.members,t[27]=n.state,t[28]=n.title,t[29]=y):y=t[29];let b;return t[30]!==v||t[31]!==y?(b=(0,X.jsxs)(`div`,{children:[v,y]}),t[30]=v,t[31]=y,t[32]=b):b=t[32],b}function bu(e){return(0,X.jsx)(lu,{agent:e},e.id)}function xu(e){return(0,X.jsx)(eu,{status:e.status},e.id)}function Su(e){return!e}function Cu(e){let t=(0,Y.c)(47),{group:n,environmentId:r,threadId:i,onCollapse:a}=e,[o,s]=(0,J.useState)(!1),c,l;t[0]===n?(c=t[1],l=t[2]):(c=fu(n),l=c.filter(Du),t[0]=n,t[1]=c,t[2]=l);let u=l.length,d=n.workflow.runHandles?.scriptPath,f=d!==void 0&&r!==null&&i!==null,p;t[3]===n.workflow.status?p=t[4]:(p=(0,X.jsx)(eu,{status:n.workflow.status}),t[3]=n.workflow.status,t[4]=p);let m=n.workflow.workflowName??n.workflow.title,h;t[5]===m?h=t[6]:(h=(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:m}),t[5]=m,t[6]=h);let g;t[7]!==f||t[8]!==o?(g=f?(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(Eu),className:L(`rounded-sm border border-border/60 px-1 font-mono normal-case hover:text-foreground`,o&&`text-foreground`),"aria-expanded":o,children:[`{}`,` script`]}):null,t[7]=f,t[8]=o,t[9]=g):g=t[9];let _;t[10]!==c.length||t[11]!==u?(_=(0,X.jsxs)(`span`,{className:`ml-auto font-mono normal-case text-muted-foreground/80`,children:[u,`/`,c.length,` settled`]}),t[10]=c.length,t[11]=u,t[12]=_):_=t[12];let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(ge,{"aria-hidden":!0,className:`size-3`}),t[13]=v):v=t[13];let y;t[14]===a?y=t[15]:(y=(0,X.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Collapse workflow`,className:`rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50`,children:v}),t[14]=a,t[15]=y);let b;t[16]!==p||t[17]!==h||t[18]!==g||t[19]!==_||t[20]!==y?(b=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-1.5 pt-0.5 text-[.65rem] font-medium uppercase tracking-wider text-muted-foreground`,children:[p,h,g,_,y]}),t[16]=p,t[17]=h,t[18]=g,t[19]=_,t[20]=y,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,X.jsx)(pu,{group:n}),t[22]=n,t[23]=x);let S;t[24]!==f||t[25]!==r||t[26]!==o||t[27]!==d||t[28]!==i?(S=o&&f?(0,X.jsx)(_u,{environmentId:r,threadId:i,scriptPath:d,onClose:()=>s(!1)}):null,t[24]=f,t[25]=r,t[26]=o,t[27]=d,t[28]=i,t[29]=S):S=t[29];let C;t[30]===n.phases?C=t[31]:(C=n.phases.map(Tu),t[30]=n.phases,t[31]=C);let w;t[32]===n.unphasedMembers?w=t[33]:(w=n.unphasedMembers.map(wu),t[32]=n.unphasedMembers,t[33]=w);let T;t[34]===w?T=t[35]:(T=(0,X.jsx)(su,{children:w}),t[34]=w,t[35]=T);let E;t[36]!==n.phases.length||t[37]!==n.unphasedMembers.length||t[38]!==n.workflow?(E=n.phases.length===0&&n.unphasedMembers.length===0?(0,X.jsx)(lu,{agent:n.workflow}):null,t[36]=n.phases.length,t[37]=n.unphasedMembers.length,t[38]=n.workflow,t[39]=E):E=t[39];let D;return t[40]!==x||t[41]!==S||t[42]!==C||t[43]!==T||t[44]!==E||t[45]!==b?(D=(0,X.jsxs)(`section`,{className:`rounded-lg border border-border/50 bg-card/30 p-1.5`,children:[b,x,S,C,T,E]}),t[40]=x,t[41]=S,t[42]=C,t[43]=T,t[44]=E,t[45]=b,t[46]=D):D=t[46],D}function wu(e){return(0,X.jsx)(lu,{agent:e},e.id)}function Tu(e){return(0,X.jsx)(yu,{phase:e,defaultOpen:!0},e.index)}function Eu(e){return!e}function Du(e){return e.status===`completed`||e.status===`failed`||e.status===`cancelled`||e.status===`interrupted`}function Ou(e){let t=(0,Y.c)(45),{group:n,onExpand:r}=e,i,a,o,s,c,l,u,d,f,p,m,h,g;if(t[0]!==n||t[1]!==r){let e=fu(n),_=e.filter(Au).length,v=e.reduce(ku,e.length===0?n.workflow.usage?.totalTokens??0:0),y;t[15]!==n.workflow.completedAt||t[16]!==n.workflow.startedAt?(y=n.workflow.startedAt&&n.workflow.completedAt?nu(n.workflow.startedAt,n.workflow.completedAt):null,t[15]=n.workflow.completedAt,t[16]=n.workflow.startedAt,t[17]=y):y=t[17],i=y,m=`button`,h=r,g=`flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-left outline-none hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/50`,o=!1;let b=_>0?`failed`:n.workflow.status;t[18]===b?s=t[19]:(s=(0,X.jsx)(eu,{status:b}),t[18]=b,t[19]=s);let x=n.workflow.workflowName??n.workflow.title;t[20]===x?c=t[21]:(c=(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:x}),t[20]=x,t[21]=c),d=`flex shrink-0 items-center gap-1.5 font-mono text-[.7rem] text-muted-foreground/80`,t[22]===_?f=t[23]:(f=_>0?(0,X.jsxs)(`span`,{className:`text-destructive-foreground`,children:[_,` failed`]}):null,t[22]=_,t[23]=f),p=(0,X.jsxs)(`span`,{children:[e.length,` agents`]}),a=`tabular-nums`,l=`· `,u=ae(v),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];let _;t[24]!==a||t[25]!==l||t[26]!==u?(_=(0,X.jsxs)(`span`,{className:a,children:[l,u,` tok`]}),t[24]=a,t[25]=l,t[26]=u,t[27]=_):_=t[27];let v;t[28]===i?v=t[29]:(v=i?(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[`· `,i]}):null,t[28]=i,t[29]=v);let y;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(Yn,{"aria-hidden":!0,className:`size-3`}),t[30]=y):y=t[30];let b;t[31]!==_||t[32]!==v||t[33]!==d||t[34]!==f||t[35]!==p?(b=(0,X.jsxs)(`span`,{className:d,children:[f,p,_,v,y]}),t[31]=_,t[32]=v,t[33]=d,t[34]=f,t[35]=p,t[36]=b):b=t[36];let x;return t[37]!==o||t[38]!==s||t[39]!==c||t[40]!==b||t[41]!==m||t[42]!==h||t[43]!==g?(x=(0,X.jsx)(`section`,{children:(0,X.jsxs)(`button`,{type:m,onClick:h,className:g,"aria-expanded":o,children:[s,c,b]})}),t[37]=o,t[38]=s,t[39]=c,t[40]=b,t[41]=m,t[42]=h,t[43]=g,t[44]=x):x=t[44],x}function ku(e,t){return e+(t.usage?.totalTokens??0)}function Au(e){return e.status===`failed`}function ju(e){let t=(0,Y.c)(7),{group:n,environmentId:r,threadId:i}=e,a;t[0]===n?a=t[1]:(a=()=>du(n),t[0]=n,t[1]=a);let[o,s]=(0,J.useState)(a),c;return t[2]!==r||t[3]!==n||t[4]!==o||t[5]!==i?(c=o?(0,X.jsx)(Cu,{group:n,environmentId:r,threadId:i,onCollapse:()=>s(!1)}):(0,X.jsx)(Ou,{group:n,onExpand:()=>s(!0)}),t[2]=r,t[3]=n,t[4]=o,t[5]=i,t[6]=c):c=t[6],c}function Mu(e){let t=(0,Y.c)(70),{model:n,environmentId:r,threadId:i,onOpenAgent:a,subagents:o,selectedAgentId:s,onBack:c}=e,l=r===void 0?null:r,u=i===void 0?null:i,d=a===void 0?null:a,f=o===void 0?[]:o,p=s===void 0?null:s,[m,h]=(0,J.useState)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>h(null),t[0]=g):g=t[0];let _;t[1]===u?_=t[2]:(_=[u],t[1]=u,t[2]=_),(0,J.useEffect)(g,_);let v;if(t[3]!==n.directAgents||t[4]!==n.workflows){let e=new Map;for(let t of n.workflows){e.set(t.workflow.id,t.workflow);for(let n of fu(t))e.set(n.id,n)}for(let t of n.directAgents)e.set(t.id,t);v=he([...e.values()].map(Fu)),t[3]=n.directAgents,t[4]=n.workflows,t[5]=v}else v=t[5];let y=d??h,b;t[6]!==v||t[7]!==y?(b={identities:v,onOpenAgent:y},t[6]=v,t[7]=y,t[8]=b):b=t[8];let x=b,S=p??m,C=S?[...n.directAgents,...n.workflows.flatMap(Pu)].find(e=>de(e.id)===de(S)):void 0;if(C){let e=f.find(e=>de(e.key)===de(C.id)),n=x.identities.get(C.id),r;t[9]===c?r=t[10]:(r=()=>{h(null),c?.()},t[9]=c,t[10]=r);let i;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(Hn,{"aria-hidden":!0,className:`size-3.5`}),t[11]=i):i=t[11];let a;t[12]===r?a=t[13]:(a=(0,X.jsxs)(`button`,{type:`button`,onClick:r,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,children:[i,`All agents`]}),t[12]=r,t[13]=a);let o=C.model?ie(C.model,C.effort):`Model not reported`,s;t[14]===o?s=t[15]:(s=(0,X.jsx)(`span`,{children:o}),t[14]=o,t[15]=s);let l;t[16]===C?l=t[17]:(l=(0,X.jsx)(iu,{agent:C}),t[16]=C,t[17]=l);let u=C.usage?.totalTokens===void 0?null:(0,X.jsxs)(`span`,{children:[ae(C.usage.totalTokens),` tokens`]}),d;t[18]!==s||t[19]!==l||t[20]!==u?(d=(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[s,l,u]}),t[18]=s,t[19]=l,t[20]=u,t[21]=d):d=t[21];let p=C.updatedAt,m=new Date(C.updatedAt).toLocaleTimeString(),g;t[22]!==C||t[23]!==m?(g=(0,X.jsxs)(`p`,{className:`text-[10px] text-muted-foreground/70`,children:[`Last reported activity`,` `,(0,X.jsx)(`time`,{dateTime:p,children:m})]}),t[22]=C,t[23]=m,t[24]=g):g=t[24];let _=C.error?(0,X.jsx)(`p`,{role:`status`,className:`m-3 whitespace-pre-wrap break-words text-xs text-destructive`,children:C.error}):null,v=e??{messages:[],entries:[]},y=C.status===`running`||C.status===`waiting`,b;t[25]!==v||t[26]!==y?(b=(0,X.jsx)(Zl,{subagent:v,running:y}),t[25]=v,t[26]=y,t[27]=b):b=t[27];let S=!e&&C.progress?(0,X.jsx)(`p`,{className:`px-3 pb-3 text-xs text-muted-foreground`,children:C.progress}):null,w=C.result&&!e?.messages.some(e=>e.text===C.result)?(0,X.jsxs)(`div`,{className:`border-t border-border/40 p-3 text-sm`,children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:`Result summary`}),(0,X.jsx)(fn,{text:C.result,cwd:void 0,isStreaming:!1})]}):null,T;return t[28]!==_||t[29]!==b||t[30]!==S||t[31]!==w?(T=(0,X.jsxs)(lr,{className:`min-h-0 flex-1`,children:[_,b,S,w]}),t[28]=_,t[29]=b,t[30]=S,t[31]=w,t[32]=T):T=t[32],(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-agent-detail":!0,children:[(0,X.jsxs)(`header`,{className:`space-y-2 border-b border-border/60 px-3 py-3`,children:[a,(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold`,children:n?.codename??C.role??C.title}),(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[(0,X.jsx)(eu,{status:C.status}),Ql[C.status].label]})]}),(0,X.jsx)(`p`,{className:`break-words text-xs leading-relaxed text-muted-foreground`,children:C.title}),d,g]}),T]})}if(!n.hasAgents){let e;return t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-6 text-center`,children:[(0,X.jsx)(Un,{"aria-hidden":!0,className:`size-6 text-muted-foreground/60`}),(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:`No agents yet`}),(0,X.jsx)(`p`,{className:`max-w-56 text-xs text-muted-foreground`,children:`When this thread spawns subagents or runs a workflow, they show up here with live status, activity, and token usage.`})]}),t[33]=e):e=t[33],e}let w;if(t[34]!==l||t[35]!==n.workflows||t[36]!==u){let e;t[38]!==l||t[39]!==u?(e=e=>(0,X.jsx)(ju,{group:e,environmentId:l,threadId:u},e.workflow.id),t[38]=l,t[39]=u,t[40]=e):e=t[40],w=n.workflows.map(e),t[34]=l,t[35]=n.workflows,t[36]=u,t[37]=w}else w=t[37];let T;t[41]===n.directAgents?T=t[42]:(T=n.directAgents.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`div`,{className:`px-1.5 pt-1 text-[.65rem] font-medium uppercase tracking-wider text-muted-foreground`,children:`Direct spawns`}),(0,X.jsx)(su,{children:n.directAgents.map(Nu)})]}):null,t[41]=n.directAgents,t[42]=T);let E;t[43]!==w||t[44]!==T?(E=(0,X.jsx)(lr,{className:`min-h-0 flex-1`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 p-2`,children:[w,T]})}),t[43]=w,t[44]=T,t[45]=E):E=t[45];let D;t[46]!==n.runningCount||t[47]!==n.waitingCount?(D=n.runningCount+n.waitingCount>0?(0,X.jsxs)(`span`,{className:`text-info-foreground`,children:[`● `,n.runningCount,` active`,n.waitingCount>0?` · ${n.waitingCount} waiting`:``]}):null,t[46]=n.runningCount,t[47]=n.waitingCount,t[48]=D):D=t[48];let O;t[49]===n.idleCount?O=t[50]:(O=n.idleCount>0?(0,X.jsxs)(`span`,{children:[n.idleCount,` idle`]}):null,t[49]=n.idleCount,t[50]=O);let k;t[51]===n.settledCount?k=t[52]:(k=n.settledCount>0?(0,X.jsxs)(`span`,{children:[n.settledCount,` settled`]}):null,t[51]=n.settledCount,t[52]=k);let A;t[53]!==D||t[54]!==O||t[55]!==k?(A=(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[D,O,k]}),t[53]=D,t[54]=O,t[55]=k,t[56]=A):A=t[56];let j;t[57]===n.totalTokens?j=t[58]:(j=ae(n.totalTokens),t[57]=n.totalTokens,t[58]=j);let M;t[59]===j?M=t[60]:(M=(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[`Σ `,j,` tok`]}),t[59]=j,t[60]=M);let N;t[61]!==A||t[62]!==M?(N=(0,X.jsxs)(`footer`,{className:`flex items-center justify-between border-t border-border/60 px-3 py-1.5 font-mono text-[.7rem] text-muted-foreground`,children:[A,M]}),t[61]=A,t[62]=M,t[63]=N):N=t[63];let P;t[64]!==E||t[65]!==N?(P=(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[E,N]}),t[64]=E,t[65]=N,t[66]=P):P=t[66];let F;return t[67]!==x||t[68]!==P?(F=(0,X.jsx)($l.Provider,{value:x,children:P}),t[67]=x,t[68]=P,t[69]=F):F=t[69],F}function Nu(e){return(0,X.jsx)(lu,{agent:e},e.id)}function Pu(e){return[e.workflow,...fu(e)]}function Fu(e){return{key:e.id,role:e.role,taskLabel:e.title}}function Iu(e){let t=[],n=new Set(e.openedPanelModes);if(n.has(`files`)&&t.push({key:`files`,label:`Files`,mode:`files`}),n.has(`review`)&&t.push({key:`review`,label:`Review`,mode:`review`}),n.has(`terminal`)&&t.push({key:`terminal`,label:`Terminal`,mode:`terminal`}),n.has(`browser`)&&t.push({key:`browser`,label:`Browser`,mode:`browser`}),n.has(`simulator`)&&t.push({key:`simulator`,label:`Simulator`,mode:`simulator`}),(n.has(`agents`)||e.groupAgents&&e.activeAgentKey)&&t.push({key:`agents`,label:`Agents`,mode:`agents`}),e.groupAgents)return t;let r=[...new Set([...e.openedAgentKeys,...e.activeAgentKey?[e.activeAgentKey]:[]])];for(let n of r){let r=Jn(e.subagents,n)??{key:n,name:`Subagent`,status:`idle`,origin:null,capability:null,tool:null,detail:null,providerThreadIds:[],providerSessionIds:[],startedAt:``,updatedAt:``,entries:[],messages:[]};t.push({key:r.key,label:r.name,mode:`agent`,agentKey:r.key,status:r.status,avatarKey:r.avatarKey??r.key})}return t}function Lu(e){let t={data:null,isLoading:!1,isApplying:!1,error:null},n=0,r=null,i=!1,a=new Set,o=e=>{t=e;for(let e of a)e()},s=(e=!0)=>{n++,r=null,o({...t,data:e?null:t.data,isLoading:!1})},c=()=>{if(i)return Promise.resolve();if(r)return r;let a=++n;o({...t,isLoading:!0,error:null});let s=Promise.resolve().then(e.read).then(e=>{a===n&&o({...t,data:e,isLoading:!1})},e=>{a===n&&o({...t,data:null,isLoading:!1,error:e instanceof Error?e.message:`Local changes unavailable. Refresh to retry.`})}).finally(()=>{r===s&&(r=null)});return r=s,s};return{getSnapshot:()=>t,subscribe:e=>(a.add(e),()=>{a.delete(e)}),invalidate:s,refresh:c,apply:async a=>{if(i||t.isLoading||!t.data)return;let s=t.data,l=++n;r=null,i=!0,o({...t,isApplying:!0,error:null});let u=null;try{await e.apply({cwd:e.cwd,expectedRevision:s.revision,...a})}catch(e){u=e instanceof Error?e.message:`Staging failed. Refresh before retrying.`}finally{i=!1,l===n?(o({...t,data:null,isApplying:!1,error:u}),u||await c()):o({...t,isApplying:!1})}}}}function Ru(e,t){return`ryco:comparison:v1:${JSON.stringify([e,t])}`}function zu(e,t,n,r){return JSON.stringify([e,t.repositoryPath,t.worktreePath,t.revision,n,n===`base`?t.baseOid:t.headOid,r])}var Bu={selection:null,data:null,isLoading:!1,error:null,refMoved:!1};function Vu(e){let t=Bu,n=0,r=!1,i=null,a=Promise.resolve(),o=new Set,s=e=>{t=e;for(let e of o)e()},d=()=>{if(r||!t.selection)return Promise.resolve();if(i)return i;let a=++n,o=t.selection,c=t.data?.source.refOid;s({...t,error:null,isLoading:!0,refMoved:!1});let l=Promise.resolve().then(()=>e.read(o)).then(e=>{!r&&a===n&&s({selection:o,data:e,error:null,isLoading:!1,refMoved:c!==void 0&&c!==e.source.refOid})},e=>{!r&&a===n&&s({selection:o,data:null,isLoading:!1,refMoved:!1,error:e instanceof Error?e.message:`Comparison unavailable. Refresh or choose another reference.`})}).finally(()=>{i===l&&(i=null)});return i=l,l},p=(o,u=!0)=>{if(!r){if(o&&l(c(f)(o))){s({...t,error:`Enter a branch, tag, or commit ID (no revision expressions or options).`});return}n++,i=null,s({...Bu,selection:o}),u&&(a=a.then(()=>e.storage.setItem(e.storageKey,JSON.stringify(o))).catch(()=>{r||s({...t,error:`Could not save comparison preference.`})})),d()}};return{getSnapshot:()=>t,subscribe:e=>(o.add(e),()=>{o.delete(e)}),setSelection:p,refresh:d,invalidate:(e=!0)=>{n++,i=null,s({...t,data:e?null:t.data,isLoading:!1})},hydrate:async()=>{let t=n;try{let i=await e.storage.getItem(e.storageKey);if(r||t!==n||i===null)return;let a=c(f)(JSON.parse(i));u(a)&&p(a.value,!1)}catch{}},dispose:()=>{r=!0,n++,o.clear()}}}function Hu(e,t,n,r,i){let s=(0,Y.c)(7),c,l;s[0]!==e||s[1]!==n||s[2]!==r||s[3]!==t||s[4]!==i?(c=()=>{if(!r||!t||!n)return;i();let s=()=>{B.isForeground()&&B.isOnline()&&e.refresh()},c=H(xe(n),()=>{e.invalidate(!1),s()}),l=B.subscribe(t=>{t===`offline`||t===`background`?e.invalidate():s()}),u=me(t)?.client,d=U(()=>{let n=me(t)?.client;u!==n&&(u=n,e.invalidate(),n&&s())}),f=a(t),p=o.get(f),m=o.subscribe(f,t=>{(t.phase!==p.phase||t.connectedAt!==p.connectedAt)&&(p=t,e.invalidate(),t.phase===`connected`&&s())});return()=>{e.invalidate(),c(),l(),d(),m()}},l=[e,r,t,n,i],s[0]=e,s[1]=n,s[2]=r,s[3]=t,s[4]=i,s[5]=c,s[6]=l):(c=s[5],l=s[6]),(0,J.useEffect)(c,l)}function Uu(e,t,n){let r=(0,Y.c)(13),i=t??``,a;r[0]!==t||r[1]!==e?(a=()=>!e||!t?Promise.reject(Error(`Repository unavailable.`)):pe(e).vcs.readLocalChanges({cwd:t}),r[0]=t,r[1]=e,r[2]=a):a=r[2];let o;r[3]===e?o=r[4]:(o=async t=>{if(!e)throw Error(`Repository unavailable.`);await pe(e).vcs.applyIndexPatch(t)},r[3]=e,r[4]=o);let s;r[5]!==i||r[6]!==a||r[7]!==o?(s=Lu({cwd:i,read:a,apply:o}),r[5]=i,r[6]=a,r[7]=o,r[8]=s):s=r[8];let c=s,l=(0,J.useSyncExternalStore)(c.subscribe,c.getSnapshot);Hu(c,e,t,n,c.refresh);let u;return r[9]!==c.apply||r[10]!==c.refresh||r[11]!==l?(u={...l,refresh:c.refresh,apply:c.apply},r[9]=c.apply,r[10]=c.refresh,r[11]=l,r[12]=u):u=r[12],u}function Wu(e){let t=(0,Y.c)(15),[n,r]=(0,J.useState)(0),i=e.scope===`staged`?`Unstage`:`Stage`,a=`${i} file ${e.name}`,o=e.disabled||!e.file.fileAction,s=e.file.fileAction?void 0:`Symlink and submodule changes require external Git review.`,c;t[0]===e?c=t[1]:(c=()=>e.onApply({scope:e.scope,fileId:e.file.id}),t[0]=e,t[1]=c);let l;t[2]!==a||t[3]!==o||t[4]!==s||t[5]!==c||t[6]!==i?(l=(0,X.jsxs)(`button`,{type:`button`,className:`rounded px-2 py-1 text-xs hover:bg-foreground/10 disabled:opacity-50`,"aria-label":a,disabled:o,title:s,onClick:c,children:[i,` file`]}),t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=i,t[7]=l):l=t[7];let u;t[8]!==n||t[9]!==e||t[10]!==i?(u=e.file.hunkAction&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`select`,{"aria-label":`Hunk in ${e.name}`,className:`max-w-28 rounded border bg-background text-xs`,disabled:e.disabled,value:n,onChange:e=>r(Number(e.target.value)),children:Array.from({length:e.file.hunkCount},Gu)}),(0,X.jsxs)(`button`,{type:`button`,className:`rounded px-2 py-1 text-xs hover:bg-foreground/10 disabled:opacity-50`,"aria-label":`${i} hunk ${n+1} in ${e.name}`,disabled:e.disabled,onClick:()=>e.onApply({scope:e.scope,fileId:e.file.id,hunkIndex:n}),children:[i,` hunk`]})]}),t[8]=n,t[9]=e,t[10]=i,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,onClick:Ku,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function Gu(e,t){return(0,X.jsxs)(`option`,{value:t,children:[`Hunk `,t+1]},t)}function Ku(e){return e.stopPropagation()}function qu(e,t,n){if(!Number.isSafeInteger(n)||n<1)return null;let r=t===`base`?e.prevName??e.name:e.name;if(r===`/dev/null`)return null;for(let i of e.hunks){let e=t===`base`?i.deletionStart:i.additionStart;for(let a of i.hunkContent){let i=a.type===`context`?a.lines:t===`base`?a.deletions:a.additions;if(n>=e&&n<e+i)return t===`head`&&a.type===`change`?null:{side:t,line:n,filePath:r};e+=i}}return null}function Ju(e){let t=!1,n=0,r=new Map;return{invalidate(){n++,r.clear()},dispose(){t=!0,n++,r.clear()},read(i){if(t)return Promise.reject(Error(`Comparison changed. Reopen line blame.`));let a=`${zu(e.environmentId,e.source,i.side,i.filePath)}:${i.line}`,o=r.get(a);if(o)return o;let s=n,c=Promise.resolve().then(()=>{if(t||s!==n)throw Error(`Comparison changed. Reopen line blame.`);return e.read({cwd:e.source.worktreePath,oid:i.side===`base`?e.source.baseOid:e.source.headOid,filePath:i.filePath,line:i.line})}).then(e=>{if(t||s!==n)throw Error(`Comparison changed. Reopen line blame.`);return e}).catch(e=>{throw r.get(a)===c&&r.delete(a),e});return r.set(a,c),r.size>32&&r.delete(r.keys().next().value),c}}}function Yu(e){let t=(0,Y.c)(74),[n,r]=(0,J.useState)(e.initialSide),[i,a]=(0,J.useState)(String(e.initialLine)),o;t[0]!==e.initialLine||t[1]!==e.initialSide?(o={side:e.initialSide,line:e.initialLine},t[0]=e.initialLine,t[1]=e.initialSide,t[2]=o):o=t[2];let[s,c]=(0,J.useState)(o),l;t[3]===e.environmentId?l=t[4]:(l=t=>pe(e.environmentId).vcs.readLineBlame(t),t[3]=e.environmentId,t[4]=l);let u;t[5]!==e.environmentId||t[6]!==e.source||t[7]!==l?(u=Ju({environmentId:e.environmentId,source:e.source,read:l}),t[5]=e.environmentId,t[6]=e.source,t[7]=l,t[8]=u):u=t[8];let d=u,[f,p]=(0,J.useState)(null),m;t[9]!==e.file||t[10]!==s.line||t[11]!==s.side?(m=qu(e.file,s.side,s.line),t[9]=e.file,t[10]=s.line,t[11]=s.side,t[12]=m):m=t[12];let h=m,g=f?.request===s&&f.reader===d?f:null,_=h?g?.result:null,v=h?g?.error:`Choose a displayed context or deleted line. Added lines have no blame here.`,y=h!==null&&g===null,b,x;t[13]===d?(b=t[14],x=t[15]):(b=()=>()=>d.invalidate(),x=[d],t[13]=d,t[14]=b,t[15]=x),(0,J.useEffect)(b,x);let S,C;t[16]!==d||t[17]!==s||t[18]!==h?(S=()=>{let e=!0;if(h)return d.read(h).then(t=>{e&&p({request:s,reader:d,result:t,error:null})},()=>{e&&p({request:s,reader:d,result:null,error:`Blame unavailable. Retry or refresh the comparison.`})}),()=>{e=!1}},C=[d,h,s],t[16]=d,t[17]=s,t[18]=h,t[19]=S,t[20]=C):(S=t[19],C=t[20]),(0,J.useEffect)(S,C);let w;t[21]===e?w=t[22]:(w=t=>{t||e.onClose()},t[21]=e,t[22]=w);let T;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,X.jsx)(K,{children:`Line blame`}),t[23]=T):T=t[23];let D;t[24]===e.file.name?D=t[25]:(D=(0,X.jsx)(Le,{className:`mt-1 break-all`,children:e.file.name}),t[24]=e.file.name,t[25]=D);let O;t[26]!==i||t[27]!==n?(O=e=>{e.preventDefault(),c({side:n,line:Number(i)})},t[26]=i,t[27]=n,t[28]=O):O=t[28];let k,A,j;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>r(e.target.value),A=(0,X.jsx)(`option`,{value:`base`,children:`Base`}),j=(0,X.jsx)(`option`,{value:`head`,children:`Head`}),t[29]=k,t[30]=A,t[31]=j):(k=t[29],A=t[30],j=t[31]);let M;t[32]===n?M=t[33]:(M=(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs`,children:[`Side`,(0,X.jsxs)(`select`,{className:`h-8 rounded border bg-background px-2`,value:n,onChange:k,children:[A,j]})]}),t[32]=n,t[33]=M);let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>a(e.target.value),t[34]=N):N=t[34];let P;t[35]===i?P=t[36]:(P=(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1 text-xs`,children:[`Line`,(0,X.jsx)(`input`,{className:`h-8 w-full rounded border bg-background px-2`,type:`number`,min:`1`,step:`1`,required:!0,value:i,onChange:N})]}),t[35]=i,t[36]=P);let F;t[37]===y?F=t[38]:(F=(0,X.jsx)(E,{type:`submit`,size:`sm`,disabled:y,children:`Look up`}),t[37]=y,t[38]=F);let ee;t[39]!==O||t[40]!==M||t[41]!==P||t[42]!==F?(ee=(0,X.jsxs)(`form`,{className:`mt-4 flex items-end gap-2`,onSubmit:O,children:[M,P,F]}),t[39]=O,t[40]=M,t[41]=P,t[42]=F,t[43]=ee):ee=t[43];let te=s.side===`base`?`Base`:`Head`,ne=s.line,re=s.side===`base`?e.source.baseOid:e.source.headOid,ie;t[44]===re?ie=t[45]:(ie=re.slice(0,12),t[44]=re,t[45]=ie);let I;t[46]===ie?I=t[47]:(I=(0,X.jsx)(`span`,{className:`font-mono`,children:ie}),t[46]=ie,t[47]=I);let L;t[48]!==s.line||t[49]!==te||t[50]!==I?(L=(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[te,` line `,ne,` ·`,` `,I]}),t[48]=s.line,t[49]=te,t[50]=I,t[51]=L):L=t[51];let ae;t[52]===y?ae=t[53]:(ae=y&&(0,X.jsx)(`p`,{children:`Loading blame…`}),t[52]=y,t[53]=ae);let oe;t[54]===v?oe=t[55]:(oe=v&&(0,X.jsx)(`p`,{role:`status`,children:v}),t[54]=v,t[55]=oe);let se;t[56]===_?se=t[57]:(se=_?.kind===`unavailable`&&(0,X.jsx)(`p`,{children:_.reason}),t[56]=_,t[57]=se);let ce;t[58]===_?ce=t[59]:(ce=_?.kind===`committed`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`break-words font-medium`,children:_.summary}),(0,X.jsxs)(`p`,{className:`break-words text-muted-foreground`,children:[_.author,_.authorTime?` · ${new Date(_.authorTime).toLocaleDateString()}`:``]}),(0,X.jsx)(`p`,{className:`break-all font-mono text-xs`,title:_.oid,children:_.oid})]}),t[58]=_,t[59]=ce);let le;t[60]!==y||t[61]!==L||t[62]!==ae||t[63]!==oe||t[64]!==se||t[65]!==ce?(le=(0,X.jsxs)(`div`,{className:`mt-4 min-h-24 space-y-2 text-sm`,"aria-live":`polite`,"aria-busy":y,children:[L,ae,oe,se,ce]}),t[60]=y,t[61]=L,t[62]=ae,t[63]=oe,t[64]=se,t[65]=ce,t[66]=le):le=t[66];let R;t[67]!==D||t[68]!==ee||t[69]!==le?(R=(0,X.jsxs)(Me,{className:`max-w-md p-5`,children:[T,D,ee,le]}),t[67]=D,t[68]=ee,t[69]=le,t[70]=R):R=t[70];let z;return t[71]!==R||t[72]!==w?(z=(0,X.jsx)(Ee,{open:!0,onOpenChange:w,children:R}),t[71]=R,t[72]=w,t[73]=z):z=t[73],z}function Xu(e){let t=(0,Y.c)(46),[n,r]=(0,J.useState)(e.selection?.ref??``),[i,a]=(0,J.useState)(e.selection?.mode??`mergeBase`),o;t[0]!==n||t[1]!==i||t[2]!==e?(o=t=>{t.preventDefault(),e.onSelect({ref:n.trim(),mode:i})},t[0]=n,t[1]=i,t[2]=e,t[3]=o):o=t[3];let s=e.turnSelected??!e.selection,c;t[4]===e?c=t[5]:(c=()=>e.onSelect(null),t[4]=e,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,X.jsx)(`button`,{type:`button`,className:`rounded border px-2 py-1`,"aria-pressed":s,onClick:c,children:`Turn review`}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u,d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>a(e.target.value),d=(0,X.jsx)(`option`,{value:`mergeBase`,children:`Branch changes → HEAD`}),f=(0,X.jsx)(`option`,{value:`direct`,children:`Commit to HEAD`}),t[9]=u,t[10]=d,t[11]=f):(u=t[9],d=t[10],f=t[11]);let p;t[12]===i?p=t[13]:(p=(0,X.jsxs)(`select`,{"aria-label":`Comparison mode`,className:`rounded border bg-background px-2 py-1`,value:i,onChange:u,children:[d,f]}),t[12]=i,t[13]=p);let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>r(e.target.value),t[14]=m):m=t[14];let h;t[15]===n?h=t[16]:(h=(0,X.jsx)(`input`,{"aria-label":`Branch, tag, or commit`,placeholder:`Branch, tag, or commit`,className:`min-w-[160px] flex-1 rounded border bg-background px-2 py-1`,value:n,maxLength:256,onChange:m}),t[15]=n,t[16]=h);let g;t[17]===n?g=t[18]:(g=n.trim(),t[17]=n,t[18]=g);let _=!g,v;t[19]===_?v=t[20]:(v=(0,X.jsx)(`button`,{type:`submit`,className:`rounded border px-2 py-1`,disabled:_,children:`Compare`}),t[19]=_,t[20]=v);let y;t[21]!==e.isLoading||t[22]!==e.onRefresh||t[23]!==e.selection?(y=e.selection&&(0,X.jsx)(`button`,{type:`button`,className:`rounded border px-2 py-1`,onClick:e.onRefresh,disabled:e.isLoading,children:`Refresh comparison`}),t[21]=e.isLoading,t[22]=e.onRefresh,t[23]=e.selection,t[24]=y):y=t[24];let b;t[25]!==o||t[26]!==v||t[27]!==y||t[28]!==l||t[29]!==p||t[30]!==h?(b=(0,X.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:o,children:[l,p,h,v,y]}),t[25]=o,t[26]=v,t[27]=y,t[28]=l,t[29]=p,t[30]=h,t[31]=b):b=t[31];let x;t[32]!==e.data||t[33]!==e.refMoved||t[34]!==e.selection?(x=e.selection&&(0,X.jsxs)(`p`,{className:`mt-2 break-words text-muted-foreground`,children:[e.selection.mode===`mergeBase`?`Merge-base of`:`Commit`,` `,(0,X.jsx)(`strong`,{children:e.selection.ref}),e.selection.mode===`mergeBase`?` and HEAD`:``,` → HEAD. Staged, unstaged, and untracked changes are excluded.`,e.data&&(0,X.jsxs)(X.Fragment,{children:[` `,`Resolved `,e.data.source.baseOid.slice(0,8),` →`,` `,e.data.source.headOid.slice(0,8),`.`]}),e.refMoved&&(0,X.jsx)(X.Fragment,{children:` The selected reference moved; showing its current commits.`})]}),t[32]=e.data,t[33]=e.refMoved,t[34]=e.selection,t[35]=x):x=t[35];let S;t[36]!==e.data||t[37]!==e.isLoading?(S=e.isLoading&&(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-muted-foreground`,children:e.data?`Refreshing; showing the previous committed snapshot.`:`Loading comparison…`}),t[36]=e.data,t[37]=e.isLoading,t[38]=S):S=t[38];let C;t[39]===e.error?C=t[40]:(C=e.error&&(0,X.jsx)(`p`,{role:`alert`,className:`mt-2 text-destructive`,children:e.error}),t[39]=e.error,t[40]=C);let w;return t[41]!==b||t[42]!==x||t[43]!==S||t[44]!==C?(w=(0,X.jsxs)(`section`,{className:`shrink-0 border-b border-border px-3 py-2 text-xs`,"aria-label":`Repository comparison`,children:[b,x,S,C]}),t[41]=b,t[42]=x,t[43]=S,t[44]=C,t[45]=w):w=t[45],w}function Zu(e){let t=(0,Y.c)(13),{environmentId:n,repositoryPath:r,cwd:i,ignoreWhitespace:a,enabled:o}=e,s;if(t[0]!==i||t[1]!==n||t[2]!==a||t[3]!==r){let e;t[5]!==i||t[6]!==n||t[7]!==a?(e=e=>!n||!i?Promise.reject(Error(`Repository unavailable.`)):pe(n).vcs.readComparison({cwd:i,selection:e,ignoreWhitespace:a}),t[5]=i,t[6]=n,t[7]=a,t[8]=e):e=t[8],s=Vu({storage:_,storageKey:Ru(n??``,r??``),read:e}),t[0]=i,t[1]=n,t[2]=a,t[3]=r,t[4]=s}else s=t[4];let c=s,l=(0,J.useSyncExternalStore)(c.subscribe,c.getSnapshot);Hu(c,n,i,o&&!!r,c.hydrate);let u;return t[9]!==c.refresh||t[10]!==c.setSelection||t[11]!==l?(u={...l,setSelection:c.setSelection,refresh:c.refresh},t[9]=c.refresh,t[10]=c.setSelection,t[11]=l,t[12]=u):u=t[12],u}function Qu(e){let t=(0,J.useRef)(e);return(0,J.useInsertionEffect)(()=>void(t.current=e)),(0,J.useCallback)((...e)=>t.current(...e),[])}var $u=(0,J.createContext)(void 0);function ed({children:e,createEditor:t}){let n=Qu((e,n,r)=>t(e,n,r));return(0,X.jsx)($u.Provider,{value:n,children:e})}function td(){return(0,J.useContext)($u)}var nd={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},rd={display:`contents`};function id(){return null}function ad({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=Ta}){let p=n?.(e),m=r?.(e),h=i?.(e),g=a?.(e);return(0,X.jsxs)(X.Fragment,{children:[p==null?(0,X.jsxs)(X.Fragment,{children:[m!=null&&(0,X.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,X.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),g!=null&&(0,X.jsx)(`div`,{slot:`header-metadata`,children:g})]}):(0,X.jsx)(`div`,{slot:gt,children:p}),o!=null&&l?.map((e,t)=>(0,X.jsx)(`div`,{slot:f(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=od(t,e);return(0,X.jsx)(`div`,{slot:n,style:rd,children:c(t,d)},n)}),s!=null&&(0,X.jsx)(`div`,{slot:`gutter-utility-slot`,style:nd,children:s(u)})]})}function od(e,t){let n=zl(e,t);return n==null?void 0:Rl({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function sd({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=Ta}){let u=t?.(e),d=n?.(e),f=r?.(e),p=i?.(e);return(0,X.jsxs)(X.Fragment,{children:[u==null?(0,X.jsxs)(X.Fragment,{children:[d!=null&&(0,X.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,X.jsx)(`div`,{slot:`header-filename-suffix`,children:f}),p!=null&&(0,X.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,X.jsx)(`div`,{slot:gt,children:u}),a!=null&&o?.map((e,t)=>(0,X.jsx)(`div`,{slot:l(e),children:a(e)},t)),s!=null&&(0,X.jsx)(`div`,{slot:`gutter-utility-slot`,style:nd,children:s(c)})]})}function cd(e,t){return typeof window>`u`&&t!=null?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,X.jsx)(X.Fragment,{children:e})}var ld=(0,J.createContext)(void 0);function ud({children:e,config:t,className:n,style:r,contentClassName:i,contentStyle:a}){let[o]=(0,J.useState)(()=>typeof window<`u`?new Jl(t):void 0),s=(0,J.useCallback)(e=>{e==null?o?.cleanUp():o?.setup(e)},[o]);return(0,X.jsx)(ld.Provider,{value:o,children:(0,X.jsx)(`div`,{className:n,style:r,ref:s,children:(0,X.jsx)(`div`,{className:i,style:a,children:e})})})}function dd(){return(0,J.useContext)(ld)}var fd=typeof window>`u`?J.useEffect:J.useLayoutEffect;function pd({file:e,options:t,editorOptions:n,editStateKey:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s,hasGutterRenderUtility:c,hasCustomHeader:l,disableWorkerPool:u,edit:d,onEditChange:f,onEditComplete:p}){let m=dd(),h=a!==void 0,g=(0,J.useContext)(Nn),_=td(),v=Qu(e=>f?.(e)),y=f==null?void 0:v,b=(0,J.useRef)(null),x=Qu(e=>{let t=p?.(e)??`reject`;return t===`accept`&&(b.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),S=p==null?void 0:x,C=(0,J.useRef)(null),w=(0,J.useRef)(null),T=Qu(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),E=Qu(n=>{if(n!=null){if(C.current!=null)throw Error(`File: An instance should not already exist when a node is created`);m==null?C.current=new Do(hd({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,!0):C.current=new Po(hd({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),m,s,u?void 0:g,!0),d&&w.current==null&&(w.current=gd(C.current,T)),C.current.hydrate({file:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(C.current==null)throw Error(`File: A File instance should exist when unmounting`);C.current.cleanUp(),C.current=null,w.current=null}});return fd(()=>{let{current:n}=C;if(n==null)return;let r=hd({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=r!==void 0&&!Pi(n.options,r);if(n.setOptions(r),!d&&w.current!=null){let{current:e}=w;w.current=null,e()}let s=md(e,i,b);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),d&&w.current==null&&(w.current=gd(n,T))}),{ref:E,getHoveredLine:(0,J.useCallback)(()=>C.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,J.useCallback)(e=>C.current?.getAnnotationSlotName(e)??Ta(e),[])}}function md(e,t,n){let{current:r}=n;if(r==null)return{file:e,lineAnnotations:t};let{file:i,annotations:a}=r,o=e;i!=null&&(Oa(e,i.stale)?o=i.installed:r.file=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null),{file:o,lineAnnotations:s}}function hd({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?id:e?.renderCustomHeader,renderGutterUtility:r?id:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function gd(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function _d({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:s,style:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,prerenderedHTML:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S}=pd({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:m,hasGutterRenderUtility:h!=null,hasCustomHeader:u!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y});return(0,X.jsx)(ot,{ref:b,className:s,style:c,children:cd(sd({file:e,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:t,getHoveredLine:x,getAnnotationSlotName:S}),m)})}var vd=typeof window>`u`?J.useEffect:J.useLayoutEffect;function yd({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=dd(),_=s!==void 0,v=(0,J.useContext)(Nn),y=td(),b=Qu(e=>m?.(e)),x=m==null?void 0:b,S=(0,J.useRef)(null),C=Qu(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(S.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),w=h==null?void 0:C,T=(0,J.useMemo)(()=>{if(e!=null)return e;let{current:i}=S,a=i?.filePair;if(i!=null&&a!=null){if(bd(t,n,a.stale)||bd(t,n,a.installed))return a.fileDiff;i.filePair=null}return Ls(t??null,n??null,r?.parseDiffOptions)},[e,t,n,r?.parseDiffOptions]),E=(0,J.useRef)(null),D=(0,J.useRef)(null),O=Qu(()=>{if(y==null)throw Error(`FileDiff: EditContext is not attached`);return y(`file-diff`,i??{},a)}),k=Qu(e=>{if(e!=null){if(E.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?E.current=new ul(Sd({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),f?void 0:v,!0):E.current=new wl(Sd({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),g,l,f?void 0:v,!0),p&&D.current==null&&(D.current=Cd(E.current,O)),E.current.hydrate({fileDiff:T,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(E.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);E.current.cleanUp(),E.current=null,D.current=null}});return vd(()=>{let{current:e}=E;if(e==null)return;let t=Sd({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),n=t!==void 0&&!Pi(e.options,t);if(e.setOptions(t),!p&&D.current!=null){let{current:e}=D;D.current=null,e()}let i=xd(T,o,S);e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),p&&D.current==null&&(D.current=Cd(e,O))}),{fileDiff:T,ref:k,getHoveredLine:(0,J.useCallback)(()=>E.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,J.useCallback)(e=>E.current?.getAnnotationSlotName(e)??Ta(e),[])}}function bd(e,t,n){return Oa(e??void 0,n.oldFile??void 0)&&Oa(t??void 0,n.newFile??void 0)}function xd(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&&(qe(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 Sd({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?id:e?.renderCustomHeader,renderGutterUtility:r?id:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function Cd(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function wd({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}=yd({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,X.jsx)(ot,{ref:b,className:s,style:c,children:cd(ad({fileDiff:e,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:a,getHoveredLine:x,getAnnotationSlotName:S}),l)})}function Td(e){let{environmentId:t,threadId:n,fromTurnCount:r,toTurnCount:i,ignoreWhitespace:a,cacheScope:o}=e,s=e.enabled,c=_e(e)?b(e):null;(0,J.useEffect)(()=>{if(c!==null)return x({environmentId:t,threadId:n,fromTurnCount:r,toTurnCount:i,ignoreWhitespace:a,...o===void 0?{}:{cacheScope:o},...s===void 0?{}:{enabled:s}})},[c,t,n,r,i,a,o,s]);let l=z(c===null?A:C(c));return c===null?M:l}var Ed=`\0`,Dd=1/0,Od=1;function kd(e){return`${e.turnId}${Ed}${e.filePath}${Ed}${e.blobSha}`}var Ad=class{#e;#t;constructor(e=50){if(!Number.isInteger(e)||e<=0)throw RangeError(`DiffParseCache maxEntries must be a positive integer, received ${String(e)}`);this.#t=e,this.#e=new W(e,Dd)}get maxEntries(){return this.#t}get(e){return this.#e.get(kd(e))??void 0}set(e,t){this.#e.set(kd(e),t,Od)}getOrCompute(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t();return this.set(e,r),r}clear(){this.#e.clear()}};function jd(e){if(!e.startsWith(`"`))return e;if(!e.endsWith(`"`))return null;let t=[],n={a:`\x07`,b:`\b`,f:`\f`,n:`
|
|
1360
|
-
`,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 Md(e,t){let n=jd(e);return n?.startsWith(t)?n.slice(2):null}function Nd(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:Md(e,`a/`),a=t===`/dev/null`?null:Md(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=Md(e.slice(0,t),`a/`),a=Md(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 Pd(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 Fd(e,t=`diff-panel`,n){if(!e)return null;let r=e.replace(/^\n+|\n+$/g,``);if(r.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 i=new Map;if(e.size&&n)for(let e of Pd(n.source)){let n=e.replace(/^\n+|\n+$/g,``);i.set(un(n,t),n)}let a=Pd(r).flatMap(n=>{let r=n.replace(/\n+$/,``),a=un(r,t),o=e.get(a);if(o&&i.get(a)===r)return o;let s=Nd(r);if(!s)throw Error(`Unsupported or ambiguous Git file paths.`);return ms(`${r}\n`,a).flatMap(e=>e.files).map((e,t)=>(e.name=s.name,s.prevName===void 0?delete e.prevName:e.prevName=s.prevName,e.cacheKey=`${a}:${t}`,e))});return a.length>0?{kind:`files`,files:a}:{kind:`raw`,text:r,reason:`Unsupported diff format. Showing raw patch.`}}catch{return{kind:`raw`,text:r,reason:`Failed to parse patch. Showing raw patch.`}}}var Id=class{#e;parse(e,t,n){let r=n===void 0?Fd(e,t,this.#e):n;return this.#e=e.trim().length?{source:e,patch:r}:void 0,r}};function Ld(e,t,n){let r=t+n;return r>=0&&r<e?r:null}function Rd(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 zd(e,t,n){let r=(0,Y.c)(27),[i,a]=(0,J.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:Rd(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,J.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=Ld(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=Ld(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=Ld(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],_}function Bd(e){return e.name??e.prevName??``}function Vd(e,t=!1){let n=e.trim();return t?n:n.toLowerCase()}function Hd(e,t){t.text!==void 0&&e.push({fileIndex:t.fileIndex,field:t.field,text:t.text,normalizedText:t.text.toLowerCase(),...t.lineIndex===void 0?{}:{lineIndex:t.lineIndex},...t.unifiedLineIndex===void 0?{}:{unifiedLineIndex:t.unifiedLineIndex},...t.splitLineIndex===void 0?{}:{splitLineIndex:t.splitLineIndex}})}function Ud(e,t,n){t.additionLines.forEach((t,r)=>{Hd(e,{fileIndex:n,field:`addition`,lineIndex:r,text:t})}),t.deletionLines.forEach((t,r)=>{Hd(e,{fileIndex:n,field:`deletion`,lineIndex:r,text:t})})}function Wd(e,t,n){if(!t.hunks||t.hunks.length===0)return!1;for(let r of t.hunks){let i=r.unifiedLineStart,a=r.splitLineStart;for(let o of r.hunkContent){if(o.type===`context`){for(let r=0;r<o.lines;r+=1){let s=o.additionLineIndex+r,c=o.deletionLineIndex+r;Hd(e,{fileIndex:n,field:`context`,lineIndex:s,unifiedLineIndex:i+r,splitLineIndex:a+r,text:t.additionLines[s]??t.deletionLines[c]})}i+=o.lines,a+=o.lines;continue}for(let r=0;r<o.deletions;r+=1){let s=o.deletionLineIndex+r;Hd(e,{fileIndex:n,field:`deletion`,lineIndex:s,unifiedLineIndex:i+r,splitLineIndex:a+r,text:t.deletionLines[s]})}for(let r=0;r<o.additions;r+=1){let s=o.additionLineIndex+r;Hd(e,{fileIndex:n,field:`addition`,lineIndex:s,unifiedLineIndex:i+o.deletions+r,splitLineIndex:a+r,text:t.additionLines[s]})}i+=o.deletions+o.additions,a+=Math.max(o.deletions,o.additions)}}return!0}function Gd(e){let t=[];return e.forEach((e,n)=>{Hd(t,{text:Bd(e),fileIndex:n,field:`path`}),e.prevName&&Hd(t,{text:Bd({name:e.prevName}),fileIndex:n,field:`previousPath`}),Wd(t,e,n)||Ud(t,e,n)}),{records:t}}function Kd(e){let t=e.caseSensitive?e.record.text:e.record.normalizedText,n=[],r=0;for(;;){let i=t.indexOf(e.needle,r);if(i===-1)return n;let a=i+e.needle.length;n.push({fileIndex:e.record.fileIndex,field:e.record.field,...e.record.lineIndex===void 0?{}:{lineIndex:e.record.lineIndex},...e.record.unifiedLineIndex===void 0?{}:{unifiedLineIndex:e.record.unifiedLineIndex},...e.record.splitLineIndex===void 0?{}:{splitLineIndex:e.record.splitLineIndex},start:i,end:a}),r=a>i?a:i+1}}function qd(e){return!Array.isArray(e)}function Jd(e,t,n){let r=n?.caseSensitive??!1,i=Vd(t,r);if(!i)return[];let a=qd(e)?e:Gd(e),o=[];for(let e of a.records)o.push(...Kd({record:e,needle:i,caseSensitive:r}));return o}function Yd(e){return[...new Set(e.map(e=>e.fileIndex))]}function Xd(e){let t=new Map;for(let n of e){let e=t.get(n.fileIndex);e?e.push(n):t.set(n.fileIndex,[n])}return t}function Zd(e,t,n){return t<=0?0:(e+n+t)%t}function Qd(e,t){return e.field===`path`||e.field===`previousPath`?null:(t===`split`?e.splitLineIndex:e.unifiedLineIndex)??e.lineIndex??null}function $d(e){return e===`addition`||e===`deletion`||e===`context`}function ef(e){if(!e)return null;let[t,n]=e.split(`,`),r=Number.parseInt(t??``,10);if(!Number.isFinite(r))return null;let i=Number.parseInt(n??``,10);return{stacked:r,split:Number.isFinite(i)?i:r}}function tf(e,t){if(!$d(e.field)||Qd(e,t.renderMode)!==(t.renderMode===`split`?t.lineIndexes.split:t.lineIndexes.stacked))return!1;switch(e.field){case`addition`:return t.lineType===`change-addition`||t.lineType===`addition`;case`deletion`:return t.lineType===`change-deletion`||t.lineType===`deletion`;case`context`:return t.lineType===`context`||t.lineType===`context-expanded`}}function nf(e){let t=e.cwd?nn(e.filePath,e.cwd):e.filePath;return typeof e.lineNumber==`number`?`${t}:${e.lineNumber}`:t}var rf=`
|
|
1361
|
-
[data-diffs-header],
|
|
1362
|
-
[data-diff],
|
|
1363
|
-
[data-file],
|
|
1364
|
-
[data-error-wrapper],
|
|
1365
|
-
[data-virtualizer-buffer] {
|
|
1366
|
-
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1367
|
-
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1368
|
-
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1369
|
-
--diffs-token-light-bg: transparent;
|
|
1370
|
-
--diffs-token-dark-bg: transparent;
|
|
1371
|
-
|
|
1372
|
-
--diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));
|
|
1373
|
-
--diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));
|
|
1374
|
-
--diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));
|
|
1375
|
-
--diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));
|
|
1376
|
-
|
|
1377
|
-
--diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));
|
|
1378
|
-
--diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));
|
|
1379
|
-
--diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));
|
|
1380
|
-
--diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));
|
|
1381
|
-
|
|
1382
|
-
--diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));
|
|
1383
|
-
--diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));
|
|
1384
|
-
--diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));
|
|
1385
|
-
--diffs-bg-deletion-emphasis-override: color-mix(
|
|
1386
|
-
in srgb,
|
|
1387
|
-
var(--background) 80%,
|
|
1388
|
-
var(--destructive)
|
|
1389
|
-
);
|
|
1390
|
-
|
|
1391
|
-
background-color: var(--diffs-bg) !important;
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
[data-file-info] {
|
|
1395
|
-
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
1396
|
-
border-block-color: var(--border) !important;
|
|
1397
|
-
color: var(--foreground) !important;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
[data-diffs-header] {
|
|
1401
|
-
position: sticky !important;
|
|
1402
|
-
top: 0;
|
|
1403
|
-
z-index: 4;
|
|
1404
|
-
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
1405
|
-
border-bottom: 1px solid var(--border) !important;
|
|
1406
|
-
}
|
|
1407
|
-
`,af=`
|
|
1408
|
-
[data-title] {
|
|
1409
|
-
cursor: pointer;
|
|
1410
|
-
transition:
|
|
1411
|
-
color 120ms ease,
|
|
1412
|
-
text-decoration-color 120ms ease;
|
|
1413
|
-
text-decoration: underline;
|
|
1414
|
-
text-decoration-color: transparent;
|
|
1415
|
-
text-underline-offset: 2px;
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
[data-title]:hover {
|
|
1419
|
-
color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
|
|
1420
|
-
text-decoration-color: currentColor;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
[data-interactive-line-numbers] [data-line-number-content] {
|
|
1424
|
-
cursor: pointer;
|
|
1425
|
-
}
|
|
1426
|
-
`,of=`
|
|
1427
|
-
::highlight(ryco-diff-search-match) {
|
|
1428
|
-
background-color: color-mix(in srgb, var(--warning) 60%, transparent);
|
|
1429
|
-
color: var(--foreground);
|
|
1430
|
-
}
|
|
1431
|
-
`,sf=`${rf}${af}${of}`,cf=`${rf}${of}`;function lf(e){return Bd(e)}function uf(e){return!e||e.kind!==`files`?[]:e.files.toSorted((e,t)=>lf(e).localeCompare(lf(t),void 0,{numeric:!0,sensitivity:`base`}))}var df=new Ad;function ff(e){return e.cacheKey??`${e.prevName??`none`}:${e.name}`}var pf=`ryco-diff-search-match`,mf=150,hf=80,gf=1600;function _f(){return typeof CSS<`u`&&CSS.highlights!==void 0&&globalThis.Highlight!==void 0}function vf(e,t,n=gf){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();return r.bottom>=i.top-n&&r.top<=i.bottom+n&&r.right>=i.left-n&&r.left<=i.right+n}function yf(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return t&&t.closest(`[data-line-number-content]`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=n.nextNode(),i=0;for(;r;){let e=r,a=i+e.data.length;t.push({node:e,start:i,end:a}),i=a,r=n.nextNode()}return{offsets:t,textLength:i}}function bf(e,t,n){for(let r of e)if(!(t<r.start||t>r.end)&&(t!==r.end||n!==`start`))return{node:r.node,offset:t-r.start};return null}function xf(e,t,n){let{offsets:r,textLength:i}=yf(e);if(r.length===0||t.start<0||t.end>i||t.start>=t.end)return;let a=bf(r,t.start,`start`),o=bf(r,t.end,`end`);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset),n.push(s)}function Sf(e){let t=ef(e.lineIndexAttr);return t?e.matches.filter(n=>tf(n,{renderMode:e.renderMode,lineIndexes:t,lineType:e.lineType})):[]}function Cf(e){if(Qd(e.match,e.renderMode)===null)return null;let t=e.fileElement.querySelectorAll(`diffs-container`);for(let n of t){let t=n.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`);for(let n of t??[]){let t=ef(n.getAttribute(`data-line-index`));if(t&&tf(e.match,{renderMode:e.renderMode,lineIndexes:t,lineType:n.getAttribute(`data-line-type`)}))return n}}return null}function wf(e){let t=[],n=e.rootElement.querySelectorAll(`[data-diff-file-index]`);for(let r of n){if(!vf(r,e.viewportElement))continue;let n=r.dataset.diffFileIndex,i=n?Number.parseInt(n,10):NaN;if(!Number.isFinite(i))continue;let a=e.matchesByFileIndex.get(i);if(!a||a.length===0)continue;let o=r.querySelectorAll(`diffs-container`);for(let n of o){let r=n.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`);for(let n of r??[]){if(!vf(n,e.viewportElement))continue;let r=Sf({matches:a,renderMode:e.renderMode,lineIndexAttr:n.getAttribute(`data-line-index`),lineType:n.getAttribute(`data-line-type`)});for(let e of r)xf(n,e,t)}}}return t}function Tf(e){switch(e.type){case`new`:return`text-[var(--diffs-addition-base)]`;case`deleted`:return`text-[var(--diffs-deletion-base)]`;case`change`:case`rename-pure`:case`rename-changed`:return`text-[var(--diffs-modified-base)]`;default:return`text-muted-foreground/80`}}function Ef(e){let t=(0,Y.c)(287),{mode:n}=e,r=n===void 0?`inline`:n;Gn(`DiffPanel`);let i=Ke(),{resolvedTheme:a}=gr(),o=j(),c=r===`phone`,[l,u]=vr(),d=c?`stacked`:l,[f,p]=(0,J.useState)(c?!0:o.diffWordWrap),[m,h]=(0,J.useState)(o.diffIgnoreWhitespace),[g,_]=(0,J.useState)(zf),[b,x]=(0,J.useState)(``),C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C={wait:mf},t[0]=C):C=t[0];let[w]=Re(b,C),E;t[1]!==w||t[2]!==b?(E=b.trim().length===0?``:w,t[1]=w,t[2]=b,t[3]=E):E=t[3];let D=E,[O,k]=(0,J.useState)(0),A=(0,J.useRef)(null),M=(0,J.useRef)(null),[N]=(0,J.useState)(Rf),P=(0,J.useRef)(null),F=(0,J.useRef)(null),te=(0,J.useRef)(!1),[re,ie]=(0,J.useState)(!1),[I,ae]=(0,J.useState)(!1),le;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(le={strict:!1,select:Lf},t[4]=le):le=t[4];let R=se(le),z;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(z={strict:!1,select:If},t[5]=z):z=t[5];let B=Rr(z),ue=B.diff===`1`,de=R?.threadId??null,V;t[6]===R?V=t[7]:(V=ne(R),t[6]=R,t[7]=V);let H=v(V),fe=H?.projectId??null,pe;t[8]!==fe||t[9]!==H?(pe=e=>H&&fe?y(e,{environmentId:H.environmentId,projectId:fe}):void 0,t[8]=fe,t[9]=H,t[10]=pe):pe=t[10];let me=v(pe),he=H?.worktreePath??me?.cwd,_e=H?.environmentId??null,ve=he??null,ye;t[11]!==_e||t[12]!==ve?(ye={environmentId:_e,cwd:ve},t[11]=_e,t[12]=ve,t[13]=ye):ye=t[13];let be=T(ye).data?.isRepo??!0,[xe,Se]=(0,J.useState)(null),U=xe!==null&&!c&&B.diffTurnId==null,Ce=Uu(H?.environmentId??null,he??null,ue&&be&&U),we=H?.environmentId??null,Te=me?.cwd??null,Ee=he??null,De=ue&&be&&!c&&B.diffTurnId==null&&!U,Oe;t[14]!==m||t[15]!==we||t[16]!==Te||t[17]!==Ee||t[18]!==De?(Oe={environmentId:we,repositoryPath:Te,cwd:Ee,ignoreWhitespace:m,enabled:De},t[14]=m,t[15]=we,t[16]=Te,t[17]=Ee,t[18]=De,t[19]=Oe):Oe=t[19];let W=Zu(Oe),G=!U&&!c&&B.diffTurnId==null&&W.selection!==null,{turnDiffSummaries:K,inferredCheckpointTurnCountByTurnId:ke}=Qe(H),Ae;if(t[20]!==ke||t[21]!==K){let e;t[23]===ke?e=t[24]:(e=(e,t)=>{let n=e.checkpointTurnCount??ke[e.turnId]??0,r=t.checkpointTurnCount??ke[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n},t[23]=ke,t[24]=e),Ae=[...K].toSorted(e),t[20]=ke,t[21]=K,t[22]=Ae}else Ae=t[22];let je=Ae,Me=B.diffTurnId??null,Ne=Me===null?null:B.diffFilePath??null,Fe;t[25]!==je||t[26]!==Me?(Fe=Me===null?void 0:je.find(e=>e.turnId===Me)??je[0],t[25]=je,t[26]=Me,t[27]=Fe):Fe=t[27];let Le=Fe,ze=Le&&(Le.checkpointTurnCount??ke[Le.turnId]),Be;t[28]===ze?Be=t[29]:(Be=typeof ze==`number`?{fromTurnCount:Math.max(0,ze-1),toTurnCount:ze}:null,t[28]=ze,t[29]=Be);let Ve=Be,He;if(t[30]!==ke||t[31]!==je){bb0:{let e;t[33]===ke?e=t[34]:(e=e=>e.checkpointTurnCount??ke[e.turnId],t[33]=ke,t[34]=e);let n=je.map(e).filter(Ff);if(n.length===0){He=void 0;break bb0}let r=Math.max(...n);He=r>0?r:void 0}t[30]=ke,t[31]=je,t[32]=He}else He=t[32];let Ue=He,We;t[35]!==Ue||t[36]!==Le?(We=!Le&&typeof Ue==`number`?{fromTurnCount:0,toTurnCount:Ue}:null,t[35]=Ue,t[36]=Le,t[37]=We):We=t[37];let Ge=Le?Ve:We,qe;bb1:{if(Le||je.length===0){qe=null;break bb1}let e;t[38]===je?e=t[39]:(e=je.map(Pf).join(`,`),t[38]=je,t[39]=e),qe=`conversation:${e}`}let Je=qe,Ye=H?.environmentId??null,Xe=Ge?.fromTurnCount??null,Ze=Ge?.toTurnCount??null,q=Le?`turn:${Le.turnId}`:Je,$e=be&&!G&&!U,et;t[40]!==de||t[41]!==m||t[42]!==Ye||t[43]!==Xe||t[44]!==Ze||t[45]!==q||t[46]!==$e?(et={environmentId:Ye,threadId:de,fromTurnCount:Xe,toTurnCount:Ze,ignoreWhitespace:m,cacheScope:q,enabled:$e},t[40]=de,t[41]=m,t[42]=Ye,t[43]=Xe,t[44]=Ze,t[45]=q,t[46]=$e,t[47]=et):et=t[47];let tt=Td(et),nt=Le?tt.data?.diff:void 0,rt=Le?void 0:tt.data?.diff,it=U?Ce.isLoading:G?W.isLoading:tt.isLoading,at=U?Ce.error:G?W.error:tt.error instanceof Error?tt.error.message:tt.error?`Failed to load checkpoint diff.`:null,ot=U&&xe?Ce.data?.[xe].patch:G?W.data?.patch:Le?nt:rt,[st,ct]=(0,J.useState)(null);st&&(!G||st.source!==W.data?.source)&&ct(null);let lt;t[48]!==H?.environmentId||t[49]!==W||t[50]!==Ce||t[51]!==xe||t[52]!==U?(lt=U&&Ce.data?JSON.stringify([H?.environmentId,xe,Ce.data.revision]):W.data?JSON.stringify([H?.environmentId,W.data.source.revision]):null,t[48]=H?.environmentId,t[49]=W,t[50]=Ce,t[51]=xe,t[52]=U,t[53]=lt):lt=t[53];let ut=lt,dt=typeof ot==`string`,ft;t[54]!==dt||t[55]!==ot?(ft=dt&&ot.trim().length===0,t[54]=dt,t[55]=ot,t[56]=ft):ft=t[56];let pt=ft,mt;if(t[57]!==N||t[58]!==G||t[59]!==ut||t[60]!==Je||t[61]!==a||t[62]!==U||t[63]!==ot||t[64]!==Le){bb2:{let e=`diff-panel:${a}`,n=typeof ot==`string`?ot:``;if(n.length===0){N.parse(``,e);let n;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(n={patch:null,files:[]},t[66]=n):n=t[66],mt=n;break bb2}let r={turnId:G||U?`comparison:${ut??`pending`}`:Le?`turn:${Le.turnId}`:Je??`conversation`,filePath:e,blobSha:un(n)},i=df.get(r);if(i){N.parse(n,e,i.patch),mt=i;break bb2}let o=N.parse(n,e),s={patch:o,files:uf(o)};o&&df.set(r,s),mt=s}t[57]=N,t[58]=G,t[59]=ut,t[60]=Je,t[61]=a,t[62]=U,t[63]=ot,t[64]=Le,t[65]=mt}else mt=t[65];let ht=mt,gt=ht.patch,_t=ht.files,vt;t[67]===_t?vt=t[68]:(vt=Gd(_t),t[67]=_t,t[68]=vt);let bt=vt,xt;t[69]===D?xt=t[70]:(xt=Vd(D),t[69]=D,t[70]=xt);let St=xt,Ct;t[71]!==bt||t[72]!==D?(Ct=Jd(bt,D),t[71]=bt,t[72]=D,t[73]=Ct):Ct=t[73];let wt=Ct,Tt;t[74]===wt?Tt=t[75]:(Tt=Xd(wt),t[74]=wt,t[75]=Tt);let Et=Tt,Dt;t[76]===_t?Dt=t[77]:(Dt=_t.map(Nf),t[76]=_t,t[77]=Dt);let Ot=Dt,At;bb3:{if(!St){At=Ot;break bb3}let e;if(t[78]!==wt||t[79]!==_t){let n;t[81]===_t?n=t[82]:(n=e=>({fileDiff:_t[e],fileIndex:e}),t[81]=_t,t[82]=n),e=Yd(wt).map(n),t[78]=wt,t[79]=_t,t[80]=e}else e=t[80];At=e}let jt=At,Mt;t[83]===jt?Mt=t[84]:(Mt=jt.map(Mf),t[83]=jt,t[84]=Mt);let Nt=Mt,Pt=zd(M,Nt,ue&&!c),Ft;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(Ft=()=>{k(0)},t[85]=Ft):Ft=t[85];let It;t[86]!==St||t[87]!==_t?(It=[St,_t],t[86]=St,t[87]=_t,t[88]=It):It=t[88],(0,J.useEffect)(Ft,It);let Lt,Rt;t[89]===wt.length?(Lt=t[90],Rt=t[91]):(Lt=()=>{k(e=>wt.length===0?0:Math.min(e,wt.length-1))},Rt=[wt.length],t[89]=wt.length,t[90]=Lt,t[91]=Rt),(0,J.useEffect)(Lt,Rt);let zt;t[92]!==O||t[93]!==d||t[94]!==wt?(zt=e=>{if(wt.length===0)return;let t=Zd(O,wt.length,e);k(t);let n=wt[t],r=M.current;if(!n||!r)return;let i=r.querySelector(`[data-diff-file-index="${n.fileIndex}"]`);if(!i)return;let a=Cf({fileElement:i,match:n,renderMode:d});(a??i).scrollIntoView({block:`center`,behavior:`smooth`}),!a&&Qd(n,d)!==null&&window.requestAnimationFrame(()=>{Cf({fileElement:i,match:n,renderMode:d})?.scrollIntoView({block:`center`,behavior:`smooth`})})},t[92]=O,t[93]=d,t[94]=wt,t[95]=zt):zt=t[95];let Bt=zt,Vt,Ht;t[96]!==d||t[97]!==wt.length||t[98]!==Et||t[99]!==St?(Vt=()=>{if(!_f())return;let e=CSS.highlights,t=M.current;if(!t||!St||wt.length===0){e.delete(pf);return}let n=0,r=0,i=new Map,a=t.querySelector(`.diff-render-surface`)??t.querySelector(`[data-virtualizer]`)??t,o=()=>{n=0,c();let r=wf({rootElement:t,viewportElement:a,matchesByFileIndex:Et,renderMode:d});if(r.length===0){e.delete(pf);return}e.set(pf,new Highlight(...r))},s=()=>{n===0&&r===0&&(r=window.setTimeout(()=>{r=0,n=window.requestAnimationFrame(o)},hf))},c=()=>{let e=t.querySelectorAll(`[data-diff-file-index]`);for(let t of e){if(!vf(t,a))continue;let e=t.querySelectorAll(`diffs-container`);for(let t of e){let e=t.shadowRoot;if(!e||i.has(e))continue;let n=new MutationObserver(s);n.observe(e,{childList:!0,subtree:!0}),i.set(e,n)}}},l=new MutationObserver(s);l.observe(t,{childList:!0,subtree:!0}),a.addEventListener(`scroll`,s,{passive:!0});let u=new ResizeObserver(s);return u.observe(a),s(),()=>{l.disconnect(),a.removeEventListener(`scroll`,s),u.disconnect();for(let e of i.values())e.disconnect();i.clear(),r!==0&&window.clearTimeout(r),n!==0&&window.cancelAnimationFrame(n),e.delete(pf)}},Ht=[d,wt.length,Et,St],t[96]=d,t[97]=wt.length,t[98]=Et,t[99]=St,t[100]=Vt,t[101]=Ht):(Vt=t[100],Ht=t[101]),(0,J.useEffect)(Vt,Ht);let Ut,Wt;t[102]===_t?(Ut=t[103],Wt=t[104]):(Ut=()=>{if(_t.length===0){_(jf);return}let e=new Set(_t.map(ff));_(t=>{let n=new Set([...t].filter(t=>e.has(t)));return n.size===t.size?t:n})},Wt=[_t],t[102]=_t,t[103]=Ut,t[104]=Wt),(0,J.useEffect)(Ut,Wt);let Gt,Kt;t[105]!==ue||t[106]!==c||t[107]!==o.diffIgnoreWhitespace||t[108]!==o.diffWordWrap?(Gt=()=>{ue&&!te.current&&(p(c?!0:o.diffWordWrap),h(o.diffIgnoreWhitespace),x(``)),te.current=ue},Kt=[ue,c,o.diffIgnoreWhitespace,o.diffWordWrap],t[105]=ue,t[106]=c,t[107]=o.diffIgnoreWhitespace,t[108]=o.diffWordWrap,t[109]=Gt,t[110]=Kt):(Gt=t[109],Kt=t[110]),(0,J.useEffect)(Gt,Kt);let qt;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(qt=()=>{x(``)},t[111]=qt):qt=t[111];let Jt;t[112]===Me?Jt=t[113]:(Jt=[Me],t[112]=Me,t[113]=Jt),(0,J.useEffect)(qt,Jt);let Yt;t[114]!==H?.environmentId||t[115]!==de||t[116]!==c||t[117]!==_t||t[118]!==Ne||t[119]!==Me?(Yt=()=>{if(!Ne||!M.current){F.current=null;return}let e=JSON.stringify([H?.environmentId,de,Me,Ne]);if(!c&&F.current===e||!_t.some(e=>lf(e)===Ne))return;let t=Array.from(M.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===Ne);t&&(t.scrollIntoView({block:`nearest`}),F.current=e)},t[114]=H?.environmentId,t[115]=de,t[116]=c,t[117]=_t,t[118]=Ne,t[119]=Me,t[120]=Yt):Yt=t[120];let Xt=H?.environmentId,Zt;t[121]!==de||t[122]!==c||t[123]!==_t||t[124]!==Ne||t[125]!==Me||t[126]!==Xt?(Zt=[Xt,de,c,Ne,Me,_t],t[121]=de,t[122]=c,t[123]=_t,t[124]=Ne,t[125]=Me,t[126]=Xt,t[127]=Zt):Zt=t[127],(0,J.useEffect)(Yt,Zt);let Qt;t[128]===he?Qt=t[129]:(Qt=(e,t)=>{let n=ce();if(!n)return;let r=nf({cwd:he,filePath:e,lineNumber:t});or(n,r).catch(Af)},t[128]=he,t[129]=Qt);let $t=Qt,en;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(en=e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[130]=en):en=t[130];let tn=en,nn;t[131]!==H||t[132]!==i?(nn=e=>{H&&i({to:`/$environmentId/$threadId`,params:S(s(H.environmentId,H.id)),search:t=>({...Er(t),diff:`1`,diffTurnId:e})})},t[131]=H,t[132]=i,t[133]=nn):nn=t[133];let rn=nn,an;t[134]!==H||t[135]!==i?(an=()=>{H&&i({to:`/$environmentId/$threadId`,params:S(s(H.environmentId,H.id)),search:kf})},t[134]=H,t[135]=i,t[136]=an):an=t[136];let on=an,sn;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(sn=()=>{let e=P.current;if(!e){ie(!1),ae(!1);return}let t=Math.max(0,e.scrollWidth-e.clientWidth);ie(e.scrollLeft>4),ae(e.scrollLeft<t-4)},t[137]=sn):sn=t[137];let cn=sn,ln;t[138]===Symbol.for(`react.memo_cache_sentinel`)?(ln=e=>{let t=P.current;t&&t.scrollBy({left:e,behavior:`smooth`})},t[138]=ln):ln=t[138];let dn=ln,fn;t[139]===Symbol.for(`react.memo_cache_sentinel`)?(fn=e=>{let t=P.current;t&&(t.scrollWidth<=t.clientWidth+1||Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.preventDefault(),t.scrollBy({left:e.deltaY,behavior:`auto`})))},t[139]=fn):fn=t[139];let pn=fn,mn,hn;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(mn=()=>{let e=P.current;if(!e)return;let t=window.requestAnimationFrame(()=>cn()),n=()=>cn();e.addEventListener(`scroll`,n,{passive:!0});let r=new ResizeObserver(()=>cn());return r.observe(e),()=>{window.cancelAnimationFrame(t),e.removeEventListener(`scroll`,n),r.disconnect()}},hn=[cn],t[140]=mn,t[141]=hn):(mn=t[140],hn=t[141]),(0,J.useEffect)(mn,hn);let gn;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(gn=()=>{let e=window.requestAnimationFrame(()=>cn());return()=>{window.cancelAnimationFrame(e)}},t[142]=gn):gn=t[142];let _n;t[143]!==je||t[144]!==Me?(_n=[je,Me,cn],t[143]=je,t[144]=Me,t[145]=_n):_n=t[145],(0,J.useEffect)(gn,_n);let vn;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(vn=()=>{let e=P.current;e&&e.querySelector(`[data-turn-chip-selected='true']`)?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})},t[146]=vn):vn=t[146];let yn=Le?.turnId,bn;t[147]!==Me||t[148]!==yn?(bn=[yn,Me],t[147]=Me,t[148]=yn,t[149]=bn):bn=t[149],(0,J.useEffect)(vn,bn);let xn;t[150]!==re||t[151]!==I||t[152]!==c?(xn=c?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,className:L(`absolute left-0 top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,re?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`),onClick:()=>dn(-180),disabled:!re,"aria-label":`Scroll turn list left`,children:(0,X.jsx)(qn,{className:`size-3.5`})}),(0,X.jsx)(`button`,{type:`button`,className:L(`absolute right-0 top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,I?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`),onClick:()=>dn(180),disabled:!I,"aria-label":`Scroll turn list right`,children:(0,X.jsx)(Yn,{className:`size-3.5`})})]}),t[150]=re,t[151]=I,t[152]=c,t[153]=xn):xn=t[153];let Sn=c?`px-1`:`px-8`,Cn;t[154]===Sn?Cn=t[155]:(Cn=L(`turn-chip-strip flex gap-1 overflow-x-auto py-0.5`,Sn),t[154]=Sn,t[155]=Cn);let wn;t[156]!==re||t[157]!==I||t[158]!==c?(wn=!c&&(re||I)?{maskImage:`linear-gradient(to right, ${re?`transparent 24px, black 72px`:`black`}, ${I?`black calc(100% - 72px), transparent calc(100% - 24px)`:`black`})`}:void 0,t[156]=re,t[157]=I,t[158]=c,t[159]=wn):wn=t[159];let Tn=c&&`min-h-[44px]`,En;t[160]===Tn?En=t[161]:(En=L(`shrink-0 rounded-md`,Tn),t[160]=Tn,t[161]=En);let Dn;t[162]!==W||t[163]!==c||t[164]!==on?(Dn=()=>{c||(W.setSelection(null),Se(null)),on()},t[162]=W,t[163]=c,t[164]=on,t[165]=Dn):Dn=t[165];let On=!G&&!U&&Me===null,kn=c&&`flex min-h-[44px] items-center`,An=!G&&!U&&Me===null?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,jn;t[166]!==kn||t[167]!==An?(jn=L(`rounded-md border px-2 py-1 text-left transition-colors`,kn,An),t[166]=kn,t[167]=An,t[168]=jn):jn=t[168];let Mn;t[169]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=(0,X.jsx)(`div`,{className:`text-[10px] leading-tight font-medium`,children:`All turns`}),t[169]=Mn):Mn=t[169];let Nn;t[170]===jn?Nn=t[171]:(Nn=(0,X.jsx)(`div`,{className:jn,children:Mn}),t[170]=jn,t[171]=Nn);let Pn;t[172]!==En||t[173]!==Dn||t[174]!==On||t[175]!==Nn?(Pn=(0,X.jsx)(`button`,{type:`button`,className:En,onClick:Dn,"data-turn-chip-selected":On,children:Nn}),t[172]=En,t[173]=Dn,t[174]=On,t[175]=Nn,t[176]=Pn):Pn=t[176];let In;if(t[177]!==ke||t[178]!==c||t[179]!==je||t[180]!==rn||t[181]!==Le?.turnId||t[182]!==o.timestampFormat){let e;t[184]!==ke||t[185]!==c||t[186]!==rn||t[187]!==Le?.turnId||t[188]!==o.timestampFormat?(e=e=>(0,X.jsx)(`button`,{type:`button`,className:L(`shrink-0 rounded-md`,c&&`min-h-[44px]`),onClick:()=>rn(e.turnId),title:e.turnId,"data-turn-chip-selected":e.turnId===Le?.turnId,children:(0,X.jsx)(`div`,{className:L(`rounded-md border px-2 py-1 text-left transition-colors`,c&&`flex min-h-[44px] items-center`,e.turnId===Le?.turnId?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`),children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsxs)(`span`,{className:`text-[10px] leading-tight font-medium`,children:[`Turn`,` `,e.checkpointTurnCount??ke[e.turnId]??`?`]}),(0,X.jsx)(`span`,{className:`text-[9px] leading-tight opacity-70`,children:Pe(e.completedAt,o.timestampFormat)})]})})},e.turnId),t[184]=ke,t[185]=c,t[186]=rn,t[187]=Le?.turnId,t[188]=o.timestampFormat,t[189]=e):e=t[189],In=je.map(e),t[177]=ke,t[178]=c,t[179]=je,t[180]=rn,t[181]=Le?.turnId,t[182]=o.timestampFormat,t[183]=In}else In=t[183];let Ln;t[190]!==Cn||t[191]!==wn||t[192]!==Pn||t[193]!==In?(Ln=(0,X.jsxs)(`div`,{ref:P,className:Cn,style:wn,onWheel:pn,children:[Pn,In]}),t[190]=Cn,t[191]=wn,t[192]=Pn,t[193]=In,t[194]=Ln):Ln=t[194];let Rn;t[195]!==xn||t[196]!==Ln?(Rn=(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1 [-webkit-app-region:no-drag]`,children:[xn,Ln]}),t[195]=xn,t[196]=Ln,t[197]=Rn):Rn=t[197];let zn;t[198]!==Pt||t[199]!==c||t[200]!==Nt?(zn=!c&&Nt.length>0&&(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,"aria-label":`Changed file navigation`,children:[(0,X.jsx)(`button`,{type:`button`,className:`rounded p-1 disabled:opacity-40`,"aria-label":`Previous changed file`,disabled:!Pt.canPrevious,onClick:()=>Pt.jump(-1),children:(0,X.jsx)(oe,{className:`size-4`})}),(0,X.jsxs)(`span`,{className:`max-w-32 truncate text-[11px]`,title:Pt.path??void 0,"aria-live":`polite`,"data-diff-active-file":Pt.path,children:[Pt.index+1,`/`,Nt.length,` `,Pt.path]}),(0,X.jsx)(`button`,{type:`button`,className:`rounded p-1 disabled:opacity-40`,"aria-label":`Next changed file`,disabled:!Pt.canNext,onClick:()=>Pt.jump(1),children:(0,X.jsx)(ge,{className:`size-4`})})]}),t[198]=Pt,t[199]=c,t[200]=Nt,t[201]=zn):zn=t[201];let Bn;t[202]!==d||t[203]!==c||t[204]!==u?(Bn=c?null:(0,X.jsxs)(_r,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[d],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&u(t)},children:[(0,X.jsx)(yr,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,X.jsx)(bi,{className:`size-3`})}),(0,X.jsx)(yr,{"aria-label":`Split diff view`,value:`split`,children:(0,X.jsx)(Qr,{className:`size-3`})})]}),t[202]=d,t[203]=c,t[204]=u,t[205]=Bn):Bn=t[205];let Vn=f?`Disable diff line wrapping`:`Enable diff line wrapping`,Hn=f?`Disable line wrapping`:`Enable line wrapping`,Un=c&&`min-h-[44px] min-w-[44px]`,Wn;t[206]===Un?Wn=t[207]:(Wn=L(Un),t[206]=Un,t[207]=Wn);let Kn,Jn;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(Kn=e=>{p(!!e)},Jn=(0,X.jsx)(Si,{className:`size-3`}),t[208]=Kn,t[209]=Jn):(Kn=t[208],Jn=t[209]);let Xn;t[210]!==f||t[211]!==Vn||t[212]!==Hn||t[213]!==Wn?(Xn=(0,X.jsx)(yr,{"aria-label":Vn,title:Hn,variant:`outline`,size:`xs`,className:Wn,pressed:f,onPressedChange:Kn,children:Jn}),t[210]=f,t[211]=Vn,t[212]=Hn,t[213]=Wn,t[214]=Xn):Xn=t[214];let Zn=U?`Whitespace is included for staging`:m?`Show whitespace changes`:`Hide whitespace changes`,Qn=U?`Staging always shows the exact patch, including whitespace.`:m?`Show whitespace changes`:`Hide whitespace changes`,$n=c&&`min-h-[44px] min-w-[44px]`,er;t[215]===$n?er=t[216]:(er=L($n),t[215]=$n,t[216]=er);let tr=!U&&m,nr,rr;t[217]===Symbol.for(`react.memo_cache_sentinel`)?(rr=e=>{h(!!e)},nr=(0,X.jsx)(gi,{className:`size-3`}),t[217]=nr,t[218]=rr):(nr=t[217],rr=t[218]);let ir;t[219]!==U||t[220]!==Zn||t[221]!==Qn||t[222]!==er||t[223]!==tr?(ir=(0,X.jsx)(yr,{"aria-label":Zn,title:Qn,disabled:U,variant:`outline`,size:`xs`,className:er,pressed:tr,onPressedChange:rr,children:nr}),t[219]=U,t[220]=Zn,t[221]=Qn,t[222]=er,t[223]=tr,t[224]=ir):ir=t[224];let ar;t[225]!==ir||t[226]!==zn||t[227]!==Bn||t[228]!==Xn?(ar=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[zn,Bn,Xn,ir]}),t[225]=ir,t[226]=zn,t[227]=Bn,t[228]=Xn,t[229]=ar):ar=t[229];let sr;t[230]!==ar||t[231]!==Rn?(sr=(0,X.jsxs)(X.Fragment,{children:[Rn,ar]}),t[230]=ar,t[231]=Rn,t[232]=sr):sr=t[232];let cr=sr,lr;t[233]!==H||t[234]!==st||t[235]!==G||t[236]!==W?(lr=G&&W.data&&H&&st?.source===W.data.source&&(0,X.jsx)(Yu,{environmentId:H.environmentId,source:W.data.source,file:st.file,initialSide:st.side,initialLine:st.line,onClose:()=>ct(null)},`${H.environmentId}:${W.data.source.revision}:${st.file.name}:${st.side}:${st.line}`),t[233]=H,t[234]=st,t[235]=G,t[236]=W,t[237]=lr):lr=t[237];let ur;t[238]!==me?.cwd||t[239]!==H||t[240]!==G||t[241]!==W||t[242]!==be||t[243]!==c||t[244]!==U||t[245]!==on?(ur=!c&&H&&be&&(0,X.jsx)(Xu,{selection:G?W.selection:null,data:G?W.data:null,turnSelected:!U&&!G,isLoading:G&&W.isLoading,error:G?W.error:null,refMoved:G&&W.refMoved,onSelect:e=>{Se(null),W.setSelection(e),on()},onRefresh:()=>{W.refresh()}},`${H.environmentId}:${me?.cwd}:${W.selection?.mode}:${W.selection?.ref}`),t[238]=me?.cwd,t[239]=H,t[240]=G,t[241]=W,t[242]=be,t[243]=c,t[244]=U,t[245]=on,t[246]=ur):ur=t[246];let dr;t[247]!==H||t[248]!==be||t[249]!==c||t[250]!==Ce||t[251]!==xe||t[252]!==i||t[253]!==U?(dr=!c&&be&&H&&(0,X.jsxs)(`section`,{"aria-label":`Local change review`,className:`shrink-0 border-b border-border px-3 py-2 text-xs`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[[`unstaged`,`staged`].map(e=>(0,X.jsx)(`button`,{type:`button`,className:L(`rounded border px-2 py-1`,U&&xe===e&&`border-foreground/30 bg-foreground/10 font-medium`),"aria-pressed":U&&xe===e,onClick:()=>{Se(e),i({to:`.`,search:Of})},children:e===`staged`?`Staged changes`:`Unstaged changes`},e)),U&&(0,X.jsx)(`button`,{type:`button`,className:`rounded border px-2 py-1`,disabled:Ce.isLoading||Ce.isApplying,onClick:()=>void Ce.refresh(),children:`Refresh local changes`})]}),U&&(0,X.jsxs)(`p`,{className:`mt-2 text-muted-foreground`,children:[xe===`staged`?`HEAD → index. Unstage keeps your working files.`:`Index → working files. Later agent edits appear here; refresh to read external changes.`,` `,`Staging does not commit. Existing commit actions stage their selected files.`,Ce.isApplying&&(0,X.jsx)(`span`,{role:`status`,children:` Updating index…`}),Ce.isLoading&&(0,X.jsx)(`span`,{role:`status`,children:` Refreshing local changes…`})]})]}),t[247]=H,t[248]=be,t[249]=c,t[250]=Ce,t[251]=xe,t[252]=i,t[253]=U,t[254]=dr):dr=t[254];let fr;t[255]!==H||t[256]!==at||t[257]!==g||t[258]!==G||t[259]!==W||t[260]!==O||t[261]!==d||t[262]!==wt.length||t[263]!==b||t[264]!==f||t[265]!==jt||t[266]!==Bt||t[267]!==pt||t[268]!==be||t[269]!==it||t[270]!==c||t[271]!==Ce||t[272]!==xe||t[273]!==St||t[274]!==$t||t[275]!==je.length||t[276]!==gt||t[277]!==a||t[278]!==U?(fr=H?be?!G&&!U&&je.length===0?(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)(`div`,{ref:M,className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[at&&!gt&&(0,X.jsx)(`div`,{className:`px-3`,children:(0,X.jsx)(`p`,{role:`alert`,className:`mb-2 text-[11px] text-red-500/80`,children:at})}),gt?gt.kind===`files`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/50 bg-card/40 px-2.5 py-1.5 [-webkit-app-region:no-drag]`,children:[(0,X.jsx)(Ie,{className:`size-3.5 shrink-0 text-muted-foreground/70`}),(0,X.jsx)(`input`,{ref:A,type:`text`,value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){x(``),e.currentTarget.blur();return}e.key===`Enter`&&St&&(e.preventDefault(),Bt(e.shiftKey?-1:1))},placeholder:`Search files or hunks...`,"aria-label":`Search diff`,className:L(`min-w-0 flex-1 bg-transparent text-xs text-foreground outline-none placeholder:text-muted-foreground/55`,c&&`min-h-[44px]`)}),St&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-muted-foreground/70`,children:[wt.length===0?0:O+1,` of`,` `,wt.length]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>Bt(-1),disabled:wt.length===0,className:L(`inline-flex size-5 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/70 transition-colors hover:bg-foreground/10 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground/70`,c&&`size-[44px]`),"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,children:(0,X.jsx)(oe,{className:`size-3.5`})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>Bt(1),disabled:wt.length===0,className:L(`inline-flex size-5 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/70 transition-colors hover:bg-foreground/10 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground/70`,c&&`size-[44px]`),"aria-label":`Next match`,title:`Next match (Enter)`,children:(0,X.jsx)(ge,{className:`size-3.5`})})]})]}),b&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>{x(``),A.current?.focus()},className:L(`inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/70 transition-colors hover:bg-foreground/10 hover:text-foreground`,c&&`size-[44px]`),"aria-label":`Clear search`,title:`Clear search`,children:(0,X.jsx)(ee,{className:`size-3`})})]}),jt.length===0?(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,X.jsxs)(`p`,{children:[`No files match “`,b,`”.`]})}):(0,X.jsx)(ud,{className:L(`diff-render-surface min-h-0 flex-1 overflow-auto px-2 pb-2`,c&&`overflow-x-hidden overflow-y-auto overscroll-x-contain`),config:{overscrollSize:600,intersectionObserverMargin:1200},children:jt.map(e=>{let{fileDiff:t,fileIndex:n}=e,r=lf(t),i=U&&xe&>?.kind===`files`&>.files.length===Ce.data?.[xe].files.length?Ce.data[xe].files[gt.files.indexOf(t)]:void 0,o=ff(t),s=`${o}:${a}`,l=g.has(o);return(0,X.jsx)(`div`,{"data-diff-file-path":r,"data-diff-file-index":n,className:`diff-render-file group/diff-file mb-2 rounded-md first:mt-2 last:mb-0`,onClickCapture:c?void 0:e=>{(e.nativeEvent.composedPath?.()??[]).some(Df)&&$t(r)},children:(0,X.jsx)(wd,{fileDiff:t,renderHeaderMetadata:()=>U&&xe&&i?(0,X.jsx)(Wu,{scope:xe,file:i,name:r,disabled:Ce.isLoading||Ce.isApplying||!!Ce.error,onApply:e=>{Ce.apply(e)}},`${Ce.data?.revision}:${i.id}`):G&&W.data?(0,X.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-xs hover:bg-foreground/10`,"aria-label":`Blame line in ${t.name}`,onClick:e=>{e.stopPropagation(),W.data&&ct({source:W.data.source,file:t,side:`base`,line:t.hunks[0]?.deletionStart||1})},children:`Line blame`}):null,renderHeaderPrefix:()=>(0,X.jsx)(`button`,{type:`button`,className:L(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,c&&`size-[44px]`,Tf(t)),"aria-label":l?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!l,title:l?`Expand diff`:`Collapse diff`,onClick:e=>{e.stopPropagation(),tn(o)},children:l?(0,X.jsx)(Yn,{className:`size-4`}):(0,X.jsx)(ge,{className:`size-4`})}),options:{collapsed:l,diffStyle:d===`split`?`split`:`unified`,lineDiffType:`none`,overflow:f?`wrap`:`scroll`,theme:yt(a),themeType:a,unsafeCSS:c?cf:sf,lineHoverHighlight:`number`,...G&&W.data?{onLineClick:e=>{!e.numberColumn&&window.getSelection()?.isCollapsed&&W.data&&ct({source:W.data.source,file:t,side:e.annotationSide===`deletions`?`base`:`head`,line:e.lineNumber})}}:{},...c?{}:{onLineNumberClick:e=>{let{lineNumber:t}=e;$t(r,t)}}}})},s)})})]}):(0,X.jsx)(`div`,{className:`flex-1 overflow-auto p-2`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:gt.reason}),(0,X.jsx)(`pre`,{className:L(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,f?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:gt.text})]})}):it?(0,X.jsx)(Fn,{label:U?`Loading local changes...`:G?`Loading comparison...`:`Loading checkpoint diff...`}):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,X.jsx)(`p`,{children:pt?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`}),t[255]=H,t[256]=at,t[257]=g,t[258]=G,t[259]=W,t[260]=O,t[261]=d,t[262]=wt.length,t[263]=b,t[264]=f,t[265]=jt,t[266]=Bt,t[267]=pt,t[268]=be,t[269]=it,t[270]=c,t[271]=Ce,t[272]=xe,t[273]=St,t[274]=$t,t[275]=je.length,t[276]=gt,t[277]=a,t[278]=U,t[279]=fr):fr=t[279];let pr;return t[280]!==cr||t[281]!==r||t[282]!==lr||t[283]!==ur||t[284]!==dr||t[285]!==fr?(pr=(0,X.jsxs)(kt,{mode:r,header:cr,children:[lr,ur,dr,fr]}),t[280]=cr,t[281]=r,t[282]=lr,t[283]=ur,t[284]=dr,t[285]=fr,t[286]=pr):pr=t[286],pr}function Df(e){return e instanceof Element&&e.hasAttribute(`data-title`)}function Of(e){return{...e,diffTurnId:void 0,diffFilePath:void 0}}function kf(e){return{...Er(e),diff:`1`}}function Af(e){console.warn(`Failed to open diff in editor.`,e)}function jf(e){return e.size===0?e:new Set}function Mf(e){let{fileDiff:t}=e;return lf(t)}function Nf(e,t){return{fileDiff:e,fileIndex:t}}function Pf(e){return e.turnId}function Ff(e){return typeof e==`number`}function If(e){return Tr(e)}function Lf(e){return P(e)}function Rf(){return new Id}function zf(){return new Set}function Bf(e){let t=(0,Y.c)(18),{environmentId:n,cwd:r,enabled:i}=e,a=Ar.keyOf(e),o,s;t[0]!==r||t[1]!==i||t[2]!==n?(o=()=>Ar.watch({environmentId:n,cwd:r,...i===void 0?{}:{enabled:i}}),s=[n,r,i],t[0]=r,t[1]=i,t[2]=n,t[3]=o,t[4]=s):(o=t[3],s=t[4]),(0,J.useEffect)(o,s);let c=z(Ar.getAtom(a)),l;bb0:{if(!c.data){l=null;break bb0}let e=c.data,n;t[5]===c.data.entries?n=t[6]:(n=c.data.entries.toSorted(Hf),t[5]=c.data.entries,t[6]=n);let r;t[7]!==c.data||t[8]!==n?(r={...e,entries:n},t[7]=c.data,t[8]=n,t[9]=r):r=t[9],l=r}let u=l,d;t[10]===a?d=t[11]:(d=async()=>{let e=await Ar.refreshAsync(a);return{data:e.data===null?null:{...e.data,entries:e.data.entries.toSorted(Vf)}}},t[10]=a,t[11]=d);let f=d,p;return t[12]!==f||t[13]!==u||t[14]!==c.error||t[15]!==c.isFetching||t[16]!==c.isLoading?(p={data:u,isLoading:c.isLoading,isFetching:c.isFetching,error:c.error,refetch:f},t[12]=f,t[13]=u,t[14]=c.error,t[15]=c.isFetching,t[16]=c.isLoading,t[17]=p):p=t[17],p}function Vf(e,t){return e.path.localeCompare(t.path,void 0,{numeric:!0,sensitivity:`base`})}function Hf(e,t){return e.path.localeCompare(t.path,void 0,{numeric:!0,sensitivity:`base`})}function Uf(e){let t=(0,Y.c)(14),{environmentId:n,cwd:r,relativePath:i,enabled:a}=e,o=Vr.keyOf(e),s,c;t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==i?(s=()=>Vr.watch({environmentId:n,cwd:r,relativePath:i,...a===void 0?{}:{enabled:a}}),c=[n,r,i,a],t[0]=r,t[1]=a,t[2]=n,t[3]=i,t[4]=s,t[5]=c):(s=t[4],c=t[5]),(0,J.useEffect)(s,c);let l=z(Vr.getAtom(o)),u;t[6]===o?u=t[7]:(u=async()=>({data:(await Vr.refreshAsync(o)).data}),t[6]=o,t[7]=u);let d=u,f;return t[8]!==d||t[9]!==l.data||t[10]!==l.error||t[11]!==l.isFetching||t[12]!==l.isLoading?(f={data:l.data,isLoading:l.isLoading,isFetching:l.isFetching,error:l.error,refetch:d},t[8]=d,t[9]=l.data,t[10]=l.error,t[11]=l.isFetching,t[12]=l.isLoading,t[13]=f):f=t[13],f}var Wf={},Gf=(0,J.memo)(function(e){let t=(0,Y.c)(22),{files:n,allDirectoriesExpanded:r,onSelectFile:i,resolvedTheme:a,selectedFilePath:o,showStats:s}=e,c=o===void 0?null:o,l=s===void 0||s,u;t[0]===n?u=t[1]:(u=Yt(n),t[0]=n,t[1]=u);let d=u,f;t[2]===d?f=t[3]:(f=Kf(d).join(`\0`),t[2]=d,t[3]=f);let p=`${r?`expanded`:`collapsed`}\u0000${f}`,m;t[4]===p?m=t[5]:(m=()=>({key:p,overrides:{}}),t[4]=p,t[5]=m);let[h,g]=(0,J.useState)(m),_=h.key===p?h.overrides:Wf,v;t[6]!==r||t[7]!==p?(v=e=>{g(t=>{let n=t.key===p?t.overrides:{};return{key:p,overrides:{...n,[e]:!(n[e]??r)}}})},t[6]=r,t[7]=p,t[8]=v):v=t[8];let y=v,b,x;if(t[9]!==r||t[10]!==_||t[11]!==i||t[12]!==a||t[13]!==c||t[14]!==l||t[15]!==y||t[16]!==d){let e=(t,n)=>{let o=8+n*14;if(t.kind===`directory`){let i=_[t.path]??r;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{type:`button`,"data-scroll-anchor-ignore":!0,className:`group/tree-row flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left hover:bg-background/80 phone:min-h-11`,style:{paddingLeft:`${o}px`},onClick:()=>y(t.path),children:[(0,X.jsx)(Yn,{"aria-hidden":`true`,className:L(`size-3.5 shrink-0 text-muted-foreground/70 transition-transform`,i&&`rotate-90`)}),i?(0,X.jsx)(ze,{className:`size-3.5 shrink-0 text-muted-foreground/75`}):(0,X.jsx)($n,{className:`size-3.5 shrink-0 text-muted-foreground/75`}),(0,X.jsx)(`span`,{"data-tree-label":!0,className:`truncate font-mono text-[11px] text-muted-foreground/90 group-hover/tree-row:text-foreground/90`,children:t.name}),l&&Ln(t.stat)&&(0,X.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums`,children:(0,X.jsx)(An,{additions:t.stat.additions,deletions:t.stat.deletions})})]}),i&&(0,X.jsx)(`div`,{className:`space-y-0.5`,children:t.children.map(t=>e(t,n+1))})]},`dir:${t.path}`)}return(0,X.jsxs)(`button`,{type:`button`,className:L(`group/tree-row flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left hover:bg-background/80 phone:min-h-11`,c===t.path&&`bg-accent text-accent-foreground hover:bg-accent`),style:{paddingLeft:`${o}px`},onClick:()=>i(t.path),children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,X.jsx)(Ct,{pathValue:t.path,kind:`file`,theme:a,className:`size-3.5 text-muted-foreground/70`}),(0,X.jsx)(`span`,{"data-tree-label":!0,className:L(`truncate font-mono text-[11px] text-muted-foreground/80 group-hover/tree-row:text-foreground/90`,c===t.path&&`text-accent-foreground`),children:t.name}),l&&t.stat&&(0,X.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums`,children:(0,X.jsx)(An,{additions:t.stat.additions,deletions:t.stat.deletions})})]},`file:${t.path}`)};b=`space-y-0.5`,x=d.map(t=>e(t,0)),t[9]=r,t[10]=_,t[11]=i,t[12]=a,t[13]=c,t[14]=l,t[15]=y,t[16]=d,t[17]=b,t[18]=x}else b=t[17],x=t[18];let S;return t[19]!==b||t[20]!==x?(S=(0,X.jsx)(`div`,{className:b,children:x}),t[19]=b,t[20]=x,t[21]=S):S=t[21],S});function Kf(e){let t=[];for(let n of e)n.kind===`directory`&&(t.push(n.path),t.push(...Kf(n.children)));return t}var qf=100,Jf=`insert`,Yf=`backspace`,Xf=`delete`,Zf=class e{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??qf)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}getState(){return{undoStack:this.#e.map($f),redoStack:this.#t.map($f),maxEntries:this.#n,canCoalesce:this.#r}}getLiveState(){return Object.defineProperties({},{undoStack:{enumerable:!0,get:()=>this.#e},redoStack:{enumerable:!0,get:()=>this.#t},maxEntries:{enumerable:!0,get:()=>this.#n},canCoalesce:{enumerable:!0,get:()=>this.#r}})}static fromState(t){let n=new e({maxEntries:t.maxEntries});return n.#e=t.undoStack,n.#t=t.redoStack,n.#r=t.canCoalesce,n}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function Qf(e){return{...e,forwardEdits:e.forwardEdits.map(e=>({...e})),inverseEdits:e.inverseEdits.map(e=>({...e})),selectionsBefore:e.selectionsBefore?.map(ep),selectionsAfter:e.selectionsAfter?.map(ep),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice()}}function $f(e){return{...Qf(e),lineAnnotationsBefore:e.lineAnnotationsBefore?.map(e=>({...e})),lineAnnotationsAfter:e.lineAnnotationsAfter?.map(e=>({...e}))}}function ep(e){return{...e,start:{...e.start},end:{...e.end}}}function tp(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?Yf:n?Xf:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function np(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=ap(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
1432
|
-
`)&&!a.text.includes(`
|
|
1433
|
-
`),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
|
|
1434
|
-
`)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=Jf,n!==Jf||e.coalescingMode!==void 0&&e.coalescingMode!==Jf||t.coalescingMode!==void 0&&t.coalescingMode!==Jf))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){let r;if(c===i.end)r=Xf;else if(c+(o.end-o.start)!==i.start)return!1;else r=Yf;if(n??=r,n!==r||e.coalescingMode!==void 0&&e.coalescingMode!==r||t.coalescingMode!==void 0&&t.coalescingMode!==r)return!1;continue}return!1}return n!==void 0}function rp(e,t){let n=[],r=[],i;for(let a=0;a<e.forwardEdits.length;a++){let o=e.forwardEdits[a],s=e.inverseEdits[a],c=t.forwardEdits[a],l=t.inverseEdits[a],u=ap(c.start,e.forwardEdits);if(o.text.length>0){i??=Jf,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text);continue}if(u===o.end){i??=Xf,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text);continue}i??=Yf,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text)}return{forwardEdits:n,inverseEdits:ip(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice(),coalescingMode:i}}function ip(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function ap(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;if(!(n<e.start)){if(n>=e.start+r){n-=i;continue}n=e.start+Math.min(n-e.start,t)}}return n}var op=1e5,sp=10,cp=13,lp=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,up=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},dp=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=Jt(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===sp||r===cp)&&(r===cp&&e.charCodeAt(n+1)===sp&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},fp=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!xp(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!xp(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},pp=class{#e;#t=new dp(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new dp(e);let t=this.#y(up.Original,0,e.length);this.#n=t.length>0?this.#C(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#g();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#f(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#f(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&mp(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=hp(e,0,this.#r),i=hp(t,r,this.#r);if(r>=i)return``;let a=this.#u(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#v(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&mp(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#d(s)}return o.join(``)}charAt(e){let t=this.#u(e);if(t===void 0)return``;let[n,r]=t;return this.#v(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=gp(e),n=0,r=!1;return this.#_(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=_p(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=gp(e),a=0,o=0,s,c;return this.#_(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!vp(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
|
|
1435
|
-
`)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=Ep(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,op)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=Jt(i);for(let s=0;s<o.length;s++){let c=o[s],l=o[s+1]??a;for(;l>c&&mp(i.charCodeAt(l-1));)l--;let u=i.slice(c,l);e.lastIndex=0;let d;for(;(d=e.exec(u))!==null;){let a=d.index,o=d[0];if(o.length===0){e.lastIndex=kp(u,a);continue}let s=c+a;if((!t||Tp(i,s,o.length))&&(r.push([s,s+o.length]),r.length>=n))return r;a===e.lastIndex&&(e.lastIndex=kp(u,a))}}return r}insert(e,t){if(e.length===0)return;let n=hp(t,0,this.#r);this.#b(n,n,e),this.#x()}delete(e,t){if(t<=0||this.#r===0)return;let n=hp(e,0,this.#r),r=hp(n+t,n,this.#r);n!==r&&(this.#b(n,r,``),this.#x())}applyEdits(e){if(e.length!==0){for(let t=e.length-1;t>=0;t--){let n=e[t],r=hp(n.start,0,this.#r),i=hp(n.end,r,this.#r);this.#b(r,i,n.text)}this.#x()}}positionAt(e){let t=hp(e,0,this.#r);if(this.#r===0)return{line:0,character:0};let n=this.#p(t),r=t-(n===0?0:this.#m(n-1));return this.#s=[n,r,t],{line:n,character:r}}positionsAt(e){let t=Array.from({length:e.length});if(e.length===0)return t;if(this.#r===0)return t.fill({line:0,character:0});for(let n=0;n<e.length;n++)t[n]=this.positionAt(e[n]);return t}offsetAt(e){if(e.line<0||this.#r===0)return 0;if(e.line>=this.#i)throw Error(`Line index out of range: ${e.line}`);let t=this.#s;if(t!==null&&t[0]===e.line&&t[1]===e.character)return t[2];let n=this.#f(e.line);if(n===void 0)throw Error(`Line index out of range: ${e.line}`);let r=hp(e.character,0,n[1]-n[0]);return n[0]+r}#u(e){if(e<0||e>=this.#r)return;let t=this.#n,n=e;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(n-=e,n<t.piece.length)return[t,n];n-=t.piece.length,t=t.right}}#d(e){if(e.right!==null){let t=e.right;for(;t.left!==null;)t=t.left;return t}let t=e;for(;t.parent!==null&&t===t.parent.right;)t=t.parent;return t.parent}#f(e){if(e<0)throw Error(`Line index out of range: ${e}`);if(this.#r===0){if(e===0)return[0,0];throw Error(`Line index out of range: ${e}`)}if(e>=this.#i)throw Error(`Line index out of range: ${e}`);return[e===0?0:this.#m(e-1),e<this.#i-1?this.#m(e):this.#r]}#p(e){let t=this.#n,n=hp(e,0,this.#r),r=0;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(r+=(t.left?.subtreeLineBreakCount??0)-+!!xp(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#v(t.piece.source),i=Math.min(Sp(e.lineOffsets,t.piece.offset+n),t.piece.lineOffsetEnd);return r+=i-t.piece.lineOffsetStart,n===t.piece.length&&t.piece.hasVirtualTrailingCRBreak&&r++,n===t.piece.length&&xp(t.piece.lastCharCode,this.#d(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!xp(t.piece.lastCharCode,t.right?.subtreeFirstCharCode),n-=t.piece.length,t=t.right}return this.#i-1}#m(e){let t=this.#n,n=e,r=0,i;for(;t!==null;){let e=(t.left?.subtreeLineBreakCount??0)-+!!xp(t.left?.subtreeLastCharCode,t.piece.firstCharCode);if(n<e){i=t.piece.firstCharCode,t=t.left;continue}let a=t.left?.subtreeLength??0;r+=a,n-=e;let o=t.right?.subtreeFirstCharCode??i,s=t.piece.lineBreakCount-+!!xp(t.piece.lastCharCode,o);if(n<s)return r+this.#h(t.piece,n);r+=t.piece.length,n-=s,t=t.right}return this.#r}#h(e,t){return t<e.lineOffsetEnd-e.lineOffsetStart?this.#v(e.source).lineOffsets[e.lineOffsetStart+t]-e.offset:e.length}#g(){let e=[];return this.#_(t=>{e.push(t.text.slice(t.start,t.end))}),e.join(``)}#_(e){this.#j(this.#n,t=>{let n=this.#v(t.piece.source);return e({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:t.piece.lineOffsetStart,lineOffsetEnd:t.piece.lineOffsetEnd,start:t.piece.offset,end:t.piece.offset+t.piece.length})})}#v(e){return e===up.Original?this.#e:this.#t}#y(e,t,n){let r=this.#v(e),i=t+n,a=Sp(r.lineOffsets,t),o=Sp(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new up(e,t,n,a,o,s===cp&&r.lineOffsets[o-1]!==i,r.text.charCodeAt(t),s)}#b(e,t,n){if(e===t&&n.length===0)return;let[r,i]=this.#E(this.#n,e),a=this.#D(i,t-e),o;if(n.length>0){let e=this.#y(up.Added,this.#t.append(n),n.length);o=this.#O(this.#k(r,e),a)}else{let[e,t]=this.#A(a);o=e===void 0?r:this.#O(this.#k(r,e),t)}o!==null&&(o.parent=null),this.#n=o,this.#r=o?.subtreeLength??0,this.#i=(o?.subtreeLineBreakCount??0)+1}#x(){this.#a=null,this.#o=null,this.#s=null}#S(){return this.#c=Math.imul(this.#c,1664525)+1013904223>>>0,this.#c}#C(e){let t=new fp(e);return t.priority=this.#S(),t}#w(e,t){e.left=t,t!==null&&(t.parent=e)}#T(e,t){e.right=t,t!==null&&(t.parent=e)}#E(e,t){if(e===null)return[null,null];if(t<=0)return[null,e];if(t>=e.subtreeLength)return[e,null];let n=e.left?.subtreeLength??0;if(t<=n){let[n,r]=this.#E(e.left,t);return this.#w(e,r),e.updateSubtreeLength(),[n,e]}let r=e.piece.length;if(t>=n+r){let[i,a]=this.#E(e.right,t-n-r);return this.#T(e,i),e.updateSubtreeLength(),[e,a]}let i=t-n,a=new fp(this.#y(e.piece.source,e.piece.offset,i)),o=new fp(this.#y(e.piece.source,e.piece.offset+i,r-i));return a.priority=e.priority,o.priority=e.priority,this.#w(a,e.left),this.#T(o,e.right),a.updateSubtreeLength(),o.updateSubtreeLength(),[a,o]}#D(e,t){if(e===null||t>=e.subtreeLength)return null;if(t<=0)return e;let n=e.left?.subtreeLength??0;if(t<=n)return this.#w(e,this.#D(e.left,t)),e.updateSubtreeLength(),e;let r=n+e.piece.length;if(t>=r)return this.#D(e.right,t-r);let i=t-n,a=new fp(this.#y(e.piece.source,e.piece.offset+i,e.piece.length-i));return a.priority=e.priority,this.#T(a,e.right),a.updateSubtreeLength(),a}#O(e,t){return e===null?t:t===null?e:e.priority>=t.priority?(this.#T(e,this.#O(e.right,t)),e.updateSubtreeLength(),e):(this.#w(t,this.#O(e,t.left)),t.updateSubtreeLength(),t)}#k(e,t){if(e===null)return this.#C(t);let n=e;for(;n.right!==null;)n=n.right;if(yp(n.piece,t)){n.piece=bp(n.piece,t);for(let t=n;t!==null&&(t.updateSubtreeLength(),t!==e);)t=t.parent;return e}return this.#O(e,this.#C(t))}#A(e){if(e===null)return[void 0,null];if(e.left===null)return[e.piece,e.right];let[t,n]=this.#A(e.left);return this.#w(e,n),e.updateSubtreeLength(),[t,e]}#j(e,t){return e===null?!0:!this.#j(e.left,t)||t(e)===!1?!1:this.#j(e.right,t)}};function mp(e){return e===10||e===13}function hp(e,t,n){return Math.min(Math.max(e,t),n)}function gp(e){let t=Array.from({length:e.length}).fill(0),n=0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r);for(;n>0&&i!==e.charCodeAt(n);)n=t[n-1];i===e.charCodeAt(n)&&n++,t[r]=n}return t}function _p(e,t){let n=[];for(let[r,i]of e){let e=hp(r,0,t),a=hp(i,e,t);e<a&&n.push([e,a])}n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];if(t!==void 0&&e[0]<=t[1]){t[1]=Math.max(t[1],e[1]);continue}r.push(e)}return r}function vp(e,t,n){let r=0,i=e.length;for(;r<i;){let n=r+Math.floor((i-r)/2);e[n][1]<=t?r=n+1:i=n}let a=e[r];return a!==void 0&&a[0]<n}function yp(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!xp(e.lastCharCode,t.firstCharCode)}function bp(e,t){return new up(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function xp(e,t){return e===cp&&t===sp}function Sp(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2);e[i]<=t?n=i+1:r=i}return n}function Cp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function wp(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return lp.includes(t)}function Tp(e,t,n){let r=t<=0||wp(e.charCodeAt(t-1)),i=t+n>=e.length||wp(e.charCodeAt(t+n));return r&&i}function Ep(e,t,n){let r=t?e:Cp(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function Dp(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function Op(e,t,n,r,i,a){if(!r.regex)return r.replaceText;let o=e(i),s=n(o.line),c=i-t({line:o.line,character:0}),l;try{l=Ep(r.text,!0,r.caseSensitive)}catch{return r.replaceText}l.lastIndex=c;let u=l.exec(s);return u===null||u.index!==c||u[0].length!==a-i?r.replaceText:Dp(r.replaceText,u)}function kp(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}var Ap=new WeakMap;function jp(e){return Ap.get(e)}function Mp(e,t){Ap.set(e,t)}var Np=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new Zf,a){if(this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new pp(t),this.#i=i,a!=null)this.#a=a;else{let e=this.#r.getLineText(0,!0);this.#a=e.endsWith(`\r
|
|
1436
|
-
`)?`\r
|
|
1437
|
-
`:e.endsWith(`\r`)?`\r`:`
|
|
1438
|
-
`}}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#n}get lineCount(){return this.#r.lineCount}get eol(){return this.#a}get history(){return this.#i.getLiveState()}get canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}clearHistory(){this.#i.clear()}positionAt(e){return this.normalizePosition(this.#r.positionAt(e))}positionsAt(e){let t=this.#r.positionsAt(e);for(let e=0;e<t.length;e++)t[e]=this.normalizePosition(t[e]);return t}offsetAt(e){return this.#r.offsetAt(this.normalizePosition(e))}getText(e){return e===void 0?this.#r.getText():this.#r.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,t){return this.#r.getLineText(e,t)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,t){return this.#r.getLineLength(e,t)}charAt(e){return typeof e==`number`?this.#r.charAt(e):this.#r.charAt(this.offsetAt(e))}getTextSlice(e,t){return this.#r.getTextSlice(e,t)}findNextNonOverlappingSubstring(e,t){return this.#r.findNextNonOverlappingSubstring(e,t)}search(e){return this.#r.search(e)}applyEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(this.resolveEdits(e)),t,n,r,i)}resolveEdits(e){return e.map(e=>this.#c(e))}applyResolvedEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(e.map(e=>this.#l(e))),t,n,r,i)}#o(e,t,n,r,i){let a=tp(this,e,this.#n,this.#n+1,t?n:void 0,t?r:void 0);t&&i&&(a.undoBoundary=!0);let o=this.#i.peekUndoForCoalescing(),s=this.#f(e);return this.#n++,s.lineDelta===0&&np(o,a)?this.#i.replaceLastUndo(rp(o,a)):this.#i.push(a),Mp(s,{appliedEdits:a.forwardEdits,inverseEdits:a.inverseEdits}),s}setLastUndoSelectionsAfter(e){this.#i.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,t){this.#i.setLastUndoLineAnnotations(e,t)}undo(){let e=this.#i.popUndoToRedo();if(e===void 0)return;let t=this.#f(e.inverseEdits);if(t===void 0)return;Mp(t,{appliedEdits:e.inverseEdits,inverseEdits:e.forwardEdits}),this.#n=e.versionBefore;let n=e.selectionsBefore?.slice();return[t,n,e.lineAnnotationsBefore?.slice(),n===void 0?e.inverseEdits.map(e=>({...e})):void 0]}redo(){let e=this.#i.popRedoToUndo();if(e===void 0)return;let t=this.#f(e.forwardEdits);if(t===void 0)return;Mp(t,{appliedEdits:e.forwardEdits,inverseEdits:e.inverseEdits}),this.#n=e.versionAfter;let n=e.selectionsAfter?.slice();return[t,n,e.lineAnnotationsAfter?.slice(),n===void 0?e.forwardEdits.map(e=>({...e})):void 0]}normalizePosition(t){let n=e.#s(t.line,this.lineCount-1);return{line:n,character:e.#s(t.character,this.getLineLength(n))}}static#s(e,t){return Number.isNaN(e)?0:Math.max(0,Math.min(Math.floor(e),t))}#c(e){let t=this.offsetAt(e.range.start),n=this.offsetAt(e.range.end);if(t>n){let e=t;t=n,n=e}return this.#l({start:t,end:n,text:e.newText})}#l(e){let{start:t,end:n}=e,r=t===n;return this.#u(t)&&t--,r?n=t:this.#u(n)&&n++,{start:t,end:n,text:e.text}}#u(e){let t=this.#r.charAt(e-1).charCodeAt(0),n=this.#r.charAt(e).charCodeAt(0);return t>=55296&&t<=56319&&n>=56320&&n<=57343}#d(e){let t=[...e].sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<t.length-1;e++)if(t[e].end>t[e+1].start)throw Error(`Overlapping text edits are not supported`);return t}#f(e){let t=this.#r.lineCount,n=this.positionsAt(e.flatMap(e=>[e.start,e.end])),r=this.#p(e,n),i=n[0],a=n[n.length-1],o=a.line===t-1&&a.character===this.#r.getLineLength(a.line);this.#r.applyEdits(e);let s=this.#r.lineCount;return{changes:e.map((e,t)=>({...e,range:{start:n[t*2],end:n[t*2+1]}})),startLine:r.startLine,startCharacter:i.character,endCharacter:a.character,endLine:Math.min(r.endLine,Math.max(0,s-1)),endedAtDocumentEnd:o,previousLineCount:t,lineCount:s,lineDelta:s-t,changedLineRanges:r.ranges,changedLineChanges:r.changes}}#p(e,t){let n=1/0,r=0,i=0,a=[],o=[],s=this.#r.lineCount-1,c=this.#r.getLineLength(s);for(let l=0;l<e.length;l++){let u=e[l],d=t[l*2],f=t[l*2+1],p=d.line,m=f.line,h=yn(u.text),g=p+i,_=g+h,v=h-(m-p);n=Math.min(n,p),r=Math.max(r,_);let y=a[a.length-1];y!==void 0&&g<=y[1]+1?a[a.length-1]=[y[0],Math.max(y[1],_)]:a.push([g,_]),o.push([g,_,v,d.character,f.character,m===s&&f.character===c]),i+=v}return n===1/0?{startLine:0,endLine:0,ranges:[[0,0]],changes:[[0,0,0,0,0,!1]]}:{startLine:n,endLine:r,ranges:a,changes:o}}},Pp=e(jt(),1),Fp=100,Ip=class{type;#e=new Pp.default.LRUMap(Fp);#t=new Map;constructor(e){this.type=e}activate(e,t,n){let r=this.#t.get(e);if(r!=null&&r.owner!==t)throw Error(`Editor: editStateKey "${e}" is already attached to another editor`);if(r!=null)return n!=null&&(r.session=n),r.session;let i=this.#e.delete(e),a={type:this.type},o=n??i??a;return this.#t.set(e,{owner:t,session:o}),o}release(e,t,n=!1){let r=this.#t.get(e);if(r?.owner!==t||(this.#t.delete(e),n))return;let i=zp(r.session);i!=null&&this.#e.set(e,i)}get(e){let t=this.#t.get(e);return t==null?this.#e.find(e):zp(t.session)??void 0}clear(e,t){if(this.#t.has(e))return!1;let n=this.#e.find(e);return n!=null&&(t==null||t.document===!0?this.#e.delete(e):Bp(n,t),!0)}clearAll(){this.#e.clear()}setCapacity(e){if(!Number.isSafeInteger(e)||e<1)throw RangeError(`EditStateManager: capacity must be a positive integer`);for(;this.#e.size>e;)this.#e.shift();this.#e.limit=e}},Lp=class{#e=new Ip(`file`);#t=new Ip(`file-diff`);activate(e,t,n,r){return e===`file`?this.#e.activate(t,n,r):this.#t.activate(t,n,r)}releaseFile(e,t,n=!1){this.#e.release(e,t,n)}releaseFileDiff(e,t,n=!1){this.#t.release(e,t,n)}get(e,t){return e===`file`?this.#e.get(t):this.#t.get(t)}clear(e,t,n){return e===`file`?this.#e.clear(t,n):this.#t.clear(t,n)}clearAll(){this.#e.clearAll(),this.#t.clearAll()}setCapacity(e){this.#e.setCapacity(e),this.#t.setCapacity(e)}};function Rp(e){return{selections:e.selections?.map(e=>({...e,start:{...e.start},end:{...e.end}})),view:e.view==null?void 0:{...e.view}}}function zp(e){if(e.document!=null&&e.fileInfo!=null&&(e.type===`file`||e.diffSession!=null))return e.editor??={},e}function Bp(e,t){e!=null&&(t.history===!0&&e.document?.clearHistory(),e.editor!=null&&((t.editor===!0||t.selections===!0)&&(e.editor.selections=void 0),(t.editor===!0||t.view===!0)&&(e.editor.view=void 0)))}var Vp=new Lp;function Hp({metaKey:e,ctrlKey:t},n=xo()){return n?e&&!t:t&&!e}function Up(e){if(xo()&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(Hp(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}var Wp=new WeakMap,Gp=qp([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]),Kp={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function qp(e){let t=Wp.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}Wp.set(e,t)}return t}function Jp(e,t,n=xo()){let r=e.key===` `?`Space`:e.key.length===1?e.key.toLowerCase():e.key,i=e.code??``,a=i.startsWith(`Key`)&&i.length===4?i.slice(3).toLowerCase():i.startsWith(`Digit`)&&i.length===6?i.slice(5):Kp[i],o=n?`mac`:globalThis.navigator?.platform.includes(`Linux`)===!0?`linux`:`windows`,s=+!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);if(t!==void 0){let e=qp(t)[o].get(s),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let c=Gp[o].get(s);return c?.get(r)??(a===void 0?void 0:c?.get(a))}function Yp(e,t=xo()){if(!e.altKey&&Hp(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}function Z(e,t,n){let{style:r,dataset:i,children:a,...o}=t??{},s=document.createElement(e);return Object.assign(s,o),r!==void 0&&(typeof r==`string`?s.style.cssText=r:Object.assign(s.style,r)),i!==void 0&&(typeof i==`string`?s.dataset[i]=``:Array.isArray(i)?i.forEach(e=>{s.dataset[e]=``}):Object.assign(s.dataset,i)),a!==void 0&&s.replaceChildren(...a),n!==void 0&&n.appendChild(s),s}function Q(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Xp(e,t=`line`){let n=e.dataset[t];if(n===void 0)return;let r=parseInt(n,10);if(!Number.isNaN(r))return r}function Zp(e,t){if(e.nodeType===3){let n=e.textContent?.length??0;return Math.max(0,Math.min(t,n))}return e.nodeType===1?Math.max(0,Math.min(t,e.childNodes.length)):0}function Qp(e,t){return Object.assign(e,t)}function $p(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function em(e,t=1e3){return Math.round(e*t)/t}function tm(e){return e.endsWith(`
|
|
1439
|
-
`)||e.endsWith(`\r`)}function nm(e){if(!(typeof Intl>`u`||typeof Intl.Segmenter!=`function`))return new Intl.Segmenter(void 0,e)}var rm,im=!1;function am(){return im||=(rm=nm({granularity:`grapheme`}),!0),rm}function om(e){let t=e.ownerDocument,n=e.parentElement;for(;n!=null&&n!==t.body&&n!==t.documentElement;){let e=n.ownerDocument.defaultView?.getComputedStyle(n).overflowY;if(e===`auto`||e===`scroll`||e===`overlay`)return n;n=n.parentElement}return t}var sm=class{#e;#t;#n;#r;#i;#a;#o=0;#s=0;#c=0;#l=!0;#u;#d=new Map;#f;#p;constructor(e){this.#f=e.hasActivePopover,this.#p=e.updateActivePopover}setViewportElements(e,t){let n=this.#e!==e||this.#t!==t;this.#e=e,n&&(this.#t=t,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#a=void 0,this.#o=0,this.#s=0,this.#c=0,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0,this.#d.clear()}resetPlacement(e=`default`){this.#d.delete(e)}setPlacement(e,t=`default`){this.#d.set(t,e)}choosePlacement(e){let{preferred:t,fallback:n,viewport:r,popoverHeight:i,atDocumentEdge:a,placementKey:o=`default`}=e,s=this.#d.get(o),c;if(r!==void 0&&i>0){let e=(e,t=0)=>e.top>=r.top+t&&e.bottom<=r.bottom-t;c=s===`fallback`&&e(n)&&!e(t,4)||!e(t)&&e(n)?`fallback`:`preferred`}else c=a?`fallback`:`preferred`;return this.#d.set(o,c),c}getPlacementBounds(){let e=this.#g();if(e===void 0)return;let t=this.#_(),n,r;if(t===void 0?(n=0,r=window.innerHeight):(n=t.top,r=t.bottom),n=Math.max(n,e.top),r=Math.min(r,e.bottom),r<=n)return;let i=this.#o,a=this.#s,o=this.#c>0?this.#c:e.width,s=t===void 0?0:t.left,c=t===void 0?window.innerWidth:t.right,l=i,u=i+o,d=Math.max(l,s-e.left+i),f=Math.min(u,c-e.left+i);return{top:n-e.top+a,bottom:r-e.top+a,left:d,right:Math.max(d,f)}}#m(){let e=this.#e;if(e===void 0)return;if(this.#r===e&&(this.#n===void 0||this.#n.isConnected))return this.#n;let t=e.parentElement;for(;t!==null;){let n=getComputedStyle(t).overflowY;if(n===`auto`||n===`scroll`||n===`overlay`)return this.#n=t,this.#r=e,t;t=t.parentElement}this.#n=void 0,this.#r=e}#h(){if(!this.#l)return;this.#v();let e=this.#t;this.#i=e?.getBoundingClientRect(),this.#o=e?.scrollLeft??0,this.#s=e?.scrollTop??0,this.#c=e?.clientWidth??0,this.#a=this.#m()?.getBoundingClientRect(),this.#l=!1}#g(){return this.#h(),this.#i}#_(){return this.#h(),this.#a}#v(){if(this.#u!==void 0)return;let e,t=()=>{this.#l=!0,this.#f()&&e===void 0&&(e=requestAnimationFrame(()=>{e=void 0,this.#p()}))},n=this.#m(),r=this.#t;this.#u=[Q(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[Q(r,`scroll`,t,{passive:!0})],Q(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function cm(e,{gutterWidth:t,placeAbove:n,viewport:r,x:i,y:a}){if(e.style.setProperty(`--gutter-width`,t+`px`),e.style.setProperty(`--popover-x`,i+`px`),e.style.setProperty(`--popover-y`,a+`px`),e.style.setProperty(`--popover-y-shift`,n?`-100%`:`0px`),r===void 0){e.style.removeProperty(`--popover-viewport-left`),e.style.removeProperty(`--popover-viewport-right`),e.style.removeProperty(`--popover-viewport-top`),e.style.removeProperty(`--popover-viewport-bottom`);return}e.style.setProperty(`--popover-viewport-left`,r.left+`px`),e.style.setProperty(`--popover-viewport-right`,r.right+`px`),e.style.setProperty(`--popover-viewport-top`,r.top+`px`),e.style.setProperty(`--popover-viewport-bottom`,r.bottom+`px`)}function lm(e){return Ta(e)}function um(e,t){let n=dm(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(`side`in a&&a.side===`deletions`||a.lineNumber<=0){r.push(a);continue}let t=a.lineNumber-1,o=e.previousLineCount,s=!1;for(let e of n){let n=Math.max(1,o+e.lineDelta),r=fm(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||mm(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){if(c===a.lineNumber)r.push(a);else{let e={...a,lineNumber:c};ao(e,io(a)),r.push(e)}i=!0;continue}r.push(a)}return i?r:void 0}function dm(e){if(e.changedLineChanges!==void 0)return e.changedLineChanges.flatMap(([e,t,n,r=0,i=0,a=!1])=>{if(n===0)return[];let o=Math.max(0,t-e);return[{startLine:e,startCharacter:r,endLine:e+Math.max(0,o-n),deletesEndLine:n<0&&a,insertedLineBreaks:o,lineDelta:n}]});if(e.lineDelta===0)return e.changedLineRanges.flatMap(([e,t])=>{let n=t-e;return n<=0?[]:[{startLine:e,startCharacter:0,endLine:e,deletesEndLine:!1,insertedLineBreaks:n,lineDelta:n}]});let t=Math.max(0,-e.lineDelta),n=e.endedAtDocumentEnd&&e.startLine+t===e.previousLineCount-1;return[{startLine:e.startLine,startCharacter:e.startCharacter,endLine:e.startLine+t,deletesEndLine:n,insertedLineBreaks:Math.max(0,e.lineDelta),lineDelta:e.lineDelta}]}function fm(e,t,n){if(e<t.startLine)return e;if(e>t.endLine||t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)return e+t.lineDelta;if(t.startLine===t.endLine)return t.startCharacter===0?e+t.insertedLineBreaks:e;if(pm(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return hm(t.startLine+r,n)}function pm(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function mm(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function hm(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function gm(e,t,n,r=lm){let i=new Map,a=new Map;for(let t of e){let e=t.lineNumber;i.has(e)||i.set(e,[]),a.has(e)||a.set(e,[]),(`side`in t&&t.side===`deletions`?a:i).get(e).push(r(t))}let o=t.parentElement?.previousElementSibling,s,c;if(o!=null&&o instanceof HTMLElement&&o.dataset.deletions!==void 0)for(let e of o.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(c=t):s=t}_m(t,n),c!==void 0&&_m(c,s);let l=vm(i,t,n);if(c===void 0)return;let u=vm(a,c,s);requestAnimationFrame(()=>{ym(i,a,l,u)})}function _m(e,t){let n=[];for(let r=1;r<e.childElementCount;r++){let i=e.children[r];i.dataset.lineAnnotation!==void 0&&(n.push(i),t!==void 0&&n.push(t.children[r]))}for(let e of n)e.remove()}function vm(e,t,n){let r=new Map;for(let n of t.children){let t=Xp(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=Z(`div`,{dataset:{lineAnnotation:`0,`+(t-1)},children:[Z(`div`,{dataset:`annotationContent`,children:i.map(e=>Z(`slot`,{name:e}))})]});n.after(e),r.set(t,e)}}}if(n!==void 0)for(let t of n.children){let n=Xp(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=Z(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function ym(e,t,n,r){let i=new Map;for(let[t,n]of e.entries()){let e=r.get(t);if(n.length===0&&e!==void 0){let n=bm(e);n>0&&i.set(t,n)}}for(let[e,r]of t.entries()){let t=n.get(e);if(r.length===0&&t!==void 0){let n=bm(t);n>0&&i.set(e,n)}}xm(e,n,i),xm(t,r,i)}function bm(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function xm(e,t,n){for(let[r,i]of t.entries()){let t=e.get(r),a=n.get(r);t?.length===0&&a!==void 0&&i.style.setProperty(`--diffs-annotation-min-height`,`${a}px`)}}var Sm=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),Cm=new Set([`'`,`"`,"`"]),wm=new Set([`{`,`[`,`(`,`<`]);function Tm(e,t=0){let n=Ah(e.startContainer,e.startOffset),r=Ah(e.endContainer,e.endOffset);if(n!==null&&r!==null)return{start:n,end:r,direction:t}}function Em(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=i.line!==a.line,l=a.line;i.line<a.line&&a.character===0&&l--;for(let t=i.line;t<=l;t++){let l=e.getLineText(t);if(l===void 0||c&&l.trim().length===0)continue;let u=l.startsWith(` `)?` `:` `.repeat(n),d=0,f=u;if(r){if(l.startsWith(` `))d=1;else if(l.startsWith(` `)){let e=l.length-l.trimStart().length;d=Math.min(u.length,e)}if(d===0)continue;f=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:d}},newText:f});let p=f.length-d;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+p)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+p)}})}return[o,s]}function Dm(e,t,n,r={}){let i=e.lineCount;return t.map(t=>{let{line:a,character:o}=n===`up`||n===`left`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){let i=qm(t);a=i.line,o=i.character;let s=Am(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+Dh(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=Om(e,a,o,-1,r);t===void 0?a>0&&(a=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`)??a):(a=t.line,o=t.character)}else if(n===`down`){let t=Om(e,a,o,1,r);if(t!==void 0)a=t.line,o=t.character;else{let e=Math.max(i-1,0);a<e&&(a=r.resolveRenderableLine==null?a+1:Math.min(r.resolveRenderableLine(a+1,`down`)??a,e))}}else if(Km(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`){if(o>0)o=Ch(e,a,o,!1);else if(a>0){let t=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`);t!==void 0&&(a=t,o=e.getLineLength(a))}}else if(o<t)o=Ch(e,a,o,!0);else if(a<i-1){let e=r.resolveRenderableLine==null?a+1:r.resolveRenderableLine(a+1,`down`);e!==void 0&&(a=Math.min(e,i-1),o=0)}}let s={line:a,character:o};return{start:s,end:s,direction:0}})}function Om(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=Am(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=Mm(e,s,o,i);else{let a=t+r;if(a<0||a>=e.lineCount)return{line:t,character:n};let o=i.resolveRenderableLine==null?a:i.resolveRenderableLine(a,r<0?`up`:`down`);if(o===void 0)return{line:t,character:n};s=Math.min(o,e.lineCount-1);let l=jm(s,i);c=Mm(e,s,r<0?l-1:0,i)}let l=Math.max(0,n-a.start),u=c.start+l,d=c.index===c.count-1?u:Math.min(u,c.end),f=e.getLineText(s);return{line:s,character:d>f.length?d:km(f,d)}}function km(e,t){if(t<=0||t>=e.length)return t;let n=am();if(n!==void 0){for(let r of n.segment(e)){if(t<=r.index)return t;let e=r.index+r.segment.length;if(t<e)return e}return t}let r=0;for(let n of e){if(t<=r)return t;let e=r+n.length;if(t<e)return e;r=e}return t}function Am(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};for(let i=0;i+1<a.length;i++){let a=Mm(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return Mm(e,t,n<(a[0]??0)?0:a.length-2,r)}function jm(e,t){let n=t.getSoftLineOffsets?.(e);return n===void 0||n.length<2?1:n.length-1}function Mm(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};let o=a.length-1,s=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(i,a[s]??0));return{start:c,end:Math.max(c,Math.min(i,a[s+1]??i)),index:s,count:o}}function Nm(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=Dm(e,[{start:i,end:i,direction:0}],n,r);return $m(t,a)})}function Pm(e,t,n,r,i=2,a=!1){if(t[t.length-1]===void 0)return{nextSelections:[]};let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=s[(t.length-1)*2],l=s[(t.length-1)*2+1],u=[],d=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=u[u.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(d=!1),u.push(t)}d||u.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let f=kh(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=kh(e,{start:g.start,end:g.end,text:f.text},i),n=Eh(e,t.text,t.start);p.push({start:t.start,end:t.end,text:n});let r=[g.start+h+n.length,g.start+h+n.length];for(let e of g.indices)m[e]=r;h+=n.length-(t.end-t.start),g=void 0};for(let e of u){let t=Math.max(0,e.start+(f.start-c)),n=Math.max(t,e.end+(f.end-l));if(g!==void 0&&t<g.end){g.end=Math.max(g.end,n),g.indices.push(e.index);continue}_(),g={start:t,end:n,indices:[e.index]}}_();let v=e.applyResolvedEdits(p,!0,t,void 0,a),y=Oh(e,m.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(y),v!==void 0&&r!==void 0){let t=um(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function Fm(e,t){if(t.length!==e.length+2)return;let n=Sm.get(t[0]);if(n!==void 0&&t[t.length-1]===n&&t.slice(1,-1)===e)return 1}function Im(e,t,n,r){let i=t.start+n,a=i+r.length;if(t.end-t.start>0){let n=e.getTextSlice(t.start,t.end),a=Fm(n,r)??r.indexOf(n);if(a!==-1&&a+n.length<=r.length){let e=i+a;return[e,e+n.length]}}return[a,a]}function Lm(e,t,n,r,i=!1,a=`selection`){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=[],l=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=c[c.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(l=!1),c.push(t)}l||c.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let u=n.every(e=>e===``),d,f=Array.from({length:t.length});if(u){d=[];let e=!1;for(let t of c){if(f[t.index]=[t.end,t.end],t.start>=t.end)continue;e=!0;let n=d[d.length-1];n!==void 0&&t.start<n.end?d[d.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:d.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of c){let t=e.end,n=0,r=t;for(let e of d){if(t<=e.start)break;if(t>=e.end){n-=e.end-e.start;continue}r=e.start+n;break}r===t&&(r+=n),f[e.index]=[r,r]}}else{d=[];let t=0,r=-1;for(let i=0;i<c.length;i++){let o=c[i];if(o.start<r)throw Error(`Overlapping multi-selection edits are not supported`);r=o.end;let s=Eh(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=Im(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=Oh(e,f.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(m),p!==void 0&&r!==void 0){let t=um(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function Rm(e,t){return e===`never`?!1:e===`brackets`?wm.has(t):e!==`quotes`||Cm.has(t)}function zm(e,t,n,r){if(n.length!==1||t.length===0)return;let i=Sm.get(n);if(i===void 0||!Rm(r,n))return;let a=[];for(let r of t){if(Km(r))return;a.push(n+e.getText(r)+i)}return a}function Bm(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=wh(e,n);if(!Km(n)){i.push([t,a]);continue}let{line:o,character:s}=n.start,c=t,l=e.getLineText(o),u=l.length,d=c-s,f=Sh(l),p;if(s>0&&s<u){let e=xh(l,s,!1,f),t=xh(l,s,!0,f);p={start:d+e,end:d+t,text:l.slice(s,t)+l.slice(e,s)},i.push([d+t,d+t])}else if(s===u&&f.length>=2){let e=f[f.length-1],t=f[f.length-2];p={start:d+t,end:c,text:l.slice(e,u)+l.slice(t,e)},i.push([c,c])}else if(s===0&&o>0&&u>0){let t=o-1,n=e.getLineText(t),r=n.length,a=e.offsetAt({line:t,character:r}),s=r>0?xh(n,r,!1,Sh(n)):r,u=xh(l,0,!0,f),d=a-(r-s),m=l.slice(0,u)+e.getTextSlice(a,c)+n.slice(s,r);p={start:d,end:c+u,text:m};let h=d+m.length;i.push([h,h])}else{i.push([t,a]);continue}r.push(p)}if(r.length===0)return{nextSelections:t};r.sort((e,t)=>e.start-t.start);for(let e=1;e<r.length;e++)if(r[e].start<r[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let a=e.applyResolvedEdits(r,!0,t),o=Oh(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=um(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function Vm(e,t,n){let r=t.map(t=>{let n=Th(e,t);return{start:n.start,end:n.end,direction:0}});return Lm(e,r,r.map(()=>``),n)}function Hm(e,t,n,r){let i=t.map(t=>{if(!Km(t))return{start:t.start,end:t.end,direction:0};let r=qm(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return Lm(e,i,i.map(()=>``),r)}function Um(e,t,n){let r=t.map(t=>{let[n,r]=bh(e,t);return{start:n,end:r,direction:0}});return Lm(e,r,r.map(()=>``),n)}function Wm(e,t,n){if(!Km(t))return[t.start,t.end];let r=qm(t),{line:i,character:a}=r,o=e.getLineLength(i),s=e.lineCount;if(a=Math.min(a,o),n)return a<o?[{line:i,character:a},{line:i,character:Ch(e,i,a,!0)}]:i<s-1?[{line:i,character:o},{line:i+1,character:0}]:[r,r];if(a>0)return[{line:i,character:Ch(e,i,a,!1)},{line:i,character:a}];if(i>0){let t=e.getLineLength(i-1);return[{line:i-1,character:t},{line:i,character:0}]}return[r,r]}function Gm(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=Wm(e,t,n);if(!n&&Km(t)){let t=kh(e,{start:e.offsetAt(r),end:e.offsetAt(a),text:``},i);r=e.positionAt(t.start),a=e.positionAt(t.end)}return{start:r,end:a,direction:0}});return Lm(e,a,a.map(()=>``),r)}function Km(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function qm(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function Jm(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function Ym(e,t){let n=Km(e),r=Km(t);return n&&r?$(e.start,t.start)===0:n?$(t.start,e.start)<=0&&$(e.start,t.end)<=0:r?$(e.start,t.start)<=0&&$(t.start,e.end)<=0:$(e.start,t.end)<0&&$(t.start,e.end)<0}function $(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Xm(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function Zm(e,t){let n=0;for(let r of t){if(e<r.start)break;if(e>=r.end)n+=r.text.length-(r.end-r.start);else return r.start+n+r.text.length}return e+n}function Qm(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=Zm(a,r),c=Zm(o,r);return Xm(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function $m(e,t){let n=e.direction===-1?e.end:e.start,r=$(n,t.start),i=$(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=$(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function eh(e,t){let n=$(t.start,e.start)<0,r=$(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:$(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:$(e.start,t.end)===0?0:1}}function th(e,t){return nh(e.map(e=>eh(e,t)))}function nh(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=$(e.selection.start,t.selection.start);if(n!==0)return n;let r=$(e.selection.end,t.selection.end);return r===0?e.index-t.index:r}),n=[],r=t[0];for(let e of t.slice(1)){if(Ym(r.selection,e.selection)){let t=e.index>r.index?e:r,n=$(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=$(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&$(n,i)!==0&&(a=$(t.selection.start,n)===0?-1:1),r={index:t.index,selection:{direction:a,end:i,start:n}};continue}n.push(r),r=e}return n.push(r),n.sort((e,t)=>e.index-t.index).map(({selection:e})=>e)}function rh(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&$(e.start,e.end)!==0&&t--,{startLine:e.start.line,endLine:Math.max(e.start.line,t)}}).sort((e,t)=>{let n=e.startLine-t.startLine;return n===0?e.endLine-t.endLine:n}),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&e.startLine<=t.endLine+1?t.endLine=Math.max(t.endLine,e.endLine):n.push({...e})}return n}function ih(e,t,n,r){let i=e=>{let i=e.line+t;if(i>=n){let e=Math.max(0,n-1);return{line:e,character:r(e)}}return i<0?{line:0,character:0}:{line:i,character:e.character}};return{start:i(e.start),end:i(e.end),direction:e.direction}}function ah(e,t){if(t.length===0)return;let n=t.map(t=>Km(t)?vh(e,t):t),r=n.map(t=>e.getText(t)),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return $(e.start,r.start)!==0||$(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Xm(e,o,o+i.length);return[...n,s]}function oh(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function sh(e,t,n){let r=0;if(t){let t=e.lineCount-1;r=n===!0&&t>0&&e.getLineLength(t)===0?t-1:t}let i=t?e.getLineLength(r):0,a={line:r,character:i};return{start:a,end:a,direction:1}}function ch(e,t){if(Km(t)){let n=t.start.line;return{start:e.offsetAt({line:n,character:0}),end:n<e.lineCount-1?e.offsetAt({line:n+1,character:0}):e.offsetAt({line:n,character:e.getLineLength(n)})}}let n=e.offsetAt(t.start),r=e.offsetAt(t.end);return n<=r?{start:n,end:r}:{start:r,end:n}}function lh(e,t){return t.map(t=>ch(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function uh(e,t){return lh(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function dh(e,t){let n=lh(e,t),r=e.eol,i=``,a=-1;for(let t of n)if(!(t.end<=t.start)){if(t.start<=a){t.end>a&&(i+=e.getTextSlice(a,t.end),a=t.end);continue}i.length>0&&!tm(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end}return i}function fh(e,t){if(Km(t))return ph(e,t);let[n,r]=$(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function ph(e,t){let n=t.start.line,r=e.offsetAt({line:n,character:0}),i=e.offsetAt({line:n,character:e.getLineLength(n)});return n<e.lineCount-1?{start:r,end:e.offsetAt({line:n+1,character:0}),text:``}:n>0?{start:e.offsetAt({line:n-1,character:e.getLineLength(n-1)}),end:i,text:``}:{start:r,end:i,text:``}}function mh(e){let t=[];for(let{edit:n}of e){if(n.start>=n.end)continue;let e=t.at(-1);e!==void 0&&n.start<=e.end?t[t.length-1]={start:e.start,end:Math.max(e.end,n.end),text:``}:t.push(n)}return t}function hh(e,t){let n=Array.from({length:e.length}),r=0,i=0;for(let a of e){for(;r<t.length&&a.edit.start>t[r].end;){let e=t[r];i-=e.end-e.start,r++}let e=t[r];e!==void 0&&a.edit.start>=e.start&&a.edit.start<=e.end?n[a.index]=e.start+i:n[a.index]=a.edit.start+i}return n}function gh(e,t){let n=[...t.map((t,n)=>({index:n,edit:fh(e,t)}))].sort((e,t)=>{let n=e.edit.start-t.edit.start;if(n!==0)return n;let r=e.edit.end-t.edit.end;return r===0?e.index-t.index:r}),r=mh(n);return{text:dh(e,t),edits:r,nextSelectionOffsets:hh(n,r)}}function _h(e,t){let n=Math.max(0,t),r=jh(e),i=null;for(let e of r){i=e;let t=zh(e);if(n<=t+(e.textContent?.length??0)){let r=Mh(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=Mh(i,i.textContent?.length??0);return e===null?[i,0]:e}let a=0,o=null;for(let t of e.childNodes){if(t.nodeType===1&&t.tagName===`BR`)return[t,0];if(t.nodeType!==3)continue;o=t;let e=Bh(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,Bh(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,Bh(o.textContent,o.textContent?.length??0)]}function vh(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=yh(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function yh(e,t){let n=nm({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}function bh(e,t){if(!Km(t))return[t.start,t.end];let n=qm(t),{line:r,character:i}=n;if(i===0){if(r===0)return[n,n];let t=e.getLineLength(r-1);return[{line:r-1,character:t},{line:r,character:0}]}let a=e.getLineText(r),o=Sh(a),s=i,c;for(;s>0;){let e=xh(a,s,!1,o),t=a.slice(e,s),n=/\S/.test(t)?/\p{Alphabetic}|\p{Number}|_/u.test(t)?1:2:0;if(c!==void 0&&n!==c)break;(n!==0||s!==i)&&(c=n),s=e}return[{line:r,character:s},{line:r,character:i}]}function xh(e,t,n,r){if(n){for(let e of r)if(e>t)return e;return e.length}for(let e=r.length-1;e>=0;e--){let n=r[e];if(n<t)return n}return 0}function Sh(e){let t=[0],n=am();if(n!==void 0){for(let r of n.segment(e))r.index>0&&t.push(r.index);return t}let r=0;for(let n of e)r>0&&t.push(r),r+=n.length;return t}function Ch(e,t,n,r){let i=e.getLineLength(t);if(r){if(n>=i)return i;let r=e.offsetAt({line:t,character:0}),a=e.getTextSlice(r+n,r+i),o=am();if(o!==void 0){for(let e of o.segment(a))return n+e.segment.length;return i}for(let e of a)return n+e.length;return i}if(n<=0)return 0;let a=e.offsetAt({line:t,character:0}),o=e.getTextSlice(a,a+n),s=0,c=am();if(c!==void 0){for(let e of c.segment(o))s=e.index;return s}let l=0;for(let e of o)s=l,l+=e.length;return s}function wh(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(qm(t))]}function Th(e,t){if(!Km(t))return{start:t.start,end:t.end};let{line:n,character:r}=t.start,i=e.getLineText(n).length;return r<i?{start:{line:n,character:r},end:{line:n,character:i}}:n<e.lineCount-1?{start:{line:n,character:r},end:{line:n+1,character:0}}:{start:{line:n,character:r},end:{line:n,character:r}}}function Eh(e,t,n){if(t!==`
|
|
1440
|
-
`&&t!==`\r`&&t!==`\r
|
|
1441
|
-
`)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=Dh(i);return a===0?t:t+i.slice(0,a)}function Dh(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function Oh(e,t){let n=[];for(let[e,r]of t)n.push(Math.min(e,r),Math.max(e,r));let r=e.positionsAt(n);return t.map(([e,t],n)=>{let i=e===t?0:e<t?1:-1;return{start:r[n*2],end:r[n*2+1],direction:i}})}function kh(e,t,n){if(t.text!==``||t.start!==t.end-1)return t;let r=e.positionAt(t.end);if(r.character===0)return t;let i=e.getLineText(r.line),a=i.slice(0,r.character);if(/[^ \t]/.test(a)||i[r.character-1]===` `)return t;let o=Math.max(0,r.character-n),s=i.slice(o,r.character);return s.length===n&&/^ +$/.test(s)?{...t,start:t.end-s.length}:t}function Ah(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&Rh(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=Rh(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:Ih(e.parentElement)===null?{line:r,character:Fh(n,e)+Bh(e.textContent,t)}:{line:r,character:Lh(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=Lh(i.childNodes[n]);return{line:r,character:e}}if(i.tagName===`BR`)return{line:r,character:0};if(i.tagName===`SPAN`){if(t<i.childNodes.length){let e=i.childNodes[t];if(e?.nodeType===1){let t=zh(e);if(t!==void 0)return{line:r,character:t};let n=Ih(e),i=n===null?void 0:zh(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?Lh(i.childNodes[t-1]):Fh(n,i)}}return{line:r,character:Fh(n,i)}}return null}function jh(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(zh(e)!==void 0){t.push(e);continue}for(let n of e.childNodes)n.nodeType===1&&zh(n)!==void 0&&t.push(n)}}return t}function Mh(e,t){let n=Math.max(0,t),r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let t=e.container.childNodes[e.index];if(e.index++,t.nodeType===3){let e=Bh(t.textContent,t.textContent?.length??0);if(n<=e)return[t,n];n-=e}else t.nodeType===1&&r.push({container:t,index:0})}return null}function Nh(e,t){let n=0,r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let i=e.container.childNodes[e.index];if(i===t)return n;e.index++,i.nodeType===3?n+=Bh(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function Ph(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function Fh(e,t){if(t.parentElement===e){let n=0,r=Array.prototype.indexOf.call(e.childNodes,t);for(let t=0;t<r;t++)n=Lh(e.childNodes[t]);return n}for(let n of jh(e))if(Ph(n,t))return zh(n)+(t.nodeType===3?Nh(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&Rh(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=Lh(e.childNodes[r]);r=e}return n}function Ih(e){let t=e;for(;t!==null;){if(Rh(t)!==void 0)return null;if(zh(t)!==void 0)return t;t=t.parentElement}return null}function Lh(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=Ih(n);if(r===null)return 0;let i=zh(r);if(i===void 0)return 0;let a=t===void 0?Bh(e.textContent,e.textContent?.length??0):Bh(e.textContent,t);return i+Nh(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=zh(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,Lh(e));return i}function Rh(e){let{line:t,lineType:n}=e.dataset;if(t!==void 0&&n!==`change-deletion`){let e=parseInt(t,10);if(!Number.isNaN(e))return e-1}}function zh(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function Bh(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}var Vh=300,Hh=100,Uh=`marker-popover`,Wh=class{#e;#t=[];#n=0;#r;#i;#a;#o;#s;#c;#l;#u=!1;constructor(e){this.#e=e}get markers(){return this.#t}isPopoverVisible(){return this.#l!==void 0}updatePopoverPosition(){let e=this.#l,t=this.#r;if(e===void 0||t===void 0)return;let n=this.#t[e];if(n===void 0){this.removePopover();return}this.#_(t,n.start.line,n.start.character)}setMarkers(e,t){this.#n=t.lineCount,this.#t=e.map(e=>({...e,start:t.normalizePosition(e.start),end:t.normalizePosition(e.end)})),this.removePopover()}listenHover(e){this.#a?.forEach(e=>e()),this.#a=void 0,this.#t.length!==0&&(this.#a=[Q(e,`mouseover`,e=>{if(this.#e.isMouseDown())return;let t=e.composedPath()[0];if(t===void 0)return;let n=this.#d(t);n===void 0?(this.#f(),this.#h()):this.#m(n)}),Q(e,`mouseleave`,()=>{this.#f(),this.#h()})])}removePopover(){this.#f(),this.#p(),this.#v()}cleanup(){this.#a?.forEach(e=>e()),this.#a=void 0,this.removePopover(),this.#t=[]}#d(e){let t=e.closest(`[data-line]`);if(t==null)return;let n=Xp(t);if(n===void 0)return;let r;if(e.tagName===`SPAN`){let t=e.dataset.char;if(t===void 0||(r=parseInt(t,10),Number.isNaN(r)))return}else if(e.tagName===`BR`)r=0;else return;let i={line:n-1,character:r};for(let e=this.#t.length-1;e>=0;e--)if(Ym({start:i,end:i},this.#t[e]))return e}#f(){this.#o!==void 0&&(clearTimeout(this.#o),this.#o=void 0),this.#c=void 0}#p(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0)}#m(e){if(e===this.#l||e===this.#c){this.#p();return}if(this.#f(),this.#p(),this.#r!==void 0){this.#y(e);return}this.#c=e,this.#o=setTimeout(()=>{this.#o=void 0,this.#c=void 0,this.#y(e)},Vh)}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopover()},Hh))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){cm(e,{gutterWidth:this.#e.getGutterWidth(),placeAbove:r,viewport:i,x:t,y:n})}#_(e,t,n){let{getCharX:r,getLineY:i,getLineHeight:a,popoverManager:o}=this.#e,[s,c]=r(t,n),l=a(),u=i(t)+c*l,d=e.offsetHeight,f={top:u+l,bottom:u+l+d},p={top:u-d,bottom:u},m=t>=this.#n-3,h=o.getPlacementBounds(),g=o.choosePlacement({preferred:f,fallback:p,viewport:h,popoverHeight:d,atDocumentEdge:m,placementKey:Uh})===`fallback`;this.#g(e,s,g?u:u+l,g,h)}#v(){this.#i?.forEach(e=>e()),this.#i=void 0,this.#r?.remove(),this.#r=void 0,this.#l=void 0,this.#u=!1,this.#e.popoverManager.resetPlacement(Uh)}#y(e){if(e===this.#l)return;let t=this.#e.getOverlayElement();if(e>=this.#t.length||t==null)return;let{start:n,message:r,severity:i}=this.#t[e],{line:a,character:o}=n,s=this.#r;if(this.#e.popoverManager.resetPlacement(Uh),s!==void 0){Kh(s,i);let t=s.firstElementChild;t?.dataset.markerMessage!==void 0&&(typeof r==`string`?t.textContent=r:r instanceof HTMLElement?t.replaceChildren(r):t.innerHTML=r.html),this.#_(s,a,o),this.#l=e;return}this.#r=Z(`div`,{dataset:{editorWidget:``,markerPopover:``,[qh(i)]:``},children:[Z(`div`,{dataset:`markerMessage`,...typeof r==`string`?{textContent:r}:r instanceof HTMLElement?{children:[r]}:{innerHTML:r.html}})]},t),this.#_(this.#r,a,o),this.#l=e,this.#i=[Q(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),Q(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},Gh=[`error`,`warning`,`info`,`hint`];function Kh(e,t){for(let t of Gh)delete e.dataset[qh(t)];e.dataset[qh(t)]=``}function qh(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}function Jh(e){return{...e,oldFile:e.oldFile==null?null:{...e.oldFile,lines:[...e.oldFile.lines]},hunks:Io(e.hunks)}}var Yh=`::selection {
|
|
1442
|
-
background-color: #0000;
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
[data-deleted-text-selection] [data-deletions] ::selection, [data-deleted-text-selection] [data-line-type="change-deletion"] ::selection {
|
|
1446
|
-
background-color: var(--diffs-editor-selection-bg);
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
@keyframes blinking {
|
|
1450
|
-
0% {
|
|
1451
|
-
opacity: 1;
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
50% {
|
|
1455
|
-
opacity: 0;
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
100% {
|
|
1459
|
-
opacity: 1;
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
:host, [data-code], [data-content], [data-diff-type="split"][data-overflow="wrap"] {
|
|
1464
|
-
position: relative;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
[data-code] {
|
|
1468
|
-
container-type: inline-size;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
[data-content] {
|
|
1472
|
-
cursor: text;
|
|
1473
|
-
caret-color: var(--diffs-bg-caret);
|
|
1474
|
-
background-color: #0000;
|
|
1475
|
-
outline: none;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
[data-line] {
|
|
1479
|
-
cursor: text;
|
|
1480
|
-
background-color: #0000;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
[data-line]:after {
|
|
1484
|
-
content: "";
|
|
1485
|
-
z-index: -20;
|
|
1486
|
-
background-color: var(--diffs-line-bg);
|
|
1487
|
-
pointer-events: none;
|
|
1488
|
-
position: absolute;
|
|
1489
|
-
inset: 0;
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
[data-line][data-editor-active-line]:after {
|
|
1493
|
-
box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
[data-editor-overlay] {
|
|
1497
|
-
display: contents;
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
[data-caret], [data-edit-prediction], [data-selection-range], [data-match-range], [data-bracket-match-range], [data-edit-prediction-deletion-range], [data-edit-prediction-insertion-range], [data-edit-prediction-replacement-range], [data-marker-range], [data-remote-caret], [data-caret-highlight-range] {
|
|
1501
|
-
height: 1lh;
|
|
1502
|
-
line-height: var(--diffs-line-height);
|
|
1503
|
-
pointer-events: none;
|
|
1504
|
-
position: absolute;
|
|
1505
|
-
top: 0;
|
|
1506
|
-
left: 0;
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
[data-edit-prediction] {
|
|
1510
|
-
z-index: 1;
|
|
1511
|
-
user-select: none;
|
|
1512
|
-
width: max-content;
|
|
1513
|
-
height: auto;
|
|
1514
|
-
color: var(--diffs-editor-edit-prediction-fg, color-mix(in lab, var(--diffs-fg) 45%, transparent));
|
|
1515
|
-
overflow: visible;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
[data-edit-prediction-line] {
|
|
1519
|
-
box-sizing: border-box;
|
|
1520
|
-
white-space: pre;
|
|
1521
|
-
width: max-content;
|
|
1522
|
-
min-height: 1lh;
|
|
1523
|
-
display: block;
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
[data-edit-prediction][data-replacement] [data-edit-prediction-line], [data-edit-prediction-insertion-range], [data-edit-prediction-replacement-range] {
|
|
1527
|
-
background-color: var(--diffs-edit-prediction-bg, var(--diffs-bg));
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
[data-edit-prediction-suffix] {
|
|
1531
|
-
color: var(--diffs-fg);
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
[data-edit-prediction][data-wrap] [data-edit-prediction-line] {
|
|
1535
|
-
overflow-wrap: anywhere;
|
|
1536
|
-
white-space: pre-wrap;
|
|
1537
|
-
max-width: 100%;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
[data-edit-prediction-line][data-empty]:after {
|
|
1541
|
-
content: "↵";
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
[data-edit-prediction-spacer] {
|
|
1545
|
-
margin-block-end: var(--diffs-edit-prediction-spacer-height);
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
[data-code][data-deletions] [data-edit-prediction-spacer] {
|
|
1549
|
-
box-sizing: content-box;
|
|
1550
|
-
margin-block-end: 0;
|
|
1551
|
-
padding-block-end: var(--diffs-edit-prediction-spacer-height);
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
[data-edit-prediction-deletion-range] {
|
|
1555
|
-
--diffs-edit-prediction-deletion-color: var(--diffs-editor-edit-prediction-deletion-fg, color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));
|
|
1556
|
-
z-index: 1;
|
|
1557
|
-
background: linear-gradient(to bottom,
|
|
1558
|
-
transparent calc(50% - .5px),
|
|
1559
|
-
var(--diffs-edit-prediction-deletion-color) calc(50% - .5px),
|
|
1560
|
-
var(--diffs-edit-prediction-deletion-color) calc(50% + .5px),
|
|
1561
|
-
transparent calc(50% + .5px));
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
[data-edit-prediction-insertion-range] {
|
|
1565
|
-
z-index: 0;
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
|
-
[data-edit-prediction-replacement-range] {
|
|
1569
|
-
z-index: 1;
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
[data-caret] {
|
|
1573
|
-
z-index: 2;
|
|
1574
|
-
background-color: var(--diffs-bg-caret-override, var(--diffs-editor-cursor-fg, light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));
|
|
1575
|
-
visibility: hidden;
|
|
1576
|
-
width: 2px;
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
1580
|
-
[data-caret] {
|
|
1581
|
-
animation: 1.2s .8s infinite blinking;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
[data-selection-range] {
|
|
1586
|
-
z-index: -10;
|
|
1587
|
-
background-color: var(--diffs-editor-selection-bg);
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
[data-caret-highlight-range] {
|
|
1591
|
-
z-index: -10;
|
|
1592
|
-
background-color: var(--diffs-caret-highlight-bg, var(--diffs-editor-selection-bg));
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
[data-selection-corner] {
|
|
1596
|
-
background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));
|
|
1597
|
-
width: 100%;
|
|
1598
|
-
height: 100%;
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
[data-match-range] {
|
|
1602
|
-
z-index: -10;
|
|
1603
|
-
background-color: var(--diffs-editor-match-bg, var(--diffs-editor-selection-bg));
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
[data-match-range]:not([data-focus]) {
|
|
1607
|
-
background-color: var(--diffs-editor-match-highlight-bg, light-dark(#ff963288, #ff963266));
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
[data-bracket-match-range] {
|
|
1611
|
-
z-index: -9;
|
|
1612
|
-
box-sizing: border-box;
|
|
1613
|
-
border-bottom: 1px solid
|
|
1614
|
-
var(--diffs-editor-bracket-match-border, color-mix(in lab, var(--diffs-fg) 60%, transparent));
|
|
1615
|
-
background-color: var(--diffs-editor-bracket-match-bg, color-mix(in lab, var(--diffs-fg) 5%, transparent));
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
[data-rtl] {
|
|
1619
|
-
border-top-left-radius: 3px;
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
[data-rtr] {
|
|
1623
|
-
border-top-right-radius: 3px;
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
[data-rbl] {
|
|
1627
|
-
border-bottom-left-radius: 3px;
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
[data-rbr] {
|
|
1631
|
-
border-bottom-right-radius: 3px;
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
[data-marker-range] {
|
|
1635
|
-
z-index: 1;
|
|
1636
|
-
background-color: var(--diffs-marker-bg);
|
|
1637
|
-
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+");
|
|
1638
|
-
mask-position: 0 100%;
|
|
1639
|
-
mask-size: 6px 3px;
|
|
1640
|
-
mask-repeat: repeat-x;
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
[data-marker-error] {
|
|
1644
|
-
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
1645
|
-
--diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
[data-marker-warning] {
|
|
1649
|
-
--diffs-marker-contrast: #000;
|
|
1650
|
-
--diffs-marker-bg: var(--diffs-editor-warning-fg, light-dark(var(--diffs-warning-light), var(--diffs-warning-dark)));
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
[data-marker-info] {
|
|
1654
|
-
--diffs-marker-contrast: #000;
|
|
1655
|
-
--diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
|
-
[data-marker-hint] {
|
|
1659
|
-
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
1660
|
-
--diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
@media (width >= 480px) {
|
|
1664
|
-
[data-content] {
|
|
1665
|
-
caret-color: #0000;
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
[data-content]:focus ~ [data-editor-overlay] [data-caret] {
|
|
1669
|
-
visibility: visible;
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
[data-editor-widget] {
|
|
1674
|
-
--diffs-widget-fg: var(--diffs-fg);
|
|
1675
|
-
--diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
|
|
1676
|
-
--diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
|
|
1677
|
-
--diffs-widget-shadow: inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013,
|
|
1678
|
-
0 6px 18px #00000013;
|
|
1679
|
-
z-index: 100;
|
|
1680
|
-
width: fit-content;
|
|
1681
|
-
max-width: calc(100% - 24px);
|
|
1682
|
-
font: 14px/20px var(--diffs-header-font-fallback);
|
|
1683
|
-
border: 1px solid var(--diffs-widget-border);
|
|
1684
|
-
background-color: var(--diffs-widget-bg);
|
|
1685
|
-
box-shadow: var(--diffs-widget-shadow);
|
|
1686
|
-
background-clip: padding-box;
|
|
1687
|
-
border-radius: 9px;
|
|
1688
|
-
position: absolute;
|
|
1689
|
-
top: 0;
|
|
1690
|
-
left: 0;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
[data-marker-popover], [data-selection-action-popover] {
|
|
1694
|
-
--popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));
|
|
1695
|
-
--popover-viewport-left: 0px;
|
|
1696
|
-
--popover-viewport-right: 100cqw;
|
|
1697
|
-
--popover-viewport-top: -99999px;
|
|
1698
|
-
--popover-viewport-bottom: 99999px;
|
|
1699
|
-
--popover-min-left: calc(var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap));
|
|
1700
|
-
--popover-available-width: max(0px,
|
|
1701
|
-
calc(var(--popover-viewport-right) - var(--popover-min-left) -
|
|
1702
|
-
var(--popover-gap)));
|
|
1703
|
-
max-width: min(640px, var(--popover-available-width));
|
|
1704
|
-
translate: clamp(var(--popover-min-left),
|
|
1705
|
-
var(--popover-x, var(--popover-min-left)),
|
|
1706
|
-
calc(var(--popover-viewport-right) - var(--popover-gap) - 100%))
|
|
1707
|
-
/* Clamp into the scrollport so a popover with no fitting side stays in view. */
|
|
1708
|
-
clamp(var(--popover-viewport-top),
|
|
1709
|
-
calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),
|
|
1710
|
-
calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%));
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
[data-marker-popover] {
|
|
1714
|
-
--diffs-widget-bg: var(--diffs-marker-bg);
|
|
1715
|
-
--diffs-widget-shadow: 0 4px 8px #00000026, 0 6px 18px #00000026;
|
|
1716
|
-
min-width: min(180px, var(--popover-available-width));
|
|
1717
|
-
overflow-wrap: anywhere;
|
|
1718
|
-
color: var(--diffs-marker-contrast);
|
|
1719
|
-
white-space: normal;
|
|
1720
|
-
pointer-events: auto;
|
|
1721
|
-
border: 0;
|
|
1722
|
-
padding: 8px 12px;
|
|
1723
|
-
|
|
1724
|
-
@supports (color: contrast-color(red)) {
|
|
1725
|
-
color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
& [data-marker-message] {
|
|
1729
|
-
white-space: normal;
|
|
1730
|
-
overflow-wrap: anywhere;
|
|
1731
|
-
|
|
1732
|
-
& code {
|
|
1733
|
-
white-space: normal;
|
|
1734
|
-
color: inherit;
|
|
1735
|
-
background-color: #0000;
|
|
1736
|
-
display: inline;
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
[data-selection-action-popover] {
|
|
1742
|
-
pointer-events: auto;
|
|
1743
|
-
flex-wrap: wrap;
|
|
1744
|
-
align-items: center;
|
|
1745
|
-
gap: 4px;
|
|
1746
|
-
width: max-content;
|
|
1747
|
-
padding: 4px;
|
|
1748
|
-
display: flex;
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
[data-search-panel] {
|
|
1752
|
-
z-index: 100;
|
|
1753
|
-
flex-direction: column;
|
|
1754
|
-
justify-content: right;
|
|
1755
|
-
width: 100%;
|
|
1756
|
-
height: 0;
|
|
1757
|
-
display: flex;
|
|
1758
|
-
position: sticky;
|
|
1759
|
-
top: 16px;
|
|
1760
|
-
right: 16px;
|
|
1761
|
-
container: search-panel / inline-size;
|
|
1762
|
-
|
|
1763
|
-
& [data-editor-widget] {
|
|
1764
|
-
z-index: 100;
|
|
1765
|
-
flex-shrink: 0;
|
|
1766
|
-
align-items: stretch;
|
|
1767
|
-
gap: 8px;
|
|
1768
|
-
min-width: 260px;
|
|
1769
|
-
max-width: 100%;
|
|
1770
|
-
margin-inline: auto 16px;
|
|
1771
|
-
padding: 4px;
|
|
1772
|
-
display: flex;
|
|
1773
|
-
position: relative;
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
& svg {
|
|
1777
|
-
fill: currentColor;
|
|
1778
|
-
width: 12px;
|
|
1779
|
-
height: 12px;
|
|
1780
|
-
display: block;
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
[data-search-grid] {
|
|
1785
|
-
grid-template-columns: auto auto auto;
|
|
1786
|
-
grid-template-areas: "find matches nav"
|
|
1787
|
-
"replace actions .";
|
|
1788
|
-
align-items: center;
|
|
1789
|
-
gap: 4px 6px;
|
|
1790
|
-
width: 100%;
|
|
1791
|
-
display: grid;
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
[data-input-box][data-find] {
|
|
1795
|
-
grid-area: find;
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
[data-search-nav] {
|
|
1799
|
-
grid-area: nav;
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
[data-input-box][data-replace] {
|
|
1803
|
-
grid-area: replace;
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
[data-replace-actions] {
|
|
1807
|
-
grid-area: actions;
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
[data-search-grid][data-mode="find"] {
|
|
1811
|
-
grid-template-areas: "find matches nav";
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
[data-search-grid][data-mode="find"] [data-replace-cell] {
|
|
1815
|
-
display: none;
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
@container search-panel (width < 400px) {
|
|
1819
|
-
[data-search-panel] [data-editor-widget] {
|
|
1820
|
-
padding: 10px;
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
[data-search-grid][data-mode="replace"] {
|
|
1824
|
-
grid-template-columns: auto 1fr auto;
|
|
1825
|
-
grid-template-areas: "find find find"
|
|
1826
|
-
"replace replace replace"
|
|
1827
|
-
"nav matches actions";
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
[data-search-grid][data-mode="find"] {
|
|
1831
|
-
grid-template-columns: auto 1fr auto;
|
|
1832
|
-
grid-template-areas: "find find find"
|
|
1833
|
-
"nav matches matches";
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
[data-replace-actions] {
|
|
1837
|
-
justify-self: end;
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
[data-search-grid] [data-input-box] {
|
|
1841
|
-
width: auto;
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
[data-input-box] {
|
|
1846
|
-
align-items: center;
|
|
1847
|
-
width: 200px;
|
|
1848
|
-
display: flex;
|
|
1849
|
-
position: relative;
|
|
1850
|
-
|
|
1851
|
-
& input {
|
|
1852
|
-
width: 100%;
|
|
1853
|
-
min-width: 0;
|
|
1854
|
-
color: var(--diffs-fg);
|
|
1855
|
-
background-color: var(--diffs-bg);
|
|
1856
|
-
border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));
|
|
1857
|
-
border-radius: 6px;
|
|
1858
|
-
outline: none;
|
|
1859
|
-
flex-grow: 1;
|
|
1860
|
-
padding-inline: 6px;
|
|
1861
|
-
font-size: 13px;
|
|
1862
|
-
line-height: 24px;
|
|
1863
|
-
|
|
1864
|
-
&::selection {
|
|
1865
|
-
background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
&:focus-visible {
|
|
1869
|
-
outline: 1px solid var(--diffs-modified-base);
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
&[data-find] input {
|
|
1874
|
-
padding-inline-end: 72px;
|
|
1875
|
-
}
|
|
1876
|
-
|
|
1877
|
-
& [data-search-icon] {
|
|
1878
|
-
--diffs-search-icon-size: 20px;
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
[data-search-toggles] {
|
|
1883
|
-
align-items: center;
|
|
1884
|
-
gap: 1px;
|
|
1885
|
-
display: flex;
|
|
1886
|
-
position: absolute;
|
|
1887
|
-
top: 50%;
|
|
1888
|
-
right: 4px;
|
|
1889
|
-
transform: translateY(-50%);
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
[data-matches] {
|
|
1893
|
-
white-space: nowrap;
|
|
1894
|
-
min-width: 50px;
|
|
1895
|
-
color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
|
|
1896
|
-
flex-shrink: 0;
|
|
1897
|
-
grid-area: matches;
|
|
1898
|
-
font-size: 12px;
|
|
1899
|
-
font-weight: 500;
|
|
1900
|
-
line-height: 20px;
|
|
1901
|
-
|
|
1902
|
-
&[data-no-matches] {
|
|
1903
|
-
color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
[data-replace-actions], [data-search-nav] {
|
|
1908
|
-
align-items: center;
|
|
1909
|
-
display: flex;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
[data-search-icon] {
|
|
1913
|
-
appearance: none;
|
|
1914
|
-
width: var(--diffs-search-icon-size, 24px);
|
|
1915
|
-
height: var(--diffs-search-icon-size, 24px);
|
|
1916
|
-
color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));
|
|
1917
|
-
border-radius: var(--diffs-search-icon-radius, 4px);
|
|
1918
|
-
cursor: pointer;
|
|
1919
|
-
background: none;
|
|
1920
|
-
border: 0;
|
|
1921
|
-
flex-shrink: 0;
|
|
1922
|
-
justify-content: center;
|
|
1923
|
-
align-items: center;
|
|
1924
|
-
margin: 0;
|
|
1925
|
-
padding: 0;
|
|
1926
|
-
transition: background-color .1s ease-in-out, color .1s ease-in-out;
|
|
1927
|
-
display: flex;
|
|
1928
|
-
|
|
1929
|
-
&:disabled {
|
|
1930
|
-
opacity: .25;
|
|
1931
|
-
cursor: default;
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
&:not(:disabled):hover {
|
|
1935
|
-
color: var(--diffs-fg);
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
&:focus-visible {
|
|
1939
|
-
outline: 1px solid var(--diffs-modified-base);
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
&[aria-pressed="true"] {
|
|
1943
|
-
color: var(--diffs-modified-base);
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
[data-search-close] {
|
|
1948
|
-
--diffs-search-icon-size: 20px;
|
|
1949
|
-
--diffs-search-icon-radius: 50%;
|
|
1950
|
-
color: var(--diffs-widget-bg);
|
|
1951
|
-
background-color: color-mix(in lab,
|
|
1952
|
-
var(--diffs-widget-fg) 50%,
|
|
1953
|
-
var(--diffs-bg));
|
|
1954
|
-
position: absolute;
|
|
1955
|
-
top: 0;
|
|
1956
|
-
right: 0;
|
|
1957
|
-
transform: translate(50%, -50%);
|
|
1958
|
-
|
|
1959
|
-
&:not(:disabled):hover {
|
|
1960
|
-
opacity: 1;
|
|
1961
|
-
color: var(--diffs-widget-bg);
|
|
1962
|
-
background-color: var(--diffs-widget-fg);
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
`,Xh=350,Zh=150,Qh=512,$h=662,eg=131072,tg=6144,ng=1e3,rg=8,ig=3,ag=[11,ig],og=new TextEncoder;function sg(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===13&&e.charCodeAt(n+1)===10&&n++,(e.charCodeAt(n)===10||e.charCodeAt(n)===13)&&t.push(n+1);return t}function cg(e,t){return e.length===0?0:t.at(-1)===e.length?t.length-1:t.length}function lg(e,t,n){let r=t[n+1];return r===void 0?e.length:r-(e.charCodeAt(r-1)===10&&e.charCodeAt(r-2)===13?2:1)}function ug(e,t,n,r,i,a){let o=t[n],s=i[a],c=lg(e,t,n)-o;if(c!==lg(r,i,a)-s)return!1;for(let t=0;t<c;t++)if(e.charCodeAt(o+t)!==r.charCodeAt(s+t))return!1;return!0}function dg(e,t,n,r){let i=cg(e,t),a=cg(n,r),o=0;for(;o<i&&o<a&&ug(e,t,o,n,r,o);)o++;let s=0;for(;s<i-o&&s<a-o&&ug(e,t,i-1-s,n,r,a-1-s);)s++;return{oldLineCount:i,newLineCount:a,prefixLines:o,suffixLines:s}}function fg(e,t,n,r=0){if(t===n)return;let i=sg(t),a=sg(n),o=dg(t,i,n,a);if(o.prefixLines===o.oldLineCount&&o.prefixLines===o.newLineCount)return;let s=o.oldLineCount-o.suffixLines,c=o.newLineCount-o.suffixLines,l=t.slice(i[o.prefixLines]??t.length,i[s]??t.length),u=n.slice(a[o.prefixLines]??n.length,a[c]??n.length);if(og.encode(l).byteLength>tg||og.encode(u).byteLength>tg)return;let d=Math.max(0,o.prefixLines-ig),f=Math.min(o.oldLineCount,s+ig),p=Math.min(o.newLineCount,c+ig),m=f-d,h=p-d,g=d+r,_=[`--- a/${e}`,`+++ b/${e}`,`@@ -${m===0?g:g+1},${m} +${h===0?g:g+1},${h} @@`];for(let e=d;e<o.prefixLines;e++)_.push(` ${t.slice(i[e],lg(t,i,e))}`);for(let e=o.prefixLines;e<s;e++)_.push(`-${t.slice(i[e],lg(t,i,e))}`);for(let e=o.prefixLines;e<c;e++)_.push(`+${n.slice(a[e],lg(n,a,e))}`);for(let e=s;e<f;e++)_.push(` ${t.slice(i[e],lg(t,i,e))}`);let v=_.join(`
|
|
1966
|
-
`);return og.encode(v).byteLength<=tg?{hunk:v,bounds:o}:void 0}function pg(e,t,n){let r=[],i=0;for(let a of n){let n=a.start-t,o=a.end-t;if(n<i||o<n||o>e.length)return;r.push(e.slice(i,n),a.text),i=o}return r.push(e.slice(i)),r.join(``)}function mg(e,t){let n=t.inverseEdits;if(n.length===0)return;let r=n[0].start,i=n[0].end;for(let e=1;e<n.length;e++)r=Math.min(r,n[e].start),i=Math.max(i,n[e].end);let[a,o]=e.positionsAt([r,i]);for(let t of ag){let r=Math.max(0,a.line-t),i=Math.min(e.lineCount-1,o.line+t),s=e.offsetAt({line:r,character:0}),c=i+1<e.lineCount?e.offsetAt({line:i+1,character:0}):e.offsetAt({line:i,character:e.getLineLength(i)});if(c-s>tg)continue;let l=e.getTextSlice(s,c);if(og.encode(l).byteLength>tg)continue;let u=pg(l,s,n);if(!(u===void 0||u.length>tg||og.encode(u).byteLength>tg))return{beforeText:u,afterText:l,startOffset:s,startLine:r,bounds:dg(u,sg(u),l,sg(l))}}}function hg(e,t,n,r,i,a=Date.now()){let o=e.slice(-10),s=mg(n,r);if(s===void 0){let e=o.at(-1);return e?.fragment!==void 0&&(o[o.length-1]={...e,fragment:void 0}),o}if(s.beforeText===s.afterText)return o;let c=s.startLine+s.bounds.prefixLines,l=s.startLine+s.bounds.oldLineCount-s.bounds.suffixLines,u=o.at(-1),d=u!==void 0&&c>u.end?c-u.end:u!==void 0&&u.start>l?u.start-l:0;if(u!==void 0&&u.fragment!==void 0&&u.path===t&&u.source===i&&a-u.at<ng&&d<=rg){let e=u.fragment,n=s.startOffset+s.beforeText.length,c=Math.max(e.currentStart,s.startOffset),l=Math.min(e.currentEnd,n);if(c<=l&&e.currentText.slice(c-e.currentStart,l-e.currentStart)===s.beforeText.slice(c-s.startOffset,l-s.startOffset)){let c=Math.min(e.currentStart,s.startOffset),l=e.currentStart<=s.startOffset?e.currentText+s.beforeText.slice(Math.max(0,e.currentEnd-s.startOffset)):s.beforeText+e.currentText.slice(Math.max(0,n-e.currentStart)),u=l.slice(0,e.currentStart-c),d=l.slice(e.currentEnd-c),f=u+e.baseText+d,p=pg(l,c,r.appliedEdits),m=e.currentStart<=s.startOffset?e.startLine:s.startLine;if(p!==void 0&&f.length<=tg&&p.length<=tg&&og.encode(f).byteLength<=tg&&og.encode(p).byteLength<=tg){if(f===p)return o.pop(),o;let e=fg(t,f,p,m);if(e!==void 0)return o[o.length-1]={path:t,hunk:e.hunk,start:m+e.bounds.prefixLines,end:m+e.bounds.newLineCount-e.bounds.suffixLines,at:a,source:i,fragment:{baseText:f,currentText:p,currentStart:c,currentEnd:c+p.length,startLine:m}},o}}}let f=o.at(-1);f?.fragment!==void 0&&(o[o.length-1]={...f,fragment:void 0});let p=fg(t,s.beforeText,s.afterText,s.startLine);return p===void 0?o:(o.push({path:t,hunk:p.hunk,start:c,end:s.startLine+s.bounds.newLineCount-s.bounds.suffixLines,at:a,source:i,fragment:{baseText:s.beforeText,currentText:s.afterText,currentStart:s.startOffset,currentEnd:s.startOffset+s.afterText.length,startLine:s.startLine}}),o.slice(-10))}function gg(e,t,n,r,i,a){for(;a>0&&(r>0||i<e-1);){let o=!1;if(r>0&&n(r-1)){let e=t(r-1);e<=a&&(r--,a-=e,o=!0)}if(i<e-1&&n(i+1)){let e=t(i+1);e<=a&&(i++,a-=e,o=!0)}if(!o)break}return{first:r,last:i}}function _g(e,t,n,r,i){if(t.lineCount<=0)return;let a=t.lineCount-1,o=t.offsetAt({line:a,character:t.getLineLength(a)}),s=Math.max(0,Math.min(Number.isFinite(n)?Math.trunc(n):0,o)),c=t.charAt(s-1).charCodeAt(0),l=t.charAt(s).charCodeAt(0);s>0&&s<o&&(c===13&&l===10||c>=55296&&c<=56319&&l>=56320&&l<=57343)&&s--;let u=t.positionAt(s).line,d=new Map,f=e=>{if(e<0||e>=t.lineCount)return!1;let n=d.get(e);return n??(n=i(e),d.set(e,n)),n};if(!f(u))return;let p=new Map,m=e=>{let n=p.get(e);if(n!==void 0)return n;let r=t.getLineLength(e);if(Math.floor(r/3)>$h)return p.set(e,663),663;let i=Math.max(1,Math.floor(og.encode(t.getLineText(e)).byteLength/3));return p.set(e,i),i},h=u,g=u,_=Math.max(0,Math.floor(Xh*3/4)-m(u));for(;_>0&&(f(h-1)||f(g+1));){if(f(g+1)){let e=m(g+1);if(e>_)break;g++,_-=e}if(f(h-1)&&_>0){let e=m(h-1);if(e>_)break;h--,_-=e}}_+=88,{first:h,last:g}=gg(t.lineCount,m,f,h,g,_);let v=h,y=g;({first:v,last:y}=gg(t.lineCount,m,()=>!0,v,y,Zh));let b=0;for(let e=h;e<=g;e++)b+=m(e);let x=0;for(let e=v;e<=y;e++)x+=m(e);if(b>Qh||x>$h)return;let S=t.offsetAt({line:v,character:0}),C=t.offsetAt({line:y,character:t.getLineLength(y)}),w=t.getTextSlice(S,C),T={path:e,version:t.version,eol:t.eol,excerptText:w,excerptStartLine:v,cursorOffsetInExcerpt:s-S,editableRange:{start:t.offsetAt({line:h,character:0})-S,end:t.offsetAt({line:g,character:t.getLineLength(g)})-S},editHistory:r.slice(-10).map(({hunk:e,source:t})=>({diff:e,source:t}))};return og.encode(JSON.stringify(T)).byteLength<=eg?T:void 0}function vg(e,t){if(typeof t!=`string`)return new RegExp(t.source,t.flags).test(e);t=t.replaceAll(`\\`,`/`);let n=`^`;for(let e=0;e<t.length;e++){let r=t[e];r===`*`?t[e+1]===`*`?(e++,t[e+1]===`/`?(e++,n+=`(?:.*/)?`):n+=`.*`):n+=`[^/]*`:n+=r===`?`?`[^/]`:/[\\^$.*+?()[\]{}|]/.test(r)?`\\${r}`:r}return RegExp(`${n}$`).test(e)}var yg=`//`,bg=[`/*`,`*/`],xg={sql:{lineComment:`--`},ruby:{lineComment:`#`,blockComment:[`=begin`,`=end`]},rst:{lineComment:`..`},coffeescript:{lineComment:`#`,blockComment:[`###`,`###`]},cmd:{lineComment:`@REM`},julia:{lineComment:`#`,blockComment:[`#=`,`=#`]},yaml:{lineComment:`#`},yml:{lineComment:`#`},markdown:{lineComment:null,blockComment:[`<!--`,`-->`]},zsh:{lineComment:`#`},makefile:{lineComment:`#`},handlebars:{lineComment:null,blockComment:[`{{!--`,`--}}`]},ini:{lineComment:`;`,blockComment:[`;`,` `]},powershell:{lineComment:`#`,blockComment:[`<#`,`#>`]},vb:{lineComment:`'`},xml:{lineComment:null,blockComment:[`<!--`,`-->`]},lua:{lineComment:`--`,blockComment:[`--[[`,`]]`]},html:{lineComment:null,blockComment:[`<!--`,`-->`]},diff:{lineComment:`#`,blockComment:[`#`,` `]},r:{lineComment:`#`},fsharp:{blockComment:[`(*`,`*)`]},pug:{lineComment:`//-`},perl:{lineComment:`#`},tex:{lineComment:`%`},clojure:{lineComment:`;;`},css:{lineComment:null},python:{lineComment:`#`,blockComment:[`"""`,`"""`]},dotenv:{lineComment:`#`},dockerfile:{lineComment:`#`},razor:{lineComment:null,blockComment:[`<!--`,`-->`]},prompt:{lineComment:null,blockComment:[`<!--`,`-->`]}};function Sg(e,t){let n={...xg[e],...t?.[e]};return{lineComment:n.lineComment===void 0?yg:n.lineComment,blockComment:n.blockComment??bg}}function Cg(e,t,n){let r=[],i=new Set;for(let a of t){let t=a.end.line;a.start.line<t&&a.end.character===0&&t--;let o=r.length,s=1/0;for(let o=a.start.line;o<=t;o++){if(i.has(o))continue;i.add(o);let t=e.getLineText(o),a=t.length-t.trimStart().length,c=a===t.length;c||(s=Math.min(s,a)),r.push({line:o,comment:t.slice(a,a+n.length)===n?a:-1,empty:c,indent:a,single:!1})}if(s!==1/0)for(let e=o;e<r.length;e++)r[e].empty||(r[e].indent=s);r.length===o+1&&(r[o].single=!0)}let a=r.some(e=>e.comment<0&&(!e.empty||e.single)),o=[];if(a){for(let e of r){if(e.empty&&!e.single)continue;let t={line:e.line,character:e.indent};o.push({range:{start:t,end:t},newText:n+` `})}return o}for(let t of r){if(t.comment<0)continue;let r=e.getLineText(t.line),i=t.comment,a=i+n.length+ +(r[i+n.length]===` `);o.push({range:{start:{line:t.line,character:i},end:{line:t.line,character:a}},newText:``})}return o}var wg=50;function Tg(e,t,n,r,i){let a=Math.max(0,r-wg),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+wg),c=o.length-o.trimEnd().length,l=s.length-s.trimStart().length,u=o.length-c;if(o.slice(u-t.length,u)===t&&s.slice(l,l+n.length)===n)return{open:{start:r-c-t.length,end:r-c+ +(c>0),text:``},close:{start:i+l-+(l>0),end:i+l+n.length,text:``},contentStart:r,contentEnd:i};let d=i-r<=100?e.getTextSlice(r,i):void 0,f=d??e.getTextSlice(r,r+wg),p=d??e.getTextSlice(i-wg,i),m=f.length-f.trimStart().length,h=i-(p.length-p.trimEnd().length)-n.length;if(f.slice(m,m+t.length)!==t||e.getTextSlice(h,h+n.length)!==n)return;let g=r+m,_=g+t.length+ +!!/\s/.test(f[t.length+m]??``),v=h-+!!/\s/.test(e.getTextSlice(h-1,h));return{open:{start:g,end:_,text:``},close:{start:v,end:h+n.length,text:``},contentStart:_,contentEnd:v}}function Eg(e,t,n,r){let i=0,a=t.length;for(;i<a;){let n=i+a>>>1;t[n].end<e?i=n+1:a=n}let o=n[i];for(let n=i;n<t.length;n++){let i=t[n];if(e<i.start)break;if(i.start===i.end&&e===i.start){if(r<0)break;o+=i.text.length;continue}if(e>i.end){o+=i.text.length-(i.end-i.start);continue}return e===i.end?i.start+o+i.text.length:i.start+o+(r>0?i.text.length:0)}return e+o}function Dg(e,t,[n,r],i=!1){let a=t.map(t=>{let{start:n,end:r}=t;if(i){let t=r.line;n.line<t&&r.character===0&&t--;let i=e.getLineText(n.line),a=i.length-i.trimStart().length;n={line:n.line,character:a},r={line:t,character:e.getLineLength(t)}}return{from:e.offsetAt(n),to:e.offsetAt(r),direction:t.direction,comment:void 0}});if(i&&a.length>1){a.sort((e,t)=>{let n=e.from-t.from;return n===0?e.to-t.to:n});let e=0;for(let t=1;t<a.length;t++){let n=a[e],r=a[t];r.from<=n.to?n.to=Math.max(n.to,r.to):a[++e]=r}a.length=e+1}for(let t of a)t.comment=Tg(e,n,r,t.from,t.to);let o=a.every(e=>e.comment!==void 0),s=[];for(let e of a){let t=e.comment;if(o&&t!==void 0){s.push(t.open,t.close);continue}if(t===void 0){if(e.from===e.to){s.push({start:e.from,end:e.to,text:n+` `+r});continue}s.push({start:e.from,end:e.from,text:n+` `},{start:e.to,end:e.to,text:` `+r})}}if(s.length===0)return;s.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});let c=s.map(t=>({range:{start:e.positionAt(t.start),end:e.positionAt(t.end)},newText:t.text}));if(i)return{edits:c,nextSelectionOffsets:[]};let l=a.map(e=>{let t=e.comment;return o&&t!==void 0?{start:t.contentStart,end:t.contentEnd,startAssociation:1,endAssociation:-1}:t===void 0?e.from===e.to?{start:e.from,end:e.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:-1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:1}}),u=Array(s.length+1);u[0]=0;for(let e=0;e<s.length;e++){let t=s[e];u[e+1]=u[e]+t.text.length-(t.end-t.start)}return{edits:c,nextSelectionOffsets:l.map((e,t)=>{let n=Eg(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?Eg(e.end,s,u,e.endAssociation):n,a[t].direction]})}}var Og=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),kg=new Map([...Og].map(([e,t])=>[t,e])),Ag=1e3,jg=5e4;function Mg(e,t,n){let r=Ng(e,t,e.normalizePosition(n));if(r===void 0)return;let i=Og.get(r.char),a=kg.get(r.char);if(i!==void 0)return Hg(r,Ig(e,t,r,i));if(a!==void 0)return Hg(Lg(e,t,r,a),r)}function Ng(e,t,n){let r=Pg(n);if(r!==void 0){let n=Fg(e,t,r);if(n!==void 0)return n}return Fg(e,t,n)}function Pg(e){if(e.character>0)return{line:e.line,character:e.character-1}}function Fg(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!Og.has(r)&&!kg.has(r)||Rg(t,n)))return{...n,char:r}}function Ig(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=Ag)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:0},d=s===n.line?n.character:0;for(let e=d;e<c.length;e++){if(o>=jg)return;if(o++,Bg(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function Lg(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=Ag)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:l===null?-1:l.length-1},d=s===n.line?n.character:c.length-1;for(let e=d;e>=0;e--){if(o>=jg)return;if(o++,Vg(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function Rg(e,t){return zg(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function zg(e,t){if(e===null)return!1;for(let[n,r]of e){if(t<n)return!1;if(t<r)return!0}return!1}function Bg(e,t,n){if(e===null)return!1;for(;n.index<e.length&&t>=e[n.index][1];)n.index++;let r=e[n.index];return r!==void 0&&t>=r[0]}function Vg(e,t,n){if(e===null)return!1;for(;n.index>=0&&t<e[n.index][0];)n.index--;let r=e[n.index];return r!==void 0&&t<r[1]}function Hg(e,t){if(e!==void 0&&t!==void 0)return[Ug(e),Ug(t)]}function Ug(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var Wg=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1967
|
-
<symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
|
|
1968
|
-
<path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
|
|
1969
|
-
</symbol>
|
|
1970
|
-
<symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
|
|
1971
|
-
<path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
1972
|
-
</symbol>
|
|
1973
|
-
<symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
|
|
1974
|
-
<path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
1975
|
-
</symbol>
|
|
1976
|
-
<symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
|
|
1977
|
-
<path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
|
|
1978
|
-
<path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
|
|
1979
|
-
</symbol>
|
|
1980
|
-
<symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
|
|
1981
|
-
<path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
|
|
1982
|
-
<path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
|
|
1983
|
-
<path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
|
|
1984
|
-
</symbol>
|
|
1985
|
-
<symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
|
|
1986
|
-
<path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
|
|
1987
|
-
<path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
|
|
1988
|
-
</symbol>
|
|
1989
|
-
<symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
|
|
1990
|
-
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
|
|
1991
|
-
</symbol>
|
|
1992
|
-
<symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
|
|
1993
|
-
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
|
|
1994
|
-
</symbol>
|
|
1995
|
-
</svg>`,Gg=()=>{let e=document.createElement(`div`);e.innerHTML=Wg;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},Kg=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
|
|
1996
|
-
<use href="#diffs-editor-icon-${e}"></use>
|
|
1997
|
-
</svg>`,qg=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=Z(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(j.disabled=n,M.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0){if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:Op(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text!==``&&d.all.length!==0&&(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>Z(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:Kg(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),w=S(`whole-word`,`Whole Word`,`wholeWord`),T=S(`regex`,`Regexp`,`regex`),E=Z(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=Yp(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=Z(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=Yp(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?Hp(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),ee(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let D=Z(`div`,{dataset:`searchToggles`,children:[C,w,T]}),O=Z(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,D]}),k=Z(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),A=Z(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),j=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),M=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});j.disabled=!0,M.disabled=!0;let N=Z(`div`,{dataset:`searchNav`,children:[j,M]}),P=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),F=Z(`div`,{dataset:{searchGrid:``,mode:i},children:[O,k,A,f,N,P]}),ee=e=>{F.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=ee,this.#e=Z(`div`,{dataset:`searchPanel`,children:[Z(`div`,{dataset:`editorWidget`,children:[F]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},Jg=class{#e;#t;#n;constructor(e,t,n){this.#e=Z(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,cm(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}},Yg=4096,Xg=/\p{Mark}/u,Zg=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=em(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=t_(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),em(n)}segmentTextWidth(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=t_(r,this.tabSize);return i===-1?this.measureTextWidth(r):i*this.ch}#i(e){return Qg(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return em(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=Z(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=em(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=Yg){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function Qg(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Xg.test(e.charAt(t)))return!0}return!1}function $g(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!Qg(e))return n;let r=am();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function e_(e){if(!Qg(e))return;let t=[0],n=am();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function t_(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var n_=500,r_=0,i_=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[bt];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++r_;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=$p(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!s_(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#F(),this.#V(r)},500);#j=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#C&&typeof r==`number`&&r===this.#S&&(this.#w>=0?this.#q(r):this.#J(r))};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#I(),this.#t===void 0))return null;if(this.#O[e]===void 0){this.#K(e);let t=this.#h[e]??bt,n=this.#H(e,t);this.#h[e+1]=n.state}return this.#O[e]??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=Ze,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#N():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#N();this.#M(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[Q(this.#n,`change`,()=>{let e=this.#N();this.#M(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#I(),this.#a=[],this.#P(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d)}#M(e,t){(e!==this.#i||t!==this.#r)&&(this.#P(e,t),this.stopBackgroundTokenize(),this.#h=[bt],this.#g=[],this.#_=0,this.#v=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#B(0),this.#u?.())}#N(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=Ze}=e;if(typeof n==`string`){let e=this.#e.getTheme(n).type;if(n===this.#i&&e===this.#r)return;this.#M(n,e);return}let r=t===`system`?this.#N():t,i=n[r];(r!==this.#r||i!==this.#i)&&this.#M(i,r)}#P(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=o!=null&&o.trim()!==``&&!Da.isFullyTransparent(o)?o:void 0,c=i[`editor.lineHighlightBorder`]??(s==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),l=s==null?`100%`:`85%`,u=i[`editorCursor.foreground`],d=i[`editor.findMatchBackground`],f=i[`editor.findMatchHighlightBackground`],p=i[`editorBracketMatch.background`],m=i[`editorBracketMatch.border`],h=i[`editorHint.foreground`],g=i[`editorInfo.foreground`],_=i[`editorWarning.foreground`],v=i[`editorError.foreground`];this.#c(`:host {
|
|
1998
|
-
--diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
|
|
1999
|
-
--diffs-editor-line-highlight-border: ${c};
|
|
2000
|
-
--diffs-editor-active-line-source-mix: ${l};
|
|
2001
|
-
--diffs-editor-match-bg: ${d??`initial`};
|
|
2002
|
-
--diffs-editor-match-highlight-bg: ${f??`initial`};
|
|
2003
|
-
--diffs-editor-bracket-match-bg: ${p??`initial`};
|
|
2004
|
-
--diffs-editor-bracket-match-border: ${m??`initial`};
|
|
2005
|
-
--diffs-editor-cursor-fg: ${u??`initial`};
|
|
2006
|
-
--diffs-editor-hint-fg: ${h??`initial`};
|
|
2007
|
-
--diffs-editor-info-fg: ${g??`initial`};
|
|
2008
|
-
--diffs-editor-warning-fg: ${_??`initial`};
|
|
2009
|
-
--diffs-editor-error-fg: ${v??`initial`};
|
|
2010
|
-
}`),this.#i=e,this.#r=t??n.type,this.#a=r}#F(){if(this.#i===``)return;let{colorMap:e}=this.#e.setTheme(this.#i);this.#a=e}cleanUp(){this.#m=!0,this.stopBackgroundTokenize(),this.#R(),this.#p?.forEach(e=>e()),this.#p=void 0}tokenize(e,t,n=!1){if(this.#I(),this.#F(),this.#t===void 0&&!s_(this.#o.languageId))throw Error(`Grammar for language "${this.#o.languageId}" not loaded`);let{lineCount:r}=this.#o,{startingLine:i=0,totalLines:a=1/0}=t??{},o=a===1/0?r:Math.min(i+a,r),s=e.startLine,c=Math.max(i,s),l=t!==void 0&&a!==1/0&&e.lineDelta>0&&s<o&&e.endLine>=o,u=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0);this.#d&&!u&&(this.#O.length=Math.min(this.#O.length,e.startLine));let d=n&&e.lineDelta!==0&&s>=i,f=u||t===void 0||s>=c,p=e.changedLineRanges??[[s,e.endLine]];this.#g=[],this.#_=0,this.#v=[];let m=-1;if(s<c)for(let[e,t]of p)e<c&&(m=Math.max(m,Math.min(t,c-1)));let h=m>=s&&(u||e.lineDelta<0);u?this.#K(s):(this.#W(e),(t===void 0||s>=c)&&this.#K(c));let g=0,_=p[g][1],v,y=0,b=u?p[g][0]:c,x=!1,S=new Map,C=h?new Map:void 0;if(C!==void 0&&!u){let e=Math.min(m+1,c,o);if(e>s){this.#K(e);let t=s,n=this.#h[t]??bt;for(;t<e;t++){let e=this.#H(t,n);n=e.state,C.set(t,e.resolvedTokens)}this.#h[e]=n}}let w=this.#h[b]??bt;for(;b<o;){let e=u?this.#h[b+1]:d?this.#G(b+1):void 0;f&&(this.#h[b]=w);let{resolvedTokens:t,state:n}=this.#H(b,w);if(w=n,b>=c?S.set(b,t):C?.set(b,t),f&&(this.#h[b+1]=w),x=b>=_&&(u||d)&&e!==void 0&&w.equals(e),x){g++;let e=p[g];if(e===void 0)break;if(e[0]>=o){v=e[0],y=g;break}let t=this.#h[e[0]];if(d)for(let n=b+2;n<=e[0]&&(t=this.#G(n),t!==void 0);n++)this.#h[n]=t;t===void 0?(_=e[1],b++):(b=e[0],w=t,_=e[1]),x=!1;continue}b++}if(f&&(b<o?this.#h[b+1]=w:this.#h[b]=w),x&&d&&v===void 0){for(let e=b+2;e<=r;e++){let t=this.#G(e);if(t===void 0)break;this.#h[e]=t}this.#g=[],this.#_=0,this.#v=[]}if(C!==void 0&&C.size>0&&this.#l(C,this.#r),v!==void 0)this.#d&&u&&(this.#O.length=Math.min(this.#O.length,v)),this.#B(v,p,y);else if(!x&&b<r){let e=l&&s>=c?o:s<c&&!u?s:b;this.#d&&u&&(this.#O.length=Math.min(this.#O.length,e)),this.#B(e,p,g)}return S}prebuildStateStack(e){this.#I(),this.#A(e)}stopBackgroundTokenize(){this.#T=-1,!this.#b&&(this.#b=!0,this.#x=!1,this.#y=-1,this.#w=-1,this.#E=void 0,this.#D=0,this.#g=[],this.#_=0,this.#v=[],this.#R())}pauseBackgroundTokenize(){this.#b||this.#x||(this.#f&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#S}),this.#x=!0)}resumeBackgroundTokenize(){this.#b||!this.#x||this.#t===void 0||this.#y<0||(this.#f&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#S}),this.#x=!1,this.#z(this.#S))}#I(){this.#t===void 0&&!s_(this.#o.languageId)&&this.#e.getLoadedLanguages().includes(this.#o.languageId)&&(this.#t=this.#e.getLanguage(this.#o.languageId))}#L(){this.#k||=(globalThis.addEventListener(`message`,this.#j),!0)}#R(){this.#k&&=(globalThis.removeEventListener(`message`,this.#j),!1)}#z(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#C,jobId:e})}#B(e,t,n=0){if(s_(this.#o.languageId))return;let r=++this.#S;this.#f&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#b=!1,this.#x=!1,this.#y=e,this.#w>=0&&(this.#T=Math.max(this.#T,this.#w)),this.#w=-1,this.#E=t,this.#D=n,this.#L(),this.#z(r)}#V(e){if(this.#t===void 0||this.#h.length>e)return;if(!this.#b){this.#w>=0?this.#w=Math.max(this.#w,e):this.#T=Math.max(this.#T,e);return}let t=++this.#S;this.#b=!1,this.#x=!1,this.#y=this.#h.length-1,this.#w=e,this.#T=-1,this.#E=void 0,this.#D=0,this.#L(),this.#z(t)}#H(e,t){let n=this.#o.getLineText(e);if(n.length>this.#s)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t===void 0||n===``||n.trim()===``)return this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=a_(this.#t,this.#a,n,t,n_,this.#d);return this.#U(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#U(e,t){this.#d&&(this.#O[e]=t)}#W(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#h.length-n?(this.#g=this.#h,this.#_=0,this.#h=this.#h.slice(0,n)):(this.#_=n,this.#g=this.#h.slice(n),this.#h.length=Math.min(this.#h.length,n)),this.#v=t}#G(e){let t=e;for(let n=this.#v.length-1;n>=0;n--){let[r,i,a]=this.#v[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#h[e]}}return this.#g[t-this.#_]??this.#h[e]}#K(e,t){let n=Math.min(Math.max(0,e),this.#o.lineCount);if(this.#h.length>n||this.#t===void 0)return!0;let r=t===void 0?0:performance.now(),i=this.#h.length-1,a=this.#h[i]??bt;for(;i<n;){this.#h[i]=a;let e=this.#o.getLineText(i);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=a_(this.#t,this.#a,e,a,n_,this.#d,!1);this.#U(i,t.bracketIgnoredRanges),a=t.ruleStack}else this.#U(i,null);if(i++,this.#h[i]=a,t!==void 0&&performance.now()-r>t)break}return i>=n}#q(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=this.#K(this.#w,1);if(!(this.#b||this.#x||e!==this.#S)){if(t){this.stopBackgroundTokenize();return}this.#y=this.#h.length-1,this.#z(e)}}#J(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=performance.now(),n=new Map,r=this.#o.lineCount,i=this.#E,a=this.#y,o=this.#h[a]??bt,s=!1,c=this.#D,l=i?.[c]?.[1];for(;a<r;){this.#h[a]=o;let e=l===void 0?void 0:this.#G(a+1),r=this.#o.getLineText(a);if(r.length>this.#s)console.warn(`[diffs] Line(${a}) too long to tokenize: ${r.length}`),n.set(a,[[0,``,r]]),this.#U(a,null);else if(r===``||r.trim()===``)n.set(a,[[0,``,r]]),this.#U(a,null);else{let e=a_(this.#t,this.#a,r,o,n_,this.#d);n.set(a,e.resolvedTokens),this.#U(a,e.bracketIgnoredRanges),o=e.ruleStack}if(this.#h[a+1]=o,s=l!==void 0&&a>=l&&e!==void 0&&o.equals(e),a++,s){c++;let e=i?.[c];if(e===void 0)break;if(l=e[1],this.#h[e[0]]===void 0)s=!1;else{a=e[0],o=this.#h[a]??o,s=!1;continue}}if(performance.now()-t>1)break}if(this.#l(n,this.#r),!(this.#b||this.#x||e!==this.#S)){if(s||a>=r){let e=this.#T;this.stopBackgroundTokenize(),e>=0&&this.#V(e);return}this.#y=a,this.#D=c,this.#z(e)}}};function a_(e,t,n,r,i,a=!0,o=!0){let s=e.tokenizeLine2(n,r,i);s.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let c=s.tokens,l=c.length/2,u=[],d=[];if(!o&&!a)return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d};for(let e=0;e<l;e++){let r=c[2*e],i=e+1<l?c[2*e+2]:n.length;if(r===i)continue;let s=c[2*e+1];if(o){let e=vt.getForeground(s);u.push([r,t[e],n.slice(r,i)])}a&&vt.getTokenType(s)>0&&d.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d}}function o_(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?Z(`br`):n:Z(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function s_(e){return e===`text`||e===`ansi`}function c_(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function l_(e,t){let n=Jt(e),r=n[n.length-1]??0;return{start:0,end:e.length,text:t,range:{start:{line:0,character:0},end:{line:n.length-1,character:e.length-r}}}}function u_(e){return e!=null&&`renderType`in e&&e.renderType===`virtualized`}var d_=2,f_=1e4,p_=300,m_=256,h_=131072,g_=new TextEncoder,__=`selection-action`,v_=`application/vnd.pierre.diffs-selections+json`,y_=class{type;#e;#t;#n;#r=new Zg;#i;#a;#o;#s;#c;#l;#u={generation:0,callback:void 0,delivered:!1};#d;#f;#p;#m=new Map;#h=new Map;#g=new Map;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F=!1;#I=!1;#L;#R;#z;#B;#V;#H;#U;#W;#G;#K=!0;#q=!1;#J=!1;#Y=!1;#X;#Z=!1;#Q=!1;#$=!1;#ee;#te=!1;#ne;#re=``;#ie;#ae;#oe;#se;#ce;#le;#ue=!1;#de=!1;#fe=!1;#pe=!1;#me;#he;#ge;#_e=0;#ve=!1;#ye=!1;#be;#xe=[];#Se=new Map;#Ce=new Map;#we=(e,t)=>{if(this.#F&&(this.#M?.updateRenderCache(e,t),this.#B!==void 0&&this.#B.totalLines!==1/0)){let t=this.#be===void 0?void 0:new Set(this.#be.response.edits.map(e=>e.range.start.line)),n=!1,{startingLine:r,totalLines:i}=this.#B,a=Math.min(r+i,(this.#n??this.#t)?.document?.lineCount??0);for(let[i,o]of e)if(i>=r&&i<a){let e=this.#hn(i);e!==void 0&&(e.replaceChildren(...o_(o)),n||=t?.has(i)===!0)}n&&this.#oe!==void 0&&this.#Ut(this.#oe)}};constructor(e,t={},n){this.type=e,this.#e=t,this.#z=t.ownsVerticalViewport===!0,this.#t=t.initialState,this.#R=n}get#Te(){return this.type,this}setOptions(e){let t=this.#e.renderCaret,n=this.#e.editPrediction;this.#e={...this.#e,...e},t!==this.#e.renderCaret&&(this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#Wt()),n!==this.#e.editPrediction&&(this.#Lt(!0),this.#xe=[],this.#zt())}__emitEditComplete(e){this.#e.onComplete?.(e)}__getGhostTextRows(){return this.#Ce}setCarets(e){let t=this.#n?.document;t!==void 0&&(this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#k?.forEach(e=>e.remove()),this.#k=void 0,this.#U=e.length===0?void 0:e.map(e=>{let n=t.normalizePosition(e.anchor),r=t.normalizePosition(e.focus);return{caret:{...e,anchor:n,focus:r},anchorOffset:t.offsetAt(n),focusOffset:t.offsetAt(r)}}),this.#Wt())}edit(e){let t=this.#Te,n=this.#n;if(this.#F)throw Error(`Editor.edit: the editor is already rendering its component`);if(this.#M!=null&&this.#M!==e)throw Error(`Editor.edit: a recycled edit session cannot attach to a different component`);let r=this.#t,i=r?.editor,a=this.#R,o=b_({type:this.type,editStateKey:a,owner:this,initialState:r,previousSession:n}),s=o.diffSession;this.#t=void 0,this.#n=o,this.#M=e,this.#F=!0,this.#I=o.editor!=null;try{if(this.#We(),e.type===`file`&&t.type===`file`)t.#N=e.applyDocumentChange.bind(e),t.#P=(n,r,i)=>{let a={changes:n,file:r,editor:t,lineAnnotations:i};e.__acceptEditorChange(a),t.#e.onChange?.(a),e.emitEditChange(a)},this.#l==null?this.#l=e.__attachEditor(t):e.__resumeEditor(t);else if(e.type===`file-diff`&&t.type===`file-diff`)t.#N=e.applyDocumentChange.bind(e),t.#P=(n,r,i)=>{let a={changes:n,file:r,editor:t,lineAnnotations:i};e.__acceptEditorChange(a),t.#e.onChange?.(a),e.emitEditChange(a)},this.#l==null?this.#l=e.__attachEditor(t):e.__resumeEditor(t);else throw Error(`Editor.edit: Impossible edit state`)}catch(e){throw this.cleanUp(`recycle`),o.type===`file-diff`&&o.diffSession==null&&(o.diffSession=s),this.#l==null&&a!=null&&(t.type===`file`?Vp.releaseFile(a,t):Vp.releaseFileDiff(a,t)),this.#n=n,this.#l??(this.#M=void 0,this.#N=void 0,this.#P=void 0),r!=null&&i!=null&&(r.editor=i),this.#t=r,e}return()=>{this.cleanUp(`complete`)}}applyEdits(e,t=!0){let n=this.#n?.document;if(n==null)throw Error(`Editor.applyEdits: Editor is not attached`);let r=this.#Y,i=this.#oe,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=Qm(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#un(s,c,this.#fn(s),{skipFocus:!r})}get canUndo(){return(this.#n??this.#t)?.document?.canUndo??!1}get canRedo(){return(this.#n??this.#t)?.document?.canRedo??!1}undo(){this.#$e(`undo`)}redo(){this.#$e(`redo`)}getFile(){let e=this.#n??this.#t,t=e?.fileInfo,n=e?.document;if(t===void 0||n===void 0)return;let r={...t};return Object.defineProperty(r,"contents",{enumerable:!0,get:()=>n.getText()}),r}getText(){return(this.#n??this.#t)?.document?.getText()??``}getViewState(){let e=this.#F?this.#M:void 0;if(!this.#F&&this.#n?.editor!=null)return Rp(this.#n.editor);let t=this.#oe?.map(e=>({...e,start:{...e.start},end:{...e.end}}));if(e==null)return{selections:t};let n=this.#Ue(),r=e.getCodeScrollLeft();return n==null?{selections:t,view:{scrollLeft:r}}:{selections:t,view:{scrollLeft:r,scrollTop:n.scrollTop}}}getEditState(){let e=this.#n;if(e!=null){if(this.#M==null)throw Error(`Editor.getEditState: active ${this.type} session has no component`);return zp(e)}}setViewState({selections:e,view:t}){if(!this.#F||this.#M===void 0||this.#n?.document===void 0)throw Error(`Editor.setViewState: Editor is not attached`);if(this.#K=!1,this.#Ut(e??[]),t!=null){this.#M.setCodeScrollLeft(t.scrollLeft);let e=this.#Ue();t.scrollTop!==void 0&&e!=null&&(e.scrollTop=t.scrollTop)}else this.#z&&this.#ht();this.#Ee()}setSelections(e){let t=this.#n?.document;if(t===void 0)throw Error(`Editor.setSelections: Text document is not initialized`);let n=e.map(e=>{let n=t.normalizePosition(e.start),r=t.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return $(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#K=!1,this.#Ut(n);let r=n.at(-1);r!==void 0&&this.#Ne(qm(r).line),this.#ht()}setMarkers(e){let t=this.#n?.document;if(t===void 0)throw Error(`Editor.setMarkers: Text document is not initialized`);if(e.length===0){this.#H?.cleanup(),this.#H=void 0,this.#Ut(this.#oe??[]);return}this.#H??=new Wh({popoverManager:this.#Le(),getLineHeight:()=>this.#r.lineHeight,getOverlayElement:()=>this.#E,getGutterWidth:()=>this.#gn(),getCharX:(e,t)=>this.#yn(e,t),getLineY:e=>this.#vn(e),isMouseDown:()=>this.#$||this.#Q}),this.#H.setMarkers(e,t),this.#w!==void 0&&this.#H.listenHover(this.#w),this.#Ut(this.#oe??[]),this.#Wt()}focus(e){let t=e?.preventScroll??!1,n=e?.lineNumber;if(n===`first-visible`||typeof n==`number`){let r=this.#n?.document;if(r==null||!this.#F||this.#M==null)return;let i=n===`first-visible`?this.#ft(e?.offset):n;if(i==null)return;let a=r.normalizePosition({line:i-1,character:n===`first-visible`?0:e?.character??0});this.#pt(a,t);return}let r=this.#oe?.at(-1);if(r!==void 0){let e=r.direction===-1?r.end:r.start;this.#lt(e,t)}else this.#lt(void 0,t)}blur(){this.#X=void 0,this.#Y=!1,this.#q=!1,this.#w?.blur()}cleanUp(e=`discard`){let t=this.#M,n=e===`recycle`;this.#Lt(!0,!1),n||(this.#xe=[]);let r=this.#n;if(t!=null&&r!=null){let e=!this.#Ee();n||this.#De(e)}if(this.#Be(),n||(this.#u.delivered=!1),this.#F=!1,ji(this.#Xe),this.#i?.cleanUp(),this.#i=void 0,this.#s?.forEach(e=>e()),this.#s=void 0,this.#o?.forEach(e=>e()),this.#o=void 0,n||(this.#l?.(),this.#l=void 0),this.#f=void 0,this.#p=void 0,this.#m.clear(),this.#h.clear(),this.#g.clear(),this.#_=void 0,this.#v?.remove(),this.#v=void 0,this.#y?.remove(),this.#y=void 0,this.#b?.remove(),this.#b=void 0,this.#x?.remove(),this.#x=void 0,this.#S=void 0,this.#a?.cleanUp(),this.#a=void 0,this.#C=void 0,this.#T=void 0,this.#w?.removeAttribute(`contentEditable`),this.#w=void 0,this.#X=void 0,this.#Y=!1,this.#E?.remove(),this.#E=void 0,this.#j?.disconnect(),this.#j=void 0,this.#pe=!1,this.#me!==void 0&&(cancelAnimationFrame(this.#me),this.#me=void 0),this.#ze(n),!n)try{if(t!=null&&r!=null){let n=this.#Te,r=e===`complete`?`install`:`discard`;if(t.type===`file`&&n.type===`file`)t.__completeEditSession(n,r);else if(t.type===`file-diff`&&n.type===`file-diff`)t.__completeEditSession(n,r);else throw Error(`Editor.cleanUp: Impossible edit state`)}}finally{this.#n=void 0,this.#M=void 0,this.#N=void 0,this.#P=void 0}}#Ee(){let e=this.#M,t=this.#n;if(e==null||t==null)return!1;let n=this.#F?this.getViewState():t.editor??{},{view:r}=n,i=r!=null&&(r.scrollLeft!==0||(r.scrollTop??0)!==0),a=n.selections!=null||i;if(t.editor=Rp(n),t.type===`file`)return!1;let o=e.__captureDocumentSessionState();if(t.diffSession=o?.diffSession,o==null)return!1;let s=t.document;return o.hasChanges||a||s?.canUndo===!0||s?.canRedo===!0}#De(e=!1){let t=this.#R;if(t==null)return;let n=this.#Te;n.type===`file`?Vp.releaseFile(t,n):Vp.releaseFileDiff(t,n,e)}__postponeBgTokenizeToNextFrame(){let e=this.#i;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{e.resumeBackgroundTokenize()}))}__captureFocusForDOMReplacement(){let e=this.#w,t=this.#S?.shadowRoot?.activeElement;e!=null&&(this.#Y||t===e||t!=null&&e.contains(t))&&(this.#X={})}__getDocumentContents(e){let t=this.#n?.fileInfo,n=this.#n?.document;if(n==null)return t==null||e==null?void 0:{...t,contents:e.contents};let r=t??e;if(r!=null)return{name:r.name,lang:r.lang,contents:n.getText()}}__getDocumentSessionState(){let e=this.#n?.diffSession;return e==null?void 0:Jh(e)}__syncRenderView(e){let{highlighter:t,fileContainer:n,renderRange:r,externalDocument:i=!1}=e,a=e,o;if(`file`in a&&this.type===`file`)o=a.file;else if(`fileDiff`in a&&this.type===`file-diff`)o=a.fileDiff;else throw Error(`Editor.__syncRenderView: Impossible render state`);let s=a.lineAnnotations,c=this.#R,l=this.#M,u=this.#n;if(!this.#F||l==null||u==null)return;let d=n.shadowRoot;if(d==null){console.error(`[editor] Could not find the shadow root.`);return}let f,p,m,h,g;for(let e of d.querySelectorAll(`[data-code]`)){let t=e.dataset.deletions!=null;t||(f=e);for(let n of e.children){if(!(n instanceof HTMLElement))continue;let{gutter:e,content:r}=n.dataset;e==null?r!=null&&(t?g=n:m=n):t?h=n:p=n}}if(g==null)this.#T=void 0;else if(h==null)throw Error(`Editor.__syncRenderView: the deletions column has no gutter`);else this.#T={content:g,gutter:h};if(f===void 0||m===void 0){this.#X=void 0;return}this.#Le().setViewportElements(n,f),this.#S!==n&&(this.#S=n,this.#v!==void 0&&n.appendChild(this.#v),this.#y!==void 0&&d.appendChild(this.#y),this.#b!==void 0&&d.appendChild(this.#b),this.#x!==void 0&&d.prepend(this.#x));let _=o.lang??Kt(o.name),v=`contents`in o?o.contents:o.additionLines.join(``),y=u.document,b=e.resetHistory??(y!=null&&u.fileInfo!=null&&(u.fileInfo.name!==o.name||y.languageId!==_)),x=i&&y!==void 0&&y.getText()!==v?[l_(y.getText(),v)]:void 0,S=i&&b;if(u.document==null||u.fileInfo==null||c==null&&(u.fileInfo.name!==o.name||u.document.languageId!==_)||S){this.#Lt(!0),this.#xe=[],this.#Be();let{name:e,lang:t}=o,n=S||c==null&&u.fileInfo!=null?void 0:u.document;if(y!=null&&n==null&&(u.editor=void 0),n==null){let e=new Zf({maxEntries:this.#e.historyMaxEntries});n=new Np(o.name,v,_,0,e)}u.fileInfo={name:e,lang:t},u.document=n,S&&(u.diffSession=void 0),this.#i?.cleanUp(),this.#i=void 0,this.#ze(),this.#h.clear(),this.#oe=this.#ae,this.#e.__debug===!0&&console.log(`[diffs/editor] text document initialized from`,o.name)}if(i&&!S){this.#Oe(u,v,s);let{name:e,lang:t}=o;u.fileInfo={name:e,lang:t}}let C=u.document;if(this.#i==null&&C!=null&&(this.#i=new i_({highlighter:t,textDocument:C,codeOptions:this.#M?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#we,onThemeChange:()=>this.#Dt(),setStyle:e=>{this.#b.textContent=e},__debug:this.#e.__debug})),this.#w!==m&&(this.#C=p,this.#w=Qp(m,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#E!==void 0&&m.after(this.#E),this.#r.init(m),this.#ot(),this.#Ye(m,p),this.#w!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),this.#X!=null&&(this.#X.target=m),m.ariaLabel!==o.name&&(m.ariaLabel=o.name),s!==void 0&&s.length>0||this.#Fe)for(let e of this.#w.children){let t=e,{lineAnnotation:n,lineType:r,separator:i}=t.dataset;(n!==void 0||i!==void 0||r===`change-deletion`)&&t.setAttribute(`contenteditable`,`false`)}this.#Re(),this.#i?.syncTheme(this.#M?.__getEffectiveCodeOptions()??{}),this.#L=s,this.#B=r,this.#V=r?.totalLines,this.#i?.prebuildStateStack(r);let w=u.editor,T=this.#I;try{if(this.#H?.removePopover(),(this.#oe!==void 0||this.#se!==void 0||this.#H!==void 0)&&this.#Ut(this.#oe??[]),this.#Wt(),this.#ye&&this.#zt(),this.#ae!==void 0&&this.#A!==void 0?(this.#ae=void 0,this.#ht(!1,`center`)):this.#ce===void 0?this.#X===void 0?this.#oe!==void 0&&this.#oe.length>0&&this.#Y&&!this.#fe&&this.focus({preventScroll:!0}):this.#ut():this.#_t(this.#ce,this.#le,this.#de),this.#fe&&this.#W?.focus(),T&&(this.#I=!1,w!==void 0&&this.setViewState(w)),this.#e.__debug===!0&&r!==void 0){let{startingLine:e,totalLines:t}=r;console.log(`[diffs/editor] render file:`,o.name,`RenderRange:`,e+`-`+(e+t),`of`,u.document?.lineCount,`lines`)}i&&l.__acknowledgeDocumentUpdate(),this.#Ee()}catch(e){throw this.#I=T,u.editor=w,e}x!=null&&this.#dn(x,s),this.#Ve(l)}#Oe(e,t,n){let r=e.document;if(r==null||r.getText()===t)return;let i=this.#oe,a=i?.map(e=>[r.offsetAt(e.start),r.offsetAt(e.end)]),o={start:0,end:r.getText().length,text:t};if(r.applyResolvedEdits([o],!0,i,void 0,!0)!=null){if(i!=null&&a!=null){let e=Qm(r,i,a,[o]);r.setLastUndoSelectionsAfter(e),this.#oe=e}(this.#L!=null||n!=null)&&r.setLastUndoLineAnnotations(this.#L??[],n??[]),this.#i?.cleanUp(),this.#i=void 0,this.#Re(),this.#h.clear(),this.#H?.removePopover(),this.#W!==void 0&&this.#se!==void 0&&this.#W.updateMatches({syncSelection:!1})}}get#ke(){return this.#M?.type===`file-diff`?this.#M:void 0}get#Ae(){return u_(this.#M)?this.#M:void 0}#je(e){return this.#ke?.isLineRenderable?.(e+1)??!0}get#Me(){let e=this.#ke;if(e!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#Ne(e){this.#je(e)||this.#ke?.revealLine?.(e+1)}get#Pe(){return this.#ke?.options.diffStyle??`split`}get#Fe(){return this.type===`file-diff`}get#Ie(){return this.#M?.options.overflow===`wrap`}#Le(){return this.#a??=new sm({hasActivePopover:()=>this.#G!==void 0||this.#H?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#Xt(),this.#H?.updatePopoverPosition()}})}#Re(){this.#m.clear(),this.#g.clear(),this.#_=void 0}#ze(e=!1){this.#Et(null),this.#f=void 0,this.#p=void 0,this.#Ge(),this.#J=!1,this.#D?.forEach(e=>e.remove()),this.#D=void 0,this.#O?.forEach(e=>e.remove()),this.#O=void 0,this.#k?.forEach(e=>e.remove()),this.#k=void 0,e||(this.#U=void 0),this.#oe=void 0,this.#ce=void 0,this.#H?.cleanup(),this.#H=void 0,this.#W?.cleanup(),this.#W=void 0,this.#G?.cleanup(),this.#G=void 0,this.#K=!0}#Be(){let e=this.#u;e.generation++,e.callback!=null&&(ji(e.callback),e.callback=void 0)}#Ve(e){let t=this.#u,n=this.#n?.document;if(t.delivered||t.callback!=null||n==null)return;let{generation:r}=t,i=()=>{if(t.callback!==i||(t.callback=void 0,r!==t.generation||this.#M!==e||this.#n?.document!==n))return;let a=this.#w,o=this.#S?.shadowRoot;a!=null&&o!=null&&o.contains(a)&&(t.delivered=!0,this.#e.onAttach?.(this,e))};t.callback=i,Ai(i)}#He(){let e=this.#Ae?.getEditorViewport?.();if(e!=null)return e;let t=this.#S;if(this.#M!=null&&t!=null)return om(t)}#Ue(){if(!this.#z)return;let e=this.#Ae?.getEditorViewport?.();if(e instanceof HTMLElement)return e}#We(){this.#v=Z(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
2011
|
-
[data-annotation-slot] {
|
|
2012
|
-
user-select: none;
|
|
2013
|
-
-webkit-user-select: none;
|
|
2014
|
-
}
|
|
2015
|
-
`}),this.#y=Z(`style`,{dataset:`editorCss`,textContent:Yh}),this.#b=Z(`style`,{dataset:`editorThemeCss`}),this.#x=Gg(),this.#E=Z(`div`,{dataset:`editorOverlay`});let e=e=>{let t=e.composedPath()[0];return t instanceof Node&&this.#w?.contains(t)===!0},t=()=>{this.#X!=null&&(this.#X=void 0,this.#Y=!1,this.#q=!1)},n=e=>{if(e.pointerType!==`mouse`)return;let t=this.#Q;this.#Ge(),t&&this.#lt(),this.#e.enabledSelectionAction===!0&&this.#oe!==void 0&&this.#oe.length>0&&!Km(this.#oe.at(-1))&&this.#Ut(this.#oe)};this.#s=[Q(document,`focusin`,n=>{e(n)||t()},{passive:!0}),Q(document,`pointerdown`,n=>{e(n)||queueMicrotask(t)},{capture:!0,passive:!0}),Q(document,`selectionchange`,()=>{let e=this.#S?.shadowRoot;if(this.#q||this.#J||e==null||!this.#Y||this.#oe!==void 0&&this.#oe.length>1&&!this.#$)return;let t=document.getSelection();if(t==null)return;let n;if(n=typeof t.getComposedRanges==`function`?t.getComposedRanges({shadowRoots:[e]})?.[0]:c_(e),n===void 0||!this.#Sn(n))return;let r=Tm(n,0);if(r!==void 0){if(this.#$&&this.#te&&this.#oe!==void 0&&this.#oe.length>0){let e=this.#oe.at(-1);this.#Ut([eh(e,r)]);return}if(this.#$)this.#ne===void 0?this.#ne=r:r=$m(this.#ne,r);else if(this.#ne!==void 0)r.direction=$m(this.#ne,r).direction;else if(this.#oe!==void 0&&this.#oe.length===1){let e=this.#oe[0];$(e.start,r.start)===0&&$(e.end,r.end)===0&&(r.direction=e.direction)}this.#ee!==void 0&&(this.#ee.focusLine=qm(r).line,this.#Ot())||(this.#ie===void 0?this.#Ut([r]):this.#Ut([...this.#ie.filter(e=>!Ym(e,r)),r]))}},{passive:!0}),Q(document,`pointerup`,n,{passive:!0}),Q(document,`pointercancel`,n,{passive:!0}),Q(document,`keydown`,e=>{e.key===`Shift`?this.#ne=this.#oe?.at(-1):e.key===`Alt`&&!e.repeat&&this.#Y&&this.#e.editPrediction?.mode===`subtle`&&(this.#ve=!this.#ve,this.#Ut(this.#oe??[]))},{passive:!0}),Q(document,`keyup`,e=>{e.key===`Shift`&&(this.#ne=void 0)},{passive:!0})]}#Ge(){this.#c?.forEach(e=>e()),this.#c=void 0,this.#q=!1,this.#Q=!1,this.#$=!1,this.#ee=void 0,this.#te=!1,this.#ne=void 0,this.#ie=void 0}#Ke(e){this.#c?.forEach(e=>e()),this.#c=e}#qe(){return this.#M?.options.enableLineSelection===!0}#Je(){this.#J=this.#oe!==void 0}#Ye(e,t){let{onFocus:n,onBlur:r}=this.#e,i=t=>{let n=t.composedPath()[0];return n!==void 0&&(n===e||e.contains(n))};this.#o?.forEach(e=>e()),this.#o=[Q(e,`focus`,()=>{this.#Y=!0,n?.(),!this.#$&&!this.#q&&this.#oe!==void 0&&this.#oe.length>0&&this.#mt(this.#oe.at(-1))},{passive:!0}),Q(e,`blur`,()=>{this.#X?.target===e&&(this.#X=void 0,this.#q=!1),this.#Y=!1,r?.()},{passive:!0}),Q(e,`pointerdown`,t=>{if(this.#K=!0,this.#J=!1,t.pointerType!==`mouse`)return;if(this.#ee=void 0,this.#yt(t)){this.#Tt(!0),this.#oe!==void 0&&this.#Ut([]);return}this.#Tt(!1),this.#H?.removePopover();let n=[];if(So()&&this.#L!==void 0&&this.#L.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[Q(e,`mouseenter`,()=>{this.#q=!0}),Q(e,`mouseleave`,()=>{this.#q=!1})]).flat();n.push(...t)}this.#$=!0;let r=t.button===0&&t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(this.#ne=void 0,r?(this.#ee={pointerId:t.pointerId,startClientX:t.clientX,clientX:t.clientX,startScrollLeft:e.parentElement?.scrollLeft??0},this.#ie=void 0,this.#oe=void 0,this.#Ut([]),n.push(Q(document,`pointermove`,e=>{let t=this.#ee;t!==void 0&&e.pointerType===`mouse`&&e.pointerId===t.pointerId&&(t.clientX=e.clientX,this.#Ot())},{capture:!0,passive:!0}))):t.button===0&&Hp(t)&&(this.#ie=this.#oe?.map(e=>({...e}))),this.#Ke(n),t.shiftKey){let e=this.#oe?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#mt({start:t,end:t,direction:0})}this.#te=!0}},{passive:!0}),Q(e,`keydown`,e=>{if(!i(e)||(this.#K=!0,this.#J=!1,e.isComposing||e.keyCode===229))return;if(e.key===`Tab`&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.isComposing&&!this.#Z&&(!e.altKey||this.#e.editPrediction?.mode===`subtle`)&&this.#be?.rendered===!0){this.#Vt(),e.preventDefault();return}if(e.key===`Escape`&&this.#be!==void 0){this.#Lt(!0),e.preventDefault();return}let t=Jp(e,this.#e.keymap);if(t!==void 0){e.preventDefault(),t===`simplifySelection`&&(this.#W?.close(),this.#W=void 0,this.#fe=!1,this.#G?.cleanup(),this.#G=void 0),this.#$e(t);return}let n=Up(e),r=this.#n?.document;if(this.#oe!==void 0&&this.#oe.length>0&&n!==void 0&&r!==void 0){let t={getSoftLineOffsets:this.#Ie?e=>this.#xn(e):void 0,resolveRenderableLine:this.#Me};e.shiftKey?this.#Ut(Nm(r,this.#oe,n,t)):this.#Ut(Dm(r,this.#oe,n,t)),this.#ht(),e.preventDefault();return}if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&Hp(e)){if(e.repeat&&this.#Fe){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),Ai(this.#Xe);return}}if(this.#W!==void 0){let t=Yp(e);if(t!==void 0){e.preventDefault(),this.#W.navigate(t===`previous`);return}}}),Q(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#Ct()?e.clipboardData?.setData(`text`,this.#wt()):this.#tn(e.clipboardData,this.#$t(),this.#en()))}),Q(e,`cut`,e=>{if(i(e)){if(e.preventDefault(),this.#Ct())e.clipboardData?.setData(`text`,this.#wt());else{let t=this.#en();this.#tn(e.clipboardData,this.#nn(),t)}}}),Q(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#n?.document;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#oe?.length??0;if(a>1){let e=t.getData(v_);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#in(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),Q(e,`beforeinput`,e=>{if(i(e)){if(e.inputType===`insertCompositionText`){this.#Lt(!0);return}e.preventDefault(),this.#ct(e.inputType,e.data)}}),Q(e,`drop`,e=>{i(e)&&e.preventDefault()}),Q(e,`compositionstart`,e=>{i(e)&&(this.#Lt(!0),this.#Z=!0,this.#q=!0)},{passive:!0}),Q(e,`compositionend`,e=>{if(!i(e))return;this.#q=!1;let t=this.#Z;this.#Z=!1,(e.data!==``||!t)&&this.#ct(`insertText`,e.data)},{passive:!0})];let a=this.#S?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#o.push(Q(a,`pointerdown`,e=>{let t=e.composedPath();if(Bi(t)){this.#Je();return}let n=t[0],r=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(r instanceof HTMLElement){if(this.#qe()){this.#Je();return}if(this.#St(r,a,e.pointerType===`mouse`))return}this.#Tt(!0),this.#oe!==void 0&&this.#Ut([])},{passive:!0})),t!==void 0){let e=(e,t=!1)=>{let n=e;return n?.dataset.lineNumberContent===void 0?t&&n?.tagName===`SPAN`&&(n=n.closest(`[data-line]`)):n=n.parentElement??void 0,n},n=e=>{if(e===void 0)return;let t=e.dataset.lineType,n=Xp(e)??Xp(e,`columnNumber`);if(n!==void 0&&t!==void 0&&Jm(t))return n-1};this.#o.push(Q(t,`pointerdown`,t=>{let r=t.composedPath();if(Bi(r)){this.#Je();return}let i=e(r[0]);if(i!==void 0&&this.#qe()){this.#Je();return}if(i?.dataset.lineType===`change-deletion`){let e=i.closest(`[data-code]`);e!=null&&this.#St(i,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let a=this.#n?.document,o=n(i);if(o===void 0||a===void 0)return;this.#K=!0,this.#H?.removePopover();let s=this.#vt(o,o,a);this.#Q=!0,this.#ne=s,this.#Ut([s]),this.#mt(s),this.#lt(),this.#Ke([Q(document,`mousemove`,t=>{if(!this.#Q)return;let r=this.#n?.document,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#ne?.start.line??i,o=this.#vt(a,i,r);this.#ne??=o,this.#Ut([o]),this.#lt(o.direction===-1?o.start:o.end)},{passive:!0})])},{passive:!0}))}this.#H?.listenHover(e),this.#j?.disconnect(),this.#j=new ResizeObserver(this.#at),this.#j.observe(e),this.#j.observe(e.parentElement),this.#Ze(e)}#Xe=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#oe?.length??0;if(n>1){let r=await e.readText(v_);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#n?.document;r!=null&&this.#in(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#Ze(e){this.#Fe&&this.#Pe===`split`&&this.#Ie&&(this.#d={top:e.offsetTop-this.#r.paddingTop,left:e.offsetLeft-this.#gn()},this.#e.__debug===!0&&console.log(`[diffs/editor] content offset:`,this.#d))}get#Qe(){if(this.#Fe&&this.#Pe===`split`&&this.#Ie)return this.#d}#$e(e){let t=this.#n?.document;if(t!=null)switch(e){case`openSearchPanel`:this.#Zt(`find`);break;case`openSearchReplacePanel`:this.#Zt(`replace`);break;case`findNextMatch`:{let e=this.#oe;if(e===void 0)break;if(e.some(Km)){let n=e.map(e=>Km(e)?vh(t,e):e);this.#Ut(n),this.focus()}else{let n=ah(t,e);if(n!==void 0){this.#Ut(n);let e=n.at(-1);e!==void 0&&this.#Ne(qm(e).line),this.#ht()}}break}case`moveLineUp`:case`moveLineDown`:this.#it(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#nt(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#oe,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#Ut([t]),this.#lt(qm(t));else if(!Km(t)){let e=qm(t);this.#Ut([{start:e,end:e,direction:0}]),this.#lt(e)}break}case`insertBlankLine`:this.#rt();break;case`deleteHardLineForward`:this.#cn();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#oe;if(n===void 0)break;let{lineComment:r,blockComment:i}=Sg(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#tt(Cg(t,n,r));break}let a=e===`toggleComment`,o=Dg(t,n,i,a);o!==void 0&&this.#tt(o.edits,a?void 0:e=>o.nextSelectionOffsets.map(([t,n,r])=>({start:e.positionAt(t),end:e.positionAt(n),direction:r})));break}case`indent`:case`outdent`:case`indentLess`:case`indentMore`:if(this.#oe!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#oe){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=Em(t,o,this.#r.tabSize,c);for(let t of e[0]){let e=t.range.start.line;i.has(e)||(i.add(e),n.push(t))}r.push(e[1])}else{let e=t.charAt({line:s,character:0})===` `?` `:` `.repeat(this.#r.tabSize);n.push({range:o,newText:e}),a.push({line:s,startCharacter:o.start.character,addedLength:e.length-(o.end.character-o.start.character),selectionIndex:r.length});let i={line:o.start.line,character:o.start.character+e.length};r.push({start:i,end:i,direction:0})}}for(let e of a){let t=0;for(let n of a)n.line===e.line&&n.startCharacter<e.startCharacter&&(t+=n.addedLength);if(t!==0){let n=r[e.selectionIndex],i={line:e.line,character:n.start.character+t};r[e.selectionIndex]={start:i,end:i,direction:0}}}let o=t.applyEdits(n,!0,this.#oe,r);o!==void 0&&this.#un(o,r)}break;case`selectAll`:{let e=oh(t);this.#Ut([e]),this.focus();let n=this.#pn(),r=n[0]?.[0],i=n.at(-1)?.[1];r!==void 0&&i!==void 0&&(this.#J=!0,this.#mt({start:{line:r,character:0},end:{line:i,character:t.getLineLength(i)},direction:1}));break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=sh(t,e===`moveCursorToDocEnd`,this.#Fe);this.#Ut([n]),this.#Ne(qm(n).line),this.#ht()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#oe;if(r!==void 0){let e=sh(t,n,this.#Fe);this.#Ut(th(r,e)),this.#Ne(qm(e).line),this.#ht()}}break;case`undo`:case`redo`:this.#et(e)}}#et(e){let t=this.#n?.document;if(t==null||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#oe,r=n?.map(e=>[t.offsetAt(e.start),t.offsetAt(e.end)]),i=e===`undo`?t.undo():t.redo();if(i===void 0)return;let[a,o,s,c]=i,l=o??(n!==void 0&&r!==void 0&&c!==void 0?Qm(t,n,r,c):void 0),u=s??(this.#L==null?void 0:um(a,this.#L));this.#un(a,l,u)}#tt(e,t){let n=this.#n?.document,r=this.#oe;if(n===void 0||r===void 0)return;let i=t===void 0,a=i?r.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]):void 0,o=i?e.map(e=>{let t=n.offsetAt(e.range.start),r=n.offsetAt(e.range.end);return{start:Math.min(t,r),end:Math.max(t,r),text:e.newText}}).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n}):void 0,s=n.applyEdits(e,!0,r,void 0,!0);if(s===void 0)return;let c=i?Qm(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#un(s,c,this.#fn(s))}#nt(e){let t=this.#n?.document,n=this.#oe;if(t===void 0||n===void 0)return;let r=rh(n);if(r.length===0)return;let i=[],a=0,o=[];for(let n of r){i.push(a);let r=n.endLine-n.startLine+1;a+=r;let s=t.getText({start:{line:n.startLine,character:0},end:{line:n.endLine,character:t.getLineLength(n.endLine)}});if(e>0){let e={line:n.startLine,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else if(n.endLine<t.lineCount-1){let e={line:n.endLine+1,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else{let e={line:n.endLine,character:t.getLineLength(n.endLine)};o.push({range:{start:e,end:e},newText:t.eol+s})}}let s=n.map(t=>{let n=t.start.line,a=0,o=r.length-1;for(;a<=o;){let e=a+o>>>1,t=r[e];if(n<t.startLine)o=e-1;else if(n>t.endLine)a=e+1;else{a=e;break}}let s=Math.max(0,a<=o?a:o),c=r[s],l=i[s]+(e>0?c.endLine-c.startLine+1:0);return{start:{...t.start,line:t.start.line+l},end:{...t.end,line:t.end.line+l},direction:t.direction}});this.#tt(o,()=>s)}#rt(){let e=this.#n?.document,t=this.#oe;if(e===void 0||t===void 0)return;let n=t.map(e=>qm(e).line),r=Array.from(new Set(n)).sort((e,t)=>e-t),i=new Map,a=new Map,o=[];for(let t=0;t<r.length;t++){let n=r[t],s=e.getLineText(n),c=/^\s*/.exec(s)?.[0]??``;i.set(n,t),a.set(n,c);let l={line:n,character:e.getLineLength(n)};o.push({range:{start:l,end:l},newText:e.eol+c})}let s=t.map((e,t)=>{let r=n[t],o={line:r+1+i.get(r),character:a.get(r).length};return{start:o,end:o,direction:0}});this.#tt(o,()=>s)}#it(e){let t=this.#n?.document,n=this.#oe;if(t===void 0||n===void 0)return;let r=rh(n);if(r.length===0||e<0&&r[0].startLine===0||e>0&&r.at(-1).endLine>=t.lineCount-1)return;let i=t.lineCount,a=e=>e<i-1?{line:e+1,character:0}:{line:e,character:t.getLineLength(e)},o=(e,n)=>{let r=e.map(e=>t.getLineText(e)).join(t.eol);return n?r+t.eol:r},s=[];if(e<0)for(let e of r){let t=e.startLine-1,n=[];for(let t=e.startLine;t<=e.endLine;t++)n.push(t);s.push({range:{start:{line:t,character:0},end:a(e.endLine)},newText:o([...n,t],e.endLine<i-1)})}else for(let e=r.length-1;e>=0;e--){let t=r[e],n=t.endLine+1,c=[];for(let e=t.startLine;e<=t.endLine;e++)c.push(e);s.push({range:{start:{line:t.startLine,character:0},end:a(n)},newText:o([n,...c],n<i-1)})}let c=r.at(-1),l=e>0&&c.endLine===i-2?t.getLineLength(c.endLine):t.getLineLength(i-1),u=n.map(n=>ih(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#un(d,u)}#at=()=>{let e=this.#L?.length??0,t=this.#f,n=this.#p;this.#f=void 0,this.#p=void 0;let r=this.#gn()!==t,i=this.#_n()!==n;(r||i)&&(this.#g.clear(),this.#_=void 0,this.#r.clearTextWidthCache(),i&&(this.#h.clear(),(this.#Ie||e>0)&&this.#m.clear()),(this.#oe!==void 0||this.#se!==void 0||this.#H!==void 0)&&(this.#Ut(this.#oe??[]),this.#oe!==void 0&&this.#Y&&this.focus()),this.#H?.removePopover(),this.#Ze(this.#w),this.#Wt())};#ot(){if(this.#pe)return;let e=document.fonts;e!==void 0&&(this.#pe=!0,e.ready.then(()=>{this.#w!==void 0&&this.#r.remeasureCharacterWidth()&&(this.#f=void 0,this.#p=void 0,this.#Re(),this.#h.clear(),(this.#oe!==void 0||this.#se!==void 0||this.#H!==void 0)&&this.#Ut(this.#oe??[]),this.#Wt(),this.#H?.removePopover())}))}#st(e,t,n=this.#B,r){let i=this.#i,a=this.#M,o=this.#N,s=this.#n?.document,c=this.#C,l=this.#w;if(i==null||a==null||o==null||s==null||l==null)return;i.stopBackgroundTokenize();let u=performance.now(),d=i.tokenize(e,n,!this.#Fe&&this.#Ae!=null),f=performance.now();if(d.size>0){let e=l.children,t=new Set;for(let e of d.keys())this.#je(e)&&t.add(e);for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=Xp(r),n=r.dataset.lineType;if(e===void 0||n===`change-deletion`)continue;let i=e-1;if(t.has(i)){let e=d.get(i);if(r.replaceChildren(...o_(e)),t.delete(i),t.size===0)break}}}if(t.size>0){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t],i=Xp(r);if(i!==void 0&&r.dataset.lineType!==`change-deletion`){n=i;break}}for(let e of t){if(e<n)continue;let t=d.get(e),r=String(e+1);Z(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:o_(t)},l),c!==void 0&&Z(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[Z(`span`,{dataset:{lineNumberContent:``},textContent:r})]},c)}}}if(e.lineDelta<0)for(let t of[l.children,c?.children??[]])for(let n=t.length-1;n>=0;n--){let r=t[n],i=Xp(r)??Xp(r,`columnNumber`),a=r.dataset.lineType;if(i!==void 0&&a!==`change-deletion`){if(i-1<e.lineCount)break;r.remove()}}let p=e.lineDelta!==0;if(p){let e=l.children.length;for(let t of l.children){let{bufferSize:n}=t.dataset;n!==void 0&&(e+=parseInt(n)-1)}l.style.gridRow=`span `+e,c!==void 0&&(c.style.gridRow=`span `+e)}a.updateRenderCache(d,i.themeType,{shouldRefreshDiffsView:this.#Fe&&!p,lineCountChangeInFlight:p}),p&&o(s,t,r),(p||this.#Fe&&this.#Pe===`unified`)&&this.#Re(),t!=null&&(this.#L=t,(!this.#Fe||!p)&&gm(t,l,c,a.getAnnotationSlotName)),this.#Wt(),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${em(performance.now()-f)}ms,`,`tokenize in: ${em(f-u)}ms (${d.size} dirty lines)`)}#ct(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#n?.document,r=this.#oe,i=n!==void 0&&r!==void 0?zm(n,r,e,this.#e.autoSurround):void 0;this.#in(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#in(this.#n?.document?.eol??`
|
|
2016
|
-
`);break;case`deleteContentBackward`:this.#an();break;case`deleteContentForward`:this.#an(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#on();break;case`deleteWordBackward`:this.#sn();break;case`insertTranspose`:this.#ln();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t)}}#lt(e,t=!0,n){this.#Y=!0,e===void 0?n?.()===!1?this.#Y=!1:this.#w?.focus({preventScroll:t}):(this.#q=!0,this.#mt({start:e,end:e,direction:0}),Ai(()=>{if(n?.()===!1||!this.#Y){this.#q=!1;return}this.#w?.focus({preventScroll:t}),Ai(()=>{this.#q=!1})}))}#ut(e){let t=this.#X;if(t==null)return;if(this.#fe){this.#X=void 0,this.#Y=!1,this.#q=!1;return}let n=this.#w;if(n==null||!this.#dt(n)){this.#X=void 0,this.#Y=!1;return}let r=()=>{if(this.#X!==t)return!1;let e=this.#dt(n);return this.#X=void 0,e};if(e!=null){this.#lt(e,!0,r);return}let i=this.#oe?.at(-1);if(i==null){this.#lt(void 0,!0,r);return}let a=i.direction===-1?i.end:i.start;this.#lt(a,!0,r)}#dt(e){let t=this.#S,n=t?.shadowRoot;if(t==null||n==null||this.#w!==e||!n.contains(e))return!1;let{activeElement:r}=n;if(r===e||r!=null&&e.contains(r))return!0;if(r!=null)return!1;let{ownerDocument:i}=t,{activeElement:a}=i;return a==null||a===i.body||a===i.documentElement||a===t}#ft(e=0){let t=this.#w,n=this.#S;if(this.#n?.document==null||t==null||n==null)return;let r=this.#He();if(r===void 0)return;let i,a;if(r instanceof HTMLElement){let e=r.getBoundingClientRect();i=e.top,a=e.bottom}else i=0,a=r.defaultView?.innerHeight??0;let o=n.shadowRoot?.querySelector(`[data-diffs-header][data-sticky]`);if(o!=null&&(i=Math.max(i,o.getBoundingClientRect().bottom)),Number.isFinite(e)&&(i+=Math.max(0,e)),!(a<=i))for(let e of t.children){let t=e,n=Xp(t),r=t.dataset.lineType;if(n==null||r==null||!Jm(r))continue;let o=t.getBoundingClientRect();if(!(o.bottom<=o.top)&&o.top>=i&&o.top<a)return n}}#pt(e,t){let n={start:e,end:e,direction:0};this.#K=!1,this.#Ut([n]),this.#Ne(e.line),t?this.#lt(e,!0):this.#ht()}#mt(e){let t=window.getSelection();if(t===null)return;let{start:n,end:r,direction:i}=e;$(n,r)>0&&([n,r]=[r,n]);let a=this.#hn(n.line),o=this.#hn(r.line);if(a===void 0||o===void 0)return;let[s,c]=_h(a,n.character),[l,u]=_h(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{t.setBaseAndExtent(s,Zp(s,c),l,Zp(l,u))}catch(e){console.error(`[diffs/editor] failed to update window selection:`,e)}}#ht(e=!1,t=`nearest`){let n=this.#oe?.at(-1);if(n===void 0)return;let r=this.#A;if(r!==void 0){if(r.scrollIntoView({block:t,inline:`nearest`}),!e){let e=n.direction===-1?n.end:n.start;this.#X===void 0?this.#lt(e):this.#ut(e)}}else{let t=qm(n);this.#_t(t.line,t.character,e)}}#gt(){let e=this.#W===void 0?0:48,t=this.#gn()+this.#r.ch;return`${e}px ${this.#r.ch}px 0 ${t}px`}#_t(e,t=0,n=!1){this.__postponeBgTokenizeToNextFrame();let r=Z(`div`,{style:{position:`absolute`,left:`0`,width:`2px`,height:this.#r.lineHeight+`px`,scrollMargin:this.#gt()}});if(this.#hn(e)!==void 0){let[i,a]=this.#yn(e,t),o=this.#vn(e)+a*this.#r.lineHeight;if(r.style.top=o+`px`,r.style.left=i+`px`,this.#E?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),!n){let n={line:e,character:t};this.#X===void 0?this.#lt(n):this.#ut(n)}this.#ce=void 0,this.#le=void 0,this.#ue=!1,this.#de=!1}else{let i=this.#Ae?.getLinePosition?.(e+1);if(i!==void 0)r.style.top=i.top+`px`,this.#S?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),i.height>0&&this.#je(e)?(this.#ce=e,this.#le=t,this.#de=n):(this.#ce=void 0,this.#le=void 0,this.#de=!1);else{let i=0;if(this.#ce===e&&this.#w!==void 0)for(let t=this.#w.childElementCount-1;t>=0;t--){let n=this.#w.children[t],r=n.dataset.lineType,a=Xp(n);if(r!==void 0&&Jm(r)&&a!==void 0){i=(e-(a-1))*this.#r.lineHeight;break}}let a=((this.#L??[]).filter(t=>t.lineNumber<e).length+e)*this.#r.lineHeight+i;r.style.top=a+`px`,this.#S?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),this.#ce===e&&(i===0||this.#ue)||!this.#je(e)?(this.#ce=void 0,this.#le=void 0,this.#ue=!1,this.#de=!1):(this.#ce=e,this.#le=t,this.#ue=i!==0,this.#de=n)}}r.remove()}#vt(e,t,n){let r=e=>({line:e,character:0}),i=e=>({line:e,character:n.getLineText(e).length});return t<e?{start:r(t),end:i(e),direction:-1}:{start:r(e),end:i(t),direction:1}}#yt(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&t.closest(`[data-line]`)?.getAttribute(`data-line-type`)===`change-deletion`}#bt(e,t,n){let r=[...n.querySelectorAll(`[data-content] > [data-line]`)],i=r.indexOf(e),a=r.indexOf(t),[o,s]=a<i?[t,e]:[e,t],c=window.getSelection();if(c!==null){let e=document.createRange();e.setStart(o,0),e.setEnd(s,s.childNodes.length),c.removeAllRanges(),c.addRange(e)}this.#Tt(!0),this.#Ut([]),this.#Et(Xp(t)??null,!0,`deletions`);let l=Math.min(i,a),u=Math.max(i,a);this.#re=l<0?``:r.slice(l,u+1).filter(e=>e.getAttribute(`data-line-type`)===`change-deletion`).map(e=>e.textContent??``).join(`
|
|
2017
|
-
`)}#xt(e,t){let n=e.parentElement;if(n==null||t==null)return;let r=[...n.children].indexOf(e),i=t.children[r];return i instanceof HTMLElement?i:void 0}#St(e,t,n){let r=t.querySelector(`[data-content]`),i=this.#xt(e,r);return i!==void 0&&(this.#bt(i,i,t),n&&this.#Ke([Q(document,`mousemove`,e=>{let n=e.composedPath()[0],a=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(a instanceof HTMLElement&&t.contains(a)){let e=this.#xt(a,r);e!==void 0&&this.#bt(i,e,t)}},{passive:!0})]),!0)}#Ct(){return this.#S?.shadowRoot?.querySelector(`pre`)?.hasAttribute(`data-deleted-text-selection`)??!1}#wt(){return this.#re===``?window.getSelection()?.toString()??``:this.#re}#Tt(e){let t=this.#S?.shadowRoot?.querySelector(`pre`);t!=null&&(e?(t.setAttribute(`data-deleted-text-selection`,``),this.#Et(null),this.#re=``):(t.removeAttribute(`data-deleted-text-selection`),this.#re=``))}#Et(e,t=!1,n=`additions`){try{this.#M?.setEditorActiveLine(e,{lineNumberOnly:t,side:n})}catch{}}#Dt(){this.#me===void 0&&(this.#me=requestAnimationFrame(()=>{this.#me=void 0,(this.#oe!==void 0||this.#se!==void 0||this.#H!==void 0)&&this.#Ut(this.#oe??[])}))}#Ot(){let e=this.#ee,t=this.#ne,n=this.#n?.document;if(e===void 0||e.focusLine===void 0||t===void 0||n===void 0)return!1;let r=t.direction===-1?t.end:t.start,i=this.#w?.parentElement?.scrollLeft??0,a=(e.clientX-e.startClientX+i-e.startScrollLeft)/this.#r.ch,o=a<0?-Math.round(-a):Math.round(a),s=Math.max(0,r.character+o),c={line:e.focusLine,character:s};if(e.renderedGoal!==void 0&&$(e.renderedGoal,c)===0)return!0;e.renderedGoal=c;let l=[],u=c.line<r.line?-1:1;for(let e=r.line;;e+=u){if(this.#je(e)){let t=n.getLineText(e),i=Math.min(r.character,t.length),a=Math.min(s,t.length),o=km(t,i),c=a===i?o:km(t,a);l.push({start:{line:e,character:Math.min(o,c)},end:{line:e,character:Math.max(o,c)},direction:o===c?0:o<c?1:-1})}if(e===c.line)break}return this.#Ut(l),!0}#kt(){for(let[e,t]of this.#D??[])e.startsWith(`editPrediction`)&&(t.remove(),this.#D?.delete(e))}#At(e,t,n){let r=t[n],i=n,a=r.range.end.line;for(;i+1<t.length&&t[i+1].range.start.line<=a;)i++,a=Math.max(a,t[i].range.end.line);if(i===n&&(r.newText.length===0||$(r.range.start,r.range.end)===0))return{edit:r,endIndex:i};let o=r.range.start,s={line:a,character:e.getLineLength(a)},c=[],l=e.offsetAt(o);for(let r=n;r<=i;r++){let n=t[r],i=e.offsetAt(n.range.start),a=e.offsetAt(n.range.end);c.push(e.getTextSlice(l,i),n.newText),l=a}return c.push(e.getTextSlice(l,e.offsetAt(s))),{edit:{range:{start:o,end:s},newText:c.join(``)},endIndex:i}}#jt(){let e=this.#be,t=this.#n?.document;if(e==null||t==null||e.document!==t||e.version!==t.version||this.#e.editPrediction?.mode===`subtle`&&!this.#ve)return;let{edits:n}=e.response,r=[],i=n.length>0;for(let e=0;e<n.length;){let{edit:a,endIndex:o}=this.#At(t,n,e);for(let e=a.range.start.line;i&&e<=a.range.end.line;e++)i=this.#Cn(e);r.push({edit:a,startIndex:e,endIndex:o}),e=o+1}return{groups:r,allVisible:i}}#Mt(e,t,n,r,i){this.#Ie?(e.dataset.wrap=``,e.style.width=`calc(100cqw - ${r}px)`):(delete e.dataset.wrap,e.style.width=`max-content`);let a=t.split(/\r\n|\r|\n/);for(let t=0;t<a.length;t++){let o=a[t],s=t===a.length-1?i:void 0,c=o.length===0&&s===void 0,l=Z(`span`,{dataset:c?[`editPredictionLine`,`empty`]:`editPredictionLine`,textContent:c?``:o},e);s!==void 0&&Z(`span`,{dataset:`editPredictionSuffix`},l).append(s),t===0&&n!==r&&(l.style.textIndent=`${n-r}px`)}}#Nt(e){let t=this.#be,n=this.#n?.document;if(t==null||n==null)return;let{edit:r,startIndex:i,endIndex:a}=e,{start:o,end:s}=r.range;if(!($(o,s)===0&&o.character<n.getLineLength(o.line))||t.response.edits[i-1]?.range.end.line===o.line||t.response.edits[a+1]?.range.start.line===o.line)return;let c=this.#hn(o.line);if(c===void 0)return document.createTextNode(n.getLineText(o.line).slice(o.character));let[l,u]=_h(c,o.character),d=document.createRange();d.selectNodeContents(c),d.setStart(l,Zp(l,u));let f=d.cloneContents();return f.firstChild?.textContent===``&&f.firstChild.remove(),f}#Pt(e){let{edit:t}=e,{start:n}=t.range,[r,i]=this.#yn(n.line,n.character),a=1,o=t.newText.split(/\r\n|\r|\n/).length,s=this.#E;if(this.#Ie&&s!=null){a=Math.max(1,this.#xn(n.line).length-1);let i=Z(`span`,{dataset:`editPrediction`,style:{visibility:`hidden`}},s);this.#Mt(i,t.newText,r,this.#yn(n.line,0)[0],this.#Nt(e));let{width:c,height:l}=i.getBoundingClientRect();i.remove();let{lineHeight:u}=this.#r;c>0&&l>0&&u>0&&(o=Math.round(l/u))}return Math.max(0,o-(a-i))}#Ft(e=!0){let t=new Map,n=new Map,r=this.#Ce,i=!1,a=this.#w,o=this.#jt();if(a!=null&&o!=null&&o.allVisible){for(let e of o.groups){let{edit:t}=e;if(t.newText.length===0)continue;let r=this.#Pt(e);r>(n.get(t.range.start.line)??0)&&n.set(t.range.start.line,r)}if(n.size>0){let e,o=this.#B?.startingLine??0;for(let[s,c]of n){i||=r.get(s)!==c;let n=this.#hn(s);if(n===void 0)continue;let l=s-o;if(a.children[l]!==n){if(e===void 0){e=new Map;for(let t=0;t<a.children.length;t++)e.set(a.children[t],t)}l=e.get(n)??-1}if(l<0)continue;t.set(n,c);let u=this.#C?.children[l];u instanceof HTMLElement&&t.set(u,c);let d=this.#It(l);d!=null&&(t.set(d.content,(t.get(d.content)??0)+c),t.set(d.gutter,(t.get(d.gutter)??0)+c))}}}let s=!1;for(let[e,n]of this.#Se)t.get(e)!==n&&(delete e.dataset.editPredictionSpacer,e.style.removeProperty(`--diffs-edit-prediction-spacer-height`),s=!0);for(let[e,n]of t)this.#Se.get(e)!==n&&(e.dataset.editPredictionSpacer=``,e.style.setProperty(`--diffs-edit-prediction-spacer-height`,`${n}lh`),s=!0);this.#Se=t,(i||n.size!==r.size)&&(this.#Ce=n,e&&this.#Ae?.syncGhostTextRows()),s&&this.#Re()}#It(e){let t=this.#T,n=this.#w;if(t==null||n==null||!this.#Fe||this.#Pe!==`split`||this.#Ie)return;let r=0;for(let t=0;t<e;t++)r+=x_(n.children[t]);let{content:i,gutter:a}=t,o=0;for(let e=0;e<i.children.length;e++){let t=i.children[e];if(o+=x_(t),o>r){let n=a.children[e];if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))throw Error(`Editor: deletions column rows and gutter cells are out of step`);return{content:t,gutter:n}}}}#Lt(e,t=!0){this.#he!==void 0&&(clearTimeout(this.#he),this.#he=void 0),this.#ge?.abort(),this.#ge=void 0,this.#_e++,this.#ve=!1,this.#ye=!1,this.#be=void 0,this.#Ft(t),e&&this.#kt()}#Rt(e){let t=this.#e.editPrediction;if(t===void 0)return!1;let n=e.replaceAll(`\\`,`/`);return(t.include===void 0||t.include.some(e=>vg(n,e)))&&t.exclude?.some(e=>vg(n,e))!==!0}#zt(){this.#Lt(!0);let e=this.#oe?.[0];if(this.#e.editPrediction===void 0||this.#n?.document===void 0||this.#n?.fileInfo===void 0||this.#oe?.length!==1||e===void 0||!Km(e))return;let t=this.#n?.document,n=t.offsetAt(qm(e));this.#he=setTimeout(()=>{this.#he=void 0;let e=this.#e.editPrediction,r=this.#oe?.[0],i=this.#n?.fileInfo?.name;if(e===void 0||i===void 0||this.#n?.document!==t||this.#oe?.length!==1||r===void 0||!Km(r)||t.offsetAt(qm(r))!==n||!this.#Rt(i))return;let a=e=>this.#mn(e)&&this.#je(e);if(!a(qm(r).line)){this.#ye=!0;return}let o=_g(i,t,n,this.#xe,a);if(o===void 0)return;let s=t.offsetAt({line:o.excerptStartLine,character:0}),c=s+o.editableRange.start,l=s+o.editableRange.end,u=new AbortController,d=++this.#_e;this.#ge=u;let f;try{f=e.provider.predict(o,{signal:u.signal})}catch{this.#ge=void 0;return}Promise.resolve(f).then(e=>{let r=this.#oe?.[0];if(u.signal.aborted||d!==this.#_e||this.#ge!==u||this.#n?.document!==t||t.version!==o.version||this.#oe?.length!==1||r===void 0||!Km(r)||t.offsetAt(qm(r))!==n||e==null||!Array.isArray(e.edits)||e.edits.length===0||e.edits.length>m_||e.newCursor==null)return;let i=[],a=0;for(let n of e.edits){if(n==null||typeof n.newText!=`string`||!S_(t,n.range?.start)||!S_(t,n.range?.end)||$(n.range.start,n.range.end)>0||(a+=g_.encode(n.newText).byteLength,a>h_))return;let e=t.offsetAt(n.range.start),r=t.offsetAt(n.range.end),o=t.resolveEdits([n])[0];if(o.start!==e||o.end!==r)return;i.push(o)}i.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<i.length;e++){let t=i[e];if(t.start<c||t.end>l||e>0&&i[e-1].end>t.start)return}let s=i.filter(e=>e.text!==t.getTextSlice(e.start,e.end));if(s.length===0)return;let f=t.positionAt(s[0].start),p=t.positionAt(s.at(-1).end),m=t.offsetAt({line:f.line,character:0}),h=t.offsetAt({line:p.line,character:t.getLineLength(p.line)}),g=[],_=m;for(let e of s)g.push(t.getTextSlice(_,e.start),e.text),_=e.end;g.push(t.getTextSlice(_,h));let v=g.join(``).split(/\r\n|\r|\n/),y=f.line+v.length-1,b=v.length-(p.line-f.line+1),x=e.newCursor;if(!(!Number.isInteger(x.line)||!Number.isInteger(x.character)||x.line<0||x.character<0)){if(x.line>=f.line&&x.line<=y){let e=v[x.line-f.line];if(x.character>e.length||C_(e,x.character))return}else{let e=x.line<f.line?x.line:x.line-b;if(e<0||e>=t.lineCount||x.character>t.getLineLength(e))return;let n=t.offsetAt({line:e,character:x.character});if(C_(t.charAt(n-1)+t.charAt(n),1))return}this.#be={document:t,version:o.version,cursorOffset:n,rendered:!1,response:{edits:s.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),newCursor:{...x}}},this.#Ut(this.#oe)}}).catch(()=>{}).finally(()=>{this.#ge===u&&(this.#ge=void 0)})},p_)}#Bt(e,t){let n=this.#n?.document,r=this.#n?.fileInfo?.name,i=jp(e);n!==void 0&&r!==void 0&&i!==void 0&&this.#Rt(r)&&(this.#xe=hg(this.#xe,r,n,i,t))}#Vt(){let e=this.#be,t=this.#n?.document,n=this.#oe?.[0];if(e===void 0||!e.rendered||t===void 0||e.document!==t||e.version!==t.version||this.#oe?.length!==1||n===void 0||!Km(n)||t.offsetAt(qm(n))!==e.cursorOffset)return;let{edits:r,newCursor:i}=e.response;this.#Lt(!0);let a=t.applyEdits(r.map(e=>({range:{start:{...e.range.start},end:{...e.range.end}},newText:e.newText})),!0,this.#oe,void 0,!0);if(a===void 0){this.#zt();return}let o=t.normalizePosition(i),s=[{start:o,end:o,direction:0}];t.setLastUndoSelectionsAfter(s),this.#un(a,s,this.#fn(a),{editSource:`prediction`})}#Ht(e){let t=this.#be,n=this.#n?.document;t!==void 0&&(t.rendered=!1);let r=this.#jt();if(t!=null&&n!=null&&r!=null&&r.allVisible){for(let t of r.groups){let{edit:r,endIndex:i}=t,{start:a,end:o}=r.range,s=r.newText.length===0,c=$(a,o)!==0,l=n.getLineLength(a.line),u=!c&&a.character<l;if(c?this.#Gt(e,s?`editPredictionDeletion`:`editPredictionReplacement`,{start:a,end:o}):u&&this.#Gt(e,`editPredictionInsertion`,{start:a,end:{line:a.line,character:l}}),s)continue;let[d,f]=this.#yn(a.line,a.character),p=this.#yn(a.line,0)[0],m=this.#vn(a.line)+f*this.#r.lineHeight,h=`editPrediction-${i}`,g=this.#D?.get(h);if(g===void 0?g=Z(`span`,{ariaHidden:`true`,contentEditable:`false`,dataset:`editPrediction`},e.fragment):(this.#D?.delete(h),g.replaceChildren()),c){g.dataset.replacement=``;let e=this.#hn(a.line);e!==void 0&&g.style.setProperty(`--diffs-edit-prediction-bg`,getComputedStyle(e).getPropertyValue(`--diffs-line-bg`))}else delete g.dataset.replacement,g.style.removeProperty(`--diffs-edit-prediction-bg`);this.#Mt(g,r.newText,d,p,this.#Nt(t)),g.style.transform=`translateX(${p}px) translateY(${m}px)`,e.elements.set(h,g)}t.rendered=!0}}#Ut(e){this.__postponeBgTokenizeToNextFrame();let t=this.#oe,n=t?.length!==e.length;if(!n&&t!==void 0)for(let r=0;r<e.length;r++){let i=t[r],a=e[r];if(i.direction!==a.direction||$(i.start,a.start)!==0||$(i.end,a.end)!==0){n=!0;break}}if(n&&this.#Lt(!0),this.#Ft(),this.#A=void 0,this.#Et(null),e.length===0&&this.#se===void 0&&this.#H===void 0){this.#oe=void 0,this.#D?.forEach(e=>e.remove()),this.#D?.clear(),this.#G?.cleanup(),this.#G=void 0,n&&this.#zt();return}let r=document.createDocumentFragment(),i={fragment:r,elements:new Map};if(e.length>0){let t=nh(e),n=t.at(-1);this.#oe=t;let r=t.some(e=>!Km(e)),a=qm(n).line+1;this.#Et(a,r);for(let e of t)Km(e)||this.#Gt(i,`selection`,e),this.#Yt(i,e,e===n);let o=this.#e.matchBrackets!==!1&&this.#n?.document!=null&&this.#i!==void 0&&Km(n)?Mg(this.#n?.document,this.#i,n.start):void 0;if(o!==void 0)for(let e of o)this.#Gt(i,`bracketMatch`,e)}let a=this.#n?.document;if(this.#se!==void 0&&a!==void 0){let e=this.#se,t=this.#B,n=t!=null&&Number.isFinite(t.totalLines)||this.#Fe&&this.#ke?.options.expandUnchanged!==!0?this.#pn():void 0,r=this.#oe?.at(-1),o=r===void 0?-1:a.offsetAt(r.start),s=r===void 0?-1:a.offsetAt(r.end),c=0,l=n?.length??1;for(let t=0;t<l;t++){let r=1/0,l=n?.[t];if(l!==void 0){let[t,n]=l,i=a.offsetAt({line:t,character:0}),o=n+1;r=o<a.lineCount?a.offsetAt({line:o,character:0}):a.offsetAt({line:o-1,character:a.getLineLength(o-1)});let s=c,u=e.length;for(;s<u;){let t=s+Math.floor((u-s)/2);e[t][1]<=i?s=t+1:u=t}c=s}for(;c<e.length;c++){let[t,n]=e[c];if(t>=r)break;let l={start:a.positionAt(t),end:a.positionAt(n)},u=o===t&&s===n;this.#Gt(i,`match`,l,u?`focus`:void 0)}}}if(this.#H!==void 0&&a!==void 0)for(let e of this.#H.markers)this.#Gt(i,`marker`,e,qh(e.severity));this.#Ht(i),this.#E?.appendChild(r),this.#D?.forEach(e=>e.remove()),this.#D?.clear(),this.#D=i.elements,this.#Xt(),n&&this.#zt()}#Wt(){let e=this.#U,t=this.#e.renderCaret,n=this.#E;if(this.#k?.forEach(e=>e.remove()),this.#k=void 0,e===void 0||t===void 0||n===void 0){this.#O?.forEach(e=>e.remove()),this.#O=void 0;return}let r=this.#O??=new Map;for(let[e,t]of r)this.#Cn(e.caret.focus.line)||(t.remove(),r.delete(e));let i=document.createDocumentFragment(),a=[];for(let n of e){let{caret:e}=n,{line:o,character:s}=e.focus;if(n.anchorOffset!==n.focusOffset){let t={fragment:i,elements:new Map};this.#Gt(t,`caretHighlight`,n.anchorOffset<n.focusOffset?{start:e.anchor,end:e.focus}:{start:e.focus,end:e.anchor},void 0,e.focus);for(let n of t.elements.values())n.style.setProperty(`--diffs-caret-highlight-bg`,`color-mix(in srgb, ${e.metadata.color} 32%, transparent)`),a.push(n)}if(!this.#Cn(o))continue;let c=r.get(n);c===void 0&&(c=Z(`div`,{dataset:`remoteCaret`,children:[t(e)]},i),r.set(n,c));let[l,u]=this.#yn(o,s),d=this.#vn(o)+u*this.#r.lineHeight;c.style.transform=`translateX(${l}px) translateY(${d}px)`}this.#k=a,n.appendChild(i)}#Gt(e,t,n,r,i){if(this.#n?.document==null)return;let{start:a,end:o}=n,s=a.line,c=o.line+1;if(this.#B!==void 0){let{startingLine:e,totalLines:t}=this.#B;s=Math.max(s,e),c=Math.min(c,e+t)}for(let n=s;n<c;n++){if(!this.#Cn(n))continue;let s=n===o.line,c=n===a.line?a.character:0,l=s?o.character:this.#n?.document.getLineLength(n);if(c===l&&(t===`editPredictionDeletion`||t===`editPredictionReplacement`)){if(s&&n!==a.line)continue;let[i,o]=this.#yn(n,c);this.#Jt(e,t,n,o,i,this.#r.ch,r);continue}if(this.#Ie){let a=this.#_n(),o=this.#n?.document.getLineText(n);if(2*this.#r.ch+this.#r.measureTextWidth(o)>a){this.#Kt(e,n,o,c,l,s,t,r,i);continue}}let u=0,d=0,f=0;u=c===0?this.#gn()+this.#r.ch+(this.#Qe?.left??0):this.#yn(n,c)[0],!s&&t===`selection`&&(f=this.#r.ch),d=c===l?f:this.#yn(n,l)[0]-u+f,this.#Jt(e,t,n,0,u,d,r,{start:i?.line===a.line&&i.character===a.character&&n===a.line,end:i?.line===o.line&&i.character===o.character&&n===o.line})}}#Kt(e,t,n,r,i,a,o,s,c){let l=this.#xn(t),u=l.length-1,d=this.#gn()+this.#r.ch+(this.#Qe?.left??0);for(let f=0;f<u;f++){let p=l[f],m=l[f+1],h=Math.max(r,p),g=Math.min(i,m);if(h>g)continue;let _=this.#qt(n,p,h),v=d+_,y=0;!a&&f===u-1&&o===`selection`&&(y=this.#r.ch);let b=h===g?y:this.#qt(n,p,g)-_+y;this.#Jt(e,o,t,f,v,b,s,{start:c?.line===t&&c.character===r&&h===r,end:c?.line===t&&c.character===i&&g===i})}}#qt(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=t_(r,this.#r.tabSize);return i===-1?this.#r.measureTextWidth(r):i*this.#r.ch}#Jt(e,t,n,r,i,a,o,s){if(a===0)return;let{ch:c,lineHeight:l}=this.#r,u=this.#vn(n)+r*l,d=`${t}-${n}/${r}-${i}-${a} ${o??``}`,f=this.#D,p=(this.#e.roundedSelection??!0)&&(t===`selection`||t===`caretHighlight`),m=(n,r,i,a)=>{let o=this.#vn(n)+r*l,s=this.#hn(n),u=`initial`;s!==void 0&&(s.dataset.lineType===`change-addition`||s.dataset.selectedLine!==void 0)&&(u=getComputedStyle(s).getPropertyValue(`--diffs-line-bg`));let d=`width:${c}px;transform:translateX(${i}px) translateY(${o}px);--diffs-selection-corner-bg:${u}`,p={selectionCorner:``,[a]:``},m=`${t}-block-${n}/${r}-${i}-1ch`,h=m+`-`+a;if(a===`rbl`){let t=m+`-rtl`,n=e.elements.get(t);n!==void 0&&(n.remove(),e.elements.delete(t),h+=`-rtl`,p.rtl=``)}let g=e.elements.get(h);g===void 0&&(f?.has(h)===!0?(g=f.get(h),g.style.cssText=d,f.delete(h)):g=Z(`div`,{dataset:t===`caretHighlight`?`caretHighlightRange`:`selectionRange`,style:{cssText:d},children:[Z(`div`,{dataset:p})]},e.fragment),e.elements.set(h,g))},h=t=>{let o=i+a,l=t.dataset,u=e.previousSelectionRange;if((u===void 0||u.line!==n||u.wrapLine!==r)&&(e.previousSelectionRange={element:t,line:n,wrapLine:r,left:i,width:a}),u===void 0||o<=u.left)[`rtl`,`rtr`,`rbl`,`rbr`].forEach(e=>{l[e]=``});else{let e=u.line,t=u.wrapLine,a=u.left,s=u.element.dataset,d=a+u.width;a>i&&m(e,t,a-c,`rbr`),delete s.rbl,delete l.rtl,delete l.rtr,o>=d&&delete s.rbr,o>d&&(m(e,t,d,`rbl`),l.rtr=``),o<d&&m(n,r,o,`rtl`),i<a&&(l.rtl=``),l.rbl=``,l.rbr=``}s?.start===!0&&(delete l.rtl,delete l.rbl),s?.end===!0&&(delete l.rtr,delete l.rbr)},g=e.elements.get(d);if(g!==void 0){p&&h(g);return}if(f?.has(d)===!0?(g=f.get(d),f.delete(d)):g=Z(`div`,{dataset:o?[t+`Range`,o]:t+`Range`},e.fragment),g.style.width=`${a}px`,g.style.transform=`translateX(${i}px) translateY(${u}px)`,t===`editPredictionInsertion`||t===`editPredictionReplacement`){let e=this.#hn(n);e!==void 0&&g.style.setProperty(`--diffs-edit-prediction-bg`,getComputedStyle(e).getPropertyValue(`--diffs-line-bg`))}else g.style.removeProperty(`--diffs-edit-prediction-bg`);p&&h(g),e.elements.set(d,g)}#Yt(e,t,n){let{line:r,character:i}=qm(t);if(!this.#Cn(r))return;let[a,o]=this.#yn(r,i),s=`caret-`+r+`/`+o+`:`+i;if(e.elements.has(s))return;let c=Z(`div`,{dataset:`caret`,style:{transform:`translateX(${a-1}px) translateY(${this.#vn(r)+o*this.#r.lineHeight}px)`}},e.fragment);e.elements.set(s,c),n&&(c.style.scrollMargin=this.#gt(),this.#A=c)}#Xt(){let e=this.#oe?.at(-1),t=this.#E,n=this.#n?.document,r=this.#e.renderSelectionAction,i=()=>{this.#G?.cleanup(),this.#G=void 0};if(this.#e.enabledSelectionAction!==!0||r===void 0||e===void 0||Km(e)||this.#$||t===void 0||n===void 0){i();return}let a=qm(e);if(!this.#Cn(a.line)){i();return}if(this.#G===void 0){if(!this.#K)return;let a=()=>this.#oe?.at(-1)??e,o=r({textDocument:n,get selection(){return a()},applyEdits:e=>this.applyEdits(e),getSelectionText:()=>this.#n?.document?.getText(a())??``,replaceSelectionText:e=>{this.#in(e,[a()])},close:()=>{i(),this.#ht()}});this.#G=new Jg(o,t,()=>this.#Xt()),this.#Le().resetPlacement(__)}let o=this.#r.lineHeight,s=e.direction===-1,c={placeAbove:s,anchor:a},l=s?{placeAbove:!1,anchor:e.end}:{placeAbove:!0,anchor:e.start},u=this.#G.height,d=e=>{let[t,n]=this.#yn(e.anchor.line,e.anchor.character),r=this.#vn(e.anchor.line)+n*o,i=e.placeAbove?r:r+o,a=e.placeAbove?i-u:i;return{top:a,bottom:a+u,left:t,anchorTop:i,rowTop:r}},f=d(c),p=n.lineCount,m=s?a.line<3:a.line>=p-3,h=this.#Cn(l.anchor.line)?d(l):void 0,g=this.#Le(),_=g.getPlacementBounds(),v=h!==void 0&&g.choosePlacement({preferred:f,fallback:h,viewport:_,popoverHeight:u,atDocumentEdge:m,placementKey:__})===`fallback`;h===void 0&&g.setPlacement(`preferred`,__);let{placeAbove:y}=v?l:c,{left:b,anchorTop:x}=v&&h!==void 0?h:f,S=s?f.rowTop:h?.rowTop??-1/0,C=(s?h?.rowTop??1/0:f.rowTop)+(e.end.line>e.start.line&&e.end.character===0?0:o),w=_===void 0||C>_.top&&S<_.bottom;this.#G.reposition(b,x,this.#gn(),y,w,_)}#Zt(e){if(this.#W!==void 0){this.#W.setMode(e);return}this.#Qt(e)}#Qt(e){this.#W?.cleanup();let t=this.#n?.document,n=this.#S?.shadowRoot?.querySelector(`pre`),r=this.#oe;if(t===void 0||n==null)return;let i=``,a;if(r!==void 0&&r.length>0){let e=r.at(-1);if(Km(e)){e=vh(t,e),this.#Ut([...r.slice(0,-1),e]);let n=t.getText(e);n!==``&&!n.includes(`
|
|
2018
|
-
`)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=Xm(t,e,n);this.#Ut([i]),this.#Ne(qm(i).line),this.#ht(!0),this.#fe=r},s=new qg({textDocument:t,containerElement:n,defaultQuery:i,mode:e,initialMatch:a,scrollToMatch:o,applyReplace:e=>{if(e.length===0)return;let n=t.applyEdits(e.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),!0,this.#oe);n!==void 0&&this.#un(n,void 0,this.#fn(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#se=void 0,this.#Ut(this.#oe??[]);return}if(this.#se=e,n?.syncSelection===!1){this.#Ut(this.#oe??[]);let n=this.#oe?.at(-1);if(n!==void 0){let r=t.offsetAt(n.start),i=t.offsetAt(n.end);for(let t of e)if(t[0]===r&&t[1]===i)return t}return}let r=this.#oe?.at(-1),i=0,a;r!==void 0&&(i=t.offsetAt(r.start));for(let t of e)if(t[0]>=i){a=t;break}return a===void 0?this.#Ut(this.#oe??[]):o(a,!0),a},onClose:()=>{this.#W=void 0,this.#fe=!1,this.#se=void 0,this.#Ut(this.#oe??[])}});this.#W=s,this.#fe=!1}#$t(){let e=this.#n?.document,t=this.#oe;return e===void 0||t===void 0?``:dh(e,t)}#en(){let e=this.#n?.document,t=this.#oe;return e===void 0||t===void 0?[]:uh(e,t)}#tn(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(v_,JSON.stringify(n)))}#nn(){let e=this.#n?.document,t=this.#oe;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>Km(e))){let n=gh(e,t);return this.#rn(n.edits,n.nextSelectionOffsets),n.text}let n=dh(e,t);return this.#in(``,void 0,!0),n}#rn(e,t){let n=this.#n?.document,r=this.#oe;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#un(i,a,this.#fn(i))}#in(e,t=this.#oe,n=!1,r=`selection`){if(t===void 0)return;let i=this.#n?.document,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?Lm(i,t,e,this.#L,n,r):Pm(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#L,void 0,n);s!==void 0&&this.#un(s,o,this.#fn(s))}#an(e=!1){let t=this.#oe,n=this.#n?.document;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=Gm(n,t,e,this.#L,this.#r.tabSize);i!==void 0&&this.#un(i,r,this.#fn(i))}#on(){let e=this.#oe,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Hm(t,e,this.#Ie?(e,t)=>{let n=this.#xn(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#L);r!==void 0&&this.#un(r,n,this.#fn(r))}#sn(){let e=this.#oe,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Um(t,e,this.#L);r!==void 0&&this.#un(r,n,this.#fn(r))}#cn(){let e=this.#oe,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Vm(t,e,this.#L);r!==void 0&&this.#un(r,n,this.#fn(r))}#ln(){let e=this.#oe,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Bm(t,e,this.#L);r!==void 0&&this.#un(r,n,this.#fn(r))}#un(e,t,n,r){this.#be!=null&&this.#Lt(!0);let i=this.#n?.document;if(i!==void 0&&this.#U!==void 0)for(let t of this.#U)t.anchorOffset=Zm(t.anchorOffset,e.changes),t.focusOffset=Zm(t.focusOffset,e.changes),t.caret.anchor=i.positionAt(t.anchorOffset),t.caret.focus=i.positionAt(t.focusOffset);if(e.lineDelta!==0||this.#Ie)for(let t of this.#m.keys())t>=e.startLine&&this.#m.delete(t);if(this.#h.size>0){if(e.lineDelta===0&&(e.changedLineRanges.length===1||e.changedLineChanges?.every(([,,e])=>e===0)===!0))for(let[t,n]of e.changedLineRanges)for(let e=t;e<=n;e++)this.#h.delete(e);else for(let t of this.#h.keys())t>=e.startLine&&this.#h.delete(t)}this.#_=void 0;let a=this.#B,o;if(a!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=a.startingLine+a.totalLines;if(n.end.line>=r){let t=n.end.line-a.startingLine+1,i=this.#V===void 0||this.#V===1/0?1/0:this.#V*d_;e.startLine<=r&&t<=i&&this.#je(n.end.line)?(n.end.line>r&&(o=!0),a={...a,totalLines:t},this.#B=a):o=!0}}if(this.#st(e,n,a,o),t!=null&&this.#Ut(t),this.#M?.__acknowledgeDocumentUpdate(),this.#Ee(),this.#Bt(e,r?.editSource??`user`),this.#zt(),this.#dn(e.changes,n??this.#L),r?.skipSearchRefresh!==!0&&this.#W!==void 0&&this.#se!==void 0&&this.#W.updateMatches({syncSelection:!1}),t!=null&&r?.skipFocus!==!0){let e=t.at(-1);if(e!==void 0&&this.#Ne(qm(e).line),this.#A!==void 0)requestAnimationFrame(()=>{this.#A?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=qm(t.at(-1));this.#_t(e.line,e.character)}this.focus({preventScroll:!0})}}#dn(e,t){let n=this.getFile(),r=this.#P;n!=null&&r!=null&&r(e,n,t)}#fn(e){if(this.#L!=null){let t=um(e,this.#L);if(t!=null)return this.#n?.document?.setLastUndoLineAnnotations(this.#L,t),t}}#pn(){let e=this.#w;if(e===void 0)return[];let t=[];for(let n of e.children){let e=n,r=e.dataset.lineType,i=Xp(e);if(i===void 0||r===void 0||!Jm(r))continue;let a=i-1,o=t.at(-1);o!==void 0&&a<=o[1]+1?o[1]=Math.max(o[1],a):t.push([a,a])}return t}#mn(e){let t=this.#B;return t==null||e>=t.startingLine&&e<t.startingLine+t.totalLines}#hn(e){let t=this.#g.get(e);if(t!==void 0)return t??void 0;let n=this.#B;if(!this.#mn(e))return;let r=this.#w;if(r!==void 0){if(n!==void 0){let{startingLine:i}=n,{children:a}=r;for(let n=e-i;n<=a.length;n++){let r=a[n];if(r===void 0)break;let i=Xp(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&Jm(o)){t=r;break}}}return t??=r.querySelector(`[data-line="${e+1}"]`+(this.#Pe===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#g.set(e,t),t??void 0}}#gn(){if(this.#C===void 0)return 0;if(this.#f===void 0){let e=this.#w?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);this.#f=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseInt(e.slice(0,-2),10):this.#C.offsetWidth}return this.#f}#_n(){if(this.#w===void 0)return 0;if(this.#p===void 0){let e=this.#w.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);this.#p=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseFloat(e.slice(0,-2)):this.#w.offsetWidth}return this.#p}#vn(e){let t=this.#m.get(e);if(t!==void 0)return t;let n=this.#hn(e);if(n===void 0)return-1;let r=n.offsetTop+this.#r.paddingTop;return r+=this.#Qe?.top??0,this.#m.set(e,r),r}#yn(e,t){if(this.#_!==void 0&&this.#_[0]===e&&this.#_[1]===t)return[this.#_[2],this.#_[3]];let n=this.#n?.document?.getLineText(e),r=this.#gn()+this.#r.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#Qe?.left??0),0];let i=$g(n,Math.min(t,n.length)),a=n.slice(0,i),o=t_(a,this.#r.tabSize),s=0,c=0;if(s=o===-1?r+this.#r.measureTextWidth(a):r+o*this.#r.ch,this.#Ie){let t=this.#_n();if(2*this.#r.ch+this.#r.measureTextWidth(n)>t){let t=this.#bn(e);if(t==null)return[s+(this.#Qe?.left??0),0];for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=t_(t,this.#r.tabSize);s=o===-1?r+this.#r.measureTextWidth(t):r+o*this.#r.ch;break}}}s+=this.#Qe?.left??0}return this.#_===void 0?this.#_=[e,t,s,c]:(this.#_[0]=e,this.#_[1]=t,this.#_[2]=s,this.#_[3]=c),[s,c]}#bn(e){let t=this.#h.get(e);if(t!==void 0)return t;this.#h.size>=f_&&this.#h.clear();let n=this.#n?.document?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#h.set(e,t),t}let r=this.#w;if(r==null||!r.isConnected)return;let i=Z(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#r.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=e_(n),c=t.left+this.#r.ch,l=r===void 0?n.length:r.length-1,u=e=>r===void 0?e:r[e],d=e=>{o.setStart(a,u(e)),o.setEnd(a,u(e+1));let t=o.getClientRects();return t.item(t.length-1)??o.getBoundingClientRect()};s.push(0);let f=d(0).top,p=1;for(;p<l;){let e=p,t=l;for(;e<t;){let n=e+t>>1;d(n).top>f?t=n:e=n+1}if(e>=l)break;let{left:n,top:r}=d(e),i=So()&&n-c>this.#r.ch/2;s.push(u(i?e-1:e)),f=r,p=e+1}let m=new Uint32Array(s.length+1);for(let e=0;e<s.length;e++)m[e]=s[e];return m[s.length]=n.length,this.#h.set(e,m),m}finally{i.remove()}}#xn(e){let t=this.#bn(e);if(t!==void 0)return t;let n=this.#n?.document?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Sn({startContainer:e,endContainer:t}){let n=this.#w;return n!==void 0&&n.contains(e)&&n.contains(t)}#Cn(e){let t=this.#n?.document?.lineCount??0;return e<0||e>=t?!1:this.#hn(e)!==void 0}};function b_({type:e,editStateKey:t,owner:n,initialState:r,previousSession:i}){if(r!=null&&r.type!==e)throw TypeError(`Editor: initialState: a ${r.type} state cannot initialize a ${e} editor`);let a=r;return t==null?a??i??(e===`file`?{type:`file`}:{type:`file-diff`}):Vp.activate(e,t,n,a)}function x_(e){return e instanceof HTMLElement?Number(e.dataset.bufferSize??1):1}function S_(e,t){return t!==void 0&&Number.isInteger(t.line)&&Number.isInteger(t.character)&&t.line>=0&&t.line<e.lineCount&&t.character>=0&&t.character<=e.getLineLength(t.line)}function C_(e,t){let n=e.charCodeAt(t-1),r=e.charCodeAt(t);return t>0&&t<e.length&&n>=55296&&n<=56319&&r>=56320&&r<=57343}var w_=(e,t,n)=>new y_(e,t,n);function T_(e){let t=(0,Y.c)(13),{cacheKey:n,className:r,contents:i,filePath:a,language:o,onChange:s,options:c}=e,l;t[0]!==n||t[1]!==i||t[2]!==a||t[3]!==o?(l={name:a,contents:i,lang:o,cacheKey:n},t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=l):l=t[4];let u=l,d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overscrollSize:400,intersectionObserverMargin:800},t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=e=>{let{file:t}=e;return s(t.contents)},t[6]=s,t[7]=f);let p;return t[8]!==r||t[9]!==u||t[10]!==c||t[11]!==f?(p=(0,X.jsx)(ed,{createEditor:w_,children:(0,X.jsx)(ud,{className:`min-h-0 flex-1 overflow-auto`,contentClassName:`min-h-full`,config:d,children:(0,X.jsx)(_d,{edit:!0,file:u,className:r,onEditChange:f,options:c})})}),t[8]=r,t[9]=u,t[10]=c,t[11]=f,t[12]=p):p=t[12],p}var E_=`
|
|
2019
|
-
[data-file] {
|
|
2020
|
-
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
2021
|
-
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
2022
|
-
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
2023
|
-
--diffs-token-light-bg: transparent;
|
|
2024
|
-
--diffs-token-dark-bg: transparent;
|
|
2025
|
-
background-color: var(--diffs-bg) !important;
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
[data-code],
|
|
2029
|
-
[data-content],
|
|
2030
|
-
[data-line],
|
|
2031
|
-
[data-column-number] {
|
|
2032
|
-
font-size: 11px;
|
|
2033
|
-
line-height: 1.25rem;
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
|
-
/* Pierre centers its 2px synthetic caret on the insertion boundary. Keep the
|
|
2037
|
-
caret entirely after the preceding glyph so narrow punctuation remains
|
|
2038
|
-
visibly on the correct side of the cursor. */
|
|
2039
|
-
[data-caret] {
|
|
2040
|
-
translate: 1px 0;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
[data-line-number-content] {
|
|
2044
|
-
color: color-mix(in srgb, var(--muted-foreground) 85%, transparent);
|
|
2045
|
-
}
|
|
2046
|
-
`,D_=524288,O_=new Set([`gif`,`jpeg`,`jpg`,`png`,`svg`,`webp`]),k_=new Set(`bash.c.cc.conf.cpp.css.csv.dockerfile.env.gitignore.go.h.html.ini.java.js.json.jsx.log.md.mdx.py.rs.sh.sql.toml.ts.tsx.txt.xml.yaml.yml`.split(`.`)),A_=new Map([[`css`,`css`],[`go`,`go`],[`html`,`html`],[`js`,`js`],[`json`,`json`],[`jsx`,`jsx`],[`md`,`markdown`],[`mdx`,`markdown`],[`py`,`python`],[`rs`,`rust`],[`sh`,`bash`],[`ts`,`ts`],[`tsx`,`tsx`],[`yaml`,`yaml`],[`yml`,`yaml`]]),j_=new Set([`application/javascript`,`application/json`,`application/toml`,`application/typescript`,`application/xml`,`application/x-sh`,`application/yaml`,`application/xhtml+xml`,`image/svg+xml`]);function M_(e){let t=e.split(/[?#]/,1)[0]??e;return t.toLowerCase().split(`/`).at(-1)??t.toLowerCase()}function N_(e){let t=M_(e),n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?t:t.slice(n+1)}function P_(e){let t=M_(e);return t===`dockerfile`?`dockerfile`:t===`.gitignore`?`ini`:A_.get(N_(e))??`text`}function F_(e){let t=e.mimeType?.toLowerCase().split(`;`,1)[0]?.trim();if(t?.startsWith(`image/`))return`image`;if(t&&(t.startsWith(`text/`)||j_.has(t)))return`text`;let n=N_(e.filePath);return O_.has(n)?`image`:k_.has(n)?`text`:`binary`}function I_(e,t=D_){return e>t?{state:`too-large`,shouldFetch:!1,sizeBytes:e,limitBytes:t}:{state:`within-limit`,shouldFetch:!0,sizeBytes:e,limitBytes:t}}function L_(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function R_(e){return L_(e).trim().split(/\s+/).filter(e=>e.length>0)}function z_(e,t){return t.every(t=>e.includes(t))}function B_(e,t){let n=e.lastIndexOf(`/`);for(;n>0;){if(t.has(e.slice(0,n)))return!0;n=e.lastIndexOf(`/`,n-1)}return!1}function V_(e,t){let n=R_(t);if(n.length===0)return e;let r=new Set;for(let t of e){if(t.kind!==`directory`)continue;let e=L_(t.path);z_(e,n)&&r.add(e)}return e.filter(e=>{let t=L_(e.path);return z_(t,n)||B_(t,r)})}var H_=()=>()=>{},U_=()=>null,W_=`chat_preview_tree_width`,G_=220,K_=280,q_=.55,J_=`
|
|
2047
|
-
.preview-panel-diffs-file {
|
|
2048
|
-
display: block;
|
|
2049
|
-
min-height: 100%;
|
|
2050
|
-
padding: 0.75rem;
|
|
2051
|
-
background-color: color-mix(in srgb, var(--card) 90%, var(--background));
|
|
2052
|
-
}
|
|
2053
|
-
|
|
2054
|
-
.preview-panel-file-card {
|
|
2055
|
-
container-type: inline-size;
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
@container (max-width: 360px) {
|
|
2059
|
-
.preview-panel-file-toolbar {
|
|
2060
|
-
flex-wrap: wrap;
|
|
2061
|
-
gap: 0.25rem;
|
|
2062
|
-
padding-block: 0.375rem;
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
.preview-panel-file-identity {
|
|
2066
|
-
flex-basis: 100%;
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
|
-
.preview-panel-file-actions {
|
|
2070
|
-
margin-left: auto;
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
`;function Y_(e,t){let n=Math.max(G_,Math.floor(t*q_));return Math.max(G_,Math.min(e,n))}function X_(e,t,n){let r=e.startX-n;return Y_(e.startWidth+r,t)}function Z_(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`enoent`)||t.includes(`no such file`)||t.includes(`file not found`)||t.includes(`cannot find the file`)}function Q_(e,t){return`preview:${e}:${t.length}:${_t(t).toString(36)}`}var $_=[];function ev(e){let t=(0,Y.c)(24),[n,r]=(0,J.useState)(e.open),i,a;t[0]===e.open?(i=t[1],a=t[2]):(i=()=>{if(!e.open){r(!1);return}let t=window.requestAnimationFrame(()=>r(!0));return()=>window.cancelAnimationFrame(t)},a=[e.open],t[0]=e.open,t[1]=i,t[2]=a),(0,J.useEffect)(i,a);let o=e.open&&n,s=!e.open||void 0,c=!e.open||void 0,l=e.open?`border-l border-border/70`:`border-l-0`,u=e.resizing?`transition-none`:`transition-[width,opacity] duration-[360ms] ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none`,d=e.open?`opacity-100`:`opacity-0`,f;t[3]!==l||t[4]!==u||t[5]!==d?(f=L(`min-h-0 shrink-0 overflow-hidden bg-card/20`,l,u,d),t[3]=l,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p=e.open?`${e.width}px`:`0px`,m;t[7]===p?m=t[8]:(m={width:p,maxWidth:`55%`},t[7]=p,t[8]=m);let h=e.resizing?`transition-none`:null,g=o?`translate-x-0 opacity-100`:`translate-x-4 opacity-0`,_;t[9]!==h||t[10]!==g?(_=L(`h-full min-h-0 transition-[translate,opacity] duration-[360ms] ease-[cubic-bezier(0.16,1,0.3,1)] will-change-transform motion-reduce:transition-none`,h,g),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v=`${e.width}px`,y;t[12]===v?y=t[13]:(y={width:v,maxWidth:`100%`},t[12]=v,t[13]=y);let b;t[14]!==e.children||t[15]!==_||t[16]!==y?(b=(0,X.jsx)(`div`,{className:_,style:y,children:e.children}),t[14]=e.children,t[15]=_,t[16]=y,t[17]=b):b=t[17];let x;return t[18]!==b||t[19]!==s||t[20]!==c||t[21]!==f||t[22]!==m?(x=(0,X.jsx)(`div`,{"data-preview-file-rail":!0,"aria-hidden":s,inert:c,className:f,style:m,children:b}),t[18]=b,t[19]=s,t[20]=c,t[21]=f,t[22]=m,t[23]=x):x=t[23],x}function tv(){let e=(0,Y.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(er,{className:`size-8 text-muted-foreground/65`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center`,children:(0,X.jsxs)(`div`,{className:`flex max-w-xs flex-col items-center gap-3`,children:[t,(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:`Open file`}),(0,X.jsx)(`div`,{className:`text-xs leading-5 text-muted-foreground/70`,children:`Select a file from the workspace tree.`})]})]})}),e[1]=n):n=e[1],n}function nv({mode:e=`inline`}){let{resolvedTheme:t}=gr(),n=j(),r=e===`phone`,i=se({strict:!1,select:e=>P(e)}),a=se({strict:!1,select:e=>typeof e.draftId==`string`?F.make(e.draftId):null}),o=Rr({strict:!1,select:e=>Fr(e)}),s=v((0,J.useMemo)(()=>ne(i),[i])),c=be(e=>s?null:a?e.getDraftSession(a):i?e.getDraftThreadByRef(i):null),l=(0,J.useMemo)(()=>{if(s)return{id:s.id,environmentId:s.environmentId,projectId:s.projectId,worktreePath:s.worktreePath,turnDiffSummaries:s.turnDiffSummaries};if(c)return{id:c.threadId,environmentId:c.environmentId,projectId:c.projectId,worktreePath:c.worktreePath,turnDiffSummaries:$_}},[s,c]),u=l?.projectId??null,d=v(e=>l&&u?y(e,{environmentId:l.environmentId,projectId:u}):void 0),f=l?.worktreePath??d?.cwd??null,[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(null),[b,x]=(0,J.useState)(null),[S,C]=(0,J.useState)(``),[w,T]=(0,J.useState)(!0),[D,O]=(0,J.useState)(r?!0:n.diffWordWrap),k=(0,J.useRef)(null),[A,M]=(0,J.useState)(()=>typeof window>`u`?K_:Ce(W_,p)??K_),[N,ee]=(0,J.useState)(!1),re=(0,J.useRef)(null),ie=(0,J.useRef)(o.preview===`1`),ae=(0,J.useRef)(null),oe=(0,J.useRef)(null),ce=(0,J.useRef)(null);(0,J.useEffect)(()=>{O(r?!0:n.diffWordWrap)},[r,n.diffWordWrap]),(0,J.useEffect)(()=>{h(!r&&l?.environmentId&&f?Lr({environmentId:l.environmentId,cwd:f}):null),x(null),_(null),T(!0)},[f,l?.environmentId,l?.id,r]);let le=(0,J.useMemo)(()=>{let e=(l?.turnDiffSummaries??[]).toReversed().find(e=>e.files.length>0);return e?`${e.turnId}:${e.completedAt}`:null},[l?.turnDiffSummaries]),R=(0,J.useMemo)(()=>{if(!m)return null;let e=(l?.turnDiffSummaries??[]).toReversed().find(e=>e.files.some(e=>e.path===m));return e?`${e.turnId}:${e.completedAt}`:null},[l?.turnDiffSummaries,m]),z=Bf({environmentId:l?.environmentId??null,cwd:f,enabled:!!(l?.environmentId&&f&&o.preview===`1`)}),B=z.error instanceof Error?z.error.message:z.error?`Failed to load the workspace tree.`:null,ue=z.data,de=z.data?.truncated===!0,V=z.isFetching,H=z.refetch,pe=(0,J.useMemo)(()=>V_(ue?.entries??[],S),[S,ue?.entries]),me=S.trim().length>0;(0,J.useEffect)(()=>{ue&&m&&!ue.entries.some(e=>e.path===m)&&((l?.environmentId&&f?zr({environmentId:l.environmentId,cwd:f},m):null)?.unsaved||h(null))},[f,l?.environmentId,ue,m]),(0,J.useEffect)(()=>{if(o.preview!==`1`){ae.current=le;return}if(ae.current===null){ae.current=le;return}ae.current!==le&&(ae.current=le,H())},[le,o.preview,H]),(0,J.useEffect)(()=>{let e=o.preview===`1`;e&&!ie.current&&h(null),ie.current=e},[o.preview]);let he=m?ue?.entries.find(e=>e.path===m):void 0,ge=typeof he?.sizeBytes==`number`?I_(he.sizeBytes):null,_e=Uf({environmentId:l?.environmentId??null,cwd:f,relativePath:m,enabled:!!(l?.environmentId&&f&&m&&o.preview===`1`&&(ge?.shouldFetch??!0))}),ye=_e.data?.relativePath===m?_e.data:null,xe=ye,Se=xe?.mimeType??he?.mimeType??null,U=m?F_({filePath:m,mimeType:Se}):`text`,we=_e.error instanceof Error?_e.error.message:_e.error?`Failed to load file preview.`:null,Te=_e.refetch;(0,J.useEffect)(()=>{if(!m||o.preview!==`1`){oe.current=R;return}if(oe.current===null){oe.current=R;return}oe.current!==R&&(oe.current=R,Te())},[R,o.preview,Te,m]);let Ee=(0,J.useMemo)(()=>!l?.environmentId||!f||!ye||ye.relativePath!==m?null:Pr({environmentId:l.environmentId,cwd:f},ye),[f,l?.environmentId,ye,m]),W=(0,J.useMemo)(()=>{if(r||!l?.environmentId||!f||!m)return null;let e={environmentId:l.environmentId,cwd:f};return zr(e,m)||(Ee&&U===`text`?jr(e,Ee):null)},[f,l?.environmentId,r,Ee,U,m]),K=(0,J.useSyncExternalStore)(W?.subscribe??H_,W?.getSnapshot??U_);(0,J.useEffect)(()=>{Ee&&W?.load(Ee)},[W,Ee]);let Me=Nr(K),Ne=!(r||U!==`text`||!K||K.lineEnding===`mixed`||K.diskState!==`known`),Pe=(0,J.useRef)(0);(0,J.useEffect)(()=>(Pe.current++,()=>{Pe.current++}),[W]);let Fe=(0,J.useCallback)(async e=>{if(e===m)return;let t=++Pe.current;if(W?.unsaved&&!await W.flush()){t===Pe.current&&x(e);return}t===Pe.current&&h(e)},[m,W]),Le=(0,J.useCallback)(e=>W?.change(e),[W]),Re=(0,J.useCallback)(()=>_(`discard`),[]),ze=(0,J.useCallback)(()=>_(`reload`),[]),Be=(0,J.useCallback)(()=>W?.flush(!0)??Promise.resolve(!1),[W]);(0,J.useEffect)(()=>{if(!m||!Z_(we)){ce.current=null;return}let e=`${f}\u0000${m}\u0000${we}`;if(ce.current===e)return;ce.current=e;let t=Pe.current;H().then(e=>{t===Pe.current&&(e.data?.entries.some(e=>e.path===m)||(W?.unsaved?W.markDeleted():h(null)))}).catch(()=>void 0)},[f,H,we,m,W]);let Ve=K?.saveStatus===`conflict`||K?.errorReason===`unsupported`,He=!!(Ne&&W?.unsaved&&K?.saveStatus!==`saving`&&!Ve);(0,J.useEffect)(()=>{if(!Ne||!Me)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),He&&Be())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[He,Me,Ne,Be]);let Ue=(0,J.useMemo)(()=>{let e=K?.contents??xe?.contents;return!m||U!==`text`||e===void 0?null:{name:m,contents:e,lang:P_(m),cacheKey:Q_(m,e)}},[K?.contents,xe?.contents,U,m]),Ge=(0,J.useMemo)(()=>({disableFileHeader:!0,overflow:D?`wrap`:`scroll`,theme:yt(t),themeType:t,unsafeCSS:E_,tokenizeMaxLineLength:1e3}),[t,D]),Ke=(0,J.useCallback)(e=>{if(e.button!==0||!w)return;let t=k.current?.querySelector(`[data-preview-file-rail]`)?.getBoundingClientRect().width??A;re.current={pointerId:e.pointerId,startWidth:t,startX:e.clientX},e.currentTarget.setPointerCapture(e.pointerId),ee(!0),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`},[w,A]),qe=(0,J.useCallback)(e=>{let t=re.current,n=k.current;if(!t||!n||t.pointerId!==e.pointerId)return;e.preventDefault();let r=X_(t,n.clientWidth,e.clientX);M(r)},[]),Je=(0,J.useCallback)(e=>{let t=re.current;if(!t||t.pointerId!==e.pointerId)return;let n=k.current,r=n?X_(t,n.clientWidth,e.clientX):t.startWidth;re.current=null,ee(!1),M(r),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`),typeof window<`u`&&te(W_,r,p)},[]);(0,J.useEffect)(()=>()=>{document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)},[]);let Ye=(0,J.useCallback)(()=>{H()},[H]),Xe=(0,J.useCallback)(()=>{w&&(re.current=null,ee(!1),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)),T(e=>!e)},[w]),Ze=b!==null,Qe=(0,J.useCallback)(()=>x(null),[]),q=(0,J.useCallback)(async()=>{let e=Pe.current;(!W||await W.discard())&&e===Pe.current&&(h(b),x(null))},[W,b]),$e=(0,J.useCallback)(async()=>{let e=Pe.current;await Be()&&e===Pe.current&&(h(b),x(null))},[b,Be]),et=async()=>{let e=W,t=Pe.current,n=g;if(_(null),e){if(n===`reload`)await e.reload();else if(n===`overwrite`)await e.flush(!0,!0);else if(n===`discard`){let n=e.getSnapshot().errorReason===`deleted`;await e.discard()&&n&&t===Pe.current&&h(null)}}},tt=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 px-1 [-webkit-app-region:no-drag]`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:`File Preview`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-[0.12em] text-muted-foreground/65`,children:[(0,X.jsx)(`span`,{children:`Workspace tree`}),de?(0,X.jsx)(We,{variant:`warning`,size:`sm`,className:`rounded-md px-1.5 py-0 text-[9px]`,children:`Truncated`}):null]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[r?null:(0,X.jsx)(E,{"aria-label":w?`Hide workspace tree`:`Show workspace tree`,"aria-pressed":w,title:w?`Hide workspace tree`:`Show workspace tree`,variant:`outline`,size:`icon-xs`,className:`shrink-0`,onClick:Xe,children:w?(0,X.jsx)(ui,{className:`size-3`}):(0,X.jsx)(fi,{className:`size-3`})}),(0,X.jsx)(E,{"aria-label":`Refresh workspace tree`,title:`Refresh workspace tree`,variant:`outline`,size:`icon-xs`,className:`shrink-0`,disabled:!l?.environmentId||!f||V,onClick:Ye,children:(0,X.jsx)(nr,{className:L(`size-3`,V&&`animate-spin`)})}),(0,X.jsx)(br,{"aria-label":D?`Disable preview line wrapping`:`Enable preview line wrapping`,title:D?`Disable line wrapping`:`Enable line wrapping`,variant:`outline`,size:`xs`,pressed:D,onPressedChange:e=>{O(!!e)},children:(0,X.jsx)(Si,{className:`size-3`})})]})]}),nt=ge?.state===`too-large`&&!K?(0,X.jsxs)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:[`File is too large to preview (`,ge.sizeBytes,` bytes). Limit is`,` `,ge.limitBytes,` bytes.`]}):_e.isLoading&&!ye&&!K?(0,X.jsx)(Fn,{label:`Loading file preview...`}):we&&!ye&&!K?(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:we}):(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 p-2`,children:[(0,X.jsx)(`style`,{children:J_}),(0,X.jsxs)(`div`,{className:`preview-panel-file-card flex h-full min-h-0 flex-col overflow-hidden rounded-md border border-border/70 bg-[color:color-mix(in_srgb,var(--card)_90%,var(--background))]`,children:[(0,X.jsxs)(`div`,{className:`preview-panel-file-toolbar flex min-h-10 shrink-0 items-center gap-3 border-b border-border/70 bg-[color:color-mix(in_srgb,var(--card)_94%,var(--foreground))] px-3 py-1.5 text-foreground`,children:[(0,X.jsxs)(`div`,{className:`preview-panel-file-identity flex min-w-0 flex-1 items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`truncate font-mono text-[12px] font-medium`,children:m}),Me?(0,X.jsx)(`span`,{"aria-label":`Unsaved changes`,className:`size-1.5 shrink-0 rounded-full bg-primary`,title:`Unsaved changes`}):null,K?.saveStatus===`saving`?(0,X.jsxs)(`span`,{"aria-live":`polite`,className:`flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,X.jsx)(ve,{className:`size-3 animate-spin`}),` Saving`]}):null,!r&&Ee?.lineEnding===`mixed`?(0,X.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:`Read-only · mixed line endings`}):null]}),!r&&K&&(Ne||W?.unsaved)?(0,X.jsxs)(`div`,{className:`preview-panel-file-actions flex shrink-0 items-center gap-1`,children:[(0,X.jsx)(E,{"aria-label":`Discard file changes`,disabled:!W?.unsaved,onClick:Re,size:`xs`,variant:`ghost`,children:`Discard`}),(0,X.jsxs)(E,{"aria-label":`Save file`,disabled:!He,onClick:()=>void Be(),size:`xs`,title:`Save file (Ctrl/⌘ S)`,children:[K.saveStatus===`saving`?(0,X.jsx)(ve,{className:`animate-spin`}):(0,X.jsx)(rr,{}),`Save`,(0,X.jsx)(`span`,{className:`ml-0.5 text-[9px] opacity-70`,children:`⌘S`})]})]}):null]}),K?.diskState===`unknown`?(0,X.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b border-border p-3 text-xs`,children:[`Draft discarded. Reload to read the current disk contents.`,(0,X.jsx)(E,{size:`xs`,variant:`outline`,onClick:ze,children:`Reload`})]}):null,K?.errorMessage?(0,X.jsx)(`div`,{className:`shrink-0 border-b border-border/60 p-2`,children:(0,X.jsxs)(fr,{variant:K.saveStatus===`conflict`?`warning`:`error`,className:`rounded-lg px-3 py-2 text-[11px]`,children:[K.saveStatus===`conflict`?(0,X.jsx)(fe,{className:`size-3.5`}):(0,X.jsx)(I,{className:`size-3.5`}),(0,X.jsx)(ur,{className:`text-[11px]`,children:K.errorReason===`deleted`?`File removed on disk`:K.saveStatus===`conflict`?`File changed on disk`:`Couldn’t save file`}),(0,X.jsxs)(dr,{className:`gap-2 text-[11px] leading-4`,children:[(0,X.jsx)(`span`,{children:K.errorMessage}),(0,X.jsx)(E,{className:`self-start`,onClick:K.errorReason===`deleted`?Re:()=>void ze(),size:`xs`,variant:`outline`,children:K.errorReason===`deleted`?`Close file`:`Reload`}),K.saveStatus===`conflict`&&K.errorReason!==`deleted`?(0,X.jsx)(E,{size:`xs`,variant:`outline`,onClick:()=>_(`overwrite`),children:`Overwrite`}):null]})]})}):we?(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-3 py-2 text-[11px] text-destructive`,children:[`Refresh failed: `,we]}):null,U===`image`&&xe?.base64?(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 justify-center overflow-auto bg-background/70 p-3`,children:(0,X.jsx)(`img`,{alt:m??void 0,className:`max-h-full max-w-full object-contain`,src:`data:${Se??`image/png`};base64,${xe.base64}`})}):Ne&&K?(0,X.jsx)(T_,{cacheKey:K.key,className:`preview-panel-diffs-file`,contents:K.contents,filePath:K.relativePath,language:P_(K.relativePath),onChange:Le,options:Ge}):K?.diskState===`unknown`?null:Ue?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,X.jsx)(_d,{file:Ue,className:`preview-panel-diffs-file`,options:Ge})}):(0,X.jsx)(`pre`,{className:L(`min-h-0 flex-1 bg-transparent p-3 font-mono text-[11px] leading-5 text-muted-foreground/90`,D?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:xe?.contents??``})]})]}),rt=(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,X.jsx)(`div`,{className:`shrink-0 border-b border-border/60 p-2`,children:(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(Ie,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/65`}),(0,X.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(C(``),e.currentTarget.blur())},placeholder:`Filter files...`,"aria-label":`Filter files`,className:`h-8 w-full rounded-md border border-border/70 bg-background/65 pl-8 pr-3 text-xs text-foreground outline-none transition-[border-color,background-color,box-shadow] placeholder:text-muted-foreground/55 focus:border-ring/60 focus:bg-background focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_18%,transparent)]`})]})}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[B||de?(0,X.jsxs)(fr,{variant:B?`error`:`warning`,className:`mb-2 rounded-lg border-border/70 px-3 py-2 text-[11px]`,children:[B?(0,X.jsx)(I,{className:`size-3.5`}):(0,X.jsx)(fe,{className:`size-3.5`}),(0,X.jsx)(ur,{className:`text-[11px]`,children:B?`Workspace tree refresh failed`:`Workspace tree is truncated`}),(0,X.jsx)(dr,{className:`gap-1 text-[11px] leading-4`,children:B?(0,X.jsx)(`span`,{children:B}):(0,X.jsx)(`span`,{children:`Only the first indexed workspace entries are shown here, so some files may be omitted from preview.`})})]}):null,pe.length===0?(0,X.jsx)(`div`,{className:`px-2 py-6 text-center text-xs leading-5 text-muted-foreground/70`,children:`No files match this filter.`}):(0,X.jsx)(Gf,{files:pe,allDirectoriesExpanded:me,resolvedTheme:t,onSelectFile:Fe,selectedFilePath:m,showStats:!1})]})]});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(kt,{mode:e,header:tt,children:l?z.isLoading&&!z.data?(0,X.jsx)(Fn,{label:`Loading project tree...`}):B&&!z.data?(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:B}):(z.data?.entries.length??0)===0?(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No project files available yet.`}):r?(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:m?(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center gap-1 border-b border-border/60 px-1.5`,children:[(0,X.jsx)(E,{size:`icon`,variant:`ghost`,"aria-label":`Back to workspace tree`,className:`shrink-0`,onClick:()=>h(null),children:(0,X.jsx)(Hn,{})}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,children:m})]}),nt]}):rt}):(0,X.jsxs)(`div`,{ref:k,className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(`div`,{"data-preview-content-panel":!0,className:`flex min-h-0 min-w-0 flex-1 flex-col transition-[min-width] duration-[320ms] ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none`,children:m?nt:(0,X.jsx)(tv,{})}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Resize workspace tree`,"aria-hidden":!w||void 0,className:L(`group relative shrink-0 overflow-hidden bg-background transition-[width,opacity,background-color] duration-[360ms] ease-[cubic-bezier(0.16,1,0.3,1)] hover:bg-accent/40 motion-reduce:transition-none`,w?`w-2 cursor-ew-resize opacity-100`:`w-0 opacity-0`),disabled:!w,onPointerDown:Ke,onPointerMove:qe,onPointerUp:Je,onPointerCancel:Je,children:(0,X.jsx)(`span`,{className:`absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border/80 group-hover:bg-border`})}),(0,X.jsx)(ev,{width:A,open:w,resizing:N,children:rt})]}):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to preview files.`})}),(0,X.jsx)(Oe,{open:g!==null,onOpenChange:e=>{e||_(null)},children:(0,X.jsxs)(je,{children:[(0,X.jsxs)(ke,{children:[(0,X.jsx)(G,{children:g===`overwrite`?`Overwrite the disk file?`:g===`reload`?`Reload from disk?`:`Discard file changes?`}),(0,X.jsx)(De,{children:g===`overwrite`?`Replace the current disk contents with your draft. Another external edit will stop the write.`:g===`reload`?`Replace your draft with the latest disk contents. This cannot be undone.`:`Abandon your unsaved edits without writing the file. This cannot be undone.`})]}),(0,X.jsxs)(Ae,{children:[(0,X.jsx)(E,{variant:`outline`,onClick:()=>_(null),children:`Cancel`}),(0,X.jsxs)(E,{variant:`destructive-outline`,onClick:()=>void et(),children:[`Confirm `,g]})]})]})}),(0,X.jsx)(Oe,{open:Ze,onOpenChange:e=>{e||Qe()},children:(0,X.jsxs)(je,{children:[(0,X.jsxs)(ke,{children:[(0,X.jsx)(G,{children:`Save changes before continuing?`}),(0,X.jsx)(De,{children:m?`${m} has unsaved changes.`:`This file has unsaved changes.`})]}),(0,X.jsxs)(Ae,{children:[(0,X.jsx)(E,{onClick:Qe,variant:`outline`,children:`Cancel`}),(0,X.jsx)(E,{disabled:K?.saveStatus===`saving`,onClick:q,variant:`destructive-outline`,children:b?`Discard & Open`:`Discard & Continue`}),(0,X.jsxs)(E,{disabled:!He,onClick:()=>void $e(),children:[K?.saveStatus===`saving`?(0,X.jsx)(ve,{className:`animate-spin`}):(0,X.jsx)(rr,{}),b?`Save & Open`:`Save & Continue`]})]})]})})]})}function rv(){return{phase:`awaiting-config`,lastSequence:null}}var iv=2**32,av=1024;function ov(e,t,n){if(t.deviceId!==n)return{state:e,action:{kind:`ignore`},requestKeyframe:!1};if(t.codecConfig)return{state:{phase:`awaiting-keyframe`,lastSequence:t.sequence},action:{kind:`configure`},requestKeyframe:!1};if(e.phase===`awaiting-config`)return{state:e,action:{kind:`drop`},requestKeyframe:!1};if(e.lastSequence!==null){let n=(t.sequence-e.lastSequence+iv)%iv;if(n===0||n>av)return{state:e,action:{kind:`drop`},requestKeyframe:!1};if(n>1&&!t.keyframe&&e.phase===`streaming`)return{state:{phase:`awaiting-keyframe`,lastSequence:t.sequence},action:{kind:`drop`},requestKeyframe:!0}}return e.phase===`awaiting-keyframe`&&!t.keyframe?{state:{...e,lastSequence:t.sequence},action:{kind:`drop`},requestKeyframe:!1}:{state:{phase:`streaming`,lastSequence:t.sequence},action:{kind:`decode`,keyframe:t.keyframe},requestKeyframe:!1}}function sv(e,t,n){let r=Math.min(e.displayWidth/e.frameWidth,e.displayHeight/e.frameHeight);if(!Number.isFinite(r)||r<=0)return null;let i=e.frameWidth*r,a=e.frameHeight*r,o=t-(e.displayWidth-i)/2,s=n-(e.displayHeight-a)/2;return o<0||s<0||o>i||s>a?null:{x:Math.round(o/i*e.pointWidth),y:Math.round(s/a*e.pointHeight)}}function cv(e){let t={Enter:40,Escape:41,Backspace:42,Tab:43," ":44,ArrowRight:79,ArrowLeft:80,ArrowDown:81,ArrowUp:82},n=e.toLowerCase();return n>=`a`&&n<=`z`&&n.length===1?4+n.charCodeAt(0)-97:n===`0`?39:n>=`1`&&n<=`9`&&n.length===1?30+n.charCodeAt(0)-49:t[e]??null}function lv(e){for(let t=0;t+7<e.byteLength;t+=1){let n=e[t]===0&&e[t+1]===0&&e[t+2]===0&&e[t+3]===1,r=e[t]===0&&e[t+1]===0&&e[t+2]===1;if(!n&&!r)continue;let i=t+(n?4:3);if(((e[i]??0)&31)==7)return`avc1.${[e[i+1],e[i+2],e[i+3]].map(e=>(e??0).toString(16).padStart(2,`0`)).join(``)}`}return null}function uv(e){let{canvasRef:t,udid:n,openFrameSource:r}=e,[i,a]=(0,J.useState)(`idle`),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),u=(0,J.useRef)(0);return(0,J.useEffect)(()=>{if(!n||!r){a(`idle`),s(null);return}if(typeof globalThis.VideoDecoder!=`function`||typeof globalThis.EncodedVideoChunk!=`function`){a(`unsupported`);return}let e=++u.current,i=rv(),o=null,c=null,d=null,f=()=>e===u.current;a(`connecting`),s(null);let p=()=>{d=null;try{o?.state!==`closed`&&o?.close()}catch{}o=null},m=e=>{f()&&(p(),i=rv(),s(e),a(`error`))},h=e=>{let n=lv(e.payload);if(!n){m(`The simulator sent video parameters Ryco could not read.`),c?.requestResync();return}p();let r=new VideoDecoder({output:e=>{try{if(!f())return;let n=t.current;if(!n)return;(n.width!==e.displayWidth||n.height!==e.displayHeight)&&(n.width=e.displayWidth,n.height=e.displayHeight,l({width:e.displayWidth,height:e.displayHeight})),n.getContext(`2d`)?.drawImage(e,0,0),a(`streaming`),s(null)}finally{e.close()}},error:e=>{m(e.message||`The simulator video decoder failed.`),c?.requestResync()}});try{r.configure({codec:n,optimizeForLatency:!0}),o=r,d=e.payload.slice()}catch(e){m(e instanceof Error?e.message:`Video decoder setup failed.`)}},g=(e,t)=>{if(!o||o.state!==`configured`)return;let n=e.payload;if(t&&d){let e=new Uint8Array(d.byteLength+n.byteLength);e.set(d),e.set(n,d.byteLength),n=e,d=null}try{o.decode(new EncodedVideoChunk({type:t?`key`:`delta`,timestamp:Math.round(e.header.timestampMs*1e3),data:n}))}catch(e){m(e instanceof Error?e.message:`A simulator frame could not be decoded.`),c?.requestResync()}};return c=r(n,{onFrame:e=>{if(!f())return;let t=ov(i,e.header,n);i=t.state,t.requestKeyframe&&c?.requestResync(),t.action.kind===`configure`&&h(e),t.action.kind===`decode`&&g(e,t.action.keyframe)},onReset:e=>{f()&&(p(),i=rv(),e===`decode-failed`&&s(`The simulator sent a malformed frame.`),a(`recovering`))}}),()=>{u.current+=1,c?.close(),p()}},[t,r,n]),{status:i,error:o,dimensions:c}}var dv=750,fv=524288,pv=15e3;function mv(e){let t=Math.ceil(Math.max(0,e)/fv*1e3);return Math.min(pv,Math.max(dv,t))}function hv(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}function gv(e){let t=hv(e);return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function _v(e){let{canvasRef:t,enabled:n,screenshot:r,udid:i}=e,[a,o]=(0,J.useState)(`idle`),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(!n||!i||!r){o(`idle`),c(null);return}let e=!0,a=null,s=document.visibilityState!==`hidden`,l=!0,d=!1;o(`connecting`);let f=()=>{a!==null&&(clearTimeout(a),a=null)},p=()=>e&&s&&l,m=e=>{f(),p()&&!d&&(a=setTimeout(()=>{a=null,h()},e))},h=async()=>{if(!p()||d)return;d=!0;let n=dv;try{let e=await r({udid:i});if(n=mv(e.bytesBase64.length),!p())return;let a=await createImageBitmap(new Blob([gv(e.bytesBase64)],{type:e.mimeType}));try{if(!p())return;let e=t.current;if(!e)return;(e.width!==a.width||e.height!==a.height)&&(e.width=a.width,e.height=a.height,u({width:a.width,height:a.height})),e.getContext(`2d`)?.drawImage(a,0,0),o(`streaming`),c(null)}finally{a.close()}}catch(t){if(!e)return;o(`recovering`),c(t instanceof Error?t.message:`The hosted simulator preview disconnected.`)}finally{d=!1,p()&&m(n)}},g=()=>{s=document.visibilityState!==`hidden`,s?m(0):f()};document.addEventListener(`visibilitychange`,g);let _=t.current,v=_&&typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{l=e.some(e=>e.isIntersecting),l?m(0):f()}):null;return v?.observe(_),m(0),()=>{e=!1,f(),v?.disconnect(),document.removeEventListener(`visibilitychange`,g)}},[t,n,r,i]),{status:a,error:s,dimensions:l}}var vv=`w-full rounded-md border border-border bg-background px-2 py-1.5 text-xs`;function yv(e){let[t,n]=(0,J.useState)(!1),r=(0,J.useRef)(!1),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(`dark`),[c,l]=(0,J.useState)(`accessibility-large`),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),[g,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(`location`),[b,x]=(0,J.useState)(`{"aps":{"alert":"Hello from Ryco","sound":"default"}}`),S=e.disabled||t,C=/^[A-Za-z0-9][A-Za-z0-9.-]*$/.test(g)&&g.length<=256,w=Number(u),T=Number(f),D=u.trim()!==``&&f.trim()!==``&&Number.isFinite(w)&&Number.isFinite(T)&&Math.abs(w)<=90&&Math.abs(T)<=180;async function O(t,i){if(!(e.disabled||r.current)){r.current=!0,n(!0),a(null);try{await e.testing({udid:e.udid,action:t}),a({error:!1,text:i})}catch(e){a({error:!0,text:e instanceof Error?e.message:`The simulator testing action failed.`})}finally{r.current=!1,n(!1)}}}return(0,X.jsxs)(`details`,{className:`max-h-[55%] shrink-0 overflow-y-auto border-b border-border/60 bg-card/40`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer px-3 py-2 text-xs font-medium`,children:`Simulator testing`}),(0,X.jsxs)(`div`,{className:`space-y-4 px-3 pb-3 text-xs`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`Apply test settings to this simulator. Values below are choices to apply, not a reading of its current settings.`}),e.disabled?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`Connect a booted simulator to enable testing.`}):null,(0,X.jsxs)(`fieldset`,{disabled:S,className:`space-y-2`,children:[(0,X.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Reusable presets`}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:[[`dark`,`Dark mode`],[`large-text`,`Large text`],[`dark-large-text`,`Dark + large text`],[`standard`,`Light + default text`]].map(([e,t])=>(0,X.jsx)(E,{size:`xs`,variant:`outline`,onClick:()=>void O({type:`preset`,value:e},`${t} applied.`),children:t},e))}),(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`Large text uses Accessibility Large. Presets change only appearance and/or text size.`})]}),(0,X.jsxs)(`fieldset`,{disabled:S,className:`space-y-2`,children:[(0,X.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Appearance and text size`}),(0,X.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,X.jsxs)(`label`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,X.jsx)(`span`,{children:`Appearance`}),(0,X.jsxs)(`select`,{className:vv,value:o,onChange:e=>s(e.target.value),children:[(0,X.jsx)(`option`,{value:`light`,children:`Light`}),(0,X.jsx)(`option`,{value:`dark`,children:`Dark`})]})]}),(0,X.jsx)(E,{size:`xs`,variant:`outline`,onClick:()=>void O({type:`appearance`,value:o},`Appearance applied.`),children:`Apply appearance`})]}),(0,X.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,X.jsxs)(`label`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,X.jsx)(`span`,{children:`Text size`}),(0,X.jsx)(`select`,{className:vv,value:c,onChange:e=>l(e.target.value),children:h.literals.map(e=>(0,X.jsx)(`option`,{value:e,children:e===`large`?`large (default)`:e},e))})]}),(0,X.jsx)(E,{size:`xs`,variant:`outline`,onClick:()=>void O({type:`text-size`,value:c},`Text size applied.`),children:`Apply text size`})]})]}),(0,X.jsxs)(`fieldset`,{disabled:S,className:`space-y-2`,children:[(0,X.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Location`}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsxs)(`label`,{className:`space-y-1`,children:[(0,X.jsx)(`span`,{children:`Latitude`}),(0,X.jsx)(`input`,{className:vv,type:`number`,min:-90,max:90,step:`any`,placeholder:`37.3349`,value:u,onChange:e=>d(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`space-y-1`,children:[(0,X.jsx)(`span`,{children:`Longitude`}),(0,X.jsx)(`input`,{className:vv,type:`number`,min:-180,max:180,step:`any`,placeholder:`-122.0090`,value:f,onChange:e=>p(e.target.value)})]})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(E,{size:`xs`,variant:`outline`,disabled:!D,onClick:()=>void O({type:`location`,latitude:w,longitude:T},`Simulated location applied.`),children:`Set location`}),(0,X.jsx)(E,{size:`xs`,variant:`outline`,onClick:()=>void O({type:`clear-location`},`Simulated location cleared.`),children:`Clear location`})]})]}),(0,X.jsxs)(`fieldset`,{disabled:S,className:`space-y-2`,children:[(0,X.jsx)(`legend`,{className:`mb-2 font-medium`,children:`App permissions and push`}),(0,X.jsxs)(`label`,{className:`block space-y-1`,children:[(0,X.jsx)(`span`,{children:`App bundle ID`}),(0,X.jsx)(`input`,{className:vv,maxLength:256,placeholder:`com.example.app`,value:g,onChange:e=>_(e.target.value),autoCapitalize:`none`,spellCheck:!1})]}),(0,X.jsxs)(`label`,{className:`block space-y-1`,children:[(0,X.jsx)(`span`,{children:`Permission`}),(0,X.jsx)(`select`,{className:vv,value:v,onChange:e=>y(e.target.value),children:m.literals.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`grant`,`revoke`,`reset`].map(e=>(0,X.jsx)(E,{size:`xs`,variant:`outline`,disabled:!C,onClick:()=>void O({type:`permission`,bundleId:g,service:v,decision:e},`Permission ${e} completed.`),children:e===`grant`?`Grant`:e===`revoke`?`Revoke`:`Reset to prompt`},e))}),(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`Permission changes may stop the app. Camera and notification permission changes are not supported here; allow notifications in the app before testing an alert.`}),(0,X.jsxs)(`label`,{className:`block space-y-1`,children:[(0,X.jsx)(`span`,{children:`Push payload (JSON)`}),(0,X.jsx)(`textarea`,{className:`${vv} min-h-24 font-mono`,maxLength:4096,value:b,onChange:e=>x(e.target.value),spellCheck:!1})]}),(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`Maximum 4,096 UTF-8 bytes, including an aps object. Simulates an app notification locally; it does not test APNs delivery.`}),(0,X.jsx)(E,{size:`xs`,variant:`outline`,disabled:!C||!b.trim(),onClick:()=>void O({type:`push`,bundleId:g,payload:b},`Push delivered to the simulator.`),children:`Send push`})]}),t?(0,X.jsx)(`p`,{role:`status`,children:`Applying simulator test…`}):null,i?(0,X.jsx)(`p`,{role:i.error?`alert`:`status`,className:i.error?`text-destructive`:`text-muted-foreground`,children:i.text}):null]})]})}var bv={iPhone:{pixelW:1206,pixelH:2622,screenRadius:186,frame:34,silver:8,grey:12,nubProtrude:27,nubs:[{side:`left`,at:507,len:102,name:`action`},{side:`left`,at:690,len:192,name:`volumeUp`},{side:`left`,at:927,len:192,name:`volumeDown`},{side:`right`,at:813,len:303,name:`power`}]},androidPhone:{pixelW:1080,pixelH:2400,screenRadius:100,frame:22,silver:6,grey:8,nubProtrude:18,nubs:[{side:`right`,at:480,len:130,name:`power`},{side:`right`,at:670,len:240,name:`volumeRocker`}]},iPad:{pixelW:1668,pixelH:2420,screenRadius:58,frame:64,silver:12,grey:16,nubProtrude:20,nubs:[{side:`right`,at:202,len:104,name:`volumeUp`},{side:`right`,at:328,len:104,name:`volumeDown`},{side:`top`,at:-148,len:126,name:`power`}]}},xv={filter:`drop-shadow(0 2px 6px rgb(0 0 0 / 0.2)) drop-shadow(0 12px 32px rgb(0 0 0 / 0.25))`},Sv={iPhone:3,androidPhone:1,iPad:2};function Cv(e){return e.platform.startsWith(`android`)?`androidPhone`:e.family?e.family===`tablet`?`iPad`:`iPhone`:e.name.toLowerCase().includes(`ipad`)?`iPad`:`iPhone`}function wv(e,t,n){let r=bv[e],i=t??r.pixelW,a=n??r.pixelH,o=Math.max(1,r.pixelW/i,r.pixelH/a),s=i*o,c=a*o,l=r.frame+r.silver+r.grey,u=l+r.nubProtrude;return{spec:r,edge:l,margin:u,screenW:s,screenH:c,W:s+2*u,H:c+2*u}}function Tv(e=`iPhone`,t,n){let{spec:r,margin:i,screenW:a,screenH:o,W:s,H:c}=wv(e,t,n);return{aspect:s/c,insetXPct:100*i/s,insetYPct:100*i/c,screenBorderRadius:`${100*r.screenRadius/a}% / ${100*r.screenRadius/o}%`}}function Ev(e,t,n,r,i){let a=Math.min(i,Math.min(n,r)/3.06),o=1.528665*a,s=1.088311*a,c=.868407*a,l=.631494*a,u=.372375*a,d=.16906*a,f=.066987*a,p=e+n,m=t+r,h=e=>+e.toFixed(3),g=(e,t,n,r,i,a)=>`C${h(e)} ${h(t)} ${h(n)} ${h(r)} ${h(i)} ${h(a)}`;return[`M${h(e+o)} ${h(t)}`,`L${h(p-o)} ${h(t)}`,g(p-s,t,p-c,t,p-l,t+f),g(p-u,t+d,p-d,t+u,p-f,t+l),g(p,t+c,p,t+s,p,t+o),`L${h(p)} ${h(m-o)}`,g(p,m-s,p,m-c,p-f,m-l),g(p-d,m-u,p-u,m-d,p-l,m-f),g(p-c,m,p-s,m,p-o,m),`L${h(e+o)} ${h(m)}`,g(e+s,m,e+c,m,e+l,m-f),g(e+u,m-d,e+d,m-u,e+f,m-l),g(e,m-c,e,m-s,e,m-o),`L${h(e)} ${h(t+o)}`,g(e,t+s,e,t+c,e+f,t+l),g(e+d,t+u,e+u,t+d,e+l,t+f),g(e+c,t,e+s,t,e+o,t),`Z`].join(``)}function Dv(e,t,n){let{spec:r,edge:i,W:a,H:o}=wv(e,t,n),s=e=>Ev(r.nubProtrude+e,r.nubProtrude+e,a-2*(r.nubProtrude+e),o-2*(r.nubProtrude+e),r.screenRadius+(i-e)),c=r.nubProtrude,l=(e,t,n)=>{let r=t+6,i=t+n-6;switch(e){case`left`:return{fill:`M0 ${t}h${c}v${n}H0z`,edge:`M${c} ${t}H6Q0 ${t} 0 ${r}V${i}Q0 ${t+n} 6 ${t+n}H${c}`};case`right`:return{fill:`M${a-c} ${t}H${a}v${n}H${a-c}z`,edge:`M${a-c} ${t}H${a-6}Q${a} ${t} ${a} ${r}V${i}Q${a} ${t+n} ${a-6} ${t+n}H${a-c}`};case`top`:{let e=t>=0?t:a+t-n;return{fill:`M${e} 0v${c}h${n}V0z`,edge:`M${e} ${c}V6Q${e} 0 ${e+6} 0H${e+n-6}Q${e+n} 0 ${e+n} 6V${c}`}}}},u=r.nubs.map(({side:e,at:t,len:n})=>l(e,t,n));return{W:a,H:o,outer:s(0),grey:s(r.silver),black:s(r.silver+r.grey),cutout:s(i),nubFill:u.map(e=>e.fill).join(``),nubEdge:u.map(e=>e.edge).join(``)}}var Ov=(0,J.memo)(function(e){let t=(0,Y.c)(37),{kind:n,pixelWidth:r,pixelHeight:i,className:a,style:o}=e,s=n===void 0?`iPhone`:n,c=(0,J.useId)(),l;t[0]!==s||t[1]!==i||t[2]!==r?(l=Dv(s,r,i),t[0]=s,t[1]=i,t[2]=r,t[3]=l):l=t[3];let{W:u,H:d,outer:f,grey:p,black:m,cutout:h,nubFill:g,nubEdge:_}=l,v=`0 0 ${u} ${d}`,y,b,x,S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`stop`,{offset:`0%`,stopColor:`#e8e8ec`}),b=(0,X.jsx)(`stop`,{offset:`45%`,stopColor:`#bcbcc0`}),x=(0,X.jsx)(`stop`,{offset:`55%`,stopColor:`#b4b4b8`}),S=(0,X.jsx)(`stop`,{offset:`100%`,stopColor:`#e2e2e6`}),t[4]=y,t[5]=b,t[6]=x,t[7]=S):(y=t[4],b=t[5],x=t[6],S=t[7]);let C;t[8]===c?C=t[9]:(C=(0,X.jsx)(`defs`,{children:(0,X.jsxs)(`linearGradient`,{id:c,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[y,b,x,S]})}),t[8]=c,t[9]=C);let w=`${f} ${h}`,T=`url(#${c})`,E;t[10]!==T||t[11]!==w?(E=(0,X.jsx)(`path`,{d:w,fill:T,fillRule:`evenodd`}),t[10]=T,t[11]=w,t[12]=E):E=t[12];let D=`${p} ${h}`,O;t[13]===D?O=t[14]:(O=(0,X.jsx)(`path`,{d:D,fill:`#4a4a4e`,fillRule:`evenodd`}),t[13]=D,t[14]=O);let k=`${m} ${h}`,A;t[15]===k?A=t[16]:(A=(0,X.jsx)(`path`,{d:k,fill:`#000`,fillRule:`evenodd`}),t[15]=k,t[16]=A);let j;t[17]===h?j=t[18]:(j=(0,X.jsx)(`path`,{d:h,fill:`none`,stroke:`#2a2a2c`,strokeWidth:3}),t[17]=h,t[18]=j);let M;t[19]===f?M=t[20]:(M=(0,X.jsx)(`path`,{d:f,fill:`none`,stroke:`#000`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`}),t[19]=f,t[20]=M);let N;t[21]===g?N=t[22]:(N=(0,X.jsx)(`path`,{d:g,fill:`#4a4a4e`}),t[21]=g,t[22]=N);let P;t[23]===_?P=t[24]:(P=(0,X.jsx)(`path`,{d:_,fill:`none`,stroke:`#000`,strokeWidth:1.5,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),t[23]=_,t[24]=P);let F;return t[25]!==a||t[26]!==o||t[27]!==E||t[28]!==O||t[29]!==A||t[30]!==j||t[31]!==M||t[32]!==N||t[33]!==P||t[34]!==v||t[35]!==C?(F=(0,X.jsxs)(`svg`,{viewBox:v,className:a,style:o,"aria-hidden":!0,focusable:!1,children:[C,E,O,A,j,M,N,P]}),t[25]=a,t[26]=o,t[27]=E,t[28]=O,t[29]=A,t[30]=j,t[31]=M,t[32]=N,t[33]=P,t[34]=v,t[35]=C,t[36]=F):F=t[36],F}),kv=(0,J.memo)(function(e){let t=(0,Y.c)(11),{kind:n,pixelWidth:r,pixelHeight:i,className:a,style:o}=e,s=n===void 0?`iPhone`:n,c;t[0]!==s||t[1]!==i||t[2]!==r?(c=Dv(s,r,i),t[0]=s,t[1]=i,t[2]=r,t[3]=c):c=t[3];let{W:l,H:u,outer:d,nubFill:f}=c,p=`0 0 ${l} ${u}`,m=`${d} ${f}`,h;t[4]===m?h=t[5]:(h=(0,X.jsx)(`path`,{d:m,fill:`#000`}),t[4]=m,t[5]=h);let g;return t[6]!==a||t[7]!==o||t[8]!==p||t[9]!==h?(g=(0,X.jsx)(`svg`,{viewBox:p,className:a,style:o,"aria-hidden":!0,focusable:!1,children:h}),t[6]=a,t[7]=o,t[8]=p,t[9]=h,t[10]=g):g=t[10],g}),Av={volumeUp:{label:`Volume up`,button:`volume-up`},volumeDown:{label:`Volume down`,button:`volume-down`},power:{label:`Lock`,button:`lock`}},jv={left:`active:translate-x-[1.5px]`,right:`active:-translate-x-[1.5px]`,top:`active:translate-y-[1.5px]`};function Mv(e,t,n){let{spec:r,margin:i,W:a,H:o}=wv(e,t,n);return r.nubs.map(({side:e,at:t,len:n,name:r})=>{let s={x:100*i/a,y:100*i/o};return{name:r,side:e,style:e===`top`?{top:0,height:`${s.y}%`,left:`${100*(t>=0?t:a+t-n)/a}%`,width:`${100*n/a}%`}:{[e]:0,width:`${s.x}%`,top:`${100*t/o}%`,height:`${100*n/o}%`}}})}var Nv=(0,J.memo)(function(e){let t=(0,Y.c)(50),{children:n,kind:r,pixelWidth:i,pixelHeight:a,className:o,buttonsDisabled:s,landscape:c,onPressButton:l}=e,u=r===void 0?`iPhone`:r,d=c!==void 0&&c,f;t[0]!==u||t[1]!==a||t[2]!==i?(f=Tv(u,i,a),t[0]=u,t[1]=a,t[2]=i,t[3]=f):f=t[3];let p=f,m;t[4]!==u||t[5]!==a||t[6]!==i?(m=Mv(u,i,a),t[4]=u,t[5]=a,t[6]=i,t[7]=m):m=t[7];let h=m,g=`${p.insetXPct}%`,_=`${p.insetYPct}%`,v=`${100-2*p.insetXPct}%`,y=`${100-2*p.insetYPct}%`,b;t[8]!==p.screenBorderRadius||t[9]!==g||t[10]!==_||t[11]!==v||t[12]!==y?(b={left:g,top:_,width:v,height:y,borderRadius:p.screenBorderRadius},t[8]=p.screenBorderRadius,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b):b=t[13];let x=b,S;t[14]===o?S=t[15]:(S=L(`flex h-full min-h-0 items-center justify-center p-6 [container-type:size]`,o),t[14]=o,t[15]=S);let C=d?`min(100cqw, calc(100cqh / ${p.aspect}))`:`min(100cqh, calc(100cqw / ${p.aspect}))`,w;t[16]===d?w=t[17]:(w=d?{transform:`rotate(90deg)`}:{},t[16]=d,t[17]=w);let T;t[18]!==p.aspect||t[19]!==C||t[20]!==w?(T={height:C,aspectRatio:p.aspect,...w},t[18]=p.aspect,t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==u||t[23]!==a||t[24]!==i?(E=(0,X.jsx)(kv,{kind:u,pixelWidth:i,pixelHeight:a,className:`pointer-events-none absolute inset-0 h-full w-full select-none`,style:xv}),t[22]=u,t[23]=a,t[24]=i,t[25]=E):E=t[25];let D;t[26]!==n||t[27]!==x?(D=(0,X.jsx)(`div`,{className:`absolute overflow-hidden bg-black`,style:x,children:n}),t[26]=n,t[27]=x,t[28]=D):D=t[28];let O;t[29]!==u||t[30]!==a||t[31]!==i?(O=(0,X.jsx)(Ov,{kind:u,pixelWidth:i,pixelHeight:a,className:`pointer-events-none absolute inset-0 h-full w-full select-none`}),t[29]=u,t[30]=a,t[31]=i,t[32]=O):O=t[32];let k;if(t[33]!==s||t[34]!==h||t[35]!==l){let e;t[37]!==s||t[38]!==l?(e=e=>{let{name:t,side:n,style:r}=e,i=Av[t];if(!i)return null;let a=i.button,o=a!==void 0&&l!==void 0;return!o&&!i.hint?null:(0,X.jsxs)(Ue,{children:[(0,X.jsx)(Ve,{render:o?(0,X.jsx)(`button`,{type:`button`,"aria-label":i.label,disabled:s,onClick:()=>l?.(a),className:L(`absolute cursor-pointer rounded-full outline-none`,`transition-transform duration-220 motion-reduce:transition-none`,jv[n],`focus-visible:ring-2 focus-visible:ring-ring/80`,`disabled:pointer-events-none`),style:r}):(0,X.jsx)(`span`,{"aria-label":i.label,className:`absolute cursor-default rounded-full`,style:r})}),(0,X.jsx)(He,{side:n===`top`?`top`:n,children:i.hint?`${i.label} — ${i.hint}`:i.label})]},t)},t[37]=s,t[38]=l,t[39]=e):e=t[39],k=h.map(e),t[33]=s,t[34]=h,t[35]=l,t[36]=k}else k=t[36];let A;t[40]!==T||t[41]!==E||t[42]!==D||t[43]!==O||t[44]!==k?(A=(0,X.jsxs)(`div`,{className:`relative`,style:T,children:[E,D,O,k]}),t[40]=T,t[41]=E,t[42]=D,t[43]=O,t[44]=k,t[45]=A):A=t[45];let j;return t[46]!==u||t[47]!==S||t[48]!==A?(j=(0,X.jsx)(`div`,{"data-device-kind":u,className:S,children:A}),t[46]=u,t[47]=S,t[48]=A,t[49]=j):j=t[49],j}),Pv=5e3;function Fv(e,t){return e instanceof Error&&e.message.trim()?e.message:t}function Iv(e){return e===`booted`?`Booted`:e===`booting`?`Booting`:e===`shutting-down`?`Shutting down`:`Shut down`}function Lv(e,t){return t===`waiting-for-display`?`Waiting for the display…`:t===`connecting`?`Connecting the live screen…`:t===`booting`||e.state===`booting`?`Starting the simulator…`:`Connecting…`}function Rv(e){let t=[];return e.metaKey&&t.push(`command`),e.shiftKey&&t.push(`shift`),e.altKey&&t.push(`option`),e.ctrlKey&&t.push(`control`),t}function zv(e){let t=(0,Y.c)(15),n=e.availability;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,X.jsx)(ve,{className:`size-5 animate-spin text-muted-foreground`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checking simulator support…`})]}),t[0]=e):e=t[0],e}if(n.kind===`unsupported-platform`){let e,r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ci,{className:`size-7 text-muted-foreground`}),r=(0,X.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`Device emulation is unavailable`}),t[1]=e,t[2]=r):(e=t[1],r=t[2]);let i;return t[3]===n.platform?i=t[4]:(i=(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8 text-center`,children:[e,r,(0,X.jsxs)(`p`,{className:`mt-1 max-w-sm text-xs leading-relaxed text-muted-foreground`,children:[`This environment runs on `,n.platform,`. Connect Ryco to a macOS environment with Xcode, or a macOS, Linux or Windows environment with the Android SDK.`]})]}),t[3]=n.platform,t[4]=i),i}if(n.kind===`helper-unavailable`){let e,r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(ci,{className:`size-7 text-amber-500`}),r=(0,X.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`Simulator helper could not start`}),t[5]=e,t[6]=r):(e=t[5],r=t[6]);let i;return t[7]===n.message?i=t[8]:(i=(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8 text-center`,children:[e,r,(0,X.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-relaxed text-muted-foreground`,children:n.message})]}),t[7]=n.message,t[8]=i),i}if(n.kind!==`setup-required`||n.steps.filter(Hv).every(Vv))return null;let r,i;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:`Set up simulators and emulators`}),i=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Ryco checks these steps automatically every few seconds.`}),t[9]=r,t[10]=i):(r=t[9],i=t[10]);let a;t[11]===n.steps?a=t[12]:(a=n.steps.map(Bv),t[11]=n.steps,t[12]=a);let o;return t[13]===a?o=t[14]:(o=(0,X.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8`,children:(0,X.jsxs)(`div`,{className:`w-full max-w-md`,children:[r,i,(0,X.jsx)(`div`,{className:`mt-5 space-y-2`,children:a})]})}),t[13]=a,t[14]=o),o}function Bv(e){return(0,X.jsxs)(`div`,{className:`flex gap-3 rounded-md border border-border/60 p-3`,children:[(0,X.jsx)(`span`,{className:L(`mt-0.5 size-2 shrink-0 rounded-full`,e.done?`bg-emerald-500`:`bg-amber-500`)}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium`,children:e.label}),e.detail?(0,X.jsx)(`p`,{className:`mt-1 break-words font-mono text-[10px] text-muted-foreground`,children:e.detail}):null]})]},e.id)}function Vv(e){return e.id===`build-device-helper`}function Hv(e){return!e.done}function Uv(e){let{environmentId:t,threadId:n}=e,a=Qn(d.app),o=Ge(),c=a.allowed&&(!a.hosted||o.machines.some(e=>e.environmentId===t&&e.canMutate)),l=(0,J.useRef)(null),u=(0,J.useMemo)(()=>t&&n?i(s(t,n)):null,[t,n]),f=r(e=>t?e.environmentById[t]:void 0),p=r(e=>u?e.threadByKey[u]:void 0),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)({kind:`idle`}),[b,x]=(0,J.useState)(null),S=t?ye(t)?.device:void 0,C=t?me(t)?.client.device:void 0,T=f?.generation??0,D=r(e=>e.applyThreadSnapshot),O=r(e=>e.applyInventory),k=(0,J.useCallback)(async()=>{if(!t||!n||!S)return;let[e,r]=await Promise.all([S.list({includeShutdown:!0}),S.getThreadState({threadId:n})]);O(t,T,e.devices,e.availability),D(t,T,r)},[S,O,D,t,T,n]),A=f?.availability?.kind===`setup-required`||f?.availability?.kind===`helper-unavailable`;(0,J.useEffect)(()=>{if(k().catch(()=>void 0),!A)return;let e=setInterval(()=>void k().catch(()=>void 0),Pv);return()=>clearInterval(e)},[A,k]);let j=f?.devices??p?.devices??[],M=j.find(e=>e.udid===p?.attachedDeviceUdid)??j.find(e=>e.udid===g)??null;(0,J.useEffect)(()=>{g&&p?.attachedDeviceUdid===g&&_(null)},[g,p?.attachedDeviceUdid]);let N=(0,J.useCallback)(async(e,t)=>{h(!0);try{await e()}catch(e){w.add({type:`error`,title:t,description:Fv(e,`The simulator did not respond.`)})}finally{h(!1)}},[]),P=(0,J.useCallback)(e=>{S&&n&&(_(e.udid),N(async()=>{if(e.state===`shutdown`){let t=await S.boot({udid:e.udid});if(t.kind===`boot-limit-reached`){_(null),x({requested:e,candidates:t.rycoBooted,limit:t.limit});return}}D(t,T,await S.attach({threadId:n,udid:e.udid}))},`Could not open that simulator`))},[S,D,t,T,N,n]),F=(0,J.useCallback)(e=>{if(!b||!S||!n||!t)return;let r=b;x(null),_(r.requested.udid),N(async()=>{await S.shutdown({udid:e.udid});let i=await S.boot({udid:r.requested.udid});if(i.kind===`boot-limit-reached`){_(null),x({...r,candidates:i.rycoBooted,limit:i.limit});return}D(t,T,await S.attach({threadId:n,udid:r.requested.udid}))},`Could not free a simulator slot`)},[S,D,b,t,T,N,n]),ee=!!C?.openFrameSource&&M?.platform!==`android-emulator`,te=uv({canvasRef:l,udid:ee&&M?.state===`booted`?M.udid:null,...C?.openFrameSource?{openFrameSource:C.openFrameSource}:{}}),ne=_v({canvasRef:l,udid:M?.state===`booted`?M.udid:null,enabled:!ee,screenshot:S?e=>S.screenshot(e):null}),re=ee?te.status:ne.status,ie=ee?te.error:ne.error,I=ee?te.dimensions:ne.dimensions,L=(0,J.useRef)(null),ae=(0,J.useCallback)(e=>{let t=l.current;if(!t||!I)return null;let n=t.getBoundingClientRect(),r=M?.geometry?.scale??(I.width>1400?2:3);return sv({frameWidth:I.width,frameHeight:I.height,displayWidth:n.width,displayHeight:n.height,pointWidth:M?.platform===`android-emulator`?I.width:M?.geometry?.pointWidth??I.width/r,pointHeight:M?.platform===`android-emulator`?I.height:M?.geometry?.pointHeight??I.height/r},e.clientX-n.left,e.clientY-n.top)},[M?.geometry,M?.platform,I]),oe=(0,J.useCallback)(e=>{e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId),L.current={point:ae(e),at:performance.now()}},[ae]),se=(0,J.useCallback)(e=>{let t=L.current;if(L.current=null,!t||!M||!S)return;let n=ae(e);t.point&&n&&(Math.hypot(n.x-t.point.x,n.y-t.point.y)<=8?S.tap({udid:M.udid,x:n.x,y:n.y}):S.swipe({udid:M.udid,fromX:t.point.x,fromY:t.point.y,toX:n.x,toY:n.y,durationMs:Math.max(16,Math.round(performance.now()-t.at))})).catch(e=>w.add({type:`error`,title:`Simulator input failed`,description:Fv(e,`The input could not be delivered.`)}))},[S,M,ae]),ce=(0,J.useRef)(Promise.resolve()),le=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e={active:!0,pending:0};return ce.current=Promise.resolve(),le.current=e,()=>{e.active=!1}},[S,T,u,M?.udid]);let R=(0,J.useCallback)((e,n)=>{if(!M||!S||e.metaKey||e.ctrlKey)return;let i=M.platform===`android-emulator`&&e.key.length===1?e.key:null,a=cv(e.key);if(i===null&&a===null)return;if(e.preventDefault(),M.platform!==`android-emulator`){S.keyEvent({udid:M.udid,keyCode:a,modifiers:Rv(e),direction:n}).catch(()=>void 0);return}if(n===`up`)return;let o=le.current;if(!o?.active||o.pending>=64)return;o.pending++;let s=M.udid,c=Rv(e);ce.current=ce.current.then(async()=>{let e=r.getState();o?.active&&t&&u&&e.environmentById[t]?.generation===T&&e.environmentById[t]?.status===`connected`&&e.threadByKey[u]?.attachedDeviceUdid===s&&ye(t)?.device===S&&await(i===null?S.keyEvent({udid:s,keyCode:a,modifiers:c,direction:n}):S.typeText({udid:s,text:i}))}).catch(e=>{o?.active&&(o.active=!1,w.add({type:`error`,title:`Android keyboard input failed`,description:Fv(e,`The input could not be delivered.`)}))}).finally(()=>{o.pending--})},[S,M,t,T,u]),z=(0,J.useCallback)(e=>{M&&S&&N(()=>S.pressButton({udid:M.udid,button:e}),`Simulator button failed`)},[S,M,N]),B=(0,J.useCallback)(()=>{M&&S&&N(async()=>{let e=await S.screenshot({udid:M.udid,save:!0});w.add({type:`success`,title:`Screenshot saved`,description:e.path??e.name})},`Could not save the screenshot`)},[S,M,N]),ue=(0,J.useCallback)(()=>{if(M&&S&&v.kind!==`starting`&&v.kind!==`stopping`){if(v.kind===`idle`){y({kind:`starting`}),S.startRecording({udid:M.udid}).then(e=>y({kind:`recording`,path:e.path}),e=>{y({kind:`idle`}),w.add({type:`error`,title:`Could not start recording`,description:Fv(e,`Recording failed.`)})});return}y({kind:`stopping`}),S.stopRecording({udid:M.udid}).then(e=>{y({kind:`idle`}),w.add({type:`success`,title:`Recording saved`,description:e.path})},e=>{y({kind:`idle`}),w.add({type:`error`,title:`Could not stop recording`,description:Fv(e,`The recording may be incomplete.`)})})}},[S,M,v]);if(!t||!n||!S)return(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8 text-center`,children:[(0,X.jsx)(ci,{className:`size-7 text-muted-foreground`}),(0,X.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`Simulator unavailable`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`This thread has no device connection.`})]});let de=(0,X.jsx)(zv,{availability:f?.availability??null});if(!f?.availability||f.availability.kind===`unsupported-platform`||f.availability.kind===`helper-unavailable`||f.availability.kind===`setup-required`&&f.availability.steps.some(e=>!e.done&&e.id!==`build-device-helper`))return de;let V=f.availability?.kind===`degraded`?f.availability.capabilities.filter(e=>!e.ok):[],H=M??j.find(e=>e.state===`booted`)??j[0]??null,fe=H?Cv(H):`iPhone`,pe=H?.geometry?.scale??Sv[fe],he=H?.geometry?Math.round(H.geometry.pointWidth*pe):M?I?.width:void 0,ge=H?.geometry?Math.round(H.geometry.pointHeight*pe):M?I?.height:void 0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,X.jsxs)(`div`,{className:`flex min-h-11 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,X.jsx)(ir,{className:`size-4 text-muted-foreground`}),(0,X.jsxs)(`select`,{"aria-label":`Choose a simulator or emulator`,className:`min-w-0 max-w-72 flex-1 bg-transparent text-xs font-medium outline-none`,disabled:m,value:M?.udid??``,onChange:e=>{let t=j.find(t=>t.udid===e.target.value);t&&P(t)},children:[(0,X.jsx)(`option`,{value:``,disabled:!0,children:`Choose a simulator`}),j.toSorted((e,t)=>Number(t.state===`booted`)-Number(e.state===`booted`)||e.name.localeCompare(t.name)).map(e=>(0,X.jsxs)(`option`,{value:e.udid,disabled:e.state===`booting`||e.state===`shutting-down`,children:[e.name,` — `,e.runtime,` · `,Iv(e.state)]},e.udid))]}),p?.agentActive?(0,X.jsx)(`span`,{className:`rounded-full bg-sky-500/15 px-2 py-0.5 text-[10px] font-medium text-sky-500`,children:`Agent controlling`}):null,(0,X.jsx)(E,{size:`icon-xs`,variant:`ghost`,"aria-label":`Refresh simulators`,onClick:()=>void k(),children:(0,X.jsx)(nr,{className:`size-3.5`})})]}),p?.hosts?.filter(e=>e.transport===`ssh`&&e.status!==`available`).map(e=>(0,X.jsxs)(`div`,{role:`status`,className:`border-b border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[e.name,`: `,e.availability??`Checking device host…`]},e.id)),M?.host?.transport===`ssh`?(0,X.jsx)(`div`,{role:`status`,className:`border-b border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:`Simulator testing controls are unavailable on SSH hosts.`}):M?.platform===`ios-simulator`?(0,X.jsx)(yv,{udid:M.udid,disabled:m||f?.status!==`connected`||!c||M.state!==`booted`||p?.attachedDeviceUdid!==M.udid||p?.attachPhase!=null,testing:e=>S.testing(e)},`${t}:${n}:${M.udid}:${T}`):null,V.length>0?(0,X.jsxs)(`div`,{className:`border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[10px] text-amber-700 dark:text-amber-300`,children:[`Limited by this Xcode: `,V.map(e=>e.id).join(`, `),`.`]}):null,(0,X.jsx)(`div`,{className:`relative flex min-h-0 flex-1 bg-muted/25`,children:(0,X.jsx)(Nv,{className:`min-h-0 w-full flex-1`,kind:fe,pixelWidth:he,pixelHeight:ge,buttonsDisabled:!M||m,onPressButton:z,children:M?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`canvas`,{ref:l,tabIndex:0,"aria-label":`${M.name} screen`,className:`h-full w-full touch-none object-cover outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sky-400`,onPointerDown:oe,onPointerUp:se,onPointerCancel:()=>{L.current=null},onKeyDown:e=>R(e,`down`),onKeyUp:e=>R(e,`up`)}),re===`streaming`?null:(0,X.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 flex flex-col items-center justify-center bg-black/75 p-6 text-center text-white`,children:[(0,X.jsx)(ve,{className:`size-5 animate-spin text-white/60`}),(0,X.jsx)(`p`,{className:`mt-3 text-xs font-medium`,children:re===`unsupported`?`This browser does not support WebCodecs.`:re===`recovering`?`Reconnecting the live screen…`:Lv(M,p?.attachPhase)}),ie?(0,X.jsx)(`p`,{className:`mt-2 max-w-52 text-[10px] text-white/60`,children:ie}):null]})]}):(0,X.jsx)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1 px-[12%] text-center`,children:(0,X.jsx)(`p`,{className:`text-balance text-[11px] leading-snug text-white/45`,children:`Choose a simulator to start streaming it here.`})})})}),(0,X.jsxs)(`div`,{className:`relative z-10 flex min-h-12 shrink-0 items-center justify-center gap-0.5 bg-muted/25 px-2`,children:[M?.platform===`android-emulator`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Wv,{icon:Hn,label:`Back`,disabled:m,onClick:()=>z(`back`)}),(0,X.jsx)(Wv,{icon:mi,label:`Recents`,disabled:m,onClick:()=>z(`recents`)})]}):null,(0,X.jsx)(Wv,{icon:ii,label:`Home`,disabled:!M||m,onClick:()=>z(`home`)}),(0,X.jsx)(Wv,{icon:Rn,label:`Lock`,disabled:!M||m,onClick:()=>z(`lock`)}),(0,X.jsx)(Wv,{icon:wi,label:`Volume down`,disabled:!M||m,onClick:()=>z(`volume-down`)}),(0,X.jsx)(Wv,{icon:Ei,label:`Volume up`,disabled:!M||m,onClick:()=>z(`volume-up`)}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),(0,X.jsx)(Wv,{icon:Jr,label:`Screenshot`,disabled:!M||m,onClick:B}),(0,X.jsx)(Wv,{icon:v.kind===`recording`||v.kind===`stopping`?Xr:ei,label:v.kind===`recording`?`Stop recording`:`Record screen`,active:v.kind!==`idle`,disabled:!M||M.platform===`android-emulator`||v.kind===`starting`||v.kind===`stopping`,onClick:ue}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),(0,X.jsx)(Wv,{icon:sr,label:`Detach`,disabled:!M||m,onClick:()=>void N(async()=>D(t,T,await S.detach({threadId:n})),`Could not detach the simulator`)}),(0,X.jsx)(Wv,{icon:vi,label:`Shut down`,disabled:!M||m,onClick:()=>{M&&N(()=>S.shutdown({udid:M.udid}),`Could not shut down the simulator`)}})]}),b?(0,X.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center bg-background/75 p-6 backdrop-blur-sm`,children:(0,X.jsxs)(`div`,{className:`w-full max-w-sm rounded-xl border border-border bg-card p-5 shadow-xl`,children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold`,children:`Simulator boot limit reached`}),(0,X.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:[`Ryco keeps at most `,b.limit,` simulators it booted running. Shut down one to open `,b.requested.name,`.`]}),(0,X.jsx)(`div`,{className:`mt-4 space-y-2`,children:b.candidates.map(e=>(0,X.jsxs)(E,{variant:`outline`,className:`w-full justify-between`,onClick:()=>F(e),children:[(0,X.jsxs)(`span`,{className:`truncate`,children:[`Shut down `,e.name]}),(0,X.jsx)(vi,{className:`size-3.5`})]},e.udid))}),(0,X.jsx)(E,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>x(null),children:`Cancel`})]})}):null]})}function Wv(e){let t=(0,Y.c)(11),n=e.icon,r=e.label,i=e.label,a=e.active,o=e.disabled,s=e.active&&`text-red-500`,c;t[0]===s?c=t[1]:(c=L(s),t[0]=s,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,X.jsx)(n,{className:`size-4`}),t[2]=n,t[3]=l);let u;return t[4]!==e.active||t[5]!==e.disabled||t[6]!==e.label||t[7]!==e.onClick||t[8]!==c||t[9]!==l?(u=(0,X.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:r,"aria-label":i,"aria-pressed":a,disabled:o,className:c,onClick:e.onClick,children:l}),t[4]=e.active,t[5]=e.disabled,t[6]=e.label,t[7]=e.onClick,t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function Gv(e){return e===`running`?`in_progress`:e===`failed`?`review`:e===`finished`?`done`:`idle`}function Kv(e){return e===`running`?`Working`:e===`failed`?`Needs review`:e===`finished`?`Finished`:e===`interrupted`?`Stopped`:`Idle`}function qv(e){return encodeURIComponent(e??`none`).replace(/%/g,`_`)}function Jv(e){return`thread-workspace-tab-${qv(e)}`}function Yv(e){return`thread-workspace-panel-${qv(e)}`}function Xv(e){let t=(0,Y.c)(19),n=e.active?`text-foreground`:`text-muted-foreground`,r;t[0]===n?r=t[1]:(r=L(`size-3.5 shrink-0`,n),t[0]=n,t[1]=r);let i=r;if(e.tab.mode===`agent`){let n=e.tab.avatarKey??e.tab.agentKey,r=!e.active&&`opacity-70`,i;t[2]===r?i=t[3]:(i=L(`size-3.5 shrink-0`,r),t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==i?(a=(0,X.jsx)(xt,{name:n,className:i}),t[4]=n,t[5]=i,t[6]=a):a=t[6],a}if(e.tab.key===`review`){let e;return t[7]===i?e=t[8]:(e=(0,X.jsx)(ni,{className:i}),t[7]=i,t[8]=e),e}if(e.tab.key===`terminal`){let e;return t[9]===i?e=t[10]:(e=(0,X.jsx)(Fe,{className:i}),t[9]=i,t[10]=e),e}if(e.tab.key===`browser`){let e;return t[11]===i?e=t[12]:(e=(0,X.jsx)(Ne,{className:i}),t[11]=i,t[12]=e),e}if(e.tab.key===`simulator`){let e;return t[13]===i?e=t[14]:(e=(0,X.jsx)(ir,{className:i}),t[13]=i,t[14]=e),e}if(e.tab.key===`agents`){let e;return t[15]===i?e=t[16]:(e=(0,X.jsx)(Un,{className:i}),t[15]=i,t[16]=e),e}let a;return t[17]===i?a=t[18]:(a=(0,X.jsx)(Te,{className:i}),t[17]=i,t[18]=a),a}function Zv(e){let t=(0,Y.c)(8),n;if(t[0]!==e.agent.status){let r=Gv(e.agent.status);n=mr(r,`truncate`),t[0]=e.agent.status,t[1]=n}else n=t[1];let r;t[2]===e.agent.name?r=t[3]:(r=pr(e.agent.name,{durationSeconds:2.2}),t[2]=e.agent.name,t[3]=r);let i;return t[4]!==e.agent.name||t[5]!==n||t[6]!==r?(i=(0,X.jsx)(`span`,{className:n,style:r,children:e.agent.name}),t[4]=e.agent.name,t[5]=n,t[6]=r,t[7]=i):i=t[7],i}function Qv(e){let t=(0,Y.c)(45);if(!e.subagent){let n,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{className:`mx-auto flex size-10 items-center justify-center rounded-md border border-border/70 bg-card/60 text-muted-foreground`,children:(0,X.jsx)(oi,{className:`size-4`})}),r=(0,X.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:`Subagent unavailable`}),i=(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`This tab points to a subagent that is no longer present in the current thread activity.`}),t[0]=n,t[1]=r,t[2]=i):(n=t[0],r=t[1],i=t[2]);let a;t[3]===e.agentKey?a=t[4]:(a=e.agentKey?(0,X.jsx)(`p`,{className:`mt-2 truncate font-mono text-[11px] text-muted-foreground/60`,children:e.agentKey}):null,t[3]=e.agentKey,t[4]=a);let o;return t[5]===a?o=t[6]:(o=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6 text-center`,children:(0,X.jsxs)(`div`,{className:`max-w-72`,children:[n,r,i,a]})}),t[5]=a,t[6]=o),o}let n=e.subagent.avatarKey??e.subagent.key,r;t[7]===n?r=t[8]:(r=(0,X.jsx)(xt,{name:n,className:`size-4`}),t[7]=n,t[8]=r);let i;t[9]===e.subagent?i=t[10]:(i=(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-sm font-medium`,children:(0,X.jsx)(Zv,{agent:e.subagent})}),t[9]=e.subagent,t[10]=i);let a;t[11]===e.subagent.role?a=t[12]:(a=e.subagent.role?(0,X.jsx)(`span`,{className:`max-w-36 shrink-0 truncate rounded-sm border border-border/60 bg-background/40 px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:e.subagent.role}):null,t[11]=e.subagent.role,t[12]=a);let o;t[13]===e.subagent.status?o=t[14]:(o=Kv(e.subagent.status),t[13]=e.subagent.status,t[14]=o);let s;t[15]===o?s=t[16]:(s=(0,X.jsx)(`span`,{className:`shrink-0 rounded-md border border-border/70 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:o}),t[15]=o,t[16]=s);let c;t[17]!==r||t[18]!==i||t[19]!==a||t[20]!==s?(c=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,i,a,s]}),t[17]=r,t[18]=i,t[19]=a,t[20]=s,t[21]=c):c=t[21];let l;t[22]===e.subagent.detail?l=t[23]:(l=e.subagent.detail?(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.subagent.detail}):null,t[22]=e.subagent.detail,t[23]=l);let u;t[24]!==e.subagent.effort||t[25]!==e.subagent.model||t[26]!==e.subagent.providerThreadIds||t[27]!==e.subagent.tool?(u=e.subagent.model||e.subagent.tool||e.subagent.providerThreadIds.length>0?(0,X.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-wrap items-center gap-1.5`,children:[e.subagent.model?(0,X.jsxs)(`span`,{className:`rounded-md border border-border/60 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:[e.subagent.model,e.subagent.effort?` · ${e.subagent.effort}`:``]}):null,e.subagent.tool?(0,X.jsx)(`span`,{className:`rounded-md border border-border/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e.subagent.tool}):null,e.subagent.providerThreadIds.slice(0,2).map(ey)]}):null,t[24]=e.subagent.effort,t[25]=e.subagent.model,t[26]=e.subagent.providerThreadIds,t[27]=e.subagent.tool,t[28]=u):u=t[28];let d;t[29]!==c||t[30]!==l||t[31]!==u?(d=(0,X.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[c,l,u]}),t[29]=c,t[30]=l,t[31]=u,t[32]=d):d=t[32];let f;t[33]===e.subagent.messages?f=t[34]:(f=e.subagent.messages.length>0?e.subagent.messages.map($v):null,t[33]=e.subagent.messages,t[34]=f);let p;t[35]!==e.subagent.entries||t[36]!==e.subagent.messages.length||t[37]!==e.subagent.status?(p=e.subagent.entries.length>0?e.subagent.entries.map(t=>(0,X.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-card/40 p-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:L(`size-2 shrink-0 rounded-full`,t.tone===`error`?`bg-destructive`:e.subagent?.status===`running`?`bg-sky-400`:e.subagent?.status===`interrupted`?`bg-muted-foreground/60`:`bg-emerald-400`)}),(0,X.jsx)(`p`,{className:`min-w-0 truncate text-xs font-medium text-foreground`,children:t.toolTitle??t.label})]}),t.detail?(0,X.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:t.detail}):null,t.output&&t.output!==t.detail?(0,X.jsx)(`div`,{className:`mt-3 rounded-md border border-border/50 bg-background/60 p-2`,children:(0,X.jsx)(fn,{text:t.output,cwd:void 0,isStreaming:!1})}):null]},t.id)):e.subagent.messages.length===0?(0,X.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-md border border-dashed border-border/70 bg-card/20 p-6 text-center`,children:[(0,X.jsx)(oi,{className:`size-5 text-muted-foreground/60`}),(0,X.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:`No transcript captured yet`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`The subagent is visible from lifecycle events. Detailed messages will appear here when the provider exposes them.`})]}):null,t[35]=e.subagent.entries,t[36]=e.subagent.messages.length,t[37]=e.subagent.status,t[38]=p):p=t[38];let m;t[39]!==f||t[40]!==p?(m=(0,X.jsx)(lr,{className:`min-h-0 flex-1`,children:(0,X.jsxs)(`div`,{className:`space-y-3 p-4`,children:[f,p]})}),t[39]=f,t[40]=p,t[41]=m):m=t[41];let h;return t[42]!==m||t[43]!==d?(h=(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[d,m]}),t[42]=m,t[43]=d,t[44]=h):h=t[44],h}function $v(e){return(0,X.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-card/40 p-3`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex min-w-0 items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`truncate text-xs font-medium text-foreground`,children:`Subagent`}),e.providerThreadId?(0,X.jsx)(`span`,{className:`truncate font-mono text-[10px] text-muted-foreground/55`,children:e.providerThreadId}):null]}),(0,X.jsx)(fn,{text:e.text,cwd:void 0,isStreaming:!1})]},e.id)}function ey(e){return(0,X.jsx)(`span`,{className:`max-w-40 truncate rounded-md border border-border/60 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground/70`,children:e},e)}function ty(e){let t=(0,Y.c)(8),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{className:`mx-auto flex size-10 items-center justify-center rounded-md border border-border/70 bg-card/60 text-muted-foreground`,children:(0,X.jsx)(Fe,{className:`size-4`})}),t[0]=n):n=t[0];let r;t[1]===e.title?r=t[2]:(r=(0,X.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e.title}),t[1]=e.title,t[2]=r);let i;t[3]===e.description?i=t[4]:(i=(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:e.description}),t[3]=e.description,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6 text-center`,children:(0,X.jsxs)(`div`,{className:`max-w-72`,children:[n,r,i]})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ny(){let e=(0,Y.c)(24),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1},e[0]=t):t=e[0];let r=se(t),i;e[1]===r?i=e[2]:(i=P(r),e[1]=r,e[2]=i);let a=i,o;e[3]===r.draftId?o=e[4]:(o=r.draftId?F.make(r.draftId):null,e[3]=r.draftId,e[4]=o);let c=o,l;e[5]===c?l=e[6]:(l=e=>c?e.getDraftSession(c):null,e[5]=c,e[6]=l);let u=be(l),d;bb0:{if(a){d=a;break bb0}if(!u){d=null;break bb0}let t;e[7]!==u.environmentId||e[8]!==u.threadId?(t=s(u.environmentId,u.threadId),e[7]=u.environmentId,e[8]=u.threadId,e[9]=t):t=e[9],d=t}let f=d,p;e[10]===f?p=e[11]:(p=ne(f),e[10]=f,e[11]=p);let m=v(p),h;e[12]===f?h=e[13]:(h=e=>f?e.getDraftThreadByRef(f):null,e[12]=f,e[13]=h);let g=be(h),_;e[14]!==g||e[15]!==m?(_=m?n(m.environmentId,m.projectId):g?n(g.environmentId,g.projectId):null,e[14]=g,e[15]=m,e[16]=_):_=e[16];let y=_,b;e[17]===y?b=e[18]:(b=Se(y),e[17]=y,e[18]=b);let x=v(b),S;return e[19]!==g||e[20]!==x||e[21]!==m||e[22]!==f?(S={threadRef:f,serverThread:m,draftThread:g,project:x},e[19]=g,e[20]=x,e[21]=m,e[22]=f,e[23]=S):S=e[23],S}function ry(){let e=(0,Y.c)(3),{threadRef:t,serverThread:n,draftThread:r,project:i}=ny(),a=t?.environmentId??null,o=n?.worktreePath??r?.worktreePath??i?.cwd??null,s;return e[0]!==a||e[1]!==o?(s=(0,X.jsx)(tr,{environmentId:a,cwd:o}),e[0]=a,e[1]=o,e[2]=s):s=e[2],s}function iy(){let e=(0,Y.c)(70),{threadRef:t,serverThread:n,draftThread:r,project:a}=ny(),o;e[0]===t?o=e[1]:(o=e=>N(e.terminalStateByThreadKey,t),e[0]=t,e[1]=o);let s=O(o),c;e[2]===t?c=e[3]:(c=e=>t?e.terminalLaunchContextByThreadKey[i(t)]??null:null,e[2]=t,e[3]=c);let l=O(c),u=O(fy),d=O(dy),f=O(uy),p=O(ly),m=O(cy),h=O(sy),g=k(),_=Kn(),[v,y]=(0,J.useState)(0),b=n?.worktreePath??r?.worktreePath??null,x=l?.worktreePath??b;l?.cwd;let S;e[4]!==x||e[5]!==a||e[6]!==l?.cwd?(S=l?.cwd??(a?vn({project:{cwd:a.cwd},worktreePath:x}):null),e[4]=x,e[5]=a,e[6]=l?.cwd,e[7]=S):S=e[7];let C=S,w;e[8]!==x||e[9]!==a?(w=a?Tn({project:{cwd:a.cwd},worktreePath:x}):{},e[8]=x,e[9]=a,e[10]=w):w=e[10];let T=w,E;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(E={context:{terminalFocus:!0,terminalOpen:!0}},e[11]=E):E=e[11];let D=E,A;e[12]===g?A=e[13]:(A=Mr(g,`terminal.split`,D),e[12]=g,e[13]=A);let j=A,M;e[14]===g?M=e[15]:(M=Mr(g,`terminal.new`,D),e[14]=g,e[15]=M);let P=M,F;e[16]===g?F=e[17]:(F=Mr(g,`terminal.close`,D),e[16]=g,e[17]=F);let ee=F,te,ne;e[18]!==u||e[19]!==s.terminalOpen||e[20]!==t?(te=()=>{t&&s.terminalOpen&&u(t,!1)},ne=[u,s.terminalOpen,t],e[18]=u,e[19]=s.terminalOpen,e[20]=t,e[21]=te,e[22]=ne):(te=e[21],ne=e[22]),(0,J.useEffect)(te,ne);let ie;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>{y(oy)},e[23]=ie):ie=e[23];let I=ie,L;e[24]!==u||e[25]!==f||e[26]!==t?(L=()=>{t&&(f(t,`terminal-${re()}`),u(t,!1),I())},e[24]=u,e[25]=f,e[26]=t,e[27]=L):L=e[27];let ae=L,oe;e[28]!==p||e[29]!==u||e[30]!==t?(oe=()=>{t&&(p(t,`terminal-${re()}`),u(t,!1),I())},e[28]=p,e[29]=u,e[30]=t,e[31]=oe):oe=e[31];let se=oe,ce;e[32]!==m||e[33]!==t?(ce=e=>{t&&(m(t,e),I())},e[32]=m,e[33]=t,e[34]=ce):ce=e[34];let le=ce,R;e[35]!==d||e[36]!==t?(R=e=>{t&&d(t,e)},e[35]=d,e[36]=t,e[37]=R):R=e[37];let z=R,B;e[38]!==h||e[39]!==u||e[40]!==s.terminalIds.length||e[41]!==t?(B=e=>{if(!t)return;let n=ye(t.environmentId);if(!n)return;let r=s.terminalIds.length<=1;on.close({threadRef:t,terminalId:e},n.terminal,r).catch(ay),h(t,e),u(t,!1),I()},e[38]=h,e[39]=u,e[40]=s.terminalIds.length,e[41]=t,e[42]=B):B=e[42];let ue=B,de;e[43]===_?de=e[44]:(de=e=>{_?.current?.addTerminalContext(e)},e[43]=_,e[44]=de);let V=de;if(!t){let t;return e[45]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(ty,{title:`Terminal unavailable`,description:`No active thread is available for this workspace terminal.`}),e[45]=t):t=e[45],t}if(!a||!C){let t;return e[46]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(ty,{title:`Terminal unavailable`,description:`This thread does not have a resolved project directory.`}),e[46]=t):t=e[46],t}let H=t.threadId,fe=j??void 0,pe=P??void 0,me=ee??void 0,he;return e[47]!==le||e[48]!==V||e[49]!==ue||e[50]!==se||e[51]!==C||e[52]!==x||e[53]!==v||e[54]!==g||e[55]!==T||e[56]!==z||e[57]!==ae||e[58]!==H||e[59]!==fe||e[60]!==pe||e[61]!==me||e[62]!==s.activeTerminalGroupId||e[63]!==s.activeTerminalId||e[64]!==s.runningTerminalIds||e[65]!==s.terminalGroups||e[66]!==s.terminalHeight||e[67]!==s.terminalIds||e[68]!==t?(he=(0,X.jsx)(ar,{threadRef:t,threadId:H,cwd:C,worktreePath:x,runtimeEnv:T,layout:`panel`,visible:!0,height:s.terminalHeight,terminalIds:s.terminalIds,runningTerminalIds:s.runningTerminalIds,activeTerminalId:s.activeTerminalId,terminalGroups:s.terminalGroups,activeTerminalGroupId:s.activeTerminalGroupId,focusRequestId:v,onSplitTerminal:ae,onNewTerminal:se,splitShortcutLabel:fe,newShortcutLabel:pe,closeShortcutLabel:me,keybindings:g,onActiveTerminalChange:le,onCloseTerminal:ue,onHeightChange:z,onAddTerminalContext:V}),e[47]=le,e[48]=V,e[49]=ue,e[50]=se,e[51]=C,e[52]=x,e[53]=v,e[54]=g,e[55]=T,e[56]=z,e[57]=ae,e[58]=H,e[59]=fe,e[60]=pe,e[61]=me,e[62]=s.activeTerminalGroupId,e[63]=s.activeTerminalId,e[64]=s.runningTerminalIds,e[65]=s.terminalGroups,e[66]=s.terminalHeight,e[67]=s.terminalIds,e[68]=t,e[69]=he):he=e[69],he}function ay(){}function oy(e){return e+1}function sy(e){return e.closeTerminal}function cy(e){return e.setActiveTerminal}function ly(e){return e.newTerminal}function uy(e){return e.splitTerminal}function dy(e){return e.setTerminalHeight}function fy(e){return e.setTerminalOpen}function py(e){let t=(0,Y.c)(38),n=e.icon,r=e.disabled,i=e.onClick,a=e.compact?`min-h-0 px-1 py-1 @sm/workspace-launcher:px-4 @sm/workspace-launcher:py-3`:`min-h-32 px-5 py-6`,o=e.disabled?`cursor-not-allowed opacity-45`:`hover:border-border hover:bg-card/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,s;t[0]!==a||t[1]!==o?(s=L(`group flex w-full flex-col items-center justify-center rounded-lg border border-border/50 bg-card/35 text-center transition-colors`,a,o),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=e.compact?`size-4 @sm/workspace-launcher:size-6`:`size-6`,l=!e.disabled&&`group-hover:text-foreground`,u;t[3]!==c||t[4]!==l?(u=L(`text-muted-foreground transition-colors`,c,l),t[3]=c,t[4]=l,t[5]=u):u=t[5];let d;t[6]!==n||t[7]!==u?(d=(0,X.jsx)(n,{className:u}),t[6]=n,t[7]=u,t[8]=d):d=t[8];let f=e.badgeCount??0,p;t[9]===f?p=t[10]:(p=(0,X.jsx)(tt,{count:f,className:`-top-2 -right-3 h-4 min-w-4 px-1 text-[9px]`}),t[9]=f,t[10]=p);let m;t[11]!==p||t[12]!==d?(m=(0,X.jsxs)(`span`,{className:`relative inline-flex`,children:[d,p]}),t[11]=p,t[12]=d,t[13]=m):m=t[13];let h;t[14]===e.badgeCount?h=t[15]:(h=(e.badgeCount??0)>0?(0,X.jsx)(`span`,{className:`sr-only`,children:$e(e.badgeCount??0)}):null,t[14]=e.badgeCount,t[15]=h);let g=e.compact?`mt-1 text-xs @sm/workspace-launcher:mt-3 @sm/workspace-launcher:text-base`:`mt-4 text-base`,_;t[16]===g?_=t[17]:(_=L(`font-semibold text-foreground`,g),t[16]=g,t[17]=_);let v;t[18]!==e.label||t[19]!==_?(v=(0,X.jsx)(`span`,{className:_,children:e.label}),t[18]=e.label,t[19]=_,t[20]=v):v=t[20];let y=e.compact?`mt-0.5 hidden text-xs @sm/workspace-launcher:block`:`mt-1 text-sm`,b;t[21]===y?b=t[22]:(b=L(`text-muted-foreground`,y),t[21]=y,t[22]=b);let x;t[23]!==e.description||t[24]!==b?(x=(0,X.jsx)(`span`,{className:b,children:e.description}),t[23]=e.description,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==e.compact||t[27]!==e.shortcutLabel?(S=e.shortcutLabel?(0,X.jsx)(`span`,{className:L(`rounded-md bg-muted px-1.5 py-0.5 font-medium text-[11px] text-muted-foreground`,e.compact?`mt-2 hidden @sm/workspace-launcher:inline-flex`:`mt-3`),children:e.shortcutLabel}):null,t[26]=e.compact,t[27]=e.shortcutLabel,t[28]=S):S=t[28];let C;return t[29]!==e.disabled||t[30]!==e.onClick||t[31]!==m||t[32]!==h||t[33]!==v||t[34]!==x||t[35]!==S||t[36]!==s?(C=(0,X.jsxs)(`button`,{type:`button`,disabled:r,onClick:i,"data-slot":`workspace-launcher-card`,className:s,children:[m,h,v,x,S]}),t[29]=e.disabled,t[30]=e.onClick,t[31]=m,t[32]=h,t[33]=v,t[34]=x,t[35]=S,t[36]=s,t[37]=C):C=t[37],C}function my(e){let t=(0,Y.c)(67),n=k(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={key:`files`,label:`Files`,mode:`files`},t[0]=r):r=t[0];let i=r,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={key:`review`,label:`Review`,mode:`review`},t[1]=a):a=t[1];let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={key:`terminal`,label:`Terminal`,mode:`terminal`},t[2]=s):s=t[2];let c=s,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={key:`simulator`,label:`Simulator`,mode:`simulator`},t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={key:`agents`,label:`Agents`,mode:`agents`},t[4]=d):d=t[4];let f=d,p;t[5]===n?p=t[6]:(p=Mr(n,`workspace.files`),t[5]=n,t[6]=p);let m=p,h;t[7]===n?h=t[8]:(h=Mr(n,`workspace.review`),t[7]=n,t[8]=h);let g=h,_;t[9]===n?_=t[10]:(_=Mr(n,`workspace.terminal`),t[9]=n,t[10]=_);let v=_,y;t[11]===n?y=t[12]:(y=Mr(n,`workspace.simulator`),t[11]=n,t[12]=y);let b=y,x,S;if(t[13]!==m||t[14]!==e||t[15]!==g||t[16]!==b||t[17]!==v){let n=e.tabs.filter(hy),r=!e.isPhoneSurface,a;t[20]===e?a=t[21]:(a=()=>e.onSelectTab(i),t[20]=e,t[21]=a);let s;t[22]!==r||t[23]!==m||t[24]!==a?(s=(0,X.jsx)(py,{label:`Files`,description:`Browse project files`,icon:ze,shortcutLabel:m,compact:r,onClick:a}),t[22]=r,t[23]=m,t[24]=a,t[25]=s):s=t[25];let l=e.isPhoneSurface||!e.activeThread,d;t[26]!==r||t[27]!==e.onOpenSideChat||t[28]!==l?(d=(0,X.jsx)(py,{label:`Side chat`,description:`Start a side conversation`,icon:Gt,compact:r,disabled:l,onClick:e.onOpenSideChat}),t[26]=r,t[27]=e.onOpenSideChat,t[28]=l,t[29]=d):d=t[29];let p;t[30]===e?p=t[31]:(p=()=>e.onSelectTab({key:`browser`,label:`Browser`,mode:`browser`}),t[30]=e,t[31]=p);let h;t[32]!==r||t[33]!==e.isPhoneSurface||t[34]!==p?(h=(0,X.jsx)(py,{label:`Browser`,description:`Preview sites and local servers`,icon:Ne,compact:r,disabled:e.isPhoneSurface,onClick:p}),t[32]=r,t[33]=e.isPhoneSurface,t[34]=p,t[35]=h):h=t[35];let _;t[36]===e?_=t[37]:(_=()=>e.onSelectTab(o),t[36]=e,t[37]=_);let y;t[38]!==r||t[39]!==g||t[40]!==_?(y=(0,X.jsx)(py,{label:`Review`,description:`View code changes`,icon:ni,shortcutLabel:g,compact:r,onClick:_}),t[38]=r,t[39]=g,t[40]=_,t[41]=y):y=t[41];let C;t[42]===e?C=t[43]:(C=()=>e.onSelectTab(c),t[42]=e,t[43]=C);let w;t[44]!==r||t[45]!==C||t[46]!==v?(w=(0,X.jsx)(py,{label:`Terminal`,description:`Start an interactive shell`,icon:Fe,shortcutLabel:v,compact:r,onClick:C}),t[44]=r,t[45]=C,t[46]=v,t[47]=w):w=t[47];let T;t[48]!==r||t[49]!==e||t[50]!==b?(T=e.showSimulator?(0,X.jsx)(py,{label:`Simulator`,description:`Run and control an iOS app`,icon:ir,shortcutLabel:b,compact:r,onClick:()=>e.onSelectTab(u)}):null,t[48]=r,t[49]=e,t[50]=b,t[51]=T):T=t[51];let E;t[52]!==r||t[53]!==e?(E=e.showAgents?(0,X.jsx)(py,{label:`Agents`,description:`Watch subagents and workflows run`,icon:Un,badgeCount:e.liveAgentCount,compact:r,onClick:()=>e.onSelectTab(f)}):null,t[52]=r,t[53]=e,t[54]=E):E=t[54];let D;t[55]!==s||t[56]!==d||t[57]!==h||t[58]!==y||t[59]!==w||t[60]!==T||t[61]!==E?(D=(0,X.jsxs)(X.Fragment,{children:[s,d,h,y,w,T,E]}),t[55]=s,t[56]=d,t[57]=h,t[58]=y,t[59]=w,t[60]=T,t[61]=E,t[62]=D):D=t[62],x=D,S=n.length>0?(0,X.jsx)(`div`,{className:`mx-auto w-full max-w-lg space-y-2 pt-1`,children:n.map(t=>(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-center gap-3 rounded-lg border border-border/50 bg-card/35 px-4 py-3 text-left transition-colors hover:border-border hover:bg-card/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>e.onSelectTab(t),children:[(0,X.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-border/50 bg-background/50 text-muted-foreground`,children:(0,X.jsx)(xt,{name:t.avatarKey??t.agentKey,className:`size-5`})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:L(`block truncate text-sm font-medium`,mr(Gv(t.status))),style:pr(t.label,{durationSeconds:2.2}),children:t.label}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:Kv(t.status)})]})]},t.key))}):null,t[13]=m,t[14]=e,t[15]=g,t[16]=b,t[17]=v,t[18]=x,t[19]=S}else x=t[18],S=t[19];let C=S,w;return t[63]!==C||t[64]!==x||t[65]!==e.isPhoneSurface?(w=(0,X.jsx)(lr,{className:`h-full`,children:e.isPhoneSurface?(0,X.jsx)(`div`,{className:`flex min-h-full p-5 sm:p-6`,children:(0,X.jsxs)(`div`,{className:`m-auto w-full max-w-lg space-y-4`,children:[x,C]})}):(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4 sm:p-5`,"data-slot":`workspace-launcher`,children:[(0,X.jsx)(`div`,{className:`@container/workspace-launcher flex min-h-0 flex-1 items-center justify-center`,children:(0,X.jsx)(`div`,{className:`grid aspect-square grid-cols-3 grid-rows-3 gap-2 @sm/workspace-launcher:gap-3`,"data-slot":`workspace-launcher-grid`,style:{inlineSize:`min(100cqw, 100cqh, 32rem)`},children:x})}),C]})}),t[63]=C,t[64]=x,t[65]=e.isPhoneSurface,t[66]=w):w=t[66],w}function hy(e){return e.mode===`agent`}function gy(e){let n=(0,Y.c)(134),{onClosePanelTab:r,onToggleMaximized:a}=e,o=e.maximized??!1,c=e.mode===`phone`,l=Ke(),u;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={strict:!1},n[0]=u):u=n[0];let d=se(u),f;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(f={strict:!1,select:Dy},n[1]=f):f=n[1];let p=Rr(f),m;n[2]===d?m=n[3]:(m=P(d),n[2]=d,n[3]=m);let h=m,g;n[4]===d.draftId?g=n[5]:(g=d.draftId?F.make(d.draftId):null,n[4]=d.draftId,n[5]=g);let _=g,y;n[6]===_?y=n[7]:(y=e=>_?e.getDraftSession(_):null,n[6]=_,n[7]=y);let b=be(y),x;n[8]!==h||n[9]!==b?(x=h??(b?s(b.environmentId,b.threadId):null),n[8]=h,n[9]=b,n[10]=x):x=n[10];let C=x,w;n[11]===C?w=n[12]:(w=ne(C),n[11]=C,n[12]=w);let T=v(w),O;n[13]===T?.session?O=n[14]:(O=D(T?.session??null)!==`disconnected`&&T?.session?.orchestrationStatus!==`stopped`&&T?.session?.orchestrationStatus!==`interrupted`&&T?.session?.orchestrationStatus!==`error`,n[13]=T?.session,n[14]=O);let k=O;T?.activities,T?.latestTurn?.state;let A;n[15]!==T?.activities||n[16]!==T?.latestTurn?.state||n[17]!==k?(A=Wn(T?.activities??[],{sessionLive:k,parentTurnState:T?.latestTurn?.state??null}),n[15]=T?.activities,n[16]=T?.latestTurn?.state,n[17]=k,n[18]=A):A=n[18];let j=A,M=(p.workspaceTab===`agent`||p.workspaceTab===`agents`)&&p.workspaceAgentKey?p.workspaceAgentKey:null,N;n[19]!==M||n[20]!==j?(N=Jn(j,M),n[19]=M,n[20]=j,n[21]=N):N=n[21];let te=N,re;n[22]!==e.panelMode||n[23]!==p?(re=Wr(p)??e.panelMode,n[22]=e.panelMode,n[23]=p,n[24]=re):re=n[24];let ie=re,I=!c&&ie===`agent`?`agents`:ie;T?.activities;let ae;n[25]!==T?.activities||n[26]!==k||n[27]!==j?(ae=ue({activities:T?.activities??[],transcriptSubagents:j,sessionLive:k}),n[25]=T?.activities,n[26]=k,n[27]=j,n[28]=ae):ae=n[28];let oe=ae,ce;bb0:{if(I===`files`||I===`review`||I===`terminal`||I===`simulator`||I===`browser`||I===`agents`){let t;n[29]!==I||n[30]!==e.openedPanelModes?(t=e.openedPanelModes.includes(I)?e.openedPanelModes:[...e.openedPanelModes,I],n[29]=I,n[30]=e.openedPanelModes,n[31]=t):t=n[31],ce=t;break bb0}ce=e.openedPanelModes}let le=ce,R;if(n[32]!==M||n[33]!==c||n[34]!==le||n[35]!==e.openedAgentKeys||n[36]!==j){let t=Iu({subagents:j,activeAgentKey:M,openedAgentKeys:e.openedAgentKeys,openedPanelModes:le,groupAgents:!c});R=c?t.filter(Ey):t,n[32]=M,n[33]=c,n[34]=le,n[35]=e.openedAgentKeys,n[36]=j,n[37]=R}else R=n[37];let z=R,B=I===`agent`?M:c&&(I===`agents`||I===`browser`)?null:I,de;n[38]!==l||n[39]!==d.draftId||n[40]!==h?(de=e=>{if(d.draftId){l({to:`/draft/$draftId`,params:{draftId:F.make(d.draftId)},replace:!0,search:e});return}h&&l({to:`/$environmentId/$threadId`,params:S(h),replace:!0,search:e})},n[38]=l,n[39]=d.draftId,n[40]=h,n[41]=de):de=n[41];let V=de,H,fe;n[42]!==M||n[43]!==c||n[44]!==V||n[45]!==ie?(H=()=>{!c&&ie===`agent`&&M&&V(e=>Sr(e,M))},fe=[c,ie,M,V],n[42]=M,n[43]=c,n[44]=V,n[45]=ie,n[46]=H,n[47]=fe):(H=n[46],fe=n[47]),(0,J.useEffect)(H,fe);let pe;n[48]===V?pe=n[49]:(pe=e=>{if(e.mode===`review`){V(Ty);return}if(e.mode===`files`){V(wy);return}if(e.mode===`terminal`){V(Cy);return}if(e.mode===`browser`){V(Sy);return}if(e.mode===`simulator`){V(xy);return}if(e.mode===`agents`){V(by);return}e.mode===`agent`&&V(t=>Or(t,e.agentKey))},n[48]=V,n[49]=pe);let me=pe,he;n[50]===V?he=n[51]:(he=()=>{V(yy)},n[50]=V,n[51]=he);let ge=he,_e;n[52]!==c||n[53]!==V?(_e=e=>{let t=e.startsWith(`subagent:`)?e:`subagent:${e}`;V(e=>c?Or(e,t):Sr(e,t))},n[52]=c,n[53]=V,n[54]=_e):_e=n[54];let ve=_e,xe;n[55]===r?xe=n[56]:(xe=e=>{r({mode:e.mode,...e.mode===`agent`?{agentKey:e.agentKey}:{}})},n[55]=r,n[56]=xe);let Se=xe,U;n[57]!==me||n[58]!==z?(U=(e,t)=>{let n=z.findIndex(t=>t.key===e.key);if(n<0)return;let r=e=>{let t=z[(e+z.length)%z.length];t&&me(t)};switch(t.key){case`ArrowRight`:case`ArrowDown`:t.preventDefault(),r(n+1);return;case`ArrowLeft`:case`ArrowUp`:t.preventDefault(),r(n-1);return;case`Home`:t.preventDefault(),r(0);return;case`End`:t.preventDefault(),r(z.length-1);return}},n[57]=me,n[58]=z,n[59]=U):U=n[59];let Ce=U,we;n[60]===V?we=n[61]:(we=()=>{V(vy)},n[60]=V,n[61]=we);let Te=we,Ee=c?`h-14`:`h-12`,De=!c&&`transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none`,Oe=e.reserveChromeInset&&hr,W=o&&t&&`drag-region wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]`,G;n[62]!==Ee||n[63]!==De||n[64]!==Oe||n[65]!==W?(G=L(`flex shrink-0 items-center gap-1 border-b border-border bg-card/40 px-2`,Ee,De,Oe,W),n[62]=Ee,n[63]=De,n[64]=Oe,n[65]=W,n[66]=G):G=n[66];let K;n[67]!==Te||n[68]!==c?(K=c?(0,X.jsx)(E,{size:`icon`,variant:`ghost`,"aria-label":`Back to thread`,className:`shrink-0`,onClick:Te,children:(0,X.jsx)(Hn,{})}):null,n[67]=Te,n[68]=c,n[69]=K):K=n[69];let ke;if(n[70]!==B||n[71]!==Se||n[72]!==c||n[73]!==Ce||n[74]!==me||n[75]!==z){let e;n[77]!==B||n[78]!==Se||n[79]!==c||n[80]!==Ce||n[81]!==me?(e=e=>{let t=B===e.key;return(0,X.jsxs)(`div`,{className:L(`flex min-w-0 shrink-0 items-center rounded-md text-sm transition-colors`,c?`h-11`:`h-8`,t?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,X.jsxs)(`button`,{type:`button`,id:Jv(e.key),role:`tab`,"aria-selected":t,"aria-controls":Yv(e.key),tabIndex:t?0:-1,className:L(`flex h-full min-w-0 items-center gap-1.5`,c?`pl-3 pr-1.5`:`pl-2.5 pr-1`),onClick:()=>me(e),onKeyDown:t=>Ce(e,t),children:[(0,X.jsx)(Xv,{tab:e,active:t}),(0,X.jsx)(`span`,{className:L(`max-w-32 truncate`,e.mode===`agent`&&mr(Gv(e.status))),style:e.mode===`agent`?pr(e.label,{durationSeconds:2.2}):void 0,children:e.label})]}),(0,X.jsx)(`button`,{type:`button`,className:L(`mr-1 flex size-5 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-colors hover:bg-background/60 hover:text-foreground`,c&&`relative after:absolute after:top-1/2 after:left-1/2 after:size-11 after:-translate-x-1/2 after:-translate-y-1/2`),"aria-label":`Close ${e.label} tab`,onClick:()=>Se(e),children:(0,X.jsx)(ee,{className:`size-3`})})]},e.key)},n[77]=B,n[78]=Se,n[79]=c,n[80]=Ce,n[81]=me,n[82]=e):e=n[82],ke=z.map(e),n[70]=B,n[71]=Se,n[72]=c,n[73]=Ce,n[74]=me,n[75]=z,n[76]=ke}else ke=n[76];let Ae=c?`size-11`:`size-6`,je=!I&&`bg-muted text-foreground`,Me;n[83]!==Ae||n[84]!==je?(Me=L(`flex shrink-0 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-muted/60 hover:text-foreground`,Ae,je),n[83]=Ae,n[84]=je,n[85]=Me):Me=n[85];let Ne=!I,Pe;n[86]!==ge||n[87]!==Me||n[88]!==Ne?(Pe=(0,X.jsx)(`button`,{type:`button`,className:Me,"aria-label":`Workspace launcher`,"aria-pressed":Ne,onClick:ge}),n[86]=ge,n[87]=Me,n[88]=Ne,n[89]=Pe):Pe=n[89];let Fe;n[90]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,X.jsx)(Br,{className:`size-3.5`}),n[90]=Fe):Fe=n[90];let Ie;n[91]===Pe?Ie=n[92]:(Ie=(0,X.jsx)(Ve,{render:Pe,children:Fe}),n[91]=Pe,n[92]=Ie);let Le;n[93]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,X.jsx)(He,{side:`bottom`,children:`Workspace launcher`}),n[93]=Le):Le=n[93];let Re;n[94]===Ie?Re=n[95]:(Re=(0,X.jsxs)(Ue,{children:[Ie,Le]}),n[94]=Ie,n[95]=Re);let ze;n[96]!==ke||n[97]!==Re?(ze=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-x-auto`,role:`tablist`,"aria-label":`Workspace tabs`,children:[ke,Re]}),n[96]=ke,n[97]=Re,n[98]=ze):ze=n[98];let Be;n[99]!==Te||n[100]!==c||n[101]!==o||n[102]!==a?(Be=c?null:(0,X.jsxs)(X.Fragment,{children:[a?(0,X.jsxs)(Ue,{children:[(0,X.jsx)(Ve,{render:(0,X.jsx)(E,{size:`icon-xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground/70 hover:text-foreground`,onClick:a,"aria-pressed":o,"aria-label":o?`Restore workspace panel`:`Maximize workspace panel`,children:o?(0,X.jsx)(Xn,{className:`size-3.5`}):(0,X.jsx)(jn,{className:`size-3.5`})})}),(0,X.jsx)(He,{side:`bottom`,children:o?`Restore workspace panel`:`Maximize workspace panel`})]}):null,(0,X.jsx)(E,{size:`icon-xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground/70 hover:text-foreground`,onClick:Te,"aria-label":`Close workspace panel`,children:(0,X.jsx)(ee,{className:`size-3.5`})})]}),n[99]=Te,n[100]=c,n[101]=o,n[102]=a,n[103]=Be):Be=n[103];let We;n[104]!==G||n[105]!==K||n[106]!==ze||n[107]!==Be?(We=(0,X.jsxs)(`div`,{className:G,children:[K,ze,Be]}),n[104]=G,n[105]=K,n[106]=ze,n[107]=Be,n[108]=We):We=n[108];let Ge;n[109]===B?Ge=n[110]:(Ge=Yv(B),n[109]=B,n[110]=Ge);let qe;n[111]===B?qe=n[112]:(qe=B?Jv(B):void 0,n[111]=B,n[112]=qe);let Je;n[113]!==te||n[114]!==I||n[115]!==T||n[116]!==M||n[117]!==oe||n[118]!==c||n[119]!==V||n[120]!==ve||n[121]!==e.mode||n[122]!==me||n[123]!==j||n[124]!==z||n[125]!==C?(Je=I===`review`?(0,X.jsx)(Ef,{mode:e.mode}):I===`files`?(0,X.jsx)(nv,{mode:e.mode}):I===`terminal`?(0,X.jsx)(iy,{}):I===`browser`&&!c?(0,X.jsx)(ry,{}):I===`simulator`&&!c?(0,X.jsx)(Uv,{environmentId:C?.environmentId??null,threadId:C?.threadId??null}):I===`agents`&&!c?(0,X.jsx)(Mu,{model:oe,environmentId:C?.environmentId??null,threadId:C?C.threadId:null,onOpenAgent:ve,subagents:j,selectedAgentId:M,onBack:()=>V(_y)}):I===`agent`?(0,X.jsx)(Qv,{subagent:te,agentKey:M}):(0,X.jsx)(my,{onOpenSideChat:()=>{C&&T&&Zt.getState().open(i(C),T.modelSelection)},tabs:z,activeThread:T,onSelectTab:me,showAgents:!c,showSimulator:!c&&!!(C&&ye(C.environmentId)?.device),isPhoneSurface:c,liveAgentCount:oe.liveCount}),n[113]=te,n[114]=I,n[115]=T,n[116]=M,n[117]=oe,n[118]=c,n[119]=V,n[120]=ve,n[121]=e.mode,n[122]=me,n[123]=j,n[124]=z,n[125]=C,n[126]=Je):Je=n[126];let Ye;n[127]!==Ge||n[128]!==qe||n[129]!==Je?(Ye=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,id:Ge,role:`tabpanel`,"aria-labelledby":qe,children:Je}),n[127]=Ge,n[128]=qe,n[129]=Je,n[130]=Ye):Ye=n[130];let Xe;return n[131]!==We||n[132]!==Ye?(Xe=(0,X.jsxs)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col bg-background w-full`,children:[We,Ye]}),n[131]=We,n[132]=Ye,n[133]=Xe):Xe=n[133],Xe}function _y(e){return Sr(e)}function vy(e){return{...xr(e),diff:void 0,diffTurnId:void 0,diffFilePath:void 0,preview:void 0,workspaceOpen:void 0,workspaceTab:void 0,workspaceAgentKey:void 0}}function yy(e){return Ir(e)}function by(e){return Sr(e)}function xy(e){return Cr(e)}function Sy(e){return Hr(e)}function Cy(e){return Dr(e)}function wy(e){return kr(e)}function Ty(e){return wr(e)}function Ey(e){return e.mode!==`agents`&&e.mode!==`simulator`&&e.mode!==`browser`}function Dy(e){return Ur(e)}export{Qv as AgentThreadPanel,gy as default};
|