ryco-cli 0.1.21 → 0.1.22
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/{AcpNativeLogging-D54V5cIY.cjs → AcpNativeLogging-COepku4a.cjs} +78 -7
- package/dist/{AcpNativeLogging-Ch-s9nA8.mjs → AcpNativeLogging-D7e1dn7s.mjs} +74 -9
- package/dist/{AzureDevOpsSourceControlProvider-DTOlXGyd.mjs → AzureDevOpsSourceControlProvider-BNGEg1R8.mjs} +3 -3
- package/dist/{AzureDevOpsSourceControlProvider-BzB5-N9m.cjs → AzureDevOpsSourceControlProvider-CrvgKNf2.cjs} +2 -2
- package/dist/{BitbucketSourceControlProvider-DGd4IPx5.mjs → BitbucketSourceControlProvider-Bt21jw68.mjs} +3 -3
- package/dist/{BitbucketSourceControlProvider-D-8PWXO3.cjs → BitbucketSourceControlProvider-BzhsQwH-.cjs} +2 -2
- package/dist/{BunPTY-CNvWSzEJ.mjs → BunPTY-TbHbSc8S.mjs} +1 -1
- package/dist/{ClaudeDriver-DxowtK6I.mjs → ClaudeDriver-D65SPdHR.mjs} +44 -119
- package/dist/{ClaudeDriver-HEbUzW34.cjs → ClaudeDriver-D7NatUx6.cjs} +52 -127
- package/dist/{CodexDriver-CccSWoP3.mjs → CodexDriver-D4z5-wUD.mjs} +237 -50
- package/dist/{CodexDriver-YG4IwzLm.cjs → CodexDriver-DWGtHt9r.cjs} +235 -48
- package/dist/{CodexTextGeneration-CBJHkgOz.cjs → CodexTextGeneration-B4tJTUDo.cjs} +1 -1
- package/dist/{CodexTextGeneration-BfGt7ZUe.mjs → CodexTextGeneration-BikHow8k.mjs} +2 -2
- package/dist/{CopilotDriver-Bm4OZMkm.cjs → CopilotDriver-DJvYncGI.cjs} +122 -23
- package/dist/{CopilotDriver-DZAW-7yV.mjs → CopilotDriver-ZvvsAIkd.mjs} +123 -24
- package/dist/{CursorDriver-B4jb4rWd.mjs → CursorDriver-B1QSBzuH.mjs} +34 -74
- package/dist/{CursorDriver-CYcKAkUY.cjs → CursorDriver-D3I4KULs.cjs} +33 -73
- package/dist/{ForgejoSourceControlProvider-Dfi8KH7I.mjs → ForgejoSourceControlProvider-BGXysSX6.mjs} +3 -3
- package/dist/{ForgejoSourceControlProvider-CXUevO6C.cjs → ForgejoSourceControlProvider-Dh6DOoc8.cjs} +2 -2
- package/dist/{GitHubSourceControlProvider-DOs1ouvp.cjs → GitHubSourceControlProvider-8hsv_kCE.cjs} +2 -2
- package/dist/{GitHubSourceControlProvider-BH97aNa0.mjs → GitHubSourceControlProvider-CPCYV8Xo.mjs} +3 -3
- package/dist/{GitLabSourceControlProvider-CfbE6GYD.cjs → GitLabSourceControlProvider-B0ZbF9Zx.cjs} +2 -2
- package/dist/{GitLabSourceControlProvider-nIzcy9AJ.mjs → GitLabSourceControlProvider-Bvknpaon.mjs} +3 -3
- package/dist/{GrokDriver-CENrrqQc.mjs → GrokDriver-DgQe3pKz.mjs} +30 -10
- package/dist/{GrokDriver-C35gWEiw.cjs → GrokDriver-_puXDTU3.cjs} +31 -11
- package/dist/{NodePTY-lO8PwZLk.mjs → NodePTY-B_p5tLYO.mjs} +1 -1
- package/dist/{OpenCodeDriver-CHuQ6Xhc.cjs → OpenCodeDriver-401RexI0.cjs} +137 -19
- package/dist/{OpenCodeDriver-BIxSPI9J.mjs → OpenCodeDriver-DNUlF8M-.mjs} +135 -20
- package/dist/{SourceControlProviderDiscoveryCatalog-DaRgCE5d.mjs → SourceControlProviderDiscoveryCatalog-B37RHe2u.mjs} +1 -1
- package/dist/{SourceControlProviderDiscoveryCatalog-DCmYsPEa.cjs → SourceControlProviderDiscoveryCatalog-DreaAH1H.cjs} +1 -1
- package/dist/bin.cjs +4508 -613
- package/dist/bin.mjs +4499 -615
- package/dist/client/assets/AccountSettings-CypheYqM.js +1 -0
- package/dist/client/assets/AiFocusSettings-BlX0ED1t.js +1 -0
- package/dist/client/assets/AnimatedHeight-DKCe4x_Q.js +1 -0
- package/dist/client/assets/AppearanceSettings-BSyn6NXf.js +1 -0
- package/dist/client/assets/BranchToolbar.logic-fpBz8Ajj.js +1 -0
- package/dist/client/assets/BrowserPanel-BWch19QH.js +1 -0
- package/dist/client/assets/ChatRightPanel-B7yrq-hS.js +27 -0
- package/dist/client/assets/ChatThreadRouteView-Cg0d_EHs.js +1 -0
- package/dist/client/assets/CommandPaletteDialog-DImCuPaX.js +1 -0
- package/dist/client/assets/CompositeItem-BYnHWRNf.js +1 -0
- package/dist/client/assets/CompositeRoot-B28uivk7.js +1 -0
- package/dist/client/assets/ComputerUseSettings-CosW7jaG.js +1 -0
- package/dist/client/assets/ConnectionsSettings-Bk6vI3G-.js +7 -0
- package/dist/client/assets/ContextHandoffEndpointLabel-BR6ygaub.js +4 -0
- package/dist/client/assets/DiagnosticsSettings-Dp_tCNLw.js +2 -0
- package/dist/client/assets/DialogHandle-BN-QB-sO.js +1 -0
- package/dist/client/assets/DialogPopup-BuJs5WUt.js +1 -0
- package/dist/client/assets/DialogRoot-PxEcoecQ.js +1 -0
- package/dist/client/assets/DialogTitle-4nxQsra4.js +1 -0
- package/dist/client/assets/DialogTrigger-D_0canul.js +1 -0
- package/dist/client/assets/DialogViewport-DSo-2hyf.js +1 -0
- package/dist/client/assets/DraftChatThreadRouteView-C94kpMx4.js +1 -0
- package/dist/client/assets/{ExternalIdentityWeb.logic-TXvkTDG8.js → ExternalIdentityWeb.logic-CGJKCFPo.js} +1 -1
- package/dist/client/assets/{GlassSurface-k7VAG7Dp.js → GlassSurface-CyOTUS7E.js} +1 -1
- package/dist/client/assets/HostedConnectionControls-CL0Ws4ca.js +1 -0
- package/dist/client/assets/HostedHubRoot-LUINZl4r.js +1 -0
- package/dist/client/assets/HostedNativeAuthorizationRoute-CgYVBE6N.js +1 -0
- package/dist/client/assets/HostedRelayTrustNotice-DgdeZh52.js +1 -0
- package/dist/client/assets/Icons-BIUbIFr7.js +1 -0
- package/dist/client/assets/IntegrationsSettingsPanel-B7tXTaa3.js +1 -0
- package/dist/client/assets/KeybindingsSettings-HMlRcGQ4.js +7 -0
- package/dist/client/assets/LazyBrowserPanel-CKfmuM9U.js +1 -0
- package/dist/client/assets/{McpServersSettings-Cpzyop0g.js → McpServersSettings-Bq-HyhvC.js} +4 -4
- package/dist/client/assets/MobileSheet-acDRH9aa.js +1 -0
- package/dist/client/assets/NoActiveThreadState-7rym7bV7.js +1 -0
- package/dist/client/assets/NodeSecuritySettings-D8qjh4Dc.js +1 -0
- package/dist/client/assets/OpinionatedPluginsSettings-D7Uks5yR.js +1 -0
- package/dist/client/assets/PhoneGetAppInterstitial-BQXUSufH.js +1 -0
- package/dist/client/assets/PhoneGetAppInterstitialBackdrop-BbUvwGmI.js +1 -0
- package/dist/client/assets/PhoneHome-DvgdMTkh.js +1 -0
- package/dist/client/assets/PhoneSettingsSurface-DncJ540i.js +1 -0
- package/dist/client/assets/ProjectFavicon-BY5Vyyk6.js +1 -0
- package/dist/client/assets/ProviderInstanceIcon-CZe1TbeC.js +1 -0
- package/dist/client/assets/ProviderModelPicker-DHAY1n_1.js +1 -0
- package/dist/client/assets/{ProviderUpdateLaunchNotification.logic-BWOy8LJG.js → ProviderUpdateLaunchNotification.logic-DQJVrUIo.js} +1 -1
- package/dist/client/assets/ProvidersSettingsPanel-BylxZs4S.js +1 -0
- package/dist/client/assets/RedactedSensitiveText-D-enj1h5.js +1 -0
- package/dist/client/assets/RootAppShell-DBK0WW2b.js +6 -0
- package/dist/client/assets/RycoLetterMark-PnGm6TQY.js +1 -0
- package/dist/client/assets/{Separator-DiMB6Prz.js → Separator-BWKYMFqt.js} +1 -1
- package/dist/client/assets/SettingsDialog-N25hIv-a.js +1 -0
- package/dist/client/assets/SettingsPanels-D9YXmUPP.js +3 -0
- package/dist/client/assets/SettingsPanels.editor-Cn18k74l.js +1 -0
- package/dist/client/assets/SourceControlSettings-BAzSpMfR.js +1 -0
- package/dist/client/assets/StatisticsPage-CLKpfsQ8.js +1 -0
- package/dist/client/assets/StatisticsPanel-DxHUFn64.js +1 -0
- package/dist/client/assets/StatisticsSettingsLink-B3HIQYFh.js +1 -0
- package/dist/client/assets/ThreadStatusIndicators-CQZ_OgY8.js +0 -0
- package/dist/client/assets/{ThreadTerminalDrawer-ro03rSMk.js → ThreadTerminalDrawer-D1SPewXR.js} +3 -3
- package/dist/client/assets/ThreadWorkspacePanel-DVF6oZsV.js +2009 -0
- package/dist/client/assets/ToolbarRootContext-Dt8G5aCw.js +1 -0
- package/dist/client/assets/{WorkItemsTab-CBbr_lPX.js → WorkItemsTab-BoE-TcXJ.js} +8 -8
- package/dist/client/assets/{activity-1CkdQG5u.js → activity-DfFM6I8A.js} +1 -1
- package/dist/client/assets/alert-DE5SkZhr.js +1 -0
- package/dist/client/assets/alert-dialog-BqPnPhb6.js +1 -0
- package/dist/client/assets/appChrome-CJauXpqv.js +1 -0
- package/dist/client/assets/{archive-BL1hojl3.js → archive-BFV4YQ7D.js} +1 -1
- package/dist/client/assets/arrow-left-CCmICk1t.js +1 -0
- package/dist/client/assets/arrow-right-Z3Eay6Fd.js +1 -0
- package/dist/client/assets/{arrow-up-CTcWIlqV.js → arrow-up-caak6P06.js} +1 -1
- package/dist/client/assets/arrow-up-right-BwC-fCE4.js +1 -0
- package/dist/client/assets/authorization-bHsGYIT0.js +1 -0
- package/dist/client/assets/{badge-DUe5V2Mj.js → badge-m9kM3P07.js} +1 -1
- package/dist/client/assets/{bot-DJp0cuhK.js → bot-Cv7a7Ksf.js} +1 -1
- package/dist/client/assets/{button-BdUaa4U1.js → button-B6xQZNKz.js} +1 -1
- package/dist/client/assets/capabilities-D6bsjqkj.js +1 -0
- package/dist/client/assets/{chart-column-Dw6ACmXM.js → chart-column-DgGlY4sD.js} +1 -1
- package/dist/client/assets/chatThreadActions-BXaNbPbp.js +1 -0
- package/dist/client/assets/check-BfnWUGBT.js +1 -0
- package/dist/client/assets/{chevron-down-B7C6FKzM.js → chevron-down-B_FKCRVh.js} +1 -1
- package/dist/client/assets/chevron-right-B6CKNGh4.js +1 -0
- package/dist/client/assets/{circle-alert-BWvs6IOn.js → circle-alert-BV3vJE-c.js} +1 -1
- package/dist/client/assets/circle-check-D2Vx39x-.js +1 -0
- package/dist/client/assets/{external-link-fbvzDWM7.js → circle-dashed-khcA8K3Y.js} +1 -1
- package/dist/client/assets/circle-question-mark-DEuLdOiy.js +1 -0
- package/dist/client/assets/circle-x-DqfM_2wS.js +1 -0
- package/dist/client/assets/clamp-D0kAXd-u.js +1 -0
- package/dist/client/assets/{clipboard-copy-C4VV20QR.js → clipboard-copy-CiD4tBsh.js} +1 -1
- package/dist/client/assets/clock--4M7moiV.js +1 -0
- package/dist/client/assets/clock-3-NbnQqtcd.js +1 -0
- package/dist/client/assets/collapsible-BECg-ssO.js +1 -0
- package/dist/client/assets/command-DvbA3O0J.js +1 -0
- package/dist/client/assets/{copy-UQjKGt7t.js → copy-CkPe1c-r.js} +1 -1
- package/dist/client/assets/data-list-7TiaqfZU.js +1 -0
- package/dist/client/assets/desktopUpdateAtoms-6j0d8vfy.js +1 -0
- package/dist/client/assets/desktopWorkspace-8s8rm3zL.js +1 -0
- package/dist/client/assets/device-CGaJ6fwD.js +168 -0
- package/dist/client/assets/dialog-C9v8Zl6e.js +1 -0
- package/dist/client/assets/{download-CQZ-m4zW.js → download-DPjzVxTa.js} +1 -1
- package/dist/client/assets/draft-input-BRSLIjV6.js +1 -0
- package/dist/client/assets/editorPreferences-D-9SDgRM.js +1 -0
- package/dist/client/assets/empty-CuQ57p2u.js +1 -0
- package/dist/client/assets/external-link-CF9EzT-A.js +1 -0
- package/dist/client/assets/{eye-CUSPj-gd.js → eye-C2Puut9B.js} +1 -1
- package/dist/client/assets/{folder-DtsQoI9_.js → folder-BKTxLq18.js} +1 -1
- package/dist/client/assets/{folder-closed-CsvKfC6X.js → folder-closed-D2cwiusg.js} +1 -1
- package/dist/client/assets/getPseudoElementBounds-DdH76YK5.js +1 -0
- package/dist/client/assets/{git-branch-BKr-Ij4u.js → git-branch-Dauy2SWC.js} +1 -1
- package/dist/client/assets/{git-pull-request-DIYyPsg5.js → git-pull-request-DsK1gBtK.js} +1 -1
- package/dist/client/assets/globe-dS40wBdE.js +1 -0
- package/dist/client/assets/group-DBXm8riE.js +1 -0
- package/dist/client/assets/hostedConnectionCoordinator-DSMW2Ldh.js +1 -0
- package/dist/client/assets/{index-CQJvt69U.js → index-DRY8Hgrj.js} +2 -2
- package/dist/client/assets/input-Dn_zesdZ.js +1 -0
- package/dist/client/assets/kbd-BF2-WlxQ.js +1 -0
- package/dist/client/assets/{key-round-CacMputS.js → key-round-BjaaL9Df.js} +1 -1
- package/dist/client/assets/{keybindings-DCgzArdM.js → keybindings-FSJY3Tht.js} +1 -1
- package/dist/client/assets/{keyboard-BqeRMHfL.js → keyboard-AkUFPD_e.js} +1 -1
- package/dist/client/assets/label-BKjVY2A9.js +1 -0
- package/dist/client/assets/{layers-BYi0v17h.js → layers-tzRiuxSx.js} +1 -1
- package/dist/client/assets/{lib-B7pkMeOn.js → lib-D5cyGc84.js} +1 -1
- package/dist/client/assets/{loader-zHASMrUy.js → loader-BrbWRz3I.js} +1 -1
- package/dist/client/assets/loader-circle-DRKbHQst.js +1 -0
- package/dist/client/assets/{log-out-tMJm0Gk6.js → log-out-BEihaal1.js} +1 -1
- package/dist/client/assets/{logging-B1VrUJXw.js → logging-Y73f240E.js} +1 -1
- package/dist/client/assets/main-BiIQEybS.js +9 -0
- package/dist/client/assets/main-tZWU6iqX.css +2 -0
- package/dist/client/assets/menu-BxtB33Up.js +1 -0
- package/dist/client/assets/{messages-square-DiMgWzoq.js → messages-square-e0Zg750i.js} +1 -1
- package/dist/client/assets/{minimize-2-C33mL7LT.js → minimize-2-DC9gMgGl.js} +1 -1
- package/dist/client/assets/monitor-Dj0JFj4_.js +1 -0
- package/dist/client/assets/{palette-BSD_aJZg.js → palette-0qvNt1CR.js} +1 -1
- package/dist/client/assets/{pencil-B69ERoVM.js → pencil-CA0DGufX.js} +1 -1
- package/dist/client/assets/{play-DYDxlTKo.js → play-wIyvqd_g.js} +1 -1
- package/dist/client/assets/plus-5kH13lqq.js +1 -0
- package/dist/client/assets/popover-CwhgX3HA.js +1 -0
- package/dist/client/assets/primary-BqnEJHWx.js +2 -0
- package/dist/client/assets/{projectPaths-C7IGaRXO.js → projectPaths-45WPhgoj.js} +1 -1
- package/dist/client/assets/providerDriverMeta-Cc60r9Rb.js +1 -0
- package/dist/client/assets/providerInstances-Cr8JmFCe.js +1 -0
- package/dist/client/assets/providerModels-Cr8JmFCe.js +1 -0
- package/dist/client/assets/qr-code-BKrwYZ2s.js +1 -0
- package/dist/client/assets/{qr-code-ScYULAuR.js → qr-code-DDmpRnPp.js} +1 -1
- package/dist/client/assets/radio-group-DZCo21CF.js +2 -0
- package/dist/client/assets/{refresh-cw-DopCMrtR.js → refresh-cw-DiuiLTny.js} +1 -1
- package/dist/client/assets/resolveAriaLabelledBy-927ShlEO.js +1 -0
- package/dist/client/assets/rightPanelRouteSearch-CExl-IaQ.js +1 -0
- package/dist/client/assets/rotate-ccw-XOYBPtyK.js +1 -0
- package/dist/client/assets/rotate-cw-D32Z4Sdd.js +1 -0
- package/dist/client/assets/runtime-CA2W9mZ-.js +17 -0
- package/dist/client/assets/{save-Bh36JIv6.js → save-DjlqeVG_.js} +1 -1
- package/dist/client/assets/scroll-area-CylKYQms.js +1 -0
- package/dist/client/assets/scrollEdges-D7RQhYjX.js +1 -0
- package/dist/client/assets/search-B2nLj573.js +1 -0
- package/dist/client/assets/select-qTezUK8F.js +1 -0
- package/dist/client/assets/separator-D77goPy-.js +1 -0
- package/dist/client/assets/{server-JApJpgLa.js → server-y8Wq0Qwv.js} +1 -1
- package/dist/client/assets/session-logic-xfW418Rx.js +1 -0
- package/dist/client/assets/{settings-2-CZQg_KUQ.js → settings-2-DpwBKj3m.js} +1 -1
- package/dist/client/assets/settingsLayout-BuaXzjIe.js +1 -0
- package/dist/client/assets/settingsSections.logic-CR4aytUI.js +1 -0
- package/dist/client/assets/sheet-z3AEiSN4.js +1 -0
- package/dist/client/assets/{shield-IZEIJ8r7.js → shield-BuXuMVtb.js} +1 -1
- package/dist/client/assets/{shield-alert-DY9uVP5G.js → shield-alert-Dfk--o-I.js} +1 -1
- package/dist/client/assets/{shield-check-dQ-4cMKk.js → shield-check-BHi57iF1.js} +1 -1
- package/dist/client/assets/sidebar-Dst9O2OR.js +1 -0
- package/dist/client/assets/sidebarProjectFolders-DR1NBLLz.js +4 -0
- package/dist/client/assets/{sidebarStatusText-WiaEF1ae.js → sidebarStatusText-7jo1n9E1.js} +1 -1
- package/dist/client/assets/skeleton-D_kbMg21.js +1 -0
- package/dist/client/assets/{smartphone-gNe1ynB8.js → smartphone-DcUQ17YT.js} +1 -1
- package/dist/client/assets/{sparkles-CAf3oJ5S.js → sparkles-nVLLtdqb.js} +1 -1
- package/dist/client/assets/spinner-CkXSwhuf.js +1 -0
- package/dist/client/assets/{square-pen-Bj3p_Q8E.js → square-pen-dcArpda7.js} +1 -1
- package/dist/client/assets/src-I4s4HU8f.js +14 -0
- package/dist/client/assets/star-CdUOqzzZ.js +1 -0
- package/dist/client/assets/storeSelectors-Cr8JmFCe.js +1 -0
- package/dist/client/assets/switch-BMeRsIbg.js +1 -0
- package/dist/client/assets/{tabSwitchInstrumentation-CLDM7g1_.js → tabSwitchInstrumentation-BuxWNdCV.js} +1 -1
- package/dist/client/assets/terminal-DupJfYRW.js +1 -0
- package/dist/client/assets/{terminal-links-Bxew8m4Q.js → terminal-links-Bf4neyyn.js} +1 -1
- package/dist/client/assets/textarea-Bu_OTJYe.js +1 -0
- package/dist/client/assets/threadPinning-DhnkssEa.js +1 -0
- package/dist/client/assets/{threadPriorityRefreshRuntime-Cgjn5Y-7.js → threadPriorityRefreshRuntime-DJjlyX7f.js} +1 -1
- package/dist/client/assets/toast-CIjfIWUw.js +1 -0
- package/dist/client/assets/toggle-BA4mJ5v9.js +1 -0
- package/dist/client/assets/toggle-group-ChGfILTR.js +1 -0
- package/dist/client/assets/{tokenModePresentation-lVM0-Wi3.js → tokenModePresentation-B64s_OK3.js} +1 -1
- package/dist/client/assets/tooltip-C2VVqN6U.js +1 -0
- package/dist/client/assets/{trash-2-CM1zXPGb.js → trash-2-Dqgxd0nF.js} +1 -1
- package/dist/client/assets/{triangle-alert-RL_T3KLo.js → triangle-alert-D4cCh6sB.js} +1 -1
- package/dist/client/assets/types-Cr8JmFCe.js +1 -0
- package/dist/client/assets/{undo-2-x37tfI3V.js → undo-2-C8EQVSSD.js} +1 -1
- package/dist/client/assets/{unplug-Cw8iawyX.js → unplug-Dt3Sy2op.js} +1 -1
- package/dist/client/assets/useAppSidebarCollapsed-w0th-164.js +1 -0
- package/dist/client/assets/{useAtlassian-BPNtoDXL.js → useAtlassian-j7ex3bVN.js} +0 -0
- package/dist/client/assets/useButton-Dx5k1uZG.js +1 -0
- package/dist/client/assets/useCompositeListItem-BqkyY0oT.js +1 -0
- package/dist/client/assets/{clamp-CgH0Dl6R.js → useControlled-HocCF1v9.js} +1 -1
- package/dist/client/assets/useDebouncedValue-BevbEbPO.js +1 -0
- package/dist/client/assets/useFloatingRootContext-j6TgzEFa.js +1 -0
- package/dist/client/assets/useHandleNewThread-gVYty_Bg.js +1 -0
- package/dist/client/assets/useLabelableId-CcYPzJvj.js +1 -0
- package/dist/client/assets/useLocation-CZ3osOgz.js +1 -0
- package/dist/client/assets/useOpenInteractionType-apbY9ZEK.js +1 -0
- package/dist/client/assets/usePhoneThreadActions-CnDlicSp.js +1 -0
- package/dist/client/assets/usePopupViewport-0k75uXo1.js +1 -0
- package/dist/client/assets/useRenderElement-5DRNLBaU.js +1 -0
- package/dist/client/assets/useScrollLock-C5WLWXcc.js +1 -0
- package/dist/client/assets/{useStatistics-BQkcb-1_.js → useStatistics-GOFXPHO0.js} +2 -2
- package/dist/client/assets/useSwipeDismiss-BNHPBucH.js +1 -0
- package/dist/client/assets/useThreadActions-B4Xy2soQ.js +2 -0
- package/dist/client/assets/useTriggerFocusGuards-C3geWFzt.js +1 -0
- package/dist/client/assets/useValueChanged-FVqPwcY_.js +1 -0
- package/dist/client/assets/user-round-KsVtJgon.js +1 -0
- package/dist/client/assets/utils-B5qahmRn.js +1 -0
- package/dist/client/assets/visuallyHidden-j2WbVEv-.js +1 -0
- package/dist/client/assets/workspaceMetadataProjection-D3vqw40g.js +1 -0
- package/dist/client/assets/{wrench-D0IetWa1.js → wrench-BnpoYEZm.js} +1 -1
- package/dist/client/assets/x-BXHT1Zj1.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/{collectUint8StreamText-D8TBiBWk.mjs → collectUint8StreamText-C_VNyArd.mjs} +614 -20
- package/dist/{collectUint8StreamText-C5fop6Zf.cjs → collectUint8StreamText-DStwNTTK.cjs} +679 -19
- package/dist/{makeManagedServerProvider-DRlNwlhe.mjs → makeManagedServerProvider-GZcpSLrW.mjs} +22 -3
- package/dist/{makeManagedServerProvider-BytnBN6b.cjs → makeManagedServerProvider-VzxWN-04.cjs} +32 -1
- package/dist/resource-monitor/LICENSE +21 -0
- package/dist/resource-monitor/darwin-arm64/LICENSE +21 -0
- package/dist/resource-monitor/darwin-arm64/ryco-resource-monitor +0 -0
- package/dist/resource-monitor/darwin-x64/LICENSE +21 -0
- package/dist/resource-monitor/darwin-x64/ryco-resource-monitor +0 -0
- package/dist/resource-monitor/linux-arm64/LICENSE +21 -0
- package/dist/resource-monitor/linux-arm64/ryco-resource-monitor +0 -0
- package/dist/resource-monitor/linux-x64/LICENSE +21 -0
- package/dist/resource-monitor/linux-x64/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/LICENSE +21 -0
- package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
- package/dist/resource-monitor/win32-x64/LICENSE +21 -0
- package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
- package/package.json +1 -1
- package/dist/client/assets/AccountSettings--RGb4Xyh.js +0 -1
- package/dist/client/assets/AiFocusSettings-BnGcbAMj.js +0 -1
- package/dist/client/assets/AnimatedHeight-xBldRJT_.js +0 -1
- package/dist/client/assets/AppearanceSettings-BZRfC5N0.js +0 -1
- package/dist/client/assets/BranchToolbar.logic-CGpYXkLE.js +0 -1
- package/dist/client/assets/ChatRightPanel-BlooofmF.js +0 -27
- package/dist/client/assets/ChatThreadRouteView-B28bv4Zt.js +0 -1
- package/dist/client/assets/CommandPaletteDialog-hNEraTe2.js +0 -1
- package/dist/client/assets/CompositeItem-CKY4wPzb.js +0 -1
- package/dist/client/assets/CompositeRoot-Ds7U4w5S.js +0 -1
- package/dist/client/assets/ConnectionsSettings-C4VqR67L.js +0 -7
- package/dist/client/assets/DiagnosticsSettings-ByZ42-mW.js +0 -2
- package/dist/client/assets/DialogHandle-BdmgCiER.js +0 -1
- package/dist/client/assets/DialogPopup-D6m8w7-0.js +0 -1
- package/dist/client/assets/DialogRoot-BnE2_J9j.js +0 -1
- package/dist/client/assets/DialogTitle-DFkPQ5wa.js +0 -1
- package/dist/client/assets/DialogTrigger-CTCt2xVs.js +0 -1
- package/dist/client/assets/DialogViewport-OqbNjTEg.js +0 -1
- package/dist/client/assets/DraftChatThreadRouteView-B_4VVh8J.js +0 -1
- package/dist/client/assets/HostedConnectionControls-D0YyFVVm.js +0 -1
- package/dist/client/assets/HostedHubRoot-gr9o6h-w.js +0 -1
- package/dist/client/assets/HostedNativeAuthorizationRoute-DQy7gPHg.js +0 -1
- package/dist/client/assets/HostedRelayTrustNotice-DtiCe1oF.js +0 -1
- package/dist/client/assets/Icons-BHigZ6eO.js +0 -1
- package/dist/client/assets/IntegrationsSettingsPanel-RgmTIo_4.js +0 -1
- package/dist/client/assets/KeybindingsSettings-2J94301x.js +0 -7
- package/dist/client/assets/MobileSheet-5RNq1fWV.js +0 -1
- package/dist/client/assets/NewWorktreeDialog-BE_53fbt.js +0 -4
- package/dist/client/assets/NoActiveThreadState-Cpar0wiW.js +0 -1
- package/dist/client/assets/NodeSecuritySettings-BpZYwf5z.js +0 -1
- package/dist/client/assets/OpinionatedPluginsSettings-CLbbw_K_.js +0 -1
- package/dist/client/assets/PhoneGetAppInterstitial-G1mx30Rm.js +0 -1
- package/dist/client/assets/PhoneGetAppInterstitialBackdrop-nfP93au3.js +0 -1
- package/dist/client/assets/PhoneHome-D24dskaK.js +0 -1
- package/dist/client/assets/PhoneSettingsSurface-DU6QcRMa.js +0 -1
- package/dist/client/assets/ProjectFavicon-DiAvCEOv.js +0 -1
- package/dist/client/assets/ProviderModelPicker-KKoDIb0I.js +0 -1
- package/dist/client/assets/ProvidersSettingsPanel-Cotp9jkx.js +0 -1
- package/dist/client/assets/RedactedSensitiveText-Bijn-7t0.js +0 -1
- package/dist/client/assets/RootAppShell-BPFAVRor.js +0 -6
- package/dist/client/assets/RycoLetterMark-DDqdXSCR.js +0 -1
- package/dist/client/assets/SettingsDialog-C1pQqIpt.js +0 -1
- package/dist/client/assets/SettingsPanels-_z4Xw8vV.js +0 -3
- package/dist/client/assets/SettingsPanels.editor-CFrJ6eJl.js +0 -1
- package/dist/client/assets/SourceControlSettings-aZXtdyQJ.js +0 -1
- package/dist/client/assets/StatisticsPage-DLxnsLkl.js +0 -1
- package/dist/client/assets/StatisticsPanel-CZng52aF.js +0 -1
- package/dist/client/assets/StatisticsSettingsLink-BswiD6v1.js +0 -1
- package/dist/client/assets/ThreadStatusIndicators-Dg7ByO0t.js +0 -0
- package/dist/client/assets/ThreadWorkspacePanel-j_muuK0U.js +0 -2009
- package/dist/client/assets/ToolbarRootContext-gBA5VTsh.js +0 -1
- package/dist/client/assets/alert-DM55UBFJ.js +0 -1
- package/dist/client/assets/alert-dialog-t0tth9lg.js +0 -1
- package/dist/client/assets/arrow-left-Dtj9PfsA.js +0 -1
- package/dist/client/assets/arrow-up-right-DGeet8e6.js +0 -1
- package/dist/client/assets/authorization-jiPI8hG1.js +0 -1
- package/dist/client/assets/branding-31Bj-8ZC.js +0 -1
- package/dist/client/assets/capabilities-DQDkV1US.js +0 -1
- package/dist/client/assets/chatThreadActions-3VwZmcuQ.js +0 -1
- package/dist/client/assets/chevron-right-BWYGybX9.js +0 -1
- package/dist/client/assets/clock-3-r12DkpRj.js +0 -1
- package/dist/client/assets/clock-nNA05brA.js +0 -1
- package/dist/client/assets/collapsible-BmAgbTeN.js +0 -1
- package/dist/client/assets/command-8YtR6jmS.js +0 -1
- package/dist/client/assets/composerDraftStore-Bz5WIZBE.js +0 -11
- package/dist/client/assets/data-list-D7UF_rKC.js +0 -1
- package/dist/client/assets/desktopUpdateAtoms-D_GMRE2r.js +0 -1
- package/dist/client/assets/desktopWorkspace-Dg6EeBlb.js +0 -1
- package/dist/client/assets/device-DlExHdp_.js +0 -168
- package/dist/client/assets/dialog-B0sUgnpe.js +0 -1
- package/dist/client/assets/draft-input-CljKajxE.js +0 -1
- package/dist/client/assets/editorPreferences-B3qgjPa6.js +0 -1
- package/dist/client/assets/empty-D5W-VFFg.js +0 -1
- package/dist/client/assets/env-3rzMJf1D.js +0 -1
- package/dist/client/assets/folder-open-GqwNTbSV.js +0 -1
- package/dist/client/assets/getPseudoElementBounds-BAmGtfzA.js +0 -1
- package/dist/client/assets/group-BQB2fHcw.js +0 -1
- package/dist/client/assets/input-5Gxk32uP.js +0 -1
- package/dist/client/assets/kbd-B4HCyWpi.js +0 -1
- package/dist/client/assets/label-CaZNWVUA.js +0 -1
- package/dist/client/assets/loader-circle-CrtHFAvM.js +0 -1
- package/dist/client/assets/main-BPfnkW0F.js +0 -9
- package/dist/client/assets/main-DspUYA0Y.css +0 -2
- package/dist/client/assets/menu-C9Z3D_7l.js +0 -1
- package/dist/client/assets/plus-B2h-VEqh.js +0 -1
- package/dist/client/assets/popover-CCz2VJor.js +0 -1
- package/dist/client/assets/primary-BMsRfh2b.js +0 -2
- package/dist/client/assets/providerDriverMeta-CgWTJ9AV.js +0 -1
- package/dist/client/assets/providerIconUtils-DKIWQBl_.js +0 -1
- package/dist/client/assets/providerInstances-DTwJD7w4.js +0 -1
- package/dist/client/assets/providerModels-DTwJD7w4.js +0 -1
- package/dist/client/assets/qr-code-BPTdK_Fr.js +0 -1
- package/dist/client/assets/radio-group-2REtGBUc.js +0 -2
- package/dist/client/assets/resolveAriaLabelledBy-CPzaFh9Q.js +0 -1
- package/dist/client/assets/rightPanelRouteSearch-Cv7sQjf8.js +0 -1
- package/dist/client/assets/runtime-DAfYpzw4.js +0 -1
- package/dist/client/assets/scroll-area-BsYcpnWD.js +0 -1
- package/dist/client/assets/scrollEdges-CUJFIJBP.js +0 -1
- package/dist/client/assets/search-BGQsenCM.js +0 -1
- package/dist/client/assets/select-zInJ5G5C.js +0 -1
- package/dist/client/assets/separator-CsdeZPxC.js +0 -1
- package/dist/client/assets/session-logic-CjEpVbpM.js +0 -6
- package/dist/client/assets/settingsDialogStore-B7yUTgbo.js +0 -1
- package/dist/client/assets/settingsLayout-7JR7nC6x.js +0 -1
- package/dist/client/assets/settingsSections.logic-F8RXVmAq.js +0 -1
- package/dist/client/assets/sheet-CLd8wqAA.js +0 -1
- package/dist/client/assets/sidebar-BliCAaUG.js +0 -1
- package/dist/client/assets/sidebarProjectFolders-ScxWbdTn.js +0 -4
- package/dist/client/assets/skeleton-B_qDqbso.js +0 -1
- package/dist/client/assets/spinner-BlCG_0jN.js +0 -1
- package/dist/client/assets/src-Chx4ffXH.js +0 -14
- package/dist/client/assets/storeSelectors-Of4FM0vM.js +0 -1
- package/dist/client/assets/switch-DUT5lUyk.js +0 -1
- package/dist/client/assets/terminal-C_CyIsDD.js +0 -1
- package/dist/client/assets/textarea-C5eyaBI3.js +0 -1
- package/dist/client/assets/threadPinning-B8un4fjx.js +0 -1
- package/dist/client/assets/toast-X_O6OBAx.js +0 -1
- package/dist/client/assets/toggle-P-wZyQFO.js +0 -1
- package/dist/client/assets/toggle-group-Du7zfd4_.js +0 -1
- package/dist/client/assets/tooltip-D_i-87PL.js +0 -1
- package/dist/client/assets/types-Of4FM0vM.js +0 -1
- package/dist/client/assets/uiStateStore-UUXKrPLz.js +0 -1
- package/dist/client/assets/useButton-D8BjCVb-.js +0 -1
- package/dist/client/assets/useCompositeListItem-BHuxHR8U.js +0 -1
- package/dist/client/assets/useDebouncedValue-D2-9M4Tq.js +0 -1
- package/dist/client/assets/useFloatingRootContext-CTdmlYcf.js +0 -1
- package/dist/client/assets/useHandleNewThread-YGjWitl4.js +0 -1
- package/dist/client/assets/useLabelableId-LInf_Egz.js +0 -1
- package/dist/client/assets/useLocation-3zGT25DO.js +0 -1
- package/dist/client/assets/useOpenInteractionType-BPthQeg6.js +0 -1
- package/dist/client/assets/usePhoneThreadActions-D_Z29f6p.js +0 -1
- package/dist/client/assets/usePopupViewport-BErrsN0k.js +0 -1
- package/dist/client/assets/useRenderElement-DchFnsR8.js +0 -1
- package/dist/client/assets/useScrollLock-CLyJPg7p.js +0 -1
- package/dist/client/assets/useSwipeDismiss-DjMT1XiU.js +0 -1
- package/dist/client/assets/useThreadActions-ISbVGkmx.js +0 -2
- package/dist/client/assets/useTriggerFocusGuards-DwOHWbrB.js +0 -1
- package/dist/client/assets/useValueChanged-Bq39JB8D.js +0 -1
- package/dist/client/assets/user-round-Cpzx8pSw.js +0 -1
- package/dist/client/assets/utils-BFbDkTQq.js +0 -1
- package/dist/client/assets/visibilityPolling-BwzZdaSN.js +0 -1
- package/dist/client/assets/x-C1Cemsov.js +0 -1
|
@@ -0,0 +1,2009 @@
|
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{Bt as n,G as r,Ht as i,It as a,St as o,wt as s,zt as c}from"./primary-BqnEJHWx.js";import{Hi as l}from"./src-I4s4HU8f.js";import{$t as u,An as d,Ar as f,Dn as p,Gi as m,Gn as h,Jn as g,Jt as _,Lt as v,Mn as y,On as b,Qt as x,Si as S,Tn as C,Ui as w,Wn as T,Xi as E,Xt as D,Zt as O,an as k,bi as A,dn as j,en as M,ia as N,jn as P,jt as F,kn as I,kt as L,p as ee,rn as R,va as te,xi as ne}from"./runtime-CA2W9mZ-.js";import{t as re}from"./compiler-runtime-qmuS0Svy.js";import{t as ie}from"./useDebouncedValue-BevbEbPO.js";import{f as z}from"./useRenderElement-5DRNLBaU.js";import{t as ae}from"./arrow-left-CCmICk1t.js";import{t as B}from"./bot-Cv7a7Ksf.js";import{t as V}from"./check-BfnWUGBT.js";import{t as oe}from"./chevron-down-B_FKCRVh.js";import{c as H,o as se}from"./tabSwitchInstrumentation-BuxWNdCV.js";import{t as ce}from"./chevron-right-B6CKNGh4.js";import{n as le}from"./useFloatingRootContext-j6TgzEFa.js";import{t as ue}from"./circle-alert-BV3vJE-c.js";import{t as de}from"./clock-3-NbnQqtcd.js";import{C as fe}from"./lib-D5cyGc84.js";import{t as pe}from"./folder-closed-D2cwiusg.js";import{n as me,t as he}from"./LazyBrowserPanel-CKfmuM9U.js";import{t as ge}from"./folder-BKTxLq18.js";import{t as _e}from"./globe-dS40wBdE.js";import{i as ve}from"./toast-CIjfIWUw.js";import{t as ye}from"./loader-circle-DRKbHQst.js";import{$ as be,$t as xe,At as Se,B as Ce,Bt as we,Ct as U,Dt as W,Et as G,F as Te,Ft as Ee,G as De,Gt as Oe,H as ke,Ht as Ae,I as je,It as Me,J as Ne,Jt as Pe,K as Fe,Kt as Ie,L as Le,Lt as Re,M as ze,Mt as Be,N as Ve,Nt as He,Ot as Ue,P as We,Pt as Ge,Q as Ke,Qt as qe,R as Je,Rt as K,St as Ye,Tt as Xe,U as Ze,Ut as Qe,V as $e,Vt as et,W as tt,Wt as nt,X as rt,Xt as it,Y as at,Yt as ot,Z as st,Zt as ct,_ as lt,_t as ut,at as dt,bt as ft,c as pt,ct as mt,d as ht,dn as gt,dt as _t,en as vt,et as yt,f as bt,ft as xt,g as St,gt as Ct,ht as wt,it as Tt,jt as Et,kt as Dt,l as Ot,ln as kt,lt as At,m as jt,mt as Mt,n as Nt,nt as Pt,on as Ft,ot as It,p as Lt,pt as Rt,q as zt,qt as Bt,r as Vt,rn as Ht,rt as Ut,s as Wt,st as Gt,t as Kt,tn as qt,tt as Jt,u as Yt,un as Xt,ut as Zt,v as Qt,vt as $t,wt as q,xt as en,y as tn,yt as nn,z as rn,zt as an}from"./device-CGaJ6fwD.js";import{t as on}from"./minimize-2-DC9gMgGl.js";import{t as sn}from"./plus-5kH13lqq.js";import{t as cn}from"./refresh-cw-DiuiLTny.js";import{t as ln}from"./save-DjlqeVG_.js";import{t as un}from"./search-B2nLj573.js";import{t as dn}from"./smartphone-DcUQ17YT.js";import{t as fn}from"./ThreadTerminalDrawer-D1SPewXR.js";import{i as pn}from"./terminal-links-Bf4neyyn.js";import{t as mn}from"./terminal-DupJfYRW.js";import{t as hn}from"./triangle-alert-D4cCh6sB.js";import{t as gn}from"./unplug-Dt3Sy2op.js";import{t as _n}from"./wrench-BnpoYEZm.js";import{t as vn}from"./x-BXHT1Zj1.js";import{t as yn}from"./button-B6xQZNKz.js";import{l as bn,t as J}from"./utils-B5qahmRn.js";import{c as xn,d as Sn,l as Cn}from"./useSwipeDismiss-BNHPBucH.js";import{t as wn}from"./useRouter-CcIDS3PN.js";import{a as Tn,c as En,d as Dn,f as On,g as kn,h as An,i as jn,l as Mn,m as Nn,o as Pn,p as Fn,r as In,s as Ln,t as Rn,u as zn}from"./rightPanelRouteSearch-CExl-IaQ.js";import{t as Bn}from"./useNavigate-2tVq4iZ2.js";import"./storeSelectors-Cr8JmFCe.js";import{o as Vn}from"./timestampFormat-8uPXS812.js";import{_ as Hn}from"./keybindings-FSJY3Tht.js";import{i as Un,n as Wn,t as Gn}from"./tooltip-C2VVqN6U.js";import{t as Kn}from"./scroll-area-CylKYQms.js";import{n as qn}from"./composerHandleContext-BrQ6d8r9.js";import{i as Jn,r as Yn,t as Xn}from"./alert-DE5SkZhr.js";import{n as Zn,t as Qn}from"./sidebarStatusText-7jo1n9E1.js";import{a as $n,i as er,o as tr,r as nr,s as rr,t as ir}from"./alert-dialog-BqPnPhb6.js";import{n as ar}from"./editorPreferences-D-9SDgRM.js";import{t as or}from"./badge-m9kM3P07.js";import{n as sr,t as cr}from"./session-logic-xfW418Rx.js";import{n as lr}from"./appChrome-CJauXpqv.js";import{t as ur}from"./useTheme-By1kfyiU.js";import{n as dr,t as fr}from"./toggle-group-ChGfILTR.js";import{t as pr}from"./toggle-BA4mJ5v9.js";var mr=z(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),hr=z(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),gr=z(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),_r=z(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),vr=z(`disc-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M6 12c0-1.7.7-3.2 1.8-4.2`,key:`oqkarx`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M18 12c0 1.7-.7 3.2-1.8 4.2`,key:`1eah9h`}]]),yr=z(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),br=z(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),xr=z(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Sr=z(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),Cr=z(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),wr=z(`monitor-off`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M17 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 1.184-1.826`,key:`cv7jms`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v10a2 2 0 0 1-.293 1.042`,key:`z8ni2w`}]]),Tr=z(`panel-right-close`,[[`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`}]]),Er=z(`panel-right-open`,[[`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`}]]),Dr=z(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),Or=z(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),kr=z(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),Ar=z(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),jr=z(`volume-1`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}]]),Mr=z(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Y=e(t(),1);function Nr(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function Pr(e,t){let{shouldBlockFn:n,enableBeforeUnload:r=!0,disabled:i=!1,withResolver:a=!1}=Nr(e,t),o=wn(),{history:s}=o,[c,l]=Y.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return Y.useEffect(()=>i?void 0:s.block({blockerFn:async e=>{function t(e){let t=o.parseLocation(e),[,n,r]=o.getMatchedRoutes(t.pathname);return r===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}:{routeId:r.id,fullPath:r.fullPath,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let s=await n({action:e.action,current:r,next:i});if(!a)return s;if(!s)return!1;let c=await new Promise(t=>{l({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return l({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),c},enableBeforeUnload:r}),[n,r,i,a,s,o]),c}function Fr(e){let t=[...e.messages.map(e=>({kind:`message`,id:`message:${e.id}`,at:e.createdAt,...e.sequence===void 0?{}:{sequence:e.sequence},message:e})),...e.entries.map(e=>({kind:`tool`,id:`tool:${e.id}`,at:e.startedAt??e.createdAt,...e.sequence===void 0?{}:{sequence:e.sequence},tool:e}))],n=t.every(e=>e.sequence!==void 0);return t.toSorted((e,t)=>n&&e.sequence!==void 0&&t.sequence!==void 0&&e.sequence!==t.sequence?e.sequence-t.sequence:e.at.localeCompare(t.at)||e.id.localeCompare(t.id))}var Ir=new Set,Lr=null;function Rr(e){Ir.add(e),Lr??=requestAnimationFrame(Br)}function zr(e){Ir.delete(e)&&Ir.size===0&&Lr!=null&&(cancelAnimationFrame(Lr),Lr=null)}function Br(e){let t=new Set(Ir);Ir.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}Lr=Ir.size>0?requestAnimationFrame(Br):null}function Vr(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function Hr(e,t){let n=e?.theme??K,r=t?.theme??K,i=Ur(e),a=Ur(t);return Be(n,r)&&Vr(e,t,[`theme`,`parseDiffOptions`])&&Vr(i,a)}function Ur(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function Wr(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Gr({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}var Kr=new TextEncoder,qr=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Jr=/[\uD800-\uDFFF]/,Yr=1024,Xr=new Uint8Array(Yr);function Zr(){Xr.length!==Yr&&(Xr=new Uint8Array(Yr))}function Qr(e){if(e.length===0)return e;if(Jr.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Xr.length<t&&(Xr=new Uint8Array(t));let{written:n}=Kr.encodeInto(e,Xr);return qr.decode(Xr.subarray(0,n))}var $r=4096,ei=.5;function ti(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=ri(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}ni(t,e)}}function ni(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function ri(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>$r)return null;let c=[];for(let t=0;t<n;t++)c.push(ai(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(ai(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=oi(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*ei:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var ii=/\s+/g;function ai(e){return e.replace(ii,``)}function oi(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function si(e,t,n){try{return ci(e,t,n)}finally{Zr()}}function ci(e,t,n=!1){let r=Ei(e),i=r?hi(e):gi(e),a,o=[];for(let e of i){if(r&&!Bt.test(e)){if(a==null)a=Qr(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!r&&!_i(e)){if(a==null)a=Qr(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=ui(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function li(e,t){try{return ui(e,t)}finally{Zr()}}function ui(e,{cacheKey:t,isGitDiff:n=Bt.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=Di(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=mi(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Ci(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?pi(i.contents):[],deletionLines:!l&&r!=null&&i!=null?pi(r.contents):[],cacheKey:ki(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(He),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=Qr(r.trim()),n!==r&&(c.prevName=Qr(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Ie:Oe):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Qr(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Qr(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Qr(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Qr(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Qr(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Qr(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(ct)??[];t!=null&&(c.prevObjectId=Qr(t)),n!=null&&(c.newObjectId=Qr(n)),r!=null&&(c.mode=Qr(r))}e.startsWith(`rename from `)&&(c.prevName=Qr(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Qr(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
2
|
+
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
3
|
+
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:ki(p.hunkContext),hunkSpecs:Qr(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&xi(t)&&!Si(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=Ai(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=ji(t);(g==null||g.type!==`change`)&&(g=Mi(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=ji(t);(g==null||g.type!==`change`)&&(g=Mi(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=ji(t);(g==null||g.type!==`context`)&&(g=Mi(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=Et(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Et(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Se(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Dt(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=Dt(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),ti(c),c}}function di(e,t,n=!1){let r=[],i=fi(e)?e.split(Ge):[e];for(let e of i)try{r.push(si(e,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function fi(e){return e.startsWith(`From `)||e.includes(`
|
|
4
|
+
From `)}function pi(e){let t=mi(e);for(let e=0;e<t.length;e++)t[e]=Qr(t[e]);return t}function mi(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
5
|
+
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function hi(e){return Di(e,`diff --git`)}function gi(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=bi(e,r);if(i<=0&&a<=0){if(vi(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=bi(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=Ci(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function _i(e){return vi(e,0)}function vi(e,t){let n=bi(e,t);return yi(e,t,`---`)&&yi(e,n,`+++`)}function yi(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
|
|
6
|
+
`||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function bi(e,t){let n=e.indexOf(`
|
|
7
|
+
`,t);return n===-1?e.length:n+1}function xi(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Si(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
8
|
+
`&&n!==`\r`)return!1}return!0}function Ci(e){if(!e.startsWith(`@@ -`))return;let t=4,n=wi(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=wi(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=wi(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=wi(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=Ti(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function wi(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function Ti(e){return e.endsWith(`\r
|
|
9
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
10
|
+
`)?e.slice(0,-1):e}function Ei(e){return e.startsWith(`diff --git`)||e.includes(`
|
|
11
|
+
diff --git`)}function Di(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:Oi(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=Oi(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function Oi(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function ki(e){return e==null?e:Qr(e)}function Ai(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function ji(e){let t=e.slice(1);return Qr(t===``?`
|
|
12
|
+
`:t)}function Mi(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var Ni=`/dev/null`;function Pi(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Fi(),a=t??Fi(),o=li(Ue(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Fi(){return{name:Ni,contents:``}}function Ii(){return q({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Xe({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Li(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ri(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var zi=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),zr(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||Wr(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&Ri(e.composedPath())||(ia(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(ia(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(ia(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){ia(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();ia(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);ia(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Wi(i)&&this.hoveredLine?.lineElement===i.lineElement;Ui(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Ui(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Wi(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Ki(i)&&p!=null){p(i);break}if(Gi(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Wi(i))break;Ui(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,ia(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),ia(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),ia(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();Ri(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Li(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=ft(Ii());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Hi(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Yi(t));if(Hi(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Hi(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Hi(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Ri(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Yi(e);if(t&&Ri(n))return;let r=Xi(e);return r==null?this.pathFromAnnotationSlot(e):Yi(r)}pathFromAnnotationSlot(e){let t=Qi(Zi(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:Yi(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=$i(t)?t:$i(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Wr(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,Rr(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{zr(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!ta(this.renderedSelectedLinesState,n),i=!ta(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);qi(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=ra(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=ra(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:Ji(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Ji(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:na(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:na(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Bi({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Vi({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Vi({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Hi(e){return e!=null&&`kind`in e&&e.kind===`line`}function Ui(e){return e!=null&&`kind`in e&&e.kind===`token`}function Wi(e){return Hi(e)||Ui(e)}function Gi(e){return`type`in e&&e.type===`line-info`}function Ki(e){return`kind`in e&&e.kind===`merge-conflict-action`}function qi(e){return e===`current`||e===`incoming`||e===`both`}function Ji(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Yi(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Xi(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Zi(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Qi(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function $i(e){return e!=null&&typeof e.elementFromPoint==`function`}function ea(e,t){return e===t||Wr(e??void 0,t??void 0)}function ta(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&ea(e?.range??null,t.range)}function na(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function ra(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function ia(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var aa=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),ca(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?da(t):fa(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:oa(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:sa(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&la(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function oa(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function sa(e){return Math.max(Math.ceil(e),0)}function ca(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?la(e,{codeWidthChanged:!0,numberWidthChanged:!0}):ua(e))}function la(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function ua(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function da(e){e.codeElement.isConnected&&ua(e)}function fa(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function pa(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!nn.has(t))return!1;return!0}function ma(e){for(let t of Rt(e))if(!Ct.has(t))return!1;return!0}function ha(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function ga(e){return q({tagName:`div`,children:[q({tagName:`div`,children:e.annotations?.map(e=>q({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function _a(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function va({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return q({tagName:`div`,children:[t===`custom`?q({tagName:`slot`,properties:{name:Ee}}):ya({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[ba(r)]],properties:i})}function ya({name:e,prevName:t,iconType:n}){let r=[q({tagName:`slot`,properties:{name:it}}),Xe({name:_a(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[G(t)]})],properties:{"data-prev-name":``}})),r.push(Xe({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[G(e)]})],properties:{"data-title":``}})),r.push(q({tagName:`slot`,properties:{name:Pe}})),q({tagName:`div`,children:r,properties:{"data-header-content":``}})}function ba(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(q({tagName:`span`,children:[G(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(q({tagName:`span`,children:[G(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(q({tagName:`slot`,properties:{name:ot}})),q({tagName:`div`,children:t,properties:{"data-metadata":``}})}function xa(e){return q({tagName:`pre`,properties:Sa(e)})}function Sa({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function Ca(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:Rt(t),preferredHighlighter:n}}function wa(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}var Ta={compositeOverBg:Jt,contrastRatio:Pt,deriveMutedFg:Ut,hoverWouldEraseText:Tt,isDarkSurface:dt,isFullyTransparent:It,pickReadableForeground:Gt,relativeLuminance:mt,surfacesMatch:At},Ea=`-1,-1`;function Da(e){return e?.some(e=>e.lineNumber===0)??!1}function Oa(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function ka(e){return e.startingLine===0&&e.totalLines>0}function Aa(e,t){return e.endsWith(`\r
|
|
13
|
+
`)?t+`\r
|
|
14
|
+
`:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
|
|
15
|
+
`)?t+`
|
|
16
|
+
`:t}function ja(e,t){return q({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function Ma(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var Na=-1,Pa=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++Na}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;constructor(e={theme:K},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=ma(e.theme??K)?Mt():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(){this.editSessionActive=!0}endEditSession(){this.editSessionActive=!1}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.endEditSession(),this.textDocumentCache=new WeakMap}syncEditedContentsToFile(){let{renderCache:e,lineCache:t}=this;e?.isDirty!==!0||t==null||!Ma(t,e.file)||(e.file.contents=t.lines.join(``))}hasUnkeyedFileContentsChanged(e){let{lineCache:t}=this;return e.cacheKey==null&&t!=null&&t.file===e&&t.sourceContents!==e.contents}invalidateChangedUnkeyedFile(e){this.hasUnkeyedFileContentsChanged(e)&&(this.workerManager?.cleanUpTasks(this),this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap)}clearRenderCache(){this.syncEditedContentsToFile(),this.pendingStructuralRows=void 0;let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){let{options:t}=this.getRenderOptions(e),n=Fa(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!_t(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!rt(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??Zt(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??K}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||!W(e,n.file)||!_t(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){this.invalidateChangedUnkeyedFile(e);let{lineCache:t}=this;return(t==null||!Ma(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:yt(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){if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:r,result:i}=this.renderCache;if(i==null)return;let a=n?new Map:void 0;this.pendingStructuralRows=a;let o=this.lineCache!=null&&Ma(this.lineCache,r)?this.lineCache:void 0;for(let[t,n]of e){if(a===void 0&&o!=null&&t<o.lines.length){let e=n.map(e=>e[2]).join(``);o.lines[t]=Aa(o.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}]})};a===void 0?i.code[t]=e:a.set(t,e)}i.baseThemeType=t,this.renderCache.isDirty=!0}applyDocumentChange(e){let t=this.pendingStructuralRows;if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:n,result:r}=this.renderCache;if(r==null)return;let i=this.lineCache!=null&&Ma(this.lineCache,n)?this.lineCache.lines:yt(n.contents),a=yt(e.getText());if(i.length!==a.length){let n=Math.min(i.length,a.length),o=0;for(;o<n&&i[o]===a[o];)o++;let s=0;for(;s<n-o&&i[i.length-1-s]===a[a.length-1-s];)s++;let c=r.code;r.code=Array(a.length);for(let e=0;e<o;e++)r.code[e]=c[e];for(let e=0;e<s;e++)r.code[a.length-1-e]=c[i.length-1-e];if(t!==void 0)for(let[e,n]of t)e<a.length&&(r.code[e]=n);for(let t=o;t<a.length-s;t++)r.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<r.code.length;e++){let t=r.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}this.renderCache.isDirty=!0}this.lineCache={cacheKey:n.cacheKey,file:n,sourceContents:n.contents,lines:a},this.textDocumentCache.set(n,e)}renderFile(e=this.renderCache?.file,t=Re){if(e==null)return;this.invalidateChangedUnkeyedFile(e),this.renderCache?.isDirty===!0&&!W(e,this.renderCache.file)&&(this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap);let{options:n,forceHighlight:r}=this.getRenderOptions(e);this.renderCache?.isDirty===!0&&!_t(n,this.renderCache.options)&&this.clearRenderCache();let i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},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||rt(e)||Fa(a.length,this.getTokenizeMaxLength()),c=!W(e,this.renderCache.file),l=!ha(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||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??Zt(e.name);let t=this.highlighter!=null&&ma(n.theme),i=this.highlighter!=null&&pa(this.computedLang),a=!s&&i;if(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.renderCache!=null&&(this.renderCache.highlighted=!1),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=Re){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=Fa(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Zt(e.name);let n=this.highlighter!=null&&xt(Rt(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&pa(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:st(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=U(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=ka(t)?Oa(this.lineAnnotations):void 0;d!=null&&(c.children.push(en(`context`,`annotation`,1)),s.push(ga({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>wa(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(Ye(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(en(`context`,`annotation`,1)),s.push(ga({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>wa(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{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 va({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return ft(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(q({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=U();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,ja(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return ft(t?q({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await wt(Ca(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){if(this.renderCache==null)return;let i=!W(e,this.renderCache.file)||!this.renderCache.highlighted||!_t(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!_t(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&W(e,n.file)&&_t(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 xa({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Fa(e,t){return e>t}var Ia=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
17
|
+
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
18
|
+
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
19
|
+
</symbol>
|
|
20
|
+
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
21
|
+
<path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
|
|
22
|
+
</symbol>
|
|
23
|
+
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
24
|
+
<path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
|
|
25
|
+
</symbol>
|
|
26
|
+
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
27
|
+
<path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
|
|
28
|
+
</symbol>
|
|
29
|
+
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
30
|
+
<path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
|
|
31
|
+
</symbol>
|
|
32
|
+
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
33
|
+
<path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
|
|
34
|
+
</symbol>
|
|
35
|
+
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
36
|
+
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
|
|
37
|
+
</symbol>
|
|
38
|
+
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
39
|
+
<path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
|
|
40
|
+
</symbol>
|
|
41
|
+
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
42
|
+
<path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
|
|
43
|
+
</symbol>
|
|
44
|
+
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
45
|
+
<path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
|
|
46
|
+
</symbol>
|
|
47
|
+
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
48
|
+
<path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
49
|
+
</symbol>
|
|
50
|
+
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
51
|
+
<path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
52
|
+
</symbol>
|
|
53
|
+
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
54
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
|
|
55
|
+
</symbol>
|
|
56
|
+
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
57
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
|
|
58
|
+
</symbol>
|
|
59
|
+
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
60
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
|
|
61
|
+
</symbol>
|
|
62
|
+
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
63
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
|
|
64
|
+
</symbol>
|
|
65
|
+
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
66
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
|
|
67
|
+
</symbol>
|
|
68
|
+
</svg>`;function La(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Ra(e,t){return e==null||t==null?e===t:Ba(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var za={};function Ba(e=za,t=za){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function Va(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Ha(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function Ua(){let e=document.createElement(`style`);return e.setAttribute(vt,``),e}var Wa=`@layer base {
|
|
69
|
+
:host {
|
|
70
|
+
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
71
|
+
"Courier New", monospace;
|
|
72
|
+
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
73
|
+
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
74
|
+
--diffs-mixer: light-dark(#000, #fff);
|
|
75
|
+
--diffs-gap-fallback: 8px;
|
|
76
|
+
--diffs-scrollbar-gutter-fallback: 6px;
|
|
77
|
+
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
78
|
+
--diffs-added-light: #0dbe4e;
|
|
79
|
+
--diffs-added-dark: #5ecc71;
|
|
80
|
+
--diffs-modified-light: #009fff;
|
|
81
|
+
--diffs-modified-dark: #69b1ff;
|
|
82
|
+
--diffs-deleted-light: #ff2e3f;
|
|
83
|
+
--diffs-deleted-dark: #ff6762;
|
|
84
|
+
--diffs-warning-light: #d5a910;
|
|
85
|
+
--diffs-warning-dark: #ffd452;
|
|
86
|
+
color-scheme: light dark;
|
|
87
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
88
|
+
font-size: var(--diffs-font-size, 13px);
|
|
89
|
+
line-height: var(--diffs-line-height, 20px);
|
|
90
|
+
font-feature-settings: var(--diffs-font-features);
|
|
91
|
+
--diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
|
|
92
|
+
--diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));
|
|
93
|
+
--diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));
|
|
94
|
+
--diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));
|
|
95
|
+
--diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));
|
|
96
|
+
--diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
|
|
97
|
+
--diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));
|
|
98
|
+
--diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
|
|
99
|
+
--diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark)))));
|
|
100
|
+
--diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark)))));
|
|
101
|
+
--diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark)))));
|
|
102
|
+
--diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));
|
|
103
|
+
--diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2)));
|
|
104
|
+
--diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));
|
|
105
|
+
--diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2)));
|
|
106
|
+
--diffs-selection-base: var(--diffs-modified-base);
|
|
107
|
+
--diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));
|
|
108
|
+
background-color: var(--diffs-bg);
|
|
109
|
+
color: var(--diffs-fg);
|
|
110
|
+
display: block;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
pre, code, [data-error-wrapper] {
|
|
114
|
+
isolation: isolate;
|
|
115
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
116
|
+
outline: none;
|
|
117
|
+
margin: 0;
|
|
118
|
+
padding: 0;
|
|
119
|
+
display: block;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
pre, code {
|
|
123
|
+
background-color: var(--diffs-bg);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
code {
|
|
127
|
+
contain: content;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
input, button {
|
|
131
|
+
font-family: inherit;
|
|
132
|
+
font-size: inherit;
|
|
133
|
+
line-height: inherit;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
*, :before, :after {
|
|
137
|
+
box-sizing: border-box;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
[data-icon-sprite] {
|
|
141
|
+
display: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
[data-diffs-header], [data-separator] {
|
|
145
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[data-diffs-header][data-sticky] {
|
|
149
|
+
z-index: 1;
|
|
150
|
+
background-color: var(--diffs-bg);
|
|
151
|
+
position: sticky;
|
|
152
|
+
top: 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-file-info] {
|
|
156
|
+
color: var(--fg);
|
|
157
|
+
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
158
|
+
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
159
|
+
padding: 10px;
|
|
160
|
+
font-weight: 700;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[data-diff], [data-file] {
|
|
164
|
+
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
165
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
166
|
+
|
|
167
|
+
&[data-dehydrated] {
|
|
168
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
172
|
+
background-color: var(--diffs-bg-context);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@supports (-webkit-touch-callout: none) {
|
|
177
|
+
:host {
|
|
178
|
+
--diffs-scrollbar-gutter-fallback: 0px;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
[data-line] span {
|
|
183
|
+
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
184
|
+
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
185
|
+
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
186
|
+
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
187
|
+
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
|
|
191
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
192
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
193
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
194
|
+
--diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
|
|
195
|
+
--diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
|
|
196
|
+
--diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
|
|
197
|
+
--diffs-line-bg: var(--diffs-computed-hovered-line-bg);
|
|
198
|
+
color: var(--diffs-fg);
|
|
199
|
+
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
[data-line], [data-no-newline] {
|
|
203
|
+
&[data-decoration-bg] {
|
|
204
|
+
--mix-deco-light: 92%;
|
|
205
|
+
--mix-deco-dark: 85%;
|
|
206
|
+
|
|
207
|
+
&[data-decoration-bg-depth="2"] {
|
|
208
|
+
--mix-deco-light: 88%;
|
|
209
|
+
--mix-deco-dark: 80%;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&[data-decoration-bg-depth="3"] {
|
|
213
|
+
--mix-deco-light: 85%;
|
|
214
|
+
--mix-deco-dark: 78%;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
--diffs-hover-mix-target: var(--diffs-decoration-bg);
|
|
218
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
219
|
+
var(--diffs-bg) var(--mix-deco-light),
|
|
220
|
+
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
221
|
+
var(--diffs-bg) var(--mix-deco-dark),
|
|
222
|
+
var(--diffs-decoration-bg)));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
227
|
+
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
228
|
+
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
229
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
[data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] {
|
|
233
|
+
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
234
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
238
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
239
|
+
var(--diffs-bg) 78%,
|
|
240
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
241
|
+
var(--diffs-bg) 68%,
|
|
242
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
243
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
247
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
248
|
+
var(--diffs-bg) 78%,
|
|
249
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
250
|
+
var(--diffs-bg) 68%,
|
|
251
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
252
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
256
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
257
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
:where([data-background]) {
|
|
261
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
262
|
+
--mix-light: 91%;
|
|
263
|
+
--mix-dark: 85%;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
& [data-line], & [data-no-newline] {
|
|
267
|
+
--mix-light: 88%;
|
|
268
|
+
--mix-dark: 80%;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
272
|
+
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
273
|
+
|
|
274
|
+
&[data-line-type="change-deletion"] {
|
|
275
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
276
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
277
|
+
|
|
278
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
279
|
+
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
280
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
284
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
285
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
286
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
287
|
+
var(--diffs-diff-line-mix-target)));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
&[data-line-type="change-addition"] {
|
|
291
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
292
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
293
|
+
|
|
294
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
295
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
296
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
300
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
301
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
302
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
303
|
+
var(--diffs-diff-line-mix-target)));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&[data-merge-conflict="current"] {
|
|
307
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
308
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
309
|
+
|
|
310
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
311
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
312
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
316
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
317
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
318
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
319
|
+
var(--diffs-diff-line-mix-target)));
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&[data-merge-conflict="incoming"] {
|
|
323
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
324
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
325
|
+
|
|
326
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
327
|
+
color: var(--diffs-modified-base);
|
|
328
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
332
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
333
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
334
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
335
|
+
var(--diffs-diff-line-mix-target)));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
|
|
341
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
342
|
+
--diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
|
|
343
|
+
|
|
344
|
+
&:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
345
|
+
--mix-selection-light: 82%;
|
|
346
|
+
--mix-selection-dark: 75%;
|
|
347
|
+
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
&:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
|
|
351
|
+
--mix-selection-light: 75%;
|
|
352
|
+
--mix-selection-dark: 60%;
|
|
353
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
354
|
+
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
&:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
358
|
+
--diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
|
|
359
|
+
var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
|
|
360
|
+
var(--mix-selection-light),
|
|
361
|
+
var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
&:where([data-editor-overlay]), &[data-selected-line] {
|
|
365
|
+
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
366
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
367
|
+
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
368
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
369
|
+
var(--diffs-selection-mix-target)));
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
[data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
|
|
374
|
+
--diffs-computed-editor-active-line-bg: color-mix(in lab,
|
|
375
|
+
var(--diffs-computed-selected-line-bg)
|
|
376
|
+
var(--diffs-editor-active-line-source-mix, 100%),
|
|
377
|
+
var(--diffs-selection-emphasis-mix-target));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
@media (pointer: fine) {
|
|
381
|
+
[data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {
|
|
382
|
+
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
383
|
+
var(--diffs-computed-editor-active-line-bg) 97%,
|
|
384
|
+
var(--diffs-hover-mix-target)), color-mix(in lab,
|
|
385
|
+
var(--diffs-computed-editor-active-line-bg) 91%,
|
|
386
|
+
var(--diffs-hover-mix-target)));
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
[data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
|
|
391
|
+
color: var(--diffs-selection-number-fg);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
[data-no-newline] {
|
|
395
|
+
user-select: none;
|
|
396
|
+
|
|
397
|
+
& span {
|
|
398
|
+
opacity: .6;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
[data-diff-type="split"][data-overflow="scroll"] {
|
|
403
|
+
grid-template-columns: 1fr 1fr;
|
|
404
|
+
display: grid;
|
|
405
|
+
|
|
406
|
+
& [data-additions] {
|
|
407
|
+
border-left: 1px solid var(--diffs-bg);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
& [data-deletions] {
|
|
411
|
+
border-right: 1px solid var(--diffs-bg);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
[data-code] {
|
|
416
|
+
grid-auto-flow: dense;
|
|
417
|
+
grid-template-columns: var(--diffs-code-grid);
|
|
418
|
+
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
419
|
+
overscroll-behavior-x: none;
|
|
420
|
+
tab-size: var(--diffs-tab-size, 2);
|
|
421
|
+
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
422
|
+
padding-bottom: max(0px,
|
|
423
|
+
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
424
|
+
var(--diffs-scrollbar-gutter)));
|
|
425
|
+
scrollbar-gutter: stable;
|
|
426
|
+
align-self: flex-start;
|
|
427
|
+
display: grid;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
[data-diffs-scrollbar-measure] {
|
|
431
|
+
opacity: 0;
|
|
432
|
+
pointer-events: none;
|
|
433
|
+
scrollbar-gutter: auto;
|
|
434
|
+
grid-template-columns: none;
|
|
435
|
+
width: 100px;
|
|
436
|
+
height: 100px;
|
|
437
|
+
padding: 0;
|
|
438
|
+
position: absolute;
|
|
439
|
+
top: -200px;
|
|
440
|
+
left: -200px;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
[data-container-size] {
|
|
444
|
+
container-type: inline-size;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
[data-code]::-webkit-scrollbar {
|
|
448
|
+
width: 0;
|
|
449
|
+
height: var(--diffs-scrollbar-gutter);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
[data-code]::-webkit-scrollbar-track {
|
|
453
|
+
background: none;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
[data-code]::-webkit-scrollbar-thumb {
|
|
457
|
+
background-color: #0000;
|
|
458
|
+
background-clip: content-box;
|
|
459
|
+
border: 1px solid #0000;
|
|
460
|
+
border-radius: 3px;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
[data-code]::-webkit-scrollbar-corner {
|
|
464
|
+
background-color: #0000;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
@supports ((-moz-appearance: none)) {
|
|
468
|
+
[data-code] {
|
|
469
|
+
scrollbar-width: thin;
|
|
470
|
+
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
471
|
+
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
476
|
+
& [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
477
|
+
padding-top: 0;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
[data-gutter] {
|
|
482
|
+
grid-template-rows: subgrid;
|
|
483
|
+
grid-template-columns: subgrid;
|
|
484
|
+
z-index: 3;
|
|
485
|
+
background-color: var(--diffs-bg);
|
|
486
|
+
grid-column: 1;
|
|
487
|
+
display: grid;
|
|
488
|
+
position: relative;
|
|
489
|
+
|
|
490
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
491
|
+
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
[data-content] {
|
|
496
|
+
grid-template-rows: subgrid;
|
|
497
|
+
grid-template-columns: subgrid;
|
|
498
|
+
background-color: var(--diffs-bg);
|
|
499
|
+
grid-column: 2;
|
|
500
|
+
min-width: 0;
|
|
501
|
+
display: grid;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
[data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
505
|
+
grid-auto-flow: dense;
|
|
506
|
+
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
507
|
+
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
508
|
+
display: grid;
|
|
509
|
+
|
|
510
|
+
& [data-code] {
|
|
511
|
+
display: contents;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
& [data-deletions] {
|
|
515
|
+
& [data-gutter] {
|
|
516
|
+
grid-column: 1;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
& [data-content] {
|
|
520
|
+
border-right: 1px solid var(--diffs-bg);
|
|
521
|
+
grid-column: 2;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
& [data-additions] {
|
|
526
|
+
& [data-gutter] {
|
|
527
|
+
border-left: 1px solid var(--diffs-bg);
|
|
528
|
+
grid-column: 3;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
& [data-content] {
|
|
532
|
+
grid-column: 4;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
|
|
538
|
+
overflow: clip;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
[data-overflow="scroll"] [data-gutter] {
|
|
542
|
+
position: sticky;
|
|
543
|
+
left: 0;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
[data-interactive-lines] [data-line] {
|
|
547
|
+
cursor: pointer;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
[data-interactive-line-numbers] [data-column-number] {
|
|
551
|
+
cursor: pointer;
|
|
552
|
+
touch-action: none;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
[data-content-buffer], [data-gutter-buffer] {
|
|
556
|
+
user-select: none;
|
|
557
|
+
min-height: 1lh;
|
|
558
|
+
position: relative;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
[data-gutter-buffer] {
|
|
562
|
+
padding-left: 2ch;
|
|
563
|
+
padding-right: 1ch;
|
|
564
|
+
|
|
565
|
+
&:before {
|
|
566
|
+
content: "";
|
|
567
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
568
|
+
display: block;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
[data-gutter-buffer="annotation"] {
|
|
573
|
+
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
574
|
+
min-height: 0;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
[data-gutter-buffer="buffer"] {
|
|
578
|
+
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
[data-content-buffer] {
|
|
582
|
+
background-position: 5px 0;
|
|
583
|
+
background-size: 8px 8px;
|
|
584
|
+
background-origin: border-box;
|
|
585
|
+
background-image: repeating-linear-gradient(-45deg,
|
|
586
|
+
transparent,
|
|
587
|
+
transparent calc(3px * 1.414),
|
|
588
|
+
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
589
|
+
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
590
|
+
grid-column: 1;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
[data-separator] {
|
|
594
|
+
box-sizing: content-box;
|
|
595
|
+
background-color: var(--diffs-bg);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
[data-separator="simple"] {
|
|
599
|
+
min-height: 4px;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
603
|
+
background-color: var(--diffs-bg-separator);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
607
|
+
height: 32px;
|
|
608
|
+
position: relative;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
[data-separator-wrapper] {
|
|
612
|
+
user-select: none;
|
|
613
|
+
fill: currentColor;
|
|
614
|
+
background-color: var(--diffs-bg);
|
|
615
|
+
align-items: center;
|
|
616
|
+
height: 100%;
|
|
617
|
+
display: flex;
|
|
618
|
+
position: absolute;
|
|
619
|
+
inset-inline: 0;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
[data-content] [data-separator-wrapper] {
|
|
623
|
+
display: none;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
[data-separator="metadata"] [data-separator-wrapper] {
|
|
627
|
+
background-color: var(--diffs-bg-separator);
|
|
628
|
+
height: 100%;
|
|
629
|
+
color: var(--diffs-fg-number);
|
|
630
|
+
white-space: nowrap;
|
|
631
|
+
text-overflow: ellipsis;
|
|
632
|
+
min-width: min-content;
|
|
633
|
+
padding-inline: 1ch;
|
|
634
|
+
inset-inline: 100% auto;
|
|
635
|
+
overflow: hidden;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
[data-separator="line-info"] {
|
|
639
|
+
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
640
|
+
|
|
641
|
+
& [data-separator-wrapper] {
|
|
642
|
+
min-width: 16px;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
647
|
+
margin-block: 0;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
[data-separator="line-info"][data-separator-first] {
|
|
651
|
+
margin-top: 0;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
[data-separator="line-info"][data-separator-last] {
|
|
655
|
+
margin-bottom: 0;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
[data-expand-index] [data-separator-wrapper] {
|
|
659
|
+
grid-template-columns: 32px auto;
|
|
660
|
+
display: grid;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
664
|
+
grid-template-columns: 32px 32px auto;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
[data-expand-button], [data-separator-content] {
|
|
668
|
+
background-color: var(--diffs-bg-separator);
|
|
669
|
+
flex: none;
|
|
670
|
+
align-items: center;
|
|
671
|
+
display: flex;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
[data-expand-index] [data-separator-content]:hover {
|
|
675
|
+
cursor: pointer;
|
|
676
|
+
text-decoration: underline;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
[data-expand-button] {
|
|
680
|
+
cursor: pointer;
|
|
681
|
+
min-width: 32px;
|
|
682
|
+
color: var(--diffs-fg-number);
|
|
683
|
+
border-right: 2px solid var(--diffs-bg);
|
|
684
|
+
flex-shrink: 0;
|
|
685
|
+
justify-content: center;
|
|
686
|
+
align-self: stretch;
|
|
687
|
+
|
|
688
|
+
&:hover {
|
|
689
|
+
color: var(--diffs-fg);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
&[data-expand-all-button] {
|
|
693
|
+
display: none;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
[data-expand-down] [data-icon] {
|
|
698
|
+
transform: scaleY(-1);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
[data-separator-content] {
|
|
702
|
+
height: 100%;
|
|
703
|
+
color: var(--diffs-fg-number);
|
|
704
|
+
flex: auto;
|
|
705
|
+
justify-content: flex-start;
|
|
706
|
+
padding: 0 1ch;
|
|
707
|
+
overflow: hidden;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
711
|
+
& [data-separator-content] {
|
|
712
|
+
user-select: none;
|
|
713
|
+
height: 100%;
|
|
714
|
+
overflow: clip;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
[data-unmodified-lines] {
|
|
719
|
+
text-overflow: ellipsis;
|
|
720
|
+
white-space: nowrap;
|
|
721
|
+
flex: 0 auto;
|
|
722
|
+
min-width: 0;
|
|
723
|
+
display: block;
|
|
724
|
+
overflow: hidden;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
@supports (width: 1cqi) {
|
|
728
|
+
[data-unified] {
|
|
729
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
730
|
+
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
731
|
+
width: 100cqi;
|
|
732
|
+
|
|
733
|
+
& [data-separator-content] {
|
|
734
|
+
border-radius: 6px;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
739
|
+
border-top-left-radius: unset;
|
|
740
|
+
border-bottom-left-radius: unset;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
[data-gutter] {
|
|
745
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
746
|
+
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
& [data-separator="line-info"] [data-separator-content] {
|
|
750
|
+
border-top-left-radius: 6px;
|
|
751
|
+
border-bottom-left-radius: 6px;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
755
|
+
border-top-left-radius: unset;
|
|
756
|
+
border-bottom-left-radius: unset;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
[data-additions] {
|
|
761
|
+
& [data-content] [data-separator="line-info"] {
|
|
762
|
+
background-color: var(--diffs-bg);
|
|
763
|
+
|
|
764
|
+
& [data-separator-wrapper] {
|
|
765
|
+
display: none;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
770
|
+
background-color: var(--diffs-bg-separator);
|
|
771
|
+
border-top-right-radius: 6px;
|
|
772
|
+
border-bottom-right-radius: 6px;
|
|
773
|
+
height: 100%;
|
|
774
|
+
display: block;
|
|
775
|
+
|
|
776
|
+
& [data-separator-content], & [data-expand-button] {
|
|
777
|
+
display: none;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
783
|
+
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
787
|
+
background-color: var(--diffs-bg-separator);
|
|
788
|
+
height: 100%;
|
|
789
|
+
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
790
|
+
border-top-right-radius: 6px;
|
|
791
|
+
border-bottom-right-radius: 6px;
|
|
792
|
+
display: block;
|
|
793
|
+
|
|
794
|
+
& [data-separator-content], & [data-expand-button] {
|
|
795
|
+
display: none;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
800
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
801
|
+
border-top-left-radius: 6px;
|
|
802
|
+
border-bottom-left-radius: 6px;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
@media (pointer: fine) {
|
|
807
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
808
|
+
&[data-separator-multi-button] {
|
|
809
|
+
& [data-expand-up] {
|
|
810
|
+
border-top-left-radius: 6px;
|
|
811
|
+
border-bottom-left-radius: unset;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
& [data-expand-down] {
|
|
815
|
+
border-bottom-left-radius: 6px;
|
|
816
|
+
border-top-left-radius: unset;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
@media (pointer: coarse) {
|
|
824
|
+
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
825
|
+
grid-template-columns: 34px 34px auto;
|
|
826
|
+
|
|
827
|
+
& [data-separator-content] {
|
|
828
|
+
grid-column: unset;
|
|
829
|
+
grid-row: unset;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
@supports (width: 1cqi) {
|
|
834
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
835
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
836
|
+
border-top-left-radius: 6px;
|
|
837
|
+
border-bottom-left-radius: 6px;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
&[data-separator-multi-button] {
|
|
841
|
+
& [data-expand-up] {
|
|
842
|
+
border-top-left-radius: 6px;
|
|
843
|
+
border-bottom-left-radius: 6px;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
& [data-expand-down] {
|
|
847
|
+
border-bottom-left-radius: unset;
|
|
848
|
+
border-top-left-radius: unset;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
@media (pointer: fine) {
|
|
856
|
+
[data-separator-wrapper][data-separator-multi-button] {
|
|
857
|
+
grid-template-rows: 50% 50%;
|
|
858
|
+
display: grid;
|
|
859
|
+
|
|
860
|
+
& [data-separator-content] {
|
|
861
|
+
grid-area: 1 / 2 / -1;
|
|
862
|
+
min-width: min-content;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
& [data-expand-button] {
|
|
866
|
+
grid-column: 1;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
871
|
+
grid-template-columns: 34px auto;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
875
|
+
grid-template-columns: 100% auto;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
879
|
+
& [data-separator-multi-button] {
|
|
880
|
+
& [data-expand-up] {
|
|
881
|
+
border-bottom: 1px solid var(--diffs-bg);
|
|
882
|
+
border-right: 2px solid var(--diffs-bg);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
& [data-expand-down] {
|
|
886
|
+
border-top: 1px solid var(--diffs-bg);
|
|
887
|
+
border-right: 2px solid var(--diffs-bg);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
894
|
+
display: none;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
[data-line-annotation] {
|
|
898
|
+
min-height: var(--diffs-annotation-min-height, 0);
|
|
899
|
+
z-index: 2;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
[data-merge-conflict-actions] {
|
|
903
|
+
z-index: 2;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
[data-separator="custom"] {
|
|
907
|
+
grid-template-columns: subgrid;
|
|
908
|
+
display: grid;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
[data-line], [data-column-number], [data-no-newline] {
|
|
912
|
+
padding-inline: 1ch;
|
|
913
|
+
position: relative;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
[data-indicators="classic"] [data-line] {
|
|
917
|
+
padding-inline-start: 2ch;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
[data-indicators="classic"] {
|
|
921
|
+
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
922
|
+
&[data-no-newline], &[data-line] {
|
|
923
|
+
&:before {
|
|
924
|
+
user-select: none;
|
|
925
|
+
width: 1ch;
|
|
926
|
+
height: 1lh;
|
|
927
|
+
display: inline-block;
|
|
928
|
+
position: absolute;
|
|
929
|
+
top: 0;
|
|
930
|
+
left: 0;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
& [data-line-type="change-addition"] {
|
|
936
|
+
&[data-line], &[data-no-newline] {
|
|
937
|
+
&:before {
|
|
938
|
+
content: "+";
|
|
939
|
+
color: var(--diffs-addition-base);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
& [data-line-type="change-deletion"] {
|
|
945
|
+
&[data-line], &[data-no-newline] {
|
|
946
|
+
&:before {
|
|
947
|
+
content: "-";
|
|
948
|
+
color: var(--diffs-deletion-base);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
[data-indicators="bars"] {
|
|
955
|
+
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
956
|
+
&[data-column-number] {
|
|
957
|
+
&:before {
|
|
958
|
+
content: "";
|
|
959
|
+
user-select: none;
|
|
960
|
+
contain: strict;
|
|
961
|
+
width: 4px;
|
|
962
|
+
height: 100%;
|
|
963
|
+
display: block;
|
|
964
|
+
position: absolute;
|
|
965
|
+
top: 0;
|
|
966
|
+
left: 0;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
& [data-line-type="change-deletion"] {
|
|
972
|
+
&[data-column-number] {
|
|
973
|
+
&:before {
|
|
974
|
+
background-image: linear-gradient(0deg,
|
|
975
|
+
var(--diffs-bg-deletion) 50%,
|
|
976
|
+
var(--diffs-deletion-base) 50%);
|
|
977
|
+
background-repeat: repeat;
|
|
978
|
+
background-size: 2px 2px;
|
|
979
|
+
background-size: calc(1lh / round(1lh / 2px))
|
|
980
|
+
calc(1lh / round(1lh / 2px));
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
& [data-line-type="change-addition"] {
|
|
986
|
+
&[data-column-number] {
|
|
987
|
+
&:before {
|
|
988
|
+
background-color: var(--diffs-addition-base);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
[data-overflow="wrap"] {
|
|
995
|
+
& [data-line] {
|
|
996
|
+
white-space: pre-wrap;
|
|
997
|
+
word-break: break-word;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
& [data-annotation-content] {
|
|
1001
|
+
word-break: break-word;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
[data-overflow="scroll"] [data-line] {
|
|
1006
|
+
white-space: pre;
|
|
1007
|
+
min-height: 1lh;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
[data-column-number] {
|
|
1011
|
+
box-sizing: content-box;
|
|
1012
|
+
text-align: right;
|
|
1013
|
+
user-select: none;
|
|
1014
|
+
color: var(--diffs-fg-number);
|
|
1015
|
+
padding-left: 2ch;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
[data-line-number-content] {
|
|
1019
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1020
|
+
z-index: 1;
|
|
1021
|
+
display: inline-block;
|
|
1022
|
+
position: relative;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
[data-disable-line-numbers] {
|
|
1026
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1027
|
+
min-width: 4px;
|
|
1028
|
+
padding: 0;
|
|
1029
|
+
|
|
1030
|
+
&:before {
|
|
1031
|
+
min-width: 0;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
& [data-line-number-content] {
|
|
1036
|
+
display: none;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
& [data-gutter-utility-slot] {
|
|
1040
|
+
right: unset;
|
|
1041
|
+
justify-content: flex-start;
|
|
1042
|
+
left: 0;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
1046
|
+
left: 6px;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
[data-file][data-disable-line-numbers] {
|
|
1051
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1052
|
+
border-right: 0;
|
|
1053
|
+
min-width: 0;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
[data-diff-span] {
|
|
1058
|
+
box-decoration-break: clone;
|
|
1059
|
+
border-radius: 3px;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
[data-line-type="change-addition"] [data-diff-span] {
|
|
1063
|
+
background-color: var(--diffs-bg-addition-emphasis);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
[data-line-type="change-deletion"] [data-diff-span] {
|
|
1067
|
+
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
1071
|
+
color: var(--diffs-fg);
|
|
1072
|
+
padding-left: 1ch;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
1076
|
+
align-items: center;
|
|
1077
|
+
display: flex;
|
|
1078
|
+
|
|
1079
|
+
&:after {
|
|
1080
|
+
color: var(--diffs-fg-conflict-marker);
|
|
1081
|
+
font-size: .75rem;
|
|
1082
|
+
font-style: normal;
|
|
1083
|
+
line-height: 1.25rem;
|
|
1084
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1085
|
+
padding-left: 1ch;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
[data-merge-conflict="marker-start"]:after {
|
|
1090
|
+
content: "(Current Change)";
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
[data-merge-conflict="marker-end"]:after {
|
|
1094
|
+
content: "(Incoming Change)";
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
[data-merge-conflict-actions-content] {
|
|
1098
|
+
min-height: 1.75rem;
|
|
1099
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1100
|
+
color: var(--diffs-fg);
|
|
1101
|
+
align-items: center;
|
|
1102
|
+
gap: .25rem;
|
|
1103
|
+
padding-inline: .5rem;
|
|
1104
|
+
font-size: .75rem;
|
|
1105
|
+
line-height: 1.2;
|
|
1106
|
+
display: flex;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
[data-merge-conflict-action] {
|
|
1110
|
+
appearance: none;
|
|
1111
|
+
color: var(--diffs-fg-number);
|
|
1112
|
+
font: inherit;
|
|
1113
|
+
cursor: pointer;
|
|
1114
|
+
background: none;
|
|
1115
|
+
border: 0;
|
|
1116
|
+
padding: 0;
|
|
1117
|
+
font-style: normal;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
[data-merge-conflict-action]:hover {
|
|
1121
|
+
color: var(--diffs-fg);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
[data-merge-conflict-action="current"]:hover {
|
|
1125
|
+
color: var(--diffs-addition-base);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
[data-merge-conflict-action="incoming"]:hover {
|
|
1129
|
+
color: var(--diffs-modified-base);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
[data-merge-conflict-action-separator] {
|
|
1133
|
+
color: var(--diffs-fg-number);
|
|
1134
|
+
opacity: .6;
|
|
1135
|
+
user-select: none;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
[data-diffs-header="default"] {
|
|
1139
|
+
background-color: var(--diffs-bg);
|
|
1140
|
+
justify-content: space-between;
|
|
1141
|
+
align-items: center;
|
|
1142
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1143
|
+
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
1144
|
+
z-index: 2;
|
|
1145
|
+
flex-direction: row;
|
|
1146
|
+
padding-inline: 16px;
|
|
1147
|
+
display: flex;
|
|
1148
|
+
position: relative;
|
|
1149
|
+
top: 0;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
[data-header-content] {
|
|
1153
|
+
align-items: center;
|
|
1154
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1155
|
+
white-space: nowrap;
|
|
1156
|
+
flex-direction: row;
|
|
1157
|
+
min-width: 0;
|
|
1158
|
+
display: flex;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
1162
|
+
text-overflow: ellipsis;
|
|
1163
|
+
white-space: nowrap;
|
|
1164
|
+
direction: rtl;
|
|
1165
|
+
min-width: 0;
|
|
1166
|
+
overflow: hidden;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
[data-prev-name] {
|
|
1170
|
+
opacity: .7;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
[data-rename-icon] {
|
|
1174
|
+
fill: currentColor;
|
|
1175
|
+
flex-grow: 0;
|
|
1176
|
+
flex-shrink: 0;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
[data-diffs-header="default"] [data-metadata] {
|
|
1180
|
+
white-space: nowrap;
|
|
1181
|
+
align-items: center;
|
|
1182
|
+
gap: 1ch;
|
|
1183
|
+
display: flex;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
[data-diffs-header="default"] [data-additions-count] {
|
|
1187
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1188
|
+
color: var(--diffs-addition-base);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
[data-diffs-header="default"] [data-deletions-count] {
|
|
1192
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1193
|
+
color: var(--diffs-deletion-base);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
[data-change-icon] {
|
|
1197
|
+
fill: currentColor;
|
|
1198
|
+
flex-shrink: 0;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
1202
|
+
color: var(--diffs-modified-base);
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
[data-change-icon="new"] {
|
|
1206
|
+
color: var(--diffs-addition-base);
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
[data-change-icon="deleted"] {
|
|
1210
|
+
color: var(--diffs-deletion-base);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
[data-change-icon="file"] {
|
|
1214
|
+
opacity: .6;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
[data-annotation-content] {
|
|
1218
|
+
z-index: 2;
|
|
1219
|
+
isolation: isolate;
|
|
1220
|
+
white-space: normal;
|
|
1221
|
+
align-self: flex-start;
|
|
1222
|
+
min-width: 0;
|
|
1223
|
+
display: flow-root;
|
|
1224
|
+
position: relative;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
1228
|
+
width: var(--diffs-column-content-width, auto);
|
|
1229
|
+
left: var(--diffs-column-number-width, 0);
|
|
1230
|
+
position: sticky;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
[data-annotation-slot] {
|
|
1234
|
+
text-wrap-mode: wrap;
|
|
1235
|
+
word-break: normal;
|
|
1236
|
+
white-space-collapse: collapse;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
[data-gutter-utility-slot] {
|
|
1240
|
+
touch-action: none;
|
|
1241
|
+
justify-content: flex-end;
|
|
1242
|
+
display: flex;
|
|
1243
|
+
position: absolute;
|
|
1244
|
+
top: 0;
|
|
1245
|
+
bottom: 0;
|
|
1246
|
+
right: 0;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
[data-utility-button] {
|
|
1250
|
+
appearance: none;
|
|
1251
|
+
cursor: pointer;
|
|
1252
|
+
width: 1lh;
|
|
1253
|
+
height: 1lh;
|
|
1254
|
+
font-size: var(--diffs-font-size, 13px);
|
|
1255
|
+
line-height: var(--diffs-line-height, 20px);
|
|
1256
|
+
background-color: var(--diffs-modified-base);
|
|
1257
|
+
color: var(--diffs-bg);
|
|
1258
|
+
fill: currentColor;
|
|
1259
|
+
z-index: 4;
|
|
1260
|
+
touch-action: none;
|
|
1261
|
+
border: none;
|
|
1262
|
+
border-radius: 4px;
|
|
1263
|
+
justify-content: center;
|
|
1264
|
+
align-items: center;
|
|
1265
|
+
margin-right: calc(-1lh + 1ch);
|
|
1266
|
+
padding: 0;
|
|
1267
|
+
display: flex;
|
|
1268
|
+
position: relative;
|
|
1269
|
+
|
|
1270
|
+
&:before {
|
|
1271
|
+
content: "";
|
|
1272
|
+
display: block;
|
|
1273
|
+
position: absolute;
|
|
1274
|
+
inset: 0 0 0 -4px;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
[data-decoration-bar-stack] {
|
|
1279
|
+
pointer-events: none;
|
|
1280
|
+
isolation: isolate;
|
|
1281
|
+
z-index: 1;
|
|
1282
|
+
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
1283
|
+
box-sizing: content-box;
|
|
1284
|
+
border-left: 2px solid var(--diffs-bg);
|
|
1285
|
+
border-right: 2px solid var(--diffs-bg);
|
|
1286
|
+
width: 6px;
|
|
1287
|
+
position: absolute;
|
|
1288
|
+
top: 0;
|
|
1289
|
+
bottom: 0;
|
|
1290
|
+
right: -2px;
|
|
1291
|
+
|
|
1292
|
+
[data-decoration-bar-depth="1"] & {
|
|
1293
|
+
background-color: color-mix(in lab,
|
|
1294
|
+
var(--diffs-bg) 20%,
|
|
1295
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
[data-decoration-bar-depth="2"] & {
|
|
1299
|
+
background-color: color-mix(in lab,
|
|
1300
|
+
var(--diffs-bg) 45%,
|
|
1301
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
[data-decoration-bar-depth="3"] & {
|
|
1305
|
+
background-color: color-mix(in lab,
|
|
1306
|
+
var(--diffs-bg) 65%,
|
|
1307
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
[data-decoration-bar-start] & {
|
|
1311
|
+
border-top-left-radius: 5px;
|
|
1312
|
+
border-top-right-radius: 5px;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
[data-decoration-bar-end] & {
|
|
1316
|
+
z-index: 3;
|
|
1317
|
+
border-bottom-right-radius: 5px;
|
|
1318
|
+
border-bottom-left-radius: 5px;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
[data-placeholder] {
|
|
1323
|
+
contain: strict;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
[data-error-wrapper] {
|
|
1327
|
+
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1328
|
+
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1329
|
+
scrollbar-width: none;
|
|
1330
|
+
max-height: 400px;
|
|
1331
|
+
overflow: auto;
|
|
1332
|
+
|
|
1333
|
+
& [data-error-message] {
|
|
1334
|
+
color: var(--diffs-deletion-base);
|
|
1335
|
+
font-size: 18px;
|
|
1336
|
+
font-weight: bold;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
& [data-error-stack] {
|
|
1340
|
+
color: var(--diffs-fg-number);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
@layer theme, rendered, unsafe;
|
|
1346
|
+
`,Ga;function Ka(e){if(Ga!=null)return Ga;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(Ae,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),Ga=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),Ga}function qa(e){return`${et}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var Ja=`@layer base, theme, rendered, unsafe;`,Ya=RegExp(`${$a(et)}\\s*:\\s*[^;]+;`);function Xa(e){return`${Ja}
|
|
1347
|
+
@layer unsafe {
|
|
1348
|
+
${e}
|
|
1349
|
+
}`}function Za(e,t=`system`,n){return`${Ja}
|
|
1350
|
+
@layer rendered {
|
|
1351
|
+
:host {${t===`system`?``:`
|
|
1352
|
+
color-scheme: ${t};`}
|
|
1353
|
+
${qa(n)}
|
|
1354
|
+
${e}
|
|
1355
|
+
}
|
|
1356
|
+
}`}function Qa(e,t){let n=qa(t);return e.replace(Ya,n)}function $a(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function eo({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function to(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function no(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function ro(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function io(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function ao(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:io(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function oo(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function so({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=co(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function co(){let e=document.createElement(`style`);return e.setAttribute(xe,``),e}var lo=void 0,uo=void 0;function fo(){return lo??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(mo())}function po(){return uo??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function mo(){let e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??`unknown`}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(Wa)),t.adoptedStyleSheets=[e]}connectedCallback(){Ka(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Qe,t)}var ho=[``],go=-1,_o=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++go}`;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;renderRange;enabled=!0;editor;constructor(e={theme:K},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Pa(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new aa,this.interactionManager=new zi(`file`,Bi(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}__getCurrentFile(){return this.file}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Bi(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&&!Be(this.appliedThemeCSS.theme,this.options.theme??K)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}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.lineAnnotations.length>0}cleanUp(e=!1){this.emitPostRender(!0),this.editor?.cleanUp(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.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),vo(this.pre,i,this.options.collapsed)||yo(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),to(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(ao(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?ho:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.file,r=this.lineAnnotations,i=this.renderRange;e!=null&&t!=null&&n!=null&&this.fileRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.file!==n||e.__syncRenderView(a,t,n,r,i)})}attachEditor(e){this.editor?.cleanUp(),this.editor=e,this.fileRenderer.beginEditSession();let t=this.file==null?void 0:e.__prepareFile?.(this.file);return t!==void 0&&t!==this.file?this.renderPreparedFile({file:t,forceRender:!0,preventEmit:!0,renderRange:this.renderRange}):this.fileRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),()=>{this.editor=void 0,this.fileRenderer.endEditSession()}}applyDocumentChange(e,t){this.fileRenderer.applyDocumentChange(e),t!=null&&t!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(t),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(e,t,n){this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render(e){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);let t=this.editor?.__prepareFile?.(e.file)??e.file;return this.renderPreparedFile(t===e.file?e:{...e,file:t})}renderPreparedFile({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){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.lineAnnotations.length>0)&&o!==this.lineAnnotations,m=!W(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e);if(!c&&!n&&ha(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(ao(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(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 n=this.fileRenderer.renderFile(e,nt);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;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||rt(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;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${wa(r)}`,a=this.annotationCache.get(i);if(a==null||!La(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Va(wa(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Ha();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??=Ua(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Xa(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??K,s=typeof o==`string`?o:{...o},c=Ka(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=so({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Za(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=Qa(this.themeCSSStyle.textContent??``,Ka(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&po()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=eo({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=ft(i.children),t.style.cssText=i.properties.style}else n.innerHTML=ft(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?oo(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.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=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,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){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??ft(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,Ee,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,it,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Pe,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,ot,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:ro(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ro(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=Ia;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};Ra(i,this.appliedPreAttributes)||(no(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 vo(e,t,n=!1){return!n&&e==null&&t!=null}function yo(e,t,n=!1){return e==null&&t!=null&&!n}var bo=5e3,xo=-1;function So(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 Co=class extends _o{virtualizer;metrics;__id=`virtualized-file:${++xo}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=we,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=zt(e);!t&&Vr(this.metrics,n)||(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>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=!Hr(t,e),r=So(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.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.file==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;let n=this.code.children[1];if(!(n instanceof HTMLElement))return e;let r=Da(this.lineAnnotations);if(this.renderRange!=null&&r&&ka(this.renderRange)){let t=wo(n)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!r&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of n.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let r=Number(n),i=t.getBoundingClientRect().height,a=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(a=!0),i+=t.nextElementSibling.getBoundingClientRect().height);let o=this.getLineHeight(r,a);i!==o&&(e=!0,i===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(r):this.cache.heights.set(r,i))}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}));prepareCodeViewItem(e,t,n,r){let i=this.syncLineAnnotations(r),a=!W(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e),o=n?.resetFileLayoutCache===!0||a||i;n?.metrics!=null&&(this.metrics=n.metrics,o=!0);let{collapsed:s=!1}=this.options;return this.currentCollapsed!==s&&(this.currentCollapsed=s,o=!0),o&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){if(this.file==null||e<1)return;let{disableFileHeader:t=!1,collapsed:n=!1}=this.options,r=this.fileRenderer.getLineCount(this.file)-1,i=Ne(this.metrics,t);if(n||r<0)return{top:i,height:0};let a=Math.min(Math.max(e-1,0),r),{overflow:o=`scroll`}=this.options,{lineHeight:s}=this.metrics;if(i+=this.cache.fileAnnotationHeight,o===`scroll`&&!this.hasLineAnnotations())return{top:i+a*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(a);i=c?.top??i;for(let e=c?.lineIndex??0;e<a;e++)i+=this.getLineHeight(e,!1);return{top:i,height:this.getLineHeight(a,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;let{disableFileHeader:t=!1,collapsed:n=!1,overflow:r=`scroll`}=this.options;if(n||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(this.file)-1;if(i<0)return;let a=Ne(this.metrics,t),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(r===`scroll`&&!this.hasLineAnnotations()){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){if(this.top==null||this.file==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.file,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1,t=this.file){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}let{disableFileHeader:i=!1,collapsed:a=!1,overflow:o=`scroll`}=this.options,{lineHeight:s}=this.metrics,c=this.fileRenderer.getLineCount(t),l=Ne(this.metrics,i),u=at(this.metrics);if(this.height+=l,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,o===`scroll`&&!this.hasLineAnnotations())this.height+=c*s;else for(let e=0;e<c;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(c>0&&(this.height+=u),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(){!this.enabled||this.file==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!==void 0&&this.file!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.file,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}renderPreparedFile({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=this.file==null||!W(this.file,t)||this.fileRenderer.hasUnkeyedFileContentsChanged(t),{forceRenderOverride:o,isSetup:s}=this;this.forceRenderOverride=void 0;let c=this.syncLineAnnotations(r);if(c&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),t==null)return console.error(`VirtualizedFile.render: attempting to virtually render when we dont have file`),!1;if(s)this.top??=this.getVirtualizedTop(),a&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!1),this.computeApproximateSize(!1,t));else{this.computeApproximateSize(!1,t);let n=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(n==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);n.connect(e,this),this.isVisible=n.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!s))return this.file=t,a&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let l=this.virtualizer.getWindowSpecs(),u=this.top??0,d=this.computeRenderRangeFromWindow(t,u,l),f=super.renderPreparedFile({file:t,fileContainer:e,renderRange:d,lineAnnotations:r,forceRender:(o??n)||c||a,...i});return this.isSimpleMode()&&f&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),f}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%bo===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,overflow:a=`scroll`}=this.options,{hunkLineCount:o,lineHeight:s}=this.metrics,c=this.fileRenderer.getLineCount(e),l=this.height,u=Ne(this.metrics,i),d=c>0?at(this.metrics):0,{fileAnnotationHeight:f}=this.cache,p=u+f,m=Math.max(0,l-u-f-d),h=Da(this.lineAnnotations),g=t+u,_=f>0&&h&&g<r&&g+f>n;if(t<n-l||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d};if(c<=o)return{startingLine:0,totalLines:o,bufferBefore:0,bufferAfter:0};let v=Math.ceil(Math.max(r-n,0)/s),y=Math.ceil(v/o)*o+o,b=y/o,x=(n+r)/2;if(a===`scroll`&&!this.hasLineAnnotations()){let e=t+p,i=e+m;if(!_&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d};let a=Math.floor(_&&x<t+p?0:(x-(t+p))/s),h=Math.floor(a/o)-Math.floor(b/2),g=Math.ceil(c/o),v=Math.max(0,Math.min(h,g))*o,S=h<0?y+h*o:y,C=v===0?0:f+v*s,w=Math.min(S,c-v);return{startingLine:v,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(c-v-w)*s)}}let S=b,C=[],w=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-y*s*2),o),T=t+(w?.top??p),E=w?.lineIndex??0,D,O,k,A=w?.lineIndex??0;for(let e=A;e<c;e++){let i=E%o===0,a=Math.floor(E/o);if(i&&(C[a]=T-(t+p),k!=null)){if(k<=0)break;k--}let s=this.getLineHeight(e,!1);T>n-s&&T<r&&(D??=a),T+s>x&&(O??=a),k==null&&T>=r&&i&&(k=S),E++,T+=s}if(D==null){if(_)D=0,O=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d}}O??=D;let j=Math.round(O-b/2),M=Math.max(0,Math.ceil(c/o)-b),N=Math.max(0,Math.min(j,M)),P=N*o,F=j<0?y+j*o:y,I=C[N]??0,L=P===0?0:f+I,ee=N+F/o,R=ee<C.length?m-C[ee]:m-(T-t-p);return{startingLine:P,totalLines:F,bufferBefore:L,bufferAfter:Math.max(0,R)}}};function wo(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Ea&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function To(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function Eo(e){return e===``?[]:e.split(qe)}function Do(e,t,n){let r=e===`clone`?To(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Oo(r,Ao(r,n),jo(r,n));case`rename-pure`:{let e=jo(r,n);Mo(r,n);let t=Eo(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,Po(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Oo(e,t,n){let r=Eo(t.contents),i=Eo(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=ko(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,Po(e,t,n),e}function ko(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Se(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=Dt(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=Dt(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function Ao(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function jo(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Mo(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function No(e,t,n){return e.cacheKey==null?Fo(t,n):`${e.cacheKey}:hydrated`}function Po(e,t,n){let r=No(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function Fo(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var Io=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function Lo(e){return q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Ro(e){return q({tagName:`div`,children:[q({tagName:`span`,children:[G(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function zo(e){return q({tagName:`div`,children:[Xe({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function Bo({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(q({tagName:`div`,children:[G(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(zo(`up`)),s++),o||(e.push(zo(`down`)),s++)):(e.push(zo(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(q({tagName:`div`,children:[q({tagName:`span`,children:[G(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(q({tagName:`div`,children:[G(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(q({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(q({tagName:`slot`,properties:{name:i}})),q({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function Vo(e,t){return`hunk-separator-${e}-${t}`}function Ho(e){let t=e.at(-1);return t==null?0:Math.max(Dt(t.additionStart,t.additionCount),Dt(t.deletionStart,t.deletionCount))}function Uo(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Wo(e,t){let n=Pi({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Go(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function Ko(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function qo(e,t){return t.length>0&&t.length<e.deletionLines.length&&Ko(t)}function Jo(e,t,n){let r=e.deletionLines.join(``),i=Go(t.length,r),a=Pi({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Yo(e,t){return Jo(e,[``],t)}function Xo(e,t){if(e.additionLines.length===0)return Yo(e,t);if(qo(e,e.additionLines))return Jo(e,e.additionLines,t);let n=e.additionLines,r=Wo(e,t);return Qo(r,n),r}function Zo(e){return e.length>1&&e.at(-1)===``}function Qo(e,t){if(!Zo(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&Dt(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,cs(e);return}}}function $o(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return es(e,Wo(e,n));let r=Array.from(t);if(r.length===0)return es(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||Et(r)===Et(i))return es(e,Wo(e,n))}let i=ts(e,r);if(i.size===0)return es(e,Wo(e,n));for(let t of i)if(!rs(e,t,n))return es(e,Wo(e,n));return cs(e),Ze(e)?es(e,Wo(e,n)):es(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function es(e,t){return Object.assign(e,t),t}function ts(e,t){let n=new Set;for(let r of t){let t=ns(e,r);if(t==null)return new Set;n.add(t)}return n}function ns(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function rs(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=Pi({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(as(r,s),is(e,t),!0)}function is(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
1357
|
+
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
1358
|
+
`)}function as(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>os(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,ss(e)}function os(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function ss(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function cs(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Se(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,ss(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=Dt(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-Dt(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var ls=new WeakMap;function us(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function ds(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function fs(e,t){let n=e.hunks,r=e.additionLines,i=us(r),a=i===r?e:{...e,additionLines:i},o=Ss(n,xs(a,t),e.deletionLines.length),s=Ts(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Fs(e),Qo(e,r),Os(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function ps(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<js(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:js(r);if(i==null||t<i||o!=null&&o!==s)return fs(e,n);o=s}if(o!=null){if(ms(e,i,o,r,n)){e.editSessionDirty=!0;return}return fs(e,n)}}function ms(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=hs(e),o=e.hunks[n];if(o.hunkContent.some(gs))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function hs(e){let t=ls.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return ls.set(e,{lines:e.deletionLines,set:n}),n}function gs(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function _s(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function vs(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=je({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Ms(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=$e({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=Ms(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function ys(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=Ms(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,Ms(i)+i.deletionCount,e.deletionLines.length),n}function bs(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Wo(e,t):Xo(e,t)),!0)}function xs(e,t){if(ds(e.deletionLines,e.additionLines)==null)return[];let n=Pi({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=os(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function Ss(e,t,n){let r=e.map((e,t)=>{let n=Ms(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&Cs(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=ws(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function Cs(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function ws(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function Ts(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);Ds(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);Ds(s,c,i,r),r+=c,i+=c,n.push(Es(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function Es(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:Ns(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Ps(t.additionStart,r),deletionStart:Ns(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Ps(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Ns(t.deletionStart,i)},${i} +${Ns(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return ss(s),s}function Ds(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Os(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(Ms(r)!==Ms(i)||r.deletionCount!==i.deletionCount||js(r)!==js(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!ks(r,i))return!0}return!1}function ks(e,t){let n=As(e),r=As(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*As(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function js(e){return Se(e.additionStart,e.additionCount)}function Ms(e){return Se(e.deletionStart,e.deletionCount)}function Ns(e,t){return t===0?e:e+1}function Ps(e,t){return t===0?e-1:e}function Fs(e){cs(e);for(let t=0;t<e.hunks.length;t++)is(e,t)}var Is=-1,Ls=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Is}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:K},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=ma(e.theme??K)?Mt():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,Yo(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||Ve(e.diff)||Qs(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);De(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Me}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=Et(l);c&&(i.additionLines[t]=Aa(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})}}let c=!1;if(o.length>0){if(this.editSessionActive&&!i.isPartial){if(!n){if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,Yo(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(qo(i,i.additionLines))Object.assign(i,Jo(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=ps(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}}else Object.assign(i,$o(i,o,this.options.parseDiffOptions))}return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=_s(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=Ys(e,r),n.code.additionLines=qs(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,Yo(t,this.options.parseDiffOptions)),n.code.additionLines[0]=Js(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,Xo(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(qo(e,n)){Object.assign(e,Jo(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(fs(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>ga(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=K,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=an,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await wt(Ca(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Qs(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!De(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!Ve(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??Zt(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??K}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Fe(e,n.diff)||!De(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Re){if(e==null)return;let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||Ve(e)||Qs(e,this.getTokenizeMaxLength()),l=!Fe(e,this.renderCache.diff),u=!ha(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&Uo(t);o&&(this.renderCache.highlightPending=!0),!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Uo(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??Zt(e.name);let t=this.highlighter!=null&&ma(i.theme),n=this.highlighter!=null&&pa(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Re){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return xa({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Qs(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Zt(e.name);let n=this.highlighter!=null&&ma(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&pa(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=We(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(Te({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Js(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!De(this.renderCache.options,n)||!Fe(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!De(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Fe(e,n.diff)&&De(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1;this.diff=e;let f=a===`unified`,p=$s(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:U(),deletionsGutterAST:U(),additionsGutterAST:U(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=Ce({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,en(void 0,`buffer`,this.size)),h?.push(Lo(this.size))):(x.pushToGutter(`deletions`,en(void 0,`buffer`,this.size)),g?.push(Lo(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,Ye(t,n,r,i))};function T(e){C.flush(),a===`unified`?Ws(`unified`,e,x):(Ws(`deletions`,e,x),Ws(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Te({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Vs(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Gs(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Gs(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Us({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Vs(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Hs(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=Gs(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Gs(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Us({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Hs(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(Ro(e)),x.pushToGutter(`unified`,en(e,`metadata`,1))):(x.deletionsContentAST.push(Ro(e)),x.pushToGutter(`deletions`,en(e,`metadata`,1)),k||(x.pushToGutter(`additions`,en(void 0,`buffer`,1)),x.additionsContentAST.push(Lo(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(Ro(e)),x.pushToGutter(`unified`,en(e,`metadata`,1))):(x.additionsContentAST.push(Ro(e)),x.pushToGutter(`additions`,en(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,en(void 0,`buffer`,1)),x.deletionsContentAST.push(Lo(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(Ho(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=U(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,ja(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return ft(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ft(t==null?e:q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!ka(n))return;let i=e.type===`new`?[]:Rs(Oa(this.deletionAnnotations)),a=e.type===`deleted`?[]:Rs(Oa(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Us({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Us({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(wa(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(wa(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return va({fileOrDiff:e,mode:t,stickyHeader:n})}};function Rs(e){return e?.map(e=>wa(e))??[]}var zs=new Intl.PluralRules(`en-US`);function Bs(e){return`${e} unmodified line${zs.select(e)===`one`?``:`s`}`}function Vs(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Hs(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Us({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,en(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,en(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,en(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Ws(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,Bo({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Bo({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Bo({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Bo({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Vo(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Bs(n):`More unchanged context may be available`;c.pushToGutter(e,Bo({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Bo({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Gs(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function Ks(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function qs(e,t,n,r){let i=Ks(e),a=Ks(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=Js(e,r.getLineText(e));return l}function Js(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Ys(e,t){let n=[],r=Zs(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!Xs(i)?i+r:i)}return n}function Xs(e){return e.endsWith(`
|
|
1359
|
+
`)||e.endsWith(`\r`)}function Zs(e){for(let t of e){if(t.endsWith(`\r
|
|
1360
|
+
`))return`\r
|
|
1361
|
+
`;if(t.endsWith(`
|
|
1362
|
+
`))return`
|
|
1363
|
+
`;if(t.endsWith(`\r`))return`\r`}return`
|
|
1364
|
+
`}function Qs(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function $s(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function ec(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function tc(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function nc(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function rc({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function ic(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:io(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function ac(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var oc=-1,sc=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++oc}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:K},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new aa,this.scrollSyncManager=new Io,this.interactionManager=new zi(`diff`,Bi(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return ic(e)}createHunksRenderer(e){return new Ls(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=Se(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`){if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}c+=n.lines,l+=n.lines,u+=n.lines}else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Bi(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Be(this.appliedThemeCSS.theme,this.options.theme??K)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.lineAnnotations.length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){zr(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=rc(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),dc(this.pre,lc({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||fc(this.headerElement,uc({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),to(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Pi(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!ac(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(Do(`merge`,e,t),this.setHydratedState(t),await nc(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=rc(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!cc(u,this.deletionFile)||!cc(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&ha(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Pi(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(bs(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,nt);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||Uo(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Te({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=vs(e,this.hunksRenderer.getExpandedHunksMap(),t);return bs(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(ys(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return tt({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return rn({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=Le(o);if(e<s){let c=je({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=$e({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=Le(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){Rr(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Ve(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!tc(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${wa(r)}`,a=this.annotationCache.get(i);if(a==null||!ec(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Va(wa(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Ha();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:ro(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ro(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=Ia;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??ft(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Ee,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,it,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Pe,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,ot,u),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Ua(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Xa(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??K,s=typeof o==`string`?o:{...o},c=Ka(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=so({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Za(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=Qa(this.themeCSSStyle.textContent??``,Ka(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&po()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?oo(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=pc(t[0]),a=pc(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=ft(i),r.content.innerHTML=ft(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=eo({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=eo({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=eo({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=pc(r?.[0]),a=pc(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=pc(n?.[0]),i=pc(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=ft(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?oo(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=pc(t[0]),i=pc(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};Ra(u,this.appliedPreAttributes)||(no(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function cc(e,t){return e==null||t==null?e==null&&t==null:W(e,t)}function lc({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function uc({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function dc(e,t,n=!1){return!n&&e==null&&t}function fc(e,t,n=!1){return e==null&&t&&!n}function pc(e){if(e!=null&&e.type===`element`)return e.children??[]}function mc({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Ne(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=je({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=Je({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=hc(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?$e({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=ke({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=ke({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=at(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function hc(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return gc(e,t)}function gc(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var _c=3e3,vc=-1,yc=class extends sc{__id=`little-virtualized-file-diff:${++vc}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;currentExpandUnchanged;pendingHydratedDiff;pendingExpansions;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=zt(n)}setMetrics(e,t=!1){let n=zt(e);!t&&Vr(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!Da(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Hr(t,e),r=n&&Dc(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Oc(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&ka(this.renderRange)){let t=bc(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=Mc(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}prepareCodeViewItem(e,t,n,r){let i=!Fe(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=zt(n.metrics),o=!0,s=!0);let{collapsed:c=!1,expandUnchanged:l=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),this.currentExpandUnchanged!==l&&(this.currentExpandUnchanged=l,o=!0,s=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=Ne(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return Te({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=Je({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=ke({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??Ne(this.metrics,t)+this.cache.fileAnnotationHeight,l;return Te({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=Je({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=ke({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=Do(`clone`,e,t);if(await nc(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Do(`merge`,e,t),this.setHydratedState(t),await nc(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e)return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}consumeCodeViewLayoutChanges(e){let t=!1,n,{pendingExpansions:r,pendingHydratedDiff:i}=this;if(r!=null){this.pendingExpansions=void 0;for(let e of r)this.hunksRenderer.expandHunk(e.hunkIndex,e.direction,e.expansionLineCountOverride),t=!0}return i!=null&&(this.pendingHydratedDiff=void 0,i.expectedDiff===e&&(this.setHydratedState(i.files),n=i.nextDiff)),n==null?t&&(this.forceRenderOverride=!0,this.invalidateDerivedLayoutCache(!0)):(this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0})),n}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.fileDiffCache;if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return tt({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!==void 0&&this.fileDiff!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.fileDiff){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=Ne(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getActiveEstimatedHeight(e=this.fileDiff){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.fileDiff){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=mc({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:kc(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.fileDiff){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=rc(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!jc(s,this.deletionFile)||!jc(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Pi(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=this.syncLineAnnotations(r);p&&this.resetLayoutCache({includeEstimatedHeights:!1});let m=t!=null&&t!==this.fileDiff,h=u!=null&&!Fe(this.fileDiff,u),g=m||l;if(h&&this.resetLayoutCache({includeEstimatedHeights:!0}),e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(f)this.top??=this.getVirtualizedTop(),h&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,u));else{this.computeApproximateSize(!1,u);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!g||!f))return this.fileDiff=u,a!=null&&(this.deletionFile=s,this.additionFile=c),h&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let _=this.virtualizer.getWindowSpecs(),v=this.top??0,y=this.computeRenderRangeFromWindow(u,v,_),b=super.render({fileDiff:u,fileContainer:e,renderRange:y,lineAnnotations:r,forceRender:(d??n)||p||h,...a,...i});return this.isSimpleMode()&&b&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),b}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Ac(this.options.hunkSeparators)}approximateLayoutCheckpoints(e=this.fileDiff){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e==null||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=kc(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=xc(this.cache.heightDeltas),u=Ne(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=wc(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Tc(i,e)*this.metrics.lineHeight+Sc(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=_c}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Sc(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=je({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?Je({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?$e({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?ke({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:Ec({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=je({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=$e({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=kc(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Ne(this.metrics,i),h=e.hunks.length>0?at(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(Te({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?Je({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=ke({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null){if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}M??=j;let P=Math.round(M-w/2),F=Math.max(0,Math.ceil(p/s)-w),I=Math.max(0,Math.min(P,F)),L=I*s,ee=P<0?C+P*s:C,R=E[I]??0,te=L===0?0:g+R,ne=I+ee/s,re=ne<E.length?v-E[ne]:v-(k-t-_);return{startingLine:L,totalLines:ee,bufferBefore:te,bufferAfter:Math.max(0,re)}}};function bc(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Ea&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function xc(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function Sc({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Cc(e,n);return(t[Cc(e,r)]??0)-(t[i]??0)}function Cc(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function wc(e){return Math.ceil(e/_c)*_c}function Tc(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Ec({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Dc(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Oc(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function kc(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ac(e){return typeof e==`function`?`custom`:e??`line-info`}function jc(e,t){return e==null||t==null?e==null&&t==null:W(e,t)}function Mc(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Nc({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Pc(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Fc(n,e.startContentIndex)}}function Fc(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function Ic(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var Lc=1e3,Rc=Lc*4,zc=[0,1e-6,.99999,1],Bc={overscrollSize:Lc,intersectionObserverMargin:Rc,resizeDebugging:!1},Vc=0,Hc=-1,Uc=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++Hc}`;config;type=`simple`;intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Bc,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:zc,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),Rr(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),Rr(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),Rr(this.computeRenderRangeAndEmit)}requestHeightReconcile(e){this.reconcileQueue.add(e),Rr(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=Gr({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: content size change`,this.__id,{sizeChange:e-Vc,newSize:e}),Vc=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: scroller size change`,this.__id,{sizeChange:e-Vc,newSize:e}),Vc=e))}t&&Rr(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw Error(`Virtualizer.setupWindow: Invalid setup method`);window.addEventListener(`scroll`,this.handleWindowScroll,{passive:!0}),window.addEventListener(`resize`,this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw Error(`Virtualizer.setupElement: Invalid setup method`);this.root.addEventListener(`scroll`,this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){zr(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleElementScroll),window.removeEventListener(`scroll`,this.handleWindowScroll),window.removeEventListener(`resize`,this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(e){return this.getScrollTop()+Wc(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error(`Virtualizer.connect: instance is already connected...`);return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),Rr(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.instancesChanged.delete(t),this.reconcileQueue.delete(t),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),Rr(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,Rr(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{e.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,Rr(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,Rr(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty,n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let e=Gr({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&Ic(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),i=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&i.add(e);for(let e of this.instancesChanged)i.has(e)||e.onRender(t)&&i.add(e);this.scrollFix(r);for(let e of i)this.reconcileQueue.delete(e),e.reconcileHeights();for(let e of this.reconcileQueue)e.reconcileHeights()&&(n=!0);this.reconcileQueue.clear(),n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&Rr(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=Wc(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=Wc(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:`instant`}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:`instant`}),this.markDOMDirty()}getScrollAnchor(e){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=Wc(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=Wc(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);e!=null&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&Rr(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=this.clampScrollTop(e),this.scrollTop=e,e}scrollTo({top:e,behavior:t=`auto`}){let{root:n}=this;if(n==null)return;let r=this.clampScrollTop(e);n instanceof Document?window.scrollTo({top:r,behavior:t}):n.scrollTo({top:r,behavior:t}),this.scrollDirty=!0,Rr(this.computeRenderRangeAndEmit)}clampScrollTop(e){return Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function Wc(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}var X=re(),Z=N();function Gc(e){let t=(0,X.c)(56),{entry:n,running:r}=e,i=n.rawCommand??n.command,a;t[0]===n?a=t[1]:(a=Ht(n),t[0]=n,t[1]=a);let o=a,s,c,l,u;t[2]!==n.label||t[3]!==n.toolTitle||t[4]!==i||t[5]!==r||t[6]!==o?(s=i?Ft(i,o===`running`&&r):null,c=n.toolTitle??n.label,l=/^(read|readfile|read_file)$/i.test(c),u=s?.verb.toLowerCase().includes(`search`)||/search|grep|glob/i.test(c),t[2]=n.label,t[3]=n.toolTitle,t[4]=i,t[5]=r,t[6]=o,t[7]=s,t[8]=c,t[9]=l,t[10]=u):(s=t[7],c=t[8],l=t[9],u=t[10]);let d=u?un:l||s?.verb===`Read`?fe:s?mn:_n,f=s?.verb??(l?`Read`:c),p;t[11]!==s?.target||t[12]!==n.changedFiles||t[13]!==n.detail?(p=s?.target??n.changedFiles?.join(`, `)??n.detail,t[11]=s?.target,t[12]=n.changedFiles,t[13]=n.detail,t[14]=p):p=t[14];let m=p,h=o===`running`?r?`Running`:`No completion received`:o===`failed`?`Failed`:`Completed`,g;t[15]===n?g=t[16]:(g=qt(n),t[15]=n,t[16]=g);let _=g,v;t[17]===d?v=t[18]:(v=(0,Z.jsx)(d,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),t[17]=d,t[18]=v);let y;t[19]!==f||t[20]!==m?(y=m&&m!==f?(0,Z.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` · `,m]}):null,t[19]=f,t[20]=m,t[21]=y):y=t[21];let b;t[22]!==f||t[23]!==y?(b=(0,Z.jsxs)(`span`,{className:`block break-words font-medium`,children:[f,y]}),t[22]=f,t[23]=y,t[24]=b):b=t[24];let x=o===`failed`?`text-destructive`:`text-muted-foreground/70`,S=_?` · ${_}`:``,C;t[25]!==h||t[26]!==x||t[27]!==S?(C=(0,Z.jsxs)(`span`,{className:x,children:[h,S]}),t[25]=h,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;t[29]!==C||t[30]!==b?(w=(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[b,C]}),t[29]=C,t[30]=b,t[31]=w):w=t[31];let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground transition-transform group-open:rotate-90`,children:`›`}),t[32]=T):T=t[32];let E;t[33]!==w||t[34]!==v?(E=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-start gap-2 rounded px-1 py-2 text-xs outline-none hover:bg-accent/35 focus-visible:ring-2 focus-visible:ring-ring`,children:[v,w,T]}),t[33]=w,t[34]=v,t[35]=E):E=t[35];let D;t[36]===i?D=t[37]:(D=i?(0,Z.jsx)(`pre`,{"aria-label":`Command`,className:`overflow-auto whitespace-pre-wrap break-words rounded bg-muted/40 p-2 font-mono`,children:i}):null,t[36]=i,t[37]=D);let O;t[38]!==n.detail||t[39]!==i||t[40]!==m?(O=n.detail&&n.detail!==m&&n.detail!==i?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-muted-foreground`,children:n.detail}):null,t[38]=n.detail,t[39]=i,t[40]=m,t[41]=O):O=t[41];let k;t[42]!==n.output||t[43]!==r||t[44]!==o?(k=n.output?(0,Z.jsx)(`pre`,{"aria-label":`Tool output`,className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/30 p-2 font-mono leading-relaxed`,children:n.output}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:o===`running`&&r?`Waiting for tool output…`:`No output was captured for this tool.`}),t[42]=n.output,t[43]=r,t[44]=o,t[45]=k):k=t[45];let A;t[46]===n.exitCode?A=t[47]:(A=n.exitCode===void 0?null:(0,Z.jsxs)(`p`,{className:`font-mono text-muted-foreground`,children:[`Exit code `,n.exitCode]}),t[46]=n.exitCode,t[47]=A);let j;t[48]!==D||t[49]!==O||t[50]!==k||t[51]!==A?(j=(0,Z.jsxs)(`div`,{className:`space-y-2 pb-3 pl-6 text-xs`,children:[D,O,k,A]}),t[48]=D,t[49]=O,t[50]=k,t[51]=A,t[52]=j):j=t[52];let M;return t[53]!==E||t[54]!==j?(M=(0,Z.jsxs)(`details`,{"data-agent-tool":!0,className:`group min-w-0 border-b border-border/35 py-1 last:border-0`,children:[E,j]}),t[53]=E,t[54]=j,t[55]=M):M=t[55],M}function Kc(e){let t=(0,X.c)(10),{subagent:n,running:r}=e,i;t[0]===n?i=t[1]:(i=Fr(n),t[0]=n,t[1]=i);let a=i;if(a.length===0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`p-4 text-xs leading-relaxed text-muted-foreground`,children:`No detailed activity has been captured. Status and usage remain available when the provider reports them.`}),t[2]=e):e=t[2],e}let o;if(t[3]!==r||t[4]!==a){let e;t[6]===r?e=t[7]:(e=e=>e.kind===`tool`?(0,Z.jsx)(Gc,{entry:e.tool,running:r},e.id):(0,Z.jsx)(`article`,{"data-agent-message":!0,className:`min-w-0 border-l-2 border-border/50 py-2 pl-3 text-sm`,children:(0,Z.jsx)(jt,{text:e.message.text,cwd:void 0,isStreaming:!1})},e.id),t[6]=r,t[7]=e),o=a.map(e),t[3]=r,t[4]=a,t[5]=o}else o=t[5];let s;return t[8]===o?s=t[9]:(s=(0,Z.jsx)(`div`,{"data-agent-timeline":!0,className:`min-w-0 space-y-2 px-3 py-3`,children:o}),t[8]=o,t[9]=s),s}var qc={pending:{dotClass:`bg-info`,label:`Queued`},running:{dotClass:`bg-info`,label:`Running`},waiting:{dotClass:`bg-info`,label:`Waiting`},idle:{dotClass:`bg-muted-foreground/50`,label:`Idle · resumable`},completed:{dotClass:`bg-success`,label:`Completed`},failed:{dotClass:`bg-destructive`,label:`Failed`},cancelled:{dotClass:`bg-muted-foreground/60`,label:`Stopped`},interrupted:{dotClass:`bg-muted-foreground/60`,label:`Interrupted`}},Jc=(0,Y.createContext)({identities:new Map,onOpenAgent:null});function Yc(e){let t=(0,X.c)(4),{status:n}=e,r=qc[n],i;t[0]===r.dotClass?i=t[1]:(i=J(`size-1.5 shrink-0 rounded-full`,r.dotClass),t[0]=r.dotClass,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:i}),t[2]=i,t[3]=a),a}function Xc(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/60);if(n===0)return`${t}s`;let r=Math.floor(n/60);return r===0?`${n}m ${String(t%60).padStart(2,`0`)}s`:`${r}h ${String(n%60).padStart(2,`0`)}m`}function Zc(e,t){let n=Date.parse(e),r=t?Date.parse(t):Date.now();return Number.isNaN(n)||Number.isNaN(r)?``:Xc((r-n)/1e3)}function Qc(e){return e.usage?.durationMs===void 0?e.startedAt&&e.completedAt?Zc(e.startedAt,e.completedAt):null:Xc(e.usage.durationMs/1e3)}function $c(e){let t=(0,X.c)(12),{agent:n}=e,r=(0,Y.useRef)(null),i=n.status===`running`||n.status===`waiting`,a=n.startedAt,o,s;if(t[0]!==i||t[1]!==a?(o=()=>{if(!i||!a)return;let e=()=>{r.current&&(r.current.textContent=Zc(a,null))};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},s=[i,a],t[0]=i,t[1]=a,t[2]=o,t[3]=s):(o=t[2],s=t[3]),(0,Y.useEffect)(o,s),!i){let e;t[4]===n?e=t[5]:(e=Qc(n),t[4]=n,t[5]=e);let r=e,i;return t[6]===r?i=t[7]:(i=r?(0,Z.jsx)(`span`,{className:`tabular-nums`,children:r}):null,t[6]=r,t[7]=i),i}if(!a)return null;let c;t[8]===a?c=t[9]:(c=Zc(a,null),t[8]=a,t[9]=c);let l;return t[10]===c?l=t[11]:(l=(0,Z.jsx)(`span`,{ref:r,className:`tabular-nums`,children:c}),t[10]=c,t[11]=l),l}function el(e,t){return/^structured[\s_-]?output$/i.test(e)?t?`Delivering result`:`Delivered result`:t?`Using ${e}`:e}function tl(e){return e.status===`running`||e.status===`pending`||e.status===`waiting`?e.progress??(e.lastToolName?el(e.lastToolName,!0):null)??e.result??e.error:e.error??e.result??e.progress??(e.lastToolName?el(e.lastToolName,!1):null)}function nl(e){let t=(0,X.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`divide-y divide-border/30`,children:n}),t[0]=n,t[1]=r),r}function rl(e){let t=(0,X.c)(11),{title:n}=e,r=`${n} pending`,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`flex size-7 items-center justify-center rounded-lg border border-dashed border-border/60 bg-background/30 text-muted-foreground/55`,children:(0,Z.jsx)(de,{className:`size-3.5`})}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground/75`,children:n}),t[1]=n,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground/65`,children:`Waiting for this stage to start`}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[a,o]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[.68rem] text-muted-foreground/65`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-muted-foreground/40`}),`Pending`]}),t[6]=c):c=t[6];let l;return t[7]!==r||t[8]!==s||t[9]!==n?(l=(0,Z.jsxs)(`div`,{"data-workflow-pending-step":!0,"data-phase-title":n,"aria-label":r,className:`grid h-14 grid-cols-[1.75rem_minmax(0,1fr)_auto] items-center gap-x-2 rounded-md px-1.5 py-1 text-left`,children:[i,s,c]}),t[7]=r,t[8]=s,t[9]=n,t[10]=l):l=t[10],l}function il(e){let t=(0,X.c)(72),{agent:n}=e,{identities:r,onOpenAgent:i}=(0,Y.use)(Jc),a=qc[n.status],o;t[0]===n?o=t[1]:(o=tl(n),t[0]=n,t[1]=o);let s=o,c;t[2]!==n.effort||t[3]!==n.model?(c=D(n.model,n.effort),t[2]=n.effort,t[3]=n.model,t[4]=c):c=t[4];let l=c,u,d,f;t[5]!==n.id||t[6]!==n.title||t[7]!==r?(d=r.get(n.id),u=d?.codename??n.title,f=d?.role&&!M(d.role,u)&&!M(d.role,n.title)?d.role:null,t[5]=n.id,t[6]=n.title,t[7]=r,t[8]=u,t[9]=d,t[10]=f):(u=t[8],d=t[9],f=t[10]);let p=f,m=d?.taskLabel??n.title,h;t[11]===n.usage?h=t[12]:(h=n.usage?`${O(n.usage.totalTokens)} tok`:`— tok`,t[11]=n.usage,t[12]=h);let g=n.usage?.toolUses===void 0?null:`${n.usage.toolUses} tools`,_=n.activationCount>1?`run ${n.activationCount}`:null,v;t[13]!==l||t[14]!==h||t[15]!==g||t[16]!==_?(v=[l,h,g,_].filter(al),t[13]=l,t[14]=h,t[15]=g,t[16]=_,t[17]=v):v=t[17];let y=v,b=d?.avatarKey??n.id,x;t[18]===b?x=t[19]:(x=(0,Z.jsx)(Lt,{name:b,className:`size-5`}),t[18]=b,t[19]=x);let S;t[20]===n.status?S=t[21]:(S=(0,Z.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 grid size-2.5 place-items-center rounded-full bg-background ring-1 ring-background`,children:(0,Z.jsx)(Yc,{status:n.status})}),t[20]=n.status,t[21]=S);let C;t[22]!==S||t[23]!==x?(C=(0,Z.jsxs)(`span`,{"aria-hidden":!0,className:`relative col-start-1 row-span-3 row-start-1 mt-0.5 flex size-7 items-center justify-center rounded-lg border border-border/45 bg-background/45`,children:[x,S]}),t[22]=S,t[23]=x,t[24]=C):C=t[24];let w;t[25]===u?w=t[26]:(w=(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold tracking-[-0.01em]`,children:u}),t[25]=u,t[26]=w);let T;t[27]===p?T=t[28]:(T=p?(0,Z.jsx)(`span`,{className:`max-w-32 shrink-0 truncate rounded-sm border border-border/60 bg-background/40 px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:p}):null,t[27]=p,t[28]=T);let E;t[29]!==w||t[30]!==T?(E=(0,Z.jsxs)(`span`,{className:`col-start-2 row-start-1 flex min-w-0 items-center gap-1.5`,children:[w,T]}),t[29]=w,t[30]=T,t[31]=E):E=t[31];let k;t[32]===a.label?k=t[33]:(k=(0,Z.jsx)(`span`,{children:a.label}),t[32]=a.label,t[33]=k);let A;t[34]===n?A=t[35]:(A=(0,Z.jsx)($c,{agent:n}),t[34]=n,t[35]=A);let j;t[36]===n.status?j=t[37]:(j=n.status===`completed`?(0,Z.jsx)(V,{"aria-hidden":!0,className:`size-3 text-success`}):null,t[36]=n.status,t[37]=j);let N;t[38]!==k||t[39]!==A||t[40]!==j?(N=(0,Z.jsx)(`span`,{className:`col-start-3 row-start-1 min-w-14 text-right font-mono text-[.7rem] text-muted-foreground/80`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[k,A,j]})}),t[38]=k,t[39]=A,t[40]=j,t[41]=N):N=t[41];let P;t[42]===m?P=t[43]:(P=(0,Z.jsx)(`span`,{className:`col-start-2 col-end-4 row-start-2 block truncate text-[11px] text-foreground/65`,title:m,children:m}),t[42]=m,t[43]=P);let F=n.status===`failed`?`text-destructive-foreground`:`text-muted-foreground`,I;t[44]===F?I=t[45]:(I=J(`col-start-2 row-start-3 block min-w-0 truncate text-xs`,F),t[44]=F,t[45]=I);let L=s??a.label,ee=s??a.label,R;t[46]!==I||t[47]!==L||t[48]!==ee?(R=(0,Z.jsx)(`span`,{className:I,title:L,children:ee}),t[46]=I,t[47]=L,t[48]=ee,t[49]=R):R=t[49];let te=y.join(` · `),ne;t[50]===te?ne=t[51]:(ne=(0,Z.jsx)(`span`,{className:`col-start-3 row-start-3 max-w-40 truncate text-right font-mono text-[.68rem] tabular-nums text-muted-foreground/65`,children:te}),t[50]=te,t[51]=ne);let re;t[52]===a.label?re=t[53]:(re=(0,Z.jsx)(`span`,{className:`sr-only`,children:a.label}),t[52]=a.label,t[53]=re);let ie;t[54]!==C||t[55]!==E||t[56]!==N||t[57]!==P||t[58]!==R||t[59]!==ne||t[60]!==re?(ie=(0,Z.jsxs)(Z.Fragment,{children:[C,E,N,P,R,ne,re]}),t[54]=C,t[55]=E,t[56]=N,t[57]=P,t[58]=R,t[59]=ne,t[60]=re,t[61]=ie):ie=t[61];let z=ie,ae=i&&`hover:bg-accent/35 focus-visible:ring-2 focus-visible:ring-ring/50`,B;t[62]===ae?B=t[63]:(B=J(`grid h-[4.5rem] w-full grid-cols-[1.75rem_minmax(0,1fr)_auto] grid-rows-[1.375rem_1.125rem_1rem] items-center gap-x-2 rounded-md px-1.5 py-1 text-left outline-none transition-colors`,ae),t[62]=ae,t[63]=B);let oe=B,H;return t[64]!==n.id||t[65]!==oe||t[66]!==u||t[67]!==z||t[68]!==i||t[69]!==p||t[70]!==a.label?(H=i?(0,Z.jsx)(`button`,{type:`button`,className:oe,"data-agent-row":!0,"data-agent-id":n.id,onClick:()=>i(n.id),"aria-label":`Open ${u}${p?`, ${p}`:``} transcript. ${a.label}.`,children:z}):(0,Z.jsx)(`div`,{className:oe,"data-agent-row":!0,"data-agent-id":n.id,children:z}),t[64]=n.id,t[65]=oe,t[66]=u,t[67]=z,t[68]=i,t[69]=p,t[70]=a.label,t[71]=H):H=t[71],H}function al(e){return e!==null}function ol(e){let t=e.workflow.status;return t!==`completed`&&t!==`failed`&&t!==`cancelled`&&t!==`interrupted`}function sl(e){return[...e.phases.flatMap(e=>e.members),...e.unphasedMembers]}function cl(e){let t=(0,X.c)(4),{group:n}=e;if(n.phases.length===0)return null;let r;t[0]===n.phases?r=t[1]:(r=n.phases.map(ll),t[0]=n.phases,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-1 gap-y-1 px-1.5 pb-1 pt-1.5`,children:r}),t[2]=r,t[3]=i),i}function ll(e,t){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0?(0,Z.jsx)(ce,{"aria-hidden":!0,className:`size-3 text-muted-foreground/40`}):null,(0,Z.jsxs)(`div`,{className:J(`flex items-center gap-1 rounded-sm border px-1.5 py-0.5`,e.state===`running`?`border-info/40`:e.state===`done`?`border-success/30`:`border-border/50`),children:[(0,Z.jsxs)(`span`,{className:J(`font-mono text-[.65rem]`,e.state===`running`?`text-info-foreground`:e.state===`done`?`text-success-foreground`:`text-muted-foreground/70`),children:[e.state===`done`?`✓ `:``,e.title]}),(0,Z.jsx)(`span`,{className:`flex items-center gap-0.5`,children:e.members.length===0?(0,Z.jsx)(`span`,{className:`font-mono text-[.6rem] text-muted-foreground/50`,children:`–`}):e.members.map(ul)})]})]},e.index)}function ul(e){return(0,Z.jsx)(Yc,{status:e.status},e.id)}var dl=15e3;function fl(e){let t=(0,X.c)(28),{environmentId:n,threadId:r,scriptPath:i,onClose:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={state:`loading`},t[0]=o):o=t[0];let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(0),d;t[1]!==n||t[2]!==i||t[3]!==r?(d=()=>{let e=!1,t;c({state:`loading`});let a=h(n)?.orchestration.getWorkflowScript;if(!a){c({state:`failed`});return}let o=new Promise((e,n)=>{t=setTimeout(()=>n(Error(`workflow script fetch timed out`)),dl)});return Promise.race([a({threadId:r,scriptPath:i}),o]).then(t=>{e||c({state:`loaded`,contents:t.contents,truncated:t.truncated})}).catch(()=>{e||c({state:`failed`})}).finally(()=>{t!==void 0&&clearTimeout(t)}),()=>{e=!0,t!==void 0&&clearTimeout(t)}},t[1]=n,t[2]=i,t[3]=r,t[4]=d):d=t[4];let f;t[5]!==l||t[6]!==n||t[7]!==i||t[8]!==r?(f=[n,r,i,l],t[5]=l,t[6]=n,t[7]=i,t[8]=r,t[9]=f):f=t[9],(0,Y.useEffect)(d,f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(mr,{"aria-hidden":!0,className:`size-3 text-muted-foreground`}),t[10]=p):p=t[10];let m;t[11]===i?m=t[12]:(m=i.split(`/`).at(-1),t[11]=i,t[12]=m);let g;t[13]===m?g=t[14]:(g=(0,Z.jsx)(`span`,{className:`truncate font-mono text-[.65rem] text-muted-foreground`,children:m}),t[13]=m,t[14]=g);let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(vn,{"aria-hidden":!0,className:`size-3`}),t[15]=_):_=t[15];let v;t[16]===a?v=t[17]:(v=(0,Z.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Close script`,className:`ml-auto text-muted-foreground hover:text-foreground`,children:_}),t[16]=a,t[17]=v);let y;t[18]!==g||t[19]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 px-2 py-1`,children:[p,g,v]}),t[18]=g,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==s.contents||t[22]!==s.state||t[23]!==s.truncated?(b=(0,Z.jsx)(`div`,{className:`max-h-72 overflow-auto p-2`,children:s.state===`loaded`?(0,Z.jsxs)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[.7rem] leading-relaxed text-foreground/90`,children:[s.contents,s.truncated?`
|
|
1365
|
+
… (truncated)`:``]}):s.state===`failed`?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-destructive-foreground`,children:`Could not load the script.`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>u(pl),className:`text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground`,children:`Retry`})]}):(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading…`})}),t[21]=s.contents,t[22]=s.state,t[23]=s.truncated,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==y?(x=(0,Z.jsxs)(`div`,{className:`mx-1.5 mb-1 rounded-md border border-border/60 bg-background/60`,children:[y,b]}),t[25]=b,t[26]=y,t[27]=x):x=t[27],x}function pl(e){return e+1}function ml(e){let t=(0,X.c)(33),{phase:n,defaultOpen:r}=e,[i,a]=(0,Y.useState)(r!==void 0&&r||n.state===`running`),o=(0,Y.useRef)(n.state),s,c;t[0]===n.state?(s=t[1],c=t[2]):(s=()=>{o.current!==`running`&&n.state===`running`&&a(!0),o.current=n.state},c=[n.state],t[0]=n.state,t[1]=s,t[2]=c),(0,Y.useEffect)(s,c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>a(_l),t[3]=l):l=t[3];let u=n.state===`done`?`text-success-foreground`:n.state===`running`?`text-info-foreground`:`text-muted-foreground/70`,d;t[4]===u?d=t[5]:(d=J(`mt-2 flex w-full items-center gap-1.5 rounded-sm px-1.5 text-left text-[.65rem] font-medium uppercase tracking-wider hover:bg-accent/40`,u),t[4]=u,t[5]=d);let f;t[6]===i?f=t[7]:(f=i?(0,Z.jsx)(oe,{"aria-hidden":!0,className:`size-3 shrink-0`}):(0,Z.jsx)(ce,{"aria-hidden":!0,className:`size-3 shrink-0`}),t[6]=i,t[7]=f);let p;t[8]===n.state?p=t[9]:(p=n.state===`done`?(0,Z.jsx)(V,{"aria-hidden":!0,className:`size-3`}):null,t[8]=n.state,t[9]=p);let m;t[10]===n.title?m=t[11]:(m=(0,Z.jsx)(`span`,{children:n.title}),t[10]=n.title,t[11]=m);let h=n.state===`pending`&&n.members.length===0?`pending`:n.state===`done`?`${n.settledCount} done`:`${n.activeCount} active · ${n.settledCount} done`,g;t[12]===h?g=t[13]:(g=(0,Z.jsx)(`span`,{className:`font-normal normal-case text-muted-foreground/70`,children:h}),t[12]=h,t[13]=g);let _;t[14]!==i||t[15]!==n.members?(_=!i&&n.members.length>0?(0,Z.jsx)(`span`,{className:`ml-auto flex items-center gap-0.5`,children:n.members.map(gl)}):null,t[14]=i,t[15]=n.members,t[16]=_):_=t[16];let v;t[17]!==i||t[18]!==g||t[19]!==_||t[20]!==d||t[21]!==f||t[22]!==p||t[23]!==m?(v=(0,Z.jsxs)(`button`,{type:`button`,onClick:l,"aria-expanded":i,className:d,children:[f,p,m,g,_]}),t[17]=i,t[18]=g,t[19]=_,t[20]=d,t[21]=f,t[22]=p,t[23]=m,t[24]=v):v=t[24];let y;t[25]!==i||t[26]!==n.members||t[27]!==n.state||t[28]!==n.title?(y=i?(0,Z.jsx)(nl,{children:n.members.length===0&&n.state===`pending`?(0,Z.jsx)(rl,{title:n.title}):n.members.map(hl)}):null,t[25]=i,t[26]=n.members,t[27]=n.state,t[28]=n.title,t[29]=y):y=t[29];let b;return t[30]!==v||t[31]!==y?(b=(0,Z.jsxs)(`div`,{children:[v,y]}),t[30]=v,t[31]=y,t[32]=b):b=t[32],b}function hl(e){return(0,Z.jsx)(il,{agent:e},e.id)}function gl(e){return(0,Z.jsx)(Yc,{status:e.status},e.id)}function _l(e){return!e}function vl(e){let t=(0,X.c)(47),{group:n,environmentId:r,threadId:i,onCollapse:a}=e,[o,s]=(0,Y.useState)(!1),c,l;t[0]===n?(c=t[1],l=t[2]):(c=sl(n),l=c.filter(Sl),t[0]=n,t[1]=c,t[2]=l);let u=l.length,d=n.workflow.runHandles?.scriptPath,f=d!==void 0&&r!==null&&i!==null,p;t[3]===n.workflow.status?p=t[4]:(p=(0,Z.jsx)(Yc,{status:n.workflow.status}),t[3]=n.workflow.status,t[4]=p);let m=n.workflow.workflowName??n.workflow.title,h;t[5]===m?h=t[6]:(h=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:m}),t[5]=m,t[6]=h);let g;t[7]!==f||t[8]!==o?(g=f?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>s(xl),className:J(`rounded-sm border border-border/60 px-1 font-mono normal-case hover:text-foreground`,o&&`text-foreground`),"aria-expanded":o,children:[`{}`,` script`]}):null,t[7]=f,t[8]=o,t[9]=g):g=t[9];let _;t[10]!==c.length||t[11]!==u?(_=(0,Z.jsxs)(`span`,{className:`ml-auto font-mono normal-case text-muted-foreground/80`,children:[u,`/`,c.length,` settled`]}),t[10]=c.length,t[11]=u,t[12]=_):_=t[12];let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(oe,{"aria-hidden":!0,className:`size-3`}),t[13]=v):v=t[13];let y;t[14]===a?y=t[15]:(y=(0,Z.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Collapse workflow`,className:`rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50`,children:v}),t[14]=a,t[15]=y);let b;t[16]!==p||t[17]!==h||t[18]!==g||t[19]!==_||t[20]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-1.5 pt-0.5 text-[.65rem] font-medium uppercase tracking-wider text-muted-foreground`,children:[p,h,g,_,y]}),t[16]=p,t[17]=h,t[18]=g,t[19]=_,t[20]=y,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(cl,{group:n}),t[22]=n,t[23]=x);let S;t[24]!==f||t[25]!==r||t[26]!==o||t[27]!==d||t[28]!==i?(S=o&&f?(0,Z.jsx)(fl,{environmentId:r,threadId:i,scriptPath:d,onClose:()=>s(!1)}):null,t[24]=f,t[25]=r,t[26]=o,t[27]=d,t[28]=i,t[29]=S):S=t[29];let C;t[30]===n.phases?C=t[31]:(C=n.phases.map(bl),t[30]=n.phases,t[31]=C);let w;t[32]===n.unphasedMembers?w=t[33]:(w=n.unphasedMembers.map(yl),t[32]=n.unphasedMembers,t[33]=w);let T;t[34]===w?T=t[35]:(T=(0,Z.jsx)(nl,{children:w}),t[34]=w,t[35]=T);let E;t[36]!==n.phases.length||t[37]!==n.unphasedMembers.length||t[38]!==n.workflow?(E=n.phases.length===0&&n.unphasedMembers.length===0?(0,Z.jsx)(il,{agent:n.workflow}):null,t[36]=n.phases.length,t[37]=n.unphasedMembers.length,t[38]=n.workflow,t[39]=E):E=t[39];let D;return t[40]!==x||t[41]!==S||t[42]!==C||t[43]!==T||t[44]!==E||t[45]!==b?(D=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-border/50 bg-card/30 p-1.5`,children:[b,x,S,C,T,E]}),t[40]=x,t[41]=S,t[42]=C,t[43]=T,t[44]=E,t[45]=b,t[46]=D):D=t[46],D}function yl(e){return(0,Z.jsx)(il,{agent:e},e.id)}function bl(e){return(0,Z.jsx)(ml,{phase:e,defaultOpen:!0},e.index)}function xl(e){return!e}function Sl(e){return e.status===`completed`||e.status===`failed`||e.status===`cancelled`||e.status===`interrupted`}function Cl(e){let t=(0,X.c)(45),{group:n,onExpand:r}=e,i,a,o,s,c,l,u,d,f,p,m,h,g;if(t[0]!==n||t[1]!==r){let e=sl(n),_=e.filter(Tl).length,v=e.reduce(wl,e.length===0?n.workflow.usage?.totalTokens??0:0),y;t[15]!==n.workflow.completedAt||t[16]!==n.workflow.startedAt?(y=n.workflow.startedAt&&n.workflow.completedAt?Zc(n.workflow.startedAt,n.workflow.completedAt):null,t[15]=n.workflow.completedAt,t[16]=n.workflow.startedAt,t[17]=y):y=t[17],i=y,m=`button`,h=r,g=`flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-left outline-none hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/50`,o=!1;let b=_>0?`failed`:n.workflow.status;t[18]===b?s=t[19]:(s=(0,Z.jsx)(Yc,{status:b}),t[18]=b,t[19]=s);let x=n.workflow.workflowName??n.workflow.title;t[20]===x?c=t[21]:(c=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:x}),t[20]=x,t[21]=c),d=`flex shrink-0 items-center gap-1.5 font-mono text-[.7rem] text-muted-foreground/80`,t[22]===_?f=t[23]:(f=_>0?(0,Z.jsxs)(`span`,{className:`text-destructive-foreground`,children:[_,` failed`]}):null,t[22]=_,t[23]=f),p=(0,Z.jsxs)(`span`,{children:[e.length,` agents`]}),a=`tabular-nums`,l=`· `,u=O(v),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];let _;t[24]!==a||t[25]!==l||t[26]!==u?(_=(0,Z.jsxs)(`span`,{className:a,children:[l,u,` tok`]}),t[24]=a,t[25]=l,t[26]=u,t[27]=_):_=t[27];let v;t[28]===i?v=t[29]:(v=i?(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`· `,i]}):null,t[28]=i,t[29]=v);let y;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(ce,{"aria-hidden":!0,className:`size-3`}),t[30]=y):y=t[30];let b;t[31]!==_||t[32]!==v||t[33]!==d||t[34]!==f||t[35]!==p?(b=(0,Z.jsxs)(`span`,{className:d,children:[f,p,_,v,y]}),t[31]=_,t[32]=v,t[33]=d,t[34]=f,t[35]=p,t[36]=b):b=t[36];let x;return t[37]!==o||t[38]!==s||t[39]!==c||t[40]!==b||t[41]!==m||t[42]!==h||t[43]!==g?(x=(0,Z.jsx)(`section`,{children:(0,Z.jsxs)(`button`,{type:m,onClick:h,className:g,"aria-expanded":o,children:[s,c,b]})}),t[37]=o,t[38]=s,t[39]=c,t[40]=b,t[41]=m,t[42]=h,t[43]=g,t[44]=x):x=t[44],x}function wl(e,t){return e+(t.usage?.totalTokens??0)}function Tl(e){return e.status===`failed`}function El(e){let t=(0,X.c)(7),{group:n,environmentId:r,threadId:i}=e,a;t[0]===n?a=t[1]:(a=()=>ol(n),t[0]=n,t[1]=a);let[o,s]=(0,Y.useState)(a),c;return t[2]!==r||t[3]!==n||t[4]!==o||t[5]!==i?(c=o?(0,Z.jsx)(vl,{group:n,environmentId:r,threadId:i,onCollapse:()=>s(!1)}):(0,Z.jsx)(Cl,{group:n,onExpand:()=>s(!0)}),t[2]=r,t[3]=n,t[4]=o,t[5]=i,t[6]=c):c=t[6],c}function Dl(e){let t=(0,X.c)(70),{model:n,environmentId:r,threadId:i,onOpenAgent:a,subagents:o,selectedAgentId:s,onBack:c}=e,l=r===void 0?null:r,d=i===void 0?null:i,f=a===void 0?null:a,p=o===void 0?[]:o,m=s===void 0?null:s,[h,g]=(0,Y.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>g(null),t[0]=_):_=t[0];let v;t[1]===d?v=t[2]:(v=[d],t[1]=d,t[2]=v),(0,Y.useEffect)(_,v);let y;if(t[3]!==n.directAgents||t[4]!==n.workflows){let e=new Map;for(let t of n.workflows){e.set(t.workflow.id,t.workflow);for(let n of sl(t))e.set(n.id,n)}for(let t of n.directAgents)e.set(t.id,t);y=x([...e.values()].map(Al)),t[3]=n.directAgents,t[4]=n.workflows,t[5]=y}else y=t[5];let b=f??g,S;t[6]!==y||t[7]!==b?(S={identities:y,onOpenAgent:b},t[6]=y,t[7]=b,t[8]=S):S=t[8];let C=S,w=m??h,T=w?[...n.directAgents,...n.workflows.flatMap(kl)].find(e=>u(e.id)===u(w)):void 0;if(T){let e=p.find(e=>u(e.key)===u(T.id)),n=C.identities.get(T.id),r;t[9]===c?r=t[10]:(r=()=>{g(null),c?.()},t[9]=c,t[10]=r);let i;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ae,{"aria-hidden":!0,className:`size-3.5`}),t[11]=i):i=t[11];let a;t[12]===r?a=t[13]:(a=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,children:[i,`All agents`]}),t[12]=r,t[13]=a);let o=T.model?D(T.model,T.effort):`Model not reported`,s;t[14]===o?s=t[15]:(s=(0,Z.jsx)(`span`,{children:o}),t[14]=o,t[15]=s);let l;t[16]===T?l=t[17]:(l=(0,Z.jsx)($c,{agent:T}),t[16]=T,t[17]=l);let d=T.usage?.totalTokens===void 0?null:(0,Z.jsxs)(`span`,{children:[O(T.usage.totalTokens),` tokens`]}),f;t[18]!==s||t[19]!==l||t[20]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[s,l,d]}),t[18]=s,t[19]=l,t[20]=d,t[21]=f):f=t[21];let m=T.updatedAt,h=new Date(T.updatedAt).toLocaleTimeString(),_;t[22]!==T||t[23]!==h?(_=(0,Z.jsxs)(`p`,{className:`text-[10px] text-muted-foreground/70`,children:[`Last reported activity`,` `,(0,Z.jsx)(`time`,{dateTime:m,children:h})]}),t[22]=T,t[23]=h,t[24]=_):_=t[24];let v=T.error?(0,Z.jsx)(`p`,{role:`status`,className:`m-3 whitespace-pre-wrap break-words text-xs text-destructive`,children:T.error}):null,y=e??{messages:[],entries:[]},b=T.status===`running`||T.status===`waiting`,x;t[25]!==y||t[26]!==b?(x=(0,Z.jsx)(Kc,{subagent:y,running:b}),t[25]=y,t[26]=b,t[27]=x):x=t[27];let S=!e&&T.progress?(0,Z.jsx)(`p`,{className:`px-3 pb-3 text-xs text-muted-foreground`,children:T.progress}):null,w=T.result&&!e?.messages.some(e=>e.text===T.result)?(0,Z.jsxs)(`div`,{className:`border-t border-border/40 p-3 text-sm`,children:[(0,Z.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:`Result summary`}),(0,Z.jsx)(jt,{text:T.result,cwd:void 0,isStreaming:!1})]}):null,E;return t[28]!==v||t[29]!==x||t[30]!==S||t[31]!==w?(E=(0,Z.jsxs)(Kn,{className:`min-h-0 flex-1`,children:[v,x,S,w]}),t[28]=v,t[29]=x,t[30]=S,t[31]=w,t[32]=E):E=t[32],(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-agent-detail":!0,children:[(0,Z.jsxs)(`header`,{className:`space-y-2 border-b border-border/60 px-3 py-3`,children:[a,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold`,children:n?.codename??T.role??T.title}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[(0,Z.jsx)(Yc,{status:T.status}),qc[T.status].label]})]}),(0,Z.jsx)(`p`,{className:`break-words text-xs leading-relaxed text-muted-foreground`,children:T.title}),f,_]}),E]})}if(!n.hasAgents){let e;return t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-6 text-center`,children:[(0,Z.jsx)(B,{"aria-hidden":!0,className:`size-6 text-muted-foreground/60`}),(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`No agents yet`}),(0,Z.jsx)(`p`,{className:`max-w-56 text-xs text-muted-foreground`,children:`When this thread spawns subagents or runs a workflow, they show up here with live status, activity, and token usage.`})]}),t[33]=e):e=t[33],e}let E;if(t[34]!==l||t[35]!==n.workflows||t[36]!==d){let e;t[38]!==l||t[39]!==d?(e=e=>(0,Z.jsx)(El,{group:e,environmentId:l,threadId:d},e.workflow.id),t[38]=l,t[39]=d,t[40]=e):e=t[40],E=n.workflows.map(e),t[34]=l,t[35]=n.workflows,t[36]=d,t[37]=E}else E=t[37];let k;t[41]===n.directAgents?k=t[42]:(k=n.directAgents.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`div`,{className:`px-1.5 pt-1 text-[.65rem] font-medium uppercase tracking-wider text-muted-foreground`,children:`Direct spawns`}),(0,Z.jsx)(nl,{children:n.directAgents.map(Ol)})]}):null,t[41]=n.directAgents,t[42]=k);let A;t[43]!==E||t[44]!==k?(A=(0,Z.jsx)(Kn,{className:`min-h-0 flex-1`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 p-2`,children:[E,k]})}),t[43]=E,t[44]=k,t[45]=A):A=t[45];let j;t[46]!==n.runningCount||t[47]!==n.waitingCount?(j=n.runningCount+n.waitingCount>0?(0,Z.jsxs)(`span`,{className:`text-info-foreground`,children:[`● `,n.runningCount,` active`,n.waitingCount>0?` · ${n.waitingCount} waiting`:``]}):null,t[46]=n.runningCount,t[47]=n.waitingCount,t[48]=j):j=t[48];let M;t[49]===n.idleCount?M=t[50]:(M=n.idleCount>0?(0,Z.jsxs)(`span`,{children:[n.idleCount,` idle`]}):null,t[49]=n.idleCount,t[50]=M);let N;t[51]===n.settledCount?N=t[52]:(N=n.settledCount>0?(0,Z.jsxs)(`span`,{children:[n.settledCount,` settled`]}):null,t[51]=n.settledCount,t[52]=N);let P;t[53]!==j||t[54]!==M||t[55]!==N?(P=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[j,M,N]}),t[53]=j,t[54]=M,t[55]=N,t[56]=P):P=t[56];let F;t[57]===n.totalTokens?F=t[58]:(F=O(n.totalTokens),t[57]=n.totalTokens,t[58]=F);let I;t[59]===F?I=t[60]:(I=(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`Σ `,F,` tok`]}),t[59]=F,t[60]=I);let L;t[61]!==P||t[62]!==I?(L=(0,Z.jsxs)(`footer`,{className:`flex items-center justify-between border-t border-border/60 px-3 py-1.5 font-mono text-[.7rem] text-muted-foreground`,children:[P,I]}),t[61]=P,t[62]=I,t[63]=L):L=t[63];let ee;t[64]!==A||t[65]!==L?(ee=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[A,L]}),t[64]=A,t[65]=L,t[66]=ee):ee=t[66];let R;return t[67]!==C||t[68]!==ee?(R=(0,Z.jsx)(Jc.Provider,{value:C,children:ee}),t[67]=C,t[68]=ee,t[69]=R):R=t[69],R}function Ol(e){return(0,Z.jsx)(il,{agent:e},e.id)}function kl(e){return[e.workflow,...sl(e)]}function Al(e){return{key:e.id,role:e.role,taskLabel:e.title}}function jl(e){let t=[],n=new Set(e.openedPanelModes);if(n.has(`files`)&&t.push({key:`files`,label:`Files`,mode:`files`}),n.has(`review`)&&t.push({key:`review`,label:`Review`,mode:`review`}),n.has(`terminal`)&&t.push({key:`terminal`,label:`Terminal`,mode:`terminal`}),n.has(`browser`)&&t.push({key:`browser`,label:`Browser`,mode:`browser`}),n.has(`simulator`)&&t.push({key:`simulator`,label:`Simulator`,mode:`simulator`}),(n.has(`agents`)||e.groupAgents&&e.activeAgentKey)&&t.push({key:`agents`,label:`Agents`,mode:`agents`}),e.groupAgents)return t;let r=[...new Set([...e.openedAgentKeys,...e.activeAgentKey?[e.activeAgentKey]:[]])];for(let n of r){let r=sr(e.subagents,n)??{key:n,name:`Subagent`,status:`idle`,origin:null,capability:null,tool:null,detail:null,providerThreadIds:[],providerSessionIds:[],startedAt:``,updatedAt:``,entries:[],messages:[]};t.push({key:r.key,label:r.name,mode:`agent`,agentKey:r.key,status:r.status,avatarKey:r.avatarKey??r.key})}return t}function Ml(e){let t=(0,Y.useRef)(e);return(0,Y.useInsertionEffect)(()=>void(t.current=e)),(0,Y.useCallback)((...e)=>t.current(...e),[])}var Nl=(0,Y.createContext)(void 0);function Pl({children:e,createEditor:t}){let n=(0,Y.useRef)(new WeakMap),r=Ml(e=>{let r=n.current.get(e);if(r!=null)return r;let i=t(e);return n.current.set(e,i),i});return(0,Z.jsx)(Nl.Provider,{value:r,children:e})}function Fl(){return(0,Y.useContext)(Nl)}var Il={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Ll={display:`contents`};function Rl(){return null}function zl({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d}){let f=n?.(e),p=r?.(e),m=i?.(e),h=a?.(e);return(0,Z.jsxs)(Z.Fragment,{children:[f==null?(0,Z.jsxs)(Z.Fragment,{children:[p!=null&&(0,Z.jsx)(`div`,{slot:`header-prefix`,children:p}),m!=null&&(0,Z.jsx)(`div`,{slot:`header-filename-suffix`,children:m}),h!=null&&(0,Z.jsx)(`div`,{slot:`header-metadata`,children:h})]}):(0,Z.jsx)(`div`,{slot:Ee,children:f}),o!=null&&l?.map((e,t)=>(0,Z.jsx)(`div`,{slot:wa(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=Bl(t,e);return(0,Z.jsx)(`div`,{slot:n,style:Ll,children:c(t,d)},n)}),s!=null&&(0,Z.jsx)(`div`,{slot:`gutter-utility-slot`,style:Il,children:s(u)})]})}function Bl(e,t){let n=Pc(e,t);return n==null?void 0:Nc({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function Vl({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c}){let l=t?.(e),u=n?.(e),d=r?.(e),f=i?.(e);return(0,Z.jsxs)(Z.Fragment,{children:[l==null?(0,Z.jsxs)(Z.Fragment,{children:[u!=null&&(0,Z.jsx)(`div`,{slot:`header-prefix`,children:u}),d!=null&&(0,Z.jsx)(`div`,{slot:`header-filename-suffix`,children:d}),f!=null&&(0,Z.jsx)(`div`,{slot:`header-metadata`,children:f})]}):(0,Z.jsx)(`div`,{slot:Ee,children:l}),a!=null&&o?.map((e,t)=>(0,Z.jsx)(`div`,{slot:wa(e),children:a(e)},t)),s!=null&&(0,Z.jsx)(`div`,{slot:`gutter-utility-slot`,style:Il,children:s(c)})]})}function Hl(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}var Ul=(0,Y.createContext)(void 0);function Wl({children:e,config:t,className:n,style:r,contentClassName:i,contentStyle:a}){let[o]=(0,Y.useState)(()=>typeof window<`u`?new Uc(t):void 0),s=(0,Y.useCallback)(e=>{e==null?o?.cleanUp():o?.setup(e)},[o]);return(0,Z.jsx)(Ul.Provider,{value:o,children:(0,Z.jsx)(`div`,{className:n,style:r,ref:s,children:(0,Z.jsx)(`div`,{className:i,style:a,children:e})})})}function Gl(){return(0,Y.useContext)(Ul)}var Kl=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function ql({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=Gl(),f=i!==void 0,p=(0,Y.useContext)(Yt),m=Fl(),h=(0,Y.useRef)(null),g=Ml(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new _o(Jl({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new Co(Jl({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Kl(()=>{if(h.current==null)return;let n=Jl({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!Hr(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),Kl(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,Y.useCallback)(()=>h.current?.getHoveredLine(),[])}}function Jl({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?Rl:e?.renderCustomHeader,renderGutterUtility:r?Rl:e?.renderGutterUtility}:e}function Yl({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=ql({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,Z.jsx)(Qe,{ref:_,className:o,style:s,children:Hl(Vl({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Xl=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function Zl({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=Gl(),f=i!==void 0,p=(0,Y.useContext)(Yt),m=Fl(),h=(0,Y.useRef)(null),g=Ml(n=>{if(n!=null){if(h.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?h.current=new sc(Ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new yc(Ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Xl(()=>{let{current:n}=h;if(n==null)return;let a=Ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!Hr(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),Xl(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,Y.useCallback)(()=>h.current?.getHoveredLine(),[])}}function Ql({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?Rl:e?.renderCustomHeader,renderGutterUtility:r?Rl:e?.renderGutterUtility}:e}function $l({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,className:o,style:s,prerenderedHTML:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Zl({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:c,hasGutterRenderUtility:m!=null,hasCustomHeader:u!=null,disableWorkerPool:h,edit:g});return(0,Z.jsx)(Qe,{ref:_,className:o,style:s,children:Hl(zl({fileDiff:e,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderAnnotation:l,renderGutterUtility:m,lineAnnotations:i,getHoveredLine:v}),c)})}function eu(e){let{environmentId:t,threadId:n,fromTurnCount:r,toTurnCount:i,ignoreWhitespace:a,cacheScope:o}=e,s=e.enabled,c=P(e)?I(e):null;(0,Y.useEffect)(()=>{if(c!==null)return y({environmentId:t,threadId:n,fromTurnCount:r,toTurnCount:i,ignoreWhitespace:a,...o===void 0?{}:{cacheScope:o},...s===void 0?{}:{enabled:s}})},[c,t,n,r,i,a,o,s]);let l=te(c===null?p:d(c));return c===null?b:l}var tu=`\0`,nu=1/0,ru=1;function iu(e){return`${e.turnId}${tu}${e.filePath}${tu}${e.blobSha}`}var au=class{#e;#t;constructor(e=50){if(!Number.isInteger(e)||e<=0)throw RangeError(`DiffParseCache maxEntries must be a positive integer, received ${String(e)}`);this.#t=e,this.#e=new St(e,nu)}get maxEntries(){return this.#t}get(e){return this.#e.get(iu(e))??void 0}set(e,t){this.#e.set(iu(e),t,ru)}getOrCompute(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t();return this.set(e,r),r}clear(){this.#e.clear()}};function ou(e){let t=e.name??e.prevName??``;return t.startsWith(`a/`)||t.startsWith(`b/`)?t.slice(2):t}function su(e,t=!1){let n=e.trim();return t?n:n.toLowerCase()}function cu(e,t){t.text!==void 0&&e.push({fileIndex:t.fileIndex,field:t.field,text:t.text,normalizedText:t.text.toLowerCase(),...t.lineIndex===void 0?{}:{lineIndex:t.lineIndex},...t.unifiedLineIndex===void 0?{}:{unifiedLineIndex:t.unifiedLineIndex},...t.splitLineIndex===void 0?{}:{splitLineIndex:t.splitLineIndex}})}function lu(e,t,n){t.additionLines.forEach((t,r)=>{cu(e,{fileIndex:n,field:`addition`,lineIndex:r,text:t})}),t.deletionLines.forEach((t,r)=>{cu(e,{fileIndex:n,field:`deletion`,lineIndex:r,text:t})})}function uu(e,t,n){if(!t.hunks||t.hunks.length===0)return!1;for(let r of t.hunks){let i=r.unifiedLineStart,a=r.splitLineStart;for(let o of r.hunkContent){if(o.type===`context`){for(let r=0;r<o.lines;r+=1){let s=o.additionLineIndex+r,c=o.deletionLineIndex+r;cu(e,{fileIndex:n,field:`context`,lineIndex:s,unifiedLineIndex:i+r,splitLineIndex:a+r,text:t.additionLines[s]??t.deletionLines[c]})}i+=o.lines,a+=o.lines;continue}for(let r=0;r<o.deletions;r+=1){let s=o.deletionLineIndex+r;cu(e,{fileIndex:n,field:`deletion`,lineIndex:s,unifiedLineIndex:i+r,splitLineIndex:a+r,text:t.deletionLines[s]})}for(let r=0;r<o.additions;r+=1){let s=o.additionLineIndex+r;cu(e,{fileIndex:n,field:`addition`,lineIndex:s,unifiedLineIndex:i+o.deletions+r,splitLineIndex:a+r,text:t.additionLines[s]})}i+=o.deletions+o.additions,a+=Math.max(o.deletions,o.additions)}}return!0}function du(e){let t=[];return e.forEach((e,n)=>{cu(t,{text:ou(e),fileIndex:n,field:`path`}),e.prevName&&cu(t,{text:ou({name:e.prevName}),fileIndex:n,field:`previousPath`}),uu(t,e,n)||lu(t,e,n)}),{records:t}}function fu(e){let t=e.caseSensitive?e.record.text:e.record.normalizedText,n=[],r=0;for(;;){let i=t.indexOf(e.needle,r);if(i===-1)return n;let a=i+e.needle.length;n.push({fileIndex:e.record.fileIndex,field:e.record.field,...e.record.lineIndex===void 0?{}:{lineIndex:e.record.lineIndex},...e.record.unifiedLineIndex===void 0?{}:{unifiedLineIndex:e.record.unifiedLineIndex},...e.record.splitLineIndex===void 0?{}:{splitLineIndex:e.record.splitLineIndex},start:i,end:a}),r=a>i?a:i+1}}function pu(e){return!Array.isArray(e)}function mu(e,t,n){let r=n?.caseSensitive??!1,i=su(t,r);if(!i)return[];let a=pu(e)?e:du(e),o=[];for(let e of a.records)o.push(...fu({record:e,needle:i,caseSensitive:r}));return o}function hu(e){return[...new Set(e.map(e=>e.fileIndex))]}function gu(e){let t=new Map;for(let n of e){let e=t.get(n.fileIndex);e?e.push(n):t.set(n.fileIndex,[n])}return t}function _u(e,t,n){return t<=0?0:(e+n+t)%t}function vu(e,t){return e.field===`path`||e.field===`previousPath`?null:(t===`split`?e.splitLineIndex:e.unifiedLineIndex)??e.lineIndex??null}function yu(e){return e===`addition`||e===`deletion`||e===`context`}function bu(e){if(!e)return null;let[t,n]=e.split(`,`),r=Number.parseInt(t??``,10);if(!Number.isFinite(r))return null;let i=Number.parseInt(n??``,10);return{stacked:r,split:Number.isFinite(i)?i:r}}function xu(e,t){if(!yu(e.field)||vu(e,t.renderMode)!==(t.renderMode===`split`?t.lineIndexes.split:t.lineIndexes.stacked))return!1;switch(e.field){case`addition`:return t.lineType===`change-addition`||t.lineType===`addition`;case`deletion`:return t.lineType===`change-deletion`||t.lineType===`deletion`;case`context`:return t.lineType===`context`||t.lineType===`context-expanded`}}function Su(e){let t=e.cwd?pn(e.filePath,e.cwd):e.filePath;return typeof e.lineNumber==`number`?`${t}:${e.lineNumber}`:t}var Cu=`
|
|
1366
|
+
[data-diffs-header],
|
|
1367
|
+
[data-diff],
|
|
1368
|
+
[data-file],
|
|
1369
|
+
[data-error-wrapper],
|
|
1370
|
+
[data-virtualizer-buffer] {
|
|
1371
|
+
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1372
|
+
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1373
|
+
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1374
|
+
--diffs-token-light-bg: transparent;
|
|
1375
|
+
--diffs-token-dark-bg: transparent;
|
|
1376
|
+
|
|
1377
|
+
--diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));
|
|
1378
|
+
--diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));
|
|
1379
|
+
--diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));
|
|
1380
|
+
--diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));
|
|
1381
|
+
|
|
1382
|
+
--diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));
|
|
1383
|
+
--diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));
|
|
1384
|
+
--diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));
|
|
1385
|
+
--diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));
|
|
1386
|
+
|
|
1387
|
+
--diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));
|
|
1388
|
+
--diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));
|
|
1389
|
+
--diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));
|
|
1390
|
+
--diffs-bg-deletion-emphasis-override: color-mix(
|
|
1391
|
+
in srgb,
|
|
1392
|
+
var(--background) 80%,
|
|
1393
|
+
var(--destructive)
|
|
1394
|
+
);
|
|
1395
|
+
|
|
1396
|
+
background-color: var(--diffs-bg) !important;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
[data-file-info] {
|
|
1400
|
+
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
1401
|
+
border-block-color: var(--border) !important;
|
|
1402
|
+
color: var(--foreground) !important;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
[data-diffs-header] {
|
|
1406
|
+
position: sticky !important;
|
|
1407
|
+
top: 0;
|
|
1408
|
+
z-index: 4;
|
|
1409
|
+
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
1410
|
+
border-bottom: 1px solid var(--border) !important;
|
|
1411
|
+
}
|
|
1412
|
+
`,wu=`
|
|
1413
|
+
[data-title] {
|
|
1414
|
+
cursor: pointer;
|
|
1415
|
+
transition:
|
|
1416
|
+
color 120ms ease,
|
|
1417
|
+
text-decoration-color 120ms ease;
|
|
1418
|
+
text-decoration: underline;
|
|
1419
|
+
text-decoration-color: transparent;
|
|
1420
|
+
text-underline-offset: 2px;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
[data-title]:hover {
|
|
1424
|
+
color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
|
|
1425
|
+
text-decoration-color: currentColor;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
[data-interactive-line-numbers] [data-line-number-content] {
|
|
1429
|
+
cursor: pointer;
|
|
1430
|
+
}
|
|
1431
|
+
`,Tu=`
|
|
1432
|
+
::highlight(ryco-diff-search-match) {
|
|
1433
|
+
background-color: color-mix(in srgb, var(--warning) 60%, transparent);
|
|
1434
|
+
color: var(--foreground);
|
|
1435
|
+
}
|
|
1436
|
+
`,Eu=`${Cu}${wu}${Tu}`,Du=`${Cu}${Tu}`;function Ou(e,t=`diff-panel`){if(!e)return null;let n=e.trim();if(n.length===0)return null;try{let e=di(n,lt(n,t)).flatMap(e=>e.files);return e.length>0?{kind:`files`,files:e}:{kind:`raw`,text:n,reason:`Unsupported diff format. Showing raw patch.`}}catch{return{kind:`raw`,text:n,reason:`Failed to parse patch. Showing raw patch.`}}}function ku(e){return ou(e)}function Au(e){return!e||e.kind!==`files`?[]:e.files.toSorted((e,t)=>ku(e).localeCompare(ku(t),void 0,{numeric:!0,sensitivity:`base`}))}var ju=new au;function Mu(e){return e.cacheKey??`${e.prevName??`none`}:${e.name}`}var Nu=`ryco-diff-search-match`,Pu=150,Fu=80,Iu=1600;function Lu(){return typeof CSS<`u`&&CSS.highlights!==void 0&&globalThis.Highlight!==void 0}function Ru(e,t,n=Iu){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();return r.bottom>=i.top-n&&r.top<=i.bottom+n&&r.right>=i.left-n&&r.left<=i.right+n}function zu(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return t&&t.closest(`[data-line-number-content]`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=n.nextNode(),i=0;for(;r;){let e=r,a=i+e.data.length;t.push({node:e,start:i,end:a}),i=a,r=n.nextNode()}return{offsets:t,textLength:i}}function Bu(e,t,n){for(let r of e)if(!(t<r.start||t>r.end)&&(t!==r.end||n!==`start`))return{node:r.node,offset:t-r.start};return null}function Vu(e,t,n){let{offsets:r,textLength:i}=zu(e);if(r.length===0||t.start<0||t.end>i||t.start>=t.end)return;let a=Bu(r,t.start,`start`),o=Bu(r,t.end,`end`);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset),n.push(s)}function Hu(e){let t=bu(e.lineIndexAttr);return t?e.matches.filter(n=>xu(n,{renderMode:e.renderMode,lineIndexes:t,lineType:e.lineType})):[]}function Uu(e){if(vu(e.match,e.renderMode)===null)return null;let t=e.fileElement.querySelectorAll(`diffs-container`);for(let n of t){let t=n.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`);for(let n of t??[]){let t=bu(n.getAttribute(`data-line-index`));if(t&&xu(e.match,{renderMode:e.renderMode,lineIndexes:t,lineType:n.getAttribute(`data-line-type`)}))return n}}return null}function Wu(e){let t=[],n=e.rootElement.querySelectorAll(`[data-diff-file-index]`);for(let r of n){if(!Ru(r,e.viewportElement))continue;let n=r.dataset.diffFileIndex,i=n?Number.parseInt(n,10):NaN;if(!Number.isFinite(i))continue;let a=e.matchesByFileIndex.get(i);if(!a||a.length===0)continue;let o=r.querySelectorAll(`diffs-container`);for(let n of o){let r=n.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`);for(let n of r??[]){if(!Ru(n,e.viewportElement))continue;let r=Hu({matches:a,renderMode:e.renderMode,lineIndexAttr:n.getAttribute(`data-line-index`),lineType:n.getAttribute(`data-line-type`)});for(let e of r)Vu(n,e,t)}}}return t}function Gu(e){switch(e.type){case`new`:return`text-[var(--diffs-addition-base)]`;case`deleted`:return`text-[var(--diffs-deletion-base)]`;case`change`:case`rename-pure`:case`rename-changed`:return`text-[var(--diffs-modified-base)]`;default:return`text-muted-foreground/80`}}function Ku(e){let t=(0,X.c)(219),{mode:r}=e,i=r===void 0?`inline`:r;se(`DiffPanel`);let a=Bn(),{resolvedTheme:o}=ur(),s=m(),c=i===`phone`,[l,u]=(0,Y.useState)(`stacked`),[d,f]=(0,Y.useState)(c?!0:s.diffWordWrap),[p,h]=(0,Y.useState)(s.diffIgnoreWhitespace),[g,_]=(0,Y.useState)(nd),[v,y]=(0,Y.useState)(``),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={wait:Pu},t[0]=b):b=t[0];let[x]=ie(v,b),S;t[1]!==x||t[2]!==v?(S=v.trim().length===0?``:x,t[1]=x,t[2]=v,t[3]=S):S=t[3];let T=S,[E,D]=(0,Y.useState)(0),O=(0,Y.useRef)(null),M=(0,Y.useRef)(null),N=(0,Y.useRef)(null),P=(0,Y.useRef)(!1),[F,I]=(0,Y.useState)(!1),[L,ee]=(0,Y.useState)(!1),R;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(R={strict:!1,select:td},t[4]=R):R=t[4];let te=Sn(R),ne;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(ne={strict:!1,select:ed},t[5]=ne):ne=t[5];let re=kn(ne),z=re.diff===`1`,ae=te?.threadId??null,B;t[6]===te?B=t[7]:(B=k(te),t[6]=te,t[7]=B);let V=C(B),ue=V?.projectId??null,de;t[8]!==ue||t[9]!==V?(de=e=>V&&ue?j(e,{environmentId:V.environmentId,projectId:ue}):void 0,t[8]=ue,t[9]=V,t[10]=de):de=t[10];let fe=C(de),pe=V?.worktreePath??fe?.cwd,me=V?.environmentId??null,he=pe??null,ge;t[11]!==me||t[12]!==he?(ge={environmentId:me,cwd:he},t[11]=me,t[12]=he,t[13]=ge):ge=t[13];let _e=w(ge).data?.isRepo??!0,{turnDiffSummaries:ve,inferredCheckpointTurnCountByTurnId:ye}=Ot(V),be;if(t[14]!==ye||t[15]!==ve){let e;t[17]===ye?e=t[18]:(e=(e,t)=>{let n=e.checkpointTurnCount??ye[e.turnId]??0,r=t.checkpointTurnCount??ye[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n},t[17]=ye,t[18]=e),be=[...ve].toSorted(e),t[14]=ye,t[15]=ve,t[16]=be}else be=t[16];let xe=be,Se=re.diffTurnId??null,Ce=Se===null?null:re.diffFilePath??null,we;t[19]!==xe||t[20]!==Se?(we=Se===null?void 0:xe.find(e=>e.turnId===Se)??xe[0],t[19]=xe,t[20]=Se,t[21]=we):we=t[21];let U=we,W=U&&(U.checkpointTurnCount??ye[U.turnId]),G;t[22]===W?G=t[23]:(G=typeof W==`number`?{fromTurnCount:Math.max(0,W-1),toTurnCount:W}:null,t[22]=W,t[23]=G);let Te=G,Ee;if(t[24]!==ye||t[25]!==xe){bb0:{let e;t[27]===ye?e=t[28]:(e=e=>e.checkpointTurnCount??ye[e.turnId],t[27]=ye,t[28]=e);let n=xe.map(e).filter($u);if(n.length===0){Ee=void 0;break bb0}let r=Math.max(...n);Ee=r>0?r:void 0}t[24]=ye,t[25]=xe,t[26]=Ee}else Ee=t[26];let De=Ee,Oe;t[29]!==De||t[30]!==U?(Oe=!U&&typeof De==`number`?{fromTurnCount:0,toTurnCount:De}:null,t[29]=De,t[30]=U,t[31]=Oe):Oe=t[31];let ke=U?Te:Oe,Ae;bb1:{if(U||xe.length===0){Ae=null;break bb1}let e;t[32]===xe?e=t[33]:(e=xe.map(Qu).join(`,`),t[32]=xe,t[33]=e),Ae=`conversation:${e}`}let je=Ae,Me=V?.environmentId??null,Ne=ke?.fromTurnCount??null,Pe=ke?.toTurnCount??null,Fe=U?`turn:${U.turnId}`:je,Ie;t[34]!==ae||t[35]!==p||t[36]!==_e||t[37]!==Me||t[38]!==Ne||t[39]!==Pe||t[40]!==Fe?(Ie={environmentId:Me,threadId:ae,fromTurnCount:Ne,toTurnCount:Pe,ignoreWhitespace:p,cacheScope:Fe,enabled:_e},t[34]=ae,t[35]=p,t[36]=_e,t[37]=Me,t[38]=Ne,t[39]=Pe,t[40]=Fe,t[41]=Ie):Ie=t[41];let Le=eu(Ie),Re=U?Le.data?.diff:void 0,ze=U?void 0:Le.data?.diff,Be=Le.isLoading,Ve=Le.error instanceof Error?Le.error.message:Le.error?`Failed to load checkpoint diff.`:null,He=U?Re:ze,Ue=typeof He==`string`,We;t[42]!==Ue||t[43]!==He?(We=Ue&&He.trim().length===0,t[42]=Ue,t[43]=He,t[44]=We):We=t[44];let Ge=We,Ke;if(t[45]!==je||t[46]!==o||t[47]!==He||t[48]!==U){bb2:{let e=`diff-panel:${o}`,n=typeof He==`string`?He.trim():``;if(n.length===0){let e;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(e={patch:null,files:[]},t[50]=e):e=t[50],Ke=e;break bb2}let r={turnId:U?`turn:${U.turnId}`:je??`conversation`,filePath:e,blobSha:lt(n)},i=ju.get(r);if(i){Ke=i;break bb2}let a=Ou(He,e),s={patch:a,files:Au(a)};a&&ju.set(r,s),Ke=s}t[45]=je,t[46]=o,t[47]=He,t[48]=U,t[49]=Ke}else Ke=t[49];let qe=Ke,Je=qe.patch,K=qe.files,Ye;t[51]===K?Ye=t[52]:(Ye=du(K),t[51]=K,t[52]=Ye);let Xe=Ye,Ze;t[53]===T?Ze=t[54]:(Ze=su(T),t[53]=T,t[54]=Ze);let Qe=Ze,$e;t[55]!==Xe||t[56]!==T?($e=mu(Xe,T),t[55]=Xe,t[56]=T,t[57]=$e):$e=t[57];let et=$e,tt;t[58]===et?tt=t[59]:(tt=gu(et),t[58]=et,t[59]=tt);let nt=tt,rt;t[60]===K?rt=t[61]:(rt=K.map(Zu),t[60]=K,t[61]=rt);let it=rt,at;bb3:{if(!Qe){at=it;break bb3}let e;if(t[62]!==et||t[63]!==K){let n;t[65]===K?n=t[66]:(n=e=>({fileDiff:K[e],fileIndex:e}),t[65]=K,t[66]=n),e=hu(et).map(n),t[62]=et,t[63]=K,t[64]=e}else e=t[64];at=e}let ot=at,st;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(st=()=>{D(0)},t[67]=st):st=t[67];let ct;t[68]!==Qe||t[69]!==K?(ct=[Qe,K],t[68]=Qe,t[69]=K,t[70]=ct):ct=t[70],(0,Y.useEffect)(st,ct);let ut,dt;t[71]===et.length?(ut=t[72],dt=t[73]):(ut=()=>{D(e=>et.length===0?0:Math.min(e,et.length-1))},dt=[et.length],t[71]=et.length,t[72]=ut,t[73]=dt),(0,Y.useEffect)(ut,dt);let ft;t[74]!==E||t[75]!==l||t[76]!==et?(ft=e=>{if(et.length===0)return;let t=_u(E,et.length,e);D(t);let n=et[t],r=M.current;if(!n||!r)return;let i=r.querySelector(`[data-diff-file-index="${n.fileIndex}"]`);if(!i)return;let a=Uu({fileElement:i,match:n,renderMode:l});(a??i).scrollIntoView({block:`center`,behavior:`smooth`}),!a&&vu(n,l)!==null&&window.requestAnimationFrame(()=>{Uu({fileElement:i,match:n,renderMode:l})?.scrollIntoView({block:`center`,behavior:`smooth`})})},t[74]=E,t[75]=l,t[76]=et,t[77]=ft):ft=t[77];let mt=ft,ht,gt;t[78]!==l||t[79]!==et.length||t[80]!==nt||t[81]!==Qe?(ht=()=>{if(!Lu())return;let e=CSS.highlights,t=M.current;if(!t||!Qe||et.length===0){e.delete(Nu);return}let n=0,r=0,i=new Map,a=t.querySelector(`.diff-render-surface`)??t.querySelector(`[data-virtualizer]`)??t,o=()=>{n=0,c();let r=Wu({rootElement:t,viewportElement:a,matchesByFileIndex:nt,renderMode:l});if(r.length===0){e.delete(Nu);return}e.set(Nu,new Highlight(...r))},s=()=>{n===0&&r===0&&(r=window.setTimeout(()=>{r=0,n=window.requestAnimationFrame(o)},Fu))},c=()=>{let e=t.querySelectorAll(`[data-diff-file-index]`);for(let t of e){if(!Ru(t,a))continue;let e=t.querySelectorAll(`diffs-container`);for(let t of e){let e=t.shadowRoot;if(!e||i.has(e))continue;let n=new MutationObserver(s);n.observe(e,{childList:!0,subtree:!0}),i.set(e,n)}}},u=new MutationObserver(s);u.observe(t,{childList:!0,subtree:!0}),a.addEventListener(`scroll`,s,{passive:!0});let d=new ResizeObserver(s);return d.observe(a),s(),()=>{u.disconnect(),a.removeEventListener(`scroll`,s),d.disconnect();for(let e of i.values())e.disconnect();i.clear(),r!==0&&window.clearTimeout(r),n!==0&&window.cancelAnimationFrame(n),e.delete(Nu)}},gt=[l,et.length,nt,Qe],t[78]=l,t[79]=et.length,t[80]=nt,t[81]=Qe,t[82]=ht,t[83]=gt):(ht=t[82],gt=t[83]),(0,Y.useEffect)(ht,gt);let _t,vt;t[84]===K?(_t=t[85],vt=t[86]):(_t=()=>{if(K.length===0){_(Xu);return}let e=new Set(K.map(Mu));_(t=>{let n=new Set([...t].filter(t=>e.has(t)));return n.size===t.size?t:n})},vt=[K],t[84]=K,t[85]=_t,t[86]=vt),(0,Y.useEffect)(_t,vt);let yt,bt;t[87]!==z||t[88]!==c||t[89]!==s.diffIgnoreWhitespace||t[90]!==s.diffWordWrap?(yt=()=>{z&&!P.current&&(f(c?!0:s.diffWordWrap),h(s.diffIgnoreWhitespace),y(``)),P.current=z},bt=[z,c,s.diffIgnoreWhitespace,s.diffWordWrap],t[87]=z,t[88]=c,t[89]=s.diffIgnoreWhitespace,t[90]=s.diffWordWrap,t[91]=yt,t[92]=bt):(yt=t[91],bt=t[92]),(0,Y.useEffect)(yt,bt);let xt;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(xt=()=>{y(``)},t[93]=xt):xt=t[93];let St;t[94]===Se?St=t[95]:(St=[Se],t[94]=Se,t[95]=St),(0,Y.useEffect)(xt,St);let Ct;t[96]===Ce?Ct=t[97]:(Ct=()=>{!Ce||!M.current||Array.from(M.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===Ce)?.scrollIntoView({block:`nearest`})},t[96]=Ce,t[97]=Ct);let wt;t[98]!==K||t[99]!==Ce?(wt=[Ce,K],t[98]=K,t[99]=Ce,t[100]=wt):wt=t[100],(0,Y.useEffect)(Ct,wt);let Tt;t[101]===pe?Tt=t[102]:(Tt=(e,t)=>{let n=A();if(!n)return;let r=Su({cwd:pe,filePath:e,lineNumber:t});ar(n,r).catch(Yu)},t[101]=pe,t[102]=Tt);let Et=Tt,Dt;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[103]=Dt):Dt=t[103];let kt=Dt,At;t[104]!==V||t[105]!==a?(At=e=>{V&&a({to:`/$environmentId/$threadId`,params:xn(n(V.environmentId,V.id)),search:t=>({...An(t),diff:`1`,diffTurnId:e})})},t[104]=V,t[105]=a,t[106]=At):At=t[106];let jt=At,Mt;t[107]!==V||t[108]!==a?(Mt=()=>{V&&a({to:`/$environmentId/$threadId`,params:xn(n(V.environmentId,V.id)),search:Ju})},t[107]=V,t[108]=a,t[109]=Mt):Mt=t[109];let Nt=Mt,Pt;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=()=>{let e=N.current;if(!e){I(!1),ee(!1);return}let t=Math.max(0,e.scrollWidth-e.clientWidth);I(e.scrollLeft>4),ee(e.scrollLeft<t-4)},t[110]=Pt):Pt=t[110];let Ft=Pt,It;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(It=e=>{let t=N.current;t&&t.scrollBy({left:e,behavior:`smooth`})},t[111]=It):It=t[111];let Lt=It,Rt;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=e=>{let t=N.current;t&&(t.scrollWidth<=t.clientWidth+1||Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.preventDefault(),t.scrollBy({left:e.deltaY,behavior:`auto`})))},t[112]=Rt):Rt=t[112];let zt=Rt,Bt,Vt;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Bt=()=>{let e=N.current;if(!e)return;let t=window.requestAnimationFrame(()=>Ft()),n=()=>Ft();e.addEventListener(`scroll`,n,{passive:!0});let r=new ResizeObserver(()=>Ft());return r.observe(e),()=>{window.cancelAnimationFrame(t),e.removeEventListener(`scroll`,n),r.disconnect()}},Vt=[Ft],t[113]=Bt,t[114]=Vt):(Bt=t[113],Vt=t[114]),(0,Y.useEffect)(Bt,Vt);let Ht;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=()=>{let e=window.requestAnimationFrame(()=>Ft());return()=>{window.cancelAnimationFrame(e)}},t[115]=Ht):Ht=t[115];let Ut;t[116]!==xe||t[117]!==Se?(Ut=[xe,Se,Ft],t[116]=xe,t[117]=Se,t[118]=Ut):Ut=t[118],(0,Y.useEffect)(Ht,Ut);let Gt;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=()=>{let e=N.current;e&&e.querySelector(`[data-turn-chip-selected='true']`)?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})},t[119]=Gt):Gt=t[119];let Kt=U?.turnId,qt;t[120]!==Se||t[121]!==Kt?(qt=[Kt,Se],t[120]=Se,t[121]=Kt,t[122]=qt):qt=t[122],(0,Y.useEffect)(Gt,qt);let Jt;t[123]!==F||t[124]!==L||t[125]!==c?(Jt=c?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,className:J(`absolute left-0 top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,F?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`),onClick:()=>Lt(-180),disabled:!F,"aria-label":`Scroll turn list left`,children:(0,Z.jsx)(H,{className:`size-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,className:J(`absolute right-0 top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,L?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`),onClick:()=>Lt(180),disabled:!L,"aria-label":`Scroll turn list right`,children:(0,Z.jsx)(ce,{className:`size-3.5`})})]}),t[123]=F,t[124]=L,t[125]=c,t[126]=Jt):Jt=t[126];let Yt=c?`px-1`:`px-8`,Xt;t[127]===Yt?Xt=t[128]:(Xt=J(`turn-chip-strip flex gap-1 overflow-x-auto py-0.5`,Yt),t[127]=Yt,t[128]=Xt);let Zt;t[129]!==F||t[130]!==L||t[131]!==c?(Zt=!c&&(F||L)?{maskImage:`linear-gradient(to right, ${F?`transparent 24px, black 72px`:`black`}, ${L?`black calc(100% - 72px), transparent calc(100% - 24px)`:`black`})`}:void 0,t[129]=F,t[130]=L,t[131]=c,t[132]=Zt):Zt=t[132];let Qt=c&&`min-h-[44px]`,$t;t[133]===Qt?$t=t[134]:($t=J(`shrink-0 rounded-md`,Qt),t[133]=Qt,t[134]=$t);let q=Se===null,en=c&&`flex min-h-[44px] items-center`,nn=Se===null?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,rn;t[135]!==en||t[136]!==nn?(rn=J(`rounded-md border px-2 py-1 text-left transition-colors`,en,nn),t[135]=en,t[136]=nn,t[137]=rn):rn=t[137];let an;t[138]===Symbol.for(`react.memo_cache_sentinel`)?(an=(0,Z.jsx)(`div`,{className:`text-[10px] leading-tight font-medium`,children:`All turns`}),t[138]=an):an=t[138];let on;t[139]===rn?on=t[140]:(on=(0,Z.jsx)(`div`,{className:rn,children:an}),t[139]=rn,t[140]=on);let sn;t[141]!==Nt||t[142]!==$t||t[143]!==q||t[144]!==on?(sn=(0,Z.jsx)(`button`,{type:`button`,className:$t,onClick:Nt,"data-turn-chip-selected":q,children:on}),t[141]=Nt,t[142]=$t,t[143]=q,t[144]=on,t[145]=sn):sn=t[145];let cn;if(t[146]!==ye||t[147]!==c||t[148]!==xe||t[149]!==jt||t[150]!==U?.turnId||t[151]!==s.timestampFormat){let e;t[153]!==ye||t[154]!==c||t[155]!==jt||t[156]!==U?.turnId||t[157]!==s.timestampFormat?(e=e=>(0,Z.jsx)(`button`,{type:`button`,className:J(`shrink-0 rounded-md`,c&&`min-h-[44px]`),onClick:()=>jt(e.turnId),title:e.turnId,"data-turn-chip-selected":e.turnId===U?.turnId,children:(0,Z.jsx)(`div`,{className:J(`rounded-md border px-2 py-1 text-left transition-colors`,c&&`flex min-h-[44px] items-center`,e.turnId===U?.turnId?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`),children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsxs)(`span`,{className:`text-[10px] leading-tight font-medium`,children:[`Turn`,` `,e.checkpointTurnCount??ye[e.turnId]??`?`]}),(0,Z.jsx)(`span`,{className:`text-[9px] leading-tight opacity-70`,children:Vn(e.completedAt,s.timestampFormat)})]})})},e.turnId),t[153]=ye,t[154]=c,t[155]=jt,t[156]=U?.turnId,t[157]=s.timestampFormat,t[158]=e):e=t[158],cn=xe.map(e),t[146]=ye,t[147]=c,t[148]=xe,t[149]=jt,t[150]=U?.turnId,t[151]=s.timestampFormat,t[152]=cn}else cn=t[152];let ln;t[159]!==Xt||t[160]!==Zt||t[161]!==sn||t[162]!==cn?(ln=(0,Z.jsxs)(`div`,{ref:N,className:Xt,style:Zt,onWheel:zt,children:[sn,cn]}),t[159]=Xt,t[160]=Zt,t[161]=sn,t[162]=cn,t[163]=ln):ln=t[163];let dn;t[164]!==Jt||t[165]!==ln?(dn=(0,Z.jsxs)(`div`,{className:`relative min-w-0 flex-1 [-webkit-app-region:no-drag]`,children:[Jt,ln]}),t[164]=Jt,t[165]=ln,t[166]=dn):dn=t[166];let fn;t[167]!==l||t[168]!==c?(fn=c?null:(0,Z.jsxs)(dr,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[l],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&u(t)},children:[(0,Z.jsx)(fr,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,Z.jsx)(kr,{className:`size-3`})}),(0,Z.jsx)(fr,{"aria-label":`Split diff view`,value:`split`,children:(0,Z.jsx)(_r,{className:`size-3`})})]}),t[167]=l,t[168]=c,t[169]=fn):fn=t[169];let pn=d?`Disable diff line wrapping`:`Enable diff line wrapping`,mn=d?`Disable line wrapping`:`Enable line wrapping`,hn=c&&`min-h-[44px] min-w-[44px]`,gn;t[170]===hn?gn=t[171]:(gn=J(hn),t[170]=hn,t[171]=gn);let _n,yn;t[172]===Symbol.for(`react.memo_cache_sentinel`)?(_n=e=>{f(!!e)},yn=(0,Z.jsx)(Ar,{className:`size-3`}),t[172]=_n,t[173]=yn):(_n=t[172],yn=t[173]);let bn;t[174]!==d||t[175]!==pn||t[176]!==mn||t[177]!==gn?(bn=(0,Z.jsx)(fr,{"aria-label":pn,title:mn,variant:`outline`,size:`xs`,className:gn,pressed:d,onPressedChange:_n,children:yn}),t[174]=d,t[175]=pn,t[176]=mn,t[177]=gn,t[178]=bn):bn=t[178];let Cn=p?`Show whitespace changes`:`Hide whitespace changes`,wn=p?`Show whitespace changes`:`Hide whitespace changes`,Tn=c&&`min-h-[44px] min-w-[44px]`,En;t[179]===Tn?En=t[180]:(En=J(Tn),t[179]=Tn,t[180]=En);let Dn,On;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(Dn=e=>{h(!!e)},On=(0,Z.jsx)(Dr,{className:`size-3`}),t[181]=Dn,t[182]=On):(Dn=t[181],On=t[182]);let jn;t[183]!==p||t[184]!==Cn||t[185]!==wn||t[186]!==En?(jn=(0,Z.jsx)(fr,{"aria-label":Cn,title:wn,variant:`outline`,size:`xs`,className:En,pressed:p,onPressedChange:Dn,children:On}),t[183]=p,t[184]=Cn,t[185]=wn,t[186]=En,t[187]=jn):jn=t[187];let Mn;t[188]!==fn||t[189]!==bn||t[190]!==jn?(Mn=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[fn,bn,jn]}),t[188]=fn,t[189]=bn,t[190]=jn,t[191]=Mn):Mn=t[191];let Nn;t[192]!==dn||t[193]!==Mn?(Nn=(0,Z.jsxs)(Z.Fragment,{children:[dn,Mn]}),t[192]=dn,t[193]=Mn,t[194]=Nn):Nn=t[194];let Pn=Nn,Fn;t[195]!==V||t[196]!==Ve||t[197]!==g||t[198]!==E||t[199]!==l||t[200]!==et.length||t[201]!==v||t[202]!==d||t[203]!==ot||t[204]!==mt||t[205]!==Ge||t[206]!==_e||t[207]!==Be||t[208]!==c||t[209]!==Qe||t[210]!==Et||t[211]!==xe.length||t[212]!==Je||t[213]!==o?(Fn=V?_e?xe.length===0?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`div`,{ref:M,className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Ve&&!Je&&(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:Ve})}),Je?Je.kind===`files`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/50 bg-card/40 px-2.5 py-1.5 [-webkit-app-region:no-drag]`,children:[(0,Z.jsx)(un,{className:`size-3.5 shrink-0 text-muted-foreground/70`}),(0,Z.jsx)(`input`,{ref:O,type:`text`,value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){y(``),e.currentTarget.blur();return}e.key===`Enter`&&Qe&&(e.preventDefault(),mt(e.shiftKey?-1:1))},placeholder:`Search files or hunks...`,"aria-label":`Search diff`,className:J(`min-w-0 flex-1 bg-transparent text-xs text-foreground outline-none placeholder:text-muted-foreground/55`,c&&`min-h-[44px]`)}),Qe&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-muted-foreground/70`,children:[et.length===0?0:E+1,` of`,` `,et.length]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>mt(-1),disabled:et.length===0,className:J(`inline-flex size-5 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/70 transition-colors hover:bg-foreground/10 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground/70`,c&&`size-[44px]`),"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,children:(0,Z.jsx)(le,{className:`size-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>mt(1),disabled:et.length===0,className:J(`inline-flex size-5 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/70 transition-colors hover:bg-foreground/10 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground/70`,c&&`size-[44px]`),"aria-label":`Next match`,title:`Next match (Enter)`,children:(0,Z.jsx)(oe,{className:`size-3.5`})})]})]}),v&&(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{y(``),O.current?.focus()},className:J(`inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/70 transition-colors hover:bg-foreground/10 hover:text-foreground`,c&&`size-[44px]`),"aria-label":`Clear search`,title:`Clear search`,children:(0,Z.jsx)(vn,{className:`size-3`})})]}),ot.length===0?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,Z.jsxs)(`p`,{children:[`No files match “`,v,`”.`]})}):(0,Z.jsx)(Wl,{className:J(`diff-render-surface min-h-0 flex-1 overflow-auto px-2 pb-2`,c&&`overflow-x-hidden overflow-y-auto overscroll-x-contain`),config:{overscrollSize:600,intersectionObserverMargin:1200},children:ot.map(e=>{let{fileDiff:t,fileIndex:n}=e,r=ku(t),i=Mu(t),a=`${i}:${o}`,s=g.has(i);return(0,Z.jsx)(`div`,{"data-diff-file-path":r,"data-diff-file-index":n,className:`diff-render-file group/diff-file mb-2 rounded-md first:mt-2 last:mb-0`,onClickCapture:c?void 0:e=>{(e.nativeEvent.composedPath?.()??[]).some(qu)&&Et(r)},children:(0,Z.jsx)($l,{fileDiff:t,renderHeaderPrefix:()=>(0,Z.jsx)(`button`,{type:`button`,className:J(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,c&&`size-[44px]`,Gu(t)),"aria-label":s?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!s,title:s?`Expand diff`:`Collapse diff`,onClick:e=>{e.stopPropagation(),kt(i)},children:s?(0,Z.jsx)(ce,{className:`size-4`}):(0,Z.jsx)(oe,{className:`size-4`})}),options:{collapsed:s,diffStyle:l===`split`?`split`:`unified`,lineDiffType:`none`,overflow:d?`wrap`:`scroll`,theme:tn(o),themeType:o,unsafeCSS:c?Du:Eu,lineHoverHighlight:`number`,...c?{}:{onLineNumberClick:e=>{let{lineNumber:t}=e;Et(r,t)}}}})},a)})})]}):(0,Z.jsx)(`div`,{className:`flex-1 overflow-auto p-2`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Je.reason}),(0,Z.jsx)(`pre`,{className:J(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,d?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Je.text})]})}):Be?(0,Z.jsx)(Wt,{label:`Loading checkpoint diff...`}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,Z.jsx)(`p`,{children:Ge?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`}),t[195]=V,t[196]=Ve,t[197]=g,t[198]=E,t[199]=l,t[200]=et.length,t[201]=v,t[202]=d,t[203]=ot,t[204]=mt,t[205]=Ge,t[206]=_e,t[207]=Be,t[208]=c,t[209]=Qe,t[210]=Et,t[211]=xe.length,t[212]=Je,t[213]=o,t[214]=Fn):Fn=t[214];let In;return t[215]!==Pn||t[216]!==i||t[217]!==Fn?(In=(0,Z.jsx)(pt,{mode:i,header:Pn,children:Fn}),t[215]=Pn,t[216]=i,t[217]=Fn,t[218]=In):In=t[218],In}function qu(e){return e instanceof Element&&e.hasAttribute(`data-title`)}function Ju(e){return{...An(e),diff:`1`}}function Yu(e){console.warn(`Failed to open diff in editor.`,e)}function Xu(e){return e.size===0?e:new Set}function Zu(e,t){return{fileDiff:e,fileIndex:t}}function Qu(e){return e.turnId}function $u(e){return typeof e==`number`}function ed(e){return Nn(e)}function td(e){return Cn(e)}function nd(){return new Set}var rd=0,id=0,ad=1,od=6e4,sd=Object.freeze({data:null,isLoading:!1,isFetching:!1,error:null}),cd=o({labelPrefix:`project-preview`,initialState:sd,gcTime:od,maxEntries:48,buildFetchingState:e=>({data:e.data,isLoading:e.data===null,isFetching:!0,error:null}),buildSuccessState:e=>({data:e,isLoading:!1,isFetching:!1,error:null}),buildErrorState:(e,t)=>({data:e.data,isLoading:!1,isFetching:!1,error:t}),isErrorState:e=>e.error!==null});function ld(e,t=ad){return e().catch(n=>{if(t<=0)throw n;return ld(e,t-1)})}function ud(e){return s(cd,{...e,createControllerFields:()=>({})},e=>!e.hasData||Date.now()-e.lastFetchedAt>=e.staleTime)}function dd(e){return T(e).projects}var fd=ud({label:`listEntries`,staleTime:rd,isEnabled:e=>(e.enabled??!0)&&e.environmentId!==null&&e.cwd!==null,buildKey:e=>`${e.environmentId}${e.cwd}`,resolveEnvironmentId:e=>e.environmentId,run:e=>ld(()=>dd(e.environmentId).listEntries({cwd:e.cwd}))}),pd=ud({label:`readFile`,staleTime:id,isEnabled:e=>(e.enabled??!0)&&e.environmentId!==null&&e.cwd!==null&&e.relativePath!==null,buildKey:e=>`${e.environmentId}${e.cwd}${e.relativePath}`,resolveEnvironmentId:e=>e.environmentId,run:e=>ld(()=>dd(e.environmentId).readFile({cwd:e.cwd,relativePath:e.relativePath}))});function md(e,t){let n=pd.keyOf(e);if(n===null)return;let r=cd.controllers.get(n);r&&(r.hasData=!0,r.lastFetchedAt=Date.now()),cd.setQueryState(n,{data:t,isLoading:!1,isFetching:!1,error:null})}function hd(e){let t=(0,X.c)(18),{environmentId:n,cwd:r,enabled:i}=e,a=fd.keyOf(e),o,s;t[0]!==r||t[1]!==i||t[2]!==n?(o=()=>fd.watch({environmentId:n,cwd:r,...i===void 0?{}:{enabled:i}}),s=[n,r,i],t[0]=r,t[1]=i,t[2]=n,t[3]=o,t[4]=s):(o=t[3],s=t[4]),(0,Y.useEffect)(o,s);let c=te(fd.getAtom(a)),l;bb0:{if(!c.data){l=null;break bb0}let e=c.data,n;t[5]===c.data.entries?n=t[6]:(n=c.data.entries.toSorted(_d),t[5]=c.data.entries,t[6]=n);let r;t[7]!==c.data||t[8]!==n?(r={...e,entries:n},t[7]=c.data,t[8]=n,t[9]=r):r=t[9],l=r}let u=l,d;t[10]===a?d=t[11]:(d=async()=>{let e=await fd.refreshAsync(a);return{data:e.data===null?null:{...e.data,entries:e.data.entries.toSorted(gd)}}},t[10]=a,t[11]=d);let f=d,p;return t[12]!==f||t[13]!==u||t[14]!==c.error||t[15]!==c.isFetching||t[16]!==c.isLoading?(p={data:u,isLoading:c.isLoading,isFetching:c.isFetching,error:c.error,refetch:f},t[12]=f,t[13]=u,t[14]=c.error,t[15]=c.isFetching,t[16]=c.isLoading,t[17]=p):p=t[17],p}function gd(e,t){return e.path.localeCompare(t.path,void 0,{numeric:!0,sensitivity:`base`})}function _d(e,t){return e.path.localeCompare(t.path,void 0,{numeric:!0,sensitivity:`base`})}function vd(e){let t=(0,X.c)(14),{environmentId:n,cwd:r,relativePath:i,enabled:a}=e,o=pd.keyOf(e),s,c;t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==i?(s=()=>pd.watch({environmentId:n,cwd:r,relativePath:i,...a===void 0?{}:{enabled:a}}),c=[n,r,i,a],t[0]=r,t[1]=a,t[2]=n,t[3]=i,t[4]=s,t[5]=c):(s=t[4],c=t[5]),(0,Y.useEffect)(s,c);let l=te(pd.getAtom(o)),u;t[6]===o?u=t[7]:(u=async()=>({data:(await pd.refreshAsync(o)).data}),t[6]=o,t[7]=u);let d=u,f;return t[8]!==d||t[9]!==l.data||t[10]!==l.error||t[11]!==l.isFetching||t[12]!==l.isLoading?(f={data:l.data,isLoading:l.isLoading,isFetching:l.isFetching,error:l.error,refetch:d},t[8]=d,t[9]=l.data,t[10]=l.error,t[11]=l.isFetching,t[12]=l.isLoading,t[13]=f):f=t[13],f}var yd={},bd=(0,Y.memo)(function(e){let t=(0,X.c)(22),{files:n,allDirectoriesExpanded:r,onSelectFile:i,resolvedTheme:a,selectedFilePath:o,showStats:s}=e,c=o===void 0?null:o,l=s===void 0||s,u;t[0]===n?u=t[1]:(u=Vt(n),t[0]=n,t[1]=u);let d=u,f;t[2]===d?f=t[3]:(f=xd(d).join(`\0`),t[2]=d,t[3]=f);let p=`${r?`expanded`:`collapsed`}\u0000${f}`,m;t[4]===p?m=t[5]:(m=()=>({key:p,overrides:{}}),t[4]=p,t[5]=m);let[h,g]=(0,Y.useState)(m),_=h.key===p?h.overrides:yd,v;t[6]!==r||t[7]!==p?(v=e=>{g(t=>{let n=t.key===p?t.overrides:{};return{key:p,overrides:{...n,[e]:!(n[e]??r)}}})},t[6]=r,t[7]=p,t[8]=v):v=t[8];let y=v,b,x;if(t[9]!==r||t[10]!==_||t[11]!==i||t[12]!==a||t[13]!==c||t[14]!==l||t[15]!==y||t[16]!==d){let e=(t,n)=>{let o=8+n*14;if(t.kind===`directory`){let i=_[t.path]??r;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`button`,{type:`button`,"data-scroll-anchor-ignore":!0,className:`group/tree-row flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left hover:bg-background/80 phone:min-h-11`,style:{paddingLeft:`${o}px`},onClick:()=>y(t.path),children:[(0,Z.jsx)(ce,{"aria-hidden":`true`,className:J(`size-3.5 shrink-0 text-muted-foreground/70 transition-transform`,i&&`rotate-90`)}),i?(0,Z.jsx)(ge,{className:`size-3.5 shrink-0 text-muted-foreground/75`}):(0,Z.jsx)(pe,{className:`size-3.5 shrink-0 text-muted-foreground/75`}),(0,Z.jsx)(`span`,{"data-tree-label":!0,className:`truncate font-mono text-[11px] text-muted-foreground/90 group-hover/tree-row:text-foreground/90`,children:t.name}),l&&Nt(t.stat)&&(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums`,children:(0,Z.jsx)(Kt,{additions:t.stat.additions,deletions:t.stat.deletions})})]}),i&&(0,Z.jsx)(`div`,{className:`space-y-0.5`,children:t.children.map(t=>e(t,n+1))})]},`dir:${t.path}`)}return(0,Z.jsxs)(`button`,{type:`button`,className:J(`group/tree-row flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left hover:bg-background/80 phone:min-h-11`,c===t.path&&`bg-accent text-accent-foreground hover:bg-accent`),style:{paddingLeft:`${o}px`},onClick:()=>i(t.path),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(ze,{pathValue:t.path,kind:`file`,theme:a,className:`size-3.5 text-muted-foreground/70`}),(0,Z.jsx)(`span`,{"data-tree-label":!0,className:J(`truncate font-mono text-[11px] text-muted-foreground/80 group-hover/tree-row:text-foreground/90`,c===t.path&&`text-accent-foreground`),children:t.name}),l&&t.stat&&(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums`,children:(0,Z.jsx)(Kt,{additions:t.stat.additions,deletions:t.stat.deletions})})]},`file:${t.path}`)};b=`space-y-0.5`,x=d.map(t=>e(t,0)),t[9]=r,t[10]=_,t[11]=i,t[12]=a,t[13]=c,t[14]=l,t[15]=y,t[16]=d,t[17]=b,t[18]=x}else b=t[17],x=t[18];let S;return t[19]!==b||t[20]!==x?(S=(0,Z.jsx)(`div`,{className:b,children:x}),t[19]=b,t[20]=x,t[21]=S):S=t[21],S});function xd(e){let t=[];for(let n of e)n.kind===`directory`&&(t.push(n.path),t.push(...xd(n.children)));return t}var Sd=100,Cd=1,wd=2,Td=3,Ed=class{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??Sd)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}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 Dd(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?wd:n?Td: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 Od(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=jd(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
1437
|
+
`)&&!a.text.includes(`
|
|
1438
|
+
`),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
|
|
1439
|
+
`)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=Cd,n!==Cd||e.coalescingMode!==void 0&&e.coalescingMode!==Cd||t.coalescingMode!==void 0&&t.coalescingMode!==Cd))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=Td;else if(c+(o.end-o.start)!==i.start)return!1;else r=wd;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 kd(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=jd(c.start,e.forwardEdits);if(o.text.length>0){i??=Cd,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text);continue}if(u===o.end){i??=Td,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text);continue}i??=wd,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text)}return{forwardEdits:n,inverseEdits:Ad(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 Ad(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 jd(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 Md=1e5,Nd=10,Pd=13,Fd=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,Id=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}},Ld=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=Ke(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===Nd||r===Pd)&&(r===Pd&&e.charCodeAt(n+1)===Nd&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},Rd=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)-+!!qd(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!qd(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},zd=class{#e;#t=new Ld(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new Ld(e);let t=this.#y(Id.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&&Bd(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=Vd(e,0,this.#r),i=Vd(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&&Bd(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=Hd(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=Ud(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=Hd(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(!Wd(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(`
|
|
1440
|
+
`)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=Qd(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,Md)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=Ke(i);for(let s=0;s<o.length;s++){let c=o[s],l=o[s+1]??a;for(;l>c&&Bd(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=tf(u,a);continue}let s=c+a;if((!t||Zd(i,s,o.length))&&(r.push([s,s+o.length]),r.length>=n))return r;a===e.lastIndex&&(e.lastIndex=tf(u,a))}}return r}insert(e,t){if(e.length===0)return;let n=Vd(t,0,this.#r);this.#b(n,n,e),this.#x()}delete(e,t){if(t<=0||this.#r===0)return;let n=Vd(e,0,this.#r),r=Vd(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=Vd(n.start,0,this.#r),i=Vd(n.end,r,this.#r);this.#b(r,i,n.text)}this.#x()}}positionAt(e){let t=Vd(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=Vd(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=Vd(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)-+!!qd(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#v(t.piece.source),i=Math.min(Jd(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&&qd(t.piece.lastCharCode,this.#d(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!qd(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)-+!!qd(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-+!!qd(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===Id.Original?this.#e:this.#t}#y(e,t,n){let r=this.#v(e),i=t+n,a=Jd(r.lineOffsets,t),o=Jd(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new Id(e,t,n,a,o,s===Pd&&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(Id.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 Rd(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 Rd(this.#y(e.piece.source,e.piece.offset,i)),o=new Rd(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 Rd(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(Gd(n.piece,t)){n.piece=Kd(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 Bd(e){return e===10||e===13}function Vd(e,t,n){return Math.min(Math.max(e,t),n)}function Hd(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 Ud(e,t){let n=[];for(let[r,i]of e){let e=Vd(r,0,t),a=Vd(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 Wd(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 Gd(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!qd(e.lastCharCode,t.firstCharCode)}function Kd(e,t){return new Id(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function qd(e,t){return e===Pd&&t===Nd}function Jd(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 Yd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xd(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return Fd.includes(t)}function Zd(e,t,n){let r=t<=0||Xd(e.charCodeAt(t-1)),i=t+n>=e.length||Xd(e.charCodeAt(t+n));return r&&i}function Qd(e,t,n){let r=t?e:Yd(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function $d(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function ef(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=Qd(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:$d(r.replaceText,u)}function tf(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 nf=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new Ed){this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new zd(t),this.#i=i;let a=this.#r.getLineText(0,!0);this.#a=a.endsWith(`\r
|
|
1441
|
+
`)?`\r
|
|
1442
|
+
`:a.endsWith(`\r`)?`\r`:`
|
|
1443
|
+
`}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 canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}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=Dd(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&&Od(o,a)?this.#i.replaceLastUndo(kd(o,a)):this.#i.push(a),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;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;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}}};function rf({metaKey:e,ctrlKey:t},n=fo()){return n?e&&!t:t&&!e}function af(e){if(fo()&&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(rf(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}var of=new WeakMap,sf=lf([{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`}}]),cf={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function lf(e){let t=of.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)}}of.set(e,t)}return t}function uf(e,t,n=fo()){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):cf[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=lf(t)[o].get(s),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let c=sf[o].get(s);return c?.get(r)??(a===void 0?void 0:c?.get(a))}function df(e,t=fo()){if(!e.altKey&&rf(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var ff=`::selection {
|
|
1444
|
+
background-color: #0000;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
[data-deleted-text-selection] [data-deletions] ::selection, [data-deleted-text-selection] [data-line-type="change-deletion"] ::selection {
|
|
1448
|
+
background-color: var(--diffs-editor-selection-bg);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
@keyframes blinking {
|
|
1452
|
+
0% {
|
|
1453
|
+
opacity: 1;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
50% {
|
|
1457
|
+
opacity: 0;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
100% {
|
|
1461
|
+
opacity: 1;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
:host, [data-code], [data-content], [data-diff-type="split"][data-overflow="wrap"] {
|
|
1466
|
+
position: relative;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
[data-code] {
|
|
1470
|
+
container-type: inline-size;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
[data-content] {
|
|
1474
|
+
cursor: text;
|
|
1475
|
+
caret-color: var(--diffs-bg-caret);
|
|
1476
|
+
background-color: #0000;
|
|
1477
|
+
outline: none;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
[data-line] {
|
|
1481
|
+
cursor: text;
|
|
1482
|
+
background-color: #0000;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
[data-line]:after {
|
|
1486
|
+
content: "";
|
|
1487
|
+
z-index: -20;
|
|
1488
|
+
background-color: var(--diffs-line-bg);
|
|
1489
|
+
pointer-events: none;
|
|
1490
|
+
position: absolute;
|
|
1491
|
+
inset: 0;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
[data-line][data-editor-active-line]:after {
|
|
1495
|
+
box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
[data-editor-overlay] {
|
|
1499
|
+
display: contents;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
[data-caret], [data-selection-range], [data-match-range], [data-bracket-match-range], [data-marker-range] {
|
|
1503
|
+
height: 1lh;
|
|
1504
|
+
line-height: var(--diffs-line-height);
|
|
1505
|
+
pointer-events: none;
|
|
1506
|
+
position: absolute;
|
|
1507
|
+
top: 0;
|
|
1508
|
+
left: 0;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
[data-caret] {
|
|
1512
|
+
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)))));
|
|
1513
|
+
visibility: hidden;
|
|
1514
|
+
width: 2px;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1518
|
+
[data-caret] {
|
|
1519
|
+
animation: 1.2s .8s infinite blinking;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
[data-selection-range] {
|
|
1524
|
+
z-index: -10;
|
|
1525
|
+
background-color: var(--diffs-editor-selection-bg);
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
[data-selection-corner] {
|
|
1529
|
+
background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));
|
|
1530
|
+
width: 100%;
|
|
1531
|
+
height: 100%;
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
[data-match-range] {
|
|
1535
|
+
z-index: -10;
|
|
1536
|
+
background-color: var(--diffs-editor-match-bg, var(--diffs-editor-selection-bg));
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
[data-match-range]:not([data-focus]) {
|
|
1540
|
+
background-color: var(--diffs-editor-match-highlight-bg, light-dark(#ff963288, #ff963266));
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
[data-bracket-match-range] {
|
|
1544
|
+
z-index: -9;
|
|
1545
|
+
box-sizing: border-box;
|
|
1546
|
+
border-bottom: 1px solid
|
|
1547
|
+
var(--diffs-editor-bracket-match-border, color-mix(in lab, var(--diffs-fg) 60%, transparent));
|
|
1548
|
+
background-color: var(--diffs-editor-bracket-match-bg, color-mix(in lab, var(--diffs-fg) 5%, transparent));
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
[data-rtl] {
|
|
1552
|
+
border-top-left-radius: 3px;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
[data-rtr] {
|
|
1556
|
+
border-top-right-radius: 3px;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
[data-rbl] {
|
|
1560
|
+
border-bottom-left-radius: 3px;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
[data-rbr] {
|
|
1564
|
+
border-bottom-right-radius: 3px;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
[data-marker-range] {
|
|
1568
|
+
z-index: 1;
|
|
1569
|
+
background-color: var(--diffs-marker-bg);
|
|
1570
|
+
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+");
|
|
1571
|
+
mask-position: 0 100%;
|
|
1572
|
+
mask-size: 6px 3px;
|
|
1573
|
+
mask-repeat: repeat-x;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
[data-marker-error] {
|
|
1577
|
+
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
1578
|
+
--diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
[data-marker-warning] {
|
|
1582
|
+
--diffs-marker-contrast: #000;
|
|
1583
|
+
--diffs-marker-bg: var(--diffs-editor-warning-fg, light-dark(var(--diffs-warning-light), var(--diffs-warning-dark)));
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
[data-marker-info] {
|
|
1587
|
+
--diffs-marker-contrast: #000;
|
|
1588
|
+
--diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
[data-marker-hint] {
|
|
1592
|
+
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
1593
|
+
--diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
@media (width >= 480px) {
|
|
1597
|
+
[data-content] {
|
|
1598
|
+
caret-color: #0000;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
[data-content]:focus ~ [data-editor-overlay] [data-caret] {
|
|
1602
|
+
visibility: visible;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
[data-editor-widget] {
|
|
1607
|
+
--diffs-widget-fg: var(--diffs-fg);
|
|
1608
|
+
--diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
|
|
1609
|
+
--diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
|
|
1610
|
+
--diffs-widget-shadow: inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013,
|
|
1611
|
+
0 6px 18px #00000013;
|
|
1612
|
+
z-index: 100;
|
|
1613
|
+
width: fit-content;
|
|
1614
|
+
max-width: calc(100% - 24px);
|
|
1615
|
+
font: 14px/20px var(--diffs-header-font-fallback);
|
|
1616
|
+
border: 1px solid var(--diffs-widget-border);
|
|
1617
|
+
background-color: var(--diffs-widget-bg);
|
|
1618
|
+
box-shadow: var(--diffs-widget-shadow);
|
|
1619
|
+
background-clip: padding-box;
|
|
1620
|
+
border-radius: 9px;
|
|
1621
|
+
position: absolute;
|
|
1622
|
+
top: 0;
|
|
1623
|
+
left: 0;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
[data-marker-popover], [data-selection-action-popover] {
|
|
1627
|
+
--popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));
|
|
1628
|
+
--popover-viewport-left: 0px;
|
|
1629
|
+
--popover-viewport-right: 100cqw;
|
|
1630
|
+
--popover-viewport-top: -99999px;
|
|
1631
|
+
--popover-viewport-bottom: 99999px;
|
|
1632
|
+
--popover-min-left: calc(var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap));
|
|
1633
|
+
--popover-available-width: max(0px,
|
|
1634
|
+
calc(var(--popover-viewport-right) - var(--popover-min-left) -
|
|
1635
|
+
var(--popover-gap)));
|
|
1636
|
+
max-width: min(640px, var(--popover-available-width));
|
|
1637
|
+
translate: clamp(var(--popover-min-left),
|
|
1638
|
+
var(--popover-x, var(--popover-min-left)),
|
|
1639
|
+
calc(var(--popover-viewport-right) - var(--popover-gap) - 100%))
|
|
1640
|
+
/* Clamp into the scrollport so a popover with no fitting side stays in view. */
|
|
1641
|
+
clamp(var(--popover-viewport-top),
|
|
1642
|
+
calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),
|
|
1643
|
+
calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%));
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
[data-marker-popover] {
|
|
1647
|
+
--diffs-widget-bg: var(--diffs-marker-bg);
|
|
1648
|
+
--diffs-widget-shadow: 0 4px 8px #00000026, 0 6px 18px #00000026;
|
|
1649
|
+
min-width: min(180px, var(--popover-available-width));
|
|
1650
|
+
overflow-wrap: anywhere;
|
|
1651
|
+
color: var(--diffs-marker-contrast);
|
|
1652
|
+
white-space: normal;
|
|
1653
|
+
pointer-events: auto;
|
|
1654
|
+
border: 0;
|
|
1655
|
+
padding: 8px 12px;
|
|
1656
|
+
|
|
1657
|
+
@supports (color: contrast-color(red)) {
|
|
1658
|
+
color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
& [data-marker-message] {
|
|
1662
|
+
white-space: normal;
|
|
1663
|
+
overflow-wrap: anywhere;
|
|
1664
|
+
|
|
1665
|
+
& code {
|
|
1666
|
+
white-space: normal;
|
|
1667
|
+
color: inherit;
|
|
1668
|
+
background-color: #0000;
|
|
1669
|
+
display: inline;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
[data-selection-action-popover] {
|
|
1675
|
+
pointer-events: auto;
|
|
1676
|
+
flex-wrap: wrap;
|
|
1677
|
+
align-items: center;
|
|
1678
|
+
gap: 4px;
|
|
1679
|
+
width: max-content;
|
|
1680
|
+
padding: 4px;
|
|
1681
|
+
display: flex;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
[data-search-panel] {
|
|
1685
|
+
z-index: 100;
|
|
1686
|
+
flex-direction: column;
|
|
1687
|
+
justify-content: right;
|
|
1688
|
+
width: 100%;
|
|
1689
|
+
height: 0;
|
|
1690
|
+
display: flex;
|
|
1691
|
+
position: sticky;
|
|
1692
|
+
top: 16px;
|
|
1693
|
+
right: 16px;
|
|
1694
|
+
container: search-panel / inline-size;
|
|
1695
|
+
|
|
1696
|
+
& [data-editor-widget] {
|
|
1697
|
+
z-index: 100;
|
|
1698
|
+
flex-shrink: 0;
|
|
1699
|
+
align-items: stretch;
|
|
1700
|
+
gap: 8px;
|
|
1701
|
+
min-width: 260px;
|
|
1702
|
+
max-width: 100%;
|
|
1703
|
+
margin-inline: auto 16px;
|
|
1704
|
+
padding: 4px;
|
|
1705
|
+
display: flex;
|
|
1706
|
+
position: relative;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
& svg {
|
|
1710
|
+
fill: currentColor;
|
|
1711
|
+
width: 12px;
|
|
1712
|
+
height: 12px;
|
|
1713
|
+
display: block;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
[data-search-grid] {
|
|
1718
|
+
grid-template-columns: auto auto auto;
|
|
1719
|
+
grid-template-areas: "find matches nav"
|
|
1720
|
+
"replace actions .";
|
|
1721
|
+
align-items: center;
|
|
1722
|
+
gap: 4px 6px;
|
|
1723
|
+
width: 100%;
|
|
1724
|
+
display: grid;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
[data-input-box][data-find] {
|
|
1728
|
+
grid-area: find;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
[data-search-nav] {
|
|
1732
|
+
grid-area: nav;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
[data-input-box][data-replace] {
|
|
1736
|
+
grid-area: replace;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
[data-replace-actions] {
|
|
1740
|
+
grid-area: actions;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
[data-search-grid][data-mode="find"] {
|
|
1744
|
+
grid-template-areas: "find matches nav";
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
[data-search-grid][data-mode="find"] [data-replace-cell] {
|
|
1748
|
+
display: none;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
@container search-panel (width < 400px) {
|
|
1752
|
+
[data-search-panel] [data-editor-widget] {
|
|
1753
|
+
padding: 10px;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
[data-search-grid][data-mode="replace"] {
|
|
1757
|
+
grid-template-columns: auto 1fr auto;
|
|
1758
|
+
grid-template-areas: "find find find"
|
|
1759
|
+
"replace replace replace"
|
|
1760
|
+
"nav matches actions";
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
[data-search-grid][data-mode="find"] {
|
|
1764
|
+
grid-template-columns: auto 1fr auto;
|
|
1765
|
+
grid-template-areas: "find find find"
|
|
1766
|
+
"nav matches matches";
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
[data-replace-actions] {
|
|
1770
|
+
justify-self: end;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
[data-search-grid] [data-input-box] {
|
|
1774
|
+
width: auto;
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
[data-input-box] {
|
|
1779
|
+
align-items: center;
|
|
1780
|
+
width: 200px;
|
|
1781
|
+
display: flex;
|
|
1782
|
+
position: relative;
|
|
1783
|
+
|
|
1784
|
+
& input {
|
|
1785
|
+
width: 100%;
|
|
1786
|
+
min-width: 0;
|
|
1787
|
+
color: var(--diffs-fg);
|
|
1788
|
+
background-color: var(--diffs-bg);
|
|
1789
|
+
border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));
|
|
1790
|
+
border-radius: 6px;
|
|
1791
|
+
outline: none;
|
|
1792
|
+
flex-grow: 1;
|
|
1793
|
+
padding-inline: 6px;
|
|
1794
|
+
font-size: 13px;
|
|
1795
|
+
line-height: 24px;
|
|
1796
|
+
|
|
1797
|
+
&::selection {
|
|
1798
|
+
background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
&:focus-visible {
|
|
1802
|
+
outline: 1px solid var(--diffs-modified-base);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
&[data-find] input {
|
|
1807
|
+
padding-inline-end: 72px;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
& [data-search-icon] {
|
|
1811
|
+
--diffs-search-icon-size: 20px;
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
[data-search-toggles] {
|
|
1816
|
+
align-items: center;
|
|
1817
|
+
gap: 1px;
|
|
1818
|
+
display: flex;
|
|
1819
|
+
position: absolute;
|
|
1820
|
+
top: 50%;
|
|
1821
|
+
right: 4px;
|
|
1822
|
+
transform: translateY(-50%);
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
[data-matches] {
|
|
1826
|
+
white-space: nowrap;
|
|
1827
|
+
min-width: 50px;
|
|
1828
|
+
color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
|
|
1829
|
+
flex-shrink: 0;
|
|
1830
|
+
grid-area: matches;
|
|
1831
|
+
font-size: 12px;
|
|
1832
|
+
font-weight: 500;
|
|
1833
|
+
line-height: 20px;
|
|
1834
|
+
|
|
1835
|
+
&[data-no-matches] {
|
|
1836
|
+
color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
[data-replace-actions], [data-search-nav] {
|
|
1841
|
+
align-items: center;
|
|
1842
|
+
display: flex;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
[data-search-icon] {
|
|
1846
|
+
appearance: none;
|
|
1847
|
+
width: var(--diffs-search-icon-size, 24px);
|
|
1848
|
+
height: var(--diffs-search-icon-size, 24px);
|
|
1849
|
+
color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));
|
|
1850
|
+
border-radius: var(--diffs-search-icon-radius, 4px);
|
|
1851
|
+
cursor: pointer;
|
|
1852
|
+
background: none;
|
|
1853
|
+
border: 0;
|
|
1854
|
+
flex-shrink: 0;
|
|
1855
|
+
justify-content: center;
|
|
1856
|
+
align-items: center;
|
|
1857
|
+
margin: 0;
|
|
1858
|
+
padding: 0;
|
|
1859
|
+
transition: background-color .1s ease-in-out, color .1s ease-in-out;
|
|
1860
|
+
display: flex;
|
|
1861
|
+
|
|
1862
|
+
&:disabled {
|
|
1863
|
+
opacity: .25;
|
|
1864
|
+
cursor: default;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
&:not(:disabled):hover {
|
|
1868
|
+
color: var(--diffs-fg);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
&:focus-visible {
|
|
1872
|
+
outline: 1px solid var(--diffs-modified-base);
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
&[aria-pressed="true"] {
|
|
1876
|
+
color: var(--diffs-modified-base);
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
[data-search-close] {
|
|
1881
|
+
--diffs-search-icon-size: 20px;
|
|
1882
|
+
--diffs-search-icon-radius: 50%;
|
|
1883
|
+
color: var(--diffs-widget-bg);
|
|
1884
|
+
background-color: color-mix(in lab,
|
|
1885
|
+
var(--diffs-widget-fg) 50%,
|
|
1886
|
+
var(--diffs-bg));
|
|
1887
|
+
position: absolute;
|
|
1888
|
+
top: 0;
|
|
1889
|
+
right: 0;
|
|
1890
|
+
transform: translate(50%, -50%);
|
|
1891
|
+
|
|
1892
|
+
&:not(:disabled):hover {
|
|
1893
|
+
opacity: 1;
|
|
1894
|
+
color: var(--diffs-widget-bg);
|
|
1895
|
+
background-color: var(--diffs-widget-fg);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
`,pf=`//`,mf=[`/*`,`*/`],hf={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 gf(e,t){let n={...hf[e],...t?.[e]};return{lineComment:n.lineComment===void 0?pf:n.lineComment,blockComment:n.blockComment??mf}}function _f(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 vf=50;function yf(e,t,n,r,i){let a=Math.max(0,r-vf),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+vf),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+vf),p=d??e.getTextSlice(i-vf,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 bf(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 xf(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=yf(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=bf(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?bf(e.end,s,u,e.endAssociation):n,a[t].direction]})}}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 $(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Sf(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 Cf(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 wf(e,t){return Object.assign(e,t)}function Tf(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function Ef(e,t=1e3){return Math.round(e*t)/t}function Df(e){return e.endsWith(`
|
|
1899
|
+
`)||e.endsWith(`\r`)}function Of(e){if(!(typeof Intl>`u`||typeof Intl.Segmenter!=`function`))return new Intl.Segmenter(void 0,e)}var kf,Af=!1;function jf(){return Af||=(kf=Of({granularity:`grapheme`}),!0),kf}function Mf(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}function Nf(e,t){let n=Pf(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(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=Ff(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||Lf(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){r.push(c===a.lineNumber?a:{...a,lineNumber:c}),i=!0;continue}r.push(a)}return i?r:void 0}function Pf(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 Ff(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(If(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return Rf(t.startLine+r,n)}function If(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function Lf(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function Rf(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function zf(e,t,n){let r=new Map,i=new Map;for(let t of e){let e=t.lineNumber;r.has(e)||r.set(e,[]),i.has(e)||i.set(e,[]),(t.side===`deletions`?i:r).get(e).push(wa(t))}let a=t.parentElement?.previousElementSibling,o,s;if(a!=null&&a instanceof HTMLElement&&a.dataset.deletions!==void 0)for(let e of a.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(s=t):o=t}Bf(t,n),s!==void 0&&Bf(s,o);let c=Vf(r,t,n);if(s===void 0)return;let l=Vf(i,s,o);requestAnimationFrame(()=>{Hf(r,i,c,l)})}function Bf(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 Vf(e,t,n){let r=new Map;for(let n of t.children){let t=Sf(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=Sf(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 Hf(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=Uf(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=Uf(t);n>0&&i.set(e,n)}}Wf(e,n,i),Wf(t,r,i)}function Uf(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function Wf(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 Gf=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=[$(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[$(r,`scroll`,t,{passive:!0})],$(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function Kf(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`)}var qf=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),Jf=new Set([`'`,`"`,"`"]),Yf=new Set([`{`,`[`,`(`,`<`]);function Xf(e,t=0){let n=nm(e.startContainer,e.startOffset),r=nm(e.endContainer,e.endOffset);if(n!==null&&r!==null)return{start:n,end:r,direction:t}}function Zf(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 Qf(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=vp(t);a=i.line,o=i.character;let s=tp(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+$p(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=$f(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=$f(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(_p(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`){if(o>0)o=Yp(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=Yp(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 $f(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=tp(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=rp(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=np(e,s,i);c=rp(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:ep(f,d)}}function ep(e,t){if(t<=0||t>=e.length)return t;let n=jf();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 tp(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=rp(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return rp(e,t,n<(a[0]??0)?0:a.length-2,r)}function np(e,t,n){let r=n.getSoftLineOffsets?.(t);return r===void 0||r.length<2?1:r.length-1}function rp(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 ip(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=Qf(e,[{start:i,end:i,direction:0}],n,r);return Tp(t,a)})}function ap(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=tm(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=tm(e,{start:g.start,end:g.end,text:f.text},i),n=Qp(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=em(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=Nf(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function op(e,t){if(t.length!==e.length+2)return;let n=qf.get(t[0]);if(n!==void 0&&t[t.length-1]===n&&t.slice(1,-1)===e)return 1}function sp(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=op(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 cp(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=Qp(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=sp(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=em(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=Nf(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function lp(e,t){return e===`never`?!1:e===`brackets`?Yf.has(t):e!==`quotes`||Jf.has(t)}function up(e,t,n,r){if(n.length!==1||t.length===0)return;let i=qf.get(n);if(i===void 0||!lp(r,n))return;let a=[];for(let r of t){if(_p(r))return;a.push(n+e.getText(r)+i)}return a}function dp(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=Xp(e,n);if(!_p(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=Jp(l),p;if(s>0&&s<u){let e=qp(l,s,!1,f),t=qp(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?qp(n,r,!1,Jp(n)):r,u=qp(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=em(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=Nf(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function fp(e,t,n){let r=t.map(t=>{let n=Zp(e,t);return{start:n.start,end:n.end,direction:0}});return cp(e,r,r.map(()=>``),n)}function pp(e,t,n,r){let i=t.map(t=>{if(!_p(t))return{start:t.start,end:t.end,direction:0};let r=vp(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 cp(e,i,i.map(()=>``),r)}function mp(e,t,n){let r=t.map(t=>{let[n,r]=Kp(e,t);return{start:n,end:r,direction:0}});return cp(e,r,r.map(()=>``),n)}function hp(e,t,n){if(!_p(t))return[t.start,t.end];let r=vp(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:Yp(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:Yp(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 gp(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=hp(e,t,n);if(!n&&_p(t)){let t=tm(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 cp(e,a,a.map(()=>``),r)}function _p(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function vp(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function yp(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function bp(e,t){let n=_p(e),r=_p(t);return n&&r?xp(e.start,t.start)===0:n?xp(t.start,e.start)<=0&&xp(e.start,t.end)<=0:r?xp(e.start,t.start)<=0&&xp(t.start,e.end)<=0:xp(e.start,t.end)<0&&xp(t.start,e.end)<0}function xp(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Sp(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 Cp(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 wp(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=Cp(a,r),c=Cp(o,r);return Sp(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function Tp(e,t){let n=e.direction===-1?e.end:e.start,r=xp(n,t.start),i=xp(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=xp(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Ep(e,t){let n=xp(t.start,e.start)<0,r=xp(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:xp(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:xp(e.start,t.end)===0?0:1}}function Dp(e,t){return Op(e.map(e=>Ep(e,t)))}function Op(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=xp(e.selection.start,t.selection.start);if(n!==0)return n;let r=xp(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(bp(r.selection,e.selection)){let t=e.index>r.index?e:r,n=xp(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=xp(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&xp(n,i)!==0&&(a=xp(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 kp(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&xp(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 Ap(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 jp(e,t){if(t.length===0)return;let n=t.map(t=>_p(t)?Wp(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 xp(e.start,r.start)!==0||xp(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Sp(e,o,o+i.length);return[...n,s]}function Mp(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function Np(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 Pp(e,t){if(_p(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 Fp(e,t){return t.map(t=>Pp(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function Ip(e,t){return Fp(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function Lp(e,t){let n=Fp(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&&!Df(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end}return i}function Rp(e,t){if(_p(t))return zp(e,t);let[n,r]=xp(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function zp(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 Bp(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 Vp(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 Hp(e,t){let n=[...t.map((t,n)=>({index:n,edit:Rp(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=Bp(n);return{text:Lp(e,t),edits:r,nextSelectionOffsets:Vp(n,r)}}function Up(e,t){let n=Math.max(0,t),r=rm(e),i=null;for(let e of r){i=e;let t=dm(e);if(n<=t+(e.textContent?.length??0)){let r=im(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=im(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=fm(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,fm(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,fm(o.textContent,o.textContent?.length??0)]}function Wp(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=Gp(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 Gp(e,t){let n=Of({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 Kp(e,t){if(!_p(t))return[t.start,t.end];let n=vp(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=Jp(a),s=i,c;for(;s>0;){let e=qp(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 qp(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 Jp(e){let t=[0],n=jf();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 Yp(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=jf();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=jf();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 Xp(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(vp(t))]}function Zp(e,t){if(!_p(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 Qp(e,t,n){if(t!==`
|
|
1900
|
+
`&&t!==`\r`&&t!==`\r
|
|
1901
|
+
`)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=$p(i);return a===0?t:t+i.slice(0,a)}function $p(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function em(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 tm(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 nm(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&um(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=um(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:cm(e.parentElement)===null?{line:r,character:sm(n,e)+fm(e.textContent,t)}:{line:r,character:lm(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=lm(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=dm(e);if(t!==void 0)return{line:r,character:t};let n=cm(e),i=n===null?void 0:dm(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?lm(i.childNodes[t-1]):sm(n,i)}}return{line:r,character:sm(n,i)}}return null}function rm(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(dm(e)!==void 0){t.push(e);continue}for(let n of e.childNodes)n.nodeType===1&&dm(n)!==void 0&&t.push(n)}}return t}function im(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=fm(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 am(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+=fm(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function om(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function sm(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=lm(e.childNodes[t]);return n}for(let n of rm(e))if(om(n,t))return dm(n)+(t.nodeType===3?am(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&um(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=lm(e.childNodes[r]);r=e}return n}function cm(e){let t=e;for(;t!==null;){if(um(t)!==void 0)return null;if(dm(t)!==void 0)return t;t=t.parentElement}return null}function lm(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=cm(n);if(r===null)return 0;let i=dm(r);if(i===void 0)return 0;let a=t===void 0?fm(e.textContent,e.textContent?.length??0):fm(e.textContent,t);return i+am(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=dm(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,lm(e));return i}function um(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 dm(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function fm(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}var pm=300,mm=100,hm=`marker-popover`,gm=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=[$(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)}),$(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=Sf(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(bp({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)},pm)}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopover()},mm))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){Kf(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:hm})===`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(hm)}#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(hm),s!==void 0){vm(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:``,[ym(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=[$(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),$(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},_m=[`error`,`warning`,`info`,`hint`];function vm(e,t){for(let t of _m)delete e.dataset[ym(t)];e.dataset[ym(t)]=``}function ym(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}var bm=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),xm=new Map([...bm].map(([e,t])=>[t,e])),Sm=1e3,Cm=5e4;function wm(e,t,n){let r=Tm(e,t,e.normalizePosition(n));if(r===void 0)return;let i=bm.get(r.char),a=xm.get(r.char);if(i!==void 0)return Pm(r,Om(e,t,r,i));if(a!==void 0)return Pm(km(e,t,r,a),r)}function Tm(e,t,n){let r=Em(n);if(r!==void 0){let n=Dm(e,t,r);if(n!==void 0)return n}return Dm(e,t,n)}function Em(e){if(e.character>0)return{line:e.line,character:e.character-1}}function Dm(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!bm.has(r)&&!xm.has(r)||Am(t,n)))return{...n,char:r}}function Om(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=Sm)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>=Cm)return;if(o++,Mm(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 km(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=Sm)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>=Cm)return;if(o++,Nm(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 Am(e,t){return jm(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function jm(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 Mm(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 Nm(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 Pm(e,t){if(e!==void 0&&t!==void 0)return[Fm(e),Fm(t)]}function Fm(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var Im=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1902
|
+
<symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
|
|
1903
|
+
<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>
|
|
1904
|
+
</symbol>
|
|
1905
|
+
<symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
|
|
1906
|
+
<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>
|
|
1907
|
+
</symbol>
|
|
1908
|
+
<symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
|
|
1909
|
+
<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>
|
|
1910
|
+
</symbol>
|
|
1911
|
+
<symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
|
|
1912
|
+
<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>
|
|
1913
|
+
<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>
|
|
1914
|
+
</symbol>
|
|
1915
|
+
<symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
|
|
1916
|
+
<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>
|
|
1917
|
+
<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>
|
|
1918
|
+
<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>
|
|
1919
|
+
</symbol>
|
|
1920
|
+
<symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
|
|
1921
|
+
<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>
|
|
1922
|
+
<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>
|
|
1923
|
+
</symbol>
|
|
1924
|
+
<symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
|
|
1925
|
+
<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>
|
|
1926
|
+
</symbol>
|
|
1927
|
+
<symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
|
|
1928
|
+
<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>
|
|
1929
|
+
</symbol>
|
|
1930
|
+
</svg>`,Lm=()=>{let e=document.createElement(`div`);e.innerHTML=Im;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},Rm=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
|
|
1931
|
+
<use href="#diffs-editor-icon-${e}"></use>
|
|
1932
|
+
</svg>`,zm=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(j.disabled=n,M.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0){if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:ef(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:Rm(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)return;let t=df(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=>{let t=df(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?rf(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),I(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let D=Q(`div`,{dataset:`searchToggles`,children:[C,w,T]}),O=Q(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,D]}),k=Q(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),A=Q(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),j=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),M=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});j.disabled=!0,M.disabled=!0;let N=Q(`div`,{dataset:`searchNav`,children:[j,M]}),P=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),F=Q(`div`,{dataset:{searchGrid:``,mode:i},children:[O,k,A,f,N,P]}),I=e=>{F.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=I,this.#e=Q(`div`,{dataset:`searchPanel`,children:[Q(`div`,{dataset:`editorWidget`,children:[F]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},Bm=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`,Kf(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function Vm(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function Hm(e){return typeof e==`object`?e:e===`indexedDB`?new qm:new Um}var Um=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:Vm(t)}set(e,t){this.#e.set(e,Vm(t))}},Wm=`pierre-diffs-editor-state`,Gm=1,Km=`states`,qm=class{#e=Jm();async get(e){let t=await this.#e;if(t===void 0)return;let n=await Ym(t.transaction(Km,`readonly`).objectStore(Km).get(e));return n===void 0?void 0:Vm(n)}async set(e,t){let n=await this.#e;n!==void 0&&await Ym(n.transaction(Km,`readwrite`).objectStore(Km).put(Vm(t),e))}};function Jm(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(Wm,Gm);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(Km)||e.createObjectStore(Km)},Ym(t)}catch{return Promise.resolve(void 0)}}function Ym(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var Xm=4096,Zm=/\p{Mark}/u,Qm=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=Ef(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=nh(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))),Ef(n)}#i(e){return $m(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return Ef(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=Ef(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=Xm){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 $m(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&&Zm.test(e.charAt(t)))return!0}return!1}function eh(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!$m(e))return n;let r=jf();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 th(e){if(!$m(e))return;let t=[0],n=jf();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 nh(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 rh=500,ih=0,ah=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[$t];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++ih;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=Tf(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&&!ch(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]??$t,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=K,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=[$(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=[$t],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=K}=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()!==``&&!Ta.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 {
|
|
1933
|
+
--diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
|
|
1934
|
+
--diffs-editor-line-highlight-border: ${c};
|
|
1935
|
+
--diffs-editor-active-line-source-mix: ${l};
|
|
1936
|
+
--diffs-editor-match-bg: ${d??`initial`};
|
|
1937
|
+
--diffs-editor-match-highlight-bg: ${f??`initial`};
|
|
1938
|
+
--diffs-editor-bracket-match-bg: ${p??`initial`};
|
|
1939
|
+
--diffs-editor-bracket-match-border: ${m??`initial`};
|
|
1940
|
+
--diffs-editor-cursor-fg: ${u??`initial`};
|
|
1941
|
+
--diffs-editor-hint-fg: ${h??`initial`};
|
|
1942
|
+
--diffs-editor-info-fg: ${g??`initial`};
|
|
1943
|
+
--diffs-editor-warning-fg: ${_??`initial`};
|
|
1944
|
+
--diffs-editor-error-fg: ${v??`initial`};
|
|
1945
|
+
}`),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&&!ch(this.#o.languageId))throw Error(`Grammar for language "${this.#o.languageId}" not loaded`);this.#d&&(this.#O.length=Math.min(this.#O.length,e.startLine));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),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]??$t;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]??$t;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.#B(v,p,y);else if(!x&&b<r){let e=l&&s>=c?o:s<c&&!u?s:b;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&&!ch(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(ch(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=oh(this.#t,this.#a,n,t,rh,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]??$t;for(;i<n;){this.#h[i]=a;let e=this.#o.getLineText(i);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=oh(this.#t,this.#a,e,a,rh,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]??$t,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=oh(this.#t,this.#a,r,o,rh,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 oh(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=ut.getForeground(s);u.push([r,t[e],n.slice(r,i)])}a&&ut.getTokenType(s)>0&&d.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d}}function sh(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 ch(e){return e===`text`||e===`ansi`}function lh(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 uh(e){if(typeof e.cacheKey!=`string`||e.cacheKey.length===0)throw Error(`Editor persistState requires a non-empty file.cacheKey for "${e.name}". Provide a unique, stable cacheKey for every editable file.`);return e.cacheKey}function dh(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}var fh=2,ph=1e4,mh=`selection-action`,hh=`application/vnd.pierre.diffs-selections+json`,gh=class{#e;#t=new Qm;#n;#r;#i=new Map;#a;#o;#s=new Map;#c;#l=0;#u=!1;#d;#f;#p;#m;#h={generation:0,callback:void 0,delivered:!1};#g;#_;#v;#y=new Map;#b=new Map;#x=new Map;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H;#U=!0;#W=!1;#G=!1;#K=!1;#q;#J=!1;#Y=!1;#X=!1;#Z=!1;#Q;#$=``;#ee;#te;#ne;#re;#ie;#ae;#oe=!1;#se=!1;#ce=!1;#le=!1;#ue;#de=(e,t)=>{if(this.#P?.updateRenderCache(e,t),this.#R!==void 0&&this.#R.totalLines!==1/0){let{startingLine:t,totalLines:n}=this.#R,r=Math.min(t+n,this.#L?.lineCount??0);for(let[n,i]of e)if(n>=t&&n<r){let e=this.#zt(n);e!==void 0&&e.replaceChildren(...sh(i))}}};constructor(e={}){this.#e=e}setOptions(e){let t=this.#e.persistStateStorage??`inMemory`,n={...this.#e,...e};if(n.persistState===!0&&this.#P?.type===`file`){let e=this.#P.__getCurrentFile?.()??this.#F;e!==void 0&&uh(e)}this.#e=n,this.#e.persistState!==!0&&(this.#i.clear(),this.#l++,this.#u=!1),(this.#e.persistStateStorage??`inMemory`)!==t&&(this.#l++,this.#a=void 0,this.#o=void 0,this.#s.clear())}edit(e){if(this.#e.persistState===!0&&e.type===`file`){let t=e.__getCurrentFile?.();t!==void 0&&uh(t)}return this.#Oe(),this.#P=e,this.#Ne(),this.#m=e.attachEditor(this),()=>this.cleanUp()}applyEdits(e,t=!0){let n=this.#L;if(n==null)throw Error(`Editor is not attached`);let r=this.#K,i=this.#ne,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=wp(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#It(s,c,this.#Lt(s),{skipFocus:!r})}get canUndo(){return this.#L?.canUndo??!1}get canRedo(){return this.#L?.canRedo??!1}undo(){this.#Ve(`undo`)}redo(){this.#Ve(`redo`)}getFile(){let e=this.#F,t=this.#L;if(e===void 0||t===void 0)return;let n={...e};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>t.getText()}),n}getText(){return this.#L?.getText()??``}getState(){let e=this.#P;return{selections:this.#ne,view:e==null?void 0:{scrollLeft:e.getCodeScrollLeft(),scrollTop:this.#je()}}}setState({selections:e,view:t}){if(this.#P===void 0||this.#L===void 0)throw Error(`Editor is not attached`);if(this.#U=!1,this.#gt(e??[]),t!=null){this.#P.setCodeScrollLeft(t.scrollLeft),t.scrollTop!==void 0&&this.#Me(t.scrollTop);return}this.#rt()}setSelections(e){let t=this.#L;if(t===void 0)throw Error(`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 xp(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#U=!1,this.#gt(n);let r=n.at(-1);r!==void 0&&this.#xe(vp(r).line),this.#rt()}setMarkers(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);if(e.length===0){this.#B?.cleanup(),this.#B=void 0,this.#gt(this.#ne??[]);return}this.#B??=new gm({popoverManager:this.#Te(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#A,getGutterWidth:()=>this.#Bt(),getCharX:(e,t)=>this.#Ut(e,t),getLineY:e=>this.#Ht(e),isMouseDown:()=>this.#X||this.#Y}),this.#B.setMarkers(e,t),this.#k!==void 0&&this.#B.listenHover(this.#k),this.#gt(this.#ne??[])}focus(e){let t=e?.preventScroll??!1,n=e?.lineNumber;if(n===`first-visible`||typeof n==`number`){let r=this.#L;if(r==null||this.#P==null)return;let i=n===`first-visible`?this.#et(e?.offset):n;if(i==null)return;let a=r.normalizePosition({line:i-1,character:n===`first-visible`?0:e?.character??0});this.#tt(a,t);return}let r=this.#ne?.at(-1);if(r!==void 0){let e=r.direction===-1?r.end:r.start;this.#Ze(e,t)}else this.#Ze(void 0,t)}blur(){this.#q=void 0,this.#K=!1,this.#W=!1,this.#k?.blur()}cleanUp(e=!1){this.#Oe(),e||(this.#h.delivered=!1);let t=this.#P!=null,n=this.#e.persistState===!0;this.#l++,this.#me(),t&&(this.#u=n),zr(this.#Re),this.#n?.cleanUp(),this.#n=void 0,e||(this.#L=void 0,this.#F=void 0),this.#f?.forEach(e=>e()),this.#f=void 0,this.#d?.forEach(e=>e()),this.#d=void 0,this.#p?.forEach(e=>e()),this.#p=void 0,this.#m?.(e),this.#m=void 0,this.#_=void 0,this.#v=void 0,this.#y.clear(),this.#b.clear(),this.#x.clear(),this.#S=void 0,this.#C?.remove(),this.#C=void 0,this.#w?.remove(),this.#w=void 0,this.#T?.remove(),this.#T=void 0,this.#E?.remove(),this.#E=void 0,this.#D=void 0,this.#r?.cleanUp(),this.#r=void 0,this.#O=void 0,this.#k?.removeAttribute(`contentEditable`),this.#k=void 0,this.#q=void 0,this.#K=!1,this.#A?.remove(),this.#A=void 0,this.#N?.disconnect(),this.#N=void 0,this.#le=!1,this.#ue!==void 0&&(cancelAnimationFrame(this.#ue),this.#ue=void 0),this.#De(),this.#P=void 0}__prepareFile(e){if(this.#e.persistState!==!0)return e;let t=uh(e),n=this.#F,r=e.lang??Zt(e.name);n!==void 0&&(uh(n)!==t||n.name!==e.name||this.#L?.languageId!==r)&&(this.#l++,this.#me());let i=this.#fe(e,t);return i===void 0||i.getText()===e.contents?e:{...e,contents:i.getText()}}__postponeBgTokenizeToNextFrame(){let e=this.#n;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{e.resumeBackgroundTokenize()}))}__captureFocusForDOMReplacement(){let e=this.#k,t=this.#D?.shadowRoot?.activeElement;e!=null&&(this.#K||t===e||t!=null&&e.contains(t))&&(this.#q={})}__syncRenderView=(e,t,n,r,i)=>{let a=this.#P;if(a==null)return;let o=t.shadowRoot;if(o==null){console.error(`[editor] Could not find the shadow root.`);return}let s,c,l;for(let e of o.querySelectorAll(`[data-code]`))if(e.dataset.deletions===void 0){s=e;for(let t of e.children){let e=t,{gutter:n,content:r}=e.dataset;n===void 0?r!==void 0&&(l=e):c=e}break}if(s===void 0||l===void 0){this.#q=void 0;return}this.#Te().setViewportElements(t,s),this.#D!==t&&(this.#D=t,this.#C!==void 0&&t.appendChild(this.#C),this.#w!==void 0&&o.appendChild(this.#w),this.#T!==void 0&&o.appendChild(this.#T),this.#E!==void 0&&o.prepend(this.#E));let u=this.#L===void 0||this.#F===void 0||this.#F.name!==n.name||this.#F.lang!==n.lang||this.#F.cacheKey!==n.cacheKey,d=this.#e.persistState===!0?uh(n):void 0,f;if(u){this.#Oe();let e=``;e=`contents`in n?n.contents:n.additionLines.join(``);let t=new Ed({maxEntries:this.#e.historyMaxEntries}),{name:r,lang:i,cacheKey:o}=n,s=i??Zt(n.name),c=d===void 0?void 0:this.#fe(n,d),l=a.type===`file`||c?.getText()===e?c:void 0,u=l??new nf(n.name,e,s,0,t);this.#F={name:r,lang:i,cacheKey:o},this.#L=u,d!==void 0&&(this.#i.set(d,u),f={cacheKey:d,textDocument:u}),this.#n?.cleanUp(),this.#n=void 0,this.#De(),this.#b.clear(),this.#ne=this.#te,this.#e.__debug===!0&&console.log(l===void 0?`[diffs/editor] text document rebuilt from`:`[diffs/editor] cached text document reused for`,n.name)}f===void 0&&this.#u&&d!==void 0&&this.#L!==void 0&&(f={cacheKey:d,textDocument:this.#L});let p=this.#L;if(this.#n==null&&p!=null&&(this.#n=new ah({highlighter:e,textDocument:p,codeOptions:this.#P?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#de,onThemeChange:()=>this.#ht(),setStyle:e=>{this.#T.textContent=e},__debug:this.#e.__debug})),this.#k!==l&&(this.#O=c,this.#k=wf(l,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#A!==void 0&&l.after(this.#A),this.#t.init(l),this.#Je(),this.#Le(l,c),this.#k!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),this.#q!=null&&(this.#q.target=l),l.ariaLabel!==n.name&&(l.ariaLabel=n.name),r!==void 0&&r.length>0||this.#Ce)for(let e of this.#k.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`)}if(this.#Ee(),this.#n?.syncTheme(this.#P?.__getEffectiveCodeOptions()??{}),this.#I=r,this.#R=i,this.#z=i?.totalLines,this.#n?.prebuildStateStack(i),this.#B?.removePopover(),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[]),this.#te!==void 0&&this.#M!==void 0?(this.#te=void 0,this.#rt(!1,`center`)):this.#ie===void 0?this.#q===void 0?this.#ne!==void 0&&this.#ne.length>0&&this.#K&&!this.#ce&&this.focus({preventScroll:!0}):this.#Qe():this.#at(this.#ie,this.#ae,this.#se),this.#ce&&this.#V?.focus(),this.#e.__debug===!0&&i!==void 0){let{startingLine:e,totalLines:t}=i;console.log(`[diffs/editor] render file:`,n.name,`RenderRange:`,e+`-`+(e+t),`of`,this.#L?.lineCount,`lines`)}f!==void 0&&(this.#u=!1,this.#_e(f.cacheKey,f.textDocument)),this.#ke(a)};#fe(e,t){let n=this.#i.get(t),r=e.lang??Zt(e.name);return n?.languageId===r?n:void 0}#pe(){let e=this.#e.persistStateStorage??`inMemory`;return(this.#a===void 0||this.#o!==e)&&(this.#a=Hm(e),this.#o=e),this.#a}#me(){let e=this.#F,t=this.#L;if(this.#e.persistState!==!0||this.#P===void 0||e===void 0||t===void 0)return;let n=uh(e);this.#i.set(n,t);let r;try{r=this.#pe()}catch{return}let i=Vm(this.getState()),a=this.#c;if(a?.cacheKey===n&&a.textDocument===t){if(this.#c=void 0,t.version===a.documentVersion&&this.#ne===a.selections&&i.view?.scrollLeft===a.view?.scrollLeft&&i.view?.scrollTop===a.view?.scrollTop)return;this.#he(r,n,i,a.completion);return}this.#he(r,n,i)}#he(e,t,n,r){let i=this.#s.get(t);if(r!==void 0||i!==void 0){let a=r??Promise.resolve();i!==void 0&&(a=a.then(()=>i)),this.#ge(t,a.then(()=>e.set(t,n)));return}let a;try{a=e.set(t,n)}catch{return}dh(a)&&this.#ge(t,a)}#ge(e,t){let n=t.catch(()=>{});this.#s.set(e,n),n.finally(()=>{this.#s.get(e)===n&&this.#s.delete(e)})}#_e(e,t){let n=++this.#l,r=t.version,i=this.#ne,a=this.getState().view,o,s=s=>{let c=this.getState().view;if(n!==this.#l||this.#L!==t||t.version!==r||this.#ne!==i||c?.scrollLeft!==a?.scrollLeft||this.#F===void 0||uh(this.#F)!==e)return;let l=o?.userScrolled()===!0;if(s===void 0){this.#P?.setCodeScrollLeft(0),l||this.#Me(0);return}let u=Vm(s);l&&u.view!==void 0&&(u.view={scrollLeft:u.view.scrollLeft}),this.setState(u)},c=()=>{let t;try{t=this.#pe().get(e)}catch{return}if(dh(t))return t.then(s).catch(()=>{});try{s(t)}catch{}},l=this.#s.get(e),u=l===void 0?c():l.then(c);if(dh(u)){o=this.#ve();let n={cacheKey:e,textDocument:t,documentVersion:r,selections:i,view:a,completion:u.catch(()=>{})};this.#c=n,n.completion.finally(()=>{o?.dispose(),this.#c===n&&(this.#c=void 0)})}}#ve(){let e=this.#Ae();if(!(e instanceof HTMLElement))return;let t=!1,n=[`wheel`,`touchstart`,`mousedown`],r=()=>{for(let t of n)e.removeEventListener(t,i,{capture:!0})},i=()=>{t=!0,r()};for(let t of n)e.addEventListener(t,i,{capture:!0,passive:!0});return{userScrolled:()=>t,dispose:r}}#ye(e){return this.#P?.isLineRenderable?.(e+1)??!0}get#be(){let e=this.#P;if(e?.getNearestRenderableLine!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#xe(e){this.#ye(e)||this.#P?.revealLine?.(e+1)}get#Se(){return this.#P?.options.diffStyle??`split`}get#Ce(){return this.#P?.type===`file-diff`}get#we(){return this.#P?.options.overflow===`wrap`}#Te(){return this.#r??=new Gf({hasActivePopover:()=>this.#H!==void 0||this.#B?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#St(),this.#B?.updatePopoverPosition()}})}#Ee(){this.#y.clear(),this.#x.clear(),this.#S=void 0}#De(){this.#mt(null),this.#_=void 0,this.#v=void 0,this.#W=!1,this.#G=!1,this.#j?.forEach(e=>e.remove()),this.#j=void 0,this.#ne=void 0,this.#ee=void 0,this.#ie=void 0,this.#B?.cleanup(),this.#B=void 0,this.#V?.cleanup(),this.#V=void 0,this.#H?.cleanup(),this.#H=void 0,this.#U=!0}#Oe(){let e=this.#h;e.generation++,e.callback!=null&&(zr(e.callback),e.callback=void 0)}#ke(e){let t=this.#h,n=this.#L;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.#P!==e||this.#L!==n))return;let a=this.#k,o=this.#D?.shadowRoot;a==null||o==null||!o.contains(a)||(t.delivered=!0,this.#e.onAttach?.(this,e))};t.callback=i,Rr(i)}#Ae(){let e=this.#P?.getEditorViewport?.();if(e!==void 0)return e;let t=this.#D;if(this.#P!=null&&t!=null)return Mf(t)}#je(){let e=this.#Ae();return e instanceof HTMLElement?e.scrollTop:e?.defaultView?.scrollY??0}#Me(e){let t=this.#Ae();t instanceof HTMLElement?t.scrollTop=e:t instanceof Document&&t.defaultView?.scrollTo({top:e})}#Ne(){this.#C=Q(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
1946
|
+
[data-annotation-slot] {
|
|
1947
|
+
user-select: none;
|
|
1948
|
+
-webkit-user-select: none;
|
|
1949
|
+
}
|
|
1950
|
+
`}),this.#w=Q(`style`,{dataset:`editorCss`,textContent:ff}),this.#T=Q(`style`,{dataset:`editorThemeCss`}),this.#E=Lm(),this.#A=Q(`div`,{dataset:`editorOverlay`});let e=e=>{let t=e.composedPath()[0];return t instanceof Node&&this.#k?.contains(t)===!0},t=()=>{this.#q!=null&&(this.#q=void 0,this.#K=!1,this.#W=!1)};this.#f=[$(document,`focusin`,n=>{e(n)||t()},{passive:!0}),$(document,`pointerdown`,n=>{e(n)||queueMicrotask(t)},{capture:!0,passive:!0}),$(document,`selectionchange`,()=>{let e=this.#D?.shadowRoot;if(this.#W||this.#G||e==null||!this.#K||this.#ne!==void 0&&this.#ne.length>1&&!this.#X)return;let t=document.getSelection();if(t==null)return;let n=typeof t.getComposedRanges==`function`?t.getComposedRanges({shadowRoots:[e]})?.[0]:lh(e);if(n===void 0||!this.#Kt(n))return;let r=Xf(n,0);if(r!==void 0){if(this.#X&&this.#Z&&this.#ne!==void 0&&this.#ne.length>0){let e=this.#ne.at(-1);this.#gt([Ep(e,r)]);return}if(this.#X)this.#Q===void 0?this.#Q=r:r=Tp(this.#Q,r);else if(this.#Q!==void 0)r.direction=Tp(this.#Q,r).direction;else if(this.#ne!==void 0&&this.#ne.length===1){let e=this.#ne[0];xp(e.start,r.start)===0&&xp(e.end,r.end)===0&&(r.direction=e.direction)}this.#ee===void 0?this.#gt([r]):this.#gt([...this.#ee.filter(e=>!bp(e,r)),r])}},{passive:!0}),$(document,`pointerup`,e=>{e.pointerType===`mouse`&&(this.#p?.forEach(e=>e()),this.#p=void 0,this.#Y&&(this.#Y=!1,this.#Ze()),this.#W=!1,this.#X=!1,this.#Z=!1,this.#Q=void 0,this.#ee=void 0,this.#e.enabledSelectionAction===!0&&this.#ne!==void 0&&this.#ne.length>0&&!_p(this.#ne.at(-1))&&this.#gt(this.#ne))},{passive:!0}),$(document,`keydown`,e=>{e.key===`Shift`&&(this.#Q=this.#ne?.at(-1))},{passive:!0}),$(document,`keyup`,e=>{e.key===`Shift`&&(this.#Q=void 0)},{passive:!0})]}#Pe(e){this.#p?.forEach(e=>e()),this.#p=e}#Fe(){return this.#P?.options.enableLineSelection===!0}#Ie(){this.#G=this.#ne!==void 0}#Le(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.#d?.forEach(e=>e()),this.#d=[$(e,`focus`,()=>{this.#K=!0,n?.(),!this.#X&&!this.#W&&this.#ne!==void 0&&this.#ne.length>0&&this.#nt(this.#ne.at(-1))},{passive:!0}),$(e,`blur`,()=>{this.#q?.target===e&&(this.#q=void 0,this.#W=!1),this.#K=!1,r?.()},{passive:!0}),$(e,`pointerdown`,t=>{if(this.#U=!0,this.#G=!1,t.pointerType===`mouse`){if(this.#st(t)){this.#pt(!0),this.#ne!==void 0&&this.#gt([]);return}if(this.#pt(!1),this.#B?.removePopover(),po()&&this.#I!==void 0&&this.#I.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[$(e,`mouseenter`,()=>{this.#W=!0}),$(e,`mouseleave`,()=>{this.#W=!1})]).flat();this.#Pe(t)}if(this.#X=!0,this.#Q=void 0,t.button===0&&rf(t)&&(this.#ee=this.#ne?.map(e=>({...e}))),t.shiftKey){let e=this.#ne?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#nt({start:t,end:t,direction:0})}this.#Z=!0}}},{passive:!0}),$(e,`keydown`,e=>{if(!i(e))return;this.#U=!0,this.#G=!1;let t=uf(e,this.#e.keymap);if(t!==void 0){e.preventDefault(),t===`simplifySelection`&&(this.#V?.close(),this.#V=void 0,this.#ce=!1,this.#H?.cleanup(),this.#H=void 0),this.#Ve(t);return}let n=af(e),r=this.#L;if(this.#ne!==void 0&&this.#ne.length>0&&n!==void 0&&r!==void 0){let t={getSoftLineOffsets:this.#we?e=>this.#Gt(e):void 0,resolveRenderableLine:this.#be};e.shiftKey?this.#gt(ip(r,this.#ne,n,t)):this.#gt(Qf(r,this.#ne,n,t)),this.#rt(),e.preventDefault();return}if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&rf(e)){if(e.repeat&&this.#Ce){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),Rr(this.#Re);return}}if(this.#V!==void 0){let t=df(e);if(t!==void 0){e.preventDefault(),this.#V.navigate(t===`previous`);return}}}),$(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#dt()?e.clipboardData?.setData(`text`,this.#ft()):this.#Dt(e.clipboardData,this.#Tt(),this.#Et()))}),$(e,`cut`,e=>{if(i(e)){if(e.preventDefault(),this.#dt())e.clipboardData?.setData(`text`,this.#ft());else{let t=this.#Et();this.#Dt(e.clipboardData,this.#Ot(),t)}}}),$(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#L;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#ne?.length??0;if(a>1){let e=t.getData(hh);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#At(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),$(e,`beforeinput`,e=>{i(e)&&e.inputType!==`insertCompositionText`&&(e.preventDefault(),this.#Xe(e.inputType,e.data))}),$(e,`drop`,e=>{i(e)&&e.preventDefault()}),$(e,`compositionstart`,e=>{i(e)&&(this.#J=!0,this.#W=!0)},{passive:!0}),$(e,`compositionend`,e=>{if(!i(e))return;this.#W=!1;let t=this.#J;this.#J=!1,(e.data!==``||!t)&&this.#Xe(`insertText`,e.data)},{passive:!0})];let a=this.#D?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#d.push($(a,`pointerdown`,e=>{let t=e.composedPath();if(Ri(t)){this.#Ie();return}let n=t[0],r=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(r instanceof HTMLElement){if(this.#Fe()){this.#Ie();return}if(this.#ut(r,a,e.pointerType===`mouse`))return}this.#pt(!0),this.#ne!==void 0&&this.#gt([])},{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=Sf(e)??Sf(e,`columnNumber`);if(!(n===void 0||t===void 0||!yp(t)))return n-1};this.#d.push($(t,`pointerdown`,t=>{let r=t.composedPath();if(Ri(r)){this.#Ie();return}let i=e(r[0]);if(i!==void 0&&this.#Fe()){this.#Ie();return}if(i?.dataset.lineType===`change-deletion`){let e=i.closest(`[data-code]`);e!=null&&this.#ut(i,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let a=this.#L,o=n(i);if(o===void 0||a===void 0)return;this.#U=!0,this.#B?.removePopover();let s=this.#ot(o,o,a);this.#Y=!0,this.#Q=s,this.#gt([s]),this.#nt(s),this.#Ze(),this.#Pe([$(document,`mousemove`,t=>{if(!this.#Y)return;let r=this.#L,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#Q?.start.line??i,o=this.#ot(a,i,r);this.#Q??=o,this.#gt([o]),this.#Ze(o.direction===-1?o.start:o.end)},{passive:!0})])},{passive:!0}))}this.#B?.listenHover(e),this.#N?.disconnect(),this.#N=new ResizeObserver(this.#qe),this.#N.observe(e),this.#N.observe(e.parentElement),this.#ze(e)}#Re=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#ne?.length??0;if(n>1){let r=await e.readText(hh);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#L;r!==void 0&&this.#At(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#ze(e){this.#Ce&&this.#Se===`split`&&this.#we&&(this.#g={top:e.offsetTop,left:e.offsetLeft-this.#Bt()},this.#e.__debug===!0&&console.log(`[diffs/editor] content offset:`,this.#g))}get#Be(){if(this.#Ce&&this.#Se===`split`&&this.#we)return this.#g}#Ve(e){let t=this.#L;if(t!==void 0)switch(e){case`openSearchPanel`:this.#Ct(`find`);break;case`openSearchReplacePanel`:this.#Ct(`replace`);break;case`findNextMatch`:{let e=this.#ne;if(e===void 0)break;if(e.some(_p)){let n=e.map(e=>_p(e)?Wp(t,e):e);this.#gt(n),this.focus()}else{let n=jp(t,e);if(n!==void 0){this.#gt(n);let e=n.at(-1);e!==void 0&&this.#xe(vp(e).line),this.#rt()}}break}case`moveLineUp`:case`moveLineDown`:this.#Ke(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#We(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#ne,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#gt([t]),this.#Ze(vp(t));else if(!_p(t)){let e=vp(t);this.#gt([{start:e,end:e,direction:0}]),this.#Ze(e)}break}case`insertBlankLine`:this.#Ge();break;case`deleteHardLineForward`:this.#Pt();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#ne;if(n===void 0)break;let{lineComment:r,blockComment:i}=gf(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#Ue(_f(t,n,r));break}let a=e===`toggleComment`,o=xf(t,n,i,a);o!==void 0&&this.#Ue(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.#ne!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#ne){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=Zf(t,o,this.#t.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.#t.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.#ne,r);o!==void 0&&this.#It(o,r)}break;case`selectAll`:{let e=Mp(t);this.#gt([e]),this.focus();let n=this.#Rt(),r=n[0]?.[0],i=n.at(-1)?.[1];r!==void 0&&i!==void 0&&(this.#G=!0,this.#nt({start:{line:r,character:0},end:{line:i,character:t.getLineLength(i)},direction:1}));break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=Np(t,e===`moveCursorToDocEnd`,this.#Ce);this.#gt([n]),this.#xe(vp(n).line),this.#rt()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#ne;if(r!==void 0){let e=Np(t,n,this.#Ce);this.#gt(Dp(r,e)),this.#xe(vp(e).line),this.#rt()}}break;case`undo`:case`redo`:this.#He(e)}}#He(e){let t=this.#L;if(t===void 0||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#ne,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?wp(t,n,r,c):void 0);this.#It(a,l,s)}#Ue(e,t){let n=this.#L,r=this.#ne;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?wp(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#It(s,c,this.#Lt(s))}#We(e){let t=this.#L,n=this.#ne;if(t===void 0||n===void 0)return;let r=kp(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.#Ue(o,()=>s)}#Ge(){let e=this.#L,t=this.#ne;if(e===void 0||t===void 0)return;let n=t.map(e=>vp(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.#Ue(o,()=>s)}#Ke(e){let t=this.#L,n=this.#ne;if(t===void 0||n===void 0)return;let r=kp(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=>Ap(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#It(d,u)}#qe=()=>{let e=this.#I?.length??0,t=this.#_,n=this.#v;this.#_=void 0,this.#v=void 0;let r=this.#Bt()!==t,i=this.#Vt()!==n;!r&&!i||(this.#x.clear(),this.#S=void 0,this.#t.clearTextWidthCache(),i&&(this.#b.clear(),(this.#we||e>0)&&this.#y.clear()),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&(this.#gt(this.#ne??[]),this.#ne!==void 0&&this.#K&&this.focus()),this.#B?.removePopover(),this.#ze(this.#k))};#Je(){if(this.#le)return;let e=document.fonts;e!==void 0&&(this.#le=!0,e.ready.then(()=>{this.#k===void 0||!this.#t.remeasureCharacterWidth()||(this.#_=void 0,this.#v=void 0,this.#Ee(),this.#b.clear(),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[]),this.#B?.removePopover())}))}#Ye(e,t,n=this.#R,r){let i=this.#n,a=this.#P,o=this.#L,s=this.#O,c=this.#k;if(i===void 0||a===void 0||o===void 0||c===void 0)return;i.stopBackgroundTokenize();let l=performance.now(),u=i.tokenize(e,n,!this.#Ce),d=performance.now();if(u.size>0){let e=c.children,t=new Set;for(let e of u.keys())this.#ye(e)&&t.add(e);for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=Sf(r),n=r.dataset.lineType;if(e===void 0||n===`change-deletion`)continue;let i=e-1;if(t.has(i)){let e=u.get(i);if(r.replaceChildren(...sh(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=Sf(r);if(i!==void 0&&r.dataset.lineType!==`change-deletion`){n=i;break}}for(let e of t){if(e<n)continue;let t=u.get(e),r=String(e+1);Q(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:sh(t)},c),s!==void 0&&Q(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[Q(`span`,{dataset:{lineNumberContent:``},textContent:r})]},s)}}}if(e.lineDelta<0)for(let t of[c.children,s?.children??[]])for(let n=t.length-1;n>=0;n--){let r=t[n],i=Sf(r)??Sf(r,`columnNumber`),a=r.dataset.lineType;if(i!==void 0&&a!==`change-deletion`){if(i-1<e.lineCount)break;r.remove()}}let f=e.lineDelta!==0;if(f){let e=c.children.length;for(let t of c.children){let{bufferSize:n}=t.dataset;n!==void 0&&(e+=parseInt(n)-1)}c.style.gridRow=`span `+e,s!==void 0&&(s.style.gridRow=`span `+e)}a.updateRenderCache(u,i.themeType,{shouldRefreshDiffsView:this.#Ce&&!f,lineCountChangeInFlight:f}),f&&a.applyDocumentChange(o,t,r),(f||this.#Ce&&this.#Se===`unified`)&&this.#Ee(),t!==void 0&&(this.#I=t,zf(t,c,s)),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${Ef(performance.now()-d)}ms,`,`tokenize in: ${Ef(d-l)}ms (${u.size} dirty lines)`)}#Xe(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#L,r=this.#ne,i=n!==void 0&&r!==void 0?up(n,r,e,this.#e.autoSurround):void 0;this.#At(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#At(this.#L?.eol??`
|
|
1951
|
+
`);break;case`deleteContentBackward`:this.#jt();break;case`deleteContentForward`:this.#jt(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#Mt();break;case`deleteWordBackward`:this.#Nt();break;case`insertTranspose`:this.#Ft();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t)}}#Ze(e,t=!0,n){this.#K=!0,e===void 0?n?.()===!1?this.#K=!1:this.#k?.focus({preventScroll:t}):(this.#W=!0,this.#nt({start:e,end:e,direction:0}),Rr(()=>{if(n?.()===!1||!this.#K){this.#W=!1;return}this.#k?.focus({preventScroll:t}),Rr(()=>{this.#W=!1})}))}#Qe(e){let t=this.#q;if(t==null)return;if(this.#ce){this.#q=void 0,this.#K=!1,this.#W=!1;return}let n=this.#k;if(n==null||!this.#$e(n)){this.#q=void 0,this.#K=!1;return}let r=()=>{if(this.#q!==t)return!1;let e=this.#$e(n);return this.#q=void 0,e};if(e!=null){this.#Ze(e,!0,r);return}let i=this.#ne?.at(-1);if(i==null){this.#Ze(void 0,!0,r);return}let a=i.direction===-1?i.end:i.start;this.#Ze(a,!0,r)}#$e(e){let t=this.#D,n=t?.shadowRoot;if(t==null||n==null||this.#k!==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}#et(e=0){let t=this.#k,n=this.#D;if(this.#L==null||t==null||n==null)return;let r=this.#Ae();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=Sf(t),r=t.dataset.lineType;if(n==null||r==null||!yp(r))continue;let o=t.getBoundingClientRect();if(!(o.bottom<=o.top)&&o.top>=i&&o.top<a)return n}}#tt(e,t){let n={start:e,end:e,direction:0};this.#U=!1,this.#gt([n]),this.#xe(e.line),t?this.#Ze(e,!0):this.#rt()}#nt(e){let t=window.getSelection();if(t===null)return;let{start:n,end:r,direction:i}=e;xp(n,r)>0&&([n,r]=[r,n]);let a=this.#zt(n.line),o=this.#zt(r.line);if(a===void 0||o===void 0)return;let[s,c]=Up(a,n.character),[l,u]=Up(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{t.setBaseAndExtent(s,Cf(s,c),l,Cf(l,u))}catch(e){console.error(`[diffs/editor] failed to update window selection:`,e)}}#rt(e=!1,t=`nearest`){let n=this.#ne?.at(-1);if(n===void 0)return;let r=this.#M;if(r!==void 0){if(r.scrollIntoView({block:t,inline:`nearest`}),!e){let e=n.direction===-1?n.end:n.start;this.#q===void 0?this.#Ze(e):this.#Qe(e)}}else{let t=vp(n);this.#at(t.line,t.character,e)}}#it(){let e=this.#V===void 0?0:48,t=this.#Bt()+this.#t.ch;return`${e}px ${this.#t.ch}px 0 ${t}px`}#at(e,t=0,n=!1){this.__postponeBgTokenizeToNextFrame();let r=Q(`div`,{style:{position:`absolute`,left:`0`,width:`2px`,height:this.#t.lineHeight+`px`,scrollMargin:this.#it()}});if(this.#zt(e)!==void 0){let[i,a]=this.#Ut(e,t),o=this.#Ht(e)+a*this.#t.lineHeight;if(r.style.top=o+`px`,r.style.left=i+`px`,this.#A?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),!n){let n={line:e,character:t};this.#q===void 0?this.#Ze(n):this.#Qe(n)}this.#ie=void 0,this.#ae=void 0,this.#oe=!1,this.#se=!1}else{let i=this.#P?.getLinePosition?.(e+1);if(i!==void 0)r.style.top=i.top+`px`,this.#D?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),i.height>0&&this.#ye(e)?(this.#ie=e,this.#ae=t,this.#se=n):(this.#ie=void 0,this.#ae=void 0,this.#se=!1);else{let i=0;if(this.#ie===e&&this.#k!==void 0)for(let t=this.#k.childElementCount-1;t>=0;t--){let n=this.#k.children[t],r=n.dataset.lineType,a=Sf(n);if(r!==void 0&&yp(r)&&a!==void 0){i=(e-(a-1))*this.#t.lineHeight;break}}let a=((this.#I??[]).filter(t=>t.lineNumber<e).length+e)*this.#t.lineHeight+i;r.style.top=a+`px`,this.#D?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),this.#ie===e&&(i===0||this.#oe)||!this.#ye(e)?(this.#ie=void 0,this.#ae=void 0,this.#oe=!1,this.#se=!1):(this.#ie=e,this.#ae=t,this.#oe=i!==0,this.#se=n)}}r.remove()}#ot(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}}#st(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&t.closest(`[data-line]`)?.getAttribute(`data-line-type`)===`change-deletion`}#ct(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.#pt(!0),this.#gt([]),this.#mt(Sf(t)??null,!0,`deletions`);let l=Math.min(i,a),u=Math.max(i,a);this.#$=l<0?``:r.slice(l,u+1).filter(e=>e.getAttribute(`data-line-type`)===`change-deletion`).map(e=>e.textContent??``).join(`
|
|
1952
|
+
`)}#lt(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}#ut(e,t,n){let r=t.querySelector(`[data-content]`),i=this.#lt(e,r);return i!==void 0&&(this.#ct(i,i,t),n&&this.#Pe([$(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.#lt(a,r);e!==void 0&&this.#ct(i,e,t)}},{passive:!0})]),!0)}#dt(){return this.#D?.shadowRoot?.querySelector(`pre`)?.hasAttribute(`data-deleted-text-selection`)??!1}#ft(){return this.#$===``?window.getSelection()?.toString()??``:this.#$}#pt(e){let t=this.#D?.shadowRoot?.querySelector(`pre`);t!=null&&(e?(t.setAttribute(`data-deleted-text-selection`,``),this.#mt(null),this.#$=``):(t.removeAttribute(`data-deleted-text-selection`),this.#$=``))}#mt(e,t=!1,n=`additions`){try{this.#P?.setEditorActiveLine(e,{lineNumberOnly:t,side:n})}catch{}}#ht(){this.#ue===void 0&&(this.#ue=requestAnimationFrame(()=>{this.#ue=void 0,(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[])}))}#gt(e){if(this.__postponeBgTokenizeToNextFrame(),this.#M=void 0,this.#mt(null),e.length===0&&this.#re===void 0&&this.#B===void 0){this.#ne=void 0,this.#j?.forEach(e=>e.remove()),this.#j?.clear(),this.#H?.cleanup(),this.#H=void 0;return}let t=document.createDocumentFragment(),n={fragment:t,elements:new Map};if(e.length>0){let t=Op(e),r=t.at(-1);this.#ne=t;let i=t.some(e=>!_p(e)),a=vp(r).line+1;this.#mt(a,i);for(let e of t)_p(e)||this.#_t(n,`selection`,e),this.#xt(n,e,e===r);let o=this.#e.matchBrackets!==!1&&this.#L!==void 0&&this.#n!==void 0&&_p(r)?wm(this.#L,this.#n,r.start):void 0;if(o!==void 0)for(let e of o)this.#_t(n,`bracketMatch`,e)}let r=this.#L;if(this.#re!==void 0&&r!==void 0){let e=this.#re,t=this.#R,i=t!==void 0&&Number.isFinite(t.totalLines)||this.#Ce&&this.#P?.options.expandUnchanged!==!0?this.#Rt():void 0,a=this.#ne?.at(-1),o=a===void 0?-1:r.offsetAt(a.start),s=a===void 0?-1:r.offsetAt(a.end),c=0,l=i?.length??1;for(let t=0;t<l;t++){let a=1/0,l=i?.[t];if(l!==void 0){let[t,n]=l,i=r.offsetAt({line:t,character:0}),o=n+1;a=o<r.lineCount?r.offsetAt({line:o,character:0}):r.offsetAt({line:o-1,character:r.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,i]=e[c];if(t>=a)break;let l={start:r.positionAt(t),end:r.positionAt(i)},u=o===t&&s===i;this.#_t(n,`match`,l,u?`focus`:void 0)}}}if(this.#B!==void 0&&r!==void 0)for(let e of this.#B.markers)this.#_t(n,`marker`,e,ym(e.severity));this.#A?.appendChild(t),this.#j?.forEach(e=>e.remove()),this.#j?.clear(),this.#j=n.elements,this.#St()}#_t(e,t,n,r){if(this.#L===void 0)return;let{start:i,end:a}=n,o=i.line,s=a.line+1;if(this.#R!==void 0){let{startingLine:e,totalLines:t}=this.#R;o=Math.max(o,e),s=Math.min(s,e+t)}for(let n=o;n<s;n++){if(!this.#qt(n))continue;let o=n===a.line,s=n===i.line?i.character:0,c=o?a.character:this.#L.getLineLength(n);if(this.#we){let i=this.#Vt(),a=this.#L.getLineText(n);if(2*this.#t.ch+this.#t.measureTextWidth(a)>i){this.#vt(e,n,a,s,c,o,t,r);continue}}let l=0,u=0,d=0;l=s===0?this.#Bt()+this.#t.ch+(this.#Be?.left??0):this.#Ut(n,s)[0],!o&&t===`selection`&&(d=this.#t.ch),u=s===c?d:this.#Ut(n,c)[0]-l+d,this.#bt(e,t,n,0,l,u,r)}}#vt(e,t,n,r,i,a,o,s){let c=this.#Gt(t),l=c.length-1,u=this.#Bt()+this.#t.ch+(this.#Be?.left??0);for(let d=0;d<l;d++){let f=c[d],p=c[d+1],m=Math.max(r,f),h=Math.min(i,p);if(m>h)continue;let g=this.#yt(n,f,m),_=u+g,v=0;!a&&d===l-1&&o===`selection`&&(v=this.#t.ch);let y=m===h?v:this.#yt(n,f,h)-g+v;this.#bt(e,o,t,d,_,y,s)}}#yt(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=nh(r,this.#t.tabSize);return i===-1?this.#t.measureTextWidth(r):i*this.#t.ch}#bt(e,t,n,r,i,a,o){if(a===0)return;let{ch:s,lineHeight:c}=this.#t,l=this.#Ht(n)+r*c,u=`${t}-${n}/${r}-${i}-${a} ${o??``}`,d=this.#j,f=(this.#e.roundedSelection??!0)&&t===`selection`,p=(n,r,i,a)=>{let o=this.#Ht(n)+r*c,l=this.#zt(n),u=`initial`;l!==void 0&&(l.dataset.lineType===`change-addition`||l.dataset.selectedLine!==void 0)&&(u=getComputedStyle(l).getPropertyValue(`--diffs-line-bg`));let f=`width:${s}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&&(d?.has(h)===!0?(g=d.get(h),g.style.cssText=f,d.delete(h)):g=Q(`div`,{dataset:`selectionRange`,style:{cssText:f},children:[Q(`div`,{dataset:p})]},e.fragment),e.elements.set(h,g))},m=t=>{let o=i+a,c=t.dataset,l=e.previousSelectionRange;if((l===void 0||l.line!==n||l.wrapLine!==r)&&(e.previousSelectionRange={element:t,line:n,wrapLine:r,left:i,width:a}),l===void 0||o<=l.left)[`rtl`,`rtr`,`rbl`,`rbr`].forEach(e=>{c[e]=``});else{let e=l.line,t=l.wrapLine,a=l.left,u=l.element.dataset,d=a+l.width;a>i&&p(e,t,a-s,`rbr`),delete u.rbl,delete c.rtl,delete c.rtr,o>=d&&delete u.rbr,o>d&&(p(e,t,d,`rbl`),c.rtr=``),o<d&&p(n,r,o,`rtl`),i<a&&(c.rtl=``),c.rbl=``,c.rbr=``}},h=e.elements.get(u);if(h!==void 0){f&&m(h);return}d?.has(u)===!0?(h=d.get(u),d.delete(u)):h=Q(`div`,{dataset:o?[t+`Range`,o]:t+`Range`},e.fragment),h.style.width=`${a}px`,h.style.transform=`translateX(${i}px) translateY(${l}px)`,f&&m(h),e.elements.set(u,h)}#xt(e,t,n){let{line:r,character:i}=vp(t);if(!this.#qt(r))return;let[a,o]=this.#Ut(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.#Ht(r)+o*this.#t.lineHeight}px)`}},e.fragment);e.elements.set(s,c),n&&(c.style.scrollMargin=this.#it(),this.#M=c)}#St(){let e=this.#ne?.at(-1),t=this.#A,n=this.#L,r=this.#e.renderSelectionAction,i=()=>{this.#H?.cleanup(),this.#H=void 0};if(this.#e.enabledSelectionAction!==!0||r===void 0||e===void 0||_p(e)||this.#X||t===void 0||n===void 0){i();return}let a=vp(e);if(!this.#qt(a.line)){i();return}if(this.#H===void 0){if(!this.#U)return;let a=()=>this.#ne?.at(-1)??e,o=r({textDocument:n,get selection(){return a()},applyEdits:e=>this.applyEdits(e),getSelectionText:()=>this.#L?.getText(a())??``,replaceSelectionText:e=>{this.#At(e,[a()])},close:()=>{i(),this.#rt()}});this.#H=new Bm(o,t,()=>this.#St()),this.#Te().resetPlacement(mh)}let o=this.#t.lineHeight,s=e.direction===-1,c={placeAbove:s,anchor:a},l=s?{placeAbove:!1,anchor:e.end}:{placeAbove:!0,anchor:e.start},u=this.#H.height,d=e=>{let[t,n]=this.#Ut(e.anchor.line,e.anchor.character),r=this.#Ht(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.#qt(l.anchor.line)?d(l):void 0,g=this.#Te(),_=g.getPlacementBounds(),v=h!==void 0&&g.choosePlacement({preferred:f,fallback:h,viewport:_,popoverHeight:u,atDocumentEdge:m,placementKey:mh})===`fallback`;h===void 0&&g.setPlacement(`preferred`,mh);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.#H.reposition(b,x,this.#Bt(),y,w,_)}#Ct(e){if(this.#V!==void 0){this.#V.setMode(e);return}this.#wt(e)}#wt(e){this.#V?.cleanup();let t=this.#L,n=this.#D?.shadowRoot?.querySelector(`pre`),r=this.#ne;if(t===void 0||n==null)return;let i=``,a;if(r!==void 0&&r.length>0){let e=r.at(-1);if(_p(e)){e=Wp(t,e),this.#gt([...r.slice(0,-1),e]);let n=t.getText(e);n!==``&&!n.includes(`
|
|
1953
|
+
`)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=Sp(t,e,n);this.#gt([i]),this.#xe(vp(i).line),this.#rt(!0),this.#ce=r},s=new zm({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.#ne);n!==void 0&&this.#It(n,void 0,this.#Lt(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#re=void 0,this.#gt(this.#ne??[]);return}if(this.#re=e,n?.syncSelection===!1){this.#gt(this.#ne??[]);let n=this.#ne?.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.#ne?.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.#gt(this.#ne??[]):o(a,!0),a},onClose:()=>{this.#V=void 0,this.#ce=!1,this.#re=void 0,this.#gt(this.#ne??[])}});this.#V=s,this.#ce=!1}#Tt(){let e=this.#L,t=this.#ne;return e===void 0||t===void 0?``:Lp(e,t)}#Et(){let e=this.#L,t=this.#ne;return e===void 0||t===void 0?[]:Ip(e,t)}#Dt(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(hh,JSON.stringify(n)))}#Ot(){let e=this.#L,t=this.#ne;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>_p(e))){let n=Hp(e,t);return this.#kt(n.edits,n.nextSelectionOffsets),n.text}let n=Lp(e,t);return this.#At(``,void 0,!0),n}#kt(e,t){let n=this.#L,r=this.#ne;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.#It(i,a,this.#Lt(i))}#At(e,t=this.#ne,n=!1,r=`selection`){if(t===void 0)return;let i=this.#L,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?cp(i,t,e,this.#I,n,r):ap(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#I,void 0,n);s!==void 0&&this.#It(s,o,this.#Lt(s))}#jt(e=!1){let t=this.#ne,n=this.#L;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=gp(n,t,e,this.#I,this.#t.tabSize);i!==void 0&&this.#It(i,r,this.#Lt(i))}#Mt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=pp(t,e,this.#we?(e,t)=>{let n=this.#Gt(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.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Nt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=mp(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Pt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=fp(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Ft(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=dp(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#It(e,t,n,r){let i=this.getFile(),a=this.#e.onChange;if(i!==void 0&&a!==void 0){let t=n??this.#I;a(i,t,{changes:e.changes,file:i,lineAnnotations:t})}if(e.lineDelta!==0||this.#we)for(let t of this.#y.keys())t>=e.startLine&&this.#y.delete(t);if(this.#b.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.#b.delete(e);else for(let t of this.#b.keys())t>=e.startLine&&this.#b.delete(t)}this.#S=void 0;let o=this.#R,s;if(o!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=o.startingLine+o.totalLines;if(n.end.line>=r){let t=n.end.line-o.startingLine+1,i=this.#z===void 0||this.#z===1/0?1/0:this.#z*fh;e.startLine<=r&&t<=i&&this.#ye(n.end.line)?(n.end.line>r&&(s=!0),o={...o,totalLines:t},this.#R=o):s=!0}}if(this.#Ye(e,n,o,s),r?.skipSearchRefresh!==!0&&this.#V!==void 0&&this.#re!==void 0&&this.#V.updateMatches({syncSelection:!1}),t!==void 0&&(this.#gt(t),r?.skipFocus!==!0)){let e=t.at(-1);if(e!==void 0&&this.#xe(vp(e).line),this.#M!==void 0)requestAnimationFrame(()=>{this.#M?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=vp(t.at(-1));this.#at(e.line,e.character)}this.focus({preventScroll:!0})}}#Lt(e){if(this.#I!==void 0){let t=Nf(e,this.#I);if(t!==void 0)return this.#L?.setLastUndoLineAnnotations(this.#I,t),t}}#Rt(){let e=this.#k;if(e===void 0)return[];let t=[];for(let n of e.children){let e=n,r=e.dataset.lineType,i=Sf(e);if(i===void 0||r===void 0||!yp(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}#zt(e){let t=this.#x.get(e);if(t!==void 0)return t??void 0;let n=this.#R;if(n!==void 0&&(e<n.startingLine||e>=n.startingLine+n.totalLines))return;let r=this.#k;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=Sf(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&yp(o)){t=r;break}}}return t??=r.querySelector(`[data-line="${e+1}"]`+(this.#Se===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#x.set(e,t),t??void 0}}#Bt(){if(this.#O===void 0)return 0;if(this.#_===void 0){let e=this.#k?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);this.#_=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseInt(e.slice(0,-2),10):this.#O.offsetWidth}return this.#_}#Vt(){if(this.#k===void 0)return 0;if(this.#v===void 0){let e=this.#k.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);this.#v=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseFloat(e.slice(0,-2)):this.#k.offsetWidth}return this.#v}#Ht(e){let t=this.#y.get(e);if(t!==void 0)return t;let n=this.#zt(e);if(n===void 0)return-1;let r=n.offsetTop+this.#t.paddingTop;return r+=this.#Be?.top??0,this.#y.set(e,r),r}#Ut(e,t){if(this.#S!==void 0&&this.#S[0]===e&&this.#S[1]===t)return[this.#S[2],this.#S[3]];let n=this.#L?.getLineText(e),r=this.#Bt()+this.#t.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#Be?.left??0),0];let i=eh(n,Math.min(t,n.length)),a=n.slice(0,i),o=nh(a,this.#t.tabSize),s=0,c=0;if(s=o===-1?r+this.#t.measureTextWidth(a):r+o*this.#t.ch,this.#we){let t=this.#Vt();if(2*this.#t.ch+this.#t.measureTextWidth(n)>t){let t=this.#Wt(e);if(t==null)return[s+(this.#Be?.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=nh(t,this.#t.tabSize);s=o===-1?r+this.#t.measureTextWidth(t):r+o*this.#t.ch;break}}}s+=this.#Be?.left??0}return this.#S===void 0?this.#S=[e,t,s,c]:(this.#S[0]=e,this.#S[1]=t,this.#S[2]=s,this.#S[3]=c),[s,c]}#Wt(e){let t=this.#b.get(e);if(t!==void 0)return t;this.#b.size>=ph&&this.#b.clear();let n=this.#L?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#b.set(e,t),t}let r=this.#k;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.#t.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=th(n),c=t.left+this.#t.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)),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=po()&&n-c>this.#t.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.#b.set(e,m),m}finally{i.remove()}}#Gt(e){let t=this.#Wt(e);if(t!==void 0)return t;let n=this.#L?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Kt({startContainer:e,endContainer:t}){let n=this.#k;return n!==void 0&&n.contains(e)&&n.contains(t)}#qt(e){let t=this.#L?.lineCount??0;return e<0||e>=t?!1:this.#zt(e)!==void 0}};function _h(e){let t=(0,X.c)(13),{cacheKey:n,className:r,contents:i,filePath:a,language:o,onChange:s,options:c}=e,l=vh,u;t[0]===s?u=t[1]:(u={onChange:e=>s(e.contents)},t[0]=s,t[1]=u);let d=u,f;t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o?(f={name:a,contents:i,lang:o,cacheKey:n},t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=f):f=t[6];let p=f,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m={overscrollSize:400,intersectionObserverMargin:800},t[7]=m):m=t[7];let h;return t[8]!==r||t[9]!==d||t[10]!==p||t[11]!==c?(h=(0,Z.jsx)(Pl,{createEditor:l,children:(0,Z.jsx)(Wl,{className:`min-h-0 flex-1 overflow-auto`,contentClassName:`min-h-full`,config:m,children:(0,Z.jsx)(Yl,{edit:!0,file:p,className:r,editorOptions:d,options:c})})}),t[8]=r,t[9]=d,t[10]=p,t[11]=c,t[12]=h):h=t[12],h}function vh(e){return new gh(e)}var yh=`
|
|
1954
|
+
[data-file] {
|
|
1955
|
+
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1956
|
+
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1957
|
+
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1958
|
+
--diffs-token-light-bg: transparent;
|
|
1959
|
+
--diffs-token-dark-bg: transparent;
|
|
1960
|
+
background-color: var(--diffs-bg) !important;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
[data-code],
|
|
1964
|
+
[data-content],
|
|
1965
|
+
[data-line],
|
|
1966
|
+
[data-column-number] {
|
|
1967
|
+
font-size: 11px;
|
|
1968
|
+
line-height: 1.25rem;
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
/* Pierre centers its 2px synthetic caret on the insertion boundary. Keep the
|
|
1972
|
+
caret entirely after the preceding glyph so narrow punctuation remains
|
|
1973
|
+
visibly on the correct side of the cursor. */
|
|
1974
|
+
[data-caret] {
|
|
1975
|
+
translate: 1px 0;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
[data-line-number-content] {
|
|
1979
|
+
color: color-mix(in srgb, var(--muted-foreground) 85%, transparent);
|
|
1980
|
+
}
|
|
1981
|
+
`;function bh(e,t){return{key:`${e.environmentId}\u0000${e.cwd}\u0000${t.relativePath}`,relativePath:t.relativePath,contents:t.contents,version:t.version,encoding:t.encoding,lineEnding:t.lineEnding}}function xh(e){return{...e,savedContents:e.contents,saveStatus:`idle`,errorReason:null,errorMessage:null}}function Sh(e){return e!==null&&e.contents!==e.savedContents}function Ch(e,t){return t===e.contents?e:{...e,contents:t,saveStatus:e.saveStatus===`error`?`idle`:e.saveStatus,errorReason:e.saveStatus===`error`?null:e.errorReason,errorMessage:e.saveStatus===`error`?null:e.errorMessage}}function wh(e){return{...e,saveStatus:`saving`,errorReason:null,errorMessage:null}}function Th(e,t,n){return{...e,savedContents:t,version:n,saveStatus:`idle`,errorReason:null,errorMessage:null}}function Eh(e,t){return{...e,saveStatus:t.reason===`conflict`||t.reason===`deleted`?`conflict`:`error`,errorReason:t.reason,errorMessage:t.message}}function Dh(e){return{...e,contents:e.savedContents,saveStatus:`idle`,errorReason:null,errorMessage:null}}function Oh(e,t){return e===null||e.key!==t.key?xh(t):e.saveStatus===`saving`||e.version===t.version?e:Sh(e)?Eh(e,{reason:`conflict`,message:`This file changed on disk after it was opened. Reload it before saving.`}):xh(t)}function kh(e){let t=e,n=t?.reason;return{reason:n===`conflict`||n===`deleted`||n===`unsupported`||n===`failed`?n:`failed`,message:typeof t?.message==`string`&&t.message.trim().length>0?t.message:`Failed to save this file.`}}var Ah=524288,jh=new Set([`gif`,`jpeg`,`jpg`,`png`,`svg`,`webp`]),Mh=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(`.`)),Nh=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`]]),Ph=new Set([`application/javascript`,`application/json`,`application/toml`,`application/typescript`,`application/xml`,`application/x-sh`,`application/yaml`,`application/xhtml+xml`,`image/svg+xml`]);function Fh(e){let t=e.split(/[?#]/,1)[0]??e;return t.toLowerCase().split(`/`).at(-1)??t.toLowerCase()}function Ih(e){let t=Fh(e),n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?t:t.slice(n+1)}function Lh(e){let t=Fh(e);return t===`dockerfile`?`dockerfile`:t===`.gitignore`?`ini`:Nh.get(Ih(e))??`text`}function Rh(e){let t=e.mimeType?.toLowerCase().split(`;`,1)[0]?.trim();if(t?.startsWith(`image/`))return`image`;if(t&&(t.startsWith(`text/`)||Ph.has(t)))return`text`;let n=Ih(e.filePath);return jh.has(n)?`image`:Mh.has(n)?`text`:`binary`}function zh(e,t=Ah){return e>t?{state:`too-large`,shouldFetch:!1,sizeBytes:e,limitBytes:t}:{state:`within-limit`,shouldFetch:!0,sizeBytes:e,limitBytes:t}}function Bh(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function Vh(e){return Bh(e).trim().split(/\s+/).filter(e=>e.length>0)}function Hh(e,t){return t.every(t=>e.includes(t))}function Uh(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 Wh(e,t){let n=Vh(t);if(n.length===0)return e;let r=new Set;for(let t of e){if(t.kind!==`directory`)continue;let e=Bh(t.path);Hh(e,n)&&r.add(e)}return e.filter(e=>{let t=Bh(e.path);return Hh(t,n)||Uh(t,r)})}var Gh=`chat_preview_tree_width`,Kh=220,qh=280,Jh=.55,Yh=`
|
|
1982
|
+
.preview-panel-diffs-file {
|
|
1983
|
+
display: block;
|
|
1984
|
+
min-height: 100%;
|
|
1985
|
+
padding: 0.75rem;
|
|
1986
|
+
background-color: color-mix(in srgb, var(--card) 90%, var(--background));
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
.preview-panel-file-card {
|
|
1990
|
+
container-type: inline-size;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
@container (max-width: 360px) {
|
|
1994
|
+
.preview-panel-file-toolbar {
|
|
1995
|
+
flex-wrap: wrap;
|
|
1996
|
+
gap: 0.25rem;
|
|
1997
|
+
padding-block: 0.375rem;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
.preview-panel-file-identity {
|
|
2001
|
+
flex-basis: 100%;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
.preview-panel-file-actions {
|
|
2005
|
+
margin-left: auto;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
`;function Xh(e,t){let n=Math.max(Kh,Math.floor(t*Jh));return Math.max(Kh,Math.min(e,n))}function Zh(e,t,n){let r=e.startX-n;return Xh(e.startWidth+r,t)}function Qh(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 $h(e,t){return`preview:${e}:${t.length}:${Qt(t).toString(36)}`}var eg=[];function tg(e){let t=(0,X.c)(24),[n,r]=(0,Y.useState)(e.open),i,a;t[0]===e.open?(i=t[1],a=t[2]):(i=()=>{if(!e.open){r(!1);return}let t=window.requestAnimationFrame(()=>r(!0));return()=>window.cancelAnimationFrame(t)},a=[e.open],t[0]=e.open,t[1]=i,t[2]=a),(0,Y.useEffect)(i,a);let o=e.open&&n,s=!e.open||void 0,c=!e.open||void 0,l=e.open?`border-l border-border/70`:`border-l-0`,u=e.resizing?`transition-none`:`transition-[width,opacity] duration-[360ms] ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none`,d=e.open?`opacity-100`:`opacity-0`,f;t[3]!==l||t[4]!==u||t[5]!==d?(f=J(`min-h-0 shrink-0 overflow-hidden bg-card/20`,l,u,d),t[3]=l,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p=e.open?`${e.width}px`:`0px`,m;t[7]===p?m=t[8]:(m={width:p,maxWidth:`55%`},t[7]=p,t[8]=m);let h=e.resizing?`transition-none`:null,g=o?`translate-x-0 opacity-100`:`translate-x-4 opacity-0`,_;t[9]!==h||t[10]!==g?(_=J(`h-full min-h-0 transition-[translate,opacity] duration-[360ms] ease-[cubic-bezier(0.16,1,0.3,1)] will-change-transform motion-reduce:transition-none`,h,g),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v=`${e.width}px`,y;t[12]===v?y=t[13]:(y={width:v,maxWidth:`100%`},t[12]=v,t[13]=y);let b;t[14]!==e.children||t[15]!==_||t[16]!==y?(b=(0,Z.jsx)(`div`,{className:_,style:y,children:e.children}),t[14]=e.children,t[15]=_,t[16]=y,t[17]=b):b=t[17];let x;return t[18]!==b||t[19]!==s||t[20]!==c||t[21]!==f||t[22]!==m?(x=(0,Z.jsx)(`div`,{"data-preview-file-rail":!0,"aria-hidden":s,inert:c,className:f,style:m,children:b}),t[18]=b,t[19]=s,t[20]=c,t[21]=f,t[22]=m,t[23]=x):x=t[23],x}function ng(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(me,{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,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center`,children:(0,Z.jsxs)(`div`,{className:`flex max-w-xs flex-col items-center gap-3`,children:[t,(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:`Open file`}),(0,Z.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 rg({mode:e=`inline`}){let{resolvedTheme:t}=ur(),n=m(),r=e===`phone`,i=Sn({strict:!1,select:e=>Cn(e)}),a=Sn({strict:!1,select:e=>typeof e.draftId==`string`?f.make(e.draftId):null}),o=kn({strict:!1,select:e=>Fn(e)}),s=C((0,Y.useMemo)(()=>k(i),[i])),c=g(e=>s?null:a?e.getDraftSession(a):i?e.getDraftThreadByRef(i):null),u=(0,Y.useMemo)(()=>{if(s)return{id:s.id,environmentId:s.environmentId,projectId:s.projectId,worktreePath:s.worktreePath,turnDiffSummaries:s.turnDiffSummaries};if(c)return{id:c.threadId,environmentId:c.environmentId,projectId:c.projectId,worktreePath:c.worktreePath,turnDiffSummaries:eg}},[s,c]),d=u?.projectId??null,p=C(e=>u&&d?j(e,{environmentId:u.environmentId,projectId:d}):void 0),h=u?.worktreePath??p?.cwd??null,[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),x=(0,Y.useRef)(null),[w,E]=(0,Y.useState)(null),[D,O]=(0,Y.useState)(``),[A,M]=(0,Y.useState)(!0),[N,P]=(0,Y.useState)(r?!0:n.diffWordWrap),F=(0,Y.useRef)(null),[I,L]=(0,Y.useState)(()=>typeof window>`u`?qh:ne(Gh,l)??qh),[ee,R]=(0,Y.useState)(!1),te=(0,Y.useRef)(null),re=(0,Y.useRef)(o.preview===`1`),ie=(0,Y.useRef)(null),z=(0,Y.useRef)(null),B=(0,Y.useRef)(null),V=(0,Y.useCallback)(e=>{x.current=e,b(e)},[]);(0,Y.useEffect)(()=>{P(r?!0:n.diffWordWrap)},[r,n.diffWordWrap]),(0,Y.useEffect)(()=>{v(null),V(null),E(null),M(!0)},[u?.environmentId,u?.id,V]);let oe=(0,Y.useMemo)(()=>{let e=(u?.turnDiffSummaries??[]).toReversed().find(e=>e.files.length>0);return e?`${e.turnId}:${e.completedAt}`:null},[u?.turnDiffSummaries]),H=(0,Y.useMemo)(()=>{if(!_)return null;let e=(u?.turnDiffSummaries??[]).toReversed().find(e=>e.files.some(e=>e.path===_));return e?`${e.turnId}:${e.completedAt}`:null},[u?.turnDiffSummaries,_]),se=hd({environmentId:u?.environmentId??null,cwd:h,enabled:!!(u?.environmentId&&h&&o.preview===`1`)}),ce=se.error instanceof Error?se.error.message:se.error?`Failed to load the workspace tree.`:null,le=se.data,de=se.data?.truncated===!0,fe=se.isFetching,pe=se.refetch,me=(0,Y.useMemo)(()=>Wh(le?.entries??[],D),[D,le?.entries]),he=D.trim().length>0;(0,Y.useEffect)(()=>{if(le){if(le.entries.length===0){Sh(x.current)||(v(null),V(null));return}_&&!le.entries.some(e=>e.path===_)&&(Sh(x.current)||(v(null),V(null)))}},[V,le,_]),(0,Y.useEffect)(()=>{if(o.preview!==`1`){ie.current=oe;return}if(ie.current===null){ie.current=oe;return}ie.current!==oe&&(ie.current=oe,pe())},[oe,o.preview,pe]),(0,Y.useEffect)(()=>{let e=o.preview===`1`;e&&!re.current&&v(null),re.current=e},[o.preview]);let ge=_?le?.entries.find(e=>e.path===_):void 0,_e=typeof ge?.sizeBytes==`number`?zh(ge.sizeBytes):null,ve=vd({environmentId:u?.environmentId??null,cwd:h,relativePath:_,enabled:!!(u?.environmentId&&h&&_&&o.preview===`1`&&(_e?.shouldFetch??!0))}),be=ve.data?.relativePath===_?ve.data:null,xe=be,Se=xe?.mimeType??ge?.mimeType??null,Ce=_?Rh({filePath:_,mimeType:Se}):`text`,we=ve.error instanceof Error?ve.error.message:ve.error?`Failed to load file preview.`:null,U=ve.refetch;(0,Y.useEffect)(()=>{if(!_||o.preview!==`1`){z.current=H;return}if(z.current===null){z.current=H;return}z.current!==H&&(z.current=H,U())},[H,o.preview,U,_]),(0,Y.useEffect)(()=>{if(!_||!Qh(we)){B.current=null;return}let e=`${h??``}\u0000${_}\u0000${we}`;B.current!==e&&(B.current=e,pe().then(e=>{if(!e.data?.entries.some(e=>e.path===_)){let e=x.current;e?.relativePath===_&&Sh(e)?V(Eh(e,{reason:`deleted`,message:`This file was removed from disk after it was opened. Explorer will not recreate it.`})):(v(e=>e===_?null:e),e?.relativePath===_&&V(null))}}).catch(()=>void 0))},[h,V,pe,we,_]);let W=(0,Y.useMemo)(()=>!u?.environmentId||!h||!be||be.relativePath!==_?null:bh({environmentId:u.environmentId,cwd:h},be),[h,u?.environmentId,be,_]);(0,Y.useEffect)(()=>{W&&V(Oh(x.current,W))},[V,W]);let G=W&&y?.key===W.key?y:null,Te=Sh(G),Ee=!!(!r&&Ce===`text`&&W&&W.lineEnding!==`mixed`),De=Pr({shouldBlockFn:(0,Y.useCallback)(()=>Te,[Te]),disabled:!Te,enableBeforeUnload:Te,withResolver:!0}),Oe=(0,Y.useCallback)(e=>{V(null),v(e)},[V]),ke=(0,Y.useCallback)(e=>{if(e!==_){if(Sh(x.current)){E(e);return}Oe(e)}},[Oe,_]),Ae=(0,Y.useCallback)(e=>{let t=x.current;!t||t.key!==W?.key||V(Ch(t,e))},[V,W?.key]),je=(0,Y.useCallback)(async()=>{if(!u?.environmentId||!h||!_)return!1;try{let e=await T(u.environmentId).projects.readFile({cwd:h,relativePath:_});return md({environmentId:u.environmentId,cwd:h,relativePath:_},e),V(xh(bh({environmentId:u.environmentId,cwd:h},e))),!0}catch(e){let t=x.current;return t&&V(Eh(t,{reason:Qh(e instanceof Error?e.message:String(e))?`deleted`:`failed`,message:e instanceof Error?e.message:`Failed to reload this file.`})),!1}},[h,u?.environmentId,V,_]),Me=(0,Y.useCallback)(()=>{let e=x.current;if(!(!e||e.key!==W?.key)){if(e.errorReason===`deleted`){V(null),v(null),pe();return}if(e.saveStatus===`conflict`){je();return}V(Dh(e))}},[V,pe,je,W?.key]),Ne=(0,Y.useCallback)(async()=>{let e=x.current;if(!e||!u?.environmentId||!h||e.relativePath!==_||e.lineEnding===`mixed`||e.saveStatus===`saving`||e.saveStatus===`conflict`||!Sh(e))return!1;let t=e.key,n=e.contents;V(wh(e));try{let r=await T(u.environmentId).projects.writeFile({cwd:h,relativePath:e.relativePath,contents:n,expectedVersion:e.version,encoding:e.encoding,lineEnding:e.lineEnding});md({environmentId:u.environmentId,cwd:h,relativePath:e.relativePath},{relativePath:e.relativePath,contents:n,version:r.version,encoding:e.encoding,lineEnding:e.lineEnding});let i=x.current;if(!i||i.key!==t)return!1;let a=Th(i,n,r.version);return V(a),!Sh(a)}catch(e){let n=x.current;return n?.key===t&&V(Eh(n,kh(e))),!1}},[h,u?.environmentId,V,_]),Pe=G?.saveStatus===`conflict`||G?.errorReason===`unsupported`,Fe=!!(Ee&&Te&&G?.saveStatus!==`saving`&&!Pe);(0,Y.useEffect)(()=>{if(!Ee||!Te)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),Fe&&Ne())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[Fe,Te,Ee,Ne]);let Ie=(0,Y.useMemo)(()=>{let e=xe?.contents;return!_||Ce!==`text`||e===void 0?null:{name:_,contents:e,lang:Lh(_),cacheKey:$h(_,e)}},[xe?.contents,Ce,_]),Le=(0,Y.useMemo)(()=>({disableFileHeader:!0,overflow:N?`wrap`:`scroll`,theme:tn(t),themeType:t,unsafeCSS:yh,tokenizeMaxLineLength:1e3}),[t,N]),Re=(0,Y.useCallback)(e=>{if(e.button!==0||!A)return;let t=F.current?.querySelector(`[data-preview-file-rail]`)?.getBoundingClientRect().width??I;te.current={pointerId:e.pointerId,startWidth:t,startX:e.clientX},e.currentTarget.setPointerCapture(e.pointerId),R(!0),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`},[A,I]),ze=(0,Y.useCallback)(e=>{let t=te.current,n=F.current;if(!t||!n||t.pointerId!==e.pointerId)return;e.preventDefault();let r=Zh(t,n.clientWidth,e.clientX);L(r)},[]),Be=(0,Y.useCallback)(e=>{let t=te.current;if(!t||t.pointerId!==e.pointerId)return;let n=F.current,r=n?Zh(t,n.clientWidth,e.clientX):t.startWidth;te.current=null,R(!1),L(r),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`),typeof window<`u`&&S(Gh,r,l)},[]);(0,Y.useEffect)(()=>()=>{document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)},[]);let Ve=(0,Y.useCallback)(()=>{pe()},[pe]),He=(0,Y.useCallback)(()=>{A&&(te.current=null,R(!1),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)),M(e=>!e)},[A]),Ue=w!==null||De.status===`blocked`,We=(0,Y.useCallback)(()=>{E(null),De.status===`blocked`&&De.reset()},[De]),Ge=(0,Y.useCallback)(()=>{let e=w;if(E(null),V(null),e){v(e);return}De.status===`blocked`&&De.proceed()},[V,De,w]),Ke=(0,Y.useCallback)(async()=>{await Ne()&&Ge()},[Ge,Ne]),qe=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 px-1 [-webkit-app-region:no-drag]`,children:[(0,Z.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:`File Preview`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-[0.12em] text-muted-foreground/65`,children:[(0,Z.jsx)(`span`,{children:`Workspace tree`}),de?(0,Z.jsx)(or,{variant:`warning`,size:`sm`,className:`rounded-md px-1.5 py-0 text-[9px]`,children:`Truncated`}):null]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[r?null:(0,Z.jsx)(yn,{"aria-label":A?`Hide workspace tree`:`Show workspace tree`,"aria-pressed":A,title:A?`Hide workspace tree`:`Show workspace tree`,variant:`outline`,size:`icon-xs`,className:`shrink-0`,onClick:He,children:A?(0,Z.jsx)(Tr,{className:`size-3`}):(0,Z.jsx)(Er,{className:`size-3`})}),(0,Z.jsx)(yn,{"aria-label":`Refresh workspace tree`,title:`Refresh workspace tree`,variant:`outline`,size:`icon-xs`,className:`shrink-0`,disabled:!u?.environmentId||!h||fe,onClick:Ve,children:(0,Z.jsx)(cn,{className:J(`size-3`,fe&&`animate-spin`)})}),(0,Z.jsx)(pr,{"aria-label":N?`Disable preview line wrapping`:`Enable preview line wrapping`,title:N?`Disable line wrapping`:`Enable line wrapping`,variant:`outline`,size:`xs`,pressed:N,onPressedChange:e=>{P(!!e)},children:(0,Z.jsx)(Ar,{className:`size-3`})})]})]}),Je=_e?.state===`too-large`?(0,Z.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 (`,_e.sizeBytes,` bytes). Limit is`,` `,_e.limitBytes,` bytes.`]}):ve.isLoading&&!be?(0,Z.jsx)(Wt,{label:`Loading file preview...`}):we&&!be?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:we}):(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 p-2`,children:[(0,Z.jsx)(`style`,{children:Yh}),(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`preview-panel-file-identity flex min-w-0 flex-1 items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`truncate font-mono text-[12px] font-medium`,children:_}),Te?(0,Z.jsx)(`span`,{"aria-label":`Unsaved changes`,className:`size-1.5 shrink-0 rounded-full bg-primary`,title:`Unsaved changes`}):null,G?.saveStatus===`saving`?(0,Z.jsxs)(`span`,{"aria-live":`polite`,className:`flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,Z.jsx)(ye,{className:`size-3 animate-spin`}),` Saving`]}):null,!r&&W?.lineEnding===`mixed`?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:`Read-only · mixed line endings`}):null]}),Ee&&G?(0,Z.jsxs)(`div`,{className:`preview-panel-file-actions flex shrink-0 items-center gap-1`,children:[(0,Z.jsx)(yn,{"aria-label":`Discard file changes`,disabled:!Te||G.saveStatus===`saving`,onClick:Me,size:`xs`,variant:`ghost`,children:`Discard`}),(0,Z.jsxs)(yn,{"aria-label":`Save file`,disabled:!Fe,onClick:()=>void Ne(),size:`xs`,title:`Save file (Ctrl/⌘ S)`,children:[G.saveStatus===`saving`?(0,Z.jsx)(ye,{className:`animate-spin`}):(0,Z.jsx)(ln,{}),`Save`,(0,Z.jsx)(`span`,{className:`ml-0.5 text-[9px] opacity-70`,children:`⌘S`})]})]}):null]}),G?.errorMessage?(0,Z.jsx)(`div`,{className:`shrink-0 border-b border-border/60 p-2`,children:(0,Z.jsxs)(Xn,{variant:G.saveStatus===`conflict`?`warning`:`error`,className:`rounded-lg px-3 py-2 text-[11px]`,children:[G.saveStatus===`conflict`?(0,Z.jsx)(hn,{className:`size-3.5`}):(0,Z.jsx)(ue,{className:`size-3.5`}),(0,Z.jsx)(Jn,{className:`text-[11px]`,children:G.errorReason===`deleted`?`File removed on disk`:G.saveStatus===`conflict`?`File changed on disk`:`Couldn’t save file`}),(0,Z.jsxs)(Yn,{className:`gap-2 text-[11px] leading-4`,children:[(0,Z.jsx)(`span`,{children:G.errorMessage}),G.saveStatus===`conflict`?(0,Z.jsx)(yn,{className:`self-start`,onClick:G.errorReason===`deleted`?Me:()=>void je(),size:`xs`,variant:`outline`,children:G.errorReason===`deleted`?`Close file`:`Reload`}):null]})]})}):we?(0,Z.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-3 py-2 text-[11px] text-destructive`,children:[`Refresh failed: `,we]}):null,Ce===`image`&&xe?.base64?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 justify-center overflow-auto bg-background/70 p-3`,children:(0,Z.jsx)(`img`,{alt:_??void 0,className:`max-h-full max-w-full object-contain`,src:`data:${Se??`image/png`};base64,${xe.base64}`})}):Ee&&G?(0,Z.jsx)(_h,{cacheKey:G.key,className:`preview-panel-diffs-file`,contents:G.contents,filePath:G.relativePath,language:Lh(G.relativePath),onChange:Ae,options:Le}):Ie?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,Z.jsx)(Yl,{file:Ie,className:`preview-panel-diffs-file`,options:Le})}):(0,Z.jsx)(`pre`,{className:J(`min-h-0 flex-1 bg-transparent p-3 font-mono text-[11px] leading-5 text-muted-foreground/90`,N?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:xe?.contents??``})]})]}),K=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 border-b border-border/60 p-2`,children:(0,Z.jsxs)(`label`,{className:`relative block`,children:[(0,Z.jsx)(un,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/65`}),(0,Z.jsx)(`input`,{type:`text`,value:D,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(O(``),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,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[ce||de?(0,Z.jsxs)(Xn,{variant:ce?`error`:`warning`,className:`mb-2 rounded-lg border-border/70 px-3 py-2 text-[11px]`,children:[ce?(0,Z.jsx)(ue,{className:`size-3.5`}):(0,Z.jsx)(hn,{className:`size-3.5`}),(0,Z.jsx)(Jn,{className:`text-[11px]`,children:ce?`Workspace tree refresh failed`:`Workspace tree is truncated`}),(0,Z.jsx)(Yn,{className:`gap-1 text-[11px] leading-4`,children:ce?(0,Z.jsx)(`span`,{children:ce}):(0,Z.jsx)(`span`,{children:`Only the first indexed workspace entries are shown here, so some files may be omitted from preview.`})})]}):null,me.length===0?(0,Z.jsx)(`div`,{className:`px-2 py-6 text-center text-xs leading-5 text-muted-foreground/70`,children:`No files match this filter.`}):(0,Z.jsx)(bd,{files:me,allDirectoriesExpanded:he,resolvedTheme:t,onSelectFile:ke,selectedFilePath:_,showStats:!1})]})]});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pt,{mode:e,header:qe,children:u?se.isLoading&&!se.data?(0,Z.jsx)(Wt,{label:`Loading project tree...`}):ce&&!se.data?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:ce}):(se.data?.entries.length??0)===0?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No project files available yet.`}):r?(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:_?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center gap-1 border-b border-border/60 px-1.5`,children:[(0,Z.jsx)(yn,{size:`icon`,variant:`ghost`,"aria-label":`Back to workspace tree`,className:`shrink-0`,onClick:()=>v(null),children:(0,Z.jsx)(ae,{})}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,children:_})]}),Je]}):K}):(0,Z.jsxs)(`div`,{ref:F,className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Z.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:_?Je:(0,Z.jsx)(ng,{})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Resize workspace tree`,"aria-hidden":!A||void 0,className:J(`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`,A?`w-2 cursor-ew-resize opacity-100`:`w-0 opacity-0`),disabled:!A,onPointerDown:Re,onPointerMove:ze,onPointerUp:Be,onPointerCancel:Be,children:(0,Z.jsx)(`span`,{className:`absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border/80 group-hover:bg-border`})}),(0,Z.jsx)(tg,{width:I,open:A,resizing:ee,children:K})]}):(0,Z.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,Z.jsx)(ir,{open:Ue,onOpenChange:e=>{e||We()},children:(0,Z.jsxs)(tr,{children:[(0,Z.jsxs)($n,{children:[(0,Z.jsx)(rr,{children:`Save changes before continuing?`}),(0,Z.jsx)(nr,{children:_?`${_} has unsaved changes.`:`This file has unsaved changes.`})]}),(0,Z.jsxs)(er,{children:[(0,Z.jsx)(yn,{onClick:We,variant:`outline`,children:`Cancel`}),(0,Z.jsx)(yn,{disabled:G?.saveStatus===`saving`,onClick:Ge,variant:`destructive-outline`,children:w?`Discard & Open`:`Discard & Continue`}),(0,Z.jsxs)(yn,{disabled:!Fe,onClick:()=>void Ke(),children:[G?.saveStatus===`saving`?(0,Z.jsx)(ye,{className:`animate-spin`}):(0,Z.jsx)(ln,{}),w?`Save & Open`:`Save & Continue`]})]})]})})]})}function ig(){return{phase:`awaiting-config`,lastSequence:null}}var ag=2**32,og=1024;function sg(e,t,n){if(t.deviceId!==n)return{state:e,action:{kind:`ignore`},requestKeyframe:!1};if(t.codecConfig)return{state:{phase:`awaiting-keyframe`,lastSequence:t.sequence},action:{kind:`configure`},requestKeyframe:!1};if(e.phase===`awaiting-config`)return{state:e,action:{kind:`drop`},requestKeyframe:!1};if(e.lastSequence!==null){let n=(t.sequence-e.lastSequence+ag)%ag;if(n===0||n>og)return{state:e,action:{kind:`drop`},requestKeyframe:!1};if(n>1&&!t.keyframe&&e.phase===`streaming`)return{state:{phase:`awaiting-keyframe`,lastSequence:t.sequence},action:{kind:`drop`},requestKeyframe:!0}}return e.phase===`awaiting-keyframe`&&!t.keyframe?{state:{...e,lastSequence:t.sequence},action:{kind:`drop`},requestKeyframe:!1}:{state:{phase:`streaming`,lastSequence:t.sequence},action:{kind:`decode`,keyframe:t.keyframe},requestKeyframe:!1}}function cg(e,t,n){let r=Math.min(e.displayWidth/e.frameWidth,e.displayHeight/e.frameHeight);if(!Number.isFinite(r)||r<=0)return null;let i=e.frameWidth*r,a=e.frameHeight*r,o=t-(e.displayWidth-i)/2,s=n-(e.displayHeight-a)/2;return o<0||s<0||o>i||s>a?null:{x:Math.round(o/i*e.pointWidth),y:Math.round(s/a*e.pointHeight)}}function lg(e){let t={Enter:40,Escape:41,Backspace:42,Tab:43," ":44,ArrowRight:79,ArrowLeft:80,ArrowDown:81,ArrowUp:82},n=e.toLowerCase();return n>=`a`&&n<=`z`&&n.length===1?4+n.charCodeAt(0)-97:n===`0`?39:n>=`1`&&n<=`9`&&n.length===1?30+n.charCodeAt(0)-49:t[e]??null}function ug(e){for(let t=0;t+7<e.byteLength;t+=1){let n=e[t]===0&&e[t+1]===0&&e[t+2]===0&&e[t+3]===1,r=e[t]===0&&e[t+1]===0&&e[t+2]===1;if(!n&&!r)continue;let i=t+(n?4:3);if(((e[i]??0)&31)==7)return`avc1.${[e[i+1],e[i+2],e[i+3]].map(e=>(e??0).toString(16).padStart(2,`0`)).join(``)}`}return null}function dg(e){let{canvasRef:t,udid:n,openFrameSource:r}=e,[i,a]=(0,Y.useState)(`idle`),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(0);return(0,Y.useEffect)(()=>{if(!n||!r){a(`idle`),s(null);return}if(typeof globalThis.VideoDecoder!=`function`||typeof globalThis.EncodedVideoChunk!=`function`){a(`unsupported`);return}let e=++u.current,i=ig(),o=null,c=null,d=null,f=()=>e===u.current;a(`connecting`),s(null);let p=()=>{d=null;try{o?.state!==`closed`&&o?.close()}catch{}o=null},m=e=>{f()&&(p(),i=ig(),s(e),a(`error`))},h=e=>{let n=ug(e.payload);if(!n){m(`The simulator sent video parameters Ryco could not read.`),c?.requestResync();return}p();let r=new VideoDecoder({output:e=>{try{if(!f())return;let n=t.current;if(!n)return;(n.width!==e.displayWidth||n.height!==e.displayHeight)&&(n.width=e.displayWidth,n.height=e.displayHeight,l({width:e.displayWidth,height:e.displayHeight})),n.getContext(`2d`)?.drawImage(e,0,0),a(`streaming`),s(null)}finally{e.close()}},error:e=>{m(e.message||`The simulator video decoder failed.`),c?.requestResync()}});try{r.configure({codec:n,optimizeForLatency:!0}),o=r,d=e.payload.slice()}catch(e){m(e instanceof Error?e.message:`Video decoder setup failed.`)}},g=(e,t)=>{if(!o||o.state!==`configured`)return;let n=e.payload;if(t&&d){let e=new Uint8Array(d.byteLength+n.byteLength);e.set(d),e.set(n,d.byteLength),n=e,d=null}try{o.decode(new EncodedVideoChunk({type:t?`key`:`delta`,timestamp:Math.round(e.header.timestampMs*1e3),data:n}))}catch(e){m(e instanceof Error?e.message:`A simulator frame could not be decoded.`),c?.requestResync()}};return c=r(n,{onFrame:e=>{if(!f())return;let t=sg(i,e.header,n);i=t.state,t.requestKeyframe&&c?.requestResync(),t.action.kind===`configure`&&h(e),t.action.kind===`decode`&&g(e,t.action.keyframe)},onReset:e=>{f()&&(p(),i=ig(),e===`decode-failed`&&s(`The simulator sent a malformed frame.`),a(`recovering`))}}),()=>{u.current+=1,c?.close(),p()}},[t,r,n]),{status:i,error:o,dimensions:c}}var fg=750,pg=524288,mg=15e3;function hg(e){let t=Math.ceil(Math.max(0,e)/pg*1e3);return Math.min(mg,Math.max(fg,t))}function gg(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}function _g(e){let t=gg(e);return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function vg(e){let{canvasRef:t,enabled:n,screenshot:r,udid:i}=e,[a,o]=(0,Y.useState)(`idle`),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{if(!n||!i||!r){o(`idle`),c(null);return}let e=!0,a=null,s=document.visibilityState!==`hidden`,l=!0,d=!1;o(`connecting`);let f=()=>{a!==null&&(clearTimeout(a),a=null)},p=()=>e&&s&&l,m=e=>{f(),!(!p()||d)&&(a=setTimeout(()=>{a=null,h()},e))},h=async()=>{if(!p()||d)return;d=!0;let n=fg;try{let e=await r({udid:i});if(n=hg(e.bytesBase64.length),!p())return;let a=await createImageBitmap(new Blob([_g(e.bytesBase64)],{type:e.mimeType}));try{if(!p())return;let e=t.current;if(!e)return;(e.width!==a.width||e.height!==a.height)&&(e.width=a.width,e.height=a.height,u({width:a.width,height:a.height})),e.getContext(`2d`)?.drawImage(a,0,0),o(`streaming`),c(null)}finally{a.close()}}catch(t){if(!e)return;o(`recovering`),c(t instanceof Error?t.message:`The hosted simulator preview disconnected.`)}finally{d=!1,p()&&m(n)}},g=()=>{s=document.visibilityState!==`hidden`,s?m(0):f()};document.addEventListener(`visibilitychange`,g);let _=t.current,v=_&&typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{l=e.some(e=>e.isIntersecting),l?m(0):f()}):null;return v?.observe(_),m(0),()=>{e=!1,f(),v?.disconnect(),document.removeEventListener(`visibilitychange`,g)}},[t,n,r,i]),{status:a,error:s,dimensions:l}}var yg=5e3;function bg(e,t){return e instanceof Error&&e.message.trim()?e.message:t}function xg(e){return e===`booted`?`Booted`:e===`booting`?`Booting`:e===`shutting-down`?`Shutting down`:`Shut down`}function Sg(e,t){return t===`waiting-for-display`?`Waiting for the display…`:t===`connecting`?`Connecting the live screen…`:t===`booting`||e.state===`booting`?`Starting the simulator…`:`Connecting…`}function Cg(e){let t=[];return e.metaKey&&t.push(`command`),e.shiftKey&&t.push(`shift`),e.altKey&&t.push(`option`),e.ctrlKey&&t.push(`control`),t}function wg(e){let t=(0,X.c)(15),n=e.availability;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Z.jsx)(ye,{className:`size-5 animate-spin text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checking simulator support…`})]}),t[0]=e):e=t[0],e}if(n.kind===`unsupported-platform`){let e,r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wr,{className:`size-7 text-muted-foreground`}),r=(0,Z.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`iOS Simulator needs a Mac`}),t[1]=e,t[2]=r):(e=t[1],r=t[2]);let i;return t[3]===n.platform?i=t[4]:(i=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8 text-center`,children:[e,r,(0,Z.jsxs)(`p`,{className:`mt-1 max-w-sm text-xs leading-relaxed text-muted-foreground`,children:[`This environment runs on `,n.platform,`. Connect Ryco to a macOS environment with Xcode to use the simulator workspace.`]})]}),t[3]=n.platform,t[4]=i),i}if(n.kind===`helper-unavailable`){let e,r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wr,{className:`size-7 text-amber-500`}),r=(0,Z.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`Simulator helper could not start`}),t[5]=e,t[6]=r):(e=t[5],r=t[6]);let i;return t[7]===n.message?i=t[8]:(i=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8 text-center`,children:[e,r,(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-relaxed text-muted-foreground`,children:n.message})]}),t[7]=n.message,t[8]=i),i}if(n.kind!==`setup-required`||n.steps.filter(Dg).every(Eg))return null;let r,i;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`Set up the iOS Simulator`}),i=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Ryco checks these steps automatically every few seconds.`}),t[9]=r,t[10]=i):(r=t[9],i=t[10]);let a;t[11]===n.steps?a=t[12]:(a=n.steps.map(Tg),t[11]=n.steps,t[12]=a);let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8`,children:(0,Z.jsxs)(`div`,{className:`w-full max-w-md`,children:[r,i,(0,Z.jsx)(`div`,{className:`mt-5 space-y-2`,children:a})]})}),t[13]=a,t[14]=o),o}function Tg(e){return(0,Z.jsxs)(`div`,{className:`flex gap-3 rounded-md border border-border/60 p-3`,children:[(0,Z.jsx)(`span`,{className:J(`mt-0.5 size-2 shrink-0 rounded-full`,e.done?`bg-emerald-500`:`bg-amber-500`)}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium`,children:e.label}),e.detail?(0,Z.jsx)(`p`,{className:`mt-1 break-words font-mono text-[10px] text-muted-foreground`,children:e.detail}):null]})]},e.id)}function Eg(e){return e.id===`build-device-helper`}function Dg(e){return!e.done}function Og(e){let{environmentId:t,threadId:r}=e,o=(0,Y.useRef)(null),s=(0,Y.useMemo)(()=>t&&r?i(n(t,r)):null,[t,r]),c=a(e=>t?e.environmentById[t]:void 0),l=a(e=>s?e.threadByKey[s]:void 0),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)({kind:`idle`}),[_,v]=(0,Y.useState)(null),y=t?h(t)?.device:void 0,b=t?ee(t)?.client.device:void 0,x=c?.generation??0,S=a(e=>e.applyThreadSnapshot),C=a(e=>e.applyInventory),w=(0,Y.useCallback)(async()=>{if(!t||!r||!y)return;let[e,n]=await Promise.all([y.list({includeShutdown:!0}),y.getThreadState({threadId:r})]);C(t,x,e.devices,e.availability),S(t,x,n)},[y,C,S,t,x,r]),T=c?.availability?.kind===`setup-required`||c?.availability?.kind===`helper-unavailable`;(0,Y.useEffect)(()=>{if(w().catch(()=>void 0),!T)return;let e=setInterval(()=>void w().catch(()=>void 0),yg);return()=>clearInterval(e)},[T,w]);let E=c?.devices??l?.devices??[],D=E.find(e=>e.udid===l?.attachedDeviceUdid)??E.find(e=>e.udid===f)??null;(0,Y.useEffect)(()=>{f&&l?.attachedDeviceUdid===f&&p(null)},[f,l?.attachedDeviceUdid]);let O=(0,Y.useCallback)(async(e,t)=>{d(!0);try{await e()}catch(e){ve.add({type:`error`,title:t,description:bg(e,`The simulator did not respond.`)})}finally{d(!1)}},[]),k=(0,Y.useCallback)(e=>{!y||!r||(p(e.udid),O(async()=>{if(e.state===`shutdown`){let t=await y.boot({udid:e.udid});if(t.kind===`boot-limit-reached`){p(null),v({requested:e,candidates:t.rycoBooted,limit:t.limit});return}}S(t,x,await y.attach({threadId:r,udid:e.udid}))},`Could not open that simulator`))},[y,S,t,x,O,r]),A=(0,Y.useCallback)(e=>{if(!_||!y||!r||!t)return;let n=_;v(null),p(n.requested.udid),O(async()=>{await y.shutdown({udid:e.udid});let i=await y.boot({udid:n.requested.udid});if(i.kind===`boot-limit-reached`){p(null),v({...n,candidates:i.rycoBooted,limit:i.limit});return}S(t,x,await y.attach({threadId:r,udid:n.requested.udid}))},`Could not free a simulator slot`)},[y,S,_,t,x,O,r]),j=dg({canvasRef:o,udid:D?.state===`booted`?D.udid:null,...b?.openFrameSource?{openFrameSource:b.openFrameSource}:{}}),M=vg({canvasRef:o,udid:D?.state===`booted`?D.udid:null,enabled:!b?.openFrameSource,screenshot:y?e=>y.screenshot(e):null}),N=b?.openFrameSource?j.status:M.status,P=b?.openFrameSource?j.error:M.error,F=b?.openFrameSource?j.dimensions:M.dimensions,I=(0,Y.useRef)(null),L=(0,Y.useCallback)(e=>{let t=o.current;if(!t||!F)return null;let n=t.getBoundingClientRect(),r=D?.geometry?.scale??(F.width>1400?2:3);return cg({frameWidth:F.width,frameHeight:F.height,displayWidth:n.width,displayHeight:n.height,pointWidth:D?.geometry?.pointWidth??F.width/r,pointHeight:D?.geometry?.pointHeight??F.height/r},e.clientX-n.left,e.clientY-n.top)},[D?.geometry,F]),R=(0,Y.useCallback)(e=>{e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId),I.current={point:L(e),at:performance.now()}},[L]),te=(0,Y.useCallback)(e=>{let t=I.current;if(I.current=null,!t||!D||!y)return;let n=L(e);!t.point||!n||(Math.hypot(n.x-t.point.x,n.y-t.point.y)<=8?y.tap({udid:D.udid,x:n.x,y:n.y}):y.swipe({udid:D.udid,fromX:t.point.x,fromY:t.point.y,toX:n.x,toY:n.y,durationMs:Math.max(16,Math.round(performance.now()-t.at))})).catch(e=>ve.add({type:`error`,title:`Simulator input failed`,description:bg(e,`The input could not be delivered.`)}))},[y,D,L]),ne=(0,Y.useCallback)((e,t)=>{if(!D||!y||e.metaKey||e.ctrlKey)return;let n=lg(e.key);n!==null&&(e.preventDefault(),y.keyEvent({udid:D.udid,keyCode:n,modifiers:Cg(e),direction:t}).catch(()=>void 0))},[y,D]),re=(0,Y.useCallback)(e=>{!D||!y||O(()=>y.pressButton({udid:D.udid,button:e}),`Simulator button failed`)},[y,D,O]),ie=(0,Y.useCallback)(()=>{!D||!y||O(async()=>{let e=await y.screenshot({udid:D.udid,save:!0});ve.add({type:`success`,title:`Screenshot saved`,description:e.path??e.name})},`Could not save the screenshot`)},[y,D,O]),z=(0,Y.useCallback)(()=>{if(!(!D||!y||m.kind===`starting`||m.kind===`stopping`)){if(m.kind===`idle`){g({kind:`starting`}),y.startRecording({udid:D.udid}).then(e=>g({kind:`recording`,path:e.path}),e=>{g({kind:`idle`}),ve.add({type:`error`,title:`Could not start recording`,description:bg(e,`Recording failed.`)})});return}g({kind:`stopping`}),y.stopRecording({udid:D.udid}).then(e=>{g({kind:`idle`}),ve.add({type:`success`,title:`Recording saved`,description:e.path})},e=>{g({kind:`idle`}),ve.add({type:`error`,title:`Could not stop recording`,description:bg(e,`The recording may be incomplete.`)})})}},[y,D,m]);if(!t||!r||!y)return(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8 text-center`,children:[(0,Z.jsx)(wr,{className:`size-7 text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`Simulator unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`This thread has no device connection.`})]});let ae=(0,Z.jsx)(wg,{availability:c?.availability??null});if(!c?.availability||c.availability.kind===`unsupported-platform`||c.availability.kind===`helper-unavailable`||c.availability.kind===`setup-required`&&c.availability.steps.some(e=>!e.done&&e.id!==`build-device-helper`))return ae;let B=c.availability?.kind===`degraded`?c.availability.capabilities.filter(e=>!e.ok):[];return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,Z.jsxs)(`div`,{className:`flex min-h-11 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,Z.jsx)(dn,{className:`size-4 text-muted-foreground`}),(0,Z.jsxs)(`select`,{"aria-label":`Choose an iOS Simulator`,className:`min-w-0 max-w-72 flex-1 bg-transparent text-xs font-medium outline-none`,disabled:u,value:D?.udid??``,onChange:e=>{let t=E.find(t=>t.udid===e.target.value);t&&k(t)},children:[(0,Z.jsx)(`option`,{value:``,disabled:!0,children:`Choose a simulator`}),E.toSorted((e,t)=>Number(t.state===`booted`)-Number(e.state===`booted`)||e.name.localeCompare(t.name)).map(e=>(0,Z.jsxs)(`option`,{value:e.udid,disabled:e.state===`booting`||e.state===`shutting-down`,children:[e.name,` — `,e.runtime,` · `,xg(e.state)]},e.udid))]}),l?.agentActive?(0,Z.jsx)(`span`,{className:`rounded-full bg-sky-500/15 px-2 py-0.5 text-[10px] font-medium text-sky-500`,children:`Agent controlling`}):null,(0,Z.jsx)(yn,{size:`icon-xs`,variant:`ghost`,"aria-label":`Refresh simulators`,onClick:()=>void w(),children:(0,Z.jsx)(cn,{className:`size-3.5`})})]}),B.length>0?(0,Z.jsxs)(`div`,{className:`border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[10px] text-amber-700 dark:text-amber-300`,children:[`Limited by this Xcode: `,B.map(e=>e.id).join(`, `),`.`]}):null,(0,Z.jsx)(`div`,{className:`relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-muted/25 p-4 sm:p-6`,children:D?(0,Z.jsxs)(`div`,{className:J(`relative flex max-h-full max-w-full overflow-hidden border-[7px] border-zinc-900 bg-black shadow-xl`,D.family===`tablet`||D.name.toLowerCase().includes(`ipad`)?`aspect-[4/3] w-[min(88%,52rem)] rounded-[1.8rem]`:`aspect-[9/19.5] h-full max-h-[min(100%,58rem)] rounded-[2.4rem]`),children:[(0,Z.jsx)(`canvas`,{ref:o,tabIndex:0,"aria-label":`${D.name} screen`,className:`h-full w-full touch-none object-contain outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sky-400`,onPointerDown:R,onPointerUp:te,onPointerCancel:()=>{I.current=null},onKeyDown:e=>ne(e,`down`),onKeyUp:e=>ne(e,`up`)}),N===`streaming`?null:(0,Z.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 flex flex-col items-center justify-center bg-black/75 p-6 text-center text-white`,children:[(0,Z.jsx)(ye,{className:`size-5 animate-spin text-white/60`}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs font-medium`,children:N===`unsupported`?`This browser does not support WebCodecs.`:N===`recovering`?`Reconnecting the live screen…`:Sg(D,l?.attachPhase)}),P?(0,Z.jsx)(`p`,{className:`mt-2 max-w-52 text-[10px] text-white/60`,children:P}):null]})]}):(0,Z.jsxs)(`div`,{className:`max-w-xs text-center`,children:[(0,Z.jsx)(dn,{className:`mx-auto size-8 text-muted-foreground/60`}),(0,Z.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:`Choose a simulator`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`Boot a device or attach one that is already running. Its screen will stay beside your conversation.`})]})}),(0,Z.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-center gap-0.5 border-t border-border/60 bg-card/40 px-2`,children:[(0,Z.jsx)(kg,{icon:br,label:`Home`,disabled:!D||u,onClick:()=>re(`home`)}),(0,Z.jsx)(kg,{icon:gt,label:`Lock`,disabled:!D||u,onClick:()=>re(`lock`)}),(0,Z.jsx)(kg,{icon:jr,label:`Volume down`,disabled:!D||u,onClick:()=>re(`volume-down`)}),(0,Z.jsx)(kg,{icon:Mr,label:`Volume up`,disabled:!D||u,onClick:()=>re(`volume-up`)}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),(0,Z.jsx)(kg,{icon:hr,label:`Screenshot`,disabled:!D||u,onClick:ie}),(0,Z.jsx)(kg,{icon:m.kind===`recording`||m.kind===`stopping`?gr:vr,label:m.kind===`recording`?`Stop recording`:`Record screen`,active:m.kind!==`idle`,disabled:!D||m.kind===`starting`||m.kind===`stopping`,onClick:z}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),(0,Z.jsx)(kg,{icon:gn,label:`Detach`,disabled:!D||u,onClick:()=>void O(async()=>S(t,x,await y.detach({threadId:r})),`Could not detach the simulator`)}),(0,Z.jsx)(kg,{icon:Or,label:`Shut down`,disabled:!D||u,onClick:()=>{D&&O(()=>y.shutdown({udid:D.udid}),`Could not shut down the simulator`)}})]}),_?(0,Z.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center bg-background/75 p-6 backdrop-blur-sm`,children:(0,Z.jsxs)(`div`,{className:`w-full max-w-sm rounded-xl border border-border bg-card p-5 shadow-xl`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-semibold`,children:`Simulator boot limit reached`}),(0,Z.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:[`Ryco keeps at most `,_.limit,` simulators it booted running. Shut down one to open `,_.requested.name,`.`]}),(0,Z.jsx)(`div`,{className:`mt-4 space-y-2`,children:_.candidates.map(e=>(0,Z.jsxs)(yn,{variant:`outline`,className:`w-full justify-between`,onClick:()=>A(e),children:[(0,Z.jsxs)(`span`,{className:`truncate`,children:[`Shut down `,e.name]}),(0,Z.jsx)(Or,{className:`size-3.5`})]},e.udid))}),(0,Z.jsx)(yn,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>v(null),children:`Cancel`})]})}):null]})}function kg(e){let t=(0,X.c)(11),n=e.icon,r=e.label,i=e.label,a=e.active,o=e.disabled,s=e.active&&`text-red-500`,c;t[0]===s?c=t[1]:(c=J(s),t[0]=s,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Z.jsx)(n,{className:`size-4`}),t[2]=n,t[3]=l);let u;return t[4]!==e.active||t[5]!==e.disabled||t[6]!==e.label||t[7]!==e.onClick||t[8]!==c||t[9]!==l?(u=(0,Z.jsx)(yn,{size:`icon-sm`,variant:`ghost`,title:r,"aria-label":i,"aria-pressed":a,disabled:o,className:c,onClick:e.onClick,children:l}),t[4]=e.active,t[5]=e.disabled,t[6]=e.label,t[7]=e.onClick,t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function Ag(e){return e===`running`?`in_progress`:e===`failed`?`review`:e===`finished`?`done`:`idle`}function jg(e){return e===`running`?`Working`:e===`failed`?`Needs review`:e===`finished`?`Finished`:e===`interrupted`?`Stopped`:`Idle`}function Mg(e){return encodeURIComponent(e??`none`).replace(/%/g,`_`)}function Ng(e){return`thread-workspace-tab-${Mg(e)}`}function Pg(e){return`thread-workspace-panel-${Mg(e)}`}function Fg(e){let t=(0,X.c)(19),n=e.active?`text-foreground`:`text-muted-foreground`,r;t[0]===n?r=t[1]:(r=J(`size-3.5 shrink-0`,n),t[0]=n,t[1]=r);let i=r;if(e.tab.mode===`agent`){let n=e.tab.avatarKey??e.tab.agentKey,r=!e.active&&`opacity-70`,i;t[2]===r?i=t[3]:(i=J(`size-3.5 shrink-0`,r),t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==i?(a=(0,Z.jsx)(Lt,{name:n,className:i}),t[4]=n,t[5]=i,t[6]=a):a=t[6],a}if(e.tab.key===`review`){let e;return t[7]===i?e=t[8]:(e=(0,Z.jsx)(yr,{className:i}),t[7]=i,t[8]=e),e}if(e.tab.key===`terminal`){let e;return t[9]===i?e=t[10]:(e=(0,Z.jsx)(mn,{className:i}),t[9]=i,t[10]=e),e}if(e.tab.key===`browser`){let e;return t[11]===i?e=t[12]:(e=(0,Z.jsx)(_e,{className:i}),t[11]=i,t[12]=e),e}if(e.tab.key===`simulator`){let e;return t[13]===i?e=t[14]:(e=(0,Z.jsx)(dn,{className:i}),t[13]=i,t[14]=e),e}if(e.tab.key===`agents`){let e;return t[15]===i?e=t[16]:(e=(0,Z.jsx)(B,{className:i}),t[15]=i,t[16]=e),e}let a;return t[17]===i?a=t[18]:(a=(0,Z.jsx)(fe,{className:i}),t[17]=i,t[18]=a),a}function Ig(e){let t=(0,X.c)(8),n;if(t[0]!==e.agent.status){let r=Ag(e.agent.status);n=Qn(r,`truncate`),t[0]=e.agent.status,t[1]=n}else n=t[1];let r;t[2]===e.agent.name?r=t[3]:(r=Zn(e.agent.name,{durationSeconds:2.2}),t[2]=e.agent.name,t[3]=r);let i;return t[4]!==e.agent.name||t[5]!==n||t[6]!==r?(i=(0,Z.jsx)(`span`,{className:n,style:r,children:e.agent.name}),t[4]=e.agent.name,t[5]=n,t[6]=r,t[7]=i):i=t[7],i}function Lg(e){let t=(0,X.c)(45);if(!e.subagent){let n,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`div`,{className:`mx-auto flex size-10 items-center justify-center rounded-md border border-border/70 bg-card/60 text-muted-foreground`,children:(0,Z.jsx)(Cr,{className:`size-4`})}),r=(0,Z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:`Subagent unavailable`}),i=(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`This tab points to a subagent that is no longer present in the current thread activity.`}),t[0]=n,t[1]=r,t[2]=i):(n=t[0],r=t[1],i=t[2]);let a;t[3]===e.agentKey?a=t[4]:(a=e.agentKey?(0,Z.jsx)(`p`,{className:`mt-2 truncate font-mono text-[11px] text-muted-foreground/60`,children:e.agentKey}):null,t[3]=e.agentKey,t[4]=a);let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6 text-center`,children:(0,Z.jsxs)(`div`,{className:`max-w-72`,children:[n,r,i,a]})}),t[5]=a,t[6]=o),o}let n=e.subagent.avatarKey??e.subagent.key,r;t[7]===n?r=t[8]:(r=(0,Z.jsx)(Lt,{name:n,className:`size-4`}),t[7]=n,t[8]=r);let i;t[9]===e.subagent?i=t[10]:(i=(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 text-sm font-medium`,children:(0,Z.jsx)(Ig,{agent:e.subagent})}),t[9]=e.subagent,t[10]=i);let a;t[11]===e.subagent.role?a=t[12]:(a=e.subagent.role?(0,Z.jsx)(`span`,{className:`max-w-36 shrink-0 truncate rounded-sm border border-border/60 bg-background/40 px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:e.subagent.role}):null,t[11]=e.subagent.role,t[12]=a);let o;t[13]===e.subagent.status?o=t[14]:(o=jg(e.subagent.status),t[13]=e.subagent.status,t[14]=o);let s;t[15]===o?s=t[16]:(s=(0,Z.jsx)(`span`,{className:`shrink-0 rounded-md border border-border/70 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:o}),t[15]=o,t[16]=s);let c;t[17]!==r||t[18]!==i||t[19]!==a||t[20]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,i,a,s]}),t[17]=r,t[18]=i,t[19]=a,t[20]=s,t[21]=c):c=t[21];let l;t[22]===e.subagent.detail?l=t[23]:(l=e.subagent.detail?(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.subagent.detail}):null,t[22]=e.subagent.detail,t[23]=l);let u;t[24]!==e.subagent.effort||t[25]!==e.subagent.model||t[26]!==e.subagent.providerThreadIds||t[27]!==e.subagent.tool?(u=e.subagent.model||e.subagent.tool||e.subagent.providerThreadIds.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-wrap items-center gap-1.5`,children:[e.subagent.model?(0,Z.jsxs)(`span`,{className:`rounded-md border border-border/60 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:[e.subagent.model,e.subagent.effort?` · ${e.subagent.effort}`:``]}):null,e.subagent.tool?(0,Z.jsx)(`span`,{className:`rounded-md border border-border/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e.subagent.tool}):null,e.subagent.providerThreadIds.slice(0,2).map(zg)]}):null,t[24]=e.subagent.effort,t[25]=e.subagent.model,t[26]=e.subagent.providerThreadIds,t[27]=e.subagent.tool,t[28]=u):u=t[28];let d;t[29]!==c||t[30]!==l||t[31]!==u?(d=(0,Z.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[c,l,u]}),t[29]=c,t[30]=l,t[31]=u,t[32]=d):d=t[32];let f;t[33]===e.subagent.messages?f=t[34]:(f=e.subagent.messages.length>0?e.subagent.messages.map(Rg):null,t[33]=e.subagent.messages,t[34]=f);let p;t[35]!==e.subagent.entries||t[36]!==e.subagent.messages.length||t[37]!==e.subagent.status?(p=e.subagent.entries.length>0?e.subagent.entries.map(t=>(0,Z.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-card/40 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:J(`size-2 shrink-0 rounded-full`,t.tone===`error`?`bg-destructive`:e.subagent?.status===`running`?`bg-sky-400`:e.subagent?.status===`interrupted`?`bg-muted-foreground/60`:`bg-emerald-400`)}),(0,Z.jsx)(`p`,{className:`min-w-0 truncate text-xs font-medium text-foreground`,children:t.toolTitle??t.label})]}),t.detail?(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:t.detail}):null,t.output&&t.output!==t.detail?(0,Z.jsx)(`div`,{className:`mt-3 rounded-md border border-border/50 bg-background/60 p-2`,children:(0,Z.jsx)(jt,{text:t.output,cwd:void 0,isStreaming:!1})}):null]},t.id)):e.subagent.messages.length===0?(0,Z.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-md border border-dashed border-border/70 bg-card/20 p-6 text-center`,children:[(0,Z.jsx)(Cr,{className:`size-5 text-muted-foreground/60`}),(0,Z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:`No transcript captured yet`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`The subagent is visible from lifecycle events. Detailed messages will appear here when the provider exposes them.`})]}):null,t[35]=e.subagent.entries,t[36]=e.subagent.messages.length,t[37]=e.subagent.status,t[38]=p):p=t[38];let m;t[39]!==f||t[40]!==p?(m=(0,Z.jsx)(Kn,{className:`min-h-0 flex-1`,children:(0,Z.jsxs)(`div`,{className:`space-y-3 p-4`,children:[f,p]})}),t[39]=f,t[40]=p,t[41]=m):m=t[41];let h;return t[42]!==m||t[43]!==d?(h=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[d,m]}),t[42]=m,t[43]=d,t[44]=h):h=t[44],h}function Rg(e){return(0,Z.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-card/40 p-3`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex min-w-0 items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`truncate text-xs font-medium text-foreground`,children:`Subagent`}),e.providerThreadId?(0,Z.jsx)(`span`,{className:`truncate font-mono text-[10px] text-muted-foreground/55`,children:e.providerThreadId}):null]}),(0,Z.jsx)(jt,{text:e.text,cwd:void 0,isStreaming:!1})]},e.id)}function zg(e){return(0,Z.jsx)(`span`,{className:`max-w-40 truncate rounded-md border border-border/60 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground/70`,children:e},e)}function Bg(e){let t=(0,X.c)(8),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`div`,{className:`mx-auto flex size-10 items-center justify-center rounded-md border border-border/70 bg-card/60 text-muted-foreground`,children:(0,Z.jsx)(mn,{className:`size-4`})}),t[0]=n):n=t[0];let r;t[1]===e.title?r=t[2]:(r=(0,Z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e.title}),t[1]=e.title,t[2]=r);let i;t[3]===e.description?i=t[4]:(i=(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:e.description}),t[3]=e.description,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6 text-center`,children:(0,Z.jsxs)(`div`,{className:`max-w-72`,children:[n,r,i]})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Vg(){let e=(0,X.c)(24),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1},e[0]=t):t=e[0];let r=Sn(t),i;e[1]===r?i=e[2]:(i=Cn(r),e[1]=r,e[2]=i);let a=i,o;e[3]===r.draftId?o=e[4]:(o=r.draftId?f.make(r.draftId):null,e[3]=r.draftId,e[4]=o);let s=o,l;e[5]===s?l=e[6]:(l=e=>s?e.getDraftSession(s):null,e[5]=s,e[6]=l);let u=g(l),d;bb0:{if(a){d=a;break bb0}if(!u){d=null;break bb0}let t;e[7]!==u.environmentId||e[8]!==u.threadId?(t=n(u.environmentId,u.threadId),e[7]=u.environmentId,e[8]=u.threadId,e[9]=t):t=e[9],d=t}let p=d,m;e[10]===p?m=e[11]:(m=k(p),e[10]=p,e[11]=m);let h=C(m),_;e[12]===p?_=e[13]:(_=e=>p?e.getDraftThreadByRef(p):null,e[12]=p,e[13]=_);let v=g(_),y;e[14]!==v||e[15]!==h?(y=h?c(h.environmentId,h.projectId):v?c(v.environmentId,v.projectId):null,e[14]=v,e[15]=h,e[16]=y):y=e[16];let b=y,x;e[17]===b?x=e[18]:(x=R(b),e[17]=b,e[18]=x);let S=C(x),w;return e[19]!==v||e[20]!==S||e[21]!==h||e[22]!==p?(w={threadRef:p,serverThread:h,draftThread:v,project:S},e[19]=v,e[20]=S,e[21]=h,e[22]=p,e[23]=w):w=e[23],w}function Hg(){let e=(0,X.c)(3),{threadRef:t,serverThread:n,draftThread:r,project:i}=Vg(),a=t?.environmentId??null,o=n?.worktreePath??r?.worktreePath??i?.cwd??null,s;return e[0]!==a||e[1]!==o?(s=(0,Z.jsx)(he,{environmentId:a,cwd:o}),e[0]=a,e[1]=o,e[2]=s):s=e[2],s}function Ug(){let e=(0,X.c)(70),{threadRef:t,serverThread:n,draftThread:r,project:a}=Vg(),o;e[0]===t?o=e[1]:(o=e=>F(e.terminalStateByThreadKey,t),e[0]=t,e[1]=o);let s=L(o),c;e[2]===t?c=e[3]:(c=e=>t?e.terminalLaunchContextByThreadKey[i(t)]??null:null,e[2]=t,e[3]=c);let l=L(c),u=L(Qg),d=L(Zg),f=L(Xg),p=L(Yg),m=L(Jg),g=L(qg),_=E(),v=qn(),[y,b]=(0,Y.useState)(0),x=n?.worktreePath??r?.worktreePath??null,S=l?.worktreePath??x;l?.cwd;let C;e[4]!==S||e[5]!==a||e[6]!==l?.cwd?(C=l?.cwd??(a?kt({project:{cwd:a.cwd},worktreePath:S}):null),e[4]=S,e[5]=a,e[6]=l?.cwd,e[7]=C):C=e[7];let w=C,T;e[8]!==S||e[9]!==a?(T=a?Xt({project:{cwd:a.cwd},worktreePath:S}):{},e[8]=S,e[9]=a,e[10]=T):T=e[10];let D=T,O;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(O={context:{terminalFocus:!0,terminalOpen:!0}},e[11]=O):O=e[11];let k=O,A;e[12]===_?A=e[13]:(A=Hn(_,`terminal.split`,k),e[12]=_,e[13]=A);let j=A,M;e[14]===_?M=e[15]:(M=Hn(_,`terminal.new`,k),e[14]=_,e[15]=M);let N=M,P;e[16]===_?P=e[17]:(P=Hn(_,`terminal.close`,k),e[16]=_,e[17]=P);let I=P,ee,R;e[18]!==u||e[19]!==s.terminalOpen||e[20]!==t?(ee=()=>{!t||!s.terminalOpen||u(t,!1)},R=[u,s.terminalOpen,t],e[18]=u,e[19]=s.terminalOpen,e[20]=t,e[21]=ee,e[22]=R):(ee=e[21],R=e[22]),(0,Y.useEffect)(ee,R);let te;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>{b(Kg)},e[23]=te):te=e[23];let ne=te,re;e[24]!==u||e[25]!==f||e[26]!==t?(re=()=>{t&&(f(t,`terminal-${bn()}`),u(t,!1),ne())},e[24]=u,e[25]=f,e[26]=t,e[27]=re):re=e[27];let ie=re,z;e[28]!==p||e[29]!==u||e[30]!==t?(z=()=>{t&&(p(t,`terminal-${bn()}`),u(t,!1),ne())},e[28]=p,e[29]=u,e[30]=t,e[31]=z):z=e[31];let ae=z,B;e[32]!==m||e[33]!==t?(B=e=>{t&&(m(t,e),ne())},e[32]=m,e[33]=t,e[34]=B):B=e[34];let V=B,oe;e[35]!==d||e[36]!==t?(oe=e=>{t&&d(t,e)},e[35]=d,e[36]=t,e[37]=oe):oe=e[37];let H=oe,se;e[38]!==g||e[39]!==u||e[40]!==s.terminalIds.length||e[41]!==t?(se=e=>{if(!t)return;let n=h(t.environmentId);if(!n)return;let r=s.terminalIds.length<=1,i=()=>n.terminal.write({threadId:t.threadId,terminalId:e,data:`exit
|
|
2009
|
+
`}).catch(Gg);`close`in n.terminal&&typeof n.terminal.close==`function`?(async()=>{r&&await n.terminal.clear({threadId:t.threadId,terminalId:e}).catch(Wg),await n.terminal.close({threadId:t.threadId,terminalId:e,deleteHistory:!0})})().catch(()=>i()):i(),g(t,e),u(t,!1),ne()},e[38]=g,e[39]=u,e[40]=s.terminalIds.length,e[41]=t,e[42]=se):se=e[42];let ce=se,le;e[43]===v?le=e[44]:(le=e=>{v?.current?.addTerminalContext(e)},e[43]=v,e[44]=le);let ue=le;if(!t){let t;return e[45]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Bg,{title:`Terminal unavailable`,description:`No active thread is available for this workspace terminal.`}),e[45]=t):t=e[45],t}if(!a||!w){let t;return e[46]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Bg,{title:`Terminal unavailable`,description:`This thread does not have a resolved project directory.`}),e[46]=t):t=e[46],t}let de=t.threadId,fe=j??void 0,pe=N??void 0,me=I??void 0,he;return e[47]!==V||e[48]!==ue||e[49]!==ce||e[50]!==ae||e[51]!==w||e[52]!==S||e[53]!==y||e[54]!==_||e[55]!==D||e[56]!==H||e[57]!==ie||e[58]!==de||e[59]!==fe||e[60]!==pe||e[61]!==me||e[62]!==s.activeTerminalGroupId||e[63]!==s.activeTerminalId||e[64]!==s.runningTerminalIds||e[65]!==s.terminalGroups||e[66]!==s.terminalHeight||e[67]!==s.terminalIds||e[68]!==t?(he=(0,Z.jsx)(fn,{threadRef:t,threadId:de,cwd:w,worktreePath:S,runtimeEnv:D,layout:`panel`,visible:!0,height:s.terminalHeight,terminalIds:s.terminalIds,runningTerminalIds:s.runningTerminalIds,activeTerminalId:s.activeTerminalId,terminalGroups:s.terminalGroups,activeTerminalGroupId:s.activeTerminalGroupId,focusRequestId:y,onSplitTerminal:ie,onNewTerminal:ae,splitShortcutLabel:fe,newShortcutLabel:pe,closeShortcutLabel:me,keybindings:_,onActiveTerminalChange:V,onCloseTerminal:ce,onHeightChange:H,onAddTerminalContext:ue}),e[47]=V,e[48]=ue,e[49]=ce,e[50]=ae,e[51]=w,e[52]=S,e[53]=y,e[54]=_,e[55]=D,e[56]=H,e[57]=ie,e[58]=de,e[59]=fe,e[60]=pe,e[61]=me,e[62]=s.activeTerminalGroupId,e[63]=s.activeTerminalId,e[64]=s.runningTerminalIds,e[65]=s.terminalGroups,e[66]=s.terminalHeight,e[67]=s.terminalIds,e[68]=t,e[69]=he):he=e[69],he}function Wg(){}function Gg(){}function Kg(e){return e+1}function qg(e){return e.closeTerminal}function Jg(e){return e.setActiveTerminal}function Yg(e){return e.newTerminal}function Xg(e){return e.splitTerminal}function Zg(e){return e.setTerminalHeight}function Qg(e){return e.setTerminalOpen}function $g(e){let t=(0,X.c)(38),n=e.icon,r=e.disabled,i=e.onClick,a=e.compact?`min-h-0 px-1 py-1 @sm/workspace-launcher:px-4 @sm/workspace-launcher:py-3`:`min-h-32 px-5 py-6`,o=e.disabled?`cursor-not-allowed opacity-45`:`hover:border-border hover:bg-card/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,s;t[0]!==a||t[1]!==o?(s=J(`group flex w-full flex-col items-center justify-center rounded-lg border border-border/50 bg-card/35 text-center transition-colors`,a,o),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=e.compact?`size-4 @sm/workspace-launcher:size-6`:`size-6`,l=!e.disabled&&`group-hover:text-foreground`,u;t[3]!==c||t[4]!==l?(u=J(`text-muted-foreground transition-colors`,c,l),t[3]=c,t[4]=l,t[5]=u):u=t[5];let d;t[6]!==n||t[7]!==u?(d=(0,Z.jsx)(n,{className:u}),t[6]=n,t[7]=u,t[8]=d):d=t[8];let f=e.badgeCount??0,p;t[9]===f?p=t[10]:(p=(0,Z.jsx)(ht,{count:f,className:`-top-2 -right-3 h-4 min-w-4 px-1 text-[9px]`}),t[9]=f,t[10]=p);let m;t[11]!==p||t[12]!==d?(m=(0,Z.jsxs)(`span`,{className:`relative inline-flex`,children:[d,p]}),t[11]=p,t[12]=d,t[13]=m):m=t[13];let h;t[14]===e.badgeCount?h=t[15]:(h=(e.badgeCount??0)>0?(0,Z.jsx)(`span`,{className:`sr-only`,children:bt(e.badgeCount??0)}):null,t[14]=e.badgeCount,t[15]=h);let g=e.compact?`mt-1 text-xs @sm/workspace-launcher:mt-3 @sm/workspace-launcher:text-base`:`mt-4 text-base`,_;t[16]===g?_=t[17]:(_=J(`font-semibold text-foreground`,g),t[16]=g,t[17]=_);let v;t[18]!==e.label||t[19]!==_?(v=(0,Z.jsx)(`span`,{className:_,children:e.label}),t[18]=e.label,t[19]=_,t[20]=v):v=t[20];let y=e.compact?`mt-0.5 hidden text-xs @sm/workspace-launcher:block`:`mt-1 text-sm`,b;t[21]===y?b=t[22]:(b=J(`text-muted-foreground`,y),t[21]=y,t[22]=b);let x;t[23]!==e.description||t[24]!==b?(x=(0,Z.jsx)(`span`,{className:b,children:e.description}),t[23]=e.description,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==e.compact||t[27]!==e.shortcutLabel?(S=e.shortcutLabel?(0,Z.jsx)(`span`,{className:J(`rounded-md bg-muted px-1.5 py-0.5 font-medium text-[11px] text-muted-foreground`,e.compact?`mt-2 hidden @sm/workspace-launcher:inline-flex`:`mt-3`),children:e.shortcutLabel}):null,t[26]=e.compact,t[27]=e.shortcutLabel,t[28]=S):S=t[28];let C;return t[29]!==e.disabled||t[30]!==e.onClick||t[31]!==m||t[32]!==h||t[33]!==v||t[34]!==x||t[35]!==S||t[36]!==s?(C=(0,Z.jsxs)(`button`,{type:`button`,disabled:r,onClick:i,"data-slot":`workspace-launcher-card`,className:s,children:[m,h,v,x,S]}),t[29]=e.disabled,t[30]=e.onClick,t[31]=m,t[32]=h,t[33]=v,t[34]=x,t[35]=S,t[36]=s,t[37]=C):C=t[37],C}function e_(e){let t=(0,X.c)(65),n=E(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={key:`files`,label:`Files`,mode:`files`},t[0]=r):r=t[0];let i=r,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={key:`review`,label:`Review`,mode:`review`},t[1]=a):a=t[1];let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={key:`terminal`,label:`Terminal`,mode:`terminal`},t[2]=s):s=t[2];let c=s,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={key:`simulator`,label:`Simulator`,mode:`simulator`},t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={key:`agents`,label:`Agents`,mode:`agents`},t[4]=d):d=t[4];let f=d,p;t[5]===n?p=t[6]:(p=Hn(n,`workspace.files`),t[5]=n,t[6]=p);let m=p,h;t[7]===n?h=t[8]:(h=Hn(n,`workspace.review`),t[7]=n,t[8]=h);let g=h,_;t[9]===n?_=t[10]:(_=Hn(n,`workspace.terminal`),t[9]=n,t[10]=_);let v=_,y;t[11]===n?y=t[12]:(y=Hn(n,`workspace.simulator`),t[11]=n,t[12]=y);let b=y,x,S;if(t[13]!==m||t[14]!==e||t[15]!==g||t[16]!==b||t[17]!==v){let n=e.tabs.filter(t_),r=!e.isPhoneSurface,a;t[20]===e?a=t[21]:(a=()=>e.onSelectTab(i),t[20]=e,t[21]=a);let s;t[22]!==r||t[23]!==m||t[24]!==a?(s=(0,Z.jsx)($g,{label:`Files`,description:`Browse project files`,icon:ge,shortcutLabel:m,compact:r,onClick:a}),t[22]=r,t[23]=m,t[24]=a,t[25]=s):s=t[25];let l;t[26]===r?l=t[27]:(l=(0,Z.jsx)($g,{label:`Side chat`,description:`Start a side conversation`,icon:Sr,compact:r,disabled:!0}),t[26]=r,t[27]=l);let d;t[28]===e?d=t[29]:(d=()=>e.onSelectTab({key:`browser`,label:`Browser`,mode:`browser`}),t[28]=e,t[29]=d);let p;t[30]!==r||t[31]!==e.isPhoneSurface||t[32]!==d?(p=(0,Z.jsx)($g,{label:`Browser`,description:`Preview sites and local servers`,icon:_e,compact:r,disabled:e.isPhoneSurface,onClick:d}),t[30]=r,t[31]=e.isPhoneSurface,t[32]=d,t[33]=p):p=t[33];let h;t[34]===e?h=t[35]:(h=()=>e.onSelectTab(o),t[34]=e,t[35]=h);let _;t[36]!==r||t[37]!==g||t[38]!==h?(_=(0,Z.jsx)($g,{label:`Review`,description:`View code changes`,icon:yr,shortcutLabel:g,compact:r,onClick:h}),t[36]=r,t[37]=g,t[38]=h,t[39]=_):_=t[39];let y;t[40]===e?y=t[41]:(y=()=>e.onSelectTab(c),t[40]=e,t[41]=y);let C;t[42]!==r||t[43]!==y||t[44]!==v?(C=(0,Z.jsx)($g,{label:`Terminal`,description:`Start an interactive shell`,icon:mn,shortcutLabel:v,compact:r,onClick:y}),t[42]=r,t[43]=y,t[44]=v,t[45]=C):C=t[45];let w;t[46]!==r||t[47]!==e||t[48]!==b?(w=e.showSimulator?(0,Z.jsx)($g,{label:`Simulator`,description:`Run and control an iOS app`,icon:dn,shortcutLabel:b,compact:r,onClick:()=>e.onSelectTab(u)}):null,t[46]=r,t[47]=e,t[48]=b,t[49]=w):w=t[49];let T;t[50]!==r||t[51]!==e?(T=e.showAgents?(0,Z.jsx)($g,{label:`Agents`,description:`Watch subagents and workflows run`,icon:B,badgeCount:e.liveAgentCount,compact:r,onClick:()=>e.onSelectTab(f)}):null,t[50]=r,t[51]=e,t[52]=T):T=t[52];let E;t[53]!==s||t[54]!==l||t[55]!==p||t[56]!==_||t[57]!==C||t[58]!==w||t[59]!==T?(E=(0,Z.jsxs)(Z.Fragment,{children:[s,l,p,_,C,w,T]}),t[53]=s,t[54]=l,t[55]=p,t[56]=_,t[57]=C,t[58]=w,t[59]=T,t[60]=E):E=t[60],x=E,S=n.length>0?(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-lg space-y-2 pt-1`,children:n.map(t=>(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-center gap-3 rounded-lg border border-border/50 bg-card/35 px-4 py-3 text-left transition-colors hover:border-border hover:bg-card/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>e.onSelectTab(t),children:[(0,Z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-border/50 bg-background/50 text-muted-foreground`,children:(0,Z.jsx)(Lt,{name:t.avatarKey??t.agentKey,className:`size-5`})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:J(`block truncate text-sm font-medium`,Qn(Ag(t.status))),style:Zn(t.label,{durationSeconds:2.2}),children:t.label}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:jg(t.status)})]})]},t.key))}):null,t[13]=m,t[14]=e,t[15]=g,t[16]=b,t[17]=v,t[18]=x,t[19]=S}else x=t[18],S=t[19];let C=S,w;return t[61]!==C||t[62]!==x||t[63]!==e.isPhoneSurface?(w=(0,Z.jsx)(Kn,{className:`h-full`,children:e.isPhoneSurface?(0,Z.jsx)(`div`,{className:`flex min-h-full p-5 sm:p-6`,children:(0,Z.jsxs)(`div`,{className:`m-auto w-full max-w-lg space-y-4`,children:[x,C]})}):(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4 sm:p-5`,"data-slot":`workspace-launcher`,children:[(0,Z.jsx)(`div`,{className:`@container/workspace-launcher flex min-h-0 flex-1 items-center justify-center`,children:(0,Z.jsx)(`div`,{className:`grid aspect-square grid-cols-3 grid-rows-3 gap-2 @sm/workspace-launcher:gap-3`,"data-slot":`workspace-launcher-grid`,style:{inlineSize:`min(100cqw, 100cqh, 32rem)`},children:x})}),C]})}),t[61]=C,t[62]=x,t[63]=e.isPhoneSurface,t[64]=w):w=t[64],w}function t_(e){return e.mode===`agent`}function n_(e){let t=(0,X.c)(134),{onClosePanelTab:i,onToggleMaximized:a}=e,o=e.maximized??!1,s=e.mode===`phone`,c=Bn(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={strict:!1},t[0]=l):l=t[0];let u=Sn(l),d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d={strict:!1,select:p_},t[1]=d):d=t[1];let p=kn(d),m;t[2]===u?m=t[3]:(m=Cn(u),t[2]=u,t[3]=m);let y=m,b;t[4]===u.draftId?b=t[5]:(b=u.draftId?f.make(u.draftId):null,t[4]=u.draftId,t[5]=b);let x=b,S;t[6]===x?S=t[7]:(S=e=>x?e.getDraftSession(x):null,t[6]=x,t[7]=S);let w=g(S),T;t[8]!==y||t[9]!==w?(T=y??(w?n(w.environmentId,w.threadId):null),t[8]=y,t[9]=w,t[10]=T):T=t[10];let E=T,D;t[11]===E?D=t[12]:(D=k(E),t[11]=E,t[12]=D);let O=C(D),A;t[13]===O?.session?A=t[14]:(A=v(O?.session??null)!==`disconnected`&&O?.session?.orchestrationStatus!==`stopped`&&O?.session?.orchestrationStatus!==`interrupted`&&O?.session?.orchestrationStatus!==`error`,t[13]=O?.session,t[14]=A);let j=A;O?.activities,O?.latestTurn?.state;let M;t[15]!==O?.activities||t[16]!==O?.latestTurn?.state||t[17]!==j?(M=cr(O?.activities??[],{sessionLive:j,parentTurnState:O?.latestTurn?.state??null}),t[15]=O?.activities,t[16]=O?.latestTurn?.state,t[17]=j,t[18]=M):M=t[18];let N=M,P=(p.workspaceTab===`agent`||p.workspaceTab===`agents`)&&p.workspaceAgentKey?p.workspaceAgentKey:null,F;t[19]!==P||t[20]!==N?(F=sr(N,P),t[19]=P,t[20]=N,t[21]=F):F=t[21];let I=F,L;t[22]!==e.panelMode||t[23]!==p?(L=Rn(p)??e.panelMode,t[22]=e.panelMode,t[23]=p,t[24]=L):L=t[24];let ee=L,R=!s&&ee===`agent`?`agents`:ee;O?.activities;let te;t[25]!==O?.activities||t[26]!==j||t[27]!==N?(te=_({activities:O?.activities??[],transcriptSubagents:N,sessionLive:j}),t[25]=O?.activities,t[26]=j,t[27]=N,t[28]=te):te=t[28];let ne=te,re;bb0:{if(R===`files`||R===`review`||R===`terminal`||R===`simulator`||R===`browser`||R===`agents`){let n;t[29]!==R||t[30]!==e.openedPanelModes?(n=e.openedPanelModes.includes(R)?e.openedPanelModes:[...e.openedPanelModes,R],t[29]=R,t[30]=e.openedPanelModes,t[31]=n):n=t[31],re=n;break bb0}re=e.openedPanelModes}let ie=re,z;if(t[32]!==P||t[33]!==s||t[34]!==ie||t[35]!==e.openedAgentKeys||t[36]!==N){let n=jl({subagents:N,activeAgentKey:P,openedAgentKeys:e.openedAgentKeys,openedPanelModes:ie,groupAgents:!s});z=s?n.filter(f_):n,t[32]=P,t[33]=s,t[34]=ie,t[35]=e.openedAgentKeys,t[36]=N,t[37]=z}else z=t[37];let B=z,V=R===`agent`?P:s&&(R===`agents`||R===`browser`)?null:R,oe;t[38]!==c||t[39]!==u.draftId||t[40]!==y?(oe=e=>{if(u.draftId){c({to:`/draft/$draftId`,params:{draftId:f.make(u.draftId)},replace:!0,search:e});return}y&&c({to:`/$environmentId/$threadId`,params:xn(y),replace:!0,search:e})},t[38]=c,t[39]=u.draftId,t[40]=y,t[41]=oe):oe=t[41];let H=oe,se,ce;t[42]!==P||t[43]!==s||t[44]!==H||t[45]!==ee?(se=()=>{!s&&ee===`agent`&&P&&H(e=>Tn(e,P))},ce=[s,ee,P,H],t[42]=P,t[43]=s,t[44]=H,t[45]=ee,t[46]=se,t[47]=ce):(se=t[46],ce=t[47]),(0,Y.useEffect)(se,ce);let le;t[48]===H?le=t[49]:(le=e=>{if(e.mode===`review`){H(d_);return}if(e.mode===`files`){H(u_);return}if(e.mode===`terminal`){H(l_);return}if(e.mode===`browser`){H(c_);return}if(e.mode===`simulator`){H(s_);return}if(e.mode===`agents`){H(o_);return}e.mode===`agent`&&H(t=>jn(t,e.agentKey))},t[48]=H,t[49]=le);let ue=le,de;t[50]===H?de=t[51]:(de=()=>{H(a_)},t[50]=H,t[51]=de);let fe=de,pe;t[52]!==s||t[53]!==H?(pe=e=>{let t=e.startsWith(`subagent:`)?e:`subagent:${e}`;H(e=>s?jn(e,t):Tn(e,t))},t[52]=s,t[53]=H,t[54]=pe):pe=t[54];let me=pe,he;t[55]===i?he=t[56]:(he=e=>{i({mode:e.mode,...e.mode===`agent`?{agentKey:e.agentKey}:{}})},t[55]=i,t[56]=he);let ge=he,_e;t[57]!==ue||t[58]!==B?(_e=(e,t)=>{let n=B.findIndex(t=>t.key===e.key);if(n<0)return;let r=e=>{let t=B[(e+B.length)%B.length];t&&ue(t)};switch(t.key){case`ArrowRight`:case`ArrowDown`:t.preventDefault(),r(n+1);return;case`ArrowLeft`:case`ArrowUp`:t.preventDefault(),r(n-1);return;case`Home`:t.preventDefault(),r(0);return;case`End`:t.preventDefault(),r(B.length-1);return}},t[57]=ue,t[58]=B,t[59]=_e):_e=t[59];let ve=_e,ye;t[60]===H?ye=t[61]:(ye=()=>{H(i_)},t[60]=H,t[61]=ye);let be=ye,xe=s?`h-14`:`h-12`,Se=!s&&`transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none`,Ce=e.reserveChromeInset&&lr,we=o&&r&&`drag-region wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]`,U;t[62]!==xe||t[63]!==Se||t[64]!==Ce||t[65]!==we?(U=J(`flex shrink-0 items-center gap-1 border-b border-border bg-card/40 px-2`,xe,Se,Ce,we),t[62]=xe,t[63]=Se,t[64]=Ce,t[65]=we,t[66]=U):U=t[66];let W;t[67]!==be||t[68]!==s?(W=s?(0,Z.jsx)(yn,{size:`icon`,variant:`ghost`,"aria-label":`Back to thread`,className:`shrink-0`,onClick:be,children:(0,Z.jsx)(ae,{})}):null,t[67]=be,t[68]=s,t[69]=W):W=t[69];let G;if(t[70]!==V||t[71]!==ge||t[72]!==s||t[73]!==ve||t[74]!==ue||t[75]!==B){let e;t[77]!==V||t[78]!==ge||t[79]!==s||t[80]!==ve||t[81]!==ue?(e=e=>{let t=V===e.key;return(0,Z.jsxs)(`div`,{className:J(`flex min-w-0 shrink-0 items-center rounded-md text-sm transition-colors`,s?`h-11`:`h-8`,t?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,Z.jsxs)(`button`,{type:`button`,id:Ng(e.key),role:`tab`,"aria-selected":t,"aria-controls":Pg(e.key),tabIndex:t?0:-1,className:J(`flex h-full min-w-0 items-center gap-1.5`,s?`pl-3 pr-1.5`:`pl-2.5 pr-1`),onClick:()=>ue(e),onKeyDown:t=>ve(e,t),children:[(0,Z.jsx)(Fg,{tab:e,active:t}),(0,Z.jsx)(`span`,{className:J(`max-w-32 truncate`,e.mode===`agent`&&Qn(Ag(e.status))),style:e.mode===`agent`?Zn(e.label,{durationSeconds:2.2}):void 0,children:e.label})]}),(0,Z.jsx)(`button`,{type:`button`,className:J(`mr-1 flex size-5 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-colors hover:bg-background/60 hover:text-foreground`,s&&`relative after:absolute after:top-1/2 after:left-1/2 after:size-11 after:-translate-x-1/2 after:-translate-y-1/2`),"aria-label":`Close ${e.label} tab`,onClick:()=>ge(e),children:(0,Z.jsx)(vn,{className:`size-3`})})]},e.key)},t[77]=V,t[78]=ge,t[79]=s,t[80]=ve,t[81]=ue,t[82]=e):e=t[82],G=B.map(e),t[70]=V,t[71]=ge,t[72]=s,t[73]=ve,t[74]=ue,t[75]=B,t[76]=G}else G=t[76];let Te=s?`size-11`:`size-6`,Ee=!R&&`bg-muted text-foreground`,De;t[83]!==Te||t[84]!==Ee?(De=J(`flex shrink-0 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-muted/60 hover:text-foreground`,Te,Ee),t[83]=Te,t[84]=Ee,t[85]=De):De=t[85];let Oe=!R,ke;t[86]!==fe||t[87]!==De||t[88]!==Oe?(ke=(0,Z.jsx)(`button`,{type:`button`,className:De,"aria-label":`Workspace launcher`,"aria-pressed":Oe,onClick:fe}),t[86]=fe,t[87]=De,t[88]=Oe,t[89]=ke):ke=t[89];let Ae;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(sn,{className:`size-3.5`}),t[90]=Ae):Ae=t[90];let je;t[91]===ke?je=t[92]:(je=(0,Z.jsx)(Un,{render:ke,children:Ae}),t[91]=ke,t[92]=je);let Me;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(Wn,{side:`bottom`,children:`Workspace launcher`}),t[93]=Me):Me=t[93];let Ne;t[94]===je?Ne=t[95]:(Ne=(0,Z.jsxs)(Gn,{children:[je,Me]}),t[94]=je,t[95]=Ne);let Pe;t[96]!==G||t[97]!==Ne?(Pe=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-x-auto`,role:`tablist`,"aria-label":`Workspace tabs`,children:[G,Ne]}),t[96]=G,t[97]=Ne,t[98]=Pe):Pe=t[98];let Fe;t[99]!==be||t[100]!==s||t[101]!==o||t[102]!==a?(Fe=s?null:(0,Z.jsxs)(Z.Fragment,{children:[a?(0,Z.jsxs)(Gn,{children:[(0,Z.jsx)(Un,{render:(0,Z.jsx)(yn,{size:`icon-xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground/70 hover:text-foreground`,onClick:a,"aria-pressed":o,"aria-label":o?`Restore workspace panel`:`Maximize workspace panel`,children:o?(0,Z.jsx)(on,{className:`size-3.5`}):(0,Z.jsx)(xr,{className:`size-3.5`})})}),(0,Z.jsx)(Wn,{side:`bottom`,children:o?`Restore workspace panel`:`Maximize workspace panel`})]}):null,(0,Z.jsx)(yn,{size:`icon-xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground/70 hover:text-foreground`,onClick:be,"aria-label":`Close workspace panel`,children:(0,Z.jsx)(vn,{className:`size-3.5`})})]}),t[99]=be,t[100]=s,t[101]=o,t[102]=a,t[103]=Fe):Fe=t[103];let Ie;t[104]!==U||t[105]!==W||t[106]!==Pe||t[107]!==Fe?(Ie=(0,Z.jsxs)(`div`,{className:U,children:[W,Pe,Fe]}),t[104]=U,t[105]=W,t[106]=Pe,t[107]=Fe,t[108]=Ie):Ie=t[108];let Le;t[109]===V?Le=t[110]:(Le=Pg(V),t[109]=V,t[110]=Le);let Re;t[111]===V?Re=t[112]:(Re=V?Ng(V):void 0,t[111]=V,t[112]=Re);let ze;t[113]!==I||t[114]!==R||t[115]!==O||t[116]!==P||t[117]!==ne||t[118]!==s||t[119]!==H||t[120]!==me||t[121]!==e.mode||t[122]!==ue||t[123]!==N||t[124]!==B||t[125]!==E?(ze=R===`review`?(0,Z.jsx)(Ku,{mode:e.mode}):R===`files`?(0,Z.jsx)(rg,{mode:e.mode}):R===`terminal`?(0,Z.jsx)(Ug,{}):R===`browser`&&!s?(0,Z.jsx)(Hg,{}):R===`simulator`&&!s?(0,Z.jsx)(Og,{environmentId:E?.environmentId??null,threadId:E?.threadId??null}):R===`agents`&&!s?(0,Z.jsx)(Dl,{model:ne,environmentId:E?.environmentId??null,threadId:E?E.threadId:null,onOpenAgent:me,subagents:N,selectedAgentId:P,onBack:()=>H(r_)}):R===`agent`?(0,Z.jsx)(Lg,{subagent:I,agentKey:P}):(0,Z.jsx)(e_,{tabs:B,activeThread:O,onSelectTab:ue,showAgents:!s,showSimulator:!s&&!!(E&&h(E.environmentId)?.device),isPhoneSurface:s,liveAgentCount:ne.liveCount}),t[113]=I,t[114]=R,t[115]=O,t[116]=P,t[117]=ne,t[118]=s,t[119]=H,t[120]=me,t[121]=e.mode,t[122]=ue,t[123]=N,t[124]=B,t[125]=E,t[126]=ze):ze=t[126];let Be;t[127]!==Le||t[128]!==Re||t[129]!==ze?(Be=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,id:Le,role:`tabpanel`,"aria-labelledby":Re,children:ze}),t[127]=Le,t[128]=Re,t[129]=ze,t[130]=Be):Be=t[130];let Ve;return t[131]!==Ie||t[132]!==Be?(Ve=(0,Z.jsxs)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col bg-background w-full`,children:[Ie,Be]}),t[131]=Ie,t[132]=Be,t[133]=Ve):Ve=t[133],Ve}function r_(e){return Tn(e)}function i_(e){return{...On(e),diff:void 0,diffTurnId:void 0,diffFilePath:void 0,preview:void 0,workspaceOpen:void 0,workspaceTab:void 0,workspaceAgentKey:void 0}}function a_(e){return Dn(e)}function o_(e){return Tn(e)}function s_(e){return Mn(e)}function c_(e){return Pn(e)}function l_(e){return zn(e)}function u_(e){return Ln(e)}function d_(e){return En(e)}function f_(e){return e.mode!==`agents`&&e.mode!==`simulator`&&e.mode!==`browser`}function p_(e){return In(e)}export{Lg as AgentThreadPanel,n_ as default};
|