ryco-cli 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AcpAdapter-DjP0IHpH.cjs → AcpAdapter-ByUp9-wk.cjs} +71 -51
- package/dist/{AcpAdapter-CKWzfB3Q.mjs → AcpAdapter-CY_ANTKu.mjs} +73 -53
- package/dist/{AcpNativeLogging-Do0LktDb.mjs → AcpNativeLogging-C7PC6imv.mjs} +30 -4
- package/dist/{AcpNativeLogging-5gTPK9Fq.cjs → AcpNativeLogging-OQeAya9d.cjs} +33 -1
- package/dist/{AcpRegistryDriver-BblCFfev.cjs → AcpRegistryDriver-CD9GN7rI.cjs} +3 -3
- package/dist/{AcpRegistryDriver-BzohT-PC.mjs → AcpRegistryDriver-DMZ5VBWJ.mjs} +4 -4
- package/dist/AzureDevOpsSourceControlProvider-5giVYoNi.mjs +2053 -0
- package/dist/AzureDevOpsSourceControlProvider-BKMXEUaN.cjs +2055 -0
- package/dist/{BitbucketSourceControlProvider-D5UVAc9z.mjs → BitbucketSourceControlProvider-BVUBsEUF.mjs} +63 -23
- package/dist/{BitbucketSourceControlProvider-Bvl_q1o2.cjs → BitbucketSourceControlProvider-BWnnrbch.cjs} +62 -22
- package/dist/{BunPTY-Dcl1Lp62.mjs → BunPTY-CMbDQ1Xb.mjs} +1 -1
- package/dist/{ClaudeDriver-DZkz0QPr.cjs → ClaudeDriver-DCrqouOR.cjs} +1373 -191
- package/dist/{ClaudeDriver-BuQ_azDw.mjs → ClaudeDriver-DVOss8cC.mjs} +1375 -193
- package/dist/{CodexDriver-6Ph2cjAW.cjs → CodexDriver-CBQPHJqU.cjs} +258 -28
- package/dist/{CodexDriver-Bi49RIL4.mjs → CodexDriver-DJoTky7Z.mjs} +261 -31
- package/dist/{CodexTextGeneration-C5TIspJA.mjs → CodexTextGeneration-BSgNgfZv.mjs} +6 -6
- package/dist/{CodexTextGeneration-sXPR9eld.cjs → CodexTextGeneration-C9MDQmZm.cjs} +7 -7
- package/dist/{CopilotDriver-Bcdpz6U_.mjs → CopilotDriver-CUkdPXcH.mjs} +78 -20
- package/dist/{CopilotDriver-D6P0xgRX.cjs → CopilotDriver-DbaMDH16.cjs} +76 -18
- package/dist/{CursorDriver-CRnDGwEv.mjs → CursorDriver-B-ZilXJB.mjs} +114 -97
- package/dist/{CursorDriver-DMJ7sGSx.cjs → CursorDriver-DKQqPbKH.cjs} +114 -97
- package/dist/{ForgejoSourceControlProvider-D4jGdaJX.cjs → ForgejoSourceControlProvider-CgpjFECj.cjs} +94 -60
- package/dist/{ForgejoSourceControlProvider-Dl_Fk3RY.mjs → ForgejoSourceControlProvider-DemMYUye.mjs} +95 -61
- package/dist/{GitHubSourceControlProvider-QMe-zymI.cjs → GitHubSourceControlProvider-C4un6hOK.cjs} +218 -119
- package/dist/{GitHubSourceControlProvider-DnwKf0ap.mjs → GitHubSourceControlProvider-CRSDYcjc.mjs} +206 -108
- package/dist/GitLabSourceControlProvider-D8W1ZLPh.cjs +2260 -0
- package/dist/GitLabSourceControlProvider-DpWkJ0M3.mjs +2258 -0
- package/dist/{GrokDriver-jy8JIvYY.cjs → GrokDriver-BQ6G_7ZZ.cjs} +6 -7
- package/dist/{GrokDriver-Bvq1jP3S.mjs → GrokDriver-Buvas9-q.mjs} +5 -6
- package/dist/{Metrics-CnmjpbWk.mjs → Metrics-C3vLS9rz.mjs} +123 -13
- package/dist/{Metrics-C0LSU8s7.cjs → Metrics-DjRPLE98.cjs} +170 -12
- package/dist/{NodePTY-D7tFWuQe.mjs → NodePTY-DgnuBruq.mjs} +1 -1
- package/dist/{OpenCodeDriver-DhyVaBMT.mjs → OpenCodeDriver-BWEZD841.mjs} +183 -49
- package/dist/{OpenCodeDriver-Bu5D19tl.cjs → OpenCodeDriver-qUiX0RLH.cjs} +183 -49
- package/dist/{SideQuestionIsolation-B-aE6aBz.mjs → SideQuestionIsolation-B1T-DsR0.mjs} +1 -1
- package/dist/{SideQuestionIsolation-CtJ4wX83.cjs → SideQuestionIsolation-BPC-Bxsz.cjs} +1 -1
- package/dist/bin.cjs +37021 -10253
- package/dist/bin.mjs +36892 -10178
- package/dist/client/assets/AccountSettings-B88Q_w9Y.js +1 -0
- package/dist/client/assets/AiFocusSettings-Bb0TrCPn.js +1 -0
- package/dist/client/assets/{AnimatedHeight-UXn4-nUd.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-NfwDyR5c.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-B6w_ROOE.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-BlKX8J9h.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-j7oSlakZ.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-C8-hT8KQ.js → PdfAttachmentPreview-BFNW2wjN.js} +2 -2
- package/dist/client/assets/{PhoneGetAppInterstitial-Zh0zpBgT.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-Qs9XsuZ4.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-B6Esv57Y.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-ByEe3mC0.js → abnfDiagram-N423BO3Z-DVEM6Scc.js} +1 -1
- package/dist/client/assets/{activity-CwTUF6lv.js → activity-DVCuAejY.js} +1 -1
- package/dist/client/assets/{alert-DQEkrtUJ.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-Bd-yxaTr.js → architectureDiagram-T3A2C74G-B6pcKiCj.js} +1 -1
- package/dist/client/assets/{arrow-left-DUOpzEbP.js → arrow-left-Blu3LSE2.js} +1 -1
- package/dist/client/assets/{arrow-right-HOYJnPKw.js → arrow-right-CO3CH0ne.js} +1 -1
- package/dist/client/assets/arrow-up-B69gV2Bq.js +1 -0
- package/dist/client/assets/{arrow-up-right-DHnMKuVA.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-CPDBonMC.js → blockDiagram-VBNYF7ZC-WNerGp9V.js} +1 -1
- package/dist/client/assets/{bot-DxjPA7Bw.js → bot-C9nWtaWq.js} +1 -1
- package/dist/client/assets/browserState-jt47YsqD.js +1 -0
- package/dist/client/assets/{c4Diagram-5PPSVZJV-BM6pAiqT.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-Cg7d41tb.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-DVKozJ41.js → chunk-2GRJ4B5K-DRl3ILpc.js} +1 -1
- package/dist/client/assets/{chunk-4I5QYGJK-BRoMwPkW.js → chunk-4I5QYGJK-CYTRl4bo.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-DFMKyoqP.js → chunk-5RXB4S5H-VCNwRsOa.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-Ba6UENe9.js → chunk-6Q2QTUOP-DnSeKGPG.js} +1 -1
- package/dist/client/assets/{chunk-7Z6QIM7H-B87gYLWH.js → chunk-7Z6QIM7H-Cjilh9TF.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-DZ840GRQ.js → chunk-GF5L2VYU-CGR7AW0t.js} +1 -1
- package/dist/client/assets/{chunk-I66GZJ75-BO6p4Aqg.js → chunk-I66GZJ75-CXSn8dDu.js} +1 -1
- package/dist/client/assets/{chunk-JQJVKLGR-5dTfVinz.js → chunk-JQJVKLGR-Dro-75lU.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-BeWfBZdP.js → chunk-KBJHAD2P-BDqN2kVf.js} +1 -1
- package/dist/client/assets/{chunk-NSK5VX7P-DuRkdn5k.js → chunk-NSK5VX7P-DGo5UczH.js} +1 -1
- package/dist/client/assets/{chunk-QR6OTTB3-Duz4Y_uE.js → chunk-QR6OTTB3-RWuyWnBI.js} +1 -1
- package/dist/client/assets/{chunk-UBXNYLIW-D-z8URgN.js → chunk-UBXNYLIW-BPRzeB0w.js} +1 -1
- package/dist/client/assets/{chunk-W5SLKNZC-AGjFjjoJ.js → chunk-W5SLKNZC-DYWocTFi.js} +1 -1
- package/dist/client/assets/{chunk-WRU74C26-BgY3UiXB.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-BWf3JuTE.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-BuOAGqlK.js → cynefin-OW5HDTMX-TuShvMuM.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-DqV0Aokp.js → cynefinDiagram-MW4NZA55-B0Edt2Em.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-D_GFquDW.js → dagre-VZM6K2ZE-D-eiuqHx.js} +1 -1
- package/dist/client/assets/{data-list-BJCq3CVP.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-C2N8ZRX3.js → deviceName-B4youG0v.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-B1wlsNg2.js → diagram-7IWD3JNH-DgM6lMlR.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-D-CYoym7.js → diagram-B4RE2ZJO-CyHNDjzV.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-DqJ9NCqt.js → diagram-LBJQPF4R-DDzuLIN5.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE-3yp1D2u4.js → diagram-Q27KOJAE-BaBvK9QB.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-Byp25nGC.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-DsYNYJeu.js → download-TvtXS4hE.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-B_IM1l6o.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-BbJHvskr.js → empty-BovKoxbn.js} +1 -1
- package/dist/client/assets/{erDiagram-JOGREHBK--OtcrCRJ.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-w0seBi3Q.js → ganttDiagram-PKOTCBZU-1q2nUL92.js} +1 -1
- package/dist/client/assets/git-pull-request-BFPwpm3c.js +1 -0
- package/dist/client/assets/{gitGraph-4MIJSDKK-BOJ0lcSW.js → gitGraph-4MIJSDKK-COtwmv2S.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-BMfOCCYn.js → gitGraphDiagram-DS77QQ5N-ChsvaxX4.js} +1 -1
- package/dist/client/assets/{group-tVMKGp7Q.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/{index-BqZvnGNr.js → index-DARIYokI.js} +2 -2
- package/dist/client/assets/{info-A6RAGUB7-acjBTQ5o.js → info-A6RAGUB7-CI2qZ9wW.js} +1 -1
- package/dist/client/assets/{infoDiagram-6WML65LV-DB01Nc2m.js → infoDiagram-6WML65LV-BPmgcTPH.js} +1 -1
- package/dist/client/assets/{input-BDWSVClC.js → input-CCie4mm1.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-KhZTvm-J.js → ishikawaDiagram-WSZJBQD7-LyS9p3Yg.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-C3JCYk-2.js → journeyDiagram-NVQOT4AX-BYaAmN65.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-Dbo0C1s6.js → kanban-definition-27J2QSJJ-D-pwzqFt.js} +1 -1
- package/dist/client/assets/{key-round-CETZqe3h.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-D5-aSBAz.js → log-out-CKq9YiLY.js} +1 -1
- package/dist/client/assets/{logging-B_qXVrk6.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-B6Q-3x_q.js → mermaid-parser.core-RK9ah5RM.js} +2 -2
- package/dist/client/assets/{mermaidEngine-DksLcesB.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-LaMzRxqw.js → mindmap-definition-FAOFIHXS-DVudWasx.js} +1 -1
- package/dist/client/assets/{packet-AYTQ26CC-BHhg59Si.js → packet-AYTQ26CC-DnkTsVhD.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-s7l7UD9d.js → pegDiagram-VL7TDLO6-Do5PIp8B.js} +1 -1
- package/dist/client/assets/pencil-Bzg-nc6d.js +1 -0
- package/dist/client/assets/{pie-WAS4IAKB-DygX31Z9.js → pie-WAS4IAKB-B_nNQOzn.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-bb6I9TtZ.js → pieDiagram-7S7Q4E2Y-D_IG4xwA.js} +1 -1
- package/dist/client/assets/{play-DUvOxTpL.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-dbkTo07n.js → qr-code-BlbiBIwH.js} +1 -1
- package/dist/client/assets/{qr-code-D4CtBq2F.js → qr-code-DywzVgQC.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-Cj1Y68ZF.js → quadrantDiagram-CIZ2JOQS-DY6fJyrM.js} +1 -1
- package/dist/client/assets/{radar-RG4KPBEZ-FHM3ftPp.js → radar-RG4KPBEZ-D9689I5m.js} +1 -1
- package/dist/client/assets/radio-group-DVwD6Cuy.js +1 -0
- package/dist/client/assets/{railroad-74A4TZTK-CPMn18Cm.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-DyV3SuDj.js → railroadDiagram-AXF67PYL-D1oJ6Jtl.js} +1 -1
- package/dist/client/assets/readCache-B7cDPz2O.js +1 -0
- package/dist/client/assets/{refresh-cw-CgDa2Ok_.js → refresh-cw-CRUTivd6.js} +1 -1
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-_xEAGWaH.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-Clf6oTLi.js → sankeyDiagram-W5VNT64P-C1tKAPGN.js} +1 -1
- package/dist/client/assets/{save-C8h0AMdl.js → save-OZdkPs_y.js} +1 -1
- package/dist/client/assets/scroll-area-80P7vbjw.js +1 -0
- package/dist/client/assets/{scrollEdges-BXYnwntN.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-CcYtQLSe.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-DPC4oHTi.js → shield-CBHYqlkR.js} +1 -1
- package/dist/client/assets/{shield-alert-CwH36qZb.js → shield-alert-Dc2cGwyR.js} +1 -1
- package/dist/client/assets/{shield-check-CGD7sEeF.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-rS3IgBob.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-DgVJfbv3.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-Cqay-Cae.js → star-C8mHmfZu.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-DEKURpRP.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-DrR6sbi6.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-bQJvmJx5.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-BkS-mry_.js → tokenModePresentation-umDRm4k1.js} +1 -1
- package/dist/client/assets/tooltip-DbqhseXd.js +1 -0
- package/dist/client/assets/{treeView-Q6P3EWNA-D4Ex5QTp.js → treeView-Q6P3EWNA-C_S3udFB.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-C4B6Y6qM.js → treemap-WGGIJYW6-B-kUSAkE.js} +1 -1
- package/dist/client/assets/undo-2-lyluTGMW.js +1 -0
- package/dist/client/assets/{unplug-B1dczi-t.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-B76_r68I.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-CLy1Qy1Y.js → user-round-BPDXr8Gq.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-8iiroXim.js → vennDiagram-T6HMQDX7-B1UEn_j_.js} +1 -1
- package/dist/client/assets/{vscode-icons-CJBVQtq5.js → vscode-icons-Ccy-gzFN.js} +1 -1
- package/dist/client/assets/{wardley-WFR3VGLG-DpyNUbTc.js → wardley-WFR3VGLG-gPdyDc-7.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-CI7is3QO.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-7pbbxqrZ.js → wrench-CPUCA_rn.js} +1 -1
- package/dist/client/assets/wsTransport-C88seBPA.js +15 -0
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-BTEX3m2y.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/{makeManagedServerProvider-CF776SAO.cjs → makeManagedServerProvider-B5tP7tvg.cjs} +1 -1
- package/dist/{makeManagedServerProvider-B90UKjnv.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/{runtimeSession-V3RIy8Ao.mjs → runtimeSession-D_BZ-wRH.mjs} +1 -1
- package/dist/{src-CARHuYkT.cjs → src-FmeCeBJ9.cjs} +2291 -72
- package/dist/{src-CtsgPPhb.mjs → src-VTj60bUm.mjs} +1974 -61
- package/package.json +1 -1
- package/dist/AzureDevOpsSourceControlProvider-CKSvfuDS.cjs +0 -190
- package/dist/AzureDevOpsSourceControlProvider-DRWSXTml.mjs +0 -188
- package/dist/GitLabSourceControlProvider-Cj07OTBD.mjs +0 -186
- package/dist/GitLabSourceControlProvider-CvvN5pHt.cjs +0 -188
- package/dist/client/assets/AccountSettings-v6-r6gYl.js +0 -1
- package/dist/client/assets/AiFocusSettings-BVdLON0q.js +0 -1
- package/dist/client/assets/AppearanceSettings-DRChsQnN.js +0 -1
- package/dist/client/assets/BranchToolbar.logic-YN3KjVr9.js +0 -3
- package/dist/client/assets/BrowserPanel-Dxw3stFP.js +0 -1
- package/dist/client/assets/ChatRightPanel-CygpcJiF.js +0 -201
- package/dist/client/assets/ChatThreadRouteView-DYLZFHu0.js +0 -1
- package/dist/client/assets/CommandPaletteDialog-BRvBzP1R.js +0 -1
- package/dist/client/assets/CompositeRoot-BeEGGWwn.js +0 -1
- package/dist/client/assets/ComputerUseSettings-Cq8Pi0ZU.js +0 -1
- package/dist/client/assets/ConnectionsSettings-RSYtexxd.js +0 -7
- package/dist/client/assets/ContextHandoffEndpointLabel-CeGDLNA4.js +0 -4
- package/dist/client/assets/DiagnosticsSettings-CDa6MVx4.js +0 -2
- package/dist/client/assets/DialogHandle-BE7egDQQ.js +0 -1
- package/dist/client/assets/DialogRoot-C4mtzigX.js +0 -1
- package/dist/client/assets/DialogTitle-B_Q4DykI.js +0 -1
- package/dist/client/assets/DialogTrigger-BSqd4Crj.js +0 -1
- package/dist/client/assets/DraftChatThreadRouteView-JW_bXVrM.js +0 -1
- package/dist/client/assets/GlassSurface-DDG4eTlj.js +0 -1
- package/dist/client/assets/HostedConnectionControls-CscV6hm1.js +0 -1
- package/dist/client/assets/HostedHubRoot-gp7-ClBP.js +0 -2
- package/dist/client/assets/HostedNodeRenameDialog-D1DSiTpx.js +0 -1
- package/dist/client/assets/HostedRelayTrustNotice-B9jp4SRh.js +0 -1
- package/dist/client/assets/IntegrationsSettingsPanel-DH7SfWtV.js +0 -2
- package/dist/client/assets/KeybindingsSettings-DkgYYSHS.js +0 -7
- package/dist/client/assets/LazyBrowserPanel-D4e76vc_.js +0 -2
- package/dist/client/assets/McpServersSettings-Dc1kPa-X.js +0 -6
- package/dist/client/assets/MobileSheet-lT--mLEz.js +0 -1
- package/dist/client/assets/NodeSecuritySettings-DcfSx4KT.js +0 -1
- package/dist/client/assets/NullStore-8d2s-Re3.js +0 -1
- package/dist/client/assets/OnboardingDialog-CnLjwM6Z.js +0 -1
- package/dist/client/assets/OpinionatedPluginsSettings-BTJyS3rN.js +0 -1
- package/dist/client/assets/PhoneHome-CIMkuDJF.js +0 -1
- package/dist/client/assets/PhoneSettingsSurface-CfZQxJNI.js +0 -2
- package/dist/client/assets/ProvidersSettingsPanel-DAVSiwE1.js +0 -1
- package/dist/client/assets/RedactedSensitiveText-BHGbQJwB.js +0 -1
- package/dist/client/assets/RootAppShell-T056pByH.js +0 -7
- package/dist/client/assets/SettingsDialog-BERU2Qg7.js +0 -2
- package/dist/client/assets/SettingsPanels-De_XZOQF.js +0 -3
- package/dist/client/assets/SettingsPanels.editor-Dkva9gX_.js +0 -2
- package/dist/client/assets/SourceControlSettings-B4HS17cB.js +0 -1
- package/dist/client/assets/StatisticsPage-Bj2ftFdH.js +0 -1
- package/dist/client/assets/StatisticsPanel-Dw7GBBmd.js +0 -1
- package/dist/client/assets/StatisticsSettingsLink-_XL3ABoI.js +0 -1
- package/dist/client/assets/ThreadTerminalDrawer-CPPzQSXN.js +0 -18
- package/dist/client/assets/ThreadWorkspacePanel-DWKU7Omm.js +0 -2073
- package/dist/client/assets/appChrome-TkWLAGxk.js +0 -1
- package/dist/client/assets/architecture-7GRP2DOG-HS59zfrk.js +0 -1
- package/dist/client/assets/authorization-D8dOcEYq.js +0 -1
- package/dist/client/assets/badge-2AZ3HfVS.js +0 -1
- package/dist/client/assets/capabilities-CsHjxjab.js +0 -1
- package/dist/client/assets/channel-Dn3_cOkm.js +0 -1
- package/dist/client/assets/chevron-right-Dsw16yGn.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-ZQvrS8No.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-ZQvrS8No.js +0 -1
- package/dist/client/assets/compiler-runtime-C4g8XhC5.js +0 -1
- package/dist/client/assets/desktopWorkspace-_iM6B9Kf.js +0 -1
- package/dist/client/assets/editorPreferences-D8q1ItMW.js +0 -1
- package/dist/client/assets/eventmodeling-NTZA5JFV-Dj71kuPV.js +0 -1
- package/dist/client/assets/flowDiagram-UKHOOZJN-BaAiwuvL.js +0 -1
- package/dist/client/assets/hostedConnectionCoordinator-BuRWCvUG.js +0 -1
- package/dist/client/assets/hubRoutes-jcMPIFy3.js +0 -1
- package/dist/client/assets/kbd-Dxm5Elqj.js +0 -1
- package/dist/client/assets/layers-Dqez1Uq8.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-DAbEANjY.js +0 -9
- package/dist/client/assets/motion-BdscFixQ.js +0 -1
- package/dist/client/assets/palette-92ylWqeC.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-DZjgHvyf.js +0 -5
- package/dist/client/assets/providerDriverMeta-T2YbXzuS.js +0 -1
- package/dist/client/assets/providerStatus-DBGvvkyF.js +0 -1
- package/dist/client/assets/radio-group-CRnHYWa8.js +0 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-DxU7Mt1k.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-BYAPVjRd.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-BOqgR_X7.js +0 -1
- package/dist/client/assets/runtime-BwHA1GUS.js +0 -18
- package/dist/client/assets/scroll-area-7n2X_RLQ.js +0 -1
- package/dist/client/assets/separator-CL1qjMqJ.js +0 -1
- package/dist/client/assets/settingsLayout-DxsFwhF0.js +0 -1
- package/dist/client/assets/sheet-CGiaw8-i.js +0 -1
- package/dist/client/assets/sidebar-Cc6ANbOP.js +0 -1
- package/dist/client/assets/sidebarProjectFolders-DO2Uv84F.js +0 -4
- package/dist/client/assets/sidebarStatusText-B4AtFXZo.js +0 -1
- package/dist/client/assets/sidebarUndo-gdSrfa4O.js +0 -1
- package/dist/client/assets/square-Cr9X8U6y.js +0 -1
- package/dist/client/assets/src-C3Y_imaX.js +0 -14
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CWtHILqh.js +0 -1
- package/dist/client/assets/storeSelectors-CTDWheMy.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DuaPce9O.js +0 -8
- package/dist/client/assets/switch-DnpJB2xv.js +0 -48
- package/dist/client/assets/toggle-D10FsFoE.js +0 -1
- package/dist/client/assets/toggle-group-BhzbQPEQ.js +0 -1
- package/dist/client/assets/tooltip-BlweKBxc.js +0 -1
- package/dist/client/assets/usage-BBwaxMif.js +0 -1
- package/dist/client/assets/useAppSidebarCollapsed-CFy476E3.js +0 -1
- package/dist/client/assets/useAppearancePreference-Dlh9P8iu.js +0 -1
- package/dist/client/assets/useBaseUiId-DKOjzmu3.js +0 -1
- package/dist/client/assets/useLabelableId-DQbY2GG1.js +0 -1
- package/dist/client/assets/useNavigate-B8oXtF30.js +0 -1
- package/dist/client/assets/usePhoneThreadActions-6DCLiyJ5.js +0 -1
- package/dist/client/assets/usePopupViewport-CNWcP7Od.js +0 -1
- package/dist/client/assets/usePresentationTier-hxB7Yv_Q.js +0 -1
- package/dist/client/assets/useScrollLock-BbKeKZdj.js +0 -1
- package/dist/client/assets/useTriggerFocusGuards-BC4Wb3GI.js +0 -1
- package/dist/client/assets/useValueChanged-BkTbyZdO.js +0 -1
- package/dist/client/assets/workspaceMetadataProjection-aqZEXDrQ.js +0 -1
- package/dist/collectUint8StreamText-BAUF-vzz.mjs +0 -37
- package/dist/collectUint8StreamText-vagpNUMJ.cjs +0 -42
- package/dist/git-9xWsJYIH.mjs +0 -132
- package/dist/git-xIkXFy_l.cjs +0 -218
- package/dist/sourceControl-B0D1Op29.cjs +0 -253
- package/dist/sourceControl-BiEBxN01.mjs +0 -224
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{La as t}from"./wsTransport-C88seBPA.js";import{$i as n,Bi as r,Ji as i,Sd as a,Ts as o,Xn as s,Zi as c,_a as l,ad as u,bs as d,cr as f,do as p,gs as m,hs as h,la as g,va as _,wr as v,ws as y}from"./runtime-DjjjAcTE.js";import{t as b}from"./react-CwJFpaho.js";import{$ as x,B as S,Z as C,et as w,z as T}from"./popover-OWEv6cQz.js";import{i as E}from"./presentationTier-DPVAxTK4.js";import{$ as ee,G as D,H as te,Q as ne,U as re,W as O}from"./ChatRightPanel-BCINd0vP.js";import{t as ie}from"./arrow-left-Blu3LSE2.js";import{o as k}from"./SettingsPanels.editor-D8U-TWWG.js";import{t as A}from"./folder-open-DcMymvp1.js";import{$ as j,A as M,B as N,Ct as ae,D as oe,F as se,G as P,I as ce,J as F,K as le,L as ue,M as de,N as fe,O as pe,P as me,Q as he,R as ge,S as _e,St as ve,U as ye,W as be,X as xe,Y as I,Z as L,_t as Se,a as Ce,b as we,dt as Te,et as Ee,ft as De,it as Oe,j as ke,k as Ae,lt as R,mt as je,nt as Me,o as Ne,q as z,rt as Pe,tt as Fe,vt as B,wt as V,x as Ie,z as Le}from"./ThreadLinkList-BN5z5EpS.js";import{t as Re}from"./refresh-cw-CRUTivd6.js";import{t as ze}from"./save-OZdkPs_y.js";import{t as Be}from"./text-wrap-DSRdSfDm.js";import"./storeSelectors-BichCKDC.js";import{t as Ve}from"./previewRouteSearch-BjZdTuSf.js";import{$ as H,A as He,B as Ue,C as We,D as Ge,E as Ke,F as qe,G as Je,H as Ye,I as Xe,J as Ze,K as Qe,L as $e,M as et,N as tt,O as nt,P as rt,R as it,S as at,T as ot,U as st,V as ct,W as U,X as lt,Y as ut,Z as dt,_ as ft,a as pt,b as mt,c as ht,d as gt,et as _t,f as vt,g as yt,h as bt,j as xt,k as St,l as Ct,m as wt,n as Tt,nt as Et,o as Dt,p as Ot,q as kt,r as At,s as jt,t as Mt,tt as Nt,u as Pt,v as Ft,w as It,x as Lt,y as Rt,z as zt}from"./Virtualizer-CwXeUPla.js";import{t as Bt}from"./useTheme-Bdy-BDs-.js";import{c as Vt}from"./select-Cb9FUPHD.js";import{t as Ht}from"./toggle-DFqtCPt-.js";import{i as Ut,r as Wt,t as Gt}from"./alert-FV7ZIit_.js";import{a as Kt,i as qt,o as Jt,r as Yt,s as Xt,t as Zt}from"./alert-dialog-CgXR9tED.js";import{C as Qt,D as $t,E as en,Jt as tn,O as nn,T as rn,w as an,x as on}from"./main-Ch0bwS-M.js";var sn={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`}]]};sn.node;var cn=y(sn),ln={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`}]]};ln.node;var un=y(ln),W=u();function dn({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=lt}){let u=t?.(e),d=n?.(e),f=r?.(e),p=i?.(e);return(0,W.jsxs)(W.Fragment,{children:[u==null?(0,W.jsxs)(W.Fragment,{children:[d!=null&&(0,W.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,W.jsx)(`div`,{slot:`header-filename-suffix`,children:f}),p!=null&&(0,W.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,W.jsx)(`div`,{slot:R,children:u}),a!=null&&o?.map((e,t)=>(0,W.jsx)(`div`,{slot:l(e),children:a(e)},t)),s!=null&&(0,W.jsx)(`div`,{slot:`gutter-utility-slot`,style:dt,children:s(c)})]})}var fn={compositeOverBg:pe,contrastRatio:Ae,deriveMutedFg:M,hoverWouldEraseText:ke,isDarkSurface:de,isFullyTransparent:fe,pickReadableForeground:me,relativeLuminance:se,surfacesMatch:ce};function pn(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var mn=-1,hn=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++mn}`;highlighter;file;renderCache;pendingHighlightResult;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;get fileCache(){return this.renderCache?.file}constructor(e={theme:De},t=lt,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=j(e.theme??De)?L():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&&U(r.file,t),{result:s}=r;if(!r.highlighted||s==null||!F(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&&pn(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&&U(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=gn(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!F(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!le(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??z(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??De}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||!U(e,n.file)||!F(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(U(n.file,e))return n.file;let r=P(e.contents),i=e.contents.length===0||le(e)||gn(r.length,this.getTokenizeMaxLength());return this.canRenderFile(e,t,i)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||U(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&j(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&j(t.theme)}getOrCreateLineCache(e){let{lineCache:t}=this;return(t==null||!pn(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:P(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&&pn(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]=rt(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&&pn(this.lineCache,r)?this.lineCache.lines:P(r.contents),o=P(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=Te){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||le(e)||gn(a.length,this.getTokenizeMaxLength()),c=this.canRenderFile(e,n,s),l=!U(e,this.renderCache.file),u=!qe(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!s&&!l&&nt(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??z(e.name),this.highlighter??=L();let t=this.highlighter!=null&&j(n.theme),i=this.highlighter!=null&&Oe(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=Te){this.file=e;let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=gn(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??z(e.name);let n=this.highlighter!=null&&I(Pe(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&Oe(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:oe(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=Le(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=st(t)?ct(this.lineAnnotations):void 0;d!=null&&(c.children.push(ue(`context`,`annotation`,1)),s.push(tt({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(ge(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(ue(`context`,`annotation`,1)),s.push(tt({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 xt({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return Ee(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(N({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Le();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,et(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return Ee(t?N({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await he(St(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&&U(e,i)&&F(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&F(a.options,n)&&U(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&&F(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&U(n.file,e)&&F(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&&U(e,n.file)&&F(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 He({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function gn(e,t){return e>t}function _n(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function vn(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:Ot(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var yn=[``];function bn(e){let t={...e};return delete t.cacheKey,t}var xn=-1,Sn=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++xn}`;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:De},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new hn(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new Xe,this.interactionManager=new $e(`file`,it(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>bt(this.editSession?.annotations,e,lt);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??De}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(U(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=wt(t,lt,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=bn(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??wt(this.lineAnnotations,lt)},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(it(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&&!xe(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,yt(t,e,lt))}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||Cn(this.pre,i,this.options.collapsed)||wn(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),jt(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(vn(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?yn: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??z(i.name),c=L({theme:o,lang:s});c==null?he({themes:Pe(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&&U(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=!U(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&qe(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(vn(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,B);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||!U(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||le(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||!_n(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:ot(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=It();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??=We(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Lt(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=at(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=Pt({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:mt(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=Rt(this.themeCSSStyle.textContent??``,at(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Ct()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=vt({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=Ee(i.children),t.style.cssText=i.properties.style}else n.innerHTML=Ee(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?gt(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??Ee(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,R,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,V,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,ve,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,ae,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:Je(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Je(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=Ge;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};Ke(i,this.appliedPreAttributes)||(Dt(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 Cn(e,t,n=!1){return!n&&e==null&&t!=null}function wn(e,t,n=!1){return e==null&&t!=null&&!n}var Tn=5e3,En=new Map,Dn=-1;function On(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 kn=class extends Sn{virtualizer;metrics;__id=`virtualized-file:${++Dn}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:En};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=je,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=we(e);(t||!ut(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=!Ze(t,e),r=On(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=En,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()??En;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=Ye(this.getLatestAnnotations());if(this.renderRange!=null&&a&&st(this.renderRange)){let t=An(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=!U(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=Ie(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=Ie(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||!U(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()??En);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=Ie(this.metrics,i),l=_e(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,!U(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=!U(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:!U(i,a),renderedFileChanged:!U(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%Tn===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=Ie(this.metrics,i),u=s>0?_e(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=Ye(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,ee,D,te=C?.lineIndex??0;for(let e=te;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),D!=null)){if(D<=0)break;D--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),w+s>b&&(ee??=o),D==null&&w>=r&&i&&(D=x),T++,w+=s}if(E==null){if(g)E=0,ee=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}ee??=E;let ne=Math.round(ee-y/2),re=Math.max(0,Math.ceil(s/a)-y),O=Math.max(0,Math.min(ne,re)),ie=O*a,k=ne<0?v+ne*a:v,A=S[O]??0,j=ie===0?0:d+A,M=O+k/a,N=M<S.length?p-S[M]:p-(w-t-f);return{startingLine:ie,totalLines:k,bufferBefore:j,bufferAfter:Math.max(0,N)}}};function An(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Ue&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}var G=e(b(),1),jn=typeof window>`u`?G.useEffect:G.useLayoutEffect;function Mn({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=Tt(),h=a!==void 0,g=(0,G.useContext)(Ce),_=Nt(),v=Et(e=>f?.(e)),y=f==null?void 0:v,b=(0,G.useRef)(null),x=Et(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,G.useRef)(null),w=(0,G.useRef)(null),T=Et(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),E=Et(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 Sn(Pn({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,!0):C.current=new kn(Pn({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=Fn(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 jn(()=>{let{current:n}=C;if(n==null)return;let r=Pn({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=r!==void 0&&!Ze(n.options,r);if(n.setOptions(r),!d&&w.current!=null){let{current:e}=w;w.current=null,e()}let s=Nn(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=Fn(n,T))}),{ref:E,getHoveredLine:(0,G.useCallback)(()=>C.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,G.useCallback)(e=>C.current?.getAnnotationSlotName(e)??lt(e),[])}}function Nn(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&&(U(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 Pn({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?H:e?.renderCustomHeader,renderGutterUtility:r?H:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function Fn(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function In({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}=Mn({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,W.jsx)(Se,{ref:b,className:s,style:c,children:At(dn({file:e,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:t,getHoveredLine:x,getAnnotationSlotName:S}),m)})}var Ln=E();function Rn(e){let t=(0,Ln.c)(18),{environmentId:n,cwd:r,enabled:i}=e,o=$t.keyOf(e),s,c;t[0]!==r||t[1]!==i||t[2]!==n?(s=()=>$t.watch({environmentId:n,cwd:r,...i===void 0?{}:{enabled:i}}),c=[n,r,i],t[0]=r,t[1]=i,t[2]=n,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,G.useEffect)(s,c);let l=a($t.getAtom(o)),u;bb0:{if(!l.data){u=null;break bb0}let e=l.data,n;t[5]===l.data.entries?n=t[6]:(n=l.data.entries.toSorted(Bn),t[5]=l.data.entries,t[6]=n);let r;t[7]!==l.data||t[8]!==n?(r={...e,entries:n},t[7]=l.data,t[8]=n,t[9]=r):r=t[9],u=r}let d=u,f;t[10]===o?f=t[11]:(f=async()=>{let e=await $t.refreshAsync(o);return{data:e.data===null?null:{...e.data,entries:e.data.entries.toSorted(zn)}}},t[10]=o,t[11]=f);let p=f,m;return t[12]!==p||t[13]!==d||t[14]!==l.error||t[15]!==l.isFetching||t[16]!==l.isLoading?(m={data:d,isLoading:l.isLoading,isFetching:l.isFetching,error:l.error,refetch:p},t[12]=p,t[13]=d,t[14]=l.error,t[15]=l.isFetching,t[16]=l.isLoading,t[17]=m):m=t[17],m}function zn(e,t){return e.path.localeCompare(t.path,void 0,{numeric:!0,sensitivity:`base`})}function Bn(e,t){return e.path.localeCompare(t.path,void 0,{numeric:!0,sensitivity:`base`})}function Vn(e){let t=(0,Ln.c)(14),{environmentId:n,cwd:r,relativePath:i,enabled:o}=e,s=nn.keyOf(e),c,l;t[0]!==r||t[1]!==o||t[2]!==n||t[3]!==i?(c=()=>nn.watch({environmentId:n,cwd:r,relativePath:i,...o===void 0?{}:{enabled:o}}),l=[n,r,i,o],t[0]=r,t[1]=o,t[2]=n,t[3]=i,t[4]=c,t[5]=l):(c=t[4],l=t[5]),(0,G.useEffect)(c,l);let u=a(nn.getAtom(s)),d;t[6]===s?d=t[7]:(d=async()=>({data:(await nn.refreshAsync(s)).data}),t[6]=s,t[7]=d);let f=d,p;return t[8]!==f||t[9]!==u.data||t[10]!==u.error||t[11]!==u.isFetching||t[12]!==u.isLoading?(p={data:u.data,isLoading:u.isLoading,isFetching:u.isFetching,error:u.error,refetch:f},t[8]=f,t[9]=u.data,t[10]=u.error,t[11]=u.isFetching,t[12]=u.isLoading,t[13]=p):p=t[13],p}var Hn={},Un=(0,G.memo)(function(e){let t=(0,Ln.c)(22),{files:r,allDirectoriesExpanded:i,onSelectFile:a,resolvedTheme:o,selectedFilePath:s,showStats:c}=e,l=s===void 0?null:s,u=c===void 0||c,d;t[0]===r?d=t[1]:(d=D(r),t[0]=r,t[1]=d);let f=d,p;t[2]===f?p=t[3]:(p=Wn(f).join(`\0`),t[2]=f,t[3]=p);let m=`${i?`expanded`:`collapsed`}\u0000${p}`,h;t[4]===m?h=t[5]:(h=()=>({key:m,overrides:{}}),t[4]=m,t[5]=h);let[g,_]=(0,G.useState)(h),v=g.key===m?g.overrides:Hn,y;t[6]!==i||t[7]!==m?(y=e=>{_(t=>{let n=t.key===m?t.overrides:{};return{key:m,overrides:{...n,[e]:!(n[e]??i)}}})},t[6]=i,t[7]=m,t[8]=y):y=t[8];let b=y,S,C;if(t[9]!==i||t[10]!==v||t[11]!==a||t[12]!==o||t[13]!==l||t[14]!==u||t[15]!==b||t[16]!==f){let e=(t,r)=>{let s=8+r*14;if(t.kind===`directory`){let a=v[t.path]??i;return(0,W.jsxs)(`div`,{children:[(0,W.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:`${s}px`},onClick:()=>b(t.path),children:[(0,W.jsx)(w,{"aria-hidden":`true`,className:n(`size-3.5 shrink-0 text-muted-foreground/70 transition-transform`,a&&`rotate-90`)}),a?(0,W.jsx)(x,{className:`size-3.5 shrink-0 text-muted-foreground/75`}):(0,W.jsx)(k,{className:`size-3.5 shrink-0 text-muted-foreground/75`}),(0,W.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}),u&&O(t.stat)&&(0,W.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums`,children:(0,W.jsx)(re,{additions:t.stat.additions,deletions:t.stat.deletions})})]}),a&&(0,W.jsx)(`div`,{className:`space-y-0.5`,children:t.children.map(t=>e(t,r+1))})]},`dir:${t.path}`)}return(0,W.jsxs)(`button`,{type:`button`,className:n(`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`,l===t.path&&`bg-accent text-accent-foreground hover:bg-accent`),style:{paddingLeft:`${s}px`},onClick:()=>a(t.path),children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(te,{pathValue:t.path,kind:`file`,theme:o,className:`size-3.5 text-muted-foreground/70`}),(0,W.jsx)(`span`,{"data-tree-label":!0,className:n(`truncate font-mono text-[11px] text-muted-foreground/80 group-hover/tree-row:text-foreground/90`,l===t.path&&`text-accent-foreground`),children:t.name}),u&&t.stat&&(0,W.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums`,children:(0,W.jsx)(re,{additions:t.stat.additions,deletions:t.stat.deletions})})]},`file:${t.path}`)};S=`space-y-0.5`,C=f.map(t=>e(t,0)),t[9]=i,t[10]=v,t[11]=a,t[12]=o,t[13]=l,t[14]=u,t[15]=b,t[16]=f,t[17]=S,t[18]=C}else S=t[17],C=t[18];let T;return t[19]!==S||t[20]!==C?(T=(0,W.jsx)(`div`,{className:S,children:C}),t[19]=S,t[20]=C,t[21]=T):T=t[21],T});function Wn(e){let t=[];for(let n of e)n.kind===`directory`&&(t.push(n.path),t.push(...Wn(n.children)));return t}var Gn=100,Kn=`insert`,qn=`backspace`,Jn=`delete`,Yn=class e{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??Gn)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}getState(){return{undoStack:this.#e.map(Zn),redoStack:this.#t.map(Zn),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 Xn(e){return{...e,forwardEdits:e.forwardEdits.map(e=>({...e})),inverseEdits:e.inverseEdits.map(e=>({...e})),selectionsBefore:e.selectionsBefore?.map(Qn),selectionsAfter:e.selectionsAfter?.map(Qn),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice()}}function Zn(e){return{...Xn(e),lineAnnotationsBefore:e.lineAnnotationsBefore?.map(e=>({...e})),lineAnnotationsAfter:e.lineAnnotationsAfter?.map(e=>({...e}))}}function Qn(e){return{...e,start:{...e.start},end:{...e.end}}}function $n(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?qn:n?Jn: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 er(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=rr(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
2
|
+
`)&&!a.text.includes(`
|
|
3
|
+
`),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
|
|
4
|
+
`)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=Kn,n!==Kn||e.coalescingMode!==void 0&&e.coalescingMode!==Kn||t.coalescingMode!==void 0&&t.coalescingMode!==Kn))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=Jn;else if(c+(o.end-o.start)!==i.start)return!1;else r=qn;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 tr(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=rr(c.start,e.forwardEdits);if(o.text.length>0){i??=Kn,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text);continue}if(u===o.end){i??=Jn,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text);continue}i??=qn,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text)}return{forwardEdits:n,inverseEdits:nr(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 nr(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 rr(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 ir=1e5,ar=10,or=13,sr=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,cr=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}},lr=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=ye(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===ar||r===or)&&(r===or&&e.charCodeAt(n+1)===ar&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},ur=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)-+!!vr(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!vr(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},dr=class{#e;#t=new lr(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new lr(e);let t=this.#y(cr.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&&fr(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=K(e,0,this.#r),i=K(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&&fr(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=pr(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=mr(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=pr(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(!hr(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(`
|
|
5
|
+
`)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=Cr(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,ir)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=ye(i);for(let s=0;s<o.length;s++){let c=o[s],l=o[s+1]??a;for(;l>c&&fr(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=Er(u,a);continue}let s=c+a;if((!t||Sr(i,s,o.length))&&(r.push([s,s+o.length]),r.length>=n))return r;a===e.lastIndex&&(e.lastIndex=Er(u,a))}}return r}insert(e,t){if(e.length===0)return;let n=K(t,0,this.#r);this.#b(n,n,e),this.#x()}delete(e,t){if(t<=0||this.#r===0)return;let n=K(e,0,this.#r),r=K(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=K(n.start,0,this.#r),i=K(n.end,r,this.#r);this.#b(r,i,n.text)}this.#x()}}positionAt(e){let t=K(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=K(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=K(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)-+!!vr(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#v(t.piece.source),i=Math.min(yr(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&&vr(t.piece.lastCharCode,this.#d(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!vr(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)-+!!vr(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-+!!vr(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===cr.Original?this.#e:this.#t}#y(e,t,n){let r=this.#v(e),i=t+n,a=yr(r.lineOffsets,t),o=yr(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new cr(e,t,n,a,o,s===or&&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(cr.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 ur(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 ur(this.#y(e.piece.source,e.piece.offset,i)),o=new ur(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 ur(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(gr(n.piece,t)){n.piece=_r(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 fr(e){return e===10||e===13}function K(e,t,n){return Math.min(Math.max(e,t),n)}function pr(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 mr(e,t){let n=[];for(let[r,i]of e){let e=K(r,0,t),a=K(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 hr(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 gr(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!vr(e.lastCharCode,t.firstCharCode)}function _r(e,t){return new cr(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function vr(e,t){return e===or&&t===ar}function yr(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 br(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xr(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return sr.includes(t)}function Sr(e,t,n){let r=t<=0||xr(e.charCodeAt(t-1)),i=t+n>=e.length||xr(e.charCodeAt(t+n));return r&&i}function Cr(e,t,n){let r=t?e:br(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function wr(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function Tr(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=Cr(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:wr(r.replaceText,u)}function Er(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 Dr=new WeakMap;function Or(e){return Dr.get(e)}function kr(e,t){Dr.set(e,t)}var Ar=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new Yn,a){if(this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new dr(t),this.#i=i,a!=null)this.#a=a;else{let e=this.#r.getLineText(0,!0);this.#a=e.endsWith(`\r
|
|
6
|
+
`)?`\r
|
|
7
|
+
`:e.endsWith(`\r`)?`\r`:`
|
|
8
|
+
`}}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=$n(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&&er(o,a)?this.#i.replaceLastUndo(tr(o,a)):this.#i.push(a),kr(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;kr(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;kr(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=be(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}}},jr=e(Ne(),1),Mr=100,Nr=class{type;#e=new jr.default.LRUMap(Mr);#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=Ir(r.session);i!=null&&this.#e.set(e,i)}get(e){let t=this.#t.get(e);return t==null?this.#e.find(e):Ir(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):Lr(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}},Pr=class{#e=new Nr(`file`);#t=new Nr(`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 Fr(e){return{selections:e.selections?.map(e=>({...e,start:{...e.start},end:{...e.end}})),view:e.view==null?void 0:{...e.view}}}function Ir(e){if(e.document!=null&&e.fileInfo!=null&&(e.type===`file`||e.diffSession!=null))return e.editor??={},e}function Lr(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 Rr=new Pr;function zr({metaKey:e,ctrlKey:t},n=ht()){return n?e&&!t:t&&!e}function Br(e){if(ht()&&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(zr(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}var Vr=new WeakMap,Hr=Wr([{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`}}]),Ur={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function Wr(e){let t=Vr.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)}}Vr.set(e,t)}return t}function Gr(e,t,n=ht()){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):Ur[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=Wr(t)[o].get(s),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let c=Hr[o].get(s);return c?.get(r)??(a===void 0?void 0:c?.get(a))}function Kr(e,t=ht()){if(!e.altKey&&zr(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}function q(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 J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Y(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 qr(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 Jr(e,t){return Object.assign(e,t)}function Yr(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function Xr(e,t=1e3){return Math.round(e*t)/t}function Zr(e){return e.endsWith(`
|
|
9
|
+
`)||e.endsWith(`\r`)}function Qr(e){if(!(typeof Intl>`u`||typeof Intl.Segmenter!=`function`))return new Intl.Segmenter(void 0,e)}var $r,ei=!1;function ti(){return ei||=($r=Qr({granularity:`grapheme`}),!0),$r}function ni(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 ri=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=[J(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[J(r,`scroll`,t,{passive:!0})],J(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function ii(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 ai(e){return lt(e)}function oi(e,t){let n=si(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=ci(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||ui(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};Ft(e,ft(a)),r.push(e)}i=!0;continue}r.push(a)}return i?r:void 0}function si(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 ci(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(li(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return di(t.startLine+r,n)}function li(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function ui(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function di(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function fi(e,t,n,r=ai){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}pi(t,n),c!==void 0&&pi(c,s);let l=mi(i,t,n);if(c===void 0)return;let u=mi(a,c,s);requestAnimationFrame(()=>{hi(i,a,l,u)})}function pi(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 mi(e,t,n){let r=new Map;for(let n of t.children){let t=Y(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=q(`div`,{dataset:{lineAnnotation:`0,`+(t-1)},children:[q(`div`,{dataset:`annotationContent`,children:i.map(e=>q(`slot`,{name:e}))})]});n.after(e),r.set(t,e)}}}if(n!==void 0)for(let t of n.children){let n=Y(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=q(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function hi(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=gi(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=gi(t);n>0&&i.set(e,n)}}_i(e,n,i),_i(t,r,i)}function gi(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function _i(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 vi=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),yi=new Set([`'`,`"`,"`"]),bi=new Set([`{`,`[`,`(`,`<`]);function xi(e,t=0){let n=wa(e.startContainer,e.startOffset),r=wa(e.endContainer,e.endOffset);if(n!==null&&r!==null)return{start:n,end:r,direction:t}}function Si(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 Ci(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=Z(t);a=i.line,o=i.character;let s=Ei(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+xa(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=wi(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=wi(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(X(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`){if(o>0)o=_a(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=_a(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 wi(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=Ei(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=Oi(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=Di(s,i);c=Oi(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:Ti(f,d)}}function Ti(e,t){if(t<=0||t>=e.length)return t;let n=ti();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 Ei(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=Oi(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return Oi(e,t,n<(a[0]??0)?0:a.length-2,r)}function Di(e,t){let n=t.getSoftLineOffsets?.(e);return n===void 0||n.length<2?1:n.length-1}function Oi(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 ki(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=Ci(e,[{start:i,end:i,direction:0}],n,r);return qi(t,a)})}function Ai(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=Ca(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=Ca(e,{start:g.start,end:g.end,text:f.text},i),n=ba(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=Sa(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=oi(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function ji(e,t){if(t.length!==e.length+2)return;let n=vi.get(t[0]);if(n!==void 0&&t[t.length-1]===n&&t.slice(1,-1)===e)return 1}function Mi(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=ji(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 Ni(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=ba(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=Mi(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=Sa(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=oi(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function Pi(e,t){return e===`never`?!1:e===`brackets`?bi.has(t):e!==`quotes`||yi.has(t)}function Fi(e,t,n,r){if(n.length!==1||t.length===0)return;let i=vi.get(n);if(i===void 0||!Pi(r,n))return;let a=[];for(let r of t){if(X(r))return;a.push(n+e.getText(r)+i)}return a}function Ii(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=va(e,n);if(!X(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=ga(l),p;if(s>0&&s<u){let e=ha(l,s,!1,f),t=ha(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?ha(n,r,!1,ga(n)):r,u=ha(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=Sa(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=oi(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function Li(e,t,n){let r=t.map(t=>{let n=ya(e,t);return{start:n.start,end:n.end,direction:0}});return Ni(e,r,r.map(()=>``),n)}function Ri(e,t,n,r){let i=t.map(t=>{if(!X(t))return{start:t.start,end:t.end,direction:0};let r=Z(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 Ni(e,i,i.map(()=>``),r)}function zi(e,t,n){let r=t.map(t=>{let[n,r]=ma(e,t);return{start:n,end:r,direction:0}});return Ni(e,r,r.map(()=>``),n)}function Bi(e,t,n){if(!X(t))return[t.start,t.end];let r=Z(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:_a(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:_a(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 Vi(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=Bi(e,t,n);if(!n&&X(t)){let t=Ca(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 Ni(e,a,a.map(()=>``),r)}function X(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function Z(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function Hi(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function Ui(e,t){let n=X(e),r=X(t);return n&&r?Q(e.start,t.start)===0:n?Q(t.start,e.start)<=0&&Q(e.start,t.end)<=0:r?Q(e.start,t.start)<=0&&Q(t.start,e.end)<=0:Q(e.start,t.end)<0&&Q(t.start,e.end)<0}function Q(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Wi(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 Gi(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 Ki(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=Gi(a,r),c=Gi(o,r);return Wi(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function qi(e,t){let n=e.direction===-1?e.end:e.start,r=Q(n,t.start),i=Q(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=Q(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Ji(e,t){let n=Q(t.start,e.start)<0,r=Q(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:Q(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:Q(e.start,t.end)===0?0:1}}function Yi(e,t){return Xi(e.map(e=>Ji(e,t)))}function Xi(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=Q(e.selection.start,t.selection.start);if(n!==0)return n;let r=Q(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(Ui(r.selection,e.selection)){let t=e.index>r.index?e:r,n=Q(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=Q(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&Q(n,i)!==0&&(a=Q(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 Zi(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&Q(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 Qi(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 $i(e,t){if(t.length===0)return;let n=t.map(t=>X(t)?fa(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 Q(e.start,r.start)!==0||Q(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Wi(e,o,o+i.length);return[...n,s]}function ea(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function ta(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 na(e,t){if(X(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 ra(e,t){return t.map(t=>na(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function ia(e,t){return ra(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function aa(e,t){let n=ra(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&&!Zr(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end}return i}function oa(e,t){if(X(t))return sa(e,t);let[n,r]=Q(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function sa(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 ca(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 la(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 ua(e,t){let n=[...t.map((t,n)=>({index:n,edit:oa(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=ca(n);return{text:aa(e,t),edits:r,nextSelectionOffsets:la(n,r)}}function da(e,t){let n=Math.max(0,t),r=Ta(e),i=null;for(let e of r){i=e;let t=Na(e);if(n<=t+(e.textContent?.length??0)){let r=Ea(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=Ea(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=Pa(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,Pa(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,Pa(o.textContent,o.textContent?.length??0)]}function fa(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=pa(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 pa(e,t){let n=Qr({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 ma(e,t){if(!X(t))return[t.start,t.end];let n=Z(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=ga(a),s=i,c;for(;s>0;){let e=ha(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 ha(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 ga(e){let t=[0],n=ti();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 _a(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=ti();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=ti();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 va(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(Z(t))]}function ya(e,t){if(!X(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 ba(e,t,n){if(t!==`
|
|
10
|
+
`&&t!==`\r`&&t!==`\r
|
|
11
|
+
`)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=xa(i);return a===0?t:t+i.slice(0,a)}function xa(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function Sa(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 Ca(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 wa(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&Ma(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=Ma(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:Aa(e.parentElement)===null?{line:r,character:ka(n,e)+Pa(e.textContent,t)}:{line:r,character:ja(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=ja(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=Na(e);if(t!==void 0)return{line:r,character:t};let n=Aa(e),i=n===null?void 0:Na(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?ja(i.childNodes[t-1]):ka(n,i)}}return{line:r,character:ka(n,i)}}return null}function Ta(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(Na(e)!==void 0){t.push(e);continue}for(let n of e.childNodes)n.nodeType===1&&Na(n)!==void 0&&t.push(n)}}return t}function Ea(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=Pa(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 Da(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+=Pa(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function Oa(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function ka(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=ja(e.childNodes[t]);return n}for(let n of Ta(e))if(Oa(n,t))return Na(n)+(t.nodeType===3?Da(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&Ma(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=ja(e.childNodes[r]);r=e}return n}function Aa(e){let t=e;for(;t!==null;){if(Ma(t)!==void 0)return null;if(Na(t)!==void 0)return t;t=t.parentElement}return null}function ja(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=Aa(n);if(r===null)return 0;let i=Na(r);if(i===void 0)return 0;let a=t===void 0?Pa(e.textContent,e.textContent?.length??0):Pa(e.textContent,t);return i+Da(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=Na(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,ja(e));return i}function Ma(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 Na(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function Pa(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}var Fa=300,Ia=100,La=`marker-popover`,Ra=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=[J(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)}),J(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=Y(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(Ui({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)},Fa)}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopover()},Ia))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){ii(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:La})===`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(La)}#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(La),s!==void 0){Ba(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=q(`div`,{dataset:{editorWidget:``,markerPopover:``,[Va(i)]:``},children:[q(`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=[J(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),J(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},za=[`error`,`warning`,`info`,`hint`];function Ba(e,t){for(let t of za)delete e.dataset[Va(t)];e.dataset[Va(t)]=``}function Va(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}function Ha(e){return{...e,oldFile:e.oldFile==null?null:{...e.oldFile,lines:[...e.oldFile.lines]},hunks:pt(e.hunks)}}var Ua=`::selection {
|
|
12
|
+
background-color: #0000;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[data-deleted-text-selection] [data-deletions] ::selection, [data-deleted-text-selection] [data-line-type="change-deletion"] ::selection {
|
|
16
|
+
background-color: var(--diffs-editor-selection-bg);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes blinking {
|
|
20
|
+
0% {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
50% {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
100% {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host, [data-code], [data-content], [data-diff-type="split"][data-overflow="wrap"] {
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[data-code] {
|
|
38
|
+
container-type: inline-size;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[data-content] {
|
|
42
|
+
cursor: text;
|
|
43
|
+
caret-color: var(--diffs-bg-caret);
|
|
44
|
+
background-color: #0000;
|
|
45
|
+
outline: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[data-line] {
|
|
49
|
+
cursor: text;
|
|
50
|
+
background-color: #0000;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[data-line]:after {
|
|
54
|
+
content: "";
|
|
55
|
+
z-index: -20;
|
|
56
|
+
background-color: var(--diffs-line-bg);
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
position: absolute;
|
|
59
|
+
inset: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-line][data-editor-active-line]:after {
|
|
63
|
+
box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[data-editor-overlay] {
|
|
67
|
+
display: contents;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[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] {
|
|
71
|
+
height: 1lh;
|
|
72
|
+
line-height: var(--diffs-line-height);
|
|
73
|
+
pointer-events: none;
|
|
74
|
+
position: absolute;
|
|
75
|
+
top: 0;
|
|
76
|
+
left: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[data-edit-prediction] {
|
|
80
|
+
z-index: 1;
|
|
81
|
+
user-select: none;
|
|
82
|
+
width: max-content;
|
|
83
|
+
height: auto;
|
|
84
|
+
color: var(--diffs-editor-edit-prediction-fg, color-mix(in lab, var(--diffs-fg) 45%, transparent));
|
|
85
|
+
overflow: visible;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[data-edit-prediction-line] {
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
white-space: pre;
|
|
91
|
+
width: max-content;
|
|
92
|
+
min-height: 1lh;
|
|
93
|
+
display: block;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[data-edit-prediction][data-replacement] [data-edit-prediction-line], [data-edit-prediction-insertion-range], [data-edit-prediction-replacement-range] {
|
|
97
|
+
background-color: var(--diffs-edit-prediction-bg, var(--diffs-bg));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[data-edit-prediction-suffix] {
|
|
101
|
+
color: var(--diffs-fg);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
[data-edit-prediction][data-wrap] [data-edit-prediction-line] {
|
|
105
|
+
overflow-wrap: anywhere;
|
|
106
|
+
white-space: pre-wrap;
|
|
107
|
+
max-width: 100%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
[data-edit-prediction-line][data-empty]:after {
|
|
111
|
+
content: "↵";
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
[data-edit-prediction-spacer] {
|
|
115
|
+
margin-block-end: var(--diffs-edit-prediction-spacer-height);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[data-code][data-deletions] [data-edit-prediction-spacer] {
|
|
119
|
+
box-sizing: content-box;
|
|
120
|
+
margin-block-end: 0;
|
|
121
|
+
padding-block-end: var(--diffs-edit-prediction-spacer-height);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
[data-edit-prediction-deletion-range] {
|
|
125
|
+
--diffs-edit-prediction-deletion-color: var(--diffs-editor-edit-prediction-deletion-fg, color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));
|
|
126
|
+
z-index: 1;
|
|
127
|
+
background: linear-gradient(to bottom,
|
|
128
|
+
transparent calc(50% - .5px),
|
|
129
|
+
var(--diffs-edit-prediction-deletion-color) calc(50% - .5px),
|
|
130
|
+
var(--diffs-edit-prediction-deletion-color) calc(50% + .5px),
|
|
131
|
+
transparent calc(50% + .5px));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[data-edit-prediction-insertion-range] {
|
|
135
|
+
z-index: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[data-edit-prediction-replacement-range] {
|
|
139
|
+
z-index: 1;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
[data-caret] {
|
|
143
|
+
z-index: 2;
|
|
144
|
+
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)))));
|
|
145
|
+
visibility: hidden;
|
|
146
|
+
width: 2px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
150
|
+
[data-caret] {
|
|
151
|
+
animation: 1.2s .8s infinite blinking;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-selection-range] {
|
|
156
|
+
z-index: -10;
|
|
157
|
+
background-color: var(--diffs-editor-selection-bg);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
[data-caret-highlight-range] {
|
|
161
|
+
z-index: -10;
|
|
162
|
+
background-color: var(--diffs-caret-highlight-bg, var(--diffs-editor-selection-bg));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
[data-selection-corner] {
|
|
166
|
+
background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));
|
|
167
|
+
width: 100%;
|
|
168
|
+
height: 100%;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[data-match-range] {
|
|
172
|
+
z-index: -10;
|
|
173
|
+
background-color: var(--diffs-editor-match-bg, var(--diffs-editor-selection-bg));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
[data-match-range]:not([data-focus]) {
|
|
177
|
+
background-color: var(--diffs-editor-match-highlight-bg, light-dark(#ff963288, #ff963266));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
[data-bracket-match-range] {
|
|
181
|
+
z-index: -9;
|
|
182
|
+
box-sizing: border-box;
|
|
183
|
+
border-bottom: 1px solid
|
|
184
|
+
var(--diffs-editor-bracket-match-border, color-mix(in lab, var(--diffs-fg) 60%, transparent));
|
|
185
|
+
background-color: var(--diffs-editor-bracket-match-bg, color-mix(in lab, var(--diffs-fg) 5%, transparent));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
[data-rtl] {
|
|
189
|
+
border-top-left-radius: 3px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
[data-rtr] {
|
|
193
|
+
border-top-right-radius: 3px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
[data-rbl] {
|
|
197
|
+
border-bottom-left-radius: 3px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
[data-rbr] {
|
|
201
|
+
border-bottom-right-radius: 3px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
[data-marker-range] {
|
|
205
|
+
z-index: 1;
|
|
206
|
+
background-color: var(--diffs-marker-bg);
|
|
207
|
+
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+");
|
|
208
|
+
mask-position: 0 100%;
|
|
209
|
+
mask-size: 6px 3px;
|
|
210
|
+
mask-repeat: repeat-x;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
[data-marker-error] {
|
|
214
|
+
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
215
|
+
--diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
[data-marker-warning] {
|
|
219
|
+
--diffs-marker-contrast: #000;
|
|
220
|
+
--diffs-marker-bg: var(--diffs-editor-warning-fg, light-dark(var(--diffs-warning-light), var(--diffs-warning-dark)));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
[data-marker-info] {
|
|
224
|
+
--diffs-marker-contrast: #000;
|
|
225
|
+
--diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
[data-marker-hint] {
|
|
229
|
+
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
230
|
+
--diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@media (width >= 480px) {
|
|
234
|
+
[data-content] {
|
|
235
|
+
caret-color: #0000;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
[data-content]:focus ~ [data-editor-overlay] [data-caret] {
|
|
239
|
+
visibility: visible;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
[data-editor-widget] {
|
|
244
|
+
--diffs-widget-fg: var(--diffs-fg);
|
|
245
|
+
--diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
|
|
246
|
+
--diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
|
|
247
|
+
--diffs-widget-shadow: inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013,
|
|
248
|
+
0 6px 18px #00000013;
|
|
249
|
+
z-index: 100;
|
|
250
|
+
width: fit-content;
|
|
251
|
+
max-width: calc(100% - 24px);
|
|
252
|
+
font: 14px/20px var(--diffs-header-font-fallback);
|
|
253
|
+
border: 1px solid var(--diffs-widget-border);
|
|
254
|
+
background-color: var(--diffs-widget-bg);
|
|
255
|
+
box-shadow: var(--diffs-widget-shadow);
|
|
256
|
+
background-clip: padding-box;
|
|
257
|
+
border-radius: 9px;
|
|
258
|
+
position: absolute;
|
|
259
|
+
top: 0;
|
|
260
|
+
left: 0;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
[data-marker-popover], [data-selection-action-popover] {
|
|
264
|
+
--popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));
|
|
265
|
+
--popover-viewport-left: 0px;
|
|
266
|
+
--popover-viewport-right: 100cqw;
|
|
267
|
+
--popover-viewport-top: -99999px;
|
|
268
|
+
--popover-viewport-bottom: 99999px;
|
|
269
|
+
--popover-min-left: calc(var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap));
|
|
270
|
+
--popover-available-width: max(0px,
|
|
271
|
+
calc(var(--popover-viewport-right) - var(--popover-min-left) -
|
|
272
|
+
var(--popover-gap)));
|
|
273
|
+
max-width: min(640px, var(--popover-available-width));
|
|
274
|
+
translate: clamp(var(--popover-min-left),
|
|
275
|
+
var(--popover-x, var(--popover-min-left)),
|
|
276
|
+
calc(var(--popover-viewport-right) - var(--popover-gap) - 100%))
|
|
277
|
+
/* Clamp into the scrollport so a popover with no fitting side stays in view. */
|
|
278
|
+
clamp(var(--popover-viewport-top),
|
|
279
|
+
calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),
|
|
280
|
+
calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
[data-marker-popover] {
|
|
284
|
+
--diffs-widget-bg: var(--diffs-marker-bg);
|
|
285
|
+
--diffs-widget-shadow: 0 4px 8px #00000026, 0 6px 18px #00000026;
|
|
286
|
+
min-width: min(180px, var(--popover-available-width));
|
|
287
|
+
overflow-wrap: anywhere;
|
|
288
|
+
color: var(--diffs-marker-contrast);
|
|
289
|
+
white-space: normal;
|
|
290
|
+
pointer-events: auto;
|
|
291
|
+
border: 0;
|
|
292
|
+
padding: 8px 12px;
|
|
293
|
+
|
|
294
|
+
@supports (color: contrast-color(red)) {
|
|
295
|
+
color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
& [data-marker-message] {
|
|
299
|
+
white-space: normal;
|
|
300
|
+
overflow-wrap: anywhere;
|
|
301
|
+
|
|
302
|
+
& code {
|
|
303
|
+
white-space: normal;
|
|
304
|
+
color: inherit;
|
|
305
|
+
background-color: #0000;
|
|
306
|
+
display: inline;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
[data-selection-action-popover] {
|
|
312
|
+
pointer-events: auto;
|
|
313
|
+
flex-wrap: wrap;
|
|
314
|
+
align-items: center;
|
|
315
|
+
gap: 4px;
|
|
316
|
+
width: max-content;
|
|
317
|
+
padding: 4px;
|
|
318
|
+
display: flex;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
[data-search-panel] {
|
|
322
|
+
z-index: 100;
|
|
323
|
+
flex-direction: column;
|
|
324
|
+
justify-content: right;
|
|
325
|
+
width: 100%;
|
|
326
|
+
height: 0;
|
|
327
|
+
display: flex;
|
|
328
|
+
position: sticky;
|
|
329
|
+
top: 16px;
|
|
330
|
+
right: 16px;
|
|
331
|
+
container: search-panel / inline-size;
|
|
332
|
+
|
|
333
|
+
& [data-editor-widget] {
|
|
334
|
+
z-index: 100;
|
|
335
|
+
flex-shrink: 0;
|
|
336
|
+
align-items: stretch;
|
|
337
|
+
gap: 8px;
|
|
338
|
+
min-width: 260px;
|
|
339
|
+
max-width: 100%;
|
|
340
|
+
margin-inline: auto 16px;
|
|
341
|
+
padding: 4px;
|
|
342
|
+
display: flex;
|
|
343
|
+
position: relative;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
& svg {
|
|
347
|
+
fill: currentColor;
|
|
348
|
+
width: 12px;
|
|
349
|
+
height: 12px;
|
|
350
|
+
display: block;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
[data-search-grid] {
|
|
355
|
+
grid-template-columns: auto auto auto;
|
|
356
|
+
grid-template-areas: "find matches nav"
|
|
357
|
+
"replace actions .";
|
|
358
|
+
align-items: center;
|
|
359
|
+
gap: 4px 6px;
|
|
360
|
+
width: 100%;
|
|
361
|
+
display: grid;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
[data-input-box][data-find] {
|
|
365
|
+
grid-area: find;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
[data-search-nav] {
|
|
369
|
+
grid-area: nav;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
[data-input-box][data-replace] {
|
|
373
|
+
grid-area: replace;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
[data-replace-actions] {
|
|
377
|
+
grid-area: actions;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
[data-search-grid][data-mode="find"] {
|
|
381
|
+
grid-template-areas: "find matches nav";
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
[data-search-grid][data-mode="find"] [data-replace-cell] {
|
|
385
|
+
display: none;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
@container search-panel (width < 400px) {
|
|
389
|
+
[data-search-panel] [data-editor-widget] {
|
|
390
|
+
padding: 10px;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
[data-search-grid][data-mode="replace"] {
|
|
394
|
+
grid-template-columns: auto 1fr auto;
|
|
395
|
+
grid-template-areas: "find find find"
|
|
396
|
+
"replace replace replace"
|
|
397
|
+
"nav matches actions";
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
[data-search-grid][data-mode="find"] {
|
|
401
|
+
grid-template-columns: auto 1fr auto;
|
|
402
|
+
grid-template-areas: "find find find"
|
|
403
|
+
"nav matches matches";
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
[data-replace-actions] {
|
|
407
|
+
justify-self: end;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
[data-search-grid] [data-input-box] {
|
|
411
|
+
width: auto;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
[data-input-box] {
|
|
416
|
+
align-items: center;
|
|
417
|
+
width: 200px;
|
|
418
|
+
display: flex;
|
|
419
|
+
position: relative;
|
|
420
|
+
|
|
421
|
+
& input {
|
|
422
|
+
width: 100%;
|
|
423
|
+
min-width: 0;
|
|
424
|
+
color: var(--diffs-fg);
|
|
425
|
+
background-color: var(--diffs-bg);
|
|
426
|
+
border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));
|
|
427
|
+
border-radius: 6px;
|
|
428
|
+
outline: none;
|
|
429
|
+
flex-grow: 1;
|
|
430
|
+
padding-inline: 6px;
|
|
431
|
+
font-size: 13px;
|
|
432
|
+
line-height: 24px;
|
|
433
|
+
|
|
434
|
+
&::selection {
|
|
435
|
+
background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
&:focus-visible {
|
|
439
|
+
outline: 1px solid var(--diffs-modified-base);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
&[data-find] input {
|
|
444
|
+
padding-inline-end: 72px;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
& [data-search-icon] {
|
|
448
|
+
--diffs-search-icon-size: 20px;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
[data-search-toggles] {
|
|
453
|
+
align-items: center;
|
|
454
|
+
gap: 1px;
|
|
455
|
+
display: flex;
|
|
456
|
+
position: absolute;
|
|
457
|
+
top: 50%;
|
|
458
|
+
right: 4px;
|
|
459
|
+
transform: translateY(-50%);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
[data-matches] {
|
|
463
|
+
white-space: nowrap;
|
|
464
|
+
min-width: 50px;
|
|
465
|
+
color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
|
|
466
|
+
flex-shrink: 0;
|
|
467
|
+
grid-area: matches;
|
|
468
|
+
font-size: 12px;
|
|
469
|
+
font-weight: 500;
|
|
470
|
+
line-height: 20px;
|
|
471
|
+
|
|
472
|
+
&[data-no-matches] {
|
|
473
|
+
color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
[data-replace-actions], [data-search-nav] {
|
|
478
|
+
align-items: center;
|
|
479
|
+
display: flex;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
[data-search-icon] {
|
|
483
|
+
appearance: none;
|
|
484
|
+
width: var(--diffs-search-icon-size, 24px);
|
|
485
|
+
height: var(--diffs-search-icon-size, 24px);
|
|
486
|
+
color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));
|
|
487
|
+
border-radius: var(--diffs-search-icon-radius, 4px);
|
|
488
|
+
cursor: pointer;
|
|
489
|
+
background: none;
|
|
490
|
+
border: 0;
|
|
491
|
+
flex-shrink: 0;
|
|
492
|
+
justify-content: center;
|
|
493
|
+
align-items: center;
|
|
494
|
+
margin: 0;
|
|
495
|
+
padding: 0;
|
|
496
|
+
transition: background-color .1s ease-in-out, color .1s ease-in-out;
|
|
497
|
+
display: flex;
|
|
498
|
+
|
|
499
|
+
&:disabled {
|
|
500
|
+
opacity: .25;
|
|
501
|
+
cursor: default;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
&:not(:disabled):hover {
|
|
505
|
+
color: var(--diffs-fg);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
&:focus-visible {
|
|
509
|
+
outline: 1px solid var(--diffs-modified-base);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
&[aria-pressed="true"] {
|
|
513
|
+
color: var(--diffs-modified-base);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
[data-search-close] {
|
|
518
|
+
--diffs-search-icon-size: 20px;
|
|
519
|
+
--diffs-search-icon-radius: 50%;
|
|
520
|
+
color: var(--diffs-widget-bg);
|
|
521
|
+
background-color: color-mix(in lab,
|
|
522
|
+
var(--diffs-widget-fg) 50%,
|
|
523
|
+
var(--diffs-bg));
|
|
524
|
+
position: absolute;
|
|
525
|
+
top: 0;
|
|
526
|
+
right: 0;
|
|
527
|
+
transform: translate(50%, -50%);
|
|
528
|
+
|
|
529
|
+
&:not(:disabled):hover {
|
|
530
|
+
opacity: 1;
|
|
531
|
+
color: var(--diffs-widget-bg);
|
|
532
|
+
background-color: var(--diffs-widget-fg);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
`,Wa=350,Ga=150,Ka=512,qa=662,Ja=131072,$=6144,Ya=1e3,Xa=8,Za=3,Qa=[11,Za],$a=new TextEncoder;function eo(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 to(e,t){return e.length===0?0:t.at(-1)===e.length?t.length-1:t.length}function no(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 ro(e,t,n,r,i,a){let o=t[n],s=i[a],c=no(e,t,n)-o;if(c!==no(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 io(e,t,n,r){let i=to(e,t),a=to(n,r),o=0;for(;o<i&&o<a&&ro(e,t,o,n,r,o);)o++;let s=0;for(;s<i-o&&s<a-o&&ro(e,t,i-1-s,n,r,a-1-s);)s++;return{oldLineCount:i,newLineCount:a,prefixLines:o,suffixLines:s}}function ao(e,t,n,r=0){if(t===n)return;let i=eo(t),a=eo(n),o=io(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($a.encode(l).byteLength>$||$a.encode(u).byteLength>$)return;let d=Math.max(0,o.prefixLines-Za),f=Math.min(o.oldLineCount,s+Za),p=Math.min(o.newLineCount,c+Za),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],no(t,i,e))}`);for(let e=o.prefixLines;e<s;e++)_.push(`-${t.slice(i[e],no(t,i,e))}`);for(let e=o.prefixLines;e<c;e++)_.push(`+${n.slice(a[e],no(n,a,e))}`);for(let e=s;e<f;e++)_.push(` ${t.slice(i[e],no(t,i,e))}`);let v=_.join(`
|
|
536
|
+
`);return $a.encode(v).byteLength<=$?{hunk:v,bounds:o}:void 0}function oo(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 so(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 Qa){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>$)continue;let l=e.getTextSlice(s,c);if($a.encode(l).byteLength>$)continue;let u=oo(l,s,n);if(!(u===void 0||u.length>$||$a.encode(u).byteLength>$))return{beforeText:u,afterText:l,startOffset:s,startLine:r,bounds:io(u,eo(u),l,eo(l))}}}function co(e,t,n,r,i,a=Date.now()){let o=e.slice(-10),s=so(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<Ya&&d<=Xa){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=oo(l,c,r.appliedEdits),m=e.currentStart<=s.startOffset?e.startLine:s.startLine;if(p!==void 0&&f.length<=$&&p.length<=$&&$a.encode(f).byteLength<=$&&$a.encode(p).byteLength<=$){if(f===p)return o.pop(),o;let e=ao(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=ao(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 lo(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 uo(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)>qa)return p.set(e,663),663;let i=Math.max(1,Math.floor($a.encode(t.getLineText(e)).byteLength/3));return p.set(e,i),i},h=u,g=u,_=Math.max(0,Math.floor(Wa*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}=lo(t.lineCount,m,f,h,g,_);let v=h,y=g;({first:v,last:y}=lo(t.lineCount,m,()=>!0,v,y,Ga));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>Ka||x>qa)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 $a.encode(JSON.stringify(T)).byteLength<=Ja?T:void 0}function fo(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 po=`//`,mo=[`/*`,`*/`],ho={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 go(e,t){let n={...ho[e],...t?.[e]};return{lineComment:n.lineComment===void 0?po:n.lineComment,blockComment:n.blockComment??mo}}function _o(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 vo=50;function yo(e,t,n,r,i){let a=Math.max(0,r-vo),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+vo),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+vo),p=d??e.getTextSlice(i-vo,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 bo(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 xo(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=yo(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=bo(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?bo(e.end,s,u,e.endAssociation):n,a[t].direction]})}}var So=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),Co=new Map([...So].map(([e,t])=>[t,e])),wo=1e3,To=5e4;function Eo(e,t,n){let r=Do(e,t,e.normalizePosition(n));if(r===void 0)return;let i=So.get(r.char),a=Co.get(r.char);if(i!==void 0)return Io(r,Ao(e,t,r,i));if(a!==void 0)return Io(jo(e,t,r,a),r)}function Do(e,t,n){let r=Oo(n);if(r!==void 0){let n=ko(e,t,r);if(n!==void 0)return n}return ko(e,t,n)}function Oo(e){if(e.character>0)return{line:e.line,character:e.character-1}}function ko(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!So.has(r)&&!Co.has(r)||Mo(t,n)))return{...n,char:r}}function Ao(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=wo)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>=To)return;if(o++,Po(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 jo(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=wo)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>=To)return;if(o++,Fo(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 Mo(e,t){return No(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function No(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 Po(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 Fo(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 Io(e,t){if(e!==void 0&&t!==void 0)return[Lo(e),Lo(t)]}function Lo(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var Ro=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
537
|
+
<symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
|
|
538
|
+
<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>
|
|
539
|
+
</symbol>
|
|
540
|
+
<symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
|
|
541
|
+
<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>
|
|
542
|
+
</symbol>
|
|
543
|
+
<symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
|
|
544
|
+
<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>
|
|
545
|
+
</symbol>
|
|
546
|
+
<symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
|
|
547
|
+
<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>
|
|
548
|
+
<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>
|
|
549
|
+
</symbol>
|
|
550
|
+
<symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
|
|
551
|
+
<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>
|
|
552
|
+
<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>
|
|
553
|
+
<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>
|
|
554
|
+
</symbol>
|
|
555
|
+
<symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
|
|
556
|
+
<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>
|
|
557
|
+
<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>
|
|
558
|
+
</symbol>
|
|
559
|
+
<symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
|
|
560
|
+
<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>
|
|
561
|
+
</symbol>
|
|
562
|
+
<symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
|
|
563
|
+
<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>
|
|
564
|
+
</symbol>
|
|
565
|
+
</svg>`,zo=()=>{let e=document.createElement(`div`);e.innerHTML=Ro;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},Bo=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
|
|
566
|
+
<use href="#diffs-editor-icon-${e}"></use>
|
|
567
|
+
</svg>`,Vo=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=q(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(re.disabled=n,O.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:Tr(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=>q(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:Bo(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=q(`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=Kr(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=q(`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=Kr(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?zr(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),j(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let ee=q(`div`,{dataset:`searchToggles`,children:[C,w,T]}),D=q(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,ee]}),te=q(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),ne=q(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),re=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),O=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});re.disabled=!0,O.disabled=!0;let ie=q(`div`,{dataset:`searchNav`,children:[re,O]}),k=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),A=q(`div`,{dataset:{searchGrid:``,mode:i},children:[D,te,ne,f,ie,k]}),j=e=>{A.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=j,this.#e=q(`div`,{dataset:`searchPanel`,children:[q(`div`,{dataset:`editorWidget`,children:[A]})]}),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()}},Ho=class{#e;#t;#n;constructor(e,t,n){this.#e=q(`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`,ii(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}},Uo=4096,Wo=/\p{Mark}/u,Go=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=Xr(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=Yo(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))),Xr(n)}segmentTextWidth(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=Yo(r,this.tabSize);return i===-1?this.measureTextWidth(r):i*this.ch}#i(e){return Ko(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return Xr(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=q(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=Xr(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=Uo){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 Ko(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&&Wo.test(e.charAt(t)))return!0}return!1}function qo(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!Ko(e))return n;let r=ti();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 Jo(e){if(!Ko(e))return;let t=[0],n=ti();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 Yo(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 Xo=500,Zo=0,Qo=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[Me];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++Zo;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=Yr(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&&!ts(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]??Me,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=De,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=[J(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=[Me],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=De}=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()!==``&&!fn.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 {
|
|
568
|
+
--diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
|
|
569
|
+
--diffs-editor-line-highlight-border: ${c};
|
|
570
|
+
--diffs-editor-active-line-source-mix: ${l};
|
|
571
|
+
--diffs-editor-match-bg: ${d??`initial`};
|
|
572
|
+
--diffs-editor-match-highlight-bg: ${f??`initial`};
|
|
573
|
+
--diffs-editor-bracket-match-bg: ${p??`initial`};
|
|
574
|
+
--diffs-editor-bracket-match-border: ${m??`initial`};
|
|
575
|
+
--diffs-editor-cursor-fg: ${u??`initial`};
|
|
576
|
+
--diffs-editor-hint-fg: ${h??`initial`};
|
|
577
|
+
--diffs-editor-info-fg: ${g??`initial`};
|
|
578
|
+
--diffs-editor-warning-fg: ${_??`initial`};
|
|
579
|
+
--diffs-editor-error-fg: ${v??`initial`};
|
|
580
|
+
}`),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&&!ts(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]??Me;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]??Me;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&&!ts(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(ts(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=$o(this.#t,this.#a,n,t,Xo,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]??Me;for(;i<n;){this.#h[i]=a;let e=this.#o.getLineText(i);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=$o(this.#t,this.#a,e,a,Xo,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]??Me,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=$o(this.#t,this.#a,r,o,Xo,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 $o(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=Fe.getForeground(s);u.push([r,t[e],n.slice(r,i)])}a&&Fe.getTokenType(s)>0&&d.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d}}function es(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?q(`br`):n:q(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function ts(e){return e===`text`||e===`ansi`}function ns(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 rs(e,t){let n=ye(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 is(e){return e!=null&&`renderType`in e&&e.renderType===`virtualized`}var as=2,os=1e4,ss=300,cs=256,ls=131072,us=new TextEncoder,ds=`selection-action`,fs=`application/vnd.pierre.diffs-selections+json`,ps=class{type;#e;#t;#n;#r=new Go;#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(...es(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=ms({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`?Rr.releaseFile(a,t):Rr.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=Ki(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 Fr(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 Ir(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 Q(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(Z(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 Ra({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,Qe(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=Fr(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`?Rr.releaseFile(t,n):Rr.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:Ha(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??z(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?[rs(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 Yn({maxEntries:this.#e.historyMaxEntries});n=new Ar(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 Qo({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=Jr(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=Ki(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 is(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 ri({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&&(Qe(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,kt(i)}#He(){let e=this.#Ae?.getEditorViewport?.();if(e!=null)return e;let t=this.#S;if(this.#M!=null&&t!=null)return ni(t)}#Ue(){if(!this.#z)return;let e=this.#Ae?.getEditorViewport?.();if(e instanceof HTMLElement)return e}#We(){this.#v=q(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
581
|
+
[data-annotation-slot] {
|
|
582
|
+
user-select: none;
|
|
583
|
+
-webkit-user-select: none;
|
|
584
|
+
}
|
|
585
|
+
`}),this.#y=q(`style`,{dataset:`editorCss`,textContent:Ua}),this.#b=q(`style`,{dataset:`editorThemeCss`}),this.#x=zo(),this.#E=q(`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&&!X(this.#oe.at(-1))&&this.#Ut(this.#oe)};this.#s=[J(document,`focusin`,n=>{e(n)||t()},{passive:!0}),J(document,`pointerdown`,n=>{e(n)||queueMicrotask(t)},{capture:!0,passive:!0}),J(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]:ns(e),n===void 0||!this.#Sn(n))return;let r=xi(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([Ji(e,r)]);return}if(this.#$)this.#ne===void 0?this.#ne=r:r=qi(this.#ne,r);else if(this.#ne!==void 0)r.direction=qi(this.#ne,r).direction;else if(this.#oe!==void 0&&this.#oe.length===1){let e=this.#oe[0];Q(e.start,r.start)===0&&Q(e.end,r.end)===0&&(r.direction=e.direction)}this.#ee!==void 0&&(this.#ee.focusLine=Z(r).line,this.#Ot())||(this.#ie===void 0?this.#Ut([r]):this.#Ut([...this.#ie.filter(e=>!Ui(e,r)),r]))}},{passive:!0}),J(document,`pointerup`,n,{passive:!0}),J(document,`pointercancel`,n,{passive:!0}),J(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}),J(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=[J(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}),J(e,`blur`,()=>{this.#X?.target===e&&(this.#X=void 0,this.#q=!1),this.#Y=!1,r?.()},{passive:!0}),J(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(Ct()&&this.#L!==void 0&&this.#L.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[J(e,`mouseenter`,()=>{this.#q=!0}),J(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(J(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&&zr(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}),J(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=Gr(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=Br(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(ki(r,this.#oe,n,t)):this.#Ut(Ci(r,this.#oe,n,t)),this.#ht(),e.preventDefault();return}if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&zr(e)){if(e.repeat&&this.#Fe){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),kt(this.#Xe);return}}if(this.#W!==void 0){let t=Kr(e);if(t!==void 0){e.preventDefault(),this.#W.navigate(t===`previous`);return}}}),J(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#Ct()?e.clipboardData?.setData(`text`,this.#wt()):this.#tn(e.clipboardData,this.#$t(),this.#en()))}),J(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)}}}),J(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(fs);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`)}),J(e,`beforeinput`,e=>{if(i(e)){if(e.inputType===`insertCompositionText`){this.#Lt(!0);return}e.preventDefault(),this.#ct(e.inputType,e.data)}}),J(e,`drop`,e=>{i(e)&&e.preventDefault()}),J(e,`compositionstart`,e=>{i(e)&&(this.#Lt(!0),this.#Z=!0,this.#q=!0)},{passive:!0}),J(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(J(a,`pointerdown`,e=>{let t=e.composedPath();if(zt(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=Y(e)??Y(e,`columnNumber`);if(n!==void 0&&t!==void 0&&Hi(t))return n-1};this.#o.push(J(t,`pointerdown`,t=>{let r=t.composedPath();if(zt(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([J(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(fs);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(X)){let n=e.map(e=>X(e)?fa(t,e):e);this.#Ut(n),this.focus()}else{let n=$i(t,e);if(n!==void 0){this.#Ut(n);let e=n.at(-1);e!==void 0&&this.#Ne(Z(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(Z(t));else if(!X(t)){let e=Z(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}=go(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#tt(_o(t,n,r));break}let a=e===`toggleComment`,o=xo(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=Si(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=ea(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=ta(t,e===`moveCursorToDocEnd`,this.#Fe);this.#Ut([n]),this.#Ne(Z(n).line),this.#ht()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#oe;if(r!==void 0){let e=ta(t,n,this.#Fe);this.#Ut(Yi(r,e)),this.#Ne(Z(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?Ki(t,n,r,c):void 0),u=s??(this.#L==null?void 0:oi(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?Ki(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=Zi(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=>Z(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=Zi(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=>Qi(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=Y(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(...es(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=Y(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);q(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:es(t)},l),c!==void 0&&q(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[q(`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=Y(r)??Y(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)&&fi(t,l,c,a.getAnnotationSlotName)),this.#Wt(),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${Xr(performance.now()-f)}ms,`,`tokenize in: ${Xr(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?Fi(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??`
|
|
586
|
+
`);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}),kt(()=>{if(n?.()===!1||!this.#Y){this.#q=!1;return}this.#w?.focus({preventScroll:t}),kt(()=>{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=Y(t),r=t.dataset.lineType;if(n==null||r==null||!Hi(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;Q(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]=da(a,n.character),[l,u]=da(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{t.setBaseAndExtent(s,qr(s,c),l,qr(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=Z(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=q(`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=Y(n);if(r!==void 0&&Hi(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(Y(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(`
|
|
587
|
+
`)}#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([J(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&&Q(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=Ti(t,i),c=a===i?o:Ti(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||Q(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=q(`span`,{dataset:c?[`editPredictionLine`,`empty`]:`editPredictionLine`,textContent:c?``:o},e);s!==void 0&&q(`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(!(Q(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]=da(c,o.character),d=document.createRange();d.selectNodeContents(c),d.setStart(l,qr(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=q(`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+=hs(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+=hs(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=>fo(n,e)))&&t.exclude?.some(e=>fo(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||!X(e))return;let t=this.#n?.document,n=t.offsetAt(Z(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||!X(r)||t.offsetAt(Z(r))!==n||!this.#Rt(i))return;let a=e=>this.#mn(e)&&this.#je(e);if(!a(Z(r).line)){this.#ye=!0;return}let o=uo(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||!X(r)||t.offsetAt(Z(r))!==n||e==null||!Array.isArray(e.edits)||e.edits.length===0||e.edits.length>cs||e.newCursor==null)return;let i=[],a=0;for(let n of e.edits){if(n==null||typeof n.newText!=`string`||!gs(t,n.range?.start)||!gs(t,n.range?.end)||Q(n.range.start,n.range.end)>0||(a+=us.encode(n.newText).byteLength,a>ls))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||_s(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(_s(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)})},ss)}#Bt(e,t){let n=this.#n?.document,r=this.#n?.fileInfo?.name,i=Or(e);n!==void 0&&r!==void 0&&i!==void 0&&this.#Rt(r)&&(this.#xe=co(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||!X(n)||t.offsetAt(Z(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=Q(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=q(`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||Q(i.start,a.start)!==0||Q(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=Xi(e),n=t.at(-1);this.#oe=t;let r=t.some(e=>!X(e)),a=Z(n).line+1;this.#Et(a,r);for(let e of t)X(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&&X(n)?Eo(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,Va(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=q(`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=Yo(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=q(`div`,{dataset:t===`caretHighlight`?`caretHighlightRange`:`selectionRange`,style:{cssText:d},children:[q(`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=q(`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}=Z(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=q(`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||X(e)||this.#$||t===void 0||n===void 0){i();return}let a=Z(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 Ho(o,t,()=>this.#Xt()),this.#Le().resetPlacement(ds)}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:ds})===`fallback`;h===void 0&&g.setPlacement(`preferred`,ds);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(X(e)){e=fa(t,e),this.#Ut([...r.slice(0,-1),e]);let n=t.getText(e);n!==``&&!n.includes(`
|
|
588
|
+
`)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=Wi(t,e,n);this.#Ut([i]),this.#Ne(Z(i).line),this.#ht(!0),this.#fe=r},s=new Vo({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?``:aa(e,t)}#en(){let e=this.#n?.document,t=this.#oe;return e===void 0||t===void 0?[]:ia(e,t)}#tn(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(fs,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=>X(e))){let n=ua(e,t);return this.#rn(n.edits,n.nextSelectionOffsets),n.text}let n=aa(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?Ni(i,t,e,this.#L,n,r):Ai(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}=Vi(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}=Ri(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}=zi(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}=Li(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}=Ii(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=Gi(t.anchorOffset,e.changes),t.focusOffset=Gi(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*as;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(Z(e).line),this.#A!==void 0)requestAnimationFrame(()=>{this.#A?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=Z(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=oi(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=Y(e);if(i===void 0||r===void 0||!Hi(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=Y(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&Hi(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=qo(n,Math.min(t,n.length)),a=n.slice(0,i),o=Yo(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=Yo(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>=os&&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=q(`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=Jo(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=Ct()&&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 ms({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`}):Rr.activate(e,t,n,a)}function hs(e){return e instanceof HTMLElement?Number(e.dataset.bufferSize??1):1}function gs(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 _s(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 vs=(e,t,n)=>new ps(e,t,n);function ys(e){let t=(0,Ln.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,W.jsx)(_t,{createEditor:vs,children:(0,W.jsx)(Mt,{className:`min-h-0 flex-1 overflow-auto`,contentClassName:`min-h-full`,config:d,children:(0,W.jsx)(In,{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 bs=`
|
|
589
|
+
[data-file] {
|
|
590
|
+
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
591
|
+
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
592
|
+
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
593
|
+
--diffs-token-light-bg: transparent;
|
|
594
|
+
--diffs-token-dark-bg: transparent;
|
|
595
|
+
background-color: var(--diffs-bg) !important;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
[data-code],
|
|
599
|
+
[data-content],
|
|
600
|
+
[data-line],
|
|
601
|
+
[data-column-number] {
|
|
602
|
+
font-size: 11px;
|
|
603
|
+
line-height: 1.25rem;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/* Pierre centers its 2px synthetic caret on the insertion boundary. Keep the
|
|
607
|
+
caret entirely after the preceding glyph so narrow punctuation remains
|
|
608
|
+
visibly on the correct side of the cursor. */
|
|
609
|
+
[data-caret] {
|
|
610
|
+
translate: 1px 0;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
[data-line-number-content] {
|
|
614
|
+
color: color-mix(in srgb, var(--muted-foreground) 85%, transparent);
|
|
615
|
+
}
|
|
616
|
+
`,xs=524288,Ss=new Set([`gif`,`jpeg`,`jpg`,`png`,`svg`,`webp`]),Cs=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(`.`)),ws=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`]]),Ts=new Set([`application/javascript`,`application/json`,`application/toml`,`application/typescript`,`application/xml`,`application/x-sh`,`application/yaml`,`application/xhtml+xml`,`image/svg+xml`]);function Es(e){let t=e.split(/[?#]/,1)[0]??e;return t.toLowerCase().split(`/`).at(-1)??t.toLowerCase()}function Ds(e){let t=Es(e),n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?t:t.slice(n+1)}function Os(e){let t=Es(e);return t===`dockerfile`?`dockerfile`:t===`.gitignore`?`ini`:ws.get(Ds(e))??`text`}function ks(e){let t=e.mimeType?.toLowerCase().split(`;`,1)[0]?.trim();if(t?.startsWith(`image/`))return`image`;if(t&&(t.startsWith(`text/`)||Ts.has(t)))return`text`;let n=Ds(e.filePath);return Ss.has(n)?`image`:Cs.has(n)?`text`:`binary`}function As(e,t=xs){return e>t?{state:`too-large`,shouldFetch:!1,sizeBytes:e,limitBytes:t}:{state:`within-limit`,shouldFetch:!0,sizeBytes:e,limitBytes:t}}function js(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function Ms(e){return js(e).trim().split(/\s+/).filter(e=>e.length>0)}function Ns(e,t){return t.every(t=>e.includes(t))}function Ps(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 Fs(e,t){let n=Ms(t);if(n.length===0)return e;let r=new Set;for(let t of e){if(t.kind!==`directory`)continue;let e=js(t.path);Ns(e,n)&&r.add(e)}return e.filter(e=>{let t=js(e.path);return Ns(t,n)||Ps(t,r)})}var Is=()=>()=>{},Ls=()=>null,Rs=`chat_preview_tree_width`,zs=220,Bs=280,Vs=.55,Hs=`
|
|
617
|
+
.preview-panel-diffs-file {
|
|
618
|
+
display: block;
|
|
619
|
+
min-height: 100%;
|
|
620
|
+
padding: 0.75rem;
|
|
621
|
+
background-color: color-mix(in srgb, var(--card) 90%, var(--background));
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.preview-panel-file-card {
|
|
625
|
+
container-type: inline-size;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
@container (max-width: 360px) {
|
|
629
|
+
.preview-panel-file-toolbar {
|
|
630
|
+
flex-wrap: wrap;
|
|
631
|
+
gap: 0.25rem;
|
|
632
|
+
padding-block: 0.375rem;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
.preview-panel-file-identity {
|
|
636
|
+
flex-basis: 100%;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
.preview-panel-file-actions {
|
|
640
|
+
margin-left: auto;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
`;function Us(e,t){let n=Math.max(zs,Math.floor(t*Vs));return Math.max(zs,Math.min(e,n))}function Ws(e,t,n){let r=e.startX-n;return Us(e.startWidth+r,t)}function Gs(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 Ks(e,t){return`preview:${e}:${t.length}:${T(t).toString(36)}`}var qs=[];function Js(e){let t=(0,Ln.c)(24),[r,i]=(0,G.useState)(e.open),a,o;t[0]===e.open?(a=t[1],o=t[2]):(a=()=>{if(!e.open){i(!1);return}let t=window.requestAnimationFrame(()=>i(!0));return()=>window.cancelAnimationFrame(t)},o=[e.open],t[0]=e.open,t[1]=a,t[2]=o),(0,G.useEffect)(a,o);let s=e.open&&r,c=!e.open||void 0,l=!e.open||void 0,u=e.open?`border-l border-border/70`:`border-l-0`,d=e.resizing?`transition-none`:`transition-[width,opacity] duration-[360ms] ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none`,f=e.open?`opacity-100`:`opacity-0`,p;t[3]!==u||t[4]!==d||t[5]!==f?(p=n(`min-h-0 shrink-0 overflow-hidden bg-card/20`,u,d,f),t[3]=u,t[4]=d,t[5]=f,t[6]=p):p=t[6];let m=e.open?`${e.width}px`:`0px`,h;t[7]===m?h=t[8]:(h={width:m,maxWidth:`55%`},t[7]=m,t[8]=h);let g=e.resizing?`transition-none`:null,_=s?`translate-x-0 opacity-100`:`translate-x-4 opacity-0`,v;t[9]!==g||t[10]!==_?(v=n(`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`,g,_),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y=`${e.width}px`,b;t[12]===y?b=t[13]:(b={width:y,maxWidth:`100%`},t[12]=y,t[13]=b);let x;t[14]!==e.children||t[15]!==v||t[16]!==b?(x=(0,W.jsx)(`div`,{className:v,style:b,children:e.children}),t[14]=e.children,t[15]=v,t[16]=b,t[17]=x):x=t[17];let S;return t[18]!==x||t[19]!==c||t[20]!==l||t[21]!==p||t[22]!==h?(S=(0,W.jsx)(`div`,{"data-preview-file-rail":!0,"aria-hidden":c,inert:l,className:p,style:h,children:x}),t[18]=x,t[19]=c,t[20]=l,t[21]=p,t[22]=h,t[23]=S):S=t[23],S}function Ys(){let e=(0,Ln.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(A,{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,W.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center`,children:(0,W.jsxs)(`div`,{className:`flex max-w-xs flex-col items-center gap-3`,children:[t,(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:`Open file`}),(0,W.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 Xs({mode:e=`inline`}){let{resolvedTheme:a}=Bt(),u=r(),y=e===`phone`,b=o({strict:!1,select:e=>i(e)}),x=o({strict:!1,select:e=>typeof e.draftId==`string`?p.make(e.draftId):null}),w=tn({strict:!1,select:e=>Ve(e)}),T=v((0,G.useMemo)(()=>s(b),[b])),E=g(e=>T?null:x?e.getDraftSession(x):b?e.getDraftThreadByRef(b):null),D=(0,G.useMemo)(()=>{if(T)return{id:T.id,environmentId:T.environmentId,projectId:T.projectId,worktreePath:T.worktreePath,turnDiffSummaries:T.turnDiffSummaries};if(E)return{id:E.threadId,environmentId:E.environmentId,projectId:E.projectId,worktreePath:E.worktreePath,turnDiffSummaries:qs}},[T,E]),te=D?.projectId??null,re=v(e=>D&&te?f(e,{environmentId:D.environmentId,projectId:te}):void 0),O=D?.worktreePath??re?.cwd??null,[k,A]=(0,G.useState)(null),[j,M]=(0,G.useState)(null),[N,ae]=(0,G.useState)(null),[oe,se]=(0,G.useState)(``),[P,ce]=(0,G.useState)(!0),[F,le]=(0,G.useState)(y?!0:u.diffWordWrap),ue=(0,G.useRef)(null),[de,fe]=(0,G.useState)(()=>typeof window>`u`?Bs:l(Rs,t)??Bs),[pe,me]=(0,G.useState)(!1),he=(0,G.useRef)(null),ge=(0,G.useRef)(w.preview===`1`),_e=(0,G.useRef)(null),ve=(0,G.useRef)(null),ye=(0,G.useRef)(null);(0,G.useEffect)(()=>{le(y?!0:u.diffWordWrap)},[y,u.diffWordWrap]),(0,G.useEffect)(()=>{A(!y&&D?.environmentId&&O?an({environmentId:D.environmentId,cwd:O}):null),ae(null),M(null),ce(!0)},[O,D?.environmentId,D?.id,y]);let be=(0,G.useMemo)(()=>{let e=(D?.turnDiffSummaries??[]).toReversed().find(e=>e.files.length>0);return e?`${e.turnId}:${e.completedAt}`:null},[D?.turnDiffSummaries]),xe=(0,G.useMemo)(()=>{if(!k)return null;let e=(D?.turnDiffSummaries??[]).toReversed().find(e=>e.files.some(e=>e.path===k));return e?`${e.turnId}:${e.completedAt}`:null},[D?.turnDiffSummaries,k]),I=Rn({environmentId:D?.environmentId??null,cwd:O,enabled:!!(D?.environmentId&&O&&w.preview===`1`)}),L=I.error instanceof Error?I.error.message:I.error?`Failed to load the workspace tree.`:null,Se=I.data,Ce=I.data?.truncated===!0,we=I.isFetching,Te=I.refetch,Ee=(0,G.useMemo)(()=>Fs(Se?.entries??[],oe),[oe,Se?.entries]),De=oe.trim().length>0;(0,G.useEffect)(()=>{Se&&k&&!Se.entries.some(e=>e.path===k)&&((D?.environmentId&&O?Qt({environmentId:D.environmentId,cwd:O},k):null)?.unsaved||A(null))},[O,D?.environmentId,Se,k]),(0,G.useEffect)(()=>{if(w.preview!==`1`){_e.current=be;return}if(_e.current===null){_e.current=be;return}_e.current!==be&&(_e.current=be,Te())},[be,w.preview,Te]),(0,G.useEffect)(()=>{let e=w.preview===`1`;e&&!ge.current&&A(null),ge.current=e},[w.preview]);let Oe=k?Se?.entries.find(e=>e.path===k):void 0,ke=typeof Oe?.sizeBytes==`number`?As(Oe.sizeBytes):null,Ae=Vn({environmentId:D?.environmentId??null,cwd:O,relativePath:k,enabled:!!(D?.environmentId&&O&&k&&w.preview===`1`&&(ke?.shouldFetch??!0))}),R=Ae.data?.relativePath===k?Ae.data:null,je=R,Me=je?.mimeType??Oe?.mimeType??null,Ne=k?ks({filePath:k,mimeType:Me}):`text`,z=Ae.error instanceof Error?Ae.error.message:Ae.error?`Failed to load file preview.`:null,Pe=Ae.refetch;(0,G.useEffect)(()=>{if(!k||w.preview!==`1`){ve.current=xe;return}if(ve.current===null){ve.current=xe;return}ve.current!==xe&&(ve.current=xe,Pe())},[xe,w.preview,Pe,k]);let Fe=(0,G.useMemo)(()=>!D?.environmentId||!O||!R||R.relativePath!==k?null:rn({environmentId:D.environmentId,cwd:O},R),[O,D?.environmentId,R,k]),B=(0,G.useMemo)(()=>{if(y||!D?.environmentId||!O||!k)return null;let e={environmentId:D.environmentId,cwd:O};return Qt(e,k)||(Fe&&Ne===`text`?on(e,Fe):null)},[O,D?.environmentId,y,Fe,Ne,k]),V=(0,G.useSyncExternalStore)(B?.subscribe??Is,B?.getSnapshot??Ls);(0,G.useEffect)(()=>{Fe&&B?.load(Fe)},[B,Fe]);let Ie=en(V),Le=!(y||Ne!==`text`||!V||V.lineEnding===`mixed`||V.diskState!==`known`),H=(0,G.useRef)(0);(0,G.useEffect)(()=>(H.current++,()=>{H.current++}),[B]);let He=(0,G.useCallback)(async e=>{if(e===k)return;let t=++H.current;if(B?.unsaved&&!await B.flush()){t===H.current&&ae(e);return}t===H.current&&A(e)},[k,B]),Ue=(0,G.useCallback)(e=>B?.change(e),[B]),We=(0,G.useCallback)(()=>M(`discard`),[]),Ge=(0,G.useCallback)(()=>M(`reload`),[]),Ke=(0,G.useCallback)(()=>B?.flush(!0)??Promise.resolve(!1),[B]);(0,G.useEffect)(()=>{if(!k||!Gs(z)){ye.current=null;return}let e=`${O}\u0000${k}\u0000${z}`;if(ye.current===e)return;ye.current=e;let t=H.current;Te().then(e=>{t===H.current&&(e.data?.entries.some(e=>e.path===k)||(B?.unsaved?B.markDeleted():A(null)))}).catch(()=>void 0)},[O,Te,z,k,B]);let qe=V?.saveStatus===`conflict`||V?.errorReason===`unsupported`,Je=!!(Le&&B?.unsaved&&V?.saveStatus!==`saving`&&!qe);(0,G.useEffect)(()=>{if(!Le||!Ie)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),Je&&Ke())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[Je,Ie,Le,Ke]);let Ye=(0,G.useMemo)(()=>{let e=V?.contents??je?.contents;return!k||Ne!==`text`||e===void 0?null:{name:k,contents:e,lang:Os(k),cacheKey:Ks(k,e)}},[V?.contents,je?.contents,Ne,k]),Xe=(0,G.useMemo)(()=>({disableFileHeader:!0,overflow:F?`wrap`:`scroll`,theme:S(a),themeType:a,unsafeCSS:bs,tokenizeMaxLineLength:1e3}),[a,F]),Ze=(0,G.useCallback)(e=>{if(e.button!==0||!P)return;let t=ue.current?.querySelector(`[data-preview-file-rail]`)?.getBoundingClientRect().width??de;he.current={pointerId:e.pointerId,startWidth:t,startX:e.clientX},e.currentTarget.setPointerCapture(e.pointerId),me(!0),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`},[P,de]),Qe=(0,G.useCallback)(e=>{let t=he.current,n=ue.current;if(!t||!n||t.pointerId!==e.pointerId)return;e.preventDefault();let r=Ws(t,n.clientWidth,e.clientX);fe(r)},[]),$e=(0,G.useCallback)(e=>{let n=he.current;if(!n||n.pointerId!==e.pointerId)return;let r=ue.current,i=r?Ws(n,r.clientWidth,e.clientX):n.startWidth;he.current=null,me(!1),fe(i),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`),typeof window<`u`&&_(Rs,i,t)},[]);(0,G.useEffect)(()=>()=>{document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)},[]);let et=(0,G.useCallback)(()=>{Te()},[Te]),tt=(0,G.useCallback)(()=>{P&&(he.current=null,me(!1),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)),ce(e=>!e)},[P]),nt=N!==null,rt=(0,G.useCallback)(()=>ae(null),[]),it=(0,G.useCallback)(async()=>{let e=H.current;(!B||await B.discard())&&e===H.current&&(A(N),ae(null))},[B,N]),at=(0,G.useCallback)(async()=>{let e=H.current;await Ke()&&e===H.current&&(A(N),ae(null))},[N,Ke]),ot=async()=>{let e=B,t=H.current,n=j;if(M(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===H.current&&A(null)}}},st=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 px-1 [-webkit-app-region:no-drag]`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:`File Preview`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-[0.12em] text-muted-foreground/65`,children:[(0,W.jsx)(`span`,{children:`Workspace tree`}),Ce?(0,W.jsx)(Vt,{variant:`warning`,size:`sm`,className:`rounded-md px-1.5 py-0 text-[9px]`,children:`Truncated`}):null]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[y?null:(0,W.jsx)(c,{"aria-label":P?`Hide workspace tree`:`Show workspace tree`,"aria-pressed":P,title:P?`Hide workspace tree`:`Show workspace tree`,variant:`outline`,size:`icon-xs`,className:`shrink-0`,onClick:tt,children:P?(0,W.jsx)(cn,{className:`size-3`}):(0,W.jsx)(un,{className:`size-3`})}),(0,W.jsx)(c,{"aria-label":`Refresh workspace tree`,title:`Refresh workspace tree`,variant:`outline`,size:`icon-xs`,className:`shrink-0`,disabled:!D?.environmentId||!O||we,onClick:et,children:(0,W.jsx)(Re,{className:n(`size-3`,we&&`animate-spin`)})}),(0,W.jsx)(Ht,{"aria-label":F?`Disable preview line wrapping`:`Enable preview line wrapping`,title:F?`Disable line wrapping`:`Enable line wrapping`,variant:`outline`,size:`xs`,pressed:F,onPressedChange:e=>{le(!!e)},children:(0,W.jsx)(Be,{className:`size-3`})})]})]}),ct=ke?.state===`too-large`&&!V?(0,W.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 (`,ke.sizeBytes,` bytes). Limit is`,` `,ke.limitBytes,` bytes.`]}):Ae.isLoading&&!R&&!V?(0,W.jsx)(ne,{label:`Loading file preview...`}):z&&!R&&!V?(0,W.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:z}):(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 p-2`,children:[(0,W.jsx)(`style`,{children:Hs}),(0,W.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,W.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,W.jsxs)(`div`,{className:`preview-panel-file-identity flex min-w-0 flex-1 items-center gap-2`,children:[(0,W.jsx)(`div`,{className:`truncate font-mono text-[12px] font-medium`,children:k}),Ie?(0,W.jsx)(`span`,{"aria-label":`Unsaved changes`,className:`size-1.5 shrink-0 rounded-full bg-primary`,title:`Unsaved changes`}):null,V?.saveStatus===`saving`?(0,W.jsxs)(`span`,{"aria-live":`polite`,className:`flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,W.jsx)(m,{className:`size-3 animate-spin`}),` Saving`]}):null,!y&&Fe?.lineEnding===`mixed`?(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:`Read-only · mixed line endings`}):null]}),!y&&V&&(Le||B?.unsaved)?(0,W.jsxs)(`div`,{className:`preview-panel-file-actions flex shrink-0 items-center gap-1`,children:[(0,W.jsx)(c,{"aria-label":`Discard file changes`,disabled:!B?.unsaved,onClick:We,size:`xs`,variant:`ghost`,children:`Discard`}),(0,W.jsxs)(c,{"aria-label":`Save file`,disabled:!Je,onClick:()=>void Ke(),size:`xs`,title:`Save file (Ctrl/⌘ S)`,children:[V.saveStatus===`saving`?(0,W.jsx)(m,{className:`animate-spin`}):(0,W.jsx)(ze,{}),`Save`,(0,W.jsx)(`span`,{className:`ml-0.5 text-[9px] opacity-70`,children:`⌘S`})]})]}):null]}),V?.diskState===`unknown`?(0,W.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,W.jsx)(c,{size:`xs`,variant:`outline`,onClick:Ge,children:`Reload`})]}):null,V?.errorMessage?(0,W.jsx)(`div`,{className:`shrink-0 border-b border-border/60 p-2`,children:(0,W.jsxs)(Gt,{variant:V.saveStatus===`conflict`?`warning`:`error`,className:`rounded-lg px-3 py-2 text-[11px]`,children:[V.saveStatus===`conflict`?(0,W.jsx)(h,{className:`size-3.5`}):(0,W.jsx)(d,{className:`size-3.5`}),(0,W.jsx)(Ut,{className:`text-[11px]`,children:V.errorReason===`deleted`?`File removed on disk`:V.saveStatus===`conflict`?`File changed on disk`:`Couldn’t save file`}),(0,W.jsxs)(Wt,{className:`gap-2 text-[11px] leading-4`,children:[(0,W.jsx)(`span`,{children:V.errorMessage}),(0,W.jsx)(c,{className:`self-start`,onClick:V.errorReason===`deleted`?We:()=>void Ge(),size:`xs`,variant:`outline`,children:V.errorReason===`deleted`?`Close file`:`Reload`}),V.saveStatus===`conflict`&&V.errorReason!==`deleted`?(0,W.jsx)(c,{size:`xs`,variant:`outline`,onClick:()=>M(`overwrite`),children:`Overwrite`}):null]})]})}):z?(0,W.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-3 py-2 text-[11px] text-destructive`,children:[`Refresh failed: `,z]}):null,Ne===`image`&&je?.base64?(0,W.jsx)(`div`,{className:`flex min-h-0 flex-1 justify-center overflow-auto bg-background/70 p-3`,children:(0,W.jsx)(`img`,{alt:k??void 0,className:`max-h-full max-w-full object-contain`,src:`data:${Me??`image/png`};base64,${je.base64}`})}):Le&&V?(0,W.jsx)(ys,{cacheKey:V.key,className:`preview-panel-diffs-file`,contents:V.contents,filePath:V.relativePath,language:Os(V.relativePath),onChange:Ue,options:Xe}):V?.diskState===`unknown`?null:Ye?(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,W.jsx)(In,{file:Ye,className:`preview-panel-diffs-file`,options:Xe})}):(0,W.jsx)(`pre`,{className:n(`min-h-0 flex-1 bg-transparent p-3 font-mono text-[11px] leading-5 text-muted-foreground/90`,F?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:je?.contents??``})]})]}),U=(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,W.jsx)(`div`,{className:`shrink-0 border-b border-border/60 p-2`,children:(0,W.jsxs)(`label`,{className:`relative block`,children:[(0,W.jsx)(C,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/65`}),(0,W.jsx)(`input`,{type:`text`,value:oe,onChange:e=>se(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(se(``),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,W.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[L||Ce?(0,W.jsxs)(Gt,{variant:L?`error`:`warning`,className:`mb-2 rounded-lg border-border/70 px-3 py-2 text-[11px]`,children:[L?(0,W.jsx)(d,{className:`size-3.5`}):(0,W.jsx)(h,{className:`size-3.5`}),(0,W.jsx)(Ut,{className:`text-[11px]`,children:L?`Workspace tree refresh failed`:`Workspace tree is truncated`}),(0,W.jsx)(Wt,{className:`gap-1 text-[11px] leading-4`,children:L?(0,W.jsx)(`span`,{children:L}):(0,W.jsx)(`span`,{children:`Only the first indexed workspace entries are shown here, so some files may be omitted from preview.`})})]}):null,Ee.length===0?(0,W.jsx)(`div`,{className:`px-2 py-6 text-center text-xs leading-5 text-muted-foreground/70`,children:`No files match this filter.`}):(0,W.jsx)(Un,{files:Ee,allDirectoriesExpanded:De,resolvedTheme:a,onSelectFile:He,selectedFilePath:k,showStats:!1})]})]});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ee,{mode:e,header:st,children:D?I.isLoading&&!I.data?(0,W.jsx)(ne,{label:`Loading project tree...`}):L&&!I.data?(0,W.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:L}):(I.data?.entries.length??0)===0?(0,W.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.`}):y?(0,W.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:k?(0,W.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center gap-1 border-b border-border/60 px-1.5`,children:[(0,W.jsx)(c,{size:`icon`,variant:`ghost`,"aria-label":`Back to workspace tree`,className:`shrink-0`,onClick:()=>A(null),children:(0,W.jsx)(ie,{})}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,children:k})]}),ct]}):U}):(0,W.jsxs)(`div`,{ref:ue,className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,W.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:k?ct:(0,W.jsx)(Ys,{})}),(0,W.jsx)(`button`,{type:`button`,"aria-label":`Resize workspace tree`,"aria-hidden":!P||void 0,className:n(`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`,P?`w-2 cursor-ew-resize opacity-100`:`w-0 opacity-0`),disabled:!P,onPointerDown:Ze,onPointerMove:Qe,onPointerUp:$e,onPointerCancel:$e,children:(0,W.jsx)(`span`,{className:`absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border/80 group-hover:bg-border`})}),(0,W.jsx)(Js,{width:de,open:P,resizing:pe,children:U})]}):(0,W.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,W.jsx)(Zt,{open:j!==null,onOpenChange:e=>{e||M(null)},children:(0,W.jsxs)(Jt,{children:[(0,W.jsxs)(Kt,{children:[(0,W.jsx)(Xt,{children:j===`overwrite`?`Overwrite the disk file?`:j===`reload`?`Reload from disk?`:`Discard file changes?`}),(0,W.jsx)(Yt,{children:j===`overwrite`?`Replace the current disk contents with your draft. Another external edit will stop the write.`:j===`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,W.jsxs)(qt,{children:[(0,W.jsx)(c,{variant:`outline`,onClick:()=>M(null),children:`Cancel`}),(0,W.jsxs)(c,{variant:`destructive-outline`,onClick:()=>void ot(),children:[`Confirm `,j]})]})]})}),(0,W.jsx)(Zt,{open:nt,onOpenChange:e=>{e||rt()},children:(0,W.jsxs)(Jt,{children:[(0,W.jsxs)(Kt,{children:[(0,W.jsx)(Xt,{children:`Save changes before continuing?`}),(0,W.jsx)(Yt,{children:k?`${k} has unsaved changes.`:`This file has unsaved changes.`})]}),(0,W.jsxs)(qt,{children:[(0,W.jsx)(c,{onClick:rt,variant:`outline`,children:`Cancel`}),(0,W.jsx)(c,{disabled:V?.saveStatus===`saving`,onClick:it,variant:`destructive-outline`,children:N?`Discard & Open`:`Discard & Continue`}),(0,W.jsxs)(c,{disabled:!Je,onClick:()=>void at(),children:[V?.saveStatus===`saving`?(0,W.jsx)(m,{className:`animate-spin`}):(0,W.jsx)(ze,{}),N?`Save & Open`:`Save & Continue`]})]})]})})]})}export{Xs as default};
|