T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/.local/lib/code-server-4.102.2/lib/vscode/out/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/.local/lib/code-server-4.102.2/lib/vscode/out/server-main.js.map
{"version":3,"sources":["node_modules/minimist/index.js","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/performance.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/nls.messages.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/nls.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/platform.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/process.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/path.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/collections.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/errors.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/functional.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/arraysFind.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/arrays.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/map.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/assert.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/types.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/iterator.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/lifecycle.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/linkedList.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/stopwatch.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/event.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/cancellation.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/cache.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/lazy.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/strings.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/extpath.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/uri.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/network.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/resources.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/symbols.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/async.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/normalization.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/pfs.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/nls.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/instantiation/common/serviceCollection.ts","vs/base/common/errorMessage.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/stream.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/buffer.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/hash.ts","vs/platform/contextkey/common/scanner.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/instantiation/common/instantiation.ts","vs/platform/contextkey/common/contextkey.ts","vs/platform/log/common/log.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/instantiation/common/descriptors.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/json.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/jsonFormatter.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/jsonEdit.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/objects.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/configuration/common/configuration.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/jsonSchema.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/registry/common/platform.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/jsonschemas/common/jsonContributionRegistry.ts","vs/platform/configuration/common/configurationRegistry.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/configuration/common/configurationModels.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/policy/common/policy.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/configuration/common/configurations.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/configuration/common/configurationService.ts","vs/platform/request/common/request.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/environment/common/environment.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/uuid.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/powershell.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/processes.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/processes.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/shell.ts","vs/platform/environment/node/argv.ts","vs/platform/environment/node/argvHelper.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/numbers.ts","vs/platform/shell/node/shellEnv.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/request/node/proxy.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/request/node/requestService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/remote/common/remoteHosts.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/telemetry/common/commonProperties.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/telemetry/common/telemetry.ts","vs/platform/telemetry/common/telemetryUtils.ts","vs/platform/extensionManagement/common/extensionManagement.ts","out-vscode-reh-web/vs/base/common/semver/semver.js","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/parts/request/common/request.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensions/common/extensions.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/common/extensionManagementUtil.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/severity.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensions/common/extensionsApiProposals.ts","vs/platform/extensions/common/extensionsApiProposals.ts","vs/platform/extensions/common/extensionValidator.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/ternarySearchTree.ts","vs/platform/files/common/files.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/product/common/productService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/externalServices/common/serviceMachineId.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/externalServices/common/marketplace.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/marshalling.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/parts/storage/common/storage.ts","vs/platform/workspace/common/workspace.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/uriIdentity/common/uriIdentity.ts","vs/platform/userDataProfile/common/userDataProfile.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/storage/common/storage.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/common/extensionGalleryManifest.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.ts","vs/base/node/zip.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/download/common/download.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/naturalLanguage/korean.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/filters.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/codiconsUtil.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/codiconsLibrary.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/codicons.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/themables.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/iconLabels.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/htmlContent.ts","vs/platform/extensionManagement/common/abstractExtensionManagementService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/common/extensionsProfileScannerService.ts","vs/base/common/jsonErrorMessages.ts","vs/platform/extensionManagement/common/extensionNls.ts","vs/platform/extensionManagement/common/extensionsScannerService.ts","vs/platform/extensionManagement/node/extensionManagementUtil.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/node/extensionSignatureVerificationService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/node/extensionDownloader.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/node/extensionLifecycle.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/node/extensionsManifestCache.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/node/extensionsWatcher.ts","vs/platform/extensionManagement/node/extensionManagementService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/instantiation/common/graph.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/instantiation/common/instantiationService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/product/common/product.ts","vs/platform/files/common/io.ts","vs/platform/files/common/fileService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/glob.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/common/watcher.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/common/diskFileSystemProvider.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/decorators/cancelPreviousCalls.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/decorators.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/parts/ipc/common/ipc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/console.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/parts/ipc/node/ipc.cp.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/node/watcher/watcherClient.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/node/watcher/baseWatcher.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/node/watcher/nodejs/nodejsWatcherLib.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/node/watcher/nodejs/nodejsWatcher.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/node/watcher/nodejs/nodejsClient.ts","vs/platform/files/node/diskFileSystemProvider.ts","vs/base/common/date.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/environment/common/environmentService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/environment/node/userDataPath.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/environment/node/environmentService.ts","vs/server/node/serverEnvironmentService.ts","vs/platform/extensionManagement/common/extensionManagementCLI.ts","vs/platform/languagePacks/common/languagePacks.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/languagePacks/node/languagePacks.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/download/common/downloadService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/instantiation/common/extensions.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/skipList.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/uriIdentity/common/uriIdentityService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/remoteLanguagePacks.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/extensionsScannerService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/state/node/state.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/state/node/stateService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/userDataProfile/node/userDataProfile.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/node/extensionsProfileScannerService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/log/common/logService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/log/node/spdlogLog.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/log/node/loggerService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/unc.ts","vs/platform/extensionManagement/common/allowedExtensionsService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/common/extensionGalleryManifestService.ts","vs/server/node/remoteExtensionHostAgentCli.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/osReleaseInfo.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/ports.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/parts/ipc/node/ipc.net.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/extensionHostStatusService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/extensions/common/extensionHostEnv.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/extensionHostConnection.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/remoteExtensionManagement.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/serverConnectionToken.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/macAddress.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/id.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/download/common/downloadIpc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/uriIpc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/common/extensionManagementIpc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/request/common/requestIpc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/telemetry/common/errorTelemetry.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/telemetry/node/errorTelemetry.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/common/terminal.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/log/common/logIpc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/common/requestStore.ts","vs/platform/terminal/common/terminalProfiles.ts","vs/platform/terminal/common/terminalPlatformConfiguration.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/common/environmentVariable.ts","vs/platform/terminal/common/environmentVariable.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/common/environmentVariableShared.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/common/environmentVariableCollection.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/node/terminalEnvironment.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/node/terminalProfiles.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/node/ptyHostService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/node/uriTransformer.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/node/ps.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/diagnostics/common/diagnostics.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/diagnostics/node/diagnosticsService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/remoteAgentEnvironmentImpl.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderServer.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/remoteFileSystemProviderServer.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/telemetry/common/remoteTelemetryChannel.ts","vs/platform/telemetry/common/telemetryService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/telemetry/common/serverTelemetryService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/mime.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/remote/common/remoteAuthorityResolver.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/notebook/common/notebookDocumentService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/common/extHostTypes.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/dataTransfer.ts","out-vscode-reh-web/vs/base/common/marked/marked.js","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/prefixTree.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/editor/common/core/position.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/editor/common/core/range.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/editor/common/core/editOperation.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/editor/common/tokenizationRegistry.ts","vs/editor/common/languages.ts","vs/platform/markers/common/markers.ts","vs/base/common/actions.ts","vs/workbench/common/editor.ts","vs/workbench/contrib/chat/common/chatVariableEntries.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/contrib/testing/common/testId.ts","vs/workbench/contrib/testing/common/testTypes.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/editor/common/editorGroupsService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/editor/common/editorService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/common/implicitActivationEvents.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/extensions/common/proxyIdentifier.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/contrib/testing/common/testItemCollection.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/common/extHostTestingPrivateApi.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/contrib/chat/common/constants.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/aiSettingsSearch/common/aiSettingsSearch.ts","vs/platform/theme/common/iconRegistry.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.ts","vs/workbench/contrib/mcp/common/modelContextProtocol.ts","vs/workbench/contrib/mcp/common/mcpTypes.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/common/extHostTypeConverters.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/common/extHost.protocol.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/common/extHostRpcService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/common/extHostTestItem.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/common/extHostInitDataService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/extensions/common/extensionHostProtocol.ts","vs/workbench/api/common/extHostTelemetry.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/common/extHostCommands.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/common/terminalEnvironment.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/base/common/labels.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolver.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverExpression.ts","vs/workbench/services/configurationResolver/common/variableResolver.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/remoteTerminalChannel.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/configuration/common/configuration.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/label/common/label.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/environmentVariable.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/remote/remoteTerminalChannel.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/files/common/diskFileSystemProviderClient.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/workbench/services/remote/common/remoteFileSystemProviderClient.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/telemetryClient.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/amdX.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/telemetry/common/1dsAppender.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/telemetry/node/1dsAppender.ts","vs/workbench/services/extensions/common/extensionsUtil.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/remoteExtensionsScanner.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/remote/common/remoteExtensionsScanner.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/userDataProfile/common/userDataProfileIpc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/terminal/node/nodePtyHostStarter.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/cssDev/node/cssDevService.ts","vs/platform/telemetry/common/telemetryLogAppender.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/mcp/common/nativeMcpDiscoveryHelper.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/mcp/node/nativeMcpDiscoveryHelperChannel.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/mcp/node/nativeMcpDiscoveryHelperService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/extensionManagement/common/extensionGalleryManifestServiceIpc.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/mcp/common/mcpManagement.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/mcp/common/mcpManagementService.ts","vs/platform/mcp/common/mcpGalleryService.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/platform/mcp/common/mcpManagementIpc.ts","vs/server/node/serverServices.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/webClientServer.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/remoteExtensionHostAgentServer.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/vs/server/node/server.main.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/bootstrap-server.ts","bootstrap-server.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/server-main.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/bootstrap-node.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/bootstrap-esm.ts","./file:/home/runner/work/code-server/code-server/lib/vscode/src/bootstrap-meta.ts"],"sourcesContent":["'use strict';\n\nfunction hasKey(obj, keys) {\n\tvar o = obj;\n\tkeys.slice(0, -1).forEach(function (key) {\n\t\to = o[key] || {};\n\t});\n\n\tvar key = keys[keys.length - 1];\n\treturn key in o;\n}\n\nfunction isNumber(x) {\n\tif (typeof x === 'number') { return true; }\n\tif ((/^0x[0-9a-f]+$/i).test(x)) { return true; }\n\treturn (/^[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(e[-+]?\\d+)?$/).test(x);\n}\n\nfunction isConstructorOrProto(obj, key) {\n\treturn (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';\n}\n\nmodule.exports = function (args, opts) {\n\tif (!opts) { opts = {}; }\n\n\tvar flags = {\n\t\tbools: {},\n\t\tstrings: {},\n\t\tunknownFn: null,\n\t};\n\n\tif (typeof opts.unknown === 'function') {\n\t\tflags.unknownFn = opts.unknown;\n\t}\n\n\tif (typeof opts.boolean === 'boolean' && opts.boolean) {\n\t\tflags.allBools = true;\n\t} else {\n\t\t[].concat(opts.boolean).filter(Boolean).forEach(function (key) {\n\t\t\tflags.bools[key] = true;\n\t\t});\n\t}\n\n\tvar aliases = {};\n\n\tfunction aliasIsBoolean(key) {\n\t\treturn aliases[key].some(function (x) {\n\t\t\treturn flags.bools[x];\n\t\t});\n\t}\n\n\tObject.keys(opts.alias || {}).forEach(function (key) {\n\t\taliases[key] = [].concat(opts.alias[key]);\n\t\taliases[key].forEach(function (x) {\n\t\t\taliases[x] = [key].concat(aliases[key].filter(function (y) {\n\t\t\t\treturn x !== y;\n\t\t\t}));\n\t\t});\n\t});\n\n\t[].concat(opts.string).filter(Boolean).forEach(function (key) {\n\t\tflags.strings[key] = true;\n\t\tif (aliases[key]) {\n\t\t\t[].concat(aliases[key]).forEach(function (k) {\n\t\t\t\tflags.strings[k] = true;\n\t\t\t});\n\t\t}\n\t});\n\n\tvar defaults = opts.default || {};\n\n\tvar argv = { _: [] };\n\n\tfunction argDefined(key, arg) {\n\t\treturn (flags.allBools && (/^--[^=]+$/).test(arg))\n\t\t\t|| flags.strings[key]\n\t\t\t|| flags.bools[key]\n\t\t\t|| aliases[key];\n\t}\n\n\tfunction setKey(obj, keys, value) {\n\t\tvar o = obj;\n\t\tfor (var i = 0; i < keys.length - 1; i++) {\n\t\t\tvar key = keys[i];\n\t\t\tif (isConstructorOrProto(o, key)) { return; }\n\t\t\tif (o[key] === undefined) { o[key] = {}; }\n\t\t\tif (\n\t\t\t\to[key] === Object.prototype\n\t\t\t\t|| o[key] === Number.prototype\n\t\t\t\t|| o[key] === String.prototype\n\t\t\t) {\n\t\t\t\to[key] = {};\n\t\t\t}\n\t\t\tif (o[key] === Array.prototype) { o[key] = []; }\n\t\t\to = o[key];\n\t\t}\n\n\t\tvar lastKey = keys[keys.length - 1];\n\t\tif (isConstructorOrProto(o, lastKey)) { return; }\n\t\tif (\n\t\t\to === Object.prototype\n\t\t\t|| o === Number.prototype\n\t\t\t|| o === String.prototype\n\t\t) {\n\t\t\to = {};\n\t\t}\n\t\tif (o === Array.prototype) { o = []; }\n\t\tif (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {\n\t\t\to[lastKey] = value;\n\t\t} else if (Array.isArray(o[lastKey])) {\n\t\t\to[lastKey].push(value);\n\t\t} else {\n\t\t\to[lastKey] = [o[lastKey], value];\n\t\t}\n\t}\n\n\tfunction setArg(key, val, arg) {\n\t\tif (arg && flags.unknownFn && !argDefined(key, arg)) {\n\t\t\tif (flags.unknownFn(arg) === false) { return; }\n\t\t}\n\n\t\tvar value = !flags.strings[key] && isNumber(val)\n\t\t\t? Number(val)\n\t\t\t: val;\n\t\tsetKey(argv, key.split('.'), value);\n\n\t\t(aliases[key] || []).forEach(function (x) {\n\t\t\tsetKey(argv, x.split('.'), value);\n\t\t});\n\t}\n\n\tObject.keys(flags.bools).forEach(function (key) {\n\t\tsetArg(key, defaults[key] === undefined ? false : defaults[key]);\n\t});\n\n\tvar notFlags = [];\n\n\tif (args.indexOf('--') !== -1) {\n\t\tnotFlags = args.slice(args.indexOf('--') + 1);\n\t\targs = args.slice(0, args.indexOf('--'));\n\t}\n\n\tfor (var i = 0; i < args.length; i++) {\n\t\tvar arg = args[i];\n\t\tvar key;\n\t\tvar next;\n\n\t\tif ((/^--.+=/).test(arg)) {\n\t\t\t// Using [\\s\\S] instead of . because js doesn't support the\n\t\t\t// 'dotall' regex modifier. See:\n\t\t\t// http://stackoverflow.com/a/1068308/13216\n\t\t\tvar m = arg.match(/^--([^=]+)=([\\s\\S]*)$/);\n\t\t\tkey = m[1];\n\t\t\tvar value = m[2];\n\t\t\tif (flags.bools[key]) {\n\t\t\t\tvalue = value !== 'false';\n\t\t\t}\n\t\t\tsetArg(key, value, arg);\n\t\t} else if ((/^--no-.+/).test(arg)) {\n\t\t\tkey = arg.match(/^--no-(.+)/)[1];\n\t\t\tsetArg(key, false, arg);\n\t\t} else if ((/^--.+/).test(arg)) {\n\t\t\tkey = arg.match(/^--(.+)/)[1];\n\t\t\tnext = args[i + 1];\n\t\t\tif (\n\t\t\t\tnext !== undefined\n\t\t\t\t&& !(/^(-|--)[^-]/).test(next)\n\t\t\t\t&& !flags.bools[key]\n\t\t\t\t&& !flags.allBools\n\t\t\t\t&& (aliases[key] ? !aliasIsBoolean(key) : true)\n\t\t\t) {\n\t\t\t\tsetArg(key, next, arg);\n\t\t\t\ti += 1;\n\t\t\t} else if ((/^(true|false)$/).test(next)) {\n\t\t\t\tsetArg(key, next === 'true', arg);\n\t\t\t\ti += 1;\n\t\t\t} else {\n\t\t\t\tsetArg(key, flags.strings[key] ? '' : true, arg);\n\t\t\t}\n\t\t} else if ((/^-[^-]+/).test(arg)) {\n\t\t\tvar letters = arg.slice(1, -1).split('');\n\n\t\t\tvar broken = false;\n\t\t\tfor (var j = 0; j < letters.length; j++) {\n\t\t\t\tnext = arg.slice(j + 2);\n\n\t\t\t\tif (next === '-') {\n\t\t\t\t\tsetArg(letters[j], next, arg);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {\n\t\t\t\t\tsetArg(letters[j], next.slice(1), arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(/[A-Za-z]/).test(letters[j])\n\t\t\t\t\t&& (/-?\\d+(\\.\\d*)?(e-?\\d+)?$/).test(next)\n\t\t\t\t) {\n\t\t\t\t\tsetArg(letters[j], next, arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (letters[j + 1] && letters[j + 1].match(/\\W/)) {\n\t\t\t\t\tsetArg(letters[j], arg.slice(j + 2), arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tsetArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tkey = arg.slice(-1)[0];\n\t\t\tif (!broken && key !== '-') {\n\t\t\t\tif (\n\t\t\t\t\targs[i + 1]\n\t\t\t\t\t&& !(/^(-|--)[^-]/).test(args[i + 1])\n\t\t\t\t\t&& !flags.bools[key]\n\t\t\t\t\t&& (aliases[key] ? !aliasIsBoolean(key) : true)\n\t\t\t\t) {\n\t\t\t\t\tsetArg(key, args[i + 1], arg);\n\t\t\t\t\ti += 1;\n\t\t\t\t} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {\n\t\t\t\t\tsetArg(key, args[i + 1] === 'true', arg);\n\t\t\t\t\ti += 1;\n\t\t\t\t} else {\n\t\t\t\t\tsetArg(key, flags.strings[key] ? '' : true, arg);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (!flags.unknownFn || flags.unknownFn(arg) !== false) {\n\t\t\t\targv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));\n\t\t\t}\n\t\t\tif (opts.stopEarly) {\n\t\t\t\targv._.push.apply(argv._, args.slice(i + 1));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tObject.keys(defaults).forEach(function (k) {\n\t\tif (!hasKey(argv, k.split('.'))) {\n\t\t\tsetKey(argv, k.split('.'), defaults[k]);\n\n\t\t\t(aliases[k] || []).forEach(function (x) {\n\t\t\t\tsetKey(argv, x.split('.'), defaults[k]);\n\t\t\t});\n\t\t}\n\t});\n\n\tif (opts['--']) {\n\t\targv['--'] = notFlags.slice();\n\t} else {\n\t\tnotFlags.forEach(function (k) {\n\t\t\targv._.push(k);\n\t\t});\n\t}\n\n\treturn argv;\n};\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { INodeProcess } from './platform.js';\n\nfunction _definePolyfillMarks(timeOrigin?: number) {\n\tconst _data: [string?, number?] = [];\n\tif (typeof timeOrigin === 'number') {\n\t\t_data.push('code/timeOrigin', timeOrigin);\n\t}\n\n\tfunction mark(name: string, markOptions?: { startTime?: number }) {\n\t\t_data.push(name, markOptions?.startTime ?? Date.now());\n\t}\n\tfunction getMarks() {\n\t\tconst result = [];\n\t\tfor (let i = 0; i < _data.length; i += 2) {\n\t\t\tresult.push({\n\t\t\t\tname: _data[i],\n\t\t\t\tstartTime: _data[i + 1],\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\treturn { mark, getMarks };\n}\n\ndeclare const process: INodeProcess;\n\ninterface IPerformanceEntry {\n\treadonly name: string;\n\treadonly startTime: number;\n}\n\ninterface IPerformanceTiming {\n\treadonly navigationStart?: number;\n\treadonly redirectStart?: number;\n\treadonly fetchStart?: number;\n}\n\ninterface IPerformance {\n\tmark(name: string, markOptions?: { startTime?: number }): void;\n\tgetEntriesByType(type: string): IPerformanceEntry[];\n\treadonly timeOrigin: number;\n\treadonly timing: IPerformanceTiming;\n\treadonly nodeTiming?: any;\n}\n\ndeclare const performance: IPerformance;\n\nfunction _define() {\n\n\t// Identify browser environment when following property is not present\n\t// https://nodejs.org/dist/latest-v16.x/docs/api/perf_hooks.html#performancenodetiming\n\t// @ts-ignore\n\tif (typeof performance === 'object' && typeof performance.mark === 'function' && !performance.nodeTiming) {\n\t\t// in a browser context, reuse performance-util\n\n\t\tif (typeof performance.timeOrigin !== 'number' && !performance.timing) {\n\t\t\t// safari & webworker: because there is no timeOrigin and no workaround\n\t\t\t// we use the `Date.now`-based polyfill.\n\t\t\treturn _definePolyfillMarks();\n\n\t\t} else {\n\t\t\t// use \"native\" performance for mark and getMarks\n\t\t\treturn {\n\t\t\t\tmark(name: string, markOptions?: { startTime?: number }) {\n\t\t\t\t\tperformance.mark(name, markOptions);\n\t\t\t\t},\n\t\t\t\tgetMarks() {\n\t\t\t\t\tlet timeOrigin = performance.timeOrigin;\n\t\t\t\t\tif (typeof timeOrigin !== 'number') {\n\t\t\t\t\t\t// safari: there is no timerOrigin but in renderers there is the timing-property\n\t\t\t\t\t\t// see https://bugs.webkit.org/show_bug.cgi?id=174862\n\t\t\t\t\t\ttimeOrigin = (performance.timing.navigationStart || performance.timing.redirectStart || performance.timing.fetchStart) ?? 0;\n\t\t\t\t\t}\n\t\t\t\t\tconst result = [{ name: 'code/timeOrigin', startTime: Math.round(timeOrigin) }];\n\t\t\t\t\tfor (const entry of performance.getEntriesByType('mark')) {\n\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\tname: entry.name,\n\t\t\t\t\t\t\tstartTime: Math.round(timeOrigin + entry.startTime)\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t} else if (typeof process === 'object') {\n\t\t// node.js: use the normal polyfill but add the timeOrigin\n\t\t// from the node perf_hooks API as very first mark\n\t\tconst timeOrigin = performance?.timeOrigin;\n\t\treturn _definePolyfillMarks(timeOrigin);\n\n\t} else {\n\t\t// unknown environment\n\t\tconsole.trace('perf-util loaded in UNKNOWN environment');\n\t\treturn _definePolyfillMarks();\n\t}\n}\n\nfunction _factory(sharedObj: any) {\n\tif (!sharedObj.MonacoPerformanceMarks) {\n\t\tsharedObj.MonacoPerformanceMarks = _define();\n\t}\n\treturn sharedObj.MonacoPerformanceMarks;\n}\n\nconst perf = _factory(globalThis);\n\nexport const mark: (name: string, markOptions?: { startTime?: number }) => void = perf.mark;\n\nexport interface PerformanceMark {\n\treadonly name: string;\n\treadonly startTime: number;\n}\n\n/**\n * Returns all marks, sorted by `startTime`.\n */\nexport const getMarks: () => PerformanceMark[] = perf.getMarks;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/*\n * This module exists so that the AMD build of the monaco editor can replace this with an async loader plugin.\n * If you add new functions to this module make sure that they are also provided in the AMD build of the monaco editor.\n *\n * TODO@esm remove me once we no longer ship an AMD build.\n */\n\nexport function getNLSMessages(): string[] {\n\treturn globalThis._VSCODE_NLS_MESSAGES;\n}\n\nexport function getNLSLanguage(): string | undefined {\n\treturn globalThis._VSCODE_NLS_LANGUAGE;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// eslint-disable-next-line local/code-import-patterns\nimport { getNLSLanguage, getNLSMessages } from './nls.messages.js';\n// eslint-disable-next-line local/code-import-patterns\nexport { getNLSLanguage, getNLSMessages } from './nls.messages.js';\n\ndeclare const document: { location?: { hash?: string } } | undefined;\nconst isPseudo = getNLSLanguage() === 'pseudo' || (typeof document !== 'undefined' && document.location && typeof document.location.hash === 'string' && document.location.hash.indexOf('pseudo=true') >= 0);\n\nexport interface ILocalizeInfo {\n\tkey: string;\n\tcomment: string[];\n}\n\nexport interface ILocalizedString {\n\toriginal: string;\n\tvalue: string;\n}\n\nfunction _format(message: string, args: (string | number | boolean | undefined | null)[]): string {\n\tlet result: string;\n\n\tif (args.length === 0) {\n\t\tresult = message;\n\t} else {\n\t\tresult = message.replace(/\\{(\\d+)\\}/g, (match, rest) => {\n\t\t\tconst index = rest[0];\n\t\t\tconst arg = args[index];\n\t\t\tlet result = match;\n\t\t\tif (typeof arg === 'string') {\n\t\t\t\tresult = arg;\n\t\t\t} else if (typeof arg === 'number' || typeof arg === 'boolean' || arg === void 0 || arg === null) {\n\t\t\t\tresult = String(arg);\n\t\t\t}\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tif (isPseudo) {\n\t\t// FF3B and FF3D is the Unicode zenkaku representation for [ and ]\n\t\tresult = '\\uFF3B' + result.replace(/[aouei]/g, '$&$&') + '\\uFF3D';\n\t}\n\n\treturn result;\n}\n\n/**\n * Marks a string to be localized. Returns the localized string.\n *\n * @param info The {@linkcode ILocalizeInfo} which describes the id and comments associated with the localized string.\n * @param message The string to localize\n * @param args The arguments to the string\n *\n * @note `message` can contain `{n}` notation where it is replaced by the nth value in `...args`\n * @example `localize({ key: 'sayHello', comment: ['Welcomes user'] }, 'hello {0}', name)`\n *\n * @returns string The localized string.\n */\nexport function localize(info: ILocalizeInfo, message: string, ...args: (string | number | boolean | undefined | null)[]): string;\n\n/**\n * Marks a string to be localized. Returns the localized string.\n *\n * @param key The key to use for localizing the string\n * @param message The string to localize\n * @param args The arguments to the string\n *\n * @note `message` can contain `{n}` notation where it is replaced by the nth value in `...args`\n * @example For example, `localize('sayHello', 'hello {0}', name)`\n *\n * @returns string The localized string.\n */\nexport function localize(key: string, message: string, ...args: (string | number | boolean | undefined | null)[]): string;\n\n/**\n * @skipMangle\n */\nexport function localize(data: ILocalizeInfo | string /* | number when built */, message: string /* | null when built */, ...args: (string | number | boolean | undefined | null)[]): string {\n\tif (typeof data === 'number') {\n\t\treturn _format(lookupMessage(data, message), args);\n\t}\n\treturn _format(message, args);\n}\n\n/**\n * Only used when built: Looks up the message in the global NLS table.\n * This table is being made available as a global through bootstrapping\n * depending on the target context.\n */\nfunction lookupMessage(index: number, fallback: string | null): string {\n\tconst message = getNLSMessages()?.[index];\n\tif (typeof message !== 'string') {\n\t\tif (typeof fallback === 'string') {\n\t\t\treturn fallback;\n\t\t}\n\t\tthrow new Error(`!!! NLS MISSING: ${index} !!!`);\n\t}\n\treturn message;\n}\n\n/**\n * Marks a string to be localized. Returns an {@linkcode ILocalizedString}\n * which contains the localized string and the original string.\n *\n * @param info The {@linkcode ILocalizeInfo} which describes the id and comments associated with the localized string.\n * @param message The string to localize\n * @param args The arguments to the string\n *\n * @note `message` can contain `{n}` notation where it is replaced by the nth value in `...args`\n * @example `localize2({ key: 'sayHello', comment: ['Welcomes user'] }, 'hello {0}', name)`\n *\n * @returns ILocalizedString which contains the localized string and the original string.\n */\nexport function localize2(info: ILocalizeInfo, message: string, ...args: (string | number | boolean | undefined | null)[]): ILocalizedString;\n\n/**\n * Marks a string to be localized. Returns an {@linkcode ILocalizedString}\n * which contains the localized string and the original string.\n *\n * @param key The key to use for localizing the string\n * @param message The string to localize\n * @param args The arguments to the string\n *\n * @note `message` can contain `{n}` notation where it is replaced by the nth value in `...args`\n * @example `localize('sayHello', 'hello {0}', name)`\n *\n * @returns ILocalizedString which contains the localized string and the original string.\n */\nexport function localize2(key: string, message: string, ...args: (string | number | boolean | undefined | null)[]): ILocalizedString;\n\n/**\n * @skipMangle\n */\nexport function localize2(data: ILocalizeInfo | string /* | number when built */, originalMessage: string, ...args: (string | number | boolean | undefined | null)[]): ILocalizedString {\n\tlet message: string;\n\tif (typeof data === 'number') {\n\t\tmessage = lookupMessage(data, originalMessage);\n\t} else {\n\t\tmessage = originalMessage;\n\t}\n\n\tconst value = _format(message, args);\n\n\treturn {\n\t\tvalue,\n\t\toriginal: originalMessage === message ? value : _format(originalMessage, args)\n\t};\n}\n\nexport interface INLSLanguagePackConfiguration {\n\n\t/**\n\t * The path to the translations config file that contains pointers to\n\t * all message bundles for `main` and extensions.\n\t */\n\treadonly translationsConfigFile: string;\n\n\t/**\n\t * The path to the file containing the translations for this language\n\t * pack as flat string array.\n\t */\n\treadonly messagesFile: string;\n\n\t/**\n\t * The path to the file that can be used to signal a corrupt language\n\t * pack, for example when reading the `messagesFile` fails. This will\n\t * instruct the application to re-create the cache on next startup.\n\t */\n\treadonly corruptMarkerFile: string;\n}\n\nexport interface INLSConfiguration {\n\n\t/**\n\t * Locale as defined in `argv.json` or `app.getLocale()`.\n\t */\n\treadonly userLocale: string;\n\n\t/**\n\t * Locale as defined by the OS (e.g. `app.getPreferredSystemLanguages()`).\n\t */\n\treadonly osLocale: string;\n\n\t/**\n\t * The actual language of the UI that ends up being used considering `userLocale`\n\t * and `osLocale`.\n\t */\n\treadonly resolvedLanguage: string;\n\n\t/**\n\t * Defined if a language pack is used that is not the\n\t * default english language pack. This requires a language\n\t * pack to be installed as extension.\n\t */\n\treadonly languagePack?: INLSLanguagePackConfiguration;\n\n\t/**\n\t * The path to the file containing the default english messages\n\t * as flat string array. The file is only present in built\n\t * versions of the application.\n\t */\n\treadonly defaultMessagesFile: string;\n\n\t/**\n\t * Below properties are deprecated and only there to continue support\n\t * for `vscode-nls` module that depends on them.\n\t * Refs https://github.com/microsoft/vscode-nls/blob/main/src/node/main.ts#L36-L46\n\t */\n\t/** @deprecated */\n\treadonly locale: string;\n\t/** @deprecated */\n\treadonly availableLanguages: Record<string, string>;\n\t/** @deprecated */\n\treadonly _languagePackSupport?: boolean;\n\t/** @deprecated */\n\treadonly _languagePackId?: string;\n\t/** @deprecated */\n\treadonly _translationsConfigFile?: string;\n\t/** @deprecated */\n\treadonly _cacheRoot?: string;\n\t/** @deprecated */\n\treadonly _resolvedLanguagePackCoreLocation?: string;\n\t/** @deprecated */\n\treadonly _corruptedFile?: string;\n}\n\nexport interface ILanguagePack {\n\treadonly hash: string;\n\treadonly label: string | undefined;\n\treadonly extensions: {\n\t\treadonly extensionIdentifier: { readonly id: string; readonly uuid?: string };\n\t\treadonly version: string;\n\t}[];\n\treadonly translations: Record<string, string | undefined>;\n}\n\nexport type ILanguagePacks = Record<string, ILanguagePack | undefined>;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as nls from '../../nls.js';\n\nexport const LANGUAGE_DEFAULT = 'en';\n\nlet _isWindows = false;\nlet _isMacintosh = false;\nlet _isLinux = false;\nlet _isLinuxSnap = false;\nlet _isNative = false;\nlet _isWeb = false;\nlet _isElectron = false;\nlet _isIOS = false;\nlet _isCI = false;\nlet _isMobile = false;\nlet _locale: string | undefined = undefined;\nlet _language: string = LANGUAGE_DEFAULT;\nlet _platformLocale: string = LANGUAGE_DEFAULT;\nlet _translationsConfigFile: string | undefined = undefined;\nlet _userAgent: string | undefined = undefined;\n\nexport interface IProcessEnvironment {\n\t[key: string]: string | undefined;\n}\n\n/**\n * This interface is intentionally not identical to node.js\n * process because it also works in sandboxed environments\n * where the process object is implemented differently. We\n * define the properties here that we need for `platform`\n * to work and nothing else.\n */\nexport interface INodeProcess {\n\tplatform: string;\n\tarch: string;\n\tenv: IProcessEnvironment;\n\tversions?: {\n\t\tnode?: string;\n\t\telectron?: string;\n\t\tchrome?: string;\n\t};\n\ttype?: string;\n\tcwd: () => string;\n}\n\ndeclare const process: INodeProcess;\n\nconst $globalThis: any = globalThis;\n\nlet nodeProcess: INodeProcess | undefined = undefined;\nif (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {\n\t// Native environment (sandboxed)\n\tnodeProcess = $globalThis.vscode.process;\n} else if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') {\n\t// Native environment (non-sandboxed)\n\tnodeProcess = process;\n}\n\nconst isElectronProcess = typeof nodeProcess?.versions?.electron === 'string';\nconst isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer';\n\ninterface INavigator {\n\tuserAgent: string;\n\tmaxTouchPoints?: number;\n\tlanguage: string;\n}\ndeclare const navigator: INavigator;\n\n// Native environment\nif (typeof nodeProcess === 'object') {\n\t_isWindows = (nodeProcess.platform === 'win32');\n\t_isMacintosh = (nodeProcess.platform === 'darwin');\n\t_isLinux = (nodeProcess.platform === 'linux');\n\t_isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\n\t_isElectron = isElectronProcess;\n\t_isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'];\n\t_locale = LANGUAGE_DEFAULT;\n\t_language = LANGUAGE_DEFAULT;\n\tconst rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\n\tif (rawNlsConfig) {\n\t\ttry {\n\t\t\tconst nlsConfig: nls.INLSConfiguration = JSON.parse(rawNlsConfig);\n\t\t\t_locale = nlsConfig.userLocale;\n\t\t\t_platformLocale = nlsConfig.osLocale;\n\t\t\t_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;\n\t\t\t_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;\n\t\t} catch (e) {\n\t\t}\n\t}\n\t_isNative = true;\n}\n\n// Web environment\nelse if (typeof navigator === 'object' && !isElectronRenderer) {\n\t_userAgent = navigator.userAgent;\n\t_isWindows = _userAgent.indexOf('Windows') >= 0;\n\t_isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\n\t_isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\n\t_isLinux = _userAgent.indexOf('Linux') >= 0;\n\t_isMobile = _userAgent?.indexOf('Mobi') >= 0;\n\t_isWeb = true;\n\t_language = nls.getNLSLanguage() || LANGUAGE_DEFAULT;\n\t_locale = navigator.language.toLowerCase();\n\t_platformLocale = _locale;\n}\n\n// Unknown environment\nelse {\n\tconsole.error('Unable to resolve platform.');\n}\n\nexport const enum Platform {\n\tWeb,\n\tMac,\n\tLinux,\n\tWindows\n}\nexport type PlatformName = 'Web' | 'Windows' | 'Mac' | 'Linux';\n\nexport function PlatformToString(platform: Platform): PlatformName {\n\tswitch (platform) {\n\t\tcase Platform.Web: return 'Web';\n\t\tcase Platform.Mac: return 'Mac';\n\t\tcase Platform.Linux: return 'Linux';\n\t\tcase Platform.Windows: return 'Windows';\n\t}\n}\n\nlet _platform: Platform = Platform.Web;\nif (_isMacintosh) {\n\t_platform = Platform.Mac;\n} else if (_isWindows) {\n\t_platform = Platform.Windows;\n} else if (_isLinux) {\n\t_platform = Platform.Linux;\n}\n\nexport const isWindows = _isWindows;\nexport const isMacintosh = _isMacintosh;\nexport const isLinux = _isLinux;\nexport const isLinuxSnap = _isLinuxSnap;\nexport const isNative = _isNative;\nexport const isElectron = _isElectron;\nexport const isWeb = _isWeb;\nexport const isWebWorker = (_isWeb && typeof $globalThis.importScripts === 'function');\nexport const webWorkerOrigin = isWebWorker ? $globalThis.origin : undefined;\nexport const isIOS = _isIOS;\nexport const isMobile = _isMobile;\n/**\n * Whether we run inside a CI environment, such as\n * GH actions or Azure Pipelines.\n */\nexport const isCI = _isCI;\nexport const platform = _platform;\nexport const userAgent = _userAgent;\n\n/**\n * The language used for the user interface. The format of\n * the string is all lower case (e.g. zh-tw for Traditional\n * Chinese or de for German)\n */\nexport const language = _language;\n\nexport namespace Language {\n\n\texport function value(): string {\n\t\treturn language;\n\t}\n\n\texport function isDefaultVariant(): boolean {\n\t\tif (language.length === 2) {\n\t\t\treturn language === 'en';\n\t\t} else if (language.length >= 3) {\n\t\t\treturn language[0] === 'e' && language[1] === 'n' && language[2] === '-';\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\texport function isDefault(): boolean {\n\t\treturn language === 'en';\n\t}\n}\n\n/**\n * Desktop: The OS locale or the locale specified by --locale or `argv.json`.\n * Web: matches `platformLocale`.\n *\n * The UI is not necessarily shown in the provided locale.\n */\nexport const locale = _locale;\n\n/**\n * This will always be set to the OS/browser's locale regardless of\n * what was specified otherwise. The format of the string is all\n * lower case (e.g. zh-tw for Traditional Chinese). The UI is not\n * necessarily shown in the provided locale.\n */\nexport const platformLocale = _platformLocale;\n\n/**\n * The translations that are available through language packs.\n */\nexport const translationsConfigFile = _translationsConfigFile;\n\nexport const setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts);\n\n/**\n * See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.\n *\n * Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay\n * that browsers set when the nesting level is > 5.\n */\nexport const setTimeout0 = (() => {\n\tif (setTimeout0IsFaster) {\n\t\tinterface IQueueElement {\n\t\t\tid: number;\n\t\t\tcallback: () => void;\n\t\t}\n\t\tconst pending: IQueueElement[] = [];\n\n\t\t$globalThis.addEventListener('message', (e: any) => {\n\t\t\tif (e.data && e.data.vscodeScheduleAsyncWork) {\n\t\t\t\tfor (let i = 0, len = pending.length; i < len; i++) {\n\t\t\t\t\tconst candidate = pending[i];\n\t\t\t\t\tif (candidate.id === e.data.vscodeScheduleAsyncWork) {\n\t\t\t\t\t\tpending.splice(i, 1);\n\t\t\t\t\t\tcandidate.callback();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tlet lastId = 0;\n\t\treturn (callback: () => void) => {\n\t\t\tconst myId = ++lastId;\n\t\t\tpending.push({\n\t\t\t\tid: myId,\n\t\t\t\tcallback: callback\n\t\t\t});\n\t\t\t$globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*');\n\t\t};\n\t}\n\treturn (callback: () => void) => setTimeout(callback);\n})();\n\nexport const enum OperatingSystem {\n\tWindows = 1,\n\tMacintosh = 2,\n\tLinux = 3\n}\nexport const OS = (_isMacintosh || _isIOS ? OperatingSystem.Macintosh : (_isWindows ? OperatingSystem.Windows : OperatingSystem.Linux));\n\nlet _isLittleEndian = true;\nlet _isLittleEndianComputed = false;\nexport function isLittleEndian(): boolean {\n\tif (!_isLittleEndianComputed) {\n\t\t_isLittleEndianComputed = true;\n\t\tconst test = new Uint8Array(2);\n\t\ttest[0] = 1;\n\t\ttest[1] = 2;\n\t\tconst view = new Uint16Array(test.buffer);\n\t\t_isLittleEndian = (view[0] === (2 << 8) + 1);\n\t}\n\treturn _isLittleEndian;\n}\n\nexport const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0);\nexport const isFirefox = !!(userAgent && userAgent.indexOf('Firefox') >= 0);\nexport const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf('Safari') >= 0));\nexport const isEdge = !!(userAgent && userAgent.indexOf('Edg/') >= 0);\nexport const isAndroid = !!(userAgent && userAgent.indexOf('Android') >= 0);\n\nexport function isBigSurOrNewer(osVersion: string): boolean {\n\treturn parseFloat(osVersion) >= 20;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { INodeProcess, isMacintosh, isWindows } from './platform.js';\n\nlet safeProcess: Omit<INodeProcess, 'arch'> & { arch: string | undefined };\ndeclare const process: INodeProcess;\n\n// Native sandbox environment\nconst vscodeGlobal = (globalThis as any).vscode;\nif (typeof vscodeGlobal !== 'undefined' && typeof vscodeGlobal.process !== 'undefined') {\n\tconst sandboxProcess: INodeProcess = vscodeGlobal.process;\n\tsafeProcess = {\n\t\tget platform() { return sandboxProcess.platform; },\n\t\tget arch() { return sandboxProcess.arch; },\n\t\tget env() { return sandboxProcess.env; },\n\t\tcwd() { return sandboxProcess.cwd(); }\n\t};\n}\n\n// Native node.js environment\nelse if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') {\n\tsafeProcess = {\n\t\tget platform() { return process.platform; },\n\t\tget arch() { return process.arch; },\n\t\tget env() { return process.env; },\n\t\tcwd() { return process.env['VSCODE_CWD'] || process.cwd(); }\n\t};\n}\n\n// Web environment\nelse {\n\tsafeProcess = {\n\n\t\t// Supported\n\t\tget platform() { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; },\n\t\tget arch() { return undefined; /* arch is undefined in web */ },\n\n\t\t// Unsupported\n\t\tget env() { return {}; },\n\t\tcwd() { return '/'; }\n\t};\n}\n\n/**\n * Provides safe access to the `cwd` property in node.js, sandboxed or web\n * environments.\n *\n * Note: in web, this property is hardcoded to be `/`.\n *\n * @skipMangle\n */\nexport const cwd = safeProcess.cwd;\n\n/**\n * Provides safe access to the `env` property in node.js, sandboxed or web\n * environments.\n *\n * Note: in web, this property is hardcoded to be `{}`.\n */\nexport const env = safeProcess.env;\n\n/**\n * Provides safe access to the `platform` property in node.js, sandboxed or web\n * environments.\n */\nexport const platform = safeProcess.platform;\n\n/**\n * Provides safe access to the `arch` method in node.js, sandboxed or web\n * environments.\n * Note: `arch` is `undefined` in web\n */\nexport const arch = safeProcess.arch;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// NOTE: VSCode's copy of nodejs path library to be usable in common (non-node) namespace\n// Copied from: https://github.com/nodejs/node/commits/v22.15.0/lib/path.js\n// Excluding: the change that adds primordials\n// (https://github.com/nodejs/node/commit/187a862d221dec42fa9a5c4214e7034d9092792f and others)\n// Excluding: the change that adds glob matching\n// (https://github.com/nodejs/node/commit/57b8b8e18e5e2007114c63b71bf0baedc01936a6)\n\n/**\n * Copyright Joyent, Inc. and other Node contributors.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to permit\n * persons to whom the Software is furnished to do so, subject to the\n * following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n * USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nimport * as process from './process.js';\n\nconst CHAR_UPPERCASE_A = 65;/* A */\nconst CHAR_LOWERCASE_A = 97; /* a */\nconst CHAR_UPPERCASE_Z = 90; /* Z */\nconst CHAR_LOWERCASE_Z = 122; /* z */\nconst CHAR_DOT = 46; /* . */\nconst CHAR_FORWARD_SLASH = 47; /* / */\nconst CHAR_BACKWARD_SLASH = 92; /* \\ */\nconst CHAR_COLON = 58; /* : */\nconst CHAR_QUESTION_MARK = 63; /* ? */\n\nclass ErrorInvalidArgType extends Error {\n\tcode: 'ERR_INVALID_ARG_TYPE';\n\tconstructor(name: string, expected: string, actual: unknown) {\n\t\t// determiner: 'must be' or 'must not be'\n\t\tlet determiner;\n\t\tif (typeof expected === 'string' && expected.indexOf('not ') === 0) {\n\t\t\tdeterminer = 'must not be';\n\t\t\texpected = expected.replace(/^not /, '');\n\t\t} else {\n\t\t\tdeterminer = 'must be';\n\t\t}\n\n\t\tconst type = name.indexOf('.') !== -1 ? 'property' : 'argument';\n\t\tlet msg = `The \"${name}\" ${type} ${determiner} of type ${expected}`;\n\n\t\tmsg += `. Received type ${typeof actual}`;\n\t\tsuper(msg);\n\n\t\tthis.code = 'ERR_INVALID_ARG_TYPE';\n\t}\n}\n\nfunction validateObject(pathObject: object, name: string) {\n\tif (pathObject === null || typeof pathObject !== 'object') {\n\t\tthrow new ErrorInvalidArgType(name, 'Object', pathObject);\n\t}\n}\n\nfunction validateString(value: string, name: string) {\n\tif (typeof value !== 'string') {\n\t\tthrow new ErrorInvalidArgType(name, 'string', value);\n\t}\n}\n\nconst platformIsWin32 = (process.platform === 'win32');\n\nfunction isPathSeparator(code: number | undefined) {\n\treturn code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;\n}\n\nfunction isPosixPathSeparator(code: number | undefined) {\n\treturn code === CHAR_FORWARD_SLASH;\n}\n\nfunction isWindowsDeviceRoot(code: number) {\n\treturn (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||\n\t\t(code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z);\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeString(path: string, allowAboveRoot: boolean, separator: string, isPathSeparator: (code?: number) => boolean) {\n\tlet res = '';\n\tlet lastSegmentLength = 0;\n\tlet lastSlash = -1;\n\tlet dots = 0;\n\tlet code = 0;\n\tfor (let i = 0; i <= path.length; ++i) {\n\t\tif (i < path.length) {\n\t\t\tcode = path.charCodeAt(i);\n\t\t}\n\t\telse if (isPathSeparator(code)) {\n\t\t\tbreak;\n\t\t}\n\t\telse {\n\t\t\tcode = CHAR_FORWARD_SLASH;\n\t\t}\n\n\t\tif (isPathSeparator(code)) {\n\t\t\tif (lastSlash === i - 1 || dots === 1) {\n\t\t\t\t// NOOP\n\t\t\t} else if (dots === 2) {\n\t\t\t\tif (res.length < 2 || lastSegmentLength !== 2 ||\n\t\t\t\t\tres.charCodeAt(res.length - 1) !== CHAR_DOT ||\n\t\t\t\t\tres.charCodeAt(res.length - 2) !== CHAR_DOT) {\n\t\t\t\t\tif (res.length > 2) {\n\t\t\t\t\t\tconst lastSlashIndex = res.lastIndexOf(separator);\n\t\t\t\t\t\tif (lastSlashIndex === -1) {\n\t\t\t\t\t\t\tres = '';\n\t\t\t\t\t\t\tlastSegmentLength = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tres = res.slice(0, lastSlashIndex);\n\t\t\t\t\t\t\tlastSegmentLength = res.length - 1 - res.lastIndexOf(separator);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastSlash = i;\n\t\t\t\t\t\tdots = 0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (res.length !== 0) {\n\t\t\t\t\t\tres = '';\n\t\t\t\t\t\tlastSegmentLength = 0;\n\t\t\t\t\t\tlastSlash = i;\n\t\t\t\t\t\tdots = 0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (allowAboveRoot) {\n\t\t\t\t\tres += res.length > 0 ? `${separator}..` : '..';\n\t\t\t\t\tlastSegmentLength = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (res.length > 0) {\n\t\t\t\t\tres += `${separator}${path.slice(lastSlash + 1, i)}`;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tres = path.slice(lastSlash + 1, i);\n\t\t\t\t}\n\t\t\t\tlastSegmentLength = i - lastSlash - 1;\n\t\t\t}\n\t\t\tlastSlash = i;\n\t\t\tdots = 0;\n\t\t} else if (code === CHAR_DOT && dots !== -1) {\n\t\t\t++dots;\n\t\t} else {\n\t\t\tdots = -1;\n\t\t}\n\t}\n\treturn res;\n}\n\nfunction formatExt(ext: string): string {\n\treturn ext ? `${ext[0] === '.' ? '' : '.'}${ext}` : '';\n}\n\nfunction _format(sep: string, pathObject: ParsedPath) {\n\tvalidateObject(pathObject, 'pathObject');\n\tconst dir = pathObject.dir || pathObject.root;\n\tconst base = pathObject.base ||\n\t\t`${pathObject.name || ''}${formatExt(pathObject.ext)}`;\n\tif (!dir) {\n\t\treturn base;\n\t}\n\treturn dir === pathObject.root ? `${dir}${base}` : `${dir}${sep}${base}`;\n}\n\nexport interface ParsedPath {\n\troot: string;\n\tdir: string;\n\tbase: string;\n\text: string;\n\tname: string;\n}\n\nexport interface IPath {\n\tnormalize(path: string): string;\n\tisAbsolute(path: string): boolean;\n\tjoin(...paths: string[]): string;\n\tresolve(...pathSegments: string[]): string;\n\trelative(from: string, to: string): string;\n\tdirname(path: string): string;\n\tbasename(path: string, suffix?: string): string;\n\textname(path: string): string;\n\tformat(pathObject: ParsedPath): string;\n\tparse(path: string): ParsedPath;\n\ttoNamespacedPath(path: string): string;\n\tsep: '\\\\' | '/';\n\tdelimiter: string;\n\twin32: IPath | null;\n\tposix: IPath | null;\n}\n\nexport const win32: IPath = {\n\t// path.resolve([from ...], to)\n\tresolve(...pathSegments: string[]): string {\n\t\tlet resolvedDevice = '';\n\t\tlet resolvedTail = '';\n\t\tlet resolvedAbsolute = false;\n\n\t\tfor (let i = pathSegments.length - 1; i >= -1; i--) {\n\t\t\tlet path;\n\t\t\tif (i >= 0) {\n\t\t\t\tpath = pathSegments[i];\n\t\t\t\tvalidateString(path, `paths[${i}]`);\n\n\t\t\t\t// Skip empty entries\n\t\t\t\tif (path.length === 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else if (resolvedDevice.length === 0) {\n\t\t\t\tpath = process.cwd();\n\t\t\t} else {\n\t\t\t\t// Windows has the concept of drive-specific current working\n\t\t\t\t// directories. If we've resolved a drive letter but not yet an\n\t\t\t\t// absolute path, get cwd for that drive, or the process cwd if\n\t\t\t\t// the drive cwd is not available. We're sure the device is not\n\t\t\t\t// a UNC path at this points, because UNC paths are always absolute.\n\t\t\t\tpath = process.env[`=${resolvedDevice}`] || process.cwd();\n\n\t\t\t\t// Verify that a cwd was found and that it actually points\n\t\t\t\t// to our drive. If not, default to the drive's root.\n\t\t\t\tif (path === undefined ||\n\t\t\t\t\t(path.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() &&\n\t\t\t\t\t\tpath.charCodeAt(2) === CHAR_BACKWARD_SLASH)) {\n\t\t\t\t\tpath = `${resolvedDevice}\\\\`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst len = path.length;\n\t\t\tlet rootEnd = 0;\n\t\t\tlet device = '';\n\t\t\tlet isAbsolute = false;\n\t\t\tconst code = path.charCodeAt(0);\n\n\t\t\t// Try to match a root\n\t\t\tif (len === 1) {\n\t\t\t\tif (isPathSeparator(code)) {\n\t\t\t\t\t// `path` contains just a path separator\n\t\t\t\t\trootEnd = 1;\n\t\t\t\t\tisAbsolute = true;\n\t\t\t\t}\n\t\t\t} else if (isPathSeparator(code)) {\n\t\t\t\t// Possible UNC root\n\n\t\t\t\t// If we started with a separator, we know we at least have an\n\t\t\t\t// absolute path of some kind (UNC or otherwise)\n\t\t\t\tisAbsolute = true;\n\n\t\t\t\tif (isPathSeparator(path.charCodeAt(1))) {\n\t\t\t\t\t// Matched double path separator at beginning\n\t\t\t\t\tlet j = 2;\n\t\t\t\t\tlet last = j;\n\t\t\t\t\t// Match 1 or more non-path separators\n\t\t\t\t\twhile (j < len && !isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\t\t\t\tif (j < len && j !== last) {\n\t\t\t\t\t\tconst firstPart = path.slice(last, j);\n\t\t\t\t\t\t// Matched!\n\t\t\t\t\t\tlast = j;\n\t\t\t\t\t\t// Match 1 or more path separators\n\t\t\t\t\t\twhile (j < len && isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (j < len && j !== last) {\n\t\t\t\t\t\t\t// Matched!\n\t\t\t\t\t\t\tlast = j;\n\t\t\t\t\t\t\t// Match 1 or more non-path separators\n\t\t\t\t\t\t\twhile (j < len && !isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (j === len || j !== last) {\n\t\t\t\t\t\t\t\t// We matched a UNC root\n\t\t\t\t\t\t\t\tdevice = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\n\t\t\t\t\t\t\t\trootEnd = j;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\trootEnd = 1;\n\t\t\t\t}\n\t\t\t} else if (isWindowsDeviceRoot(code) &&\n\t\t\t\tpath.charCodeAt(1) === CHAR_COLON) {\n\t\t\t\t// Possible device root\n\t\t\t\tdevice = path.slice(0, 2);\n\t\t\t\trootEnd = 2;\n\t\t\t\tif (len > 2 && isPathSeparator(path.charCodeAt(2))) {\n\t\t\t\t\t// Treat separator following drive name as an absolute path\n\t\t\t\t\t// indicator\n\t\t\t\t\tisAbsolute = true;\n\t\t\t\t\trootEnd = 3;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (device.length > 0) {\n\t\t\t\tif (resolvedDevice.length > 0) {\n\t\t\t\t\tif (device.toLowerCase() !== resolvedDevice.toLowerCase()) {\n\t\t\t\t\t\t// This path points to another device so it is not applicable\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresolvedDevice = device;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (resolvedAbsolute) {\n\t\t\t\tif (resolvedDevice.length > 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresolvedTail = `${path.slice(rootEnd)}\\\\${resolvedTail}`;\n\t\t\t\tresolvedAbsolute = isAbsolute;\n\t\t\t\tif (isAbsolute && resolvedDevice.length > 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// At this point the path should be resolved to a full absolute path,\n\t\t// but handle relative paths to be safe (might happen when process.cwd()\n\t\t// fails)\n\n\t\t// Normalize the tail path\n\t\tresolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, '\\\\',\n\t\t\tisPathSeparator);\n\n\t\treturn resolvedAbsolute ?\n\t\t\t`${resolvedDevice}\\\\${resolvedTail}` :\n\t\t\t`${resolvedDevice}${resolvedTail}` || '.';\n\t},\n\n\tnormalize(path: string): string {\n\t\tvalidateString(path, 'path');\n\t\tconst len = path.length;\n\t\tif (len === 0) {\n\t\t\treturn '.';\n\t\t}\n\t\tlet rootEnd = 0;\n\t\tlet device;\n\t\tlet isAbsolute = false;\n\t\tconst code = path.charCodeAt(0);\n\n\t\t// Try to match a root\n\t\tif (len === 1) {\n\t\t\t// `path` contains just a single char, exit early to avoid\n\t\t\t// unnecessary work\n\t\t\treturn isPosixPathSeparator(code) ? '\\\\' : path;\n\t\t}\n\t\tif (isPathSeparator(code)) {\n\t\t\t// Possible UNC root\n\n\t\t\t// If we started with a separator, we know we at least have an absolute\n\t\t\t// path of some kind (UNC or otherwise)\n\t\t\tisAbsolute = true;\n\n\t\t\tif (isPathSeparator(path.charCodeAt(1))) {\n\t\t\t\t// Matched double path separator at beginning\n\t\t\t\tlet j = 2;\n\t\t\t\tlet last = j;\n\t\t\t\t// Match 1 or more non-path separators\n\t\t\t\twhile (j < len && !isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tif (j < len && j !== last) {\n\t\t\t\t\tconst firstPart = path.slice(last, j);\n\t\t\t\t\t// Matched!\n\t\t\t\t\tlast = j;\n\t\t\t\t\t// Match 1 or more path separators\n\t\t\t\t\twhile (j < len && isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\t\t\t\tif (j < len && j !== last) {\n\t\t\t\t\t\t// Matched!\n\t\t\t\t\t\tlast = j;\n\t\t\t\t\t\t// Match 1 or more non-path separators\n\t\t\t\t\t\twhile (j < len && !isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (j === len) {\n\t\t\t\t\t\t\t// We matched a UNC root only\n\t\t\t\t\t\t\t// Return the normalized version of the UNC root since there\n\t\t\t\t\t\t\t// is nothing left to process\n\t\t\t\t\t\t\treturn `\\\\\\\\${firstPart}\\\\${path.slice(last)}\\\\`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (j !== last) {\n\t\t\t\t\t\t\t// We matched a UNC root with leftovers\n\t\t\t\t\t\t\tdevice = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\n\t\t\t\t\t\t\trootEnd = j;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trootEnd = 1;\n\t\t\t}\n\t\t} else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n\t\t\t// Possible device root\n\t\t\tdevice = path.slice(0, 2);\n\t\t\trootEnd = 2;\n\t\t\tif (len > 2 && isPathSeparator(path.charCodeAt(2))) {\n\t\t\t\t// Treat separator following drive name as an absolute path\n\t\t\t\t// indicator\n\t\t\t\tisAbsolute = true;\n\t\t\t\trootEnd = 3;\n\t\t\t}\n\t\t}\n\n\t\tlet tail = rootEnd < len ?\n\t\t\tnormalizeString(path.slice(rootEnd), !isAbsolute, '\\\\', isPathSeparator) :\n\t\t\t'';\n\t\tif (tail.length === 0 && !isAbsolute) {\n\t\t\ttail = '.';\n\t\t}\n\t\tif (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {\n\t\t\ttail += '\\\\';\n\t\t}\n\t\tif (!isAbsolute && device === undefined && path.includes(':')) {\n\t\t\t// If the original path was not absolute and if we have not been able to\n\t\t\t// resolve it relative to a particular device, we need to ensure that the\n\t\t\t// `tail` has not become something that Windows might interpret as an\n\t\t\t// absolute path. See CVE-2024-36139.\n\t\t\tif (tail.length >= 2 &&\n\t\t\t\tisWindowsDeviceRoot(tail.charCodeAt(0)) &&\n\t\t\t\ttail.charCodeAt(1) === CHAR_COLON) {\n\t\t\t\treturn `.\\\\${tail}`;\n\t\t\t}\n\t\t\tlet index = path.indexOf(':');\n\t\t\tdo {\n\t\t\t\tif (index === len - 1 || isPathSeparator(path.charCodeAt(index + 1))) {\n\t\t\t\t\treturn `.\\\\${tail}`;\n\t\t\t\t}\n\t\t\t} while ((index = path.indexOf(':', index + 1)) !== -1);\n\t\t}\n\t\tif (device === undefined) {\n\t\t\treturn isAbsolute ? `\\\\${tail}` : tail;\n\t\t}\n\t\treturn isAbsolute ? `${device}\\\\${tail}` : `${device}${tail}`;\n\t},\n\n\tisAbsolute(path: string): boolean {\n\t\tvalidateString(path, 'path');\n\t\tconst len = path.length;\n\t\tif (len === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst code = path.charCodeAt(0);\n\t\treturn isPathSeparator(code) ||\n\t\t\t// Possible device root\n\t\t\t(len > 2 &&\n\t\t\t\tisWindowsDeviceRoot(code) &&\n\t\t\t\tpath.charCodeAt(1) === CHAR_COLON &&\n\t\t\t\tisPathSeparator(path.charCodeAt(2)));\n\t},\n\n\tjoin(...paths: string[]): string {\n\t\tif (paths.length === 0) {\n\t\t\treturn '.';\n\t\t}\n\n\t\tlet joined;\n\t\tlet firstPart: string | undefined;\n\t\tfor (let i = 0; i < paths.length; ++i) {\n\t\t\tconst arg = paths[i];\n\t\t\tvalidateString(arg, 'path');\n\t\t\tif (arg.length > 0) {\n\t\t\t\tif (joined === undefined) {\n\t\t\t\t\tjoined = firstPart = arg;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tjoined += `\\\\${arg}`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (joined === undefined) {\n\t\t\treturn '.';\n\t\t}\n\n\t\t// Make sure that the joined path doesn't start with two slashes, because\n\t\t// normalize() will mistake it for a UNC path then.\n\t\t//\n\t\t// This step is skipped when it is very clear that the user actually\n\t\t// intended to point at a UNC path. This is assumed when the first\n\t\t// non-empty string arguments starts with exactly two slashes followed by\n\t\t// at least one more non-slash character.\n\t\t//\n\t\t// Note that for normalize() to treat a path as a UNC path it needs to\n\t\t// have at least 2 components, so we don't filter for that here.\n\t\t// This means that the user can use join to construct UNC paths from\n\t\t// a server name and a share name; for example:\n\t\t//   path.join('//server', 'share') -> '\\\\\\\\server\\\\share\\\\')\n\t\tlet needsReplace = true;\n\t\tlet slashCount = 0;\n\t\tif (typeof firstPart === 'string' && isPathSeparator(firstPart.charCodeAt(0))) {\n\t\t\t++slashCount;\n\t\t\tconst firstLen = firstPart.length;\n\t\t\tif (firstLen > 1 && isPathSeparator(firstPart.charCodeAt(1))) {\n\t\t\t\t++slashCount;\n\t\t\t\tif (firstLen > 2) {\n\t\t\t\t\tif (isPathSeparator(firstPart.charCodeAt(2))) {\n\t\t\t\t\t\t++slashCount;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// We matched a UNC path in the first part\n\t\t\t\t\t\tneedsReplace = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (needsReplace) {\n\t\t\t// Find any more consecutive slashes we need to replace\n\t\t\twhile (slashCount < joined.length &&\n\t\t\t\tisPathSeparator(joined.charCodeAt(slashCount))) {\n\t\t\t\tslashCount++;\n\t\t\t}\n\n\t\t\t// Replace the slashes if needed\n\t\t\tif (slashCount >= 2) {\n\t\t\t\tjoined = `\\\\${joined.slice(slashCount)}`;\n\t\t\t}\n\t\t}\n\n\t\treturn win32.normalize(joined);\n\t},\n\n\n\t// It will solve the relative path from `from` to `to`, for instance:\n\t//  from = 'C:\\\\orandea\\\\test\\\\aaa'\n\t//  to = 'C:\\\\orandea\\\\impl\\\\bbb'\n\t// The output of the function should be: '..\\\\..\\\\impl\\\\bbb'\n\trelative(from: string, to: string): string {\n\t\tvalidateString(from, 'from');\n\t\tvalidateString(to, 'to');\n\n\t\tif (from === to) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst fromOrig = win32.resolve(from);\n\t\tconst toOrig = win32.resolve(to);\n\n\t\tif (fromOrig === toOrig) {\n\t\t\treturn '';\n\t\t}\n\n\t\tfrom = fromOrig.toLowerCase();\n\t\tto = toOrig.toLowerCase();\n\n\t\tif (from === to) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (fromOrig.length !== from.length || toOrig.length !== to.length) {\n\t\t\tconst fromSplit = fromOrig.split('\\\\');\n\t\t\tconst toSplit = toOrig.split('\\\\');\n\t\t\tif (fromSplit[fromSplit.length - 1] === '') {\n\t\t\t\tfromSplit.pop();\n\t\t\t}\n\t\t\tif (toSplit[toSplit.length - 1] === '') {\n\t\t\t\ttoSplit.pop();\n\t\t\t}\n\n\t\t\tconst fromLen = fromSplit.length;\n\t\t\tconst toLen = toSplit.length;\n\t\t\tconst length = fromLen < toLen ? fromLen : toLen;\n\n\t\t\tlet i;\n\t\t\tfor (i = 0; i < length; i++) {\n\t\t\t\tif (fromSplit[i].toLowerCase() !== toSplit[i].toLowerCase()) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i === 0) {\n\t\t\t\treturn toOrig;\n\t\t\t} else if (i === length) {\n\t\t\t\tif (toLen > length) {\n\t\t\t\t\treturn toSplit.slice(i).join('\\\\');\n\t\t\t\t}\n\t\t\t\tif (fromLen > length) {\n\t\t\t\t\treturn '..\\\\'.repeat(fromLen - 1 - i) + '..';\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\treturn '..\\\\'.repeat(fromLen - i) + toSplit.slice(i).join('\\\\');\n\t\t}\n\n\t\t// Trim any leading backslashes\n\t\tlet fromStart = 0;\n\t\twhile (fromStart < from.length &&\n\t\t\tfrom.charCodeAt(fromStart) === CHAR_BACKWARD_SLASH) {\n\t\t\tfromStart++;\n\t\t}\n\t\t// Trim trailing backslashes (applicable to UNC paths only)\n\t\tlet fromEnd = from.length;\n\t\twhile (fromEnd - 1 > fromStart &&\n\t\t\tfrom.charCodeAt(fromEnd - 1) === CHAR_BACKWARD_SLASH) {\n\t\t\tfromEnd--;\n\t\t}\n\t\tconst fromLen = fromEnd - fromStart;\n\n\t\t// Trim any leading backslashes\n\t\tlet toStart = 0;\n\t\twhile (toStart < to.length &&\n\t\t\tto.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\n\t\t\ttoStart++;\n\t\t}\n\t\t// Trim trailing backslashes (applicable to UNC paths only)\n\t\tlet toEnd = to.length;\n\t\twhile (toEnd - 1 > toStart &&\n\t\t\tto.charCodeAt(toEnd - 1) === CHAR_BACKWARD_SLASH) {\n\t\t\ttoEnd--;\n\t\t}\n\t\tconst toLen = toEnd - toStart;\n\n\t\t// Compare paths to find the longest common path from root\n\t\tconst length = fromLen < toLen ? fromLen : toLen;\n\t\tlet lastCommonSep = -1;\n\t\tlet i = 0;\n\t\tfor (; i < length; i++) {\n\t\t\tconst fromCode = from.charCodeAt(fromStart + i);\n\t\t\tif (fromCode !== to.charCodeAt(toStart + i)) {\n\t\t\t\tbreak;\n\t\t\t} else if (fromCode === CHAR_BACKWARD_SLASH) {\n\t\t\t\tlastCommonSep = i;\n\t\t\t}\n\t\t}\n\n\t\t// We found a mismatch before the first common path separator was seen, so\n\t\t// return the original `to`.\n\t\tif (i !== length) {\n\t\t\tif (lastCommonSep === -1) {\n\t\t\t\treturn toOrig;\n\t\t\t}\n\t\t} else {\n\t\t\tif (toLen > length) {\n\t\t\t\tif (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {\n\t\t\t\t\t// We get here if `from` is the exact base path for `to`.\n\t\t\t\t\t// For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo\\\\bar\\\\baz'\n\t\t\t\t\treturn toOrig.slice(toStart + i + 1);\n\t\t\t\t}\n\t\t\t\tif (i === 2) {\n\t\t\t\t\t// We get here if `from` is the device root.\n\t\t\t\t\t// For example: from='C:\\\\'; to='C:\\\\foo'\n\t\t\t\t\treturn toOrig.slice(toStart + i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (fromLen > length) {\n\t\t\t\tif (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {\n\t\t\t\t\t// We get here if `to` is the exact base path for `from`.\n\t\t\t\t\t// For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo'\n\t\t\t\t\tlastCommonSep = i;\n\t\t\t\t} else if (i === 2) {\n\t\t\t\t\t// We get here if `to` is the device root.\n\t\t\t\t\t// For example: from='C:\\\\foo\\\\bar'; to='C:\\\\'\n\t\t\t\t\tlastCommonSep = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (lastCommonSep === -1) {\n\t\t\t\tlastCommonSep = 0;\n\t\t\t}\n\t\t}\n\n\t\tlet out = '';\n\t\t// Generate the relative path based on the path difference between `to` and\n\t\t// `from`\n\t\tfor (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n\t\t\tif (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {\n\t\t\t\tout += out.length === 0 ? '..' : '\\\\..';\n\t\t\t}\n\t\t}\n\n\t\ttoStart += lastCommonSep;\n\n\t\t// Lastly, append the rest of the destination (`to`) path that comes after\n\t\t// the common path parts\n\t\tif (out.length > 0) {\n\t\t\treturn `${out}${toOrig.slice(toStart, toEnd)}`;\n\t\t}\n\n\t\tif (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\n\t\t\t++toStart;\n\t\t}\n\n\t\treturn toOrig.slice(toStart, toEnd);\n\t},\n\n\ttoNamespacedPath(path: string): string {\n\t\t// Note: this will *probably* throw somewhere.\n\t\tif (typeof path !== 'string' || path.length === 0) {\n\t\t\treturn path;\n\t\t}\n\n\t\tconst resolvedPath = win32.resolve(path);\n\n\t\tif (resolvedPath.length <= 2) {\n\t\t\treturn path;\n\t\t}\n\n\t\tif (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {\n\t\t\t// Possible UNC root\n\t\t\tif (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {\n\t\t\t\tconst code = resolvedPath.charCodeAt(2);\n\t\t\t\tif (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {\n\t\t\t\t\t// Matched non-long UNC root, convert the path to a long UNC path\n\t\t\t\t\treturn `\\\\\\\\?\\\\UNC\\\\${resolvedPath.slice(2)}`;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) &&\n\t\t\tresolvedPath.charCodeAt(1) === CHAR_COLON &&\n\t\t\tresolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {\n\t\t\t// Matched device root, convert the path to a long UNC path\n\t\t\treturn `\\\\\\\\?\\\\${resolvedPath}`;\n\t\t}\n\n\t\treturn resolvedPath;\n\t},\n\n\tdirname(path: string): string {\n\t\tvalidateString(path, 'path');\n\t\tconst len = path.length;\n\t\tif (len === 0) {\n\t\t\treturn '.';\n\t\t}\n\t\tlet rootEnd = -1;\n\t\tlet offset = 0;\n\t\tconst code = path.charCodeAt(0);\n\n\t\tif (len === 1) {\n\t\t\t// `path` contains just a path separator, exit early to avoid\n\t\t\t// unnecessary work or a dot.\n\t\t\treturn isPathSeparator(code) ? path : '.';\n\t\t}\n\n\t\t// Try to match a root\n\t\tif (isPathSeparator(code)) {\n\t\t\t// Possible UNC root\n\n\t\t\trootEnd = offset = 1;\n\n\t\t\tif (isPathSeparator(path.charCodeAt(1))) {\n\t\t\t\t// Matched double path separator at beginning\n\t\t\t\tlet j = 2;\n\t\t\t\tlet last = j;\n\t\t\t\t// Match 1 or more non-path separators\n\t\t\t\twhile (j < len && !isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tif (j < len && j !== last) {\n\t\t\t\t\t// Matched!\n\t\t\t\t\tlast = j;\n\t\t\t\t\t// Match 1 or more path separators\n\t\t\t\t\twhile (j < len && isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\t\t\t\tif (j < len && j !== last) {\n\t\t\t\t\t\t// Matched!\n\t\t\t\t\t\tlast = j;\n\t\t\t\t\t\t// Match 1 or more non-path separators\n\t\t\t\t\t\twhile (j < len && !isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (j === len) {\n\t\t\t\t\t\t\t// We matched a UNC root only\n\t\t\t\t\t\t\treturn path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (j !== last) {\n\t\t\t\t\t\t\t// We matched a UNC root with leftovers\n\n\t\t\t\t\t\t\t// Offset by 1 to include the separator after the UNC root to\n\t\t\t\t\t\t\t// treat it as a \"normal root\" on top of a (UNC) root\n\t\t\t\t\t\t\trootEnd = offset = j + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Possible device root\n\t\t} else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n\t\t\trootEnd = len > 2 && isPathSeparator(path.charCodeAt(2)) ? 3 : 2;\n\t\t\toffset = rootEnd;\n\t\t}\n\n\t\tlet end = -1;\n\t\tlet matchedSlash = true;\n\t\tfor (let i = len - 1; i >= offset; --i) {\n\t\t\tif (isPathSeparator(path.charCodeAt(i))) {\n\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\tend = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We saw the first non-path separator\n\t\t\t\tmatchedSlash = false;\n\t\t\t}\n\t\t}\n\n\t\tif (end === -1) {\n\t\t\tif (rootEnd === -1) {\n\t\t\t\treturn '.';\n\t\t\t}\n\n\t\t\tend = rootEnd;\n\t\t}\n\t\treturn path.slice(0, end);\n\t},\n\n\tbasename(path: string, suffix?: string): string {\n\t\tif (suffix !== undefined) {\n\t\t\tvalidateString(suffix, 'suffix');\n\t\t}\n\t\tvalidateString(path, 'path');\n\t\tlet start = 0;\n\t\tlet end = -1;\n\t\tlet matchedSlash = true;\n\t\tlet i;\n\n\t\t// Check for a drive letter prefix so as not to mistake the following\n\t\t// path separator as an extra separator at the end of the path that can be\n\t\t// disregarded\n\t\tif (path.length >= 2 &&\n\t\t\tisWindowsDeviceRoot(path.charCodeAt(0)) &&\n\t\t\tpath.charCodeAt(1) === CHAR_COLON) {\n\t\t\tstart = 2;\n\t\t}\n\n\t\tif (suffix !== undefined && suffix.length > 0 && suffix.length <= path.length) {\n\t\t\tif (suffix === path) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t\tlet extIdx = suffix.length - 1;\n\t\t\tlet firstNonSlashEnd = -1;\n\t\t\tfor (i = path.length - 1; i >= start; --i) {\n\t\t\t\tconst code = path.charCodeAt(i);\n\t\t\t\tif (isPathSeparator(code)) {\n\t\t\t\t\t// If we reached a path separator that was not part of a set of path\n\t\t\t\t\t// separators at the end of the string, stop now\n\t\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\t\tstart = i + 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (firstNonSlashEnd === -1) {\n\t\t\t\t\t\t// We saw the first non-path separator, remember this index in case\n\t\t\t\t\t\t// we need it if the extension ends up not matching\n\t\t\t\t\t\tmatchedSlash = false;\n\t\t\t\t\t\tfirstNonSlashEnd = i + 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (extIdx >= 0) {\n\t\t\t\t\t\t// Try to match the explicit extension\n\t\t\t\t\t\tif (code === suffix.charCodeAt(extIdx)) {\n\t\t\t\t\t\t\tif (--extIdx === -1) {\n\t\t\t\t\t\t\t\t// We matched the extension, so mark this as the end of our path\n\t\t\t\t\t\t\t\t// component\n\t\t\t\t\t\t\t\tend = i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Extension does not match, so our result is the entire path\n\t\t\t\t\t\t\t// component\n\t\t\t\t\t\t\textIdx = -1;\n\t\t\t\t\t\t\tend = firstNonSlashEnd;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (start === end) {\n\t\t\t\tend = firstNonSlashEnd;\n\t\t\t} else if (end === -1) {\n\t\t\t\tend = path.length;\n\t\t\t}\n\t\t\treturn path.slice(start, end);\n\t\t}\n\t\tfor (i = path.length - 1; i >= start; --i) {\n\t\t\tif (isPathSeparator(path.charCodeAt(i))) {\n\t\t\t\t// If we reached a path separator that was not part of a set of path\n\t\t\t\t// separators at the end of the string, stop now\n\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\tstart = i + 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (end === -1) {\n\t\t\t\t// We saw the first non-path separator, mark this as the end of our\n\t\t\t\t// path component\n\t\t\t\tmatchedSlash = false;\n\t\t\t\tend = i + 1;\n\t\t\t}\n\t\t}\n\n\t\tif (end === -1) {\n\t\t\treturn '';\n\t\t}\n\t\treturn path.slice(start, end);\n\t},\n\n\textname(path: string): string {\n\t\tvalidateString(path, 'path');\n\t\tlet start = 0;\n\t\tlet startDot = -1;\n\t\tlet startPart = 0;\n\t\tlet end = -1;\n\t\tlet matchedSlash = true;\n\t\t// Track the state of characters (if any) we see before our first dot and\n\t\t// after any path separator we find\n\t\tlet preDotState = 0;\n\n\t\t// Check for a drive letter prefix so as not to mistake the following\n\t\t// path separator as an extra separator at the end of the path that can be\n\t\t// disregarded\n\n\t\tif (path.length >= 2 &&\n\t\t\tpath.charCodeAt(1) === CHAR_COLON &&\n\t\t\tisWindowsDeviceRoot(path.charCodeAt(0))) {\n\t\t\tstart = startPart = 2;\n\t\t}\n\n\t\tfor (let i = path.length - 1; i >= start; --i) {\n\t\t\tconst code = path.charCodeAt(i);\n\t\t\tif (isPathSeparator(code)) {\n\t\t\t\t// If we reached a path separator that was not part of a set of path\n\t\t\t\t// separators at the end of the string, stop now\n\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\tstartPart = i + 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (end === -1) {\n\t\t\t\t// We saw the first non-path separator, mark this as the end of our\n\t\t\t\t// extension\n\t\t\t\tmatchedSlash = false;\n\t\t\t\tend = i + 1;\n\t\t\t}\n\t\t\tif (code === CHAR_DOT) {\n\t\t\t\t// If this is our first dot, mark it as the start of our extension\n\t\t\t\tif (startDot === -1) {\n\t\t\t\t\tstartDot = i;\n\t\t\t\t}\n\t\t\t\telse if (preDotState !== 1) {\n\t\t\t\t\tpreDotState = 1;\n\t\t\t\t}\n\t\t\t} else if (startDot !== -1) {\n\t\t\t\t// We saw a non-dot and non-path separator before our dot, so we should\n\t\t\t\t// have a good chance at having a non-empty extension\n\t\t\t\tpreDotState = -1;\n\t\t\t}\n\t\t}\n\n\t\tif (startDot === -1 ||\n\t\t\tend === -1 ||\n\t\t\t// We saw a non-dot character immediately before the dot\n\t\t\tpreDotState === 0 ||\n\t\t\t// The (right-most) trimmed path component is exactly '..'\n\t\t\t(preDotState === 1 &&\n\t\t\t\tstartDot === end - 1 &&\n\t\t\t\tstartDot === startPart + 1)) {\n\t\t\treturn '';\n\t\t}\n\t\treturn path.slice(startDot, end);\n\t},\n\n\tformat: _format.bind(null, '\\\\'),\n\n\tparse(path) {\n\t\tvalidateString(path, 'path');\n\n\t\tconst ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\t\tif (path.length === 0) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tconst len = path.length;\n\t\tlet rootEnd = 0;\n\t\tlet code = path.charCodeAt(0);\n\n\t\tif (len === 1) {\n\t\t\tif (isPathSeparator(code)) {\n\t\t\t\t// `path` contains just a path separator, exit early to avoid\n\t\t\t\t// unnecessary work\n\t\t\t\tret.root = ret.dir = path;\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t\tret.base = ret.name = path;\n\t\t\treturn ret;\n\t\t}\n\t\t// Try to match a root\n\t\tif (isPathSeparator(code)) {\n\t\t\t// Possible UNC root\n\n\t\t\trootEnd = 1;\n\t\t\tif (isPathSeparator(path.charCodeAt(1))) {\n\t\t\t\t// Matched double path separator at beginning\n\t\t\t\tlet j = 2;\n\t\t\t\tlet last = j;\n\t\t\t\t// Match 1 or more non-path separators\n\t\t\t\twhile (j < len && !isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tif (j < len && j !== last) {\n\t\t\t\t\t// Matched!\n\t\t\t\t\tlast = j;\n\t\t\t\t\t// Match 1 or more path separators\n\t\t\t\t\twhile (j < len && isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\t\t\t\tif (j < len && j !== last) {\n\t\t\t\t\t\t// Matched!\n\t\t\t\t\t\tlast = j;\n\t\t\t\t\t\t// Match 1 or more non-path separators\n\t\t\t\t\t\twhile (j < len && !isPathSeparator(path.charCodeAt(j))) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (j === len) {\n\t\t\t\t\t\t\t// We matched a UNC root only\n\t\t\t\t\t\t\trootEnd = j;\n\t\t\t\t\t\t} else if (j !== last) {\n\t\t\t\t\t\t\t// We matched a UNC root with leftovers\n\t\t\t\t\t\t\trootEnd = j + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n\t\t\t// Possible device root\n\t\t\tif (len <= 2) {\n\t\t\t\t// `path` contains just a drive root, exit early to avoid\n\t\t\t\t// unnecessary work\n\t\t\t\tret.root = ret.dir = path;\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t\trootEnd = 2;\n\t\t\tif (isPathSeparator(path.charCodeAt(2))) {\n\t\t\t\tif (len === 3) {\n\t\t\t\t\t// `path` contains just a drive root, exit early to avoid\n\t\t\t\t\t// unnecessary work\n\t\t\t\t\tret.root = ret.dir = path;\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\t\t\trootEnd = 3;\n\t\t\t}\n\t\t}\n\t\tif (rootEnd > 0) {\n\t\t\tret.root = path.slice(0, rootEnd);\n\t\t}\n\n\t\tlet startDot = -1;\n\t\tlet startPart = rootEnd;\n\t\tlet end = -1;\n\t\tlet matchedSlash = true;\n\t\tlet i = path.length - 1;\n\n\t\t// Track the state of characters (if any) we see before our first dot and\n\t\t// after any path separator we find\n\t\tlet preDotState = 0;\n\n\t\t// Get non-dir info\n\t\tfor (; i >= rootEnd; --i) {\n\t\t\tcode = path.charCodeAt(i);\n\t\t\tif (isPathSeparator(code)) {\n\t\t\t\t// If we reached a path separator that was not part of a set of path\n\t\t\t\t// separators at the end of the string, stop now\n\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\tstartPart = i + 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (end === -1) {\n\t\t\t\t// We saw the first non-path separator, mark this as the end of our\n\t\t\t\t// extension\n\t\t\t\tmatchedSlash = false;\n\t\t\t\tend = i + 1;\n\t\t\t}\n\t\t\tif (code === CHAR_DOT) {\n\t\t\t\t// If this is our first dot, mark it as the start of our extension\n\t\t\t\tif (startDot === -1) {\n\t\t\t\t\tstartDot = i;\n\t\t\t\t} else if (preDotState !== 1) {\n\t\t\t\t\tpreDotState = 1;\n\t\t\t\t}\n\t\t\t} else if (startDot !== -1) {\n\t\t\t\t// We saw a non-dot and non-path separator before our dot, so we should\n\t\t\t\t// have a good chance at having a non-empty extension\n\t\t\t\tpreDotState = -1;\n\t\t\t}\n\t\t}\n\n\t\tif (end !== -1) {\n\t\t\tif (startDot === -1 ||\n\t\t\t\t// We saw a non-dot character immediately before the dot\n\t\t\t\tpreDotState === 0 ||\n\t\t\t\t// The (right-most) trimmed path component is exactly '..'\n\t\t\t\t(preDotState === 1 &&\n\t\t\t\t\tstartDot === end - 1 &&\n\t\t\t\t\tstartDot === startPart + 1)) {\n\t\t\t\tret.base = ret.name = path.slice(startPart, end);\n\t\t\t} else {\n\t\t\t\tret.name = path.slice(startPart, startDot);\n\t\t\t\tret.base = path.slice(startPart, end);\n\t\t\t\tret.ext = path.slice(startDot, end);\n\t\t\t}\n\t\t}\n\n\t\t// If the directory is the root, use the entire root as the `dir` including\n\t\t// the trailing slash if any (`C:\\abc` -> `C:\\`). Otherwise, strip out the\n\t\t// trailing slash (`C:\\abc\\def` -> `C:\\abc`).\n\t\tif (startPart > 0 && startPart !== rootEnd) {\n\t\t\tret.dir = path.slice(0, startPart - 1);\n\t\t} else {\n\t\t\tret.dir = ret.root;\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tsep: '\\\\',\n\tdelimiter: ';',\n\twin32: null,\n\tposix: null\n};\n\nconst posixCwd = (() => {\n\tif (platformIsWin32) {\n\t\t// Converts Windows' backslash path separators to POSIX forward slashes\n\t\t// and truncates any drive indicator\n\t\tconst regexp = /\\\\/g;\n\t\treturn () => {\n\t\t\tconst cwd = process.cwd().replace(regexp, '/');\n\t\t\treturn cwd.slice(cwd.indexOf('/'));\n\t\t};\n\t}\n\n\t// We're already on POSIX, no need for any transformations\n\treturn () => process.cwd();\n})();\n\nexport const posix: IPath = {\n\t// path.resolve([from ...], to)\n\tresolve(...pathSegments: string[]): string {\n\t\tlet resolvedPath = '';\n\t\tlet resolvedAbsolute = false;\n\n\t\tfor (let i = pathSegments.length - 1; i >= 0 && !resolvedAbsolute; i--) {\n\t\t\tconst path = pathSegments[i];\n\t\t\tvalidateString(path, `paths[${i}]`);\n\n\t\t\t// Skip empty entries\n\t\t\tif (path.length === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tresolvedPath = `${path}/${resolvedPath}`;\n\t\t\tresolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n\t\t}\n\n\t\tif (!resolvedAbsolute) {\n\t\t\tconst cwd = posixCwd();\n\t\t\tresolvedPath = `${cwd}/${resolvedPath}`;\n\t\t\tresolvedAbsolute =\n\t\t\t\tcwd.charCodeAt(0) === CHAR_FORWARD_SLASH;\n\t\t}\n\n\t\t// At this point the path should be resolved to a full absolute path, but\n\t\t// handle relative paths to be safe (might happen when process.cwd() fails)\n\n\t\t// Normalize the path\n\t\tresolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, '/',\n\t\t\tisPosixPathSeparator);\n\n\t\tif (resolvedAbsolute) {\n\t\t\treturn `/${resolvedPath}`;\n\t\t}\n\t\treturn resolvedPath.length > 0 ? resolvedPath : '.';\n\t},\n\n\tnormalize(path: string): string {\n\t\tvalidateString(path, 'path');\n\n\t\tif (path.length === 0) {\n\t\t\treturn '.';\n\t\t}\n\n\t\tconst isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n\t\tconst trailingSeparator =\n\t\t\tpath.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH;\n\n\t\t// Normalize the path\n\t\tpath = normalizeString(path, !isAbsolute, '/', isPosixPathSeparator);\n\n\t\tif (path.length === 0) {\n\t\t\tif (isAbsolute) {\n\t\t\t\treturn '/';\n\t\t\t}\n\t\t\treturn trailingSeparator ? './' : '.';\n\t\t}\n\t\tif (trailingSeparator) {\n\t\t\tpath += '/';\n\t\t}\n\n\t\treturn isAbsolute ? `/${path}` : path;\n\t},\n\n\tisAbsolute(path: string): boolean {\n\t\tvalidateString(path, 'path');\n\t\treturn path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n\t},\n\n\tjoin(...paths: string[]): string {\n\t\tif (paths.length === 0) {\n\t\t\treturn '.';\n\t\t}\n\n\t\tconst path = [];\n\t\tfor (let i = 0; i < paths.length; ++i) {\n\t\t\tconst arg = paths[i];\n\t\t\tvalidateString(arg, 'path');\n\t\t\tif (arg.length > 0) {\n\t\t\t\tpath.push(arg);\n\t\t\t}\n\t\t}\n\n\t\tif (path.length === 0) {\n\t\t\treturn '.';\n\t\t}\n\n\t\treturn posix.normalize(path.join('/'));\n\t},\n\n\trelative(from: string, to: string): string {\n\t\tvalidateString(from, 'from');\n\t\tvalidateString(to, 'to');\n\n\t\tif (from === to) {\n\t\t\treturn '';\n\t\t}\n\n\t\t// Trim leading forward slashes.\n\t\tfrom = posix.resolve(from);\n\t\tto = posix.resolve(to);\n\n\t\tif (from === to) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst fromStart = 1;\n\t\tconst fromEnd = from.length;\n\t\tconst fromLen = fromEnd - fromStart;\n\t\tconst toStart = 1;\n\t\tconst toLen = to.length - toStart;\n\n\t\t// Compare paths to find the longest common path from root\n\t\tconst length = (fromLen < toLen ? fromLen : toLen);\n\t\tlet lastCommonSep = -1;\n\t\tlet i = 0;\n\t\tfor (; i < length; i++) {\n\t\t\tconst fromCode = from.charCodeAt(fromStart + i);\n\t\t\tif (fromCode !== to.charCodeAt(toStart + i)) {\n\t\t\t\tbreak;\n\t\t\t} else if (fromCode === CHAR_FORWARD_SLASH) {\n\t\t\t\tlastCommonSep = i;\n\t\t\t}\n\t\t}\n\t\tif (i === length) {\n\t\t\tif (toLen > length) {\n\t\t\t\tif (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {\n\t\t\t\t\t// We get here if `from` is the exact base path for `to`.\n\t\t\t\t\t// For example: from='/foo/bar'; to='/foo/bar/baz'\n\t\t\t\t\treturn to.slice(toStart + i + 1);\n\t\t\t\t}\n\t\t\t\tif (i === 0) {\n\t\t\t\t\t// We get here if `from` is the root\n\t\t\t\t\t// For example: from='/'; to='/foo'\n\t\t\t\t\treturn to.slice(toStart + i);\n\t\t\t\t}\n\t\t\t} else if (fromLen > length) {\n\t\t\t\tif (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {\n\t\t\t\t\t// We get here if `to` is the exact base path for `from`.\n\t\t\t\t\t// For example: from='/foo/bar/baz'; to='/foo/bar'\n\t\t\t\t\tlastCommonSep = i;\n\t\t\t\t} else if (i === 0) {\n\t\t\t\t\t// We get here if `to` is the root.\n\t\t\t\t\t// For example: from='/foo/bar'; to='/'\n\t\t\t\t\tlastCommonSep = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet out = '';\n\t\t// Generate the relative path based on the path difference between `to`\n\t\t// and `from`.\n\t\tfor (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n\t\t\tif (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n\t\t\t\tout += out.length === 0 ? '..' : '/..';\n\t\t\t}\n\t\t}\n\n\t\t// Lastly, append the rest of the destination (`to`) path that comes after\n\t\t// the common path parts.\n\t\treturn `${out}${to.slice(toStart + lastCommonSep)}`;\n\t},\n\n\ttoNamespacedPath(path: string): string {\n\t\t// Non-op on posix systems\n\t\treturn path;\n\t},\n\n\tdirname(path: string): string {\n\t\tvalidateString(path, 'path');\n\t\tif (path.length === 0) {\n\t\t\treturn '.';\n\t\t}\n\t\tconst hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n\t\tlet end = -1;\n\t\tlet matchedSlash = true;\n\t\tfor (let i = path.length - 1; i >= 1; --i) {\n\t\t\tif (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\tend = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We saw the first non-path separator\n\t\t\t\tmatchedSlash = false;\n\t\t\t}\n\t\t}\n\n\t\tif (end === -1) {\n\t\t\treturn hasRoot ? '/' : '.';\n\t\t}\n\t\tif (hasRoot && end === 1) {\n\t\t\treturn '//';\n\t\t}\n\t\treturn path.slice(0, end);\n\t},\n\n\tbasename(path: string, suffix?: string): string {\n\t\tif (suffix !== undefined) {\n\t\t\tvalidateString(suffix, 'suffix');\n\t\t}\n\t\tvalidateString(path, 'path');\n\n\t\tlet start = 0;\n\t\tlet end = -1;\n\t\tlet matchedSlash = true;\n\t\tlet i;\n\n\t\tif (suffix !== undefined && suffix.length > 0 && suffix.length <= path.length) {\n\t\t\tif (suffix === path) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t\tlet extIdx = suffix.length - 1;\n\t\t\tlet firstNonSlashEnd = -1;\n\t\t\tfor (i = path.length - 1; i >= 0; --i) {\n\t\t\t\tconst code = path.charCodeAt(i);\n\t\t\t\tif (code === CHAR_FORWARD_SLASH) {\n\t\t\t\t\t// If we reached a path separator that was not part of a set of path\n\t\t\t\t\t// separators at the end of the string, stop now\n\t\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\t\tstart = i + 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (firstNonSlashEnd === -1) {\n\t\t\t\t\t\t// We saw the first non-path separator, remember this index in case\n\t\t\t\t\t\t// we need it if the extension ends up not matching\n\t\t\t\t\t\tmatchedSlash = false;\n\t\t\t\t\t\tfirstNonSlashEnd = i + 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (extIdx >= 0) {\n\t\t\t\t\t\t// Try to match the explicit extension\n\t\t\t\t\t\tif (code === suffix.charCodeAt(extIdx)) {\n\t\t\t\t\t\t\tif (--extIdx === -1) {\n\t\t\t\t\t\t\t\t// We matched the extension, so mark this as the end of our path\n\t\t\t\t\t\t\t\t// component\n\t\t\t\t\t\t\t\tend = i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Extension does not match, so our result is the entire path\n\t\t\t\t\t\t\t// component\n\t\t\t\t\t\t\textIdx = -1;\n\t\t\t\t\t\t\tend = firstNonSlashEnd;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (start === end) {\n\t\t\t\tend = firstNonSlashEnd;\n\t\t\t} else if (end === -1) {\n\t\t\t\tend = path.length;\n\t\t\t}\n\t\t\treturn path.slice(start, end);\n\t\t}\n\t\tfor (i = path.length - 1; i >= 0; --i) {\n\t\t\tif (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n\t\t\t\t// If we reached a path separator that was not part of a set of path\n\t\t\t\t// separators at the end of the string, stop now\n\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\tstart = i + 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (end === -1) {\n\t\t\t\t// We saw the first non-path separator, mark this as the end of our\n\t\t\t\t// path component\n\t\t\t\tmatchedSlash = false;\n\t\t\t\tend = i + 1;\n\t\t\t}\n\t\t}\n\n\t\tif (end === -1) {\n\t\t\treturn '';\n\t\t}\n\t\treturn path.slice(start, end);\n\t},\n\n\textname(path: string): string {\n\t\tvalidateString(path, 'path');\n\t\tlet startDot = -1;\n\t\tlet startPart = 0;\n\t\tlet end = -1;\n\t\tlet matchedSlash = true;\n\t\t// Track the state of characters (if any) we see before our first dot and\n\t\t// after any path separator we find\n\t\tlet preDotState = 0;\n\t\tfor (let i = path.length - 1; i >= 0; --i) {\n\t\t\tconst char = path[i];\n\t\t\tif (char === '/') {\n\t\t\t\t// If we reached a path separator that was not part of a set of path\n\t\t\t\t// separators at the end of the string, stop now\n\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\tstartPart = i + 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (end === -1) {\n\t\t\t\t// We saw the first non-path separator, mark this as the end of our\n\t\t\t\t// extension\n\t\t\t\tmatchedSlash = false;\n\t\t\t\tend = i + 1;\n\t\t\t}\n\t\t\tif (char === '.') {\n\t\t\t\t// If this is our first dot, mark it as the start of our extension\n\t\t\t\tif (startDot === -1) {\n\t\t\t\t\tstartDot = i;\n\t\t\t\t}\n\t\t\t\telse if (preDotState !== 1) {\n\t\t\t\t\tpreDotState = 1;\n\t\t\t\t}\n\t\t\t} else if (startDot !== -1) {\n\t\t\t\t// We saw a non-dot and non-path separator before our dot, so we should\n\t\t\t\t// have a good chance at having a non-empty extension\n\t\t\t\tpreDotState = -1;\n\t\t\t}\n\t\t}\n\n\t\tif (startDot === -1 ||\n\t\t\tend === -1 ||\n\t\t\t// We saw a non-dot character immediately before the dot\n\t\t\tpreDotState === 0 ||\n\t\t\t// The (right-most) trimmed path component is exactly '..'\n\t\t\t(preDotState === 1 &&\n\t\t\t\tstartDot === end - 1 &&\n\t\t\t\tstartDot === startPart + 1)) {\n\t\t\treturn '';\n\t\t}\n\t\treturn path.slice(startDot, end);\n\t},\n\n\tformat: _format.bind(null, '/'),\n\n\tparse(path: string): ParsedPath {\n\t\tvalidateString(path, 'path');\n\n\t\tconst ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\t\tif (path.length === 0) {\n\t\t\treturn ret;\n\t\t}\n\t\tconst isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n\t\tlet start;\n\t\tif (isAbsolute) {\n\t\t\tret.root = '/';\n\t\t\tstart = 1;\n\t\t} else {\n\t\t\tstart = 0;\n\t\t}\n\t\tlet startDot = -1;\n\t\tlet startPart = 0;\n\t\tlet end = -1;\n\t\tlet matchedSlash = true;\n\t\tlet i = path.length - 1;\n\n\t\t// Track the state of characters (if any) we see before our first dot and\n\t\t// after any path separator we find\n\t\tlet preDotState = 0;\n\n\t\t// Get non-dir info\n\t\tfor (; i >= start; --i) {\n\t\t\tconst code = path.charCodeAt(i);\n\t\t\tif (code === CHAR_FORWARD_SLASH) {\n\t\t\t\t// If we reached a path separator that was not part of a set of path\n\t\t\t\t// separators at the end of the string, stop now\n\t\t\t\tif (!matchedSlash) {\n\t\t\t\t\tstartPart = i + 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (end === -1) {\n\t\t\t\t// We saw the first non-path separator, mark this as the end of our\n\t\t\t\t// extension\n\t\t\t\tmatchedSlash = false;\n\t\t\t\tend = i + 1;\n\t\t\t}\n\t\t\tif (code === CHAR_DOT) {\n\t\t\t\t// If this is our first dot, mark it as the start of our extension\n\t\t\t\tif (startDot === -1) {\n\t\t\t\t\tstartDot = i;\n\t\t\t\t} else if (preDotState !== 1) {\n\t\t\t\t\tpreDotState = 1;\n\t\t\t\t}\n\t\t\t} else if (startDot !== -1) {\n\t\t\t\t// We saw a non-dot and non-path separator before our dot, so we should\n\t\t\t\t// have a good chance at having a non-empty extension\n\t\t\t\tpreDotState = -1;\n\t\t\t}\n\t\t}\n\n\t\tif (end !== -1) {\n\t\t\tconst start = startPart === 0 && isAbsolute ? 1 : startPart;\n\t\t\tif (startDot === -1 ||\n\t\t\t\t// We saw a non-dot character immediately before the dot\n\t\t\t\tpreDotState === 0 ||\n\t\t\t\t// The (right-most) trimmed path component is exactly '..'\n\t\t\t\t(preDotState === 1 &&\n\t\t\t\t\tstartDot === end - 1 &&\n\t\t\t\t\tstartDot === startPart + 1)) {\n\t\t\t\tret.base = ret.name = path.slice(start, end);\n\t\t\t} else {\n\t\t\t\tret.name = path.slice(start, startDot);\n\t\t\t\tret.base = path.slice(start, end);\n\t\t\t\tret.ext = path.slice(startDot, end);\n\t\t\t}\n\t\t}\n\n\t\tif (startPart > 0) {\n\t\t\tret.dir = path.slice(0, startPart - 1);\n\t\t} else if (isAbsolute) {\n\t\t\tret.dir = '/';\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tsep: '/',\n\tdelimiter: ':',\n\twin32: null,\n\tposix: null\n};\n\nposix.win32 = win32.win32 = win32;\nposix.posix = win32.posix = posix;\n\nexport const normalize = (platformIsWin32 ? win32.normalize : posix.normalize);\nexport const isAbsolute = (platformIsWin32 ? win32.isAbsolute : posix.isAbsolute);\nexport const join = (platformIsWin32 ? win32.join : posix.join);\nexport const resolve = (platformIsWin32 ? win32.resolve : posix.resolve);\nexport const relative = (platformIsWin32 ? win32.relative : posix.relative);\nexport const dirname = (platformIsWin32 ? win32.dirname : posix.dirname);\nexport const basename = (platformIsWin32 ? win32.basename : posix.basename);\nexport const extname = (platformIsWin32 ? win32.extname : posix.extname);\nexport const format = (platformIsWin32 ? win32.format : posix.format);\nexport const parse = (platformIsWin32 ? win32.parse : posix.parse);\nexport const toNamespacedPath = (platformIsWin32 ? win32.toNamespacedPath : posix.toNamespacedPath);\nexport const sep = (platformIsWin32 ? win32.sep : posix.sep);\nexport const delimiter = (platformIsWin32 ? win32.delimiter : posix.delimiter);\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * An interface for a JavaScript object that\n * acts a dictionary. The keys are strings.\n */\nexport type IStringDictionary<V> = Record<string, V>;\n\n/**\n * An interface for a JavaScript object that\n * acts a dictionary. The keys are numbers.\n */\nexport type INumberDictionary<V> = Record<number, V>;\n\n/**\n * Groups the collection into a dictionary based on the provided\n * group function.\n */\nexport function groupBy<K extends string | number | symbol, V>(data: V[], groupFn: (element: V) => K): Record<K, V[]> {\n\tconst result: Record<K, V[]> = Object.create(null);\n\tfor (const element of data) {\n\t\tconst key = groupFn(element);\n\t\tlet target = result[key];\n\t\tif (!target) {\n\t\t\ttarget = result[key] = [];\n\t\t}\n\t\ttarget.push(element);\n\t}\n\treturn result;\n}\n\nexport function groupByMap<K, V>(data: V[], groupFn: (element: V) => K): Map<K, V[]> {\n\tconst result = new Map<K, V[]>();\n\tfor (const element of data) {\n\t\tconst key = groupFn(element);\n\t\tlet target = result.get(key);\n\t\tif (!target) {\n\t\t\ttarget = [];\n\t\t\tresult.set(key, target);\n\t\t}\n\t\ttarget.push(element);\n\t}\n\treturn result;\n}\n\nexport function diffSets<T>(before: ReadonlySet<T>, after: ReadonlySet<T>): { removed: T[]; added: T[] } {\n\tconst removed: T[] = [];\n\tconst added: T[] = [];\n\tfor (const element of before) {\n\t\tif (!after.has(element)) {\n\t\t\tremoved.push(element);\n\t\t}\n\t}\n\tfor (const element of after) {\n\t\tif (!before.has(element)) {\n\t\t\tadded.push(element);\n\t\t}\n\t}\n\treturn { removed, added };\n}\n\nexport function diffMaps<K, V>(before: Map<K, V>, after: Map<K, V>): { removed: V[]; added: V[] } {\n\tconst removed: V[] = [];\n\tconst added: V[] = [];\n\tfor (const [index, value] of before) {\n\t\tif (!after.has(index)) {\n\t\t\tremoved.push(value);\n\t\t}\n\t}\n\tfor (const [index, value] of after) {\n\t\tif (!before.has(index)) {\n\t\t\tadded.push(value);\n\t\t}\n\t}\n\treturn { removed, added };\n}\n\n/**\n * Computes the intersection of two sets.\n *\n * @param setA - The first set.\n * @param setB - The second iterable.\n * @returns A new set containing the elements that are in both `setA` and `setB`.\n */\nexport function intersection<T>(setA: Set<T>, setB: Iterable<T>): Set<T> {\n\tconst result = new Set<T>();\n\tfor (const elem of setB) {\n\t\tif (setA.has(elem)) {\n\t\t\tresult.add(elem);\n\t\t}\n\t}\n\treturn result;\n}\n\nexport class SetWithKey<T> implements Set<T> {\n\tprivate _map = new Map<any, T>();\n\n\tconstructor(values: T[], private toKey: (t: T) => unknown) {\n\t\tfor (const value of values) {\n\t\t\tthis.add(value);\n\t\t}\n\t}\n\n\tget size(): number {\n\t\treturn this._map.size;\n\t}\n\n\tadd(value: T): this {\n\t\tconst key = this.toKey(value);\n\t\tthis._map.set(key, value);\n\t\treturn this;\n\t}\n\n\tdelete(value: T): boolean {\n\t\treturn this._map.delete(this.toKey(value));\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this._map.has(this.toKey(value));\n\t}\n\n\t*entries(): IterableIterator<[T, T]> {\n\t\tfor (const entry of this._map.values()) {\n\t\t\tyield [entry, entry];\n\t\t}\n\t}\n\n\tkeys(): IterableIterator<T> {\n\t\treturn this.values();\n\t}\n\n\t*values(): IterableIterator<T> {\n\t\tfor (const entry of this._map.values()) {\n\t\t\tyield entry;\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._map.clear();\n\t}\n\n\tforEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void {\n\t\tthis._map.forEach(entry => callbackfn.call(thisArg, entry, entry, this));\n\t}\n\n\t[Symbol.iterator](): IterableIterator<T> {\n\t\treturn this.values();\n\t}\n\n\t[Symbol.toStringTag]: string = 'SetWithKey';\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport interface ErrorListenerCallback {\n\t(error: any): void;\n}\n\nexport interface ErrorListenerUnbind {\n\t(): void;\n}\n\n// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\nexport class ErrorHandler {\n\tprivate unexpectedErrorHandler: (e: any) => void;\n\tprivate listeners: ErrorListenerCallback[];\n\n\tconstructor() {\n\n\t\tthis.listeners = [];\n\n\t\tthis.unexpectedErrorHandler = function (e: any) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (e.stack) {\n\t\t\t\t\tif (ErrorNoTelemetry.isErrorNoTelemetry(e)) {\n\t\t\t\t\t\tthrow new ErrorNoTelemetry(e.message + '\\n\\n' + e.stack);\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error(e.message + '\\n\\n' + e.stack);\n\t\t\t\t}\n\n\t\t\t\tthrow e;\n\t\t\t}, 0);\n\t\t};\n\t}\n\n\taddListener(listener: ErrorListenerCallback): ErrorListenerUnbind {\n\t\tthis.listeners.push(listener);\n\n\t\treturn () => {\n\t\t\tthis._removeListener(listener);\n\t\t};\n\t}\n\n\tprivate emit(e: any): void {\n\t\tthis.listeners.forEach((listener) => {\n\t\t\tlistener(e);\n\t\t});\n\t}\n\n\tprivate _removeListener(listener: ErrorListenerCallback): void {\n\t\tthis.listeners.splice(this.listeners.indexOf(listener), 1);\n\t}\n\n\tsetUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void {\n\t\tthis.unexpectedErrorHandler = newUnexpectedErrorHandler;\n\t}\n\n\tgetUnexpectedErrorHandler(): (e: any) => void {\n\t\treturn this.unexpectedErrorHandler;\n\t}\n\n\tonUnexpectedError(e: any): void {\n\t\tthis.unexpectedErrorHandler(e);\n\t\tthis.emit(e);\n\t}\n\n\t// For external errors, we don't want the listeners to be called\n\tonUnexpectedExternalError(e: any): void {\n\t\tthis.unexpectedErrorHandler(e);\n\t}\n}\n\nexport const errorHandler = new ErrorHandler();\n\n/** @skipMangle */\nexport function setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void {\n\terrorHandler.setUnexpectedErrorHandler(newUnexpectedErrorHandler);\n}\n\n/**\n * Returns if the error is a SIGPIPE error. SIGPIPE errors should generally be\n * logged at most once, to avoid a loop.\n *\n * @see https://github.com/microsoft/vscode-remote-release/issues/6481\n */\nexport function isSigPipeError(e: unknown): e is Error {\n\tif (!e || typeof e !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst cast = e as Record<string, string | undefined>;\n\treturn cast.code === 'EPIPE' && cast.syscall?.toUpperCase() === 'WRITE';\n}\n\n/**\n * This function should only be called with errors that indicate a bug in the product.\n * E.g. buggy extensions/invalid user-input/network issues should not be able to trigger this code path.\n * If they are, this indicates there is also a bug in the product.\n*/\nexport function onBugIndicatingError(e: any): undefined {\n\terrorHandler.onUnexpectedError(e);\n\treturn undefined;\n}\n\nexport function onUnexpectedError(e: any): undefined {\n\t// ignore errors from cancelled promises\n\tif (!isCancellationError(e)) {\n\t\terrorHandler.onUnexpectedError(e);\n\t}\n\treturn undefined;\n}\n\nexport function onUnexpectedExternalError(e: any): undefined {\n\t// ignore errors from cancelled promises\n\tif (!isCancellationError(e)) {\n\t\terrorHandler.onUnexpectedExternalError(e);\n\t}\n\treturn undefined;\n}\n\nexport interface SerializedError {\n\treadonly $isError: true;\n\treadonly name: string;\n\treadonly message: string;\n\treadonly stack: string;\n\treadonly noTelemetry: boolean;\n\treadonly code?: string;\n\treadonly cause?: SerializedError;\n}\n\ntype ErrorWithCode = Error & {\n\tcode: string | undefined;\n};\n\nexport function transformErrorForSerialization(error: Error): SerializedError;\nexport function transformErrorForSerialization(error: any): any;\nexport function transformErrorForSerialization(error: any): any {\n\tif (error instanceof Error) {\n\t\tconst { name, message, cause } = error;\n\t\tconst stack: string = (<any>error).stacktrace || (<any>error).stack;\n\t\treturn {\n\t\t\t$isError: true,\n\t\t\tname,\n\t\t\tmessage,\n\t\t\tstack,\n\t\t\tnoTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error),\n\t\t\tcause: cause ? transformErrorForSerialization(cause) : undefined,\n\t\t\tcode: (<ErrorWithCode>error).code\n\t\t};\n\t}\n\n\t// return as is\n\treturn error;\n}\n\nexport function transformErrorFromSerialization(data: SerializedError): Error {\n\tlet error: Error;\n\tif (data.noTelemetry) {\n\t\terror = new ErrorNoTelemetry();\n\t} else {\n\t\terror = new Error();\n\t\terror.name = data.name;\n\t}\n\terror.message = data.message;\n\terror.stack = data.stack;\n\tif (data.code) {\n\t\t(<ErrorWithCode>error).code = data.code;\n\t}\n\tif (data.cause) {\n\t\terror.cause = transformErrorFromSerialization(data.cause);\n\t}\n\treturn error;\n}\n\n// see https://github.com/v8/v8/wiki/Stack%20Trace%20API#basic-stack-traces\nexport interface V8CallSite {\n\tgetThis(): unknown;\n\tgetTypeName(): string | null;\n\tgetFunction(): Function | undefined;\n\tgetFunctionName(): string | null;\n\tgetMethodName(): string | null;\n\tgetFileName(): string | null;\n\tgetLineNumber(): number | null;\n\tgetColumnNumber(): number | null;\n\tgetEvalOrigin(): string | undefined;\n\tisToplevel(): boolean;\n\tisEval(): boolean;\n\tisNative(): boolean;\n\tisConstructor(): boolean;\n\ttoString(): string;\n}\n\nexport const canceledName = 'Canceled';\n\n/**\n * Checks if the given error is a promise in canceled state\n */\nexport function isCancellationError(error: any): boolean {\n\tif (error instanceof CancellationError) {\n\t\treturn true;\n\t}\n\treturn error instanceof Error && error.name === canceledName && error.message === canceledName;\n}\n\n// !!!IMPORTANT!!!\n// Do NOT change this class because it is also used as an API-type.\nexport class CancellationError extends Error {\n\tconstructor() {\n\t\tsuper(canceledName);\n\t\tthis.name = this.message;\n\t}\n}\n\nexport class PendingMigrationError extends Error {\n\n\tprivate static readonly _name = 'PendingMigrationError';\n\n\tstatic is(error: unknown): error is PendingMigrationError {\n\t\treturn error instanceof PendingMigrationError || (error instanceof Error && error.name === PendingMigrationError._name);\n\t}\n\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = PendingMigrationError._name;\n\t}\n}\n\n/**\n * @deprecated use {@link CancellationError `new CancellationError()`} instead\n */\nexport function canceled(): Error {\n\tconst error = new Error(canceledName);\n\terror.name = error.message;\n\treturn error;\n}\n\nexport function illegalArgument(name?: string): Error {\n\tif (name) {\n\t\treturn new Error(`Illegal argument: ${name}`);\n\t} else {\n\t\treturn new Error('Illegal argument');\n\t}\n}\n\nexport function illegalState(name?: string): Error {\n\tif (name) {\n\t\treturn new Error(`Illegal state: ${name}`);\n\t} else {\n\t\treturn new Error('Illegal state');\n\t}\n}\n\nexport class ReadonlyError extends TypeError {\n\tconstructor(name?: string) {\n\t\tsuper(name ? `${name} is read-only and cannot be changed` : 'Cannot change read-only property');\n\t}\n}\n\nexport function getErrorMessage(err: any): string {\n\tif (!err) {\n\t\treturn 'Error';\n\t}\n\n\tif (err.message) {\n\t\treturn err.message;\n\t}\n\n\tif (err.stack) {\n\t\treturn err.stack.split('\\n')[0];\n\t}\n\n\treturn String(err);\n}\n\nexport class NotImplementedError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper('NotImplemented');\n\t\tif (message) {\n\t\t\tthis.message = message;\n\t\t}\n\t}\n}\n\nexport class NotSupportedError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper('NotSupported');\n\t\tif (message) {\n\t\t\tthis.message = message;\n\t\t}\n\t}\n}\n\nexport class ExpectedError extends Error {\n\treadonly isExpected = true;\n}\n\n/**\n * Error that when thrown won't be logged in telemetry as an unhandled error.\n */\nexport class ErrorNoTelemetry extends Error {\n\toverride readonly name: string;\n\n\tconstructor(msg?: string) {\n\t\tsuper(msg);\n\t\tthis.name = 'CodeExpectedError';\n\t}\n\n\tpublic static fromError(err: Error): ErrorNoTelemetry {\n\t\tif (err instanceof ErrorNoTelemetry) {\n\t\t\treturn err;\n\t\t}\n\n\t\tconst result = new ErrorNoTelemetry();\n\t\tresult.message = err.message;\n\t\tresult.stack = err.stack;\n\t\treturn result;\n\t}\n\n\tpublic static isErrorNoTelemetry(err: Error): err is ErrorNoTelemetry {\n\t\treturn err.name === 'CodeExpectedError';\n\t}\n}\n\n/**\n * This error indicates a bug.\n * Do not throw this for invalid user input.\n * Only catch this error to recover gracefully from bugs.\n */\nexport class BugIndicatingError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper(message || 'An unexpected bug occurred.');\n\t\tObject.setPrototypeOf(this, BugIndicatingError.prototype);\n\n\t\t// Because we know for sure only buggy code throws this,\n\t\t// we definitely want to break here and fix the bug.\n\t\t// debugger;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Given a function, returns a function that is only calling that function once.\n */\nexport function createSingleCallFunction<T extends Function>(this: unknown, fn: T, fnDidRunCallback?: () => void): T {\n\tconst _this = this;\n\tlet didCall = false;\n\tlet result: unknown;\n\n\treturn function () {\n\t\tif (didCall) {\n\t\t\treturn result;\n\t\t}\n\n\t\tdidCall = true;\n\t\tif (fnDidRunCallback) {\n\t\t\ttry {\n\t\t\t\tresult = fn.apply(_this, arguments);\n\t\t\t} finally {\n\t\t\t\tfnDidRunCallback();\n\t\t\t}\n\t\t} else {\n\t\t\tresult = fn.apply(_this, arguments);\n\t\t}\n\n\t\treturn result;\n\t} as unknown as T;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Comparator } from './arrays.js';\n\nexport function findLast<T>(array: readonly T[], predicate: (item: T) => unknown, fromIndex = array.length - 1): T | undefined {\n\tconst idx = findLastIdx(array, predicate, fromIndex);\n\tif (idx === -1) {\n\t\treturn undefined;\n\t}\n\treturn array[idx];\n}\n\nexport function findLastIdx<T>(array: readonly T[], predicate: (item: T) => unknown, fromIndex = array.length - 1): number {\n\tfor (let i = fromIndex; i >= 0; i--) {\n\t\tconst element = array[i];\n\n\t\tif (predicate(element)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `undefined` if no item matches, otherwise the last item that matches the predicate.\n */\nexport function findLastMonotonous<T>(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findLastIdxMonotonous(array, predicate);\n\treturn idx === -1 ? undefined : array[idx];\n}\n\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `startIdx - 1` if predicate is false for all items, otherwise the index of the last item that matches the predicate.\n */\nexport function findLastIdxMonotonous<T>(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tlet i = startIdx;\n\tlet j = endIdxEx;\n\twhile (i < j) {\n\t\tconst k = Math.floor((i + j) / 2);\n\t\tif (predicate(array[k])) {\n\t\t\ti = k + 1;\n\t\t} else {\n\t\t\tj = k;\n\t\t}\n\t}\n\treturn i - 1;\n}\n\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `undefined` if no item matches, otherwise the first item that matches the predicate.\n */\nexport function findFirstMonotonous<T>(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findFirstIdxMonotonousOrArrLen(array, predicate);\n\treturn idx === array.length ? undefined : array[idx];\n}\n\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `endIdxEx` if predicate is false for all items, otherwise the index of the first item that matches the predicate.\n */\nexport function findFirstIdxMonotonousOrArrLen<T>(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tlet i = startIdx;\n\tlet j = endIdxEx;\n\twhile (i < j) {\n\t\tconst k = Math.floor((i + j) / 2);\n\t\tif (predicate(array[k])) {\n\t\t\tj = k;\n\t\t} else {\n\t\t\ti = k + 1;\n\t\t}\n\t}\n\treturn i;\n}\n\nexport function findFirstIdxMonotonous<T>(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tconst idx = findFirstIdxMonotonousOrArrLen(array, predicate, startIdx, endIdxEx);\n\treturn idx === array.length ? -1 : idx;\n}\n\n/**\n * Use this when\n * * You have a sorted array\n * * You query this array with a monotonous predicate to find the last item that has a certain property.\n * * You query this array multiple times with monotonous predicates that get weaker and weaker.\n */\nexport class MonotonousArray<T> {\n\tpublic static assertInvariants = false;\n\n\tprivate _findLastMonotonousLastIdx = 0;\n\tprivate _prevFindLastPredicate: ((item: T) => boolean) | undefined;\n\n\tconstructor(private readonly _array: readonly T[]) {\n\t}\n\n\t/**\n\t * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n\t * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.\n\t */\n\tfindLastMonotonous(predicate: (item: T) => boolean): T | undefined {\n\t\tif (MonotonousArray.assertInvariants) {\n\t\t\tif (this._prevFindLastPredicate) {\n\t\t\t\tfor (const item of this._array) {\n\t\t\t\t\tif (this._prevFindLastPredicate(item) && !predicate(item)) {\n\t\t\t\t\t\tthrow new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._prevFindLastPredicate = predicate;\n\t\t}\n\n\t\tconst idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);\n\t\tthis._findLastMonotonousLastIdx = idx + 1;\n\t\treturn idx === -1 ? undefined : this._array[idx];\n\t}\n}\n\n/**\n * Returns the first item that is equal to or greater than every other item.\n*/\nexport function findFirstMax<T>(array: readonly T[], comparator: Comparator<T>): T | undefined {\n\tif (array.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tlet max = array[0];\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, max) > 0) {\n\t\t\tmax = item;\n\t\t}\n\t}\n\treturn max;\n}\n\n/**\n * Returns the last item that is equal to or greater than every other item.\n*/\nexport function findLastMax<T>(array: readonly T[], comparator: Comparator<T>): T | undefined {\n\tif (array.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tlet max = array[0];\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, max) >= 0) {\n\t\t\tmax = item;\n\t\t}\n\t}\n\treturn max;\n}\n\n/**\n * Returns the first item that is equal to or less than every other item.\n*/\nexport function findFirstMin<T>(array: readonly T[], comparator: Comparator<T>): T | undefined {\n\treturn findFirstMax(array, (a, b) => -comparator(a, b));\n}\n\nexport function findMaxIdx<T>(array: readonly T[], comparator: Comparator<T>): number {\n\tif (array.length === 0) {\n\t\treturn -1;\n\t}\n\n\tlet maxIdx = 0;\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, array[maxIdx]) > 0) {\n\t\t\tmaxIdx = i;\n\t\t}\n\t}\n\treturn maxIdx;\n}\n\n/**\n * Returns the first mapped value of the array which is not undefined.\n */\nexport function mapFindFirst<T, R>(items: Iterable<T>, mapFn: (value: T) => R | undefined): R | undefined {\n\tfor (const value of items) {\n\t\tconst mapped = mapFn(value);\n\t\tif (mapped !== undefined) {\n\t\t\treturn mapped;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { findFirstIdxMonotonousOrArrLen } from './arraysFind.js';\nimport { CancellationToken } from './cancellation.js';\nimport { CancellationError } from './errors.js';\nimport { ISplice } from './sequence.js';\n\n/**\n * Returns the last entry and the initial N-1 entries of the array, as a tuple of [rest, last].\n *\n * The array must have at least one element.\n *\n * @param arr The input array\n * @returns A tuple of [rest, last] where rest is all but the last element and last is the last element\n * @throws Error if the array is empty\n */\nexport function tail<T>(arr: T[]): [T[], T] {\n\tif (arr.length === 0) {\n\t\tthrow new Error('Invalid tail call');\n\t}\n\n\treturn [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\n}\n\nexport function equals<T>(one: ReadonlyArray<T> | undefined, other: ReadonlyArray<T> | undefined, itemEquals: (a: T, b: T) => boolean = (a, b) => a === b): boolean {\n\tif (one === other) {\n\t\treturn true;\n\t}\n\n\tif (!one || !other) {\n\t\treturn false;\n\t}\n\n\tif (one.length !== other.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0, len = one.length; i < len; i++) {\n\t\tif (!itemEquals(one[i], other[i])) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Remove the element at `index` by replacing it with the last element. This is faster than `splice`\n * but changes the order of the array\n */\nexport function removeFastWithoutKeepingOrder<T>(array: T[], index: number) {\n\tconst last = array.length - 1;\n\tif (index < last) {\n\t\tarray[index] = array[last];\n\t}\n\tarray.pop();\n}\n\n/**\n * Performs a binary search algorithm over a sorted array.\n *\n * @param array The array being searched.\n * @param key The value we search for.\n * @param comparator A function that takes two array elements and returns zero\n *   if they are equal, a negative number if the first element precedes the\n *   second one in the sorting order, or a positive number if the second element\n *   precedes the first one.\n * @return See {@link binarySearch2}\n */\nexport function binarySearch<T>(array: ReadonlyArray<T>, key: T, comparator: (op1: T, op2: T) => number): number {\n\treturn binarySearch2(array.length, i => comparator(array[i], key));\n}\n\n/**\n * Performs a binary search algorithm over a sorted collection. Useful for cases\n * when we need to perform a binary search over something that isn't actually an\n * array, and converting data to an array would defeat the use of binary search\n * in the first place.\n *\n * @param length The collection length.\n * @param compareToKey A function that takes an index of an element in the\n *   collection and returns zero if the value at this index is equal to the\n *   search key, a negative number if the value precedes the search key in the\n *   sorting order, or a positive number if the search key precedes the value.\n * @return A non-negative index of an element, if found. If not found, the\n *   result is -(n+1) (or ~n, using bitwise notation), where n is the index\n *   where the key should be inserted to maintain the sorting order.\n */\nexport function binarySearch2(length: number, compareToKey: (index: number) => number): number {\n\tlet low = 0,\n\t\thigh = length - 1;\n\n\twhile (low <= high) {\n\t\tconst mid = ((low + high) / 2) | 0;\n\t\tconst comp = compareToKey(mid);\n\t\tif (comp < 0) {\n\t\t\tlow = mid + 1;\n\t\t} else if (comp > 0) {\n\t\t\thigh = mid - 1;\n\t\t} else {\n\t\t\treturn mid;\n\t\t}\n\t}\n\treturn -(low + 1);\n}\n\ntype Compare<T> = (a: T, b: T) => number;\n\n\nexport function quickSelect<T>(nth: number, data: T[], compare: Compare<T>): T {\n\n\tnth = nth | 0;\n\n\tif (nth >= data.length) {\n\t\tthrow new TypeError('invalid index');\n\t}\n\n\tconst pivotValue = data[Math.floor(data.length * Math.random())];\n\tconst lower: T[] = [];\n\tconst higher: T[] = [];\n\tconst pivots: T[] = [];\n\n\tfor (const value of data) {\n\t\tconst val = compare(value, pivotValue);\n\t\tif (val < 0) {\n\t\t\tlower.push(value);\n\t\t} else if (val > 0) {\n\t\t\thigher.push(value);\n\t\t} else {\n\t\t\tpivots.push(value);\n\t\t}\n\t}\n\n\tif (nth < lower.length) {\n\t\treturn quickSelect(nth, lower, compare);\n\t} else if (nth < lower.length + pivots.length) {\n\t\treturn pivots[0];\n\t} else {\n\t\treturn quickSelect(nth - (lower.length + pivots.length), higher, compare);\n\t}\n}\n\nexport function groupBy<T>(data: ReadonlyArray<T>, compare: (a: T, b: T) => number): T[][] {\n\tconst result: T[][] = [];\n\tlet currentGroup: T[] | undefined = undefined;\n\tfor (const element of data.slice(0).sort(compare)) {\n\t\tif (!currentGroup || compare(currentGroup[0], element) !== 0) {\n\t\t\tcurrentGroup = [element];\n\t\t\tresult.push(currentGroup);\n\t\t} else {\n\t\t\tcurrentGroup.push(element);\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Splits the given items into a list of (non-empty) groups.\n * `shouldBeGrouped` is used to decide if two consecutive items should be in the same group.\n * The order of the items is preserved.\n */\nexport function* groupAdjacentBy<T>(items: Iterable<T>, shouldBeGrouped: (item1: T, item2: T) => boolean): Iterable<T[]> {\n\tlet currentGroup: T[] | undefined;\n\tlet last: T | undefined;\n\tfor (const item of items) {\n\t\tif (last !== undefined && shouldBeGrouped(last, item)) {\n\t\t\tcurrentGroup!.push(item);\n\t\t} else {\n\t\t\tif (currentGroup) {\n\t\t\t\tyield currentGroup;\n\t\t\t}\n\t\t\tcurrentGroup = [item];\n\t\t}\n\t\tlast = item;\n\t}\n\tif (currentGroup) {\n\t\tyield currentGroup;\n\t}\n}\n\nexport function forEachAdjacent<T>(arr: T[], f: (item1: T | undefined, item2: T | undefined) => void): void {\n\tfor (let i = 0; i <= arr.length; i++) {\n\t\tf(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]);\n\t}\n}\n\nexport function forEachWithNeighbors<T>(arr: T[], f: (before: T | undefined, element: T, after: T | undefined) => void): void {\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tf(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]);\n\t}\n}\n\nexport function concatArrays<TArr extends any[]>(...arrays: TArr): TArr[number][number][] {\n\treturn ([] as any[]).concat(...arrays);\n}\n\ninterface IMutableSplice<T> extends ISplice<T> {\n\treadonly toInsert: T[];\n\tdeleteCount: number;\n}\n\n/**\n * Diffs two *sorted* arrays and computes the splices which apply the diff.\n */\nexport function sortedDiff<T>(before: ReadonlyArray<T>, after: ReadonlyArray<T>, compare: (a: T, b: T) => number): ISplice<T>[] {\n\tconst result: IMutableSplice<T>[] = [];\n\n\tfunction pushSplice(start: number, deleteCount: number, toInsert: T[]): void {\n\t\tif (deleteCount === 0 && toInsert.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst latest = result[result.length - 1];\n\n\t\tif (latest && latest.start + latest.deleteCount === start) {\n\t\t\tlatest.deleteCount += deleteCount;\n\t\t\tlatest.toInsert.push(...toInsert);\n\t\t} else {\n\t\t\tresult.push({ start, deleteCount, toInsert });\n\t\t}\n\t}\n\n\tlet beforeIdx = 0;\n\tlet afterIdx = 0;\n\n\twhile (true) {\n\t\tif (beforeIdx === before.length) {\n\t\t\tpushSplice(beforeIdx, 0, after.slice(afterIdx));\n\t\t\tbreak;\n\t\t}\n\t\tif (afterIdx === after.length) {\n\t\t\tpushSplice(beforeIdx, before.length - beforeIdx, []);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst beforeElement = before[beforeIdx];\n\t\tconst afterElement = after[afterIdx];\n\t\tconst n = compare(beforeElement, afterElement);\n\t\tif (n === 0) {\n\t\t\t// equal\n\t\t\tbeforeIdx += 1;\n\t\t\tafterIdx += 1;\n\t\t} else if (n < 0) {\n\t\t\t// beforeElement is smaller -> before element removed\n\t\t\tpushSplice(beforeIdx, 1, []);\n\t\t\tbeforeIdx += 1;\n\t\t} else if (n > 0) {\n\t\t\t// beforeElement is greater -> after element added\n\t\t\tpushSplice(beforeIdx, 0, [afterElement]);\n\t\t\tafterIdx += 1;\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Takes two *sorted* arrays and computes their delta (removed, added elements).\n * Finishes in `Math.min(before.length, after.length)` steps.\n */\nexport function delta<T>(before: ReadonlyArray<T>, after: ReadonlyArray<T>, compare: (a: T, b: T) => number): { removed: T[]; added: T[] } {\n\tconst splices = sortedDiff(before, after, compare);\n\tconst removed: T[] = [];\n\tconst added: T[] = [];\n\n\tfor (const splice of splices) {\n\t\tremoved.push(...before.slice(splice.start, splice.start + splice.deleteCount));\n\t\tadded.push(...splice.toInsert);\n\t}\n\n\treturn { removed, added };\n}\n\n/**\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @return The first n elements from array when sorted with compare.\n */\nexport function top<T>(array: ReadonlyArray<T>, compare: (a: T, b: T) => number, n: number): T[] {\n\tif (n === 0) {\n\t\treturn [];\n\t}\n\tconst result = array.slice(0, n).sort(compare);\n\ttopStep(array, compare, result, n, array.length);\n\treturn result;\n}\n\n/**\n * Asynchronous variant of `top()` allowing for splitting up work in batches between which the event loop can run.\n *\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @param batch The number of elements to examine before yielding to the event loop.\n * @return The first n elements from array when sorted with compare.\n */\nexport function topAsync<T>(array: T[], compare: (a: T, b: T) => number, n: number, batch: number, token?: CancellationToken): Promise<T[]> {\n\tif (n === 0) {\n\t\treturn Promise.resolve([]);\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\t(async () => {\n\t\t\tconst o = array.length;\n\t\t\tconst result = array.slice(0, n).sort(compare);\n\t\t\tfor (let i = n, m = Math.min(n + batch, o); i < o; i = m, m = Math.min(m + batch, o)) {\n\t\t\t\tif (i > n) {\n\t\t\t\t\tawait new Promise(resolve => setTimeout(resolve)); // any other delay function would starve I/O\n\t\t\t\t}\n\t\t\t\tif (token && token.isCancellationRequested) {\n\t\t\t\t\tthrow new CancellationError();\n\t\t\t\t}\n\t\t\t\ttopStep(array, compare, result, i, m);\n\t\t\t}\n\t\t\treturn result;\n\t\t})()\n\t\t\t.then(resolve, reject);\n\t});\n}\n\nfunction topStep<T>(array: ReadonlyArray<T>, compare: (a: T, b: T) => number, result: T[], i: number, m: number): void {\n\tfor (const n = result.length; i < m; i++) {\n\t\tconst element = array[i];\n\t\tif (compare(element, result[n - 1]) < 0) {\n\t\t\tresult.pop();\n\t\t\tconst j = findFirstIdxMonotonousOrArrLen(result, e => compare(element, e) < 0);\n\t\t\tresult.splice(j, 0, element);\n\t\t}\n\t}\n}\n\n/**\n * @returns New array with all falsy values removed. The original array IS NOT modified.\n */\nexport function coalesce<T>(array: ReadonlyArray<T | undefined | null>): T[] {\n\treturn array.filter((e): e is T => !!e);\n}\n\n/**\n * Remove all falsy values from `array`. The original array IS modified.\n */\nexport function coalesceInPlace<T>(array: Array<T | undefined | null>): asserts array is Array<T> {\n\tlet to = 0;\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (!!array[i]) {\n\t\t\tarray[to] = array[i];\n\t\t\tto += 1;\n\t\t}\n\t}\n\tarray.length = to;\n}\n\n/**\n * @deprecated Use `Array.copyWithin` instead\n */\nexport function move(array: unknown[], from: number, to: number): void {\n\tarray.splice(to, 0, array.splice(from, 1)[0]);\n}\n\n/**\n * @returns false if the provided object is an array and not empty.\n */\nexport function isFalsyOrEmpty(obj: unknown): boolean {\n\treturn !Array.isArray(obj) || obj.length === 0;\n}\n\n/**\n * @returns True if the provided object is an array and has at least one element.\n */\nexport function isNonEmptyArray<T>(obj: T[] | undefined | null): obj is T[];\nexport function isNonEmptyArray<T>(obj: readonly T[] | undefined | null): obj is readonly T[];\nexport function isNonEmptyArray<T>(obj: T[] | readonly T[] | undefined | null): obj is T[] | readonly T[] {\n\treturn Array.isArray(obj) && obj.length > 0;\n}\n\n/**\n * Removes duplicates from the given array. The optional keyFn allows to specify\n * how elements are checked for equality by returning an alternate value for each.\n */\nexport function distinct<T>(array: ReadonlyArray<T>, keyFn: (value: T) => unknown = value => value): T[] {\n\tconst seen = new Set<any>();\n\n\treturn array.filter(element => {\n\t\tconst key = keyFn!(element);\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(key);\n\t\treturn true;\n\t});\n}\n\nexport function uniqueFilter<T, R>(keyFn: (t: T) => R): (t: T) => boolean {\n\tconst seen = new Set<R>();\n\n\treturn element => {\n\t\tconst key = keyFn(element);\n\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tseen.add(key);\n\t\treturn true;\n\t};\n}\n\nexport function commonPrefixLength<T>(one: ReadonlyArray<T>, other: ReadonlyArray<T>, equals: (a: T, b: T) => boolean = (a, b) => a === b): number {\n\tlet result = 0;\n\n\tfor (let i = 0, len = Math.min(one.length, other.length); i < len && equals(one[i], other[i]); i++) {\n\t\tresult++;\n\t}\n\n\treturn result;\n}\n\nexport function range(to: number): number[];\nexport function range(from: number, to: number): number[];\nexport function range(arg: number, to?: number): number[] {\n\tlet from = typeof to === 'number' ? arg : 0;\n\n\tif (typeof to === 'number') {\n\t\tfrom = arg;\n\t} else {\n\t\tfrom = 0;\n\t\tto = arg;\n\t}\n\n\tconst result: number[] = [];\n\n\tif (from <= to) {\n\t\tfor (let i = from; i < to; i++) {\n\t\t\tresult.push(i);\n\t\t}\n\t} else {\n\t\tfor (let i = from; i > to; i--) {\n\t\t\tresult.push(i);\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function index<T>(array: ReadonlyArray<T>, indexer: (t: T) => string): { [key: string]: T };\nexport function index<T, R>(array: ReadonlyArray<T>, indexer: (t: T) => string, mapper: (t: T) => R): { [key: string]: R };\nexport function index<T, R>(array: ReadonlyArray<T>, indexer: (t: T) => string, mapper?: (t: T) => R): { [key: string]: R } {\n\treturn array.reduce((r, t) => {\n\t\tr[indexer(t)] = mapper ? mapper(t) : t;\n\t\treturn r;\n\t}, Object.create(null));\n}\n\n/**\n * Inserts an element into an array. Returns a function which, when\n * called, will remove that element from the array.\n *\n * @deprecated In almost all cases, use a `Set<T>` instead.\n */\nexport function insert<T>(array: T[], element: T): () => void {\n\tarray.push(element);\n\n\treturn () => remove(array, element);\n}\n\n/**\n * Removes an element from an array if it can be found.\n *\n * @deprecated In almost all cases, use a `Set<T>` instead.\n */\nexport function remove<T>(array: T[], element: T): T | undefined {\n\tconst index = array.indexOf(element);\n\tif (index > -1) {\n\t\tarray.splice(index, 1);\n\n\t\treturn element;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Insert `insertArr` inside `target` at `insertIndex`.\n * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array\n */\nexport function arrayInsert<T>(target: T[], insertIndex: number, insertArr: T[]): T[] {\n\tconst before = target.slice(0, insertIndex);\n\tconst after = target.slice(insertIndex);\n\treturn before.concat(insertArr, after);\n}\n\n/**\n * Uses Fisher-Yates shuffle to shuffle the given array\n */\nexport function shuffle<T>(array: T[], _seed?: number): void {\n\tlet rand: () => number;\n\n\tif (typeof _seed === 'number') {\n\t\tlet seed = _seed;\n\t\t// Seeded random number generator in JS. Modified from:\n\t\t// https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript\n\t\trand = () => {\n\t\t\tconst x = Math.sin(seed++) * 179426549; // throw away most significant digits and reduce any potential bias\n\t\t\treturn x - Math.floor(x);\n\t\t};\n\t} else {\n\t\trand = Math.random;\n\t}\n\n\tfor (let i = array.length - 1; i > 0; i -= 1) {\n\t\tconst j = Math.floor(rand() * (i + 1));\n\t\tconst temp = array[i];\n\t\tarray[i] = array[j];\n\t\tarray[j] = temp;\n\t}\n}\n\n/**\n * Pushes an element to the start of the array, if found.\n */\nexport function pushToStart<T>(arr: T[], value: T): void {\n\tconst index = arr.indexOf(value);\n\n\tif (index > -1) {\n\t\tarr.splice(index, 1);\n\t\tarr.unshift(value);\n\t}\n}\n\n/**\n * Pushes an element to the end of the array, if found.\n */\nexport function pushToEnd<T>(arr: T[], value: T): void {\n\tconst index = arr.indexOf(value);\n\n\tif (index > -1) {\n\t\tarr.splice(index, 1);\n\t\tarr.push(value);\n\t}\n}\n\nexport function pushMany<T>(arr: T[], items: ReadonlyArray<T>): void {\n\tfor (const item of items) {\n\t\tarr.push(item);\n\t}\n}\n\nexport function mapArrayOrNot<T, U>(items: T | T[], fn: (_: T) => U): U | U[] {\n\treturn Array.isArray(items) ?\n\t\titems.map(fn) :\n\t\tfn(items);\n}\n\nexport function asArray<T>(x: T | T[]): T[];\nexport function asArray<T>(x: T | readonly T[]): readonly T[];\nexport function asArray<T>(x: T | T[]): T[] {\n\treturn Array.isArray(x) ? x : [x];\n}\n\nexport function getRandomElement<T>(arr: T[]): T | undefined {\n\treturn arr[Math.floor(Math.random() * arr.length)];\n}\n\n/**\n * Insert the new items in the array.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start inserting elements.\n * @param newItems The items to be inserted\n */\nexport function insertInto<T>(array: T[], start: number, newItems: T[]): void {\n\tconst startIdx = getActualStartIndex(array, start);\n\tconst originalLength = array.length;\n\tconst newItemsLength = newItems.length;\n\tarray.length = originalLength + newItemsLength;\n\t// Move the items after the start index, start from the end so that we don't overwrite any value.\n\tfor (let i = originalLength - 1; i >= startIdx; i--) {\n\t\tarray[i + newItemsLength] = array[i];\n\t}\n\n\tfor (let i = 0; i < newItemsLength; i++) {\n\t\tarray[i + startIdx] = newItems[i];\n\t}\n}\n\n/**\n * Removes elements from an array and inserts new elements in their place, returning the deleted elements. Alternative to the native Array.splice method, it\n * can only support limited number of items due to the maximum call stack size limit.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns An array containing the elements that were deleted.\n */\nexport function splice<T>(array: T[], start: number, deleteCount: number, newItems: T[]): T[] {\n\tconst index = getActualStartIndex(array, start);\n\tlet result = array.splice(index, deleteCount);\n\tif (result === undefined) {\n\t\t// see https://bugs.webkit.org/show_bug.cgi?id=261140\n\t\tresult = [];\n\t}\n\tinsertInto(array, index, newItems);\n\treturn result;\n}\n\n/**\n * Determine the actual start index (same logic as the native splice() or slice())\n * If greater than the length of the array, start will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided.\n * If negative, it will begin that many elements from the end of the array. (In this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) If array.length + start is less than 0, it will begin from index 0.\n * @param array The target array.\n * @param start The operation index.\n */\nfunction getActualStartIndex<T>(array: T[], start: number): number {\n\treturn start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length);\n}\n\n\n\n/**\n * When comparing two values,\n * a negative number indicates that the first value is less than the second,\n * a positive number indicates that the first value is greater than the second,\n * and zero indicates that neither is the case.\n*/\nexport type CompareResult = number;\n\nexport namespace CompareResult {\n\texport function isLessThan(result: CompareResult): boolean {\n\t\treturn result < 0;\n\t}\n\n\texport function isLessThanOrEqual(result: CompareResult): boolean {\n\t\treturn result <= 0;\n\t}\n\n\texport function isGreaterThan(result: CompareResult): boolean {\n\t\treturn result > 0;\n\t}\n\n\texport function isNeitherLessOrGreaterThan(result: CompareResult): boolean {\n\t\treturn result === 0;\n\t}\n\n\texport const greaterThan = 1;\n\texport const lessThan = -1;\n\texport const neitherLessOrGreaterThan = 0;\n}\n\n/**\n * A comparator `c` defines a total order `<=` on `T` as following:\n * `c(a, b) <= 0` iff `a` <= `b`.\n * We also have `c(a, b) == 0` iff `c(b, a) == 0`.\n*/\nexport type Comparator<T> = (a: T, b: T) => CompareResult;\n\nexport function compareBy<TItem, TCompareBy>(selector: (item: TItem) => TCompareBy, comparator: Comparator<TCompareBy>): Comparator<TItem> {\n\treturn (a, b) => comparator(selector(a), selector(b));\n}\n\nexport function tieBreakComparators<TItem>(...comparators: Comparator<TItem>[]): Comparator<TItem> {\n\treturn (item1, item2) => {\n\t\tfor (const comparator of comparators) {\n\t\t\tconst result = comparator(item1, item2);\n\t\t\tif (!CompareResult.isNeitherLessOrGreaterThan(result)) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn CompareResult.neitherLessOrGreaterThan;\n\t};\n}\n\n/**\n * The natural order on numbers.\n*/\nexport const numberComparator: Comparator<number> = (a, b) => a - b;\n\nexport const booleanComparator: Comparator<boolean> = (a, b) => numberComparator(a ? 1 : 0, b ? 1 : 0);\n\nexport function reverseOrder<TItem>(comparator: Comparator<TItem>): Comparator<TItem> {\n\treturn (a, b) => -comparator(a, b);\n}\n\n/**\n * Returns a new comparator that treats `undefined` as the smallest value.\n * All other values are compared using the given comparator.\n*/\nexport function compareUndefinedSmallest<T>(comparator: Comparator<T>): Comparator<T | undefined> {\n\treturn (a, b) => {\n\t\tif (a === undefined) {\n\t\t\treturn b === undefined ? CompareResult.neitherLessOrGreaterThan : CompareResult.lessThan;\n\t\t} else if (b === undefined) {\n\t\t\treturn CompareResult.greaterThan;\n\t\t}\n\n\t\treturn comparator(a, b);\n\t};\n}\n\nexport class ArrayQueue<T> {\n\tprivate readonly items: readonly T[];\n\tprivate firstIdx = 0;\n\tprivate lastIdx: number;\n\n\t/**\n\t * Constructs a queue that is backed by the given array. Runtime is O(1).\n\t*/\n\tconstructor(items: readonly T[]) {\n\t\tthis.items = items;\n\t\tthis.lastIdx = this.items.length - 1;\n\t}\n\n\tget length(): number {\n\t\treturn this.lastIdx - this.firstIdx + 1;\n\t}\n\n\t/**\n\t * Consumes elements from the beginning of the queue as long as the predicate returns true.\n\t * If no elements were consumed, `null` is returned. Has a runtime of O(result.length).\n\t*/\n\ttakeWhile(predicate: (value: T) => boolean): T[] | null {\n\t\t// P(k) := k <= this.lastIdx && predicate(this.items[k])\n\t\t// Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)\n\n\t\tlet startIdx = this.firstIdx;\n\t\twhile (startIdx < this.items.length && predicate(this.items[startIdx])) {\n\t\t\tstartIdx++;\n\t\t}\n\t\tconst result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);\n\t\tthis.firstIdx = startIdx;\n\t\treturn result;\n\t}\n\n\t/**\n\t * Consumes elements from the end of the queue as long as the predicate returns true.\n\t * If no elements were consumed, `null` is returned.\n\t * The result has the same order as the underlying array!\n\t*/\n\ttakeFromEndWhile(predicate: (value: T) => boolean): T[] | null {\n\t\t// P(k) := this.firstIdx >= k && predicate(this.items[k])\n\t\t// Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]\n\n\t\tlet endIdx = this.lastIdx;\n\t\twhile (endIdx >= 0 && predicate(this.items[endIdx])) {\n\t\t\tendIdx--;\n\t\t}\n\t\tconst result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);\n\t\tthis.lastIdx = endIdx;\n\t\treturn result;\n\t}\n\n\tpeek(): T | undefined {\n\t\tif (this.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.items[this.firstIdx];\n\t}\n\n\tpeekLast(): T | undefined {\n\t\tif (this.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.items[this.lastIdx];\n\t}\n\n\tdequeue(): T | undefined {\n\t\tconst result = this.items[this.firstIdx];\n\t\tthis.firstIdx++;\n\t\treturn result;\n\t}\n\n\tremoveLast(): T | undefined {\n\t\tconst result = this.items[this.lastIdx];\n\t\tthis.lastIdx--;\n\t\treturn result;\n\t}\n\n\ttakeCount(count: number): T[] {\n\t\tconst result = this.items.slice(this.firstIdx, this.firstIdx + count);\n\t\tthis.firstIdx += count;\n\t\treturn result;\n\t}\n}\n\n/**\n * This class is faster than an iterator and array for lazy computed data.\n*/\nexport class CallbackIterable<T> {\n\tpublic static readonly empty = new CallbackIterable<never>(_callback => { });\n\n\tconstructor(\n\t\t/**\n\t\t * Calls the callback for every item.\n\t\t * Stops when the callback returns false.\n\t\t*/\n\t\tpublic readonly iterate: (callback: (item: T) => boolean) => void\n\t) {\n\t}\n\n\tforEach(handler: (item: T) => void) {\n\t\tthis.iterate(item => { handler(item); return true; });\n\t}\n\n\ttoArray(): T[] {\n\t\tconst result: T[] = [];\n\t\tthis.iterate(item => { result.push(item); return true; });\n\t\treturn result;\n\t}\n\n\tfilter(predicate: (item: T) => boolean): CallbackIterable<T> {\n\t\treturn new CallbackIterable(cb => this.iterate(item => predicate(item) ? cb(item) : true));\n\t}\n\n\tmap<TResult>(mapFn: (item: T) => TResult): CallbackIterable<TResult> {\n\t\treturn new CallbackIterable<TResult>(cb => this.iterate(item => cb(mapFn(item))));\n\t}\n\n\tsome(predicate: (item: T) => boolean): boolean {\n\t\tlet result = false;\n\t\tthis.iterate(item => { result = predicate(item); return !result; });\n\t\treturn result;\n\t}\n\n\tfindFirst(predicate: (item: T) => boolean): T | undefined {\n\t\tlet result: T | undefined;\n\t\tthis.iterate(item => {\n\t\t\tif (predicate(item)) {\n\t\t\t\tresult = item;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n\n\tfindLast(predicate: (item: T) => boolean): T | undefined {\n\t\tlet result: T | undefined;\n\t\tthis.iterate(item => {\n\t\t\tif (predicate(item)) {\n\t\t\t\tresult = item;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n\n\tfindLastMaxBy(comparator: Comparator<T>): T | undefined {\n\t\tlet result: T | undefined;\n\t\tlet first = true;\n\t\tthis.iterate(item => {\n\t\t\tif (first || CompareResult.isGreaterThan(comparator(item, result!))) {\n\t\t\t\tfirst = false;\n\t\t\t\tresult = item;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n}\n\n/**\n * Represents a re-arrangement of items in an array.\n */\nexport class Permutation {\n\tconstructor(private readonly _indexMap: readonly number[]) { }\n\n\t/**\n\t * Returns a permutation that sorts the given array according to the given compare function.\n\t */\n\tpublic static createSortPermutation<T>(arr: readonly T[], compareFn: (a: T, b: T) => number): Permutation {\n\t\tconst sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2]));\n\t\treturn new Permutation(sortIndices);\n\t}\n\n\t/**\n\t * Returns a new array with the elements of the given array re-arranged according to this permutation.\n\t */\n\tapply<T>(arr: readonly T[]): T[] {\n\t\treturn arr.map((_, index) => arr[this._indexMap[index]]);\n\t}\n\n\t/**\n\t * Returns a new permutation that undoes the re-arrangement of this permutation.\n\t*/\n\tinverse(): Permutation {\n\t\tconst inverseIndexMap = this._indexMap.slice();\n\t\tfor (let i = 0; i < this._indexMap.length; i++) {\n\t\t\tinverseIndexMap[this._indexMap[i]] = i;\n\t\t}\n\t\treturn new Permutation(inverseIndexMap);\n\t}\n}\n\n/**\n * Asynchronous variant of `Array.find()`, returning the first element in\n * the array for which the predicate returns true.\n *\n * This implementation does not bail early and waits for all promises to\n * resolve before returning.\n */\nexport async function findAsync<T>(array: readonly T[], predicate: (element: T, index: number) => Promise<boolean>): Promise<T | undefined> {\n\tconst results = await Promise.all(array.map(\n\t\tasync (element, index) => ({ element, ok: await predicate(element, index) })\n\t));\n\n\treturn results.find(r => r.ok)?.element;\n}\n\nexport function sum(array: readonly number[]): number {\n\treturn array.reduce((acc, value) => acc + value, 0);\n}\n\nexport function sumBy<T>(array: readonly T[], selector: (value: T) => number): number {\n\treturn array.reduce((acc, value) => acc + selector(value), 0);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { URI } from './uri.js';\n\nexport function getOrSet<K, V>(map: Map<K, V>, key: K, value: V): V {\n\tlet result = map.get(key);\n\tif (result === undefined) {\n\t\tresult = value;\n\t\tmap.set(key, result);\n\t}\n\n\treturn result;\n}\n\nexport function mapToString<K, V>(map: Map<K, V>): string {\n\tconst entries: string[] = [];\n\tmap.forEach((value, key) => {\n\t\tentries.push(`${key} => ${value}`);\n\t});\n\n\treturn `Map(${map.size}) {${entries.join(', ')}}`;\n}\n\nexport function setToString<K>(set: Set<K>): string {\n\tconst entries: K[] = [];\n\tset.forEach(value => {\n\t\tentries.push(value);\n\t});\n\n\treturn `Set(${set.size}) {${entries.join(', ')}}`;\n}\n\ninterface ResourceMapKeyFn {\n\t(resource: URI): string;\n}\n\nclass ResourceMapEntry<T> {\n\tconstructor(readonly uri: URI, readonly value: T) { }\n}\n\nfunction isEntries<T>(arg: ResourceMap<T> | ResourceMapKeyFn | readonly (readonly [URI, T])[] | undefined): arg is readonly (readonly [URI, T])[] {\n\treturn Array.isArray(arg);\n}\n\nexport class ResourceMap<T> implements Map<URI, T> {\n\n\tprivate static readonly defaultToKey = (resource: URI) => resource.toString();\n\n\treadonly [Symbol.toStringTag] = 'ResourceMap';\n\n\tprivate readonly map: Map<string, ResourceMapEntry<T>>;\n\tprivate readonly toKey: ResourceMapKeyFn;\n\n\t/**\n\t *\n\t * @param toKey Custom uri identity function, e.g use an existing `IExtUri#getComparison`-util\n\t */\n\tconstructor(toKey?: ResourceMapKeyFn);\n\n\t/**\n\t *\n\t * @param other Another resource which this maps is created from\n\t * @param toKey Custom uri identity function, e.g use an existing `IExtUri#getComparison`-util\n\t */\n\tconstructor(other?: ResourceMap<T>, toKey?: ResourceMapKeyFn);\n\n\t/**\n\t *\n\t * @param other Another resource which this maps is created from\n\t * @param toKey Custom uri identity function, e.g use an existing `IExtUri#getComparison`-util\n\t */\n\tconstructor(entries?: readonly (readonly [URI, T])[], toKey?: ResourceMapKeyFn);\n\n\tconstructor(arg?: ResourceMap<T> | ResourceMapKeyFn | readonly (readonly [URI, T])[], toKey?: ResourceMapKeyFn) {\n\t\tif (arg instanceof ResourceMap) {\n\t\t\tthis.map = new Map(arg.map);\n\t\t\tthis.toKey = toKey ?? ResourceMap.defaultToKey;\n\t\t} else if (isEntries(arg)) {\n\t\t\tthis.map = new Map();\n\t\t\tthis.toKey = toKey ?? ResourceMap.defaultToKey;\n\n\t\t\tfor (const [resource, value] of arg) {\n\t\t\t\tthis.set(resource, value);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.map = new Map();\n\t\t\tthis.toKey = arg ?? ResourceMap.defaultToKey;\n\t\t}\n\t}\n\n\tset(resource: URI, value: T): this {\n\t\tthis.map.set(this.toKey(resource), new ResourceMapEntry(resource, value));\n\t\treturn this;\n\t}\n\n\tget(resource: URI): T | undefined {\n\t\treturn this.map.get(this.toKey(resource))?.value;\n\t}\n\n\thas(resource: URI): boolean {\n\t\treturn this.map.has(this.toKey(resource));\n\t}\n\n\tget size(): number {\n\t\treturn this.map.size;\n\t}\n\n\tclear(): void {\n\t\tthis.map.clear();\n\t}\n\n\tdelete(resource: URI): boolean {\n\t\treturn this.map.delete(this.toKey(resource));\n\t}\n\n\tforEach(clb: (value: T, key: URI, map: Map<URI, T>) => void, thisArg?: any): void {\n\t\tif (typeof thisArg !== 'undefined') {\n\t\t\tclb = clb.bind(thisArg);\n\t\t}\n\t\tfor (const [_, entry] of this.map) {\n\t\t\tclb(entry.value, entry.uri, <any>this);\n\t\t}\n\t}\n\n\t*values(): IterableIterator<T> {\n\t\tfor (const entry of this.map.values()) {\n\t\t\tyield entry.value;\n\t\t}\n\t}\n\n\t*keys(): IterableIterator<URI> {\n\t\tfor (const entry of this.map.values()) {\n\t\t\tyield entry.uri;\n\t\t}\n\t}\n\n\t*entries(): IterableIterator<[URI, T]> {\n\t\tfor (const entry of this.map.values()) {\n\t\t\tyield [entry.uri, entry.value];\n\t\t}\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[URI, T]> {\n\t\tfor (const [, entry] of this.map) {\n\t\t\tyield [entry.uri, entry.value];\n\t\t}\n\t}\n}\n\nexport class ResourceSet implements Set<URI> {\n\n\treadonly [Symbol.toStringTag]: string = 'ResourceSet';\n\n\tprivate readonly _map: ResourceMap<URI>;\n\n\tconstructor(toKey?: ResourceMapKeyFn);\n\tconstructor(entries: readonly URI[], toKey?: ResourceMapKeyFn);\n\tconstructor(entriesOrKey?: readonly URI[] | ResourceMapKeyFn, toKey?: ResourceMapKeyFn) {\n\t\tif (!entriesOrKey || typeof entriesOrKey === 'function') {\n\t\t\tthis._map = new ResourceMap(entriesOrKey);\n\t\t} else {\n\t\t\tthis._map = new ResourceMap(toKey);\n\t\t\tentriesOrKey.forEach(this.add, this);\n\t\t}\n\t}\n\n\n\tget size(): number {\n\t\treturn this._map.size;\n\t}\n\n\tadd(value: URI): this {\n\t\tthis._map.set(value, value);\n\t\treturn this;\n\t}\n\n\tclear(): void {\n\t\tthis._map.clear();\n\t}\n\n\tdelete(value: URI): boolean {\n\t\treturn this._map.delete(value);\n\t}\n\n\tforEach(callbackfn: (value: URI, value2: URI, set: Set<URI>) => void, thisArg?: any): void {\n\t\tthis._map.forEach((_value, key) => callbackfn.call(thisArg, key, key, this));\n\t}\n\n\thas(value: URI): boolean {\n\t\treturn this._map.has(value);\n\t}\n\n\tentries(): IterableIterator<[URI, URI]> {\n\t\treturn this._map.entries();\n\t}\n\n\tkeys(): IterableIterator<URI> {\n\t\treturn this._map.keys();\n\t}\n\n\tvalues(): IterableIterator<URI> {\n\t\treturn this._map.keys();\n\t}\n\n\t[Symbol.iterator](): IterableIterator<URI> {\n\t\treturn this.keys();\n\t}\n}\n\n\ninterface Item<K, V> {\n\tprevious: Item<K, V> | undefined;\n\tnext: Item<K, V> | undefined;\n\tkey: K;\n\tvalue: V;\n}\n\nexport const enum Touch {\n\tNone = 0,\n\tAsOld = 1,\n\tAsNew = 2\n}\n\nexport class LinkedMap<K, V> implements Map<K, V> {\n\n\treadonly [Symbol.toStringTag] = 'LinkedMap';\n\n\tprivate _map: Map<K, Item<K, V>>;\n\tprivate _head: Item<K, V> | undefined;\n\tprivate _tail: Item<K, V> | undefined;\n\tprivate _size: number;\n\n\tprivate _state: number;\n\n\tconstructor() {\n\t\tthis._map = new Map<K, Item<K, V>>();\n\t\tthis._head = undefined;\n\t\tthis._tail = undefined;\n\t\tthis._size = 0;\n\t\tthis._state = 0;\n\t}\n\n\tclear(): void {\n\t\tthis._map.clear();\n\t\tthis._head = undefined;\n\t\tthis._tail = undefined;\n\t\tthis._size = 0;\n\t\tthis._state++;\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn !this._head && !this._tail;\n\t}\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tget first(): V | undefined {\n\t\treturn this._head?.value;\n\t}\n\n\tget last(): V | undefined {\n\t\treturn this._tail?.value;\n\t}\n\n\thas(key: K): boolean {\n\t\treturn this._map.has(key);\n\t}\n\n\tget(key: K, touch: Touch = Touch.None): V | undefined {\n\t\tconst item = this._map.get(key);\n\t\tif (!item) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (touch !== Touch.None) {\n\t\t\tthis.touch(item, touch);\n\t\t}\n\t\treturn item.value;\n\t}\n\n\tset(key: K, value: V, touch: Touch = Touch.None): this {\n\t\tlet item = this._map.get(key);\n\t\tif (item) {\n\t\t\titem.value = value;\n\t\t\tif (touch !== Touch.None) {\n\t\t\t\tthis.touch(item, touch);\n\t\t\t}\n\t\t} else {\n\t\t\titem = { key, value, next: undefined, previous: undefined };\n\t\t\tswitch (touch) {\n\t\t\t\tcase Touch.None:\n\t\t\t\t\tthis.addItemLast(item);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Touch.AsOld:\n\t\t\t\t\tthis.addItemFirst(item);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Touch.AsNew:\n\t\t\t\t\tthis.addItemLast(item);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthis.addItemLast(item);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis._map.set(key, item);\n\t\t\tthis._size++;\n\t\t}\n\t\treturn this;\n\t}\n\n\tdelete(key: K): boolean {\n\t\treturn !!this.remove(key);\n\t}\n\n\tremove(key: K): V | undefined {\n\t\tconst item = this._map.get(key);\n\t\tif (!item) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthis._map.delete(key);\n\t\tthis.removeItem(item);\n\t\tthis._size--;\n\t\treturn item.value;\n\t}\n\n\tshift(): V | undefined {\n\t\tif (!this._head && !this._tail) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (!this._head || !this._tail) {\n\t\t\tthrow new Error('Invalid list');\n\t\t}\n\t\tconst item = this._head;\n\t\tthis._map.delete(item.key);\n\t\tthis.removeItem(item);\n\t\tthis._size--;\n\t\treturn item.value;\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: LinkedMap<K, V>) => void, thisArg?: any): void {\n\t\tconst state = this._state;\n\t\tlet current = this._head;\n\t\twhile (current) {\n\t\t\tif (thisArg) {\n\t\t\t\tcallbackfn.bind(thisArg)(current.value, current.key, this);\n\t\t\t} else {\n\t\t\t\tcallbackfn(current.value, current.key, this);\n\t\t\t}\n\t\t\tif (this._state !== state) {\n\t\t\t\tthrow new Error(`LinkedMap got modified during iteration.`);\n\t\t\t}\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\tkeys(): IterableIterator<K> {\n\t\tconst map = this;\n\t\tconst state = this._state;\n\t\tlet current = this._head;\n\t\tconst iterator: IterableIterator<K> = {\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn iterator;\n\t\t\t},\n\t\t\tnext(): IteratorResult<K> {\n\t\t\t\tif (map._state !== state) {\n\t\t\t\t\tthrow new Error(`LinkedMap got modified during iteration.`);\n\t\t\t\t}\n\t\t\t\tif (current) {\n\t\t\t\t\tconst result = { value: current.key, done: false };\n\t\t\t\t\tcurrent = current.next;\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\treturn { value: undefined, done: true };\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treturn iterator;\n\t}\n\n\tvalues(): IterableIterator<V> {\n\t\tconst map = this;\n\t\tconst state = this._state;\n\t\tlet current = this._head;\n\t\tconst iterator: IterableIterator<V> = {\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn iterator;\n\t\t\t},\n\t\t\tnext(): IteratorResult<V> {\n\t\t\t\tif (map._state !== state) {\n\t\t\t\t\tthrow new Error(`LinkedMap got modified during iteration.`);\n\t\t\t\t}\n\t\t\t\tif (current) {\n\t\t\t\t\tconst result = { value: current.value, done: false };\n\t\t\t\t\tcurrent = current.next;\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\treturn { value: undefined, done: true };\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treturn iterator;\n\t}\n\n\tentries(): IterableIterator<[K, V]> {\n\t\tconst map = this;\n\t\tconst state = this._state;\n\t\tlet current = this._head;\n\t\tconst iterator: IterableIterator<[K, V]> = {\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn iterator;\n\t\t\t},\n\t\t\tnext(): IteratorResult<[K, V]> {\n\t\t\t\tif (map._state !== state) {\n\t\t\t\t\tthrow new Error(`LinkedMap got modified during iteration.`);\n\t\t\t\t}\n\t\t\t\tif (current) {\n\t\t\t\t\tconst result: IteratorResult<[K, V]> = { value: [current.key, current.value], done: false };\n\t\t\t\t\tcurrent = current.next;\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\treturn { value: undefined, done: true };\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n\n\tprotected trimOld(newSize: number) {\n\t\tif (newSize >= this.size) {\n\t\t\treturn;\n\t\t}\n\t\tif (newSize === 0) {\n\t\t\tthis.clear();\n\t\t\treturn;\n\t\t}\n\t\tlet current = this._head;\n\t\tlet currentSize = this.size;\n\t\twhile (current && currentSize > newSize) {\n\t\t\tthis._map.delete(current.key);\n\t\t\tcurrent = current.next;\n\t\t\tcurrentSize--;\n\t\t}\n\t\tthis._head = current;\n\t\tthis._size = currentSize;\n\t\tif (current) {\n\t\t\tcurrent.previous = undefined;\n\t\t}\n\t\tthis._state++;\n\t}\n\n\tprotected trimNew(newSize: number) {\n\t\tif (newSize >= this.size) {\n\t\t\treturn;\n\t\t}\n\t\tif (newSize === 0) {\n\t\t\tthis.clear();\n\t\t\treturn;\n\t\t}\n\t\tlet current = this._tail;\n\t\tlet currentSize = this.size;\n\t\twhile (current && currentSize > newSize) {\n\t\t\tthis._map.delete(current.key);\n\t\t\tcurrent = current.previous;\n\t\t\tcurrentSize--;\n\t\t}\n\t\tthis._tail = current;\n\t\tthis._size = currentSize;\n\t\tif (current) {\n\t\t\tcurrent.next = undefined;\n\t\t}\n\t\tthis._state++;\n\t}\n\n\tprivate addItemFirst(item: Item<K, V>): void {\n\t\t// First time Insert\n\t\tif (!this._head && !this._tail) {\n\t\t\tthis._tail = item;\n\t\t} else if (!this._head) {\n\t\t\tthrow new Error('Invalid list');\n\t\t} else {\n\t\t\titem.next = this._head;\n\t\t\tthis._head.previous = item;\n\t\t}\n\t\tthis._head = item;\n\t\tthis._state++;\n\t}\n\n\tprivate addItemLast(item: Item<K, V>): void {\n\t\t// First time Insert\n\t\tif (!this._head && !this._tail) {\n\t\t\tthis._head = item;\n\t\t} else if (!this._tail) {\n\t\t\tthrow new Error('Invalid list');\n\t\t} else {\n\t\t\titem.previous = this._tail;\n\t\t\tthis._tail.next = item;\n\t\t}\n\t\tthis._tail = item;\n\t\tthis._state++;\n\t}\n\n\tprivate removeItem(item: Item<K, V>): void {\n\t\tif (item === this._head && item === this._tail) {\n\t\t\tthis._head = undefined;\n\t\t\tthis._tail = undefined;\n\t\t}\n\t\telse if (item === this._head) {\n\t\t\t// This can only happen if size === 1 which is handled\n\t\t\t// by the case above.\n\t\t\tif (!item.next) {\n\t\t\t\tthrow new Error('Invalid list');\n\t\t\t}\n\t\t\titem.next.previous = undefined;\n\t\t\tthis._head = item.next;\n\t\t}\n\t\telse if (item === this._tail) {\n\t\t\t// This can only happen if size === 1 which is handled\n\t\t\t// by the case above.\n\t\t\tif (!item.previous) {\n\t\t\t\tthrow new Error('Invalid list');\n\t\t\t}\n\t\t\titem.previous.next = undefined;\n\t\t\tthis._tail = item.previous;\n\t\t}\n\t\telse {\n\t\t\tconst next = item.next;\n\t\t\tconst previous = item.previous;\n\t\t\tif (!next || !previous) {\n\t\t\t\tthrow new Error('Invalid list');\n\t\t\t}\n\t\t\tnext.previous = previous;\n\t\t\tprevious.next = next;\n\t\t}\n\t\titem.next = undefined;\n\t\titem.previous = undefined;\n\t\tthis._state++;\n\t}\n\n\tprivate touch(item: Item<K, V>, touch: Touch): void {\n\t\tif (!this._head || !this._tail) {\n\t\t\tthrow new Error('Invalid list');\n\t\t}\n\t\tif ((touch !== Touch.AsOld && touch !== Touch.AsNew)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (touch === Touch.AsOld) {\n\t\t\tif (item === this._head) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = item.next;\n\t\t\tconst previous = item.previous;\n\n\t\t\t// Unlink the item\n\t\t\tif (item === this._tail) {\n\t\t\t\t// previous must be defined since item was not head but is tail\n\t\t\t\t// So there are more than on item in the map\n\t\t\t\tprevious!.next = undefined;\n\t\t\t\tthis._tail = previous;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Both next and previous are not undefined since item was neither head nor tail.\n\t\t\t\tnext!.previous = previous;\n\t\t\t\tprevious!.next = next;\n\t\t\t}\n\n\t\t\t// Insert the node at head\n\t\t\titem.previous = undefined;\n\t\t\titem.next = this._head;\n\t\t\tthis._head.previous = item;\n\t\t\tthis._head = item;\n\t\t\tthis._state++;\n\t\t} else if (touch === Touch.AsNew) {\n\t\t\tif (item === this._tail) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = item.next;\n\t\t\tconst previous = item.previous;\n\n\t\t\t// Unlink the item.\n\t\t\tif (item === this._head) {\n\t\t\t\t// next must be defined since item was not tail but is head\n\t\t\t\t// So there are more than on item in the map\n\t\t\t\tnext!.previous = undefined;\n\t\t\t\tthis._head = next;\n\t\t\t} else {\n\t\t\t\t// Both next and previous are not undefined since item was neither head nor tail.\n\t\t\t\tnext!.previous = previous;\n\t\t\t\tprevious!.next = next;\n\t\t\t}\n\t\t\titem.next = undefined;\n\t\t\titem.previous = this._tail;\n\t\t\tthis._tail.next = item;\n\t\t\tthis._tail = item;\n\t\t\tthis._state++;\n\t\t}\n\t}\n\n\ttoJSON(): [K, V][] {\n\t\tconst data: [K, V][] = [];\n\n\t\tthis.forEach((value, key) => {\n\t\t\tdata.push([key, value]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\tfromJSON(data: [K, V][]): void {\n\t\tthis.clear();\n\n\t\tfor (const [key, value] of data) {\n\t\t\tthis.set(key, value);\n\t\t}\n\t}\n}\n\nabstract class Cache<K, V> extends LinkedMap<K, V> {\n\n\tprotected _limit: number;\n\tprotected _ratio: number;\n\n\tconstructor(limit: number, ratio: number = 1) {\n\t\tsuper();\n\t\tthis._limit = limit;\n\t\tthis._ratio = Math.min(Math.max(0, ratio), 1);\n\t}\n\n\tget limit(): number {\n\t\treturn this._limit;\n\t}\n\n\tset limit(limit: number) {\n\t\tthis._limit = limit;\n\t\tthis.checkTrim();\n\t}\n\n\tget ratio(): number {\n\t\treturn this._ratio;\n\t}\n\n\tset ratio(ratio: number) {\n\t\tthis._ratio = Math.min(Math.max(0, ratio), 1);\n\t\tthis.checkTrim();\n\t}\n\n\toverride get(key: K, touch: Touch = Touch.AsNew): V | undefined {\n\t\treturn super.get(key, touch);\n\t}\n\n\tpeek(key: K): V | undefined {\n\t\treturn super.get(key, Touch.None);\n\t}\n\n\toverride set(key: K, value: V): this {\n\t\tsuper.set(key, value, Touch.AsNew);\n\t\treturn this;\n\t}\n\n\tprotected checkTrim() {\n\t\tif (this.size > this._limit) {\n\t\t\tthis.trim(Math.round(this._limit * this._ratio));\n\t\t}\n\t}\n\n\tprotected abstract trim(newSize: number): void;\n}\n\nexport class LRUCache<K, V> extends Cache<K, V> {\n\n\tconstructor(limit: number, ratio: number = 1) {\n\t\tsuper(limit, ratio);\n\t}\n\n\tprotected override trim(newSize: number) {\n\t\tthis.trimOld(newSize);\n\t}\n\n\toverride set(key: K, value: V): this {\n\t\tsuper.set(key, value);\n\t\tthis.checkTrim();\n\t\treturn this;\n\t}\n}\n\nexport class MRUCache<K, V> extends Cache<K, V> {\n\n\tconstructor(limit: number, ratio: number = 1) {\n\t\tsuper(limit, ratio);\n\t}\n\n\tprotected override trim(newSize: number) {\n\t\tthis.trimNew(newSize);\n\t}\n\n\toverride set(key: K, value: V): this {\n\t\tif (this._limit <= this.size && !this.has(key)) {\n\t\t\tthis.trim(Math.round(this._limit * this._ratio) - 1);\n\t\t}\n\n\t\tsuper.set(key, value);\n\t\treturn this;\n\t}\n}\n\nexport class CounterSet<T> {\n\n\tprivate map = new Map<T, number>();\n\n\tadd(value: T): CounterSet<T> {\n\t\tthis.map.set(value, (this.map.get(value) || 0) + 1);\n\t\treturn this;\n\t}\n\n\tdelete(value: T): boolean {\n\t\tlet counter = this.map.get(value) || 0;\n\n\t\tif (counter === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tcounter--;\n\n\t\tif (counter === 0) {\n\t\t\tthis.map.delete(value);\n\t\t} else {\n\t\t\tthis.map.set(value, counter);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this.map.has(value);\n\t}\n}\n\n/**\n * A map that allows access both by keys and values.\n * **NOTE**: values need to be unique.\n */\nexport class BidirectionalMap<K, V> {\n\n\tprivate readonly _m1 = new Map<K, V>();\n\tprivate readonly _m2 = new Map<V, K>();\n\n\tconstructor(entries?: readonly (readonly [K, V])[]) {\n\t\tif (entries) {\n\t\t\tfor (const [key, value] of entries) {\n\t\t\t\tthis.set(key, value);\n\t\t\t}\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._m1.clear();\n\t\tthis._m2.clear();\n\t}\n\n\tset(key: K, value: V): void {\n\t\tthis._m1.set(key, value);\n\t\tthis._m2.set(value, key);\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn this._m1.get(key);\n\t}\n\n\tgetKey(value: V): K | undefined {\n\t\treturn this._m2.get(value);\n\t}\n\n\tdelete(key: K): boolean {\n\t\tconst value = this._m1.get(key);\n\t\tif (value === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._m1.delete(key);\n\t\tthis._m2.delete(value);\n\t\treturn true;\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: BidirectionalMap<K, V>) => void, thisArg?: any): void {\n\t\tthis._m1.forEach((value, key) => {\n\t\t\tcallbackfn.call(thisArg, value, key, this);\n\t\t});\n\t}\n\n\tkeys(): IterableIterator<K> {\n\t\treturn this._m1.keys();\n\t}\n\n\tvalues(): IterableIterator<V> {\n\t\treturn this._m1.values();\n\t}\n}\n\nexport class SetMap<K, V> {\n\n\tprivate map = new Map<K, Set<V>>();\n\n\tadd(key: K, value: V): void {\n\t\tlet values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\tvalues = new Set<V>();\n\t\t\tthis.map.set(key, values);\n\t\t}\n\n\t\tvalues.add(value);\n\t}\n\n\tdelete(key: K, value: V): void {\n\t\tconst values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalues.delete(value);\n\n\t\tif (values.size === 0) {\n\t\t\tthis.map.delete(key);\n\t\t}\n\t}\n\n\tforEach(key: K, fn: (value: V) => void): void {\n\t\tconst values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalues.forEach(fn);\n\t}\n\n\tget(key: K): ReadonlySet<V> {\n\t\tconst values = this.map.get(key);\n\t\tif (!values) {\n\t\t\treturn new Set<V>();\n\t\t}\n\t\treturn values;\n\t}\n}\n\nexport function mapsStrictEqualIgnoreOrder(a: Map<unknown, unknown>, b: Map<unknown, unknown>): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t}\n\n\tif (a.size !== b.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [key, value] of a) {\n\t\tif (!b.has(key) || b.get(key) !== value) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfor (const [key] of b) {\n\t\tif (!a.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * A map that is addressable with an arbitrary number of keys. This is useful in high performance\n * scenarios where creating a composite key whenever the data is accessed is too expensive. For\n * example for a very hot function, constructing a string like `first-second-third` for every call\n * will cause a significant hit to performance.\n */\nexport class NKeyMap<TValue, TKeys extends (string | boolean | number)[]> {\n\tprivate _data: Map<any, any> = new Map();\n\n\t/**\n\t * Sets a value on the map. Note that unlike a standard `Map`, the first argument is the value.\n\t * This is because the spread operator is used for the keys and must be last..\n\t * @param value The value to set.\n\t * @param keys The keys for the value.\n\t */\n\tpublic set(value: TValue, ...keys: [...TKeys]): void {\n\t\tlet currentMap = this._data;\n\t\tfor (let i = 0; i < keys.length - 1; i++) {\n\t\t\tif (!currentMap.has(keys[i])) {\n\t\t\t\tcurrentMap.set(keys[i], new Map());\n\t\t\t}\n\t\t\tcurrentMap = currentMap.get(keys[i]);\n\t\t}\n\t\tcurrentMap.set(keys[keys.length - 1], value);\n\t}\n\n\tpublic get(...keys: [...TKeys]): TValue | undefined {\n\t\tlet currentMap = this._data;\n\t\tfor (let i = 0; i < keys.length - 1; i++) {\n\t\t\tif (!currentMap.has(keys[i])) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tcurrentMap = currentMap.get(keys[i]);\n\t\t}\n\t\treturn currentMap.get(keys[keys.length - 1]);\n\t}\n\n\tpublic clear(): void {\n\t\tthis._data.clear();\n\t}\n\n\tpublic *values(): IterableIterator<TValue> {\n\t\tfunction* iterate(map: Map<any, any>): IterableIterator<TValue> {\n\t\t\tfor (const value of map.values()) {\n\t\t\t\tif (value instanceof Map) {\n\t\t\t\t\tyield* iterate(value);\n\t\t\t\t} else {\n\t\t\t\t\tyield value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tyield* iterate(this._data);\n\t}\n\n\t/**\n\t * Get a textual representation of the map for debugging purposes.\n\t */\n\tpublic toString(): string {\n\t\tconst printMap = (map: Map<any, any>, depth: number): string => {\n\t\t\tlet result = '';\n\t\t\tfor (const [key, value] of map) {\n\t\t\t\tresult += `${'  '.repeat(depth)}${key}: `;\n\t\t\t\tif (value instanceof Map) {\n\t\t\t\t\tresult += '\\n' + printMap(value, depth + 1);\n\t\t\t\t} else {\n\t\t\t\t\tresult += `${value}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\n\t\treturn printMap(this._data, 0);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError, onUnexpectedError } from './errors.js';\n\n/**\n * Throws an error with the provided message if the provided value does not evaluate to a true Javascript value.\n *\n * @deprecated Use `assert(...)` instead.\n * This method is usually used like this:\n * ```ts\n * import * as assert from 'vs/base/common/assert';\n * assert.ok(...);\n * ```\n *\n * However, `assert` in that example is a user chosen name.\n * There is no tooling for generating such an import statement.\n * Thus, the `assert(...)` function should be used instead.\n */\nexport function ok(value?: unknown, message?: string) {\n\tif (!value) {\n\t\tthrow new Error(message ? `Assertion failed (${message})` : 'Assertion Failed');\n\t}\n}\n\nexport function assertNever(value: never, message = 'Unreachable'): never {\n\tthrow new Error(message);\n}\n\n/**\n * Asserts that a condition is `truthy`.\n *\n * @throws provided {@linkcode messageOrError} if the {@linkcode condition} is `falsy`.\n *\n * @param condition The condition to assert.\n * @param messageOrError An error message or error object to throw if condition is `falsy`.\n */\nexport function assert(\n\tcondition: boolean,\n\tmessageOrError: string | Error = 'unexpected state',\n): asserts condition {\n\tif (!condition) {\n\t\t// if error instance is provided, use it, otherwise create a new one\n\t\tconst errorToThrow = typeof messageOrError === 'string'\n\t\t\t? new BugIndicatingError(`Assertion Failed: ${messageOrError}`)\n\t\t\t: messageOrError;\n\n\t\tthrow errorToThrow;\n\t}\n}\n\n/**\n * Like assert, but doesn't throw.\n */\nexport function softAssert(condition: boolean, message = 'Soft Assertion Failed'): void {\n\tif (!condition) {\n\t\tonUnexpectedError(new BugIndicatingError(message));\n\t}\n}\n\n/**\n * condition must be side-effect free!\n */\nexport function assertFn(condition: () => boolean): void {\n\tif (!condition()) {\n\t\t// eslint-disable-next-line no-debugger\n\t\tdebugger;\n\t\t// Reevaluate `condition` again to make debugging easier\n\t\tcondition();\n\t\tonUnexpectedError(new BugIndicatingError('Assertion Failed'));\n\t}\n}\n\nexport function checkAdjacentItems<T>(items: readonly T[], predicate: (item1: T, item2: T) => boolean): boolean {\n\tlet i = 0;\n\twhile (i < items.length - 1) {\n\t\tconst a = items[i];\n\t\tconst b = items[i + 1];\n\t\tif (!predicate(a, b)) {\n\t\t\treturn false;\n\t\t}\n\t\ti++;\n\t}\n\treturn true;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { assert } from './assert.js';\n\n/**\n * @returns whether the provided parameter is a JavaScript String or not.\n */\nexport function isString(str: unknown): str is string {\n\treturn (typeof str === 'string');\n}\n\n/**\n * @returns whether the provided parameter is a JavaScript Array and each element in the array is a string.\n */\nexport function isStringArray(value: unknown): value is string[] {\n\treturn Array.isArray(value) && (<unknown[]>value).every(elem => isString(elem));\n}\n\n/**\n * @returns whether the provided parameter is of type `object` but **not**\n *\t`null`, an `array`, a `regexp`, nor a `date`.\n */\nexport function isObject(obj: unknown): obj is Object {\n\t// The method can't do a type cast since there are type (like strings) which\n\t// are subclasses of any put not positvely matched by the function. Hence type\n\t// narrowing results in wrong results.\n\treturn typeof obj === 'object'\n\t\t&& obj !== null\n\t\t&& !Array.isArray(obj)\n\t\t&& !(obj instanceof RegExp)\n\t\t&& !(obj instanceof Date);\n}\n\n/**\n * @returns whether the provided parameter is of type `Buffer` or Uint8Array dervived type\n */\nexport function isTypedArray(obj: unknown): obj is Object {\n\tconst TypedArray = Object.getPrototypeOf(Uint8Array);\n\treturn typeof obj === 'object'\n\t\t&& obj instanceof TypedArray;\n}\n\n/**\n * In **contrast** to just checking `typeof` this will return `false` for `NaN`.\n * @returns whether the provided parameter is a JavaScript Number or not.\n */\nexport function isNumber(obj: unknown): obj is number {\n\treturn (typeof obj === 'number' && !isNaN(obj));\n}\n\n/**\n * @returns whether the provided parameter is an Iterable, casting to the given generic\n */\nexport function isIterable<T>(obj: unknown): obj is Iterable<T> {\n\treturn !!obj && typeof (obj as any)[Symbol.iterator] === 'function';\n}\n\n/**\n * @returns whether the provided parameter is an Iterable, casting to the given generic\n */\nexport function isAsyncIterable<T>(obj: unknown): obj is AsyncIterable<T> {\n\treturn !!obj && typeof (obj as any)[Symbol.asyncIterator] === 'function';\n}\n\n/**\n * @returns whether the provided parameter is a JavaScript Boolean or not.\n */\nexport function isBoolean(obj: unknown): obj is boolean {\n\treturn (obj === true || obj === false);\n}\n\n/**\n * @returns whether the provided parameter is undefined.\n */\nexport function isUndefined(obj: unknown): obj is undefined {\n\treturn (typeof obj === 'undefined');\n}\n\n/**\n * @returns whether the provided parameter is defined.\n */\nexport function isDefined<T>(arg: T | null | undefined): arg is T {\n\treturn !isUndefinedOrNull(arg);\n}\n\n/**\n * @returns whether the provided parameter is undefined or null.\n */\nexport function isUndefinedOrNull(obj: unknown): obj is undefined | null {\n\treturn (isUndefined(obj) || obj === null);\n}\n\n\nexport function assertType(condition: unknown, type?: string): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(type ? `Unexpected type, expected '${type}'` : 'Unexpected type');\n\t}\n}\n\n/**\n * Asserts that the argument passed in is neither undefined nor null.\n *\n * @see {@link assertDefined} for a similar utility that leverages TS assertion functions to narrow down the type of `arg` to be non-nullable.\n */\nexport function assertReturnsDefined<T>(arg: T | null | undefined): NonNullable<T> {\n\tassert(\n\t\targ !== null && arg !== undefined,\n\t\t'Argument is `undefined` or `null`.',\n\t);\n\n\treturn arg;\n}\n\n/**\n * Asserts that a provided `value` is `defined` - not `null` or `undefined`,\n * throwing an error with the provided error or error message, while also\n * narrowing down the type of the `value` to be `NonNullable` using TS\n * assertion functions.\n *\n * @throws if the provided `value` is `null` or `undefined`.\n *\n * ## Examples\n *\n * ```typescript\n * // an assert with an error message\n * assertDefined('some value', 'String constant is not defined o_O.');\n *\n * // `throws!` the provided error\n * assertDefined(null, new Error('Should throw this error.'));\n *\n * // narrows down the type of `someValue` to be non-nullable\n * const someValue: string | undefined | null = blackbox();\n * assertDefined(someValue, 'Some value must be defined.');\n * console.log(someValue.length); // now type of `someValue` is `string`\n * ```\n *\n * @see {@link assertReturnsDefined} for a similar utility but without assertion.\n * @see {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions typescript-3-7.html#assertion-functions}\n */\nexport function assertDefined<T>(value: T, error: string | NonNullable<Error>): asserts value is NonNullable<T> {\n\tif (value === null || value === undefined) {\n\t\tconst errorToThrow = typeof error === 'string' ? new Error(error) : error;\n\n\t\tthrow errorToThrow;\n\t}\n}\n\n/**\n * Asserts that each argument passed in is neither undefined nor null.\n */\nexport function assertReturnsAllDefined<T1, T2>(t1: T1 | null | undefined, t2: T2 | null | undefined): [T1, T2];\nexport function assertReturnsAllDefined<T1, T2, T3>(t1: T1 | null | undefined, t2: T2 | null | undefined, t3: T3 | null | undefined): [T1, T2, T3];\nexport function assertReturnsAllDefined<T1, T2, T3, T4>(t1: T1 | null | undefined, t2: T2 | null | undefined, t3: T3 | null | undefined, t4: T4 | null | undefined): [T1, T2, T3, T4];\nexport function assertReturnsAllDefined(...args: (unknown | null | undefined)[]): unknown[] {\n\tconst result = [];\n\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\n\t\tif (isUndefinedOrNull(arg)) {\n\t\t\tthrow new Error(`Assertion Failed: argument at index ${i} is undefined or null`);\n\t\t}\n\n\t\tresult.push(arg);\n\t}\n\n\treturn result;\n}\n\n/**\n * Checks if the provided value is one of the vales in the provided list.\n *\n * ## Examples\n *\n * ```typescript\n * // note! item type is a `subset of string`\n * type TItem = ':' | '.' | '/';\n *\n * // note! item is type of `string` here\n * const item: string = ':';\n * // list of the items to check against\n * const list: TItem[] = [':', '.'];\n *\n * // ok\n * assert(\n *   isOneOf(item, list),\n *   'Must succeed.',\n * );\n *\n * // `item` is of `TItem` type now\n * ```\n */\nexport const isOneOf = <TType, TSubtype extends TType>(\n\tvalue: TType,\n\tvalidValues: readonly TSubtype[],\n): value is TSubtype => {\n\t// note! it is OK to type cast here, because we rely on the includes\n\t//       utility to check if the value is present in the provided list\n\treturn validValues.includes(<TSubtype>value);\n};\n\n/**\n * Compile-time type check of a variable.\n */\nexport function typeCheck<T = never>(_thing: NoInfer<T>): void { }\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * @returns whether the provided parameter is an empty JavaScript Object or not.\n */\nexport function isEmptyObject(obj: unknown): obj is object {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\n\tfor (const key in obj) {\n\t\tif (hasOwnProperty.call(obj, key)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * @returns whether the provided parameter is a JavaScript Function or not.\n */\nexport function isFunction(obj: unknown): obj is Function {\n\treturn (typeof obj === 'function');\n}\n\n/**\n * @returns whether the provided parameters is are JavaScript Function or not.\n */\nexport function areFunctions(...objects: unknown[]): boolean {\n\treturn objects.length > 0 && objects.every(isFunction);\n}\n\nexport type TypeConstraint = string | Function;\n\nexport function validateConstraints(args: unknown[], constraints: Array<TypeConstraint | undefined>): void {\n\tconst len = Math.min(args.length, constraints.length);\n\tfor (let i = 0; i < len; i++) {\n\t\tvalidateConstraint(args[i], constraints[i]);\n\t}\n}\n\nexport function validateConstraint(arg: unknown, constraint: TypeConstraint | undefined): void {\n\n\tif (isString(constraint)) {\n\t\tif (typeof arg !== constraint) {\n\t\t\tthrow new Error(`argument does not match constraint: typeof ${constraint}`);\n\t\t}\n\t} else if (isFunction(constraint)) {\n\t\ttry {\n\t\t\tif (arg instanceof constraint) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t\tif (!isUndefinedOrNull(arg) && (arg as any).constructor === constraint) {\n\t\t\treturn;\n\t\t}\n\t\tif (constraint.length === 1 && constraint.call(undefined, arg) === true) {\n\t\t\treturn;\n\t\t}\n\t\tthrow new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);\n\t}\n}\n\n/**\n * Helper type assertion that safely upcasts a type to a supertype.\n *\n * This can be used to make sure the argument correctly conforms to the subtype while still being able to pass it\n * to contexts that expects the supertype.\n */\nexport function upcast<Base, Sub extends Base = Base>(x: Sub): Base {\n\treturn x;\n}\n\ntype AddFirstParameterToFunction<T, TargetFunctionsReturnType, FirstParameter> = T extends (...args: any[]) => TargetFunctionsReturnType ?\n\t// Function: add param to function\n\t(firstArg: FirstParameter, ...args: Parameters<T>) => ReturnType<T> :\n\n\t// Else: just leave as is\n\tT;\n\n/**\n * Allows to add a first parameter to functions of a type.\n */\nexport type AddFirstParameterToFunctions<Target, TargetFunctionsReturnType, FirstParameter> = {\n\t// For every property\n\t[K in keyof Target]: AddFirstParameterToFunction<Target[K], TargetFunctionsReturnType, FirstParameter>;\n};\n\n/**\n * Given an object with all optional properties, requires at least one to be defined.\n * i.e. AtLeastOne<MyObject>;\n */\nexport type AtLeastOne<T, U = { [K in keyof T]: Pick<T, K> }> = Partial<T> & U[keyof U];\n\n/**\n * Only picks the non-optional properties of a type.\n */\nexport type OmitOptional<T> = { [K in keyof T as T[K] extends Required<T>[K] ? K : never]: T[K] };\n\n/**\n * A type that removed readonly-less from all properties of `T`\n */\nexport type Mutable<T> = {\n\t-readonly [P in keyof T]: T[P]\n};\n\n/**\n * A single object or an array of the objects.\n */\nexport type SingleOrMany<T> = T | T[];\n\n\n/**\n * A type that recursively makes all properties of `T` required\n */\nexport type DeepRequiredNonNullable<T> = {\n\t[P in keyof T]-?: T[P] extends object ? DeepRequiredNonNullable<T[P]> : Required<NonNullable<T[P]>>;\n};\n\n\n/**\n * Represents a type that is a partial version of a given type `T`, where all properties are optional and can be deeply nested.\n */\nexport type DeepPartial<T> = {\n\t[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : Partial<T[P]>;\n};\n\n/**\n * Represents a type that is a partial version of a given type `T`, except a subset.\n */\nexport type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { isIterable } from './types.js';\n\nexport namespace Iterable {\n\n\texport function is<T = any>(thing: unknown): thing is Iterable<T> {\n\t\treturn !!thing && typeof thing === 'object' && typeof (thing as Iterable<T>)[Symbol.iterator] === 'function';\n\t}\n\n\tconst _empty: Iterable<any> = Object.freeze([]);\n\texport function empty<T = any>(): Iterable<T> {\n\t\treturn _empty;\n\t}\n\n\texport function* single<T>(element: T): Iterable<T> {\n\t\tyield element;\n\t}\n\n\texport function wrap<T>(iterableOrElement: Iterable<T> | T): Iterable<T> {\n\t\tif (is(iterableOrElement)) {\n\t\t\treturn iterableOrElement;\n\t\t} else {\n\t\t\treturn single(iterableOrElement);\n\t\t}\n\t}\n\n\texport function from<T>(iterable: Iterable<T> | undefined | null): Iterable<T> {\n\t\treturn iterable || _empty;\n\t}\n\n\texport function* reverse<T>(array: ReadonlyArray<T>): Iterable<T> {\n\t\tfor (let i = array.length - 1; i >= 0; i--) {\n\t\t\tyield array[i];\n\t\t}\n\t}\n\n\texport function isEmpty<T>(iterable: Iterable<T> | undefined | null): boolean {\n\t\treturn !iterable || iterable[Symbol.iterator]().next().done === true;\n\t}\n\n\texport function first<T>(iterable: Iterable<T>): T | undefined {\n\t\treturn iterable[Symbol.iterator]().next().value;\n\t}\n\n\texport function some<T>(iterable: Iterable<T>, predicate: (t: T, i: number) => unknown): boolean {\n\t\tlet i = 0;\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element, i++)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\texport function every<T>(iterable: Iterable<T>, predicate: (t: T, i: number) => unknown): boolean {\n\t\tlet i = 0;\n\t\tfor (const element of iterable) {\n\t\t\tif (!predicate(element, i++)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\texport function find<T, R extends T>(iterable: Iterable<T>, predicate: (t: T) => t is R): R | undefined;\n\texport function find<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): T | undefined;\n\texport function find<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): T | undefined {\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\texport function filter<T, R extends T>(iterable: Iterable<T>, predicate: (t: T) => t is R): Iterable<R>;\n\texport function filter<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): Iterable<T>;\n\texport function* filter<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): Iterable<T> {\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element)) {\n\t\t\t\tyield element;\n\t\t\t}\n\t\t}\n\t}\n\n\texport function* map<T, R>(iterable: Iterable<T>, fn: (t: T, index: number) => R): Iterable<R> {\n\t\tlet index = 0;\n\t\tfor (const element of iterable) {\n\t\t\tyield fn(element, index++);\n\t\t}\n\t}\n\n\texport function* flatMap<T, R>(iterable: Iterable<T>, fn: (t: T, index: number) => Iterable<R>): Iterable<R> {\n\t\tlet index = 0;\n\t\tfor (const element of iterable) {\n\t\t\tyield* fn(element, index++);\n\t\t}\n\t}\n\n\texport function* concat<T>(...iterables: (Iterable<T> | T)[]): Iterable<T> {\n\t\tfor (const item of iterables) {\n\t\t\tif (isIterable(item)) {\n\t\t\t\tyield* item;\n\t\t\t} else {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\texport function reduce<T, R>(iterable: Iterable<T>, reducer: (previousValue: R, currentValue: T) => R, initialValue: R): R {\n\t\tlet value = initialValue;\n\t\tfor (const element of iterable) {\n\t\t\tvalue = reducer(value, element);\n\t\t}\n\t\treturn value;\n\t}\n\n\texport function length<T>(iterable: Iterable<T>): number {\n\t\tlet count = 0;\n\t\tfor (const _ of iterable) {\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n\n\t/**\n\t * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\n\t */\n\texport function* slice<T>(arr: ReadonlyArray<T>, from: number, to = arr.length): Iterable<T> {\n\t\tif (from < -arr.length) {\n\t\t\tfrom = 0;\n\t\t}\n\t\tif (from < 0) {\n\t\t\tfrom += arr.length;\n\t\t}\n\n\t\tif (to < 0) {\n\t\t\tto += arr.length;\n\t\t} else if (to > arr.length) {\n\t\t\tto = arr.length;\n\t\t}\n\n\t\tfor (; from < to; from++) {\n\t\t\tyield arr[from];\n\t\t}\n\t}\n\n\t/**\n\t * Consumes `atMost` elements from iterable and returns the consumed elements,\n\t * and an iterable for the rest of the elements.\n\t */\n\texport function consume<T>(iterable: Iterable<T>, atMost: number = Number.POSITIVE_INFINITY): [T[], Iterable<T>] {\n\t\tconst consumed: T[] = [];\n\n\t\tif (atMost === 0) {\n\t\t\treturn [consumed, iterable];\n\t\t}\n\n\t\tconst iterator = iterable[Symbol.iterator]();\n\n\t\tfor (let i = 0; i < atMost; i++) {\n\t\t\tconst next = iterator.next();\n\n\t\t\tif (next.done) {\n\t\t\t\treturn [consumed, Iterable.empty()];\n\t\t\t}\n\n\t\t\tconsumed.push(next.value);\n\t\t}\n\n\t\treturn [consumed, { [Symbol.iterator]() { return iterator; } }];\n\t}\n\n\texport async function asyncToArray<T>(iterable: AsyncIterable<T>): Promise<T[]> {\n\t\tconst result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult.push(item);\n\t\t}\n\t\treturn result;\n\t}\n\n\texport async function asyncToArrayFlat<T>(iterable: AsyncIterable<T[]>): Promise<T[]> {\n\t\tlet result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult = result.concat(item);\n\t\t}\n\t\treturn result;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { compareBy, numberComparator } from './arrays.js';\nimport { groupBy } from './collections.js';\nimport { SetMap } from './map.js';\nimport { createSingleCallFunction } from './functional.js';\nimport { Iterable } from './iterator.js';\n\n// #region Disposable Tracking\n\n/**\n * Enables logging of potentially leaked disposables.\n *\n * A disposable is considered leaked if it is not disposed or not registered as the child of\n * another disposable. This tracking is very simple an only works for classes that either\n * extend Disposable or use a DisposableStore. This means there are a lot of false positives.\n */\nconst TRACK_DISPOSABLES = false;\nlet disposableTracker: IDisposableTracker | null = null;\n\nexport interface IDisposableTracker {\n\t/**\n\t * Is called on construction of a disposable.\n\t*/\n\ttrackDisposable(disposable: IDisposable): void;\n\n\t/**\n\t * Is called when a disposable is registered as child of another disposable (e.g. {@link DisposableStore}).\n\t * If parent is `null`, the disposable is removed from its former parent.\n\t*/\n\tsetParent(child: IDisposable, parent: IDisposable | null): void;\n\n\t/**\n\t * Is called after a disposable is disposed.\n\t*/\n\tmarkAsDisposed(disposable: IDisposable): void;\n\n\t/**\n\t * Indicates that the given object is a singleton which does not need to be disposed.\n\t*/\n\tmarkAsSingleton(disposable: IDisposable): void;\n}\n\nexport class GCBasedDisposableTracker implements IDisposableTracker {\n\n\tprivate readonly _registry = new FinalizationRegistry<string>(heldValue => {\n\t\tconsole.warn(`[LEAKED DISPOSABLE] ${heldValue}`);\n\t});\n\n\ttrackDisposable(disposable: IDisposable): void {\n\t\tconst stack = new Error('CREATED via:').stack!;\n\t\tthis._registry.register(disposable, stack, disposable);\n\t}\n\n\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\tif (parent) {\n\t\t\tthis._registry.unregister(child);\n\t\t} else {\n\t\t\tthis.trackDisposable(child);\n\t\t}\n\t}\n\n\tmarkAsDisposed(disposable: IDisposable): void {\n\t\tthis._registry.unregister(disposable);\n\t}\n\n\tmarkAsSingleton(disposable: IDisposable): void {\n\t\tthis._registry.unregister(disposable);\n\t}\n}\n\nexport interface DisposableInfo {\n\tvalue: IDisposable;\n\tsource: string | null;\n\tparent: IDisposable | null;\n\tisSingleton: boolean;\n\tidx: number;\n}\n\nexport class DisposableTracker implements IDisposableTracker {\n\tprivate static idx = 0;\n\n\tprivate readonly livingDisposables = new Map<IDisposable, DisposableInfo>();\n\n\tprivate getDisposableData(d: IDisposable): DisposableInfo {\n\t\tlet val = this.livingDisposables.get(d);\n\t\tif (!val) {\n\t\t\tval = { parent: null, source: null, isSingleton: false, value: d, idx: DisposableTracker.idx++ };\n\t\t\tthis.livingDisposables.set(d, val);\n\t\t}\n\t\treturn val;\n\t}\n\n\ttrackDisposable(d: IDisposable): void {\n\t\tconst data = this.getDisposableData(d);\n\t\tif (!data.source) {\n\t\t\tdata.source =\n\t\t\t\tnew Error().stack!;\n\t\t}\n\t}\n\n\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\tconst data = this.getDisposableData(child);\n\t\tdata.parent = parent;\n\t}\n\n\tmarkAsDisposed(x: IDisposable): void {\n\t\tthis.livingDisposables.delete(x);\n\t}\n\n\tmarkAsSingleton(disposable: IDisposable): void {\n\t\tthis.getDisposableData(disposable).isSingleton = true;\n\t}\n\n\tprivate getRootParent(data: DisposableInfo, cache: Map<DisposableInfo, DisposableInfo>): DisposableInfo {\n\t\tconst cacheValue = cache.get(data);\n\t\tif (cacheValue) {\n\t\t\treturn cacheValue;\n\t\t}\n\n\t\tconst result = data.parent ? this.getRootParent(this.getDisposableData(data.parent), cache) : data;\n\t\tcache.set(data, result);\n\t\treturn result;\n\t}\n\n\tgetTrackedDisposables(): IDisposable[] {\n\t\tconst rootParentCache = new Map<DisposableInfo, DisposableInfo>();\n\n\t\tconst leaking = [...this.livingDisposables.entries()]\n\t\t\t.filter(([, v]) => v.source !== null && !this.getRootParent(v, rootParentCache).isSingleton)\n\t\t\t.flatMap(([k]) => k);\n\n\t\treturn leaking;\n\t}\n\n\tcomputeLeakingDisposables(maxReported = 10, preComputedLeaks?: DisposableInfo[]): { leaks: DisposableInfo[]; details: string } | undefined {\n\t\tlet uncoveredLeakingObjs: DisposableInfo[] | undefined;\n\t\tif (preComputedLeaks) {\n\t\t\tuncoveredLeakingObjs = preComputedLeaks;\n\t\t} else {\n\t\t\tconst rootParentCache = new Map<DisposableInfo, DisposableInfo>();\n\n\t\t\tconst leakingObjects = [...this.livingDisposables.values()]\n\t\t\t\t.filter((info) => info.source !== null && !this.getRootParent(info, rootParentCache).isSingleton);\n\n\t\t\tif (leakingObjects.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst leakingObjsSet = new Set(leakingObjects.map(o => o.value));\n\n\t\t\t// Remove all objects that are a child of other leaking objects. Assumes there are no cycles.\n\t\t\tuncoveredLeakingObjs = leakingObjects.filter(l => {\n\t\t\t\treturn !(l.parent && leakingObjsSet.has(l.parent));\n\t\t\t});\n\n\t\t\tif (uncoveredLeakingObjs.length === 0) {\n\t\t\t\tthrow new Error('There are cyclic diposable chains!');\n\t\t\t}\n\t\t}\n\n\t\tif (!uncoveredLeakingObjs) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tfunction getStackTracePath(leaking: DisposableInfo): string[] {\n\t\t\tfunction removePrefix(array: string[], linesToRemove: (string | RegExp)[]) {\n\t\t\t\twhile (array.length > 0 && linesToRemove.some(regexp => typeof regexp === 'string' ? regexp === array[0] : array[0].match(regexp))) {\n\t\t\t\t\tarray.shift();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst lines = leaking.source!.split('\\n').map(p => p.trim().replace('at ', '')).filter(l => l !== '');\n\t\t\tremovePrefix(lines, ['Error', /^trackDisposable \\(.*\\)$/, /^DisposableTracker.trackDisposable \\(.*\\)$/]);\n\t\t\treturn lines.reverse();\n\t\t}\n\n\t\tconst stackTraceStarts = new SetMap<string, DisposableInfo>();\n\t\tfor (const leaking of uncoveredLeakingObjs) {\n\t\t\tconst stackTracePath = getStackTracePath(leaking);\n\t\t\tfor (let i = 0; i <= stackTracePath.length; i++) {\n\t\t\t\tstackTraceStarts.add(stackTracePath.slice(0, i).join('\\n'), leaking);\n\t\t\t}\n\t\t}\n\n\t\t// Put earlier leaks first\n\t\tuncoveredLeakingObjs.sort(compareBy(l => l.idx, numberComparator));\n\n\t\tlet message = '';\n\n\t\tlet i = 0;\n\t\tfor (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {\n\t\t\ti++;\n\t\t\tconst stackTracePath = getStackTracePath(leaking);\n\t\t\tconst stackTraceFormattedLines = [];\n\n\t\t\tfor (let i = 0; i < stackTracePath.length; i++) {\n\t\t\t\tlet line = stackTracePath[i];\n\t\t\t\tconst starts = stackTraceStarts.get(stackTracePath.slice(0, i + 1).join('\\n'));\n\t\t\t\tline = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;\n\n\t\t\t\tconst prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i).join('\\n'));\n\t\t\t\tconst continuations = groupBy([...prevStarts].map(d => getStackTracePath(d)[i]), v => v);\n\t\t\t\tdelete continuations[stackTracePath[i]];\n\t\t\t\tfor (const [cont, set] of Object.entries(continuations)) {\n\t\t\t\t\tstackTraceFormattedLines.unshift(`    - stacktraces of ${set.length} other leaks continue with ${cont}`);\n\t\t\t\t}\n\n\t\t\t\tstackTraceFormattedLines.unshift(line);\n\t\t\t}\n\n\t\t\tmessage += `\\n\\n\\n==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================\\n${stackTraceFormattedLines.join('\\n')}\\n============================================================\\n\\n`;\n\t\t}\n\n\t\tif (uncoveredLeakingObjs.length > maxReported) {\n\t\t\tmessage += `\\n\\n\\n... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables\\n\\n`;\n\t\t}\n\n\t\treturn { leaks: uncoveredLeakingObjs, details: message };\n\t}\n}\n\nexport function setDisposableTracker(tracker: IDisposableTracker | null): void {\n\tdisposableTracker = tracker;\n}\n\nif (TRACK_DISPOSABLES) {\n\tconst __is_disposable_tracked__ = '__is_disposable_tracked__';\n\tsetDisposableTracker(new class implements IDisposableTracker {\n\t\ttrackDisposable(x: IDisposable): void {\n\t\t\tconst stack = new Error('Potentially leaked disposable').stack!;\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (!(x as any)[__is_disposable_tracked__]) {\n\t\t\t\t\tconsole.log(stack);\n\t\t\t\t}\n\t\t\t}, 3000);\n\t\t}\n\n\t\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\t\tif (child && child !== Disposable.None) {\n\t\t\t\ttry {\n\t\t\t\t\t(child as any)[__is_disposable_tracked__] = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmarkAsDisposed(disposable: IDisposable): void {\n\t\t\tif (disposable && disposable !== Disposable.None) {\n\t\t\t\ttry {\n\t\t\t\t\t(disposable as any)[__is_disposable_tracked__] = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmarkAsSingleton(disposable: IDisposable): void { }\n\t});\n}\n\nexport function trackDisposable<T extends IDisposable>(x: T): T {\n\tdisposableTracker?.trackDisposable(x);\n\treturn x;\n}\n\nexport function markAsDisposed(disposable: IDisposable): void {\n\tdisposableTracker?.markAsDisposed(disposable);\n}\n\nfunction setParentOfDisposable(child: IDisposable, parent: IDisposable | null): void {\n\tdisposableTracker?.setParent(child, parent);\n}\n\nfunction setParentOfDisposables(children: IDisposable[], parent: IDisposable | null): void {\n\tif (!disposableTracker) {\n\t\treturn;\n\t}\n\tfor (const child of children) {\n\t\tdisposableTracker.setParent(child, parent);\n\t}\n}\n\n/**\n * Indicates that the given object is a singleton which does not need to be disposed.\n*/\nexport function markAsSingleton<T extends IDisposable>(singleton: T): T {\n\tdisposableTracker?.markAsSingleton(singleton);\n\treturn singleton;\n}\n\n// #endregion\n\n/**\n * An object that performs a cleanup operation when `.dispose()` is called.\n *\n * Some examples of how disposables are used:\n *\n * - An event listener that removes itself when `.dispose()` is called.\n * - A resource such as a file system watcher that cleans up the resource when `.dispose()` is called.\n * - The return value from registering a provider. When `.dispose()` is called, the provider is unregistered.\n */\nexport interface IDisposable {\n\tdispose(): void;\n}\n\n/**\n * Check if `thing` is {@link IDisposable disposable}.\n */\nexport function isDisposable<E extends any>(thing: E): thing is E & IDisposable {\n\treturn typeof thing === 'object' && thing !== null && typeof (<IDisposable><any>thing).dispose === 'function' && (<IDisposable><any>thing).dispose.length === 0;\n}\n\n/**\n * Disposes of the value(s) passed in.\n */\nexport function dispose<T extends IDisposable>(disposable: T): T;\nexport function dispose<T extends IDisposable>(disposable: T | undefined): T | undefined;\nexport function dispose<T extends IDisposable, A extends Iterable<T> = Iterable<T>>(disposables: A): A;\nexport function dispose<T extends IDisposable>(disposables: Array<T>): Array<T>;\nexport function dispose<T extends IDisposable>(disposables: ReadonlyArray<T>): ReadonlyArray<T>;\nexport function dispose<T extends IDisposable>(arg: T | Iterable<T> | undefined): any {\n\tif (Iterable.is(arg)) {\n\t\tconst errors: any[] = [];\n\n\t\tfor (const d of arg) {\n\t\t\tif (d) {\n\t\t\t\ttry {\n\t\t\t\t\td.dispose();\n\t\t\t\t} catch (e) {\n\t\t\t\t\terrors.push(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length === 1) {\n\t\t\tthrow errors[0];\n\t\t} else if (errors.length > 1) {\n\t\t\tthrow new AggregateError(errors, 'Encountered errors while disposing of store');\n\t\t}\n\n\t\treturn Array.isArray(arg) ? [] : arg;\n\t} else if (arg) {\n\t\targ.dispose();\n\t\treturn arg;\n\t}\n}\n\nexport function disposeIfDisposable<T extends IDisposable | object>(disposables: Array<T>): Array<T> {\n\tfor (const d of disposables) {\n\t\tif (isDisposable(d)) {\n\t\t\td.dispose();\n\t\t}\n\t}\n\treturn [];\n}\n\n/**\n * Combine multiple disposable values into a single {@link IDisposable}.\n */\nexport function combinedDisposable(...disposables: IDisposable[]): IDisposable {\n\tconst parent = toDisposable(() => dispose(disposables));\n\tsetParentOfDisposables(disposables, parent);\n\treturn parent;\n}\n\n/**\n * Turn a function that implements dispose into an {@link IDisposable}.\n *\n * @param fn Clean up function, guaranteed to be called only **once**.\n */\nexport function toDisposable(fn: () => void): IDisposable {\n\tconst self = trackDisposable({\n\t\tdispose: createSingleCallFunction(() => {\n\t\t\tmarkAsDisposed(self);\n\t\t\tfn();\n\t\t})\n\t});\n\treturn self;\n}\n\n/**\n * Manages a collection of disposable values.\n *\n * This is the preferred way to manage multiple disposables. A `DisposableStore` is safer to work with than an\n * `IDisposable[]` as it considers edge cases, such as registering the same value multiple times or adding an item to a\n * store that has already been disposed of.\n */\nexport class DisposableStore implements IDisposable {\n\n\tstatic DISABLE_DISPOSED_WARNING = false;\n\n\tprivate readonly _toDispose = new Set<IDisposable>();\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\t/**\n\t * Dispose of all registered disposables and mark this object as disposed.\n\t *\n\t * Any future disposables added to this object will be disposed of on `add`.\n\t */\n\tpublic dispose(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tmarkAsDisposed(this);\n\t\tthis._isDisposed = true;\n\t\tthis.clear();\n\t}\n\n\t/**\n\t * @return `true` if this object has been disposed of.\n\t */\n\tpublic get isDisposed(): boolean {\n\t\treturn this._isDisposed;\n\t}\n\n\t/**\n\t * Dispose of all registered disposables but do not mark this object as disposed.\n\t */\n\tpublic clear(): void {\n\t\tif (this._toDispose.size === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispose(this._toDispose);\n\t\t} finally {\n\t\t\tthis._toDispose.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Add a new {@link IDisposable disposable} to the collection.\n\t */\n\tpublic add<T extends IDisposable>(o: T): T {\n\t\tif (!o) {\n\t\t\treturn o;\n\t\t}\n\t\tif ((o as unknown as DisposableStore) === this) {\n\t\t\tthrow new Error('Cannot register a disposable on itself!');\n\t\t}\n\n\t\tsetParentOfDisposable(o, this);\n\t\tif (this._isDisposed) {\n\t\t\tif (!DisposableStore.DISABLE_DISPOSED_WARNING) {\n\t\t\t\tconsole.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._toDispose.add(o);\n\t\t}\n\n\t\treturn o;\n\t}\n\n\t/**\n\t * Deletes a disposable from store and disposes of it. This will not throw or warn and proceed to dispose the\n\t * disposable even when the disposable is not part in the store.\n\t */\n\tpublic delete<T extends IDisposable>(o: T): void {\n\t\tif (!o) {\n\t\t\treturn;\n\t\t}\n\t\tif ((o as unknown as DisposableStore) === this) {\n\t\t\tthrow new Error('Cannot dispose a disposable on itself!');\n\t\t}\n\t\tthis._toDispose.delete(o);\n\t\to.dispose();\n\t}\n\n\t/**\n\t * Deletes the value from the store, but does not dispose it.\n\t */\n\tpublic deleteAndLeak<T extends IDisposable>(o: T): void {\n\t\tif (!o) {\n\t\t\treturn;\n\t\t}\n\t\tif (this._toDispose.has(o)) {\n\t\t\tthis._toDispose.delete(o);\n\t\t\tsetParentOfDisposable(o, null);\n\t\t}\n\t}\n}\n\n/**\n * Abstract base class for a {@link IDisposable disposable} object.\n *\n * Subclasses can {@linkcode _register} disposables that will be automatically cleaned up when this object is disposed of.\n */\nexport abstract class Disposable implements IDisposable {\n\n\t/**\n\t * A disposable that does nothing when it is disposed of.\n\t *\n\t * TODO: This should not be a static property.\n\t */\n\tstatic readonly None = Object.freeze<IDisposable>({ dispose() { } });\n\n\tprotected readonly _store = new DisposableStore();\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t\tsetParentOfDisposable(this._store, this);\n\t}\n\n\tpublic dispose(): void {\n\t\tmarkAsDisposed(this);\n\n\t\tthis._store.dispose();\n\t}\n\n\t/**\n\t * Adds `o` to the collection of disposables managed by this object.\n\t */\n\tprotected _register<T extends IDisposable>(o: T): T {\n\t\tif ((o as unknown as Disposable) === this) {\n\t\t\tthrow new Error('Cannot register a disposable on itself!');\n\t\t}\n\t\treturn this._store.add(o);\n\t}\n}\n\n/**\n * Manages the lifecycle of a disposable value that may be changed.\n *\n * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can\n * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.\n */\nexport class MutableDisposable<T extends IDisposable> implements IDisposable {\n\tprivate _value?: T;\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\tget value(): T | undefined {\n\t\treturn this._isDisposed ? undefined : this._value;\n\t}\n\n\tset value(value: T | undefined) {\n\t\tif (this._isDisposed || value === this._value) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._value?.dispose();\n\t\tif (value) {\n\t\t\tsetParentOfDisposable(value, this);\n\t\t}\n\t\tthis._value = value;\n\t}\n\n\t/**\n\t * Resets the stored value and disposed of the previously stored value.\n\t */\n\tclear(): void {\n\t\tthis.value = undefined;\n\t}\n\n\tdispose(): void {\n\t\tthis._isDisposed = true;\n\t\tmarkAsDisposed(this);\n\t\tthis._value?.dispose();\n\t\tthis._value = undefined;\n\t}\n\n\t/**\n\t * Clears the value, but does not dispose it.\n\t * The old value is returned.\n\t*/\n\tclearAndLeak(): T | undefined {\n\t\tconst oldValue = this._value;\n\t\tthis._value = undefined;\n\t\tif (oldValue) {\n\t\t\tsetParentOfDisposable(oldValue, null);\n\t\t}\n\t\treturn oldValue;\n\t}\n}\n\n/**\n * Manages the lifecycle of a disposable value that may be changed like {@link MutableDisposable}, but the value must\n * exist and cannot be undefined.\n */\nexport class MandatoryMutableDisposable<T extends IDisposable> implements IDisposable {\n\tprivate readonly _disposable = new MutableDisposable<T>();\n\tprivate _isDisposed = false;\n\n\tconstructor(initialValue: T) {\n\t\tthis._disposable.value = initialValue;\n\t}\n\n\tget value(): T {\n\t\treturn this._disposable.value!;\n\t}\n\n\tset value(value: T) {\n\t\tif (this._isDisposed || value === this._disposable.value) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposable.value = value;\n\t}\n\n\tdispose() {\n\t\tthis._isDisposed = true;\n\t\tthis._disposable.dispose();\n\t}\n}\n\nexport class RefCountedDisposable {\n\n\tprivate _counter: number = 1;\n\n\tconstructor(\n\t\tprivate readonly _disposable: IDisposable,\n\t) { }\n\n\tacquire() {\n\t\tthis._counter++;\n\t\treturn this;\n\t}\n\n\trelease() {\n\t\tif (--this._counter === 0) {\n\t\t\tthis._disposable.dispose();\n\t\t}\n\t\treturn this;\n\t}\n}\n\n/**\n * A safe disposable can be `unset` so that a leaked reference (listener)\n * can be cut-off.\n */\nexport class SafeDisposable implements IDisposable {\n\n\tdispose: () => void = () => { };\n\tunset: () => void = () => { };\n\tisset: () => boolean = () => false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\tset(fn: Function) {\n\t\tlet callback: Function | undefined = fn;\n\t\tthis.unset = () => callback = undefined;\n\t\tthis.isset = () => callback !== undefined;\n\t\tthis.dispose = () => {\n\t\t\tif (callback) {\n\t\t\t\tcallback();\n\t\t\t\tcallback = undefined;\n\t\t\t\tmarkAsDisposed(this);\n\t\t\t}\n\t\t};\n\t\treturn this;\n\t}\n}\n\nexport interface IReference<T> extends IDisposable {\n\treadonly object: T;\n}\n\nexport abstract class ReferenceCollection<T> {\n\n\tprivate readonly references: Map<string, { readonly object: T; counter: number }> = new Map();\n\n\tacquire(key: string, ...args: any[]): IReference<T> {\n\t\tlet reference = this.references.get(key);\n\n\t\tif (!reference) {\n\t\t\treference = { counter: 0, object: this.createReferencedObject(key, ...args) };\n\t\t\tthis.references.set(key, reference);\n\t\t}\n\n\t\tconst { object } = reference;\n\t\tconst dispose = createSingleCallFunction(() => {\n\t\t\tif (--reference.counter === 0) {\n\t\t\t\tthis.destroyReferencedObject(key, reference.object);\n\t\t\t\tthis.references.delete(key);\n\t\t\t}\n\t\t});\n\n\t\treference.counter++;\n\n\t\treturn { object, dispose };\n\t}\n\n\tprotected abstract createReferencedObject(key: string, ...args: any[]): T;\n\tprotected abstract destroyReferencedObject(key: string, object: T): void;\n}\n\n/**\n * Unwraps a reference collection of promised values. Makes sure\n * references are disposed whenever promises get rejected.\n */\nexport class AsyncReferenceCollection<T> {\n\n\tconstructor(private referenceCollection: ReferenceCollection<Promise<T>>) { }\n\n\tasync acquire(key: string, ...args: any[]): Promise<IReference<T>> {\n\t\tconst ref = this.referenceCollection.acquire(key, ...args);\n\n\t\ttry {\n\t\t\tconst object = await ref.object;\n\n\t\t\treturn {\n\t\t\t\tobject,\n\t\t\t\tdispose: () => ref.dispose()\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tref.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport class ImmortalReference<T> implements IReference<T> {\n\tconstructor(public object: T) { }\n\tdispose(): void { /* noop */ }\n}\n\nexport function disposeOnReturn(fn: (store: DisposableStore) => void): void {\n\tconst store = new DisposableStore();\n\ttry {\n\t\tfn(store);\n\t} finally {\n\t\tstore.dispose();\n\t}\n}\n\n/**\n * A map the manages the lifecycle of the values that it stores.\n */\nexport class DisposableMap<K, V extends IDisposable = IDisposable> implements IDisposable {\n\n\tprivate readonly _store = new Map<K, V>();\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\t/**\n\t * Disposes of all stored values and mark this object as disposed.\n\t *\n\t * Trying to use this object after it has been disposed of is an error.\n\t */\n\tdispose(): void {\n\t\tmarkAsDisposed(this);\n\t\tthis._isDisposed = true;\n\t\tthis.clearAndDisposeAll();\n\t}\n\n\t/**\n\t * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.\n\t */\n\tclearAndDisposeAll(): void {\n\t\tif (!this._store.size) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispose(this._store.values());\n\t\t} finally {\n\t\t\tthis._store.clear();\n\t\t}\n\t}\n\n\thas(key: K): boolean {\n\t\treturn this._store.has(key);\n\t}\n\n\tget size(): number {\n\t\treturn this._store.size;\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn this._store.get(key);\n\t}\n\n\tset(key: K, value: V, skipDisposeOnOverwrite = false): void {\n\t\tif (this._isDisposed) {\n\t\t\tconsole.warn(new Error('Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!').stack);\n\t\t}\n\n\t\tif (!skipDisposeOnOverwrite) {\n\t\t\tthis._store.get(key)?.dispose();\n\t\t}\n\n\t\tthis._store.set(key, value);\n\t}\n\n\t/**\n\t * Delete the value stored for `key` from this map and also dispose of it.\n\t */\n\tdeleteAndDispose(key: K): void {\n\t\tthis._store.get(key)?.dispose();\n\t\tthis._store.delete(key);\n\t}\n\n\t/**\n\t * Delete the value stored for `key` from this map but return it. The caller is\n\t * responsible for disposing of the value.\n\t */\n\tdeleteAndLeak(key: K): V | undefined {\n\t\tconst value = this._store.get(key);\n\t\tthis._store.delete(key);\n\t\treturn value;\n\t}\n\n\tkeys(): IterableIterator<K> {\n\t\treturn this._store.keys();\n\t}\n\n\tvalues(): IterableIterator<V> {\n\t\treturn this._store.values();\n\t}\n\n\t[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this._store[Symbol.iterator]();\n\t}\n}\n\n/**\n * Call `then` on a Promise, unless the returned disposable is disposed.\n */\nexport function thenIfNotDisposed<T>(promise: Promise<T>, then: (result: T) => void): IDisposable {\n\tlet disposed = false;\n\tpromise.then(result => {\n\t\tif (disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthen(result);\n\t});\n\treturn toDisposable(() => {\n\t\tdisposed = true;\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nclass Node<E> {\n\n\tstatic readonly Undefined = new Node<any>(undefined);\n\n\telement: E;\n\tnext: Node<E>;\n\tprev: Node<E>;\n\n\tconstructor(element: E) {\n\t\tthis.element = element;\n\t\tthis.next = Node.Undefined;\n\t\tthis.prev = Node.Undefined;\n\t}\n}\n\nexport class LinkedList<E> {\n\n\tprivate _first: Node<E> = Node.Undefined;\n\tprivate _last: Node<E> = Node.Undefined;\n\tprivate _size: number = 0;\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this._first === Node.Undefined;\n\t}\n\n\tclear(): void {\n\t\tlet node = this._first;\n\t\twhile (node !== Node.Undefined) {\n\t\t\tconst next = node.next;\n\t\t\tnode.prev = Node.Undefined;\n\t\t\tnode.next = Node.Undefined;\n\t\t\tnode = next;\n\t\t}\n\n\t\tthis._first = Node.Undefined;\n\t\tthis._last = Node.Undefined;\n\t\tthis._size = 0;\n\t}\n\n\tunshift(element: E): () => void {\n\t\treturn this._insert(element, false);\n\t}\n\n\tpush(element: E): () => void {\n\t\treturn this._insert(element, true);\n\t}\n\n\tprivate _insert(element: E, atTheEnd: boolean): () => void {\n\t\tconst newNode = new Node(element);\n\t\tif (this._first === Node.Undefined) {\n\t\t\tthis._first = newNode;\n\t\t\tthis._last = newNode;\n\n\t\t} else if (atTheEnd) {\n\t\t\t// push\n\t\t\tconst oldLast = this._last;\n\t\t\tthis._last = newNode;\n\t\t\tnewNode.prev = oldLast;\n\t\t\toldLast.next = newNode;\n\n\t\t} else {\n\t\t\t// unshift\n\t\t\tconst oldFirst = this._first;\n\t\t\tthis._first = newNode;\n\t\t\tnewNode.next = oldFirst;\n\t\t\toldFirst.prev = newNode;\n\t\t}\n\t\tthis._size += 1;\n\n\t\tlet didRemove = false;\n\t\treturn () => {\n\t\t\tif (!didRemove) {\n\t\t\t\tdidRemove = true;\n\t\t\t\tthis._remove(newNode);\n\t\t\t}\n\t\t};\n\t}\n\n\tshift(): E | undefined {\n\t\tif (this._first === Node.Undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst res = this._first.element;\n\t\t\tthis._remove(this._first);\n\t\t\treturn res;\n\t\t}\n\t}\n\n\tpop(): E | undefined {\n\t\tif (this._last === Node.Undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst res = this._last.element;\n\t\t\tthis._remove(this._last);\n\t\t\treturn res;\n\t\t}\n\t}\n\n\tprivate _remove(node: Node<E>): void {\n\t\tif (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n\t\t\t// middle\n\t\t\tconst anchor = node.prev;\n\t\t\tanchor.next = node.next;\n\t\t\tnode.next.prev = anchor;\n\n\t\t} else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n\t\t\t// only node\n\t\t\tthis._first = Node.Undefined;\n\t\t\tthis._last = Node.Undefined;\n\n\t\t} else if (node.next === Node.Undefined) {\n\t\t\t// last\n\t\t\tthis._last = this._last.prev!;\n\t\t\tthis._last.next = Node.Undefined;\n\n\t\t} else if (node.prev === Node.Undefined) {\n\t\t\t// first\n\t\t\tthis._first = this._first.next!;\n\t\t\tthis._first.prev = Node.Undefined;\n\t\t}\n\n\t\t// done\n\t\tthis._size -= 1;\n\t}\n\n\t*[Symbol.iterator](): Iterator<E> {\n\t\tlet node = this._first;\n\t\twhile (node !== Node.Undefined) {\n\t\t\tyield node.element;\n\t\t\tnode = node.next;\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\ndeclare const globalThis: { performance: { now(): number } };\nconst performanceNow = globalThis.performance.now.bind(globalThis.performance);\n\nexport class StopWatch {\n\n\tprivate _startTime: number;\n\tprivate _stopTime: number;\n\n\tprivate readonly _now: () => number;\n\n\tpublic static create(highResolution?: boolean): StopWatch {\n\t\treturn new StopWatch(highResolution);\n\t}\n\n\tconstructor(highResolution?: boolean) {\n\t\tthis._now = highResolution === false ? Date.now : performanceNow;\n\t\tthis._startTime = this._now();\n\t\tthis._stopTime = -1;\n\t}\n\n\tpublic stop(): void {\n\t\tthis._stopTime = this._now();\n\t}\n\n\tpublic reset(): void {\n\t\tthis._startTime = this._now();\n\t\tthis._stopTime = -1;\n\t}\n\n\tpublic elapsed(): number {\n\t\tif (this._stopTime !== -1) {\n\t\t\treturn this._stopTime - this._startTime;\n\t\t}\n\t\treturn this._now() - this._startTime;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancelablePromise } from './async.js';\nimport { CancellationToken } from './cancellation.js';\nimport { diffSets } from './collections.js';\nimport { onUnexpectedError } from './errors.js';\nimport { createSingleCallFunction } from './functional.js';\nimport { combinedDisposable, Disposable, DisposableMap, DisposableStore, IDisposable, toDisposable } from './lifecycle.js';\nimport { LinkedList } from './linkedList.js';\nimport { IObservable, IObservableWithChange, IObserver } from './observable.js';\nimport { StopWatch } from './stopwatch.js';\nimport { MicrotaskDelay } from './symbols.js';\n\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever an emitter with listeners is disposed. That is a sign of code smell.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableDisposeWithListenerWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a snapshotted event is used repeatedly without cleanup.\n// See https://github.com/microsoft/vscode/issues/142851\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableSnapshotPotentialLeakWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n/**\n * An event with zero or one parameters that can be subscribed to. The event is a function itself.\n */\nexport interface Event<T> {\n\t(listener: (e: T) => unknown, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;\n}\n\nexport namespace Event {\n\texport const None: Event<any> = () => Disposable.None;\n\n\tfunction _addLeakageTraceLogic(options: EmitterOptions) {\n\t\tif (_enableSnapshotPotentialLeakWarning) {\n\t\t\tconst { onDidAddListener: origListenerDidAdd } = options;\n\t\t\tconst stack = Stacktrace.create();\n\t\t\tlet count = 0;\n\t\t\toptions.onDidAddListener = () => {\n\t\t\t\tif (++count === 2) {\n\t\t\t\t\tconsole.warn('snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here');\n\t\t\t\t\tstack.print();\n\t\t\t\t}\n\t\t\t\torigListenerDidAdd?.();\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared\n\t * `setTimeout`. The event is converted into a signal (`Event<void>`) to avoid additional object creation as a\n\t * result of merging events and to try prevent race conditions that could arise when using related deferred and\n\t * non-deferred events.\n\t *\n\t * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work\n\t * (eg. latency of keypress to text rendered).\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function defer(event: Event<unknown>, disposable?: DisposableStore): Event<void> {\n\t\treturn debounce<unknown, void>(event, () => void 0, 0, undefined, true, undefined, disposable);\n\t}\n\n\t/**\n\t * Given an event, returns another event which only fires once.\n\t *\n\t * @param event The event source for the new event.\n\t */\n\texport function once<T>(event: Event<T>): Event<T> {\n\t\treturn (listener, thisArgs = null, disposables?) => {\n\t\t\t// we need this, in case the event fires during the listener call\n\t\t\tlet didFire = false;\n\t\t\tlet result: IDisposable | undefined = undefined;\n\t\t\tresult = event(e => {\n\t\t\t\tif (didFire) {\n\t\t\t\t\treturn;\n\t\t\t\t} else if (result) {\n\t\t\t\t\tresult.dispose();\n\t\t\t\t} else {\n\t\t\t\t\tdidFire = true;\n\t\t\t\t}\n\n\t\t\t\treturn listener.call(thisArgs, e);\n\t\t\t}, null, disposables);\n\n\t\t\tif (didFire) {\n\t\t\t\tresult.dispose();\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\t}\n\n\t/**\n\t * Given an event, returns another event which only fires once, and only when the condition is met.\n\t *\n\t * @param event The event source for the new event.\n\t */\n\texport function onceIf<T>(event: Event<T>, condition: (e: T) => boolean): Event<T> {\n\t\treturn Event.once(Event.filter(event, condition));\n\t}\n\n\t/**\n\t * Maps an event of one type into an event of another type using a mapping function, similar to how\n\t * `Array.prototype.map` works.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param map The mapping function.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function map<I, O>(event: Event<I>, map: (i: I) => O, disposable?: DisposableStore): Event<O> {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable);\n\t}\n\n\t/**\n\t * Wraps an event in another event that performs some function on the event object before firing.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param each The function to perform on the event object.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function forEach<I>(event: Event<I>, each: (i: I) => void, disposable?: DisposableStore): Event<I> {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable);\n\t}\n\n\t/**\n\t * Wraps an event in another event that fires only when some condition is met.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param filter The filter function that defines the condition. The event will fire for the object if this function\n\t * returns true.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function filter<T, U>(event: Event<T | U>, filter: (e: T | U) => e is T, disposable?: DisposableStore): Event<T>;\n\texport function filter<T>(event: Event<T>, filter: (e: T) => boolean, disposable?: DisposableStore): Event<T>;\n\texport function filter<T, R>(event: Event<T | R>, filter: (e: T | R) => e is R, disposable?: DisposableStore): Event<R>;\n\texport function filter<T>(event: Event<T>, filter: (e: T) => boolean, disposable?: DisposableStore): Event<T> {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable);\n\t}\n\n\t/**\n\t * Given an event, returns the same event but typed as `Event<void>`.\n\t */\n\texport function signal<T>(event: Event<T>): Event<void> {\n\t\treturn event as Event<any> as Event<void>;\n\t}\n\n\t/**\n\t * Given a collection of events, returns a single event which emits whenever any of the provided events emit.\n\t */\n\texport function any<T>(...events: Event<T>[]): Event<T>;\n\texport function any(...events: Event<any>[]): Event<void>;\n\texport function any<T>(...events: Event<T>[]): Event<T> {\n\t\treturn (listener, thisArgs = null, disposables?) => {\n\t\t\tconst disposable = combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e))));\n\t\t\treturn addAndReturnDisposable(disposable, disposables);\n\t\t};\n\t}\n\n\t/**\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t */\n\texport function reduce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, initial?: O, disposable?: DisposableStore): Event<O> {\n\t\tlet output: O | undefined = initial;\n\n\t\treturn map<I, O>(event, e => {\n\t\t\toutput = merge(output, e);\n\t\t\treturn output;\n\t\t}, disposable);\n\t}\n\n\tfunction snapshot<T>(event: Event<T>, disposable: DisposableStore | undefined): Event<T> {\n\t\tlet listener: IDisposable | undefined;\n\n\t\tconst options: EmitterOptions | undefined = {\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tlistener = event(emitter.fire, emitter);\n\t\t\t},\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tlistener?.dispose();\n\t\t\t}\n\t\t};\n\n\t\tif (!disposable) {\n\t\t\t_addLeakageTraceLogic(options);\n\t\t}\n\n\t\tconst emitter = new Emitter<T>(options);\n\n\t\tdisposable?.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\t/**\n\t * Adds the IDisposable to the store if it's set, and returns it. Useful to\n\t * Event function implementation.\n\t */\n\tfunction addAndReturnDisposable<T extends IDisposable>(d: T, store: DisposableStore | IDisposable[] | undefined): T {\n\t\tif (store instanceof Array) {\n\t\t\tstore.push(d);\n\t\t} else if (store) {\n\t\t\tstore.add(d);\n\t\t}\n\t\treturn d;\n\t}\n\n\t/**\n\t * Given an event, creates a new emitter that event that will debounce events based on {@link delay} and give an\n\t * array event object of all events that fired.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The original event to debounce.\n\t * @param merge A function that reduces all events into a single event.\n\t * @param delay The number of milliseconds to debounce.\n\t * @param leading Whether to fire a leading event without debouncing.\n\t * @param flushOnListenerRemove Whether to fire all debounced events when a listener is removed. If this is not\n\t * specified, some events could go missing. Use this if it's important that all events are processed, even if the\n\t * listener gets disposed before the debounced event fires.\n\t * @param leakWarningThreshold See {@link EmitterOptions.leakWarningThreshold}.\n\t * @param disposable A disposable store to register the debounce emitter to.\n\t */\n\texport function debounce<T>(event: Event<T>, merge: (last: T | undefined, event: T) => T, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<T>;\n\texport function debounce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<O>;\n\texport function debounce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, delay: number | typeof MicrotaskDelay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold?: number, disposable?: DisposableStore): Event<O> {\n\t\tlet subscription: IDisposable;\n\t\tlet output: O | undefined = undefined;\n\t\tlet handle: Timeout | undefined | null = undefined;\n\t\tlet numDebouncedCalls = 0;\n\t\tlet doFire: (() => void) | undefined;\n\n\t\tconst options: EmitterOptions | undefined = {\n\t\t\tleakWarningThreshold,\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tsubscription = event(cur => {\n\t\t\t\t\tnumDebouncedCalls++;\n\t\t\t\t\toutput = merge(output, cur);\n\n\t\t\t\t\tif (leading && !handle) {\n\t\t\t\t\t\temitter.fire(output);\n\t\t\t\t\t\toutput = undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tdoFire = () => {\n\t\t\t\t\t\tconst _output = output;\n\t\t\t\t\t\toutput = undefined;\n\t\t\t\t\t\thandle = undefined;\n\t\t\t\t\t\tif (!leading || numDebouncedCalls > 1) {\n\t\t\t\t\t\t\temitter.fire(_output!);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnumDebouncedCalls = 0;\n\t\t\t\t\t};\n\n\t\t\t\t\tif (typeof delay === 'number') {\n\t\t\t\t\t\tif (handle) {\n\t\t\t\t\t\t\tclearTimeout(handle);\n\t\t\t\t\t\t}\n\t\t\t\t\t\thandle = setTimeout(doFire, delay);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (handle === undefined) {\n\t\t\t\t\t\t\thandle = null;\n\t\t\t\t\t\t\tqueueMicrotask(doFire);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\tonWillRemoveListener() {\n\t\t\t\tif (flushOnListenerRemove && numDebouncedCalls > 0) {\n\t\t\t\t\tdoFire?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tdoFire = undefined;\n\t\t\t\tsubscription.dispose();\n\t\t\t}\n\t\t};\n\n\t\tif (!disposable) {\n\t\t\t_addLeakageTraceLogic(options);\n\t\t}\n\n\t\tconst emitter = new Emitter<O>(options);\n\n\t\tdisposable?.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\t/**\n\t * Debounces an event, firing after some delay (default=0) with an array of all event original objects.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t */\n\texport function accumulate<T>(event: Event<T>, delay: number | typeof MicrotaskDelay = 0, disposable?: DisposableStore): Event<T[]> {\n\t\treturn Event.debounce<T, T[]>(event, (last, e) => {\n\t\t\tif (!last) {\n\t\t\t\treturn [e];\n\t\t\t}\n\t\t\tlast.push(e);\n\t\t\treturn last;\n\t\t}, delay, undefined, true, undefined, disposable);\n\t}\n\n\t/**\n\t * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate\n\t * event objects from different sources do not fire the same event object.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param equals The equality condition.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t *\n\t * @example\n\t * ```\n\t * // Fire only one time when a single window is opened or focused\n\t * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow))\n\t * ```\n\t */\n\texport function latch<T>(event: Event<T>, equals: (a: T, b: T) => boolean = (a, b) => a === b, disposable?: DisposableStore): Event<T> {\n\t\tlet firstCall = true;\n\t\tlet cache: T;\n\n\t\treturn filter(event, value => {\n\t\t\tconst shouldEmit = firstCall || !equals(value, cache);\n\t\t\tfirstCall = false;\n\t\t\tcache = value;\n\t\t\treturn shouldEmit;\n\t\t}, disposable);\n\t}\n\n\t/**\n\t * Splits an event whose parameter is a union type into 2 separate events for each type in the union.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @example\n\t * ```\n\t * const event = new EventEmitter<number | undefined>().event;\n\t * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined);\n\t * ```\n\t *\n\t * @param event The event source for the new event.\n\t * @param isT A function that determines what event is of the first type.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function split<T, U>(event: Event<T | U>, isT: (e: T | U) => e is T, disposable?: DisposableStore): [Event<T>, Event<U>] {\n\t\treturn [\n\t\t\tEvent.filter(event, isT, disposable),\n\t\t\tEvent.filter(event, e => !isT(e), disposable) as Event<U>,\n\t\t];\n\t}\n\n\t/**\n\t * Buffers an event until it has a listener attached.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a\n\t * `setTimeout` when the first event listener is added.\n\t * @param _buffer Internal: A source event array used for tests.\n\t *\n\t * @example\n\t * ```\n\t * // Start accumulating events, when the first listener is attached, flush\n\t * // the event after a timeout such that multiple listeners attached before\n\t * // the timeout would receive the event\n\t * this.onInstallExtension = Event.buffer(service.onInstallExtension, true);\n\t * ```\n\t */\n\texport function buffer<T>(event: Event<T>, flushAfterTimeout = false, _buffer: T[] = [], disposable?: DisposableStore): Event<T> {\n\t\tlet buffer: T[] | null = _buffer.slice();\n\n\t\tlet listener: IDisposable | null = event(e => {\n\t\t\tif (buffer) {\n\t\t\t\tbuffer.push(e);\n\t\t\t} else {\n\t\t\t\temitter.fire(e);\n\t\t\t}\n\t\t});\n\n\t\tif (disposable) {\n\t\t\tdisposable.add(listener);\n\t\t}\n\n\t\tconst flush = () => {\n\t\t\tbuffer?.forEach(e => emitter.fire(e));\n\t\t\tbuffer = null;\n\t\t};\n\n\t\tconst emitter = new Emitter<T>({\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tif (!listener) {\n\t\t\t\t\tlistener = event(e => emitter.fire(e));\n\t\t\t\t\tif (disposable) {\n\t\t\t\t\t\tdisposable.add(listener);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonDidAddFirstListener() {\n\t\t\t\tif (buffer) {\n\t\t\t\t\tif (flushAfterTimeout) {\n\t\t\t\t\t\tsetTimeout(flush);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tflush();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tif (listener) {\n\t\t\t\t\tlistener.dispose();\n\t\t\t\t}\n\t\t\t\tlistener = null;\n\t\t\t}\n\t\t});\n\n\t\tif (disposable) {\n\t\t\tdisposable.add(emitter);\n\t\t}\n\n\t\treturn emitter.event;\n\t}\n\t/**\n\t * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style.\n\t *\n\t * @example\n\t * ```\n\t * // Normal\n\t * const onEnterPressNormal = Event.filter(\n\t *   Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)),\n\t *   e.keyCode === KeyCode.Enter\n\t * ).event;\n\t *\n\t * // Using chain\n\t * const onEnterPressChain = Event.chain(onKeyPress.event, $ => $\n\t *   .map(e => new StandardKeyboardEvent(e))\n\t *   .filter(e => e.keyCode === KeyCode.Enter)\n\t * );\n\t * ```\n\t */\n\texport function chain<T, R>(event: Event<T>, sythensize: ($: IChainableSythensis<T>) => IChainableSythensis<R>): Event<R> {\n\t\tconst fn: Event<R> = (listener, thisArgs, disposables) => {\n\t\t\tconst cs = sythensize(new ChainableSynthesis()) as ChainableSynthesis;\n\t\t\treturn event(function (value) {\n\t\t\t\tconst result = cs.evaluate(value);\n\t\t\t\tif (result !== HaltChainable) {\n\t\t\t\t\tlistener.call(thisArgs, result);\n\t\t\t\t}\n\t\t\t}, undefined, disposables);\n\t\t};\n\n\t\treturn fn;\n\t}\n\n\tconst HaltChainable = Symbol('HaltChainable');\n\n\tclass ChainableSynthesis implements IChainableSythensis<any> {\n\t\tprivate readonly steps: ((input: any) => unknown)[] = [];\n\n\t\tmap<O>(fn: (i: any) => O): this {\n\t\t\tthis.steps.push(fn);\n\t\t\treturn this;\n\t\t}\n\n\t\tforEach(fn: (i: any) => void): this {\n\t\t\tthis.steps.push(v => {\n\t\t\t\tfn(v);\n\t\t\t\treturn v;\n\t\t\t});\n\t\t\treturn this;\n\t\t}\n\n\t\tfilter(fn: (e: any) => boolean): this {\n\t\t\tthis.steps.push(v => fn(v) ? v : HaltChainable);\n\t\t\treturn this;\n\t\t}\n\n\t\treduce<R>(merge: (last: R | undefined, event: any) => R, initial?: R | undefined): this {\n\t\t\tlet last = initial;\n\t\t\tthis.steps.push(v => {\n\t\t\t\tlast = merge(last, v);\n\t\t\t\treturn last;\n\t\t\t});\n\t\t\treturn this;\n\t\t}\n\n\t\tlatch(equals: (a: any, b: any) => boolean = (a, b) => a === b): ChainableSynthesis {\n\t\t\tlet firstCall = true;\n\t\t\tlet cache: any;\n\t\t\tthis.steps.push(value => {\n\t\t\t\tconst shouldEmit = firstCall || !equals(value, cache);\n\t\t\t\tfirstCall = false;\n\t\t\t\tcache = value;\n\t\t\t\treturn shouldEmit ? value : HaltChainable;\n\t\t\t});\n\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic evaluate(value: any) {\n\t\t\tfor (const step of this.steps) {\n\t\t\t\tvalue = step(value);\n\t\t\t\tif (value === HaltChainable) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn value;\n\t\t}\n\t}\n\n\texport interface IChainableSythensis<T> {\n\t\tmap<O>(fn: (i: T) => O): IChainableSythensis<O>;\n\t\tforEach(fn: (i: T) => void): IChainableSythensis<T>;\n\t\tfilter<R extends T>(fn: (e: T) => e is R): IChainableSythensis<R>;\n\t\tfilter(fn: (e: T) => boolean): IChainableSythensis<T>;\n\t\treduce<R>(merge: (last: R, event: T) => R, initial: R): IChainableSythensis<R>;\n\t\treduce<R>(merge: (last: R | undefined, event: T) => R): IChainableSythensis<R>;\n\t\tlatch(equals?: (a: T, b: T) => boolean): IChainableSythensis<T>;\n\t}\n\n\texport interface NodeEventEmitter {\n\t\ton(event: string | symbol, listener: Function): unknown;\n\t\tremoveListener(event: string | symbol, listener: Function): unknown;\n\t}\n\n\t/**\n\t * Creates an {@link Event} from a node event emitter.\n\t */\n\texport function fromNodeEventEmitter<T>(emitter: NodeEventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event<T> {\n\t\tconst fn = (...args: any[]) => result.fire(map(...args));\n\t\tconst onFirstListenerAdd = () => emitter.on(eventName, fn);\n\t\tconst onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n\t\tconst result = new Emitter<T>({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n\n\t\treturn result.event;\n\t}\n\n\texport interface DOMEventEmitter {\n\t\taddEventListener(event: string | symbol, listener: Function): void;\n\t\tremoveEventListener(event: string | symbol, listener: Function): void;\n\t}\n\n\t/**\n\t * Creates an {@link Event} from a DOM event emitter.\n\t */\n\texport function fromDOMEventEmitter<T>(emitter: DOMEventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event<T> {\n\t\tconst fn = (...args: any[]) => result.fire(map(...args));\n\t\tconst onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\n\t\tconst onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\n\t\tconst result = new Emitter<T>({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n\n\t\treturn result.event;\n\t}\n\n\t/**\n\t * Creates a promise out of an event, using the {@link Event.once} helper.\n\t */\n\texport function toPromise<T>(event: Event<T>, disposables?: IDisposable[] | DisposableStore): CancelablePromise<T> {\n\t\tlet cancelRef: () => void;\n\t\tconst promise = new Promise((resolve, reject) => {\n\t\t\tconst listener = once(event)(resolve, null, disposables);\n\t\t\t// not resolved, matching the behavior of a normal disposal\n\t\t\tcancelRef = () => listener.dispose();\n\t\t}) as CancelablePromise<T>;\n\t\tpromise.cancel = cancelRef!;\n\n\t\treturn promise;\n\t}\n\n\t/**\n\t * Creates an event out of a promise that fires once when the promise is\n\t * resolved with the result of the promise or `undefined`.\n\t */\n\texport function fromPromise<T>(promise: Promise<T>): Event<T | undefined> {\n\t\tconst result = new Emitter<T | undefined>();\n\n\t\tpromise.then(res => {\n\t\t\tresult.fire(res);\n\t\t}, () => {\n\t\t\tresult.fire(undefined);\n\t\t}).finally(() => {\n\t\t\tresult.dispose();\n\t\t});\n\n\t\treturn result.event;\n\t}\n\n\t/**\n\t * A convenience function for forwarding an event to another emitter which\n\t * improves readability.\n\t *\n\t * This is similar to {@link Relay} but allows instantiating and forwarding\n\t * on a single line and also allows for multiple source events.\n\t * @param from The event to forward.\n\t * @param to The emitter to forward the event to.\n\t * @example\n\t * Event.forward(event, emitter);\n\t * // equivalent to\n\t * event(e => emitter.fire(e));\n\t * // equivalent to\n\t * event(emitter.fire, emitter);\n\t */\n\texport function forward<T>(from: Event<T>, to: Emitter<T>): IDisposable {\n\t\treturn from(e => to.fire(e));\n\t}\n\n\t/**\n\t * Adds a listener to an event and calls the listener immediately with undefined as the event object.\n\t *\n\t * @example\n\t * ```\n\t * // Initialize the UI and update it when dataChangeEvent fires\n\t * runAndSubscribe(dataChangeEvent, () => this._updateUI());\n\t * ```\n\t */\n\texport function runAndSubscribe<T>(event: Event<T>, handler: (e: T) => unknown, initial: T): IDisposable;\n\texport function runAndSubscribe<T>(event: Event<T>, handler: (e: T | undefined) => unknown): IDisposable;\n\texport function runAndSubscribe<T>(event: Event<T>, handler: (e: T | undefined) => unknown, initial?: T): IDisposable {\n\t\thandler(initial);\n\t\treturn event(e => handler(e));\n\t}\n\n\tclass EmitterObserver<T> implements IObserver {\n\n\t\treadonly emitter: Emitter<T>;\n\n\t\tprivate _counter = 0;\n\t\tprivate _hasChanged = false;\n\n\t\tconstructor(readonly _observable: IObservable<T>, store: DisposableStore | undefined) {\n\t\t\tconst options: EmitterOptions = {\n\t\t\t\tonWillAddFirstListener: () => {\n\t\t\t\t\t_observable.addObserver(this);\n\n\t\t\t\t\t// Communicate to the observable that we received its current value and would like to be notified about future changes.\n\t\t\t\t\tthis._observable.reportChanges();\n\t\t\t\t},\n\t\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\t\t_observable.removeObserver(this);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (!store) {\n\t\t\t\t_addLeakageTraceLogic(options);\n\t\t\t}\n\t\t\tthis.emitter = new Emitter<T>(options);\n\t\t\tif (store) {\n\t\t\t\tstore.add(this.emitter);\n\t\t\t}\n\t\t}\n\n\t\tbeginUpdate<T>(_observable: IObservable<T>): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._counter++;\n\t\t}\n\n\t\thandlePossibleChange<T>(_observable: IObservable<T>): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t}\n\n\t\thandleChange<T, TChange>(_observable: IObservableWithChange<T, TChange>, _change: TChange): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._hasChanged = true;\n\t\t}\n\n\t\tendUpdate<T>(_observable: IObservable<T>): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._counter--;\n\t\t\tif (this._counter === 0) {\n\t\t\t\tthis._observable.reportChanges();\n\t\t\t\tif (this._hasChanged) {\n\t\t\t\t\tthis._hasChanged = false;\n\t\t\t\t\tthis.emitter.fire(this._observable.get());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Creates an event emitter that is fired when the observable changes.\n\t * Each listeners subscribes to the emitter.\n\t */\n\texport function fromObservable<T>(obs: IObservable<T>, store?: DisposableStore): Event<T> {\n\t\tconst observer = new EmitterObserver(obs, store);\n\t\treturn observer.emitter.event;\n\t}\n\n\t/**\n\t * Each listener is attached to the observable directly.\n\t */\n\texport function fromObservableLight(observable: IObservable<unknown>): Event<void> {\n\t\treturn (listener, thisArgs, disposables) => {\n\t\t\tlet count = 0;\n\t\t\tlet didChange = false;\n\t\t\tconst observer: IObserver = {\n\t\t\t\tbeginUpdate() {\n\t\t\t\t\tcount++;\n\t\t\t\t},\n\t\t\t\tendUpdate() {\n\t\t\t\t\tcount--;\n\t\t\t\t\tif (count === 0) {\n\t\t\t\t\t\tobservable.reportChanges();\n\t\t\t\t\t\tif (didChange) {\n\t\t\t\t\t\t\tdidChange = false;\n\t\t\t\t\t\t\tlistener.call(thisArgs);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\thandlePossibleChange() {\n\t\t\t\t\t// noop\n\t\t\t\t},\n\t\t\t\thandleChange() {\n\t\t\t\t\tdidChange = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tobservable.addObserver(observer);\n\t\t\tobservable.reportChanges();\n\t\t\tconst disposable = {\n\t\t\t\tdispose() {\n\t\t\t\t\tobservable.removeObserver(observer);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (disposables instanceof DisposableStore) {\n\t\t\t\tdisposables.add(disposable);\n\t\t\t} else if (Array.isArray(disposables)) {\n\t\t\t\tdisposables.push(disposable);\n\t\t\t}\n\n\t\t\treturn disposable;\n\t\t};\n\t}\n}\n\nexport interface EmitterOptions {\n\t/**\n\t * Optional function that's called *before* the very first listener is added\n\t */\n\tonWillAddFirstListener?: Function;\n\t/**\n\t * Optional function that's called *after* the very first listener is added\n\t */\n\tonDidAddFirstListener?: Function;\n\t/**\n\t * Optional function that's called after a listener is added\n\t */\n\tonDidAddListener?: Function;\n\t/**\n\t * Optional function that's called *after* remove the very last listener\n\t */\n\tonDidRemoveLastListener?: Function;\n\t/**\n\t * Optional function that's called *before* a listener is removed\n\t */\n\tonWillRemoveListener?: Function;\n\t/**\n\t * Optional function that's called when a listener throws an error. Defaults to\n\t * {@link onUnexpectedError}\n\t */\n\tonListenerError?: (e: any) => void;\n\t/**\n\t * Number of listeners that are allowed before assuming a leak. Default to\n\t * a globally configured value\n\t *\n\t * @see setGlobalLeakWarningThreshold\n\t */\n\tleakWarningThreshold?: number;\n\t/**\n\t * Pass in a delivery queue, which is useful for ensuring\n\t * in order event delivery across multiple emitters.\n\t */\n\tdeliveryQueue?: EventDeliveryQueue;\n\n\t/** ONLY enable this during development */\n\t_profName?: string;\n}\n\n\nexport class EventProfiling {\n\n\tstatic readonly all = new Set<EventProfiling>();\n\n\tprivate static _idPool = 0;\n\n\treadonly name: string;\n\tpublic listenerCount: number = 0;\n\tpublic invocationCount = 0;\n\tpublic elapsedOverall = 0;\n\tpublic durations: number[] = [];\n\n\tprivate _stopWatch?: StopWatch;\n\n\tconstructor(name: string) {\n\t\tthis.name = `${name}_${EventProfiling._idPool++}`;\n\t\tEventProfiling.all.add(this);\n\t}\n\n\tstart(listenerCount: number): void {\n\t\tthis._stopWatch = new StopWatch();\n\t\tthis.listenerCount = listenerCount;\n\t}\n\n\tstop(): void {\n\t\tif (this._stopWatch) {\n\t\t\tconst elapsed = this._stopWatch.elapsed();\n\t\t\tthis.durations.push(elapsed);\n\t\t\tthis.elapsedOverall += elapsed;\n\t\t\tthis.invocationCount += 1;\n\t\t\tthis._stopWatch = undefined;\n\t\t}\n\t}\n}\n\nlet _globalLeakWarningThreshold = -1;\nexport function setGlobalLeakWarningThreshold(n: number): IDisposable {\n\tconst oldValue = _globalLeakWarningThreshold;\n\t_globalLeakWarningThreshold = n;\n\treturn {\n\t\tdispose() {\n\t\t\t_globalLeakWarningThreshold = oldValue;\n\t\t}\n\t};\n}\n\nclass LeakageMonitor {\n\n\tprivate static _idPool = 1;\n\n\tprivate _stacks: Map<string, number> | undefined;\n\tprivate _warnCountdown: number = 0;\n\n\tconstructor(\n\t\tprivate readonly _errorHandler: (err: Error) => void,\n\t\treadonly threshold: number,\n\t\treadonly name: string = (LeakageMonitor._idPool++).toString(16).padStart(3, '0')\n\t) { }\n\n\tdispose(): void {\n\t\tthis._stacks?.clear();\n\t}\n\n\tcheck(stack: Stacktrace, listenerCount: number): undefined | (() => void) {\n\n\t\tconst threshold = this.threshold;\n\t\tif (threshold <= 0 || listenerCount < threshold) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (!this._stacks) {\n\t\t\tthis._stacks = new Map();\n\t\t}\n\t\tconst count = (this._stacks.get(stack.value) || 0);\n\t\tthis._stacks.set(stack.value, count + 1);\n\t\tthis._warnCountdown -= 1;\n\n\t\tif (this._warnCountdown <= 0) {\n\t\t\t// only warn on first exceed and then every time the limit\n\t\t\t// is exceeded by 50% again\n\t\t\tthis._warnCountdown = threshold * 0.5;\n\n\t\t\tconst [topStack, topCount] = this.getMostFrequentStack()!;\n\t\t\tconst message = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`;\n\t\t\tconsole.warn(message);\n\t\t\tconsole.warn(topStack!);\n\n\t\t\tconst error = new ListenerLeakError(message, topStack);\n\t\t\tthis._errorHandler(error);\n\t\t}\n\n\t\treturn () => {\n\t\t\tconst count = (this._stacks!.get(stack.value) || 0);\n\t\t\tthis._stacks!.set(stack.value, count - 1);\n\t\t};\n\t}\n\n\tgetMostFrequentStack(): [string, number] | undefined {\n\t\tif (!this._stacks) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet topStack: [string, number] | undefined;\n\t\tlet topCount: number = 0;\n\t\tfor (const [stack, count] of this._stacks) {\n\t\t\tif (!topStack || topCount < count) {\n\t\t\t\ttopStack = [stack, count];\n\t\t\t\ttopCount = count;\n\t\t\t}\n\t\t}\n\t\treturn topStack;\n\t}\n}\n\nclass Stacktrace {\n\n\tstatic create() {\n\t\tconst err = new Error();\n\t\treturn new Stacktrace(err.stack ?? '');\n\t}\n\n\tprivate constructor(readonly value: string) { }\n\n\tprint() {\n\t\tconsole.warn(this.value.split('\\n').slice(2).join('\\n'));\n\t}\n}\n\n// error that is logged when going over the configured listener threshold\nexport class ListenerLeakError extends Error {\n\tconstructor(message: string, stack: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ListenerLeakError';\n\t\tthis.stack = stack;\n\t}\n}\n\n// SEVERE error that is logged when having gone way over the configured listener\n// threshold so that the emitter refuses to accept more listeners\nexport class ListenerRefusalError extends Error {\n\tconstructor(message: string, stack: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ListenerRefusalError';\n\t\tthis.stack = stack;\n\t}\n}\n\nlet id = 0;\nclass UniqueContainer<T> {\n\tstack?: Stacktrace;\n\tpublic id = id++;\n\tconstructor(public readonly value: T) { }\n}\nconst compactionThreshold = 2;\n\ntype ListenerContainer<T> = UniqueContainer<(data: T) => void>;\ntype ListenerOrListeners<T> = (ListenerContainer<T> | undefined)[] | ListenerContainer<T>;\n\nconst forEachListener = <T>(listeners: ListenerOrListeners<T>, fn: (c: ListenerContainer<T>) => void) => {\n\tif (listeners instanceof UniqueContainer) {\n\t\tfn(listeners);\n\t} else {\n\t\tfor (let i = 0; i < listeners.length; i++) {\n\t\t\tconst l = listeners[i];\n\t\t\tif (l) {\n\t\t\t\tfn(l);\n\t\t\t}\n\t\t}\n\t}\n};\n\n/**\n * The Emitter can be used to expose an Event to the public\n * to fire it from the insides.\n * Sample:\n\tclass Document {\n\n\t\tprivate readonly _onDidChange = new Emitter<(value:string)=>any>();\n\n\t\tpublic onDidChange = this._onDidChange.event;\n\n\t\t// getter-style\n\t\t// get onDidChange(): Event<(value:string)=>any> {\n\t\t// \treturn this._onDidChange.event;\n\t\t// }\n\n\t\tprivate _doIt() {\n\t\t\t//...\n\t\t\tthis._onDidChange.fire(value);\n\t\t}\n\t}\n */\nexport class Emitter<T> {\n\n\tprivate readonly _options?: EmitterOptions;\n\tprivate readonly _leakageMon?: LeakageMonitor;\n\tprivate readonly _perfMon?: EventProfiling;\n\tprivate _disposed?: true;\n\tprivate _event?: Event<T>;\n\n\t/**\n\t * A listener, or list of listeners. A single listener is the most common\n\t * for event emitters (#185789), so we optimize that special case to avoid\n\t * wrapping it in an array (just like Node.js itself.)\n\t *\n\t * A list of listeners never 'downgrades' back to a plain function if\n\t * listeners are removed, for two reasons:\n\t *\n\t *  1. That's complicated (especially with the deliveryQueue)\n\t *  2. A listener with >1 listener is likely to have >1 listener again at\n\t *     some point, and swapping between arrays and functions may[citation needed]\n\t *     introduce unnecessary work and garbage.\n\t *\n\t * The array listeners can be 'sparse', to avoid reallocating the array\n\t * whenever any listener is added or removed. If more than `1 / compactionThreshold`\n\t * of the array is empty, only then is it resized.\n\t */\n\tprotected _listeners?: ListenerOrListeners<T>;\n\n\t/**\n\t * Always to be defined if _listeners is an array. It's no longer a true\n\t * queue, but holds the dispatching 'state'. If `fire()` is called on an\n\t * emitter, any work left in the _deliveryQueue is finished first.\n\t */\n\tprivate _deliveryQueue?: EventDeliveryQueuePrivate;\n\tprotected _size = 0;\n\n\tconstructor(options?: EmitterOptions) {\n\t\tthis._options = options;\n\t\tthis._leakageMon = (_globalLeakWarningThreshold > 0 || this._options?.leakWarningThreshold)\n\t\t\t? new LeakageMonitor(options?.onListenerError ?? onUnexpectedError, this._options?.leakWarningThreshold ?? _globalLeakWarningThreshold) :\n\t\t\tundefined;\n\t\tthis._perfMon = this._options?._profName ? new EventProfiling(this._options._profName) : undefined;\n\t\tthis._deliveryQueue = this._options?.deliveryQueue as EventDeliveryQueuePrivate | undefined;\n\t}\n\n\tdispose() {\n\t\tif (!this._disposed) {\n\t\t\tthis._disposed = true;\n\n\t\t\t// It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter\n\t\t\t// alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and\n\t\t\t// unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the\n\t\t\t// the following programming pattern is very popular:\n\t\t\t//\n\t\t\t// const someModel = this._disposables.add(new ModelObject()); // (1) create and register model\n\t\t\t// this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener\n\t\t\t// ...later...\n\t\t\t// this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the \"overall dispose\" is done\n\n\t\t\tif (this._deliveryQueue?.current === this) {\n\t\t\t\tthis._deliveryQueue.reset();\n\t\t\t}\n\t\t\tif (this._listeners) {\n\t\t\t\tif (_enableDisposeWithListenerWarning) {\n\t\t\t\t\tconst listeners = this._listeners;\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tforEachListener(listeners, l => l.stack?.print());\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tthis._listeners = undefined;\n\t\t\t\tthis._size = 0;\n\t\t\t}\n\t\t\tthis._options?.onDidRemoveLastListener?.();\n\t\t\tthis._leakageMon?.dispose();\n\t\t}\n\t}\n\n\t/**\n\t * For the public to allow to subscribe\n\t * to events from this Emitter\n\t */\n\tget event(): Event<T> {\n\t\tthis._event ??= (callback: (e: T) => unknown, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n\t\t\tif (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {\n\t\t\t\tconst message = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;\n\t\t\t\tconsole.warn(message);\n\n\t\t\t\tconst tuple = this._leakageMon.getMostFrequentStack() ?? ['UNKNOWN stack', -1];\n\t\t\t\tconst error = new ListenerRefusalError(`${message}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]);\n\t\t\t\tconst errorHandler = this._options?.onListenerError || onUnexpectedError;\n\t\t\t\terrorHandler(error);\n\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tif (this._disposed) {\n\t\t\t\t// todo: should we warn if a listener is added to a disposed emitter? This happens often\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tif (thisArgs) {\n\t\t\t\tcallback = callback.bind(thisArgs);\n\t\t\t}\n\n\t\t\tconst contained = new UniqueContainer(callback);\n\n\t\t\tlet removeMonitor: Function | undefined;\n\t\t\tlet stack: Stacktrace | undefined;\n\t\t\tif (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) {\n\t\t\t\t// check and record this emitter for potential leakage\n\t\t\t\tcontained.stack = Stacktrace.create();\n\t\t\t\tremoveMonitor = this._leakageMon.check(contained.stack, this._size + 1);\n\t\t\t}\n\n\t\t\tif (_enableDisposeWithListenerWarning) {\n\t\t\t\tcontained.stack = stack ?? Stacktrace.create();\n\t\t\t}\n\n\t\t\tif (!this._listeners) {\n\t\t\t\tthis._options?.onWillAddFirstListener?.(this);\n\t\t\t\tthis._listeners = contained;\n\t\t\t\tthis._options?.onDidAddFirstListener?.(this);\n\t\t\t} else if (this._listeners instanceof UniqueContainer) {\n\t\t\t\tthis._deliveryQueue ??= new EventDeliveryQueuePrivate();\n\t\t\t\tthis._listeners = [this._listeners, contained];\n\t\t\t} else {\n\t\t\t\tthis._listeners.push(contained);\n\t\t\t}\n\t\t\tthis._options?.onDidAddListener?.(this);\n\n\t\t\tthis._size++;\n\n\n\t\t\tconst result = toDisposable(() => {\n\t\t\t\tremoveMonitor?.();\n\t\t\t\tthis._removeListener(contained);\n\t\t\t});\n\t\t\tif (disposables instanceof DisposableStore) {\n\t\t\t\tdisposables.add(result);\n\t\t\t} else if (Array.isArray(disposables)) {\n\t\t\t\tdisposables.push(result);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\n\t\treturn this._event;\n\t}\n\n\tprivate _removeListener(listener: ListenerContainer<T>) {\n\t\tthis._options?.onWillRemoveListener?.(this);\n\n\t\tif (!this._listeners) {\n\t\t\treturn; // expected if a listener gets disposed\n\t\t}\n\n\t\tif (this._size === 1) {\n\t\t\tthis._listeners = undefined;\n\t\t\tthis._options?.onDidRemoveLastListener?.(this);\n\t\t\tthis._size = 0;\n\t\t\treturn;\n\t\t}\n\n\t\t// size > 1 which requires that listeners be a list:\n\t\tconst listeners = this._listeners as (ListenerContainer<T> | undefined)[];\n\n\t\tconst index = listeners.indexOf(listener);\n\t\tif (index === -1) {\n\t\t\tconsole.log('disposed?', this._disposed);\n\t\t\tconsole.log('size?', this._size);\n\t\t\tconsole.log('arr?', JSON.stringify(this._listeners));\n\t\t\tthrow new Error('Attempted to dispose unknown listener');\n\t\t}\n\n\t\tthis._size--;\n\t\tlisteners[index] = undefined;\n\n\t\tconst adjustDeliveryQueue = this._deliveryQueue!.current === this;\n\t\tif (this._size * compactionThreshold <= listeners.length) {\n\t\t\tlet n = 0;\n\t\t\tfor (let i = 0; i < listeners.length; i++) {\n\t\t\t\tif (listeners[i]) {\n\t\t\t\t\tlisteners[n++] = listeners[i];\n\t\t\t\t} else if (adjustDeliveryQueue && n < this._deliveryQueue!.end) {\n\t\t\t\t\tthis._deliveryQueue!.end--;\n\t\t\t\t\tif (n < this._deliveryQueue!.i) {\n\t\t\t\t\t\tthis._deliveryQueue!.i--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlisteners.length = n;\n\t\t}\n\t}\n\n\tprivate _deliver(listener: undefined | UniqueContainer<(value: T) => void>, value: T) {\n\t\tif (!listener) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst errorHandler = this._options?.onListenerError || onUnexpectedError;\n\t\tif (!errorHandler) {\n\t\t\tlistener.value(value);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlistener.value(value);\n\t\t} catch (e) {\n\t\t\terrorHandler(e);\n\t\t}\n\t}\n\n\t/** Delivers items in the queue. Assumes the queue is ready to go. */\n\tprivate _deliverQueue(dq: EventDeliveryQueuePrivate) {\n\t\tconst listeners = dq.current!._listeners! as (ListenerContainer<T> | undefined)[];\n\t\twhile (dq.i < dq.end) {\n\t\t\t// important: dq.i is incremented before calling deliver() because it might reenter deliverQueue()\n\t\t\tthis._deliver(listeners[dq.i++], dq.value as T);\n\t\t}\n\t\tdq.reset();\n\t}\n\n\t/**\n\t * To be kept private to fire an event to\n\t * subscribers\n\t */\n\tfire(event: T): void {\n\t\tif (this._deliveryQueue?.current) {\n\t\t\tthis._deliverQueue(this._deliveryQueue);\n\t\t\tthis._perfMon?.stop(); // last fire() will have starting perfmon, stop it before starting the next dispatch\n\t\t}\n\n\t\tthis._perfMon?.start(this._size);\n\n\t\tif (!this._listeners) {\n\t\t\t// no-op\n\t\t} else if (this._listeners instanceof UniqueContainer) {\n\t\t\tthis._deliver(this._listeners, event);\n\t\t} else {\n\t\t\tconst dq = this._deliveryQueue!;\n\t\t\tdq.enqueue(this, event, this._listeners.length);\n\t\t\tthis._deliverQueue(dq);\n\t\t}\n\n\t\tthis._perfMon?.stop();\n\t}\n\n\thasListeners(): boolean {\n\t\treturn this._size > 0;\n\t}\n}\n\nexport interface EventDeliveryQueue {\n\t_isEventDeliveryQueue: true;\n}\n\nexport const createEventDeliveryQueue = (): EventDeliveryQueue => new EventDeliveryQueuePrivate();\n\nclass EventDeliveryQueuePrivate implements EventDeliveryQueue {\n\tdeclare _isEventDeliveryQueue: true;\n\n\t/**\n\t * Index in current's listener list.\n\t */\n\tpublic i = -1;\n\n\t/**\n\t * The last index in the listener's list to deliver.\n\t */\n\tpublic end = 0;\n\n\t/**\n\t * Emitter currently being dispatched on. Emitter._listeners is always an array.\n\t */\n\tpublic current?: Emitter<any>;\n\t/**\n\t * Currently emitting value. Defined whenever `current` is.\n\t */\n\tpublic value?: unknown;\n\n\tpublic enqueue<T>(emitter: Emitter<T>, value: T, end: number) {\n\t\tthis.i = 0;\n\t\tthis.end = end;\n\t\tthis.current = emitter;\n\t\tthis.value = value;\n\t}\n\n\tpublic reset() {\n\t\tthis.i = this.end; // force any current emission loop to stop, mainly for during dispose\n\t\tthis.current = undefined;\n\t\tthis.value = undefined;\n\t}\n}\n\nexport interface IWaitUntil {\n\ttoken: CancellationToken;\n\twaitUntil(thenable: Promise<unknown>): void;\n}\n\nexport type IWaitUntilData<T> = Omit<Omit<T, 'waitUntil'>, 'token'>;\n\nexport class AsyncEmitter<T extends IWaitUntil> extends Emitter<T> {\n\n\tprivate _asyncDeliveryQueue?: LinkedList<[(ev: T) => void, IWaitUntilData<T>]>;\n\n\tasync fireAsync(data: IWaitUntilData<T>, token: CancellationToken, promiseJoin?: (p: Promise<unknown>, listener: Function) => Promise<unknown>): Promise<void> {\n\t\tif (!this._listeners) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._asyncDeliveryQueue) {\n\t\t\tthis._asyncDeliveryQueue = new LinkedList();\n\t\t}\n\n\t\tforEachListener(this._listeners, listener => this._asyncDeliveryQueue!.push([listener.value, data]));\n\n\t\twhile (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) {\n\n\t\t\tconst [listener, data] = this._asyncDeliveryQueue.shift()!;\n\t\t\tconst thenables: Promise<unknown>[] = [];\n\n\t\t\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\t\t\tconst event = <T>{\n\t\t\t\t...data,\n\t\t\t\ttoken,\n\t\t\t\twaitUntil: (p: Promise<unknown>): void => {\n\t\t\t\t\tif (Object.isFrozen(thenables)) {\n\t\t\t\t\t\tthrow new Error('waitUntil can NOT be called asynchronous');\n\t\t\t\t\t}\n\t\t\t\t\tif (promiseJoin) {\n\t\t\t\t\t\tp = promiseJoin(p, listener);\n\t\t\t\t\t}\n\t\t\t\t\tthenables.push(p);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttry {\n\t\t\t\tlistener(event);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedError(e);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// freeze thenables-collection to enforce sync-calls to\n\t\t\t// wait until and then wait for all thenables to resolve\n\t\t\tObject.freeze(thenables);\n\n\t\t\tawait Promise.allSettled(thenables).then(values => {\n\t\t\t\tfor (const value of values) {\n\t\t\t\t\tif (value.status === 'rejected') {\n\t\t\t\t\t\tonUnexpectedError(value.reason);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n}\n\n\nexport class PauseableEmitter<T> extends Emitter<T> {\n\n\tprivate _isPaused = 0;\n\tprotected _eventQueue = new LinkedList<T>();\n\tprivate _mergeFn?: (input: T[]) => T;\n\n\tpublic get isPaused(): boolean {\n\t\treturn this._isPaused !== 0;\n\t}\n\n\tconstructor(options?: EmitterOptions & { merge?: (input: T[]) => T }) {\n\t\tsuper(options);\n\t\tthis._mergeFn = options?.merge;\n\t}\n\n\tpause(): void {\n\t\tthis._isPaused++;\n\t}\n\n\tresume(): void {\n\t\tif (this._isPaused !== 0 && --this._isPaused === 0) {\n\t\t\tif (this._mergeFn) {\n\t\t\t\t// use the merge function to create a single composite\n\t\t\t\t// event. make a copy in case firing pauses this emitter\n\t\t\t\tif (this._eventQueue.size > 0) {\n\t\t\t\t\tconst events = Array.from(this._eventQueue);\n\t\t\t\t\tthis._eventQueue.clear();\n\t\t\t\t\tsuper.fire(this._mergeFn(events));\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t// no merging, fire each event individually and test\n\t\t\t\t// that this emitter isn't paused halfway through\n\t\t\t\twhile (!this._isPaused && this._eventQueue.size !== 0) {\n\t\t\t\t\tsuper.fire(this._eventQueue.shift()!);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\toverride fire(event: T): void {\n\t\tif (this._size) {\n\t\t\tif (this._isPaused !== 0) {\n\t\t\t\tthis._eventQueue.push(event);\n\t\t\t} else {\n\t\t\t\tsuper.fire(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class DebounceEmitter<T> extends PauseableEmitter<T> {\n\n\tprivate readonly _delay: number;\n\tprivate _handle: Timeout | undefined;\n\n\tconstructor(options: EmitterOptions & { merge: (input: T[]) => T; delay?: number }) {\n\t\tsuper(options);\n\t\tthis._delay = options.delay ?? 100;\n\t}\n\n\toverride fire(event: T): void {\n\t\tif (!this._handle) {\n\t\t\tthis.pause();\n\t\t\tthis._handle = setTimeout(() => {\n\t\t\t\tthis._handle = undefined;\n\t\t\t\tthis.resume();\n\t\t\t}, this._delay);\n\t\t}\n\t\tsuper.fire(event);\n\t}\n}\n\n/**\n * An emitter which queue all events and then process them at the\n * end of the event loop.\n */\nexport class MicrotaskEmitter<T> extends Emitter<T> {\n\tprivate _queuedEvents: T[] = [];\n\tprivate _mergeFn?: (input: T[]) => T;\n\n\tconstructor(options?: EmitterOptions & { merge?: (input: T[]) => T }) {\n\t\tsuper(options);\n\t\tthis._mergeFn = options?.merge;\n\t}\n\toverride fire(event: T): void {\n\n\t\tif (!this.hasListeners()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._queuedEvents.push(event);\n\t\tif (this._queuedEvents.length === 1) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (this._mergeFn) {\n\t\t\t\t\tsuper.fire(this._mergeFn(this._queuedEvents));\n\t\t\t\t} else {\n\t\t\t\t\tthis._queuedEvents.forEach(e => super.fire(e));\n\t\t\t\t}\n\t\t\t\tthis._queuedEvents = [];\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * An event emitter that multiplexes many events into a single event.\n *\n * @example Listen to the `onData` event of all `Thing`s, dynamically adding and removing `Thing`s\n * to the multiplexer as needed.\n *\n * ```typescript\n * const anythingDataMultiplexer = new EventMultiplexer<{ data: string }>();\n *\n * const thingListeners = DisposableMap<Thing, IDisposable>();\n *\n * thingService.onDidAddThing(thing => {\n *   thingListeners.set(thing, anythingDataMultiplexer.add(thing.onData);\n * });\n * thingService.onDidRemoveThing(thing => {\n *   thingListeners.deleteAndDispose(thing);\n * });\n *\n * anythingDataMultiplexer.event(e => {\n *   console.log('Something fired data ' + e.data)\n * });\n * ```\n */\nexport class EventMultiplexer<T> implements IDisposable {\n\n\tprivate readonly emitter: Emitter<T>;\n\tprivate hasListeners = false;\n\tprivate events: { event: Event<T>; listener: IDisposable | null }[] = [];\n\n\tconstructor() {\n\t\tthis.emitter = new Emitter<T>({\n\t\t\tonWillAddFirstListener: () => this.onFirstListenerAdd(),\n\t\t\tonDidRemoveLastListener: () => this.onLastListenerRemove()\n\t\t});\n\t}\n\n\tget event(): Event<T> {\n\t\treturn this.emitter.event;\n\t}\n\n\tadd(event: Event<T>): IDisposable {\n\t\tconst e = { event: event, listener: null };\n\t\tthis.events.push(e);\n\n\t\tif (this.hasListeners) {\n\t\t\tthis.hook(e);\n\t\t}\n\n\t\tconst dispose = () => {\n\t\t\tif (this.hasListeners) {\n\t\t\t\tthis.unhook(e);\n\t\t\t}\n\n\t\t\tconst idx = this.events.indexOf(e);\n\t\t\tthis.events.splice(idx, 1);\n\t\t};\n\n\t\treturn toDisposable(createSingleCallFunction(dispose));\n\t}\n\n\tprivate onFirstListenerAdd(): void {\n\t\tthis.hasListeners = true;\n\t\tthis.events.forEach(e => this.hook(e));\n\t}\n\n\tprivate onLastListenerRemove(): void {\n\t\tthis.hasListeners = false;\n\t\tthis.events.forEach(e => this.unhook(e));\n\t}\n\n\tprivate hook(e: { event: Event<T>; listener: IDisposable | null }): void {\n\t\te.listener = e.event(r => this.emitter.fire(r));\n\t}\n\n\tprivate unhook(e: { event: Event<T>; listener: IDisposable | null }): void {\n\t\te.listener?.dispose();\n\t\te.listener = null;\n\t}\n\n\tdispose(): void {\n\t\tthis.emitter.dispose();\n\n\t\tfor (const e of this.events) {\n\t\t\te.listener?.dispose();\n\t\t}\n\t\tthis.events = [];\n\t}\n}\n\nexport interface IDynamicListEventMultiplexer<TEventType> extends IDisposable {\n\treadonly event: Event<TEventType>;\n}\nexport class DynamicListEventMultiplexer<TItem, TEventType> implements IDynamicListEventMultiplexer<TEventType> {\n\tprivate readonly _store = new DisposableStore();\n\n\treadonly event: Event<TEventType>;\n\n\tconstructor(\n\t\titems: TItem[],\n\t\tonAddItem: Event<TItem>,\n\t\tonRemoveItem: Event<TItem>,\n\t\tgetEvent: (item: TItem) => Event<TEventType>\n\t) {\n\t\tconst multiplexer = this._store.add(new EventMultiplexer<TEventType>());\n\t\tconst itemListeners = this._store.add(new DisposableMap<TItem, IDisposable>());\n\n\t\tfunction addItem(instance: TItem) {\n\t\t\titemListeners.set(instance, multiplexer.add(getEvent(instance)));\n\t\t}\n\n\t\t// Existing items\n\t\tfor (const instance of items) {\n\t\t\taddItem(instance);\n\t\t}\n\n\t\t// Added items\n\t\tthis._store.add(onAddItem(instance => {\n\t\t\taddItem(instance);\n\t\t}));\n\n\t\t// Removed items\n\t\tthis._store.add(onRemoveItem(instance => {\n\t\t\titemListeners.deleteAndDispose(instance);\n\t\t}));\n\n\t\tthis.event = multiplexer.event;\n\t}\n\n\tdispose() {\n\t\tthis._store.dispose();\n\t}\n}\n\n/**\n * The EventBufferer is useful in situations in which you want\n * to delay firing your events during some code.\n * You can wrap that code and be sure that the event will not\n * be fired during that wrap.\n *\n * ```\n * const emitter: Emitter;\n * const delayer = new EventDelayer();\n * const delayedEvent = delayer.wrapEvent(emitter.event);\n *\n * delayedEvent(console.log);\n *\n * delayer.bufferEvents(() => {\n *   emitter.fire(); // event will not be fired yet\n * });\n *\n * // event will only be fired at this point\n * ```\n */\nexport class EventBufferer {\n\n\tprivate data: { buffers: Function[] }[] = [];\n\n\twrapEvent<T>(event: Event<T>): Event<T>;\n\twrapEvent<T>(event: Event<T>, reduce: (last: T | undefined, event: T) => T): Event<T>;\n\twrapEvent<T, O>(event: Event<T>, reduce: (last: O | undefined, event: T) => O, initial: O): Event<O>;\n\twrapEvent<T, O>(event: Event<T>, reduce?: (last: T | O | undefined, event: T) => T | O, initial?: O): Event<O | T> {\n\t\treturn (listener, thisArgs?, disposables?) => {\n\t\t\treturn event(i => {\n\t\t\t\tconst data = this.data[this.data.length - 1];\n\n\t\t\t\t// Non-reduce scenario\n\t\t\t\tif (!reduce) {\n\t\t\t\t\t// Buffering case\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\tdata.buffers.push(() => listener.call(thisArgs, i));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Not buffering case\n\t\t\t\t\t\tlistener.call(thisArgs, i);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Reduce scenario\n\t\t\t\tconst reduceData = data as typeof data & {\n\t\t\t\t\t/**\n\t\t\t\t\t * The accumulated items that will be reduced.\n\t\t\t\t\t */\n\t\t\t\t\titems?: T[];\n\t\t\t\t\t/**\n\t\t\t\t\t * The reduced result cached to be shared with other listeners.\n\t\t\t\t\t */\n\t\t\t\t\treducedResult?: T | O;\n\t\t\t\t};\n\n\t\t\t\t// Not buffering case\n\t\t\t\tif (!reduceData) {\n\t\t\t\t\t// TODO: Is there a way to cache this reduce call for all listeners?\n\t\t\t\t\tlistener.call(thisArgs, reduce(initial, i));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Buffering case\n\t\t\t\treduceData.items ??= [];\n\t\t\t\treduceData.items.push(i);\n\t\t\t\tif (reduceData.buffers.length === 0) {\n\t\t\t\t\t// Include a single buffered function that will reduce all events when we're done buffering events\n\t\t\t\t\tdata.buffers.push(() => {\n\t\t\t\t\t\t// cache the reduced result so that the value can be shared across all listeners\n\t\t\t\t\t\treduceData.reducedResult ??= initial\n\t\t\t\t\t\t\t? reduceData.items!.reduce(reduce as (last: O | undefined, event: T) => O, initial)\n\t\t\t\t\t\t\t: reduceData.items!.reduce(reduce as (last: T | undefined, event: T) => T);\n\t\t\t\t\t\tlistener.call(thisArgs, reduceData.reducedResult);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}, undefined, disposables);\n\t\t};\n\t}\n\n\tbufferEvents<R = void>(fn: () => R): R {\n\t\tconst data = { buffers: new Array<Function>() };\n\t\tthis.data.push(data);\n\t\tconst r = fn();\n\t\tthis.data.pop();\n\t\tdata.buffers.forEach(flush => flush());\n\t\treturn r;\n\t}\n}\n\n/**\n * A Relay is an event forwarder which functions as a replugabble event pipe.\n * Once created, you can connect an input event to it and it will simply forward\n * events from that input event through its own `event` property. The `input`\n * can be changed at any point in time.\n */\nexport class Relay<T> implements IDisposable {\n\n\tprivate listening = false;\n\tprivate inputEvent: Event<T> = Event.None;\n\tprivate inputEventListener: IDisposable = Disposable.None;\n\n\tprivate readonly emitter = new Emitter<T>({\n\t\tonDidAddFirstListener: () => {\n\t\t\tthis.listening = true;\n\t\t\tthis.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n\t\t},\n\t\tonDidRemoveLastListener: () => {\n\t\t\tthis.listening = false;\n\t\t\tthis.inputEventListener.dispose();\n\t\t}\n\t});\n\n\treadonly event: Event<T> = this.emitter.event;\n\n\tset input(event: Event<T>) {\n\t\tthis.inputEvent = event;\n\n\t\tif (this.listening) {\n\t\t\tthis.inputEventListener.dispose();\n\t\t\tthis.inputEventListener = event(this.emitter.fire, this.emitter);\n\t\t}\n\t}\n\n\tdispose() {\n\t\tthis.inputEventListener.dispose();\n\t\tthis.emitter.dispose();\n\t}\n}\n\nexport interface IValueWithChangeEvent<T> {\n\treadonly onDidChange: Event<void>;\n\tget value(): T;\n}\n\nexport class ValueWithChangeEvent<T> implements IValueWithChangeEvent<T> {\n\tpublic static const<T>(value: T): IValueWithChangeEvent<T> {\n\t\treturn new ConstValueWithChangeEvent(value);\n\t}\n\n\tprivate readonly _onDidChange = new Emitter<void>();\n\treadonly onDidChange: Event<void> = this._onDidChange.event;\n\n\tconstructor(private _value: T) { }\n\n\tget value(): T {\n\t\treturn this._value;\n\t}\n\n\tset value(value: T) {\n\t\tif (value !== this._value) {\n\t\t\tthis._value = value;\n\t\t\tthis._onDidChange.fire(undefined);\n\t\t}\n\t}\n}\n\nclass ConstValueWithChangeEvent<T> implements IValueWithChangeEvent<T> {\n\tpublic readonly onDidChange: Event<void> = Event.None;\n\n\tconstructor(readonly value: T) { }\n}\n\n/**\n * @param handleItem Is called for each item in the set (but only the first time the item is seen in the set).\n * \tThe returned disposable is disposed if the item is no longer in the set.\n */\nexport function trackSetChanges<T>(getData: () => ReadonlySet<T>, onDidChangeData: Event<unknown>, handleItem: (d: T) => IDisposable): IDisposable {\n\tconst map = new DisposableMap<T, IDisposable>();\n\tlet oldData = new Set(getData());\n\tfor (const d of oldData) {\n\t\tmap.set(d, handleItem(d));\n\t}\n\n\tconst store = new DisposableStore();\n\tstore.add(onDidChangeData(() => {\n\t\tconst newData = getData();\n\t\tconst diff = diffSets(oldData, newData);\n\t\tfor (const r of diff.removed) {\n\t\t\tmap.deleteAndDispose(r);\n\t\t}\n\t\tfor (const a of diff.added) {\n\t\t\tmap.set(a, handleItem(a));\n\t\t}\n\t\toldData = new Set(newData);\n\t}));\n\tstore.add(map);\n\treturn store;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from './event.js';\nimport { DisposableStore, IDisposable } from './lifecycle.js';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event<any> = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze<CancellationToken>({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter<any> | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event<any> {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter<any>();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken, CancellationTokenSource } from './cancellation.js';\nimport { IDisposable } from './lifecycle.js';\n\nexport interface CacheResult<T> extends IDisposable {\n\tpromise: Promise<T>;\n}\n\nexport class Cache<T> {\n\n\tprivate result: CacheResult<T> | null = null;\n\tconstructor(private task: (ct: CancellationToken) => Promise<T>) { }\n\n\tget(): CacheResult<T> {\n\t\tif (this.result) {\n\t\t\treturn this.result;\n\t\t}\n\n\t\tconst cts = new CancellationTokenSource();\n\t\tconst promise = this.task(cts.token);\n\n\t\tthis.result = {\n\t\t\tpromise,\n\t\t\tdispose: () => {\n\t\t\t\tthis.result = null;\n\t\t\t\tcts.cancel();\n\t\t\t\tcts.dispose();\n\t\t\t}\n\t\t};\n\n\t\treturn this.result;\n\t}\n}\n\nexport function identity<T>(t: T): T {\n\treturn t;\n}\n\ninterface ICacheOptions<TArg> {\n\t/**\n\t * The cache key is used to identify the cache entry.\n\t * Strict equality is used to compare cache keys.\n\t*/\n\tgetCacheKey: (arg: TArg) => unknown;\n}\n\n/**\n * Uses a LRU cache to make a given parametrized function cached.\n * Caches just the last key/value.\n*/\nexport class LRUCachedFunction<TArg, TComputed> {\n\tprivate lastCache: TComputed | undefined = undefined;\n\tprivate lastArgKey: unknown | undefined = undefined;\n\n\tprivate readonly _fn: (arg: TArg) => TComputed;\n\tprivate readonly _computeKey: (arg: TArg) => unknown;\n\n\tconstructor(fn: (arg: TArg) => TComputed);\n\tconstructor(options: ICacheOptions<TArg>, fn: (arg: TArg) => TComputed);\n\tconstructor(arg1: ICacheOptions<TArg> | ((arg: TArg) => TComputed), arg2?: (arg: TArg) => TComputed) {\n\t\tif (typeof arg1 === 'function') {\n\t\t\tthis._fn = arg1;\n\t\t\tthis._computeKey = identity;\n\t\t} else {\n\t\t\tthis._fn = arg2!;\n\t\t\tthis._computeKey = arg1.getCacheKey;\n\t\t}\n\t}\n\n\tpublic get(arg: TArg): TComputed {\n\t\tconst key = this._computeKey(arg);\n\t\tif (this.lastArgKey !== key) {\n\t\t\tthis.lastArgKey = key;\n\t\t\tthis.lastCache = this._fn(arg);\n\t\t}\n\t\treturn this.lastCache!;\n\t}\n}\n\n/**\n * Uses an unbounded cache to memoize the results of the given function.\n*/\nexport class CachedFunction<TArg, TComputed> {\n\tprivate readonly _map = new Map<TArg, TComputed>();\n\tprivate readonly _map2 = new Map<unknown, TComputed>();\n\tpublic get cachedValues(): ReadonlyMap<TArg, TComputed> {\n\t\treturn this._map;\n\t}\n\n\tprivate readonly _fn: (arg: TArg) => TComputed;\n\tprivate readonly _computeKey: (arg: TArg) => unknown;\n\n\tconstructor(fn: (arg: TArg) => TComputed);\n\tconstructor(options: ICacheOptions<TArg>, fn: (arg: TArg) => TComputed);\n\tconstructor(arg1: ICacheOptions<TArg> | ((arg: TArg) => TComputed), arg2?: (arg: TArg) => TComputed) {\n\t\tif (typeof arg1 === 'function') {\n\t\t\tthis._fn = arg1;\n\t\t\tthis._computeKey = identity;\n\t\t} else {\n\t\t\tthis._fn = arg2!;\n\t\t\tthis._computeKey = arg1.getCacheKey;\n\t\t}\n\t}\n\n\tpublic get(arg: TArg): TComputed {\n\t\tconst key = this._computeKey(arg);\n\t\tif (this._map2.has(key)) {\n\t\t\treturn this._map2.get(key)!;\n\t\t}\n\n\t\tconst value = this._fn(arg);\n\t\tthis._map.set(arg, value);\n\t\tthis._map2.set(key, value);\n\t\treturn value;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport class Lazy<T> {\n\n\tprivate _didRun: boolean = false;\n\tprivate _value?: T;\n\tprivate _error: Error | undefined;\n\n\tconstructor(\n\t\tprivate readonly executor: () => T,\n\t) { }\n\n\t/**\n\t * True if the lazy value has been resolved.\n\t */\n\tget hasValue() { return this._didRun; }\n\n\t/**\n\t * Get the wrapped value.\n\t *\n\t * This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only\n\t * resolved once. `getValue` will re-throw exceptions that are hit while resolving the value\n\t */\n\tget value(): T {\n\t\tif (!this._didRun) {\n\t\t\ttry {\n\t\t\t\tthis._value = this.executor();\n\t\t\t} catch (err) {\n\t\t\t\tthis._error = err;\n\t\t\t} finally {\n\t\t\t\tthis._didRun = true;\n\t\t\t}\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n\n\t/**\n\t * Get the wrapped value without forcing evaluation.\n\t */\n\tget rawValue(): T | undefined { return this._value; }\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { LRUCachedFunction } from './cache.js';\nimport { CharCode } from './charCode.js';\nimport { Lazy } from './lazy.js';\nimport { Constants } from './uint.js';\n\nexport function isFalsyOrWhitespace(str: string | undefined): boolean {\n\tif (!str || typeof str !== 'string') {\n\t\treturn true;\n\t}\n\treturn str.trim().length === 0;\n}\n\nconst _formatRegexp = /{(\\d+)}/g;\n\n/**\n * Helper to produce a string with a variable number of arguments. Insert variable segments\n * into the string using the {n} notation where N is the index of the argument following the string.\n * @param value string to which formatting is applied\n * @param args replacements for {n}-entries\n */\nexport function format(value: string, ...args: any[]): string {\n\tif (args.length === 0) {\n\t\treturn value;\n\t}\n\treturn value.replace(_formatRegexp, function (match, group) {\n\t\tconst idx = parseInt(group, 10);\n\t\treturn isNaN(idx) || idx < 0 || idx >= args.length ?\n\t\t\tmatch :\n\t\t\targs[idx];\n\t});\n}\n\nconst _format2Regexp = /{([^}]+)}/g;\n\n/**\n * Helper to create a string from a template and a string record.\n * Similar to `format` but with objects instead of positional arguments.\n */\nexport function format2(template: string, values: Record<string, unknown>): string {\n\tif (Object.keys(values).length === 0) {\n\t\treturn template;\n\t}\n\treturn template.replace(_format2Regexp, (match, group) => (values[group] ?? match) as string);\n}\n\n/**\n * Encodes the given value so that it can be used as literal value in html attributes.\n *\n * In other words, computes `$val`, such that `attr` in `<div attr=\"$val\" />` has the runtime value `value`.\n * This prevents XSS injection.\n */\nexport function htmlAttributeEncodeValue(value: string): string {\n\treturn value.replace(/[<>\"'&]/g, ch => {\n\t\tswitch (ch) {\n\t\t\tcase '<': return '&lt;';\n\t\t\tcase '>': return '&gt;';\n\t\t\tcase '\"': return '&quot;';\n\t\t\tcase '\\'': return '&apos;';\n\t\t\tcase '&': return '&amp;';\n\t\t}\n\t\treturn ch;\n\t});\n}\n\n/**\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\n * being used e.g. in HTMLElement.innerHTML.\n */\nexport function escape(html: string): string {\n\treturn html.replace(/[<>&]/g, function (match) {\n\t\tswitch (match) {\n\t\t\tcase '<': return '&lt;';\n\t\t\tcase '>': return '&gt;';\n\t\t\tcase '&': return '&amp;';\n\t\t\tdefault: return match;\n\t\t}\n\t});\n}\n\n/**\n * Escapes regular expression characters in a given string\n */\nexport function escapeRegExpCharacters(value: string): string {\n\treturn value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\n}\n\n/**\n * Counts how often `substr` occurs inside `value`.\n */\nexport function count(value: string, substr: string): number {\n\tlet result = 0;\n\tlet index = value.indexOf(substr);\n\twhile (index !== -1) {\n\t\tresult++;\n\t\tindex = value.indexOf(substr, index + substr.length);\n\t}\n\treturn result;\n}\n\nexport function truncate(value: string, maxLength: number, suffix = Ellipsis): string {\n\tif (value.length <= maxLength) {\n\t\treturn value;\n\t}\n\n\treturn `${value.substr(0, maxLength)}${suffix}`;\n}\n\nexport function truncateMiddle(value: string, maxLength: number, suffix = Ellipsis): string {\n\tif (value.length <= maxLength) {\n\t\treturn value;\n\t}\n\n\tconst prefixLength = Math.ceil(maxLength / 2) - suffix.length / 2;\n\tconst suffixLength = Math.floor(maxLength / 2) - suffix.length / 2;\n\n\treturn `${value.substr(0, prefixLength)}${suffix}${value.substr(value.length - suffixLength)}`;\n}\n\n/**\n * Removes all occurrences of needle from the beginning and end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim (default is a blank)\n */\nexport function trim(haystack: string, needle: string = ' '): string {\n\tconst trimmed = ltrim(haystack, needle);\n\treturn rtrim(trimmed, needle);\n}\n\n/**\n * Removes all occurrences of needle from the beginning of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function ltrim(haystack: string, needle: string): string {\n\tif (!haystack || !needle) {\n\t\treturn haystack;\n\t}\n\n\tconst needleLen = needle.length;\n\tif (needleLen === 0 || haystack.length === 0) {\n\t\treturn haystack;\n\t}\n\n\tlet offset = 0;\n\n\twhile (haystack.indexOf(needle, offset) === offset) {\n\t\toffset = offset + needleLen;\n\t}\n\treturn haystack.substring(offset);\n}\n\n/**\n * Removes all occurrences of needle from the end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function rtrim(haystack: string, needle: string): string {\n\tif (!haystack || !needle) {\n\t\treturn haystack;\n\t}\n\n\tconst needleLen = needle.length,\n\t\thaystackLen = haystack.length;\n\n\tif (needleLen === 0 || haystackLen === 0) {\n\t\treturn haystack;\n\t}\n\n\tlet offset = haystackLen,\n\t\tidx = -1;\n\n\twhile (true) {\n\t\tidx = haystack.lastIndexOf(needle, offset - 1);\n\t\tif (idx === -1 || idx + needleLen !== offset) {\n\t\t\tbreak;\n\t\t}\n\t\tif (idx === 0) {\n\t\t\treturn '';\n\t\t}\n\t\toffset = idx;\n\t}\n\n\treturn haystack.substring(0, offset);\n}\n\nexport function convertSimple2RegExpPattern(pattern: string): string {\n\treturn pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\n\nexport function stripWildcards(pattern: string): string {\n\treturn pattern.replace(/\\*/g, '');\n}\n\nexport interface RegExpOptions {\n\tmatchCase?: boolean;\n\twholeWord?: boolean;\n\tmultiline?: boolean;\n\tglobal?: boolean;\n\tunicode?: boolean;\n}\n\nexport function createRegExp(searchString: string, isRegex: boolean, options: RegExpOptions = {}): RegExp {\n\tif (!searchString) {\n\t\tthrow new Error('Cannot create regex from empty string');\n\t}\n\tif (!isRegex) {\n\t\tsearchString = escapeRegExpCharacters(searchString);\n\t}\n\tif (options.wholeWord) {\n\t\tif (!/\\B/.test(searchString.charAt(0))) {\n\t\t\tsearchString = '\\\\b' + searchString;\n\t\t}\n\t\tif (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n\t\t\tsearchString = searchString + '\\\\b';\n\t\t}\n\t}\n\tlet modifiers = '';\n\tif (options.global) {\n\t\tmodifiers += 'g';\n\t}\n\tif (!options.matchCase) {\n\t\tmodifiers += 'i';\n\t}\n\tif (options.multiline) {\n\t\tmodifiers += 'm';\n\t}\n\tif (options.unicode) {\n\t\tmodifiers += 'u';\n\t}\n\n\treturn new RegExp(searchString, modifiers);\n}\n\nexport function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {\n\t// Exit early if it's one of these special cases which are meant to match\n\t// against an empty string\n\tif (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n\t\treturn false;\n\t}\n\n\t// We check against an empty string. If the regular expression doesn't advance\n\t// (e.g. ends in an endless loop) it will match an empty string.\n\tconst match = regexp.exec('');\n\treturn !!(match && regexp.lastIndex === 0);\n}\n\nexport function joinStrings(items: (string | undefined | null | false)[], separator: string): string {\n\treturn items.filter(item => item !== undefined && item !== null && item !== false).join(separator);\n}\n\nexport function splitLines(str: string): string[] {\n\treturn str.split(/\\r\\n|\\r|\\n/);\n}\n\nexport function splitLinesIncludeSeparators(str: string): string[] {\n\tconst linesWithSeparators: string[] = [];\n\tconst splitLinesAndSeparators = str.split(/(\\r\\n|\\r|\\n)/);\n\tfor (let i = 0; i < Math.ceil(splitLinesAndSeparators.length / 2); i++) {\n\t\tlinesWithSeparators.push(splitLinesAndSeparators[2 * i] + (splitLinesAndSeparators[2 * i + 1] ?? ''));\n\t}\n\treturn linesWithSeparators;\n}\n\nexport function indexOfPattern(str: string, re: RegExp) {\n\tconst match = re.exec(str);\n\tif (match) {\n\t\treturn match.index;\n\t}\n\treturn -1;\n}\n\n/**\n * Returns first index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function firstNonWhitespaceIndex(str: string): number {\n\tfor (let i = 0, len = str.length; i < len; i++) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Returns the leading whitespace of the string.\n * If the string contains only whitespaces, returns entire string\n */\nexport function getLeadingWhitespace(str: string, start: number = 0, end: number = str.length): string {\n\tfor (let i = start; i < end; i++) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn str.substring(start, i);\n\t\t}\n\t}\n\treturn str.substring(start, end);\n}\n\n/**\n * Returns last index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function lastNonWhitespaceIndex(str: string, startIndex: number = str.length - 1): number {\n\tfor (let i = startIndex; i >= 0; i--) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\nexport function getIndentationLength(str: string): number {\n\tconst idx = firstNonWhitespaceIndex(str);\n\tif (idx === -1) { return str.length; }\n\treturn idx;\n}\n\n/**\n * Function that works identically to String.prototype.replace, except, the\n * replace function is allowed to be async and return a Promise.\n */\nexport function replaceAsync(str: string, search: RegExp, replacer: (match: string, ...args: any[]) => Promise<string>): Promise<string> {\n\tconst parts: (string | Promise<string>)[] = [];\n\n\tlet last = 0;\n\tfor (const match of str.matchAll(search)) {\n\t\tparts.push(str.slice(last, match.index));\n\t\tif (match.index === undefined) {\n\t\t\tthrow new Error('match.index should be defined');\n\t\t}\n\n\t\tlast = match.index + match[0].length;\n\t\tparts.push(replacer(match[0], ...match.slice(1), match.index, str, match.groups));\n\t}\n\n\tparts.push(str.slice(last));\n\n\treturn Promise.all(parts).then(p => p.join(''));\n}\n\nexport function compare(a: string, b: string): number {\n\tif (a < b) {\n\t\treturn -1;\n\t} else if (a > b) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nexport function compareSubstring(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {\n\tfor (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n\t\tconst codeA = a.charCodeAt(aStart);\n\t\tconst codeB = b.charCodeAt(bStart);\n\t\tif (codeA < codeB) {\n\t\t\treturn -1;\n\t\t} else if (codeA > codeB) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\tconst aLen = aEnd - aStart;\n\tconst bLen = bEnd - bStart;\n\tif (aLen < bLen) {\n\t\treturn -1;\n\t} else if (aLen > bLen) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nexport function compareIgnoreCase(a: string, b: string): number {\n\treturn compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\n}\n\nexport function compareSubstringIgnoreCase(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {\n\n\tfor (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n\n\t\tlet codeA = a.charCodeAt(aStart);\n\t\tlet codeB = b.charCodeAt(bStart);\n\n\t\tif (codeA === codeB) {\n\t\t\t// equal\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (codeA >= 128 || codeB >= 128) {\n\t\t\t// not ASCII letters -> fallback to lower-casing strings\n\t\t\treturn compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\n\t\t}\n\n\t\t// mapper lower-case ascii letter onto upper-case varinats\n\t\t// [97-122] (lower ascii) --> [65-90] (upper ascii)\n\t\tif (isLowerAsciiLetter(codeA)) {\n\t\t\tcodeA -= 32;\n\t\t}\n\t\tif (isLowerAsciiLetter(codeB)) {\n\t\t\tcodeB -= 32;\n\t\t}\n\n\t\t// compare both code points\n\t\tconst diff = codeA - codeB;\n\t\tif (diff === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn diff;\n\t}\n\n\tconst aLen = aEnd - aStart;\n\tconst bLen = bEnd - bStart;\n\n\tif (aLen < bLen) {\n\t\treturn -1;\n\t} else if (aLen > bLen) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\nexport function isAsciiDigit(code: number): boolean {\n\treturn code >= CharCode.Digit0 && code <= CharCode.Digit9;\n}\n\nexport function isLowerAsciiLetter(code: number): boolean {\n\treturn code >= CharCode.a && code <= CharCode.z;\n}\n\nexport function isUpperAsciiLetter(code: number): boolean {\n\treturn code >= CharCode.A && code <= CharCode.Z;\n}\n\nexport function equalsIgnoreCase(a: string, b: string): boolean {\n\treturn a.length === b.length && compareSubstringIgnoreCase(a, b) === 0;\n}\n\nexport function startsWithIgnoreCase(str: string, candidate: string): boolean {\n\tconst candidateLength = candidate.length;\n\tif (candidate.length > str.length) {\n\t\treturn false;\n\t}\n\n\treturn compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0;\n}\n\n/**\n * @returns the length of the common prefix of the two strings.\n */\nexport function commonPrefixLength(a: string, b: string): number {\n\n\tconst len = Math.min(a.length, b.length);\n\tlet i: number;\n\n\tfor (i = 0; i < len; i++) {\n\t\tif (a.charCodeAt(i) !== b.charCodeAt(i)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn len;\n}\n\n/**\n * @returns the length of the common suffix of the two strings.\n */\nexport function commonSuffixLength(a: string, b: string): number {\n\n\tconst len = Math.min(a.length, b.length);\n\tlet i: number;\n\n\tconst aLastIndex = a.length - 1;\n\tconst bLastIndex = b.length - 1;\n\n\tfor (i = 0; i < len; i++) {\n\t\tif (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn len;\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isHighSurrogate(charCode: number): boolean {\n\treturn (0xD800 <= charCode && charCode <= 0xDBFF);\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isLowSurrogate(charCode: number): boolean {\n\treturn (0xDC00 <= charCode && charCode <= 0xDFFF);\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function computeCodePoint(highSurrogate: number, lowSurrogate: number): number {\n\treturn ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\n}\n\n/**\n * get the code point that begins at offset `offset`\n */\nexport function getNextCodePoint(str: string, len: number, offset: number): number {\n\tconst charCode = str.charCodeAt(offset);\n\tif (isHighSurrogate(charCode) && offset + 1 < len) {\n\t\tconst nextCharCode = str.charCodeAt(offset + 1);\n\t\tif (isLowSurrogate(nextCharCode)) {\n\t\t\treturn computeCodePoint(charCode, nextCharCode);\n\t\t}\n\t}\n\treturn charCode;\n}\n\n/**\n * get the code point that ends right before offset `offset`\n */\nfunction getPrevCodePoint(str: string, offset: number): number {\n\tconst charCode = str.charCodeAt(offset - 1);\n\tif (isLowSurrogate(charCode) && offset > 1) {\n\t\tconst prevCharCode = str.charCodeAt(offset - 2);\n\t\tif (isHighSurrogate(prevCharCode)) {\n\t\t\treturn computeCodePoint(prevCharCode, charCode);\n\t\t}\n\t}\n\treturn charCode;\n}\n\nexport class CodePointIterator {\n\n\tprivate readonly _str: string;\n\tprivate readonly _len: number;\n\tprivate _offset: number;\n\n\tpublic get offset(): number {\n\t\treturn this._offset;\n\t}\n\n\tconstructor(str: string, offset: number = 0) {\n\t\tthis._str = str;\n\t\tthis._len = str.length;\n\t\tthis._offset = offset;\n\t}\n\n\tpublic setOffset(offset: number): void {\n\t\tthis._offset = offset;\n\t}\n\n\tpublic prevCodePoint(): number {\n\t\tconst codePoint = getPrevCodePoint(this._str, this._offset);\n\t\tthis._offset -= (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n\t\treturn codePoint;\n\t}\n\n\tpublic nextCodePoint(): number {\n\t\tconst codePoint = getNextCodePoint(this._str, this._len, this._offset);\n\t\tthis._offset += (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n\t\treturn codePoint;\n\t}\n\n\tpublic eol(): boolean {\n\t\treturn (this._offset >= this._len);\n\t}\n}\n\nexport class GraphemeIterator {\n\n\tprivate readonly _iterator: CodePointIterator;\n\n\tpublic get offset(): number {\n\t\treturn this._iterator.offset;\n\t}\n\n\tconstructor(str: string, offset: number = 0) {\n\t\tthis._iterator = new CodePointIterator(str, offset);\n\t}\n\n\tpublic nextGraphemeLength(): number {\n\t\tconst graphemeBreakTree = GraphemeBreakTree.getInstance();\n\t\tconst iterator = this._iterator;\n\t\tconst initialOffset = iterator.offset;\n\n\t\tlet graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint());\n\t\twhile (!iterator.eol()) {\n\t\t\tconst offset = iterator.offset;\n\t\t\tconst nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint());\n\t\t\tif (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {\n\t\t\t\t// move iterator back\n\t\t\t\titerator.setOffset(offset);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tgraphemeBreakType = nextGraphemeBreakType;\n\t\t}\n\t\treturn (iterator.offset - initialOffset);\n\t}\n\n\tpublic prevGraphemeLength(): number {\n\t\tconst graphemeBreakTree = GraphemeBreakTree.getInstance();\n\t\tconst iterator = this._iterator;\n\t\tconst initialOffset = iterator.offset;\n\n\t\tlet graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint());\n\t\twhile (iterator.offset > 0) {\n\t\t\tconst offset = iterator.offset;\n\t\t\tconst prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint());\n\t\t\tif (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {\n\t\t\t\t// move iterator back\n\t\t\t\titerator.setOffset(offset);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tgraphemeBreakType = prevGraphemeBreakType;\n\t\t}\n\t\treturn (initialOffset - iterator.offset);\n\t}\n\n\tpublic eol(): boolean {\n\t\treturn this._iterator.eol();\n\t}\n}\n\nexport function nextCharLength(str: string, initialOffset: number): number {\n\tconst iterator = new GraphemeIterator(str, initialOffset);\n\treturn iterator.nextGraphemeLength();\n}\n\nexport function prevCharLength(str: string, initialOffset: number): number {\n\tconst iterator = new GraphemeIterator(str, initialOffset);\n\treturn iterator.prevGraphemeLength();\n}\n\nexport function getCharContainingOffset(str: string, offset: number): [number, number] {\n\tif (offset > 0 && isLowSurrogate(str.charCodeAt(offset))) {\n\t\toffset--;\n\t}\n\tconst endOffset = offset + nextCharLength(str, offset);\n\tconst startOffset = endOffset - prevCharLength(str, endOffset);\n\treturn [startOffset, endOffset];\n}\n\nexport function charCount(str: string): number {\n\tconst iterator = new GraphemeIterator(str);\n\tlet length = 0;\n\twhile (!iterator.eol()) {\n\t\tlength++;\n\t\titerator.nextGraphemeLength();\n\t}\n\treturn length;\n}\n\nlet CONTAINS_RTL: RegExp | undefined = undefined;\n\nfunction makeContainsRtl() {\n\t// Generated using https://github.com/alexdima/unicode-utils/blob/main/rtl-test.js\n\treturn /(?:[\\u05BE\\u05C0\\u05C3\\u05C6\\u05D0-\\u05F4\\u0608\\u060B\\u060D\\u061B-\\u064A\\u066D-\\u066F\\u0671-\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1-\\u07EA\\u07F4\\u07F5\\u07FA\\u07FE-\\u0815\\u081A\\u0824\\u0828\\u0830-\\u0858\\u085E-\\u088E\\u08A0-\\u08C9\\u200F\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFD3D\\uFD50-\\uFDC7\\uFDF0-\\uFDFC\\uFE70-\\uFEFC]|\\uD802[\\uDC00-\\uDD1B\\uDD20-\\uDE00\\uDE10-\\uDE35\\uDE40-\\uDEE4\\uDEEB-\\uDF35\\uDF40-\\uDFFF]|\\uD803[\\uDC00-\\uDD23\\uDE80-\\uDEA9\\uDEAD-\\uDF45\\uDF51-\\uDF81\\uDF86-\\uDFF6]|\\uD83A[\\uDC00-\\uDCCF\\uDD00-\\uDD43\\uDD4B-\\uDFFF]|\\uD83B[\\uDC00-\\uDEBB])/;\n}\n\n/**\n * Returns true if `str` contains any Unicode character that is classified as \"R\" or \"AL\".\n */\nexport function containsRTL(str: string): boolean {\n\tif (!CONTAINS_RTL) {\n\t\tCONTAINS_RTL = makeContainsRtl();\n\t}\n\n\treturn CONTAINS_RTL.test(str);\n}\n\nconst IS_BASIC_ASCII = /^[\\t\\n\\r\\x20-\\x7E]*$/;\n/**\n * Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \\n, \\r, \\t\n */\nexport function isBasicASCII(str: string): boolean {\n\treturn IS_BASIC_ASCII.test(str);\n}\n\nexport const UNUSUAL_LINE_TERMINATORS = /[\\u2028\\u2029]/; // LINE SEPARATOR (LS) or PARAGRAPH SEPARATOR (PS)\n/**\n * Returns true if `str` contains unusual line terminators, like LS or PS\n */\nexport function containsUnusualLineTerminators(str: string): boolean {\n\treturn UNUSUAL_LINE_TERMINATORS.test(str);\n}\n\nexport function isFullWidthCharacter(charCode: number): boolean {\n\t// Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns\n\t// http://jrgraphix.net/research/unicode_blocks.php\n\t//          2E80 - 2EFF   CJK Radicals Supplement\n\t//          2F00 - 2FDF   Kangxi Radicals\n\t//          2FF0 - 2FFF   Ideographic Description Characters\n\t//          3000 - 303F   CJK Symbols and Punctuation\n\t//          3040 - 309F   Hiragana\n\t//          30A0 - 30FF   Katakana\n\t//          3100 - 312F   Bopomofo\n\t//          3130 - 318F   Hangul Compatibility Jamo\n\t//          3190 - 319F   Kanbun\n\t//          31A0 - 31BF   Bopomofo Extended\n\t//          31F0 - 31FF   Katakana Phonetic Extensions\n\t//          3200 - 32FF   Enclosed CJK Letters and Months\n\t//          3300 - 33FF   CJK Compatibility\n\t//          3400 - 4DBF   CJK Unified Ideographs Extension A\n\t//          4DC0 - 4DFF   Yijing Hexagram Symbols\n\t//          4E00 - 9FFF   CJK Unified Ideographs\n\t//          A000 - A48F   Yi Syllables\n\t//          A490 - A4CF   Yi Radicals\n\t//          AC00 - D7AF   Hangul Syllables\n\t// [IGNORE] D800 - DB7F   High Surrogates\n\t// [IGNORE] DB80 - DBFF   High Private Use Surrogates\n\t// [IGNORE] DC00 - DFFF   Low Surrogates\n\t// [IGNORE] E000 - F8FF   Private Use Area\n\t//          F900 - FAFF   CJK Compatibility Ideographs\n\t// [IGNORE] FB00 - FB4F   Alphabetic Presentation Forms\n\t// [IGNORE] FB50 - FDFF   Arabic Presentation Forms-A\n\t// [IGNORE] FE00 - FE0F   Variation Selectors\n\t// [IGNORE] FE20 - FE2F   Combining Half Marks\n\t// [IGNORE] FE30 - FE4F   CJK Compatibility Forms\n\t// [IGNORE] FE50 - FE6F   Small Form Variants\n\t// [IGNORE] FE70 - FEFF   Arabic Presentation Forms-B\n\t//          FF00 - FFEF   Halfwidth and Fullwidth Forms\n\t//               [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]\n\t//               of which FF01 - FF5E fullwidth ASCII of 21 to 7E\n\t// [IGNORE]    and FF65 - FFDC halfwidth of Katakana and Hangul\n\t// [IGNORE] FFF0 - FFFF   Specials\n\treturn (\n\t\t(charCode >= 0x2E80 && charCode <= 0xD7AF)\n\t\t|| (charCode >= 0xF900 && charCode <= 0xFAFF)\n\t\t|| (charCode >= 0xFF01 && charCode <= 0xFF5E)\n\t);\n}\n\n/**\n * A fast function (therefore imprecise) to check if code points are emojis.\n * Generated using https://github.com/alexdima/unicode-utils/blob/main/emoji-test.js\n */\nexport function isEmojiImprecise(x: number): boolean {\n\treturn (\n\t\t(x >= 0x1F1E6 && x <= 0x1F1FF) || (x === 8986) || (x === 8987) || (x === 9200)\n\t\t|| (x === 9203) || (x >= 9728 && x <= 10175) || (x === 11088) || (x === 11093)\n\t\t|| (x >= 127744 && x <= 128591) || (x >= 128640 && x <= 128764)\n\t\t|| (x >= 128992 && x <= 129008) || (x >= 129280 && x <= 129535)\n\t\t|| (x >= 129648 && x <= 129782)\n\t);\n}\n\n/**\n * Given a string and a max length returns a shorted version. Shorting\n * happens at favorable positions - such as whitespace or punctuation characters.\n * The return value can be longer than the given value of `n`. Leading whitespace is always trimmed.\n */\nexport function lcut(text: string, n: number, prefix = ''): string {\n\tconst trimmed = text.trimStart();\n\n\tif (trimmed.length < n) {\n\t\treturn trimmed;\n\t}\n\n\tconst re = /\\b/g;\n\tlet i = 0;\n\twhile (re.test(trimmed)) {\n\t\tif (trimmed.length - re.lastIndex < n) {\n\t\t\tbreak;\n\t\t}\n\n\t\ti = re.lastIndex;\n\t\tre.lastIndex += 1;\n\t}\n\n\tif (i === 0) {\n\t\treturn trimmed;\n\t}\n\n\treturn prefix + trimmed.substring(i).trimStart();\n}\n\n/**\n * Given a string and a max length returns a shorted version. Shorting\n * happens at favorable positions - such as whitespace or punctuation characters.\n * The return value can be longer than the given value of `n`. Trailing whitespace is always trimmed.\n */\nexport function rcut(text: string, n: number, suffix = ''): string {\n\tconst trimmed = text.trimEnd();\n\n\tif (trimmed.length < n) {\n\t\treturn trimmed;\n\t}\n\n\tconst parts = text.split(/\\b/);\n\tlet result = '';\n\tfor (const part of parts) {\n\t\tif (result.length > 0 && result.length + part.length > n) {\n\t\t\tbreak;\n\t\t}\n\t\tresult += part;\n\t}\n\n\tif (result === trimmed) {\n\t\treturn result;\n\t}\n\n\treturn result.trim().replace(/b$/, '') + suffix;\n}\n\n// Defacto standard: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html\nconst CSI_SEQUENCE = /(?:\\x1b\\[|\\x9b)[=?>!]?[\\d;:]*[\"$#'* ]?[a-zA-Z@^`{}|~]/;\nconst OSC_SEQUENCE = /(?:\\x1b\\]|\\x9d).*?(?:\\x1b\\\\|\\x07|\\x9c)/;\nconst ESC_SEQUENCE = /\\x1b(?:[ #%\\(\\)\\*\\+\\-\\.\\/]?[a-zA-Z0-9\\|}~@])/;\nconst CONTROL_SEQUENCES = new RegExp('(?:' + [\n\tCSI_SEQUENCE.source,\n\tOSC_SEQUENCE.source,\n\tESC_SEQUENCE.source,\n].join('|') + ')', 'g');\n\n/** Iterates over parts of a string with CSI sequences */\nexport function* forAnsiStringParts(str: string) {\n\tlet last = 0;\n\tfor (const match of str.matchAll(CONTROL_SEQUENCES)) {\n\t\tif (last !== match.index) {\n\t\t\tyield { isCode: false, str: str.substring(last, match.index) };\n\t\t}\n\n\t\tyield { isCode: true, str: match[0] };\n\t\tlast = match.index + match[0].length;\n\t}\n\n\tif (last !== str.length) {\n\t\tyield { isCode: false, str: str.substring(last) };\n\t}\n}\n\n/**\n * Strips ANSI escape sequences from a string.\n * @param str The dastringa stringo strip the ANSI escape sequences from.\n *\n * @example\n * removeAnsiEscapeCodes('\\u001b[31mHello, World!\\u001b[0m');\n * // 'Hello, World!'\n */\nexport function removeAnsiEscapeCodes(str: string): string {\n\tif (str) {\n\t\tstr = str.replace(CONTROL_SEQUENCES, '');\n\t}\n\n\treturn str;\n}\n\nconst PROMPT_NON_PRINTABLE = /\\\\\\[.*?\\\\\\]/g;\n\n/**\n * Strips ANSI escape sequences from a UNIX-style prompt string (eg. `$PS1`).\n * @param str The string to strip the ANSI escape sequences from.\n *\n * @example\n * removeAnsiEscapeCodesFromPrompt('\\n\\\\[\\u001b[01;34m\\\\]\\\\w\\\\[\\u001b[00m\\\\]\\n\\\\[\\u001b[1;32m\\\\]> \\\\[\\u001b[0m\\\\]');\n * // '\\n\\\\w\\n> '\n */\nexport function removeAnsiEscapeCodesFromPrompt(str: string): string {\n\treturn removeAnsiEscapeCodes(str).replace(PROMPT_NON_PRINTABLE, '');\n}\n\n\n// -- UTF-8 BOM\n\nexport const UTF8_BOM_CHARACTER = String.fromCharCode(CharCode.UTF8_BOM);\n\nexport function startsWithUTF8BOM(str: string): boolean {\n\treturn !!(str && str.length > 0 && str.charCodeAt(0) === CharCode.UTF8_BOM);\n}\n\nexport function stripUTF8BOM(str: string): string {\n\treturn startsWithUTF8BOM(str) ? str.substr(1) : str;\n}\n\n/**\n * Checks if the characters of the provided query string are included in the\n * target string. The characters do not have to be contiguous within the string.\n */\nexport function fuzzyContains(target: string, query: string): boolean {\n\tif (!target || !query) {\n\t\treturn false; // return early if target or query are undefined\n\t}\n\n\tif (target.length < query.length) {\n\t\treturn false; // impossible for query to be contained in target\n\t}\n\n\tconst queryLen = query.length;\n\tconst targetLower = target.toLowerCase();\n\n\tlet index = 0;\n\tlet lastIndexOf = -1;\n\twhile (index < queryLen) {\n\t\tconst indexOf = targetLower.indexOf(query[index], lastIndexOf + 1);\n\t\tif (indexOf < 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tlastIndexOf = indexOf;\n\n\t\tindex++;\n\t}\n\n\treturn true;\n}\n\nexport function containsUppercaseCharacter(target: string, ignoreEscapedChars = false): boolean {\n\tif (!target) {\n\t\treturn false;\n\t}\n\n\tif (ignoreEscapedChars) {\n\t\ttarget = target.replace(/\\\\./g, '');\n\t}\n\n\treturn target.toLowerCase() !== target;\n}\n\nexport function uppercaseFirstLetter(str: string): string {\n\treturn str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function getNLines(str: string, n = 1): string {\n\tif (n === 0) {\n\t\treturn '';\n\t}\n\n\tlet idx = -1;\n\tdo {\n\t\tidx = str.indexOf('\\n', idx + 1);\n\t\tn--;\n\t} while (n > 0 && idx >= 0);\n\n\tif (idx === -1) {\n\t\treturn str;\n\t}\n\n\tif (str[idx - 1] === '\\r') {\n\t\tidx--;\n\t}\n\n\treturn str.substr(0, idx);\n}\n\n/**\n * Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc.\n */\nexport function singleLetterHash(n: number): string {\n\tconst LETTERS_CNT = (CharCode.Z - CharCode.A + 1);\n\n\tn = n % (2 * LETTERS_CNT);\n\n\tif (n < LETTERS_CNT) {\n\t\treturn String.fromCharCode(CharCode.a + n);\n\t}\n\n\treturn String.fromCharCode(CharCode.A + n - LETTERS_CNT);\n}\n\n//#region Unicode Grapheme Break\n\nexport function getGraphemeBreakType(codePoint: number): GraphemeBreakType {\n\tconst graphemeBreakTree = GraphemeBreakTree.getInstance();\n\treturn graphemeBreakTree.getGraphemeBreakType(codePoint);\n}\n\nfunction breakBetweenGraphemeBreakType(breakTypeA: GraphemeBreakType, breakTypeB: GraphemeBreakType): boolean {\n\t// http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules\n\n\t// !!! Let's make the common case a bit faster\n\tif (breakTypeA === GraphemeBreakType.Other) {\n\t\t// see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table\n\t\treturn (breakTypeB !== GraphemeBreakType.Extend && breakTypeB !== GraphemeBreakType.SpacingMark);\n\t}\n\n\t// Do not break between a CR and LF. Otherwise, break before and after controls.\n\t// GB3                                        CR × LF\n\t// GB4                       (Control | CR | LF) ÷\n\t// GB5                                           ÷ (Control | CR | LF)\n\tif (breakTypeA === GraphemeBreakType.CR) {\n\t\tif (breakTypeB === GraphemeBreakType.LF) {\n\t\t\treturn false; // GB3\n\t\t}\n\t}\n\tif (breakTypeA === GraphemeBreakType.Control || breakTypeA === GraphemeBreakType.CR || breakTypeA === GraphemeBreakType.LF) {\n\t\treturn true; // GB4\n\t}\n\tif (breakTypeB === GraphemeBreakType.Control || breakTypeB === GraphemeBreakType.CR || breakTypeB === GraphemeBreakType.LF) {\n\t\treturn true; // GB5\n\t}\n\n\t// Do not break Hangul syllable sequences.\n\t// GB6                                         L × (L | V | LV | LVT)\n\t// GB7                                  (LV | V) × (V | T)\n\t// GB8                                 (LVT | T) × T\n\tif (breakTypeA === GraphemeBreakType.L) {\n\t\tif (breakTypeB === GraphemeBreakType.L || breakTypeB === GraphemeBreakType.V || breakTypeB === GraphemeBreakType.LV || breakTypeB === GraphemeBreakType.LVT) {\n\t\t\treturn false; // GB6\n\t\t}\n\t}\n\tif (breakTypeA === GraphemeBreakType.LV || breakTypeA === GraphemeBreakType.V) {\n\t\tif (breakTypeB === GraphemeBreakType.V || breakTypeB === GraphemeBreakType.T) {\n\t\t\treturn false; // GB7\n\t\t}\n\t}\n\tif (breakTypeA === GraphemeBreakType.LVT || breakTypeA === GraphemeBreakType.T) {\n\t\tif (breakTypeB === GraphemeBreakType.T) {\n\t\t\treturn false; // GB8\n\t\t}\n\t}\n\n\t// Do not break before extending characters or ZWJ.\n\t// GB9                                           × (Extend | ZWJ)\n\tif (breakTypeB === GraphemeBreakType.Extend || breakTypeB === GraphemeBreakType.ZWJ) {\n\t\treturn false; // GB9\n\t}\n\n\t// The GB9a and GB9b rules only apply to extended grapheme clusters:\n\t// Do not break before SpacingMarks, or after Prepend characters.\n\t// GB9a                                          × SpacingMark\n\t// GB9b                                  Prepend ×\n\tif (breakTypeB === GraphemeBreakType.SpacingMark) {\n\t\treturn false; // GB9a\n\t}\n\tif (breakTypeA === GraphemeBreakType.Prepend) {\n\t\treturn false; // GB9b\n\t}\n\n\t// Do not break within emoji modifier sequences or emoji zwj sequences.\n\t// GB11    \\p{Extended_Pictographic} Extend* ZWJ × \\p{Extended_Pictographic}\n\tif (breakTypeA === GraphemeBreakType.ZWJ && breakTypeB === GraphemeBreakType.Extended_Pictographic) {\n\t\t// Note: we are not implementing the rule entirely here to avoid introducing states\n\t\treturn false; // GB11\n\t}\n\n\t// GB12                          sot (RI RI)* RI × RI\n\t// GB13                        [^RI] (RI RI)* RI × RI\n\tif (breakTypeA === GraphemeBreakType.Regional_Indicator && breakTypeB === GraphemeBreakType.Regional_Indicator) {\n\t\t// Note: we are not implementing the rule entirely here to avoid introducing states\n\t\treturn false; // GB12 & GB13\n\t}\n\n\t// GB999                                     Any ÷ Any\n\treturn true;\n}\n\nexport const enum GraphemeBreakType {\n\tOther = 0,\n\tPrepend = 1,\n\tCR = 2,\n\tLF = 3,\n\tControl = 4,\n\tExtend = 5,\n\tRegional_Indicator = 6,\n\tSpacingMark = 7,\n\tL = 8,\n\tV = 9,\n\tT = 10,\n\tLV = 11,\n\tLVT = 12,\n\tZWJ = 13,\n\tExtended_Pictographic = 14\n}\n\nclass GraphemeBreakTree {\n\n\tprivate static _INSTANCE: GraphemeBreakTree | null = null;\n\tpublic static getInstance(): GraphemeBreakTree {\n\t\tif (!GraphemeBreakTree._INSTANCE) {\n\t\t\tGraphemeBreakTree._INSTANCE = new GraphemeBreakTree();\n\t\t}\n\t\treturn GraphemeBreakTree._INSTANCE;\n\t}\n\n\tprivate readonly _data: number[];\n\n\tconstructor() {\n\t\tthis._data = getGraphemeBreakRawData();\n\t}\n\n\tpublic getGraphemeBreakType(codePoint: number): GraphemeBreakType {\n\t\t// !!! Let's make 7bit ASCII a bit faster: 0..31\n\t\tif (codePoint < 32) {\n\t\t\tif (codePoint === CharCode.LineFeed) {\n\t\t\t\treturn GraphemeBreakType.LF;\n\t\t\t}\n\t\t\tif (codePoint === CharCode.CarriageReturn) {\n\t\t\t\treturn GraphemeBreakType.CR;\n\t\t\t}\n\t\t\treturn GraphemeBreakType.Control;\n\t\t}\n\t\t// !!! Let's make 7bit ASCII a bit faster: 32..126\n\t\tif (codePoint < 127) {\n\t\t\treturn GraphemeBreakType.Other;\n\t\t}\n\n\t\tconst data = this._data;\n\t\tconst nodeCount = data.length / 3;\n\t\tlet nodeIndex = 1;\n\t\twhile (nodeIndex <= nodeCount) {\n\t\t\tif (codePoint < data[3 * nodeIndex]) {\n\t\t\t\t// go left\n\t\t\t\tnodeIndex = 2 * nodeIndex;\n\t\t\t} else if (codePoint > data[3 * nodeIndex + 1]) {\n\t\t\t\t// go right\n\t\t\t\tnodeIndex = 2 * nodeIndex + 1;\n\t\t\t} else {\n\t\t\t\t// hit\n\t\t\t\treturn data[3 * nodeIndex + 2];\n\t\t\t}\n\t\t}\n\n\t\treturn GraphemeBreakType.Other;\n\t}\n}\n\nfunction getGraphemeBreakRawData(): number[] {\n\t// generated using https://github.com/alexdima/unicode-utils/blob/main/grapheme-break.js\n\treturn JSON.parse('[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]');\n}\n\n//#endregion\n\n/**\n * Computes the offset after performing a left delete on the given string,\n * while considering unicode grapheme/emoji rules.\n*/\nexport function getLeftDeleteOffset(offset: number, str: string): number {\n\tif (offset === 0) {\n\t\treturn 0;\n\t}\n\n\t// Try to delete emoji part.\n\tconst emojiOffset = getOffsetBeforeLastEmojiComponent(offset, str);\n\tif (emojiOffset !== undefined) {\n\t\treturn emojiOffset;\n\t}\n\n\t// Otherwise, just skip a single code point.\n\tconst iterator = new CodePointIterator(str, offset);\n\titerator.prevCodePoint();\n\treturn iterator.offset;\n}\n\nfunction getOffsetBeforeLastEmojiComponent(initialOffset: number, str: string): number | undefined {\n\t// See https://www.unicode.org/reports/tr51/tr51-14.html#EBNF_and_Regex for the\n\t// structure of emojis.\n\tconst iterator = new CodePointIterator(str, initialOffset);\n\tlet codePoint = iterator.prevCodePoint();\n\n\t// Skip modifiers\n\twhile ((isEmojiModifier(codePoint) || codePoint === CodePoint.emojiVariantSelector || codePoint === CodePoint.enclosingKeyCap)) {\n\t\tif (iterator.offset === 0) {\n\t\t\t// Cannot skip modifier, no preceding emoji base.\n\t\t\treturn undefined;\n\t\t}\n\t\tcodePoint = iterator.prevCodePoint();\n\t}\n\n\t// Expect base emoji\n\tif (!isEmojiImprecise(codePoint)) {\n\t\t// Unexpected code point, not a valid emoji.\n\t\treturn undefined;\n\t}\n\n\tlet resultOffset = iterator.offset;\n\n\tif (resultOffset > 0) {\n\t\t// Skip optional ZWJ code points that combine multiple emojis.\n\t\t// In theory, we should check if that ZWJ actually combines multiple emojis\n\t\t// to prevent deleting ZWJs in situations we didn't account for.\n\t\tconst optionalZwjCodePoint = iterator.prevCodePoint();\n\t\tif (optionalZwjCodePoint === CodePoint.zwj) {\n\t\t\tresultOffset = iterator.offset;\n\t\t}\n\t}\n\n\treturn resultOffset;\n}\n\nfunction isEmojiModifier(codePoint: number): boolean {\n\treturn 0x1F3FB <= codePoint && codePoint <= 0x1F3FF;\n}\n\nconst enum CodePoint {\n\tzwj = 0x200D,\n\n\t/**\n\t * Variation Selector-16 (VS16)\n\t*/\n\temojiVariantSelector = 0xFE0F,\n\n\t/**\n\t * Combining Enclosing Keycap\n\t */\n\tenclosingKeyCap = 0x20E3,\n\n\tspace = 0x0020,\n}\n\nexport const noBreakWhitespace = '\\xa0';\n\nexport class AmbiguousCharacters {\n\tprivate static readonly ambiguousCharacterData = new Lazy<\n\t\tRecord<\n\t\t\tstring | '_common' | '_default',\n\t\t\t/* code point -> ascii code point */ number[]\n\t\t>\n\t>(() => {\n\t\t// Generated using https://github.com/hediet/vscode-unicode-data\n\t\t// Stored as key1, value1, key2, value2, ...\n\t\treturn JSON.parse(\n\t\t\t'{\\\"_common\\\":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,1523,96,8242,96,1370,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,118002,50,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,118003,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,118004,52,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,118005,53,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,118006,54,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,118007,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,118008,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,118009,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,117974,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,117975,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71913,67,71922,67,65315,67,8557,67,8450,67,8493,67,117976,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,117977,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,117978,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,117979,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,117980,71,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,117981,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,117983,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,117984,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,118001,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,117982,108,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,117985,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,117986,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,117987,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,118000,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,117988,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,117989,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,117990,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,117991,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,117992,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,117993,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,117994,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,117995,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71910,87,71919,87,117996,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,117997,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,117998,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,71909,90,66293,90,65338,90,8484,90,8488,90,117999,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65283,35,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],\\\"_default\\\":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"cs\\\":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"de\\\":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"es\\\":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"fr\\\":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"it\\\":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"ja\\\":[8211,45,8218,44,65281,33,8216,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65292,44,65297,49,65307,59],\\\"ko\\\":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"pl\\\":[65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"pt-BR\\\":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"qps-ploc\\\":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"ru\\\":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"tr\\\":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],\\\"zh-hans\\\":[160,32,65374,126,8218,44,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65297,49],\\\"zh-hant\\\":[8211,45,65374,126,8218,44,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89]}'\n\t\t);\n\t});\n\n\tprivate static readonly cache = new LRUCachedFunction<\n\t\tstring[],\n\t\tAmbiguousCharacters\n\t>({ getCacheKey: JSON.stringify }, (locales) => {\n\t\tfunction arrayToMap(arr: number[]): Map<number, number> {\n\t\t\tconst result = new Map<number, number>();\n\t\t\tfor (let i = 0; i < arr.length; i += 2) {\n\t\t\t\tresult.set(arr[i], arr[i + 1]);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tfunction mergeMaps(\n\t\t\tmap1: Map<number, number>,\n\t\t\tmap2: Map<number, number>\n\t\t): Map<number, number> {\n\t\t\tconst result = new Map<number, number>(map1);\n\t\t\tfor (const [key, value] of map2) {\n\t\t\t\tresult.set(key, value);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tfunction intersectMaps(\n\t\t\tmap1: Map<number, number> | undefined,\n\t\t\tmap2: Map<number, number>\n\t\t) {\n\t\t\tif (!map1) {\n\t\t\t\treturn map2;\n\t\t\t}\n\t\t\tconst result = new Map<number, number>();\n\t\t\tfor (const [key, value] of map1) {\n\t\t\t\tif (map2.has(key)) {\n\t\t\t\t\tresult.set(key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tconst data = this.ambiguousCharacterData.value;\n\n\t\tlet filteredLocales = locales.filter(\n\t\t\t(l) => !l.startsWith('_') && l in data\n\t\t);\n\t\tif (filteredLocales.length === 0) {\n\t\t\tfilteredLocales = ['_default'];\n\t\t}\n\n\t\tlet languageSpecificMap: Map<number, number> | undefined = undefined;\n\t\tfor (const locale of filteredLocales) {\n\t\t\tconst map = arrayToMap(data[locale]);\n\t\t\tlanguageSpecificMap = intersectMaps(languageSpecificMap, map);\n\t\t}\n\n\t\tconst commonMap = arrayToMap(data['_common']);\n\t\tconst map = mergeMaps(commonMap, languageSpecificMap!);\n\n\t\treturn new AmbiguousCharacters(map);\n\t});\n\n\tpublic static getInstance(locales: Set<string>): AmbiguousCharacters {\n\t\treturn AmbiguousCharacters.cache.get(Array.from(locales));\n\t}\n\n\tprivate static _locales = new Lazy<string[]>(() =>\n\t\tObject.keys(AmbiguousCharacters.ambiguousCharacterData.value).filter(\n\t\t\t(k) => !k.startsWith('_')\n\t\t)\n\t);\n\tpublic static getLocales(): string[] {\n\t\treturn AmbiguousCharacters._locales.value;\n\t}\n\n\tprivate constructor(\n\t\tprivate readonly confusableDictionary: Map<number, number>\n\t) { }\n\n\tpublic isAmbiguous(codePoint: number): boolean {\n\t\treturn this.confusableDictionary.has(codePoint);\n\t}\n\n\tpublic containsAmbiguousCharacter(str: string): boolean {\n\t\tfor (let i = 0; i < str.length; i++) {\n\t\t\tconst codePoint = str.codePointAt(i);\n\t\t\tif (typeof codePoint === 'number' && this.isAmbiguous(codePoint)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns the non basic ASCII code point that the given code point can be confused,\n\t * or undefined if such code point does note exist.\n\t */\n\tpublic getPrimaryConfusable(codePoint: number): number | undefined {\n\t\treturn this.confusableDictionary.get(codePoint);\n\t}\n\n\tpublic getConfusableCodePoints(): ReadonlySet<number> {\n\t\treturn new Set(this.confusableDictionary.keys());\n\t}\n}\n\nexport class InvisibleCharacters {\n\tprivate static getRawData(): Record<string | '_common', number[]> {\n\t\t// Generated using https://github.com/hediet/vscode-unicode-data\n\t\treturn JSON.parse('{\\\"_common\\\":[11,12,13,127,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999],\\\"cs\\\":[173,8203,12288],\\\"de\\\":[173,8203,12288],\\\"es\\\":[8203,12288],\\\"fr\\\":[173,8203,12288],\\\"it\\\":[160,173,12288],\\\"ja\\\":[173],\\\"ko\\\":[173,12288],\\\"pl\\\":[173,8203,12288],\\\"pt-BR\\\":[173,8203,12288],\\\"qps-ploc\\\":[160,173,8203,12288],\\\"ru\\\":[173,12288],\\\"tr\\\":[160,173,8203,12288],\\\"zh-hans\\\":[160,173,8203,12288],\\\"zh-hant\\\":[173,12288]}');\n\t}\n\n\tprivate static _data: Set<number> | undefined = undefined;\n\n\tprivate static getData() {\n\t\tif (!this._data) {\n\t\t\tthis._data = new Set([...Object.values(InvisibleCharacters.getRawData())].flat());\n\t\t}\n\t\treturn this._data;\n\t}\n\n\tpublic static isInvisibleCharacter(codePoint: number): boolean {\n\t\treturn InvisibleCharacters.getData().has(codePoint);\n\t}\n\n\tpublic static containsInvisibleCharacter(str: string): boolean {\n\t\tfor (let i = 0; i < str.length; i++) {\n\t\t\tconst codePoint = str.codePointAt(i);\n\t\t\tif (typeof codePoint === 'number' && (InvisibleCharacters.isInvisibleCharacter(codePoint) || codePoint === CodePoint.space)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static get codePoints(): ReadonlySet<number> {\n\t\treturn InvisibleCharacters.getData();\n\t}\n}\n\nexport const Ellipsis = '\\u2026';\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from './charCode.js';\nimport { isAbsolute, join, normalize, posix, sep } from './path.js';\nimport { isWindows } from './platform.js';\nimport { equalsIgnoreCase, rtrim, startsWithIgnoreCase } from './strings.js';\nimport { isNumber } from './types.js';\n\nexport function isPathSeparator(code: number) {\n\treturn code === CharCode.Slash || code === CharCode.Backslash;\n}\n\n/**\n * Takes a Windows OS path and changes backward slashes to forward slashes.\n * This should only be done for OS paths from Windows (or user provided paths potentially from Windows).\n * Using it on a Linux or MaxOS path might change it.\n */\nexport function toSlashes(osPath: string) {\n\treturn osPath.replace(/[\\\\/]/g, posix.sep);\n}\n\n/**\n * Takes a Windows OS path (using backward or forward slashes) and turns it into a posix path:\n * - turns backward slashes into forward slashes\n * - makes it absolute if it starts with a drive letter\n * This should only be done for OS paths from Windows (or user provided paths potentially from Windows).\n * Using it on a Linux or MaxOS path might change it.\n */\nexport function toPosixPath(osPath: string) {\n\tif (osPath.indexOf('/') === -1) {\n\t\tosPath = toSlashes(osPath);\n\t}\n\tif (/^[a-zA-Z]:(\\/|$)/.test(osPath)) { // starts with a drive letter\n\t\tosPath = '/' + osPath;\n\t}\n\treturn osPath;\n}\n\n/**\n * Computes the _root_ this path, like `getRoot('c:\\files') === c:\\`,\n * `getRoot('files:///files/path') === files:///`,\n * or `getRoot('\\\\server\\shares\\path') === \\\\server\\shares\\`\n */\nexport function getRoot(path: string, sep: string = posix.sep): string {\n\tif (!path) {\n\t\treturn '';\n\t}\n\n\tconst len = path.length;\n\tconst firstLetter = path.charCodeAt(0);\n\tif (isPathSeparator(firstLetter)) {\n\t\tif (isPathSeparator(path.charCodeAt(1))) {\n\t\t\t// UNC candidate \\\\localhost\\shares\\ddd\n\t\t\t//               ^^^^^^^^^^^^^^^^^^^\n\t\t\tif (!isPathSeparator(path.charCodeAt(2))) {\n\t\t\t\tlet pos = 3;\n\t\t\t\tconst start = pos;\n\t\t\t\tfor (; pos < len; pos++) {\n\t\t\t\t\tif (isPathSeparator(path.charCodeAt(pos))) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (start !== pos && !isPathSeparator(path.charCodeAt(pos + 1))) {\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tfor (; pos < len; pos++) {\n\t\t\t\t\t\tif (isPathSeparator(path.charCodeAt(pos))) {\n\t\t\t\t\t\t\treturn path.slice(0, pos + 1) // consume this separator\n\t\t\t\t\t\t\t\t.replace(/[\\\\/]/g, sep);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// /user/far\n\t\t// ^\n\t\treturn sep;\n\n\t} else if (isWindowsDriveLetter(firstLetter)) {\n\t\t// check for windows drive letter c:\\ or c:\n\n\t\tif (path.charCodeAt(1) === CharCode.Colon) {\n\t\t\tif (isPathSeparator(path.charCodeAt(2))) {\n\t\t\t\t// C:\\fff\n\t\t\t\t// ^^^\n\t\t\t\treturn path.slice(0, 2) + sep;\n\t\t\t} else {\n\t\t\t\t// C:\n\t\t\t\t// ^^\n\t\t\t\treturn path.slice(0, 2);\n\t\t\t}\n\t\t}\n\t}\n\n\t// check for URI\n\t// scheme://authority/path\n\t// ^^^^^^^^^^^^^^^^^^^\n\tlet pos = path.indexOf('://');\n\tif (pos !== -1) {\n\t\tpos += 3; // 3 -> \"://\".length\n\t\tfor (; pos < len; pos++) {\n\t\t\tif (isPathSeparator(path.charCodeAt(pos))) {\n\t\t\t\treturn path.slice(0, pos + 1); // consume this separator\n\t\t\t}\n\t\t}\n\t}\n\n\treturn '';\n}\n\n/**\n * Check if the path follows this pattern: `\\\\hostname\\sharename`.\n *\n * @see https://msdn.microsoft.com/en-us/library/gg465305.aspx\n * @return A boolean indication if the path is a UNC path, on none-windows\n * always false.\n */\nexport function isUNC(path: string): boolean {\n\tif (!isWindows) {\n\t\t// UNC is a windows concept\n\t\treturn false;\n\t}\n\n\tif (!path || path.length < 5) {\n\t\t// at least \\\\a\\b\n\t\treturn false;\n\t}\n\n\tlet code = path.charCodeAt(0);\n\tif (code !== CharCode.Backslash) {\n\t\treturn false;\n\t}\n\n\tcode = path.charCodeAt(1);\n\n\tif (code !== CharCode.Backslash) {\n\t\treturn false;\n\t}\n\n\tlet pos = 2;\n\tconst start = pos;\n\tfor (; pos < path.length; pos++) {\n\t\tcode = path.charCodeAt(pos);\n\t\tif (code === CharCode.Backslash) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (start === pos) {\n\t\treturn false;\n\t}\n\n\tcode = path.charCodeAt(pos + 1);\n\n\tif (isNaN(code) || code === CharCode.Backslash) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n// Reference: https://en.wikipedia.org/wiki/Filename\nconst WINDOWS_INVALID_FILE_CHARS = /[\\\\/:\\*\\?\"<>\\|]/g;\nconst UNIX_INVALID_FILE_CHARS = /[/]/g;\nconst WINDOWS_FORBIDDEN_NAMES = /^(con|prn|aux|clock\\$|nul|lpt[0-9]|com[0-9])(\\.(.*?))?$/i;\nexport function isValidBasename(name: string | null | undefined, isWindowsOS: boolean = isWindows): boolean {\n\tconst invalidFileChars = isWindowsOS ? WINDOWS_INVALID_FILE_CHARS : UNIX_INVALID_FILE_CHARS;\n\n\tif (!name || name.length === 0 || /^\\s+$/.test(name)) {\n\t\treturn false; // require a name that is not just whitespace\n\t}\n\n\tinvalidFileChars.lastIndex = 0; // the holy grail of software development\n\tif (invalidFileChars.test(name)) {\n\t\treturn false; // check for certain invalid file characters\n\t}\n\n\tif (isWindowsOS && WINDOWS_FORBIDDEN_NAMES.test(name)) {\n\t\treturn false; // check for certain invalid file names\n\t}\n\n\tif (name === '.' || name === '..') {\n\t\treturn false; // check for reserved values\n\t}\n\n\tif (isWindowsOS && name[name.length - 1] === '.') {\n\t\treturn false; // Windows: file cannot end with a \".\"\n\t}\n\n\tif (isWindowsOS && name.length !== name.trim().length) {\n\t\treturn false; // Windows: file cannot end with a whitespace\n\t}\n\n\tif (name.length > 255) {\n\t\treturn false; // most file systems do not allow files > 255 length\n\t}\n\n\treturn true;\n}\n\n/**\n * @deprecated please use `IUriIdentityService.extUri.isEqual` instead. If you are\n * in a context without services, consider to pass down the `extUri` from the outside\n * or use `extUriBiasedIgnorePathCase` if you know what you are doing.\n */\nexport function isEqual(pathA: string, pathB: string, ignoreCase?: boolean): boolean {\n\tconst identityEquals = (pathA === pathB);\n\tif (!ignoreCase || identityEquals) {\n\t\treturn identityEquals;\n\t}\n\n\tif (!pathA || !pathB) {\n\t\treturn false;\n\t}\n\n\treturn equalsIgnoreCase(pathA, pathB);\n}\n\n/**\n * @deprecated please use `IUriIdentityService.extUri.isEqualOrParent` instead. If\n * you are in a context without services, consider to pass down the `extUri` from the\n * outside, or use `extUriBiasedIgnorePathCase` if you know what you are doing.\n */\nexport function isEqualOrParent(base: string, parentCandidate: string, ignoreCase?: boolean, separator = sep): boolean {\n\tif (base === parentCandidate) {\n\t\treturn true;\n\t}\n\n\tif (!base || !parentCandidate) {\n\t\treturn false;\n\t}\n\n\tif (parentCandidate.length > base.length) {\n\t\treturn false;\n\t}\n\n\tif (ignoreCase) {\n\t\tconst beginsWith = startsWithIgnoreCase(base, parentCandidate);\n\t\tif (!beginsWith) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (parentCandidate.length === base.length) {\n\t\t\treturn true; // same path, different casing\n\t\t}\n\n\t\tlet sepOffset = parentCandidate.length;\n\t\tif (parentCandidate.charAt(parentCandidate.length - 1) === separator) {\n\t\t\tsepOffset--; // adjust the expected sep offset in case our candidate already ends in separator character\n\t\t}\n\n\t\treturn base.charAt(sepOffset) === separator;\n\t}\n\n\tif (parentCandidate.charAt(parentCandidate.length - 1) !== separator) {\n\t\tparentCandidate += separator;\n\t}\n\n\treturn base.indexOf(parentCandidate) === 0;\n}\n\nexport function isWindowsDriveLetter(char0: number): boolean {\n\treturn char0 >= CharCode.A && char0 <= CharCode.Z || char0 >= CharCode.a && char0 <= CharCode.z;\n}\n\nexport function sanitizeFilePath(candidate: string, cwd: string): string {\n\n\t// Special case: allow to open a drive letter without trailing backslash\n\tif (isWindows && candidate.endsWith(':')) {\n\t\tcandidate += sep;\n\t}\n\n\t// Ensure absolute\n\tif (!isAbsolute(candidate)) {\n\t\tcandidate = join(cwd, candidate);\n\t}\n\n\t// Ensure normalized\n\tcandidate = normalize(candidate);\n\n\t// Ensure no trailing slash/backslash\n\treturn removeTrailingPathSeparator(candidate);\n}\n\nexport function removeTrailingPathSeparator(candidate: string): string {\n\tif (isWindows) {\n\t\tcandidate = rtrim(candidate, sep);\n\n\t\t// Special case: allow to open drive root ('C:\\')\n\t\tif (candidate.endsWith(':')) {\n\t\t\tcandidate += sep;\n\t\t}\n\n\t} else {\n\t\tcandidate = rtrim(candidate, sep);\n\n\t\t// Special case: allow to open root ('/')\n\t\tif (!candidate) {\n\t\t\tcandidate = sep;\n\t\t}\n\t}\n\n\treturn candidate;\n}\n\nexport function isRootOrDriveLetter(path: string): boolean {\n\tconst pathNormalized = normalize(path);\n\n\tif (isWindows) {\n\t\tif (path.length > 3) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn hasDriveLetter(pathNormalized) &&\n\t\t\t(path.length === 2 || pathNormalized.charCodeAt(2) === CharCode.Backslash);\n\t}\n\n\treturn pathNormalized === posix.sep;\n}\n\nexport function hasDriveLetter(path: string, isWindowsOS: boolean = isWindows): boolean {\n\tif (isWindowsOS) {\n\t\treturn isWindowsDriveLetter(path.charCodeAt(0)) && path.charCodeAt(1) === CharCode.Colon;\n\t}\n\n\treturn false;\n}\n\nexport function getDriveLetter(path: string, isWindowsOS: boolean = isWindows): string | undefined {\n\treturn hasDriveLetter(path, isWindowsOS) ? path[0] : undefined;\n}\n\nexport function indexOfPath(path: string, candidate: string, ignoreCase?: boolean): number {\n\tif (candidate.length > path.length) {\n\t\treturn -1;\n\t}\n\n\tif (path === candidate) {\n\t\treturn 0;\n\t}\n\n\tif (ignoreCase) {\n\t\tpath = path.toLowerCase();\n\t\tcandidate = candidate.toLowerCase();\n\t}\n\n\treturn path.indexOf(candidate);\n}\n\nexport interface IPathWithLineAndColumn {\n\tpath: string;\n\tline?: number;\n\tcolumn?: number;\n}\n\nexport function parseLineAndColumnAware(rawPath: string): IPathWithLineAndColumn {\n\tconst segments = rawPath.split(':'); // C:\\file.txt:<line>:<column>\n\n\tlet path: string | undefined = undefined;\n\tlet line: number | undefined = undefined;\n\tlet column: number | undefined = undefined;\n\n\tfor (const segment of segments) {\n\t\tconst segmentAsNumber = Number(segment);\n\t\tif (!isNumber(segmentAsNumber)) {\n\t\t\tpath = !!path ? [path, segment].join(':') : segment; // a colon can well be part of a path (e.g. C:\\...)\n\t\t} else if (line === undefined) {\n\t\t\tline = segmentAsNumber;\n\t\t} else if (column === undefined) {\n\t\t\tcolumn = segmentAsNumber;\n\t\t}\n\t}\n\n\tif (!path) {\n\t\tthrow new Error('Format for `--goto` should be: `FILE:LINE(:COLUMN)`');\n\t}\n\n\treturn {\n\t\tpath,\n\t\tline: line !== undefined ? line : undefined,\n\t\tcolumn: column !== undefined ? column : line !== undefined ? 1 : undefined // if we have a line, make sure column is also set\n\t};\n}\n\nconst pathChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nconst windowsSafePathFirstChars = 'BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789';\n\nexport function randomPath(parent?: string, prefix?: string, randomLength = 8): string {\n\tlet suffix = '';\n\tfor (let i = 0; i < randomLength; i++) {\n\t\tlet pathCharsTouse: string;\n\t\tif (i === 0 && isWindows && !prefix && (randomLength === 3 || randomLength === 4)) {\n\n\t\t\t// Windows has certain reserved file names that cannot be used, such\n\t\t\t// as AUX, CON, PRN, etc. We want to avoid generating a random name\n\t\t\t// that matches that pattern, so we use a different set of characters\n\t\t\t// for the first character of the name that does not include any of\n\t\t\t// the reserved names first characters.\n\n\t\t\tpathCharsTouse = windowsSafePathFirstChars;\n\t\t} else {\n\t\t\tpathCharsTouse = pathChars;\n\t\t}\n\n\t\tsuffix += pathCharsTouse.charAt(Math.floor(Math.random() * pathCharsTouse.length));\n\t}\n\n\tlet randomFileName: string;\n\tif (prefix) {\n\t\trandomFileName = `${prefix}-${suffix}`;\n\t} else {\n\t\trandomFileName = suffix;\n\t}\n\n\tif (parent) {\n\t\treturn join(parent, randomFileName);\n\t}\n\n\treturn randomFileName;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from './charCode.js';\nimport { MarshalledId } from './marshallingIds.js';\nimport * as paths from './path.js';\nimport { isWindows } from './platform.js';\n\nconst _schemePattern = /^\\w[\\w\\d+.-]*$/;\nconst _singleSlashStart = /^\\//;\nconst _doubleSlashStart = /^\\/\\//;\n\nfunction _validateUri(ret: URI, _strict?: boolean): void {\n\n\t// scheme, must be set\n\tif (!ret.scheme && _strict) {\n\t\tthrow new Error(`[UriError]: Scheme is missing: {scheme: \"\", authority: \"${ret.authority}\", path: \"${ret.path}\", query: \"${ret.query}\", fragment: \"${ret.fragment}\"}`);\n\t}\n\n\t// scheme, https://tools.ietf.org/html/rfc3986#section-3.1\n\t// ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n\tif (ret.scheme && !_schemePattern.test(ret.scheme)) {\n\t\tthrow new Error('[UriError]: Scheme contains illegal characters.');\n\t}\n\n\t// path, http://tools.ietf.org/html/rfc3986#section-3.3\n\t// If a URI contains an authority component, then the path component\n\t// must either be empty or begin with a slash (\"/\") character.  If a URI\n\t// does not contain an authority component, then the path cannot begin\n\t// with two slash characters (\"//\").\n\tif (ret.path) {\n\t\tif (ret.authority) {\n\t\t\tif (!_singleSlashStart.test(ret.path)) {\n\t\t\t\tthrow new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\n\t\t\t}\n\t\t} else {\n\t\t\tif (_doubleSlashStart.test(ret.path)) {\n\t\t\t\tthrow new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\n\t\t\t}\n\t\t}\n\t}\n}\n\n// for a while we allowed uris *without* schemes and this is the migration\n// for them, e.g. an uri without scheme and without strict-mode warns and falls\n// back to the file-scheme. that should cause the least carnage and still be a\n// clear warning\nfunction _schemeFix(scheme: string, _strict: boolean): string {\n\tif (!scheme && !_strict) {\n\t\treturn 'file';\n\t}\n\treturn scheme;\n}\n\n// implements a bit of https://tools.ietf.org/html/rfc3986#section-5\nfunction _referenceResolution(scheme: string, path: string): string {\n\n\t// the slash-character is our 'default base' as we don't\n\t// support constructing URIs relative to other URIs. This\n\t// also means that we alter and potentially break paths.\n\t// see https://tools.ietf.org/html/rfc3986#section-5.1.4\n\tswitch (scheme) {\n\t\tcase 'https':\n\t\tcase 'http':\n\t\tcase 'file':\n\t\t\tif (!path) {\n\t\t\t\tpath = _slash;\n\t\t\t} else if (path[0] !== _slash) {\n\t\t\t\tpath = _slash + path;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn path;\n}\n\nconst _empty = '';\nconst _slash = '/';\nconst _regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\n\n/**\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\n * This class is a simple parser which creates the basic component parts\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\n * and encoding.\n *\n * ```txt\n *       foo://example.com:8042/over/there?name=ferret#nose\n *       \\_/   \\______________/\\_________/ \\_________/ \\__/\n *        |           |            |            |        |\n *     scheme     authority       path        query   fragment\n *        |   _____________________|__\n *       / \\ /                        \\\n *       urn:example:animal:ferret:nose\n * ```\n */\nexport class URI implements UriComponents {\n\n\tstatic isUri(thing: unknown): thing is URI {\n\t\tif (thing instanceof URI) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (<URI>thing).authority === 'string'\n\t\t\t&& typeof (<URI>thing).fragment === 'string'\n\t\t\t&& typeof (<URI>thing).path === 'string'\n\t\t\t&& typeof (<URI>thing).query === 'string'\n\t\t\t&& typeof (<URI>thing).scheme === 'string'\n\t\t\t&& typeof (<URI>thing).fsPath === 'string'\n\t\t\t&& typeof (<URI>thing).with === 'function'\n\t\t\t&& typeof (<URI>thing).toString === 'function';\n\t}\n\n\t/**\n\t * scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'.\n\t * The part before the first colon.\n\t */\n\treadonly scheme: string;\n\n\t/**\n\t * authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'.\n\t * The part between the first double slashes and the next slash.\n\t */\n\treadonly authority: string;\n\n\t/**\n\t * path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'.\n\t */\n\treadonly path: string;\n\n\t/**\n\t * query is the 'query' part of 'http://www.example.com/some/path?query#fragment'.\n\t */\n\treadonly query: string;\n\n\t/**\n\t * fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'.\n\t */\n\treadonly fragment: string;\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(components: UriComponents);\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(schemeOrData: string | UriComponents, authority?: string, path?: string, query?: string, fragment?: string, _strict: boolean = false) {\n\n\t\tif (typeof schemeOrData === 'object') {\n\t\t\tthis.scheme = schemeOrData.scheme || _empty;\n\t\t\tthis.authority = schemeOrData.authority || _empty;\n\t\t\tthis.path = schemeOrData.path || _empty;\n\t\t\tthis.query = schemeOrData.query || _empty;\n\t\t\tthis.fragment = schemeOrData.fragment || _empty;\n\t\t\t// no validation because it's this URI\n\t\t\t// that creates uri components.\n\t\t\t// _validateUri(this);\n\t\t} else {\n\t\t\tthis.scheme = _schemeFix(schemeOrData, _strict);\n\t\t\tthis.authority = authority || _empty;\n\t\t\tthis.path = _referenceResolution(this.scheme, path || _empty);\n\t\t\tthis.query = query || _empty;\n\t\t\tthis.fragment = fragment || _empty;\n\n\t\t\t_validateUri(this, _strict);\n\t\t}\n\t}\n\n\t// ---- filesystem path -----------------------\n\n\t/**\n\t * Returns a string representing the corresponding file system path of this URI.\n\t * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the\n\t * platform specific path separator.\n\t *\n\t * * Will *not* validate the path for invalid characters and semantics.\n\t * * Will *not* look at the scheme of this URI.\n\t * * The result shall *not* be used for display purposes but for accessing a file on disk.\n\t *\n\t *\n\t * The *difference* to `URI#path` is the use of the platform specific separator and the handling\n\t * of UNC paths. See the below sample of a file-uri with an authority (UNC path).\n\t *\n\t * ```ts\n\t\tconst u = URI.parse('file://server/c$/folder/file.txt')\n\t\tu.authority === 'server'\n\t\tu.path === '/shares/c$/file.txt'\n\t\tu.fsPath === '\\\\server\\c$\\folder\\file.txt'\n\t```\n\t *\n\t * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,\n\t * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working\n\t * with URIs that represent files on disk (`file` scheme).\n\t */\n\tget fsPath(): string {\n\t\t// if (this.scheme !== 'file') {\n\t\t// \tconsole.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);\n\t\t// }\n\t\treturn uriToFsPath(this, false);\n\t}\n\n\t// ---- modify to new -------------------------\n\n\twith(change: { scheme?: string; authority?: string | null; path?: string | null; query?: string | null; fragment?: string | null }): URI {\n\n\t\tif (!change) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet { scheme, authority, path, query, fragment } = change;\n\t\tif (scheme === undefined) {\n\t\t\tscheme = this.scheme;\n\t\t} else if (scheme === null) {\n\t\t\tscheme = _empty;\n\t\t}\n\t\tif (authority === undefined) {\n\t\t\tauthority = this.authority;\n\t\t} else if (authority === null) {\n\t\t\tauthority = _empty;\n\t\t}\n\t\tif (path === undefined) {\n\t\t\tpath = this.path;\n\t\t} else if (path === null) {\n\t\t\tpath = _empty;\n\t\t}\n\t\tif (query === undefined) {\n\t\t\tquery = this.query;\n\t\t} else if (query === null) {\n\t\t\tquery = _empty;\n\t\t}\n\t\tif (fragment === undefined) {\n\t\t\tfragment = this.fragment;\n\t\t} else if (fragment === null) {\n\t\t\tfragment = _empty;\n\t\t}\n\n\t\tif (scheme === this.scheme\n\t\t\t&& authority === this.authority\n\t\t\t&& path === this.path\n\t\t\t&& query === this.query\n\t\t\t&& fragment === this.fragment) {\n\n\t\t\treturn this;\n\t\t}\n\n\t\treturn new Uri(scheme, authority, path, query, fragment);\n\t}\n\n\t// ---- parse & validate ------------------------\n\n\t/**\n\t * Creates a new URI from a string, e.g. `http://www.example.com/some/path`,\n\t * `file:///usr/home`, or `scheme:with/path`.\n\t *\n\t * @param value A string which represents an URI (see `URI#toString`).\n\t */\n\tstatic parse(value: string, _strict: boolean = false): URI {\n\t\tconst match = _regexp.exec(value);\n\t\tif (!match) {\n\t\t\treturn new Uri(_empty, _empty, _empty, _empty, _empty);\n\t\t}\n\t\treturn new Uri(\n\t\t\tmatch[2] || _empty,\n\t\t\tpercentDecode(match[4] || _empty),\n\t\t\tpercentDecode(match[5] || _empty),\n\t\t\tpercentDecode(match[7] || _empty),\n\t\t\tpercentDecode(match[9] || _empty),\n\t\t\t_strict\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new URI from a file system path, e.g. `c:\\my\\files`,\n\t * `/usr/home`, or `\\\\server\\share\\some\\path`.\n\t *\n\t * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument\n\t * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**\n\t * `URI.parse('file://' + path)` because the path might contain characters that are\n\t * interpreted (# and ?). See the following sample:\n\t * ```ts\n\tconst good = URI.file('/coding/c#/project1');\n\tgood.scheme === 'file';\n\tgood.path === '/coding/c#/project1';\n\tgood.fragment === '';\n\tconst bad = URI.parse('file://' + '/coding/c#/project1');\n\tbad.scheme === 'file';\n\tbad.path === '/coding/c'; // path is now broken\n\tbad.fragment === '/project1';\n\t```\n\t *\n\t * @param path A file system path (see `URI#fsPath`)\n\t */\n\tstatic file(path: string): URI {\n\n\t\tlet authority = _empty;\n\n\t\t// normalize to fwd-slashes on windows,\n\t\t// on other systems bwd-slashes are valid\n\t\t// filename character, eg /f\\oo/ba\\r.txt\n\t\tif (isWindows) {\n\t\t\tpath = path.replace(/\\\\/g, _slash);\n\t\t}\n\n\t\t// check for authority as used in UNC shares\n\t\t// or use the path as given\n\t\tif (path[0] === _slash && path[1] === _slash) {\n\t\t\tconst idx = path.indexOf(_slash, 2);\n\t\t\tif (idx === -1) {\n\t\t\t\tauthority = path.substring(2);\n\t\t\t\tpath = _slash;\n\t\t\t} else {\n\t\t\t\tauthority = path.substring(2, idx);\n\t\t\t\tpath = path.substring(idx) || _slash;\n\t\t\t}\n\t\t}\n\n\t\treturn new Uri('file', authority, path, _empty, _empty);\n\t}\n\n\t/**\n\t * Creates new URI from uri components.\n\t *\n\t * Unless `strict` is `true` the scheme is defaults to be `file`. This function performs\n\t * validation and should be used for untrusted uri components retrieved from storage,\n\t * user input, command arguments etc\n\t */\n\tstatic from(components: UriComponents, strict?: boolean): URI {\n\t\tconst result = new Uri(\n\t\t\tcomponents.scheme,\n\t\t\tcomponents.authority,\n\t\t\tcomponents.path,\n\t\t\tcomponents.query,\n\t\t\tcomponents.fragment,\n\t\t\tstrict\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Join a URI path with path fragments and normalizes the resulting path.\n\t *\n\t * @param uri The input URI.\n\t * @param pathFragment The path fragment to add to the URI path.\n\t * @returns The resulting URI.\n\t */\n\tstatic joinPath(uri: URI, ...pathFragment: string[]): URI {\n\t\tif (!uri.path) {\n\t\t\tthrow new Error(`[UriError]: cannot call joinPath on URI without path`);\n\t\t}\n\t\tlet newPath: string;\n\t\tif (isWindows && uri.scheme === 'file') {\n\t\t\tnewPath = URI.file(paths.win32.join(uriToFsPath(uri, true), ...pathFragment)).path;\n\t\t} else {\n\t\t\tnewPath = paths.posix.join(uri.path, ...pathFragment);\n\t\t}\n\t\treturn uri.with({ path: newPath });\n\t}\n\n\t// ---- printing/externalize ---------------------------\n\n\t/**\n\t * Creates a string representation for this URI. It's guaranteed that calling\n\t * `URI.parse` with the result of this function creates an URI which is equal\n\t * to this URI.\n\t *\n\t * * The result shall *not* be used for display purposes but for externalization or transport.\n\t * * The result will be encoded using the percentage encoding and encoding happens mostly\n\t * ignore the scheme-specific encoding rules.\n\t *\n\t * @param skipEncoding Do not encode the result, default is `false`\n\t */\n\ttoString(skipEncoding: boolean = false): string {\n\t\treturn _asFormatted(this, skipEncoding);\n\t}\n\n\ttoJSON(): UriComponents {\n\t\treturn this;\n\t}\n\n\t/**\n\t * A helper function to revive URIs.\n\t *\n\t * **Note** that this function should only be used when receiving URI#toJSON generated data\n\t * and that it doesn't do any validation. Use {@link URI.from} when received \"untrusted\"\n\t * uri components such as command arguments or data from storage.\n\t *\n\t * @param data The URI components or URI to revive.\n\t * @returns The revived URI or undefined or null.\n\t */\n\tstatic revive(data: UriComponents | URI): URI;\n\tstatic revive(data: UriComponents | URI | undefined): URI | undefined;\n\tstatic revive(data: UriComponents | URI | null): URI | null;\n\tstatic revive(data: UriComponents | URI | undefined | null): URI | undefined | null;\n\tstatic revive(data: UriComponents | URI | undefined | null): URI | undefined | null {\n\t\tif (!data) {\n\t\t\treturn data;\n\t\t} else if (data instanceof URI) {\n\t\t\treturn data;\n\t\t} else {\n\t\t\tconst result = new Uri(data);\n\t\t\tresult._formatted = (<UriState>data).external ?? null;\n\t\t\tresult._fsPath = (<UriState>data)._sep === _pathSepMarker ? (<UriState>data).fsPath ?? null : null;\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t[Symbol.for('debug.description')]() {\n\t\treturn `URI(${this.toString()})`;\n\t}\n}\n\nexport interface UriComponents {\n\tscheme: string;\n\tauthority?: string;\n\tpath?: string;\n\tquery?: string;\n\tfragment?: string;\n}\n\nexport function isUriComponents(thing: unknown): thing is UriComponents {\n\tif (!thing || typeof thing !== 'object') {\n\t\treturn false;\n\t}\n\treturn typeof (<UriComponents>thing).scheme === 'string'\n\t\t&& (typeof (<UriComponents>thing).authority === 'string' || typeof (<UriComponents>thing).authority === 'undefined')\n\t\t&& (typeof (<UriComponents>thing).path === 'string' || typeof (<UriComponents>thing).path === 'undefined')\n\t\t&& (typeof (<UriComponents>thing).query === 'string' || typeof (<UriComponents>thing).query === 'undefined')\n\t\t&& (typeof (<UriComponents>thing).fragment === 'string' || typeof (<UriComponents>thing).fragment === 'undefined');\n}\n\ninterface UriState extends UriComponents {\n\t$mid: MarshalledId.Uri;\n\texternal?: string;\n\tfsPath?: string;\n\t_sep?: 1;\n}\n\nconst _pathSepMarker = isWindows ? 1 : undefined;\n\n// This class exists so that URI is compatible with vscode.Uri (API).\nclass Uri extends URI {\n\n\t_formatted: string | null = null;\n\t_fsPath: string | null = null;\n\n\toverride get fsPath(): string {\n\t\tif (!this._fsPath) {\n\t\t\tthis._fsPath = uriToFsPath(this, false);\n\t\t}\n\t\treturn this._fsPath;\n\t}\n\n\toverride toString(skipEncoding: boolean = false): string {\n\t\tif (!skipEncoding) {\n\t\t\tif (!this._formatted) {\n\t\t\t\tthis._formatted = _asFormatted(this, false);\n\t\t\t}\n\t\t\treturn this._formatted;\n\t\t} else {\n\t\t\t// we don't cache that\n\t\t\treturn _asFormatted(this, true);\n\t\t}\n\t}\n\n\toverride toJSON(): UriComponents {\n\t\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\t\tconst res = <UriState>{\n\t\t\t$mid: MarshalledId.Uri\n\t\t};\n\t\t// cached state\n\t\tif (this._fsPath) {\n\t\t\tres.fsPath = this._fsPath;\n\t\t\tres._sep = _pathSepMarker;\n\t\t}\n\t\tif (this._formatted) {\n\t\t\tres.external = this._formatted;\n\t\t}\n\t\t//--- uri components\n\t\tif (this.path) {\n\t\t\tres.path = this.path;\n\t\t}\n\t\t// TODO\n\t\t// this isn't correct and can violate the UriComponents contract but\n\t\t// this is part of the vscode.Uri API and we shouldn't change how that\n\t\t// works anymore\n\t\tif (this.scheme) {\n\t\t\tres.scheme = this.scheme;\n\t\t}\n\t\tif (this.authority) {\n\t\t\tres.authority = this.authority;\n\t\t}\n\t\tif (this.query) {\n\t\t\tres.query = this.query;\n\t\t}\n\t\tif (this.fragment) {\n\t\t\tres.fragment = this.fragment;\n\t\t}\n\t\treturn res;\n\t}\n}\n\n// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2\nconst encodeTable: { [ch: number]: string } = {\n\t[CharCode.Colon]: '%3A', // gen-delims\n\t[CharCode.Slash]: '%2F',\n\t[CharCode.QuestionMark]: '%3F',\n\t[CharCode.Hash]: '%23',\n\t[CharCode.OpenSquareBracket]: '%5B',\n\t[CharCode.CloseSquareBracket]: '%5D',\n\t[CharCode.AtSign]: '%40',\n\n\t[CharCode.ExclamationMark]: '%21', // sub-delims\n\t[CharCode.DollarSign]: '%24',\n\t[CharCode.Ampersand]: '%26',\n\t[CharCode.SingleQuote]: '%27',\n\t[CharCode.OpenParen]: '%28',\n\t[CharCode.CloseParen]: '%29',\n\t[CharCode.Asterisk]: '%2A',\n\t[CharCode.Plus]: '%2B',\n\t[CharCode.Comma]: '%2C',\n\t[CharCode.Semicolon]: '%3B',\n\t[CharCode.Equals]: '%3D',\n\n\t[CharCode.Space]: '%20',\n};\n\nfunction encodeURIComponentFast(uriComponent: string, isPath: boolean, isAuthority: boolean): string {\n\tlet res: string | undefined = undefined;\n\tlet nativeEncodePos = -1;\n\n\tfor (let pos = 0; pos < uriComponent.length; pos++) {\n\t\tconst code = uriComponent.charCodeAt(pos);\n\n\t\t// unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3\n\t\tif (\n\t\t\t(code >= CharCode.a && code <= CharCode.z)\n\t\t\t|| (code >= CharCode.A && code <= CharCode.Z)\n\t\t\t|| (code >= CharCode.Digit0 && code <= CharCode.Digit9)\n\t\t\t|| code === CharCode.Dash\n\t\t\t|| code === CharCode.Period\n\t\t\t|| code === CharCode.Underline\n\t\t\t|| code === CharCode.Tilde\n\t\t\t|| (isPath && code === CharCode.Slash)\n\t\t\t|| (isAuthority && code === CharCode.OpenSquareBracket)\n\t\t\t|| (isAuthority && code === CharCode.CloseSquareBracket)\n\t\t\t|| (isAuthority && code === CharCode.Colon)\n\t\t) {\n\t\t\t// check if we are delaying native encode\n\t\t\tif (nativeEncodePos !== -1) {\n\t\t\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n\t\t\t\tnativeEncodePos = -1;\n\t\t\t}\n\t\t\t// check if we write into a new string (by default we try to return the param)\n\t\t\tif (res !== undefined) {\n\t\t\t\tres += uriComponent.charAt(pos);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// encoding needed, we need to allocate a new string\n\t\t\tif (res === undefined) {\n\t\t\t\tres = uriComponent.substr(0, pos);\n\t\t\t}\n\n\t\t\t// check with default table first\n\t\t\tconst escaped = encodeTable[code];\n\t\t\tif (escaped !== undefined) {\n\n\t\t\t\t// check if we are delaying native encode\n\t\t\t\tif (nativeEncodePos !== -1) {\n\t\t\t\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n\t\t\t\t\tnativeEncodePos = -1;\n\t\t\t\t}\n\n\t\t\t\t// append escaped variant to result\n\t\t\t\tres += escaped;\n\n\t\t\t} else if (nativeEncodePos === -1) {\n\t\t\t\t// use native encode only when needed\n\t\t\t\tnativeEncodePos = pos;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (nativeEncodePos !== -1) {\n\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos));\n\t}\n\n\treturn res !== undefined ? res : uriComponent;\n}\n\nfunction encodeURIComponentMinimal(path: string): string {\n\tlet res: string | undefined = undefined;\n\tfor (let pos = 0; pos < path.length; pos++) {\n\t\tconst code = path.charCodeAt(pos);\n\t\tif (code === CharCode.Hash || code === CharCode.QuestionMark) {\n\t\t\tif (res === undefined) {\n\t\t\t\tres = path.substr(0, pos);\n\t\t\t}\n\t\t\tres += encodeTable[code];\n\t\t} else {\n\t\t\tif (res !== undefined) {\n\t\t\t\tres += path[pos];\n\t\t\t}\n\t\t}\n\t}\n\treturn res !== undefined ? res : path;\n}\n\n/**\n * Compute `fsPath` for the given uri\n */\nexport function uriToFsPath(uri: URI, keepDriveLetterCasing: boolean): string {\n\n\tlet value: string;\n\tif (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {\n\t\t// unc path: file://shares/c$/far/boo\n\t\tvalue = `//${uri.authority}${uri.path}`;\n\t} else if (\n\t\turi.path.charCodeAt(0) === CharCode.Slash\n\t\t&& (uri.path.charCodeAt(1) >= CharCode.A && uri.path.charCodeAt(1) <= CharCode.Z || uri.path.charCodeAt(1) >= CharCode.a && uri.path.charCodeAt(1) <= CharCode.z)\n\t\t&& uri.path.charCodeAt(2) === CharCode.Colon\n\t) {\n\t\tif (!keepDriveLetterCasing) {\n\t\t\t// windows drive letter: file:///c:/far/boo\n\t\t\tvalue = uri.path[1].toLowerCase() + uri.path.substr(2);\n\t\t} else {\n\t\t\tvalue = uri.path.substr(1);\n\t\t}\n\t} else {\n\t\t// other path\n\t\tvalue = uri.path;\n\t}\n\tif (isWindows) {\n\t\tvalue = value.replace(/\\//g, '\\\\');\n\t}\n\treturn value;\n}\n\n/**\n * Create the external version of a uri\n */\nfunction _asFormatted(uri: URI, skipEncoding: boolean): string {\n\n\tconst encoder = !skipEncoding\n\t\t? encodeURIComponentFast\n\t\t: encodeURIComponentMinimal;\n\n\tlet res = '';\n\tlet { scheme, authority, path, query, fragment } = uri;\n\tif (scheme) {\n\t\tres += scheme;\n\t\tres += ':';\n\t}\n\tif (authority || scheme === 'file') {\n\t\tres += _slash;\n\t\tres += _slash;\n\t}\n\tif (authority) {\n\t\tlet idx = authority.indexOf('@');\n\t\tif (idx !== -1) {\n\t\t\t// <user>@<auth>\n\t\t\tconst userinfo = authority.substr(0, idx);\n\t\t\tauthority = authority.substr(idx + 1);\n\t\t\tidx = userinfo.lastIndexOf(':');\n\t\t\tif (idx === -1) {\n\t\t\t\tres += encoder(userinfo, false, false);\n\t\t\t} else {\n\t\t\t\t// <user>:<pass>@<auth>\n\t\t\t\tres += encoder(userinfo.substr(0, idx), false, false);\n\t\t\t\tres += ':';\n\t\t\t\tres += encoder(userinfo.substr(idx + 1), false, true);\n\t\t\t}\n\t\t\tres += '@';\n\t\t}\n\t\tauthority = authority.toLowerCase();\n\t\tidx = authority.lastIndexOf(':');\n\t\tif (idx === -1) {\n\t\t\tres += encoder(authority, false, true);\n\t\t} else {\n\t\t\t// <auth>:<port>\n\t\t\tres += encoder(authority.substr(0, idx), false, true);\n\t\t\tres += authority.substr(idx);\n\t\t}\n\t}\n\tif (path) {\n\t\t// lower-case windows drive letters in /C:/fff or C:/fff\n\t\tif (path.length >= 3 && path.charCodeAt(0) === CharCode.Slash && path.charCodeAt(2) === CharCode.Colon) {\n\t\t\tconst code = path.charCodeAt(1);\n\t\t\tif (code >= CharCode.A && code <= CharCode.Z) {\n\t\t\t\tpath = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // \"/c:\".length === 3\n\t\t\t}\n\t\t} else if (path.length >= 2 && path.charCodeAt(1) === CharCode.Colon) {\n\t\t\tconst code = path.charCodeAt(0);\n\t\t\tif (code >= CharCode.A && code <= CharCode.Z) {\n\t\t\t\tpath = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // \"/c:\".length === 3\n\t\t\t}\n\t\t}\n\t\t// encode the rest of the path\n\t\tres += encoder(path, true, false);\n\t}\n\tif (query) {\n\t\tres += '?';\n\t\tres += encoder(query, false, false);\n\t}\n\tif (fragment) {\n\t\tres += '#';\n\t\tres += !skipEncoding ? encodeURIComponentFast(fragment, false, false) : fragment;\n\t}\n\treturn res;\n}\n\n// --- decode\n\nfunction decodeURIComponentGraceful(str: string): string {\n\ttry {\n\t\treturn decodeURIComponent(str);\n\t} catch {\n\t\tif (str.length > 3) {\n\t\t\treturn str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));\n\t\t} else {\n\t\t\treturn str;\n\t\t}\n\t}\n}\n\nconst _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;\n\nfunction percentDecode(str: string): string {\n\tif (!str.match(_rEncodedAsHex)) {\n\t\treturn str;\n\t}\n\treturn str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));\n}\n\n/**\n * Mapped-type that replaces all occurrences of URI with UriComponents\n */\nexport type UriDto<T> = { [K in keyof T]: T[K] extends URI\n\t? UriComponents\n\t: UriDto<T[K]> };\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as errors from './errors.js';\nimport * as platform from './platform.js';\nimport { equalsIgnoreCase, startsWithIgnoreCase } from './strings.js';\nimport { URI } from './uri.js';\nimport * as paths from './path.js';\n\nexport namespace Schemas {\n\n\t/**\n\t * A schema that is used for models that exist in memory\n\t * only and that have no correspondence on a server or such.\n\t */\n\texport const inMemory = 'inmemory';\n\n\t/**\n\t * A schema that is used for setting files\n\t */\n\texport const vscode = 'vscode';\n\n\t/**\n\t * A schema that is used for internal private files\n\t */\n\texport const internal = 'private';\n\n\t/**\n\t * A walk-through document.\n\t */\n\texport const walkThrough = 'walkThrough';\n\n\t/**\n\t * An embedded code snippet.\n\t */\n\texport const walkThroughSnippet = 'walkThroughSnippet';\n\n\texport const http = 'http';\n\n\texport const https = 'https';\n\n\texport const file = 'file';\n\n\texport const mailto = 'mailto';\n\n\texport const untitled = 'untitled';\n\n\texport const data = 'data';\n\n\texport const command = 'command';\n\n\texport const vscodeRemote = 'vscode-remote';\n\n\texport const vscodeRemoteResource = 'vscode-remote-resource';\n\n\texport const vscodeManagedRemoteResource = 'vscode-managed-remote-resource';\n\n\texport const vscodeUserData = 'vscode-userdata';\n\n\texport const vscodeCustomEditor = 'vscode-custom-editor';\n\n\texport const vscodeNotebookCell = 'vscode-notebook-cell';\n\texport const vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';\n\texport const vscodeNotebookCellMetadataDiff = 'vscode-notebook-cell-metadata-diff';\n\texport const vscodeNotebookCellOutput = 'vscode-notebook-cell-output';\n\texport const vscodeNotebookCellOutputDiff = 'vscode-notebook-cell-output-diff';\n\texport const vscodeNotebookMetadata = 'vscode-notebook-metadata';\n\texport const vscodeInteractiveInput = 'vscode-interactive-input';\n\n\texport const vscodeSettings = 'vscode-settings';\n\n\texport const vscodeWorkspaceTrust = 'vscode-workspace-trust';\n\n\texport const vscodeTerminal = 'vscode-terminal';\n\n\t/** Scheme used for code blocks in chat. */\n\texport const vscodeChatCodeBlock = 'vscode-chat-code-block';\n\n\t/** Scheme used for LHS of code compare (aka diff) blocks in chat. */\n\texport const vscodeChatCodeCompareBlock = 'vscode-chat-code-compare-block';\n\n\t/** Scheme used for the chat input editor. */\n\texport const vscodeChatSesssion = 'vscode-chat-editor';\n\n\t/** Scheme used for the chat input part */\n\texport const vscodeChatInput = 'chatSessionInput';\n\n\t/**\n\t * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors)\n\t */\n\texport const webviewPanel = 'webview-panel';\n\n\t/**\n\t * Scheme used for loading the wrapper html and script in webviews.\n\t */\n\texport const vscodeWebview = 'vscode-webview';\n\n\t/**\n\t * Scheme used for extension pages\n\t */\n\texport const extension = 'extension';\n\n\t/**\n\t * Scheme used as a replacement of `file` scheme to load\n\t * files with our custom protocol handler (desktop only).\n\t */\n\texport const vscodeFileResource = 'vscode-file';\n\n\t/**\n\t * Scheme used for temporary resources\n\t */\n\texport const tmp = 'tmp';\n\n\t/**\n\t * Scheme used vs live share\n\t */\n\texport const vsls = 'vsls';\n\n\t/**\n\t * Scheme used for the Source Control commit input's text document\n\t */\n\texport const vscodeSourceControl = 'vscode-scm';\n\n\t/**\n\t * Scheme used for input box for creating comments.\n\t */\n\texport const commentsInput = 'comment';\n\n\t/**\n\t * Scheme used for special rendering of settings in the release notes\n\t */\n\texport const codeSetting = 'code-setting';\n\n\t/**\n\t * Scheme used for output panel resources\n\t */\n\texport const outputChannel = 'output';\n\n\t/**\n\t * Scheme used for the accessible view\n\t */\n\texport const accessibleView = 'accessible-view';\n}\n\nexport function matchesScheme(target: URI | string, scheme: string): boolean {\n\tif (URI.isUri(target)) {\n\t\treturn equalsIgnoreCase(target.scheme, scheme);\n\t} else {\n\t\treturn startsWithIgnoreCase(target, scheme + ':');\n\t}\n}\n\nexport function matchesSomeScheme(target: URI | string, ...schemes: string[]): boolean {\n\treturn schemes.some(scheme => matchesScheme(target, scheme));\n}\n\nexport const connectionTokenCookieName = 'vscode-tkn';\nexport const connectionTokenQueryName = 'tkn';\n\nclass RemoteAuthoritiesImpl {\n\tprivate readonly _hosts: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate readonly _ports: { [authority: string]: number | undefined } = Object.create(null);\n\tprivate readonly _connectionTokens: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate _preferredWebSchema: 'http' | 'https' = 'http';\n\tprivate _delegate: ((uri: URI) => URI) | null = null;\n\tprivate _serverRootPath: string = '/';\n\n\tsetPreferredWebSchema(schema: 'http' | 'https') {\n\t\tthis._preferredWebSchema = schema;\n\t}\n\n\tsetDelegate(delegate: (uri: URI) => URI): void {\n\t\tthis._delegate = delegate;\n\t}\n\n\tsetServerRootPath(product: { quality?: string; commit?: string }, serverBasePath: string | undefined): void {\n\t\tthis._serverRootPath = paths.posix.join(serverBasePath ?? '/', getServerProductSegment(product));\n\t}\n\n\tgetServerRootPath(): string {\n\t\treturn this._serverRootPath;\n\t}\n\n\tprivate get _remoteResourcesPath(): string {\n\t\treturn paths.posix.join(this._serverRootPath, Schemas.vscodeRemoteResource);\n\t}\n\n\tset(authority: string, host: string, port: number): void {\n\t\tthis._hosts[authority] = host;\n\t\tthis._ports[authority] = port;\n\t}\n\n\tsetConnectionToken(authority: string, connectionToken: string): void {\n\t\tthis._connectionTokens[authority] = connectionToken;\n\t}\n\n\tgetPreferredWebSchema(): 'http' | 'https' {\n\t\treturn this._preferredWebSchema;\n\t}\n\n\trewrite(uri: URI): URI {\n\t\tif (this._delegate) {\n\t\t\ttry {\n\t\t\t\treturn this._delegate(uri);\n\t\t\t} catch (err) {\n\t\t\t\terrors.onUnexpectedError(err);\n\t\t\t\treturn uri;\n\t\t\t}\n\t\t}\n\t\tconst authority = uri.authority;\n\t\tlet host = this._hosts[authority];\n\t\tif (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) {\n\t\t\thost = `[${host}]`;\n\t\t}\n\t\tconst port = this._ports[authority];\n\t\tconst connectionToken = this._connectionTokens[authority];\n\t\tlet query = `path=${encodeURIComponent(uri.path)}`;\n\t\tif (typeof connectionToken === 'string') {\n\t\t\tquery += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;\n\t\t}\n\t\treturn URI.from({\n\t\t\tscheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,\n\t\t\tauthority: `${host}:${port}`,\n\t\t\tpath: platform.isWeb\n\t\t\t\t? (window.location.pathname + \"/\" + this._remoteResourcesPath).replace(/\\/\\/+/g, \"/\")\n\t\t\t\t: this._remoteResourcesPath,\n\t\t\tquery\n\t\t});\n\t}\n}\n\nexport const RemoteAuthorities = new RemoteAuthoritiesImpl();\n\nexport function getServerProductSegment(product: { quality?: string; commit?: string }) {\n\treturn `${product.quality ?? 'oss'}-${product.commit ?? 'dev'}`;\n}\n\n/**\n * A string pointing to a path inside the app. It should not begin with ./ or ../\n */\nexport type AppResourcePath = (\n\t`a${string}` | `b${string}` | `c${string}` | `d${string}` | `e${string}` | `f${string}`\n\t| `g${string}` | `h${string}` | `i${string}` | `j${string}` | `k${string}` | `l${string}`\n\t| `m${string}` | `n${string}` | `o${string}` | `p${string}` | `q${string}` | `r${string}`\n\t| `s${string}` | `t${string}` | `u${string}` | `v${string}` | `w${string}` | `x${string}`\n\t| `y${string}` | `z${string}`\n);\n\nexport const builtinExtensionsPath: AppResourcePath = 'vs/../../extensions';\nexport const nodeModulesPath: AppResourcePath = 'vs/../../node_modules';\nexport const nodeModulesAsarPath: AppResourcePath = 'vs/../../node_modules.asar';\nexport const nodeModulesAsarUnpackedPath: AppResourcePath = 'vs/../../node_modules.asar.unpacked';\n\nexport const VSCODE_AUTHORITY = 'vscode-app';\n\nclass FileAccessImpl {\n\n\tprivate static readonly FALLBACK_AUTHORITY = VSCODE_AUTHORITY;\n\n\t/**\n\t * Returns a URI to use in contexts where the browser is responsible\n\t * for loading (e.g. fetch()) or when used within the DOM.\n\t *\n\t * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n\t */\n\tasBrowserUri(resourcePath: AppResourcePath | ''): URI {\n\t\tconst uri = this.toUri(resourcePath);\n\t\treturn this.uriToBrowserUri(uri);\n\t}\n\n\t/**\n\t * Returns a URI to use in contexts where the browser is responsible\n\t * for loading (e.g. fetch()) or when used within the DOM.\n\t *\n\t * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n\t */\n\turiToBrowserUri(uri: URI): URI {\n\t\t// Handle remote URIs via `RemoteAuthorities`\n\t\tif (uri.scheme === Schemas.vscodeRemote) {\n\t\t\treturn RemoteAuthorities.rewrite(uri);\n\t\t}\n\n\t\t// Convert to `vscode-file` resource..\n\t\tif (\n\t\t\t// ...only ever for `file` resources\n\t\t\turi.scheme === Schemas.file &&\n\t\t\t(\n\t\t\t\t// ...and we run in native environments\n\t\t\t\tplatform.isNative ||\n\t\t\t\t// ...or web worker extensions on desktop\n\t\t\t\t(platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`)\n\t\t\t)\n\t\t) {\n\t\t\treturn uri.with({\n\t\t\t\tscheme: Schemas.vscodeFileResource,\n\t\t\t\t// We need to provide an authority here so that it can serve\n\t\t\t\t// as origin for network and loading matters in chromium.\n\t\t\t\t// If the URI is not coming with an authority already, we\n\t\t\t\t// add our own\n\t\t\t\tauthority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY,\n\t\t\t\tquery: null,\n\t\t\t\tfragment: null\n\t\t\t});\n\t\t}\n\n\t\treturn uri;\n\t}\n\n\t/**\n\t * Returns the `file` URI to use in contexts where node.js\n\t * is responsible for loading.\n\t */\n\tasFileUri(resourcePath: AppResourcePath | ''): URI {\n\t\tconst uri = this.toUri(resourcePath);\n\t\treturn this.uriToFileUri(uri);\n\t}\n\n\t/**\n\t * Returns the `file` URI to use in contexts where node.js\n\t * is responsible for loading.\n\t */\n\turiToFileUri(uri: URI): URI {\n\t\t// Only convert the URI if it is `vscode-file:` scheme\n\t\tif (uri.scheme === Schemas.vscodeFileResource) {\n\t\t\treturn uri.with({\n\t\t\t\tscheme: Schemas.file,\n\t\t\t\t// Only preserve the `authority` if it is different from\n\t\t\t\t// our fallback authority. This ensures we properly preserve\n\t\t\t\t// Windows UNC paths that come with their own authority.\n\t\t\t\tauthority: uri.authority !== FileAccessImpl.FALLBACK_AUTHORITY ? uri.authority : null,\n\t\t\t\tquery: null,\n\t\t\t\tfragment: null\n\t\t\t});\n\t\t}\n\n\t\treturn uri;\n\t}\n\n\tprivate toUri(uriOrModule: URI | string): URI {\n\t\tif (URI.isUri(uriOrModule)) {\n\t\t\treturn uriOrModule;\n\t\t}\n\n\t\tif (globalThis._VSCODE_FILE_ROOT) {\n\t\t\tconst rootUriOrPath = globalThis._VSCODE_FILE_ROOT;\n\n\t\t\t// File URL (with scheme)\n\t\t\tif (/^\\w[\\w\\d+.-]*:\\/\\//.test(rootUriOrPath)) {\n\t\t\t\treturn URI.joinPath(URI.parse(rootUriOrPath, true), uriOrModule);\n\t\t\t}\n\n\t\t\t// File Path (no scheme)\n\t\t\tconst modulePath = paths.join(rootUriOrPath, uriOrModule);\n\t\t\treturn URI.file(modulePath);\n\t\t}\n\n\t\tthrow new Error('Cannot determine URI for module id!');\n\t}\n}\n\nexport const FileAccess = new FileAccessImpl();\n\nexport const CacheControlheaders: Record<string, string> = Object.freeze({\n\t'Cache-Control': 'no-cache, no-store'\n});\n\nexport const DocumentPolicyheaders: Record<string, string> = Object.freeze({\n\t'Document-Policy': 'include-js-call-stacks-in-crash-reports'\n});\n\nexport namespace COI {\n\n\tconst coiHeaders = new Map<'3' | '2' | '1' | string, Record<string, string>>([\n\t\t['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }],\n\t\t['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t\t['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t]);\n\n\texport const CoopAndCoep = Object.freeze(coiHeaders.get('3'));\n\n\tconst coiSearchParamName = 'vscode-coi';\n\n\t/**\n\t * Extract desired headers from `vscode-coi` invocation\n\t */\n\texport function getHeadersFromQuery(url: string | URI | URL): Record<string, string> | undefined {\n\t\tlet params: URLSearchParams | undefined;\n\t\tif (typeof url === 'string') {\n\t\t\tparams = new URL(url).searchParams;\n\t\t} else if (url instanceof URL) {\n\t\t\tparams = url.searchParams;\n\t\t} else if (URI.isUri(url)) {\n\t\t\tparams = new URL(url.toString(true)).searchParams;\n\t\t}\n\t\tconst value = params?.get(coiSearchParamName);\n\t\tif (!value) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn coiHeaders.get(value);\n\t}\n\n\t/**\n\t * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated`\n\t * isn't enabled the current context\n\t */\n\texport function addSearchParam(urlOrSearch: URLSearchParams | Record<string, string>, coop: boolean, coep: boolean): void {\n\t\tif (!(<any>globalThis).crossOriginIsolated) {\n\t\t\t// depends on the current context being COI\n\t\t\treturn;\n\t\t}\n\t\tconst value = coop && coep ? '3' : coep ? '2' : '1';\n\t\tif (urlOrSearch instanceof URLSearchParams) {\n\t\t\turlOrSearch.set(coiSearchParamName, value);\n\t\t} else {\n\t\t\t(<Record<string, string>>urlOrSearch)[coiSearchParamName] = value;\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from './charCode.js';\nimport * as extpath from './extpath.js';\nimport { Schemas } from './network.js';\nimport * as paths from './path.js';\nimport { isLinux, isWindows } from './platform.js';\nimport { compare as strCompare, equalsIgnoreCase } from './strings.js';\nimport { URI, uriToFsPath } from './uri.js';\n\nexport function originalFSPath(uri: URI): string {\n\treturn uriToFsPath(uri, true);\n}\n\n//#region IExtUri\n\nexport interface IExtUri {\n\n\t// --- identity\n\n\t/**\n\t * Compares two uris.\n\t *\n\t * @param uri1 Uri\n\t * @param uri2 Uri\n\t * @param ignoreFragment Ignore the fragment (defaults to `false`)\n\t */\n\tcompare(uri1: URI, uri2: URI, ignoreFragment?: boolean): number;\n\n\t/**\n\t * Tests whether two uris are equal\n\t *\n\t * @param uri1 Uri\n\t * @param uri2 Uri\n\t * @param ignoreFragment Ignore the fragment (defaults to `false`)\n\t */\n\tisEqual(uri1: URI | undefined, uri2: URI | undefined, ignoreFragment?: boolean): boolean;\n\n\t/**\n\t * Tests whether a `candidate` URI is a parent or equal of a given `base` URI.\n\t *\n\t * @param base A uri which is \"longer\" or at least same length as `parentCandidate`\n\t * @param parentCandidate A uri which is \"shorter\" or up to same length as `base`\n\t * @param ignoreFragment Ignore the fragment (defaults to `false`)\n\t */\n\tisEqualOrParent(base: URI, parentCandidate: URI, ignoreFragment?: boolean): boolean;\n\n\t/**\n\t * Creates a key from a resource URI to be used to resource comparison and for resource maps.\n\t * @see {@link ResourceMap}\n\t * @param uri Uri\n\t * @param ignoreFragment Ignore the fragment (defaults to `false`)\n\t */\n\tgetComparisonKey(uri: URI, ignoreFragment?: boolean): string;\n\n\t/**\n\t * Whether the casing of the path-component of the uri should be ignored.\n\t */\n\tignorePathCasing(uri: URI): boolean;\n\n\t// --- path math\n\n\tbasenameOrAuthority(resource: URI): string;\n\n\t/**\n\t * Returns the basename of the path component of an uri.\n\t * @param resource\n\t */\n\tbasename(resource: URI): string;\n\n\t/**\n\t * Returns the extension of the path component of an uri.\n\t * @param resource\n\t */\n\textname(resource: URI): string;\n\t/**\n\t * Return a URI representing the directory of a URI path.\n\t *\n\t * @param resource The input URI.\n\t * @returns The URI representing the directory of the input URI.\n\t */\n\tdirname(resource: URI): URI;\n\t/**\n\t * Join a URI path with path fragments and normalizes the resulting path.\n\t *\n\t * @param resource The input URI.\n\t * @param pathFragment The path fragment to add to the URI path.\n\t * @returns The resulting URI.\n\t */\n\tjoinPath(resource: URI, ...pathFragment: string[]): URI;\n\t/**\n\t * Normalizes the path part of a URI: Resolves `.` and `..` elements with directory names.\n\t *\n\t * @param resource The URI to normalize the path.\n\t * @returns The URI with the normalized path.\n\t */\n\tnormalizePath(resource: URI): URI;\n\t/**\n\t *\n\t * @param from\n\t * @param to\n\t */\n\trelativePath(from: URI, to: URI): string | undefined;\n\t/**\n\t * Resolves an absolute or relative path against a base URI.\n\t * The path can be relative or absolute posix or a Windows path\n\t */\n\tresolvePath(base: URI, path: string): URI;\n\n\t// --- misc\n\n\t/**\n\t * Returns true if the URI path is absolute.\n\t */\n\tisAbsolutePath(resource: URI): boolean;\n\t/**\n\t * Tests whether the two authorities are the same\n\t */\n\tisEqualAuthority(a1: string, a2: string): boolean;\n\t/**\n\t * Returns true if the URI path has a trailing path separator\n\t */\n\thasTrailingPathSeparator(resource: URI, sep?: string): boolean;\n\t/**\n\t * Removes a trailing path separator, if there's one.\n\t * Important: Doesn't remove the first slash, it would make the URI invalid\n\t */\n\tremoveTrailingPathSeparator(resource: URI, sep?: string): URI;\n\t/**\n\t * Adds a trailing path separator to the URI if there isn't one already.\n\t * For example, c:\\ would be unchanged, but c:\\users would become c:\\users\\\n\t */\n\taddTrailingPathSeparator(resource: URI, sep?: string): URI;\n}\n\nexport class ExtUri implements IExtUri {\n\n\tconstructor(private _ignorePathCasing: (uri: URI) => boolean) { }\n\n\tcompare(uri1: URI, uri2: URI, ignoreFragment: boolean = false): number {\n\t\tif (uri1 === uri2) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn strCompare(this.getComparisonKey(uri1, ignoreFragment), this.getComparisonKey(uri2, ignoreFragment));\n\t}\n\n\tisEqual(uri1: URI | undefined, uri2: URI | undefined, ignoreFragment: boolean = false): boolean {\n\t\tif (uri1 === uri2) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!uri1 || !uri2) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this.getComparisonKey(uri1, ignoreFragment) === this.getComparisonKey(uri2, ignoreFragment);\n\t}\n\n\tgetComparisonKey(uri: URI, ignoreFragment: boolean = false): string {\n\t\treturn uri.with({\n\t\t\tpath: this._ignorePathCasing(uri) ? uri.path.toLowerCase() : undefined,\n\t\t\tfragment: ignoreFragment ? null : undefined\n\t\t}).toString();\n\t}\n\n\tignorePathCasing(uri: URI): boolean {\n\t\treturn this._ignorePathCasing(uri);\n\t}\n\n\tisEqualOrParent(base: URI, parentCandidate: URI, ignoreFragment: boolean = false): boolean {\n\t\tif (base.scheme === parentCandidate.scheme) {\n\t\t\tif (base.scheme === Schemas.file) {\n\t\t\t\treturn extpath.isEqualOrParent(originalFSPath(base), originalFSPath(parentCandidate), this._ignorePathCasing(base)) && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);\n\t\t\t}\n\t\t\tif (isEqualAuthority(base.authority, parentCandidate.authority)) {\n\t\t\t\treturn extpath.isEqualOrParent(base.path, parentCandidate.path, this._ignorePathCasing(base), '/') && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t// --- path math\n\n\tjoinPath(resource: URI, ...pathFragment: string[]): URI {\n\t\treturn URI.joinPath(resource, ...pathFragment);\n\t}\n\n\tbasenameOrAuthority(resource: URI): string {\n\t\treturn basename(resource) || resource.authority;\n\t}\n\n\tbasename(resource: URI): string {\n\t\treturn paths.posix.basename(resource.path);\n\t}\n\n\textname(resource: URI): string {\n\t\treturn paths.posix.extname(resource.path);\n\t}\n\n\tdirname(resource: URI): URI {\n\t\tif (resource.path.length === 0) {\n\t\t\treturn resource;\n\t\t}\n\t\tlet dirname;\n\t\tif (resource.scheme === Schemas.file) {\n\t\t\tdirname = URI.file(paths.dirname(originalFSPath(resource))).path;\n\t\t} else {\n\t\t\tdirname = paths.posix.dirname(resource.path);\n\t\t\tif (resource.authority && dirname.length && dirname.charCodeAt(0) !== CharCode.Slash) {\n\t\t\t\tconsole.error(`dirname(\"${resource.toString})) resulted in a relative path`);\n\t\t\t\tdirname = '/'; // If a URI contains an authority component, then the path component must either be empty or begin with a CharCode.Slash (\"/\") character\n\t\t\t}\n\t\t}\n\t\treturn resource.with({\n\t\t\tpath: dirname\n\t\t});\n\t}\n\n\tnormalizePath(resource: URI): URI {\n\t\tif (!resource.path.length) {\n\t\t\treturn resource;\n\t\t}\n\t\tlet normalizedPath: string;\n\t\tif (resource.scheme === Schemas.file) {\n\t\t\tnormalizedPath = URI.file(paths.normalize(originalFSPath(resource))).path;\n\t\t} else {\n\t\t\tnormalizedPath = paths.posix.normalize(resource.path);\n\t\t}\n\t\treturn resource.with({\n\t\t\tpath: normalizedPath\n\t\t});\n\t}\n\n\trelativePath(from: URI, to: URI): string | undefined {\n\t\tif (from.scheme !== to.scheme || !isEqualAuthority(from.authority, to.authority)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (from.scheme === Schemas.file) {\n\t\t\tconst relativePath = paths.relative(originalFSPath(from), originalFSPath(to));\n\t\t\treturn isWindows ? extpath.toSlashes(relativePath) : relativePath;\n\t\t}\n\t\tlet fromPath = from.path || '/';\n\t\tconst toPath = to.path || '/';\n\t\tif (this._ignorePathCasing(from)) {\n\t\t\t// make casing of fromPath match toPath\n\t\t\tlet i = 0;\n\t\t\tfor (const len = Math.min(fromPath.length, toPath.length); i < len; i++) {\n\t\t\t\tif (fromPath.charCodeAt(i) !== toPath.charCodeAt(i)) {\n\t\t\t\t\tif (fromPath.charAt(i).toLowerCase() !== toPath.charAt(i).toLowerCase()) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfromPath = toPath.substr(0, i) + fromPath.substr(i);\n\t\t}\n\t\treturn paths.posix.relative(fromPath, toPath);\n\t}\n\n\tresolvePath(base: URI, path: string): URI {\n\t\tif (base.scheme === Schemas.file) {\n\t\t\tconst newURI = URI.file(paths.resolve(originalFSPath(base), path));\n\t\t\treturn base.with({\n\t\t\t\tauthority: newURI.authority,\n\t\t\t\tpath: newURI.path\n\t\t\t});\n\t\t}\n\t\tpath = extpath.toPosixPath(path); // we allow path to be a windows path\n\t\treturn base.with({\n\t\t\tpath: paths.posix.resolve(base.path, path)\n\t\t});\n\t}\n\n\t// --- misc\n\n\tisAbsolutePath(resource: URI): boolean {\n\t\treturn !!resource.path && resource.path[0] === '/';\n\t}\n\n\tisEqualAuthority(a1: string | undefined, a2: string | undefined) {\n\t\treturn a1 === a2 || (a1 !== undefined && a2 !== undefined && equalsIgnoreCase(a1, a2));\n\t}\n\n\thasTrailingPathSeparator(resource: URI, sep: string = paths.sep): boolean {\n\t\tif (resource.scheme === Schemas.file) {\n\t\t\tconst fsp = originalFSPath(resource);\n\t\t\treturn fsp.length > extpath.getRoot(fsp).length && fsp[fsp.length - 1] === sep;\n\t\t} else {\n\t\t\tconst p = resource.path;\n\t\t\treturn (p.length > 1 && p.charCodeAt(p.length - 1) === CharCode.Slash) && !(/^[a-zA-Z]:(\\/$|\\\\$)/.test(resource.fsPath)); // ignore the slash at offset 0\n\t\t}\n\t}\n\n\tremoveTrailingPathSeparator(resource: URI, sep: string = paths.sep): URI {\n\t\t// Make sure that the path isn't a drive letter. A trailing separator there is not removable.\n\t\tif (hasTrailingPathSeparator(resource, sep)) {\n\t\t\treturn resource.with({ path: resource.path.substr(0, resource.path.length - 1) });\n\t\t}\n\t\treturn resource;\n\t}\n\n\taddTrailingPathSeparator(resource: URI, sep: string = paths.sep): URI {\n\t\tlet isRootSep: boolean = false;\n\t\tif (resource.scheme === Schemas.file) {\n\t\t\tconst fsp = originalFSPath(resource);\n\t\t\tisRootSep = ((fsp !== undefined) && (fsp.length === extpath.getRoot(fsp).length) && (fsp[fsp.length - 1] === sep));\n\t\t} else {\n\t\t\tsep = '/';\n\t\t\tconst p = resource.path;\n\t\t\tisRootSep = p.length === 1 && p.charCodeAt(p.length - 1) === CharCode.Slash;\n\t\t}\n\t\tif (!isRootSep && !hasTrailingPathSeparator(resource, sep)) {\n\t\t\treturn resource.with({ path: resource.path + '/' });\n\t\t}\n\t\treturn resource;\n\t}\n}\n\n\n/**\n * Unbiased utility that takes uris \"as they are\". This means it can be interchanged with\n * uri#toString() usages. The following is true\n * ```\n * assertEqual(aUri.toString() === bUri.toString(), exturi.isEqual(aUri, bUri))\n * ```\n */\nexport const extUri = new ExtUri(() => false);\n\n/**\n * BIASED utility that _mostly_ ignored the case of urs paths. ONLY use this util if you\n * understand what you are doing.\n *\n * This utility is INCOMPATIBLE with `uri.toString()`-usages and both CANNOT be used interchanged.\n *\n * When dealing with uris from files or documents, `extUri` (the unbiased friend)is sufficient\n * because those uris come from a \"trustworthy source\". When creating unknown uris it's always\n * better to use `IUriIdentityService` which exposes an `IExtUri`-instance which knows when path\n * casing matters.\n */\nexport const extUriBiasedIgnorePathCase = new ExtUri(uri => {\n\t// A file scheme resource is in the same platform as code, so ignore case for non linux platforms\n\t// Resource can be from another platform. Lowering the case as an hack. Should come from File system provider\n\treturn uri.scheme === Schemas.file ? !isLinux : true;\n});\n\n\n/**\n * BIASED utility that always ignores the casing of uris paths. ONLY use this util if you\n * understand what you are doing.\n *\n * This utility is INCOMPATIBLE with `uri.toString()`-usages and both CANNOT be used interchanged.\n *\n * When dealing with uris from files or documents, `extUri` (the unbiased friend)is sufficient\n * because those uris come from a \"trustworthy source\". When creating unknown uris it's always\n * better to use `IUriIdentityService` which exposes an `IExtUri`-instance which knows when path\n * casing matters.\n */\nexport const extUriIgnorePathCase = new ExtUri(_ => true);\n\nexport const isEqual = extUri.isEqual.bind(extUri);\nexport const isEqualOrParent = extUri.isEqualOrParent.bind(extUri);\nexport const getComparisonKey = extUri.getComparisonKey.bind(extUri);\nexport const basenameOrAuthority = extUri.basenameOrAuthority.bind(extUri);\nexport const basename = extUri.basename.bind(extUri);\nexport const extname = extUri.extname.bind(extUri);\nexport const dirname = extUri.dirname.bind(extUri);\nexport const joinPath = extUri.joinPath.bind(extUri);\nexport const normalizePath = extUri.normalizePath.bind(extUri);\nexport const relativePath = extUri.relativePath.bind(extUri);\nexport const resolvePath = extUri.resolvePath.bind(extUri);\nexport const isAbsolutePath = extUri.isAbsolutePath.bind(extUri);\nexport const isEqualAuthority = extUri.isEqualAuthority.bind(extUri);\nexport const hasTrailingPathSeparator = extUri.hasTrailingPathSeparator.bind(extUri);\nexport const removeTrailingPathSeparator = extUri.removeTrailingPathSeparator.bind(extUri);\nexport const addTrailingPathSeparator = extUri.addTrailingPathSeparator.bind(extUri);\n\n//#endregion\n\nexport function distinctParents<T>(items: T[], resourceAccessor: (item: T) => URI): T[] {\n\tconst distinctParents: T[] = [];\n\tfor (let i = 0; i < items.length; i++) {\n\t\tconst candidateResource = resourceAccessor(items[i]);\n\t\tif (items.some((otherItem, index) => {\n\t\t\tif (index === i) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn isEqualOrParent(candidateResource, resourceAccessor(otherItem));\n\t\t})) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdistinctParents.push(items[i]);\n\t}\n\n\treturn distinctParents;\n}\n\n/**\n * Data URI related helpers.\n */\nexport namespace DataUri {\n\n\texport const META_DATA_LABEL = 'label';\n\texport const META_DATA_DESCRIPTION = 'description';\n\texport const META_DATA_SIZE = 'size';\n\texport const META_DATA_MIME = 'mime';\n\n\texport function parseMetaData(dataUri: URI): Map<string, string> {\n\t\tconst metadata = new Map<string, string>();\n\n\t\t// Given a URI of:  data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...\n\t\t// the metadata is: size:2313;label:SomeLabel;description:SomeDescription\n\t\tconst meta = dataUri.path.substring(dataUri.path.indexOf(';') + 1, dataUri.path.lastIndexOf(';'));\n\t\tmeta.split(';').forEach(property => {\n\t\t\tconst [key, value] = property.split(':');\n\t\t\tif (key && value) {\n\t\t\t\tmetadata.set(key, value);\n\t\t\t}\n\t\t});\n\n\t\t// Given a URI of:  data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...\n\t\t// the mime is: image/png\n\t\tconst mime = dataUri.path.substring(0, dataUri.path.indexOf(';'));\n\t\tif (mime) {\n\t\t\tmetadata.set(META_DATA_MIME, mime);\n\t\t}\n\n\t\treturn metadata;\n\t}\n}\n\nexport function toLocalResource(resource: URI, authority: string | undefined, localScheme: string): URI {\n\tif (authority) {\n\t\tlet path = resource.path;\n\t\tif (path && path[0] !== paths.posix.sep) {\n\t\t\tpath = paths.posix.sep + path;\n\t\t}\n\n\t\treturn resource.with({ scheme: localScheme, authority, path });\n\t}\n\n\treturn resource.with({ scheme: localScheme });\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Can be passed into the Delayed to defer using a microtask\n * */\nexport const MicrotaskDelay = Symbol('MicrotaskDelay');\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken, CancellationTokenSource } from './cancellation.js';\nimport { BugIndicatingError, CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { Disposable, DisposableMap, DisposableStore, IDisposable, isDisposable, MutableDisposable, toDisposable } from './lifecycle.js';\nimport { extUri as defaultExtUri, IExtUri } from './resources.js';\nimport { URI } from './uri.js';\nimport { setTimeout0 } from './platform.js';\nimport { MicrotaskDelay } from './symbols.js';\nimport { Lazy } from './lazy.js';\n\nexport function isThenable<T>(obj: unknown): obj is Promise<T> {\n\treturn !!obj && typeof (obj as unknown as Promise<T>).then === 'function';\n}\n\nexport interface CancelablePromise<T> extends Promise<T> {\n\tcancel(): void;\n}\n\n/**\n * Returns a promise that can be cancelled using the provided cancellation token.\n *\n * @remarks When cancellation is requested, the promise will be rejected with a {@link CancellationError}.\n * If the promise resolves to a disposable object, it will be automatically disposed when cancellation\n * is requested.\n *\n * @param callback A function that accepts a cancellation token and returns a promise\n * @returns A promise that can be cancelled\n */\nexport function createCancelablePromise<T>(callback: (token: CancellationToken) => Promise<T>): CancelablePromise<T> {\n\tconst source = new CancellationTokenSource();\n\n\tconst thenable = callback(source.token);\n\n\tlet isCancelled = false;\n\n\tconst promise = new Promise<T>((resolve, reject) => {\n\t\tconst subscription = source.token.onCancellationRequested(() => {\n\t\t\tisCancelled = true;\n\t\t\tsubscription.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t\tPromise.resolve(thenable).then(value => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\n\t\t\tif (!isCancelled) {\n\t\t\t\tresolve(value);\n\n\t\t\t} else if (isDisposable(value)) {\n\t\t\t\t// promise has been cancelled, result is disposable and will\n\t\t\t\t// be cleaned up\n\t\t\t\tvalue.dispose();\n\t\t\t}\n\t\t}, err => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\treject(err);\n\t\t});\n\t});\n\n\treturn <CancelablePromise<T>>new class {\n\t\tcancel() {\n\t\t\tsource.cancel();\n\t\t\tsource.dispose();\n\t\t}\n\t\tthen<TResult1 = T, TResult2 = never>(resolve?: ((value: T) => TResult1 | Promise<TResult1>) | undefined | null, reject?: ((reason: unknown) => TResult2 | Promise<TResult2>) | undefined | null): Promise<TResult1 | TResult2> {\n\t\t\treturn promise.then(resolve, reject);\n\t\t}\n\t\tcatch<TResult = never>(reject?: ((reason: unknown) => TResult | Promise<TResult>) | undefined | null): Promise<T | TResult> {\n\t\t\treturn this.then(undefined, reject);\n\t\t}\n\t\tfinally(onfinally?: (() => void) | undefined | null): Promise<T> {\n\t\t\treturn promise.finally(onfinally);\n\t\t}\n\t};\n}\n\n/**\n * Returns a promise that resolves with `undefined` as soon as the passed token is cancelled.\n * @see {@link raceCancellationError}\n */\nexport function raceCancellation<T>(promise: Promise<T>, token: CancellationToken): Promise<T | undefined>;\n\n/**\n * Returns a promise that resolves with `defaultValue` as soon as the passed token is cancelled.\n * @see {@link raceCancellationError}\n */\nexport function raceCancellation<T>(promise: Promise<T>, token: CancellationToken, defaultValue: T): Promise<T>;\n\nexport function raceCancellation<T>(promise: Promise<T>, token: CancellationToken, defaultValue?: T): Promise<T | undefined> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst ref = token.onCancellationRequested(() => {\n\t\t\tref.dispose();\n\t\t\tresolve(defaultValue);\n\t\t});\n\t\tpromise.then(resolve, reject).finally(() => ref.dispose());\n\t});\n}\n\n/**\n * Returns a promise that rejects with an {@CancellationError} as soon as the passed token is cancelled.\n * @see {@link raceCancellation}\n */\nexport function raceCancellationError<T>(promise: Promise<T>, token: CancellationToken): Promise<T> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst ref = token.onCancellationRequested(() => {\n\t\t\tref.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t\tpromise.then(resolve, reject).finally(() => ref.dispose());\n\t});\n}\n\n/**\n * Wraps a cancellable promise such that it is no cancellable. Can be used to\n * avoid issues with shared promises that would normally be returned as\n * cancellable to consumers.\n */\nexport function notCancellablePromise<T>(promise: CancelablePromise<T>): Promise<T> {\n\treturn new Promise<T>((resolve, reject) => {\n\t\tpromise.then(resolve, reject);\n\t});\n}\n\n/**\n * Returns as soon as one of the promises resolves or rejects and cancels remaining promises\n */\nexport function raceCancellablePromises<T>(cancellablePromises: (CancelablePromise<T> | Promise<T>)[]): CancelablePromise<T> {\n\tlet resolvedPromiseIndex = -1;\n\tconst promises = cancellablePromises.map((promise, index) => promise.then(result => { resolvedPromiseIndex = index; return result; }));\n\tconst promise = Promise.race(promises) as CancelablePromise<T>;\n\tpromise.cancel = () => {\n\t\tcancellablePromises.forEach((cancellablePromise, index) => {\n\t\t\tif (index !== resolvedPromiseIndex && (cancellablePromise as CancelablePromise<T>).cancel) {\n\t\t\t\t(cancellablePromise as CancelablePromise<T>).cancel();\n\t\t\t}\n\t\t});\n\t};\n\tpromise.finally(() => {\n\t\tpromise.cancel();\n\t});\n\treturn promise;\n}\n\nexport function raceTimeout<T>(promise: Promise<T>, timeout: number, onTimeout?: () => void): Promise<T | undefined> {\n\tlet promiseResolve: ((value: T | undefined) => void) | undefined = undefined;\n\n\tconst timer = setTimeout(() => {\n\t\tpromiseResolve?.(undefined);\n\t\tonTimeout?.();\n\t}, timeout);\n\n\treturn Promise.race([\n\t\tpromise.finally(() => clearTimeout(timer)),\n\t\tnew Promise<T | undefined>(resolve => promiseResolve = resolve)\n\t]);\n}\n\nexport function raceFilter<T>(promises: Promise<T>[], filter: (result: T) => boolean): Promise<T | undefined> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (promises.length === 0) {\n\t\t\tresolve(undefined);\n\t\t\treturn;\n\t\t}\n\n\t\tlet resolved = false;\n\t\tlet unresolvedCount = promises.length;\n\t\tfor (const promise of promises) {\n\t\t\tpromise.then(result => {\n\t\t\t\tunresolvedCount--;\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tif (filter(result)) {\n\t\t\t\t\t\tresolved = true;\n\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t} else if (unresolvedCount === 0) {\n\t\t\t\t\t\t// Last one has to resolve the promise\n\t\t\t\t\t\tresolve(undefined);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}).catch(reject);\n\t\t}\n\t});\n}\n\nexport function asPromise<T>(callback: () => T | Thenable<T>): Promise<T> {\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst item = callback();\n\t\tif (isThenable<T>(item)) {\n\t\t\titem.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(item);\n\t\t}\n\t});\n}\n\n/**\n * Creates and returns a new promise, plus its `resolve` and `reject` callbacks.\n *\n * Replace with standardized [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) once it is supported\n */\nexport function promiseWithResolvers<T>(): { promise: Promise<T>; resolve: (value: T | PromiseLike<T>) => void; reject: (err?: any) => void } {\n\tlet resolve: (value: T | PromiseLike<T>) => void;\n\tlet reject: (reason?: any) => void;\n\tconst promise = new Promise<T>((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\treturn { promise, resolve: resolve!, reject: reject! };\n}\n\nexport interface ITask<T> {\n\t(): T;\n}\n\n/**\n * A helper to prevent accumulation of sequential async tasks.\n *\n * Imagine a mail man with the sole task of delivering letters. As soon as\n * a letter submitted for delivery, he drives to the destination, delivers it\n * and returns to his base. Imagine that during the trip, N more letters were submitted.\n * When the mail man returns, he picks those N letters and delivers them all in a\n * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.\n *\n * The throttler implements this via the queue() method, by providing it a task\n * factory. Following the example:\n *\n * \t\tconst throttler = new Throttler();\n * \t\tconst letters = [];\n *\n * \t\tfunction deliver() {\n * \t\t\tconst lettersToDeliver = letters;\n * \t\t\tletters = [];\n * \t\t\treturn makeTheTrip(lettersToDeliver);\n * \t\t}\n *\n * \t\tfunction onLetterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tthrottler.queue(deliver);\n * \t\t}\n */\nexport class Throttler implements IDisposable {\n\n\tprivate activePromise: Promise<any> | null;\n\tprivate queuedPromise: Promise<any> | null;\n\tprivate queuedPromiseFactory: ITask<Promise<any>> | null;\n\n\tprivate isDisposed = false;\n\n\tconstructor() {\n\t\tthis.activePromise = null;\n\t\tthis.queuedPromise = null;\n\t\tthis.queuedPromiseFactory = null;\n\t}\n\n\tqueue<T>(promiseFactory: ITask<Promise<T>>): Promise<T> {\n\t\tif (this.isDisposed) {\n\t\t\treturn Promise.reject(new Error('Throttler is disposed'));\n\t\t}\n\n\t\tif (this.activePromise) {\n\t\t\tthis.queuedPromiseFactory = promiseFactory;\n\n\t\t\tif (!this.queuedPromise) {\n\t\t\t\tconst onComplete = () => {\n\t\t\t\t\tthis.queuedPromise = null;\n\n\t\t\t\t\tif (this.isDisposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = this.queue(this.queuedPromiseFactory!);\n\t\t\t\t\tthis.queuedPromiseFactory = null;\n\n\t\t\t\t\treturn result;\n\t\t\t\t};\n\n\t\t\t\tthis.queuedPromise = new Promise(resolve => {\n\t\t\t\t\tthis.activePromise!.then(onComplete, onComplete).then(resolve);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tthis.queuedPromise!.then(resolve, reject);\n\t\t\t});\n\t\t}\n\n\t\tthis.activePromise = promiseFactory();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.activePromise!.then((result: T) => {\n\t\t\t\tthis.activePromise = null;\n\t\t\t\tresolve(result);\n\t\t\t}, (err: unknown) => {\n\t\t\t\tthis.activePromise = null;\n\t\t\t\treject(err);\n\t\t\t});\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis.isDisposed = true;\n\t}\n}\n\nexport class Sequencer {\n\n\tprivate current: Promise<unknown> = Promise.resolve(null);\n\n\tqueue<T>(promiseTask: ITask<Promise<T>>): Promise<T> {\n\t\treturn this.current = this.current.then(() => promiseTask(), () => promiseTask());\n\t}\n}\n\nexport class SequencerByKey<TKey> {\n\n\tprivate promiseMap = new Map<TKey, Promise<unknown>>();\n\n\tqueue<T>(key: TKey, promiseTask: ITask<Promise<T>>): Promise<T> {\n\t\tconst runningPromise = this.promiseMap.get(key) ?? Promise.resolve();\n\t\tconst newPromise = runningPromise\n\t\t\t.catch(() => { })\n\t\t\t.then(promiseTask)\n\t\t\t.finally(() => {\n\t\t\t\tif (this.promiseMap.get(key) === newPromise) {\n\t\t\t\t\tthis.promiseMap.delete(key);\n\t\t\t\t}\n\t\t\t});\n\t\tthis.promiseMap.set(key, newPromise);\n\t\treturn newPromise;\n\t}\n\n\tkeys(): IterableIterator<TKey> {\n\t\treturn this.promiseMap.keys();\n\t}\n}\n\ninterface IScheduledLater extends IDisposable {\n\tisTriggered(): boolean;\n}\n\nconst timeoutDeferred = (timeout: number, fn: () => void): IScheduledLater => {\n\tlet scheduled = true;\n\tconst handle = setTimeout(() => {\n\t\tscheduled = false;\n\t\tfn();\n\t}, timeout);\n\treturn {\n\t\tisTriggered: () => scheduled,\n\t\tdispose: () => {\n\t\t\tclearTimeout(handle);\n\t\t\tscheduled = false;\n\t\t},\n\t};\n};\n\nconst microtaskDeferred = (fn: () => void): IScheduledLater => {\n\tlet scheduled = true;\n\tqueueMicrotask(() => {\n\t\tif (scheduled) {\n\t\t\tscheduled = false;\n\t\t\tfn();\n\t\t}\n\t});\n\n\treturn {\n\t\tisTriggered: () => scheduled,\n\t\tdispose: () => { scheduled = false; },\n\t};\n};\n\n/**\n * A helper to delay (debounce) execution of a task that is being requested often.\n *\n * Following the throttler, now imagine the mail man wants to optimize the number of\n * trips proactively. The trip itself can be long, so he decides not to make the trip\n * as soon as a letter is submitted. Instead he waits a while, in case more\n * letters are submitted. After said waiting period, if no letters were submitted, he\n * decides to make the trip. Imagine that N more letters were submitted after the first\n * one, all within a short period of time between each other. Even though N+1\n * submissions occurred, only 1 delivery was made.\n *\n * The delayer offers this behavior via the trigger() method, into which both the task\n * to be executed and the waiting period (delay) must be passed in as arguments. Following\n * the example:\n *\n * \t\tconst delayer = new Delayer(WAITING_PERIOD);\n * \t\tconst letters = [];\n *\n * \t\tfunction letterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tdelayer.trigger(() => { return makeTheTrip(); });\n * \t\t}\n */\nexport class Delayer<T> implements IDisposable {\n\n\tprivate deferred: IScheduledLater | null;\n\tprivate completionPromise: Promise<any> | null;\n\tprivate doResolve: ((value?: any | Promise<any>) => void) | null;\n\tprivate doReject: ((err: unknown) => void) | null;\n\tprivate task: ITask<T | Promise<T>> | null;\n\n\tconstructor(public defaultDelay: number | typeof MicrotaskDelay) {\n\t\tthis.deferred = null;\n\t\tthis.completionPromise = null;\n\t\tthis.doResolve = null;\n\t\tthis.doReject = null;\n\t\tthis.task = null;\n\t}\n\n\ttrigger(task: ITask<T | Promise<T>>, delay = this.defaultDelay): Promise<T> {\n\t\tthis.task = task;\n\t\tthis.cancelTimeout();\n\n\t\tif (!this.completionPromise) {\n\t\t\tthis.completionPromise = new Promise((resolve, reject) => {\n\t\t\t\tthis.doResolve = resolve;\n\t\t\t\tthis.doReject = reject;\n\t\t\t}).then(() => {\n\t\t\t\tthis.completionPromise = null;\n\t\t\t\tthis.doResolve = null;\n\t\t\t\tif (this.task) {\n\t\t\t\t\tconst task = this.task;\n\t\t\t\t\tthis.task = null;\n\t\t\t\t\treturn task();\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t}\n\n\t\tconst fn = () => {\n\t\t\tthis.deferred = null;\n\t\t\tthis.doResolve?.(null);\n\t\t};\n\n\t\tthis.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);\n\n\t\treturn this.completionPromise;\n\t}\n\n\tisTriggered(): boolean {\n\t\treturn !!this.deferred?.isTriggered();\n\t}\n\n\tcancel(): void {\n\t\tthis.cancelTimeout();\n\n\t\tif (this.completionPromise) {\n\t\t\tthis.doReject?.(new CancellationError());\n\t\t\tthis.completionPromise = null;\n\t\t}\n\t}\n\n\tprivate cancelTimeout(): void {\n\t\tthis.deferred?.dispose();\n\t\tthis.deferred = null;\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t}\n}\n\n/**\n * A helper to delay execution of a task that is being requested often, while\n * preventing accumulation of consecutive executions, while the task runs.\n *\n * The mail man is clever and waits for a certain amount of time, before going\n * out to deliver letters. While the mail man is going out, more letters arrive\n * and can only be delivered once he is back. Once he is back the mail man will\n * do one more trip to deliver the letters that have accumulated while he was out.\n */\nexport class ThrottledDelayer<T> {\n\n\tprivate delayer: Delayer<Promise<T>>;\n\tprivate throttler: Throttler;\n\n\tconstructor(defaultDelay: number) {\n\t\tthis.delayer = new Delayer(defaultDelay);\n\t\tthis.throttler = new Throttler();\n\t}\n\n\ttrigger(promiseFactory: ITask<Promise<T>>, delay?: number): Promise<T> {\n\t\treturn this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay) as unknown as Promise<T>;\n\t}\n\n\tisTriggered(): boolean {\n\t\treturn this.delayer.isTriggered();\n\t}\n\n\tcancel(): void {\n\t\tthis.delayer.cancel();\n\t}\n\n\tdispose(): void {\n\t\tthis.delayer.dispose();\n\t\tthis.throttler.dispose();\n\t}\n}\n\n/**\n * A barrier that is initially closed and then becomes opened permanently.\n */\nexport class Barrier {\n\tprivate _isOpen: boolean;\n\tprivate _promise: Promise<boolean>;\n\tprivate _completePromise!: (v: boolean) => void;\n\n\tconstructor() {\n\t\tthis._isOpen = false;\n\t\tthis._promise = new Promise<boolean>((c, e) => {\n\t\t\tthis._completePromise = c;\n\t\t});\n\t}\n\n\tisOpen(): boolean {\n\t\treturn this._isOpen;\n\t}\n\n\topen(): void {\n\t\tthis._isOpen = true;\n\t\tthis._completePromise(true);\n\t}\n\n\twait(): Promise<boolean> {\n\t\treturn this._promise;\n\t}\n}\n\n/**\n * A barrier that is initially closed and then becomes opened permanently after a certain period of\n * time or when open is called explicitly\n */\nexport class AutoOpenBarrier extends Barrier {\n\n\tprivate readonly _timeout: Timeout;\n\n\tconstructor(autoOpenTimeMs: number) {\n\t\tsuper();\n\t\tthis._timeout = setTimeout(() => this.open(), autoOpenTimeMs);\n\t}\n\n\toverride open(): void {\n\t\tclearTimeout(this._timeout);\n\t\tsuper.open();\n\t}\n}\n\nexport function timeout(millis: number): CancelablePromise<void>;\nexport function timeout(millis: number, token: CancellationToken): Promise<void>;\nexport function timeout(millis: number, token?: CancellationToken): CancelablePromise<void> | Promise<void> {\n\tif (!token) {\n\t\treturn createCancelablePromise(token => timeout(millis, token));\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst handle = setTimeout(() => {\n\t\t\tdisposable.dispose();\n\t\t\tresolve();\n\t\t}, millis);\n\t\tconst disposable = token.onCancellationRequested(() => {\n\t\t\tclearTimeout(handle);\n\t\t\tdisposable.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t});\n}\n\n/**\n * Creates a timeout that can be disposed using its returned value.\n * @param handler The timeout handler.\n * @param timeout An optional timeout in milliseconds.\n * @param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically.\n *\n * @example\n * const store = new DisposableStore;\n * // Call the timeout after 1000ms at which point it will be automatically\n * // evicted from the store.\n * const timeoutDisposable = disposableTimeout(() => {}, 1000, store);\n *\n * if (foo) {\n *   // Cancel the timeout and evict it from store.\n *   timeoutDisposable.dispose();\n * }\n */\nexport function disposableTimeout(handler: () => void, timeout = 0, store?: DisposableStore): IDisposable {\n\tconst timer = setTimeout(() => {\n\t\thandler();\n\t\tif (store) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t}, timeout);\n\tconst disposable = toDisposable(() => {\n\t\tclearTimeout(timer);\n\t\tstore?.delete(disposable);\n\t});\n\tstore?.add(disposable);\n\treturn disposable;\n}\n\n/**\n * Runs the provided list of promise factories in sequential order. The returned\n * promise will complete to an array of results from each promise.\n */\n\nexport function sequence<T>(promiseFactories: ITask<Promise<T>>[]): Promise<T[]> {\n\tconst results: T[] = [];\n\tlet index = 0;\n\tconst len = promiseFactories.length;\n\n\tfunction next(): Promise<T> | null {\n\t\treturn index < len ? promiseFactories[index++]() : null;\n\t}\n\n\tfunction thenHandler(result: unknown): Promise<any> {\n\t\tif (result !== undefined && result !== null) {\n\t\t\tresults.push(result as T);\n\t\t}\n\n\t\tconst n = next();\n\t\tif (n) {\n\t\t\treturn n.then(thenHandler);\n\t\t}\n\n\t\treturn Promise.resolve(results);\n\t}\n\n\treturn Promise.resolve(null).then(thenHandler);\n}\n\nexport function first<T>(promiseFactories: ITask<Promise<T>>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null): Promise<T | null> {\n\tlet index = 0;\n\tconst len = promiseFactories.length;\n\n\tconst loop: () => Promise<T | null> = () => {\n\t\tif (index >= len) {\n\t\t\treturn Promise.resolve(defaultValue);\n\t\t}\n\n\t\tconst factory = promiseFactories[index++];\n\t\tconst promise = Promise.resolve(factory());\n\n\t\treturn promise.then(result => {\n\t\t\tif (shouldStop(result)) {\n\t\t\t\treturn Promise.resolve(result);\n\t\t\t}\n\n\t\t\treturn loop();\n\t\t});\n\t};\n\n\treturn loop();\n}\n\n/**\n * Returns the result of the first promise that matches the \"shouldStop\",\n * running all promises in parallel. Supports cancelable promises.\n */\nexport function firstParallel<T>(promiseList: Promise<T>[], shouldStop?: (t: T) => boolean, defaultValue?: T | null): Promise<T | null>;\nexport function firstParallel<T, R extends T>(promiseList: Promise<T>[], shouldStop: (t: T) => t is R, defaultValue?: R | null): Promise<R | null>;\nexport function firstParallel<T>(promiseList: Promise<T>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null) {\n\tif (promiseList.length === 0) {\n\t\treturn Promise.resolve(defaultValue);\n\t}\n\n\tlet todo = promiseList.length;\n\tconst finish = () => {\n\t\ttodo = -1;\n\t\tfor (const promise of promiseList) {\n\t\t\t(promise as Partial<CancelablePromise<T>>).cancel?.();\n\t\t}\n\t};\n\n\treturn new Promise<T | null>((resolve, reject) => {\n\t\tfor (const promise of promiseList) {\n\t\t\tpromise.then(result => {\n\t\t\t\tif (--todo >= 0 && shouldStop(result)) {\n\t\t\t\t\tfinish();\n\t\t\t\t\tresolve(result);\n\t\t\t\t} else if (todo === 0) {\n\t\t\t\t\tresolve(defaultValue);\n\t\t\t\t}\n\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\tif (--todo >= 0) {\n\t\t\t\t\t\tfinish();\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\t});\n}\n\ninterface ILimitedTaskFactory<T> {\n\tfactory: ITask<Promise<T>>;\n\tc: (value: T | Promise<T>) => void;\n\te: (error?: unknown) => void;\n}\n\nexport interface ILimiter<T> {\n\n\treadonly size: number;\n\n\tqueue(factory: ITask<Promise<T>>): Promise<T>;\n\n\tclear(): void;\n}\n\n/**\n * A helper to queue N promises and run them all with a max degree of parallelism. The helper\n * ensures that at any time no more than M promises are running at the same time.\n */\nexport class Limiter<T> implements ILimiter<T> {\n\n\tprivate _size = 0;\n\tprivate _isDisposed = false;\n\tprivate runningPromises: number;\n\tprivate readonly maxDegreeOfParalellism: number;\n\tprivate readonly outstandingPromises: ILimitedTaskFactory<T>[];\n\tprivate readonly _onDrained: Emitter<void>;\n\n\tconstructor(maxDegreeOfParalellism: number) {\n\t\tthis.maxDegreeOfParalellism = maxDegreeOfParalellism;\n\t\tthis.outstandingPromises = [];\n\t\tthis.runningPromises = 0;\n\t\tthis._onDrained = new Emitter<void>();\n\t}\n\n\t/**\n\t *\n\t * @returns A promise that resolved when all work is done (onDrained) or when\n\t * there is nothing to do\n\t */\n\twhenIdle(): Promise<void> {\n\t\treturn this.size > 0\n\t\t\t? Event.toPromise(this.onDrained)\n\t\t\t: Promise.resolve();\n\t}\n\n\tget onDrained(): Event<void> {\n\t\treturn this._onDrained.event;\n\t}\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tqueue(factory: ITask<Promise<T>>): Promise<T> {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('Object has been disposed');\n\t\t}\n\t\tthis._size++;\n\n\t\treturn new Promise<T>((c, e) => {\n\t\t\tthis.outstandingPromises.push({ factory, c, e });\n\t\t\tthis.consume();\n\t\t});\n\t}\n\n\tprivate consume(): void {\n\t\twhile (this.outstandingPromises.length && this.runningPromises < this.maxDegreeOfParalellism) {\n\t\t\tconst iLimitedTask = this.outstandingPromises.shift()!;\n\t\t\tthis.runningPromises++;\n\n\t\t\tconst promise = iLimitedTask.factory();\n\t\t\tpromise.then(iLimitedTask.c, iLimitedTask.e);\n\t\t\tpromise.then(() => this.consumed(), () => this.consumed());\n\t\t}\n\t}\n\n\tprivate consumed(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.runningPromises--;\n\t\tif (--this._size === 0) {\n\t\t\tthis._onDrained.fire();\n\t\t}\n\n\t\tif (this.outstandingPromises.length > 0) {\n\t\t\tthis.consume();\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('Object has been disposed');\n\t\t}\n\t\tthis.outstandingPromises.length = 0;\n\t\tthis._size = this.runningPromises;\n\t}\n\n\tdispose(): void {\n\t\tthis._isDisposed = true;\n\t\tthis.outstandingPromises.length = 0; // stop further processing\n\t\tthis._size = 0;\n\t\tthis._onDrained.dispose();\n\t}\n}\n\n/**\n * A queue is handles one promise at a time and guarantees that at any time only one promise is executing.\n */\nexport class Queue<T> extends Limiter<T> {\n\n\tconstructor() {\n\t\tsuper(1);\n\t}\n}\n\n/**\n * Same as `Queue`, ensures that only 1 task is executed at the same time. The difference to `Queue` is that\n * there is only 1 task about to be scheduled next. As such, calling `queue` while a task is executing will\n * replace the currently queued task until it executes.\n *\n * As such, the returned promise may not be from the factory that is passed in but from the next factory that\n * is running after having called `queue`.\n */\nexport class LimitedQueue {\n\n\tprivate readonly sequentializer = new TaskSequentializer();\n\n\tprivate tasks = 0;\n\n\tqueue(factory: ITask<Promise<void>>): Promise<void> {\n\t\tif (!this.sequentializer.isRunning()) {\n\t\t\treturn this.sequentializer.run(this.tasks++, factory());\n\t\t}\n\n\t\treturn this.sequentializer.queue(() => {\n\t\t\treturn this.sequentializer.run(this.tasks++, factory());\n\t\t});\n\t}\n}\n\n/**\n * A helper to organize queues per resource. The ResourceQueue makes sure to manage queues per resource\n * by disposing them once the queue is empty.\n */\nexport class ResourceQueue implements IDisposable {\n\n\tprivate readonly queues = new Map<string, Queue<void>>();\n\n\tprivate readonly drainers = new Set<DeferredPromise<void>>();\n\n\tprivate drainListeners: DisposableMap<number> | undefined = undefined;\n\tprivate drainListenerCount = 0;\n\n\tasync whenDrained(): Promise<void> {\n\t\tif (this.isDrained()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst promise = new DeferredPromise<void>();\n\t\tthis.drainers.add(promise);\n\n\t\treturn promise.p;\n\t}\n\n\tprivate isDrained(): boolean {\n\t\tfor (const [, queue] of this.queues) {\n\t\t\tif (queue.size > 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tqueueSize(resource: URI, extUri: IExtUri = defaultExtUri): number {\n\t\tconst key = extUri.getComparisonKey(resource);\n\n\t\treturn this.queues.get(key)?.size ?? 0;\n\t}\n\n\tqueueFor(resource: URI, factory: ITask<Promise<void>>, extUri: IExtUri = defaultExtUri): Promise<void> {\n\t\tconst key = extUri.getComparisonKey(resource);\n\n\t\tlet queue = this.queues.get(key);\n\t\tif (!queue) {\n\t\t\tqueue = new Queue<void>();\n\t\t\tconst drainListenerId = this.drainListenerCount++;\n\t\t\tconst drainListener = Event.once(queue.onDrained)(() => {\n\t\t\t\tqueue?.dispose();\n\t\t\t\tthis.queues.delete(key);\n\t\t\t\tthis.onDidQueueDrain();\n\n\t\t\t\tthis.drainListeners?.deleteAndDispose(drainListenerId);\n\n\t\t\t\tif (this.drainListeners?.size === 0) {\n\t\t\t\t\tthis.drainListeners.dispose();\n\t\t\t\t\tthis.drainListeners = undefined;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (!this.drainListeners) {\n\t\t\t\tthis.drainListeners = new DisposableMap();\n\t\t\t}\n\t\t\tthis.drainListeners.set(drainListenerId, drainListener);\n\n\t\t\tthis.queues.set(key, queue);\n\t\t}\n\n\t\treturn queue.queue(factory);\n\t}\n\n\tprivate onDidQueueDrain(): void {\n\t\tif (!this.isDrained()) {\n\t\t\treturn; // not done yet\n\t\t}\n\n\t\tthis.releaseDrainers();\n\t}\n\n\tprivate releaseDrainers(): void {\n\t\tfor (const drainer of this.drainers) {\n\t\t\tdrainer.complete();\n\t\t}\n\n\t\tthis.drainers.clear();\n\t}\n\n\tdispose(): void {\n\t\tfor (const [, queue] of this.queues) {\n\t\t\tqueue.dispose();\n\t\t}\n\n\t\tthis.queues.clear();\n\n\t\t// Even though we might still have pending\n\t\t// tasks queued, after the queues have been\n\t\t// disposed, we can no longer track them, so\n\t\t// we release drainers to prevent hanging\n\t\t// promises when the resource queue is being\n\t\t// disposed.\n\t\tthis.releaseDrainers();\n\n\t\tthis.drainListeners?.dispose();\n\t}\n}\n\nexport type Task<T = void> = () => (Promise<T> | T);\n\n/**\n * Processes tasks in the order they were scheduled.\n*/\nexport class TaskQueue {\n\tprivate _runningTask: Task<any> | undefined = undefined;\n\tprivate _pendingTasks: { task: Task<any>; deferred: DeferredPromise<any>; setUndefinedWhenCleared: boolean }[] = [];\n\n\t/**\n\t * Waits for the current and pending tasks to finish, then runs and awaits the given task.\n\t * If the task is skipped because of clearPending, the promise is rejected with a CancellationError.\n\t*/\n\tpublic schedule<T>(task: Task<T>): Promise<T> {\n\t\tconst deferred = new DeferredPromise<T>();\n\t\tthis._pendingTasks.push({ task, deferred, setUndefinedWhenCleared: false });\n\t\tthis._runIfNotRunning();\n\t\treturn deferred.p;\n\t}\n\n\t/**\n\t * Waits for the current and pending tasks to finish, then runs and awaits the given task.\n\t * If the task is skipped because of clearPending, the promise is resolved with undefined.\n\t*/\n\tpublic scheduleSkipIfCleared<T>(task: Task<T>): Promise<T | undefined> {\n\t\tconst deferred = new DeferredPromise<T>();\n\t\tthis._pendingTasks.push({ task, deferred, setUndefinedWhenCleared: true });\n\t\tthis._runIfNotRunning();\n\t\treturn deferred.p;\n\t}\n\n\tprivate _runIfNotRunning(): void {\n\t\tif (this._runningTask === undefined) {\n\t\t\tthis._processQueue();\n\t\t}\n\t}\n\n\tprivate async _processQueue(): Promise<void> {\n\t\tif (this._pendingTasks.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst next = this._pendingTasks.shift();\n\t\tif (!next) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._runningTask) {\n\t\t\tthrow new BugIndicatingError();\n\t\t}\n\n\t\tthis._runningTask = next.task;\n\n\t\ttry {\n\t\t\tconst result = await next.task();\n\t\t\tnext.deferred.complete(result);\n\t\t} catch (e) {\n\t\t\tnext.deferred.error(e);\n\t\t} finally {\n\t\t\tthis._runningTask = undefined;\n\t\t\tthis._processQueue();\n\t\t}\n\t}\n\n\t/**\n\t * Clears all pending tasks. Does not cancel the currently running task.\n\t*/\n\tpublic clearPending(): void {\n\t\tconst tasks = this._pendingTasks;\n\t\tthis._pendingTasks = [];\n\t\tfor (const task of tasks) {\n\t\t\tif (task.setUndefinedWhenCleared) {\n\t\t\t\ttask.deferred.complete(undefined);\n\t\t\t} else {\n\t\t\t\ttask.deferred.error(new CancellationError());\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class TimeoutTimer implements IDisposable {\n\tprivate _token: Timeout | undefined;\n\tprivate _isDisposed = false;\n\n\tconstructor();\n\tconstructor(runner: () => void, timeout: number);\n\tconstructor(runner?: () => void, timeout?: number) {\n\t\tthis._token = undefined;\n\n\t\tif (typeof runner === 'function' && typeof timeout === 'number') {\n\t\t\tthis.setIfNotSet(runner, timeout);\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis._isDisposed = true;\n\t}\n\n\tcancel(): void {\n\t\tif (this._token !== undefined) {\n\t\t\tclearTimeout(this._token);\n\t\t\tthis._token = undefined;\n\t\t}\n\t}\n\n\tcancelAndSet(runner: () => void, timeout: number): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);\n\t\t}\n\n\t\tthis.cancel();\n\t\tthis._token = setTimeout(() => {\n\t\t\tthis._token = undefined;\n\t\t\trunner();\n\t\t}, timeout);\n\t}\n\n\tsetIfNotSet(runner: () => void, timeout: number): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);\n\t\t}\n\n\t\tif (this._token !== undefined) {\n\t\t\t// timer is already set\n\t\t\treturn;\n\t\t}\n\t\tthis._token = setTimeout(() => {\n\t\t\tthis._token = undefined;\n\t\t\trunner();\n\t\t}, timeout);\n\t}\n}\n\nexport class IntervalTimer implements IDisposable {\n\n\tprivate disposable: IDisposable | undefined = undefined;\n\tprivate isDisposed = false;\n\n\tcancel(): void {\n\t\tthis.disposable?.dispose();\n\t\tthis.disposable = undefined;\n\t}\n\n\tcancelAndSet(runner: () => void, interval: number, context = globalThis): void {\n\t\tif (this.isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'cancelAndSet' on a disposed IntervalTimer`);\n\t\t}\n\n\t\tthis.cancel();\n\t\tconst handle = context.setInterval(() => {\n\t\t\trunner();\n\t\t}, interval);\n\n\t\tthis.disposable = toDisposable(() => {\n\t\t\tcontext.clearInterval(handle);\n\t\t\tthis.disposable = undefined;\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.isDisposed = true;\n\t}\n}\n\nexport class RunOnceScheduler implements IDisposable {\n\n\tprotected runner: ((...args: unknown[]) => void) | null;\n\n\tprivate timeoutToken: Timeout | undefined;\n\tprivate timeout: number;\n\tprivate timeoutHandler: () => void;\n\n\tconstructor(runner: (...args: any[]) => void, delay: number) {\n\t\tthis.timeoutToken = undefined;\n\t\tthis.runner = runner;\n\t\tthis.timeout = delay;\n\t\tthis.timeoutHandler = this.onTimeout.bind(this);\n\t}\n\n\t/**\n\t * Dispose RunOnceScheduler\n\t */\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.runner = null;\n\t}\n\n\t/**\n\t * Cancel current scheduled runner (if any).\n\t */\n\tcancel(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tclearTimeout(this.timeoutToken);\n\t\t\tthis.timeoutToken = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Cancel previous runner (if any) & schedule a new runner.\n\t */\n\tschedule(delay = this.timeout): void {\n\t\tthis.cancel();\n\t\tthis.timeoutToken = setTimeout(this.timeoutHandler, delay);\n\t}\n\n\tget delay(): number {\n\t\treturn this.timeout;\n\t}\n\n\tset delay(value: number) {\n\t\tthis.timeout = value;\n\t}\n\n\t/**\n\t * Returns true if scheduled.\n\t */\n\tisScheduled(): boolean {\n\t\treturn this.timeoutToken !== undefined;\n\t}\n\n\tflush(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tthis.cancel();\n\t\t\tthis.doRun();\n\t\t}\n\t}\n\n\tprivate onTimeout() {\n\t\tthis.timeoutToken = undefined;\n\t\tif (this.runner) {\n\t\t\tthis.doRun();\n\t\t}\n\t}\n\n\tprotected doRun(): void {\n\t\tthis.runner?.();\n\t}\n}\n\n/**\n * Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.\n * > **NOTE**: Only offers 1s resolution.\n *\n * When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep\n * for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But\n * this scheduler will execute 3hrs **after waking the computer from sleep**.\n */\nexport class ProcessTimeRunOnceScheduler {\n\n\tprivate runner: (() => void) | null;\n\tprivate timeout: number;\n\n\tprivate counter: number;\n\tprivate intervalToken: Timeout | undefined;\n\tprivate intervalHandler: () => void;\n\n\tconstructor(runner: () => void, delay: number) {\n\t\tif (delay % 1000 !== 0) {\n\t\t\tconsole.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n\t\t}\n\t\tthis.runner = runner;\n\t\tthis.timeout = delay;\n\t\tthis.counter = 0;\n\t\tthis.intervalToken = undefined;\n\t\tthis.intervalHandler = this.onInterval.bind(this);\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.runner = null;\n\t}\n\n\tcancel(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tclearInterval(this.intervalToken);\n\t\t\tthis.intervalToken = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Cancel previous runner (if any) & schedule a new runner.\n\t */\n\tschedule(delay = this.timeout): void {\n\t\tif (delay % 1000 !== 0) {\n\t\t\tconsole.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n\t\t}\n\t\tthis.cancel();\n\t\tthis.counter = Math.ceil(delay / 1000);\n\t\tthis.intervalToken = setInterval(this.intervalHandler, 1000);\n\t}\n\n\t/**\n\t * Returns true if scheduled.\n\t */\n\tisScheduled(): boolean {\n\t\treturn this.intervalToken !== undefined;\n\t}\n\n\tprivate onInterval() {\n\t\tthis.counter--;\n\t\tif (this.counter > 0) {\n\t\t\t// still need to wait\n\t\t\treturn;\n\t\t}\n\n\t\t// time elapsed\n\t\tclearInterval(this.intervalToken);\n\t\tthis.intervalToken = undefined;\n\t\tthis.runner?.();\n\t}\n}\n\nexport class RunOnceWorker<T> extends RunOnceScheduler {\n\n\tprivate units: T[] = [];\n\n\tconstructor(runner: (units: T[]) => void, timeout: number) {\n\t\tsuper(runner, timeout);\n\t}\n\n\twork(unit: T): void {\n\t\tthis.units.push(unit);\n\n\t\tif (!this.isScheduled()) {\n\t\t\tthis.schedule();\n\t\t}\n\t}\n\n\tprotected override doRun(): void {\n\t\tconst units = this.units;\n\t\tthis.units = [];\n\n\t\tthis.runner?.(units);\n\t}\n\n\toverride dispose(): void {\n\t\tthis.units = [];\n\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IThrottledWorkerOptions {\n\n\t/**\n\t * maximum of units the worker will pass onto handler at once\n\t */\n\tmaxWorkChunkSize: number;\n\n\t/**\n\t * maximum of units the worker will keep in memory for processing\n\t */\n\tmaxBufferedWork: number | undefined;\n\n\t/**\n\t * delay before processing the next round of chunks when chunk size exceeds limits\n\t */\n\tthrottleDelay: number;\n\n\t/**\n\t * When enabled will guarantee that two distinct calls to `work()` are not executed\n\t * without throttle delay between them.\n\t * Otherwise if the worker isn't currently throttling it will execute work immediately.\n\t */\n\twaitThrottleDelayBetweenWorkUnits?: boolean;\n}\n\n/**\n * The `ThrottledWorker` will accept units of work `T`\n * to handle. The contract is:\n * * there is a maximum of units the worker can handle at once (via `maxWorkChunkSize`)\n * * there is a maximum of units the worker will keep in memory for processing (via `maxBufferedWork`)\n * * after having handled `maxWorkChunkSize` units, the worker needs to rest (via `throttleDelay`)\n */\nexport class ThrottledWorker<T> extends Disposable {\n\n\tprivate readonly pendingWork: T[] = [];\n\n\tprivate readonly throttler = this._register(new MutableDisposable<RunOnceScheduler>());\n\tprivate disposed = false;\n\tprivate lastExecutionTime = 0;\n\n\tconstructor(\n\t\tprivate options: IThrottledWorkerOptions,\n\t\tprivate readonly handler: (units: T[]) => void\n\t) {\n\t\tsuper();\n\t}\n\n\t/**\n\t * The number of work units that are pending to be processed.\n\t */\n\tget pending(): number { return this.pendingWork.length; }\n\n\t/**\n\t * Add units to be worked on. Use `pending` to figure out\n\t * how many units are not yet processed after this method\n\t * was called.\n\t *\n\t * @returns whether the work was accepted or not. If the\n\t * worker is disposed, it will not accept any more work.\n\t * If the number of pending units would become larger\n\t * than `maxPendingWork`, more work will also not be accepted.\n\t */\n\twork(units: readonly T[]): boolean {\n\t\tif (this.disposed) {\n\t\t\treturn false; // work not accepted: disposed\n\t\t}\n\n\t\t// Check for reaching maximum of pending work\n\t\tif (typeof this.options.maxBufferedWork === 'number') {\n\n\t\t\t// Throttled: simple check if pending + units exceeds max pending\n\t\t\tif (this.throttler.value) {\n\t\t\t\tif (this.pending + units.length > this.options.maxBufferedWork) {\n\t\t\t\t\treturn false; // work not accepted: too much pending work\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Unthrottled: same as throttled, but account for max chunk getting\n\t\t\t// worked on directly without being pending\n\t\t\telse {\n\t\t\t\tif (this.pending + units.length - this.options.maxWorkChunkSize > this.options.maxBufferedWork) {\n\t\t\t\t\treturn false; // work not accepted: too much pending work\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add to pending units first\n\t\tfor (const unit of units) {\n\t\t\tthis.pendingWork.push(unit);\n\t\t}\n\n\t\tconst timeSinceLastExecution = Date.now() - this.lastExecutionTime;\n\n\t\tif (!this.throttler.value && (!this.options.waitThrottleDelayBetweenWorkUnits || timeSinceLastExecution >= this.options.throttleDelay)) {\n\t\t\t// Work directly if we are not throttling and we are not\n\t\t\t// enforced to throttle between `work()` calls.\n\t\t\tthis.doWork();\n\t\t} else if (!this.throttler.value && this.options.waitThrottleDelayBetweenWorkUnits) {\n\t\t\t// Otherwise, schedule the throttler to work.\n\t\t\tthis.scheduleThrottler(Math.max(this.options.throttleDelay - timeSinceLastExecution, 0));\n\t\t} else {\n\t\t\t// Otherwise, our work will be picked up by the running throttler\n\t\t}\n\n\t\treturn true; // work accepted\n\t}\n\n\tprivate doWork(): void {\n\t\tthis.lastExecutionTime = Date.now();\n\n\t\t// Extract chunk to handle and handle it\n\t\tthis.handler(this.pendingWork.splice(0, this.options.maxWorkChunkSize));\n\n\t\t// If we have remaining work, schedule it after a delay\n\t\tif (this.pendingWork.length > 0) {\n\t\t\tthis.scheduleThrottler();\n\t\t}\n\t}\n\n\tprivate scheduleThrottler(delay = this.options.throttleDelay): void {\n\t\tthis.throttler.value = new RunOnceScheduler(() => {\n\t\t\tthis.throttler.clear();\n\n\t\t\tthis.doWork();\n\t\t}, delay);\n\t\tthis.throttler.value.schedule();\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\n\t\tthis.pendingWork.length = 0;\n\t\tthis.disposed = true;\n\t}\n}\n\n//#region -- run on idle tricks ------------\n\nexport interface IdleDeadline {\n\treadonly didTimeout: boolean;\n\ttimeRemaining(): number;\n}\n\ntype IdleApi = Pick<typeof globalThis, 'requestIdleCallback' | 'cancelIdleCallback'>;\n\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n *\n * **Note** that there is `dom.ts#runWhenWindowIdle` which is better suited when running inside a browser\n * context\n */\nexport let runWhenGlobalIdle: (callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;\n\nexport let _runWhenIdle: (targetWindow: IdleApi, callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;\n\n(function () {\n\tconst safeGlobal: any = globalThis;\n\tif (typeof safeGlobal.requestIdleCallback !== 'function' || typeof safeGlobal.cancelIdleCallback !== 'function') {\n\t\t_runWhenIdle = (_targetWindow, runner, timeout?) => {\n\t\t\tsetTimeout0(() => {\n\t\t\t\tif (disposed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst end = Date.now() + 15; // one frame at 64fps\n\t\t\t\tconst deadline: IdleDeadline = {\n\t\t\t\t\tdidTimeout: true,\n\t\t\t\t\ttimeRemaining() {\n\t\t\t\t\t\treturn Math.max(0, end - Date.now());\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\trunner(Object.freeze(deadline));\n\t\t\t});\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdisposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t} else {\n\t\t_runWhenIdle = (targetWindow: typeof safeGlobal, runner, timeout?) => {\n\t\t\tconst handle: number = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdisposed = true;\n\t\t\t\t\ttargetWindow.cancelIdleCallback(handle);\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t}\n\trunWhenGlobalIdle = (runner, timeout) => _runWhenIdle(globalThis, runner, timeout);\n})();\n\nexport abstract class AbstractIdleValue<T> {\n\n\tprivate readonly _executor: () => void;\n\tprivate readonly _handle: IDisposable;\n\n\tprivate _didRun: boolean = false;\n\tprivate _value?: T;\n\tprivate _error: unknown;\n\n\tconstructor(targetWindow: IdleApi, executor: () => T) {\n\t\tthis._executor = () => {\n\t\t\ttry {\n\t\t\t\tthis._value = executor();\n\t\t\t} catch (err) {\n\t\t\t\tthis._error = err;\n\t\t\t} finally {\n\t\t\t\tthis._didRun = true;\n\t\t\t}\n\t\t};\n\t\tthis._handle = _runWhenIdle(targetWindow, () => this._executor());\n\t}\n\n\tdispose(): void {\n\t\tthis._handle.dispose();\n\t}\n\n\tget value(): T {\n\t\tif (!this._didRun) {\n\t\t\tthis._handle.dispose();\n\t\t\tthis._executor();\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n\n\tget isInitialized(): boolean {\n\t\treturn this._didRun;\n\t}\n}\n\n/**\n * An `IdleValue` that always uses the current window (which might be throttled or inactive)\n *\n * **Note** that there is `dom.ts#WindowIdleValue` which is better suited when running inside a browser\n * context\n */\nexport class GlobalIdleValue<T> extends AbstractIdleValue<T> {\n\n\tconstructor(executor: () => T) {\n\t\tsuper(globalThis, executor);\n\t}\n}\n\n//#endregion\n\nexport async function retry<T>(task: ITask<Promise<T>>, delay: number, retries: number): Promise<T> {\n\tlet lastError: Error | undefined;\n\n\tfor (let i = 0; i < retries; i++) {\n\t\ttry {\n\t\t\treturn await task();\n\t\t} catch (error) {\n\t\t\tlastError = error;\n\n\t\t\tawait timeout(delay);\n\t\t}\n\t}\n\n\tthrow lastError;\n}\n\n//#region Task Sequentializer\n\ninterface IRunningTask {\n\treadonly taskId: number;\n\treadonly cancel: () => void;\n\treadonly promise: Promise<void>;\n}\n\ninterface IQueuedTask {\n\treadonly promise: Promise<void>;\n\treadonly promiseResolve: () => void;\n\treadonly promiseReject: (error: Error) => void;\n\trun: ITask<Promise<void>>;\n}\n\nexport interface ITaskSequentializerWithRunningTask {\n\treadonly running: Promise<void>;\n}\n\nexport interface ITaskSequentializerWithQueuedTask {\n\treadonly queued: IQueuedTask;\n}\n\n/**\n * @deprecated use `LimitedQueue` instead for an easier to use API\n */\nexport class TaskSequentializer {\n\n\tprivate _running?: IRunningTask;\n\tprivate _queued?: IQueuedTask;\n\n\tisRunning(taskId?: number): this is ITaskSequentializerWithRunningTask {\n\t\tif (typeof taskId === 'number') {\n\t\t\treturn this._running?.taskId === taskId;\n\t\t}\n\n\t\treturn !!this._running;\n\t}\n\n\tget running(): Promise<void> | undefined {\n\t\treturn this._running?.promise;\n\t}\n\n\tcancelRunning(): void {\n\t\tthis._running?.cancel();\n\t}\n\n\trun(taskId: number, promise: Promise<void>, onCancel?: () => void,): Promise<void> {\n\t\tthis._running = { taskId, cancel: () => onCancel?.(), promise };\n\n\t\tpromise.then(() => this.doneRunning(taskId), () => this.doneRunning(taskId));\n\n\t\treturn promise;\n\t}\n\n\tprivate doneRunning(taskId: number): void {\n\t\tif (this._running && taskId === this._running.taskId) {\n\n\t\t\t// only set running to done if the promise finished that is associated with that taskId\n\t\t\tthis._running = undefined;\n\n\t\t\t// schedule the queued task now that we are free if we have any\n\t\t\tthis.runQueued();\n\t\t}\n\t}\n\n\tprivate runQueued(): void {\n\t\tif (this._queued) {\n\t\t\tconst queued = this._queued;\n\t\t\tthis._queued = undefined;\n\n\t\t\t// Run queued task and complete on the associated promise\n\t\t\tqueued.run().then(queued.promiseResolve, queued.promiseReject);\n\t\t}\n\t}\n\n\t/**\n\t * Note: the promise to schedule as next run MUST itself call `run`.\n\t *       Otherwise, this sequentializer will report `false` for `isRunning`\n\t *       even when this task is running. Missing this detail means that\n\t *       suddenly multiple tasks will run in parallel.\n\t */\n\tqueue(run: ITask<Promise<void>>): Promise<void> {\n\n\t\t// this is our first queued task, so we create associated promise with it\n\t\t// so that we can return a promise that completes when the task has\n\t\t// completed.\n\t\tif (!this._queued) {\n\t\t\tconst { promise, resolve: promiseResolve, reject: promiseReject } = promiseWithResolvers<void>();\n\t\t\tthis._queued = {\n\t\t\t\trun,\n\t\t\t\tpromise,\n\t\t\t\tpromiseResolve: promiseResolve!,\n\t\t\t\tpromiseReject: promiseReject!\n\t\t\t};\n\t\t}\n\n\t\t// we have a previous queued task, just overwrite it\n\t\telse {\n\t\t\tthis._queued.run = run;\n\t\t}\n\n\t\treturn this._queued.promise;\n\t}\n\n\thasQueued(): this is ITaskSequentializerWithQueuedTask {\n\t\treturn !!this._queued;\n\t}\n\n\tasync join(): Promise<void> {\n\t\treturn this._queued?.promise ?? this._running?.promise;\n\t}\n}\n\n//#endregion\n\n//#region\n\n/**\n * The `IntervalCounter` allows to count the number\n * of calls to `increment()` over a duration of\n * `interval`. This utility can be used to conditionally\n * throttle a frequent task when a certain threshold\n * is reached.\n */\nexport class IntervalCounter {\n\n\tprivate lastIncrementTime = 0;\n\n\tprivate value = 0;\n\n\tconstructor(private readonly interval: number, private readonly nowFn = () => Date.now()) { }\n\n\tincrement(): number {\n\t\tconst now = this.nowFn();\n\n\t\t// We are outside of the range of `interval` and as such\n\t\t// start counting from 0 and remember the time\n\t\tif (now - this.lastIncrementTime > this.interval) {\n\t\t\tthis.lastIncrementTime = now;\n\t\t\tthis.value = 0;\n\t\t}\n\n\t\tthis.value++;\n\n\t\treturn this.value;\n\t}\n}\n\n//#endregion\n\n//#region\n\nexport type ValueCallback<T = unknown> = (value: T | Promise<T>) => void;\n\nconst enum DeferredOutcome {\n\tResolved,\n\tRejected\n}\n\n/**\n * Creates a promise whose resolution or rejection can be controlled imperatively.\n */\nexport class DeferredPromise<T> {\n\n\tprivate completeCallback!: ValueCallback<T>;\n\tprivate errorCallback!: (err: unknown) => void;\n\tprivate outcome?: { outcome: DeferredOutcome.Rejected; value: unknown } | { outcome: DeferredOutcome.Resolved; value: T };\n\n\tpublic get isRejected() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Rejected;\n\t}\n\n\tpublic get isResolved() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Resolved;\n\t}\n\n\tpublic get isSettled() {\n\t\treturn !!this.outcome;\n\t}\n\n\tpublic get value() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Resolved ? this.outcome?.value : undefined;\n\t}\n\n\tpublic readonly p: Promise<T>;\n\n\tconstructor() {\n\t\tthis.p = new Promise<T>((c, e) => {\n\t\t\tthis.completeCallback = c;\n\t\t\tthis.errorCallback = e;\n\t\t});\n\t}\n\n\tpublic complete(value: T) {\n\t\treturn new Promise<void>(resolve => {\n\t\t\tthis.completeCallback(value);\n\t\t\tthis.outcome = { outcome: DeferredOutcome.Resolved, value };\n\t\t\tresolve();\n\t\t});\n\t}\n\n\tpublic error(err: unknown) {\n\t\treturn new Promise<void>(resolve => {\n\t\t\tthis.errorCallback(err);\n\t\t\tthis.outcome = { outcome: DeferredOutcome.Rejected, value: err };\n\t\t\tresolve();\n\t\t});\n\t}\n\n\tpublic settleWith(promise: Promise<T>): Promise<void> {\n\t\treturn promise.then(\n\t\t\tvalue => this.complete(value),\n\t\t\terror => this.error(error)\n\t\t);\n\t}\n\n\tpublic cancel() {\n\t\treturn this.error(new CancellationError());\n\t}\n}\n\n//#endregion\n\n//#region Promises\n\nexport namespace Promises {\n\n\t/**\n\t * A drop-in replacement for `Promise.all` with the only difference\n\t * that the method awaits every promise to either fulfill or reject.\n\t *\n\t * Similar to `Promise.all`, only the first error will be returned\n\t * if any.\n\t */\n\texport async function settled<T>(promises: Promise<T>[]): Promise<T[]> {\n\t\tlet firstError: Error | undefined = undefined;\n\n\t\tconst result = await Promise.all(promises.map(promise => promise.then(value => value, error => {\n\t\t\tif (!firstError) {\n\t\t\t\tfirstError = error;\n\t\t\t}\n\n\t\t\treturn undefined; // do not rethrow so that other promises can settle\n\t\t})));\n\n\t\tif (typeof firstError !== 'undefined') {\n\t\t\tthrow firstError;\n\t\t}\n\n\t\treturn result as unknown as T[]; // cast is needed and protected by the `throw` above\n\t}\n\n\t/**\n\t * A helper to create a new `Promise<T>` with a body that is a promise\n\t * itself. By default, an error that raises from the async body will\n\t * end up as a unhandled rejection, so this utility properly awaits the\n\t * body and rejects the promise as a normal promise does without async\n\t * body.\n\t *\n\t * This method should only be used in rare cases where otherwise `async`\n\t * cannot be used (e.g. when callbacks are involved that require this).\n\t */\n\texport function withAsyncBody<T, E = Error>(bodyFn: (resolve: (value: T) => unknown, reject: (error: E) => unknown) => Promise<unknown>): Promise<T> {\n\t\t// eslint-disable-next-line no-async-promise-executor\n\t\treturn new Promise<T>(async (resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tawait bodyFn(resolve, reject);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport class StatefulPromise<T> {\n\tprivate _value: T | undefined = undefined;\n\tget value(): T | undefined { return this._value; }\n\n\tprivate _error: unknown = undefined;\n\tget error(): unknown { return this._error; }\n\n\tprivate _isResolved = false;\n\tget isResolved() { return this._isResolved; }\n\n\tpublic readonly promise: Promise<T>;\n\n\tconstructor(promise: Promise<T>) {\n\t\tthis.promise = promise.then(\n\t\t\tvalue => {\n\t\t\t\tthis._value = value;\n\t\t\t\tthis._isResolved = true;\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tthis._error = error;\n\t\t\t\tthis._isResolved = true;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Returns the resolved value.\n\t * Throws if the promise is not resolved yet.\n\t */\n\tpublic requireValue(): T {\n\t\tif (!this._isResolved) {\n\t\t\tthrow new BugIndicatingError('Promise is not resolved yet');\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n}\n\nexport class LazyStatefulPromise<T> {\n\tprivate readonly _promise = new Lazy(() => new StatefulPromise(this._compute()));\n\n\tconstructor(\n\t\tprivate readonly _compute: () => Promise<T>,\n\t) { }\n\n\t/**\n\t * Returns the resolved value.\n\t * Throws if the promise is not resolved yet.\n\t */\n\tpublic requireValue(): T {\n\t\treturn this._promise.value.requireValue();\n\t}\n\n\t/**\n\t * Returns the promise (and triggers a computation of the promise if not yet done so).\n\t */\n\tpublic getPromise(): Promise<T> {\n\t\treturn this._promise.value.promise;\n\t}\n\n\t/**\n\t * Reads the current value without triggering a computation of the promise.\n\t */\n\tpublic get currentValue(): T | undefined {\n\t\treturn this._promise.rawValue?.value;\n\t}\n}\n\n//#endregion\n\n//#region\n\nconst enum AsyncIterableSourceState {\n\tInitial,\n\tDoneOK,\n\tDoneError,\n}\n\n/**\n * An object that allows to emit async values asynchronously or bring the iterable to an error state using `reject()`.\n * This emitter is valid only for the duration of the executor (until the promise returned by the executor settles).\n */\nexport interface AsyncIterableEmitter<T> {\n\t/**\n\t * The value will be appended at the end.\n\t *\n\t * **NOTE** If `reject()` has already been called, this method has no effect.\n\t */\n\temitOne(value: T): void;\n\t/**\n\t * The values will be appended at the end.\n\t *\n\t * **NOTE** If `reject()` has already been called, this method has no effect.\n\t */\n\temitMany(values: T[]): void;\n\t/**\n\t * Writing an error will permanently invalidate this iterable.\n\t * The current users will receive an error thrown, as will all future users.\n\t *\n\t * **NOTE** If `reject()` have already been called, this method has no effect.\n\t */\n\treject(error: Error): void;\n}\n\n/**\n * An executor for the `AsyncIterableObject` that has access to an emitter.\n */\nexport interface AsyncIterableExecutor<T> {\n\t/**\n\t * @param emitter An object that allows to emit async values valid only for the duration of the executor.\n\t */\n\t(emitter: AsyncIterableEmitter<T>): unknown | Promise<unknown>;\n}\n\n/**\n * A rich implementation for an `AsyncIterable<T>`.\n */\nexport class AsyncIterableObject<T> implements AsyncIterable<T> {\n\n\tpublic static fromArray<T>(items: T[]): AsyncIterableObject<T> {\n\t\treturn new AsyncIterableObject<T>((writer) => {\n\t\t\twriter.emitMany(items);\n\t\t});\n\t}\n\n\tpublic static fromPromise<T>(promise: Promise<T[]>): AsyncIterableObject<T> {\n\t\treturn new AsyncIterableObject<T>(async (emitter) => {\n\t\t\temitter.emitMany(await promise);\n\t\t});\n\t}\n\n\tpublic static fromPromisesResolveOrder<T>(promises: Promise<T>[]): AsyncIterableObject<T> {\n\t\treturn new AsyncIterableObject<T>(async (emitter) => {\n\t\t\tawait Promise.all(promises.map(async (p) => emitter.emitOne(await p)));\n\t\t});\n\t}\n\n\tpublic static merge<T>(iterables: AsyncIterable<T>[]): AsyncIterableObject<T> {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tawait Promise.all(iterables.map(async (iterable) => {\n\t\t\t\tfor await (const item of iterable) {\n\t\t\t\t\temitter.emitOne(item);\n\t\t\t\t}\n\t\t\t}));\n\t\t});\n\t}\n\n\tpublic static EMPTY = AsyncIterableObject.fromArray<any>([]);\n\n\tprivate _state: AsyncIterableSourceState;\n\tprivate _results: T[];\n\tprivate _error: Error | null;\n\tprivate readonly _onReturn?: () => void | Promise<void>;\n\tprivate readonly _onStateChanged: Emitter<void>;\n\n\tconstructor(executor: AsyncIterableExecutor<T>, onReturn?: () => void | Promise<void>) {\n\t\tthis._state = AsyncIterableSourceState.Initial;\n\t\tthis._results = [];\n\t\tthis._error = null;\n\t\tthis._onReturn = onReturn;\n\t\tthis._onStateChanged = new Emitter<void>();\n\n\t\tqueueMicrotask(async () => {\n\t\t\tconst writer: AsyncIterableEmitter<T> = {\n\t\t\t\temitOne: (item) => this.emitOne(item),\n\t\t\t\temitMany: (items) => this.emitMany(items),\n\t\t\t\treject: (error) => this.reject(error)\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tawait Promise.resolve(executor(writer));\n\t\t\t\tthis.resolve();\n\t\t\t} catch (err) {\n\t\t\t\tthis.reject(err);\n\t\t\t} finally {\n\t\t\t\twriter.emitOne = undefined!;\n\t\t\t\twriter.emitMany = undefined!;\n\t\t\t\twriter.reject = undefined!;\n\t\t\t}\n\t\t});\n\t}\n\n\t[Symbol.asyncIterator](): AsyncIterator<T, undefined, undefined> {\n\t\tlet i = 0;\n\t\treturn {\n\t\t\tnext: async () => {\n\t\t\t\tdo {\n\t\t\t\t\tif (this._state === AsyncIterableSourceState.DoneError) {\n\t\t\t\t\t\tthrow this._error;\n\t\t\t\t\t}\n\t\t\t\t\tif (i < this._results.length) {\n\t\t\t\t\t\treturn { done: false, value: this._results[i++] };\n\t\t\t\t\t}\n\t\t\t\t\tif (this._state === AsyncIterableSourceState.DoneOK) {\n\t\t\t\t\t\treturn { done: true, value: undefined };\n\t\t\t\t\t}\n\t\t\t\t\tawait Event.toPromise(this._onStateChanged.event);\n\t\t\t\t} while (true);\n\t\t\t},\n\t\t\treturn: async () => {\n\t\t\t\tthis._onReturn?.();\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic static map<T, R>(iterable: AsyncIterable<T>, mapFn: (item: T) => R): AsyncIterableObject<R> {\n\t\treturn new AsyncIterableObject<R>(async (emitter) => {\n\t\t\tfor await (const item of iterable) {\n\t\t\t\temitter.emitOne(mapFn(item));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic map<R>(mapFn: (item: T) => R): AsyncIterableObject<R> {\n\t\treturn AsyncIterableObject.map(this, mapFn);\n\t}\n\n\tpublic static filter<T>(iterable: AsyncIterable<T>, filterFn: (item: T) => boolean): AsyncIterableObject<T> {\n\t\treturn new AsyncIterableObject<T>(async (emitter) => {\n\t\t\tfor await (const item of iterable) {\n\t\t\t\tif (filterFn(item)) {\n\t\t\t\t\temitter.emitOne(item);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic filter<T2 extends T>(filterFn: (item: T) => item is T2): AsyncIterableObject<T2>;\n\tpublic filter(filterFn: (item: T) => boolean): AsyncIterableObject<T>;\n\tpublic filter(filterFn: (item: T) => boolean): AsyncIterableObject<T> {\n\t\treturn AsyncIterableObject.filter(this, filterFn);\n\t}\n\n\tpublic static coalesce<T>(iterable: AsyncIterable<T | undefined | null>): AsyncIterableObject<T> {\n\t\treturn <AsyncIterableObject<T>>AsyncIterableObject.filter(iterable, item => !!item);\n\t}\n\n\tpublic coalesce(): AsyncIterableObject<NonNullable<T>> {\n\t\treturn AsyncIterableObject.coalesce(this) as AsyncIterableObject<NonNullable<T>>;\n\t}\n\n\tpublic static async toPromise<T>(iterable: AsyncIterable<T>): Promise<T[]> {\n\t\tconst result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult.push(item);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic toPromise(): Promise<T[]> {\n\t\treturn AsyncIterableObject.toPromise(this);\n\t}\n\n\t/**\n\t * The value will be appended at the end.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate emitOne(value: T): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\t// it is important to add new values at the end,\n\t\t// as we may have iterators already running on the array\n\t\tthis._results.push(value);\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * The values will be appended at the end.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate emitMany(values: T[]): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\t// it is important to add new values at the end,\n\t\t// as we may have iterators already running on the array\n\t\tthis._results = this._results.concat(values);\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * Calling `resolve()` will mark the result array as complete.\n\t *\n\t * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate resolve(): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\tthis._state = AsyncIterableSourceState.DoneOK;\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * Writing an error will permanently invalidate this iterable.\n\t * The current users will receive an error thrown, as will all future users.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate reject(error: Error) {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\tthis._state = AsyncIterableSourceState.DoneError;\n\t\tthis._error = error;\n\t\tthis._onStateChanged.fire();\n\t}\n}\n\nexport class CancelableAsyncIterableObject<T> extends AsyncIterableObject<T> {\n\tconstructor(\n\t\tprivate readonly _source: CancellationTokenSource,\n\t\texecutor: AsyncIterableExecutor<T>\n\t) {\n\t\tsuper(executor);\n\t}\n\n\tcancel(): void {\n\t\tthis._source.cancel();\n\t}\n}\n\nexport function createCancelableAsyncIterable<T>(callback: (token: CancellationToken) => AsyncIterable<T>): CancelableAsyncIterableObject<T> {\n\tconst source = new CancellationTokenSource();\n\tconst innerIterable = callback(source.token);\n\n\treturn new CancelableAsyncIterableObject<T>(source, async (emitter) => {\n\t\tconst subscription = source.token.onCancellationRequested(() => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\temitter.reject(new CancellationError());\n\t\t});\n\t\ttry {\n\t\t\tfor await (const item of innerIterable) {\n\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t// canceled in the meantime\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\temitter.emitOne(item);\n\t\t\t}\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t} catch (err) {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\temitter.reject(err);\n\t\t}\n\t});\n}\n\nexport class AsyncIterableSource<T> {\n\n\tprivate readonly _deferred = new DeferredPromise<void>();\n\tprivate readonly _asyncIterable: AsyncIterableObject<T>;\n\n\tprivate _errorFn: (error: Error) => void;\n\tprivate _emitOneFn: (item: T) => void;\n\tprivate _emitManyFn: (item: T[]) => void;\n\n\t/**\n\t *\n\t * @param onReturn A function that will be called when consuming the async iterable\n\t * has finished by the consumer, e.g the for-await-loop has be existed (break, return) early.\n\t * This is NOT called when resolving this source by its owner.\n\t */\n\tconstructor(onReturn?: () => Promise<void> | void) {\n\t\tthis._asyncIterable = new AsyncIterableObject(emitter => {\n\n\t\t\tif (earlyError) {\n\t\t\t\temitter.reject(earlyError);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (earlyItems) {\n\t\t\t\temitter.emitMany(earlyItems);\n\t\t\t}\n\t\t\tthis._errorFn = (error: Error) => emitter.reject(error);\n\t\t\tthis._emitOneFn = (item: T) => emitter.emitOne(item);\n\t\t\tthis._emitManyFn = (items: T[]) => emitter.emitMany(items);\n\t\t\treturn this._deferred.p;\n\t\t}, onReturn);\n\n\t\tlet earlyError: Error | undefined;\n\t\tlet earlyItems: T[] | undefined;\n\n\n\t\tthis._errorFn = (error: Error) => {\n\t\t\tif (!earlyError) {\n\t\t\t\tearlyError = error;\n\t\t\t}\n\t\t};\n\t\tthis._emitOneFn = (item: T) => {\n\t\t\tif (!earlyItems) {\n\t\t\t\tearlyItems = [];\n\t\t\t}\n\t\t\tearlyItems.push(item);\n\t\t};\n\t\tthis._emitManyFn = (items: T[]) => {\n\t\t\tif (!earlyItems) {\n\t\t\t\tearlyItems = items.slice();\n\t\t\t} else {\n\t\t\t\titems.forEach(item => earlyItems!.push(item));\n\t\t\t}\n\t\t};\n\t}\n\n\tget asyncIterable(): AsyncIterableObject<T> {\n\t\treturn this._asyncIterable;\n\t}\n\n\tresolve(): void {\n\t\tthis._deferred.complete();\n\t}\n\n\treject(error: Error): void {\n\t\tthis._errorFn(error);\n\t\tthis._deferred.complete();\n\t}\n\n\temitOne(item: T): void {\n\t\tthis._emitOneFn(item);\n\t}\n\n\temitMany(items: T[]) {\n\t\tthis._emitManyFn(items);\n\t}\n}\n\nexport function cancellableIterable<T>(iterableOrIterator: AsyncIterator<T> | AsyncIterable<T>, token: CancellationToken): AsyncIterableIterator<T> {\n\tconst iterator = Symbol.asyncIterator in iterableOrIterator ? iterableOrIterator[Symbol.asyncIterator]() : iterableOrIterator;\n\n\treturn {\n\t\tasync next(): Promise<IteratorResult<T>> {\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\t\t\tconst result = await raceCancellation(iterator.next(), token);\n\t\t\treturn result || { done: true, value: undefined };\n\t\t},\n\t\tthrow: iterator.throw?.bind(iterator),\n\t\treturn: iterator.return?.bind(iterator),\n\t\t[Symbol.asyncIterator]() {\n\t\t\treturn this;\n\t\t}\n\t};\n}\n\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { LRUCache } from './map.js';\n\nconst nfcCache = new LRUCache<string, string>(10000); // bounded to 10000 elements\nexport function normalizeNFC(str: string): string {\n\treturn normalize(str, 'NFC', nfcCache);\n}\n\nconst nfdCache = new LRUCache<string, string>(10000); // bounded to 10000 elements\nexport function normalizeNFD(str: string): string {\n\treturn normalize(str, 'NFD', nfdCache);\n}\n\nconst nonAsciiCharactersPattern = /[^\\u0000-\\u0080]/;\nfunction normalize(str: string, form: string, normalizedCache: LRUCache<string, string>): string {\n\tif (!str) {\n\t\treturn str;\n\t}\n\n\tconst cached = normalizedCache.get(str);\n\tif (cached) {\n\t\treturn cached;\n\t}\n\n\tlet res: string;\n\tif (nonAsciiCharactersPattern.test(str)) {\n\t\tres = str.normalize(form);\n\t} else {\n\t\tres = str;\n\t}\n\n\t// Use the cache for fast lookup\n\tnormalizedCache.set(str, res);\n\n\treturn res;\n}\n\nexport const removeAccents: (str: string) => string = (function () {\n\t// transform into NFD form and remove accents\n\t// see: https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463\n\tconst regex = /[\\u0300-\\u036f]/g;\n\treturn function (str: string) {\n\t\treturn normalizeNFD(str).replace(regex, '');\n\t};\n})();\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as fs from 'fs';\nimport { tmpdir } from 'os';\nimport { promisify } from 'util';\nimport { ResourceQueue, timeout } from '../common/async.js';\nimport { isEqualOrParent, isRootOrDriveLetter, randomPath } from '../common/extpath.js';\nimport { normalizeNFC } from '../common/normalization.js';\nimport { basename, dirname, join, normalize, sep } from '../common/path.js';\nimport { isLinux, isMacintosh, isWindows } from '../common/platform.js';\nimport { extUriBiasedIgnorePathCase } from '../common/resources.js';\nimport { URI } from '../common/uri.js';\nimport { CancellationToken } from '../common/cancellation.js';\nimport { rtrim } from '../common/strings.js';\n\n//#region rimraf\n\nexport enum RimRafMode {\n\n\t/**\n\t * Slow version that unlinks each file and folder.\n\t */\n\tUNLINK,\n\n\t/**\n\t * Fast version that first moves the file/folder\n\t * into a temp directory and then deletes that\n\t * without waiting for it.\n\t */\n\tMOVE\n}\n\n/**\n * Allows to delete the provided path (either file or folder) recursively\n * with the options:\n * - `UNLINK`: direct removal from disk\n * - `MOVE`: faster variant that first moves the target to temp dir and then\n *           deletes it in the background without waiting for that to finish.\n *           the optional `moveToPath` allows to override where to rename the\n *           path to before deleting it.\n */\nasync function rimraf(path: string, mode: RimRafMode.UNLINK): Promise<void>;\nasync function rimraf(path: string, mode: RimRafMode.MOVE, moveToPath?: string): Promise<void>;\nasync function rimraf(path: string, mode?: RimRafMode, moveToPath?: string): Promise<void>;\nasync function rimraf(path: string, mode = RimRafMode.UNLINK, moveToPath?: string): Promise<void> {\n\tif (isRootOrDriveLetter(path)) {\n\t\tthrow new Error('rimraf - will refuse to recursively delete root');\n\t}\n\n\t// delete: via rm\n\tif (mode === RimRafMode.UNLINK) {\n\t\treturn rimrafUnlink(path);\n\t}\n\n\t// delete: via move\n\treturn rimrafMove(path, moveToPath);\n}\n\nasync function rimrafMove(path: string, moveToPath = randomPath(tmpdir())): Promise<void> {\n\ttry {\n\t\ttry {\n\t\t\tawait fs.promises.rename(path, moveToPath);\n\t\t} catch (error) {\n\t\t\tif (error.code === 'ENOENT') {\n\t\t\t\treturn; // ignore - path to delete did not exist\n\t\t\t}\n\n\t\t\treturn rimrafUnlink(path); // otherwise fallback to unlink\n\t\t}\n\n\t\t// Delete but do not return as promise\n\t\trimrafUnlink(moveToPath).catch(error => {/* ignore */ });\n\t} catch (error) {\n\t\tif (error.code !== 'ENOENT') {\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nasync function rimrafUnlink(path: string): Promise<void> {\n\treturn fs.promises.rm(path, { recursive: true, force: true, maxRetries: 3 });\n}\n\n//#endregion\n\n//#region readdir with NFC support (macos)\n\nexport interface IDirent {\n\tname: string;\n\n\tisFile(): boolean;\n\tisDirectory(): boolean;\n\tisSymbolicLink(): boolean;\n}\n\n/**\n * Drop-in replacement of `fs.readdir` with support\n * for converting from macOS NFD unicon form to NFC\n * (https://github.com/nodejs/node/issues/2165)\n */\nasync function readdir(path: string): Promise<string[]>;\nasync function readdir(path: string, options: { withFileTypes: true }): Promise<IDirent[]>;\nasync function readdir(path: string, options?: { withFileTypes: true }): Promise<(string | IDirent)[]> {\n\treturn handleDirectoryChildren(await (options ? safeReaddirWithFileTypes(path) : fs.promises.readdir(path)));\n}\n\nasync function safeReaddirWithFileTypes(path: string): Promise<IDirent[]> {\n\ttry {\n\t\treturn await fs.promises.readdir(path, { withFileTypes: true });\n\t} catch (error) {\n\t\tconsole.warn('[node.js fs] readdir with filetypes failed with error: ', error);\n\t}\n\n\t// Fallback to manually reading and resolving each\n\t// children of the folder in case we hit an error\n\t// previously.\n\t// This can only really happen on exotic file systems\n\t// such as explained in #115645 where we get entries\n\t// from `readdir` that we can later not `lstat`.\n\tconst result: IDirent[] = [];\n\tconst children = await readdir(path);\n\tfor (const child of children) {\n\t\tlet isFile = false;\n\t\tlet isDirectory = false;\n\t\tlet isSymbolicLink = false;\n\n\t\ttry {\n\t\t\tconst lstat = await fs.promises.lstat(join(path, child));\n\n\t\t\tisFile = lstat.isFile();\n\t\t\tisDirectory = lstat.isDirectory();\n\t\t\tisSymbolicLink = lstat.isSymbolicLink();\n\t\t} catch (error) {\n\t\t\tconsole.warn('[node.js fs] unexpected error from lstat after readdir: ', error);\n\t\t}\n\n\t\tresult.push({\n\t\t\tname: child,\n\t\t\tisFile: () => isFile,\n\t\t\tisDirectory: () => isDirectory,\n\t\t\tisSymbolicLink: () => isSymbolicLink\n\t\t});\n\t}\n\n\treturn result;\n}\n\nfunction handleDirectoryChildren(children: string[]): string[];\nfunction handleDirectoryChildren(children: IDirent[]): IDirent[];\nfunction handleDirectoryChildren(children: (string | IDirent)[]): (string | IDirent)[];\nfunction handleDirectoryChildren(children: (string | IDirent)[]): (string | IDirent)[] {\n\treturn children.map(child => {\n\n\t\t// Mac: uses NFD unicode form on disk, but we want NFC\n\t\t// See also https://github.com/nodejs/node/issues/2165\n\n\t\tif (typeof child === 'string') {\n\t\t\treturn isMacintosh ? normalizeNFC(child) : child;\n\t\t}\n\n\t\tchild.name = isMacintosh ? normalizeNFC(child.name) : child.name;\n\n\t\treturn child;\n\t});\n}\n\n/**\n * A convenience method to read all children of a path that\n * are directories.\n */\nasync function readDirsInDir(dirPath: string): Promise<string[]> {\n\tconst children = await readdir(dirPath);\n\tconst directories: string[] = [];\n\n\tfor (const child of children) {\n\t\tif (await SymlinkSupport.existsDirectory(join(dirPath, child))) {\n\t\t\tdirectories.push(child);\n\t\t}\n\t}\n\n\treturn directories;\n}\n\n//#endregion\n\n//#region whenDeleted()\n\n/**\n * A `Promise` that resolves when the provided `path`\n * is deleted from disk.\n */\nexport function whenDeleted(path: string, intervalMs = 1000): Promise<void> {\n\treturn new Promise<void>(resolve => {\n\t\tlet running = false;\n\t\tconst interval = setInterval(() => {\n\t\t\tif (!running) {\n\t\t\t\trunning = true;\n\t\t\t\tfs.access(path, err => {\n\t\t\t\t\trunning = false;\n\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\t\tresolve(undefined);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}, intervalMs);\n\t});\n}\n\n//#endregion\n\n//#region Methods with symbolic links support\n\nexport namespace SymlinkSupport {\n\n\texport interface IStats {\n\n\t\t// The stats of the file. If the file is a symbolic\n\t\t// link, the stats will be of that target file and\n\t\t// not the link itself.\n\t\t// If the file is a symbolic link pointing to a non\n\t\t// existing file, the stat will be of the link and\n\t\t// the `dangling` flag will indicate this.\n\t\tstat: fs.Stats;\n\n\t\t// Will be provided if the resource is a symbolic link\n\t\t// on disk. Use the `dangling` flag to find out if it\n\t\t// points to a resource that does not exist on disk.\n\t\tsymbolicLink?: { dangling: boolean };\n\t}\n\n\t/**\n\t * Resolves the `fs.Stats` of the provided path. If the path is a\n\t * symbolic link, the `fs.Stats` will be from the target it points\n\t * to. If the target does not exist, `dangling: true` will be returned\n\t * as `symbolicLink` value.\n\t */\n\texport async function stat(path: string): Promise<IStats> {\n\n\t\t// First stat the link\n\t\tlet lstats: fs.Stats | undefined;\n\t\ttry {\n\t\t\tlstats = await fs.promises.lstat(path);\n\n\t\t\t// Return early if the stat is not a symbolic link at all\n\t\t\tif (!lstats.isSymbolicLink()) {\n\t\t\t\treturn { stat: lstats };\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t/* ignore - use stat() instead */\n\t\t}\n\n\t\t// If the stat is a symbolic link or failed to stat, use fs.stat()\n\t\t// which for symbolic links will stat the target they point to\n\t\ttry {\n\t\t\tconst stats = await fs.promises.stat(path);\n\n\t\t\treturn { stat: stats, symbolicLink: lstats?.isSymbolicLink() ? { dangling: false } : undefined };\n\t\t} catch (error) {\n\n\t\t\t// If the link points to a nonexistent file we still want\n\t\t\t// to return it as result while setting dangling: true flag\n\t\t\tif (error.code === 'ENOENT' && lstats) {\n\t\t\t\treturn { stat: lstats, symbolicLink: { dangling: true } };\n\t\t\t}\n\n\t\t\t// Windows: workaround a node.js bug where reparse points\n\t\t\t// are not supported (https://github.com/nodejs/node/issues/36790)\n\t\t\tif (isWindows && error.code === 'EACCES') {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = await fs.promises.stat(await fs.promises.readlink(path));\n\n\t\t\t\t\treturn { stat: stats, symbolicLink: { dangling: false } };\n\t\t\t\t} catch (error) {\n\n\t\t\t\t\t// If the link points to a nonexistent file we still want\n\t\t\t\t\t// to return it as result while setting dangling: true flag\n\t\t\t\t\tif (error.code === 'ENOENT' && lstats) {\n\t\t\t\t\t\treturn { stat: lstats, symbolicLink: { dangling: true } };\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Figures out if the `path` exists and is a file with support\n\t * for symlinks.\n\t *\n\t * Note: this will return `false` for a symlink that exists on\n\t * disk but is dangling (pointing to a nonexistent path).\n\t *\n\t * Use `exists` if you only care about the path existing on disk\n\t * or not without support for symbolic links.\n\t */\n\texport async function existsFile(path: string): Promise<boolean> {\n\t\ttry {\n\t\t\tconst { stat, symbolicLink } = await SymlinkSupport.stat(path);\n\n\t\t\treturn stat.isFile() && symbolicLink?.dangling !== true;\n\t\t} catch (error) {\n\t\t\t// Ignore, path might not exist\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Figures out if the `path` exists and is a directory with support for\n\t * symlinks.\n\t *\n\t * Note: this will return `false` for a symlink that exists on\n\t * disk but is dangling (pointing to a nonexistent path).\n\t *\n\t * Use `exists` if you only care about the path existing on disk\n\t * or not without support for symbolic links.\n\t */\n\texport async function existsDirectory(path: string): Promise<boolean> {\n\t\ttry {\n\t\t\tconst { stat, symbolicLink } = await SymlinkSupport.stat(path);\n\n\t\t\treturn stat.isDirectory() && symbolicLink?.dangling !== true;\n\t\t} catch (error) {\n\t\t\t// Ignore, path might not exist\n\t\t}\n\n\t\treturn false;\n\t}\n}\n\n//#endregion\n\n//#region Write File\n\n// According to node.js docs (https://nodejs.org/docs/v14.16.0/api/fs.html#fs_fs_writefile_file_data_options_callback)\n// it is not safe to call writeFile() on the same path multiple times without waiting for the callback to return.\n// Therefor we use a Queue on the path that is given to us to sequentialize calls to the same path properly.\nconst writeQueues = new ResourceQueue();\n\n/**\n * Same as `fs.writeFile` but with an additional call to\n * `fs.fdatasync` after writing to ensure changes are\n * flushed to disk.\n *\n * In addition, multiple writes to the same path are queued.\n */\nfunction writeFile(path: string, data: string, options?: IWriteFileOptions): Promise<void>;\nfunction writeFile(path: string, data: Buffer, options?: IWriteFileOptions): Promise<void>;\nfunction writeFile(path: string, data: Uint8Array, options?: IWriteFileOptions): Promise<void>;\nfunction writeFile(path: string, data: string | Buffer | Uint8Array, options?: IWriteFileOptions): Promise<void>;\nfunction writeFile(path: string, data: string | Buffer | Uint8Array, options?: IWriteFileOptions): Promise<void> {\n\treturn writeQueues.queueFor(URI.file(path), () => {\n\t\tconst ensuredOptions = ensureWriteOptions(options);\n\n\t\treturn new Promise((resolve, reject) => doWriteFileAndFlush(path, data, ensuredOptions, error => error ? reject(error) : resolve()));\n\t}, extUriBiasedIgnorePathCase);\n}\n\ninterface IWriteFileOptions {\n\tmode?: number;\n\tflag?: string;\n}\n\ninterface IEnsuredWriteFileOptions extends IWriteFileOptions {\n\tmode: number;\n\tflag: string;\n}\n\nlet canFlush = true;\nexport function configureFlushOnWrite(enabled: boolean): void {\n\tcanFlush = enabled;\n}\n\n// Calls fs.writeFile() followed by a fs.sync() call to flush the changes to disk\n// We do this in cases where we want to make sure the data is really on disk and\n// not in some cache.\n//\n// See https://github.com/nodejs/node/blob/v5.10.0/lib/fs.js#L1194\nfunction doWriteFileAndFlush(path: string, data: string | Buffer | Uint8Array, options: IEnsuredWriteFileOptions, callback: (error: Error | null) => void): void {\n\tif (!canFlush) {\n\t\treturn fs.writeFile(path, data, { mode: options.mode, flag: options.flag }, callback);\n\t}\n\n\t// Open the file with same flags and mode as fs.writeFile()\n\tfs.open(path, options.flag, options.mode, (openError, fd) => {\n\t\tif (openError) {\n\t\t\treturn callback(openError);\n\t\t}\n\n\t\t// It is valid to pass a fd handle to fs.writeFile() and this will keep the handle open!\n\t\tfs.writeFile(fd, data, writeError => {\n\t\t\tif (writeError) {\n\t\t\t\treturn fs.close(fd, () => callback(writeError)); // still need to close the handle on error!\n\t\t\t}\n\n\t\t\t// Flush contents (not metadata) of the file to disk\n\t\t\t// https://github.com/microsoft/vscode/issues/9589\n\t\t\tfs.fdatasync(fd, (syncError: Error | null) => {\n\n\t\t\t\t// In some exotic setups it is well possible that node fails to sync\n\t\t\t\t// In that case we disable flushing and warn to the console\n\t\t\t\tif (syncError) {\n\t\t\t\t\tconsole.warn('[node.js fs] fdatasync is now disabled for this session because it failed: ', syncError);\n\t\t\t\t\tconfigureFlushOnWrite(false);\n\t\t\t\t}\n\n\t\t\t\treturn fs.close(fd, closeError => callback(closeError));\n\t\t\t});\n\t\t});\n\t});\n}\n\n/**\n * Same as `fs.writeFileSync` but with an additional call to\n * `fs.fdatasyncSync` after writing to ensure changes are\n * flushed to disk.\n *\n * @deprecated always prefer async variants over sync!\n */\nexport function writeFileSync(path: string, data: string | Buffer, options?: IWriteFileOptions): void {\n\tconst ensuredOptions = ensureWriteOptions(options);\n\n\tif (!canFlush) {\n\t\treturn fs.writeFileSync(path, data, { mode: ensuredOptions.mode, flag: ensuredOptions.flag });\n\t}\n\n\t// Open the file with same flags and mode as fs.writeFile()\n\tconst fd = fs.openSync(path, ensuredOptions.flag, ensuredOptions.mode);\n\n\ttry {\n\n\t\t// It is valid to pass a fd handle to fs.writeFile() and this will keep the handle open!\n\t\tfs.writeFileSync(fd, data);\n\n\t\t// Flush contents (not metadata) of the file to disk\n\t\ttry {\n\t\t\tfs.fdatasyncSync(fd); // https://github.com/microsoft/vscode/issues/9589\n\t\t} catch (syncError) {\n\t\t\tconsole.warn('[node.js fs] fdatasyncSync is now disabled for this session because it failed: ', syncError);\n\t\t\tconfigureFlushOnWrite(false);\n\t\t}\n\t} finally {\n\t\tfs.closeSync(fd);\n\t}\n}\n\nfunction ensureWriteOptions(options?: IWriteFileOptions): IEnsuredWriteFileOptions {\n\tif (!options) {\n\t\treturn { mode: 0o666 /* default node.js mode for files */, flag: 'w' };\n\t}\n\n\treturn {\n\t\tmode: typeof options.mode === 'number' ? options.mode : 0o666 /* default node.js mode for files */,\n\t\tflag: typeof options.flag === 'string' ? options.flag : 'w'\n\t};\n}\n\n//#endregion\n\n//#region Move / Copy\n\n/**\n * A drop-in replacement for `fs.rename` that:\n * - allows to move across multiple disks\n * - attempts to retry the operation for certain error codes on Windows\n */\nasync function rename(source: string, target: string, windowsRetryTimeout: number | false = 60000): Promise<void> {\n\tif (source === target) {\n\t\treturn;  // simulate node.js behaviour here and do a no-op if paths match\n\t}\n\n\ttry {\n\t\tif (isWindows && typeof windowsRetryTimeout === 'number') {\n\t\t\t// On Windows, a rename can fail when either source or target\n\t\t\t// is locked by AV software.\n\t\t\tawait renameWithRetry(source, target, Date.now(), windowsRetryTimeout);\n\t\t} else {\n\t\t\tawait fs.promises.rename(source, target);\n\t\t}\n\t} catch (error) {\n\t\t// In two cases we fallback to classic copy and delete:\n\t\t//\n\t\t// 1.) The EXDEV error indicates that source and target are on different devices\n\t\t// In this case, fallback to using a copy() operation as there is no way to\n\t\t// rename() between different devices.\n\t\t//\n\t\t// 2.) The user tries to rename a file/folder that ends with a dot. This is not\n\t\t// really possible to move then, at least on UNC devices.\n\t\tif (source.toLowerCase() !== target.toLowerCase() && error.code === 'EXDEV' || source.endsWith('.')) {\n\t\t\tawait copy(source, target, { preserveSymlinks: false /* copying to another device */ });\n\t\t\tawait rimraf(source, RimRafMode.MOVE);\n\t\t} else {\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nasync function renameWithRetry(source: string, target: string, startTime: number, retryTimeout: number, attempt = 0): Promise<void> {\n\ttry {\n\t\treturn await fs.promises.rename(source, target);\n\t} catch (error) {\n\t\tif (error.code !== 'EACCES' && error.code !== 'EPERM' && error.code !== 'EBUSY') {\n\t\t\tthrow error; // only for errors we think are temporary\n\t\t}\n\n\t\tif (Date.now() - startTime >= retryTimeout) {\n\t\t\tconsole.error(`[node.js fs] rename failed after ${attempt} retries with error: ${error}`);\n\n\t\t\tthrow error; // give up after configurable timeout\n\t\t}\n\n\t\tif (attempt === 0) {\n\t\t\tlet abortRetry = false;\n\t\t\ttry {\n\t\t\t\tconst { stat } = await SymlinkSupport.stat(target);\n\t\t\t\tif (!stat.isFile()) {\n\t\t\t\t\tabortRetry = true; // if target is not a file, EPERM error may be raised and we should not attempt to retry\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\t// Ignore\n\t\t\t}\n\n\t\t\tif (abortRetry) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\t// Delay with incremental backoff up to 100ms\n\t\tawait timeout(Math.min(100, attempt * 10));\n\n\t\t// Attempt again\n\t\treturn renameWithRetry(source, target, startTime, retryTimeout, attempt + 1);\n\t}\n}\n\ninterface ICopyPayload {\n\treadonly root: { source: string; target: string };\n\treadonly options: { preserveSymlinks: boolean };\n\treadonly handledSourcePaths: Set<string>;\n}\n\n/**\n * Recursively copies all of `source` to `target`.\n *\n * The options `preserveSymlinks` configures how symbolic\n * links should be handled when encountered. Set to\n * `false` to not preserve them and `true` otherwise.\n */\nasync function copy(source: string, target: string, options: { preserveSymlinks: boolean }): Promise<void> {\n\treturn doCopy(source, target, { root: { source, target }, options, handledSourcePaths: new Set<string>() });\n}\n\n// When copying a file or folder, we want to preserve the mode\n// it had and as such provide it when creating. However, modes\n// can go beyond what we expect (see link below), so we mask it.\n// (https://github.com/nodejs/node-v0.x-archive/issues/3045#issuecomment-4862588)\nconst COPY_MODE_MASK = 0o777;\n\nasync function doCopy(source: string, target: string, payload: ICopyPayload): Promise<void> {\n\n\t// Keep track of paths already copied to prevent\n\t// cycles from symbolic links to cause issues\n\tif (payload.handledSourcePaths.has(source)) {\n\t\treturn;\n\t} else {\n\t\tpayload.handledSourcePaths.add(source);\n\t}\n\n\tconst { stat, symbolicLink } = await SymlinkSupport.stat(source);\n\n\t// Symlink\n\tif (symbolicLink) {\n\n\t\t// Try to re-create the symlink unless `preserveSymlinks: false`\n\t\tif (payload.options.preserveSymlinks) {\n\t\t\ttry {\n\t\t\t\treturn await doCopySymlink(source, target, payload);\n\t\t\t} catch (error) {\n\t\t\t\t// in any case of an error fallback to normal copy via dereferencing\n\t\t\t}\n\t\t}\n\n\t\tif (symbolicLink.dangling) {\n\t\t\treturn; // skip dangling symbolic links from here on (https://github.com/microsoft/vscode/issues/111621)\n\t\t}\n\t}\n\n\t// Folder\n\tif (stat.isDirectory()) {\n\t\treturn doCopyDirectory(source, target, stat.mode & COPY_MODE_MASK, payload);\n\t}\n\n\t// File or file-like\n\telse {\n\t\treturn doCopyFile(source, target, stat.mode & COPY_MODE_MASK);\n\t}\n}\n\nasync function doCopyDirectory(source: string, target: string, mode: number, payload: ICopyPayload): Promise<void> {\n\n\t// Create folder\n\tawait fs.promises.mkdir(target, { recursive: true, mode });\n\n\t// Copy each file recursively\n\tconst files = await readdir(source);\n\tfor (const file of files) {\n\t\tawait doCopy(join(source, file), join(target, file), payload);\n\t}\n}\n\nasync function doCopyFile(source: string, target: string, mode: number): Promise<void> {\n\n\t// Copy file\n\tawait fs.promises.copyFile(source, target);\n\n\t// restore mode (https://github.com/nodejs/node/issues/1104)\n\tawait fs.promises.chmod(target, mode);\n}\n\nasync function doCopySymlink(source: string, target: string, payload: ICopyPayload): Promise<void> {\n\n\t// Figure out link target\n\tlet linkTarget = await fs.promises.readlink(source);\n\n\t// Special case: the symlink points to a target that is\n\t// actually within the path that is being copied. In that\n\t// case we want the symlink to point to the target and\n\t// not the source\n\tif (isEqualOrParent(linkTarget, payload.root.source, !isLinux)) {\n\t\tlinkTarget = join(payload.root.target, linkTarget.substr(payload.root.source.length + 1));\n\t}\n\n\t// Create symlink\n\tawait fs.promises.symlink(linkTarget, target);\n}\n\n//#endregion\n\n//#region Path resolvers\n\n/**\n * Given an absolute, normalized, and existing file path 'realcase' returns the\n * exact path that the file has on disk.\n * On a case insensitive file system, the returned path might differ from the original\n * path by character casing.\n * On a case sensitive file system, the returned path will always be identical to the\n * original path.\n * In case of errors, null is returned. But you cannot use this function to verify that\n * a path exists.\n *\n * realcase does not handle '..' or '.' path segments and it does not take the locale into account.\n */\nexport async function realcase(path: string, token?: CancellationToken): Promise<string | null> {\n\tif (isLinux) {\n\t\t// This method is unsupported on OS that have case sensitive\n\t\t// file system where the same path can exist in different forms\n\t\t// (see also https://github.com/microsoft/vscode/issues/139709)\n\t\treturn path;\n\t}\n\n\tconst dir = dirname(path);\n\tif (path === dir) {\t// end recursion\n\t\treturn path;\n\t}\n\n\tconst name = (basename(path) /* can be '' for windows drive letters */ || path).toLowerCase();\n\ttry {\n\t\tif (token?.isCancellationRequested) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst entries = await Promises.readdir(dir);\n\t\tconst found = entries.filter(e => e.toLowerCase() === name);\t// use a case insensitive search\n\t\tif (found.length === 1) {\n\t\t\t// on a case sensitive filesystem we cannot determine here, whether the file exists or not, hence we need the 'file exists' precondition\n\t\t\tconst prefix = await realcase(dir, token);   // recurse\n\t\t\tif (prefix) {\n\t\t\t\treturn join(prefix, found[0]);\n\t\t\t}\n\t\t} else if (found.length > 1) {\n\t\t\t// must be a case sensitive $filesystem\n\t\t\tconst ix = found.indexOf(name);\n\t\t\tif (ix >= 0) {\t// case sensitive\n\t\t\t\tconst prefix = await realcase(dir, token);   // recurse\n\t\t\t\tif (prefix) {\n\t\t\t\t\treturn join(prefix, found[ix]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\t// silently ignore error\n\t}\n\n\treturn null;\n}\n\nasync function realpath(path: string): Promise<string> {\n\ttry {\n\t\t// DO NOT USE `fs.promises.realpath` here as it internally\n\t\t// calls `fs.native.realpath` which will result in subst\n\t\t// drives to be resolved to their target on Windows\n\t\t// https://github.com/microsoft/vscode/issues/118562\n\t\treturn await promisify(fs.realpath)(path);\n\t} catch (error) {\n\n\t\t// We hit an error calling fs.realpath(). Since fs.realpath() is doing some path normalization\n\t\t// we now do a similar normalization and then try again if we can access the path with read\n\t\t// permissions at least. If that succeeds, we return that path.\n\t\t// fs.realpath() is resolving symlinks and that can fail in certain cases. The workaround is\n\t\t// to not resolve links but to simply see if the path is read accessible or not.\n\t\tconst normalizedPath = normalizePath(path);\n\n\t\tawait fs.promises.access(normalizedPath, fs.constants.R_OK);\n\n\t\treturn normalizedPath;\n\t}\n}\n\n/**\n * @deprecated always prefer async variants over sync!\n */\nexport function realpathSync(path: string): string {\n\ttry {\n\t\treturn fs.realpathSync(path);\n\t} catch (error) {\n\n\t\t// We hit an error calling fs.realpathSync(). Since fs.realpathSync() is doing some path normalization\n\t\t// we now do a similar normalization and then try again if we can access the path with read\n\t\t// permissions at least. If that succeeds, we return that path.\n\t\t// fs.realpath() is resolving symlinks and that can fail in certain cases. The workaround is\n\t\t// to not resolve links but to simply see if the path is read accessible or not.\n\t\tconst normalizedPath = normalizePath(path);\n\n\t\tfs.accessSync(normalizedPath, fs.constants.R_OK); // throws in case of an error\n\n\t\treturn normalizedPath;\n\t}\n}\n\nfunction normalizePath(path: string): string {\n\treturn rtrim(normalize(path), sep);\n}\n\n//#endregion\n\n//#region Promise based fs methods\n\n/**\n * Some low level `fs` methods provided as `Promises` similar to\n * `fs.promises` but with notable differences, either implemented\n * by us or by restoring the original callback based behavior.\n *\n * At least `realpath` is implemented differently in the promise\n * based implementation compared to the callback based one. The\n * promise based implementation actually calls `fs.realpath.native`.\n * (https://github.com/microsoft/vscode/issues/118562)\n */\nexport const Promises = new class {\n\n\t//#region Implemented by node.js\n\n\tget read() {\n\n\t\t// Not using `promisify` here for a reason: the return\n\t\t// type is not an object as indicated by TypeScript but\n\t\t// just the bytes read, so we create our own wrapper.\n\n\t\treturn (fd: number, buffer: Uint8Array, offset: number, length: number, position: number | null) => {\n\t\t\treturn new Promise<{ bytesRead: number; buffer: Uint8Array }>((resolve, reject) => {\n\t\t\t\tfs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treturn reject(err);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn resolve({ bytesRead, buffer });\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t}\n\n\tget write() {\n\n\t\t// Not using `promisify` here for a reason: the return\n\t\t// type is not an object as indicated by TypeScript but\n\t\t// just the bytes written, so we create our own wrapper.\n\n\t\treturn (fd: number, buffer: Uint8Array, offset: number | undefined | null, length: number | undefined | null, position: number | undefined | null) => {\n\t\t\treturn new Promise<{ bytesWritten: number; buffer: Uint8Array }>((resolve, reject) => {\n\t\t\t\tfs.write(fd, buffer, offset, length, position, (err, bytesWritten, buffer) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treturn reject(err);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn resolve({ bytesWritten, buffer });\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t}\n\n\tget fdatasync() { return promisify(fs.fdatasync); } // not exposed as API in 22.x yet\n\n\tget open() { return promisify(fs.open); } \t\t\t// changed to return `FileHandle` in promise API\n\tget close() { return promisify(fs.close); } \t\t// not exposed as API due to the `FileHandle` return type of `open`\n\n\tget ftruncate() { return promisify(fs.ftruncate); } // not exposed as API in 22.x yet\n\n\t//#endregion\n\n\t//#region Implemented by us\n\n\tasync exists(path: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait fs.promises.access(path);\n\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tget readdir() { return readdir; }\n\tget readDirsInDir() { return readDirsInDir; }\n\n\tget writeFile() { return writeFile; }\n\n\tget rm() { return rimraf; }\n\n\tget rename() { return rename; }\n\tget copy() { return copy; }\n\n\tget realpath() { return realpath; }\t// `fs.promises.realpath` will use `fs.realpath.native` which we do not want\n\n\t//#endregion\n};\n\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { join } from '../common/path.js';\nimport { promises } from 'fs';\nimport { mark } from '../common/performance.js';\nimport { ILanguagePacks, INLSConfiguration } from '../../nls.js';\nimport { Promises } from './pfs.js';\n\nexport interface IResolveNLSConfigurationContext {\n\n\t/**\n\t * Location where `nls.messages.json` and `nls.keys.json` are stored.\n\t */\n\treadonly nlsMetadataPath: string;\n\n\t/**\n\t * Path to the user data directory. Used as a cache for\n\t * language packs converted to the format we need.\n\t */\n\treadonly userDataPath: string;\n\n\t/**\n\t * Commit of the running application. Can be `undefined`\n\t * when not built.\n\t */\n\treadonly commit: string | undefined;\n\n\t/**\n\t * Locale as defined in `argv.json` or `app.getLocale()`.\n\t */\n\treadonly userLocale: string;\n\n\t/**\n\t * Locale as defined by the OS (e.g. `app.getPreferredSystemLanguages()`).\n\t */\n\treadonly osLocale: string;\n}\n\nexport async function resolveNLSConfiguration({ userLocale, osLocale, userDataPath, commit, nlsMetadataPath }: IResolveNLSConfigurationContext): Promise<INLSConfiguration> {\n\tmark('code/willGenerateNls');\n\n\tif (\n\t\tprocess.env['VSCODE_DEV'] ||\n\t\tuserLocale === 'pseudo' ||\n\t\tuserLocale.startsWith('en') ||\n\t\t!commit ||\n\t\t!userDataPath\n\t) {\n\t\treturn defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath);\n\t}\n\n\ttry {\n\t\tconst languagePacks = await getLanguagePackConfigurations(userDataPath);\n\t\tif (!languagePacks) {\n\t\t\treturn defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath);\n\t\t}\n\n\t\tconst resolvedLanguage = resolveLanguagePackLanguage(languagePacks, userLocale);\n\t\tif (!resolvedLanguage) {\n\t\t\treturn defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath);\n\t\t}\n\n\t\tconst languagePack = languagePacks[resolvedLanguage];\n\t\tconst mainLanguagePackPath = languagePack?.translations?.['vscode'];\n\t\tif (\n\t\t\t!languagePack ||\n\t\t\ttypeof languagePack.hash !== 'string' ||\n\t\t\t!languagePack.translations ||\n\t\t\ttypeof mainLanguagePackPath !== 'string' ||\n\t\t\t!(await Promises.exists(mainLanguagePackPath))\n\t\t) {\n\t\t\treturn defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath);\n\t\t}\n\n\t\tconst languagePackId = `${languagePack.hash}.${resolvedLanguage}`;\n\t\tconst globalLanguagePackCachePath = join(userDataPath, 'clp', languagePackId);\n\t\tconst commitLanguagePackCachePath = join(globalLanguagePackCachePath, commit);\n\t\tconst languagePackMessagesFile = join(commitLanguagePackCachePath, 'nls.messages.json');\n\t\tconst translationsConfigFile = join(globalLanguagePackCachePath, 'tcf.json');\n\t\tconst languagePackCorruptMarkerFile = join(globalLanguagePackCachePath, 'corrupted.info');\n\n\t\tif (await Promises.exists(languagePackCorruptMarkerFile)) {\n\t\t\tawait promises.rm(globalLanguagePackCachePath, { recursive: true, force: true, maxRetries: 3 }); // delete corrupted cache folder\n\t\t}\n\n\t\tconst result: INLSConfiguration = {\n\t\t\tuserLocale,\n\t\t\tosLocale,\n\t\t\tresolvedLanguage,\n\t\t\tdefaultMessagesFile: join(nlsMetadataPath, 'nls.messages.json'),\n\t\t\tlanguagePack: {\n\t\t\t\ttranslationsConfigFile,\n\t\t\t\tmessagesFile: languagePackMessagesFile,\n\t\t\t\tcorruptMarkerFile: languagePackCorruptMarkerFile\n\t\t\t},\n\n\t\t\t// NLS: below properties are a relic from old times only used by vscode-nls and deprecated\n\t\t\tlocale: userLocale,\n\t\t\tavailableLanguages: { '*': resolvedLanguage },\n\t\t\t_languagePackId: languagePackId,\n\t\t\t_languagePackSupport: true,\n\t\t\t_translationsConfigFile: translationsConfigFile,\n\t\t\t_cacheRoot: globalLanguagePackCachePath,\n\t\t\t_resolvedLanguagePackCoreLocation: commitLanguagePackCachePath,\n\t\t\t_corruptedFile: languagePackCorruptMarkerFile\n\t\t};\n\n\t\tif (await Promises.exists(languagePackMessagesFile)) {\n\t\t\ttouch(commitLanguagePackCachePath).catch(() => { }); // We don't wait for this. No big harm if we can't touch\n\t\t\tmark('code/didGenerateNls');\n\t\t\treturn result;\n\t\t}\n\n\t\tconst [\n\t\t\tnlsDefaultKeys,\n\t\t\tnlsDefaultMessages,\n\t\t\tnlsPackdata\n\t\t]:\n\t\t\t[Array<[string, string[]]>, string[], { contents: Record<string, Record<string, string>> }]\n\t\t\t//      ^moduleId ^nlsKeys                               ^moduleId      ^nlsKey ^nlsValue\n\t\t\t= await Promise.all([\n\t\t\t\tpromises.readFile(join(nlsMetadataPath, 'nls.keys.json'), 'utf-8').then(content => JSON.parse(content)),\n\t\t\t\tpromises.readFile(join(nlsMetadataPath, 'nls.messages.json'), 'utf-8').then(content => JSON.parse(content)),\n\t\t\t\tpromises.readFile(mainLanguagePackPath, 'utf-8').then(content => JSON.parse(content)),\n\t\t\t]);\n\n\t\tconst nlsResult: string[] = [];\n\n\t\t// We expect NLS messages to be in a flat array in sorted order as they\n\t\t// where produced during build time. We use `nls.keys.json` to know the\n\t\t// right order and then lookup the related message from the translation.\n\t\t// If a translation does not exist, we fallback to the default message.\n\n\t\tlet nlsIndex = 0;\n\t\tfor (const [moduleId, nlsKeys] of nlsDefaultKeys) {\n\t\t\tconst moduleTranslations = nlsPackdata.contents[moduleId];\n\t\t\tfor (const nlsKey of nlsKeys) {\n\t\t\t\tnlsResult.push(moduleTranslations?.[nlsKey] || nlsDefaultMessages[nlsIndex]);\n\t\t\t\tnlsIndex++;\n\t\t\t}\n\t\t}\n\n\t\tawait promises.mkdir(commitLanguagePackCachePath, { recursive: true });\n\n\t\tawait Promise.all([\n\t\t\tpromises.writeFile(languagePackMessagesFile, JSON.stringify(nlsResult), 'utf-8'),\n\t\t\tpromises.writeFile(translationsConfigFile, JSON.stringify(languagePack.translations), 'utf-8')\n\t\t]);\n\n\t\tmark('code/didGenerateNls');\n\n\t\treturn result;\n\t} catch (error) {\n\t\tconsole.error('Generating translation files failed.', error);\n\t}\n\n\treturn defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath);\n}\n\n/**\n * The `languagepacks.json` file is a JSON file that contains all metadata\n * about installed language extensions per language. Specifically, for\n * core (`vscode`) and all extensions it supports, it points to the related\n * translation files.\n *\n * The file is updated whenever a new language pack is installed or removed.\n */\nasync function getLanguagePackConfigurations(userDataPath: string): Promise<ILanguagePacks | undefined> {\n\tconst configFile = join(userDataPath, 'languagepacks.json');\n\ttry {\n\t\treturn JSON.parse(await promises.readFile(configFile, 'utf-8'));\n\t} catch (err) {\n\t\treturn undefined; // Do nothing. If we can't read the file we have no language pack config.\n\t}\n}\n\nfunction resolveLanguagePackLanguage(languagePacks: ILanguagePacks, locale: string | undefined): string | undefined {\n\ttry {\n\t\twhile (locale) {\n\t\t\tif (languagePacks[locale]) {\n\t\t\t\treturn locale;\n\t\t\t}\n\n\t\t\tconst index = locale.lastIndexOf('-');\n\t\t\tif (index > 0) {\n\t\t\t\tlocale = locale.substring(0, index);\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.error('Resolving language pack configuration failed.', error);\n\t}\n\n\treturn undefined;\n}\n\nfunction defaultNLSConfiguration(userLocale: string, osLocale: string, nlsMetadataPath: string): INLSConfiguration {\n\tmark('code/didGenerateNls');\n\n\treturn {\n\t\tuserLocale,\n\t\tosLocale,\n\t\tresolvedLanguage: 'en',\n\t\tdefaultMessagesFile: join(nlsMetadataPath, 'nls.messages.json'),\n\n\t\t// NLS: below 2 are a relic from old times only used by vscode-nls and deprecated\n\t\tlocale: userLocale,\n\t\tavailableLanguages: {}\n\t};\n}\n\n//#region fs helpers\n\nfunction touch(path: string): Promise<void> {\n\tconst date = new Date();\n\n\treturn promises.utimes(path, date, date);\n}\n\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ServiceIdentifier } from './instantiation.js';\nimport { SyncDescriptor } from './descriptors.js';\n\nexport class ServiceCollection {\n\n\tprivate _entries = new Map<ServiceIdentifier<any>, any>();\n\n\tconstructor(...entries: [ServiceIdentifier<any>, any][]) {\n\t\tfor (const [id, service] of entries) {\n\t\t\tthis.set(id, service);\n\t\t}\n\t}\n\n\tset<T>(id: ServiceIdentifier<T>, instanceOrDescriptor: T | SyncDescriptor<T>): T | SyncDescriptor<T> {\n\t\tconst result = this._entries.get(id);\n\t\tthis._entries.set(id, instanceOrDescriptor);\n\t\treturn result;\n\t}\n\n\thas(id: ServiceIdentifier<any>): boolean {\n\t\treturn this._entries.has(id);\n\t}\n\n\tget<T>(id: ServiceIdentifier<T>): T | SyncDescriptor<T> {\n\t\treturn this._entries.get(id);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as arrays from './arrays.js';\nimport * as types from './types.js';\nimport * as nls from '../../nls.js';\nimport { IAction } from './actions.js';\n\nfunction exceptionToErrorMessage(exception: any, verbose: boolean): string {\n\tif (verbose && (exception.stack || exception.stacktrace)) {\n\t\treturn nls.localize('stackTrace.format', \"{0}: {1}\", detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace));\n\t}\n\n\treturn detectSystemErrorMessage(exception);\n}\n\nfunction stackToString(stack: string[] | string | undefined): string | undefined {\n\tif (Array.isArray(stack)) {\n\t\treturn stack.join('\\n');\n\t}\n\n\treturn stack;\n}\n\nfunction detectSystemErrorMessage(exception: any): string {\n\n\t// Custom node.js error from us\n\tif (exception.code === 'ERR_UNC_HOST_NOT_ALLOWED') {\n\t\treturn `${exception.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`;\n\t}\n\n\t// See https://nodejs.org/api/errors.html#errors_class_system_error\n\tif (typeof exception.code === 'string' && typeof exception.errno === 'number' && typeof exception.syscall === 'string') {\n\t\treturn nls.localize('nodeExceptionMessage', \"A system error occurred ({0})\", exception.message);\n\t}\n\n\treturn exception.message || nls.localize('error.defaultMessage', \"An unknown error occurred. Please consult the log for more details.\");\n}\n\n/**\n * Tries to generate a human readable error message out of the error. If the verbose parameter\n * is set to true, the error message will include stacktrace details if provided.\n *\n * @returns A string containing the error message.\n */\nexport function toErrorMessage(error: any = null, verbose: boolean = false): string {\n\tif (!error) {\n\t\treturn nls.localize('error.defaultMessage', \"An unknown error occurred. Please consult the log for more details.\");\n\t}\n\n\tif (Array.isArray(error)) {\n\t\tconst errors: any[] = arrays.coalesce(error);\n\t\tconst msg = toErrorMessage(errors[0], verbose);\n\n\t\tif (errors.length > 1) {\n\t\t\treturn nls.localize('error.moreErrors', \"{0} ({1} errors in total)\", msg, errors.length);\n\t\t}\n\n\t\treturn msg;\n\t}\n\n\tif (types.isString(error)) {\n\t\treturn error;\n\t}\n\n\tif (error.detail) {\n\t\tconst detail = error.detail;\n\n\t\tif (detail.error) {\n\t\t\treturn exceptionToErrorMessage(detail.error, verbose);\n\t\t}\n\n\t\tif (detail.exception) {\n\t\t\treturn exceptionToErrorMessage(detail.exception, verbose);\n\t\t}\n\t}\n\n\tif (error.stack) {\n\t\treturn exceptionToErrorMessage(error, verbose);\n\t}\n\n\tif (error.message) {\n\t\treturn error.message;\n\t}\n\n\treturn nls.localize('error.defaultMessage', \"An unknown error occurred. Please consult the log for more details.\");\n}\n\n\nexport interface IErrorWithActions extends Error {\n\tactions: IAction[];\n}\n\nexport function isErrorWithActions(obj: unknown): obj is IErrorWithActions {\n\tconst candidate = obj as IErrorWithActions | undefined;\n\n\treturn candidate instanceof Error && Array.isArray(candidate.actions);\n}\n\nexport function createErrorWithActions(messageOrError: string | Error, actions: IAction[]): IErrorWithActions {\n\tlet error: IErrorWithActions;\n\tif (typeof messageOrError === 'string') {\n\t\terror = new Error(messageOrError) as IErrorWithActions;\n\t} else {\n\t\terror = messageOrError as IErrorWithActions;\n\t}\n\n\terror.actions = actions;\n\n\treturn error;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from './cancellation.js';\nimport { onUnexpectedError } from './errors.js';\nimport { DisposableStore, toDisposable } from './lifecycle.js';\n\n/**\n * The payload that flows in readable stream events.\n */\nexport type ReadableStreamEventPayload<T> = T | Error | 'end';\n\nexport interface ReadableStreamEvents<T> {\n\n\t/**\n\t * The 'data' event is emitted whenever the stream is\n\t * relinquishing ownership of a chunk of data to a consumer.\n\t *\n\t * NOTE: PLEASE UNDERSTAND THAT ADDING A DATA LISTENER CAN\n\t * TURN THE STREAM INTO FLOWING MODE. IT IS THEREFOR THE\n\t * LAST LISTENER THAT SHOULD BE ADDED AND NOT THE FIRST\n\t *\n\t * Use `listenStream` as a helper method to listen to\n\t * stream events in the right order.\n\t */\n\ton(event: 'data', callback: (data: T) => void): void;\n\n\t/**\n\t * Emitted when any error occurs.\n\t */\n\ton(event: 'error', callback: (err: Error) => void): void;\n\n\t/**\n\t * The 'end' event is emitted when there is no more data\n\t * to be consumed from the stream. The 'end' event will\n\t * not be emitted unless the data is completely consumed.\n\t */\n\ton(event: 'end', callback: () => void): void;\n}\n\n/**\n * A interface that emulates the API shape of a node.js readable\n * stream for use in native and web environments.\n */\nexport interface ReadableStream<T> extends ReadableStreamEvents<T> {\n\n\t/**\n\t * Stops emitting any events until resume() is called.\n\t */\n\tpause(): void;\n\n\t/**\n\t * Starts emitting events again after pause() was called.\n\t */\n\tresume(): void;\n\n\t/**\n\t * Destroys the stream and stops emitting any event.\n\t */\n\tdestroy(): void;\n\n\t/**\n\t * Allows to remove a listener that was previously added.\n\t */\n\tremoveListener(event: string, callback: Function): void;\n}\n\n/**\n * A interface that emulates the API shape of a node.js readable\n * for use in native and web environments.\n */\nexport interface Readable<T> {\n\n\t/**\n\t * Read data from the underlying source. Will return\n\t * null to indicate that no more data can be read.\n\t */\n\tread(): T | null;\n}\n\nexport function isReadable<T>(obj: unknown): obj is Readable<T> {\n\tconst candidate = obj as Readable<T> | undefined;\n\tif (!candidate) {\n\t\treturn false;\n\t}\n\n\treturn typeof candidate.read === 'function';\n}\n\n/**\n * A interface that emulates the API shape of a node.js writeable\n * stream for use in native and web environments.\n */\nexport interface WriteableStream<T> extends ReadableStream<T> {\n\n\t/**\n\t * Writing data to the stream will trigger the on('data')\n\t * event listener if the stream is flowing and buffer the\n\t * data otherwise until the stream is flowing.\n\t *\n\t * If a `highWaterMark` is configured and writing to the\n\t * stream reaches this mark, a promise will be returned\n\t * that should be awaited on before writing more data.\n\t * Otherwise there is a risk of buffering a large number\n\t * of data chunks without consumer.\n\t */\n\twrite(data: T): void | Promise<void>;\n\n\t/**\n\t * Signals an error to the consumer of the stream via the\n\t * on('error') handler if the stream is flowing.\n\t *\n\t * NOTE: call `end` to signal that the stream has ended,\n\t * this DOES NOT happen automatically from `error`.\n\t */\n\terror(error: Error): void;\n\n\t/**\n\t * Signals the end of the stream to the consumer. If the\n\t * result is provided, will trigger the on('data') event\n\t * listener if the stream is flowing and buffer the data\n\t * otherwise until the stream is flowing.\n\t */\n\tend(result?: T): void;\n}\n\n/**\n * A stream that has a buffer already read. Returns the original stream\n * that was read as well as the chunks that got read.\n *\n * The `ended` flag indicates if the stream has been fully consumed.\n */\nexport interface ReadableBufferedStream<T> {\n\n\t/**\n\t * The original stream that is being read.\n\t */\n\tstream: ReadableStream<T>;\n\n\t/**\n\t * An array of chunks already read from this stream.\n\t */\n\tbuffer: T[];\n\n\t/**\n\t * Signals if the stream has ended or not. If not, consumers\n\t * should continue to read from the stream until consumed.\n\t */\n\tended: boolean;\n}\n\nexport function isReadableStream<T>(obj: unknown): obj is ReadableStream<T> {\n\tconst candidate = obj as ReadableStream<T> | undefined;\n\tif (!candidate) {\n\t\treturn false;\n\t}\n\n\treturn [candidate.on, candidate.pause, candidate.resume, candidate.destroy].every(fn => typeof fn === 'function');\n}\n\nexport function isReadableBufferedStream<T>(obj: unknown): obj is ReadableBufferedStream<T> {\n\tconst candidate = obj as ReadableBufferedStream<T> | undefined;\n\tif (!candidate) {\n\t\treturn false;\n\t}\n\n\treturn isReadableStream(candidate.stream) && Array.isArray(candidate.buffer) && typeof candidate.ended === 'boolean';\n}\n\nexport interface IReducer<T, R = T> {\n\t(data: T[]): R;\n}\n\nexport interface IDataTransformer<Original, Transformed> {\n\t(data: Original): Transformed;\n}\n\nexport interface IErrorTransformer {\n\t(error: Error): Error;\n}\n\nexport interface ITransformer<Original, Transformed> {\n\tdata: IDataTransformer<Original, Transformed>;\n\terror?: IErrorTransformer;\n}\n\nexport function newWriteableStream<T>(reducer: IReducer<T> | null, options?: WriteableStreamOptions): WriteableStream<T> {\n\treturn new WriteableStreamImpl<T>(reducer, options);\n}\n\nexport interface WriteableStreamOptions {\n\n\t/**\n\t * The number of objects to buffer before WriteableStream#write()\n\t * signals back that the buffer is full. Can be used to reduce\n\t * the memory pressure when the stream is not flowing.\n\t */\n\thighWaterMark?: number;\n}\n\nclass WriteableStreamImpl<T> implements WriteableStream<T> {\n\n\tprivate readonly state = {\n\t\tflowing: false,\n\t\tended: false,\n\t\tdestroyed: false\n\t};\n\n\tprivate readonly buffer = {\n\t\tdata: [] as T[],\n\t\terror: [] as Error[]\n\t};\n\n\tprivate readonly listeners = {\n\t\tdata: [] as { (data: T): void }[],\n\t\terror: [] as { (error: Error): void }[],\n\t\tend: [] as { (): void }[]\n\t};\n\n\tprivate readonly pendingWritePromises: Function[] = [];\n\n\t/**\n\t * @param reducer a function that reduces the buffered data into a single object;\n\t * \t\t\t\t  because some objects can be complex and non-reducible, we also\n\t * \t\t\t\t  allow passing the explicit `null` value to skip the reduce step\n\t * @param options stream options\n\t */\n\tconstructor(private reducer: IReducer<T> | null, private options?: WriteableStreamOptions) { }\n\n\tpause(): void {\n\t\tif (this.state.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.state.flowing = false;\n\t}\n\n\tresume(): void {\n\t\tif (this.state.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.state.flowing) {\n\t\t\tthis.state.flowing = true;\n\n\t\t\t// emit buffered events\n\t\t\tthis.flowData();\n\t\t\tthis.flowErrors();\n\t\t\tthis.flowEnd();\n\t\t}\n\t}\n\n\twrite(data: T): void | Promise<void> {\n\t\tif (this.state.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\t// flowing: directly send the data to listeners\n\t\tif (this.state.flowing) {\n\t\t\tthis.emitData(data);\n\t\t}\n\n\t\t// not yet flowing: buffer data until flowing\n\t\telse {\n\t\t\tthis.buffer.data.push(data);\n\n\t\t\t// highWaterMark: if configured, signal back when buffer reached limits\n\t\t\tif (typeof this.options?.highWaterMark === 'number' && this.buffer.data.length > this.options.highWaterMark) {\n\t\t\t\treturn new Promise(resolve => this.pendingWritePromises.push(resolve));\n\t\t\t}\n\t\t}\n\t}\n\n\terror(error: Error): void {\n\t\tif (this.state.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\t// flowing: directly send the error to listeners\n\t\tif (this.state.flowing) {\n\t\t\tthis.emitError(error);\n\t\t}\n\n\t\t// not yet flowing: buffer errors until flowing\n\t\telse {\n\t\t\tthis.buffer.error.push(error);\n\t\t}\n\t}\n\n\tend(result?: T): void {\n\t\tif (this.state.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\t// end with data if provided\n\t\tif (typeof result !== 'undefined') {\n\t\t\tthis.write(result);\n\t\t}\n\n\t\t// flowing: send end event to listeners\n\t\tif (this.state.flowing) {\n\t\t\tthis.emitEnd();\n\n\t\t\tthis.destroy();\n\t\t}\n\n\t\t// not yet flowing: remember state\n\t\telse {\n\t\t\tthis.state.ended = true;\n\t\t}\n\t}\n\n\tprivate emitData(data: T): void {\n\t\tthis.listeners.data.slice(0).forEach(listener => listener(data)); // slice to avoid listener mutation from delivering event\n\t}\n\n\tprivate emitError(error: Error): void {\n\t\tif (this.listeners.error.length === 0) {\n\t\t\tonUnexpectedError(error); // nobody listened to this error so we log it as unexpected\n\t\t} else {\n\t\t\tthis.listeners.error.slice(0).forEach(listener => listener(error)); // slice to avoid listener mutation from delivering event\n\t\t}\n\t}\n\n\tprivate emitEnd(): void {\n\t\tthis.listeners.end.slice(0).forEach(listener => listener()); // slice to avoid listener mutation from delivering event\n\t}\n\n\ton(event: 'data', callback: (data: T) => void): void;\n\ton(event: 'error', callback: (err: Error) => void): void;\n\ton(event: 'end', callback: () => void): void;\n\ton(event: 'data' | 'error' | 'end', callback: (arg0?: any) => void): void {\n\t\tif (this.state.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (event) {\n\t\t\tcase 'data':\n\t\t\t\tthis.listeners.data.push(callback);\n\n\t\t\t\t// switch into flowing mode as soon as the first 'data'\n\t\t\t\t// listener is added and we are not yet in flowing mode\n\t\t\t\tthis.resume();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'end':\n\t\t\t\tthis.listeners.end.push(callback);\n\n\t\t\t\t// emit 'end' event directly if we are flowing\n\t\t\t\t// and the end has already been reached\n\t\t\t\t//\n\t\t\t\t// finish() when it went through\n\t\t\t\tif (this.state.flowing && this.flowEnd()) {\n\t\t\t\t\tthis.destroy();\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'error':\n\t\t\t\tthis.listeners.error.push(callback);\n\n\t\t\t\t// emit buffered 'error' events unless done already\n\t\t\t\t// now that we know that we have at least one listener\n\t\t\t\tif (this.state.flowing) {\n\t\t\t\t\tthis.flowErrors();\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tremoveListener(event: string, callback: Function): void {\n\t\tif (this.state.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet listeners: unknown[] | undefined = undefined;\n\n\t\tswitch (event) {\n\t\t\tcase 'data':\n\t\t\t\tlisteners = this.listeners.data;\n\t\t\t\tbreak;\n\n\t\t\tcase 'end':\n\t\t\t\tlisteners = this.listeners.end;\n\t\t\t\tbreak;\n\n\t\t\tcase 'error':\n\t\t\t\tlisteners = this.listeners.error;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (listeners) {\n\t\t\tconst index = listeners.indexOf(callback);\n\t\t\tif (index >= 0) {\n\t\t\t\tlisteners.splice(index, 1);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate flowData(): void {\n\t\t// if buffer is empty, nothing to do\n\t\tif (this.buffer.data.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// if buffer data can be reduced into a single object,\n\t\t// emit the reduced data\n\t\tif (typeof this.reducer === 'function') {\n\t\t\tconst fullDataBuffer = this.reducer(this.buffer.data);\n\n\t\t\tthis.emitData(fullDataBuffer);\n\t\t} else {\n\t\t\t// otherwise emit each buffered data instance individually\n\t\t\tfor (const data of this.buffer.data) {\n\t\t\t\tthis.emitData(data);\n\t\t\t}\n\t\t}\n\n\t\tthis.buffer.data.length = 0;\n\n\t\t// when the buffer is empty, resolve all pending writers\n\t\tconst pendingWritePromises = [...this.pendingWritePromises];\n\t\tthis.pendingWritePromises.length = 0;\n\t\tpendingWritePromises.forEach(pendingWritePromise => pendingWritePromise());\n\t}\n\n\tprivate flowErrors(): void {\n\t\tif (this.listeners.error.length > 0) {\n\t\t\tfor (const error of this.buffer.error) {\n\t\t\t\tthis.emitError(error);\n\t\t\t}\n\n\t\t\tthis.buffer.error.length = 0;\n\t\t}\n\t}\n\n\tprivate flowEnd(): boolean {\n\t\tif (this.state.ended) {\n\t\t\tthis.emitEnd();\n\n\t\t\treturn this.listeners.end.length > 0;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tdestroy(): void {\n\t\tif (!this.state.destroyed) {\n\t\t\tthis.state.destroyed = true;\n\t\t\tthis.state.ended = true;\n\n\t\t\tthis.buffer.data.length = 0;\n\t\t\tthis.buffer.error.length = 0;\n\n\t\t\tthis.listeners.data.length = 0;\n\t\t\tthis.listeners.error.length = 0;\n\t\t\tthis.listeners.end.length = 0;\n\n\t\t\tthis.pendingWritePromises.length = 0;\n\t\t}\n\t}\n}\n\n/**\n * Helper to fully read a T readable into a T.\n */\nexport function consumeReadable<T>(readable: Readable<T>, reducer: IReducer<T>): T {\n\tconst chunks: T[] = [];\n\n\tlet chunk: T | null;\n\twhile ((chunk = readable.read()) !== null) {\n\t\tchunks.push(chunk);\n\t}\n\n\treturn reducer(chunks);\n}\n\n/**\n * Helper to read a T readable up to a maximum of chunks. If the limit is\n * reached, will return a readable instead to ensure all data can still\n * be read.\n */\nexport function peekReadable<T>(readable: Readable<T>, reducer: IReducer<T>, maxChunks: number): T | Readable<T> {\n\tconst chunks: T[] = [];\n\n\tlet chunk: T | null | undefined = undefined;\n\twhile ((chunk = readable.read()) !== null && chunks.length < maxChunks) {\n\t\tchunks.push(chunk);\n\t}\n\n\t// If the last chunk is null, it means we reached the end of\n\t// the readable and return all the data at once\n\tif (chunk === null && chunks.length > 0) {\n\t\treturn reducer(chunks);\n\t}\n\n\t// Otherwise, we still have a chunk, it means we reached the maxChunks\n\t// value and as such we return a new Readable that first returns\n\t// the existing read chunks and then continues with reading from\n\t// the underlying readable.\n\treturn {\n\t\tread: () => {\n\n\t\t\t// First consume chunks from our array\n\t\t\tif (chunks.length > 0) {\n\t\t\t\treturn chunks.shift()!;\n\t\t\t}\n\n\t\t\t// Then ensure to return our last read chunk\n\t\t\tif (typeof chunk !== 'undefined') {\n\t\t\t\tconst lastReadChunk = chunk;\n\n\t\t\t\t// explicitly use undefined here to indicate that we consumed\n\t\t\t\t// the chunk, which could have either been null or valued.\n\t\t\t\tchunk = undefined;\n\n\t\t\t\treturn lastReadChunk;\n\t\t\t}\n\n\t\t\t// Finally delegate back to the Readable\n\t\t\treturn readable.read();\n\t\t}\n\t};\n}\n\n/**\n * Helper to fully read a T stream into a T or consuming\n * a stream fully, awaiting all the events without caring\n * about the data.\n */\nexport function consumeStream<T, R = T>(stream: ReadableStreamEvents<T>, reducer: IReducer<T, R>): Promise<R>;\nexport function consumeStream(stream: ReadableStreamEvents<unknown>): Promise<undefined>;\nexport function consumeStream<T, R = T>(stream: ReadableStreamEvents<T>, reducer?: IReducer<T, R>): Promise<R | undefined> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst chunks: T[] = [];\n\n\t\tlistenStream(stream, {\n\t\t\tonData: chunk => {\n\t\t\t\tif (reducer) {\n\t\t\t\t\tchunks.push(chunk);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonError: error => {\n\t\t\t\tif (reducer) {\n\t\t\t\t\treject(error);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(undefined);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonEnd: () => {\n\t\t\t\tif (reducer) {\n\t\t\t\t\tresolve(reducer(chunks));\n\t\t\t\t} else {\n\t\t\t\t\tresolve(undefined);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n\nexport interface IStreamListener<T> {\n\n\t/**\n\t * The 'data' event is emitted whenever the stream is\n\t * relinquishing ownership of a chunk of data to a consumer.\n\t */\n\tonData(data: T): void;\n\n\t/**\n\t * Emitted when any error occurs.\n\t */\n\tonError(err: Error): void;\n\n\t/**\n\t * The 'end' event is emitted when there is no more data\n\t * to be consumed from the stream. The 'end' event will\n\t * not be emitted unless the data is completely consumed.\n\t */\n\tonEnd(): void;\n}\n\n/**\n * Helper to listen to all events of a T stream in proper order.\n */\nexport function listenStream<T>(stream: ReadableStreamEvents<T>, listener: IStreamListener<T>, token?: CancellationToken): void {\n\n\tstream.on('error', error => {\n\t\tif (!token?.isCancellationRequested) {\n\t\t\tlistener.onError(error);\n\t\t}\n\t});\n\n\tstream.on('end', () => {\n\t\tif (!token?.isCancellationRequested) {\n\t\t\tlistener.onEnd();\n\t\t}\n\t});\n\n\t// Adding the `data` listener will turn the stream\n\t// into flowing mode. As such it is important to\n\t// add this listener last (DO NOT CHANGE!)\n\tstream.on('data', data => {\n\t\tif (!token?.isCancellationRequested) {\n\t\t\tlistener.onData(data);\n\t\t}\n\t});\n}\n\n/**\n * Helper to peek up to `maxChunks` into a stream. The return type signals if\n * the stream has ended or not. If not, caller needs to add a `data` listener\n * to continue reading.\n */\nexport function peekStream<T>(stream: ReadableStream<T>, maxChunks: number): Promise<ReadableBufferedStream<T>> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst streamListeners = new DisposableStore();\n\t\tconst buffer: T[] = [];\n\n\t\t// Data Listener\n\t\tconst dataListener = (chunk: T) => {\n\n\t\t\t// Add to buffer\n\t\t\tbuffer.push(chunk);\n\n\t\t\t// We reached maxChunks and thus need to return\n\t\t\tif (buffer.length > maxChunks) {\n\n\t\t\t\t// Dispose any listeners and ensure to pause the\n\t\t\t\t// stream so that it can be consumed again by caller\n\t\t\t\tstreamListeners.dispose();\n\t\t\t\tstream.pause();\n\n\t\t\t\treturn resolve({ stream, buffer, ended: false });\n\t\t\t}\n\t\t};\n\n\t\t// Error Listener\n\t\tconst errorListener = (error: Error) => {\n\t\t\tstreamListeners.dispose();\n\n\t\t\treturn reject(error);\n\t\t};\n\n\t\t// End Listener\n\t\tconst endListener = () => {\n\t\t\tstreamListeners.dispose();\n\n\t\t\treturn resolve({ stream, buffer, ended: true });\n\t\t};\n\n\t\tstreamListeners.add(toDisposable(() => stream.removeListener('error', errorListener)));\n\t\tstream.on('error', errorListener);\n\n\t\tstreamListeners.add(toDisposable(() => stream.removeListener('end', endListener)));\n\t\tstream.on('end', endListener);\n\n\t\t// Important: leave the `data` listener last because\n\t\t// this can turn the stream into flowing mode and we\n\t\t// want `error` events to be received as well.\n\t\tstreamListeners.add(toDisposable(() => stream.removeListener('data', dataListener)));\n\t\tstream.on('data', dataListener);\n\t});\n}\n\n/**\n * Helper to create a readable stream from an existing T.\n */\nexport function toStream<T>(t: T, reducer: IReducer<T>): ReadableStream<T> {\n\tconst stream = newWriteableStream<T>(reducer);\n\n\tstream.end(t);\n\n\treturn stream;\n}\n\n/**\n * Helper to create an empty stream\n */\nexport function emptyStream(): ReadableStream<never> {\n\tconst stream = newWriteableStream<never>(() => { throw new Error('not supported'); });\n\tstream.end();\n\n\treturn stream;\n}\n\n/**\n * Helper to convert a T into a Readable<T>.\n */\nexport function toReadable<T>(t: T): Readable<T> {\n\tlet consumed = false;\n\n\treturn {\n\t\tread: () => {\n\t\t\tif (consumed) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconsumed = true;\n\n\t\t\treturn t;\n\t\t}\n\t};\n}\n\n/**\n * Helper to transform a readable stream into another stream.\n */\nexport function transform<Original, Transformed>(stream: ReadableStreamEvents<Original>, transformer: ITransformer<Original, Transformed>, reducer: IReducer<Transformed>): ReadableStream<Transformed> {\n\tconst target = newWriteableStream<Transformed>(reducer);\n\n\tlistenStream(stream, {\n\t\tonData: data => target.write(transformer.data(data)),\n\t\tonError: error => target.error(transformer.error ? transformer.error(error) : error),\n\t\tonEnd: () => target.end()\n\t});\n\n\treturn target;\n}\n\n/**\n * Helper to take an existing readable that will\n * have a prefix injected to the beginning.\n */\nexport function prefixedReadable<T>(prefix: T, readable: Readable<T>, reducer: IReducer<T>): Readable<T> {\n\tlet prefixHandled = false;\n\n\treturn {\n\t\tread: () => {\n\t\t\tconst chunk = readable.read();\n\n\t\t\t// Handle prefix only once\n\t\t\tif (!prefixHandled) {\n\t\t\t\tprefixHandled = true;\n\n\t\t\t\t// If we have also a read-result, make\n\t\t\t\t// sure to reduce it to a single result\n\t\t\t\tif (chunk !== null) {\n\t\t\t\t\treturn reducer([prefix, chunk]);\n\t\t\t\t}\n\n\t\t\t\t// Otherwise, just return prefix directly\n\t\t\t\treturn prefix;\n\t\t\t}\n\n\t\t\treturn chunk;\n\t\t}\n\t};\n}\n\n/**\n * Helper to take an existing stream that will\n * have a prefix injected to the beginning.\n */\nexport function prefixedStream<T>(prefix: T, stream: ReadableStream<T>, reducer: IReducer<T>): ReadableStream<T> {\n\tlet prefixHandled = false;\n\n\tconst target = newWriteableStream<T>(reducer);\n\n\tlistenStream(stream, {\n\t\tonData: data => {\n\n\t\t\t// Handle prefix only once\n\t\t\tif (!prefixHandled) {\n\t\t\t\tprefixHandled = true;\n\n\t\t\t\treturn target.write(reducer([prefix, data]));\n\t\t\t}\n\n\t\t\treturn target.write(data);\n\t\t},\n\t\tonError: error => target.error(error),\n\t\tonEnd: () => {\n\n\t\t\t// Handle prefix only once\n\t\t\tif (!prefixHandled) {\n\t\t\t\tprefixHandled = true;\n\n\t\t\t\ttarget.write(prefix);\n\t\t\t}\n\n\t\t\ttarget.end();\n\t\t}\n\t});\n\n\treturn target;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Lazy } from './lazy.js';\nimport * as streams from './stream.js';\n\ninterface NodeBuffer {\n\tallocUnsafe(size: number): Uint8Array;\n\tisBuffer(obj: any): obj is NodeBuffer;\n\tfrom(arrayBuffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;\n\tfrom(data: string): Uint8Array;\n}\n\ndeclare const Buffer: NodeBuffer;\n\nconst hasBuffer = (typeof Buffer !== 'undefined');\nconst indexOfTable = new Lazy(() => new Uint8Array(256));\n\nlet textEncoder: { encode: (input: string) => Uint8Array } | null;\nlet textDecoder: { decode: (input: Uint8Array) => string } | null;\n\nexport class VSBuffer {\n\n\t/**\n\t * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n\t * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n\t */\n\tstatic alloc(byteLength: number): VSBuffer {\n\t\tif (hasBuffer) {\n\t\t\treturn new VSBuffer(Buffer.allocUnsafe(byteLength));\n\t\t} else {\n\t\t\treturn new VSBuffer(new Uint8Array(byteLength));\n\t\t}\n\t}\n\n\t/**\n\t * When running in a nodejs context, if `actual` is not a nodejs Buffer, the backing store for\n\t * the returned `VSBuffer` instance might use a nodejs Buffer allocated from node's Buffer pool,\n\t * which is not transferrable.\n\t */\n\tstatic wrap(actual: Uint8Array): VSBuffer {\n\t\tif (hasBuffer && !(Buffer.isBuffer(actual))) {\n\t\t\t// https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length\n\t\t\t// Create a zero-copy Buffer wrapper around the ArrayBuffer pointed to by the Uint8Array\n\t\t\tactual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength);\n\t\t}\n\t\treturn new VSBuffer(actual);\n\t}\n\n\t/**\n\t * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n\t * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n\t */\n\tstatic fromString(source: string, options?: { dontUseNodeBuffer?: boolean }): VSBuffer {\n\t\tconst dontUseNodeBuffer = options?.dontUseNodeBuffer || false;\n\t\tif (!dontUseNodeBuffer && hasBuffer) {\n\t\t\treturn new VSBuffer(Buffer.from(source));\n\t\t} else {\n\t\t\tif (!textEncoder) {\n\t\t\t\ttextEncoder = new TextEncoder();\n\t\t\t}\n\t\t\treturn new VSBuffer(textEncoder.encode(source));\n\t\t}\n\t}\n\n\t/**\n\t * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n\t * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n\t */\n\tstatic fromByteArray(source: number[]): VSBuffer {\n\t\tconst result = VSBuffer.alloc(source.length);\n\t\tfor (let i = 0, len = source.length; i < len; i++) {\n\t\t\tresult.buffer[i] = source[i];\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n\t * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n\t */\n\tstatic concat(buffers: VSBuffer[], totalLength?: number): VSBuffer {\n\t\tif (typeof totalLength === 'undefined') {\n\t\t\ttotalLength = 0;\n\t\t\tfor (let i = 0, len = buffers.length; i < len; i++) {\n\t\t\t\ttotalLength += buffers[i].byteLength;\n\t\t\t}\n\t\t}\n\n\t\tconst ret = VSBuffer.alloc(totalLength);\n\t\tlet offset = 0;\n\t\tfor (let i = 0, len = buffers.length; i < len; i++) {\n\t\t\tconst element = buffers[i];\n\t\t\tret.set(element, offset);\n\t\t\toffset += element.byteLength;\n\t\t}\n\n\t\treturn ret;\n\t}\n\n\tstatic isNativeBuffer(buffer: unknown): boolean {\n\t\treturn hasBuffer && Buffer.isBuffer(buffer);\n\t}\n\n\treadonly buffer: Uint8Array;\n\treadonly byteLength: number;\n\n\tprivate constructor(buffer: Uint8Array) {\n\t\tthis.buffer = buffer;\n\t\tthis.byteLength = this.buffer.byteLength;\n\t}\n\n\t/**\n\t * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n\t * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n\t */\n\tclone(): VSBuffer {\n\t\tconst result = VSBuffer.alloc(this.byteLength);\n\t\tresult.set(this);\n\t\treturn result;\n\t}\n\n\ttoString(): string {\n\t\tif (hasBuffer) {\n\t\t\treturn this.buffer.toString();\n\t\t} else {\n\t\t\tif (!textDecoder) {\n\t\t\t\ttextDecoder = new TextDecoder();\n\t\t\t}\n\t\t\treturn textDecoder.decode(this.buffer);\n\t\t}\n\t}\n\n\tslice(start?: number, end?: number): VSBuffer {\n\t\t// IMPORTANT: use subarray instead of slice because TypedArray#slice\n\t\t// creates shallow copy and NodeBuffer#slice doesn't. The use of subarray\n\t\t// ensures the same, performance, behaviour.\n\t\treturn new VSBuffer(this.buffer.subarray(start, end));\n\t}\n\n\tset(array: VSBuffer, offset?: number): void;\n\tset(array: Uint8Array, offset?: number): void;\n\tset(array: ArrayBuffer, offset?: number): void;\n\tset(array: ArrayBufferView, offset?: number): void;\n\tset(array: VSBuffer | Uint8Array | ArrayBuffer | ArrayBufferView, offset?: number): void;\n\tset(array: VSBuffer | Uint8Array | ArrayBuffer | ArrayBufferView, offset?: number): void {\n\t\tif (array instanceof VSBuffer) {\n\t\t\tthis.buffer.set(array.buffer, offset);\n\t\t} else if (array instanceof Uint8Array) {\n\t\t\tthis.buffer.set(array, offset);\n\t\t} else if (array instanceof ArrayBuffer) {\n\t\t\tthis.buffer.set(new Uint8Array(array), offset);\n\t\t} else if (ArrayBuffer.isView(array)) {\n\t\t\tthis.buffer.set(new Uint8Array(array.buffer, array.byteOffset, array.byteLength), offset);\n\t\t} else {\n\t\t\tthrow new Error(`Unknown argument 'array'`);\n\t\t}\n\t}\n\n\treadUInt32BE(offset: number): number {\n\t\treturn readUInt32BE(this.buffer, offset);\n\t}\n\n\twriteUInt32BE(value: number, offset: number): void {\n\t\twriteUInt32BE(this.buffer, value, offset);\n\t}\n\n\treadUInt32LE(offset: number): number {\n\t\treturn readUInt32LE(this.buffer, offset);\n\t}\n\n\twriteUInt32LE(value: number, offset: number): void {\n\t\twriteUInt32LE(this.buffer, value, offset);\n\t}\n\n\treadUInt8(offset: number): number {\n\t\treturn readUInt8(this.buffer, offset);\n\t}\n\n\twriteUInt8(value: number, offset: number): void {\n\t\twriteUInt8(this.buffer, value, offset);\n\t}\n\n\tindexOf(subarray: VSBuffer | Uint8Array, offset = 0) {\n\t\treturn binaryIndexOf(this.buffer, subarray instanceof VSBuffer ? subarray.buffer : subarray, offset);\n\t}\n\n\tequals(other: VSBuffer): boolean {\n\t\tif (this === other) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.byteLength !== other.byteLength) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.buffer.every((value, index) => value === other.buffer[index]);\n\t}\n}\n\n/**\n * Like String.indexOf, but works on Uint8Arrays.\n * Uses the boyer-moore-horspool algorithm to be reasonably speedy.\n */\nexport function binaryIndexOf(haystack: Uint8Array, needle: Uint8Array, offset = 0): number {\n\tconst needleLen = needle.byteLength;\n\tconst haystackLen = haystack.byteLength;\n\n\tif (needleLen === 0) {\n\t\treturn 0;\n\t}\n\n\tif (needleLen === 1) {\n\t\treturn haystack.indexOf(needle[0]);\n\t}\n\n\tif (needleLen > haystackLen - offset) {\n\t\treturn -1;\n\t}\n\n\t// find index of the subarray using boyer-moore-horspool algorithm\n\tconst table = indexOfTable.value;\n\ttable.fill(needle.length);\n\tfor (let i = 0; i < needle.length; i++) {\n\t\ttable[needle[i]] = needle.length - i - 1;\n\t}\n\n\tlet i = offset + needle.length - 1;\n\tlet j = i;\n\tlet result = -1;\n\twhile (i < haystackLen) {\n\t\tif (haystack[i] === needle[j]) {\n\t\t\tif (j === 0) {\n\t\t\t\tresult = i;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\ti--;\n\t\t\tj--;\n\t\t} else {\n\t\t\ti += Math.max(needle.length - j, table[haystack[i]]);\n\t\t\tj = needle.length - 1;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function readUInt16LE(source: Uint8Array, offset: number): number {\n\treturn (\n\t\t((source[offset + 0] << 0) >>> 0) |\n\t\t((source[offset + 1] << 8) >>> 0)\n\t);\n}\n\nexport function writeUInt16LE(destination: Uint8Array, value: number, offset: number): void {\n\tdestination[offset + 0] = (value & 0b11111111);\n\tvalue = value >>> 8;\n\tdestination[offset + 1] = (value & 0b11111111);\n}\n\nexport function readUInt32BE(source: Uint8Array, offset: number): number {\n\treturn (\n\t\tsource[offset] * 2 ** 24\n\t\t+ source[offset + 1] * 2 ** 16\n\t\t+ source[offset + 2] * 2 ** 8\n\t\t+ source[offset + 3]\n\t);\n}\n\nexport function writeUInt32BE(destination: Uint8Array, value: number, offset: number): void {\n\tdestination[offset + 3] = value;\n\tvalue = value >>> 8;\n\tdestination[offset + 2] = value;\n\tvalue = value >>> 8;\n\tdestination[offset + 1] = value;\n\tvalue = value >>> 8;\n\tdestination[offset] = value;\n}\n\nexport function readUInt32LE(source: Uint8Array, offset: number): number {\n\treturn (\n\t\t((source[offset + 0] << 0) >>> 0) |\n\t\t((source[offset + 1] << 8) >>> 0) |\n\t\t((source[offset + 2] << 16) >>> 0) |\n\t\t((source[offset + 3] << 24) >>> 0)\n\t);\n}\n\nexport function writeUInt32LE(destination: Uint8Array, value: number, offset: number): void {\n\tdestination[offset + 0] = (value & 0b11111111);\n\tvalue = value >>> 8;\n\tdestination[offset + 1] = (value & 0b11111111);\n\tvalue = value >>> 8;\n\tdestination[offset + 2] = (value & 0b11111111);\n\tvalue = value >>> 8;\n\tdestination[offset + 3] = (value & 0b11111111);\n}\n\nexport function readUInt8(source: Uint8Array, offset: number): number {\n\treturn source[offset];\n}\n\nexport function writeUInt8(destination: Uint8Array, value: number, offset: number): void {\n\tdestination[offset] = value;\n}\n\nexport interface VSBufferReadable extends streams.Readable<VSBuffer> { }\n\nexport interface VSBufferReadableStream extends streams.ReadableStream<VSBuffer> { }\n\nexport interface VSBufferWriteableStream extends streams.WriteableStream<VSBuffer> { }\n\nexport interface VSBufferReadableBufferedStream extends streams.ReadableBufferedStream<VSBuffer> { }\n\nexport function readableToBuffer(readable: VSBufferReadable): VSBuffer {\n\treturn streams.consumeReadable<VSBuffer>(readable, chunks => VSBuffer.concat(chunks));\n}\n\nexport function bufferToReadable(buffer: VSBuffer): VSBufferReadable {\n\treturn streams.toReadable<VSBuffer>(buffer);\n}\n\nexport function streamToBuffer(stream: streams.ReadableStream<VSBuffer>): Promise<VSBuffer> {\n\treturn streams.consumeStream<VSBuffer>(stream, chunks => VSBuffer.concat(chunks));\n}\n\nexport async function bufferedStreamToBuffer(bufferedStream: streams.ReadableBufferedStream<VSBuffer>): Promise<VSBuffer> {\n\tif (bufferedStream.ended) {\n\t\treturn VSBuffer.concat(bufferedStream.buffer);\n\t}\n\n\treturn VSBuffer.concat([\n\n\t\t// Include already read chunks...\n\t\t...bufferedStream.buffer,\n\n\t\t// ...and all additional chunks\n\t\tawait streamToBuffer(bufferedStream.stream)\n\t]);\n}\n\nexport function bufferToStream(buffer: VSBuffer): streams.ReadableStream<VSBuffer> {\n\treturn streams.toStream<VSBuffer>(buffer, chunks => VSBuffer.concat(chunks));\n}\n\nexport function streamToBufferReadableStream(stream: streams.ReadableStreamEvents<Uint8Array | string>): streams.ReadableStream<VSBuffer> {\n\treturn streams.transform<Uint8Array | string, VSBuffer>(stream, { data: data => typeof data === 'string' ? VSBuffer.fromString(data) : VSBuffer.wrap(data) }, chunks => VSBuffer.concat(chunks));\n}\n\nexport function newWriteableBufferStream(options?: streams.WriteableStreamOptions): streams.WriteableStream<VSBuffer> {\n\treturn streams.newWriteableStream<VSBuffer>(chunks => VSBuffer.concat(chunks), options);\n}\n\nexport function prefixedBufferReadable(prefix: VSBuffer, readable: VSBufferReadable): VSBufferReadable {\n\treturn streams.prefixedReadable(prefix, readable, chunks => VSBuffer.concat(chunks));\n}\n\nexport function prefixedBufferStream(prefix: VSBuffer, stream: VSBufferReadableStream): VSBufferReadableStream {\n\treturn streams.prefixedStream(prefix, stream, chunks => VSBuffer.concat(chunks));\n}\n\n/** Decodes base64 to a uint8 array. URL-encoded and unpadded base64 is allowed. */\nexport function decodeBase64(encoded: string) {\n\tlet building = 0;\n\tlet remainder = 0;\n\tlet bufi = 0;\n\n\t// The simpler way to do this is `Uint8Array.from(atob(str), c => c.charCodeAt(0))`,\n\t// but that's about 10-20x slower than this function in current Chromium versions.\n\n\tconst buffer = new Uint8Array(Math.floor(encoded.length / 4 * 3));\n\tconst append = (value: number) => {\n\t\tswitch (remainder) {\n\t\t\tcase 3:\n\t\t\t\tbuffer[bufi++] = building | value;\n\t\t\t\tremainder = 0;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tbuffer[bufi++] = building | (value >>> 2);\n\t\t\t\tbuilding = value << 6;\n\t\t\t\tremainder = 3;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tbuffer[bufi++] = building | (value >>> 4);\n\t\t\t\tbuilding = value << 4;\n\t\t\t\tremainder = 2;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbuilding = value << 2;\n\t\t\t\tremainder = 1;\n\t\t}\n\t};\n\n\tfor (let i = 0; i < encoded.length; i++) {\n\t\tconst code = encoded.charCodeAt(i);\n\t\t// See https://datatracker.ietf.org/doc/html/rfc4648#section-4\n\t\t// This branchy code is about 3x faster than an indexOf on a base64 char string.\n\t\tif (code >= 65 && code <= 90) {\n\t\t\tappend(code - 65); // A-Z starts ranges from char code 65 to 90\n\t\t} else if (code >= 97 && code <= 122) {\n\t\t\tappend(code - 97 + 26); // a-z starts ranges from char code 97 to 122, starting at byte 26\n\t\t} else if (code >= 48 && code <= 57) {\n\t\t\tappend(code - 48 + 52); // 0-9 starts ranges from char code 48 to 58, starting at byte 52\n\t\t} else if (code === 43 || code === 45) {\n\t\t\tappend(62); // \"+\" or \"-\" for URLS\n\t\t} else if (code === 47 || code === 95) {\n\t\t\tappend(63); // \"/\" or \"_\" for URLS\n\t\t} else if (code === 61) {\n\t\t\tbreak; // \"=\"\n\t\t} else {\n\t\t\tthrow new SyntaxError(`Unexpected base64 character ${encoded[i]}`);\n\t\t}\n\t}\n\n\tconst unpadded = bufi;\n\twhile (remainder > 0) {\n\t\tappend(0);\n\t}\n\n\t// slice is needed to account for overestimation due to padding\n\treturn VSBuffer.wrap(buffer).slice(0, unpadded);\n}\n\nconst base64Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst base64UrlSafeAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';\n\n/** Encodes a buffer to a base64 string. */\nexport function encodeBase64({ buffer }: VSBuffer, padded = true, urlSafe = false) {\n\tconst dictionary = urlSafe ? base64UrlSafeAlphabet : base64Alphabet;\n\tlet output = '';\n\n\tconst remainder = buffer.byteLength % 3;\n\n\tlet i = 0;\n\tfor (; i < buffer.byteLength - remainder; i += 3) {\n\t\tconst a = buffer[i + 0];\n\t\tconst b = buffer[i + 1];\n\t\tconst c = buffer[i + 2];\n\n\t\toutput += dictionary[a >>> 2];\n\t\toutput += dictionary[(a << 4 | b >>> 4) & 0b111111];\n\t\toutput += dictionary[(b << 2 | c >>> 6) & 0b111111];\n\t\toutput += dictionary[c & 0b111111];\n\t}\n\n\tif (remainder === 1) {\n\t\tconst a = buffer[i + 0];\n\t\toutput += dictionary[a >>> 2];\n\t\toutput += dictionary[(a << 4) & 0b111111];\n\t\tif (padded) { output += '=='; }\n\t} else if (remainder === 2) {\n\t\tconst a = buffer[i + 0];\n\t\tconst b = buffer[i + 1];\n\t\toutput += dictionary[a >>> 2];\n\t\toutput += dictionary[(a << 4 | b >>> 4) & 0b111111];\n\t\toutput += dictionary[(b << 2) & 0b111111];\n\t\tif (padded) { output += '='; }\n\t}\n\n\treturn output;\n}\n\nconst hexChars = '0123456789abcdef';\nexport function encodeHex({ buffer }: VSBuffer): string {\n\tlet result = '';\n\tfor (let i = 0; i < buffer.length; i++) {\n\t\tconst byte = buffer[i];\n\t\tresult += hexChars[byte >>> 4];\n\t\tresult += hexChars[byte & 0x0f];\n\t}\n\treturn result;\n}\n\nexport function decodeHex(hex: string): VSBuffer {\n\tif (hex.length % 2 !== 0) {\n\t\tthrow new SyntaxError('Hex string must have an even length');\n\t}\n\tconst out = new Uint8Array(hex.length >> 1);\n\tfor (let i = 0; i < hex.length;) {\n\t\tout[i >> 1] = (decodeHexChar(hex, i++) << 4) | decodeHexChar(hex, i++);\n\t}\n\treturn VSBuffer.wrap(out);\n}\n\nfunction decodeHexChar(str: string, position: number) {\n\tconst s = str.charCodeAt(position);\n\tif (s >= 48 && s <= 57) { // '0'-'9'\n\t\treturn s - 48;\n\t} else if (s >= 97 && s <= 102) { // 'a'-'f'\n\t\treturn s - 87;\n\t} else if (s >= 65 && s <= 70) { // 'A'-'F'\n\t\treturn s - 55;\n\t} else {\n\t\tthrow new SyntaxError(`Invalid hex character at position ${position}`);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { encodeHex, VSBuffer } from './buffer.js';\nimport * as strings from './strings.js';\n\ntype NotSyncHashable = ArrayBufferLike | ArrayBufferView;\n\n/**\n * Return a hash value for an object.\n *\n * Note that this should not be used for binary data types. Instead,\n * prefer {@link hashAsync}.\n */\nexport function hash<T>(obj: T extends NotSyncHashable ? never : T): number {\n\treturn doHash(obj, 0);\n}\n\nexport function doHash(obj: unknown, hashVal: number): number {\n\tswitch (typeof obj) {\n\t\tcase 'object':\n\t\t\tif (obj === null) {\n\t\t\t\treturn numberHash(349, hashVal);\n\t\t\t} else if (Array.isArray(obj)) {\n\t\t\t\treturn arrayHash(obj, hashVal);\n\t\t\t}\n\t\t\treturn objectHash(obj, hashVal);\n\t\tcase 'string':\n\t\t\treturn stringHash(obj, hashVal);\n\t\tcase 'boolean':\n\t\t\treturn booleanHash(obj, hashVal);\n\t\tcase 'number':\n\t\t\treturn numberHash(obj, hashVal);\n\t\tcase 'undefined':\n\t\t\treturn numberHash(937, hashVal);\n\t\tdefault:\n\t\t\treturn numberHash(617, hashVal);\n\t}\n}\n\nexport function numberHash(val: number, initialHashVal: number): number {\n\treturn (((initialHashVal << 5) - initialHashVal) + val) | 0;  // hashVal * 31 + ch, keep as int32\n}\n\nfunction booleanHash(b: boolean, initialHashVal: number): number {\n\treturn numberHash(b ? 433 : 863, initialHashVal);\n}\n\nexport function stringHash(s: string, hashVal: number) {\n\thashVal = numberHash(149417, hashVal);\n\tfor (let i = 0, length = s.length; i < length; i++) {\n\t\thashVal = numberHash(s.charCodeAt(i), hashVal);\n\t}\n\treturn hashVal;\n}\n\nfunction arrayHash(arr: any[], initialHashVal: number): number {\n\tinitialHashVal = numberHash(104579, initialHashVal);\n\treturn arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\n}\n\nfunction objectHash(obj: any, initialHashVal: number): number {\n\tinitialHashVal = numberHash(181387, initialHashVal);\n\treturn Object.keys(obj).sort().reduce((hashVal, key) => {\n\t\thashVal = stringHash(key, hashVal);\n\t\treturn doHash(obj[key], hashVal);\n\t}, initialHashVal);\n}\n\n\n\n/** Hashes the input as SHA-1, returning a hex-encoded string. */\nexport const hashAsync = (input: string | ArrayBufferView | VSBuffer) => {\n\t// Note: I would very much like to expose a streaming interface for hashing\n\t// generally, but this is not available in web crypto yet, see\n\t// https://github.com/w3c/webcrypto/issues/73\n\n\t// StringSHA1 is faster for small string input, use it since we have it:\n\tif (typeof input === 'string' && input.length < 250) {\n\t\tconst sha = new StringSHA1();\n\t\tsha.update(input);\n\t\treturn Promise.resolve(sha.digest());\n\t}\n\n\tlet buff: ArrayBufferView;\n\tif (typeof input === 'string') {\n\t\tbuff = new TextEncoder().encode(input);\n\t} else if (input instanceof VSBuffer) {\n\t\tbuff = input.buffer;\n\t} else {\n\t\tbuff = input;\n\t}\n\n\treturn crypto.subtle.digest('sha-1', buff as ArrayBufferView<ArrayBuffer>).then(toHexString); // CodeQL [SM04514] we use sha1 here for validating old stored client state, not for security\n};\n\nconst enum SHA1Constant {\n\tBLOCK_SIZE = 64, // 512 / 8\n\tUNICODE_REPLACEMENT = 0xFFFD,\n}\n\nfunction leftRotate(value: number, bits: number, totalBits: number = 32): number {\n\t// delta + bits = totalBits\n\tconst delta = totalBits - bits;\n\n\t// All ones, expect `delta` zeros aligned to the right\n\tconst mask = ~((1 << delta) - 1);\n\n\t// Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\n\treturn ((value << bits) | ((mask & value) >>> delta)) >>> 0;\n}\n\nfunction toHexString(buffer: ArrayBuffer): string;\nfunction toHexString(value: number, bitsize?: number): string;\nfunction toHexString(bufferOrValue: ArrayBuffer | number, bitsize: number = 32): string {\n\tif (bufferOrValue instanceof ArrayBuffer) {\n\t\treturn encodeHex(VSBuffer.wrap(new Uint8Array(bufferOrValue)));\n\t}\n\n\treturn (bufferOrValue >>> 0).toString(16).padStart(bitsize / 4, '0');\n}\n\n/**\n * A SHA1 implementation that works with strings and does not allocate.\n *\n * Prefer to use {@link hashAsync} in async contexts\n */\nexport class StringSHA1 {\n\tprivate static _bigBlock32 = new DataView(new ArrayBuffer(320)); // 80 * 4 = 320\n\n\tprivate _h0 = 0x67452301;\n\tprivate _h1 = 0xEFCDAB89;\n\tprivate _h2 = 0x98BADCFE;\n\tprivate _h3 = 0x10325476;\n\tprivate _h4 = 0xC3D2E1F0;\n\n\tprivate readonly _buff: Uint8Array;\n\tprivate readonly _buffDV: DataView;\n\tprivate _buffLen: number;\n\tprivate _totalLen: number;\n\tprivate _leftoverHighSurrogate: number;\n\tprivate _finished: boolean;\n\n\tconstructor() {\n\t\tthis._buff = new Uint8Array(SHA1Constant.BLOCK_SIZE + 3 /* to fit any utf-8 */);\n\t\tthis._buffDV = new DataView(this._buff.buffer);\n\t\tthis._buffLen = 0;\n\t\tthis._totalLen = 0;\n\t\tthis._leftoverHighSurrogate = 0;\n\t\tthis._finished = false;\n\t}\n\n\tpublic update(str: string): void {\n\t\tconst strLen = str.length;\n\t\tif (strLen === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst buff = this._buff;\n\t\tlet buffLen = this._buffLen;\n\t\tlet leftoverHighSurrogate = this._leftoverHighSurrogate;\n\t\tlet charCode: number;\n\t\tlet offset: number;\n\n\t\tif (leftoverHighSurrogate !== 0) {\n\t\t\tcharCode = leftoverHighSurrogate;\n\t\t\toffset = -1;\n\t\t\tleftoverHighSurrogate = 0;\n\t\t} else {\n\t\t\tcharCode = str.charCodeAt(0);\n\t\t\toffset = 0;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tlet codePoint = charCode;\n\t\t\tif (strings.isHighSurrogate(charCode)) {\n\t\t\t\tif (offset + 1 < strLen) {\n\t\t\t\t\tconst nextCharCode = str.charCodeAt(offset + 1);\n\t\t\t\t\tif (strings.isLowSurrogate(nextCharCode)) {\n\t\t\t\t\t\toffset++;\n\t\t\t\t\t\tcodePoint = strings.computeCodePoint(charCode, nextCharCode);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// illegal => unicode replacement character\n\t\t\t\t\t\tcodePoint = SHA1Constant.UNICODE_REPLACEMENT;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// last character is a surrogate pair\n\t\t\t\t\tleftoverHighSurrogate = charCode;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (strings.isLowSurrogate(charCode)) {\n\t\t\t\t// illegal => unicode replacement character\n\t\t\t\tcodePoint = SHA1Constant.UNICODE_REPLACEMENT;\n\t\t\t}\n\n\t\t\tbuffLen = this._push(buff, buffLen, codePoint);\n\t\t\toffset++;\n\t\t\tif (offset < strLen) {\n\t\t\t\tcharCode = str.charCodeAt(offset);\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._buffLen = buffLen;\n\t\tthis._leftoverHighSurrogate = leftoverHighSurrogate;\n\t}\n\n\tprivate _push(buff: Uint8Array, buffLen: number, codePoint: number): number {\n\t\tif (codePoint < 0x0080) {\n\t\t\tbuff[buffLen++] = codePoint;\n\t\t} else if (codePoint < 0x0800) {\n\t\t\tbuff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t} else if (codePoint < 0x10000) {\n\t\t\tbuff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t} else {\n\t\t\tbuff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t}\n\n\t\tif (buffLen >= SHA1Constant.BLOCK_SIZE) {\n\t\t\tthis._step();\n\t\t\tbuffLen -= SHA1Constant.BLOCK_SIZE;\n\t\t\tthis._totalLen += SHA1Constant.BLOCK_SIZE;\n\t\t\t// take last 3 in case of UTF8 overflow\n\t\t\tbuff[0] = buff[SHA1Constant.BLOCK_SIZE + 0];\n\t\t\tbuff[1] = buff[SHA1Constant.BLOCK_SIZE + 1];\n\t\t\tbuff[2] = buff[SHA1Constant.BLOCK_SIZE + 2];\n\t\t}\n\n\t\treturn buffLen;\n\t}\n\n\tpublic digest(): string {\n\t\tif (!this._finished) {\n\t\t\tthis._finished = true;\n\t\t\tif (this._leftoverHighSurrogate) {\n\t\t\t\t// illegal => unicode replacement character\n\t\t\t\tthis._leftoverHighSurrogate = 0;\n\t\t\t\tthis._buffLen = this._push(this._buff, this._buffLen, SHA1Constant.UNICODE_REPLACEMENT);\n\t\t\t}\n\t\t\tthis._totalLen += this._buffLen;\n\t\t\tthis._wrapUp();\n\t\t}\n\n\t\treturn toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\n\t}\n\n\tprivate _wrapUp(): void {\n\t\tthis._buff[this._buffLen++] = 0x80;\n\t\tthis._buff.subarray(this._buffLen).fill(0);\n\n\t\tif (this._buffLen > 56) {\n\t\t\tthis._step();\n\t\t\tthis._buff.fill(0);\n\t\t}\n\n\t\t// this will fit because the mantissa can cover up to 52 bits\n\t\tconst ml = 8 * this._totalLen;\n\n\t\tthis._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\n\t\tthis._buffDV.setUint32(60, ml % 4294967296, false);\n\n\t\tthis._step();\n\t}\n\n\tprivate _step(): void {\n\t\tconst bigBlock32 = StringSHA1._bigBlock32;\n\t\tconst data = this._buffDV;\n\n\t\tfor (let j = 0; j < 64 /* 16*4 */; j += 4) {\n\t\t\tbigBlock32.setUint32(j, data.getUint32(j, false), false);\n\t\t}\n\n\t\tfor (let j = 64; j < 320 /* 80*4 */; j += 4) {\n\t\t\tbigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false);\n\t\t}\n\n\t\tlet a = this._h0;\n\t\tlet b = this._h1;\n\t\tlet c = this._h2;\n\t\tlet d = this._h3;\n\t\tlet e = this._h4;\n\n\t\tlet f: number, k: number;\n\t\tlet temp: number;\n\n\t\tfor (let j = 0; j < 80; j++) {\n\t\t\tif (j < 20) {\n\t\t\t\tf = (b & c) | ((~b) & d);\n\t\t\t\tk = 0x5A827999;\n\t\t\t} else if (j < 40) {\n\t\t\t\tf = b ^ c ^ d;\n\t\t\t\tk = 0x6ED9EBA1;\n\t\t\t} else if (j < 60) {\n\t\t\t\tf = (b & c) | (b & d) | (c & d);\n\t\t\t\tk = 0x8F1BBCDC;\n\t\t\t} else {\n\t\t\t\tf = b ^ c ^ d;\n\t\t\t\tk = 0xCA62C1D6;\n\t\t\t}\n\n\t\t\ttemp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\n\t\t\te = d;\n\t\t\td = c;\n\t\t\tc = leftRotate(b, 30);\n\t\t\tb = a;\n\t\t\ta = temp;\n\t\t}\n\n\t\tthis._h0 = (this._h0 + a) & 0xffffffff;\n\t\tthis._h1 = (this._h1 + b) & 0xffffffff;\n\t\tthis._h2 = (this._h2 + c) & 0xffffffff;\n\t\tthis._h3 = (this._h3 + d) & 0xffffffff;\n\t\tthis._h4 = (this._h4 + e) & 0xffffffff;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from '../../../base/common/charCode.js';\nimport { illegalState } from '../../../base/common/errors.js';\nimport { localize } from '../../../nls.js';\n\nexport const enum TokenType {\n\tLParen,\n\tRParen,\n\tNeg,\n\tEq,\n\tNotEq,\n\tLt,\n\tLtEq,\n\tGt,\n\tGtEq,\n\tRegexOp,\n\tRegexStr,\n\tTrue,\n\tFalse,\n\tIn,\n\tNot,\n\tAnd,\n\tOr,\n\tStr,\n\tQuotedStr,\n\tError,\n\tEOF,\n}\n\nexport type Token =\n\t| { type: TokenType.LParen; offset: number }\n\t| { type: TokenType.RParen; offset: number }\n\t| { type: TokenType.Neg; offset: number }\n\t| { type: TokenType.Eq; offset: number; isTripleEq: boolean }\n\t| { type: TokenType.NotEq; offset: number; isTripleEq: boolean }\n\t| { type: TokenType.Lt; offset: number }\n\t| { type: TokenType.LtEq; offset: number }\n\t| { type: TokenType.Gt; offset: number }\n\t| { type: TokenType.GtEq; offset: number }\n\t| { type: TokenType.RegexOp; offset: number }\n\t| { type: TokenType.RegexStr; offset: number; lexeme: string }\n\t| { type: TokenType.True; offset: number }\n\t| { type: TokenType.False; offset: number }\n\t| { type: TokenType.In; offset: number }\n\t| { type: TokenType.Not; offset: number }\n\t| { type: TokenType.And; offset: number }\n\t| { type: TokenType.Or; offset: number }\n\t| { type: TokenType.Str; offset: number; lexeme: string }\n\t| { type: TokenType.QuotedStr; offset: number; lexeme: string }\n\t| { type: TokenType.Error; offset: number; lexeme: string }\n\t| { type: TokenType.EOF; offset: number };\n\ntype KeywordTokenType = TokenType.Not | TokenType.In | TokenType.False | TokenType.True;\ntype TokenTypeWithoutLexeme =\n\tTokenType.LParen |\n\tTokenType.RParen |\n\tTokenType.Neg |\n\tTokenType.Lt |\n\tTokenType.LtEq |\n\tTokenType.Gt |\n\tTokenType.GtEq |\n\tTokenType.RegexOp |\n\tTokenType.True |\n\tTokenType.False |\n\tTokenType.In |\n\tTokenType.Not |\n\tTokenType.And |\n\tTokenType.Or |\n\tTokenType.EOF;\n\n/**\n * Example:\n * `foo == bar'` - note how single quote doesn't have a corresponding closing quote,\n * so it's reported as unexpected\n */\nexport type LexingError = {\n\toffset: number; /** note that this doesn't take into account escape characters from the original encoding of the string, e.g., within an extension manifest file's JSON encoding  */\n\tlexeme: string;\n\tadditionalInfo?: string;\n};\n\nfunction hintDidYouMean(...meant: string[]) {\n\tswitch (meant.length) {\n\t\tcase 1:\n\t\t\treturn localize('contextkey.scanner.hint.didYouMean1', \"Did you mean {0}?\", meant[0]);\n\t\tcase 2:\n\t\t\treturn localize('contextkey.scanner.hint.didYouMean2', \"Did you mean {0} or {1}?\", meant[0], meant[1]);\n\t\tcase 3:\n\t\t\treturn localize('contextkey.scanner.hint.didYouMean3', \"Did you mean {0}, {1} or {2}?\", meant[0], meant[1], meant[2]);\n\t\tdefault: // we just don't expect that many\n\t\t\treturn undefined;\n\t}\n}\n\nconst hintDidYouForgetToOpenOrCloseQuote = localize('contextkey.scanner.hint.didYouForgetToOpenOrCloseQuote', \"Did you forget to open or close the quote?\");\nconst hintDidYouForgetToEscapeSlash = localize('contextkey.scanner.hint.didYouForgetToEscapeSlash', \"Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\\\\\/\\'.\");\n\n/**\n * A simple scanner for context keys.\n *\n * Example:\n *\n * ```ts\n * const scanner = new Scanner().reset('resourceFileName =~ /docker/ && !config.docker.enabled');\n * const tokens = [...scanner];\n * if (scanner.errorTokens.length > 0) {\n *     scanner.errorTokens.forEach(err => console.error(`Unexpected token at ${err.offset}: ${err.lexeme}\\nHint: ${err.additional}`));\n * } else {\n *     // process tokens\n * }\n * ```\n */\nexport class Scanner {\n\n\tstatic getLexeme(token: Token): string {\n\t\tswitch (token.type) {\n\t\t\tcase TokenType.LParen:\n\t\t\t\treturn '(';\n\t\t\tcase TokenType.RParen:\n\t\t\t\treturn ')';\n\t\t\tcase TokenType.Neg:\n\t\t\t\treturn '!';\n\t\t\tcase TokenType.Eq:\n\t\t\t\treturn token.isTripleEq ? '===' : '==';\n\t\t\tcase TokenType.NotEq:\n\t\t\t\treturn token.isTripleEq ? '!==' : '!=';\n\t\t\tcase TokenType.Lt:\n\t\t\t\treturn '<';\n\t\t\tcase TokenType.LtEq:\n\t\t\t\treturn '<=';\n\t\t\tcase TokenType.Gt:\n\t\t\t\treturn '>=';\n\t\t\tcase TokenType.GtEq:\n\t\t\t\treturn '>=';\n\t\t\tcase TokenType.RegexOp:\n\t\t\t\treturn '=~';\n\t\t\tcase TokenType.RegexStr:\n\t\t\t\treturn token.lexeme;\n\t\t\tcase TokenType.True:\n\t\t\t\treturn 'true';\n\t\t\tcase TokenType.False:\n\t\t\t\treturn 'false';\n\t\t\tcase TokenType.In:\n\t\t\t\treturn 'in';\n\t\t\tcase TokenType.Not:\n\t\t\t\treturn 'not';\n\t\t\tcase TokenType.And:\n\t\t\t\treturn '&&';\n\t\t\tcase TokenType.Or:\n\t\t\t\treturn '||';\n\t\t\tcase TokenType.Str:\n\t\t\t\treturn token.lexeme;\n\t\t\tcase TokenType.QuotedStr:\n\t\t\t\treturn token.lexeme;\n\t\t\tcase TokenType.Error:\n\t\t\t\treturn token.lexeme;\n\t\t\tcase TokenType.EOF:\n\t\t\t\treturn 'EOF';\n\t\t\tdefault:\n\t\t\t\tthrow illegalState(`unhandled token type: ${JSON.stringify(token)}; have you forgotten to add a case?`);\n\t\t}\n\t}\n\n\tprivate static _regexFlags = new Set(['i', 'g', 's', 'm', 'y', 'u'].map(ch => ch.charCodeAt(0)));\n\n\tprivate static _keywords = new Map<string, KeywordTokenType>([\n\t\t['not', TokenType.Not],\n\t\t['in', TokenType.In],\n\t\t['false', TokenType.False],\n\t\t['true', TokenType.True],\n\t]);\n\n\tprivate _input: string = '';\n\tprivate _start: number = 0;\n\tprivate _current: number = 0;\n\tprivate _tokens: Token[] = [];\n\tprivate _errors: LexingError[] = [];\n\n\tget errors(): Readonly<LexingError[]> {\n\t\treturn this._errors;\n\t}\n\n\treset(value: string) {\n\t\tthis._input = value;\n\n\t\tthis._start = 0;\n\t\tthis._current = 0;\n\t\tthis._tokens = [];\n\t\tthis._errors = [];\n\n\t\treturn this;\n\t}\n\n\tscan() {\n\t\twhile (!this._isAtEnd()) {\n\n\t\t\tthis._start = this._current;\n\n\t\t\tconst ch = this._advance();\n\t\t\tswitch (ch) {\n\t\t\t\tcase CharCode.OpenParen: this._addToken(TokenType.LParen); break;\n\t\t\t\tcase CharCode.CloseParen: this._addToken(TokenType.RParen); break;\n\n\t\t\t\tcase CharCode.ExclamationMark:\n\t\t\t\t\tif (this._match(CharCode.Equals)) {\n\t\t\t\t\t\tconst isTripleEq = this._match(CharCode.Equals); // eat last `=` if `!==`\n\t\t\t\t\t\tthis._tokens.push({ type: TokenType.NotEq, offset: this._start, isTripleEq });\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._addToken(TokenType.Neg);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase CharCode.SingleQuote: this._quotedString(); break;\n\t\t\t\tcase CharCode.Slash: this._regex(); break;\n\n\t\t\t\tcase CharCode.Equals:\n\t\t\t\t\tif (this._match(CharCode.Equals)) { // support `==`\n\t\t\t\t\t\tconst isTripleEq = this._match(CharCode.Equals); // eat last `=` if `===`\n\t\t\t\t\t\tthis._tokens.push({ type: TokenType.Eq, offset: this._start, isTripleEq });\n\t\t\t\t\t} else if (this._match(CharCode.Tilde)) {\n\t\t\t\t\t\tthis._addToken(TokenType.RegexOp);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._error(hintDidYouMean('==', '=~'));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase CharCode.LessThan: this._addToken(this._match(CharCode.Equals) ? TokenType.LtEq : TokenType.Lt); break;\n\n\t\t\t\tcase CharCode.GreaterThan: this._addToken(this._match(CharCode.Equals) ? TokenType.GtEq : TokenType.Gt); break;\n\n\t\t\t\tcase CharCode.Ampersand:\n\t\t\t\t\tif (this._match(CharCode.Ampersand)) {\n\t\t\t\t\t\tthis._addToken(TokenType.And);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._error(hintDidYouMean('&&'));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase CharCode.Pipe:\n\t\t\t\t\tif (this._match(CharCode.Pipe)) {\n\t\t\t\t\t\tthis._addToken(TokenType.Or);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._error(hintDidYouMean('||'));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO@ulugbekna: 1) rewrite using a regex 2) reconsider what characters are considered whitespace, including unicode, nbsp, etc.\n\t\t\t\tcase CharCode.Space:\n\t\t\t\tcase CharCode.CarriageReturn:\n\t\t\t\tcase CharCode.Tab:\n\t\t\t\tcase CharCode.LineFeed:\n\t\t\t\tcase CharCode.NoBreakSpace: // &nbsp\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tthis._string();\n\t\t\t}\n\t\t}\n\n\t\tthis._start = this._current;\n\t\tthis._addToken(TokenType.EOF);\n\n\t\treturn Array.from(this._tokens);\n\t}\n\n\tprivate _match(expected: number): boolean {\n\t\tif (this._isAtEnd()) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this._input.charCodeAt(this._current) !== expected) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._current++;\n\t\treturn true;\n\t}\n\n\tprivate _advance(): number {\n\t\treturn this._input.charCodeAt(this._current++);\n\t}\n\n\tprivate _peek(): number {\n\t\treturn this._isAtEnd() ? CharCode.Null : this._input.charCodeAt(this._current);\n\t}\n\n\tprivate _addToken(type: TokenTypeWithoutLexeme) {\n\t\tthis._tokens.push({ type, offset: this._start });\n\t}\n\n\tprivate _error(additional?: string) {\n\t\tconst offset = this._start;\n\t\tconst lexeme = this._input.substring(this._start, this._current);\n\t\tconst errToken: Token = { type: TokenType.Error, offset: this._start, lexeme };\n\t\tthis._errors.push({ offset, lexeme, additionalInfo: additional });\n\t\tthis._tokens.push(errToken);\n\t}\n\n\t// u - unicode, y - sticky // TODO@ulugbekna: we accept double quotes as part of the string rather than as a delimiter (to preserve old parser's behavior)\n\tprivate stringRe = /[a-zA-Z0-9_<>\\-\\./\\\\:\\*\\?\\+\\[\\]\\^,#@;\"%\\$\\p{L}-]+/uy;\n\tprivate _string() {\n\t\tthis.stringRe.lastIndex = this._start;\n\t\tconst match = this.stringRe.exec(this._input);\n\t\tif (match) {\n\t\t\tthis._current = this._start + match[0].length;\n\t\t\tconst lexeme = this._input.substring(this._start, this._current);\n\t\t\tconst keyword = Scanner._keywords.get(lexeme);\n\t\t\tif (keyword) {\n\t\t\t\tthis._addToken(keyword);\n\t\t\t} else {\n\t\t\t\tthis._tokens.push({ type: TokenType.Str, lexeme, offset: this._start });\n\t\t\t}\n\t\t}\n\t}\n\n\t// captures the lexeme without the leading and trailing '\n\tprivate _quotedString() {\n\t\twhile (this._peek() !== CharCode.SingleQuote && !this._isAtEnd()) { // TODO@ulugbekna: add support for escaping ' ?\n\t\t\tthis._advance();\n\t\t}\n\n\t\tif (this._isAtEnd()) {\n\t\t\tthis._error(hintDidYouForgetToOpenOrCloseQuote);\n\t\t\treturn;\n\t\t}\n\n\t\t// consume the closing '\n\t\tthis._advance();\n\n\t\tthis._tokens.push({ type: TokenType.QuotedStr, lexeme: this._input.substring(this._start + 1, this._current - 1), offset: this._start + 1 });\n\t}\n\n\t/*\n\t * Lexing a regex expression: /.../[igsmyu]*\n\t * Based on https://github.com/microsoft/TypeScript/blob/9247ef115e617805983740ba795d7a8164babf89/src/compiler/scanner.ts#L2129-L2181\n\t *\n\t * Note that we want slashes within a regex to be escaped, e.g., /file:\\\\/\\\\/\\\\// should match `file:///`\n\t */\n\tprivate _regex() {\n\t\tlet p = this._current;\n\n\t\tlet inEscape = false;\n\t\tlet inCharacterClass = false;\n\t\twhile (true) {\n\t\t\tif (p >= this._input.length) {\n\t\t\t\tthis._current = p;\n\t\t\t\tthis._error(hintDidYouForgetToEscapeSlash);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst ch = this._input.charCodeAt(p);\n\n\t\t\tif (inEscape) { // parsing an escape character\n\t\t\t\tinEscape = false;\n\t\t\t} else if (ch === CharCode.Slash && !inCharacterClass) { // end of regex\n\t\t\t\tp++;\n\t\t\t\tbreak;\n\t\t\t} else if (ch === CharCode.OpenSquareBracket) {\n\t\t\t\tinCharacterClass = true;\n\t\t\t} else if (ch === CharCode.Backslash) {\n\t\t\t\tinEscape = true;\n\t\t\t} else if (ch === CharCode.CloseSquareBracket) {\n\t\t\t\tinCharacterClass = false;\n\t\t\t}\n\t\t\tp++;\n\t\t}\n\n\t\t// Consume flags // TODO@ulugbekna: use regex instead\n\t\twhile (p < this._input.length && Scanner._regexFlags.has(this._input.charCodeAt(p))) {\n\t\t\tp++;\n\t\t}\n\n\t\tthis._current = p;\n\n\t\tconst lexeme = this._input.substring(this._start, this._current);\n\t\tthis._tokens.push({ type: TokenType.RegexStr, lexeme, offset: this._start });\n\t}\n\n\tprivate _isAtEnd() {\n\t\treturn this._current >= this._input.length;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { DisposableStore } from '../../../base/common/lifecycle.js';\nimport * as descriptors from './descriptors.js';\nimport { ServiceCollection } from './serviceCollection.js';\n\n// ------ internal util\n\nexport namespace _util {\n\n\texport const serviceIds = new Map<string, ServiceIdentifier<any>>();\n\n\texport const DI_TARGET = '$di$target';\n\texport const DI_DEPENDENCIES = '$di$dependencies';\n\n\texport function getServiceDependencies(ctor: any): { id: ServiceIdentifier<any>; index: number }[] {\n\t\treturn ctor[DI_DEPENDENCIES] || [];\n\t}\n}\n\n// --- interfaces ------\n\nexport type BrandedService = { _serviceBrand: undefined };\n\nexport interface IConstructorSignature<T, Args extends any[] = []> {\n\tnew <Services extends BrandedService[]>(...args: [...Args, ...Services]): T;\n}\n\nexport interface ServicesAccessor {\n\tget<T>(id: ServiceIdentifier<T>): T;\n}\n\nexport const IInstantiationService = createDecorator<IInstantiationService>('instantiationService');\n\n/**\n * Given a list of arguments as a tuple, attempt to extract the leading, non-service arguments\n * to their own tuple.\n */\nexport type GetLeadingNonServiceArgs<TArgs extends any[]> =\n\tTArgs extends [] ? []\n\t: TArgs extends [...infer TFirst, BrandedService] ? GetLeadingNonServiceArgs<TFirst>\n\t: TArgs;\n\nexport interface IInstantiationService {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Synchronously creates an instance that is denoted by the descriptor\n\t */\n\tcreateInstance<T>(descriptor: descriptors.SyncDescriptor0<T>): T;\n\tcreateInstance<Ctor extends new (...args: any[]) => unknown, R extends InstanceType<Ctor>>(ctor: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;\n\n\t/**\n\t * Calls a function with a service accessor.\n\t */\n\tinvokeFunction<R, TS extends any[] = []>(fn: (accessor: ServicesAccessor, ...args: TS) => R, ...args: TS): R;\n\n\t/**\n\t * Creates a child of this service which inherits all current services\n\t * and adds/overwrites the given services.\n\t *\n\t * NOTE that the returned child is `disposable` and should be disposed when not used\n\t * anymore. This will also dispose all the services that this service has created.\n\t */\n\tcreateChild(services: ServiceCollection, store?: DisposableStore): IInstantiationService;\n\n\t/**\n\t * Disposes this instantiation service.\n\t *\n\t * - Will dispose all services that this instantiation service has created.\n\t * - Will dispose all its children but not its parent.\n\t * - Will NOT dispose services-instances that this service has been created with\n\t * - Will NOT dispose consumer-instances this service has created\n\t */\n\tdispose(): void;\n}\n\n\n/**\n * Identifies a service of type `T`.\n */\nexport interface ServiceIdentifier<T> {\n\t(...args: any[]): void;\n\ttype: T;\n}\n\nfunction storeServiceDependency(id: Function, target: Function, index: number): void {\n\tif ((target as any)[_util.DI_TARGET] === target) {\n\t\t(target as any)[_util.DI_DEPENDENCIES].push({ id, index });\n\t} else {\n\t\t(target as any)[_util.DI_DEPENDENCIES] = [{ id, index }];\n\t\t(target as any)[_util.DI_TARGET] = target;\n\t}\n}\n\n/**\n * The *only* valid way to create a {{ServiceIdentifier}}.\n */\nexport function createDecorator<T>(serviceId: string): ServiceIdentifier<T> {\n\n\tif (_util.serviceIds.has(serviceId)) {\n\t\treturn _util.serviceIds.get(serviceId)!;\n\t}\n\n\tconst id = <any>function (target: Function, key: string, index: number) {\n\t\tif (arguments.length !== 3) {\n\t\t\tthrow new Error('@IServiceName-decorator can only be used to decorate a parameter');\n\t\t}\n\t\tstoreServiceDependency(id, target, index);\n\t};\n\n\tid.toString = () => serviceId;\n\n\t_util.serviceIds.set(serviceId, id);\n\treturn id;\n}\n\nexport function refineServiceDecorator<T1, T extends T1>(serviceIdentifier: ServiceIdentifier<T1>): ServiceIdentifier<T> {\n\treturn <ServiceIdentifier<T>>serviceIdentifier;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from '../../../base/common/charCode.js';\nimport { Event } from '../../../base/common/event.js';\nimport { isChrome, isEdge, isFirefox, isLinux, isMacintosh, isSafari, isWeb, isWindows } from '../../../base/common/platform.js';\nimport { isFalsyOrWhitespace } from '../../../base/common/strings.js';\nimport { Scanner, LexingError, Token, TokenType } from './scanner.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { localize } from '../../../nls.js';\nimport { IDisposable } from '../../../base/common/lifecycle.js';\nimport { illegalArgument } from '../../../base/common/errors.js';\n\nconst CONSTANT_VALUES = new Map<string, boolean>();\nCONSTANT_VALUES.set('false', false);\nCONSTANT_VALUES.set('true', true);\nCONSTANT_VALUES.set('isMac', isMacintosh);\nCONSTANT_VALUES.set('isLinux', isLinux);\nCONSTANT_VALUES.set('isWindows', isWindows);\nCONSTANT_VALUES.set('isWeb', isWeb);\nCONSTANT_VALUES.set('isMacNative', isMacintosh && !isWeb);\nCONSTANT_VALUES.set('isEdge', isEdge);\nCONSTANT_VALUES.set('isFirefox', isFirefox);\nCONSTANT_VALUES.set('isChrome', isChrome);\nCONSTANT_VALUES.set('isSafari', isSafari);\n\n/** allow register constant context keys that are known only after startup; requires running `substituteConstants` on the context key - https://github.com/microsoft/vscode/issues/174218#issuecomment-1437972127 */\nexport function setConstant(key: string, value: boolean) {\n\tif (CONSTANT_VALUES.get(key) !== undefined) { throw illegalArgument('contextkey.setConstant(k, v) invoked with already set constant `k`'); }\n\n\tCONSTANT_VALUES.set(key, value);\n}\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\nexport const enum ContextKeyExprType {\n\tFalse = 0,\n\tTrue = 1,\n\tDefined = 2,\n\tNot = 3,\n\tEquals = 4,\n\tNotEquals = 5,\n\tAnd = 6,\n\tRegex = 7,\n\tNotRegex = 8,\n\tOr = 9,\n\tIn = 10,\n\tNotIn = 11,\n\tGreater = 12,\n\tGreaterEquals = 13,\n\tSmaller = 14,\n\tSmallerEquals = 15,\n}\n\nexport interface IContextKeyExprMapper {\n\tmapDefined(key: string): ContextKeyExpression;\n\tmapNot(key: string): ContextKeyExpression;\n\tmapEquals(key: string, value: any): ContextKeyExpression;\n\tmapNotEquals(key: string, value: any): ContextKeyExpression;\n\tmapGreater(key: string, value: any): ContextKeyExpression;\n\tmapGreaterEquals(key: string, value: any): ContextKeyExpression;\n\tmapSmaller(key: string, value: any): ContextKeyExpression;\n\tmapSmallerEquals(key: string, value: any): ContextKeyExpression;\n\tmapRegex(key: string, regexp: RegExp | null): ContextKeyRegexExpr;\n\tmapIn(key: string, valueKey: string): ContextKeyInExpr;\n\tmapNotIn(key: string, valueKey: string): ContextKeyNotInExpr;\n}\n\nexport interface IContextKeyExpression {\n\tcmp(other: ContextKeyExpression): number;\n\tequals(other: ContextKeyExpression): boolean;\n\tsubstituteConstants(): ContextKeyExpression | undefined;\n\tevaluate(context: IContext): boolean;\n\tserialize(): string;\n\tkeys(): string[];\n\tmap(mapFnc: IContextKeyExprMapper): ContextKeyExpression;\n\tnegate(): ContextKeyExpression;\n\n}\n\nexport type ContextKeyExpression = (\n\tContextKeyFalseExpr | ContextKeyTrueExpr | ContextKeyDefinedExpr | ContextKeyNotExpr\n\t| ContextKeyEqualsExpr | ContextKeyNotEqualsExpr | ContextKeyRegexExpr\n\t| ContextKeyNotRegexExpr | ContextKeyAndExpr | ContextKeyOrExpr | ContextKeyInExpr\n\t| ContextKeyNotInExpr | ContextKeyGreaterExpr | ContextKeyGreaterEqualsExpr\n\t| ContextKeySmallerExpr | ContextKeySmallerEqualsExpr\n);\n\n\n/*\n\nSyntax grammar:\n\n```ebnf\n\nexpression ::= or\n\nor ::= and { '||' and }*\n\nand ::= term { '&&' term }*\n\nterm ::=\n\t| '!' (KEY | true | false | parenthesized)\n\t| primary\n\nprimary ::=\n\t| 'true'\n\t| 'false'\n\t| parenthesized\n\t| KEY '=~' REGEX\n\t| KEY [ ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'not' 'in' | 'in') value ]\n\nparenthesized ::=\n\t| '(' expression ')'\n\nvalue ::=\n\t| 'true'\n\t| 'false'\n\t| 'in'      \t// we support `in` as a value because there's an extension that uses it, ie \"when\": \"languageId == in\"\n\t| VALUE \t\t// matched by the same regex as KEY; consider putting the value in single quotes if it's a string (e.g., with spaces)\n\t| SINGLE_QUOTED_STR\n\t| EMPTY_STR  \t// this allows \"when\": \"foo == \" which's used by existing extensions\n\n```\n*/\n\nexport type ParserConfig = {\n\t/**\n\t * with this option enabled, the parser can recover from regex parsing errors, e.g., unescaped slashes: `/src//` is accepted as `/src\\//` would be\n\t */\n\tregexParsingWithErrorRecovery: boolean;\n};\n\nconst defaultConfig: ParserConfig = {\n\tregexParsingWithErrorRecovery: true\n};\n\nexport type ParsingError = {\n\tmessage: string;\n\toffset: number;\n\tlexeme: string;\n\tadditionalInfo?: string;\n};\n\nconst errorEmptyString = localize('contextkey.parser.error.emptyString', \"Empty context key expression\");\nconst hintEmptyString = localize('contextkey.parser.error.emptyString.hint', \"Did you forget to write an expression? You can also put 'false' or 'true' to always evaluate to false or true, respectively.\");\nconst errorNoInAfterNot = localize('contextkey.parser.error.noInAfterNot', \"'in' after 'not'.\");\nconst errorClosingParenthesis = localize('contextkey.parser.error.closingParenthesis', \"closing parenthesis ')'\");\nconst errorUnexpectedToken = localize('contextkey.parser.error.unexpectedToken', \"Unexpected token\");\nconst hintUnexpectedToken = localize('contextkey.parser.error.unexpectedToken.hint', \"Did you forget to put && or || before the token?\");\nconst errorUnexpectedEOF = localize('contextkey.parser.error.unexpectedEOF', \"Unexpected end of expression\");\nconst hintUnexpectedEOF = localize('contextkey.parser.error.unexpectedEOF.hint', \"Did you forget to put a context key?\");\n\n/**\n * A parser for context key expressions.\n *\n * Example:\n * ```ts\n * const parser = new Parser();\n * const expr = parser.parse('foo == \"bar\" && baz == true');\n *\n * if (expr === undefined) {\n * \t// there were lexing or parsing errors\n * \t// process lexing errors with `parser.lexingErrors`\n *  // process parsing errors with `parser.parsingErrors`\n * } else {\n * \t// expr is a valid expression\n * }\n * ```\n */\nexport class Parser {\n\t// Note: this doesn't produce an exact syntax tree but a normalized one\n\t// ContextKeyExpression's that we use as AST nodes do not expose constructors that do not normalize\n\n\tprivate static _parseError = new Error();\n\n\t// lifetime note: `_scanner` lives as long as the parser does, i.e., is not reset between calls to `parse`\n\tprivate readonly _scanner = new Scanner();\n\n\t// lifetime note: `_tokens`, `_current`, and `_parsingErrors` must be reset between calls to `parse`\n\tprivate _tokens: Token[] = [];\n\tprivate _current = 0; \t\t\t\t\t// invariant: 0 <= this._current < this._tokens.length ; any incrementation of this value must first call `_isAtEnd`\n\tprivate _parsingErrors: ParsingError[] = [];\n\n\tget lexingErrors(): Readonly<LexingError[]> {\n\t\treturn this._scanner.errors;\n\t}\n\n\tget parsingErrors(): Readonly<ParsingError[]> {\n\t\treturn this._parsingErrors;\n\t}\n\n\tconstructor(private readonly _config: ParserConfig = defaultConfig) {\n\t}\n\n\t/**\n\t * Parse a context key expression.\n\t *\n\t * @param input the expression to parse\n\t * @returns the parsed expression or `undefined` if there's an error - call `lexingErrors` and `parsingErrors` to see the errors\n\t */\n\tparse(input: string): ContextKeyExpression | undefined {\n\n\t\tif (input === '') {\n\t\t\tthis._parsingErrors.push({ message: errorEmptyString, offset: 0, lexeme: '', additionalInfo: hintEmptyString });\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis._tokens = this._scanner.reset(input).scan();\n\t\t// @ulugbekna: we do not stop parsing if there are lexing errors to be able to reconstruct regexes with unescaped slashes; TODO@ulugbekna: make this respect config option for recovery\n\n\t\tthis._current = 0;\n\t\tthis._parsingErrors = [];\n\n\t\ttry {\n\t\t\tconst expr = this._expr();\n\t\t\tif (!this._isAtEnd()) {\n\t\t\t\tconst peek = this._peek();\n\t\t\t\tconst additionalInfo = peek.type === TokenType.Str ? hintUnexpectedToken : undefined;\n\t\t\t\tthis._parsingErrors.push({ message: errorUnexpectedToken, offset: peek.offset, lexeme: Scanner.getLexeme(peek), additionalInfo });\n\t\t\t\tthrow Parser._parseError;\n\t\t\t}\n\t\t\treturn expr;\n\t\t} catch (e) {\n\t\t\tif (!(e === Parser._parseError)) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate _expr(): ContextKeyExpression | undefined {\n\t\treturn this._or();\n\t}\n\n\tprivate _or(): ContextKeyExpression | undefined {\n\t\tconst expr = [this._and()];\n\n\t\twhile (this._matchOne(TokenType.Or)) {\n\t\t\tconst right = this._and();\n\t\t\texpr.push(right);\n\t\t}\n\n\t\treturn expr.length === 1 ? expr[0] : ContextKeyExpr.or(...expr);\n\t}\n\n\tprivate _and(): ContextKeyExpression | undefined {\n\t\tconst expr = [this._term()];\n\n\t\twhile (this._matchOne(TokenType.And)) {\n\t\t\tconst right = this._term();\n\t\t\texpr.push(right);\n\t\t}\n\n\t\treturn expr.length === 1 ? expr[0] : ContextKeyExpr.and(...expr);\n\t}\n\n\tprivate _term(): ContextKeyExpression | undefined {\n\t\tif (this._matchOne(TokenType.Neg)) {\n\t\t\tconst peek = this._peek();\n\t\t\tswitch (peek.type) {\n\t\t\t\tcase TokenType.True:\n\t\t\t\t\tthis._advance();\n\t\t\t\t\treturn ContextKeyFalseExpr.INSTANCE;\n\t\t\t\tcase TokenType.False:\n\t\t\t\t\tthis._advance();\n\t\t\t\t\treturn ContextKeyTrueExpr.INSTANCE;\n\t\t\t\tcase TokenType.LParen: {\n\t\t\t\t\tthis._advance();\n\t\t\t\t\tconst expr = this._expr();\n\t\t\t\t\tthis._consume(TokenType.RParen, errorClosingParenthesis);\n\t\t\t\t\treturn expr?.negate();\n\t\t\t\t}\n\t\t\t\tcase TokenType.Str:\n\t\t\t\t\tthis._advance();\n\t\t\t\t\treturn ContextKeyNotExpr.create(peek.lexeme);\n\t\t\t\tdefault:\n\t\t\t\t\tthrow this._errExpectedButGot(`KEY | true | false | '(' expression ')'`, peek);\n\t\t\t}\n\t\t}\n\t\treturn this._primary();\n\t}\n\n\tprivate _primary(): ContextKeyExpression | undefined {\n\n\t\tconst peek = this._peek();\n\t\tswitch (peek.type) {\n\t\t\tcase TokenType.True:\n\t\t\t\tthis._advance();\n\t\t\t\treturn ContextKeyExpr.true();\n\n\t\t\tcase TokenType.False:\n\t\t\t\tthis._advance();\n\t\t\t\treturn ContextKeyExpr.false();\n\n\t\t\tcase TokenType.LParen: {\n\t\t\t\tthis._advance();\n\t\t\t\tconst expr = this._expr();\n\t\t\t\tthis._consume(TokenType.RParen, errorClosingParenthesis);\n\t\t\t\treturn expr;\n\t\t\t}\n\n\t\t\tcase TokenType.Str: {\n\t\t\t\t// KEY\n\t\t\t\tconst key = peek.lexeme;\n\t\t\t\tthis._advance();\n\n\t\t\t\t// =~ regex\n\t\t\t\tif (this._matchOne(TokenType.RegexOp)) {\n\n\t\t\t\t\t// @ulugbekna: we need to reconstruct the regex from the tokens because some extensions use unescaped slashes in regexes\n\t\t\t\t\tconst expr = this._peek();\n\n\t\t\t\t\tif (!this._config.regexParsingWithErrorRecovery) {\n\t\t\t\t\t\tthis._advance();\n\t\t\t\t\t\tif (expr.type !== TokenType.RegexStr) {\n\t\t\t\t\t\t\tthrow this._errExpectedButGot(`REGEX`, expr);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst regexLexeme = expr.lexeme;\n\t\t\t\t\t\tconst closingSlashIndex = regexLexeme.lastIndexOf('/');\n\t\t\t\t\t\tconst flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));\n\t\t\t\t\t\tlet regexp: RegExp | null;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tregexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tthrow this._errExpectedButGot(`REGEX`, expr);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn ContextKeyRegexExpr.create(key, regexp);\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (expr.type) {\n\t\t\t\t\t\tcase TokenType.RegexStr:\n\t\t\t\t\t\tcase TokenType.Error: { // also handle an ErrorToken in case of smth such as /(/file)/\n\t\t\t\t\t\t\tconst lexemeReconstruction = [expr.lexeme]; // /REGEX/ or /REGEX/FLAGS\n\t\t\t\t\t\t\tthis._advance();\n\n\t\t\t\t\t\t\tlet followingToken = this._peek();\n\t\t\t\t\t\t\tlet parenBalance = 0;\n\t\t\t\t\t\t\tfor (let i = 0; i < expr.lexeme.length; i++) {\n\t\t\t\t\t\t\t\tif (expr.lexeme.charCodeAt(i) === CharCode.OpenParen) {\n\t\t\t\t\t\t\t\t\tparenBalance++;\n\t\t\t\t\t\t\t\t} else if (expr.lexeme.charCodeAt(i) === CharCode.CloseParen) {\n\t\t\t\t\t\t\t\t\tparenBalance--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\twhile (!this._isAtEnd() && followingToken.type !== TokenType.And && followingToken.type !== TokenType.Or) {\n\t\t\t\t\t\t\t\tswitch (followingToken.type) {\n\t\t\t\t\t\t\t\t\tcase TokenType.LParen:\n\t\t\t\t\t\t\t\t\t\tparenBalance++;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase TokenType.RParen:\n\t\t\t\t\t\t\t\t\t\tparenBalance--;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase TokenType.RegexStr:\n\t\t\t\t\t\t\t\t\tcase TokenType.QuotedStr:\n\t\t\t\t\t\t\t\t\t\tfor (let i = 0; i < followingToken.lexeme.length; i++) {\n\t\t\t\t\t\t\t\t\t\t\tif (followingToken.lexeme.charCodeAt(i) === CharCode.OpenParen) {\n\t\t\t\t\t\t\t\t\t\t\t\tparenBalance++;\n\t\t\t\t\t\t\t\t\t\t\t} else if (expr.lexeme.charCodeAt(i) === CharCode.CloseParen) {\n\t\t\t\t\t\t\t\t\t\t\t\tparenBalance--;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (parenBalance < 0) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlexemeReconstruction.push(Scanner.getLexeme(followingToken));\n\t\t\t\t\t\t\t\tthis._advance();\n\t\t\t\t\t\t\t\tfollowingToken = this._peek();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst regexLexeme = lexemeReconstruction.join('');\n\t\t\t\t\t\t\tconst closingSlashIndex = regexLexeme.lastIndexOf('/');\n\t\t\t\t\t\t\tconst flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));\n\t\t\t\t\t\t\tlet regexp: RegExp | null;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tregexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);\n\t\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t\tthrow this._errExpectedButGot(`REGEX`, expr);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ContextKeyExpr.regex(key, regexp);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcase TokenType.QuotedStr: {\n\t\t\t\t\t\t\tconst serializedValue = expr.lexeme;\n\t\t\t\t\t\t\tthis._advance();\n\t\t\t\t\t\t\t// replicate old regex parsing behavior\n\n\t\t\t\t\t\t\tlet regex: RegExp | null = null;\n\n\t\t\t\t\t\t\tif (!isFalsyOrWhitespace(serializedValue)) {\n\t\t\t\t\t\t\t\tconst start = serializedValue.indexOf('/');\n\t\t\t\t\t\t\t\tconst end = serializedValue.lastIndexOf('/');\n\t\t\t\t\t\t\t\tif (start !== end && start >= 0) {\n\n\t\t\t\t\t\t\t\t\tconst value = serializedValue.slice(start + 1, end);\n\t\t\t\t\t\t\t\t\tconst caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tregex = new RegExp(value, caseIgnoreFlag);\n\t\t\t\t\t\t\t\t\t} catch (_e) {\n\t\t\t\t\t\t\t\t\t\tthrow this._errExpectedButGot(`REGEX`, expr);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (regex === null) {\n\t\t\t\t\t\t\t\tthrow this._errExpectedButGot('REGEX', expr);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ContextKeyRegexExpr.create(key, regex);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow this._errExpectedButGot('REGEX', this._peek());\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// [ 'not' 'in' value ]\n\t\t\t\tif (this._matchOne(TokenType.Not)) {\n\t\t\t\t\tthis._consume(TokenType.In, errorNoInAfterNot);\n\t\t\t\t\tconst right = this._value();\n\t\t\t\t\treturn ContextKeyExpr.notIn(key, right);\n\t\t\t\t}\n\n\t\t\t\t// [ ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in') value ]\n\t\t\t\tconst maybeOp = this._peek().type;\n\t\t\t\tswitch (maybeOp) {\n\t\t\t\t\tcase TokenType.Eq: {\n\t\t\t\t\t\tthis._advance();\n\n\t\t\t\t\t\tconst right = this._value();\n\t\t\t\t\t\tif (this._previous().type === TokenType.QuotedStr) { // to preserve old parser behavior: \"foo == 'true'\" is preserved as \"foo == 'true'\", but \"foo == true\" is optimized as \"foo\"\n\t\t\t\t\t\t\treturn ContextKeyExpr.equals(key, right);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tswitch (right) {\n\t\t\t\t\t\t\tcase 'true':\n\t\t\t\t\t\t\t\treturn ContextKeyExpr.has(key);\n\t\t\t\t\t\t\tcase 'false':\n\t\t\t\t\t\t\t\treturn ContextKeyExpr.not(key);\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn ContextKeyExpr.equals(key, right);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcase TokenType.NotEq: {\n\t\t\t\t\t\tthis._advance();\n\n\t\t\t\t\t\tconst right = this._value();\n\t\t\t\t\t\tif (this._previous().type === TokenType.QuotedStr) { // same as above with \"foo != 'true'\"\n\t\t\t\t\t\t\treturn ContextKeyExpr.notEquals(key, right);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tswitch (right) {\n\t\t\t\t\t\t\tcase 'true':\n\t\t\t\t\t\t\t\treturn ContextKeyExpr.not(key);\n\t\t\t\t\t\t\tcase 'false':\n\t\t\t\t\t\t\t\treturn ContextKeyExpr.has(key);\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn ContextKeyExpr.notEquals(key, right);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// TODO: ContextKeyExpr.smaller(key, right) accepts only `number` as `right` AND during eval of this node, we just eval to `false` if `right` is not a number\n\t\t\t\t\t// consequently, package.json linter should _warn_ the user if they're passing undesired things to ops\n\t\t\t\t\tcase TokenType.Lt:\n\t\t\t\t\t\tthis._advance();\n\t\t\t\t\t\treturn ContextKeySmallerExpr.create(key, this._value());\n\n\t\t\t\t\tcase TokenType.LtEq:\n\t\t\t\t\t\tthis._advance();\n\t\t\t\t\t\treturn ContextKeySmallerEqualsExpr.create(key, this._value());\n\n\t\t\t\t\tcase TokenType.Gt:\n\t\t\t\t\t\tthis._advance();\n\t\t\t\t\t\treturn ContextKeyGreaterExpr.create(key, this._value());\n\n\t\t\t\t\tcase TokenType.GtEq:\n\t\t\t\t\t\tthis._advance();\n\t\t\t\t\t\treturn ContextKeyGreaterEqualsExpr.create(key, this._value());\n\n\t\t\t\t\tcase TokenType.In:\n\t\t\t\t\t\tthis._advance();\n\t\t\t\t\t\treturn ContextKeyExpr.in(key, this._value());\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn ContextKeyExpr.has(key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase TokenType.EOF:\n\t\t\t\tthis._parsingErrors.push({ message: errorUnexpectedEOF, offset: peek.offset, lexeme: '', additionalInfo: hintUnexpectedEOF });\n\t\t\t\tthrow Parser._parseError;\n\n\t\t\tdefault:\n\t\t\t\tthrow this._errExpectedButGot(`true | false | KEY \\n\\t| KEY '=~' REGEX \\n\\t| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`, this._peek());\n\n\t\t}\n\t}\n\n\tprivate _value(): string {\n\t\tconst token = this._peek();\n\t\tswitch (token.type) {\n\t\t\tcase TokenType.Str:\n\t\t\tcase TokenType.QuotedStr:\n\t\t\t\tthis._advance();\n\t\t\t\treturn token.lexeme;\n\t\t\tcase TokenType.True:\n\t\t\t\tthis._advance();\n\t\t\t\treturn 'true';\n\t\t\tcase TokenType.False:\n\t\t\t\tthis._advance();\n\t\t\t\treturn 'false';\n\t\t\tcase TokenType.In: // we support `in` as a value, e.g., \"when\": \"languageId == in\" - exists in existing extensions\n\t\t\t\tthis._advance();\n\t\t\t\treturn 'in';\n\t\t\tdefault:\n\t\t\t\t// this allows \"when\": \"foo == \" which's used by existing extensions\n\t\t\t\t// we do not call `_advance` on purpose - we don't want to eat unintended tokens\n\t\t\t\treturn '';\n\t\t}\n\t}\n\n\tprivate _flagsGYRe = /g|y/g;\n\tprivate _removeFlagsGY(flags: string): string {\n\t\treturn flags.replaceAll(this._flagsGYRe, '');\n\t}\n\n\t// careful: this can throw if current token is the initial one (ie index = 0)\n\tprivate _previous() {\n\t\treturn this._tokens[this._current - 1];\n\t}\n\n\tprivate _matchOne(token: TokenType) {\n\t\tif (this._check(token)) {\n\t\t\tthis._advance();\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate _advance() {\n\t\tif (!this._isAtEnd()) {\n\t\t\tthis._current++;\n\t\t}\n\t\treturn this._previous();\n\t}\n\n\tprivate _consume(type: TokenType, message: string) {\n\t\tif (this._check(type)) {\n\t\t\treturn this._advance();\n\t\t}\n\n\t\tthrow this._errExpectedButGot(message, this._peek());\n\t}\n\n\tprivate _errExpectedButGot(expected: string, got: Token, additionalInfo?: string) {\n\t\tconst message = localize('contextkey.parser.error.expectedButGot', \"Expected: {0}\\nReceived: '{1}'.\", expected, Scanner.getLexeme(got));\n\t\tconst offset = got.offset;\n\t\tconst lexeme = Scanner.getLexeme(got);\n\t\tthis._parsingErrors.push({ message, offset, lexeme, additionalInfo });\n\t\treturn Parser._parseError;\n\t}\n\n\tprivate _check(type: TokenType) {\n\t\treturn this._peek().type === type;\n\t}\n\n\tprivate _peek() {\n\t\treturn this._tokens[this._current];\n\t}\n\n\tprivate _isAtEnd() {\n\t\treturn this._peek().type === TokenType.EOF;\n\t}\n}\n\nexport abstract class ContextKeyExpr {\n\n\tpublic static false(): ContextKeyExpression {\n\t\treturn ContextKeyFalseExpr.INSTANCE;\n\t}\n\tpublic static true(): ContextKeyExpression {\n\t\treturn ContextKeyTrueExpr.INSTANCE;\n\t}\n\tpublic static has(key: string): ContextKeyExpression {\n\t\treturn ContextKeyDefinedExpr.create(key);\n\t}\n\tpublic static equals(key: string, value: any): ContextKeyExpression {\n\t\treturn ContextKeyEqualsExpr.create(key, value);\n\t}\n\tpublic static notEquals(key: string, value: any): ContextKeyExpression {\n\t\treturn ContextKeyNotEqualsExpr.create(key, value);\n\t}\n\tpublic static regex(key: string, value: RegExp): ContextKeyExpression {\n\t\treturn ContextKeyRegexExpr.create(key, value);\n\t}\n\tpublic static in(key: string, value: string): ContextKeyExpression {\n\t\treturn ContextKeyInExpr.create(key, value);\n\t}\n\tpublic static notIn(key: string, value: string): ContextKeyExpression {\n\t\treturn ContextKeyNotInExpr.create(key, value);\n\t}\n\tpublic static not(key: string): ContextKeyExpression {\n\t\treturn ContextKeyNotExpr.create(key);\n\t}\n\tpublic static and(...expr: Array<ContextKeyExpression | undefined | null>): ContextKeyExpression | undefined {\n\t\treturn ContextKeyAndExpr.create(expr, null, true);\n\t}\n\tpublic static or(...expr: Array<ContextKeyExpression | undefined | null>): ContextKeyExpression | undefined {\n\t\treturn ContextKeyOrExpr.create(expr, null, true);\n\t}\n\tpublic static greater(key: string, value: number): ContextKeyExpression {\n\t\treturn ContextKeyGreaterExpr.create(key, value);\n\t}\n\tpublic static greaterEquals(key: string, value: number): ContextKeyExpression {\n\t\treturn ContextKeyGreaterEqualsExpr.create(key, value);\n\t}\n\tpublic static smaller(key: string, value: number): ContextKeyExpression {\n\t\treturn ContextKeySmallerExpr.create(key, value);\n\t}\n\tpublic static smallerEquals(key: string, value: number): ContextKeyExpression {\n\t\treturn ContextKeySmallerEqualsExpr.create(key, value);\n\t}\n\n\tprivate static _parser = new Parser({ regexParsingWithErrorRecovery: false });\n\tpublic static deserialize(serialized: string | null | undefined): ContextKeyExpression | undefined {\n\t\tif (serialized === undefined || serialized === null) { // an empty string needs to be handled by the parser to get a corresponding parsing error reported\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst expr = this._parser.parse(serialized);\n\t\treturn expr;\n\t}\n\n}\n\n\nexport function validateWhenClauses(whenClauses: string[]): any {\n\n\tconst parser = new Parser({ regexParsingWithErrorRecovery: false }); // we run with no recovery to guide users to use correct regexes\n\n\treturn whenClauses.map(whenClause => {\n\t\tparser.parse(whenClause);\n\n\t\tif (parser.lexingErrors.length > 0) {\n\t\t\treturn parser.lexingErrors.map((se: LexingError) => ({\n\t\t\t\terrorMessage: se.additionalInfo ?\n\t\t\t\t\tlocalize('contextkey.scanner.errorForLinterWithHint', \"Unexpected token. Hint: {0}\", se.additionalInfo) :\n\t\t\t\t\tlocalize('contextkey.scanner.errorForLinter', \"Unexpected token.\"),\n\t\t\t\toffset: se.offset,\n\t\t\t\tlength: se.lexeme.length,\n\t\t\t}));\n\t\t} else if (parser.parsingErrors.length > 0) {\n\t\t\treturn parser.parsingErrors.map((pe: ParsingError) => ({\n\t\t\t\terrorMessage: pe.additionalInfo ? `${pe.message}. ${pe.additionalInfo}` : pe.message,\n\t\t\t\toffset: pe.offset,\n\t\t\t\tlength: pe.lexeme.length,\n\t\t\t}));\n\t\t} else {\n\t\t\treturn [];\n\t\t}\n\t});\n}\n\nexport function expressionsAreEqualWithConstantSubstitution(a: ContextKeyExpression | null | undefined, b: ContextKeyExpression | null | undefined): boolean {\n\tconst aExpr = a ? a.substituteConstants() : undefined;\n\tconst bExpr = b ? b.substituteConstants() : undefined;\n\tif (!aExpr && !bExpr) {\n\t\treturn true;\n\t}\n\tif (!aExpr || !bExpr) {\n\t\treturn false;\n\t}\n\treturn aExpr.equals(bExpr);\n}\n\nfunction cmp(a: ContextKeyExpression, b: ContextKeyExpression): number {\n\treturn a.cmp(b);\n}\n\nexport class ContextKeyFalseExpr implements IContextKeyExpression {\n\tpublic static INSTANCE = new ContextKeyFalseExpr();\n\n\tpublic readonly type = ContextKeyExprType.False;\n\n\tprotected constructor() {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\treturn this.type - other.type;\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\treturn (other.type === this.type);\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\treturn false;\n\t}\n\n\tpublic serialize(): string {\n\t\treturn 'false';\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn this;\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\treturn ContextKeyTrueExpr.INSTANCE;\n\t}\n}\n\nexport class ContextKeyTrueExpr implements IContextKeyExpression {\n\tpublic static INSTANCE = new ContextKeyTrueExpr();\n\n\tpublic readonly type = ContextKeyExprType.True;\n\n\tprotected constructor() {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\treturn this.type - other.type;\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\treturn (other.type === this.type);\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\treturn true;\n\t}\n\n\tpublic serialize(): string {\n\t\treturn 'true';\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn this;\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\treturn ContextKeyFalseExpr.INSTANCE;\n\t}\n}\n\nexport class ContextKeyDefinedExpr implements IContextKeyExpression {\n\tpublic static create(key: string, negated: ContextKeyExpression | null = null): ContextKeyExpression {\n\t\tconst constantValue = CONSTANT_VALUES.get(key);\n\t\tif (typeof constantValue === 'boolean') {\n\t\t\treturn constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;\n\t\t}\n\t\treturn new ContextKeyDefinedExpr(key, negated);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.Defined;\n\n\tprotected constructor(\n\t\treadonly key: string,\n\t\tprivate negated: ContextKeyExpression | null\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp1(this.key, other.key);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\tconst constantValue = CONSTANT_VALUES.get(this.key);\n\t\tif (typeof constantValue === 'boolean') {\n\t\t\treturn constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\treturn (!!context.getValue(this.key));\n\t}\n\n\tpublic serialize(): string {\n\t\treturn this.key;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapDefined(this.key);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeyNotExpr.create(this.key, this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeyEqualsExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, value: any, negated: ContextKeyExpression | null = null): ContextKeyExpression {\n\t\tif (typeof value === 'boolean') {\n\t\t\treturn (value ? ContextKeyDefinedExpr.create(key, negated) : ContextKeyNotExpr.create(key, negated));\n\t\t}\n\t\tconst constantValue = CONSTANT_VALUES.get(key);\n\t\tif (typeof constantValue === 'boolean') {\n\t\t\tconst trueValue = constantValue ? 'true' : 'false';\n\t\t\treturn (value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);\n\t\t}\n\t\treturn new ContextKeyEqualsExpr(key, value, negated);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.Equals;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly value: any,\n\t\tprivate negated: ContextKeyExpression | null\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp2(this.key, this.value, other.key, other.value);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key && this.value === other.value);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\tconst constantValue = CONSTANT_VALUES.get(this.key);\n\t\tif (typeof constantValue === 'boolean') {\n\t\t\tconst trueValue = constantValue ? 'true' : 'false';\n\t\t\treturn (this.value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\t// Intentional ==\n\t\t// eslint-disable-next-line eqeqeq\n\t\treturn (context.getValue(this.key) == this.value);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `${this.key} == '${this.value}'`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapEquals(this.key, this.value);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeyNotEqualsExpr.create(this.key, this.value, this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeyInExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, valueKey: string): ContextKeyInExpr {\n\t\treturn new ContextKeyInExpr(key, valueKey);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.In;\n\tprivate negated: ContextKeyExpression | null = null;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly valueKey: string,\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp2(this.key, this.valueKey, other.key, other.valueKey);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key && this.valueKey === other.valueKey);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\tconst source = context.getValue(this.valueKey);\n\n\t\tconst item = context.getValue(this.key);\n\n\t\tif (Array.isArray(source)) {\n\t\t\treturn source.includes(item as any);\n\t\t}\n\n\t\tif (typeof item === 'string' && typeof source === 'object' && source !== null) {\n\t\t\treturn hasOwnProperty.call(source, item);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `${this.key} in '${this.valueKey}'`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key, this.valueKey];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyInExpr {\n\t\treturn mapFnc.mapIn(this.key, this.valueKey);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeyNotInExpr.create(this.key, this.valueKey);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeyNotInExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, valueKey: string): ContextKeyNotInExpr {\n\t\treturn new ContextKeyNotInExpr(key, valueKey);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.NotIn;\n\n\tprivate readonly _negated: ContextKeyInExpr;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly valueKey: string,\n\t) {\n\t\tthis._negated = ContextKeyInExpr.create(key, valueKey);\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn this._negated.cmp(other._negated);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn this._negated.equals(other._negated);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\treturn !this._negated.evaluate(context);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `${this.key} not in '${this.valueKey}'`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn this._negated.keys();\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapNotIn(this.key, this.valueKey);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\treturn this._negated;\n\t}\n}\n\nexport class ContextKeyNotEqualsExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, value: any, negated: ContextKeyExpression | null = null): ContextKeyExpression {\n\t\tif (typeof value === 'boolean') {\n\t\t\tif (value) {\n\t\t\t\treturn ContextKeyNotExpr.create(key, negated);\n\t\t\t}\n\t\t\treturn ContextKeyDefinedExpr.create(key, negated);\n\t\t}\n\t\tconst constantValue = CONSTANT_VALUES.get(key);\n\t\tif (typeof constantValue === 'boolean') {\n\t\t\tconst falseValue = constantValue ? 'true' : 'false';\n\t\t\treturn (value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n\t\t}\n\t\treturn new ContextKeyNotEqualsExpr(key, value, negated);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.NotEquals;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly value: any,\n\t\tprivate negated: ContextKeyExpression | null\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp2(this.key, this.value, other.key, other.value);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key && this.value === other.value);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\tconst constantValue = CONSTANT_VALUES.get(this.key);\n\t\tif (typeof constantValue === 'boolean') {\n\t\t\tconst falseValue = constantValue ? 'true' : 'false';\n\t\t\treturn (this.value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\t// Intentional !=\n\t\t// eslint-disable-next-line eqeqeq\n\t\treturn (context.getValue(this.key) != this.value);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `${this.key} != '${this.value}'`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapNotEquals(this.key, this.value);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeyEqualsExpr.create(this.key, this.value, this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeyNotExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, negated: ContextKeyExpression | null = null): ContextKeyExpression {\n\t\tconst constantValue = CONSTANT_VALUES.get(key);\n\t\tif (typeof constantValue === 'boolean') {\n\t\t\treturn (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n\t\t}\n\t\treturn new ContextKeyNotExpr(key, negated);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.Not;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate negated: ContextKeyExpression | null\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp1(this.key, other.key);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\tconst constantValue = CONSTANT_VALUES.get(this.key);\n\t\tif (typeof constantValue === 'boolean') {\n\t\t\treturn (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\treturn (!context.getValue(this.key));\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `!${this.key}`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapNot(this.key);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeyDefinedExpr.create(this.key, this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nfunction withFloatOrStr<T extends ContextKeyExpression>(value: any, callback: (value: number | string) => T): T | ContextKeyFalseExpr {\n\tif (typeof value === 'string') {\n\t\tconst n = parseFloat(value);\n\t\tif (!isNaN(n)) {\n\t\t\tvalue = n;\n\t\t}\n\t}\n\tif (typeof value === 'string' || typeof value === 'number') {\n\t\treturn callback(value);\n\t}\n\treturn ContextKeyFalseExpr.INSTANCE;\n}\n\nexport class ContextKeyGreaterExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, _value: any, negated: ContextKeyExpression | null = null): ContextKeyExpression {\n\t\treturn withFloatOrStr(_value, (value) => new ContextKeyGreaterExpr(key, value, negated));\n\t}\n\n\tpublic readonly type = ContextKeyExprType.Greater;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly value: number | string,\n\t\tprivate negated: ContextKeyExpression | null\n\t) { }\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp2(this.key, this.value, other.key, other.value);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key && this.value === other.value);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\tif (typeof this.value === 'string') {\n\t\t\treturn false;\n\t\t}\n\t\treturn (parseFloat(<any>context.getValue(this.key)) > this.value);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `${this.key} > ${this.value}`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapGreater(this.key, this.value);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeySmallerEqualsExpr.create(this.key, this.value, this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeyGreaterEqualsExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, _value: any, negated: ContextKeyExpression | null = null): ContextKeyExpression {\n\t\treturn withFloatOrStr(_value, (value) => new ContextKeyGreaterEqualsExpr(key, value, negated));\n\t}\n\n\tpublic readonly type = ContextKeyExprType.GreaterEquals;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly value: number | string,\n\t\tprivate negated: ContextKeyExpression | null\n\t) { }\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp2(this.key, this.value, other.key, other.value);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key && this.value === other.value);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\tif (typeof this.value === 'string') {\n\t\t\treturn false;\n\t\t}\n\t\treturn (parseFloat(<any>context.getValue(this.key)) >= this.value);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `${this.key} >= ${this.value}`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapGreaterEquals(this.key, this.value);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeySmallerExpr.create(this.key, this.value, this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeySmallerExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, _value: any, negated: ContextKeyExpression | null = null): ContextKeyExpression {\n\t\treturn withFloatOrStr(_value, (value) => new ContextKeySmallerExpr(key, value, negated));\n\t}\n\n\tpublic readonly type = ContextKeyExprType.Smaller;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly value: number | string,\n\t\tprivate negated: ContextKeyExpression | null\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp2(this.key, this.value, other.key, other.value);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key && this.value === other.value);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\tif (typeof this.value === 'string') {\n\t\t\treturn false;\n\t\t}\n\t\treturn (parseFloat(<any>context.getValue(this.key)) < this.value);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `${this.key} < ${this.value}`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapSmaller(this.key, this.value);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeyGreaterEqualsExpr.create(this.key, this.value, this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeySmallerEqualsExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, _value: any, negated: ContextKeyExpression | null = null): ContextKeyExpression {\n\t\treturn withFloatOrStr(_value, (value) => new ContextKeySmallerEqualsExpr(key, value, negated));\n\t}\n\n\tpublic readonly type = ContextKeyExprType.SmallerEquals;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly value: number | string,\n\t\tprivate negated: ContextKeyExpression | null\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn cmp2(this.key, this.value, other.key, other.value);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn (this.key === other.key && this.value === other.value);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\tif (typeof this.value === 'string') {\n\t\t\treturn false;\n\t\t}\n\t\treturn (parseFloat(<any>context.getValue(this.key)) <= this.value);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `${this.key} <= ${this.value}`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn mapFnc.mapSmallerEquals(this.key, this.value);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeyGreaterExpr.create(this.key, this.value, this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeyRegexExpr implements IContextKeyExpression {\n\n\tpublic static create(key: string, regexp: RegExp | null): ContextKeyRegexExpr {\n\t\treturn new ContextKeyRegexExpr(key, regexp);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.Regex;\n\tprivate negated: ContextKeyExpression | null = null;\n\n\tprivate constructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly regexp: RegExp | null\n\t) {\n\t\t//\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\tif (this.key < other.key) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (this.key > other.key) {\n\t\t\treturn 1;\n\t\t}\n\t\tconst thisSource = this.regexp ? this.regexp.source : '';\n\t\tconst otherSource = other.regexp ? other.regexp.source : '';\n\t\tif (thisSource < otherSource) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (thisSource > otherSource) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\tconst thisSource = this.regexp ? this.regexp.source : '';\n\t\t\tconst otherSource = other.regexp ? other.regexp.source : '';\n\t\t\treturn (this.key === other.key && thisSource === otherSource);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\tconst value = context.getValue<any>(this.key);\n\t\treturn this.regexp ? this.regexp.test(value) : false;\n\t}\n\n\tpublic serialize(): string {\n\t\tconst value = this.regexp\n\t\t\t? `/${this.regexp.source}/${this.regexp.flags}`\n\t\t\t: '/invalid/';\n\t\treturn `${this.key} =~ ${value}`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [this.key];\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyRegexExpr {\n\t\treturn mapFnc.mapRegex(this.key, this.regexp);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tthis.negated = ContextKeyNotRegexExpr.create(this);\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeyNotRegexExpr implements IContextKeyExpression {\n\n\tpublic static create(actual: ContextKeyRegexExpr): ContextKeyExpression {\n\t\treturn new ContextKeyNotRegexExpr(actual);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.NotRegex;\n\n\tprivate constructor(private readonly _actual: ContextKeyRegexExpr) {\n\t\t//\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\treturn this._actual.cmp(other._actual);\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\treturn this._actual.equals(other._actual);\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\treturn this;\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\treturn !this._actual.evaluate(context);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn `!(${this._actual.serialize()})`;\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn this._actual.keys();\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn new ContextKeyNotRegexExpr(this._actual.map(mapFnc));\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\treturn this._actual;\n\t}\n}\n\n/**\n * @returns the same instance if nothing changed.\n */\nfunction eliminateConstantsInArray(arr: ContextKeyExpression[]): (ContextKeyExpression | undefined)[] {\n\t// Allocate array only if there is a difference\n\tlet newArr: (ContextKeyExpression | undefined)[] | null = null;\n\tfor (let i = 0, len = arr.length; i < len; i++) {\n\t\tconst newExpr = arr[i].substituteConstants();\n\n\t\tif (arr[i] !== newExpr) {\n\t\t\t// something has changed!\n\n\t\t\t// allocate array on first difference\n\t\t\tif (newArr === null) {\n\t\t\t\tnewArr = [];\n\t\t\t\tfor (let j = 0; j < i; j++) {\n\t\t\t\t\tnewArr[j] = arr[j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (newArr !== null) {\n\t\t\tnewArr[i] = newExpr;\n\t\t}\n\t}\n\n\tif (newArr === null) {\n\t\treturn arr;\n\t}\n\treturn newArr;\n}\n\nexport class ContextKeyAndExpr implements IContextKeyExpression {\n\n\tpublic static create(_expr: ReadonlyArray<ContextKeyExpression | null | undefined>, negated: ContextKeyExpression | null, extraRedundantCheck: boolean): ContextKeyExpression | undefined {\n\t\treturn ContextKeyAndExpr._normalizeArr(_expr, negated, extraRedundantCheck);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.And;\n\n\tprivate constructor(\n\t\tpublic readonly expr: ContextKeyExpression[],\n\t\tprivate negated: ContextKeyExpression | null\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\tif (this.expr.length < other.expr.length) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (this.expr.length > other.expr.length) {\n\t\t\treturn 1;\n\t\t}\n\t\tfor (let i = 0, len = this.expr.length; i < len; i++) {\n\t\t\tconst r = cmp(this.expr[i], other.expr[i]);\n\t\t\tif (r !== 0) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\tif (this.expr.length !== other.expr.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (let i = 0, len = this.expr.length; i < len; i++) {\n\t\t\t\tif (!this.expr[i].equals(other.expr[i])) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\tconst exprArr = eliminateConstantsInArray(this.expr);\n\t\tif (exprArr === this.expr) {\n\t\t\t// no change\n\t\t\treturn this;\n\t\t}\n\t\treturn ContextKeyAndExpr.create(exprArr, this.negated, false);\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\tfor (let i = 0, len = this.expr.length; i < len; i++) {\n\t\t\tif (!this.expr[i].evaluate(context)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate static _normalizeArr(arr: ReadonlyArray<ContextKeyExpression | null | undefined>, negated: ContextKeyExpression | null, extraRedundantCheck: boolean): ContextKeyExpression | undefined {\n\t\tconst expr: ContextKeyExpression[] = [];\n\t\tlet hasTrue = false;\n\n\t\tfor (const e of arr) {\n\t\t\tif (!e) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (e.type === ContextKeyExprType.True) {\n\t\t\t\t// anything && true ==> anything\n\t\t\t\thasTrue = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (e.type === ContextKeyExprType.False) {\n\t\t\t\t// anything && false ==> false\n\t\t\t\treturn ContextKeyFalseExpr.INSTANCE;\n\t\t\t}\n\n\t\t\tif (e.type === ContextKeyExprType.And) {\n\t\t\t\texpr.push(...e.expr);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\texpr.push(e);\n\t\t}\n\n\t\tif (expr.length === 0 && hasTrue) {\n\t\t\treturn ContextKeyTrueExpr.INSTANCE;\n\t\t}\n\n\t\tif (expr.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (expr.length === 1) {\n\t\t\treturn expr[0];\n\t\t}\n\n\t\texpr.sort(cmp);\n\n\t\t// eliminate duplicate terms\n\t\tfor (let i = 1; i < expr.length; i++) {\n\t\t\tif (expr[i - 1].equals(expr[i])) {\n\t\t\t\texpr.splice(i, 1);\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\n\t\tif (expr.length === 1) {\n\t\t\treturn expr[0];\n\t\t}\n\n\t\t// We must distribute any OR expression because we don't support parens\n\t\t// OR extensions will be at the end (due to sorting rules)\n\t\twhile (expr.length > 1) {\n\t\t\tconst lastElement = expr[expr.length - 1];\n\t\t\tif (lastElement.type !== ContextKeyExprType.Or) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// pop the last element\n\t\t\texpr.pop();\n\n\t\t\t// pop the second to last element\n\t\t\tconst secondToLastElement = expr.pop()!;\n\n\t\t\tconst isFinished = (expr.length === 0);\n\n\t\t\t// distribute `lastElement` over `secondToLastElement`\n\t\t\tconst resultElement = ContextKeyOrExpr.create(\n\t\t\t\tlastElement.expr.map(el => ContextKeyAndExpr.create([el, secondToLastElement], null, extraRedundantCheck)),\n\t\t\t\tnull,\n\t\t\t\tisFinished\n\t\t\t);\n\n\t\t\tif (resultElement) {\n\t\t\t\texpr.push(resultElement);\n\t\t\t\texpr.sort(cmp);\n\t\t\t}\n\t\t}\n\n\t\tif (expr.length === 1) {\n\t\t\treturn expr[0];\n\t\t}\n\n\t\t// resolve false AND expressions\n\t\tif (extraRedundantCheck) {\n\t\t\tfor (let i = 0; i < expr.length; i++) {\n\t\t\t\tfor (let j = i + 1; j < expr.length; j++) {\n\t\t\t\t\tif (expr[i].negate().equals(expr[j])) {\n\t\t\t\t\t\t// A && !A case\n\t\t\t\t\t\treturn ContextKeyFalseExpr.INSTANCE;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (expr.length === 1) {\n\t\t\t\treturn expr[0];\n\t\t\t}\n\t\t}\n\n\t\treturn new ContextKeyAndExpr(expr, negated);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn this.expr.map(e => e.serialize()).join(' && ');\n\t}\n\n\tpublic keys(): string[] {\n\t\tconst result: string[] = [];\n\t\tfor (const expr of this.expr) {\n\t\t\tresult.push(...expr.keys());\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn new ContextKeyAndExpr(this.expr.map(expr => expr.map(mapFnc)), null);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tconst result: ContextKeyExpression[] = [];\n\t\t\tfor (const expr of this.expr) {\n\t\t\t\tresult.push(expr.negate());\n\t\t\t}\n\t\t\tthis.negated = ContextKeyOrExpr.create(result, this, true)!;\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport class ContextKeyOrExpr implements IContextKeyExpression {\n\n\tpublic static create(_expr: ReadonlyArray<ContextKeyExpression | null | undefined>, negated: ContextKeyExpression | null, extraRedundantCheck: boolean): ContextKeyExpression | undefined {\n\t\treturn ContextKeyOrExpr._normalizeArr(_expr, negated, extraRedundantCheck);\n\t}\n\n\tpublic readonly type = ContextKeyExprType.Or;\n\n\tprivate constructor(\n\t\tpublic readonly expr: ContextKeyExpression[],\n\t\tprivate negated: ContextKeyExpression | null\n\t) {\n\t}\n\n\tpublic cmp(other: ContextKeyExpression): number {\n\t\tif (other.type !== this.type) {\n\t\t\treturn this.type - other.type;\n\t\t}\n\t\tif (this.expr.length < other.expr.length) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (this.expr.length > other.expr.length) {\n\t\t\treturn 1;\n\t\t}\n\t\tfor (let i = 0, len = this.expr.length; i < len; i++) {\n\t\t\tconst r = cmp(this.expr[i], other.expr[i]);\n\t\t\tif (r !== 0) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic equals(other: ContextKeyExpression): boolean {\n\t\tif (other.type === this.type) {\n\t\t\tif (this.expr.length !== other.expr.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (let i = 0, len = this.expr.length; i < len; i++) {\n\t\t\t\tif (!this.expr[i].equals(other.expr[i])) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic substituteConstants(): ContextKeyExpression | undefined {\n\t\tconst exprArr = eliminateConstantsInArray(this.expr);\n\t\tif (exprArr === this.expr) {\n\t\t\t// no change\n\t\t\treturn this;\n\t\t}\n\t\treturn ContextKeyOrExpr.create(exprArr, this.negated, false);\n\t}\n\n\tpublic evaluate(context: IContext): boolean {\n\t\tfor (let i = 0, len = this.expr.length; i < len; i++) {\n\t\t\tif (this.expr[i].evaluate(context)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate static _normalizeArr(arr: ReadonlyArray<ContextKeyExpression | null | undefined>, negated: ContextKeyExpression | null, extraRedundantCheck: boolean): ContextKeyExpression | undefined {\n\t\tlet expr: ContextKeyExpression[] = [];\n\t\tlet hasFalse = false;\n\n\t\tif (arr) {\n\t\t\tfor (let i = 0, len = arr.length; i < len; i++) {\n\t\t\t\tconst e = arr[i];\n\t\t\t\tif (!e) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (e.type === ContextKeyExprType.False) {\n\t\t\t\t\t// anything || false ==> anything\n\t\t\t\t\thasFalse = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (e.type === ContextKeyExprType.True) {\n\t\t\t\t\t// anything || true ==> true\n\t\t\t\t\treturn ContextKeyTrueExpr.INSTANCE;\n\t\t\t\t}\n\n\t\t\t\tif (e.type === ContextKeyExprType.Or) {\n\t\t\t\t\texpr = expr.concat(e.expr);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\texpr.push(e);\n\t\t\t}\n\n\t\t\tif (expr.length === 0 && hasFalse) {\n\t\t\t\treturn ContextKeyFalseExpr.INSTANCE;\n\t\t\t}\n\n\t\t\texpr.sort(cmp);\n\t\t}\n\n\t\tif (expr.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (expr.length === 1) {\n\t\t\treturn expr[0];\n\t\t}\n\n\t\t// eliminate duplicate terms\n\t\tfor (let i = 1; i < expr.length; i++) {\n\t\t\tif (expr[i - 1].equals(expr[i])) {\n\t\t\t\texpr.splice(i, 1);\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\n\t\tif (expr.length === 1) {\n\t\t\treturn expr[0];\n\t\t}\n\n\t\t// resolve true OR expressions\n\t\tif (extraRedundantCheck) {\n\t\t\tfor (let i = 0; i < expr.length; i++) {\n\t\t\t\tfor (let j = i + 1; j < expr.length; j++) {\n\t\t\t\t\tif (expr[i].negate().equals(expr[j])) {\n\t\t\t\t\t\t// A || !A case\n\t\t\t\t\t\treturn ContextKeyTrueExpr.INSTANCE;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (expr.length === 1) {\n\t\t\t\treturn expr[0];\n\t\t\t}\n\t\t}\n\n\t\treturn new ContextKeyOrExpr(expr, negated);\n\t}\n\n\tpublic serialize(): string {\n\t\treturn this.expr.map(e => e.serialize()).join(' || ');\n\t}\n\n\tpublic keys(): string[] {\n\t\tconst result: string[] = [];\n\t\tfor (const expr of this.expr) {\n\t\t\tresult.push(...expr.keys());\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic map(mapFnc: IContextKeyExprMapper): ContextKeyExpression {\n\t\treturn new ContextKeyOrExpr(this.expr.map(expr => expr.map(mapFnc)), null);\n\t}\n\n\tpublic negate(): ContextKeyExpression {\n\t\tif (!this.negated) {\n\t\t\tconst result: ContextKeyExpression[] = [];\n\t\t\tfor (const expr of this.expr) {\n\t\t\t\tresult.push(expr.negate());\n\t\t\t}\n\n\t\t\t// We don't support parens, so here we distribute the AND over the OR terminals\n\t\t\t// We always take the first 2 AND pairs and distribute them\n\t\t\twhile (result.length > 1) {\n\t\t\t\tconst LEFT = result.shift()!;\n\t\t\t\tconst RIGHT = result.shift()!;\n\n\t\t\t\tconst all: ContextKeyExpression[] = [];\n\t\t\t\tfor (const left of getTerminals(LEFT)) {\n\t\t\t\t\tfor (const right of getTerminals(RIGHT)) {\n\t\t\t\t\t\tall.push(ContextKeyAndExpr.create([left, right], null, false)!);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tresult.unshift(ContextKeyOrExpr.create(all, null, false)!);\n\t\t\t}\n\n\t\t\tthis.negated = ContextKeyOrExpr.create(result, this, true)!;\n\t\t}\n\t\treturn this.negated;\n\t}\n}\n\nexport interface ContextKeyInfo {\n\treadonly key: string;\n\treadonly type?: string;\n\treadonly description?: string;\n}\n\nexport class RawContextKey<T extends ContextKeyValue> extends ContextKeyDefinedExpr {\n\n\tprivate static _info: ContextKeyInfo[] = [];\n\n\tstatic all(): IterableIterator<ContextKeyInfo> {\n\t\treturn RawContextKey._info.values();\n\t}\n\n\tprivate readonly _defaultValue: T | undefined;\n\n\tconstructor(key: string, defaultValue: T | undefined, metaOrHide?: string | true | { type: string; description: string }) {\n\t\tsuper(key, null);\n\t\tthis._defaultValue = defaultValue;\n\n\t\t// collect all context keys into a central place\n\t\tif (typeof metaOrHide === 'object') {\n\t\t\tRawContextKey._info.push({ ...metaOrHide, key });\n\t\t} else if (metaOrHide !== true) {\n\t\t\tRawContextKey._info.push({ key, description: metaOrHide, type: defaultValue !== null && defaultValue !== undefined ? typeof defaultValue : undefined });\n\t\t}\n\t}\n\n\tpublic bindTo(target: IContextKeyService): IContextKey<T> {\n\t\treturn target.createKey(this.key, this._defaultValue);\n\t}\n\n\tpublic getValue(target: IContextKeyService): T | undefined {\n\t\treturn target.getContextKeyValue<T>(this.key);\n\t}\n\n\tpublic toNegated(): ContextKeyExpression {\n\t\treturn this.negate();\n\t}\n\n\tpublic isEqualTo(value: any): ContextKeyExpression {\n\t\treturn ContextKeyEqualsExpr.create(this.key, value);\n\t}\n\n\tpublic notEqualsTo(value: any): ContextKeyExpression {\n\t\treturn ContextKeyNotEqualsExpr.create(this.key, value);\n\t}\n\n\tpublic greater(value: any): ContextKeyExpression {\n\t\treturn ContextKeyGreaterExpr.create(this.key, value);\n\t}\n}\n\nexport type ContextKeyValue = null | undefined | boolean | number | string\n\t| Array<null | undefined | boolean | number | string>\n\t| Record<string, null | undefined | boolean | number | string>;\n\nexport interface IContext {\n\tgetValue<T extends ContextKeyValue = ContextKeyValue>(key: string): T | undefined;\n}\n\nexport interface IContextKey<T extends ContextKeyValue = ContextKeyValue> {\n\tset(value: T): void;\n\treset(): void;\n\tget(): T | undefined;\n}\n\nexport interface IContextKeyServiceTarget {\n\tparentElement: IContextKeyServiceTarget | null;\n\tsetAttribute(attr: string, value: string): void;\n\tremoveAttribute(attr: string): void;\n\thasAttribute(attr: string): boolean;\n\tgetAttribute(attr: string): string | null;\n}\n\nexport const IContextKeyService = createDecorator<IContextKeyService>('contextKeyService');\n\nexport interface IReadableSet<T> {\n\thas(value: T): boolean;\n}\n\nexport interface IContextKeyChangeEvent {\n\taffectsSome(keys: IReadableSet<string>): boolean;\n\tallKeysContainedIn(keys: IReadableSet<string>): boolean;\n}\n\nexport type IScopedContextKeyService = IContextKeyService & IDisposable;\n\nexport interface IContextKeyService {\n\treadonly _serviceBrand: undefined;\n\n\tonDidChangeContext: Event<IContextKeyChangeEvent>;\n\tbufferChangeEvents(callback: Function): void;\n\n\tcreateKey<T extends ContextKeyValue>(key: string, defaultValue: T | undefined): IContextKey<T>;\n\tcontextMatchesRules(rules: ContextKeyExpression | undefined): boolean;\n\tgetContextKeyValue<T>(key: string): T | undefined;\n\n\tcreateScoped(target: IContextKeyServiceTarget): IScopedContextKeyService;\n\tcreateOverlay(overlay: Iterable<[string, any]>): IContextKeyService;\n\tgetContext(target: IContextKeyServiceTarget | null): IContext;\n\n\tupdateParent(parentContextKeyService: IContextKeyService): void;\n}\n\nfunction cmp1(key1: string, key2: string): number {\n\tif (key1 < key2) {\n\t\treturn -1;\n\t}\n\tif (key1 > key2) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nfunction cmp2(key1: string, value1: any, key2: string, value2: any): number {\n\tif (key1 < key2) {\n\t\treturn -1;\n\t}\n\tif (key1 > key2) {\n\t\treturn 1;\n\t}\n\tif (value1 < value2) {\n\t\treturn -1;\n\t}\n\tif (value1 > value2) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n/**\n * Returns true if it is provable `p` implies `q`.\n */\nexport function implies(p: ContextKeyExpression, q: ContextKeyExpression): boolean {\n\n\tif (p.type === ContextKeyExprType.False || q.type === ContextKeyExprType.True) {\n\t\t// false implies anything\n\t\t// anything implies true\n\t\treturn true;\n\t}\n\n\tif (p.type === ContextKeyExprType.Or) {\n\t\tif (q.type === ContextKeyExprType.Or) {\n\t\t\t// `a || b || c` can only imply something like `a || b || c || d`\n\t\t\treturn allElementsIncluded(p.expr, q.expr);\n\t\t}\n\t\treturn false;\n\t}\n\n\tif (q.type === ContextKeyExprType.Or) {\n\t\tfor (const element of q.expr) {\n\t\t\tif (implies(p, element)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tif (p.type === ContextKeyExprType.And) {\n\t\tif (q.type === ContextKeyExprType.And) {\n\t\t\t// `a && b && c` implies `a && c`\n\t\t\treturn allElementsIncluded(q.expr, p.expr);\n\t\t}\n\t\tfor (const element of p.expr) {\n\t\t\tif (implies(element, q)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\treturn p.equals(q);\n}\n\n/**\n * Returns true if all elements in `p` are also present in `q`.\n * The two arrays are assumed to be sorted\n */\nfunction allElementsIncluded(p: ContextKeyExpression[], q: ContextKeyExpression[]): boolean {\n\tlet pIndex = 0;\n\tlet qIndex = 0;\n\twhile (pIndex < p.length && qIndex < q.length) {\n\t\tconst cmp = p[pIndex].cmp(q[qIndex]);\n\n\t\tif (cmp < 0) {\n\t\t\t// an element from `p` is missing from `q`\n\t\t\treturn false;\n\t\t} else if (cmp === 0) {\n\t\t\tpIndex++;\n\t\t\tqIndex++;\n\t\t} else {\n\t\t\tqIndex++;\n\t\t}\n\t}\n\treturn (pIndex === p.length);\n}\n\nfunction getTerminals(node: ContextKeyExpression) {\n\tif (node.type === ContextKeyExprType.Or) {\n\t\treturn node.expr;\n\t}\n\treturn [node];\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as nls from '../../../nls.js';\nimport { toErrorMessage } from '../../../base/common/errorMessage.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { hash } from '../../../base/common/hash.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { isWindows } from '../../../base/common/platform.js';\nimport { joinPath } from '../../../base/common/resources.js';\nimport { Mutable, isNumber, isString } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { ILocalizedString } from '../../action/common/action.js';\nimport { RawContextKey } from '../../contextkey/common/contextkey.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const ILogService = createDecorator<ILogService>('logService');\nexport const ILoggerService = createDecorator<ILoggerService>('loggerService');\n\nfunction now(): string {\n\treturn new Date().toISOString();\n}\n\nexport function isLogLevel(thing: unknown): thing is LogLevel {\n\treturn isNumber(thing);\n}\n\nexport enum LogLevel {\n\tOff,\n\tTrace,\n\tDebug,\n\tInfo,\n\tWarning,\n\tError\n}\n\nexport const DEFAULT_LOG_LEVEL: LogLevel = LogLevel.Info;\n\nexport interface ILogger extends IDisposable {\n\tonDidChangeLogLevel: Event<LogLevel>;\n\tgetLevel(): LogLevel;\n\tsetLevel(level: LogLevel): void;\n\n\ttrace(message: string, ...args: any[]): void;\n\tdebug(message: string, ...args: any[]): void;\n\tinfo(message: string, ...args: any[]): void;\n\twarn(message: string, ...args: any[]): void;\n\terror(message: string | Error, ...args: any[]): void;\n\n\t/**\n\t * An operation to flush the contents. Can be synchronous.\n\t */\n\tflush(): void;\n}\n\nexport function canLog(loggerLevel: LogLevel, messageLevel: LogLevel): boolean {\n\treturn loggerLevel !== LogLevel.Off && loggerLevel <= messageLevel;\n}\n\nexport function log(logger: ILogger, level: LogLevel, message: string): void {\n\tswitch (level) {\n\t\tcase LogLevel.Trace: logger.trace(message); break;\n\t\tcase LogLevel.Debug: logger.debug(message); break;\n\t\tcase LogLevel.Info: logger.info(message); break;\n\t\tcase LogLevel.Warning: logger.warn(message); break;\n\t\tcase LogLevel.Error: logger.error(message); break;\n\t\tcase LogLevel.Off: /* do nothing */ break;\n\t\tdefault: throw new Error(`Invalid log level ${level}`);\n\t}\n}\n\nfunction format(args: any, verbose: boolean = false): string {\n\tlet result = '';\n\n\tfor (let i = 0; i < args.length; i++) {\n\t\tlet a = args[i];\n\n\t\tif (a instanceof Error) {\n\t\t\ta = toErrorMessage(a, verbose);\n\t\t}\n\n\t\tif (typeof a === 'object') {\n\t\t\ttry {\n\t\t\t\ta = JSON.stringify(a);\n\t\t\t} catch (e) { }\n\t\t}\n\n\t\tresult += (i > 0 ? ' ' : '') + a;\n\t}\n\n\treturn result;\n}\n\nexport type LoggerGroup = {\n\treadonly id: string;\n\treadonly name: string;\n};\n\nexport interface ILogService extends ILogger {\n\treadonly _serviceBrand: undefined;\n}\n\nexport interface ILoggerOptions {\n\n\t/**\n\t * Id of the logger.\n\t */\n\tid?: string;\n\n\t/**\n\t * Name of the logger.\n\t */\n\tname?: string;\n\n\t/**\n\t * Do not create rotating files if max size exceeds.\n\t */\n\tdonotRotate?: boolean;\n\n\t/**\n\t * Do not use formatters.\n\t */\n\tdonotUseFormatters?: boolean;\n\n\t/**\n\t * When to log. Set to `always` to log always.\n\t */\n\tlogLevel?: 'always' | LogLevel;\n\n\t/**\n\t * Whether the log should be hidden from the user.\n\t */\n\thidden?: boolean;\n\n\t/**\n\t * Condition which must be true to show this logger\n\t */\n\twhen?: string;\n\n\t/**\n\t * Id of the extension that created this logger.\n\t */\n\textensionId?: string;\n\n\t/**\n\t * Group of the logger.\n\t */\n\tgroup?: LoggerGroup;\n}\n\nexport interface ILoggerResource {\n\treadonly resource: URI;\n\treadonly id: string;\n\treadonly name?: string;\n\treadonly logLevel?: LogLevel;\n\treadonly hidden?: boolean;\n\treadonly when?: string;\n\treadonly extensionId?: string;\n\treadonly group?: LoggerGroup;\n}\n\nexport type DidChangeLoggersEvent = {\n\treadonly added: Iterable<ILoggerResource>;\n\treadonly removed: Iterable<ILoggerResource>;\n};\n\nexport interface ILoggerService {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Creates a logger for the given resource, or gets one if it already exists.\n\t *\n\t * This will also register the logger with the logger service.\n\t */\n\tcreateLogger(resource: URI, options?: ILoggerOptions): ILogger;\n\n\t/**\n\t * Creates a logger with the given id in the logs folder, or gets one if it already exists.\n\t *\n\t * This will also register the logger with the logger service.\n\t */\n\tcreateLogger(id: string, options?: Omit<ILoggerOptions, 'id'>): ILogger;\n\n\t/**\n\t * Gets an existing logger, if any.\n\t */\n\tgetLogger(resourceOrId: URI | string): ILogger | undefined;\n\n\t/**\n\t * An event which fires when the log level of a logger has changed\n\t */\n\treadonly onDidChangeLogLevel: Event<LogLevel | [URI, LogLevel]>;\n\n\t/**\n\t * Set default log level.\n\t */\n\tsetLogLevel(level: LogLevel): void;\n\n\t/**\n\t * Set log level for a logger.\n\t */\n\tsetLogLevel(resource: URI, level: LogLevel): void;\n\n\t/**\n\t * Get log level for a logger or the default log level.\n\t */\n\tgetLogLevel(resource?: URI): LogLevel;\n\n\t/**\n\t * An event which fires when the visibility of a logger has changed\n\t */\n\treadonly onDidChangeVisibility: Event<[URI, boolean]>;\n\n\t/**\n\t * Set the visibility of a logger.\n\t */\n\tsetVisibility(resourceOrId: URI | string, visible: boolean): void;\n\n\t/**\n\t * An event which fires when the logger resources are changed\n\t */\n\treadonly onDidChangeLoggers: Event<DidChangeLoggersEvent>;\n\n\t/**\n\t * Register a logger with the logger service.\n\t *\n\t * Note that this will not create a logger, but only register it.\n\t *\n\t * Use `createLogger` to create a logger and register it.\n\t *\n\t * Use it when you want to register a logger that is not created by the logger service.\n\t */\n\tregisterLogger(resource: ILoggerResource): void;\n\n\t/**\n\t * Deregister the logger for the given resource.\n\t */\n\tderegisterLogger(idOrResource: URI | string): void;\n\n\t/**\n\t * Get all registered loggers\n\t */\n\tgetRegisteredLoggers(): Iterable<ILoggerResource>;\n\n\t/**\n\t * Get the registered logger for the given resource.\n\t */\n\tgetRegisteredLogger(resource: URI): ILoggerResource | undefined;\n}\n\nexport abstract class AbstractLogger extends Disposable implements ILogger {\n\n\tprivate level: LogLevel = DEFAULT_LOG_LEVEL;\n\tprivate readonly _onDidChangeLogLevel: Emitter<LogLevel> = this._register(new Emitter<LogLevel>());\n\treadonly onDidChangeLogLevel: Event<LogLevel> = this._onDidChangeLogLevel.event;\n\n\tsetLevel(level: LogLevel): void {\n\t\tif (this.level !== level) {\n\t\t\tthis.level = level;\n\t\t\tthis._onDidChangeLogLevel.fire(this.level);\n\t\t}\n\t}\n\n\tgetLevel(): LogLevel {\n\t\treturn this.level;\n\t}\n\n\tprotected checkLogLevel(level: LogLevel): boolean {\n\t\treturn canLog(this.level, level);\n\t}\n\n\tprotected canLog(level: LogLevel): boolean {\n\t\tif (this._store.isDisposed) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this.checkLogLevel(level);\n\t}\n\n\tabstract trace(message: string, ...args: any[]): void;\n\tabstract debug(message: string, ...args: any[]): void;\n\tabstract info(message: string, ...args: any[]): void;\n\tabstract warn(message: string, ...args: any[]): void;\n\tabstract error(message: string | Error, ...args: any[]): void;\n\tabstract flush(): void;\n}\n\nexport abstract class AbstractMessageLogger extends AbstractLogger implements ILogger {\n\n\tconstructor(private readonly logAlways?: boolean) {\n\t\tsuper();\n\t}\n\n\tprotected override checkLogLevel(level: LogLevel): boolean {\n\t\treturn this.logAlways || super.checkLogLevel(level);\n\t}\n\n\ttrace(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Trace)) {\n\t\t\tthis.log(LogLevel.Trace, format([message, ...args], true));\n\t\t}\n\t}\n\n\tdebug(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Debug)) {\n\t\t\tthis.log(LogLevel.Debug, format([message, ...args]));\n\t\t}\n\t}\n\n\tinfo(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Info)) {\n\t\t\tthis.log(LogLevel.Info, format([message, ...args]));\n\t\t}\n\t}\n\n\twarn(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Warning)) {\n\t\t\tthis.log(LogLevel.Warning, format([message, ...args]));\n\t\t}\n\t}\n\n\terror(message: string | Error, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Error)) {\n\t\t\tif (message instanceof Error) {\n\t\t\t\tconst array = Array.prototype.slice.call(arguments) as any[];\n\t\t\t\tarray[0] = message.stack;\n\t\t\t\tthis.log(LogLevel.Error, format(array));\n\t\t\t} else {\n\t\t\t\tthis.log(LogLevel.Error, format([message, ...args]));\n\t\t\t}\n\t\t}\n\t}\n\n\tflush(): void { }\n\n\tprotected abstract log(level: LogLevel, message: string): void;\n}\n\n\nexport class ConsoleMainLogger extends AbstractLogger implements ILogger {\n\n\tprivate useColors: boolean;\n\n\tconstructor(logLevel: LogLevel = DEFAULT_LOG_LEVEL) {\n\t\tsuper();\n\t\tthis.setLevel(logLevel);\n\t\tthis.useColors = !isWindows;\n\t}\n\n\ttrace(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Trace)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log(`\\x1b[90m[main ${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(`[main ${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\tdebug(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Debug)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log(`\\x1b[90m[main ${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(`[main ${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\tinfo(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Info)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log(`\\x1b[90m[main ${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(`[main ${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\twarn(message: string | Error, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Warning)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.warn(`\\x1b[93m[main ${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.warn(`[main ${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\terror(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Error)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.error(`\\x1b[91m[main ${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.error(`[main ${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\tflush(): void {\n\t\t// noop\n\t}\n\n}\n\nexport class ConsoleLogger extends AbstractLogger implements ILogger {\n\n\tconstructor(logLevel: LogLevel = DEFAULT_LOG_LEVEL, private readonly useColors: boolean = true) {\n\t\tsuper();\n\t\tthis.setLevel(logLevel);\n\t}\n\n\ttrace(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Trace)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log('%cTRACE', 'color: #888', message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\tdebug(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Debug)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log('%cDEBUG', 'background: #eee; color: #888', message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\tinfo(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Info)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log('%c INFO', 'color: #33f', message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\twarn(message: string | Error, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Warning)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.warn('%c WARN', 'color: #993', message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\terror(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Error)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.error('%c  ERR', 'color: #f33', message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.error(message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\n\tflush(): void {\n\t\t// noop\n\t}\n}\n\nexport class AdapterLogger extends AbstractLogger implements ILogger {\n\n\tconstructor(private readonly adapter: { log: (logLevel: LogLevel, args: any[]) => void }, logLevel: LogLevel = DEFAULT_LOG_LEVEL) {\n\t\tsuper();\n\t\tthis.setLevel(logLevel);\n\t}\n\n\ttrace(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Trace)) {\n\t\t\tthis.adapter.log(LogLevel.Trace, [this.extractMessage(message), ...args]);\n\t\t}\n\t}\n\n\tdebug(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Debug)) {\n\t\t\tthis.adapter.log(LogLevel.Debug, [this.extractMessage(message), ...args]);\n\t\t}\n\t}\n\n\tinfo(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Info)) {\n\t\t\tthis.adapter.log(LogLevel.Info, [this.extractMessage(message), ...args]);\n\t\t}\n\t}\n\n\twarn(message: string | Error, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Warning)) {\n\t\t\tthis.adapter.log(LogLevel.Warning, [this.extractMessage(message), ...args]);\n\t\t}\n\t}\n\n\terror(message: string | Error, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Error)) {\n\t\t\tthis.adapter.log(LogLevel.Error, [this.extractMessage(message), ...args]);\n\t\t}\n\t}\n\n\tprivate extractMessage(msg: string | Error): string {\n\t\tif (typeof msg === 'string') {\n\t\t\treturn msg;\n\t\t}\n\n\t\treturn toErrorMessage(msg, this.canLog(LogLevel.Trace));\n\t}\n\n\tflush(): void {\n\t\t// noop\n\t}\n}\n\nexport class MultiplexLogger extends AbstractLogger implements ILogger {\n\n\tconstructor(private readonly loggers: ReadonlyArray<ILogger>) {\n\t\tsuper();\n\t\tif (loggers.length) {\n\t\t\tthis.setLevel(loggers[0].getLevel());\n\t\t}\n\t}\n\n\toverride setLevel(level: LogLevel): void {\n\t\tfor (const logger of this.loggers) {\n\t\t\tlogger.setLevel(level);\n\t\t}\n\t\tsuper.setLevel(level);\n\t}\n\n\ttrace(message: string, ...args: any[]): void {\n\t\tfor (const logger of this.loggers) {\n\t\t\tlogger.trace(message, ...args);\n\t\t}\n\t}\n\n\tdebug(message: string, ...args: any[]): void {\n\t\tfor (const logger of this.loggers) {\n\t\t\tlogger.debug(message, ...args);\n\t\t}\n\t}\n\n\tinfo(message: string, ...args: any[]): void {\n\t\tfor (const logger of this.loggers) {\n\t\t\tlogger.info(message, ...args);\n\t\t}\n\t}\n\n\twarn(message: string, ...args: any[]): void {\n\t\tfor (const logger of this.loggers) {\n\t\t\tlogger.warn(message, ...args);\n\t\t}\n\t}\n\n\terror(message: string | Error, ...args: any[]): void {\n\t\tfor (const logger of this.loggers) {\n\t\t\tlogger.error(message, ...args);\n\t\t}\n\t}\n\n\tflush(): void {\n\t\tfor (const logger of this.loggers) {\n\t\t\tlogger.flush();\n\t\t}\n\t}\n\n\toverride dispose(): void {\n\t\tfor (const logger of this.loggers) {\n\t\t\tlogger.dispose();\n\t\t}\n\t\tsuper.dispose();\n\t}\n}\n\ntype LoggerEntry = { logger: ILogger | undefined; info: Mutable<ILoggerResource> };\n\nexport abstract class AbstractLoggerService extends Disposable implements ILoggerService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly _loggers = new ResourceMap<LoggerEntry>();\n\n\tprivate _onDidChangeLoggers = this._register(new Emitter<{ added: ILoggerResource[]; removed: ILoggerResource[] }>);\n\treadonly onDidChangeLoggers = this._onDidChangeLoggers.event;\n\n\tprivate _onDidChangeLogLevel = this._register(new Emitter<LogLevel | [URI, LogLevel]>);\n\treadonly onDidChangeLogLevel = this._onDidChangeLogLevel.event;\n\n\tprivate _onDidChangeVisibility = this._register(new Emitter<[URI, boolean]>);\n\treadonly onDidChangeVisibility = this._onDidChangeVisibility.event;\n\n\tconstructor(\n\t\tprotected logLevel: LogLevel,\n\t\tprivate readonly logsHome: URI,\n\t\tloggerResources?: Iterable<ILoggerResource>,\n\t) {\n\t\tsuper();\n\t\tif (loggerResources) {\n\t\t\tfor (const loggerResource of loggerResources) {\n\t\t\t\tthis._loggers.set(loggerResource.resource, { logger: undefined, info: loggerResource });\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getLoggerEntry(resourceOrId: URI | string): LoggerEntry | undefined {\n\t\tif (isString(resourceOrId)) {\n\t\t\treturn [...this._loggers.values()].find(logger => logger.info.id === resourceOrId);\n\t\t}\n\t\treturn this._loggers.get(resourceOrId);\n\t}\n\n\tgetLogger(resourceOrId: URI | string): ILogger | undefined {\n\t\treturn this.getLoggerEntry(resourceOrId)?.logger;\n\t}\n\n\tcreateLogger(idOrResource: URI | string, options?: ILoggerOptions): ILogger {\n\t\tconst resource = this.toResource(idOrResource);\n\t\tconst id = isString(idOrResource) ? idOrResource : (options?.id ?? hash(resource.toString()).toString(16));\n\t\tlet logger = this._loggers.get(resource)?.logger;\n\t\tconst logLevel = options?.logLevel === 'always' ? LogLevel.Trace : options?.logLevel;\n\t\tif (!logger) {\n\t\t\tlogger = this.doCreateLogger(resource, logLevel ?? this.getLogLevel(resource) ?? this.logLevel, { ...options, id });\n\t\t}\n\t\tconst loggerEntry: LoggerEntry = {\n\t\t\tlogger,\n\t\t\tinfo: {\n\t\t\t\tresource,\n\t\t\t\tid,\n\t\t\t\tlogLevel,\n\t\t\t\tname: options?.name,\n\t\t\t\thidden: options?.hidden,\n\t\t\t\tgroup: options?.group,\n\t\t\t\textensionId: options?.extensionId,\n\t\t\t\twhen: options?.when\n\t\t\t}\n\t\t};\n\t\tthis.registerLogger(loggerEntry.info);\n\t\t// TODO: @sandy081 Remove this once registerLogger can take ILogger\n\t\tthis._loggers.set(resource, loggerEntry);\n\t\treturn logger;\n\t}\n\n\tprotected toResource(idOrResource: string | URI): URI {\n\t\treturn isString(idOrResource) ? joinPath(this.logsHome, `${idOrResource}.log`) : idOrResource;\n\t}\n\n\tsetLogLevel(logLevel: LogLevel): void;\n\tsetLogLevel(resource: URI, logLevel: LogLevel): void;\n\tsetLogLevel(arg1: any, arg2?: any): void {\n\t\tif (URI.isUri(arg1)) {\n\t\t\tconst resource = arg1;\n\t\t\tconst logLevel = arg2;\n\t\t\tconst logger = this._loggers.get(resource);\n\t\t\tif (logger && logLevel !== logger.info.logLevel) {\n\t\t\t\tlogger.info.logLevel = logLevel === this.logLevel ? undefined : logLevel;\n\t\t\t\tlogger.logger?.setLevel(logLevel);\n\t\t\t\tthis._loggers.set(logger.info.resource, logger);\n\t\t\t\tthis._onDidChangeLogLevel.fire([resource, logLevel]);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.logLevel = arg1;\n\t\t\tfor (const [resource, logger] of this._loggers.entries()) {\n\t\t\t\tif (this._loggers.get(resource)?.info.logLevel === undefined) {\n\t\t\t\t\tlogger.logger?.setLevel(this.logLevel);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._onDidChangeLogLevel.fire(this.logLevel);\n\t\t}\n\t}\n\n\tsetVisibility(resourceOrId: URI | string, visibility: boolean): void {\n\t\tconst logger = this.getLoggerEntry(resourceOrId);\n\t\tif (logger && visibility !== !logger.info.hidden) {\n\t\t\tlogger.info.hidden = !visibility;\n\t\t\tthis._loggers.set(logger.info.resource, logger);\n\t\t\tthis._onDidChangeVisibility.fire([logger.info.resource, visibility]);\n\t\t}\n\t}\n\n\tgetLogLevel(resource?: URI): LogLevel {\n\t\tlet logLevel;\n\t\tif (resource) {\n\t\t\tlogLevel = this._loggers.get(resource)?.info.logLevel;\n\t\t}\n\t\treturn logLevel ?? this.logLevel;\n\t}\n\n\tregisterLogger(resource: ILoggerResource): void {\n\t\tconst existing = this._loggers.get(resource.resource);\n\t\tif (existing) {\n\t\t\tif (existing.info.hidden !== resource.hidden) {\n\t\t\t\tthis.setVisibility(resource.resource, !resource.hidden);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._loggers.set(resource.resource, { info: resource, logger: undefined });\n\t\t\tthis._onDidChangeLoggers.fire({ added: [resource], removed: [] });\n\t\t}\n\t}\n\n\tderegisterLogger(idOrResource: URI | string): void {\n\t\tconst resource = this.toResource(idOrResource);\n\t\tconst existing = this._loggers.get(resource);\n\t\tif (existing) {\n\t\t\tif (existing.logger) {\n\t\t\t\texisting.logger.dispose();\n\t\t\t}\n\t\t\tthis._loggers.delete(resource);\n\t\t\tthis._onDidChangeLoggers.fire({ added: [], removed: [existing.info] });\n\t\t}\n\t}\n\n\t*getRegisteredLoggers(): Iterable<ILoggerResource> {\n\t\tfor (const entry of this._loggers.values()) {\n\t\t\tyield entry.info;\n\t\t}\n\t}\n\n\tgetRegisteredLogger(resource: URI): ILoggerResource | undefined {\n\t\treturn this._loggers.get(resource)?.info;\n\t}\n\n\toverride dispose(): void {\n\t\tthis._loggers.forEach(logger => logger.logger?.dispose());\n\t\tthis._loggers.clear();\n\t\tsuper.dispose();\n\t}\n\n\tprotected abstract doCreateLogger(resource: URI, logLevel: LogLevel, options?: ILoggerOptions): ILogger;\n}\n\nexport class NullLogger implements ILogger {\n\treadonly onDidChangeLogLevel: Event<LogLevel> = new Emitter<LogLevel>().event;\n\tsetLevel(level: LogLevel): void { }\n\tgetLevel(): LogLevel { return LogLevel.Info; }\n\ttrace(message: string, ...args: any[]): void { }\n\tdebug(message: string, ...args: any[]): void { }\n\tinfo(message: string, ...args: any[]): void { }\n\twarn(message: string, ...args: any[]): void { }\n\terror(message: string | Error, ...args: any[]): void { }\n\tcritical(message: string | Error, ...args: any[]): void { }\n\tdispose(): void { }\n\tflush(): void { }\n}\n\nexport class NullLogService extends NullLogger implements ILogService {\n\tdeclare readonly _serviceBrand: undefined;\n}\n\nexport class NullLoggerService extends AbstractLoggerService {\n\tconstructor() {\n\t\tsuper(LogLevel.Off, URI.parse('log:///log'));\n\t}\n\tprotected override doCreateLogger(resource: URI, logLevel: LogLevel, options?: ILoggerOptions): ILogger {\n\t\treturn new NullLogger();\n\t}\n}\n\nexport function getLogLevel(environmentService: IEnvironmentService): LogLevel {\n\tif (environmentService.verbose) {\n\t\treturn LogLevel.Trace;\n\t}\n\tif (typeof environmentService.logLevel === 'string') {\n\t\tconst logLevel = parseLogLevel(environmentService.logLevel.toLowerCase());\n\t\tif (logLevel !== undefined) {\n\t\t\treturn logLevel;\n\t\t}\n\t}\n\treturn DEFAULT_LOG_LEVEL;\n}\n\nexport function LogLevelToString(logLevel: LogLevel): string {\n\tswitch (logLevel) {\n\t\tcase LogLevel.Trace: return 'trace';\n\t\tcase LogLevel.Debug: return 'debug';\n\t\tcase LogLevel.Info: return 'info';\n\t\tcase LogLevel.Warning: return 'warn';\n\t\tcase LogLevel.Error: return 'error';\n\t\tcase LogLevel.Off: return 'off';\n\t}\n}\n\nexport function LogLevelToLocalizedString(logLevel: LogLevel): ILocalizedString {\n\tswitch (logLevel) {\n\t\tcase LogLevel.Trace: return { original: 'Trace', value: nls.localize('trace', \"Trace\") };\n\t\tcase LogLevel.Debug: return { original: 'Debug', value: nls.localize('debug', \"Debug\") };\n\t\tcase LogLevel.Info: return { original: 'Info', value: nls.localize('info', \"Info\") };\n\t\tcase LogLevel.Warning: return { original: 'Warning', value: nls.localize('warn', \"Warning\") };\n\t\tcase LogLevel.Error: return { original: 'Error', value: nls.localize('error', \"Error\") };\n\t\tcase LogLevel.Off: return { original: 'Off', value: nls.localize('off', \"Off\") };\n\t}\n}\n\nexport function parseLogLevel(logLevel: string): LogLevel | undefined {\n\tswitch (logLevel) {\n\t\tcase 'trace':\n\t\t\treturn LogLevel.Trace;\n\t\tcase 'debug':\n\t\t\treturn LogLevel.Debug;\n\t\tcase 'info':\n\t\t\treturn LogLevel.Info;\n\t\tcase 'warn':\n\t\t\treturn LogLevel.Warning;\n\t\tcase 'error':\n\t\t\treturn LogLevel.Error;\n\t\tcase 'critical':\n\t\t\treturn LogLevel.Error;\n\t\tcase 'off':\n\t\t\treturn LogLevel.Off;\n\t}\n\treturn undefined;\n}\n\n// Contexts\nexport const CONTEXT_LOG_LEVEL = new RawContextKey<string>('logLevel', LogLevelToString(LogLevel.Info));\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport class SyncDescriptor<T> {\n\n\treadonly ctor: any;\n\treadonly staticArguments: any[];\n\treadonly supportsDelayedInstantiation: boolean;\n\n\tconstructor(ctor: new (...args: any[]) => T, staticArguments: any[] = [], supportsDelayedInstantiation: boolean = false) {\n\t\tthis.ctor = ctor;\n\t\tthis.staticArguments = staticArguments;\n\t\tthis.supportsDelayedInstantiation = supportsDelayedInstantiation;\n\t}\n}\n\nexport interface SyncDescriptor0<T> {\n\treadonly ctor: new () => T;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport const enum ScanError {\n\tNone = 0,\n\tUnexpectedEndOfComment = 1,\n\tUnexpectedEndOfString = 2,\n\tUnexpectedEndOfNumber = 3,\n\tInvalidUnicode = 4,\n\tInvalidEscapeCharacter = 5,\n\tInvalidCharacter = 6\n}\n\nexport const enum SyntaxKind {\n\tOpenBraceToken = 1,\n\tCloseBraceToken = 2,\n\tOpenBracketToken = 3,\n\tCloseBracketToken = 4,\n\tCommaToken = 5,\n\tColonToken = 6,\n\tNullKeyword = 7,\n\tTrueKeyword = 8,\n\tFalseKeyword = 9,\n\tStringLiteral = 10,\n\tNumericLiteral = 11,\n\tLineCommentTrivia = 12,\n\tBlockCommentTrivia = 13,\n\tLineBreakTrivia = 14,\n\tTrivia = 15,\n\tUnknown = 16,\n\tEOF = 17\n}\n\n/**\n * The scanner object, representing a JSON scanner at a position in the input string.\n */\nexport interface JSONScanner {\n\t/**\n\t * Sets the scan position to a new offset. A call to 'scan' is needed to get the first token.\n\t */\n\tsetPosition(pos: number): void;\n\t/**\n\t * Read the next token. Returns the token code.\n\t */\n\tscan(): SyntaxKind;\n\t/**\n\t * Returns the current scan position, which is after the last read token.\n\t */\n\tgetPosition(): number;\n\t/**\n\t * Returns the last read token.\n\t */\n\tgetToken(): SyntaxKind;\n\t/**\n\t * Returns the last read token value. The value for strings is the decoded string content. For numbers its of type number, for boolean it's true or false.\n\t */\n\tgetTokenValue(): string;\n\t/**\n\t * The start offset of the last read token.\n\t */\n\tgetTokenOffset(): number;\n\t/**\n\t * The length of the last read token.\n\t */\n\tgetTokenLength(): number;\n\t/**\n\t * An error code of the last scan.\n\t */\n\tgetTokenError(): ScanError;\n}\n\n\n\nexport interface ParseError {\n\terror: ParseErrorCode;\n\toffset: number;\n\tlength: number;\n}\n\nexport const enum ParseErrorCode {\n\tInvalidSymbol = 1,\n\tInvalidNumberFormat = 2,\n\tPropertyNameExpected = 3,\n\tValueExpected = 4,\n\tColonExpected = 5,\n\tCommaExpected = 6,\n\tCloseBraceExpected = 7,\n\tCloseBracketExpected = 8,\n\tEndOfFileExpected = 9,\n\tInvalidCommentToken = 10,\n\tUnexpectedEndOfComment = 11,\n\tUnexpectedEndOfString = 12,\n\tUnexpectedEndOfNumber = 13,\n\tInvalidUnicode = 14,\n\tInvalidEscapeCharacter = 15,\n\tInvalidCharacter = 16\n}\n\nexport type NodeType = 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null';\n\nexport interface Node {\n\treadonly type: NodeType;\n\treadonly value?: any;\n\treadonly offset: number;\n\treadonly length: number;\n\treadonly colonOffset?: number;\n\treadonly parent?: Node;\n\treadonly children?: Node[];\n}\n\nexport type Segment = string | number;\nexport type JSONPath = Segment[];\n\nexport interface Location {\n\t/**\n\t * The previous property key or literal value (string, number, boolean or null) or undefined.\n\t */\n\tpreviousNode?: Node;\n\t/**\n\t * The path describing the location in the JSON document. The path consists of a sequence strings\n\t * representing an object property or numbers for array indices.\n\t */\n\tpath: JSONPath;\n\t/**\n\t * Matches the locations path against a pattern consisting of strings (for properties) and numbers (for array indices).\n\t * '*' will match a single segment, of any property name or index.\n\t * '**' will match a sequence of segments or no segment, of any property name or index.\n\t */\n\tmatches: (patterns: JSONPath) => boolean;\n\t/**\n\t * If set, the location's offset is at a property key.\n\t */\n\tisAtPropertyKey: boolean;\n}\n\nexport interface ParseOptions {\n\tdisallowComments?: boolean;\n\tallowTrailingComma?: boolean;\n\tallowEmptyContent?: boolean;\n}\n\nexport namespace ParseOptions {\n\texport const DEFAULT = {\n\t\tallowTrailingComma: true\n\t};\n}\n\nexport interface JSONVisitor {\n\t/**\n\t * Invoked when an open brace is encountered and an object is started. The offset and length represent the location of the open brace.\n\t */\n\tonObjectBegin?: (offset: number, length: number) => void;\n\n\t/**\n\t * Invoked when a property is encountered. The offset and length represent the location of the property name.\n\t */\n\tonObjectProperty?: (property: string, offset: number, length: number) => void;\n\n\t/**\n\t * Invoked when a closing brace is encountered and an object is completed. The offset and length represent the location of the closing brace.\n\t */\n\tonObjectEnd?: (offset: number, length: number) => void;\n\n\t/**\n\t * Invoked when an open bracket is encountered. The offset and length represent the location of the open bracket.\n\t */\n\tonArrayBegin?: (offset: number, length: number) => void;\n\n\t/**\n\t * Invoked when a closing bracket is encountered. The offset and length represent the location of the closing bracket.\n\t */\n\tonArrayEnd?: (offset: number, length: number) => void;\n\n\t/**\n\t * Invoked when a literal value is encountered. The offset and length represent the location of the literal value.\n\t */\n\tonLiteralValue?: (value: any, offset: number, length: number) => void;\n\n\t/**\n\t * Invoked when a comma or colon separator is encountered. The offset and length represent the location of the separator.\n\t */\n\tonSeparator?: (character: string, offset: number, length: number) => void;\n\n\t/**\n\t * When comments are allowed, invoked when a line or block comment is encountered. The offset and length represent the location of the comment.\n\t */\n\tonComment?: (offset: number, length: number) => void;\n\n\t/**\n\t * Invoked on an error.\n\t */\n\tonError?: (error: ParseErrorCode, offset: number, length: number) => void;\n}\n\n/**\n * Creates a JSON scanner on the given text.\n * If ignoreTrivia is set, whitespaces or comments are ignored.\n */\nexport function createScanner(text: string, ignoreTrivia: boolean = false): JSONScanner {\n\n\tlet pos = 0;\n\tconst len = text.length;\n\tlet value: string = '';\n\tlet tokenOffset = 0;\n\tlet token: SyntaxKind = SyntaxKind.Unknown;\n\tlet scanError: ScanError = ScanError.None;\n\n\tfunction scanHexDigits(count: number): number {\n\t\tlet digits = 0;\n\t\tlet hexValue = 0;\n\t\twhile (digits < count) {\n\t\t\tconst ch = text.charCodeAt(pos);\n\t\t\tif (ch >= CharacterCodes._0 && ch <= CharacterCodes._9) {\n\t\t\t\thexValue = hexValue * 16 + ch - CharacterCodes._0;\n\t\t\t}\n\t\t\telse if (ch >= CharacterCodes.A && ch <= CharacterCodes.F) {\n\t\t\t\thexValue = hexValue * 16 + ch - CharacterCodes.A + 10;\n\t\t\t}\n\t\t\telse if (ch >= CharacterCodes.a && ch <= CharacterCodes.f) {\n\t\t\t\thexValue = hexValue * 16 + ch - CharacterCodes.a + 10;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpos++;\n\t\t\tdigits++;\n\t\t}\n\t\tif (digits < count) {\n\t\t\thexValue = -1;\n\t\t}\n\t\treturn hexValue;\n\t}\n\n\tfunction setPosition(newPosition: number) {\n\t\tpos = newPosition;\n\t\tvalue = '';\n\t\ttokenOffset = 0;\n\t\ttoken = SyntaxKind.Unknown;\n\t\tscanError = ScanError.None;\n\t}\n\n\tfunction scanNumber(): string {\n\t\tconst start = pos;\n\t\tif (text.charCodeAt(pos) === CharacterCodes._0) {\n\t\t\tpos++;\n\t\t} else {\n\t\t\tpos++;\n\t\t\twhile (pos < text.length && isDigit(text.charCodeAt(pos))) {\n\t\t\t\tpos++;\n\t\t\t}\n\t\t}\n\t\tif (pos < text.length && text.charCodeAt(pos) === CharacterCodes.dot) {\n\t\t\tpos++;\n\t\t\tif (pos < text.length && isDigit(text.charCodeAt(pos))) {\n\t\t\t\tpos++;\n\t\t\t\twhile (pos < text.length && isDigit(text.charCodeAt(pos))) {\n\t\t\t\t\tpos++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tscanError = ScanError.UnexpectedEndOfNumber;\n\t\t\t\treturn text.substring(start, pos);\n\t\t\t}\n\t\t}\n\t\tlet end = pos;\n\t\tif (pos < text.length && (text.charCodeAt(pos) === CharacterCodes.E || text.charCodeAt(pos) === CharacterCodes.e)) {\n\t\t\tpos++;\n\t\t\tif (pos < text.length && text.charCodeAt(pos) === CharacterCodes.plus || text.charCodeAt(pos) === CharacterCodes.minus) {\n\t\t\t\tpos++;\n\t\t\t}\n\t\t\tif (pos < text.length && isDigit(text.charCodeAt(pos))) {\n\t\t\t\tpos++;\n\t\t\t\twhile (pos < text.length && isDigit(text.charCodeAt(pos))) {\n\t\t\t\t\tpos++;\n\t\t\t\t}\n\t\t\t\tend = pos;\n\t\t\t} else {\n\t\t\t\tscanError = ScanError.UnexpectedEndOfNumber;\n\t\t\t}\n\t\t}\n\t\treturn text.substring(start, end);\n\t}\n\n\tfunction scanString(): string {\n\n\t\tlet result = '',\n\t\t\tstart = pos;\n\n\t\twhile (true) {\n\t\t\tif (pos >= len) {\n\t\t\t\tresult += text.substring(start, pos);\n\t\t\t\tscanError = ScanError.UnexpectedEndOfString;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tconst ch = text.charCodeAt(pos);\n\t\t\tif (ch === CharacterCodes.doubleQuote) {\n\t\t\t\tresult += text.substring(start, pos);\n\t\t\t\tpos++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ch === CharacterCodes.backslash) {\n\t\t\t\tresult += text.substring(start, pos);\n\t\t\t\tpos++;\n\t\t\t\tif (pos >= len) {\n\t\t\t\t\tscanError = ScanError.UnexpectedEndOfString;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst ch2 = text.charCodeAt(pos++);\n\t\t\t\tswitch (ch2) {\n\t\t\t\t\tcase CharacterCodes.doubleQuote:\n\t\t\t\t\t\tresult += '\\\"';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CharacterCodes.backslash:\n\t\t\t\t\t\tresult += '\\\\';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CharacterCodes.slash:\n\t\t\t\t\t\tresult += '/';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CharacterCodes.b:\n\t\t\t\t\t\tresult += '\\b';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CharacterCodes.f:\n\t\t\t\t\t\tresult += '\\f';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CharacterCodes.n:\n\t\t\t\t\t\tresult += '\\n';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CharacterCodes.r:\n\t\t\t\t\t\tresult += '\\r';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CharacterCodes.t:\n\t\t\t\t\t\tresult += '\\t';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CharacterCodes.u: {\n\t\t\t\t\t\tconst ch3 = scanHexDigits(4);\n\t\t\t\t\t\tif (ch3 >= 0) {\n\t\t\t\t\t\t\tresult += String.fromCharCode(ch3);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscanError = ScanError.InvalidUnicode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tscanError = ScanError.InvalidEscapeCharacter;\n\t\t\t\t}\n\t\t\t\tstart = pos;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (ch >= 0 && ch <= 0x1F) {\n\t\t\t\tif (isLineBreak(ch)) {\n\t\t\t\t\tresult += text.substring(start, pos);\n\t\t\t\t\tscanError = ScanError.UnexpectedEndOfString;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tscanError = ScanError.InvalidCharacter;\n\t\t\t\t\t// mark as error but continue with string\n\t\t\t\t}\n\t\t\t}\n\t\t\tpos++;\n\t\t}\n\t\treturn result;\n\t}\n\n\tfunction scanNext(): SyntaxKind {\n\n\t\tvalue = '';\n\t\tscanError = ScanError.None;\n\n\t\ttokenOffset = pos;\n\n\t\tif (pos >= len) {\n\t\t\t// at the end\n\t\t\ttokenOffset = len;\n\t\t\treturn token = SyntaxKind.EOF;\n\t\t}\n\n\t\tlet code = text.charCodeAt(pos);\n\t\t// trivia: whitespace\n\t\tif (isWhitespace(code)) {\n\t\t\tdo {\n\t\t\t\tpos++;\n\t\t\t\tvalue += String.fromCharCode(code);\n\t\t\t\tcode = text.charCodeAt(pos);\n\t\t\t} while (isWhitespace(code));\n\n\t\t\treturn token = SyntaxKind.Trivia;\n\t\t}\n\n\t\t// trivia: newlines\n\t\tif (isLineBreak(code)) {\n\t\t\tpos++;\n\t\t\tvalue += String.fromCharCode(code);\n\t\t\tif (code === CharacterCodes.carriageReturn && text.charCodeAt(pos) === CharacterCodes.lineFeed) {\n\t\t\t\tpos++;\n\t\t\t\tvalue += '\\n';\n\t\t\t}\n\t\t\treturn token = SyntaxKind.LineBreakTrivia;\n\t\t}\n\n\t\tswitch (code) {\n\t\t\t// tokens: []{}:,\n\t\t\tcase CharacterCodes.openBrace:\n\t\t\t\tpos++;\n\t\t\t\treturn token = SyntaxKind.OpenBraceToken;\n\t\t\tcase CharacterCodes.closeBrace:\n\t\t\t\tpos++;\n\t\t\t\treturn token = SyntaxKind.CloseBraceToken;\n\t\t\tcase CharacterCodes.openBracket:\n\t\t\t\tpos++;\n\t\t\t\treturn token = SyntaxKind.OpenBracketToken;\n\t\t\tcase CharacterCodes.closeBracket:\n\t\t\t\tpos++;\n\t\t\t\treturn token = SyntaxKind.CloseBracketToken;\n\t\t\tcase CharacterCodes.colon:\n\t\t\t\tpos++;\n\t\t\t\treturn token = SyntaxKind.ColonToken;\n\t\t\tcase CharacterCodes.comma:\n\t\t\t\tpos++;\n\t\t\t\treturn token = SyntaxKind.CommaToken;\n\n\t\t\t// strings\n\t\t\tcase CharacterCodes.doubleQuote:\n\t\t\t\tpos++;\n\t\t\t\tvalue = scanString();\n\t\t\t\treturn token = SyntaxKind.StringLiteral;\n\n\t\t\t// comments\n\t\t\tcase CharacterCodes.slash: {\n\t\t\t\tconst start = pos - 1;\n\t\t\t\t// Single-line comment\n\t\t\t\tif (text.charCodeAt(pos + 1) === CharacterCodes.slash) {\n\t\t\t\t\tpos += 2;\n\n\t\t\t\t\twhile (pos < len) {\n\t\t\t\t\t\tif (isLineBreak(text.charCodeAt(pos))) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpos++;\n\n\t\t\t\t\t}\n\t\t\t\t\tvalue = text.substring(start, pos);\n\t\t\t\t\treturn token = SyntaxKind.LineCommentTrivia;\n\t\t\t\t}\n\n\t\t\t\t// Multi-line comment\n\t\t\t\tif (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {\n\t\t\t\t\tpos += 2;\n\n\t\t\t\t\tconst safeLength = len - 1; // For lookahead.\n\t\t\t\t\tlet commentClosed = false;\n\t\t\t\t\twhile (pos < safeLength) {\n\t\t\t\t\t\tconst ch = text.charCodeAt(pos);\n\n\t\t\t\t\t\tif (ch === CharacterCodes.asterisk && text.charCodeAt(pos + 1) === CharacterCodes.slash) {\n\t\t\t\t\t\t\tpos += 2;\n\t\t\t\t\t\t\tcommentClosed = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpos++;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!commentClosed) {\n\t\t\t\t\t\tpos++;\n\t\t\t\t\t\tscanError = ScanError.UnexpectedEndOfComment;\n\t\t\t\t\t}\n\n\t\t\t\t\tvalue = text.substring(start, pos);\n\t\t\t\t\treturn token = SyntaxKind.BlockCommentTrivia;\n\t\t\t\t}\n\t\t\t\t// just a single slash\n\t\t\t\tvalue += String.fromCharCode(code);\n\t\t\t\tpos++;\n\t\t\t\treturn token = SyntaxKind.Unknown;\n\t\t\t}\n\t\t\t// numbers\n\t\t\tcase CharacterCodes.minus:\n\t\t\t\tvalue += String.fromCharCode(code);\n\t\t\t\tpos++;\n\t\t\t\tif (pos === len || !isDigit(text.charCodeAt(pos))) {\n\t\t\t\t\treturn token = SyntaxKind.Unknown;\n\t\t\t\t}\n\t\t\t// found a minus, followed by a number so\n\t\t\t// we fall through to proceed with scanning\n\t\t\t// numbers\n\t\t\tcase CharacterCodes._0:\n\t\t\tcase CharacterCodes._1:\n\t\t\tcase CharacterCodes._2:\n\t\t\tcase CharacterCodes._3:\n\t\t\tcase CharacterCodes._4:\n\t\t\tcase CharacterCodes._5:\n\t\t\tcase CharacterCodes._6:\n\t\t\tcase CharacterCodes._7:\n\t\t\tcase CharacterCodes._8:\n\t\t\tcase CharacterCodes._9:\n\t\t\t\tvalue += scanNumber();\n\t\t\t\treturn token = SyntaxKind.NumericLiteral;\n\t\t\t// literals and unknown symbols\n\t\t\tdefault:\n\t\t\t\t// is a literal? Read the full word.\n\t\t\t\twhile (pos < len && isUnknownContentCharacter(code)) {\n\t\t\t\t\tpos++;\n\t\t\t\t\tcode = text.charCodeAt(pos);\n\t\t\t\t}\n\t\t\t\tif (tokenOffset !== pos) {\n\t\t\t\t\tvalue = text.substring(tokenOffset, pos);\n\t\t\t\t\t// keywords: true, false, null\n\t\t\t\t\tswitch (value) {\n\t\t\t\t\t\tcase 'true': return token = SyntaxKind.TrueKeyword;\n\t\t\t\t\t\tcase 'false': return token = SyntaxKind.FalseKeyword;\n\t\t\t\t\t\tcase 'null': return token = SyntaxKind.NullKeyword;\n\t\t\t\t\t}\n\t\t\t\t\treturn token = SyntaxKind.Unknown;\n\t\t\t\t}\n\t\t\t\t// some\n\t\t\t\tvalue += String.fromCharCode(code);\n\t\t\t\tpos++;\n\t\t\t\treturn token = SyntaxKind.Unknown;\n\t\t}\n\t}\n\n\tfunction isUnknownContentCharacter(code: CharacterCodes) {\n\t\tif (isWhitespace(code) || isLineBreak(code)) {\n\t\t\treturn false;\n\t\t}\n\t\tswitch (code) {\n\t\t\tcase CharacterCodes.closeBrace:\n\t\t\tcase CharacterCodes.closeBracket:\n\t\t\tcase CharacterCodes.openBrace:\n\t\t\tcase CharacterCodes.openBracket:\n\t\t\tcase CharacterCodes.doubleQuote:\n\t\t\tcase CharacterCodes.colon:\n\t\t\tcase CharacterCodes.comma:\n\t\t\tcase CharacterCodes.slash:\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\n\tfunction scanNextNonTrivia(): SyntaxKind {\n\t\tlet result: SyntaxKind;\n\t\tdo {\n\t\t\tresult = scanNext();\n\t\t} while (result >= SyntaxKind.LineCommentTrivia && result <= SyntaxKind.Trivia);\n\t\treturn result;\n\t}\n\n\treturn {\n\t\tsetPosition: setPosition,\n\t\tgetPosition: () => pos,\n\t\tscan: ignoreTrivia ? scanNextNonTrivia : scanNext,\n\t\tgetToken: () => token,\n\t\tgetTokenValue: () => value,\n\t\tgetTokenOffset: () => tokenOffset,\n\t\tgetTokenLength: () => pos - tokenOffset,\n\t\tgetTokenError: () => scanError\n\t};\n}\n\nfunction isWhitespace(ch: number): boolean {\n\treturn ch === CharacterCodes.space || ch === CharacterCodes.tab || ch === CharacterCodes.verticalTab || ch === CharacterCodes.formFeed ||\n\t\tch === CharacterCodes.nonBreakingSpace || ch === CharacterCodes.ogham || ch >= CharacterCodes.enQuad && ch <= CharacterCodes.zeroWidthSpace ||\n\t\tch === CharacterCodes.narrowNoBreakSpace || ch === CharacterCodes.mathematicalSpace || ch === CharacterCodes.ideographicSpace || ch === CharacterCodes.byteOrderMark;\n}\n\nfunction isLineBreak(ch: number): boolean {\n\treturn ch === CharacterCodes.lineFeed || ch === CharacterCodes.carriageReturn || ch === CharacterCodes.lineSeparator || ch === CharacterCodes.paragraphSeparator;\n}\n\nfunction isDigit(ch: number): boolean {\n\treturn ch >= CharacterCodes._0 && ch <= CharacterCodes._9;\n}\n\nconst enum CharacterCodes {\n\tnullCharacter = 0,\n\tmaxAsciiCharacter = 0x7F,\n\n\tlineFeed = 0x0A,              // \\n\n\tcarriageReturn = 0x0D,        // \\r\n\tlineSeparator = 0x2028,\n\tparagraphSeparator = 0x2029,\n\n\t// REVIEW: do we need to support this?  The scanner doesn't, but our IText does.  This seems\n\t// like an odd disparity?  (Or maybe it's completely fine for them to be different).\n\tnextLine = 0x0085,\n\n\t// Unicode 3.0 space characters\n\tspace = 0x0020,   // \" \"\n\tnonBreakingSpace = 0x00A0,   //\n\tenQuad = 0x2000,\n\temQuad = 0x2001,\n\tenSpace = 0x2002,\n\temSpace = 0x2003,\n\tthreePerEmSpace = 0x2004,\n\tfourPerEmSpace = 0x2005,\n\tsixPerEmSpace = 0x2006,\n\tfigureSpace = 0x2007,\n\tpunctuationSpace = 0x2008,\n\tthinSpace = 0x2009,\n\thairSpace = 0x200A,\n\tzeroWidthSpace = 0x200B,\n\tnarrowNoBreakSpace = 0x202F,\n\tideographicSpace = 0x3000,\n\tmathematicalSpace = 0x205F,\n\togham = 0x1680,\n\n\t_ = 0x5F,\n\t$ = 0x24,\n\n\t_0 = 0x30,\n\t_1 = 0x31,\n\t_2 = 0x32,\n\t_3 = 0x33,\n\t_4 = 0x34,\n\t_5 = 0x35,\n\t_6 = 0x36,\n\t_7 = 0x37,\n\t_8 = 0x38,\n\t_9 = 0x39,\n\n\ta = 0x61,\n\tb = 0x62,\n\tc = 0x63,\n\td = 0x64,\n\te = 0x65,\n\tf = 0x66,\n\tg = 0x67,\n\th = 0x68,\n\ti = 0x69,\n\tj = 0x6A,\n\tk = 0x6B,\n\tl = 0x6C,\n\tm = 0x6D,\n\tn = 0x6E,\n\to = 0x6F,\n\tp = 0x70,\n\tq = 0x71,\n\tr = 0x72,\n\ts = 0x73,\n\tt = 0x74,\n\tu = 0x75,\n\tv = 0x76,\n\tw = 0x77,\n\tx = 0x78,\n\ty = 0x79,\n\tz = 0x7A,\n\n\tA = 0x41,\n\tB = 0x42,\n\tC = 0x43,\n\tD = 0x44,\n\tE = 0x45,\n\tF = 0x46,\n\tG = 0x47,\n\tH = 0x48,\n\tI = 0x49,\n\tJ = 0x4A,\n\tK = 0x4B,\n\tL = 0x4C,\n\tM = 0x4D,\n\tN = 0x4E,\n\tO = 0x4F,\n\tP = 0x50,\n\tQ = 0x51,\n\tR = 0x52,\n\tS = 0x53,\n\tT = 0x54,\n\tU = 0x55,\n\tV = 0x56,\n\tW = 0x57,\n\tX = 0x58,\n\tY = 0x59,\n\tZ = 0x5A,\n\n\tampersand = 0x26,             // &\n\tasterisk = 0x2A,              // *\n\tat = 0x40,                    // @\n\tbackslash = 0x5C,             // \\\n\tbar = 0x7C,                   // |\n\tcaret = 0x5E,                 // ^\n\tcloseBrace = 0x7D,            // }\n\tcloseBracket = 0x5D,          // ]\n\tcloseParen = 0x29,            // )\n\tcolon = 0x3A,                 // :\n\tcomma = 0x2C,                 // ,\n\tdot = 0x2E,                   // .\n\tdoubleQuote = 0x22,           // \"\n\tequals = 0x3D,                // =\n\texclamation = 0x21,           // !\n\tgreaterThan = 0x3E,           // >\n\tlessThan = 0x3C,              // <\n\tminus = 0x2D,                 // -\n\topenBrace = 0x7B,             // {\n\topenBracket = 0x5B,           // [\n\topenParen = 0x28,             // (\n\tpercent = 0x25,               // %\n\tplus = 0x2B,                  // +\n\tquestion = 0x3F,              // ?\n\tsemicolon = 0x3B,             // ;\n\tsingleQuote = 0x27,           // '\n\tslash = 0x2F,                 // /\n\ttilde = 0x7E,                 // ~\n\n\tbackspace = 0x08,             // \\b\n\tformFeed = 0x0C,              // \\f\n\tbyteOrderMark = 0xFEFF,\n\ttab = 0x09,                   // \\t\n\tverticalTab = 0x0B,           // \\v\n}\n\ninterface NodeImpl extends Node {\n\ttype: NodeType;\n\tvalue?: any;\n\toffset: number;\n\tlength: number;\n\tcolonOffset?: number;\n\tparent?: NodeImpl;\n\tchildren?: NodeImpl[];\n}\n\n/**\n * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.\n */\nexport function getLocation(text: string, position: number): Location {\n\tconst segments: Segment[] = []; // strings or numbers\n\tconst earlyReturnException = new Object();\n\tlet previousNode: NodeImpl | undefined = undefined;\n\tconst previousNodeInst: NodeImpl = {\n\t\tvalue: {},\n\t\toffset: 0,\n\t\tlength: 0,\n\t\ttype: 'object',\n\t\tparent: undefined\n\t};\n\tlet isAtPropertyKey = false;\n\tfunction setPreviousNode(value: string, offset: number, length: number, type: NodeType) {\n\t\tpreviousNodeInst.value = value;\n\t\tpreviousNodeInst.offset = offset;\n\t\tpreviousNodeInst.length = length;\n\t\tpreviousNodeInst.type = type;\n\t\tpreviousNodeInst.colonOffset = undefined;\n\t\tpreviousNode = previousNodeInst;\n\t}\n\ttry {\n\n\t\tvisit(text, {\n\t\t\tonObjectBegin: (offset: number, length: number) => {\n\t\t\t\tif (position <= offset) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t\tpreviousNode = undefined;\n\t\t\t\tisAtPropertyKey = position > offset;\n\t\t\t\tsegments.push(''); // push a placeholder (will be replaced)\n\t\t\t},\n\t\t\tonObjectProperty: (name: string, offset: number, length: number) => {\n\t\t\t\tif (position < offset) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t\tsetPreviousNode(name, offset, length, 'property');\n\t\t\t\tsegments[segments.length - 1] = name;\n\t\t\t\tif (position <= offset + length) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t},\n\t\t\tonObjectEnd: (offset: number, length: number) => {\n\t\t\t\tif (position <= offset) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t\tpreviousNode = undefined;\n\t\t\t\tsegments.pop();\n\t\t\t},\n\t\t\tonArrayBegin: (offset: number, length: number) => {\n\t\t\t\tif (position <= offset) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t\tpreviousNode = undefined;\n\t\t\t\tsegments.push(0);\n\t\t\t},\n\t\t\tonArrayEnd: (offset: number, length: number) => {\n\t\t\t\tif (position <= offset) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t\tpreviousNode = undefined;\n\t\t\t\tsegments.pop();\n\t\t\t},\n\t\t\tonLiteralValue: (value: any, offset: number, length: number) => {\n\t\t\t\tif (position < offset) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t\tsetPreviousNode(value, offset, length, getNodeType(value));\n\n\t\t\t\tif (position <= offset + length) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t},\n\t\t\tonSeparator: (sep: string, offset: number, length: number) => {\n\t\t\t\tif (position <= offset) {\n\t\t\t\t\tthrow earlyReturnException;\n\t\t\t\t}\n\t\t\t\tif (sep === ':' && previousNode && previousNode.type === 'property') {\n\t\t\t\t\tpreviousNode.colonOffset = offset;\n\t\t\t\t\tisAtPropertyKey = false;\n\t\t\t\t\tpreviousNode = undefined;\n\t\t\t\t} else if (sep === ',') {\n\t\t\t\t\tconst last = segments[segments.length - 1];\n\t\t\t\t\tif (typeof last === 'number') {\n\t\t\t\t\t\tsegments[segments.length - 1] = last + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tisAtPropertyKey = true;\n\t\t\t\t\t\tsegments[segments.length - 1] = '';\n\t\t\t\t\t}\n\t\t\t\t\tpreviousNode = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} catch (e) {\n\t\tif (e !== earlyReturnException) {\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\treturn {\n\t\tpath: segments,\n\t\tpreviousNode,\n\t\tisAtPropertyKey,\n\t\tmatches: (pattern: Segment[]) => {\n\t\t\tlet k = 0;\n\t\t\tfor (let i = 0; k < pattern.length && i < segments.length; i++) {\n\t\t\t\tif (pattern[k] === segments[i] || pattern[k] === '*') {\n\t\t\t\t\tk++;\n\t\t\t\t} else if (pattern[k] !== '**') {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn k === pattern.length;\n\t\t}\n\t};\n}\n\n\n/**\n * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n * Therefore always check the errors list to find out if the input was valid.\n */\nexport function parse(text: string, errors: ParseError[] = [], options: ParseOptions = ParseOptions.DEFAULT): any {\n\tlet currentProperty: string | null = null;\n\tlet currentParent: any = [];\n\tconst previousParents: any[] = [];\n\n\tfunction onValue(value: unknown) {\n\t\tif (Array.isArray(currentParent)) {\n\t\t\t(<any[]>currentParent).push(value);\n\t\t} else if (currentProperty !== null) {\n\t\t\tcurrentParent[currentProperty] = value;\n\t\t}\n\t}\n\n\tconst visitor: JSONVisitor = {\n\t\tonObjectBegin: () => {\n\t\t\tconst object = {};\n\t\t\tonValue(object);\n\t\t\tpreviousParents.push(currentParent);\n\t\t\tcurrentParent = object;\n\t\t\tcurrentProperty = null;\n\t\t},\n\t\tonObjectProperty: (name: string) => {\n\t\t\tcurrentProperty = name;\n\t\t},\n\t\tonObjectEnd: () => {\n\t\t\tcurrentParent = previousParents.pop();\n\t\t},\n\t\tonArrayBegin: () => {\n\t\t\tconst array: any[] = [];\n\t\t\tonValue(array);\n\t\t\tpreviousParents.push(currentParent);\n\t\t\tcurrentParent = array;\n\t\t\tcurrentProperty = null;\n\t\t},\n\t\tonArrayEnd: () => {\n\t\t\tcurrentParent = previousParents.pop();\n\t\t},\n\t\tonLiteralValue: onValue,\n\t\tonError: (error: ParseErrorCode, offset: number, length: number) => {\n\t\t\terrors.push({ error, offset, length });\n\t\t}\n\t};\n\tvisit(text, visitor, options);\n\treturn currentParent[0];\n}\n\n\n/**\n * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n */\nexport function parseTree(text: string, errors: ParseError[] = [], options: ParseOptions = ParseOptions.DEFAULT): Node {\n\tlet currentParent: NodeImpl = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root\n\n\tfunction ensurePropertyComplete(endOffset: number) {\n\t\tif (currentParent.type === 'property') {\n\t\t\tcurrentParent.length = endOffset - currentParent.offset;\n\t\t\tcurrentParent = currentParent.parent!;\n\t\t}\n\t}\n\n\tfunction onValue(valueNode: Node): Node {\n\t\tcurrentParent.children!.push(valueNode);\n\t\treturn valueNode;\n\t}\n\n\tconst visitor: JSONVisitor = {\n\t\tonObjectBegin: (offset: number) => {\n\t\t\tcurrentParent = onValue({ type: 'object', offset, length: -1, parent: currentParent, children: [] });\n\t\t},\n\t\tonObjectProperty: (name: string, offset: number, length: number) => {\n\t\t\tcurrentParent = onValue({ type: 'property', offset, length: -1, parent: currentParent, children: [] });\n\t\t\tcurrentParent.children!.push({ type: 'string', value: name, offset, length, parent: currentParent });\n\t\t},\n\t\tonObjectEnd: (offset: number, length: number) => {\n\t\t\tcurrentParent.length = offset + length - currentParent.offset;\n\t\t\tcurrentParent = currentParent.parent!;\n\t\t\tensurePropertyComplete(offset + length);\n\t\t},\n\t\tonArrayBegin: (offset: number, length: number) => {\n\t\t\tcurrentParent = onValue({ type: 'array', offset, length: -1, parent: currentParent, children: [] });\n\t\t},\n\t\tonArrayEnd: (offset: number, length: number) => {\n\t\t\tcurrentParent.length = offset + length - currentParent.offset;\n\t\t\tcurrentParent = currentParent.parent!;\n\t\t\tensurePropertyComplete(offset + length);\n\t\t},\n\t\tonLiteralValue: (value: unknown, offset: number, length: number) => {\n\t\t\tonValue({ type: getNodeType(value), offset, length, parent: currentParent, value });\n\t\t\tensurePropertyComplete(offset + length);\n\t\t},\n\t\tonSeparator: (sep: string, offset: number, length: number) => {\n\t\t\tif (currentParent.type === 'property') {\n\t\t\t\tif (sep === ':') {\n\t\t\t\t\tcurrentParent.colonOffset = offset;\n\t\t\t\t} else if (sep === ',') {\n\t\t\t\t\tensurePropertyComplete(offset);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonError: (error: ParseErrorCode, offset: number, length: number) => {\n\t\t\terrors.push({ error, offset, length });\n\t\t}\n\t};\n\tvisit(text, visitor, options);\n\n\tconst result = currentParent.children![0];\n\tif (result) {\n\t\tdelete result.parent;\n\t}\n\treturn result;\n}\n\n/**\n * Finds the node at the given path in a JSON DOM.\n */\nexport function findNodeAtLocation(root: Node, path: JSONPath): Node | undefined {\n\tif (!root) {\n\t\treturn undefined;\n\t}\n\tlet node = root;\n\tfor (const segment of path) {\n\t\tif (typeof segment === 'string') {\n\t\t\tif (node.type !== 'object' || !Array.isArray(node.children)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tlet found = false;\n\t\t\tfor (const propertyNode of node.children) {\n\t\t\t\tif (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) {\n\t\t\t\t\tnode = propertyNode.children[1];\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!found) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t} else {\n\t\t\tconst index = <number>segment;\n\t\t\tif (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tnode = node.children[index];\n\t\t}\n\t}\n\treturn node;\n}\n\n/**\n * Gets the JSON path of the given JSON DOM node\n */\nexport function getNodePath(node: Node): JSONPath {\n\tif (!node.parent || !node.parent.children) {\n\t\treturn [];\n\t}\n\tconst path = getNodePath(node.parent);\n\tif (node.parent.type === 'property') {\n\t\tconst key = node.parent.children[0].value;\n\t\tpath.push(key);\n\t} else if (node.parent.type === 'array') {\n\t\tconst index = node.parent.children.indexOf(node);\n\t\tif (index !== -1) {\n\t\t\tpath.push(index);\n\t\t}\n\t}\n\treturn path;\n}\n\n/**\n * Evaluates the JavaScript object of the given JSON DOM node\n */\nexport function getNodeValue(node: Node): any {\n\tswitch (node.type) {\n\t\tcase 'array':\n\t\t\treturn node.children!.map(getNodeValue);\n\t\tcase 'object': {\n\t\t\tconst obj = Object.create(null);\n\t\t\tfor (const prop of node.children!) {\n\t\t\t\tconst valueNode = prop.children![1];\n\t\t\t\tif (valueNode) {\n\t\t\t\t\tobj[prop.children![0].value] = getNodeValue(valueNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn obj;\n\t\t}\n\t\tcase 'null':\n\t\tcase 'string':\n\t\tcase 'number':\n\t\tcase 'boolean':\n\t\t\treturn node.value;\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n\n}\n\nexport function contains(node: Node, offset: number, includeRightBound = false): boolean {\n\treturn (offset >= node.offset && offset < (node.offset + node.length)) || includeRightBound && (offset === (node.offset + node.length));\n}\n\n/**\n * Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.\n */\nexport function findNodeAtOffset(node: Node, offset: number, includeRightBound = false): Node | undefined {\n\tif (contains(node, offset, includeRightBound)) {\n\t\tconst children = node.children;\n\t\tif (Array.isArray(children)) {\n\t\t\tfor (let i = 0; i < children.length && children[i].offset <= offset; i++) {\n\t\t\t\tconst item = findNodeAtOffset(children[i], offset, includeRightBound);\n\t\t\t\tif (item) {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn node;\n\t}\n\treturn undefined;\n}\n\n\n/**\n * Parses the given text and invokes the visitor functions for each object, array and literal reached.\n */\nexport function visit(text: string, visitor: JSONVisitor, options: ParseOptions = ParseOptions.DEFAULT): any {\n\n\tconst _scanner = createScanner(text, false);\n\n\tfunction toNoArgVisit(visitFunction?: (offset: number, length: number) => void): () => void {\n\t\treturn visitFunction ? () => visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength()) : () => true;\n\t}\n\tfunction toOneArgVisit<T>(visitFunction?: (arg: T, offset: number, length: number) => void): (arg: T) => void {\n\t\treturn visitFunction ? (arg: T) => visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength()) : () => true;\n\t}\n\n\tconst onObjectBegin = toNoArgVisit(visitor.onObjectBegin),\n\t\tonObjectProperty = toOneArgVisit(visitor.onObjectProperty),\n\t\tonObjectEnd = toNoArgVisit(visitor.onObjectEnd),\n\t\tonArrayBegin = toNoArgVisit(visitor.onArrayBegin),\n\t\tonArrayEnd = toNoArgVisit(visitor.onArrayEnd),\n\t\tonLiteralValue = toOneArgVisit(visitor.onLiteralValue),\n\t\tonSeparator = toOneArgVisit(visitor.onSeparator),\n\t\tonComment = toNoArgVisit(visitor.onComment),\n\t\tonError = toOneArgVisit(visitor.onError);\n\n\tconst disallowComments = options && options.disallowComments;\n\tconst allowTrailingComma = options && options.allowTrailingComma;\n\tfunction scanNext(): SyntaxKind {\n\t\twhile (true) {\n\t\t\tconst token = _scanner.scan();\n\t\t\tswitch (_scanner.getTokenError()) {\n\t\t\t\tcase ScanError.InvalidUnicode:\n\t\t\t\t\thandleError(ParseErrorCode.InvalidUnicode);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScanError.InvalidEscapeCharacter:\n\t\t\t\t\thandleError(ParseErrorCode.InvalidEscapeCharacter);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScanError.UnexpectedEndOfNumber:\n\t\t\t\t\thandleError(ParseErrorCode.UnexpectedEndOfNumber);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScanError.UnexpectedEndOfComment:\n\t\t\t\t\tif (!disallowComments) {\n\t\t\t\t\t\thandleError(ParseErrorCode.UnexpectedEndOfComment);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScanError.UnexpectedEndOfString:\n\t\t\t\t\thandleError(ParseErrorCode.UnexpectedEndOfString);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScanError.InvalidCharacter:\n\t\t\t\t\thandleError(ParseErrorCode.InvalidCharacter);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tswitch (token) {\n\t\t\t\tcase SyntaxKind.LineCommentTrivia:\n\t\t\t\tcase SyntaxKind.BlockCommentTrivia:\n\t\t\t\t\tif (disallowComments) {\n\t\t\t\t\t\thandleError(ParseErrorCode.InvalidCommentToken);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tonComment();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase SyntaxKind.Unknown:\n\t\t\t\t\thandleError(ParseErrorCode.InvalidSymbol);\n\t\t\t\t\tbreak;\n\t\t\t\tcase SyntaxKind.Trivia:\n\t\t\t\tcase SyntaxKind.LineBreakTrivia:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn token;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction handleError(error: ParseErrorCode, skipUntilAfter: SyntaxKind[] = [], skipUntil: SyntaxKind[] = []): void {\n\t\tonError(error);\n\t\tif (skipUntilAfter.length + skipUntil.length > 0) {\n\t\t\tlet token = _scanner.getToken();\n\t\t\twhile (token !== SyntaxKind.EOF) {\n\t\t\t\tif (skipUntilAfter.indexOf(token) !== -1) {\n\t\t\t\t\tscanNext();\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (skipUntil.indexOf(token) !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttoken = scanNext();\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction parseString(isValue: boolean): boolean {\n\t\tconst value = _scanner.getTokenValue();\n\t\tif (isValue) {\n\t\t\tonLiteralValue(value);\n\t\t} else {\n\t\t\tonObjectProperty(value);\n\t\t}\n\t\tscanNext();\n\t\treturn true;\n\t}\n\n\tfunction parseLiteral(): boolean {\n\t\tswitch (_scanner.getToken()) {\n\t\t\tcase SyntaxKind.NumericLiteral: {\n\t\t\t\tlet value = 0;\n\t\t\t\ttry {\n\t\t\t\t\tvalue = JSON.parse(_scanner.getTokenValue());\n\t\t\t\t\tif (typeof value !== 'number') {\n\t\t\t\t\t\thandleError(ParseErrorCode.InvalidNumberFormat);\n\t\t\t\t\t\tvalue = 0;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\thandleError(ParseErrorCode.InvalidNumberFormat);\n\t\t\t\t}\n\t\t\t\tonLiteralValue(value);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SyntaxKind.NullKeyword:\n\t\t\t\tonLiteralValue(null);\n\t\t\t\tbreak;\n\t\t\tcase SyntaxKind.TrueKeyword:\n\t\t\t\tonLiteralValue(true);\n\t\t\t\tbreak;\n\t\t\tcase SyntaxKind.FalseKeyword:\n\t\t\t\tonLiteralValue(false);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t\tscanNext();\n\t\treturn true;\n\t}\n\n\tfunction parseProperty(): boolean {\n\t\tif (_scanner.getToken() !== SyntaxKind.StringLiteral) {\n\t\t\thandleError(ParseErrorCode.PropertyNameExpected, [], [SyntaxKind.CloseBraceToken, SyntaxKind.CommaToken]);\n\t\t\treturn false;\n\t\t}\n\t\tparseString(false);\n\t\tif (_scanner.getToken() === SyntaxKind.ColonToken) {\n\t\t\tonSeparator(':');\n\t\t\tscanNext(); // consume colon\n\n\t\t\tif (!parseValue()) {\n\t\t\t\thandleError(ParseErrorCode.ValueExpected, [], [SyntaxKind.CloseBraceToken, SyntaxKind.CommaToken]);\n\t\t\t}\n\t\t} else {\n\t\t\thandleError(ParseErrorCode.ColonExpected, [], [SyntaxKind.CloseBraceToken, SyntaxKind.CommaToken]);\n\t\t}\n\t\treturn true;\n\t}\n\n\tfunction parseObject(): boolean {\n\t\tonObjectBegin();\n\t\tscanNext(); // consume open brace\n\n\t\tlet needsComma = false;\n\t\twhile (_scanner.getToken() !== SyntaxKind.CloseBraceToken && _scanner.getToken() !== SyntaxKind.EOF) {\n\t\t\tif (_scanner.getToken() === SyntaxKind.CommaToken) {\n\t\t\t\tif (!needsComma) {\n\t\t\t\t\thandleError(ParseErrorCode.ValueExpected, [], []);\n\t\t\t\t}\n\t\t\t\tonSeparator(',');\n\t\t\t\tscanNext(); // consume comma\n\t\t\t\tif (_scanner.getToken() === SyntaxKind.CloseBraceToken && allowTrailingComma) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (needsComma) {\n\t\t\t\thandleError(ParseErrorCode.CommaExpected, [], []);\n\t\t\t}\n\t\t\tif (!parseProperty()) {\n\t\t\t\thandleError(ParseErrorCode.ValueExpected, [], [SyntaxKind.CloseBraceToken, SyntaxKind.CommaToken]);\n\t\t\t}\n\t\t\tneedsComma = true;\n\t\t}\n\t\tonObjectEnd();\n\t\tif (_scanner.getToken() !== SyntaxKind.CloseBraceToken) {\n\t\t\thandleError(ParseErrorCode.CloseBraceExpected, [SyntaxKind.CloseBraceToken], []);\n\t\t} else {\n\t\t\tscanNext(); // consume close brace\n\t\t}\n\t\treturn true;\n\t}\n\n\tfunction parseArray(): boolean {\n\t\tonArrayBegin();\n\t\tscanNext(); // consume open bracket\n\n\t\tlet needsComma = false;\n\t\twhile (_scanner.getToken() !== SyntaxKind.CloseBracketToken && _scanner.getToken() !== SyntaxKind.EOF) {\n\t\t\tif (_scanner.getToken() === SyntaxKind.CommaToken) {\n\t\t\t\tif (!needsComma) {\n\t\t\t\t\thandleError(ParseErrorCode.ValueExpected, [], []);\n\t\t\t\t}\n\t\t\t\tonSeparator(',');\n\t\t\t\tscanNext(); // consume comma\n\t\t\t\tif (_scanner.getToken() === SyntaxKind.CloseBracketToken && allowTrailingComma) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (needsComma) {\n\t\t\t\thandleError(ParseErrorCode.CommaExpected, [], []);\n\t\t\t}\n\t\t\tif (!parseValue()) {\n\t\t\t\thandleError(ParseErrorCode.ValueExpected, [], [SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken]);\n\t\t\t}\n\t\t\tneedsComma = true;\n\t\t}\n\t\tonArrayEnd();\n\t\tif (_scanner.getToken() !== SyntaxKind.CloseBracketToken) {\n\t\t\thandleError(ParseErrorCode.CloseBracketExpected, [SyntaxKind.CloseBracketToken], []);\n\t\t} else {\n\t\t\tscanNext(); // consume close bracket\n\t\t}\n\t\treturn true;\n\t}\n\n\tfunction parseValue(): boolean {\n\t\tswitch (_scanner.getToken()) {\n\t\t\tcase SyntaxKind.OpenBracketToken:\n\t\t\t\treturn parseArray();\n\t\t\tcase SyntaxKind.OpenBraceToken:\n\t\t\t\treturn parseObject();\n\t\t\tcase SyntaxKind.StringLiteral:\n\t\t\t\treturn parseString(true);\n\t\t\tdefault:\n\t\t\t\treturn parseLiteral();\n\t\t}\n\t}\n\n\tscanNext();\n\tif (_scanner.getToken() === SyntaxKind.EOF) {\n\t\tif (options.allowEmptyContent) {\n\t\t\treturn true;\n\t\t}\n\t\thandleError(ParseErrorCode.ValueExpected, [], []);\n\t\treturn false;\n\t}\n\tif (!parseValue()) {\n\t\thandleError(ParseErrorCode.ValueExpected, [], []);\n\t\treturn false;\n\t}\n\tif (_scanner.getToken() !== SyntaxKind.EOF) {\n\t\thandleError(ParseErrorCode.EndOfFileExpected, [], []);\n\t}\n\treturn true;\n}\n\nexport function getNodeType(value: unknown): NodeType {\n\tswitch (typeof value) {\n\t\tcase 'boolean': return 'boolean';\n\t\tcase 'number': return 'number';\n\t\tcase 'string': return 'string';\n\t\tcase 'object': {\n\t\t\tif (!value) {\n\t\t\t\treturn 'null';\n\t\t\t} else if (Array.isArray(value)) {\n\t\t\t\treturn 'array';\n\t\t\t}\n\t\t\treturn 'object';\n\t\t}\n\t\tdefault: return 'null';\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createScanner, ScanError, SyntaxKind } from './json.js';\n\nexport interface FormattingOptions {\n\t/**\n\t * If indentation is based on spaces (`insertSpaces` = true), then what is the number of spaces that make an indent?\n\t */\n\ttabSize?: number;\n\t/**\n\t * Is indentation based on spaces?\n\t */\n\tinsertSpaces?: boolean;\n\t/**\n\t * The default 'end of line' character. If not set, '\\n' is used as default.\n\t */\n\teol?: string;\n}\n\n/**\n * Represents a text modification\n */\nexport interface Edit {\n\t/**\n\t * The start offset of the modification.\n\t */\n\toffset: number;\n\t/**\n\t * The length of the modification. Must not be negative. Empty length represents an *insert*.\n\t */\n\tlength: number;\n\t/**\n\t * The new content. Empty content represents a *remove*.\n\t */\n\tcontent: string;\n}\n\n/**\n * A text range in the document\n*/\nexport interface Range {\n\t/**\n\t * The start offset of the range.\n\t */\n\toffset: number;\n\t/**\n\t * The length of the range. Must not be negative.\n\t */\n\tlength: number;\n}\n\n\nexport function format(documentText: string, range: Range | undefined, options: FormattingOptions): Edit[] {\n\tlet initialIndentLevel: number;\n\tlet formatText: string;\n\tlet formatTextStart: number;\n\tlet rangeStart: number;\n\tlet rangeEnd: number;\n\tif (range) {\n\t\trangeStart = range.offset;\n\t\trangeEnd = rangeStart + range.length;\n\n\t\tformatTextStart = rangeStart;\n\t\twhile (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {\n\t\t\tformatTextStart--;\n\t\t}\n\t\tlet endOffset = rangeEnd;\n\t\twhile (endOffset < documentText.length && !isEOL(documentText, endOffset)) {\n\t\t\tendOffset++;\n\t\t}\n\t\tformatText = documentText.substring(formatTextStart, endOffset);\n\t\tinitialIndentLevel = computeIndentLevel(formatText, options);\n\t} else {\n\t\tformatText = documentText;\n\t\tinitialIndentLevel = 0;\n\t\tformatTextStart = 0;\n\t\trangeStart = 0;\n\t\trangeEnd = documentText.length;\n\t}\n\tconst eol = getEOL(options, documentText);\n\n\tlet lineBreak = false;\n\tlet indentLevel = 0;\n\tlet indentValue: string;\n\tif (options.insertSpaces) {\n\t\tindentValue = repeat(' ', options.tabSize || 4);\n\t} else {\n\t\tindentValue = '\\t';\n\t}\n\n\tconst scanner = createScanner(formatText, false);\n\tlet hasError = false;\n\n\tfunction newLineAndIndent(): string {\n\t\treturn eol + repeat(indentValue, initialIndentLevel + indentLevel);\n\t}\n\tfunction scanNext(): SyntaxKind {\n\t\tlet token = scanner.scan();\n\t\tlineBreak = false;\n\t\twhile (token === SyntaxKind.Trivia || token === SyntaxKind.LineBreakTrivia) {\n\t\t\tlineBreak = lineBreak || (token === SyntaxKind.LineBreakTrivia);\n\t\t\ttoken = scanner.scan();\n\t\t}\n\t\thasError = token === SyntaxKind.Unknown || scanner.getTokenError() !== ScanError.None;\n\t\treturn token;\n\t}\n\tconst editOperations: Edit[] = [];\n\tfunction addEdit(text: string, startOffset: number, endOffset: number) {\n\t\tif (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) {\n\t\t\teditOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });\n\t\t}\n\t}\n\n\tlet firstToken = scanNext();\n\n\tif (firstToken !== SyntaxKind.EOF) {\n\t\tconst firstTokenStart = scanner.getTokenOffset() + formatTextStart;\n\t\tconst initialIndent = repeat(indentValue, initialIndentLevel);\n\t\taddEdit(initialIndent, formatTextStart, firstTokenStart);\n\t}\n\n\twhile (firstToken !== SyntaxKind.EOF) {\n\t\tlet firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;\n\t\tlet secondToken = scanNext();\n\n\t\tlet replaceContent = '';\n\t\twhile (!lineBreak && (secondToken === SyntaxKind.LineCommentTrivia || secondToken === SyntaxKind.BlockCommentTrivia)) {\n\t\t\t// comments on the same line: keep them on the same line, but ignore them otherwise\n\t\t\tconst commentTokenStart = scanner.getTokenOffset() + formatTextStart;\n\t\t\taddEdit(' ', firstTokenEnd, commentTokenStart);\n\t\t\tfirstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;\n\t\t\treplaceContent = secondToken === SyntaxKind.LineCommentTrivia ? newLineAndIndent() : '';\n\t\t\tsecondToken = scanNext();\n\t\t}\n\n\t\tif (secondToken === SyntaxKind.CloseBraceToken) {\n\t\t\tif (firstToken !== SyntaxKind.OpenBraceToken) {\n\t\t\t\tindentLevel--;\n\t\t\t\treplaceContent = newLineAndIndent();\n\t\t\t}\n\t\t} else if (secondToken === SyntaxKind.CloseBracketToken) {\n\t\t\tif (firstToken !== SyntaxKind.OpenBracketToken) {\n\t\t\t\tindentLevel--;\n\t\t\t\treplaceContent = newLineAndIndent();\n\t\t\t}\n\t\t} else {\n\t\t\tswitch (firstToken) {\n\t\t\t\tcase SyntaxKind.OpenBracketToken:\n\t\t\t\tcase SyntaxKind.OpenBraceToken:\n\t\t\t\t\tindentLevel++;\n\t\t\t\t\treplaceContent = newLineAndIndent();\n\t\t\t\t\tbreak;\n\t\t\t\tcase SyntaxKind.CommaToken:\n\t\t\t\tcase SyntaxKind.LineCommentTrivia:\n\t\t\t\t\treplaceContent = newLineAndIndent();\n\t\t\t\t\tbreak;\n\t\t\t\tcase SyntaxKind.BlockCommentTrivia:\n\t\t\t\t\tif (lineBreak) {\n\t\t\t\t\t\treplaceContent = newLineAndIndent();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// symbol following comment on the same line: keep on same line, separate with ' '\n\t\t\t\t\t\treplaceContent = ' ';\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase SyntaxKind.ColonToken:\n\t\t\t\t\treplaceContent = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase SyntaxKind.StringLiteral:\n\t\t\t\t\tif (secondToken === SyntaxKind.ColonToken) {\n\t\t\t\t\t\treplaceContent = '';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t// fall through\n\t\t\t\tcase SyntaxKind.NullKeyword:\n\t\t\t\tcase SyntaxKind.TrueKeyword:\n\t\t\t\tcase SyntaxKind.FalseKeyword:\n\t\t\t\tcase SyntaxKind.NumericLiteral:\n\t\t\t\tcase SyntaxKind.CloseBraceToken:\n\t\t\t\tcase SyntaxKind.CloseBracketToken:\n\t\t\t\t\tif (secondToken === SyntaxKind.LineCommentTrivia || secondToken === SyntaxKind.BlockCommentTrivia) {\n\t\t\t\t\t\treplaceContent = ' ';\n\t\t\t\t\t} else if (secondToken !== SyntaxKind.CommaToken && secondToken !== SyntaxKind.EOF) {\n\t\t\t\t\t\thasError = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase SyntaxKind.Unknown:\n\t\t\t\t\thasError = true;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (lineBreak && (secondToken === SyntaxKind.LineCommentTrivia || secondToken === SyntaxKind.BlockCommentTrivia)) {\n\t\t\t\treplaceContent = newLineAndIndent();\n\t\t\t}\n\n\t\t}\n\t\tconst secondTokenStart = scanner.getTokenOffset() + formatTextStart;\n\t\taddEdit(replaceContent, firstTokenEnd, secondTokenStart);\n\t\tfirstToken = secondToken;\n\t}\n\treturn editOperations;\n}\n\n/**\n * Creates a formatted string out of the object passed as argument, using the given formatting options\n * @param any The object to stringify and format\n * @param options The formatting options to use\n */\nexport function toFormattedString(obj: unknown, options: FormattingOptions) {\n\tconst content = JSON.stringify(obj, undefined, options.insertSpaces ? options.tabSize || 4 : '\\t');\n\tif (options.eol !== undefined) {\n\t\treturn content.replace(/\\r\\n|\\r|\\n/g, options.eol);\n\t}\n\treturn content;\n}\n\nfunction repeat(s: string, count: number): string {\n\tlet result = '';\n\tfor (let i = 0; i < count; i++) {\n\t\tresult += s;\n\t}\n\treturn result;\n}\n\nfunction computeIndentLevel(content: string, options: FormattingOptions): number {\n\tlet i = 0;\n\tlet nChars = 0;\n\tconst tabSize = options.tabSize || 4;\n\twhile (i < content.length) {\n\t\tconst ch = content.charAt(i);\n\t\tif (ch === ' ') {\n\t\t\tnChars++;\n\t\t} else if (ch === '\\t') {\n\t\t\tnChars += tabSize;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t\ti++;\n\t}\n\treturn Math.floor(nChars / tabSize);\n}\n\nexport function getEOL(options: FormattingOptions, text: string): string {\n\tfor (let i = 0; i < text.length; i++) {\n\t\tconst ch = text.charAt(i);\n\t\tif (ch === '\\r') {\n\t\t\tif (i + 1 < text.length && text.charAt(i + 1) === '\\n') {\n\t\t\t\treturn '\\r\\n';\n\t\t\t}\n\t\t\treturn '\\r';\n\t\t} else if (ch === '\\n') {\n\t\t\treturn '\\n';\n\t\t}\n\t}\n\treturn (options && options.eol) || '\\n';\n}\n\nexport function isEOL(text: string, offset: number) {\n\treturn '\\r\\n'.indexOf(text.charAt(offset)) !== -1;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { findNodeAtLocation, JSONPath, Node, ParseError, parseTree, Segment } from './json.js';\nimport { Edit, format, FormattingOptions, isEOL } from './jsonFormatter.js';\n\n\nexport function removeProperty(text: string, path: JSONPath, formattingOptions: FormattingOptions): Edit[] {\n\treturn setProperty(text, path, undefined, formattingOptions);\n}\n\nexport function setProperty(text: string, originalPath: JSONPath, value: unknown, formattingOptions: FormattingOptions, getInsertionIndex?: (properties: string[]) => number): Edit[] {\n\tconst path = originalPath.slice();\n\tconst errors: ParseError[] = [];\n\tconst root = parseTree(text, errors);\n\tlet parent: Node | undefined = undefined;\n\n\tlet lastSegment: Segment | undefined = undefined;\n\twhile (path.length > 0) {\n\t\tlastSegment = path.pop();\n\t\tparent = findNodeAtLocation(root, path);\n\t\tif (parent === undefined && value !== undefined) {\n\t\t\tif (typeof lastSegment === 'string') {\n\t\t\t\tvalue = { [lastSegment]: value };\n\t\t\t} else {\n\t\t\t\tvalue = [value];\n\t\t\t}\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!parent) {\n\t\t// empty document\n\t\tif (value === undefined) { // delete\n\t\t\treturn []; // property does not exist, nothing to do\n\t\t}\n\t\treturn withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, formattingOptions);\n\t} else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) {\n\t\tconst existing = findNodeAtLocation(parent, [lastSegment]);\n\t\tif (existing !== undefined) {\n\t\t\tif (value === undefined) { // delete\n\t\t\t\tif (!existing.parent) {\n\t\t\t\t\tthrow new Error('Malformed AST');\n\t\t\t\t}\n\t\t\t\tconst propertyIndex = parent.children.indexOf(existing.parent);\n\t\t\t\tlet removeBegin: number;\n\t\t\t\tlet removeEnd = existing.parent.offset + existing.parent.length;\n\t\t\t\tif (propertyIndex > 0) {\n\t\t\t\t\t// remove the comma of the previous node\n\t\t\t\t\tconst previous = parent.children[propertyIndex - 1];\n\t\t\t\t\tremoveBegin = previous.offset + previous.length;\n\t\t\t\t} else {\n\t\t\t\t\tremoveBegin = parent.offset + 1;\n\t\t\t\t\tif (parent.children.length > 1) {\n\t\t\t\t\t\t// remove the comma of the next node\n\t\t\t\t\t\tconst next = parent.children[1];\n\t\t\t\t\t\tremoveEnd = next.offset;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, formattingOptions);\n\t\t\t} else {\n\t\t\t\t// set value of existing property\n\t\t\t\treturn withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, formattingOptions);\n\t\t\t}\n\t\t} else {\n\t\t\tif (value === undefined) { // delete\n\t\t\t\treturn []; // property does not exist, nothing to do\n\t\t\t}\n\t\t\tconst newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;\n\t\t\tconst index = getInsertionIndex ? getInsertionIndex(parent.children.map(p => p.children![0].value)) : parent.children.length;\n\t\t\tlet edit: Edit;\n\t\t\tif (index > 0) {\n\t\t\t\tconst previous = parent.children[index - 1];\n\t\t\t\tedit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };\n\t\t\t} else if (parent.children.length === 0) {\n\t\t\t\tedit = { offset: parent.offset + 1, length: 0, content: newProperty };\n\t\t\t} else {\n\t\t\t\tedit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' };\n\t\t\t}\n\t\t\treturn withFormatting(text, edit, formattingOptions);\n\t\t}\n\t} else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) {\n\t\tif (value !== undefined) {\n\t\t\t// Insert\n\t\t\tconst newProperty = `${JSON.stringify(value)}`;\n\t\t\tlet edit: Edit;\n\t\t\tif (parent.children.length === 0 || lastSegment === 0) {\n\t\t\t\tedit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' };\n\t\t\t} else {\n\t\t\t\tconst index = lastSegment === -1 || lastSegment > parent.children.length ? parent.children.length : lastSegment;\n\t\t\t\tconst previous = parent.children[index - 1];\n\t\t\t\tedit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };\n\t\t\t}\n\t\t\treturn withFormatting(text, edit, formattingOptions);\n\t\t} else {\n\t\t\t//Removal\n\t\t\tconst removalIndex = lastSegment;\n\t\t\tconst toRemove = parent.children[removalIndex];\n\t\t\tlet edit: Edit;\n\t\t\tif (parent.children.length === 1) {\n\t\t\t\t// only item\n\t\t\t\tedit = { offset: parent.offset + 1, length: parent.length - 2, content: '' };\n\t\t\t} else if (parent.children.length - 1 === removalIndex) {\n\t\t\t\t// last item\n\t\t\t\tconst previous = parent.children[removalIndex - 1];\n\t\t\t\tconst offset = previous.offset + previous.length;\n\t\t\t\tconst parentEndOffset = parent.offset + parent.length;\n\t\t\t\tedit = { offset, length: parentEndOffset - 2 - offset, content: '' };\n\t\t\t} else {\n\t\t\t\tedit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' };\n\t\t\t}\n\t\t\treturn withFormatting(text, edit, formattingOptions);\n\t\t}\n\t} else {\n\t\tthrow new Error(`Can not add ${typeof lastSegment !== 'number' ? 'index' : 'property'} to parent of type ${parent.type}`);\n\t}\n}\n\nexport function withFormatting(text: string, edit: Edit, formattingOptions: FormattingOptions): Edit[] {\n\t// apply the edit\n\tlet newText = applyEdit(text, edit);\n\n\t// format the new text\n\tlet begin = edit.offset;\n\tlet end = edit.offset + edit.content.length;\n\tif (edit.length === 0 || edit.content.length === 0) { // insert or remove\n\t\twhile (begin > 0 && !isEOL(newText, begin - 1)) {\n\t\t\tbegin--;\n\t\t}\n\t\twhile (end < newText.length && !isEOL(newText, end)) {\n\t\t\tend++;\n\t\t}\n\t}\n\n\tconst edits = format(newText, { offset: begin, length: end - begin }, formattingOptions);\n\n\t// apply the formatting edits and track the begin and end offsets of the changes\n\tfor (let i = edits.length - 1; i >= 0; i--) {\n\t\tconst curr = edits[i];\n\t\tnewText = applyEdit(newText, curr);\n\t\tbegin = Math.min(begin, curr.offset);\n\t\tend = Math.max(end, curr.offset + curr.length);\n\t\tend += curr.content.length - curr.length;\n\t}\n\t// create a single edit with all changes\n\tconst editLength = text.length - (newText.length - end) - begin;\n\treturn [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];\n}\n\nexport function applyEdit(text: string, edit: Edit): string {\n\treturn text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);\n}\n\nexport function applyEdits(text: string, edits: Edit[]): string {\n\tconst sortedEdits = edits.slice(0).sort((a, b) => {\n\t\tconst diff = a.offset - b.offset;\n\t\tif (diff === 0) {\n\t\t\treturn a.length - b.length;\n\t\t}\n\t\treturn diff;\n\t});\n\tlet lastModifiedOffset = text.length;\n\tfor (let i = sortedEdits.length - 1; i >= 0; i--) {\n\t\tconst e = sortedEdits[i];\n\t\tif (e.offset + e.length <= lastModifiedOffset) {\n\t\t\ttext = applyEdit(text, e);\n\t\t} else {\n\t\t\tthrow new Error('Overlapping edit');\n\t\t}\n\t\tlastModifiedOffset = e.offset;\n\t}\n\treturn text;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { isTypedArray, isObject, isUndefinedOrNull } from './types.js';\n\nexport function deepClone<T>(obj: T): T {\n\tif (!obj || typeof obj !== 'object') {\n\t\treturn obj;\n\t}\n\tif (obj instanceof RegExp) {\n\t\treturn obj;\n\t}\n\tconst result: any = Array.isArray(obj) ? [] : {};\n\tObject.entries(obj).forEach(([key, value]) => {\n\t\tresult[key] = value && typeof value === 'object' ? deepClone(value) : value;\n\t});\n\treturn result;\n}\n\nexport function deepFreeze<T>(obj: T): T {\n\tif (!obj || typeof obj !== 'object') {\n\t\treturn obj;\n\t}\n\tconst stack: any[] = [obj];\n\twhile (stack.length > 0) {\n\t\tconst obj = stack.shift();\n\t\tObject.freeze(obj);\n\t\tfor (const key in obj) {\n\t\t\tif (_hasOwnProperty.call(obj, key)) {\n\t\t\t\tconst prop = obj[key];\n\t\t\t\tif (typeof prop === 'object' && !Object.isFrozen(prop) && !isTypedArray(prop)) {\n\t\t\t\t\tstack.push(prop);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn obj;\n}\n\nconst _hasOwnProperty = Object.prototype.hasOwnProperty;\n\n\nexport function cloneAndChange(obj: any, changer: (orig: any) => any): any {\n\treturn _cloneAndChange(obj, changer, new Set());\n}\n\nfunction _cloneAndChange(obj: any, changer: (orig: any) => any, seen: Set<any>): any {\n\tif (isUndefinedOrNull(obj)) {\n\t\treturn obj;\n\t}\n\n\tconst changed = changer(obj);\n\tif (typeof changed !== 'undefined') {\n\t\treturn changed;\n\t}\n\n\tif (Array.isArray(obj)) {\n\t\tconst r1: any[] = [];\n\t\tfor (const e of obj) {\n\t\t\tr1.push(_cloneAndChange(e, changer, seen));\n\t\t}\n\t\treturn r1;\n\t}\n\n\tif (isObject(obj)) {\n\t\tif (seen.has(obj)) {\n\t\t\tthrow new Error('Cannot clone recursive data-structure');\n\t\t}\n\t\tseen.add(obj);\n\t\tconst r2 = {};\n\t\tfor (const i2 in obj) {\n\t\t\tif (_hasOwnProperty.call(obj, i2)) {\n\t\t\t\t(r2 as any)[i2] = _cloneAndChange(obj[i2], changer, seen);\n\t\t\t}\n\t\t}\n\t\tseen.delete(obj);\n\t\treturn r2;\n\t}\n\n\treturn obj;\n}\n\n/**\n * Copies all properties of source into destination. The optional parameter \"overwrite\" allows to control\n * if existing properties on the destination should be overwritten or not. Defaults to true (overwrite).\n */\nexport function mixin(destination: any, source: any, overwrite: boolean = true): any {\n\tif (!isObject(destination)) {\n\t\treturn source;\n\t}\n\n\tif (isObject(source)) {\n\t\tObject.keys(source).forEach(key => {\n\t\t\tif (key in destination) {\n\t\t\t\tif (overwrite) {\n\t\t\t\t\tif (isObject(destination[key]) && isObject(source[key])) {\n\t\t\t\t\t\tmixin(destination[key], source[key], overwrite);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdestination[key] = source[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdestination[key] = source[key];\n\t\t\t}\n\t\t});\n\t}\n\treturn destination;\n}\n\nexport function equals(one: any, other: any): boolean {\n\tif (one === other) {\n\t\treturn true;\n\t}\n\tif (one === null || one === undefined || other === null || other === undefined) {\n\t\treturn false;\n\t}\n\tif (typeof one !== typeof other) {\n\t\treturn false;\n\t}\n\tif (typeof one !== 'object') {\n\t\treturn false;\n\t}\n\tif ((Array.isArray(one)) !== (Array.isArray(other))) {\n\t\treturn false;\n\t}\n\n\tlet i: number;\n\tlet key: string;\n\n\tif (Array.isArray(one)) {\n\t\tif (one.length !== other.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (i = 0; i < one.length; i++) {\n\t\t\tif (!equals(one[i], other[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst oneKeys: string[] = [];\n\n\t\tfor (key in one) {\n\t\t\toneKeys.push(key);\n\t\t}\n\t\toneKeys.sort();\n\t\tconst otherKeys: string[] = [];\n\t\tfor (key in other) {\n\t\t\totherKeys.push(key);\n\t\t}\n\t\totherKeys.sort();\n\t\tif (!equals(oneKeys, otherKeys)) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (i = 0; i < oneKeys.length; i++) {\n\t\t\tif (!equals(one[oneKeys[i]], other[oneKeys[i]])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * Calls `JSON.Stringify` with a replacer to break apart any circular references.\n * This prevents `JSON`.stringify` from throwing the exception\n *  \"Uncaught TypeError: Converting circular structure to JSON\"\n */\nexport function safeStringify(obj: any): string {\n\tconst seen = new Set<any>();\n\treturn JSON.stringify(obj, (key, value) => {\n\t\tif (isObject(value) || Array.isArray(value)) {\n\t\t\tif (seen.has(value)) {\n\t\t\t\treturn '[Circular]';\n\t\t\t} else {\n\t\t\t\tseen.add(value);\n\t\t\t}\n\t\t}\n\t\tif (typeof value === 'bigint') {\n\t\t\treturn `[BigInt ${value.toString()}]`;\n\t\t}\n\t\treturn value;\n\t});\n}\n\ntype obj = { [key: string]: any };\n/**\n * Returns an object that has keys for each value that is different in the base object. Keys\n * that do not exist in the target but in the base object are not considered.\n *\n * Note: This is not a deep-diffing method, so the values are strictly taken into the resulting\n * object if they differ.\n *\n * @param base the object to diff against\n * @param obj the object to use for diffing\n */\nexport function distinct(base: obj, target: obj): obj {\n\tconst result = Object.create(null);\n\n\tif (!base || !target) {\n\t\treturn result;\n\t}\n\n\tconst targetKeys = Object.keys(target);\n\ttargetKeys.forEach(k => {\n\t\tconst baseValue = base[k];\n\t\tconst targetValue = target[k];\n\n\t\tif (!equals(baseValue, targetValue)) {\n\t\t\tresult[k] = targetValue;\n\t\t}\n\t});\n\n\treturn result;\n}\n\nexport function getCaseInsensitive(target: obj, key: string): unknown {\n\tconst lowercaseKey = key.toLowerCase();\n\tconst equivalentKey = Object.keys(target).find(k => k.toLowerCase() === lowercaseKey);\n\treturn equivalentKey ? target[equivalentKey] : target[key];\n}\n\nexport function filter(obj: obj, predicate: (key: string, value: any) => boolean): obj {\n\tconst result = Object.create(null);\n\tfor (const [key, value] of Object.entries(obj)) {\n\t\tif (predicate(key, value)) {\n\t\t\tresult[key] = value;\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function mapValues<T extends {}, R>(obj: T, fn: (value: T[keyof T], key: string) => R): { [K in keyof T]: R } {\n\tconst result: { [key: string]: R } = {};\n\tfor (const [key, value] of Object.entries(obj)) {\n\t\tresult[key] = fn(<T[keyof T]>value, key);\n\t}\n\treturn result as { [K in keyof T]: R };\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { assertNever } from '../../../base/common/assert.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { Event } from '../../../base/common/event.js';\nimport * as types from '../../../base/common/types.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { IWorkspaceFolder } from '../../workspace/common/workspace.js';\n\nexport const IConfigurationService = createDecorator<IConfigurationService>('configurationService');\n\nexport function isConfigurationOverrides(thing: any): thing is IConfigurationOverrides {\n\treturn thing\n\t\t&& typeof thing === 'object'\n\t\t&& (!thing.overrideIdentifier || typeof thing.overrideIdentifier === 'string')\n\t\t&& (!thing.resource || thing.resource instanceof URI);\n}\n\nexport interface IConfigurationOverrides {\n\toverrideIdentifier?: string | null;\n\tresource?: URI | null;\n}\n\nexport function isConfigurationUpdateOverrides(thing: any): thing is IConfigurationUpdateOverrides {\n\treturn thing\n\t\t&& typeof thing === 'object'\n\t\t&& (!thing.overrideIdentifiers || Array.isArray(thing.overrideIdentifiers))\n\t\t&& !thing.overrideIdentifier\n\t\t&& (!thing.resource || thing.resource instanceof URI);\n}\n\nexport type IConfigurationUpdateOverrides = Omit<IConfigurationOverrides, 'overrideIdentifier'> & { overrideIdentifiers?: string[] | null };\n\nexport const enum ConfigurationTarget {\n\tAPPLICATION = 1,\n\tUSER,\n\tUSER_LOCAL,\n\tUSER_REMOTE,\n\tWORKSPACE,\n\tWORKSPACE_FOLDER,\n\tDEFAULT,\n\tMEMORY\n}\nexport function ConfigurationTargetToString(configurationTarget: ConfigurationTarget) {\n\tswitch (configurationTarget) {\n\t\tcase ConfigurationTarget.APPLICATION: return 'APPLICATION';\n\t\tcase ConfigurationTarget.USER: return 'USER';\n\t\tcase ConfigurationTarget.USER_LOCAL: return 'USER_LOCAL';\n\t\tcase ConfigurationTarget.USER_REMOTE: return 'USER_REMOTE';\n\t\tcase ConfigurationTarget.WORKSPACE: return 'WORKSPACE';\n\t\tcase ConfigurationTarget.WORKSPACE_FOLDER: return 'WORKSPACE_FOLDER';\n\t\tcase ConfigurationTarget.DEFAULT: return 'DEFAULT';\n\t\tcase ConfigurationTarget.MEMORY: return 'MEMORY';\n\t}\n}\n\nexport interface IConfigurationChange {\n\tkeys: string[];\n\toverrides: [string, string[]][];\n}\n\nexport interface IConfigurationChangeEvent {\n\n\treadonly source: ConfigurationTarget;\n\treadonly affectedKeys: ReadonlySet<string>;\n\treadonly change: IConfigurationChange;\n\n\taffectsConfiguration(configuration: string, overrides?: IConfigurationOverrides): boolean;\n}\n\nexport interface IInspectValue<T> {\n\treadonly value?: T;\n\treadonly override?: T;\n\treadonly overrides?: { readonly identifiers: string[]; readonly value: T }[];\n}\n\nexport interface IConfigurationValue<T> {\n\n\treadonly defaultValue?: T;\n\treadonly applicationValue?: T;\n\treadonly userValue?: T;\n\treadonly userLocalValue?: T;\n\treadonly userRemoteValue?: T;\n\treadonly workspaceValue?: T;\n\treadonly workspaceFolderValue?: T;\n\treadonly memoryValue?: T;\n\treadonly policyValue?: T;\n\treadonly value?: T;\n\n\treadonly default?: IInspectValue<T>;\n\treadonly application?: IInspectValue<T>;\n\treadonly user?: IInspectValue<T>;\n\treadonly userLocal?: IInspectValue<T>;\n\treadonly userRemote?: IInspectValue<T>;\n\treadonly workspace?: IInspectValue<T>;\n\treadonly workspaceFolder?: IInspectValue<T>;\n\treadonly memory?: IInspectValue<T>;\n\treadonly policy?: { value?: T };\n\n\treadonly overrideIdentifiers?: string[];\n}\n\nexport function getConfigValueInTarget<T>(configValue: IConfigurationValue<T>, scope: ConfigurationTarget): T | undefined {\n\tswitch (scope) {\n\t\tcase ConfigurationTarget.APPLICATION:\n\t\t\treturn configValue.applicationValue;\n\t\tcase ConfigurationTarget.USER:\n\t\t\treturn configValue.userValue;\n\t\tcase ConfigurationTarget.USER_LOCAL:\n\t\t\treturn configValue.userLocalValue;\n\t\tcase ConfigurationTarget.USER_REMOTE:\n\t\t\treturn configValue.userRemoteValue;\n\t\tcase ConfigurationTarget.WORKSPACE:\n\t\t\treturn configValue.workspaceValue;\n\t\tcase ConfigurationTarget.WORKSPACE_FOLDER:\n\t\t\treturn configValue.workspaceFolderValue;\n\t\tcase ConfigurationTarget.DEFAULT:\n\t\t\treturn configValue.defaultValue;\n\t\tcase ConfigurationTarget.MEMORY:\n\t\t\treturn configValue.memoryValue;\n\t\tdefault:\n\t\t\tassertNever(scope);\n\t}\n}\n\nexport function isConfigured<T>(configValue: IConfigurationValue<T>): configValue is IConfigurationValue<T> & { value: T } {\n\treturn configValue.applicationValue !== undefined ||\n\t\tconfigValue.userValue !== undefined ||\n\t\tconfigValue.userLocalValue !== undefined ||\n\t\tconfigValue.userRemoteValue !== undefined ||\n\t\tconfigValue.workspaceValue !== undefined ||\n\t\tconfigValue.workspaceFolderValue !== undefined;\n}\n\nexport interface IConfigurationUpdateOptions {\n\t/**\n\t * If `true`, do not notifies the error to user by showing the message box. Default is `false`.\n\t */\n\tdonotNotifyError?: boolean;\n\t/**\n\t * How to handle dirty file when updating the configuration.\n\t */\n\thandleDirtyFile?: 'save' | 'revert';\n}\n\nexport interface IConfigurationService {\n\treadonly _serviceBrand: undefined;\n\n\tonDidChangeConfiguration: Event<IConfigurationChangeEvent>;\n\n\tgetConfigurationData(): IConfigurationData | null;\n\n\t/**\n\t * Fetches the value of the section for the given overrides.\n\t * Value can be of native type or an object keyed off the section name.\n\t *\n\t * @param section - Section of the configuration. Can be `null` or `undefined`.\n\t * @param overrides - Overrides that has to be applied while fetching\n\t *\n\t */\n\tgetValue<T>(): T;\n\tgetValue<T>(section: string): T;\n\tgetValue<T>(overrides: IConfigurationOverrides): T;\n\tgetValue<T>(section: string, overrides: IConfigurationOverrides): T;\n\n\t/**\n\t * Update a configuration value.\n\t *\n\t * Use `target` to update the configuration in a specific `ConfigurationTarget`.\n\t *\n\t * Use `overrides` to update the configuration for a resource or for override identifiers or both.\n\t *\n\t * Passing a resource through overrides will update the configuration in the workspace folder containing that resource.\n\t *\n\t * *Note 1:* Updating configuration to a default value will remove the configuration from the requested target. If not target is passed, it will be removed from all writeable targets.\n\t *\n\t * *Note 2:* Use `undefined` value to remove the configuration from the given target. If not target is passed, it will be removed from all writeable targets.\n\t *\n\t * Use `donotNotifyError` and set it to `true` to surpresss errors.\n\t *\n\t * @param key setting to be updated\n\t * @param value The new value\n\t */\n\tupdateValue(key: string, value: any): Promise<void>;\n\tupdateValue(key: string, value: any, target: ConfigurationTarget): Promise<void>;\n\tupdateValue(key: string, value: any, overrides: IConfigurationOverrides | IConfigurationUpdateOverrides): Promise<void>;\n\tupdateValue(key: string, value: any, overrides: IConfigurationOverrides | IConfigurationUpdateOverrides, target: ConfigurationTarget, options?: IConfigurationUpdateOptions): Promise<void>;\n\n\tinspect<T>(key: string, overrides?: IConfigurationOverrides): IConfigurationValue<Readonly<T>>;\n\n\treloadConfiguration(target?: ConfigurationTarget | IWorkspaceFolder): Promise<void>;\n\n\tkeys(): {\n\t\tdefault: string[];\n\t\tuser: string[];\n\t\tworkspace: string[];\n\t\tworkspaceFolder: string[];\n\t\tmemory?: string[];\n\t};\n}\n\nexport interface IConfigurationModel {\n\tcontents: any;\n\tkeys: string[];\n\toverrides: IOverrides[];\n\traw?: IStringDictionary<any>;\n}\n\nexport interface IOverrides {\n\tkeys: string[];\n\tcontents: any;\n\tidentifiers: string[];\n}\n\nexport interface IConfigurationData {\n\tdefaults: IConfigurationModel;\n\tpolicy: IConfigurationModel;\n\tapplication: IConfigurationModel;\n\tuserLocal: IConfigurationModel;\n\tuserRemote: IConfigurationModel;\n\tworkspace: IConfigurationModel;\n\tfolders: [UriComponents, IConfigurationModel][];\n}\n\nexport interface IConfigurationCompareResult {\n\tadded: string[];\n\tremoved: string[];\n\tupdated: string[];\n\toverrides: [string, string[]][];\n}\n\nexport function toValuesTree(properties: { [qualifiedKey: string]: any }, conflictReporter: (message: string) => void): any {\n\tconst root = Object.create(null);\n\n\tfor (const key in properties) {\n\t\taddToValueTree(root, key, properties[key], conflictReporter);\n\t}\n\n\treturn root;\n}\n\nexport function addToValueTree(settingsTreeRoot: any, key: string, value: any, conflictReporter: (message: string) => void): void {\n\tconst segments = key.split('.');\n\tconst last = segments.pop()!;\n\n\tlet curr = settingsTreeRoot;\n\tfor (let i = 0; i < segments.length; i++) {\n\t\tconst s = segments[i];\n\t\tlet obj = curr[s];\n\t\tswitch (typeof obj) {\n\t\t\tcase 'undefined':\n\t\t\t\tobj = curr[s] = Object.create(null);\n\t\t\t\tbreak;\n\t\t\tcase 'object':\n\t\t\t\tif (obj === null) {\n\t\t\t\t\tconflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join('.')} is null`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join('.')} is ${JSON.stringify(obj)}`);\n\t\t\t\treturn;\n\t\t}\n\t\tcurr = obj;\n\t}\n\n\tif (typeof curr === 'object' && curr !== null) {\n\t\ttry {\n\t\t\tcurr[last] = value; // workaround https://github.com/microsoft/vscode/issues/13606\n\t\t} catch (e) {\n\t\t\tconflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`);\n\t\t}\n\t} else {\n\t\tconflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`);\n\t}\n}\n\nexport function removeFromValueTree(valueTree: any, key: string): void {\n\tconst segments = key.split('.');\n\tdoRemoveFromValueTree(valueTree, segments);\n}\n\nfunction doRemoveFromValueTree(valueTree: any, segments: string[]): void {\n\tif (!valueTree) {\n\t\treturn;\n\t}\n\n\tconst first = segments.shift()!;\n\tif (segments.length === 0) {\n\t\t// Reached last segment\n\t\tdelete valueTree[first];\n\t\treturn;\n\t}\n\n\tif (Object.keys(valueTree).indexOf(first) !== -1) {\n\t\tconst value = valueTree[first];\n\t\tif (typeof value === 'object' && !Array.isArray(value)) {\n\t\t\tdoRemoveFromValueTree(value, segments);\n\t\t\tif (Object.keys(value).length === 0) {\n\t\t\t\tdelete valueTree[first];\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * A helper function to get the configuration value with a specific settings path (e.g. config.some.setting)\n */\nexport function getConfigurationValue<T>(config: any, settingPath: string): T | undefined;\nexport function getConfigurationValue<T>(config: any, settingPath: string, defaultValue: T): T;\nexport function getConfigurationValue<T>(config: any, settingPath: string, defaultValue?: T): T | undefined {\n\tfunction accessSetting(config: any, path: string[]): any {\n\t\tlet current = config;\n\t\tfor (const component of path) {\n\t\t\tif (typeof current !== 'object' || current === null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tcurrent = current[component];\n\t\t}\n\t\treturn <T>current;\n\t}\n\n\tconst path = settingPath.split('.');\n\tconst result = accessSetting(config, path);\n\n\treturn typeof result === 'undefined' ? defaultValue : result;\n}\n\nexport function merge(base: any, add: any, overwrite: boolean): void {\n\tObject.keys(add).forEach(key => {\n\t\tif (key !== '__proto__') {\n\t\t\tif (key in base) {\n\t\t\t\tif (types.isObject(base[key]) && types.isObject(add[key])) {\n\t\t\t\t\tmerge(base[key], add[key], overwrite);\n\t\t\t\t} else if (overwrite) {\n\t\t\t\t\tbase[key] = add[key];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbase[key] = add[key];\n\t\t\t}\n\t\t}\n\t});\n}\n\nexport function getLanguageTagSettingPlainKey(settingKey: string) {\n\treturn settingKey\n\t\t.replace(/^\\[/, '')\n\t\t.replace(/]$/g, '')\n\t\t.replace(/\\]\\[/g, ', ');\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport type JSONSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'array' | 'object';\n\nexport interface IJSONSchema {\n\tid?: string;\n\t$id?: string;\n\t$schema?: string;\n\ttype?: JSONSchemaType | JSONSchemaType[];\n\ttitle?: string;\n\tdefault?: any;\n\tdefinitions?: IJSONSchemaMap;\n\tdescription?: string;\n\tproperties?: IJSONSchemaMap;\n\tpatternProperties?: IJSONSchemaMap;\n\tadditionalProperties?: boolean | IJSONSchema;\n\tminProperties?: number;\n\tmaxProperties?: number;\n\tdependencies?: IJSONSchemaMap | { [prop: string]: string[] };\n\titems?: IJSONSchema | IJSONSchema[];\n\tminItems?: number;\n\tmaxItems?: number;\n\tuniqueItems?: boolean;\n\tadditionalItems?: boolean | IJSONSchema;\n\tpattern?: string;\n\tminLength?: number;\n\tmaxLength?: number;\n\tminimum?: number;\n\tmaximum?: number;\n\texclusiveMinimum?: boolean | number;\n\texclusiveMaximum?: boolean | number;\n\tmultipleOf?: number;\n\trequired?: string[];\n\t$ref?: string;\n\tanyOf?: IJSONSchema[];\n\tallOf?: IJSONSchema[];\n\toneOf?: IJSONSchema[];\n\tnot?: IJSONSchema;\n\tenum?: any[];\n\tformat?: string;\n\n\t// schema draft 06\n\tconst?: any;\n\tcontains?: IJSONSchema;\n\tpropertyNames?: IJSONSchema;\n\texamples?: any[];\n\n\t// schema draft 07\n\t$comment?: string;\n\tif?: IJSONSchema;\n\tthen?: IJSONSchema;\n\telse?: IJSONSchema;\n\n\t// schema 2019-09\n\tunevaluatedProperties?: boolean | IJSONSchema;\n\tunevaluatedItems?: boolean | IJSONSchema;\n\tminContains?: number;\n\tmaxContains?: number;\n\tdeprecated?: boolean;\n\tdependentRequired?: { [prop: string]: string[] };\n\tdependentSchemas?: IJSONSchemaMap;\n\t$defs?: { [name: string]: IJSONSchema };\n\t$anchor?: string;\n\t$recursiveRef?: string;\n\t$recursiveAnchor?: string;\n\t$vocabulary?: any;\n\n\t// schema 2020-12\n\tprefixItems?: IJSONSchema[];\n\t$dynamicRef?: string;\n\t$dynamicAnchor?: string;\n\n\t// VSCode extensions\n\n\tdefaultSnippets?: IJSONSchemaSnippet[];\n\terrorMessage?: string;\n\tpatternErrorMessage?: string;\n\tdeprecationMessage?: string;\n\tmarkdownDeprecationMessage?: string;\n\tenumDescriptions?: string[];\n\tmarkdownEnumDescriptions?: string[];\n\tmarkdownDescription?: string;\n\tdoNotSuggest?: boolean;\n\tsuggestSortText?: string;\n\tallowComments?: boolean;\n\tallowTrailingCommas?: boolean;\n}\n\nexport interface IJSONSchemaMap {\n\t[name: string]: IJSONSchema;\n}\n\nexport interface IJSONSchemaSnippet {\n\tlabel?: string;\n\tdescription?: string;\n\tbody?: any; // a object that will be JSON stringified\n\tbodyText?: string; // an already stringified JSON object that can contain new lines (\\n) and tabs (\\t)\n}\n\n/**\n * Converts a basic JSON schema to a TypeScript type.\n *\n * TODO: only supports basic schemas. Doesn't support all JSON schema features.\n */\nexport type SchemaToType<T> = T extends { type: 'string' }\n\t? string\n\t: T extends { type: 'number' }\n\t? number\n\t: T extends { type: 'boolean' }\n\t? boolean\n\t: T extends { type: 'null' }\n\t? null\n\t// Object\n\t: T extends { type: 'object'; properties: infer P }\n\t? { [K in keyof P]: SchemaToType<P[K]> }\n\t// Array\n\t: T extends { type: 'array'; items: infer I }\n\t? Array<SchemaToType<I>>\n\t// OneOf\n\t: T extends { oneOf: infer I }\n\t? MapSchemaToType<I>\n\t// Fallthrough\n\t: never;\n\ntype MapSchemaToType<T> = T extends [infer First, ...infer Rest]\n\t? SchemaToType<First> | MapSchemaToType<Rest>\n\t: never;\n\ninterface Equals { schemas: IJSONSchema[]; id?: string }\n\nexport function getCompressedContent(schema: IJSONSchema): string {\n\tlet hasDups = false;\n\n\n\t// visit all schema nodes and collect the ones that are equal\n\tconst equalsByString = new Map<string, Equals>();\n\tconst nodeToEquals = new Map<IJSONSchema, Equals>();\n\tconst visitSchemas = (next: IJSONSchema) => {\n\t\tif (schema === next) {\n\t\t\treturn true;\n\t\t}\n\t\tconst val = JSON.stringify(next);\n\t\tif (val.length < 30) {\n\t\t\t// the $ref takes around 25 chars, so we don't save anything\n\t\t\treturn true;\n\t\t}\n\t\tconst eq = equalsByString.get(val);\n\t\tif (!eq) {\n\t\t\tconst newEq = { schemas: [next] };\n\t\t\tequalsByString.set(val, newEq);\n\t\t\tnodeToEquals.set(next, newEq);\n\t\t\treturn true;\n\t\t}\n\t\teq.schemas.push(next);\n\t\tnodeToEquals.set(next, eq);\n\t\thasDups = true;\n\t\treturn false;\n\t};\n\ttraverseNodes(schema, visitSchemas);\n\tequalsByString.clear();\n\n\tif (!hasDups) {\n\t\treturn JSON.stringify(schema);\n\t}\n\n\tlet defNodeName = '$defs';\n\twhile (schema.hasOwnProperty(defNodeName)) {\n\t\tdefNodeName += '_';\n\t}\n\n\t// used to collect all schemas that are later put in `$defs`. The index in the array is the id of the schema.\n\tconst definitions: IJSONSchema[] = [];\n\n\tfunction stringify(root: IJSONSchema): string {\n\t\treturn JSON.stringify(root, (_key: string, value: any) => {\n\t\t\tif (value !== root) {\n\t\t\t\tconst eq = nodeToEquals.get(value);\n\t\t\t\tif (eq && eq.schemas.length > 1) {\n\t\t\t\t\tif (!eq.id) {\n\t\t\t\t\t\teq.id = `_${definitions.length}`;\n\t\t\t\t\t\tdefinitions.push(eq.schemas[0]);\n\t\t\t\t\t}\n\t\t\t\t\treturn { $ref: `#/${defNodeName}/${eq.id}` };\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn value;\n\t\t});\n\t}\n\n\t// stringify the schema and replace duplicate subtrees with $ref\n\t// this will add new items to the definitions array\n\tconst str = stringify(schema);\n\n\t// now stringify the definitions. Each invication of stringify cann add new items to the definitions array, so the length can grow while we iterate\n\tconst defStrings: string[] = [];\n\tfor (let i = 0; i < definitions.length; i++) {\n\t\tdefStrings.push(`\"_${i}\":${stringify(definitions[i])}`);\n\t}\n\tif (defStrings.length) {\n\t\treturn `${str.substring(0, str.length - 1)},\"${defNodeName}\":{${defStrings.join(',')}}}`;\n\t}\n\treturn str;\n}\n\ntype IJSONSchemaRef = IJSONSchema | boolean;\n\nfunction isObject(thing: unknown): thing is object {\n\treturn typeof thing === 'object' && thing !== null;\n}\n\n/*\n * Traverse a JSON schema and visit each schema node\n*/\nfunction traverseNodes(root: IJSONSchema, visit: (schema: IJSONSchema) => boolean) {\n\tif (!root || typeof root !== 'object') {\n\t\treturn;\n\t}\n\tconst collectEntries = (...entries: (IJSONSchemaRef | undefined)[]) => {\n\t\tfor (const entry of entries) {\n\t\t\tif (isObject(entry)) {\n\t\t\t\ttoWalk.push(entry);\n\t\t\t}\n\t\t}\n\t};\n\tconst collectMapEntries = (...maps: (IJSONSchemaMap | undefined)[]) => {\n\t\tfor (const map of maps) {\n\t\t\tif (isObject(map)) {\n\t\t\t\tfor (const key in map) {\n\t\t\t\t\tconst entry = map[key];\n\t\t\t\t\tif (isObject(entry)) {\n\t\t\t\t\t\ttoWalk.push(entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\tconst collectArrayEntries = (...arrays: (IJSONSchemaRef[] | undefined)[]) => {\n\t\tfor (const array of arrays) {\n\t\t\tif (Array.isArray(array)) {\n\t\t\t\tfor (const entry of array) {\n\t\t\t\t\tif (isObject(entry)) {\n\t\t\t\t\t\ttoWalk.push(entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\tconst collectEntryOrArrayEntries = (items: (IJSONSchemaRef[] | IJSONSchemaRef | undefined)) => {\n\t\tif (Array.isArray(items)) {\n\t\t\tfor (const entry of items) {\n\t\t\t\tif (isObject(entry)) {\n\t\t\t\t\ttoWalk.push(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isObject(items)) {\n\t\t\ttoWalk.push(items);\n\t\t}\n\t};\n\n\tconst toWalk: IJSONSchema[] = [root];\n\n\tlet next = toWalk.pop();\n\twhile (next) {\n\t\tconst visitChildern = visit(next);\n\t\tif (visitChildern) {\n\t\t\tcollectEntries(next.additionalItems, next.additionalProperties, next.not, next.contains, next.propertyNames, next.if, next.then, next.else, next.unevaluatedItems, next.unevaluatedProperties);\n\t\t\tcollectMapEntries(next.definitions, next.$defs, next.properties, next.patternProperties, <IJSONSchemaMap>next.dependencies, next.dependentSchemas);\n\t\t\tcollectArrayEntries(next.anyOf, next.allOf, next.oneOf, next.prefixItems);\n\t\t\tcollectEntryOrArrayEntries(next.items);\n\t\t}\n\t\tnext = toWalk.pop();\n\t}\n}\n\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as Assert from '../../../base/common/assert.js';\nimport * as Types from '../../../base/common/types.js';\n\nexport interface IRegistry {\n\n\t/**\n\t * Adds the extension functions and properties defined by data to the\n\t * platform. The provided id must be unique.\n\t * @param id a unique identifier\n\t * @param data a contribution\n\t */\n\tadd(id: string, data: any): void;\n\n\t/**\n\t * Returns true iff there is an extension with the provided id.\n\t * @param id an extension identifier\n\t */\n\tknows(id: string): boolean;\n\n\t/**\n\t * Returns the extension functions and properties defined by the specified key or null.\n\t * @param id an extension identifier\n\t */\n\tas<T>(id: string): T;\n}\n\nclass RegistryImpl implements IRegistry {\n\n\tprivate readonly data = new Map<string, any>();\n\n\tpublic add(id: string, data: any): void {\n\t\tAssert.ok(Types.isString(id));\n\t\tAssert.ok(Types.isObject(data));\n\t\tAssert.ok(!this.data.has(id), 'There is already an extension with this id');\n\n\t\tthis.data.set(id, data);\n\t}\n\n\tpublic knows(id: string): boolean {\n\t\treturn this.data.has(id);\n\t}\n\n\tpublic as(id: string): any {\n\t\treturn this.data.get(id) || null;\n\t}\n\n\tpublic dispose() {\n\t\tthis.data.forEach((value) => {\n\t\t\tif (Types.isFunction(value.dispose)) {\n\t\t\t\tvalue.dispose();\n\t\t\t}\n\t\t});\n\t\tthis.data.clear();\n\t}\n\n}\n\nexport const Registry: IRegistry = new RegistryImpl();\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { getCompressedContent, IJSONSchema } from '../../../base/common/jsonSchema.js';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport * as platform from '../../registry/common/platform.js';\n\nexport const Extensions = {\n\tJSONContribution: 'base.contributions.json'\n};\n\nexport interface ISchemaContributions {\n\tschemas: { [id: string]: IJSONSchema };\n}\n\nexport interface IJSONContributionRegistry {\n\n\treadonly onDidChangeSchema: Event<string>;\n\treadonly onDidChangeSchemaAssociations: Event<void>;\n\n\t/**\n\t * Register a schema to the registry.\n\t */\n\tregisterSchema(uri: string, unresolvedSchemaContent: IJSONSchema, store?: DisposableStore): void;\n\n\tregisterSchemaAssociation(uri: string, glob: string): IDisposable;\n\n\t/**\n\t * Notifies all listeners that the content of the given schema has changed.\n\t * @param uri The id of the schema\n\t */\n\tnotifySchemaChanged(uri: string): void;\n\n\t/**\n\t * Get all schemas\n\t */\n\tgetSchemaContributions(): ISchemaContributions;\n\n\tgetSchemaAssociations(): { [uri: string]: string[] };\n\n\t/**\n\t * Gets the (compressed) content of the schema with the given schema ID (if any)\n\t * @param uri The id of the schema\n\t */\n\tgetSchemaContent(uri: string): string | undefined;\n\n\t/**\n\t * Returns true if there's a schema that matches the given schema ID\n\t * @param uri The id of the schema\n\t */\n\thasSchemaContent(uri: string): boolean;\n}\n\n\n\nfunction normalizeId(id: string) {\n\tif (id.length > 0 && id.charAt(id.length - 1) === '#') {\n\t\treturn id.substring(0, id.length - 1);\n\t}\n\treturn id;\n}\n\n\n\nclass JSONContributionRegistry extends Disposable implements IJSONContributionRegistry {\n\n\tprivate readonly schemasById: { [id: string]: IJSONSchema } = {};\n\tprivate readonly schemaAssociations: { [uri: string]: string[] } = {};\n\n\tprivate readonly _onDidChangeSchema = this._register(new Emitter<string>());\n\treadonly onDidChangeSchema: Event<string> = this._onDidChangeSchema.event;\n\n\tprivate readonly _onDidChangeSchemaAssociations = this._register(new Emitter<void>());\n\treadonly onDidChangeSchemaAssociations: Event<void> = this._onDidChangeSchemaAssociations.event;\n\n\tpublic registerSchema(uri: string, unresolvedSchemaContent: IJSONSchema, store?: DisposableStore): void {\n\t\tconst normalizedUri = normalizeId(uri);\n\t\tthis.schemasById[normalizedUri] = unresolvedSchemaContent;\n\t\tthis._onDidChangeSchema.fire(uri);\n\n\t\tif (store) {\n\t\t\tstore.add(toDisposable(() => {\n\t\t\t\tdelete this.schemasById[normalizedUri];\n\t\t\t\tthis._onDidChangeSchema.fire(uri);\n\t\t\t}));\n\t\t}\n\t}\n\n\tpublic registerSchemaAssociation(uri: string, glob: string): IDisposable {\n\t\tconst normalizedUri = normalizeId(uri);\n\t\tif (!this.schemaAssociations[normalizedUri]) {\n\t\t\tthis.schemaAssociations[normalizedUri] = [];\n\t\t}\n\t\tif (!this.schemaAssociations[normalizedUri].includes(glob)) {\n\t\t\tthis.schemaAssociations[normalizedUri].push(glob);\n\t\t\tthis._onDidChangeSchemaAssociations.fire();\n\t\t}\n\n\t\treturn toDisposable(() => {\n\t\t\tconst associations = this.schemaAssociations[normalizedUri];\n\t\t\tif (associations) {\n\t\t\t\tconst index = associations.indexOf(glob);\n\t\t\t\tif (index !== -1) {\n\t\t\t\t\tassociations.splice(index, 1);\n\t\t\t\t\tif (associations.length === 0) {\n\t\t\t\t\t\tdelete this.schemaAssociations[normalizedUri];\n\t\t\t\t\t}\n\t\t\t\t\tthis._onDidChangeSchemaAssociations.fire();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic notifySchemaChanged(uri: string): void {\n\t\tthis._onDidChangeSchema.fire(uri);\n\t}\n\n\tpublic getSchemaContributions(): ISchemaContributions {\n\t\treturn {\n\t\t\tschemas: this.schemasById,\n\t\t};\n\t}\n\n\tpublic getSchemaContent(uri: string): string | undefined {\n\t\tconst schema = this.schemasById[uri];\n\t\treturn schema ? getCompressedContent(schema) : undefined;\n\t}\n\n\tpublic hasSchemaContent(uri: string): boolean {\n\t\treturn !!this.schemasById[uri];\n\t}\n\n\tpublic getSchemaAssociations(): { [uri: string]: string[] } {\n\t\treturn this.schemaAssociations;\n\t}\n\n}\n\nconst jsonContributionRegistry = new JSONContributionRegistry();\nplatform.Registry.add(Extensions.JSONContribution, jsonContributionRegistry);\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { distinct } from '../../../base/common/arrays.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { IJSONSchema } from '../../../base/common/jsonSchema.js';\nimport * as types from '../../../base/common/types.js';\nimport * as nls from '../../../nls.js';\nimport { getLanguageTagSettingPlainKey } from './configuration.js';\nimport { Extensions as JSONExtensions, IJSONContributionRegistry } from '../../jsonschemas/common/jsonContributionRegistry.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport { IPolicy, PolicyName } from '../../../base/common/policy.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\n\nexport enum EditPresentationTypes {\n\tMultiline = 'multilineText',\n\tSingleline = 'singlelineText'\n}\n\nexport const Extensions = {\n\tConfiguration: 'base.contributions.configuration'\n};\n\nexport interface IConfigurationDelta {\n\tremovedDefaults?: IConfigurationDefaults[];\n\tremovedConfigurations?: IConfigurationNode[];\n\taddedDefaults?: IConfigurationDefaults[];\n\taddedConfigurations?: IConfigurationNode[];\n}\n\nexport interface IConfigurationRegistry {\n\n\t/**\n\t * Register a configuration to the registry.\n\t */\n\tregisterConfiguration(configuration: IConfigurationNode): IConfigurationNode;\n\n\t/**\n\t * Register multiple configurations to the registry.\n\t */\n\tregisterConfigurations(configurations: IConfigurationNode[], validate?: boolean): void;\n\n\t/**\n\t * Deregister multiple configurations from the registry.\n\t */\n\tderegisterConfigurations(configurations: IConfigurationNode[]): void;\n\n\t/**\n\t * update the configuration registry by\n\t * \t- registering the configurations to add\n\t * \t- dereigstering the configurations to remove\n\t */\n\tupdateConfigurations(configurations: { add: IConfigurationNode[]; remove: IConfigurationNode[] }): void;\n\n\t/**\n\t * Register multiple default configurations to the registry.\n\t */\n\tregisterDefaultConfigurations(defaultConfigurations: IConfigurationDefaults[]): void;\n\n\t/**\n\t * Deregister multiple default configurations from the registry.\n\t */\n\tderegisterDefaultConfigurations(defaultConfigurations: IConfigurationDefaults[]): void;\n\n\t/**\n\t * Bulk update of the configuration registry (default and configurations, remove and add)\n\t * @param delta\n\t */\n\tdeltaConfiguration(delta: IConfigurationDelta): void;\n\n\t/**\n\t * Return the registered default configurations\n\t */\n\tgetRegisteredDefaultConfigurations(): IConfigurationDefaults[];\n\n\t/**\n\t * Return the registered configuration defaults overrides\n\t */\n\tgetConfigurationDefaultsOverrides(): Map<string, IConfigurationDefaultOverrideValue>;\n\n\t/**\n\t * Signal that the schema of a configuration setting has changes. It is currently only supported to change enumeration values.\n\t * Property or default value changes are not allowed.\n\t */\n\tnotifyConfigurationSchemaUpdated(...configurations: IConfigurationNode[]): void;\n\n\t/**\n\t * Event that fires whenever a configuration has been\n\t * registered.\n\t */\n\treadonly onDidSchemaChange: Event<void>;\n\n\t/**\n\t * Event that fires whenever a configuration has been\n\t * registered.\n\t */\n\treadonly onDidUpdateConfiguration: Event<{ properties: ReadonlySet<string>; defaultsOverrides?: boolean }>;\n\n\t/**\n\t * Returns all configuration nodes contributed to this registry.\n\t */\n\tgetConfigurations(): IConfigurationNode[];\n\n\t/**\n\t * Returns all configurations settings of all configuration nodes contributed to this registry.\n\t */\n\tgetConfigurationProperties(): IStringDictionary<IRegisteredConfigurationPropertySchema>;\n\n\t/**\n\t * Return all configurations by policy name\n\t */\n\tgetPolicyConfigurations(): Map<PolicyName, string>;\n\n\t/**\n\t * Returns all excluded configurations settings of all configuration nodes contributed to this registry.\n\t */\n\tgetExcludedConfigurationProperties(): IStringDictionary<IRegisteredConfigurationPropertySchema>;\n\n\t/**\n\t * Register the identifiers for editor configurations\n\t */\n\tregisterOverrideIdentifiers(identifiers: string[]): void;\n}\n\nexport const enum ConfigurationScope {\n\t/**\n\t * Application specific configuration, which can be configured only in default profile user settings.\n\t */\n\tAPPLICATION = 1,\n\t/**\n\t * Machine specific configuration, which can be configured only in local and remote user settings.\n\t */\n\tMACHINE,\n\t/**\n\t * An application machine specific configuration, which can be configured only in default profile user settings and remote user settings.\n\t */\n\tAPPLICATION_MACHINE,\n\t/**\n\t * Window specific configuration, which can be configured in the user or workspace settings.\n\t */\n\tWINDOW,\n\t/**\n\t * Resource specific configuration, which can be configured in the user, workspace or folder settings.\n\t */\n\tRESOURCE,\n\t/**\n\t * Resource specific configuration that can be configured in language specific settings\n\t */\n\tLANGUAGE_OVERRIDABLE,\n\t/**\n\t * Machine specific configuration that can also be configured in workspace or folder settings.\n\t */\n\tMACHINE_OVERRIDABLE,\n}\n\n\nexport interface IConfigurationPropertySchema extends IJSONSchema {\n\n\tscope?: ConfigurationScope;\n\n\t/**\n\t * When restricted, value of this configuration will be read only from trusted sources.\n\t * For eg., If the workspace is not trusted, then the value of this configuration is not read from workspace settings file.\n\t */\n\trestricted?: boolean;\n\n\t/**\n\t * When `false` this property is excluded from the registry. Default is to include.\n\t */\n\tincluded?: boolean;\n\n\t/**\n\t * List of tags associated to the property.\n\t *  - A tag can be used for filtering\n\t *  - Use `experimental` tag for marking the setting as experimental.\n\t *  - Use `onExP` tag for marking that the default of the setting can be changed by running experiments.\n\t */\n\ttags?: string[];\n\n\t/**\n\t * When enabled this setting is ignored during sync and user can override this.\n\t */\n\tignoreSync?: boolean;\n\n\t/**\n\t * When enabled this setting is ignored during sync and user cannot override this.\n\t */\n\tdisallowSyncIgnore?: boolean;\n\n\t/**\n\t * Disallow extensions to contribute configuration default value for this setting.\n\t */\n\tdisallowConfigurationDefault?: boolean;\n\n\t/**\n\t * Labels for enumeration items\n\t */\n\tenumItemLabels?: string[];\n\n\t/**\n\t * When specified, controls the presentation format of string settings.\n\t * Otherwise, the presentation format defaults to `singleline`.\n\t */\n\teditPresentation?: EditPresentationTypes;\n\n\t/**\n\t * When specified, gives an order number for the setting\n\t * within the settings editor. Otherwise, the setting is placed at the end.\n\t */\n\torder?: number;\n\n\t/**\n\t * When specified, this setting's value can always be overwritten by\n\t * a system-wide policy.\n\t */\n\tpolicy?: IPolicy;\n}\n\nexport interface IExtensionInfo {\n\tid: string;\n\tdisplayName?: string;\n}\n\nexport interface IConfigurationNode {\n\tid?: string;\n\torder?: number;\n\ttype?: string | string[];\n\ttitle?: string;\n\tdescription?: string;\n\tproperties?: IStringDictionary<IConfigurationPropertySchema>;\n\tallOf?: IConfigurationNode[];\n\tscope?: ConfigurationScope;\n\textensionInfo?: IExtensionInfo;\n\trestrictedProperties?: string[];\n}\n\nexport type ConfigurationDefaultValueSource = IExtensionInfo | Map<string, IExtensionInfo>;\n\nexport interface IConfigurationDefaults {\n\toverrides: IStringDictionary<any>;\n\tsource?: IExtensionInfo;\n}\n\nexport type IRegisteredConfigurationPropertySchema = IConfigurationPropertySchema & {\n\tdefaultDefaultValue?: any;\n\tsource?: IExtensionInfo; // Source of the Property\n\tdefaultValueSource?: ConfigurationDefaultValueSource; // Source of the Default Value\n};\n\nexport interface IConfigurationDefaultOverride {\n\treadonly value: any;\n\treadonly source?: IExtensionInfo;  // Source of the default override\n}\n\nexport interface IConfigurationDefaultOverrideValue {\n\treadonly value: any;\n\treadonly source?: ConfigurationDefaultValueSource;\n}\n\nexport const allSettings: { properties: IStringDictionary<IConfigurationPropertySchema>; patternProperties: IStringDictionary<IConfigurationPropertySchema> } = { properties: {}, patternProperties: {} };\nexport const applicationSettings: { properties: IStringDictionary<IConfigurationPropertySchema>; patternProperties: IStringDictionary<IConfigurationPropertySchema> } = { properties: {}, patternProperties: {} };\nexport const applicationMachineSettings: { properties: IStringDictionary<IConfigurationPropertySchema>; patternProperties: IStringDictionary<IConfigurationPropertySchema> } = { properties: {}, patternProperties: {} };\nexport const machineSettings: { properties: IStringDictionary<IConfigurationPropertySchema>; patternProperties: IStringDictionary<IConfigurationPropertySchema> } = { properties: {}, patternProperties: {} };\nexport const machineOverridableSettings: { properties: IStringDictionary<IConfigurationPropertySchema>; patternProperties: IStringDictionary<IConfigurationPropertySchema> } = { properties: {}, patternProperties: {} };\nexport const windowSettings: { properties: IStringDictionary<IConfigurationPropertySchema>; patternProperties: IStringDictionary<IConfigurationPropertySchema> } = { properties: {}, patternProperties: {} };\nexport const resourceSettings: { properties: IStringDictionary<IConfigurationPropertySchema>; patternProperties: IStringDictionary<IConfigurationPropertySchema> } = { properties: {}, patternProperties: {} };\n\nexport const resourceLanguageSettingsSchemaId = 'vscode://schemas/settings/resourceLanguage';\nexport const configurationDefaultsSchemaId = 'vscode://schemas/settings/configurationDefaults';\n\nconst contributionRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);\n\nclass ConfigurationRegistry extends Disposable implements IConfigurationRegistry {\n\n\tprivate readonly registeredConfigurationDefaults: IConfigurationDefaults[] = [];\n\tprivate readonly configurationDefaultsOverrides: Map<string, { configurationDefaultOverrides: IConfigurationDefaultOverride[]; configurationDefaultOverrideValue?: IConfigurationDefaultOverrideValue }>;\n\tprivate readonly defaultLanguageConfigurationOverridesNode: IConfigurationNode;\n\tprivate readonly configurationContributors: IConfigurationNode[];\n\tprivate readonly configurationProperties: IStringDictionary<IRegisteredConfigurationPropertySchema>;\n\tprivate readonly policyConfigurations: Map<PolicyName, string>;\n\tprivate readonly excludedConfigurationProperties: IStringDictionary<IRegisteredConfigurationPropertySchema>;\n\tprivate readonly resourceLanguageSettingsSchema: IJSONSchema;\n\tprivate readonly overrideIdentifiers = new Set<string>();\n\n\tprivate readonly _onDidSchemaChange = this._register(new Emitter<void>());\n\treadonly onDidSchemaChange: Event<void> = this._onDidSchemaChange.event;\n\n\tprivate readonly _onDidUpdateConfiguration = this._register(new Emitter<{ properties: ReadonlySet<string>; defaultsOverrides?: boolean }>());\n\treadonly onDidUpdateConfiguration = this._onDidUpdateConfiguration.event;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.configurationDefaultsOverrides = new Map();\n\t\tthis.defaultLanguageConfigurationOverridesNode = {\n\t\t\tid: 'defaultOverrides',\n\t\t\ttitle: nls.localize('defaultLanguageConfigurationOverrides.title', \"Default Language Configuration Overrides\"),\n\t\t\tproperties: {}\n\t\t};\n\t\tthis.configurationContributors = [this.defaultLanguageConfigurationOverridesNode];\n\t\tthis.resourceLanguageSettingsSchema = {\n\t\t\tproperties: {},\n\t\t\tpatternProperties: {},\n\t\t\tadditionalProperties: true,\n\t\t\tallowTrailingCommas: true,\n\t\t\tallowComments: true\n\t\t};\n\t\tthis.configurationProperties = {};\n\t\tthis.policyConfigurations = new Map<PolicyName, string>();\n\t\tthis.excludedConfigurationProperties = {};\n\n\t\tcontributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n\t\tthis.registerOverridePropertyPatternKey();\n\t}\n\n\tpublic registerConfiguration(configuration: IConfigurationNode, validate: boolean = true): IConfigurationNode {\n\t\tthis.registerConfigurations([configuration], validate);\n\t\treturn configuration;\n\t}\n\n\tpublic registerConfigurations(configurations: IConfigurationNode[], validate: boolean = true): void {\n\t\tconst properties = new Set<string>();\n\t\tthis.doRegisterConfigurations(configurations, validate, properties);\n\n\t\tcontributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n\t\tthis._onDidSchemaChange.fire();\n\t\tthis._onDidUpdateConfiguration.fire({ properties });\n\t}\n\n\tpublic deregisterConfigurations(configurations: IConfigurationNode[]): void {\n\t\tconst properties = new Set<string>();\n\t\tthis.doDeregisterConfigurations(configurations, properties);\n\n\t\tcontributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n\t\tthis._onDidSchemaChange.fire();\n\t\tthis._onDidUpdateConfiguration.fire({ properties });\n\t}\n\n\tpublic updateConfigurations({ add, remove }: { add: IConfigurationNode[]; remove: IConfigurationNode[] }): void {\n\t\tconst properties = new Set<string>();\n\t\tthis.doDeregisterConfigurations(remove, properties);\n\t\tthis.doRegisterConfigurations(add, false, properties);\n\n\t\tcontributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n\t\tthis._onDidSchemaChange.fire();\n\t\tthis._onDidUpdateConfiguration.fire({ properties });\n\t}\n\n\tpublic registerDefaultConfigurations(configurationDefaults: IConfigurationDefaults[]): void {\n\t\tconst properties = new Set<string>();\n\t\tthis.doRegisterDefaultConfigurations(configurationDefaults, properties);\n\t\tthis._onDidSchemaChange.fire();\n\t\tthis._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });\n\t}\n\n\tprivate doRegisterDefaultConfigurations(configurationDefaults: IConfigurationDefaults[], bucket: Set<string>) {\n\n\t\tthis.registeredConfigurationDefaults.push(...configurationDefaults);\n\n\t\tconst overrideIdentifiers: string[] = [];\n\n\t\tfor (const { overrides, source } of configurationDefaults) {\n\t\t\tfor (const key in overrides) {\n\t\t\t\tbucket.add(key);\n\n\t\t\t\tconst configurationDefaultOverridesForKey = this.configurationDefaultsOverrides.get(key)\n\t\t\t\t\t?? this.configurationDefaultsOverrides.set(key, { configurationDefaultOverrides: [] }).get(key)!;\n\n\t\t\t\tconst value = overrides[key];\n\t\t\t\tconfigurationDefaultOverridesForKey.configurationDefaultOverrides.push({ value, source });\n\n\t\t\t\t// Configuration defaults for Override Identifiers\n\t\t\t\tif (OVERRIDE_PROPERTY_REGEX.test(key)) {\n\t\t\t\t\tconst newDefaultOverride = this.mergeDefaultConfigurationsForOverrideIdentifier(key, value, source, configurationDefaultOverridesForKey.configurationDefaultOverrideValue);\n\t\t\t\t\tif (!newDefaultOverride) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconfigurationDefaultOverridesForKey.configurationDefaultOverrideValue = newDefaultOverride;\n\t\t\t\t\tthis.updateDefaultOverrideProperty(key, newDefaultOverride, source);\n\t\t\t\t\toverrideIdentifiers.push(...overrideIdentifiersFromKey(key));\n\t\t\t\t}\n\n\t\t\t\t// Configuration defaults for Configuration Properties\n\t\t\t\telse {\n\t\t\t\t\tconst newDefaultOverride = this.mergeDefaultConfigurationsForConfigurationProperty(key, value, source, configurationDefaultOverridesForKey.configurationDefaultOverrideValue);\n\t\t\t\t\tif (!newDefaultOverride) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconfigurationDefaultOverridesForKey.configurationDefaultOverrideValue = newDefaultOverride;\n\t\t\t\t\tconst property = this.configurationProperties[key];\n\t\t\t\t\tif (property) {\n\t\t\t\t\t\tthis.updatePropertyDefaultValue(key, property);\n\t\t\t\t\t\tthis.updateSchema(key, property);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tthis.doRegisterOverrideIdentifiers(overrideIdentifiers);\n\t}\n\n\tpublic deregisterDefaultConfigurations(defaultConfigurations: IConfigurationDefaults[]): void {\n\t\tconst properties = new Set<string>();\n\t\tthis.doDeregisterDefaultConfigurations(defaultConfigurations, properties);\n\t\tthis._onDidSchemaChange.fire();\n\t\tthis._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });\n\t}\n\n\tprivate doDeregisterDefaultConfigurations(defaultConfigurations: IConfigurationDefaults[], bucket: Set<string>): void {\n\t\tfor (const defaultConfiguration of defaultConfigurations) {\n\t\t\tconst index = this.registeredConfigurationDefaults.indexOf(defaultConfiguration);\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.registeredConfigurationDefaults.splice(index, 1);\n\t\t\t}\n\t\t}\n\n\t\tfor (const { overrides, source } of defaultConfigurations) {\n\t\t\tfor (const key in overrides) {\n\t\t\t\tconst configurationDefaultOverridesForKey = this.configurationDefaultsOverrides.get(key);\n\t\t\t\tif (!configurationDefaultOverridesForKey) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst index = configurationDefaultOverridesForKey.configurationDefaultOverrides\n\t\t\t\t\t.findIndex(configurationDefaultOverride => source ? configurationDefaultOverride.source?.id === source.id : configurationDefaultOverride.value === overrides[key]);\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconfigurationDefaultOverridesForKey.configurationDefaultOverrides.splice(index, 1);\n\t\t\t\tif (configurationDefaultOverridesForKey.configurationDefaultOverrides.length === 0) {\n\t\t\t\t\tthis.configurationDefaultsOverrides.delete(key);\n\t\t\t\t}\n\n\t\t\t\tif (OVERRIDE_PROPERTY_REGEX.test(key)) {\n\t\t\t\t\tlet configurationDefaultOverrideValue: IConfigurationDefaultOverrideValue | undefined;\n\t\t\t\t\tfor (const configurationDefaultOverride of configurationDefaultOverridesForKey.configurationDefaultOverrides) {\n\t\t\t\t\t\tconfigurationDefaultOverrideValue = this.mergeDefaultConfigurationsForOverrideIdentifier(key, configurationDefaultOverride.value, configurationDefaultOverride.source, configurationDefaultOverrideValue);\n\t\t\t\t\t}\n\t\t\t\t\tif (configurationDefaultOverrideValue && !types.isEmptyObject(configurationDefaultOverrideValue.value)) {\n\t\t\t\t\t\tconfigurationDefaultOverridesForKey.configurationDefaultOverrideValue = configurationDefaultOverrideValue;\n\t\t\t\t\t\tthis.updateDefaultOverrideProperty(key, configurationDefaultOverrideValue, source);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.configurationDefaultsOverrides.delete(key);\n\t\t\t\t\t\tdelete this.configurationProperties[key];\n\t\t\t\t\t\tdelete this.defaultLanguageConfigurationOverridesNode.properties![key];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlet configurationDefaultOverrideValue: IConfigurationDefaultOverrideValue | undefined;\n\t\t\t\t\tfor (const configurationDefaultOverride of configurationDefaultOverridesForKey.configurationDefaultOverrides) {\n\t\t\t\t\t\tconfigurationDefaultOverrideValue = this.mergeDefaultConfigurationsForConfigurationProperty(key, configurationDefaultOverride.value, configurationDefaultOverride.source, configurationDefaultOverrideValue);\n\t\t\t\t\t}\n\t\t\t\t\tconfigurationDefaultOverridesForKey.configurationDefaultOverrideValue = configurationDefaultOverrideValue;\n\t\t\t\t\tconst property = this.configurationProperties[key];\n\t\t\t\t\tif (property) {\n\t\t\t\t\t\tthis.updatePropertyDefaultValue(key, property);\n\t\t\t\t\t\tthis.updateSchema(key, property);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbucket.add(key);\n\t\t\t}\n\t\t}\n\t\tthis.updateOverridePropertyPatternKey();\n\t}\n\n\tprivate updateDefaultOverrideProperty(key: string, newDefaultOverride: IConfigurationDefaultOverrideValue, source: IExtensionInfo | undefined): void {\n\t\tconst property: IRegisteredConfigurationPropertySchema = {\n\t\t\ttype: 'object',\n\t\t\tdefault: newDefaultOverride.value,\n\t\t\tdescription: nls.localize('defaultLanguageConfiguration.description', \"Configure settings to be overridden for {0}.\", getLanguageTagSettingPlainKey(key)),\n\t\t\t$ref: resourceLanguageSettingsSchemaId,\n\t\t\tdefaultDefaultValue: newDefaultOverride.value,\n\t\t\tsource,\n\t\t\tdefaultValueSource: source\n\t\t};\n\t\tthis.configurationProperties[key] = property;\n\t\tthis.defaultLanguageConfigurationOverridesNode.properties![key] = property;\n\t}\n\n\tprivate mergeDefaultConfigurationsForOverrideIdentifier(overrideIdentifier: string, configurationValueObject: IStringDictionary<any>, valueSource: IExtensionInfo | undefined, existingDefaultOverride: IConfigurationDefaultOverrideValue | undefined): IConfigurationDefaultOverrideValue | undefined {\n\t\tconst defaultValue = existingDefaultOverride?.value || {};\n\t\tconst source = existingDefaultOverride?.source ?? new Map<string, IExtensionInfo>();\n\n\t\t// This should not happen\n\t\tif (!(source instanceof Map)) {\n\t\t\tconsole.error('objectConfigurationSources is not a Map');\n\t\t\treturn undefined;\n\t\t}\n\n\t\tfor (const propertyKey of Object.keys(configurationValueObject)) {\n\t\t\tconst propertyDefaultValue = configurationValueObject[propertyKey];\n\n\t\t\tconst isObjectSetting = types.isObject(propertyDefaultValue) &&\n\t\t\t\t(types.isUndefined(defaultValue[propertyKey]) || types.isObject(defaultValue[propertyKey]));\n\n\t\t\t// If the default value is an object, merge the objects and store the source of each keys\n\t\t\tif (isObjectSetting) {\n\t\t\t\tdefaultValue[propertyKey] = { ...(defaultValue[propertyKey] ?? {}), ...propertyDefaultValue };\n\t\t\t\t// Track the source of each value in the object\n\t\t\t\tif (valueSource) {\n\t\t\t\t\tfor (const objectKey in propertyDefaultValue) {\n\t\t\t\t\t\tsource.set(`${propertyKey}.${objectKey}`, valueSource);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Primitive values are overridden\n\t\t\telse {\n\t\t\t\tdefaultValue[propertyKey] = propertyDefaultValue;\n\t\t\t\tif (valueSource) {\n\t\t\t\t\tsource.set(propertyKey, valueSource);\n\t\t\t\t} else {\n\t\t\t\t\tsource.delete(propertyKey);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { value: defaultValue, source };\n\t}\n\n\tprivate mergeDefaultConfigurationsForConfigurationProperty(propertyKey: string, value: any, valuesSource: IExtensionInfo | undefined, existingDefaultOverride: IConfigurationDefaultOverrideValue | undefined): IConfigurationDefaultOverrideValue | undefined {\n\t\tconst property = this.configurationProperties[propertyKey];\n\t\tconst existingDefaultValue = existingDefaultOverride?.value ?? property?.defaultDefaultValue;\n\t\tlet source: ConfigurationDefaultValueSource | undefined = valuesSource;\n\n\t\tconst isObjectSetting = types.isObject(value) &&\n\t\t\t(\n\t\t\t\tproperty !== undefined && property.type === 'object' ||\n\t\t\t\tproperty === undefined && (types.isUndefined(existingDefaultValue) || types.isObject(existingDefaultValue))\n\t\t\t);\n\n\t\t// If the default value is an object, merge the objects and store the source of each keys\n\t\tif (isObjectSetting) {\n\t\t\tsource = existingDefaultOverride?.source ?? new Map<string, IExtensionInfo>();\n\n\t\t\t// This should not happen\n\t\t\tif (!(source instanceof Map)) {\n\t\t\t\tconsole.error('defaultValueSource is not a Map');\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tfor (const objectKey in value) {\n\t\t\t\tif (valuesSource) {\n\t\t\t\t\tsource.set(`${propertyKey}.${objectKey}`, valuesSource);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue = { ...(types.isObject(existingDefaultValue) ? existingDefaultValue : {}), ...value };\n\t\t}\n\n\t\treturn { value, source };\n\t}\n\n\tpublic deltaConfiguration(delta: IConfigurationDelta): void {\n\t\t// defaults: remove\n\t\tlet defaultsOverrides = false;\n\t\tconst properties = new Set<string>();\n\t\tif (delta.removedDefaults) {\n\t\t\tthis.doDeregisterDefaultConfigurations(delta.removedDefaults, properties);\n\t\t\tdefaultsOverrides = true;\n\t\t}\n\t\t// defaults: add\n\t\tif (delta.addedDefaults) {\n\t\t\tthis.doRegisterDefaultConfigurations(delta.addedDefaults, properties);\n\t\t\tdefaultsOverrides = true;\n\t\t}\n\t\t// configurations: remove\n\t\tif (delta.removedConfigurations) {\n\t\t\tthis.doDeregisterConfigurations(delta.removedConfigurations, properties);\n\t\t}\n\t\t// configurations: add\n\t\tif (delta.addedConfigurations) {\n\t\t\tthis.doRegisterConfigurations(delta.addedConfigurations, false, properties);\n\t\t}\n\t\tthis._onDidSchemaChange.fire();\n\t\tthis._onDidUpdateConfiguration.fire({ properties, defaultsOverrides });\n\t}\n\n\tpublic notifyConfigurationSchemaUpdated(...configurations: IConfigurationNode[]) {\n\t\tthis._onDidSchemaChange.fire();\n\t}\n\n\tpublic registerOverrideIdentifiers(overrideIdentifiers: string[]): void {\n\t\tthis.doRegisterOverrideIdentifiers(overrideIdentifiers);\n\t\tthis._onDidSchemaChange.fire();\n\t}\n\n\tprivate doRegisterOverrideIdentifiers(overrideIdentifiers: string[]) {\n\t\tfor (const overrideIdentifier of overrideIdentifiers) {\n\t\t\tthis.overrideIdentifiers.add(overrideIdentifier);\n\t\t}\n\t\tthis.updateOverridePropertyPatternKey();\n\t}\n\n\tprivate doRegisterConfigurations(configurations: IConfigurationNode[], validate: boolean, bucket: Set<string>): void {\n\n\t\tconfigurations.forEach(configuration => {\n\n\t\t\tthis.validateAndRegisterProperties(configuration, validate, configuration.extensionInfo, configuration.restrictedProperties, undefined, bucket);\n\n\t\t\tthis.configurationContributors.push(configuration);\n\t\t\tthis.registerJSONConfiguration(configuration);\n\t\t});\n\t}\n\n\tprivate doDeregisterConfigurations(configurations: IConfigurationNode[], bucket: Set<string>): void {\n\n\t\tconst deregisterConfiguration = (configuration: IConfigurationNode) => {\n\t\t\tif (configuration.properties) {\n\t\t\t\tfor (const key in configuration.properties) {\n\t\t\t\t\tbucket.add(key);\n\t\t\t\t\tconst property = this.configurationProperties[key];\n\t\t\t\t\tif (property?.policy?.name) {\n\t\t\t\t\t\tthis.policyConfigurations.delete(property.policy.name);\n\t\t\t\t\t}\n\t\t\t\t\tdelete this.configurationProperties[key];\n\t\t\t\t\tthis.removeFromSchema(key, configuration.properties[key]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconfiguration.allOf?.forEach(node => deregisterConfiguration(node));\n\t\t};\n\t\tfor (const configuration of configurations) {\n\t\t\tderegisterConfiguration(configuration);\n\t\t\tconst index = this.configurationContributors.indexOf(configuration);\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.configurationContributors.splice(index, 1);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate validateAndRegisterProperties(configuration: IConfigurationNode, validate: boolean = true, extensionInfo: IExtensionInfo | undefined, restrictedProperties: string[] | undefined, scope: ConfigurationScope = ConfigurationScope.WINDOW, bucket: Set<string>): void {\n\t\tscope = types.isUndefinedOrNull(configuration.scope) ? scope : configuration.scope;\n\t\tconst properties = configuration.properties;\n\t\tif (properties) {\n\t\t\tfor (const key in properties) {\n\t\t\t\tconst property: IRegisteredConfigurationPropertySchema = properties[key];\n\t\t\t\tif (validate && validateProperty(key, property)) {\n\t\t\t\t\tdelete properties[key];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tproperty.source = extensionInfo;\n\n\t\t\t\t// update default value\n\t\t\t\tproperty.defaultDefaultValue = properties[key].default;\n\t\t\t\tthis.updatePropertyDefaultValue(key, property);\n\n\t\t\t\t// update scope\n\t\t\t\tif (OVERRIDE_PROPERTY_REGEX.test(key)) {\n\t\t\t\t\tproperty.scope = undefined; // No scope for overridable properties `[${identifier}]`\n\t\t\t\t} else {\n\t\t\t\t\tproperty.scope = types.isUndefinedOrNull(property.scope) ? scope : property.scope;\n\t\t\t\t\tproperty.restricted = types.isUndefinedOrNull(property.restricted) ? !!restrictedProperties?.includes(key) : property.restricted;\n\t\t\t\t}\n\n\t\t\t\tconst excluded = properties[key].hasOwnProperty('included') && !properties[key].included;\n\t\t\t\tconst policyName = properties[key].policy?.name;\n\n\t\t\t\tif (excluded) {\n\t\t\t\t\tthis.excludedConfigurationProperties[key] = properties[key];\n\t\t\t\t\tif (policyName) {\n\t\t\t\t\t\tthis.policyConfigurations.set(policyName, key);\n\t\t\t\t\t\tbucket.add(key);\n\t\t\t\t\t}\n\t\t\t\t\tdelete properties[key];\n\t\t\t\t} else {\n\t\t\t\t\tbucket.add(key);\n\t\t\t\t\tif (policyName) {\n\t\t\t\t\t\tthis.policyConfigurations.set(policyName, key);\n\t\t\t\t\t}\n\t\t\t\t\tthis.configurationProperties[key] = properties[key];\n\t\t\t\t\tif (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {\n\t\t\t\t\t\t// If not set, default deprecationMessage to the markdown source\n\t\t\t\t\t\tproperties[key].deprecationMessage = properties[key].markdownDeprecationMessage;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tconst subNodes = configuration.allOf;\n\t\tif (subNodes) {\n\t\t\tfor (const node of subNodes) {\n\t\t\t\tthis.validateAndRegisterProperties(node, validate, extensionInfo, restrictedProperties, scope, bucket);\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: @sandy081 - Remove this method and include required info in getConfigurationProperties\n\tgetConfigurations(): IConfigurationNode[] {\n\t\treturn this.configurationContributors;\n\t}\n\n\tgetConfigurationProperties(): IStringDictionary<IRegisteredConfigurationPropertySchema> {\n\t\treturn this.configurationProperties;\n\t}\n\n\tgetPolicyConfigurations(): Map<PolicyName, string> {\n\t\treturn this.policyConfigurations;\n\t}\n\n\tgetExcludedConfigurationProperties(): IStringDictionary<IRegisteredConfigurationPropertySchema> {\n\t\treturn this.excludedConfigurationProperties;\n\t}\n\n\tgetRegisteredDefaultConfigurations(): IConfigurationDefaults[] {\n\t\treturn [...this.registeredConfigurationDefaults];\n\t}\n\n\tgetConfigurationDefaultsOverrides(): Map<string, IConfigurationDefaultOverrideValue> {\n\t\tconst configurationDefaultsOverrides = new Map<string, IConfigurationDefaultOverrideValue>();\n\t\tfor (const [key, value] of this.configurationDefaultsOverrides) {\n\t\t\tif (value.configurationDefaultOverrideValue) {\n\t\t\t\tconfigurationDefaultsOverrides.set(key, value.configurationDefaultOverrideValue);\n\t\t\t}\n\t\t}\n\t\treturn configurationDefaultsOverrides;\n\t}\n\n\tprivate registerJSONConfiguration(configuration: IConfigurationNode) {\n\t\tconst register = (configuration: IConfigurationNode) => {\n\t\t\tconst properties = configuration.properties;\n\t\t\tif (properties) {\n\t\t\t\tfor (const key in properties) {\n\t\t\t\t\tthis.updateSchema(key, properties[key]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst subNodes = configuration.allOf;\n\t\t\tsubNodes?.forEach(register);\n\t\t};\n\t\tregister(configuration);\n\t}\n\n\tprivate updateSchema(key: string, property: IConfigurationPropertySchema): void {\n\t\tallSettings.properties[key] = property;\n\t\tswitch (property.scope) {\n\t\t\tcase ConfigurationScope.APPLICATION:\n\t\t\t\tapplicationSettings.properties[key] = property;\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.MACHINE:\n\t\t\t\tmachineSettings.properties[key] = property;\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.APPLICATION_MACHINE:\n\t\t\t\tapplicationMachineSettings.properties[key] = property;\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.MACHINE_OVERRIDABLE:\n\t\t\t\tmachineOverridableSettings.properties[key] = property;\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.WINDOW:\n\t\t\t\twindowSettings.properties[key] = property;\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.RESOURCE:\n\t\t\t\tresourceSettings.properties[key] = property;\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.LANGUAGE_OVERRIDABLE:\n\t\t\t\tresourceSettings.properties[key] = property;\n\t\t\t\tthis.resourceLanguageSettingsSchema.properties![key] = property;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate removeFromSchema(key: string, property: IConfigurationPropertySchema): void {\n\t\tdelete allSettings.properties[key];\n\t\tswitch (property.scope) {\n\t\t\tcase ConfigurationScope.APPLICATION:\n\t\t\t\tdelete applicationSettings.properties[key];\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.MACHINE:\n\t\t\t\tdelete machineSettings.properties[key];\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.APPLICATION_MACHINE:\n\t\t\t\tdelete applicationMachineSettings.properties[key];\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.MACHINE_OVERRIDABLE:\n\t\t\t\tdelete machineOverridableSettings.properties[key];\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.WINDOW:\n\t\t\t\tdelete windowSettings.properties[key];\n\t\t\t\tbreak;\n\t\t\tcase ConfigurationScope.RESOURCE:\n\t\t\tcase ConfigurationScope.LANGUAGE_OVERRIDABLE:\n\t\t\t\tdelete resourceSettings.properties[key];\n\t\t\t\tdelete this.resourceLanguageSettingsSchema.properties![key];\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate updateOverridePropertyPatternKey(): void {\n\t\tfor (const overrideIdentifier of this.overrideIdentifiers.values()) {\n\t\t\tconst overrideIdentifierProperty = `[${overrideIdentifier}]`;\n\t\t\tconst resourceLanguagePropertiesSchema: IJSONSchema = {\n\t\t\t\ttype: 'object',\n\t\t\t\tdescription: nls.localize('overrideSettings.defaultDescription', \"Configure editor settings to be overridden for a language.\"),\n\t\t\t\terrorMessage: nls.localize('overrideSettings.errorMessage', \"This setting does not support per-language configuration.\"),\n\t\t\t\t$ref: resourceLanguageSettingsSchemaId,\n\t\t\t};\n\t\t\tthis.updatePropertyDefaultValue(overrideIdentifierProperty, resourceLanguagePropertiesSchema);\n\t\t\tallSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n\t\t\tapplicationSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n\t\t\tapplicationMachineSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n\t\t\tmachineSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n\t\t\tmachineOverridableSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n\t\t\twindowSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n\t\t\tresourceSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n\t\t}\n\t}\n\n\tprivate registerOverridePropertyPatternKey(): void {\n\t\tconst resourceLanguagePropertiesSchema: IJSONSchema = {\n\t\t\ttype: 'object',\n\t\t\tdescription: nls.localize('overrideSettings.defaultDescription', \"Configure editor settings to be overridden for a language.\"),\n\t\t\terrorMessage: nls.localize('overrideSettings.errorMessage', \"This setting does not support per-language configuration.\"),\n\t\t\t$ref: resourceLanguageSettingsSchemaId,\n\t\t};\n\t\tallSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n\t\tapplicationSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n\t\tapplicationMachineSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n\t\tmachineSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n\t\tmachineOverridableSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n\t\twindowSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n\t\tresourceSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n\t\tthis._onDidSchemaChange.fire();\n\t}\n\n\tprivate updatePropertyDefaultValue(key: string, property: IRegisteredConfigurationPropertySchema): void {\n\t\tconst configurationdefaultOverride = this.configurationDefaultsOverrides.get(key)?.configurationDefaultOverrideValue;\n\t\tlet defaultValue = undefined;\n\t\tlet defaultSource = undefined;\n\t\tif (configurationdefaultOverride\n\t\t\t&& (!property.disallowConfigurationDefault || !configurationdefaultOverride.source) // Prevent overriding the default value if the property is disallowed to be overridden by configuration defaults from extensions\n\t\t) {\n\t\t\tdefaultValue = configurationdefaultOverride.value;\n\t\t\tdefaultSource = configurationdefaultOverride.source;\n\t\t}\n\t\tif (types.isUndefined(defaultValue)) {\n\t\t\tdefaultValue = property.defaultDefaultValue;\n\t\t\tdefaultSource = undefined;\n\t\t}\n\t\tif (types.isUndefined(defaultValue)) {\n\t\t\tdefaultValue = getDefaultValue(property.type);\n\t\t}\n\t\tproperty.default = defaultValue;\n\t\tproperty.defaultValueSource = defaultSource;\n\t}\n}\n\nconst OVERRIDE_IDENTIFIER_PATTERN = `\\\\[([^\\\\]]+)\\\\]`;\nconst OVERRIDE_IDENTIFIER_REGEX = new RegExp(OVERRIDE_IDENTIFIER_PATTERN, 'g');\nexport const OVERRIDE_PROPERTY_PATTERN = `^(${OVERRIDE_IDENTIFIER_PATTERN})+$`;\nexport const OVERRIDE_PROPERTY_REGEX = new RegExp(OVERRIDE_PROPERTY_PATTERN);\n\nexport function overrideIdentifiersFromKey(key: string): string[] {\n\tconst identifiers: string[] = [];\n\tif (OVERRIDE_PROPERTY_REGEX.test(key)) {\n\t\tlet matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);\n\t\twhile (matches?.length) {\n\t\t\tconst identifier = matches[1].trim();\n\t\t\tif (identifier) {\n\t\t\t\tidentifiers.push(identifier);\n\t\t\t}\n\t\t\tmatches = OVERRIDE_IDENTIFIER_REGEX.exec(key);\n\t\t}\n\t}\n\treturn distinct(identifiers);\n}\n\nexport function keyFromOverrideIdentifiers(overrideIdentifiers: string[]): string {\n\treturn overrideIdentifiers.reduce((result, overrideIdentifier) => `${result}[${overrideIdentifier}]`, '');\n}\n\nexport function getDefaultValue(type: string | string[] | undefined) {\n\tconst t = Array.isArray(type) ? (<string[]>type)[0] : <string>type;\n\tswitch (t) {\n\t\tcase 'boolean':\n\t\t\treturn false;\n\t\tcase 'integer':\n\t\tcase 'number':\n\t\t\treturn 0;\n\t\tcase 'string':\n\t\t\treturn '';\n\t\tcase 'array':\n\t\t\treturn [];\n\t\tcase 'object':\n\t\t\treturn {};\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\nconst configurationRegistry = new ConfigurationRegistry();\nRegistry.add(Extensions.Configuration, configurationRegistry);\n\nexport function validateProperty(property: string, schema: IRegisteredConfigurationPropertySchema): string | null {\n\tif (!property.trim()) {\n\t\treturn nls.localize('config.property.empty', \"Cannot register an empty property\");\n\t}\n\tif (OVERRIDE_PROPERTY_REGEX.test(property)) {\n\t\treturn nls.localize('config.property.languageDefault', \"Cannot register '{0}'. This matches property pattern '\\\\\\\\[.*\\\\\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.\", property);\n\t}\n\tif (configurationRegistry.getConfigurationProperties()[property] !== undefined) {\n\t\treturn nls.localize('config.property.duplicate', \"Cannot register '{0}'. This property is already registered.\", property);\n\t}\n\tif (schema.policy?.name && configurationRegistry.getPolicyConfigurations().get(schema.policy?.name) !== undefined) {\n\t\treturn nls.localize('config.policy.duplicate', \"Cannot register '{0}'. The associated policy {1} is already registered with {2}.\", property, schema.policy?.name, configurationRegistry.getPolicyConfigurations().get(schema.policy?.name));\n\t}\n\treturn null;\n}\n\nexport function getScopes(): [string, ConfigurationScope | undefined][] {\n\tconst scopes: [string, ConfigurationScope | undefined][] = [];\n\tconst configurationProperties = configurationRegistry.getConfigurationProperties();\n\tfor (const key of Object.keys(configurationProperties)) {\n\t\tscopes.push([key, configurationProperties[key].scope]);\n\t}\n\tscopes.push(['launch', ConfigurationScope.RESOURCE]);\n\tscopes.push(['task', ConfigurationScope.RESOURCE]);\n\treturn scopes;\n}\n\nexport function getAllConfigurationProperties(configurationNode: IConfigurationNode[]): IStringDictionary<IRegisteredConfigurationPropertySchema> {\n\tconst result: IStringDictionary<IRegisteredConfigurationPropertySchema> = {};\n\tfor (const configuration of configurationNode) {\n\t\tconst properties = configuration.properties;\n\t\tif (types.isObject(properties)) {\n\t\t\tfor (const key in properties) {\n\t\t\t\tresult[key] = properties[key];\n\t\t\t}\n\t\t}\n\t\tif (configuration.allOf) {\n\t\t\tObject.assign(result, getAllConfigurationProperties(configuration.allOf));\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function parseScope(scope: string): ConfigurationScope {\n\tswitch (scope) {\n\t\tcase 'application':\n\t\t\treturn ConfigurationScope.APPLICATION;\n\t\tcase 'machine':\n\t\t\treturn ConfigurationScope.MACHINE;\n\t\tcase 'resource':\n\t\t\treturn ConfigurationScope.RESOURCE;\n\t\tcase 'machine-overridable':\n\t\t\treturn ConfigurationScope.MACHINE_OVERRIDABLE;\n\t\tcase 'language-overridable':\n\t\t\treturn ConfigurationScope.LANGUAGE_OVERRIDABLE;\n\t\tdefault:\n\t\t\treturn ConfigurationScope.WINDOW;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as arrays from '../../../base/common/arrays.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport * as json from '../../../base/common/json.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { getOrSet, ResourceMap } from '../../../base/common/map.js';\nimport * as objects from '../../../base/common/objects.js';\nimport { IExtUri } from '../../../base/common/resources.js';\nimport * as types from '../../../base/common/types.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { addToValueTree, ConfigurationTarget, getConfigurationValue, IConfigurationChange, IConfigurationChangeEvent, IConfigurationCompareResult, IConfigurationData, IConfigurationModel, IConfigurationOverrides, IConfigurationUpdateOverrides, IConfigurationValue, IInspectValue, IOverrides, removeFromValueTree, toValuesTree } from './configuration.js';\nimport { ConfigurationScope, Extensions, IConfigurationPropertySchema, IConfigurationRegistry, overrideIdentifiersFromKey, OVERRIDE_PROPERTY_REGEX } from './configurationRegistry.js';\nimport { FileOperation, IFileService } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport { Workspace } from '../../workspace/common/workspace.js';\n\nfunction freeze<T>(data: T): T {\n\treturn Object.isFrozen(data) ? data : objects.deepFreeze(data);\n}\n\ntype InspectValue<V> = IInspectValue<V> & { merged?: V };\n\nexport class ConfigurationModel implements IConfigurationModel {\n\n\tstatic createEmptyModel(logService: ILogService): ConfigurationModel {\n\t\treturn new ConfigurationModel({}, [], [], undefined, logService);\n\t}\n\n\tprivate readonly overrideConfigurations = new Map<string, ConfigurationModel>();\n\n\tconstructor(\n\t\tprivate readonly _contents: any,\n\t\tprivate readonly _keys: string[],\n\t\tprivate readonly _overrides: IOverrides[],\n\t\treadonly raw: IStringDictionary<any> | ReadonlyArray<IStringDictionary<any> | ConfigurationModel> | undefined,\n\t\tprivate readonly logService: ILogService\n\t) {\n\t}\n\n\tprivate _rawConfiguration: ConfigurationModel | undefined;\n\tget rawConfiguration(): ConfigurationModel {\n\t\tif (!this._rawConfiguration) {\n\t\t\tif (this.raw) {\n\t\t\t\tconst rawConfigurationModels = (Array.isArray(this.raw) ? this.raw : [this.raw]).map(raw => {\n\t\t\t\t\tif (raw instanceof ConfigurationModel) {\n\t\t\t\t\t\treturn raw;\n\t\t\t\t\t}\n\t\t\t\t\tconst parser = new ConfigurationModelParser('', this.logService);\n\t\t\t\t\tparser.parseRaw(raw);\n\t\t\t\t\treturn parser.configurationModel;\n\t\t\t\t});\n\t\t\t\tthis._rawConfiguration = rawConfigurationModels.reduce((previous, current) => current === previous ? current : previous.merge(current), rawConfigurationModels[0]);\n\t\t\t} else {\n\t\t\t\t// raw is same as current\n\t\t\t\tthis._rawConfiguration = this;\n\t\t\t}\n\t\t}\n\t\treturn this._rawConfiguration;\n\t}\n\n\tget contents(): any {\n\t\treturn this._contents;\n\t}\n\n\tget overrides(): IOverrides[] {\n\t\treturn this._overrides;\n\t}\n\n\tget keys(): string[] {\n\t\treturn this._keys;\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this._keys.length === 0 && Object.keys(this._contents).length === 0 && this._overrides.length === 0;\n\t}\n\n\tgetValue<V>(section: string | undefined): V {\n\t\treturn section ? getConfigurationValue<any>(this.contents, section) : this.contents;\n\t}\n\n\tinspect<V>(section: string | undefined, overrideIdentifier?: string | null): InspectValue<V> {\n\t\tconst that = this;\n\t\treturn {\n\t\t\tget value() {\n\t\t\t\treturn freeze(that.rawConfiguration.getValue<V>(section));\n\t\t\t},\n\t\t\tget override() {\n\t\t\t\treturn overrideIdentifier ? freeze(that.rawConfiguration.getOverrideValue<V>(section, overrideIdentifier)) : undefined;\n\t\t\t},\n\t\t\tget merged() {\n\t\t\t\treturn freeze(overrideIdentifier ? that.rawConfiguration.override(overrideIdentifier).getValue<V>(section) : that.rawConfiguration.getValue<V>(section));\n\t\t\t},\n\t\t\tget overrides() {\n\t\t\t\tconst overrides: { readonly identifiers: string[]; readonly value: V }[] = [];\n\t\t\t\tfor (const { contents, identifiers, keys } of that.rawConfiguration.overrides) {\n\t\t\t\t\tconst value = new ConfigurationModel(contents, keys, [], undefined, that.logService).getValue<V>(section);\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\toverrides.push({ identifiers, value });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn overrides.length ? freeze(overrides) : undefined;\n\t\t\t}\n\t\t};\n\t}\n\n\tgetOverrideValue<V>(section: string | undefined, overrideIdentifier: string): V | undefined {\n\t\tconst overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier);\n\t\treturn overrideContents\n\t\t\t? section ? getConfigurationValue<any>(overrideContents, section) : overrideContents\n\t\t\t: undefined;\n\t}\n\n\tgetKeysForOverrideIdentifier(identifier: string): string[] {\n\t\tconst keys: string[] = [];\n\t\tfor (const override of this.overrides) {\n\t\t\tif (override.identifiers.includes(identifier)) {\n\t\t\t\tkeys.push(...override.keys);\n\t\t\t}\n\t\t}\n\t\treturn arrays.distinct(keys);\n\t}\n\n\tgetAllOverrideIdentifiers(): string[] {\n\t\tconst result: string[] = [];\n\t\tfor (const override of this.overrides) {\n\t\t\tresult.push(...override.identifiers);\n\t\t}\n\t\treturn arrays.distinct(result);\n\t}\n\n\toverride(identifier: string): ConfigurationModel {\n\t\tlet overrideConfigurationModel = this.overrideConfigurations.get(identifier);\n\t\tif (!overrideConfigurationModel) {\n\t\t\toverrideConfigurationModel = this.createOverrideConfigurationModel(identifier);\n\t\t\tthis.overrideConfigurations.set(identifier, overrideConfigurationModel);\n\t\t}\n\t\treturn overrideConfigurationModel;\n\t}\n\n\tmerge(...others: ConfigurationModel[]): ConfigurationModel {\n\t\tconst contents = objects.deepClone(this.contents);\n\t\tconst overrides = objects.deepClone(this.overrides);\n\t\tconst keys = [...this.keys];\n\t\tconst raws = this.raw ? Array.isArray(this.raw) ? [...this.raw] : [this.raw] : [this];\n\n\t\tfor (const other of others) {\n\t\t\traws.push(...(other.raw ? Array.isArray(other.raw) ? other.raw : [other.raw] : [other]));\n\t\t\tif (other.isEmpty()) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.mergeContents(contents, other.contents);\n\n\t\t\tfor (const otherOverride of other.overrides) {\n\t\t\t\tconst [override] = overrides.filter(o => arrays.equals(o.identifiers, otherOverride.identifiers));\n\t\t\t\tif (override) {\n\t\t\t\t\tthis.mergeContents(override.contents, otherOverride.contents);\n\t\t\t\t\toverride.keys.push(...otherOverride.keys);\n\t\t\t\t\toverride.keys = arrays.distinct(override.keys);\n\t\t\t\t} else {\n\t\t\t\t\toverrides.push(objects.deepClone(otherOverride));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const key of other.keys) {\n\t\t\t\tif (keys.indexOf(key) === -1) {\n\t\t\t\t\tkeys.push(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new ConfigurationModel(contents, keys, overrides, !raws.length || raws.every(raw => raw instanceof ConfigurationModel) ? undefined : raws, this.logService);\n\t}\n\n\tprivate createOverrideConfigurationModel(identifier: string): ConfigurationModel {\n\t\tconst overrideContents = this.getContentsForOverrideIdentifer(identifier);\n\n\t\tif (!overrideContents || typeof overrideContents !== 'object' || !Object.keys(overrideContents).length) {\n\t\t\t// If there are no valid overrides, return self\n\t\t\treturn this;\n\t\t}\n\n\t\tconst contents: any = {};\n\t\tfor (const key of arrays.distinct([...Object.keys(this.contents), ...Object.keys(overrideContents)])) {\n\n\t\t\tlet contentsForKey = this.contents[key];\n\t\t\tconst overrideContentsForKey = overrideContents[key];\n\n\t\t\t// If there are override contents for the key, clone and merge otherwise use base contents\n\t\t\tif (overrideContentsForKey) {\n\t\t\t\t// Clone and merge only if base contents and override contents are of type object otherwise just override\n\t\t\t\tif (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {\n\t\t\t\t\tcontentsForKey = objects.deepClone(contentsForKey);\n\t\t\t\t\tthis.mergeContents(contentsForKey, overrideContentsForKey);\n\t\t\t\t} else {\n\t\t\t\t\tcontentsForKey = overrideContentsForKey;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontents[key] = contentsForKey;\n\t\t}\n\n\t\treturn new ConfigurationModel(contents, this.keys, this.overrides, undefined, this.logService);\n\t}\n\n\tprivate mergeContents(source: any, target: any): void {\n\t\tfor (const key of Object.keys(target)) {\n\t\t\tif (key in source) {\n\t\t\t\tif (types.isObject(source[key]) && types.isObject(target[key])) {\n\t\t\t\t\tthis.mergeContents(source[key], target[key]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsource[key] = objects.deepClone(target[key]);\n\t\t}\n\t}\n\n\tprivate getContentsForOverrideIdentifer(identifier: string): any {\n\t\tlet contentsForIdentifierOnly: IStringDictionary<any> | null = null;\n\t\tlet contents: IStringDictionary<any> | null = null;\n\t\tconst mergeContents = (contentsToMerge: any) => {\n\t\t\tif (contentsToMerge) {\n\t\t\t\tif (contents) {\n\t\t\t\t\tthis.mergeContents(contents, contentsToMerge);\n\t\t\t\t} else {\n\t\t\t\t\tcontents = objects.deepClone(contentsToMerge);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tfor (const override of this.overrides) {\n\t\t\tif (override.identifiers.length === 1 && override.identifiers[0] === identifier) {\n\t\t\t\tcontentsForIdentifierOnly = override.contents;\n\t\t\t} else if (override.identifiers.includes(identifier)) {\n\t\t\t\tmergeContents(override.contents);\n\t\t\t}\n\t\t}\n\t\t// Merge contents of the identifier only at the end to take precedence.\n\t\tmergeContents(contentsForIdentifierOnly);\n\t\treturn contents;\n\t}\n\n\ttoJSON(): IConfigurationModel {\n\t\treturn {\n\t\t\tcontents: this.contents,\n\t\t\toverrides: this.overrides,\n\t\t\tkeys: this.keys\n\t\t};\n\t}\n\n\t// Update methods\n\n\tpublic addValue(key: string, value: any): void {\n\t\tthis.updateValue(key, value, true);\n\t}\n\n\tpublic setValue(key: string, value: any): void {\n\t\tthis.updateValue(key, value, false);\n\t}\n\n\tpublic removeValue(key: string): void {\n\t\tconst index = this.keys.indexOf(key);\n\t\tif (index === -1) {\n\t\t\treturn;\n\t\t}\n\t\tthis.keys.splice(index, 1);\n\t\tremoveFromValueTree(this.contents, key);\n\t\tif (OVERRIDE_PROPERTY_REGEX.test(key)) {\n\t\t\tthis.overrides.splice(this.overrides.findIndex(o => arrays.equals(o.identifiers, overrideIdentifiersFromKey(key))), 1);\n\t\t}\n\t}\n\n\tprivate updateValue(key: string, value: any, add: boolean): void {\n\t\taddToValueTree(this.contents, key, value, e => this.logService.error(e));\n\t\tadd = add || this.keys.indexOf(key) === -1;\n\t\tif (add) {\n\t\t\tthis.keys.push(key);\n\t\t}\n\t\tif (OVERRIDE_PROPERTY_REGEX.test(key)) {\n\t\t\tconst identifiers = overrideIdentifiersFromKey(key);\n\t\t\tconst override = {\n\t\t\t\tidentifiers,\n\t\t\t\tkeys: Object.keys(this.contents[key]),\n\t\t\t\tcontents: toValuesTree(this.contents[key], message => this.logService.error(message)),\n\t\t\t};\n\t\t\tconst index = this.overrides.findIndex(o => arrays.equals(o.identifiers, identifiers));\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.overrides[index] = override;\n\t\t\t} else {\n\t\t\t\tthis.overrides.push(override);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface ConfigurationParseOptions {\n\tskipUnregistered?: boolean;\n\tscopes?: ConfigurationScope[];\n\tskipRestricted?: boolean;\n\tinclude?: string[];\n\texclude?: string[];\n}\n\nexport class ConfigurationModelParser {\n\n\tprivate _raw: any = null;\n\tprivate _configurationModel: ConfigurationModel | null = null;\n\tprivate _restrictedConfigurations: string[] = [];\n\tprivate _parseErrors: any[] = [];\n\n\tconstructor(\n\t\tprotected readonly _name: string,\n\t\tprotected readonly logService: ILogService\n\t) { }\n\n\tget configurationModel(): ConfigurationModel {\n\t\treturn this._configurationModel || ConfigurationModel.createEmptyModel(this.logService);\n\t}\n\n\tget restrictedConfigurations(): string[] {\n\t\treturn this._restrictedConfigurations;\n\t}\n\n\tget errors(): any[] {\n\t\treturn this._parseErrors;\n\t}\n\n\tpublic parse(content: string | null | undefined, options?: ConfigurationParseOptions): void {\n\t\tif (!types.isUndefinedOrNull(content)) {\n\t\t\tconst raw = this.doParseContent(content);\n\t\t\tthis.parseRaw(raw, options);\n\t\t}\n\t}\n\n\tpublic reparse(options: ConfigurationParseOptions): void {\n\t\tif (this._raw) {\n\t\t\tthis.parseRaw(this._raw, options);\n\t\t}\n\t}\n\n\tpublic parseRaw(raw: any, options?: ConfigurationParseOptions): void {\n\t\tthis._raw = raw;\n\t\tconst { contents, keys, overrides, restricted, hasExcludedProperties } = this.doParseRaw(raw, options);\n\t\tthis._configurationModel = new ConfigurationModel(contents, keys, overrides, hasExcludedProperties ? [raw] : undefined /* raw has not changed */, this.logService);\n\t\tthis._restrictedConfigurations = restricted || [];\n\t}\n\n\tprivate doParseContent(content: string): any {\n\t\tlet raw: any = {};\n\t\tlet currentProperty: string | null = null;\n\t\tlet currentParent: any = [];\n\t\tconst previousParents: any[] = [];\n\t\tconst parseErrors: json.ParseError[] = [];\n\n\t\tfunction onValue(value: any) {\n\t\t\tif (Array.isArray(currentParent)) {\n\t\t\t\t(<any[]>currentParent).push(value);\n\t\t\t} else if (currentProperty !== null) {\n\t\t\t\tcurrentParent[currentProperty] = value;\n\t\t\t}\n\t\t}\n\n\t\tconst visitor: json.JSONVisitor = {\n\t\t\tonObjectBegin: () => {\n\t\t\t\tconst object = {};\n\t\t\t\tonValue(object);\n\t\t\t\tpreviousParents.push(currentParent);\n\t\t\t\tcurrentParent = object;\n\t\t\t\tcurrentProperty = null;\n\t\t\t},\n\t\t\tonObjectProperty: (name: string) => {\n\t\t\t\tcurrentProperty = name;\n\t\t\t},\n\t\t\tonObjectEnd: () => {\n\t\t\t\tcurrentParent = previousParents.pop();\n\t\t\t},\n\t\t\tonArrayBegin: () => {\n\t\t\t\tconst array: any[] = [];\n\t\t\t\tonValue(array);\n\t\t\t\tpreviousParents.push(currentParent);\n\t\t\t\tcurrentParent = array;\n\t\t\t\tcurrentProperty = null;\n\t\t\t},\n\t\t\tonArrayEnd: () => {\n\t\t\t\tcurrentParent = previousParents.pop();\n\t\t\t},\n\t\t\tonLiteralValue: onValue,\n\t\t\tonError: (error: json.ParseErrorCode, offset: number, length: number) => {\n\t\t\t\tparseErrors.push({ error, offset, length });\n\t\t\t}\n\t\t};\n\t\tif (content) {\n\t\t\ttry {\n\t\t\t\tjson.visit(content, visitor);\n\t\t\t\traw = currentParent[0] || {};\n\t\t\t} catch (e) {\n\t\t\t\tthis.logService.error(`Error while parsing settings file ${this._name}: ${e}`);\n\t\t\t\tthis._parseErrors = [e];\n\t\t\t}\n\t\t}\n\n\t\treturn raw;\n\t}\n\n\tprotected doParseRaw(raw: any, options?: ConfigurationParseOptions): IConfigurationModel & { restricted?: string[]; hasExcludedProperties?: boolean } {\n\t\tconst configurationProperties = Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurationProperties();\n\t\tconst filtered = this.filter(raw, configurationProperties, true, options);\n\t\traw = filtered.raw;\n\t\tconst contents = toValuesTree(raw, message => this.logService.error(`Conflict in settings file ${this._name}: ${message}`));\n\t\tconst keys = Object.keys(raw);\n\t\tconst overrides = this.toOverrides(raw, message => this.logService.error(`Conflict in settings file ${this._name}: ${message}`));\n\t\treturn { contents, keys, overrides, restricted: filtered.restricted, hasExcludedProperties: filtered.hasExcludedProperties };\n\t}\n\n\tprivate filter(properties: any, configurationProperties: { [qualifiedKey: string]: IConfigurationPropertySchema | undefined }, filterOverriddenProperties: boolean, options?: ConfigurationParseOptions): { raw: {}; restricted: string[]; hasExcludedProperties: boolean } {\n\t\tlet hasExcludedProperties = false;\n\t\tif (!options?.scopes && !options?.skipRestricted && !options?.exclude?.length) {\n\t\t\treturn { raw: properties, restricted: [], hasExcludedProperties };\n\t\t}\n\t\tconst raw: any = {};\n\t\tconst restricted: string[] = [];\n\t\tfor (const key in properties) {\n\t\t\tif (OVERRIDE_PROPERTY_REGEX.test(key) && filterOverriddenProperties) {\n\t\t\t\tconst result = this.filter(properties[key], configurationProperties, false, options);\n\t\t\t\traw[key] = result.raw;\n\t\t\t\thasExcludedProperties = hasExcludedProperties || result.hasExcludedProperties;\n\t\t\t\trestricted.push(...result.restricted);\n\t\t\t} else {\n\t\t\t\tconst propertySchema = configurationProperties[key];\n\t\t\t\tif (propertySchema?.restricted) {\n\t\t\t\t\trestricted.push(key);\n\t\t\t\t}\n\t\t\t\tif (this.shouldInclude(key, propertySchema, options)) {\n\t\t\t\t\traw[key] = properties[key];\n\t\t\t\t} else {\n\t\t\t\t\thasExcludedProperties = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn { raw, restricted, hasExcludedProperties };\n\t}\n\n\tprivate shouldInclude(key: string, propertySchema: IConfigurationPropertySchema | undefined, options: ConfigurationParseOptions): boolean {\n\t\tif (options.exclude?.includes(key)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (options.include?.includes(key)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (options.skipRestricted && propertySchema?.restricted) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (options.skipUnregistered && !propertySchema) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst scope = propertySchema ? typeof propertySchema.scope !== 'undefined' ? propertySchema.scope : ConfigurationScope.WINDOW : undefined;\n\t\tif (scope === undefined || options.scopes === undefined) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn options.scopes.includes(scope);\n\t}\n\n\tprivate toOverrides(raw: any, conflictReporter: (message: string) => void): IOverrides[] {\n\t\tconst overrides: IOverrides[] = [];\n\t\tfor (const key of Object.keys(raw)) {\n\t\t\tif (OVERRIDE_PROPERTY_REGEX.test(key)) {\n\t\t\t\tconst overrideRaw: any = {};\n\t\t\t\tfor (const keyInOverrideRaw in raw[key]) {\n\t\t\t\t\toverrideRaw[keyInOverrideRaw] = raw[key][keyInOverrideRaw];\n\t\t\t\t}\n\t\t\t\toverrides.push({\n\t\t\t\t\tidentifiers: overrideIdentifiersFromKey(key),\n\t\t\t\t\tkeys: Object.keys(overrideRaw),\n\t\t\t\t\tcontents: toValuesTree(overrideRaw, conflictReporter)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn overrides;\n\t}\n\n}\n\nexport class UserSettings extends Disposable {\n\n\tprivate readonly parser: ConfigurationModelParser;\n\tprotected readonly _onDidChange: Emitter<void> = this._register(new Emitter<void>());\n\treadonly onDidChange: Event<void> = this._onDidChange.event;\n\n\tconstructor(\n\t\tprivate readonly userSettingsResource: URI,\n\t\tprotected parseOptions: ConfigurationParseOptions,\n\t\textUri: IExtUri,\n\t\tprivate readonly fileService: IFileService,\n\t\tprivate readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis.parser = new ConfigurationModelParser(this.userSettingsResource.toString(), logService);\n\t\tthis._register(this.fileService.watch(extUri.dirname(this.userSettingsResource)));\n\t\t// Also listen to the resource incase the resource is a symlink - https://github.com/microsoft/vscode/issues/118134\n\t\tthis._register(this.fileService.watch(this.userSettingsResource));\n\t\tthis._register(Event.any(\n\t\t\tEvent.filter(this.fileService.onDidFilesChange, e => e.contains(this.userSettingsResource)),\n\t\t\tEvent.filter(this.fileService.onDidRunOperation, e => (e.isOperation(FileOperation.CREATE) || e.isOperation(FileOperation.COPY) || e.isOperation(FileOperation.DELETE) || e.isOperation(FileOperation.WRITE)) && extUri.isEqual(e.resource, userSettingsResource))\n\t\t)(() => this._onDidChange.fire()));\n\t}\n\n\tasync loadConfiguration(): Promise<ConfigurationModel> {\n\t\ttry {\n\t\t\tconst content = await this.fileService.readFile(this.userSettingsResource);\n\t\t\tthis.parser.parse(content.value.toString() || '{}', this.parseOptions);\n\t\t\treturn this.parser.configurationModel;\n\t\t} catch (e) {\n\t\t\treturn ConfigurationModel.createEmptyModel(this.logService);\n\t\t}\n\t}\n\n\treparse(parseOptions?: ConfigurationParseOptions): ConfigurationModel {\n\t\tif (parseOptions) {\n\t\t\tthis.parseOptions = parseOptions;\n\t\t}\n\t\tthis.parser.reparse(this.parseOptions);\n\t\treturn this.parser.configurationModel;\n\t}\n\n\tgetRestrictedSettings(): string[] {\n\t\treturn this.parser.restrictedConfigurations;\n\t}\n}\n\nclass ConfigurationInspectValue<V> implements IConfigurationValue<V> {\n\n\tconstructor(\n\t\tprivate readonly key: string,\n\t\tprivate readonly overrides: IConfigurationOverrides,\n\t\tprivate readonly _value: V | undefined,\n\t\treadonly overrideIdentifiers: string[] | undefined,\n\t\tprivate readonly defaultConfiguration: ConfigurationModel,\n\t\tprivate readonly policyConfiguration: ConfigurationModel | undefined,\n\t\tprivate readonly applicationConfiguration: ConfigurationModel | undefined,\n\t\tprivate readonly userConfiguration: ConfigurationModel,\n\t\tprivate readonly localUserConfiguration: ConfigurationModel,\n\t\tprivate readonly remoteUserConfiguration: ConfigurationModel,\n\t\tprivate readonly workspaceConfiguration: ConfigurationModel | undefined,\n\t\tprivate readonly folderConfigurationModel: ConfigurationModel | undefined,\n\t\tprivate readonly memoryConfigurationModel: ConfigurationModel\n\t) {\n\t}\n\n\tget value(): V | undefined {\n\t\treturn freeze(this._value);\n\t}\n\n\tprivate toInspectValue(inspectValue: IInspectValue<V> | undefined | null): IInspectValue<V> | undefined {\n\t\treturn inspectValue?.value !== undefined || inspectValue?.override !== undefined || inspectValue?.overrides !== undefined ? inspectValue : undefined;\n\t}\n\n\tprivate _defaultInspectValue: InspectValue<V> | undefined;\n\tprivate get defaultInspectValue(): InspectValue<V> {\n\t\tif (!this._defaultInspectValue) {\n\t\t\tthis._defaultInspectValue = this.defaultConfiguration.inspect<V>(this.key, this.overrides.overrideIdentifier);\n\t\t}\n\t\treturn this._defaultInspectValue;\n\t}\n\n\tget defaultValue(): V | undefined {\n\t\treturn this.defaultInspectValue.merged;\n\t}\n\n\tget default(): IInspectValue<V> | undefined {\n\t\treturn this.toInspectValue(this.defaultInspectValue);\n\t}\n\n\tprivate _policyInspectValue: InspectValue<V> | undefined | null;\n\tprivate get policyInspectValue(): InspectValue<V> | null {\n\t\tif (this._policyInspectValue === undefined) {\n\t\t\tthis._policyInspectValue = this.policyConfiguration ? this.policyConfiguration.inspect<V>(this.key) : null;\n\t\t}\n\t\treturn this._policyInspectValue;\n\t}\n\n\tget policyValue(): V | undefined {\n\t\treturn this.policyInspectValue?.merged;\n\t}\n\n\tget policy(): IInspectValue<V> | undefined {\n\t\treturn this.policyInspectValue?.value !== undefined ? { value: this.policyInspectValue.value } : undefined;\n\t}\n\n\tprivate _applicationInspectValue: InspectValue<V> | undefined | null;\n\tprivate get applicationInspectValue(): InspectValue<V> | null {\n\t\tif (this._applicationInspectValue === undefined) {\n\t\t\tthis._applicationInspectValue = this.applicationConfiguration ? this.applicationConfiguration.inspect<V>(this.key) : null;\n\t\t}\n\t\treturn this._applicationInspectValue;\n\t}\n\n\tget applicationValue(): V | undefined {\n\t\treturn this.applicationInspectValue?.merged;\n\t}\n\n\tget application(): IInspectValue<V> | undefined {\n\t\treturn this.toInspectValue(this.applicationInspectValue);\n\t}\n\n\tprivate _userInspectValue: InspectValue<V> | undefined;\n\tprivate get userInspectValue(): InspectValue<V> {\n\t\tif (!this._userInspectValue) {\n\t\t\tthis._userInspectValue = this.userConfiguration.inspect<V>(this.key, this.overrides.overrideIdentifier);\n\t\t}\n\t\treturn this._userInspectValue;\n\t}\n\n\tget userValue(): V | undefined {\n\t\treturn this.userInspectValue.merged;\n\t}\n\n\tget user(): IInspectValue<V> | undefined {\n\t\treturn this.toInspectValue(this.userInspectValue);\n\t}\n\n\tprivate _userLocalInspectValue: InspectValue<V> | undefined;\n\tprivate get userLocalInspectValue(): InspectValue<V> {\n\t\tif (!this._userLocalInspectValue) {\n\t\t\tthis._userLocalInspectValue = this.localUserConfiguration.inspect<V>(this.key, this.overrides.overrideIdentifier);\n\t\t}\n\t\treturn this._userLocalInspectValue;\n\t}\n\n\tget userLocalValue(): V | undefined {\n\t\treturn this.userLocalInspectValue.merged;\n\t}\n\n\tget userLocal(): IInspectValue<V> | undefined {\n\t\treturn this.toInspectValue(this.userLocalInspectValue);\n\t}\n\n\tprivate _userRemoteInspectValue: InspectValue<V> | undefined;\n\tprivate get userRemoteInspectValue(): InspectValue<V> {\n\t\tif (!this._userRemoteInspectValue) {\n\t\t\tthis._userRemoteInspectValue = this.remoteUserConfiguration.inspect<V>(this.key, this.overrides.overrideIdentifier);\n\t\t}\n\t\treturn this._userRemoteInspectValue;\n\t}\n\n\tget userRemoteValue(): V | undefined {\n\t\treturn this.userRemoteInspectValue.merged;\n\t}\n\n\tget userRemote(): IInspectValue<V> | undefined {\n\t\treturn this.toInspectValue(this.userRemoteInspectValue);\n\t}\n\n\tprivate _workspaceInspectValue: InspectValue<V> | undefined | null;\n\tprivate get workspaceInspectValue(): InspectValue<V> | null {\n\t\tif (this._workspaceInspectValue === undefined) {\n\t\t\tthis._workspaceInspectValue = this.workspaceConfiguration ? this.workspaceConfiguration.inspect<V>(this.key, this.overrides.overrideIdentifier) : null;\n\t\t}\n\t\treturn this._workspaceInspectValue;\n\t}\n\n\tget workspaceValue(): V | undefined {\n\t\treturn this.workspaceInspectValue?.merged;\n\t}\n\n\tget workspace(): IInspectValue<V> | undefined {\n\t\treturn this.toInspectValue(this.workspaceInspectValue);\n\t}\n\n\tprivate _workspaceFolderInspectValue: InspectValue<V> | undefined | null;\n\tprivate get workspaceFolderInspectValue(): InspectValue<V> | null {\n\t\tif (this._workspaceFolderInspectValue === undefined) {\n\t\t\tthis._workspaceFolderInspectValue = this.folderConfigurationModel ? this.folderConfigurationModel.inspect<V>(this.key, this.overrides.overrideIdentifier) : null;\n\t\t}\n\t\treturn this._workspaceFolderInspectValue;\n\t}\n\n\tget workspaceFolderValue(): V | undefined {\n\t\treturn this.workspaceFolderInspectValue?.merged;\n\t}\n\n\tget workspaceFolder(): IInspectValue<V> | undefined {\n\t\treturn this.toInspectValue(this.workspaceFolderInspectValue);\n\t}\n\n\tprivate _memoryInspectValue: InspectValue<V> | undefined;\n\tprivate get memoryInspectValue(): InspectValue<V> {\n\t\tif (this._memoryInspectValue === undefined) {\n\t\t\tthis._memoryInspectValue = this.memoryConfigurationModel.inspect<V>(this.key, this.overrides.overrideIdentifier);\n\t\t}\n\t\treturn this._memoryInspectValue;\n\t}\n\n\tget memoryValue(): V | undefined {\n\t\treturn this.memoryInspectValue.merged;\n\t}\n\n\tget memory(): IInspectValue<V> | undefined {\n\t\treturn this.toInspectValue(this.memoryInspectValue);\n\t}\n\n}\n\nexport class Configuration {\n\n\tprivate _workspaceConsolidatedConfiguration: ConfigurationModel | null = null;\n\tprivate _foldersConsolidatedConfigurations = new ResourceMap<ConfigurationModel>();\n\n\tconstructor(\n\t\tprivate _defaultConfiguration: ConfigurationModel,\n\t\tprivate _policyConfiguration: ConfigurationModel,\n\t\tprivate _applicationConfiguration: ConfigurationModel,\n\t\tprivate _localUserConfiguration: ConfigurationModel,\n\t\tprivate _remoteUserConfiguration: ConfigurationModel,\n\t\tprivate _workspaceConfiguration: ConfigurationModel,\n\t\tprivate _folderConfigurations: ResourceMap<ConfigurationModel>,\n\t\tprivate _memoryConfiguration: ConfigurationModel,\n\t\tprivate _memoryConfigurationByResource: ResourceMap<ConfigurationModel>,\n\t\tprivate readonly logService: ILogService\n\t) {\n\t}\n\n\tgetValue(section: string | undefined, overrides: IConfigurationOverrides, workspace: Workspace | undefined): any {\n\t\tconst consolidateConfigurationModel = this.getConsolidatedConfigurationModel(section, overrides, workspace);\n\t\treturn consolidateConfigurationModel.getValue(section);\n\t}\n\n\tupdateValue(key: string, value: any, overrides: IConfigurationUpdateOverrides = {}): void {\n\t\tlet memoryConfiguration: ConfigurationModel | undefined;\n\t\tif (overrides.resource) {\n\t\t\tmemoryConfiguration = this._memoryConfigurationByResource.get(overrides.resource);\n\t\t\tif (!memoryConfiguration) {\n\t\t\t\tmemoryConfiguration = ConfigurationModel.createEmptyModel(this.logService);\n\t\t\t\tthis._memoryConfigurationByResource.set(overrides.resource, memoryConfiguration);\n\t\t\t}\n\t\t} else {\n\t\t\tmemoryConfiguration = this._memoryConfiguration;\n\t\t}\n\n\t\tif (value === undefined) {\n\t\t\tmemoryConfiguration.removeValue(key);\n\t\t} else {\n\t\t\tmemoryConfiguration.setValue(key, value);\n\t\t}\n\n\t\tif (!overrides.resource) {\n\t\t\tthis._workspaceConsolidatedConfiguration = null;\n\t\t}\n\t}\n\n\tinspect<C>(key: string, overrides: IConfigurationOverrides, workspace: Workspace | undefined): IConfigurationValue<C> {\n\t\tconst consolidateConfigurationModel = this.getConsolidatedConfigurationModel(key, overrides, workspace);\n\t\tconst folderConfigurationModel = this.getFolderConfigurationModelForResource(overrides.resource, workspace);\n\t\tconst memoryConfigurationModel = overrides.resource ? this._memoryConfigurationByResource.get(overrides.resource) || this._memoryConfiguration : this._memoryConfiguration;\n\t\tconst overrideIdentifiers = new Set<string>();\n\t\tfor (const override of consolidateConfigurationModel.overrides) {\n\t\t\tfor (const overrideIdentifier of override.identifiers) {\n\t\t\t\tif (consolidateConfigurationModel.getOverrideValue(key, overrideIdentifier) !== undefined) {\n\t\t\t\t\toverrideIdentifiers.add(overrideIdentifier);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn new ConfigurationInspectValue<C>(\n\t\t\tkey,\n\t\t\toverrides,\n\t\t\tconsolidateConfigurationModel.getValue<C>(key),\n\t\t\toverrideIdentifiers.size ? [...overrideIdentifiers] : undefined,\n\t\t\tthis._defaultConfiguration,\n\t\t\tthis._policyConfiguration.isEmpty() ? undefined : this._policyConfiguration,\n\t\t\tthis.applicationConfiguration.isEmpty() ? undefined : this.applicationConfiguration,\n\t\t\tthis.userConfiguration,\n\t\t\tthis.localUserConfiguration,\n\t\t\tthis.remoteUserConfiguration,\n\t\t\tworkspace ? this._workspaceConfiguration : undefined,\n\t\t\tfolderConfigurationModel ? folderConfigurationModel : undefined,\n\t\t\tmemoryConfigurationModel\n\t\t);\n\n\t}\n\n\tkeys(workspace: Workspace | undefined): {\n\t\tdefault: string[];\n\t\tuser: string[];\n\t\tworkspace: string[];\n\t\tworkspaceFolder: string[];\n\t} {\n\t\tconst folderConfigurationModel = this.getFolderConfigurationModelForResource(undefined, workspace);\n\t\treturn {\n\t\t\tdefault: this._defaultConfiguration.keys.slice(0),\n\t\t\tuser: this.userConfiguration.keys.slice(0),\n\t\t\tworkspace: this._workspaceConfiguration.keys.slice(0),\n\t\t\tworkspaceFolder: folderConfigurationModel ? folderConfigurationModel.keys.slice(0) : []\n\t\t};\n\t}\n\n\tupdateDefaultConfiguration(defaultConfiguration: ConfigurationModel): void {\n\t\tthis._defaultConfiguration = defaultConfiguration;\n\t\tthis._workspaceConsolidatedConfiguration = null;\n\t\tthis._foldersConsolidatedConfigurations.clear();\n\t}\n\n\tupdatePolicyConfiguration(policyConfiguration: ConfigurationModel): void {\n\t\tthis._policyConfiguration = policyConfiguration;\n\t}\n\n\tupdateApplicationConfiguration(applicationConfiguration: ConfigurationModel): void {\n\t\tthis._applicationConfiguration = applicationConfiguration;\n\t\tthis._workspaceConsolidatedConfiguration = null;\n\t\tthis._foldersConsolidatedConfigurations.clear();\n\t}\n\n\tupdateLocalUserConfiguration(localUserConfiguration: ConfigurationModel): void {\n\t\tthis._localUserConfiguration = localUserConfiguration;\n\t\tthis._userConfiguration = null;\n\t\tthis._workspaceConsolidatedConfiguration = null;\n\t\tthis._foldersConsolidatedConfigurations.clear();\n\t}\n\n\tupdateRemoteUserConfiguration(remoteUserConfiguration: ConfigurationModel): void {\n\t\tthis._remoteUserConfiguration = remoteUserConfiguration;\n\t\tthis._userConfiguration = null;\n\t\tthis._workspaceConsolidatedConfiguration = null;\n\t\tthis._foldersConsolidatedConfigurations.clear();\n\t}\n\n\tupdateWorkspaceConfiguration(workspaceConfiguration: ConfigurationModel): void {\n\t\tthis._workspaceConfiguration = workspaceConfiguration;\n\t\tthis._workspaceConsolidatedConfiguration = null;\n\t\tthis._foldersConsolidatedConfigurations.clear();\n\t}\n\n\tupdateFolderConfiguration(resource: URI, configuration: ConfigurationModel): void {\n\t\tthis._folderConfigurations.set(resource, configuration);\n\t\tthis._foldersConsolidatedConfigurations.delete(resource);\n\t}\n\n\tdeleteFolderConfiguration(resource: URI): void {\n\t\tthis.folderConfigurations.delete(resource);\n\t\tthis._foldersConsolidatedConfigurations.delete(resource);\n\t}\n\n\tcompareAndUpdateDefaultConfiguration(defaults: ConfigurationModel, keys?: string[]): IConfigurationChange {\n\t\tconst overrides: [string, string[]][] = [];\n\t\tif (!keys) {\n\t\t\tconst { added, updated, removed } = compare(this._defaultConfiguration, defaults);\n\t\t\tkeys = [...added, ...updated, ...removed];\n\t\t}\n\t\tfor (const key of keys) {\n\t\t\tfor (const overrideIdentifier of overrideIdentifiersFromKey(key)) {\n\t\t\t\tconst fromKeys = this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier);\n\t\t\t\tconst toKeys = defaults.getKeysForOverrideIdentifier(overrideIdentifier);\n\t\t\t\tconst keys = [\n\t\t\t\t\t...toKeys.filter(key => fromKeys.indexOf(key) === -1),\n\t\t\t\t\t...fromKeys.filter(key => toKeys.indexOf(key) === -1),\n\t\t\t\t\t...fromKeys.filter(key => !objects.equals(this._defaultConfiguration.override(overrideIdentifier).getValue(key), defaults.override(overrideIdentifier).getValue(key)))\n\t\t\t\t];\n\t\t\t\toverrides.push([overrideIdentifier, keys]);\n\t\t\t}\n\t\t}\n\t\tthis.updateDefaultConfiguration(defaults);\n\t\treturn { keys, overrides };\n\t}\n\n\tcompareAndUpdatePolicyConfiguration(policyConfiguration: ConfigurationModel): IConfigurationChange {\n\t\tconst { added, updated, removed } = compare(this._policyConfiguration, policyConfiguration);\n\t\tconst keys = [...added, ...updated, ...removed];\n\t\tif (keys.length) {\n\t\t\tthis.updatePolicyConfiguration(policyConfiguration);\n\t\t}\n\t\treturn { keys, overrides: [] };\n\t}\n\n\tcompareAndUpdateApplicationConfiguration(application: ConfigurationModel): IConfigurationChange {\n\t\tconst { added, updated, removed, overrides } = compare(this.applicationConfiguration, application);\n\t\tconst keys = [...added, ...updated, ...removed];\n\t\tif (keys.length) {\n\t\t\tthis.updateApplicationConfiguration(application);\n\t\t}\n\t\treturn { keys, overrides };\n\t}\n\n\tcompareAndUpdateLocalUserConfiguration(user: ConfigurationModel): IConfigurationChange {\n\t\tconst { added, updated, removed, overrides } = compare(this.localUserConfiguration, user);\n\t\tconst keys = [...added, ...updated, ...removed];\n\t\tif (keys.length) {\n\t\t\tthis.updateLocalUserConfiguration(user);\n\t\t}\n\t\treturn { keys, overrides };\n\t}\n\n\tcompareAndUpdateRemoteUserConfiguration(user: ConfigurationModel): IConfigurationChange {\n\t\tconst { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user);\n\t\tconst keys = [...added, ...updated, ...removed];\n\t\tif (keys.length) {\n\t\t\tthis.updateRemoteUserConfiguration(user);\n\t\t}\n\t\treturn { keys, overrides };\n\t}\n\n\tcompareAndUpdateWorkspaceConfiguration(workspaceConfiguration: ConfigurationModel): IConfigurationChange {\n\t\tconst { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration);\n\t\tconst keys = [...added, ...updated, ...removed];\n\t\tif (keys.length) {\n\t\t\tthis.updateWorkspaceConfiguration(workspaceConfiguration);\n\t\t}\n\t\treturn { keys, overrides };\n\t}\n\n\tcompareAndUpdateFolderConfiguration(resource: URI, folderConfiguration: ConfigurationModel): IConfigurationChange {\n\t\tconst currentFolderConfiguration = this.folderConfigurations.get(resource);\n\t\tconst { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration);\n\t\tconst keys = [...added, ...updated, ...removed];\n\t\tif (keys.length || !currentFolderConfiguration) {\n\t\t\tthis.updateFolderConfiguration(resource, folderConfiguration);\n\t\t}\n\t\treturn { keys, overrides };\n\t}\n\n\tcompareAndDeleteFolderConfiguration(folder: URI): IConfigurationChange {\n\t\tconst folderConfig = this.folderConfigurations.get(folder);\n\t\tif (!folderConfig) {\n\t\t\tthrow new Error('Unknown folder');\n\t\t}\n\t\tthis.deleteFolderConfiguration(folder);\n\t\tconst { added, updated, removed, overrides } = compare(folderConfig, undefined);\n\t\treturn { keys: [...added, ...updated, ...removed], overrides };\n\t}\n\n\tget defaults(): ConfigurationModel {\n\t\treturn this._defaultConfiguration;\n\t}\n\n\tget applicationConfiguration(): ConfigurationModel {\n\t\treturn this._applicationConfiguration;\n\t}\n\n\tprivate _userConfiguration: ConfigurationModel | null = null;\n\tget userConfiguration(): ConfigurationModel {\n\t\tif (!this._userConfiguration) {\n\t\t\tif (this._remoteUserConfiguration.isEmpty()) {\n\t\t\t\tthis._userConfiguration = this._localUserConfiguration;\n\t\t\t} else {\n\t\t\t\tconst merged = this._localUserConfiguration.merge(this._remoteUserConfiguration);\n\t\t\t\tthis._userConfiguration = new ConfigurationModel(merged.contents, merged.keys, merged.overrides, undefined, this.logService);\n\t\t\t}\n\t\t}\n\t\treturn this._userConfiguration;\n\t}\n\n\tget localUserConfiguration(): ConfigurationModel {\n\t\treturn this._localUserConfiguration;\n\t}\n\n\tget remoteUserConfiguration(): ConfigurationModel {\n\t\treturn this._remoteUserConfiguration;\n\t}\n\n\tget workspaceConfiguration(): ConfigurationModel {\n\t\treturn this._workspaceConfiguration;\n\t}\n\n\tget folderConfigurations(): ResourceMap<ConfigurationModel> {\n\t\treturn this._folderConfigurations;\n\t}\n\n\tprivate getConsolidatedConfigurationModel(section: string | undefined, overrides: IConfigurationOverrides, workspace: Workspace | undefined): ConfigurationModel {\n\t\tlet configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);\n\t\tif (overrides.overrideIdentifier) {\n\t\t\tconfigurationModel = configurationModel.override(overrides.overrideIdentifier);\n\t\t}\n\t\tif (!this._policyConfiguration.isEmpty() && this._policyConfiguration.getValue(section) !== undefined) {\n\t\t\t// clone by merging\n\t\t\tconfigurationModel = configurationModel.merge();\n\t\t\tfor (const key of this._policyConfiguration.keys) {\n\t\t\t\tconfigurationModel.setValue(key, this._policyConfiguration.getValue(key));\n\t\t\t}\n\t\t}\n\t\treturn configurationModel;\n\t}\n\n\tprivate getConsolidatedConfigurationModelForResource({ resource }: IConfigurationOverrides, workspace: Workspace | undefined): ConfigurationModel {\n\t\tlet consolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();\n\n\t\tif (workspace && resource) {\n\t\t\tconst root = workspace.getFolder(resource);\n\t\t\tif (root) {\n\t\t\t\tconsolidateConfiguration = this.getFolderConsolidatedConfiguration(root.uri) || consolidateConfiguration;\n\t\t\t}\n\t\t\tconst memoryConfigurationForResource = this._memoryConfigurationByResource.get(resource);\n\t\t\tif (memoryConfigurationForResource) {\n\t\t\t\tconsolidateConfiguration = consolidateConfiguration.merge(memoryConfigurationForResource);\n\t\t\t}\n\t\t}\n\n\t\treturn consolidateConfiguration;\n\t}\n\n\tprivate getWorkspaceConsolidatedConfiguration(): ConfigurationModel {\n\t\tif (!this._workspaceConsolidatedConfiguration) {\n\t\t\tthis._workspaceConsolidatedConfiguration = this._defaultConfiguration.merge(this.applicationConfiguration, this.userConfiguration, this._workspaceConfiguration, this._memoryConfiguration);\n\t\t}\n\t\treturn this._workspaceConsolidatedConfiguration;\n\t}\n\n\tprivate getFolderConsolidatedConfiguration(folder: URI): ConfigurationModel {\n\t\tlet folderConsolidatedConfiguration = this._foldersConsolidatedConfigurations.get(folder);\n\t\tif (!folderConsolidatedConfiguration) {\n\t\t\tconst workspaceConsolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();\n\t\t\tconst folderConfiguration = this._folderConfigurations.get(folder);\n\t\t\tif (folderConfiguration) {\n\t\t\t\tfolderConsolidatedConfiguration = workspaceConsolidateConfiguration.merge(folderConfiguration);\n\t\t\t\tthis._foldersConsolidatedConfigurations.set(folder, folderConsolidatedConfiguration);\n\t\t\t} else {\n\t\t\t\tfolderConsolidatedConfiguration = workspaceConsolidateConfiguration;\n\t\t\t}\n\t\t}\n\t\treturn folderConsolidatedConfiguration;\n\t}\n\n\tprivate getFolderConfigurationModelForResource(resource: URI | null | undefined, workspace: Workspace | undefined): ConfigurationModel | undefined {\n\t\tif (workspace && resource) {\n\t\t\tconst root = workspace.getFolder(resource);\n\t\t\tif (root) {\n\t\t\t\treturn this._folderConfigurations.get(root.uri);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\ttoData(): IConfigurationData {\n\t\treturn {\n\t\t\tdefaults: {\n\t\t\t\tcontents: this._defaultConfiguration.contents,\n\t\t\t\toverrides: this._defaultConfiguration.overrides,\n\t\t\t\tkeys: this._defaultConfiguration.keys,\n\t\t\t},\n\t\t\tpolicy: {\n\t\t\t\tcontents: this._policyConfiguration.contents,\n\t\t\t\toverrides: this._policyConfiguration.overrides,\n\t\t\t\tkeys: this._policyConfiguration.keys\n\t\t\t},\n\t\t\tapplication: {\n\t\t\t\tcontents: this.applicationConfiguration.contents,\n\t\t\t\toverrides: this.applicationConfiguration.overrides,\n\t\t\t\tkeys: this.applicationConfiguration.keys,\n\t\t\t\traw: Array.isArray(this.applicationConfiguration.raw) ? undefined : this.applicationConfiguration.raw\n\t\t\t},\n\t\t\tuserLocal: {\n\t\t\t\tcontents: this.localUserConfiguration.contents,\n\t\t\t\toverrides: this.localUserConfiguration.overrides,\n\t\t\t\tkeys: this.localUserConfiguration.keys,\n\t\t\t\traw: Array.isArray(this.localUserConfiguration.raw) ? undefined : this.localUserConfiguration.raw\n\t\t\t},\n\t\t\tuserRemote: {\n\t\t\t\tcontents: this.remoteUserConfiguration.contents,\n\t\t\t\toverrides: this.remoteUserConfiguration.overrides,\n\t\t\t\tkeys: this.remoteUserConfiguration.keys,\n\t\t\t\traw: Array.isArray(this.remoteUserConfiguration.raw) ? undefined : this.remoteUserConfiguration.raw\n\t\t\t},\n\t\t\tworkspace: {\n\t\t\t\tcontents: this._workspaceConfiguration.contents,\n\t\t\t\toverrides: this._workspaceConfiguration.overrides,\n\t\t\t\tkeys: this._workspaceConfiguration.keys\n\t\t\t},\n\t\t\tfolders: [...this._folderConfigurations.keys()].reduce<[UriComponents, IConfigurationModel][]>((result, folder) => {\n\t\t\t\tconst { contents, overrides, keys } = this._folderConfigurations.get(folder)!;\n\t\t\t\tresult.push([folder, { contents, overrides, keys }]);\n\t\t\t\treturn result;\n\t\t\t}, [])\n\t\t};\n\t}\n\n\tallKeys(): string[] {\n\t\tconst keys: Set<string> = new Set<string>();\n\t\tthis._defaultConfiguration.keys.forEach(key => keys.add(key));\n\t\tthis.userConfiguration.keys.forEach(key => keys.add(key));\n\t\tthis._workspaceConfiguration.keys.forEach(key => keys.add(key));\n\t\tthis._folderConfigurations.forEach(folderConfiguration => folderConfiguration.keys.forEach(key => keys.add(key)));\n\t\treturn [...keys.values()];\n\t}\n\n\tprotected allOverrideIdentifiers(): string[] {\n\t\tconst keys: Set<string> = new Set<string>();\n\t\tthis._defaultConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));\n\t\tthis.userConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));\n\t\tthis._workspaceConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key));\n\t\tthis._folderConfigurations.forEach(folderConfiguration => folderConfiguration.getAllOverrideIdentifiers().forEach(key => keys.add(key)));\n\t\treturn [...keys.values()];\n\t}\n\n\tprotected getAllKeysForOverrideIdentifier(overrideIdentifier: string): string[] {\n\t\tconst keys: Set<string> = new Set<string>();\n\t\tthis._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));\n\t\tthis.userConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));\n\t\tthis._workspaceConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key));\n\t\tthis._folderConfigurations.forEach(folderConfiguration => folderConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key)));\n\t\treturn [...keys.values()];\n\t}\n\n\tstatic parse(data: IConfigurationData, logService: ILogService): Configuration {\n\t\tconst defaultConfiguration = this.parseConfigurationModel(data.defaults, logService);\n\t\tconst policyConfiguration = this.parseConfigurationModel(data.policy, logService);\n\t\tconst applicationConfiguration = this.parseConfigurationModel(data.application, logService);\n\t\tconst userLocalConfiguration = this.parseConfigurationModel(data.userLocal, logService);\n\t\tconst userRemoteConfiguration = this.parseConfigurationModel(data.userRemote, logService);\n\t\tconst workspaceConfiguration = this.parseConfigurationModel(data.workspace, logService);\n\t\tconst folders: ResourceMap<ConfigurationModel> = data.folders.reduce((result, value) => {\n\t\t\tresult.set(URI.revive(value[0]), this.parseConfigurationModel(value[1], logService));\n\t\t\treturn result;\n\t\t}, new ResourceMap<ConfigurationModel>());\n\t\treturn new Configuration(\n\t\t\tdefaultConfiguration,\n\t\t\tpolicyConfiguration,\n\t\t\tapplicationConfiguration,\n\t\t\tuserLocalConfiguration,\n\t\t\tuserRemoteConfiguration,\n\t\t\tworkspaceConfiguration,\n\t\t\tfolders,\n\t\t\tConfigurationModel.createEmptyModel(logService),\n\t\t\tnew ResourceMap<ConfigurationModel>(),\n\t\t\tlogService\n\t\t);\n\t}\n\n\tprivate static parseConfigurationModel(model: IConfigurationModel, logService: ILogService): ConfigurationModel {\n\t\treturn new ConfigurationModel(model.contents, model.keys, model.overrides, model.raw, logService);\n\t}\n\n}\n\nexport function mergeChanges(...changes: IConfigurationChange[]): IConfigurationChange {\n\tif (changes.length === 0) {\n\t\treturn { keys: [], overrides: [] };\n\t}\n\tif (changes.length === 1) {\n\t\treturn changes[0];\n\t}\n\tconst keysSet = new Set<string>();\n\tconst overridesMap = new Map<string, Set<string>>();\n\tfor (const change of changes) {\n\t\tchange.keys.forEach(key => keysSet.add(key));\n\t\tchange.overrides.forEach(([identifier, keys]) => {\n\t\t\tconst result = getOrSet(overridesMap, identifier, new Set<string>());\n\t\t\tkeys.forEach(key => result.add(key));\n\t\t});\n\t}\n\tconst overrides: [string, string[]][] = [];\n\toverridesMap.forEach((keys, identifier) => overrides.push([identifier, [...keys.values()]]));\n\treturn { keys: [...keysSet.values()], overrides };\n}\n\nexport class ConfigurationChangeEvent implements IConfigurationChangeEvent {\n\n\tprivate readonly _marker = '\\n';\n\tprivate readonly _markerCode1 = this._marker.charCodeAt(0);\n\tprivate readonly _markerCode2 = '.'.charCodeAt(0);\n\tprivate readonly _affectsConfigStr: string;\n\n\treadonly affectedKeys = new Set<string>();\n\tsource!: ConfigurationTarget;\n\n\tconstructor(\n\t\treadonly change: IConfigurationChange,\n\t\tprivate readonly previous: { workspace?: Workspace; data: IConfigurationData } | undefined,\n\t\tprivate readonly currentConfiguraiton: Configuration,\n\t\tprivate readonly currentWorkspace: Workspace | undefined,\n\t\tprivate readonly logService: ILogService\n\t) {\n\t\tfor (const key of change.keys) {\n\t\t\tthis.affectedKeys.add(key);\n\t\t}\n\t\tfor (const [, keys] of change.overrides) {\n\t\t\tfor (const key of keys) {\n\t\t\t\tthis.affectedKeys.add(key);\n\t\t\t}\n\t\t}\n\n\t\t// Example: '\\nfoo.bar\\nabc.def\\n'\n\t\tthis._affectsConfigStr = this._marker;\n\t\tfor (const key of this.affectedKeys) {\n\t\t\tthis._affectsConfigStr += key + this._marker;\n\t\t}\n\t}\n\n\tprivate _previousConfiguration: Configuration | undefined = undefined;\n\tget previousConfiguration(): Configuration | undefined {\n\t\tif (!this._previousConfiguration && this.previous) {\n\t\t\tthis._previousConfiguration = Configuration.parse(this.previous.data, this.logService);\n\t\t}\n\t\treturn this._previousConfiguration;\n\t}\n\n\taffectsConfiguration(section: string, overrides?: IConfigurationOverrides): boolean {\n\t\t// we have one large string with all keys that have changed. we pad (marker) the section\n\t\t// and check that either find it padded or before a segment character\n\t\tconst needle = this._marker + section;\n\t\tconst idx = this._affectsConfigStr.indexOf(needle);\n\t\tif (idx < 0) {\n\t\t\t// NOT: (marker + section)\n\t\t\treturn false;\n\t\t}\n\t\tconst pos = idx + needle.length;\n\t\tif (pos >= this._affectsConfigStr.length) {\n\t\t\treturn false;\n\t\t}\n\t\tconst code = this._affectsConfigStr.charCodeAt(pos);\n\t\tif (code !== this._markerCode1 && code !== this._markerCode2) {\n\t\t\t// NOT: section + (marker | segment)\n\t\t\treturn false;\n\t\t}\n\t\tif (overrides) {\n\t\t\tconst value1 = this.previousConfiguration ? this.previousConfiguration.getValue(section, overrides, this.previous?.workspace) : undefined;\n\t\t\tconst value2 = this.currentConfiguraiton.getValue(section, overrides, this.currentWorkspace);\n\t\t\treturn !objects.equals(value1, value2);\n\t\t}\n\t\treturn true;\n\t}\n}\n\nfunction compare(from: ConfigurationModel | undefined, to: ConfigurationModel | undefined): IConfigurationCompareResult {\n\tconst { added, removed, updated } = compareConfigurationContents(to?.rawConfiguration, from?.rawConfiguration);\n\tconst overrides: [string, string[]][] = [];\n\n\tconst fromOverrideIdentifiers = from?.getAllOverrideIdentifiers() || [];\n\tconst toOverrideIdentifiers = to?.getAllOverrideIdentifiers() || [];\n\n\tif (to) {\n\t\tconst addedOverrideIdentifiers = toOverrideIdentifiers.filter(key => !fromOverrideIdentifiers.includes(key));\n\t\tfor (const identifier of addedOverrideIdentifiers) {\n\t\t\toverrides.push([identifier, to.getKeysForOverrideIdentifier(identifier)]);\n\t\t}\n\t}\n\n\tif (from) {\n\t\tconst removedOverrideIdentifiers = fromOverrideIdentifiers.filter(key => !toOverrideIdentifiers.includes(key));\n\t\tfor (const identifier of removedOverrideIdentifiers) {\n\t\t\toverrides.push([identifier, from.getKeysForOverrideIdentifier(identifier)]);\n\t\t}\n\t}\n\n\tif (to && from) {\n\t\tfor (const identifier of fromOverrideIdentifiers) {\n\t\t\tif (toOverrideIdentifiers.includes(identifier)) {\n\t\t\t\tconst result = compareConfigurationContents({ contents: from.getOverrideValue(undefined, identifier) || {}, keys: from.getKeysForOverrideIdentifier(identifier) }, { contents: to.getOverrideValue(undefined, identifier) || {}, keys: to.getKeysForOverrideIdentifier(identifier) });\n\t\t\t\toverrides.push([identifier, [...result.added, ...result.removed, ...result.updated]]);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { added, removed, updated, overrides };\n}\n\nfunction compareConfigurationContents(to: { keys: string[]; contents: any } | undefined, from: { keys: string[]; contents: any } | undefined) {\n\tconst added = to\n\t\t? from ? to.keys.filter(key => from.keys.indexOf(key) === -1) : [...to.keys]\n\t\t: [];\n\tconst removed = from\n\t\t? to ? from.keys.filter(key => to.keys.indexOf(key) === -1) : [...from.keys]\n\t\t: [];\n\tconst updated: string[] = [];\n\n\tif (to && from) {\n\t\tfor (const key of from.keys) {\n\t\t\tif (to.keys.indexOf(key) !== -1) {\n\t\t\t\tconst value1 = getConfigurationValue(from.contents, key);\n\t\t\t\tconst value2 = getConfigurationValue(to.contents, key);\n\t\t\t\tif (!objects.equals(value1, value2)) {\n\t\t\t\t\tupdated.push(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn { added, removed, updated };\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Iterable } from '../../../base/common/iterator.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { PolicyName } from '../../../base/common/policy.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport type PolicyValue = string | number | boolean;\nexport type PolicyDefinition = { type: 'string' | 'number' | 'boolean'; previewFeature?: boolean; defaultValue?: string | number | boolean };\n\nexport const IPolicyService = createDecorator<IPolicyService>('policy');\n\nexport interface IPolicyService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly onDidChange: Event<readonly PolicyName[]>;\n\tupdatePolicyDefinitions(policyDefinitions: IStringDictionary<PolicyDefinition>): Promise<IStringDictionary<PolicyValue>>;\n\tgetPolicyValue(name: PolicyName): PolicyValue | undefined;\n\tserialize(): IStringDictionary<{ definition: PolicyDefinition; value: PolicyValue }> | undefined;\n\treadonly policyDefinitions: IStringDictionary<PolicyDefinition>;\n}\n\nexport abstract class AbstractPolicyService extends Disposable implements IPolicyService {\n\treadonly _serviceBrand: undefined;\n\n\tpublic policyDefinitions: IStringDictionary<PolicyDefinition> = {};\n\tprotected policies = new Map<PolicyName, PolicyValue>();\n\n\tprotected readonly _onDidChange = this._register(new Emitter<readonly PolicyName[]>());\n\treadonly onDidChange = this._onDidChange.event;\n\n\tasync updatePolicyDefinitions(policyDefinitions: IStringDictionary<PolicyDefinition>): Promise<IStringDictionary<PolicyValue>> {\n\t\tconst size = Object.keys(this.policyDefinitions).length;\n\t\tthis.policyDefinitions = { ...policyDefinitions, ...this.policyDefinitions };\n\n\t\tif (size !== Object.keys(this.policyDefinitions).length) {\n\t\t\tawait this._updatePolicyDefinitions(this.policyDefinitions);\n\t\t}\n\n\t\treturn Iterable.reduce(this.policies.entries(), (r, [name, value]) => ({ ...r, [name]: value }), {});\n\t}\n\n\tgetPolicyValue(name: PolicyName): PolicyValue | undefined {\n\t\treturn this.policies.get(name);\n\t}\n\n\tserialize(): IStringDictionary<{ definition: PolicyDefinition; value: PolicyValue }> {\n\t\treturn Iterable.reduce<[PolicyName, PolicyDefinition], IStringDictionary<{ definition: PolicyDefinition; value: PolicyValue }>>(Object.entries(this.policyDefinitions), (r, [name, definition]) => ({ ...r, [name]: { definition, value: this.policies.get(name)! } }), {});\n\t}\n\n\tprotected abstract _updatePolicyDefinitions(policyDefinitions: IStringDictionary<PolicyDefinition>): Promise<void>;\n}\n\nexport class NullPolicyService implements IPolicyService {\n\treadonly _serviceBrand: undefined;\n\treadonly onDidChange = Event.None;\n\tasync updatePolicyDefinitions() { return {}; }\n\tgetPolicyValue() { return undefined; }\n\tserialize() { return undefined; }\n\tpolicyDefinitions: IStringDictionary<PolicyDefinition> = {};\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { coalesce } from '../../../base/common/arrays.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { deepClone, equals } from '../../../base/common/objects.js';\nimport { isEmptyObject, isString } from '../../../base/common/types.js';\nimport { ConfigurationModel } from './configurationModels.js';\nimport { Extensions, IConfigurationRegistry, IRegisteredConfigurationPropertySchema } from './configurationRegistry.js';\nimport { ILogService, NullLogService } from '../../log/common/log.js';\nimport { IPolicyService, PolicyDefinition } from '../../policy/common/policy.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport { getErrorMessage } from '../../../base/common/errors.js';\nimport * as json from '../../../base/common/json.js';\nimport { PolicyName } from '../../../base/common/policy.js';\n\nexport class DefaultConfiguration extends Disposable {\n\n\tprivate readonly _onDidChangeConfiguration = this._register(new Emitter<{ defaults: ConfigurationModel; properties: string[] }>());\n\treadonly onDidChangeConfiguration = this._onDidChangeConfiguration.event;\n\n\tprivate _configurationModel: ConfigurationModel;\n\tget configurationModel(): ConfigurationModel {\n\t\treturn this._configurationModel;\n\t}\n\n\tconstructor(private readonly logService: ILogService) {\n\t\tsuper();\n\t\tthis._configurationModel = ConfigurationModel.createEmptyModel(logService);\n\t}\n\n\tasync initialize(): Promise<ConfigurationModel> {\n\t\tthis.resetConfigurationModel();\n\t\tthis._register(Registry.as<IConfigurationRegistry>(Extensions.Configuration).onDidUpdateConfiguration(({ properties, defaultsOverrides }) => this.onDidUpdateConfiguration(Array.from(properties), defaultsOverrides)));\n\t\treturn this.configurationModel;\n\t}\n\n\treload(): ConfigurationModel {\n\t\tthis.resetConfigurationModel();\n\t\treturn this.configurationModel;\n\t}\n\n\tprotected onDidUpdateConfiguration(properties: string[], defaultsOverrides?: boolean): void {\n\t\tthis.updateConfigurationModel(properties, Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurationProperties());\n\t\tthis._onDidChangeConfiguration.fire({ defaults: this.configurationModel, properties });\n\t}\n\n\tprotected getConfigurationDefaultOverrides(): IStringDictionary<any> {\n\t\treturn {};\n\t}\n\n\tprivate resetConfigurationModel(): void {\n\t\tthis._configurationModel = ConfigurationModel.createEmptyModel(this.logService);\n\t\tconst properties = Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurationProperties();\n\t\tthis.updateConfigurationModel(Object.keys(properties), properties);\n\t}\n\n\tprivate updateConfigurationModel(properties: string[], configurationProperties: IStringDictionary<IRegisteredConfigurationPropertySchema>): void {\n\t\tconst configurationDefaultsOverrides = this.getConfigurationDefaultOverrides();\n\t\tfor (const key of properties) {\n\t\t\tconst defaultOverrideValue = configurationDefaultsOverrides[key];\n\t\t\tconst propertySchema = configurationProperties[key];\n\t\t\tif (defaultOverrideValue !== undefined) {\n\t\t\t\tthis._configurationModel.setValue(key, defaultOverrideValue);\n\t\t\t} else if (propertySchema) {\n\t\t\t\tthis._configurationModel.setValue(key, deepClone(propertySchema.default));\n\t\t\t} else {\n\t\t\t\tthis._configurationModel.removeValue(key);\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nexport interface IPolicyConfiguration {\n\treadonly onDidChangeConfiguration: Event<ConfigurationModel>;\n\treadonly configurationModel: ConfigurationModel;\n\tinitialize(): Promise<ConfigurationModel>;\n}\n\nexport class NullPolicyConfiguration implements IPolicyConfiguration {\n\treadonly onDidChangeConfiguration = Event.None;\n\treadonly configurationModel = ConfigurationModel.createEmptyModel(new NullLogService());\n\tasync initialize() { return this.configurationModel; }\n}\n\nexport class PolicyConfiguration extends Disposable implements IPolicyConfiguration {\n\n\tprivate readonly _onDidChangeConfiguration = this._register(new Emitter<ConfigurationModel>());\n\treadonly onDidChangeConfiguration = this._onDidChangeConfiguration.event;\n\n\tprivate readonly configurationRegistry: IConfigurationRegistry;\n\n\tprivate _configurationModel: ConfigurationModel;\n\tget configurationModel() { return this._configurationModel; }\n\n\tconstructor(\n\t\tprivate readonly defaultConfiguration: DefaultConfiguration,\n\t\t@IPolicyService private readonly policyService: IPolicyService,\n\t\t@ILogService private readonly logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis._configurationModel = ConfigurationModel.createEmptyModel(this.logService);\n\t\tthis.configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);\n\t}\n\n\tasync initialize(): Promise<ConfigurationModel> {\n\t\tthis.logService.trace('PolicyConfiguration#initialize');\n\n\t\tthis.update(await this.updatePolicyDefinitions(this.defaultConfiguration.configurationModel.keys), false);\n\t\tthis.update(await this.updatePolicyDefinitions(Object.keys(this.configurationRegistry.getExcludedConfigurationProperties())), false);\n\t\tthis._register(this.policyService.onDidChange(policyNames => this.onDidChangePolicies(policyNames)));\n\t\tthis._register(this.defaultConfiguration.onDidChangeConfiguration(async ({ properties }) => this.update(await this.updatePolicyDefinitions(properties), true)));\n\t\treturn this._configurationModel;\n\t}\n\n\tprivate async updatePolicyDefinitions(properties: string[]): Promise<string[]> {\n\t\tthis.logService.trace('PolicyConfiguration#updatePolicyDefinitions', properties);\n\t\tconst policyDefinitions: IStringDictionary<PolicyDefinition> = {};\n\t\tconst keys: string[] = [];\n\t\tconst configurationProperties = this.configurationRegistry.getConfigurationProperties();\n\t\tconst excludedConfigurationProperties = this.configurationRegistry.getExcludedConfigurationProperties();\n\n\t\tfor (const key of properties) {\n\t\t\tconst config = configurationProperties[key] ?? excludedConfigurationProperties[key];\n\t\t\tif (!config) {\n\t\t\t\t// Config is removed. So add it to the list if in case it was registered as policy before\n\t\t\t\tkeys.push(key);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (config.policy) {\n\t\t\t\tif (config.type !== 'string' && config.type !== 'number' && config.type !== 'array' && config.type !== 'object' && config.type !== 'boolean') {\n\t\t\t\t\tthis.logService.warn(`Policy ${config.policy.name} has unsupported type ${config.type}`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst { defaultValue, previewFeature } = config.policy;\n\t\t\t\tkeys.push(key);\n\t\t\t\tpolicyDefinitions[config.policy.name] = {\n\t\t\t\t\ttype: config.type === 'number' ? 'number' : config.type === 'boolean' ? 'boolean' : 'string',\n\t\t\t\t\tpreviewFeature,\n\t\t\t\t\tdefaultValue,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif (!isEmptyObject(policyDefinitions)) {\n\t\t\tawait this.policyService.updatePolicyDefinitions(policyDefinitions);\n\t\t}\n\n\t\treturn keys;\n\t}\n\n\tprivate onDidChangePolicies(policyNames: readonly PolicyName[]): void {\n\t\tthis.logService.trace('PolicyConfiguration#onDidChangePolicies', policyNames);\n\t\tconst policyConfigurations = this.configurationRegistry.getPolicyConfigurations();\n\t\tconst keys = coalesce(policyNames.map(policyName => policyConfigurations.get(policyName)));\n\t\tthis.update(keys, true);\n\t}\n\n\tprivate update(keys: string[], trigger: boolean): void {\n\t\tthis.logService.trace('PolicyConfiguration#update', keys);\n\t\tconst configurationProperties = this.configurationRegistry.getConfigurationProperties();\n\t\tconst excludedConfigurationProperties = this.configurationRegistry.getExcludedConfigurationProperties();\n\t\tconst changed: [string, any][] = [];\n\t\tconst wasEmpty = this._configurationModel.isEmpty();\n\n\t\tfor (const key of keys) {\n\t\t\tconst proprety = configurationProperties[key] ?? excludedConfigurationProperties[key];\n\t\t\tconst policyName = proprety?.policy?.name;\n\t\t\tif (policyName) {\n\t\t\t\tlet policyValue = this.policyService.getPolicyValue(policyName);\n\t\t\t\tif (isString(policyValue) && proprety.type !== 'string') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tpolicyValue = this.parse(policyValue);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.logService.error(`Error parsing policy value ${policyName}:`, getErrorMessage(e));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (wasEmpty ? policyValue !== undefined : !equals(this._configurationModel.getValue(key), policyValue)) {\n\t\t\t\t\tchanged.push([key, policyValue]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this._configurationModel.getValue(key) !== undefined) {\n\t\t\t\t\tchanged.push([key, undefined]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (changed.length) {\n\t\t\tthis.logService.trace('PolicyConfiguration#changed', changed);\n\t\t\tconst old = this._configurationModel;\n\t\t\tthis._configurationModel = ConfigurationModel.createEmptyModel(this.logService);\n\t\t\tfor (const key of old.keys) {\n\t\t\t\tthis._configurationModel.setValue(key, old.getValue(key));\n\t\t\t}\n\t\t\tfor (const [key, policyValue] of changed) {\n\t\t\t\tif (policyValue === undefined) {\n\t\t\t\t\tthis._configurationModel.removeValue(key);\n\t\t\t\t} else {\n\t\t\t\t\tthis._configurationModel.setValue(key, policyValue);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (trigger) {\n\t\t\t\tthis._onDidChangeConfiguration.fire(this._configurationModel);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate parse(content: string): any {\n\t\tlet raw: any = {};\n\t\tlet currentProperty: string | null = null;\n\t\tlet currentParent: any = [];\n\t\tconst previousParents: any[] = [];\n\t\tconst parseErrors: json.ParseError[] = [];\n\n\t\tfunction onValue(value: any) {\n\t\t\tif (Array.isArray(currentParent)) {\n\t\t\t\t(<any[]>currentParent).push(value);\n\t\t\t} else if (currentProperty !== null) {\n\t\t\t\tif (currentParent[currentProperty] !== undefined) {\n\t\t\t\t\tthrow new Error(`Duplicate property found: ${currentProperty}`);\n\t\t\t\t}\n\t\t\t\tcurrentParent[currentProperty] = value;\n\t\t\t}\n\t\t}\n\n\t\tconst visitor: json.JSONVisitor = {\n\t\t\tonObjectBegin: () => {\n\t\t\t\tconst object = {};\n\t\t\t\tonValue(object);\n\t\t\t\tpreviousParents.push(currentParent);\n\t\t\t\tcurrentParent = object;\n\t\t\t\tcurrentProperty = null;\n\t\t\t},\n\t\t\tonObjectProperty: (name: string) => {\n\t\t\t\tcurrentProperty = name;\n\t\t\t},\n\t\t\tonObjectEnd: () => {\n\t\t\t\tcurrentParent = previousParents.pop();\n\t\t\t},\n\t\t\tonArrayBegin: () => {\n\t\t\t\tconst array: any[] = [];\n\t\t\t\tonValue(array);\n\t\t\t\tpreviousParents.push(currentParent);\n\t\t\t\tcurrentParent = array;\n\t\t\t\tcurrentProperty = null;\n\t\t\t},\n\t\t\tonArrayEnd: () => {\n\t\t\t\tcurrentParent = previousParents.pop();\n\t\t\t},\n\t\t\tonLiteralValue: onValue,\n\t\t\tonError: (error: json.ParseErrorCode, offset: number, length: number) => {\n\t\t\t\tparseErrors.push({ error, offset, length });\n\t\t\t}\n\t\t};\n\n\t\tif (content) {\n\t\t\tjson.visit(content, visitor);\n\t\t\traw = currentParent[0] || {};\n\t\t}\n\n\t\tif (parseErrors.length > 0) {\n\t\t\tthrow new Error(parseErrors.map(e => getErrorMessage(e.error)).join('\\n'));\n\t\t}\n\n\t\treturn raw;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { distinct, equals as arrayEquals } from '../../../base/common/arrays.js';\nimport { Queue, RunOnceScheduler } from '../../../base/common/async.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { JSONPath, ParseError, parse } from '../../../base/common/json.js';\nimport { applyEdits, setProperty } from '../../../base/common/jsonEdit.js';\nimport { Edit, FormattingOptions } from '../../../base/common/jsonFormatter.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { equals } from '../../../base/common/objects.js';\nimport { OS, OperatingSystem } from '../../../base/common/platform.js';\nimport { extUriBiasedIgnorePathCase } from '../../../base/common/resources.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { ConfigurationTarget, IConfigurationChange, IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IConfigurationService, IConfigurationUpdateOptions, IConfigurationUpdateOverrides, IConfigurationValue, isConfigurationOverrides, isConfigurationUpdateOverrides } from './configuration.js';\nimport { Configuration, ConfigurationChangeEvent, ConfigurationModel, UserSettings } from './configurationModels.js';\nimport { keyFromOverrideIdentifiers } from './configurationRegistry.js';\nimport { DefaultConfiguration, IPolicyConfiguration, NullPolicyConfiguration, PolicyConfiguration } from './configurations.js';\nimport { FileOperationError, FileOperationResult, IFileService } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IPolicyService, NullPolicyService } from '../../policy/common/policy.js';\n\nexport class ConfigurationService extends Disposable implements IConfigurationService, IDisposable {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate configuration: Configuration;\n\tprivate readonly defaultConfiguration: DefaultConfiguration;\n\tprivate readonly policyConfiguration: IPolicyConfiguration;\n\tprivate readonly userConfiguration: UserSettings;\n\tprivate readonly reloadConfigurationScheduler: RunOnceScheduler;\n\n\tprivate readonly _onDidChangeConfiguration: Emitter<IConfigurationChangeEvent> = this._register(new Emitter<IConfigurationChangeEvent>());\n\treadonly onDidChangeConfiguration: Event<IConfigurationChangeEvent> = this._onDidChangeConfiguration.event;\n\n\tprivate readonly configurationEditing: ConfigurationEditing;\n\n\tconstructor(\n\t\tprivate readonly settingsResource: URI,\n\t\tfileService: IFileService,\n\t\tpolicyService: IPolicyService,\n\t\tprivate readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis.defaultConfiguration = this._register(new DefaultConfiguration(logService));\n\t\tthis.policyConfiguration = policyService instanceof NullPolicyService ? new NullPolicyConfiguration() : this._register(new PolicyConfiguration(this.defaultConfiguration, policyService, logService));\n\t\tthis.userConfiguration = this._register(new UserSettings(this.settingsResource, {}, extUriBiasedIgnorePathCase, fileService, logService));\n\t\tthis.configuration = new Configuration(\n\t\t\tthis.defaultConfiguration.configurationModel,\n\t\t\tthis.policyConfiguration.configurationModel,\n\t\t\tConfigurationModel.createEmptyModel(logService),\n\t\t\tConfigurationModel.createEmptyModel(logService),\n\t\t\tConfigurationModel.createEmptyModel(logService),\n\t\t\tConfigurationModel.createEmptyModel(logService),\n\t\t\tnew ResourceMap<ConfigurationModel>(),\n\t\t\tConfigurationModel.createEmptyModel(logService),\n\t\t\tnew ResourceMap<ConfigurationModel>(),\n\t\t\tlogService\n\t\t);\n\t\tthis.configurationEditing = new ConfigurationEditing(settingsResource, fileService, this);\n\n\t\tthis.reloadConfigurationScheduler = this._register(new RunOnceScheduler(() => this.reloadConfiguration(), 50));\n\t\tthis._register(this.defaultConfiguration.onDidChangeConfiguration(({ defaults, properties }) => this.onDidDefaultConfigurationChange(defaults, properties)));\n\t\tthis._register(this.policyConfiguration.onDidChangeConfiguration(model => this.onDidPolicyConfigurationChange(model)));\n\t\tthis._register(this.userConfiguration.onDidChange(() => this.reloadConfigurationScheduler.schedule()));\n\t}\n\n\tasync initialize(): Promise<void> {\n\t\tconst [defaultModel, policyModel, userModel] = await Promise.all([this.defaultConfiguration.initialize(), this.policyConfiguration.initialize(), this.userConfiguration.loadConfiguration()]);\n\t\tthis.configuration = new Configuration(\n\t\t\tdefaultModel,\n\t\t\tpolicyModel,\n\t\t\tConfigurationModel.createEmptyModel(this.logService),\n\t\t\tuserModel,\n\t\t\tConfigurationModel.createEmptyModel(this.logService),\n\t\t\tConfigurationModel.createEmptyModel(this.logService),\n\t\t\tnew ResourceMap<ConfigurationModel>(),\n\t\t\tConfigurationModel.createEmptyModel(this.logService),\n\t\t\tnew ResourceMap<ConfigurationModel>(),\n\t\t\tthis.logService\n\t\t);\n\t}\n\n\tgetConfigurationData(): IConfigurationData {\n\t\treturn this.configuration.toData();\n\t}\n\n\tgetValue<T>(): T;\n\tgetValue<T>(section: string): T;\n\tgetValue<T>(overrides: IConfigurationOverrides): T;\n\tgetValue<T>(section: string, overrides: IConfigurationOverrides): T;\n\tgetValue(arg1?: any, arg2?: any): any {\n\t\tconst section = typeof arg1 === 'string' ? arg1 : undefined;\n\t\tconst overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};\n\t\treturn this.configuration.getValue(section, overrides, undefined);\n\t}\n\n\tupdateValue(key: string, value: any): Promise<void>;\n\tupdateValue(key: string, value: any, overrides: IConfigurationOverrides | IConfigurationUpdateOverrides): Promise<void>;\n\tupdateValue(key: string, value: any, target: ConfigurationTarget): Promise<void>;\n\tupdateValue(key: string, value: any, overrides: IConfigurationOverrides | IConfigurationUpdateOverrides, target: ConfigurationTarget, options?: IConfigurationUpdateOptions): Promise<void>;\n\tasync updateValue(key: string, value: any, arg3?: any, arg4?: any, options?: any): Promise<void> {\n\t\tconst overrides: IConfigurationUpdateOverrides | undefined = isConfigurationUpdateOverrides(arg3) ? arg3\n\t\t\t: isConfigurationOverrides(arg3) ? { resource: arg3.resource, overrideIdentifiers: arg3.overrideIdentifier ? [arg3.overrideIdentifier] : undefined } : undefined;\n\n\t\tconst target: ConfigurationTarget | undefined = overrides ? arg4 : arg3;\n\t\tif (target !== undefined) {\n\t\t\tif (target !== ConfigurationTarget.USER_LOCAL && target !== ConfigurationTarget.USER) {\n\t\t\t\tthrow new Error(`Unable to write ${key} to target ${target}.`);\n\t\t\t}\n\t\t}\n\n\t\tif (overrides?.overrideIdentifiers) {\n\t\t\toverrides.overrideIdentifiers = distinct(overrides.overrideIdentifiers);\n\t\t\toverrides.overrideIdentifiers = overrides.overrideIdentifiers.length ? overrides.overrideIdentifiers : undefined;\n\t\t}\n\n\t\tconst inspect = this.inspect(key, { resource: overrides?.resource, overrideIdentifier: overrides?.overrideIdentifiers ? overrides.overrideIdentifiers[0] : undefined });\n\t\tif (inspect.policyValue !== undefined) {\n\t\t\tthrow new Error(`Unable to write ${key} because it is configured in system policy.`);\n\t\t}\n\n\t\t// Remove the setting, if the value is same as default value\n\t\tif (equals(value, inspect.defaultValue)) {\n\t\t\tvalue = undefined;\n\t\t}\n\n\t\tif (overrides?.overrideIdentifiers?.length && overrides.overrideIdentifiers.length > 1) {\n\t\t\tconst overrideIdentifiers = overrides.overrideIdentifiers.sort();\n\t\t\tconst existingOverrides = this.configuration.localUserConfiguration.overrides.find(override => arrayEquals([...override.identifiers].sort(), overrideIdentifiers));\n\t\t\tif (existingOverrides) {\n\t\t\t\toverrides.overrideIdentifiers = existingOverrides.identifiers;\n\t\t\t}\n\t\t}\n\n\t\tconst path = overrides?.overrideIdentifiers?.length ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key];\n\n\t\tawait this.configurationEditing.write(path, value);\n\t\tawait this.reloadConfiguration();\n\t}\n\n\tinspect<T>(key: string, overrides: IConfigurationOverrides = {}): IConfigurationValue<T> {\n\t\treturn this.configuration.inspect<T>(key, overrides, undefined);\n\t}\n\n\tkeys(): {\n\t\tdefault: string[];\n\t\tuser: string[];\n\t\tworkspace: string[];\n\t\tworkspaceFolder: string[];\n\t} {\n\t\treturn this.configuration.keys(undefined);\n\t}\n\n\tasync reloadConfiguration(): Promise<void> {\n\t\tconst configurationModel = await this.userConfiguration.loadConfiguration();\n\t\tthis.onDidChangeUserConfiguration(configurationModel);\n\t}\n\n\tprivate onDidChangeUserConfiguration(userConfigurationModel: ConfigurationModel): void {\n\t\tconst previous = this.configuration.toData();\n\t\tconst change = this.configuration.compareAndUpdateLocalUserConfiguration(userConfigurationModel);\n\t\tthis.trigger(change, previous, ConfigurationTarget.USER);\n\t}\n\n\tprivate onDidDefaultConfigurationChange(defaultConfigurationModel: ConfigurationModel, properties: string[]): void {\n\t\tconst previous = this.configuration.toData();\n\t\tconst change = this.configuration.compareAndUpdateDefaultConfiguration(defaultConfigurationModel, properties);\n\t\tthis.trigger(change, previous, ConfigurationTarget.DEFAULT);\n\t}\n\n\tprivate onDidPolicyConfigurationChange(policyConfiguration: ConfigurationModel): void {\n\t\tconst previous = this.configuration.toData();\n\t\tconst change = this.configuration.compareAndUpdatePolicyConfiguration(policyConfiguration);\n\t\tthis.trigger(change, previous, ConfigurationTarget.DEFAULT);\n\t}\n\n\tprivate trigger(configurationChange: IConfigurationChange, previous: IConfigurationData, source: ConfigurationTarget): void {\n\t\tconst event = new ConfigurationChangeEvent(configurationChange, { data: previous }, this.configuration, undefined, this.logService);\n\t\tevent.source = source;\n\t\tthis._onDidChangeConfiguration.fire(event);\n\t}\n}\n\nclass ConfigurationEditing {\n\n\tprivate readonly queue: Queue<void>;\n\n\tconstructor(\n\t\tprivate readonly settingsResource: URI,\n\t\tprivate readonly fileService: IFileService,\n\t\tprivate readonly configurationService: IConfigurationService,\n\t) {\n\t\tthis.queue = new Queue<void>();\n\t}\n\n\twrite(path: JSONPath, value: any): Promise<void> {\n\t\treturn this.queue.queue(() => this.doWriteConfiguration(path, value)); // queue up writes to prevent race conditions\n\t}\n\n\tprivate async doWriteConfiguration(path: JSONPath, value: any): Promise<void> {\n\t\tlet content: string;\n\t\ttry {\n\t\t\tconst fileContent = await this.fileService.readFile(this.settingsResource);\n\t\t\tcontent = fileContent.value.toString();\n\t\t} catch (error) {\n\t\t\tif ((<FileOperationError>error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\tcontent = '{}';\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\tconst parseErrors: ParseError[] = [];\n\t\tparse(content, parseErrors, { allowTrailingComma: true, allowEmptyContent: true });\n\t\tif (parseErrors.length > 0) {\n\t\t\tthrow new Error('Unable to write into the settings file. Please open the file to correct errors/warnings in the file and try again.');\n\t\t}\n\n\t\tconst edits = this.getEdits(content, path, value);\n\t\tcontent = applyEdits(content, edits);\n\n\t\tawait this.fileService.writeFile(this.settingsResource, VSBuffer.fromString(content));\n\t}\n\n\tprivate getEdits(content: string, path: JSONPath, value: any): Edit[] {\n\t\tconst { tabSize, insertSpaces, eol } = this.formattingOptions;\n\n\t\t// With empty path the entire file is being replaced, so we just use JSON.stringify\n\t\tif (!path.length) {\n\t\t\tconst content = JSON.stringify(value, null, insertSpaces ? ' '.repeat(tabSize) : '\\t');\n\t\t\treturn [{\n\t\t\t\tcontent,\n\t\t\t\tlength: content.length,\n\t\t\t\toffset: 0\n\t\t\t}];\n\t\t}\n\n\t\treturn setProperty(content, path, value, { tabSize, insertSpaces, eol });\n\t}\n\n\tprivate _formattingOptions: Required<FormattingOptions> | undefined;\n\tprivate get formattingOptions(): Required<FormattingOptions> {\n\t\tif (!this._formattingOptions) {\n\t\t\tlet eol = OS === OperatingSystem.Linux || OS === OperatingSystem.Macintosh ? '\\n' : '\\r\\n';\n\t\t\tconst configuredEol = this.configurationService.getValue('files.eol', { overrideIdentifier: 'jsonc' });\n\t\t\tif (configuredEol && typeof configuredEol === 'string' && configuredEol !== 'auto') {\n\t\t\t\teol = configuredEol;\n\t\t\t}\n\t\t\tthis._formattingOptions = {\n\t\t\t\teol,\n\t\t\t\tinsertSpaces: !!this.configurationService.getValue('editor.insertSpaces', { overrideIdentifier: 'jsonc' }),\n\t\t\t\ttabSize: this.configurationService.getValue('editor.tabSize', { overrideIdentifier: 'jsonc' })\n\t\t\t};\n\t\t}\n\t\treturn this._formattingOptions;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { streamToBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { getErrorMessage } from '../../../base/common/errors.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { IHeaders, IRequestContext, IRequestOptions } from '../../../base/parts/request/common/request.js';\nimport { localize } from '../../../nls.js';\nimport { ConfigurationScope, Extensions, IConfigurationNode, IConfigurationRegistry } from '../../configuration/common/configurationRegistry.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { Registry } from '../../registry/common/platform.js';\n\nexport const IRequestService = createDecorator<IRequestService>('requestService');\n\nexport interface AuthInfo {\n\tisProxy: boolean;\n\tscheme: string;\n\thost: string;\n\tport: number;\n\trealm: string;\n\tattempt: number;\n}\n\nexport interface Credentials {\n\tusername: string;\n\tpassword: string;\n}\n\nexport interface IRequestService {\n\treadonly _serviceBrand: undefined;\n\n\trequest(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext>;\n\n\tresolveProxy(url: string): Promise<string | undefined>;\n\tlookupAuthorization(authInfo: AuthInfo): Promise<Credentials | undefined>;\n\tlookupKerberosAuthorization(url: string): Promise<string | undefined>;\n\tloadCertificates(): Promise<string[]>;\n}\n\nclass LoggableHeaders {\n\n\tprivate headers: IHeaders | undefined;\n\n\tconstructor(private readonly original: IHeaders) { }\n\n\ttoJSON(): any {\n\t\tif (!this.headers) {\n\t\t\tconst headers = Object.create(null);\n\t\t\tfor (const key in this.original) {\n\t\t\t\tif (key.toLowerCase() === 'authorization' || key.toLowerCase() === 'proxy-authorization') {\n\t\t\t\t\theaders[key] = '*****';\n\t\t\t\t} else {\n\t\t\t\t\theaders[key] = this.original[key];\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.headers = headers;\n\t\t}\n\t\treturn this.headers;\n\t}\n\n}\n\nexport abstract class AbstractRequestService extends Disposable implements IRequestService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate counter = 0;\n\n\tconstructor(protected readonly logService: ILogService) {\n\t\tsuper();\n\t}\n\n\tprotected async logAndRequest(options: IRequestOptions, request: () => Promise<IRequestContext>): Promise<IRequestContext> {\n\t\tconst prefix = `#${++this.counter}: ${options.url}`;\n\t\tthis.logService.trace(`${prefix} - begin`, options.type, new LoggableHeaders(options.headers ?? {}));\n\t\ttry {\n\t\t\tconst result = await request();\n\t\t\tthis.logService.trace(`${prefix} - end`, options.type, result.res.statusCode, result.res.headers);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthis.logService.error(`${prefix} - error`, options.type, getErrorMessage(error));\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tabstract request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext>;\n\tabstract resolveProxy(url: string): Promise<string | undefined>;\n\tabstract lookupAuthorization(authInfo: AuthInfo): Promise<Credentials | undefined>;\n\tabstract lookupKerberosAuthorization(url: string): Promise<string | undefined>;\n\tabstract loadCertificates(): Promise<string[]>;\n}\n\nexport function isSuccess(context: IRequestContext): boolean {\n\treturn (context.res.statusCode && context.res.statusCode >= 200 && context.res.statusCode < 300) || context.res.statusCode === 1223;\n}\n\nexport function hasNoContent(context: IRequestContext): boolean {\n\treturn context.res.statusCode === 204;\n}\n\nexport async function asText(context: IRequestContext): Promise<string | null> {\n\tif (hasNoContent(context)) {\n\t\treturn null;\n\t}\n\tconst buffer = await streamToBuffer(context.stream);\n\treturn buffer.toString();\n}\n\nexport async function asTextOrError(context: IRequestContext): Promise<string | null> {\n\tif (!isSuccess(context)) {\n\t\tthrow new Error('Server returned ' + context.res.statusCode);\n\t}\n\treturn asText(context);\n}\n\nexport async function asJson<T = {}>(context: IRequestContext): Promise<T | null> {\n\tif (!isSuccess(context)) {\n\t\tthrow new Error('Server returned ' + context.res.statusCode);\n\t}\n\tif (hasNoContent(context)) {\n\t\treturn null;\n\t}\n\tconst buffer = await streamToBuffer(context.stream);\n\tconst str = buffer.toString();\n\ttry {\n\t\treturn JSON.parse(str);\n\t} catch (err) {\n\t\terr.message += ':\\n' + str;\n\t\tthrow err;\n\t}\n}\n\nexport function updateProxyConfigurationsScope(useHostProxy: boolean, useHostProxyDefault: boolean): void {\n\tregisterProxyConfigurations(useHostProxy, useHostProxyDefault);\n}\n\nexport const USER_LOCAL_AND_REMOTE_SETTINGS = [\n\t'http.proxy',\n\t'http.proxyStrictSSL',\n\t'http.proxyKerberosServicePrincipal',\n\t'http.noProxy',\n\t'http.proxyAuthorization',\n\t'http.proxySupport',\n\t'http.systemCertificates',\n\t'http.experimental.systemCertificatesV2',\n\t'http.fetchAdditionalSupport',\n];\n\nlet proxyConfiguration: IConfigurationNode[] = [];\nlet previousUseHostProxy: boolean | undefined = undefined;\nlet previousUseHostProxyDefault: boolean | undefined = undefined;\nfunction registerProxyConfigurations(useHostProxy = true, useHostProxyDefault = true): void {\n\tif (previousUseHostProxy === useHostProxy && previousUseHostProxyDefault === useHostProxyDefault) {\n\t\treturn;\n\t}\n\n\tpreviousUseHostProxy = useHostProxy;\n\tpreviousUseHostProxyDefault = useHostProxyDefault;\n\n\tconst configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);\n\tconst oldProxyConfiguration = proxyConfiguration;\n\tproxyConfiguration = [\n\t\t{\n\t\t\tid: 'http',\n\t\t\torder: 15,\n\t\t\ttitle: localize('httpConfigurationTitle', \"HTTP\"),\n\t\t\ttype: 'object',\n\t\t\tscope: ConfigurationScope.MACHINE,\n\t\t\tproperties: {\n\t\t\t\t'http.useLocalProxyConfiguration': {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: useHostProxyDefault,\n\t\t\t\t\tmarkdownDescription: localize('useLocalProxy', \"Controls whether in the remote extension host the local proxy configuration should be used. This setting only applies as a remote setting during [remote development](https://aka.ms/vscode-remote).\"),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tid: 'http',\n\t\t\torder: 15,\n\t\t\ttitle: localize('httpConfigurationTitle', \"HTTP\"),\n\t\t\ttype: 'object',\n\t\t\tscope: ConfigurationScope.APPLICATION,\n\t\t\tproperties: {\n\t\t\t\t'http.electronFetch': {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: false,\n\t\t\t\t\tdescription: localize('electronFetch', \"Controls whether use of Electron's fetch implementation instead of Node.js' should be enabled. All local extensions will get Electron's fetch implementation for the global fetch API.\"),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tid: 'http',\n\t\t\torder: 15,\n\t\t\ttitle: localize('httpConfigurationTitle', \"HTTP\"),\n\t\t\ttype: 'object',\n\t\t\tscope: useHostProxy ? ConfigurationScope.APPLICATION : ConfigurationScope.MACHINE,\n\t\t\tproperties: {\n\t\t\t\t'http.proxy': {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tpattern: '^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\\\[[:0-9a-fA-F]+\\\\])(:\\\\d+)?/?$|^$',\n\t\t\t\t\tmarkdownDescription: localize('proxy', \"The proxy setting to use. If not set, will be inherited from the `http_proxy` and `https_proxy` environment variables. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t\t'http.proxyStrictSSL': {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: true,\n\t\t\t\t\tmarkdownDescription: localize('strictSSL', \"Controls whether the proxy server certificate should be verified against the list of supplied CAs. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t\t'http.proxyKerberosServicePrincipal': {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tmarkdownDescription: localize('proxyKerberosServicePrincipal', \"Overrides the principal service name for Kerberos authentication with the HTTP proxy. A default based on the proxy hostname is used when this is not set. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t\t'http.noProxy': {\n\t\t\t\t\ttype: 'array',\n\t\t\t\t\titems: { type: 'string' },\n\t\t\t\t\tmarkdownDescription: localize('noProxy', \"Specifies domain names for which proxy settings should be ignored for HTTP/HTTPS requests. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t\t'http.proxyAuthorization': {\n\t\t\t\t\ttype: ['null', 'string'],\n\t\t\t\t\tdefault: null,\n\t\t\t\t\tmarkdownDescription: localize('proxyAuthorization', \"The value to send as the `Proxy-Authorization` header for every network request. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t\t'http.proxySupport': {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tenum: ['off', 'on', 'fallback', 'override'],\n\t\t\t\t\tenumDescriptions: [\n\t\t\t\t\t\tlocalize('proxySupportOff', \"Disable proxy support for extensions.\"),\n\t\t\t\t\t\tlocalize('proxySupportOn', \"Enable proxy support for extensions.\"),\n\t\t\t\t\t\tlocalize('proxySupportFallback', \"Enable proxy support for extensions, fall back to request options, when no proxy found.\"),\n\t\t\t\t\t\tlocalize('proxySupportOverride', \"Enable proxy support for extensions, override request options.\"),\n\t\t\t\t\t],\n\t\t\t\t\tdefault: 'override',\n\t\t\t\t\tmarkdownDescription: localize('proxySupport', \"Use the proxy support for extensions. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t\t'http.systemCertificates': {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: true,\n\t\t\t\t\tmarkdownDescription: localize('systemCertificates', \"Controls whether CA certificates should be loaded from the OS. On Windows and macOS, a reload of the window is required after turning this off. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t\t'http.experimental.systemCertificatesV2': {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\ttags: ['experimental'],\n\t\t\t\t\tdefault: false,\n\t\t\t\t\tmarkdownDescription: localize('systemCertificatesV2', \"Controls whether experimental loading of CA certificates from the OS should be enabled. This uses a more general approach than the default implementation. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t},\n\t\t\t\t'http.fetchAdditionalSupport': {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: true,\n\t\t\t\t\tmarkdownDescription: localize('fetchAdditionalSupport', \"Controls whether Node.js' fetch implementation should be extended with additional support. Currently proxy support ({1}) and system certificates ({2}) are added when the corresponding settings are enabled. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.\", '`#http.useLocalProxyConfiguration#`', '`#http.proxySupport#`', '`#http.systemCertificates#`'),\n\t\t\t\t\trestricted: true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t];\n\tconfigurationRegistry.updateConfigurations({ add: proxyConfiguration, remove: oldProxyConfiguration });\n}\n\nregisterProxyConfigurations();\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { URI } from '../../../base/common/uri.js';\nimport { NativeParsedArgs } from './argv.js';\nimport { createDecorator, refineServiceDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');\nexport const INativeEnvironmentService = refineServiceDecorator<IEnvironmentService, INativeEnvironmentService>(IEnvironmentService);\n\nexport interface IDebugParams {\n\tport: number | null;\n\tbreak: boolean;\n}\n\nexport interface IExtensionHostDebugParams extends IDebugParams {\n\tdebugId?: string;\n\tenv?: Record<string, string>;\n}\n\n/**\n * Type of extension.\n *\n * **NOTE**: This is defined in `platform/environment` because it can appear as a CLI argument.\n */\nexport type ExtensionKind = 'ui' | 'workspace' | 'web';\n\n/**\n * A basic environment service that can be used in various processes,\n * such as main, renderer and shared process. Use subclasses of this\n * service for specific environment.\n */\nexport interface IEnvironmentService {\n\n\treadonly _serviceBrand: undefined;\n\n\t// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t//\n\t// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.\n\t//\n\t// AS SUCH:\n\t//   - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE\n\t//   - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE\n\t//   - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE\n\t//\n\t// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\t// --- user roaming data\n\tstateResource: URI;\n\tuserRoamingDataHome: URI;\n\tkeyboardLayoutResource: URI;\n\targvResource: URI;\n\n\t// --- data paths\n\tuntitledWorkspacesHome: URI;\n\tworkspaceStorageHome: URI;\n\tlocalHistoryHome: URI;\n\tcacheHome: URI;\n\n\t// --- settings sync\n\tuserDataSyncHome: URI;\n\tsync: 'on' | 'off' | undefined;\n\n\t// --- continue edit session\n\tcontinueOn?: string;\n\teditSessionId?: string;\n\n\t// --- extension development\n\tdebugExtensionHost: IExtensionHostDebugParams;\n\tisExtensionDevelopment: boolean;\n\tdisableExtensions: boolean | string[];\n\tenableExtensions?: readonly string[];\n\textensionDevelopmentLocationURI?: URI[];\n\textensionDevelopmentKind?: ExtensionKind[];\n\textensionTestsLocationURI?: URI;\n\n\t// --- logging\n\tlogsHome: URI;\n\tlogLevel?: string;\n\textensionLogLevel?: [string, string][];\n\tverbose: boolean;\n\tisBuilt: boolean;\n\n\t// --- telemetry\n\tdisableTelemetry: boolean;\n\tserviceMachineIdResource: URI;\n\n\t// --- Policy\n\tpolicyFile?: URI;\n\n\t// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t//\n\t// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.\n\t//\n\t// AS SUCH:\n\t//   - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE\n\t//   - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE\n\t//   - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE\n\t//\n\t// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n}\n\n/**\n * A subclass of the `IEnvironmentService` to be used only in native\n * environments (Windows, Linux, macOS) but not e.g. web.\n */\nexport interface INativeEnvironmentService extends IEnvironmentService {\n\n\t// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t//\n\t// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.\n\t//\n\t// AS SUCH:\n\t//   - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE\n\t//   - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE\n\t//\n\t// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\t// --- CLI Arguments\n\targs: NativeParsedArgs;\n\n\t// --- data paths\n\t/**\n\t * Root path of the JavaScript sources.\n\t *\n\t * Note: This is NOT the installation root\n\t * directory itself but contained in it at\n\t * a level that is platform dependent.\n\t */\n\tappRoot: string;\n\tuserHome: URI;\n\tappSettingsHome: URI;\n\ttmpDir: URI;\n\tuserDataPath: string;\n\n\t// --- extensions\n\textensionsPath: string;\n\textensionsDownloadLocation: URI;\n\tbuiltinExtensionsPath: string;\n\n\t// --- use in-memory Secret Storage\n\tuseInMemorySecretStorage?: boolean;\n\n\tcrossOriginIsolated?: boolean;\n\n\t// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t//\n\t// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.\n\t//\n\t// AS SUCH:\n\t//   - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE\n\t//   - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE\n\t//   - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE\n\t//\n\t// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n\nconst _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport function isUUID(value: string): boolean {\n\treturn _UUIDPattern.test(value);\n}\n\nexport const generateUuid = (function (): () => string {\n\n\t// use `randomUUID` if possible\n\tif (typeof crypto.randomUUID === 'function') {\n\t\t// see https://developer.mozilla.org/en-US/docs/Web/API/Window/crypto\n\t\t// > Although crypto is available on all windows, the returned Crypto object only has one\n\t\t// > usable feature in insecure contexts: the getRandomValues() method.\n\t\t// > In general, you should use this API only in secure contexts.\n\n\t\treturn crypto.randomUUID.bind(crypto);\n\t}\n\n\t// prep-work\n\tconst _data = new Uint8Array(16);\n\tconst _hex: string[] = [];\n\tfor (let i = 0; i < 256; i++) {\n\t\t_hex.push(i.toString(16).padStart(2, '0'));\n\t}\n\n\treturn function generateUuid(): string {\n\t\t// get data\n\t\tcrypto.getRandomValues(_data);\n\n\t\t// set version bits\n\t\t_data[6] = (_data[6] & 0x0f) | 0x40;\n\t\t_data[8] = (_data[8] & 0x3f) | 0x80;\n\n\t\t// print as string\n\t\tlet i = 0;\n\t\tlet result = '';\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += '-';\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += '-';\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += '-';\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += '-';\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\tresult += _hex[_data[i++]];\n\t\treturn result;\n\t};\n})();\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as os from 'os';\nimport * as path from '../common/path.js';\nimport * as pfs from './pfs.js';\n\n// This is required, since parseInt(\"7-preview\") will return 7.\nconst IntRegex: RegExp = /^\\d+$/;\n\nconst PwshMsixRegex: RegExp = /^Microsoft.PowerShell_.*/;\nconst PwshPreviewMsixRegex: RegExp = /^Microsoft.PowerShellPreview_.*/;\n\nconst enum Arch {\n\tx64,\n\tx86,\n\tARM\n}\n\nlet processArch: Arch;\nswitch (process.arch) {\n\tcase 'ia32':\n\t\tprocessArch = Arch.x86;\n\t\tbreak;\n\tcase 'arm':\n\tcase 'arm64':\n\t\tprocessArch = Arch.ARM;\n\t\tbreak;\n\tdefault:\n\t\tprocessArch = Arch.x64;\n\t\tbreak;\n}\n\n/*\nCurrently, here are the values for these environment variables on their respective archs:\n\nOn x86 process on x86:\nPROCESSOR_ARCHITECTURE is X86\nPROCESSOR_ARCHITEW6432 is undefined\n\nOn x86 process on x64:\nPROCESSOR_ARCHITECTURE is X86\nPROCESSOR_ARCHITEW6432 is AMD64\n\nOn x64 process on x64:\nPROCESSOR_ARCHITECTURE is AMD64\nPROCESSOR_ARCHITEW6432 is undefined\n\nOn ARM process on ARM:\nPROCESSOR_ARCHITECTURE is ARM64\nPROCESSOR_ARCHITEW6432 is undefined\n\nOn x86 process on ARM:\nPROCESSOR_ARCHITECTURE is X86\nPROCESSOR_ARCHITEW6432 is ARM64\n\nOn x64 process on ARM:\nPROCESSOR_ARCHITECTURE is ARM64\nPROCESSOR_ARCHITEW6432 is undefined\n*/\nlet osArch: Arch;\nif (process.env['PROCESSOR_ARCHITEW6432']) {\n\tosArch = process.env['PROCESSOR_ARCHITEW6432'] === 'ARM64'\n\t\t? Arch.ARM\n\t\t: Arch.x64;\n} else if (process.env['PROCESSOR_ARCHITECTURE'] === 'ARM64') {\n\tosArch = Arch.ARM;\n} else if (process.env['PROCESSOR_ARCHITECTURE'] === 'X86') {\n\tosArch = Arch.x86;\n} else {\n\tosArch = Arch.x64;\n}\n\nexport interface IPowerShellExeDetails {\n\treadonly displayName: string;\n\treadonly exePath: string;\n}\n\ninterface IPossiblePowerShellExe extends IPowerShellExeDetails {\n\texists(): Promise<boolean>;\n}\n\nclass PossiblePowerShellExe implements IPossiblePowerShellExe {\n\tconstructor(\n\t\tpublic readonly exePath: string,\n\t\tpublic readonly displayName: string,\n\t\tprivate knownToExist?: boolean) { }\n\n\tpublic async exists(): Promise<boolean> {\n\t\tif (this.knownToExist === undefined) {\n\t\t\tthis.knownToExist = await pfs.SymlinkSupport.existsFile(this.exePath);\n\t\t}\n\t\treturn this.knownToExist;\n\t}\n}\n\nfunction getProgramFilesPath(\n\t{ useAlternateBitness = false }: { useAlternateBitness?: boolean } = {}): string | null {\n\n\tif (!useAlternateBitness) {\n\t\t// Just use the native system bitness\n\t\treturn process.env.ProgramFiles || null;\n\t}\n\n\t// We might be a 64-bit process looking for 32-bit program files\n\tif (processArch === Arch.x64) {\n\t\treturn process.env['ProgramFiles(x86)'] || null;\n\t}\n\n\t// We might be a 32-bit process looking for 64-bit program files\n\tif (osArch === Arch.x64) {\n\t\treturn process.env.ProgramW6432 || null;\n\t}\n\n\t// We're a 32-bit process on 32-bit Windows, there is no other Program Files dir\n\treturn null;\n}\n\nasync function findPSCoreWindowsInstallation(\n\t{ useAlternateBitness = false, findPreview = false }:\n\t\t{ useAlternateBitness?: boolean; findPreview?: boolean } = {}): Promise<IPossiblePowerShellExe | null> {\n\n\tconst programFilesPath = getProgramFilesPath({ useAlternateBitness });\n\tif (!programFilesPath) {\n\t\treturn null;\n\t}\n\n\tconst powerShellInstallBaseDir = path.join(programFilesPath, 'PowerShell');\n\n\t// Ensure the base directory exists\n\tif (!await pfs.SymlinkSupport.existsDirectory(powerShellInstallBaseDir)) {\n\t\treturn null;\n\t}\n\n\tlet highestSeenVersion: number = -1;\n\tlet pwshExePath: string | null = null;\n\tfor (const item of await pfs.Promises.readdir(powerShellInstallBaseDir)) {\n\n\t\tlet currentVersion: number = -1;\n\t\tif (findPreview) {\n\t\t\t// We are looking for something like \"7-preview\"\n\n\t\t\t// Preview dirs all have dashes in them\n\t\t\tconst dashIndex = item.indexOf('-');\n\t\t\tif (dashIndex < 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Verify that the part before the dash is an integer\n\t\t\t// and that the part after the dash is \"preview\"\n\t\t\tconst intPart: string = item.substring(0, dashIndex);\n\t\t\tif (!IntRegex.test(intPart) || item.substring(dashIndex + 1) !== 'preview') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcurrentVersion = parseInt(intPart, 10);\n\t\t} else {\n\t\t\t// Search for a directory like \"6\" or \"7\"\n\t\t\tif (!IntRegex.test(item)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcurrentVersion = parseInt(item, 10);\n\t\t}\n\n\t\t// Ensure we haven't already seen a higher version\n\t\tif (currentVersion <= highestSeenVersion) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Now look for the file\n\t\tconst exePath = path.join(powerShellInstallBaseDir, item, 'pwsh.exe');\n\t\tif (!await pfs.SymlinkSupport.existsFile(exePath)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tpwshExePath = exePath;\n\t\thighestSeenVersion = currentVersion;\n\t}\n\n\tif (!pwshExePath) {\n\t\treturn null;\n\t}\n\n\tconst bitness: string = programFilesPath.includes('x86') ? ' (x86)' : '';\n\tconst preview: string = findPreview ? ' Preview' : '';\n\n\treturn new PossiblePowerShellExe(pwshExePath, `PowerShell${preview}${bitness}`, true);\n}\n\nasync function findPSCoreMsix({ findPreview }: { findPreview?: boolean } = {}): Promise<IPossiblePowerShellExe | null> {\n\t// We can't proceed if there's no LOCALAPPDATA path\n\tif (!process.env.LOCALAPPDATA) {\n\t\treturn null;\n\t}\n\n\t// Find the base directory for MSIX application exe shortcuts\n\tconst msixAppDir = path.join(process.env.LOCALAPPDATA, 'Microsoft', 'WindowsApps');\n\n\tif (!await pfs.SymlinkSupport.existsDirectory(msixAppDir)) {\n\t\treturn null;\n\t}\n\n\t// Define whether we're looking for the preview or the stable\n\tconst { pwshMsixDirRegex, pwshMsixName } = findPreview\n\t\t? { pwshMsixDirRegex: PwshPreviewMsixRegex, pwshMsixName: 'PowerShell Preview (Store)' }\n\t\t: { pwshMsixDirRegex: PwshMsixRegex, pwshMsixName: 'PowerShell (Store)' };\n\n\t// We should find only one such application, so return on the first one\n\tfor (const subdir of await pfs.Promises.readdir(msixAppDir)) {\n\t\tif (pwshMsixDirRegex.test(subdir)) {\n\t\t\tconst pwshMsixPath = path.join(msixAppDir, subdir, 'pwsh.exe');\n\t\t\treturn new PossiblePowerShellExe(pwshMsixPath, pwshMsixName);\n\t\t}\n\t}\n\n\t// If we find nothing, return null\n\treturn null;\n}\n\nfunction findPSCoreDotnetGlobalTool(): IPossiblePowerShellExe {\n\tconst dotnetGlobalToolExePath: string = path.join(os.homedir(), '.dotnet', 'tools', 'pwsh.exe');\n\n\treturn new PossiblePowerShellExe(dotnetGlobalToolExePath, '.NET Core PowerShell Global Tool');\n}\n\nfunction findPSCoreScoopInstallation(): IPossiblePowerShellExe {\n\tconst scoopAppsDir = path.join(os.homedir(), 'scoop', 'apps');\n\tconst scoopPwsh = path.join(scoopAppsDir, 'pwsh', 'current', 'pwsh.exe');\n\n\treturn new PossiblePowerShellExe(scoopPwsh, 'PowerShell (Scoop)');\n}\n\nfunction findWinPS(): IPossiblePowerShellExe | null {\n\tconst winPSPath = path.join(\n\t\tprocess.env.windir!,\n\t\tprocessArch === Arch.x86 && osArch !== Arch.x86 ? 'SysNative' : 'System32',\n\t\t'WindowsPowerShell', 'v1.0', 'powershell.exe');\n\n\treturn new PossiblePowerShellExe(winPSPath, 'Windows PowerShell', true);\n}\n\n/**\n * Iterates through all the possible well-known PowerShell installations on a machine.\n * Returned values may not exist, but come with an .exists property\n * which will check whether the executable exists.\n */\nasync function* enumerateDefaultPowerShellInstallations(): AsyncIterable<IPossiblePowerShellExe> {\n\t// Find PSCore stable first\n\tlet pwshExe = await findPSCoreWindowsInstallation();\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n\n\t// Windows may have a 32-bit pwsh.exe\n\tpwshExe = await findPSCoreWindowsInstallation({ useAlternateBitness: true });\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n\n\t// Also look for the MSIX/UWP installation\n\tpwshExe = await findPSCoreMsix();\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n\n\t// Look for the .NET global tool\n\t// Some older versions of PowerShell have a bug in this where startup will fail,\n\t// but this is fixed in newer versions\n\tpwshExe = findPSCoreDotnetGlobalTool();\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n\n\t// Look for PSCore preview\n\tpwshExe = await findPSCoreWindowsInstallation({ findPreview: true });\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n\n\t// Find a preview MSIX\n\tpwshExe = await findPSCoreMsix({ findPreview: true });\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n\n\t// Look for pwsh-preview with the opposite bitness\n\tpwshExe = await findPSCoreWindowsInstallation({ useAlternateBitness: true, findPreview: true });\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n\n\tpwshExe = await findPSCoreScoopInstallation();\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n\n\t// Finally, get Windows PowerShell\n\tpwshExe = findWinPS();\n\tif (pwshExe) {\n\t\tyield pwshExe;\n\t}\n}\n\n/**\n * Iterates through PowerShell installations on the machine according\n * to configuration passed in through the constructor.\n * PowerShell items returned by this object are verified\n * to exist on the filesystem.\n */\nexport async function* enumeratePowerShellInstallations(): AsyncIterable<IPowerShellExeDetails> {\n\t// Get the default PowerShell installations first\n\tfor await (const defaultPwsh of enumerateDefaultPowerShellInstallations()) {\n\t\tif (await defaultPwsh.exists()) {\n\t\t\tyield defaultPwsh;\n\t\t}\n\t}\n}\n\n/**\n* Returns the first available PowerShell executable found in the search order.\n*/\nexport async function getFirstAvailablePowerShellInstallation(): Promise<IPowerShellExeDetails | null> {\n\tfor await (const pwsh of enumeratePowerShellInstallations()) {\n\t\treturn pwsh;\n\t}\n\treturn null;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IProcessEnvironment, isLinux } from './platform.js';\n\n/**\n * Options to be passed to the external program or shell.\n */\nexport interface CommandOptions {\n\t/**\n\t * The current working directory of the executed program or shell.\n\t * If omitted VSCode's current workspace root is used.\n\t */\n\tcwd?: string;\n\n\t/**\n\t * The environment of the executed program or shell. If omitted\n\t * the parent process' environment is used.\n\t */\n\tenv?: { [key: string]: string };\n}\n\nexport interface Executable {\n\t/**\n\t * The command to be executed. Can be an external program or a shell\n\t * command.\n\t */\n\tcommand: string;\n\n\t/**\n\t * Specifies whether the command is a shell command and therefore must\n\t * be executed in a shell interpreter (e.g. cmd.exe, bash, ...).\n\t */\n\tisShellCommand: boolean;\n\n\t/**\n\t * The arguments passed to the command.\n\t */\n\targs: string[];\n\n\t/**\n\t * The command options used when the command is executed. Can be omitted.\n\t */\n\toptions?: CommandOptions;\n}\n\nexport interface ForkOptions extends CommandOptions {\n\texecArgv?: string[];\n}\n\nexport const enum Source {\n\tstdout,\n\tstderr\n}\n\n/**\n * The data send via a success callback\n */\nexport interface SuccessData {\n\terror?: Error;\n\tcmdCode?: number;\n\tterminated?: boolean;\n}\n\n/**\n * The data send via a error callback\n */\nexport interface ErrorData {\n\terror?: Error;\n\tterminated?: boolean;\n\tstdout?: string;\n\tstderr?: string;\n}\n\nexport interface TerminateResponse {\n\tsuccess: boolean;\n\tcode?: TerminateResponseCode;\n\terror?: any;\n}\n\nexport const enum TerminateResponseCode {\n\tSuccess = 0,\n\tUnknown = 1,\n\tAccessDenied = 2,\n\tProcessNotFound = 3,\n}\n\nexport interface ProcessItem {\n\tname: string;\n\tcmd: string;\n\tpid: number;\n\tppid: number;\n\tload: number;\n\tmem: number;\n\n\tchildren?: ProcessItem[];\n}\n\n/**\n * Sanitizes a VS Code process environment by removing all Electron/VS Code-related values.\n */\nexport function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve: string[]): void {\n\tconst set = preserve.reduce<Record<string, boolean>>((set, key) => {\n\t\tset[key] = true;\n\t\treturn set;\n\t}, {});\n\tconst keysToRemove = [\n\t\t/^ELECTRON_.+$/,\n\t\t/^VSCODE_(?!(PORTABLE|SHELL_LOGIN|ENV_REPLACE|ENV_APPEND|ENV_PREPEND)).+$/,\n\t\t/^SNAP(|_.*)$/,\n\t\t/^GDK_PIXBUF_.+$/,\n\t\t/^CODE_SERVER_.+$/,\n\t\t/^CS_.+$/,\n\t];\n\tconst envKeys = Object.keys(env);\n\tenvKeys\n\t\t.filter(key => !set[key])\n\t\t.forEach(envKey => {\n\t\t\tfor (let i = 0; i < keysToRemove.length; i++) {\n\t\t\t\tif (envKey.search(keysToRemove[i]) !== -1) {\n\t\t\t\t\tdelete env[envKey];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}\n\n/**\n * Remove dangerous environment variables that have caused crashes\n * in forked processes (i.e. in ELECTRON_RUN_AS_NODE processes)\n *\n * @param env The env object to change\n */\nexport function removeDangerousEnvVariables(env: IProcessEnvironment | undefined): void {\n\tif (!env) {\n\t\treturn;\n\t}\n\n\t// Unset `DEBUG`, as an invalid value might lead to process crashes\n\t// See https://github.com/microsoft/vscode/issues/130072\n\tdelete env['DEBUG'];\n\n\tif (isLinux) {\n\t\t// Unset `LD_PRELOAD`, as it might lead to process crashes\n\t\t// See https://github.com/microsoft/vscode/issues/134177\n\t\tdelete env['LD_PRELOAD'];\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as cp from 'child_process';\nimport { Stats, promises } from 'fs';\nimport { getCaseInsensitive } from '../common/objects.js';\nimport * as path from '../common/path.js';\nimport * as Platform from '../common/platform.js';\nimport * as processCommon from '../common/process.js';\nimport { CommandOptions, ForkOptions, Source, SuccessData, TerminateResponse, TerminateResponseCode } from '../common/processes.js';\nimport * as Types from '../common/types.js';\nimport * as pfs from './pfs.js';\nimport { FileAccess } from '../common/network.js';\nimport Stream from 'stream';\nexport { Source, TerminateResponseCode, type CommandOptions, type ForkOptions, type SuccessData, type TerminateResponse };\n\nexport type ValueCallback<T> = (value: T | Promise<T>) => void;\nexport type ErrorCallback = (error?: any) => void;\nexport type ProgressCallback<T> = (progress: T) => void;\n\n\nexport function getWindowsShell(env = processCommon.env as Platform.IProcessEnvironment): string {\n\treturn env['comspec'] || 'cmd.exe';\n}\n\nexport interface IQueuedSender {\n\tsend: (msg: any) => void;\n}\n\n// Wrapper around process.send() that will queue any messages if the internal node.js\n// queue is filled with messages and only continue sending messages when the internal\n// queue is free again to consume messages.\n// On Windows we always wait for the send() method to return before sending the next message\n// to workaround https://github.com/nodejs/node/issues/7657 (IPC can freeze process)\nexport function createQueuedSender(childProcess: cp.ChildProcess): IQueuedSender {\n\tlet msgQueue: string[] = [];\n\tlet useQueue = false;\n\n\tconst send = function (msg: any): void {\n\t\tif (useQueue) {\n\t\t\tmsgQueue.push(msg); // add to the queue if the process cannot handle more messages\n\t\t\treturn;\n\t\t}\n\n\t\tconst result = childProcess.send(msg, (error: Error | null) => {\n\t\t\tif (error) {\n\t\t\t\tconsole.error(error); // unlikely to happen, best we can do is log this error\n\t\t\t}\n\n\t\t\tuseQueue = false; // we are good again to send directly without queue\n\n\t\t\t// now send all the messages that we have in our queue and did not send yet\n\t\t\tif (msgQueue.length > 0) {\n\t\t\t\tconst msgQueueCopy = msgQueue.slice(0);\n\t\t\t\tmsgQueue = [];\n\t\t\t\tmsgQueueCopy.forEach(entry => send(entry));\n\t\t\t}\n\t\t});\n\n\t\tif (!result || Platform.isWindows /* workaround https://github.com/nodejs/node/issues/7657 */) {\n\t\t\tuseQueue = true;\n\t\t}\n\t};\n\n\treturn { send };\n}\n\nasync function fileExistsDefault(path: string): Promise<boolean> {\n\tif (await pfs.Promises.exists(path)) {\n\t\tlet statValue: Stats | undefined;\n\t\ttry {\n\t\t\tstatValue = await promises.stat(path);\n\t\t} catch (e) {\n\t\t\tif (e.message.startsWith('EACCES')) {\n\t\t\t\t// it might be symlink\n\t\t\t\tstatValue = await promises.lstat(path);\n\t\t\t}\n\t\t}\n\t\treturn statValue ? !statValue.isDirectory() : false;\n\t}\n\treturn false;\n}\n\nexport async function findExecutable(command: string, cwd?: string, paths?: string[], env: Platform.IProcessEnvironment = processCommon.env as Platform.IProcessEnvironment, fileExists: (path: string) => Promise<boolean> = fileExistsDefault): Promise<string | undefined> {\n\t// If we have an absolute path then we take it.\n\tif (path.isAbsolute(command)) {\n\t\treturn await fileExists(command) ? command : undefined;\n\t}\n\tif (cwd === undefined) {\n\t\tcwd = processCommon.cwd();\n\t}\n\tconst dir = path.dirname(command);\n\tif (dir !== '.') {\n\t\t// We have a directory and the directory is relative (see above). Make the path absolute\n\t\t// to the current working directory.\n\t\tconst fullPath = path.join(cwd, command);\n\t\treturn await fileExists(fullPath) ? fullPath : undefined;\n\t}\n\tconst envPath = getCaseInsensitive(env, 'PATH');\n\tif (paths === undefined && Types.isString(envPath)) {\n\t\tpaths = envPath.split(path.delimiter);\n\t}\n\t// No PATH environment. Make path absolute to the cwd.\n\tif (paths === undefined || paths.length === 0) {\n\t\tconst fullPath = path.join(cwd, command);\n\t\treturn await fileExists(fullPath) ? fullPath : undefined;\n\t}\n\n\t// We have a simple file name. We get the path variable from the env\n\t// and try to find the executable on the path.\n\tfor (const pathEntry of paths) {\n\t\t// The path entry is absolute.\n\t\tlet fullPath: string;\n\t\tif (path.isAbsolute(pathEntry)) {\n\t\t\tfullPath = path.join(pathEntry, command);\n\t\t} else {\n\t\t\tfullPath = path.join(cwd, pathEntry, command);\n\t\t}\n\t\tif (Platform.isWindows) {\n\t\t\tconst pathExt = getCaseInsensitive(env, 'PATHEXT') as string || '.COM;.EXE;.BAT;.CMD';\n\t\t\tconst pathExtsFound = pathExt.split(';').map(async ext => {\n\t\t\t\tconst withExtension = fullPath + ext;\n\t\t\t\treturn await fileExists(withExtension) ? withExtension : undefined;\n\t\t\t});\n\t\t\tfor (const foundPromise of pathExtsFound) {\n\t\t\t\tconst found = await foundPromise;\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (await fileExists(fullPath)) {\n\t\t\treturn fullPath;\n\t\t}\n\t}\n\tconst fullPath = path.join(cwd, command);\n\treturn await fileExists(fullPath) ? fullPath : undefined;\n}\n\n/**\n * Kills a process and all its children.\n * @param pid the process id to kill\n * @param forceful whether to forcefully kill the process (default: false). Note\n * that on Windows, terminal processes can _only_ be killed forcefully and this\n * will throw when not forceful.\n */\nexport async function killTree(pid: number, forceful = false) {\n\tlet child: cp.ChildProcessByStdio<null, Stream.Readable, Stream.Readable>;\n\tif (Platform.isWindows) {\n\t\tconst windir = process.env['WINDIR'] || 'C:\\\\Windows';\n\t\tconst taskKill = path.join(windir, 'System32', 'taskkill.exe');\n\n\t\tconst args = ['/T'];\n\t\tif (forceful) {\n\t\t\targs.push('/F');\n\t\t}\n\t\targs.push('/PID', String(pid));\n\t\tchild = cp.spawn(taskKill, args, { stdio: ['ignore', 'pipe', 'pipe'] });\n\t} else {\n\t\tconst killScript = FileAccess.asFileUri('vs/base/node/terminateProcess.sh').fsPath;\n\t\tchild = cp.spawn('/bin/sh', [killScript, String(pid), forceful ? '9' : '15'], { stdio: ['ignore', 'pipe', 'pipe'] });\n\t}\n\n\treturn new Promise<void>((resolve, reject) => {\n\t\tconst stdout: Buffer[] = [];\n\t\tchild.stdout.on('data', (data) => stdout.push(data));\n\t\tchild.stderr.on('data', (data) => stdout.push(data));\n\t\tchild.on('error', reject);\n\t\tchild.on('exit', (code) => {\n\t\t\tif (code === 0) {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\treject(new Error(`taskkill exited with code ${code}: ${Buffer.concat(stdout).toString()}`));\n\t\t\t}\n\t\t});\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { userInfo } from 'os';\nimport * as platform from '../common/platform.js';\nimport { getFirstAvailablePowerShellInstallation } from './powershell.js';\nimport * as processes from './processes.js';\n\n/**\n * Gets the detected default shell for the _system_, not to be confused with VS Code's _default_\n * shell that the terminal uses by default.\n * @param os The platform to detect the shell of.\n */\nexport async function getSystemShell(os: platform.OperatingSystem, env: platform.IProcessEnvironment): Promise<string> {\n\tif (os === platform.OperatingSystem.Windows) {\n\t\tif (platform.isWindows) {\n\t\t\treturn getSystemShellWindows();\n\t\t}\n\t\t// Don't detect Windows shell when not on Windows\n\t\treturn processes.getWindowsShell(env);\n\t}\n\n\treturn getSystemShellUnixLike(os, env);\n}\n\nlet _TERMINAL_DEFAULT_SHELL_UNIX_LIKE: string | null = null;\nfunction getSystemShellUnixLike(os: platform.OperatingSystem, env: platform.IProcessEnvironment): string {\n\t// Only use $SHELL for the current OS\n\tif (platform.isLinux && os === platform.OperatingSystem.Macintosh || platform.isMacintosh && os === platform.OperatingSystem.Linux) {\n\t\treturn '/bin/bash';\n\t}\n\n\tif (!_TERMINAL_DEFAULT_SHELL_UNIX_LIKE) {\n\t\tlet unixLikeTerminal: string | undefined | null;\n\t\tif (platform.isWindows) {\n\t\t\tunixLikeTerminal = '/bin/bash'; // for WSL\n\t\t} else {\n\t\t\tunixLikeTerminal = env['SHELL'];\n\n\t\t\tif (!unixLikeTerminal) {\n\t\t\t\ttry {\n\t\t\t\t\t// It's possible for $SHELL to be unset, this API reads /etc/passwd. See https://github.com/github/codespaces/issues/1639\n\t\t\t\t\t// Node docs: \"Throws a SystemError if a user has no username or homedir.\"\n\t\t\t\t\tunixLikeTerminal = userInfo().shell;\n\t\t\t\t} catch (err) { }\n\t\t\t}\n\n\t\t\tif (!unixLikeTerminal) {\n\t\t\t\tunixLikeTerminal = 'sh';\n\t\t\t}\n\n\t\t\t// Some systems have $SHELL set to /bin/false which breaks the terminal\n\t\t\tif (unixLikeTerminal === '/bin/false') {\n\t\t\t\tunixLikeTerminal = '/bin/bash';\n\t\t\t}\n\t\t}\n\t\t_TERMINAL_DEFAULT_SHELL_UNIX_LIKE = unixLikeTerminal;\n\t}\n\treturn _TERMINAL_DEFAULT_SHELL_UNIX_LIKE;\n}\n\nlet _TERMINAL_DEFAULT_SHELL_WINDOWS: string | null = null;\nasync function getSystemShellWindows(): Promise<string> {\n\tif (!_TERMINAL_DEFAULT_SHELL_WINDOWS) {\n\t\t_TERMINAL_DEFAULT_SHELL_WINDOWS = (await getFirstAvailablePowerShellInstallation())!.exePath;\n\t}\n\treturn _TERMINAL_DEFAULT_SHELL_WINDOWS;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport minimist from 'minimist';\nimport { isWindows } from '../../../base/common/platform.js';\nimport { localize } from '../../../nls.js';\nimport { NativeParsedArgs } from '../common/argv.js';\n\n/**\n * This code is also used by standalone cli's. Avoid adding any other dependencies.\n */\nconst helpCategories = {\n\to: localize('optionsUpperCase', \"Options\"),\n\te: localize('extensionsManagement', \"Extensions Management\"),\n\tt: localize('troubleshooting', \"Troubleshooting\"),\n\tm: localize('mcp', \"Model Context Protocol\")\n};\n\nexport interface Option<OptionType> {\n\ttype: OptionType;\n\talias?: string;\n\tdeprecates?: string[]; // old deprecated ids\n\targs?: string | string[];\n\tdescription?: string;\n\tdeprecationMessage?: string;\n\tallowEmptyValue?: boolean;\n\tcat?: keyof typeof helpCategories;\n\tglobal?: boolean;\n}\n\nexport interface Subcommand<T> {\n\ttype: 'subcommand';\n\tdescription?: string;\n\tdeprecationMessage?: string;\n\toptions: OptionDescriptions<Required<T>>;\n}\n\nexport type OptionDescriptions<T> = {\n\t[P in keyof T]:\n\tT[P] extends boolean | undefined ? Option<'boolean'> :\n\tT[P] extends string | undefined ? Option<'string'> :\n\tT[P] extends string[] | undefined ? Option<'string[]'> :\n\tSubcommand<T[P]>\n};\n\nexport const NATIVE_CLI_COMMANDS = ['tunnel', 'serve-web'] as const;\n\nexport const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {\n\t'chat': {\n\t\ttype: 'subcommand',\n\t\tdescription: 'Pass in a prompt to run in a chat session in the current working directory.',\n\t\toptions: {\n\t\t\t'_': { type: 'string[]', description: localize('prompt', \"The prompt to use as chat.\") },\n\t\t\t'mode': { type: 'string', cat: 'o', alias: 'm', args: 'mode', description: localize('chatMode', \"The mode to use for the chat session. Available options: 'ask', 'edit', 'agent', or the identifier of a custom mode. Defaults to 'agent'.\") },\n\t\t\t'add-file': { type: 'string[]', cat: 'o', alias: 'a', args: 'path', description: localize('addFile', \"Add files as context to the chat session.\") },\n\t\t\t'maximize': { type: 'boolean', cat: 'o', description: localize('chatMaximize', \"Maximize the chat session view.\") },\n\t\t\t'reuse-window': { type: 'boolean', cat: 'o', alias: 'r', description: localize('reuseWindowForChat', \"Force to use the last active window for the chat session.\") },\n\t\t\t'new-window': { type: 'boolean', cat: 'o', alias: 'n', description: localize('newWindowForChat', \"Force to open an empty window for the chat session.\") },\n\t\t\t'help': { type: 'boolean', alias: 'h', description: localize('help', \"Print usage.\") }\n\t\t}\n\t},\n\t'serve-web': {\n\t\ttype: 'subcommand',\n\t\tdescription: 'Run a server that displays the editor UI in browsers.',\n\t\toptions: {\n\t\t\t'cli-data-dir': { type: 'string', args: 'dir', description: localize('cliDataDir', \"Directory where CLI metadata should be stored.\") },\n\t\t\t'disable-telemetry': { type: 'boolean' },\n\t\t\t'telemetry-level': { type: 'string' },\n\t\t}\n\t},\n\t'tunnel': {\n\t\ttype: 'subcommand',\n\t\tdescription: 'Make the current machine accessible from vscode.dev or other machines through a secure tunnel.',\n\t\toptions: {\n\t\t\t'cli-data-dir': { type: 'string', args: 'dir', description: localize('cliDataDir', \"Directory where CLI metadata should be stored.\") },\n\t\t\t'disable-telemetry': { type: 'boolean' },\n\t\t\t'telemetry-level': { type: 'string' },\n\t\t\tuser: {\n\t\t\t\ttype: 'subcommand',\n\t\t\t\toptions: {\n\t\t\t\t\tlogin: {\n\t\t\t\t\t\ttype: 'subcommand',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tprovider: { type: 'string' },\n\t\t\t\t\t\t\t'access-token': { type: 'string' }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t'diff': { type: 'boolean', cat: 'o', alias: 'd', args: ['file', 'file'], description: localize('diff', \"Compare two files with each other.\") },\n\t'merge': { type: 'boolean', cat: 'o', alias: 'm', args: ['path1', 'path2', 'base', 'result'], description: localize('merge', \"Perform a three-way merge by providing paths for two modified versions of a file, the common origin of both modified versions and the output file to save merge results.\") },\n\t'add': { type: 'boolean', cat: 'o', alias: 'a', args: 'folder', description: localize('add', \"Add folder(s) to the last active window.\") },\n\t'remove': { type: 'boolean', cat: 'o', args: 'folder', description: localize('remove', \"Remove folder(s) from the last active window.\") },\n\t'goto': { type: 'boolean', cat: 'o', alias: 'g', args: 'file:line[:character]', description: localize('goto', \"Open a file at the path on the specified line and character position.\") },\n\t'new-window': { type: 'boolean', cat: 'o', alias: 'n', description: localize('newWindow', \"Force to open a new window.\") },\n\t'reuse-window': { type: 'boolean', cat: 'o', alias: 'r', description: localize('reuseWindow', \"Force to open a file or folder in an already opened window.\") },\n\t'wait': { type: 'boolean', cat: 'o', alias: 'w', description: localize('wait', \"Wait for the files to be closed before returning.\") },\n\t'waitMarkerFilePath': { type: 'string' },\n\t'locale': { type: 'string', cat: 'o', args: 'locale', description: localize('locale', \"The locale to use (e.g. en-US or zh-TW).\") },\n\t'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', \"Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.\") },\n\t'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', \"Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created.\") },\n\t'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', \"Print usage.\") },\n\t'stdin-to-clipboard': { type: 'boolean', cat: 'o', alias: 'c', description: localize('clipboard', \"copies the STDIN to the clipboard\") },\n\n\t'extensions-dir': { type: 'string', deprecates: ['extensionHomePath'], cat: 'e', args: 'dir', description: localize('extensionHomePath', \"Set the root path for extensions.\") },\n\t'extensions-download-dir': { type: 'string' },\n\t'builtin-extensions-dir': { type: 'string' },\n\t'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', \"List the installed extensions.\") },\n\t'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', \"Show versions of installed extensions, when using --list-extensions.\") },\n\t'category': { type: 'string', allowEmptyValue: true, cat: 'e', description: localize('category', \"Filters installed extensions by provided category, when using --list-extensions.\"), args: 'category' },\n\t'install-extension': { type: 'string[]', cat: 'e', args: 'ext-id | path', description: localize('installExtension', \"Installs or updates an extension. The argument is either an extension id or a path to a VSIX. The identifier of an extension is '${publisher}.${name}'. Use '--force' argument to update to latest version. To install a specific version provide '@${version}'. For example: 'vscode.csharp@1.2.3'.\") },\n\t'pre-release': { type: 'boolean', cat: 'e', description: localize('install prerelease', \"Installs the pre-release version of the extension, when using --install-extension\") },\n\t'uninstall-extension': { type: 'string[]', cat: 'e', args: 'ext-id', description: localize('uninstallExtension', \"Uninstalls an extension.\") },\n\t'update-extensions': { type: 'boolean', cat: 'e', description: localize('updateExtensions', \"Update the installed extensions.\") },\n\t'enable-proposed-api': { type: 'string[]', allowEmptyValue: true, cat: 'e', args: 'ext-id', description: localize('experimentalApis', \"Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.\") },\n\n\t'add-mcp': { type: 'string[]', cat: 'm', args: 'json', description: localize('addMcp', \"Adds a Model Context Protocol server definition to the user profile. Accepts JSON input in the form '{\\\"name\\\":\\\"server-name\\\",\\\"command\\\":...}'\") },\n\n\t'version': { type: 'boolean', cat: 't', alias: 'v', description: localize('version', \"Print version.\") },\n\t'verbose': { type: 'boolean', cat: 't', global: true, description: localize('verbose', \"Print verbose output (implies --wait).\") },\n\t'log': { type: 'string[]', cat: 't', args: 'level', global: true, description: localize('log', \"Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'. You can also configure the log level of an extension by passing extension id and log level in the following format: '${publisher}.${name}:${logLevel}'. For example: 'vscode.csharp:trace'. Can receive one or more such entries.\") },\n\t'status': { type: 'boolean', alias: 's', cat: 't', description: localize('status', \"Print process usage and diagnostics information.\") },\n\t'prof-startup': { type: 'boolean', cat: 't', description: localize('prof-startup', \"Run CPU profiler during startup.\") },\n\t'prof-append-timers': { type: 'string' },\n\t'prof-duration-markers': { type: 'string[]' },\n\t'prof-duration-markers-file': { type: 'string' },\n\t'no-cached-data': { type: 'boolean' },\n\t'prof-startup-prefix': { type: 'string' },\n\t'prof-v8-extensions': { type: 'boolean' },\n\t'disable-extensions': { type: 'boolean', deprecates: ['disableExtensions'], cat: 't', description: localize('disableExtensions', \"Disable all installed extensions. This option is not persisted and is effective only when the command opens a new window.\") },\n\t'disable-extension': { type: 'string[]', cat: 't', args: 'ext-id', description: localize('disableExtension', \"Disable the provided extension. This option is not persisted and is effective only when the command opens a new window.\") },\n\t'sync': { type: 'string', cat: 't', description: localize('turn sync', \"Turn sync on or off.\"), args: ['on | off'] },\n\n\t'inspect-extensions': { type: 'string', allowEmptyValue: true, deprecates: ['debugPluginHost'], args: 'port', cat: 't', description: localize('inspect-extensions', \"Allow debugging and profiling of extensions. Check the developer tools for the connection URI.\") },\n\t'inspect-brk-extensions': { type: 'string', allowEmptyValue: true, deprecates: ['debugBrkPluginHost'], args: 'port', cat: 't', description: localize('inspect-brk-extensions', \"Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection URI.\") },\n\t'disable-lcd-text': { type: 'boolean', cat: 't', description: localize('disableLCDText', \"Disable LCD font rendering.\") },\n\t'disable-gpu': { type: 'boolean', cat: 't', description: localize('disableGPU', \"Disable GPU hardware acceleration.\") },\n\t'disable-chromium-sandbox': { type: 'boolean', cat: 't', description: localize('disableChromiumSandbox', \"Use this option only when there is requirement to launch the application as sudo user on Linux or when running as an elevated user in an applocker environment on Windows.\") },\n\t'sandbox': { type: 'boolean' },\n\t'locate-shell-integration-path': { type: 'string', cat: 't', args: ['shell'], description: localize('locateShellIntegrationPath', \"Print the path to a terminal shell integration script. Allowed values are 'bash', 'pwsh', 'zsh' or 'fish'.\") },\n\t'telemetry': { type: 'boolean', cat: 't', description: localize('telemetry', \"Shows all telemetry events which VS code collects.\") },\n\n\t'remote': { type: 'string', allowEmptyValue: true },\n\t'folder-uri': { type: 'string[]', cat: 'o', args: 'uri' },\n\t'file-uri': { type: 'string[]', cat: 'o', args: 'uri' },\n\n\t'locate-extension': { type: 'string[]' },\n\t'extensionDevelopmentPath': { type: 'string[]' },\n\t'extensionDevelopmentKind': { type: 'string[]' },\n\t'extensionTestsPath': { type: 'string' },\n\t'extensionEnvironment': { type: 'string' },\n\t'debugId': { type: 'string' },\n\t'debugRenderer': { type: 'boolean' },\n\t'inspect-ptyhost': { type: 'string', allowEmptyValue: true },\n\t'inspect-brk-ptyhost': { type: 'string', allowEmptyValue: true },\n\t'inspect-search': { type: 'string', deprecates: ['debugSearch'], allowEmptyValue: true },\n\t'inspect-brk-search': { type: 'string', deprecates: ['debugBrkSearch'], allowEmptyValue: true },\n\t'inspect-sharedprocess': { type: 'string', allowEmptyValue: true },\n\t'inspect-brk-sharedprocess': { type: 'string', allowEmptyValue: true },\n\t'export-default-configuration': { type: 'string' },\n\t'install-source': { type: 'string' },\n\t'enable-smoke-test-driver': { type: 'boolean' },\n\t'logExtensionHostCommunication': { type: 'boolean' },\n\t'skip-release-notes': { type: 'boolean' },\n\t'skip-welcome': { type: 'boolean' },\n\t'disable-telemetry': { type: 'boolean' },\n\t'disable-updates': { type: 'boolean' },\n\t'use-inmemory-secretstorage': { type: 'boolean', deprecates: ['disable-keytar'] },\n\t'password-store': { type: 'string' },\n\t'disable-workspace-trust': { type: 'boolean' },\n\t'disable-crash-reporter': { type: 'boolean' },\n\t'crash-reporter-directory': { type: 'string' },\n\t'crash-reporter-id': { type: 'string' },\n\t'skip-add-to-recently-opened': { type: 'boolean' },\n\t'open-url': { type: 'boolean' },\n\t'file-write': { type: 'boolean' },\n\t'file-chmod': { type: 'boolean' },\n\t'install-builtin-extension': { type: 'string[]' },\n\t'force': { type: 'boolean' },\n\t'do-not-sync': { type: 'boolean' },\n\t'do-not-include-pack-dependencies': { type: 'boolean' },\n\t'trace': { type: 'boolean' },\n\t'trace-memory-infra': { type: 'boolean' },\n\t'trace-category-filter': { type: 'string' },\n\t'trace-options': { type: 'string' },\n\t'preserve-env': { type: 'boolean' },\n\t'force-user-env': { type: 'boolean' },\n\t'force-disable-user-env': { type: 'boolean' },\n\t'open-devtools': { type: 'boolean' },\n\t'disable-gpu-sandbox': { type: 'boolean' },\n\t'logsPath': { type: 'string' },\n\t'__enable-file-policy': { type: 'boolean' },\n\t'editSessionId': { type: 'string' },\n\t'continueOn': { type: 'string' },\n\t'enable-coi': { type: 'boolean' },\n\t'unresponsive-sample-interval': { type: 'string' },\n\t'unresponsive-sample-period': { type: 'string' },\n\t'enable-rdp-display-tracking': { type: 'boolean' },\n\t'disable-layout-restore': { type: 'boolean' },\n\t'startup-experiment-group': { type: 'string', cat: 't', args: 'control|maximizedChat|splitEmptyEditorChat|splitWelcomeChat', description: localize('startupExperimentGroup', \"Override the startup experiment group.\") },\n\n\t// chromium flags\n\t'no-proxy-server': { type: 'boolean' },\n\t// Minimist incorrectly parses keys that start with `--no`\n\t// https://github.com/substack/minimist/blob/aeb3e27dae0412de5c0494e9563a5f10c82cc7a9/index.js#L118-L121\n\t// If --no-sandbox is passed via cli wrapper it will be treated as --sandbox which is incorrect, we use\n\t// the alias here to make sure --no-sandbox is always respected.\n\t// For https://github.com/microsoft/vscode/issues/128279\n\t'no-sandbox': { type: 'boolean', alias: 'sandbox' },\n\t'proxy-server': { type: 'string' },\n\t'proxy-bypass-list': { type: 'string' },\n\t'proxy-pac-url': { type: 'string' },\n\t'js-flags': { type: 'string' }, // chrome js flags\n\t'inspect': { type: 'string', allowEmptyValue: true },\n\t'inspect-brk': { type: 'string', allowEmptyValue: true },\n\t'nolazy': { type: 'boolean' }, // node inspect\n\t'force-device-scale-factor': { type: 'string' },\n\t'force-renderer-accessibility': { type: 'boolean' },\n\t'ignore-certificate-errors': { type: 'boolean' },\n\t'allow-insecure-localhost': { type: 'boolean' },\n\t'log-net-log': { type: 'string' },\n\t'vmodule': { type: 'string' },\n\t'_urls': { type: 'string[]' },\n\t'disable-dev-shm-usage': { type: 'boolean' },\n\t'profile-temp': { type: 'boolean' },\n\t'ozone-platform': { type: 'string' },\n\t'enable-tracing': { type: 'string' },\n\t'trace-startup-format': { type: 'string' },\n\t'trace-startup-file': { type: 'string' },\n\t'trace-startup-duration': { type: 'string' },\n\t'xdg-portal-required-version': { type: 'string' },\n\n\t_: { type: 'string[]' } // main arguments\n};\n\nexport interface ErrorReporter {\n\tonUnknownOption(id: string): void;\n\tonMultipleValues(id: string, usedValue: string): void;\n\tonEmptyValue(id: string): void;\n\tonDeprecatedOption(deprecatedId: string, message: string): void;\n\n\tgetSubcommandReporter?(command: string): ErrorReporter;\n}\n\nconst ignoringReporter = {\n\tonUnknownOption: () => { },\n\tonMultipleValues: () => { },\n\tonEmptyValue: () => { },\n\tonDeprecatedOption: () => { }\n};\n\nexport function parseArgs<T>(args: string[], options: OptionDescriptions<T>, errorReporter: ErrorReporter = ignoringReporter): T {\n\t// Find the first non-option arg, which also isn't the value for a previous `--flag`\n\tconst firstPossibleCommand = args.find((a, i) => a.length > 0 && a[0] !== '-' && options.hasOwnProperty(a) && options[a as T].type === 'subcommand');\n\n\tconst alias: { [key: string]: string } = {};\n\tconst stringOptions: string[] = ['_'];\n\tconst booleanOptions: string[] = [];\n\tconst globalOptions: OptionDescriptions<any> = {};\n\tlet command: Subcommand<any> | undefined = undefined;\n\tfor (const optionId in options) {\n\t\tconst o = options[optionId];\n\t\tif (o.type === 'subcommand') {\n\t\t\tif (optionId === firstPossibleCommand) {\n\t\t\t\tcommand = o;\n\t\t\t}\n\t\t} else {\n\t\t\tif (o.alias) {\n\t\t\t\talias[optionId] = o.alias;\n\t\t\t}\n\n\t\t\tif (o.type === 'string' || o.type === 'string[]') {\n\t\t\t\tstringOptions.push(optionId);\n\t\t\t\tif (o.deprecates) {\n\t\t\t\t\tstringOptions.push(...o.deprecates);\n\t\t\t\t}\n\t\t\t} else if (o.type === 'boolean') {\n\t\t\t\tbooleanOptions.push(optionId);\n\t\t\t\tif (o.deprecates) {\n\t\t\t\t\tbooleanOptions.push(...o.deprecates);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (o.global) {\n\t\t\t\tglobalOptions[optionId] = o;\n\t\t\t}\n\t\t}\n\t}\n\tif (command && firstPossibleCommand) {\n\t\tconst options = globalOptions;\n\t\tfor (const optionId in command.options) {\n\t\t\toptions[optionId] = command.options[optionId];\n\t\t}\n\t\tconst newArgs = args.filter(a => a !== firstPossibleCommand);\n\t\tconst reporter = errorReporter.getSubcommandReporter ? errorReporter.getSubcommandReporter(firstPossibleCommand) : undefined;\n\t\tconst subcommandOptions = parseArgs(newArgs, options, reporter);\n\t\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\t\treturn <T>{\n\t\t\t[firstPossibleCommand]: subcommandOptions,\n\t\t\t_: []\n\t\t};\n\t}\n\n\n\t// remove aliases to avoid confusion\n\tconst parsedArgs = minimist(args, { string: stringOptions, boolean: booleanOptions, alias });\n\n\tconst cleanedArgs: any = {};\n\tconst remainingArgs: any = parsedArgs;\n\n\t// https://github.com/microsoft/vscode/issues/58177, https://github.com/microsoft/vscode/issues/106617\n\tcleanedArgs._ = parsedArgs._.map(arg => String(arg)).filter(arg => arg.length > 0);\n\n\tdelete remainingArgs._;\n\n\tfor (const optionId in options) {\n\t\tconst o = options[optionId];\n\t\tif (o.type === 'subcommand') {\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.alias) {\n\t\t\tdelete remainingArgs[o.alias];\n\t\t}\n\n\t\tlet val = remainingArgs[optionId];\n\t\tif (o.deprecates) {\n\t\t\tfor (const deprecatedId of o.deprecates) {\n\t\t\t\tif (remainingArgs.hasOwnProperty(deprecatedId)) {\n\t\t\t\t\tif (!val) {\n\t\t\t\t\t\tval = remainingArgs[deprecatedId];\n\t\t\t\t\t\tif (val) {\n\t\t\t\t\t\t\terrorReporter.onDeprecatedOption(deprecatedId, o.deprecationMessage || localize('deprecated.useInstead', 'Use {0} instead.', optionId));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdelete remainingArgs[deprecatedId];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof val !== 'undefined') {\n\t\t\tif (o.type === 'string[]') {\n\t\t\t\tif (!Array.isArray(val)) {\n\t\t\t\t\tval = [val];\n\t\t\t\t}\n\t\t\t\tif (!o.allowEmptyValue) {\n\t\t\t\t\tconst sanitized = val.filter((v: string) => v.length > 0);\n\t\t\t\t\tif (sanitized.length !== val.length) {\n\t\t\t\t\t\terrorReporter.onEmptyValue(optionId);\n\t\t\t\t\t\tval = sanitized.length > 0 ? sanitized : undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (o.type === 'string') {\n\t\t\t\tif (Array.isArray(val)) {\n\t\t\t\t\tval = val.pop(); // take the last\n\t\t\t\t\terrorReporter.onMultipleValues(optionId, val);\n\t\t\t\t} else if (!val && !o.allowEmptyValue) {\n\t\t\t\t\terrorReporter.onEmptyValue(optionId);\n\t\t\t\t\tval = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcleanedArgs[optionId] = val;\n\n\t\t\tif (o.deprecationMessage) {\n\t\t\t\terrorReporter.onDeprecatedOption(optionId, o.deprecationMessage);\n\t\t\t}\n\t\t}\n\t\tdelete remainingArgs[optionId];\n\t}\n\n\tfor (const key in remainingArgs) {\n\t\terrorReporter.onUnknownOption(key);\n\t}\n\n\treturn cleanedArgs;\n}\n\nfunction formatUsage(optionId: string, option: Option<any>) {\n\tlet args = '';\n\tif (option.args) {\n\t\tif (Array.isArray(option.args)) {\n\t\t\targs = ` <${option.args.join('> <')}>`;\n\t\t} else {\n\t\t\targs = ` <${option.args}>`;\n\t\t}\n\t}\n\tif (option.alias) {\n\t\treturn `-${option.alias} --${optionId}${args}`;\n\t}\n\treturn `--${optionId}${args}`;\n}\n\n// exported only for testing\nexport function formatOptions(options: OptionDescriptions<any>, columns: number): string[] {\n\tconst usageTexts: [string, string][] = [];\n\tfor (const optionId in options) {\n\t\tconst o = options[optionId];\n\t\tconst usageText = formatUsage(optionId, o);\n\t\tusageTexts.push([usageText, o.description!]);\n\t}\n\treturn formatUsageTexts(usageTexts, columns);\n}\n\nfunction formatUsageTexts(usageTexts: [string, string][], columns: number) {\n\tconst maxLength = usageTexts.reduce((previous, e) => Math.max(previous, e[0].length), 12);\n\tconst argLength = maxLength + 2/*left padding*/ + 1/*right padding*/;\n\tif (columns - argLength < 25) {\n\t\t// Use a condensed version on narrow terminals\n\t\treturn usageTexts.reduce<string[]>((r, ut) => r.concat([`  ${ut[0]}`, `      ${ut[1]}`]), []);\n\t}\n\tconst descriptionColumns = columns - argLength - 1;\n\tconst result: string[] = [];\n\tfor (const ut of usageTexts) {\n\t\tconst usage = ut[0];\n\t\tconst wrappedDescription = wrapText(ut[1], descriptionColumns);\n\t\tconst keyPadding = indent(argLength - usage.length - 2/*left padding*/);\n\t\tresult.push('  ' + usage + keyPadding + wrappedDescription[0]);\n\t\tfor (let i = 1; i < wrappedDescription.length; i++) {\n\t\t\tresult.push(indent(argLength) + wrappedDescription[i]);\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction indent(count: number): string {\n\treturn ' '.repeat(count);\n}\n\nfunction wrapText(text: string, columns: number): string[] {\n\tconst lines: string[] = [];\n\twhile (text.length) {\n\t\tlet index = text.length < columns ? text.length : text.lastIndexOf(' ', columns);\n\t\tif (index === 0) {\n\t\t\tindex = columns;\n\t\t}\n\t\tconst line = text.slice(0, index).trim();\n\t\ttext = text.slice(index).trimStart();\n\t\tlines.push(line);\n\t}\n\treturn lines;\n}\n\nexport function buildHelpMessage(productName: string, executableName: string, version: string, options: OptionDescriptions<any>, capabilities?: { noPipe?: boolean; noInputFiles?: boolean; isChat?: boolean }): string {\n\tconst columns = (process.stdout).isTTY && (process.stdout).columns || 80;\n\tconst inputFiles = capabilities?.noInputFiles ? '' : capabilities?.isChat ? ` [${localize('cliPrompt', 'prompt')}]` : ` [${localize('paths', 'paths')}...]`;\n\tconst subcommand = capabilities?.isChat ? ' chat' : '';\n\n\tconst help = [`${productName} ${version}`];\n\thelp.push('');\n\thelp.push(`${localize('usage', \"Usage\")}: ${executableName}${subcommand} [${localize('options', \"options\")}]${inputFiles}`);\n\thelp.push('');\n\tif (capabilities?.noPipe !== true) {\n\t\thelp.push(buildStdinMessage(executableName, capabilities?.isChat));\n\t\thelp.push('');\n\t}\n\tconst optionsByCategory: { [P in keyof typeof helpCategories]?: OptionDescriptions<any> } = {};\n\tconst subcommands: { command: string; description: string }[] = [];\n\tfor (const optionId in options) {\n\t\tconst o = options[optionId];\n\t\tif (o.type === 'subcommand') {\n\t\t\tif (o.description) {\n\t\t\t\tsubcommands.push({ command: optionId, description: o.description });\n\t\t\t}\n\t\t} else if (o.description && o.cat) {\n\t\t\tlet optionsByCat = optionsByCategory[o.cat];\n\t\t\tif (!optionsByCat) {\n\t\t\t\toptionsByCategory[o.cat] = optionsByCat = {};\n\t\t\t}\n\t\t\toptionsByCat[optionId] = o;\n\t\t}\n\t}\n\n\tfor (const helpCategoryKey in optionsByCategory) {\n\t\tconst key = <keyof typeof helpCategories>helpCategoryKey;\n\n\t\tconst categoryOptions = optionsByCategory[key];\n\t\tif (categoryOptions) {\n\t\t\thelp.push(helpCategories[key]);\n\t\t\thelp.push(...formatOptions(categoryOptions, columns));\n\t\t\thelp.push('');\n\t\t}\n\t}\n\n\tif (subcommands.length) {\n\t\thelp.push(localize('subcommands', \"Subcommands\"));\n\t\thelp.push(...formatUsageTexts(subcommands.map(s => [s.command, s.description]), columns));\n\t\thelp.push('');\n\t}\n\n\treturn help.join('\\n');\n}\n\nexport function buildStdinMessage(executableName: string, isChat?: boolean): string {\n\tlet example: string;\n\tif (isWindows) {\n\t\tif (isChat) {\n\t\t\texample = `echo Hello World | ${executableName} chat <prompt> -`;\n\t\t} else {\n\t\t\texample = `echo Hello World | ${executableName} -`;\n\t\t}\n\t} else {\n\t\tif (isChat) {\n\t\t\texample = `ps aux | grep code | ${executableName} chat <prompt> -`;\n\t\t} else {\n\t\t\texample = `ps aux | grep code | ${executableName} -`;\n\t\t}\n\t}\n\n\treturn localize('stdinUsage', \"To read from stdin, append '-' (e.g. '{0}')\", example);\n}\n\nexport function buildVersionMessage(version: string | undefined, commit: string | undefined): string {\n\treturn `${version || localize('unknownVersion', \"Unknown version\")}\\n${commit || localize('unknownCommit', \"Unknown commit\")}\\n${process.arch}`;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport assert from 'assert';\nimport { IProcessEnvironment } from '../../../base/common/platform.js';\nimport { localize } from '../../../nls.js';\nimport { NativeParsedArgs } from '../common/argv.js';\nimport { ErrorReporter, NATIVE_CLI_COMMANDS, OPTIONS, parseArgs } from './argv.js';\n\nfunction parseAndValidate(cmdLineArgs: string[], reportWarnings: boolean): NativeParsedArgs {\n\tconst onMultipleValues = (id: string, val: string) => {\n\t\tconsole.warn(localize('multipleValues', \"Option '{0}' is defined more than once. Using value '{1}'.\", id, val));\n\t};\n\tconst onEmptyValue = (id: string) => {\n\t\tconsole.warn(localize('emptyValue', \"Option '{0}' requires a non empty value. Ignoring the option.\", id));\n\t};\n\tconst onDeprecatedOption = (deprecatedOption: string, message: string) => {\n\t\tconsole.warn(localize('deprecatedArgument', \"Option '{0}' is deprecated: {1}\", deprecatedOption, message));\n\t};\n\tconst getSubcommandReporter = (command: string) => ({\n\t\tonUnknownOption: (id: string) => {\n\t\t\tif (!(NATIVE_CLI_COMMANDS as readonly string[]).includes(command)) {\n\t\t\t\tconsole.warn(localize('unknownSubCommandOption', \"Warning: '{0}' is not in the list of known options for subcommand '{1}'\", id, command));\n\t\t\t}\n\t\t},\n\t\tonMultipleValues,\n\t\tonEmptyValue,\n\t\tonDeprecatedOption,\n\t\tgetSubcommandReporter: (NATIVE_CLI_COMMANDS as readonly string[]).includes(command) ? getSubcommandReporter : undefined\n\t});\n\tconst errorReporter: ErrorReporter = {\n\t\tonUnknownOption: (id) => {\n\t\t\tconsole.warn(localize('unknownOption', \"Warning: '{0}' is not in the list of known options, but still passed to Electron/Chromium.\", id));\n\t\t},\n\t\tonMultipleValues,\n\t\tonEmptyValue,\n\t\tonDeprecatedOption,\n\t\tgetSubcommandReporter\n\t};\n\n\tconst args = parseArgs(cmdLineArgs, OPTIONS, reportWarnings ? errorReporter : undefined);\n\tif (args.goto) {\n\t\targs._.forEach(arg => assert(/^(\\w:)?[^:]+(:\\d*){0,2}:?$/.test(arg), localize('gotoValidation', \"Arguments in `--goto` mode should be in the format of `FILE(:LINE(:CHARACTER))`.\")));\n\t}\n\n\treturn args;\n}\n\nfunction stripAppPath(argv: string[]): string[] | undefined {\n\tconst index = argv.findIndex(a => !/^-/.test(a));\n\n\tif (index > -1) {\n\t\treturn [...argv.slice(0, index), ...argv.slice(index + 1)];\n\t}\n\treturn undefined;\n}\n\n/**\n * Use this to parse raw code process.argv such as: `Electron . --verbose --wait`\n */\nexport function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs {\n\tlet [, ...args] = processArgv;\n\n\t// If dev, remove the first non-option argument: it's the app location\n\tif (process.env['VSCODE_DEV']) {\n\t\targs = stripAppPath(args) || [];\n\t}\n\n\t// If called from CLI, don't report warnings as they are already reported.\n\tconst reportWarnings = !isLaunchedFromCli(process.env);\n\treturn parseAndValidate(args, reportWarnings);\n}\n\n/**\n * Use this to parse raw code CLI process.argv such as: `Electron cli.js . --verbose --wait`\n */\nexport function parseCLIProcessArgv(processArgv: string[]): NativeParsedArgs {\n\tlet [, , ...args] = processArgv; // remove the first non-option argument: it's always the app location\n\n\t// If dev, remove the first non-option argument: it's the app location\n\tif (process.env['VSCODE_DEV']) {\n\t\targs = stripAppPath(args) || [];\n\t}\n\n\treturn parseAndValidate(args, true);\n}\n\nexport function addArg(argv: string[], ...args: string[]): string[] {\n\tconst endOfArgsMarkerIndex = argv.indexOf('--');\n\tif (endOfArgsMarkerIndex === -1) {\n\t\targv.push(...args);\n\t} else {\n\t\t// if the we have an argument \"--\" (end of argument marker)\n\t\t// we cannot add arguments at the end. rather, we add\n\t\t// arguments before the \"--\" marker.\n\t\targv.splice(endOfArgsMarkerIndex, 0, ...args);\n\t}\n\n\treturn argv;\n}\n\nexport function isLaunchedFromCli(env: IProcessEnvironment): boolean {\n\treturn env['VSCODE_CLI'] === '1';\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { assert } from './assert.js';\n\nexport function clamp(value: number, min: number, max: number): number {\n\treturn Math.min(Math.max(value, min), max);\n}\n\nexport function rot(index: number, modulo: number): number {\n\treturn (modulo + (index % modulo)) % modulo;\n}\n\nexport class Counter {\n\tprivate _next = 0;\n\n\tgetNext(): number {\n\t\treturn this._next++;\n\t}\n}\n\nexport class MovingAverage {\n\n\tprivate _n = 1;\n\tprivate _val = 0;\n\n\tupdate(value: number): number {\n\t\tthis._val = this._val + (value - this._val) / this._n;\n\t\tthis._n += 1;\n\t\treturn this._val;\n\t}\n\n\tget value(): number {\n\t\treturn this._val;\n\t}\n}\n\nexport class SlidingWindowAverage {\n\n\tprivate _n: number = 0;\n\tprivate _val = 0;\n\n\tprivate readonly _values: number[] = [];\n\tprivate _index: number = 0;\n\tprivate _sum = 0;\n\n\tconstructor(size: number) {\n\t\tthis._values = new Array(size);\n\t\tthis._values.fill(0, 0, size);\n\t}\n\n\tupdate(value: number): number {\n\t\tconst oldValue = this._values[this._index];\n\t\tthis._values[this._index] = value;\n\t\tthis._index = (this._index + 1) % this._values.length;\n\n\t\tthis._sum -= oldValue;\n\t\tthis._sum += value;\n\n\t\tif (this._n < this._values.length) {\n\t\t\tthis._n += 1;\n\t\t}\n\n\t\tthis._val = this._sum / this._n;\n\t\treturn this._val;\n\t}\n\n\tget value(): number {\n\t\treturn this._val;\n\t}\n}\n\n/** Returns whether the point is within the triangle formed by the following 6 x/y point pairs */\nexport function isPointWithinTriangle(\n\tx: number, y: number,\n\tax: number, ay: number,\n\tbx: number, by: number,\n\tcx: number, cy: number\n) {\n\tconst v0x = cx - ax;\n\tconst v0y = cy - ay;\n\tconst v1x = bx - ax;\n\tconst v1y = by - ay;\n\tconst v2x = x - ax;\n\tconst v2y = y - ay;\n\n\tconst dot00 = v0x * v0x + v0y * v0y;\n\tconst dot01 = v0x * v1x + v0y * v1y;\n\tconst dot02 = v0x * v2x + v0y * v2y;\n\tconst dot11 = v1x * v1x + v1y * v1y;\n\tconst dot12 = v1x * v2x + v1y * v2y;\n\n\tconst invDenom = 1 / (dot00 * dot11 - dot01 * dot01);\n\tconst u = (dot11 * dot02 - dot01 * dot12) * invDenom;\n\tconst v = (dot00 * dot12 - dot01 * dot02) * invDenom;\n\n\treturn u >= 0 && v >= 0 && u + v < 1;\n}\n\n/**\n * Function to get a (pseudo)random integer from a provided `max`...[`min`] range.\n * Both `min` and `max` values are inclusive. The `min` value is optional (defaults to `0`).\n *\n * @throws in the next cases:\n * \t- if provided `min` or `max` is not a number\n *  - if provided `min` or `max` is not finite\n *  - if provided `min` is larger than `max` value\n *\n * ## Examples\n *\n * Specifying a `max` value only uses `0` as the `min` value by default:\n *\n * ```typescript\n * // get a random integer between 0 and 10\n * const randomInt = randomInt(10);\n *\n * assert(\n *   randomInt >= 0,\n *   'Should be greater than or equal to 0.',\n * );\n *\n * assert(\n *   randomInt <= 10,\n *   'Should be less than or equal to 10.',\n * );\n * ```\n * * Specifying both `max` and `min` values:\n *\n * ```typescript\n * // get a random integer between 5 and 8\n * const randomInt = randomInt(8, 5);\n *\n * assert(\n *   randomInt >= 5,\n *   'Should be greater than or equal to 5.',\n * );\n *\n * assert(\n *   randomInt <= 8,\n *   'Should be less than or equal to 8.',\n * );\n * ```\n */\nexport function randomInt(max: number, min: number = 0): number {\n\tassert(!isNaN(min), '\"min\" param is not a number.');\n\tassert(!isNaN(max), '\"max\" param is not a number.');\n\n\tassert(isFinite(max), '\"max\" param is not finite.');\n\tassert(isFinite(min), '\"min\" param is not finite.');\n\n\tassert(max > min, `\"max\"(${max}) param should be greater than \"min\"(${min}).`);\n\n\tconst delta = max - min;\n\tconst randomFloat = delta * Math.random();\n\n\treturn Math.round(min + randomFloat);\n}\n\nexport function randomChance(p: number): boolean {\n\tassert(p >= 0 && p <= 1, 'p must be between 0 and 1');\n\treturn Math.random() < p;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { spawn } from 'child_process';\nimport { basename } from '../../../base/common/path.js';\nimport { localize } from '../../../nls.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../base/common/cancellation.js';\nimport { toErrorMessage } from '../../../base/common/errorMessage.js';\nimport { CancellationError, isCancellationError } from '../../../base/common/errors.js';\nimport { IProcessEnvironment, isWindows, OS } from '../../../base/common/platform.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { getSystemShell } from '../../../base/node/shell.js';\nimport { NativeParsedArgs } from '../../environment/common/argv.js';\nimport { isLaunchedFromCli } from '../../environment/node/argvHelper.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { Promises } from '../../../base/common/async.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { clamp } from '../../../base/common/numbers.js';\n\nlet unixShellEnvPromise: Promise<typeof process.env> | undefined = undefined;\n\n/**\n * Resolves the shell environment by spawning a shell. This call will cache\n * the shell spawning so that subsequent invocations use that cached result.\n *\n * Will throw an error if:\n * - we hit a timeout of `MAX_SHELL_RESOLVE_TIME`\n * - any other error from spawning a shell to figure out the environment\n */\nexport async function getResolvedShellEnv(configurationService: IConfigurationService, logService: ILogService, args: NativeParsedArgs, env: IProcessEnvironment): Promise<typeof process.env> {\n\n\t// Skip if --force-disable-user-env\n\tif (args['force-disable-user-env']) {\n\t\tlogService.trace('resolveShellEnv(): skipped (--force-disable-user-env)');\n\n\t\treturn {};\n\t}\n\n\t// Skip on windows\n\telse if (isWindows) {\n\t\tlogService.trace('resolveShellEnv(): skipped (Windows)');\n\n\t\treturn {};\n\t}\n\n\t// Skip if running from CLI already\n\telse if (isLaunchedFromCli(env) && !args['force-user-env']) {\n\t\tlogService.trace('resolveShellEnv(): skipped (VSCODE_CLI is set)');\n\n\t\treturn {};\n\t}\n\n\t// Otherwise resolve (macOS, Linux)\n\telse {\n\t\tif (isLaunchedFromCli(env)) {\n\t\t\tlogService.trace('resolveShellEnv(): running (--force-user-env)');\n\t\t} else {\n\t\t\tlogService.trace('resolveShellEnv(): running (macOS/Linux)');\n\t\t}\n\n\t\t// Call this only once and cache the promise for\n\t\t// subsequent calls since this operation can be\n\t\t// expensive (spawns a process).\n\t\tif (!unixShellEnvPromise) {\n\t\t\tunixShellEnvPromise = Promises.withAsyncBody<NodeJS.ProcessEnv>(async (resolve, reject) => {\n\t\t\t\tconst cts = new CancellationTokenSource();\n\n\t\t\t\tlet timeoutValue = 10000; // default to 10 seconds\n\t\t\t\tconst configuredTimeoutValue = configurationService.getValue<unknown>('application.shellEnvironmentResolutionTimeout');\n\t\t\t\tif (typeof configuredTimeoutValue === 'number') {\n\t\t\t\t\ttimeoutValue = clamp(configuredTimeoutValue, 1, 120) * 1000 /* convert from seconds */;\n\t\t\t\t}\n\n\t\t\t\t// Give up resolving shell env after some time\n\t\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\t\tcts.dispose(true);\n\t\t\t\t\treject(new Error(localize('resolveShellEnvTimeout', \"Unable to resolve your shell environment in a reasonable time. Please review your shell configuration and restart.\")));\n\t\t\t\t}, timeoutValue);\n\n\t\t\t\t// Resolve shell env and handle errors\n\t\t\t\ttry {\n\t\t\t\t\tresolve(await doResolveUnixShellEnv(logService, cts.token));\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!isCancellationError(error) && !cts.token.isCancellationRequested) {\n\t\t\t\t\t\treject(new Error(localize('resolveShellEnvError', \"Unable to resolve your shell environment: {0}\", toErrorMessage(error))));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresolve({});\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\tcts.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn unixShellEnvPromise;\n\t}\n}\n\nasync function doResolveUnixShellEnv(logService: ILogService, token: CancellationToken): Promise<typeof process.env> {\n\tconst runAsNode = process.env['ELECTRON_RUN_AS_NODE'];\n\tlogService.trace('getUnixShellEnvironment#runAsNode', runAsNode);\n\n\tconst noAttach = process.env['ELECTRON_NO_ATTACH_CONSOLE'];\n\tlogService.trace('getUnixShellEnvironment#noAttach', noAttach);\n\n\tconst mark = generateUuid().replace(/-/g, '').substr(0, 12);\n\tconst regex = new RegExp(mark + '({.*})' + mark);\n\n\tconst env = {\n\t\t...process.env,\n\t\tELECTRON_RUN_AS_NODE: '1',\n\t\tELECTRON_NO_ATTACH_CONSOLE: '1',\n\t\tVSCODE_RESOLVING_ENVIRONMENT: '1'\n\t};\n\n\tlogService.trace('getUnixShellEnvironment#env', env);\n\tconst systemShellUnix = await getSystemShell(OS, env);\n\tlogService.trace('getUnixShellEnvironment#shell', systemShellUnix);\n\n\treturn new Promise<typeof process.env>((resolve, reject) => {\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn reject(new CancellationError());\n\t\t}\n\n\t\t// handle popular non-POSIX shells\n\t\tconst name = basename(systemShellUnix);\n\t\tlet command: string, shellArgs: Array<string>;\n\t\tconst extraArgs = '';\n\t\tif (/^(?:pwsh|powershell)(?:-preview)?$/.test(name)) {\n\t\t\t// Older versions of PowerShell removes double quotes sometimes so we use \"double single quotes\" which is how\n\t\t\t// you escape single quotes inside of a single quoted string.\n\t\t\tcommand = `& '${process.execPath}' ${extraArgs} -p '''${mark}'' + JSON.stringify(process.env) + ''${mark}'''`;\n\t\t\tshellArgs = ['-Login', '-Command'];\n\t\t} else if (name === 'nu') { // nushell requires ^ before quoted path to treat it as a command\n\t\t\tcommand = `^'${process.execPath}' ${extraArgs} -p '\"${mark}\" + JSON.stringify(process.env) + \"${mark}\"'`;\n\t\t\tshellArgs = ['-i', '-l', '-c'];\n\t\t} else if (name === 'xonsh') { // #200374: native implementation is shorter\n\t\t\tcommand = `import os, json; print(\"${mark}\", json.dumps(dict(os.environ)), \"${mark}\")`;\n\t\t\tshellArgs = ['-i', '-l', '-c'];\n\t\t} else {\n\t\t\tcommand = `'${process.execPath}' ${extraArgs} -p '\"${mark}\" + JSON.stringify(process.env) + \"${mark}\"'`;\n\n\t\t\tif (name === 'tcsh' || name === 'csh') {\n\t\t\t\tshellArgs = ['-ic'];\n\t\t\t} else {\n\t\t\t\tshellArgs = ['-i', '-l', '-c'];\n\t\t\t}\n\t\t}\n\n\t\tlogService.trace('getUnixShellEnvironment#spawn', JSON.stringify(shellArgs), command);\n\n\t\tconst child = spawn(systemShellUnix, [...shellArgs, command], {\n\t\t\tdetached: true,\n\t\t\tstdio: ['ignore', 'pipe', 'pipe'],\n\t\t\tenv\n\t\t});\n\n\t\ttoken.onCancellationRequested(() => {\n\t\t\tchild.kill();\n\n\t\t\treturn reject(new CancellationError());\n\t\t});\n\n\t\tchild.on('error', err => {\n\t\t\tlogService.error('getUnixShellEnvironment#errorChildProcess', toErrorMessage(err));\n\t\t\treject(err);\n\t\t});\n\n\t\tconst buffers: Buffer[] = [];\n\t\tchild.stdout.on('data', b => buffers.push(b));\n\n\t\tconst stderr: Buffer[] = [];\n\t\tchild.stderr.on('data', b => stderr.push(b));\n\n\t\tchild.on('close', (code, signal) => {\n\t\t\tconst raw = Buffer.concat(buffers).toString('utf8');\n\t\t\tlogService.trace('getUnixShellEnvironment#raw', raw);\n\n\t\t\tconst stderrStr = Buffer.concat(stderr).toString('utf8');\n\t\t\tif (stderrStr.trim()) {\n\t\t\t\tlogService.trace('getUnixShellEnvironment#stderr', stderrStr);\n\t\t\t}\n\n\t\t\tif (code || signal) {\n\t\t\t\treturn reject(new Error(localize('resolveShellEnvExitError', \"Unexpected exit code from spawned shell (code {0}, signal {1})\", code, signal)));\n\t\t\t}\n\n\t\t\tconst match = regex.exec(raw);\n\t\t\tconst rawStripped = match ? match[1] : '{}';\n\n\t\t\ttry {\n\t\t\t\tconst env = JSON.parse(rawStripped);\n\n\t\t\t\tif (runAsNode) {\n\t\t\t\t\tenv['ELECTRON_RUN_AS_NODE'] = runAsNode;\n\t\t\t\t} else {\n\t\t\t\t\tdelete env['ELECTRON_RUN_AS_NODE'];\n\t\t\t\t}\n\n\t\t\t\tif (noAttach) {\n\t\t\t\t\tenv['ELECTRON_NO_ATTACH_CONSOLE'] = noAttach;\n\t\t\t\t} else {\n\t\t\t\t\tdelete env['ELECTRON_NO_ATTACH_CONSOLE'];\n\t\t\t\t}\n\n\t\t\t\tdelete env['VSCODE_RESOLVING_ENVIRONMENT'];\n\n\t\t\t\t// https://github.com/microsoft/vscode/issues/22593#issuecomment-336050758\n\t\t\t\tdelete env['XDG_RUNTIME_DIR'];\n\n\t\t\t\tlogService.trace('getUnixShellEnvironment#result', env);\n\t\t\t\tresolve(env);\n\t\t\t} catch (err) {\n\t\t\t\tlogService.error('getUnixShellEnvironment#errorCaught', toErrorMessage(err));\n\t\t\t\treject(err);\n\t\t\t}\n\t\t});\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { parse as parseUrl, Url } from 'url';\nimport { isBoolean } from '../../../base/common/types.js';\n\nexport type Agent = any;\n\nfunction getSystemProxyURI(requestURL: Url, env: typeof process.env): string | null {\n\tif (requestURL.protocol === 'http:') {\n\t\treturn env.HTTP_PROXY || env.http_proxy || null;\n\t} else if (requestURL.protocol === 'https:') {\n\t\treturn env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy || null;\n\t}\n\n\treturn null;\n}\n\nexport interface IOptions {\n\tproxyUrl?: string;\n\tstrictSSL?: boolean;\n}\n\nexport async function getProxyAgent(rawRequestURL: string, env: typeof process.env, options: IOptions = {}): Promise<Agent> {\n\tconst requestURL = parseUrl(rawRequestURL);\n\tconst proxyURL = options.proxyUrl || getSystemProxyURI(requestURL, env);\n\n\tif (!proxyURL) {\n\t\treturn null;\n\t}\n\n\tconst proxyEndpoint = parseUrl(proxyURL);\n\n\tif (!/^https?:$/.test(proxyEndpoint.protocol || '')) {\n\t\treturn null;\n\t}\n\n\tconst opts = {\n\t\thost: proxyEndpoint.hostname || '',\n\t\tport: (proxyEndpoint.port ? +proxyEndpoint.port : 0) || (proxyEndpoint.protocol === 'https' ? 443 : 80),\n\t\tauth: proxyEndpoint.auth,\n\t\trejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true,\n\t\tkeepAlive: true,\n\t};\n\n\tif (requestURL.protocol === 'http:') {\n\t\tconst { default: mod } = await import('http-proxy-agent');\n\t\treturn new mod.HttpProxyAgent(proxyURL, opts);\n\t} else {\n\t\tconst { default: mod } = await import('https-proxy-agent');\n\t\treturn new mod.HttpsProxyAgent(proxyURL, opts);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as http from 'http';\nimport * as https from 'https';\nimport { parse as parseUrl } from 'url';\nimport { Promises } from '../../../base/common/async.js';\nimport { streamToBufferReadableStream } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { CancellationError, getErrorMessage } from '../../../base/common/errors.js';\nimport * as streams from '../../../base/common/stream.js';\nimport { isBoolean, isNumber } from '../../../base/common/types.js';\nimport { IRequestContext, IRequestOptions } from '../../../base/parts/request/common/request.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { INativeEnvironmentService } from '../../environment/common/environment.js';\nimport { getResolvedShellEnv } from '../../shell/node/shellEnv.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { AbstractRequestService, AuthInfo, Credentials, IRequestService } from '../common/request.js';\nimport { Agent, getProxyAgent } from './proxy.js';\nimport { createGunzip } from 'zlib';\n\nexport interface IRawRequestFunction {\n\t(options: http.RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;\n}\n\nexport interface NodeRequestOptions extends IRequestOptions {\n\tagent?: Agent;\n\tstrictSSL?: boolean;\n\tisChromiumNetwork?: boolean;\n\tgetRawRequest?(options: IRequestOptions): IRawRequestFunction;\n}\n\n/**\n * This service exposes the `request` API, while using the global\n * or configured proxy settings.\n */\nexport class RequestService extends AbstractRequestService implements IRequestService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate proxyUrl?: string;\n\tprivate strictSSL: boolean | undefined;\n\tprivate authorization?: string;\n\tprivate shellEnvErrorLogged?: boolean;\n\n\tconstructor(\n\t\tprivate readonly machine: 'local' | 'remote',\n\t\t@IConfigurationService private readonly configurationService: IConfigurationService,\n\t\t@INativeEnvironmentService private readonly environmentService: INativeEnvironmentService,\n\t\t@ILogService logService: ILogService,\n\t) {\n\t\tsuper(logService);\n\t\tthis.configure();\n\t\tthis._register(configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('http')) {\n\t\t\t\tthis.configure();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate configure() {\n\t\tthis.proxyUrl = this.getConfigValue<string>('http.proxy');\n\t\tthis.strictSSL = !!this.getConfigValue<boolean>('http.proxyStrictSSL');\n\t\tthis.authorization = this.getConfigValue<string>('http.proxyAuthorization');\n\t}\n\n\tasync request(options: NodeRequestOptions, token: CancellationToken): Promise<IRequestContext> {\n\t\tconst { proxyUrl, strictSSL } = this;\n\n\t\tlet shellEnv: typeof process.env | undefined = undefined;\n\t\ttry {\n\t\t\tshellEnv = await getResolvedShellEnv(this.configurationService, this.logService, this.environmentService.args, process.env);\n\t\t} catch (error) {\n\t\t\tif (!this.shellEnvErrorLogged) {\n\t\t\t\tthis.shellEnvErrorLogged = true;\n\t\t\t\tthis.logService.error(`resolving shell environment failed`, getErrorMessage(error));\n\t\t\t}\n\t\t}\n\n\t\tconst env = {\n\t\t\t...process.env,\n\t\t\t...shellEnv\n\t\t};\n\t\tconst agent = options.agent ? options.agent : await getProxyAgent(options.url || '', env, { proxyUrl, strictSSL });\n\n\t\toptions.agent = agent;\n\t\toptions.strictSSL = strictSSL;\n\n\t\tif (this.authorization) {\n\t\t\toptions.headers = {\n\t\t\t\t...(options.headers || {}),\n\t\t\t\t'Proxy-Authorization': this.authorization\n\t\t\t};\n\t\t}\n\n\t\treturn this.logAndRequest(options, () => nodeRequest(options, token));\n\t}\n\n\tasync resolveProxy(url: string): Promise<string | undefined> {\n\t\treturn undefined; // currently not implemented in node\n\t}\n\n\tasync lookupAuthorization(authInfo: AuthInfo): Promise<Credentials | undefined> {\n\t\treturn undefined; // currently not implemented in node\n\t}\n\n\tasync lookupKerberosAuthorization(urlStr: string): Promise<string | undefined> {\n\t\ttry {\n\t\t\tconst spnConfig = this.getConfigValue<string>('http.proxyKerberosServicePrincipal');\n\t\t\tconst response = await lookupKerberosAuthorization(urlStr, spnConfig, this.logService, 'RequestService#lookupKerberosAuthorization');\n\t\t\treturn 'Negotiate ' + response;\n\t\t} catch (err) {\n\t\t\tthis.logService.debug('RequestService#lookupKerberosAuthorization Kerberos authentication failed', err);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tasync loadCertificates(): Promise<string[]> {\n\t\tconst proxyAgent = await import('@vscode/proxy-agent');\n\t\treturn proxyAgent.loadSystemCertificates({ log: this.logService });\n\t}\n\n\tprivate getConfigValue<T>(key: string): T | undefined {\n\t\tif (this.machine === 'remote') {\n\t\t\treturn this.configurationService.getValue<T>(key);\n\t\t}\n\t\tconst values = this.configurationService.inspect<T>(key);\n\t\treturn values.userLocalValue || values.defaultValue;\n\t}\n}\n\nexport async function lookupKerberosAuthorization(urlStr: string, spnConfig: string | undefined, logService: ILogService, logPrefix: string) {\n\tconst importKerberos = await import('kerberos');\n\tconst kerberos = importKerberos.default || importKerberos;\n\tconst url = new URL(urlStr);\n\tconst spn = spnConfig\n\t\t|| (process.platform === 'win32' ? `HTTP/${url.hostname}` : `HTTP@${url.hostname}`);\n\tlogService.debug(`${logPrefix} Kerberos authentication lookup`, `proxyURL:${url}`, `spn:${spn}`);\n\tconst client = await kerberos.initializeClient(spn);\n\treturn client.step('');\n}\n\nasync function getNodeRequest(options: IRequestOptions): Promise<IRawRequestFunction> {\n\tconst endpoint = parseUrl(options.url!);\n\tconst module = endpoint.protocol === 'https:' ? await import('https') : await import('http');\n\n\treturn module.request;\n}\n\nexport async function nodeRequest(options: NodeRequestOptions, token: CancellationToken): Promise<IRequestContext> {\n\treturn Promises.withAsyncBody<IRequestContext>(async (resolve, reject) => {\n\t\tconst endpoint = parseUrl(options.url!);\n\t\tconst rawRequest = options.getRawRequest\n\t\t\t? options.getRawRequest(options)\n\t\t\t: await getNodeRequest(options);\n\n\t\tconst opts: https.RequestOptions & { cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached' } = {\n\t\t\thostname: endpoint.hostname,\n\t\t\tport: endpoint.port ? parseInt(endpoint.port) : (endpoint.protocol === 'https:' ? 443 : 80),\n\t\t\tprotocol: endpoint.protocol,\n\t\t\tpath: endpoint.path,\n\t\t\tmethod: options.type || 'GET',\n\t\t\theaders: options.headers,\n\t\t\tagent: options.agent,\n\t\t\trejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true\n\t\t};\n\n\t\tif (options.user && options.password) {\n\t\t\topts.auth = options.user + ':' + options.password;\n\t\t}\n\n\t\tif (options.disableCache) {\n\t\t\topts.cache = 'no-store';\n\t\t}\n\n\t\tconst req = rawRequest(opts, (res: http.IncomingMessage) => {\n\t\t\tconst followRedirects: number = isNumber(options.followRedirects) ? options.followRedirects : 3;\n\t\t\tif (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers['location']) {\n\t\t\t\tnodeRequest({\n\t\t\t\t\t...options,\n\t\t\t\t\turl: res.headers['location'],\n\t\t\t\t\tfollowRedirects: followRedirects - 1\n\t\t\t\t}, token).then(resolve, reject);\n\t\t\t} else {\n\t\t\t\tlet stream: streams.ReadableStreamEvents<Uint8Array> = res;\n\n\t\t\t\t// Responses from Electron net module should be treated as response\n\t\t\t\t// from browser, which will apply gzip filter and decompress the response\n\t\t\t\t// using zlib before passing the result to us. Following step can be bypassed\n\t\t\t\t// in this case and proceed further.\n\t\t\t\t// Refs https://source.chromium.org/chromium/chromium/src/+/main:net/url_request/url_request_http_job.cc;l=1266-1318\n\t\t\t\tif (!options.isChromiumNetwork && res.headers['content-encoding'] === 'gzip') {\n\t\t\t\t\tstream = res.pipe(createGunzip());\n\t\t\t\t}\n\n\t\t\t\tresolve({ res, stream: streamToBufferReadableStream(stream) } satisfies IRequestContext);\n\t\t\t}\n\t\t});\n\n\t\treq.on('error', reject);\n\n\t\t// Handle timeout\n\t\tif (options.timeout) {\n\t\t\t// Chromium network requests do not support the `timeout` option\n\t\t\tif (options.isChromiumNetwork) {\n\t\t\t\t// Use Node's setTimeout for Chromium network requests\n\t\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\t\treq.abort();\n\t\t\t\t\treject(new Error(`Request timeout after ${options.timeout}ms`));\n\t\t\t\t}, options.timeout);\n\n\t\t\t\t// Clear timeout when request completes\n\t\t\t\treq.on('response', () => clearTimeout(timeout));\n\t\t\t\treq.on('error', () => clearTimeout(timeout));\n\t\t\t\treq.on('abort', () => clearTimeout(timeout));\n\t\t\t} else {\n\t\t\t\treq.setTimeout(options.timeout);\n\t\t\t}\n\t\t}\n\n\t\t// Chromium will abort the request if forbidden headers are set.\n\t\t// Ref https://source.chromium.org/chromium/chromium/src/+/main:services/network/public/cpp/header_util.cc;l=14-48;\n\t\t// for additional context.\n\t\tif (options.isChromiumNetwork) {\n\t\t\treq.removeHeader('Content-Length');\n\t\t}\n\n\t\tif (options.data) {\n\t\t\tif (typeof options.data === 'string') {\n\t\t\t\treq.write(options.data);\n\t\t\t}\n\t\t}\n\n\t\treq.end();\n\n\t\ttoken.onCancellationRequested(() => {\n\t\t\treq.abort();\n\n\t\t\treject(new CancellationError());\n\t\t});\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Schemas } from '../../../base/common/network.js';\nimport { URI } from '../../../base/common/uri.js';\n\nexport function getRemoteAuthority(uri: URI): string | undefined {\n\treturn uri.scheme === Schemas.vscodeRemote ? uri.authority : undefined;\n}\n\nexport function getRemoteName(authority: string): string;\nexport function getRemoteName(authority: undefined): undefined;\nexport function getRemoteName(authority: string | undefined): string | undefined;\nexport function getRemoteName(authority: string | undefined): string | undefined {\n\tif (!authority) {\n\t\treturn undefined;\n\t}\n\tconst pos = authority.indexOf('+');\n\tif (pos < 0) {\n\t\t// e.g. localhost:8000\n\t\treturn authority;\n\t}\n\treturn authority.substr(0, pos);\n}\n\nexport function parseAuthorityWithPort(authority: string): { host: string; port: number } {\n\tconst { host, port } = parseAuthority(authority);\n\tif (typeof port === 'undefined') {\n\t\tthrow new Error(`Invalid remote authority: ${authority}. It must either be a remote of form <remoteName>+<arg> or a remote host of form <host>:<port>.`);\n\t}\n\treturn { host, port };\n}\n\nexport function parseAuthorityWithOptionalPort(authority: string, defaultPort: number): { host: string; port: number } {\n\tlet { host, port } = parseAuthority(authority);\n\tif (typeof port === 'undefined') {\n\t\tport = defaultPort;\n\t}\n\treturn { host, port };\n}\n\nfunction parseAuthority(authority: string): { host: string; port: number | undefined } {\n\t// check for ipv6 with port\n\tconst m1 = authority.match(/^(\\[[0-9a-z:]+\\]):(\\d+)$/);\n\tif (m1) {\n\t\treturn { host: m1[1], port: parseInt(m1[2], 10) };\n\t}\n\n\t// check for ipv6 without port\n\tconst m2 = authority.match(/^(\\[[0-9a-z:]+\\])$/);\n\tif (m2) {\n\t\treturn { host: m2[1], port: undefined };\n\t}\n\n\t// anything with a trailing port\n\tconst m3 = authority.match(/(.*):(\\d+)$/);\n\tif (m3) {\n\t\treturn { host: m3[1], port: parseInt(m3[2], 10) };\n\t}\n\n\t// doesn't contain a port\n\treturn { host: authority, port: undefined };\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { isLinuxSnap, platform, Platform, PlatformToString } from '../../../base/common/platform.js';\nimport { env, platform as nodePlatform } from '../../../base/common/process.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { ICommonProperties } from './telemetry.js';\n\nfunction getPlatformDetail(hostname: string): string | undefined {\n\tif (platform === Platform.Linux && /^penguin(\\.|$)/i.test(hostname)) {\n\t\treturn 'chromebook';\n\t}\n\n\treturn undefined;\n}\n\nexport function resolveCommonProperties(\n\trelease: string,\n\thostname: string,\n\tarch: string,\n\tcommit: string | undefined,\n\tversion: string | undefined,\n\tmachineId: string | undefined,\n\tsqmId: string | undefined,\n\tdevDeviceId: string | undefined,\n\tisInternalTelemetry: boolean,\n\treleaseDate: string | undefined,\n\tproduct?: string,\n): ICommonProperties {\n\tconst result: ICommonProperties = Object.create(null);\n\n\t// __GDPR__COMMON__ \"common.machineId\" : { \"endPoint\": \"MacAddressHash\", \"classification\": \"EndUserPseudonymizedInformation\", \"purpose\": \"FeatureInsight\" }\n\tresult['common.machineId'] = machineId;\n\t// __GDPR__COMMON__ \"common.sqmId\" : { \"endPoint\": \"SqmMachineId\", \"classification\": \"EndUserPseudonymizedInformation\", \"purpose\": \"BusinessInsight\" }\n\tresult['common.sqmId'] = sqmId;\n\t// __GDPR__COMMON__ \"common.devDeviceId\" : { \"endPoint\": \"SqmMachineId\", \"classification\": \"EndUserPseudonymizedInformation\", \"purpose\": \"BusinessInsight\" }\n\tresult['common.devDeviceId'] = devDeviceId;\n\t// __GDPR__COMMON__ \"sessionID\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\tresult['sessionID'] = generateUuid() + Date.now();\n\t// __GDPR__COMMON__ \"commitHash\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\" }\n\tresult['commitHash'] = commit;\n\t// __GDPR__COMMON__ \"version\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\tresult['version'] = version;\n\t// __GDPR__COMMON__ \"common.releaseDate\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\tresult['common.releaseDate'] = releaseDate;\n\t// __GDPR__COMMON__ \"common.platformVersion\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\tresult['common.platformVersion'] = (release || '').replace(/^(\\d+)(\\.\\d+)?(\\.\\d+)?(.*)/, '$1$2$3');\n\t// __GDPR__COMMON__ \"common.platform\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\tresult['common.platform'] = PlatformToString(platform);\n\t// __GDPR__COMMON__ \"common.nodePlatform\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\" }\n\tresult['common.nodePlatform'] = nodePlatform;\n\t// __GDPR__COMMON__ \"common.nodeArch\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\" }\n\tresult['common.nodeArch'] = arch;\n\t// __GDPR__COMMON__ \"common.product\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\" }\n\tresult['common.product'] = product || 'desktop';\n\n\tif (isInternalTelemetry) {\n\t\t// __GDPR__COMMON__ \"common.msftInternal\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\", \"isMeasurement\": true }\n\t\tresult['common.msftInternal'] = isInternalTelemetry;\n\t}\n\n\t// dynamic properties which value differs on each call\n\tlet seq = 0;\n\tconst startTime = Date.now();\n\tObject.defineProperties(result, {\n\t\t// __GDPR__COMMON__ \"timestamp\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\t\t'timestamp': {\n\t\t\tget: () => new Date(),\n\t\t\tenumerable: true\n\t\t},\n\t\t// __GDPR__COMMON__ \"common.timesincesessionstart\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\", \"isMeasurement\": true }\n\t\t'common.timesincesessionstart': {\n\t\t\tget: () => Date.now() - startTime,\n\t\t\tenumerable: true\n\t\t},\n\t\t// __GDPR__COMMON__ \"common.sequence\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\", \"isMeasurement\": true }\n\t\t'common.sequence': {\n\t\t\tget: () => seq++,\n\t\t\tenumerable: true\n\t\t}\n\t});\n\n\tif (isLinuxSnap) {\n\t\t// __GDPR__COMMON__ \"common.snap\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\t\tresult['common.snap'] = 'true';\n\t}\n\n\tconst platformDetail = getPlatformDetail(hostname);\n\n\tif (platformDetail) {\n\t\t// __GDPR__COMMON__ \"common.platformDetail\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\t\tresult['common.platformDetail'] = platformDetail;\n\t}\n\n\treturn result;\n}\n\nexport function verifyMicrosoftInternalDomain(domainList: readonly string[]): boolean {\n\tconst userDnsDomain = env['USERDNSDOMAIN'];\n\tif (!userDnsDomain) {\n\t\treturn false;\n\t}\n\n\tconst domain = userDnsDomain.toLowerCase();\n\treturn domainList.some(msftDomain => domain === msftDomain);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { ClassifiedEvent, IGDPRProperty, OmitMetadata, StrictPropertyCheck } from './gdprTypings.js';\n\nexport const ITelemetryService = createDecorator<ITelemetryService>('telemetryService');\n\nexport interface ITelemetryData {\n\tfrom?: string;\n\ttarget?: string;\n\t[key: string]: any;\n}\n\nexport interface ITelemetryService {\n\n\treadonly _serviceBrand: undefined;\n\n\treadonly telemetryLevel: TelemetryLevel;\n\n\treadonly sessionId: string;\n\treadonly machineId: string;\n\treadonly sqmId: string;\n\treadonly devDeviceId: string;\n\treadonly firstSessionDate: string;\n\treadonly msftInternal?: boolean;\n\n\t/**\n\t * Whether error telemetry will get sent. If false, `publicLogError` will no-op.\n\t */\n\treadonly sendErrorTelemetry: boolean;\n\n\t/**\n\t * @deprecated Use publicLog2 and the typescript GDPR annotation where possible\n\t */\n\tpublicLog(eventName: string, data?: ITelemetryData): void;\n\n\t/**\n\t * Sends a telemetry event that has been privacy approved.\n\t * Do not call this unless you have been given approval.\n\t */\n\tpublicLog2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>): void;\n\n\t/**\n\t * @deprecated Use publicLogError2 and the typescript GDPR annotation where possible\n\t */\n\tpublicLogError(errorEventName: string, data?: ITelemetryData): void;\n\n\tpublicLogError2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>): void;\n\n\tsetExperimentProperty(name: string, value: string): void;\n}\n\nexport function telemetryLevelEnabled(service: ITelemetryService, level: TelemetryLevel): boolean {\n\treturn service.telemetryLevel >= level;\n}\n\nexport interface ITelemetryEndpoint {\n\tid: string;\n\taiKey: string;\n\tsendErrorTelemetry: boolean;\n}\n\nexport const ICustomEndpointTelemetryService = createDecorator<ICustomEndpointTelemetryService>('customEndpointTelemetryService');\n\nexport interface ICustomEndpointTelemetryService {\n\treadonly _serviceBrand: undefined;\n\n\tpublicLog(endpoint: ITelemetryEndpoint, eventName: string, data?: ITelemetryData): void;\n\tpublicLogError(endpoint: ITelemetryEndpoint, errorEventName: string, data?: ITelemetryData): void;\n}\n\n// Keys\nexport const currentSessionDateStorageKey = 'telemetry.currentSessionDate';\nexport const firstSessionDateStorageKey = 'telemetry.firstSessionDate';\nexport const lastSessionDateStorageKey = 'telemetry.lastSessionDate';\nexport const machineIdKey = 'telemetry.machineId';\nexport const sqmIdKey = 'telemetry.sqmId';\nexport const devDeviceIdKey = 'telemetry.devDeviceId';\n\n// Configuration Keys\nexport const TELEMETRY_SECTION_ID = 'telemetry';\nexport const TELEMETRY_SETTING_ID = 'telemetry.telemetryLevel';\nexport const TELEMETRY_CRASH_REPORTER_SETTING_ID = 'telemetry.enableCrashReporter';\nexport const TELEMETRY_OLD_SETTING_ID = 'telemetry.enableTelemetry';\n\nexport const enum TelemetryLevel {\n\tNONE = 0,\n\tCRASH = 1,\n\tERROR = 2,\n\tUSAGE = 3\n}\n\nexport const enum TelemetryConfiguration {\n\tOFF = 'off',\n\tCRASH = 'crash',\n\tERROR = 'error',\n\tON = 'all'\n}\n\nexport interface ICommonProperties {\n\t[name: string]: string | boolean | undefined;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { cloneAndChange, safeStringify } from '../../../base/common/objects.js';\nimport { isObject } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { LoggerGroup } from '../../log/common/log.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { getRemoteName } from '../../remote/common/remoteHosts.js';\nimport { verifyMicrosoftInternalDomain } from './commonProperties.js';\nimport { ICustomEndpointTelemetryService, ITelemetryData, ITelemetryEndpoint, ITelemetryService, TelemetryConfiguration, TelemetryLevel, TELEMETRY_CRASH_REPORTER_SETTING_ID, TELEMETRY_OLD_SETTING_ID, TELEMETRY_SETTING_ID } from './telemetry.js';\n\n/**\n * A special class used to denoting a telemetry value which should not be clean.\n * This is because that value is \"Trusted\" not to contain identifiable information such as paths.\n * NOTE: This is used as an API type as well, and should not be changed.\n */\nexport class TelemetryTrustedValue<T> {\n\t// This is merely used as an identifier as the instance will be lost during serialization over the exthost\n\tpublic readonly isTrustedTelemetryValue = true;\n\tconstructor(public readonly value: T) { }\n}\n\nexport class NullTelemetryServiceShape implements ITelemetryService {\n\tdeclare readonly _serviceBrand: undefined;\n\treadonly telemetryLevel = TelemetryLevel.NONE;\n\treadonly sessionId = 'someValue.sessionId';\n\treadonly machineId = 'someValue.machineId';\n\treadonly sqmId = 'someValue.sqmId';\n\treadonly devDeviceId = 'someValue.devDeviceId';\n\treadonly firstSessionDate = 'someValue.firstSessionDate';\n\treadonly sendErrorTelemetry = false;\n\tpublicLog() { }\n\tpublicLog2() { }\n\tpublicLogError() { }\n\tpublicLogError2() { }\n\tsetExperimentProperty() { }\n}\n\nexport const NullTelemetryService = new NullTelemetryServiceShape();\n\nexport class NullEndpointTelemetryService implements ICustomEndpointTelemetryService {\n\t_serviceBrand: undefined;\n\n\tasync publicLog(_endpoint: ITelemetryEndpoint, _eventName: string, _data?: ITelemetryData): Promise<void> {\n\t\t// noop\n\t}\n\n\tasync publicLogError(_endpoint: ITelemetryEndpoint, _errorEventName: string, _data?: ITelemetryData): Promise<void> {\n\t\t// noop\n\t}\n}\n\nexport const telemetryLogId = 'telemetry';\nexport const TelemetryLogGroup: LoggerGroup = { id: telemetryLogId, name: localize('telemetryLogName', \"Telemetry\") };\n\nexport interface ITelemetryAppender {\n\tlog(eventName: string, data: any): void;\n\tflush(): Promise<void>;\n}\n\nexport const NullAppender: ITelemetryAppender = { log: () => null, flush: () => Promise.resolve(undefined) };\n\n\n/* __GDPR__FRAGMENT__\n\t\"URIDescriptor\" : {\n\t\t\"mimeType\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"scheme\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"ext\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"path\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\t}\n*/\nexport interface URIDescriptor {\n\tmimeType?: string;\n\tscheme?: string;\n\text?: string;\n\tpath?: string;\n}\n\n/**\n * Determines whether or not we support logging telemetry.\n * This checks if the product is capable of collecting telemetry but not whether or not it can send it\n * For checking the user setting and what telemetry you can send please check `getTelemetryLevel`.\n * This returns true if `--disable-telemetry` wasn't used, the product.json allows for telemetry, and we're not testing an extension\n * If false telemetry is disabled throughout the product\n * @param productService\n * @param environmentService\n * @returns false - telemetry is completely disabled, true - telemetry is logged locally, but may not be sent\n */\nexport function supportsTelemetry(productService: IProductService, environmentService: IEnvironmentService): boolean {\n\t// If it's OSS and telemetry isn't disabled via the CLI we will allow it for logging only purposes\n\tif (!environmentService.isBuilt && !environmentService.disableTelemetry) {\n\t\treturn true;\n\t}\n\treturn !(environmentService.disableTelemetry || !productService.enableTelemetry);\n}\n\n/**\n * Checks to see if we're in logging only mode to debug telemetry.\n * This is if telemetry is enabled and we're in OSS, but no telemetry key is provided so it's not being sent just logged.\n * @param productService\n * @param environmentService\n * @returns True if telemetry is actually disabled and we're only logging for debug purposes\n */\nexport function isLoggingOnly(productService: IProductService, environmentService: IEnvironmentService): boolean {\n\t// If we're testing an extension, log telemetry for debug purposes\n\tif (environmentService.extensionTestsLocationURI) {\n\t\treturn true;\n\t}\n\t// Logging only mode is only for OSS\n\tif (environmentService.isBuilt) {\n\t\treturn false;\n\t}\n\n\tif (environmentService.disableTelemetry) {\n\t\treturn false;\n\t}\n\n\tif (productService.enableTelemetry && productService.aiConfig?.ariaKey) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Determines how telemetry is handled based on the user's configuration.\n *\n * @param configurationService\n * @returns OFF, ERROR, ON\n */\nexport function getTelemetryLevel(configurationService: IConfigurationService): TelemetryLevel {\n\tconst newConfig = configurationService.getValue<TelemetryConfiguration>(TELEMETRY_SETTING_ID);\n\tconst crashReporterConfig = configurationService.getValue<boolean | undefined>(TELEMETRY_CRASH_REPORTER_SETTING_ID);\n\tconst oldConfig = configurationService.getValue<boolean | undefined>(TELEMETRY_OLD_SETTING_ID);\n\n\t// If `telemetry.enableCrashReporter` is false or `telemetry.enableTelemetry' is false, disable telemetry\n\tif (oldConfig === false || crashReporterConfig === false) {\n\t\treturn TelemetryLevel.NONE;\n\t}\n\n\t// Maps new telemetry setting to a telemetry level\n\tswitch (newConfig ?? TelemetryConfiguration.ON) {\n\t\tcase TelemetryConfiguration.ON:\n\t\t\treturn TelemetryLevel.USAGE;\n\t\tcase TelemetryConfiguration.ERROR:\n\t\t\treturn TelemetryLevel.ERROR;\n\t\tcase TelemetryConfiguration.CRASH:\n\t\t\treturn TelemetryLevel.CRASH;\n\t\tcase TelemetryConfiguration.OFF:\n\t\t\treturn TelemetryLevel.NONE;\n\t}\n}\n\nexport interface Properties {\n\t[key: string]: string;\n}\n\nexport interface Measurements {\n\t[key: string]: number;\n}\n\nexport function validateTelemetryData(data?: any): { properties: Properties; measurements: Measurements } {\n\n\tconst properties: Properties = {};\n\tconst measurements: Measurements = {};\n\n\tconst flat: Record<string, any> = {};\n\tflatten(data, flat);\n\n\tfor (let prop in flat) {\n\t\t// enforce property names less than 150 char, take the last 150 char\n\t\tprop = prop.length > 150 ? prop.substr(prop.length - 149) : prop;\n\t\tconst value = flat[prop];\n\n\t\tif (typeof value === 'number') {\n\t\t\tmeasurements[prop] = value;\n\n\t\t} else if (typeof value === 'boolean') {\n\t\t\tmeasurements[prop] = value ? 1 : 0;\n\n\t\t} else if (typeof value === 'string') {\n\t\t\tif (value.length > 8192) {\n\t\t\t\tconsole.warn(`Telemetry property: ${prop} has been trimmed to 8192, the original length is ${value.length}`);\n\t\t\t}\n\t\t\t//enforce property value to be less than 8192 char, take the first 8192 char\n\t\t\t// https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#limits\n\t\t\tproperties[prop] = value.substring(0, 8191);\n\n\t\t} else if (typeof value !== 'undefined' && value !== null) {\n\t\t\tproperties[prop] = value;\n\t\t}\n\t}\n\n\treturn {\n\t\tproperties,\n\t\tmeasurements\n\t};\n}\n\nconst telemetryAllowedAuthorities = new Set(['ssh-remote', 'dev-container', 'attached-container', 'wsl', 'tunnel', 'codespaces', 'amlext']);\n\nexport function cleanRemoteAuthority(remoteAuthority?: string): string {\n\tif (!remoteAuthority) {\n\t\treturn 'none';\n\t}\n\tconst remoteName = getRemoteName(remoteAuthority);\n\treturn telemetryAllowedAuthorities.has(remoteName) ? remoteName : 'other';\n}\n\nfunction flatten(obj: any, result: { [key: string]: any }, order: number = 0, prefix?: string): void {\n\tif (!obj) {\n\t\treturn;\n\t}\n\n\tfor (const item of Object.getOwnPropertyNames(obj)) {\n\t\tconst value = obj[item];\n\t\tconst index = prefix ? prefix + item : item;\n\n\t\tif (Array.isArray(value)) {\n\t\t\tresult[index] = safeStringify(value);\n\n\t\t} else if (value instanceof Date) {\n\t\t\t// TODO unsure why this is here and not in _getData\n\t\t\tresult[index] = value.toISOString();\n\n\t\t} else if (isObject(value)) {\n\t\t\tif (order < 2) {\n\t\t\t\tflatten(value, result, order + 1, index + '.');\n\t\t\t} else {\n\t\t\t\tresult[index] = safeStringify(value);\n\t\t\t}\n\t\t} else {\n\t\t\tresult[index] = value;\n\t\t}\n\t}\n}\n\n/**\n * Whether or not this is an internal user\n * @param productService The product service\n * @param configService The config servivce\n * @returns true if internal, false otherwise\n */\nexport function isInternalTelemetry(productService: IProductService, configService: IConfigurationService) {\n\tconst msftInternalDomains = productService.msftInternalDomains || [];\n\tconst internalTesting = configService.getValue<boolean>('telemetry.internalTesting');\n\treturn verifyMicrosoftInternalDomain(msftInternalDomains) || internalTesting;\n}\n\ninterface IPathEnvironment {\n\tappRoot: string;\n\textensionsPath: string;\n\tuserDataPath: string;\n\tuserHome: URI;\n\ttmpDir: URI;\n}\n\nexport function getPiiPathsFromEnvironment(paths: IPathEnvironment): string[] {\n\treturn [paths.appRoot, paths.extensionsPath, paths.userHome.fsPath, paths.tmpDir.fsPath, paths.userDataPath];\n}\n\n//#region Telemetry Cleaning\n\n/**\n * Cleans a given stack of possible paths\n * @param stack The stack to sanitize\n * @param cleanupPatterns Cleanup patterns to remove from the stack\n * @returns The cleaned stack\n */\nfunction anonymizeFilePaths(stack: string, cleanupPatterns: RegExp[]): string {\n\n\t// Fast check to see if it is a file path to avoid doing unnecessary heavy regex work\n\tif (!stack || (!stack.includes('/') && !stack.includes('\\\\'))) {\n\t\treturn stack;\n\t}\n\n\tlet updatedStack = stack;\n\n\tconst cleanUpIndexes: [number, number][] = [];\n\tfor (const regexp of cleanupPatterns) {\n\t\twhile (true) {\n\t\t\tconst result = regexp.exec(stack);\n\t\t\tif (!result) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcleanUpIndexes.push([result.index, regexp.lastIndex]);\n\t\t}\n\t}\n\n\tconst nodeModulesRegex = /^[\\\\\\/]?(node_modules|node_modules\\.asar)[\\\\\\/]/;\n\tconst fileRegex = /(file:\\/\\/)?([a-zA-Z]:(\\\\\\\\|\\\\|\\/)|(\\\\\\\\|\\\\|\\/))?([\\w-\\._]+(\\\\\\\\|\\\\|\\/))+[\\w-\\._]*/g;\n\tlet lastIndex = 0;\n\tupdatedStack = '';\n\n\twhile (true) {\n\t\tconst result = fileRegex.exec(stack);\n\t\tif (!result) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// Check to see if the any cleanupIndexes partially overlap with this match\n\t\tconst overlappingRange = cleanUpIndexes.some(([start, end]) => result.index < end && start < fileRegex.lastIndex);\n\n\t\t// anoynimize user file paths that do not need to be retained or cleaned up.\n\t\tif (!nodeModulesRegex.test(result[0]) && !overlappingRange) {\n\t\t\tupdatedStack += stack.substring(lastIndex, result.index) + '<REDACTED: user-file-path>';\n\t\t\tlastIndex = fileRegex.lastIndex;\n\t\t}\n\t}\n\tif (lastIndex < stack.length) {\n\t\tupdatedStack += stack.substr(lastIndex);\n\t}\n\n\treturn updatedStack;\n}\n\n/**\n * Attempts to remove commonly leaked PII\n * @param property The property which will be removed if it contains user data\n * @returns The new value for the property\n */\nfunction removePropertiesWithPossibleUserInfo(property: string): string {\n\t// If for some reason it is undefined we skip it (this shouldn't be possible);\n\tif (!property) {\n\t\treturn property;\n\t}\n\n\tconst userDataRegexes = [\n\t\t{ label: 'Google API Key', regex: /AIza[A-Za-z0-9_\\\\\\-]{35}/ },\n\t\t{ label: 'JWT', regex: /eyJ[0eXAiOiJKV1Qi|hbGci|a-zA-Z0-9\\-_]+\\.[a-zA-Z0-9\\-_]+\\.[a-zA-Z0-9\\-_]+/ },\n\t\t{ label: 'Slack Token', regex: /xox[pbar]\\-[A-Za-z0-9]/ },\n\t\t{ label: 'GitHub Token', regex: /(gh[psuro]_[a-zA-Z0-9]{36}|github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59})/ },\n\t\t{ label: 'Generic Secret', regex: /(key|token|sig|secret|signature|password|passwd|pwd|android:value)[^a-zA-Z0-9]/i },\n\t\t{ label: 'CLI Credentials', regex: /((login|psexec|(certutil|psexec)\\.exe).{1,50}(\\s-u(ser(name)?)?\\s+.{3,100})?\\s-(admin|user|vm|root)?p(ass(word)?)?\\s+[\"']?[^$\\-\\/\\s]|(^|[\\s\\r\\n\\\\])net(\\.exe)?.{1,5}(user\\s+|share\\s+\\/user:| user -? secrets ? set) \\s + [^ $\\s \\/])/ },\n\t\t{ label: 'Microsoft Entra ID', regex: /eyJ(?:0eXAiOiJKV1Qi|hbGci|[a-zA-Z0-9\\-_]+\\.[a-zA-Z0-9\\-_]+\\.)/ },\n\t\t{ label: 'Email', regex: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/ }\n\t];\n\n\t// Check for common user data in the telemetry events\n\tfor (const secretRegex of userDataRegexes) {\n\t\tif (secretRegex.regex.test(property)) {\n\t\t\treturn `<REDACTED: ${secretRegex.label}>`;\n\t\t}\n\t}\n\n\treturn property;\n}\n\n\n/**\n * Does a best possible effort to clean a data object from any possible PII.\n * @param data The data object to clean\n * @param paths Any additional patterns that should be removed from the data set\n * @returns A new object with the PII removed\n */\nexport function cleanData(data: Record<string, any>, cleanUpPatterns: RegExp[]): Record<string, any> {\n\treturn cloneAndChange(data, value => {\n\n\t\t// If it's a trusted value it means it's okay to skip cleaning so we don't clean it\n\t\tif (value instanceof TelemetryTrustedValue || Object.hasOwnProperty.call(value, 'isTrustedTelemetryValue')) {\n\t\t\treturn value.value;\n\t\t}\n\n\t\t// We only know how to clean strings\n\t\tif (typeof value === 'string') {\n\t\t\tlet updatedProperty = value.replaceAll('%20', ' ');\n\n\t\t\t// First we anonymize any possible file paths\n\t\t\tupdatedProperty = anonymizeFilePaths(updatedProperty, cleanUpPatterns);\n\n\t\t\t// Then we do a simple regex replace with the defined patterns\n\t\t\tfor (const regexp of cleanUpPatterns) {\n\t\t\t\tupdatedProperty = updatedProperty.replace(regexp, '');\n\t\t\t}\n\n\t\t\t// Lastly, remove commonly leaked PII\n\t\t\tupdatedProperty = removePropertiesWithPossibleUserInfo(updatedProperty);\n\n\t\t\treturn updatedProperty;\n\t\t}\n\t\treturn undefined;\n\t});\n}\n\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { Event } from '../../../base/common/event.js';\nimport { IMarkdownString } from '../../../base/common/htmlContent.js';\nimport { IPager } from '../../../base/common/paging.js';\nimport { Platform } from '../../../base/common/platform.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize, localize2 } from '../../../nls.js';\nimport { ConfigurationScope, Extensions, IConfigurationRegistry } from '../../configuration/common/configurationRegistry.js';\nimport { ExtensionType, IExtension, IExtensionManifest, TargetPlatform } from '../../extensions/common/extensions.js';\nimport { FileOperationError, FileOperationResult, IFileService, IFileStat } from '../../files/common/files.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport { IExtensionGalleryManifest } from './extensionGalleryManifest.js';\n\nexport const EXTENSION_IDENTIFIER_PATTERN = '^([a-z0-9A-Z][a-z0-9-A-Z]*)\\\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$';\nexport const EXTENSION_IDENTIFIER_REGEX = new RegExp(EXTENSION_IDENTIFIER_PATTERN);\nexport const WEB_EXTENSION_TAG = '__web_extension';\nexport const EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT = 'skipWalkthrough';\nexport const EXTENSION_INSTALL_SKIP_PUBLISHER_TRUST_CONTEXT = 'skipPublisherTrust';\nexport const EXTENSION_INSTALL_SOURCE_CONTEXT = 'extensionInstallSource';\nexport const EXTENSION_INSTALL_DEP_PACK_CONTEXT = 'dependecyOrPackExtensionInstall';\nexport const EXTENSION_INSTALL_CLIENT_TARGET_PLATFORM_CONTEXT = 'clientTargetPlatform';\n\nexport const enum ExtensionInstallSource {\n\tCOMMAND = 'command',\n\tSETTINGS_SYNC = 'settingsSync',\n}\n\nexport interface IProductVersion {\n\treadonly version: string;\n\treadonly date?: string;\n}\n\nexport function TargetPlatformToString(targetPlatform: TargetPlatform) {\n\tswitch (targetPlatform) {\n\t\tcase TargetPlatform.WIN32_X64: return 'Windows 64 bit';\n\t\tcase TargetPlatform.WIN32_ARM64: return 'Windows ARM';\n\n\t\tcase TargetPlatform.LINUX_X64: return 'Linux 64 bit';\n\t\tcase TargetPlatform.LINUX_ARM64: return 'Linux ARM 64';\n\t\tcase TargetPlatform.LINUX_ARMHF: return 'Linux ARM';\n\n\t\tcase TargetPlatform.ALPINE_X64: return 'Alpine Linux 64 bit';\n\t\tcase TargetPlatform.ALPINE_ARM64: return 'Alpine ARM 64';\n\n\t\tcase TargetPlatform.DARWIN_X64: return 'Mac';\n\t\tcase TargetPlatform.DARWIN_ARM64: return 'Mac Silicon';\n\n\t\tcase TargetPlatform.WEB: return 'Web';\n\n\t\tcase TargetPlatform.UNIVERSAL: return TargetPlatform.UNIVERSAL;\n\t\tcase TargetPlatform.UNKNOWN: return TargetPlatform.UNKNOWN;\n\t\tcase TargetPlatform.UNDEFINED: return TargetPlatform.UNDEFINED;\n\t}\n}\n\nexport function toTargetPlatform(targetPlatform: string): TargetPlatform {\n\tswitch (targetPlatform) {\n\t\tcase TargetPlatform.WIN32_X64: return TargetPlatform.WIN32_X64;\n\t\tcase TargetPlatform.WIN32_ARM64: return TargetPlatform.WIN32_ARM64;\n\n\t\tcase TargetPlatform.LINUX_X64: return TargetPlatform.LINUX_X64;\n\t\tcase TargetPlatform.LINUX_ARM64: return TargetPlatform.LINUX_ARM64;\n\t\tcase TargetPlatform.LINUX_ARMHF: return TargetPlatform.LINUX_ARMHF;\n\n\t\tcase TargetPlatform.ALPINE_X64: return TargetPlatform.ALPINE_X64;\n\t\tcase TargetPlatform.ALPINE_ARM64: return TargetPlatform.ALPINE_ARM64;\n\n\t\tcase TargetPlatform.DARWIN_X64: return TargetPlatform.DARWIN_X64;\n\t\tcase TargetPlatform.DARWIN_ARM64: return TargetPlatform.DARWIN_ARM64;\n\n\t\tcase TargetPlatform.WEB: return TargetPlatform.WEB;\n\n\t\tcase TargetPlatform.UNIVERSAL: return TargetPlatform.UNIVERSAL;\n\t\tdefault: return TargetPlatform.UNKNOWN;\n\t}\n}\n\nexport function getTargetPlatform(platform: Platform | 'alpine', arch: string | undefined): TargetPlatform {\n\tswitch (platform) {\n\t\tcase Platform.Windows:\n\t\t\tif (arch === 'x64') {\n\t\t\t\treturn TargetPlatform.WIN32_X64;\n\t\t\t}\n\t\t\tif (arch === 'arm64') {\n\t\t\t\treturn TargetPlatform.WIN32_ARM64;\n\t\t\t}\n\t\t\treturn TargetPlatform.UNKNOWN;\n\n\t\tcase Platform.Linux:\n\t\t\tif (arch === 'x64') {\n\t\t\t\treturn TargetPlatform.LINUX_X64;\n\t\t\t}\n\t\t\tif (arch === 'arm64') {\n\t\t\t\treturn TargetPlatform.LINUX_ARM64;\n\t\t\t}\n\t\t\tif (arch === 'arm') {\n\t\t\t\treturn TargetPlatform.LINUX_ARMHF;\n\t\t\t}\n\t\t\treturn TargetPlatform.UNKNOWN;\n\n\t\tcase 'alpine':\n\t\t\tif (arch === 'x64') {\n\t\t\t\treturn TargetPlatform.ALPINE_X64;\n\t\t\t}\n\t\t\tif (arch === 'arm64') {\n\t\t\t\treturn TargetPlatform.ALPINE_ARM64;\n\t\t\t}\n\t\t\treturn TargetPlatform.UNKNOWN;\n\n\t\tcase Platform.Mac:\n\t\t\tif (arch === 'x64') {\n\t\t\t\treturn TargetPlatform.DARWIN_X64;\n\t\t\t}\n\t\t\tif (arch === 'arm64') {\n\t\t\t\treturn TargetPlatform.DARWIN_ARM64;\n\t\t\t}\n\t\t\treturn TargetPlatform.UNKNOWN;\n\n\t\tcase Platform.Web: return TargetPlatform.WEB;\n\t}\n}\n\nexport function isNotWebExtensionInWebTargetPlatform(allTargetPlatforms: TargetPlatform[], productTargetPlatform: TargetPlatform): boolean {\n\t// Not a web extension in web target platform\n\treturn productTargetPlatform === TargetPlatform.WEB && !allTargetPlatforms.includes(TargetPlatform.WEB);\n}\n\nexport function isTargetPlatformCompatible(extensionTargetPlatform: TargetPlatform, allTargetPlatforms: TargetPlatform[], productTargetPlatform: TargetPlatform): boolean {\n\t// Not compatible when extension is not a web extension in web target platform\n\tif (isNotWebExtensionInWebTargetPlatform(allTargetPlatforms, productTargetPlatform)) {\n\t\treturn false;\n\t}\n\n\t// Compatible when extension target platform is not defined\n\tif (extensionTargetPlatform === TargetPlatform.UNDEFINED) {\n\t\treturn true;\n\t}\n\n\t// Compatible when extension target platform is universal\n\tif (extensionTargetPlatform === TargetPlatform.UNIVERSAL) {\n\t\treturn true;\n\t}\n\n\t// Not compatible when extension target platform is unknown\n\tif (extensionTargetPlatform === TargetPlatform.UNKNOWN) {\n\t\treturn false;\n\t}\n\n\t// Compatible when extension and product target platforms matches\n\tif (extensionTargetPlatform === productTargetPlatform) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nexport interface IGalleryExtensionProperties {\n\tdependencies?: string[];\n\textensionPack?: string[];\n\tengine?: string;\n\tenabledApiProposals?: string[];\n\tlocalizedLanguages?: string[];\n\ttargetPlatform: TargetPlatform;\n\tisPreReleaseVersion: boolean;\n\texecutesCode?: boolean;\n}\n\nexport interface IGalleryExtensionAsset {\n\turi: string;\n\tfallbackUri: string;\n}\n\nexport interface IGalleryExtensionAssets {\n\tmanifest: IGalleryExtensionAsset | null;\n\treadme: IGalleryExtensionAsset | null;\n\tchangelog: IGalleryExtensionAsset | null;\n\tlicense: IGalleryExtensionAsset | null;\n\trepository: IGalleryExtensionAsset | null;\n\tdownload: IGalleryExtensionAsset;\n\ticon: IGalleryExtensionAsset | null;\n\tsignature: IGalleryExtensionAsset | null;\n\tcoreTranslations: [string, IGalleryExtensionAsset][];\n}\n\nexport function isIExtensionIdentifier(thing: any): thing is IExtensionIdentifier {\n\treturn thing\n\t\t&& typeof thing === 'object'\n\t\t&& typeof thing.id === 'string'\n\t\t&& (!thing.uuid || typeof thing.uuid === 'string');\n}\n\nexport interface IExtensionIdentifier {\n\tid: string;\n\tuuid?: string;\n}\n\nexport interface IGalleryExtensionIdentifier extends IExtensionIdentifier {\n\tuuid: string;\n}\n\nexport interface IGalleryExtensionVersion {\n\tversion: string;\n\tdate: string;\n\tisPreReleaseVersion: boolean;\n}\n\nexport interface IGalleryExtension {\n\ttype: 'gallery';\n\tname: string;\n\tidentifier: IGalleryExtensionIdentifier;\n\tversion: string;\n\tdisplayName: string;\n\tpublisherId: string;\n\tpublisher: string;\n\tpublisherDisplayName: string;\n\tpublisherDomain?: { link: string; verified: boolean };\n\tpublisherLink?: string;\n\tpublisherSponsorLink?: string;\n\tdescription: string;\n\tinstallCount: number;\n\trating: number;\n\tratingCount: number;\n\tcategories: readonly string[];\n\ttags: readonly string[];\n\treleaseDate: number;\n\tlastUpdated: number;\n\tpreview: boolean;\n\tprivate: boolean;\n\thasPreReleaseVersion: boolean;\n\thasReleaseVersion: boolean;\n\tisSigned: boolean;\n\tallTargetPlatforms: TargetPlatform[];\n\tassets: IGalleryExtensionAssets;\n\tproperties: IGalleryExtensionProperties;\n\tdetailsLink?: string;\n\tratingLink?: string;\n\tsupportLink?: string;\n\ttelemetryData?: any;\n\tqueryContext?: IStringDictionary<any>;\n}\n\nexport type InstallSource = 'gallery' | 'vsix' | 'resource';\n\nexport interface IGalleryMetadata {\n\tid: string;\n\tpublisherId: string;\n\tprivate: boolean;\n\tpublisherDisplayName: string;\n\tisPreReleaseVersion: boolean;\n\ttargetPlatform?: TargetPlatform;\n}\n\nexport type Metadata = Partial<IGalleryMetadata & {\n\tisApplicationScoped: boolean;\n\tisMachineScoped: boolean;\n\tisBuiltin: boolean;\n\tisSystem: boolean;\n\tupdated: boolean;\n\tpreRelease: boolean;\n\thasPreReleaseVersion: boolean;\n\tinstalledTimestamp: number;\n\tpinned: boolean;\n\tsource: InstallSource;\n\tsize: number;\n}>;\n\nexport interface ILocalExtension extends IExtension {\n\tisWorkspaceScoped: boolean;\n\tisMachineScoped: boolean;\n\tisApplicationScoped: boolean;\n\tpublisherId: string | null;\n\tinstalledTimestamp?: number;\n\tisPreReleaseVersion: boolean;\n\thasPreReleaseVersion: boolean;\n\tprivate: boolean;\n\tpreRelease: boolean;\n\tupdated: boolean;\n\tpinned: boolean;\n\tsource: InstallSource;\n\tsize: number;\n}\n\nexport const enum SortBy {\n\tNoneOrRelevance = 'NoneOrRelevance',\n\tLastUpdatedDate = 'LastUpdatedDate',\n\tTitle = 'Title',\n\tPublisherName = 'PublisherName',\n\tInstallCount = 'InstallCount',\n\tPublishedDate = 'PublishedDate',\n\tAverageRating = 'AverageRating',\n\tWeightedRating = 'WeightedRating'\n}\n\nexport const enum SortOrder {\n\tDefault = 0,\n\tAscending = 1,\n\tDescending = 2\n}\n\nexport const enum FilterType {\n\tCategory = 'Category',\n\tExtensionId = 'ExtensionId',\n\tExtensionName = 'ExtensionName',\n\tExcludeWithFlags = 'ExcludeWithFlags',\n\tFeatured = 'Featured',\n\tSearchText = 'SearchText',\n\tTag = 'Tag',\n\tTarget = 'Target',\n}\n\nexport interface IQueryOptions {\n\ttext?: string;\n\texclude?: string[];\n\tpageSize?: number;\n\tsortBy?: SortBy;\n\tsortOrder?: SortOrder;\n\tsource?: string;\n\tincludePreRelease?: boolean;\n\tproductVersion?: IProductVersion;\n}\n\nexport const enum StatisticType {\n\tInstall = 'install',\n\tUninstall = 'uninstall'\n}\n\nexport interface IDeprecationInfo {\n\treadonly disallowInstall?: boolean;\n\treadonly extension?: {\n\t\treadonly id: string;\n\t\treadonly displayName: string;\n\t\treadonly autoMigrate?: { readonly storage: boolean };\n\t\treadonly preRelease?: boolean;\n\t};\n\treadonly settings?: readonly string[];\n\treadonly additionalInfo?: string;\n}\n\nexport interface ISearchPrefferedResults {\n\treadonly query?: string;\n\treadonly preferredResults?: string[];\n}\n\nexport type MaliciousExtensionInfo = {\n\treadonly extensionOrPublisher: IExtensionIdentifier | string;\n\treadonly learnMoreLink?: string;\n};\n\nexport interface IExtensionsControlManifest {\n\treadonly malicious: ReadonlyArray<MaliciousExtensionInfo>;\n\treadonly deprecated: IStringDictionary<IDeprecationInfo>;\n\treadonly search: ISearchPrefferedResults[];\n\treadonly autoUpdate?: IStringDictionary<string>;\n}\n\nexport const enum InstallOperation {\n\tNone = 1,\n\tInstall,\n\tUpdate,\n\tMigrate,\n}\n\nexport interface ITranslation {\n\tcontents: { [key: string]: {} };\n}\n\nexport interface IExtensionInfo extends IExtensionIdentifier {\n\tversion?: string;\n\tpreRelease?: boolean;\n\thasPreRelease?: boolean;\n}\n\nexport interface IExtensionQueryOptions {\n\ttargetPlatform?: TargetPlatform;\n\tproductVersion?: IProductVersion;\n\tcompatible?: boolean;\n\tqueryAllVersions?: boolean;\n\tsource?: string;\n\tupdateCheck?: boolean;\n}\n\nexport interface IExtensionGalleryCapabilities {\n\treadonly query: {\n\t\treadonly sortBy: readonly SortBy[];\n\t\treadonly filters: readonly FilterType[];\n\t};\n\treadonly allRepositorySigned: boolean;\n}\n\nexport const IExtensionGalleryService = createDecorator<IExtensionGalleryService>('extensionGalleryService');\n\n/**\n * Service to interact with the Visual Studio Code Marketplace to get extensions.\n * @throws Error if the Marketplace is not enabled or not reachable.\n */\nexport interface IExtensionGalleryService {\n\treadonly _serviceBrand: undefined;\n\tisEnabled(): boolean;\n\tquery(options: IQueryOptions, token: CancellationToken): Promise<IPager<IGalleryExtension>>;\n\tgetExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, token: CancellationToken): Promise<IGalleryExtension[]>;\n\tgetExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, options: IExtensionQueryOptions, token: CancellationToken): Promise<IGalleryExtension[]>;\n\tisExtensionCompatible(extension: IGalleryExtension, includePreRelease: boolean, targetPlatform: TargetPlatform, productVersion?: IProductVersion): Promise<boolean>;\n\tgetCompatibleExtension(extension: IGalleryExtension, includePreRelease: boolean, targetPlatform: TargetPlatform, productVersion?: IProductVersion): Promise<IGalleryExtension | null>;\n\tgetAllCompatibleVersions(extensionIdentifier: IExtensionIdentifier, includePreRelease: boolean, targetPlatform: TargetPlatform): Promise<IGalleryExtensionVersion[]>;\n\tgetAllVersions(extensionIdentifier: IExtensionIdentifier): Promise<IGalleryExtensionVersion[]>;\n\tdownload(extension: IGalleryExtension, location: URI, operation: InstallOperation): Promise<void>;\n\tdownloadSignatureArchive(extension: IGalleryExtension, location: URI): Promise<void>;\n\treportStatistic(publisher: string, name: string, version: string, type: StatisticType): Promise<void>;\n\tgetReadme(extension: IGalleryExtension, token: CancellationToken): Promise<string>;\n\tgetManifest(extension: IGalleryExtension, token: CancellationToken): Promise<IExtensionManifest | null>;\n\tgetChangelog(extension: IGalleryExtension, token: CancellationToken): Promise<string>;\n\tgetCoreTranslation(extension: IGalleryExtension, languageId: string): Promise<ITranslation | null>;\n\tgetExtensionsControlManifest(): Promise<IExtensionsControlManifest>;\n}\n\nexport interface InstallExtensionEvent {\n\treadonly identifier: IExtensionIdentifier;\n\treadonly source: URI | IGalleryExtension;\n\treadonly profileLocation: URI;\n\treadonly applicationScoped?: boolean;\n\treadonly workspaceScoped?: boolean;\n}\n\nexport interface InstallExtensionResult {\n\treadonly identifier: IExtensionIdentifier;\n\treadonly operation: InstallOperation;\n\treadonly source?: URI | IGalleryExtension;\n\treadonly local?: ILocalExtension;\n\treadonly error?: Error;\n\treadonly context?: IStringDictionary<any>;\n\treadonly profileLocation: URI;\n\treadonly applicationScoped?: boolean;\n\treadonly workspaceScoped?: boolean;\n}\n\nexport interface UninstallExtensionEvent {\n\treadonly identifier: IExtensionIdentifier;\n\treadonly profileLocation: URI;\n\treadonly applicationScoped?: boolean;\n\treadonly workspaceScoped?: boolean;\n}\n\nexport interface DidUninstallExtensionEvent {\n\treadonly identifier: IExtensionIdentifier;\n\treadonly error?: string;\n\treadonly profileLocation: URI;\n\treadonly applicationScoped?: boolean;\n\treadonly workspaceScoped?: boolean;\n}\n\nexport interface DidUpdateExtensionMetadata {\n\treadonly profileLocation: URI;\n\treadonly local: ILocalExtension;\n}\n\nexport const enum ExtensionGalleryErrorCode {\n\tTimeout = 'Timeout',\n\tCancelled = 'Cancelled',\n\tFailed = 'Failed',\n\tDownloadFailedWriting = 'DownloadFailedWriting',\n\tOffline = 'Offline',\n}\n\nexport class ExtensionGalleryError extends Error {\n\tconstructor(message: string, readonly code: ExtensionGalleryErrorCode) {\n\t\tsuper(message);\n\t\tthis.name = code;\n\t}\n}\n\nexport const enum ExtensionManagementErrorCode {\n\tNotFound = 'NotFound',\n\tUnsupported = 'Unsupported',\n\tDeprecated = 'Deprecated',\n\tMalicious = 'Malicious',\n\tIncompatible = 'Incompatible',\n\tIncompatibleApi = 'IncompatibleApi',\n\tIncompatibleTargetPlatform = 'IncompatibleTargetPlatform',\n\tReleaseVersionNotFound = 'ReleaseVersionNotFound',\n\tInvalid = 'Invalid',\n\tDownload = 'Download',\n\tDownloadSignature = 'DownloadSignature',\n\tDownloadFailedWriting = ExtensionGalleryErrorCode.DownloadFailedWriting,\n\tUpdateMetadata = 'UpdateMetadata',\n\tExtract = 'Extract',\n\tScanning = 'Scanning',\n\tScanningExtension = 'ScanningExtension',\n\tReadRemoved = 'ReadRemoved',\n\tUnsetRemoved = 'UnsetRemoved',\n\tDelete = 'Delete',\n\tRename = 'Rename',\n\tIntializeDefaultProfile = 'IntializeDefaultProfile',\n\tAddToProfile = 'AddToProfile',\n\tInstalledExtensionNotFound = 'InstalledExtensionNotFound',\n\tPostInstall = 'PostInstall',\n\tCorruptZip = 'CorruptZip',\n\tIncompleteZip = 'IncompleteZip',\n\tPackageNotSigned = 'PackageNotSigned',\n\tSignatureVerificationInternal = 'SignatureVerificationInternal',\n\tSignatureVerificationFailed = 'SignatureVerificationFailed',\n\tNotAllowed = 'NotAllowed',\n\tGallery = 'Gallery',\n\tCancelled = 'Cancelled',\n\tUnknown = 'Unknown',\n\tInternal = 'Internal',\n}\n\nexport enum ExtensionSignatureVerificationCode {\n\t'NotSigned' = 'NotSigned',\n\t'Success' = 'Success',\n\t'RequiredArgumentMissing' = 'RequiredArgumentMissing', // A required argument is missing.\n\t'InvalidArgument' = 'InvalidArgument', // An argument is invalid.\n\t'PackageIsUnreadable' = 'PackageIsUnreadable', // The extension package is unreadable.\n\t'UnhandledException' = 'UnhandledException', // An unhandled exception occurred.\n\t'SignatureManifestIsMissing' = 'SignatureManifestIsMissing', // The extension is missing a signature manifest file (.signature.manifest).\n\t'SignatureManifestIsUnreadable' = 'SignatureManifestIsUnreadable', // The signature manifest is unreadable.\n\t'SignatureIsMissing' = 'SignatureIsMissing', // The extension is missing a signature file (.signature.p7s).\n\t'SignatureIsUnreadable' = 'SignatureIsUnreadable', // The signature is unreadable.\n\t'CertificateIsUnreadable' = 'CertificateIsUnreadable', // The certificate is unreadable.\n\t'SignatureArchiveIsUnreadable' = 'SignatureArchiveIsUnreadable',\n\t'FileAlreadyExists' = 'FileAlreadyExists', // The output file already exists.\n\t'SignatureArchiveIsInvalidZip' = 'SignatureArchiveIsInvalidZip',\n\t'SignatureArchiveHasSameSignatureFile' = 'SignatureArchiveHasSameSignatureFile', // The signature archive has the same signature file.\n\t'PackageIntegrityCheckFailed' = 'PackageIntegrityCheckFailed', // The package integrity check failed.\n\t'SignatureIsInvalid' = 'SignatureIsInvalid', // The extension has an invalid signature file (.signature.p7s).\n\t'SignatureManifestIsInvalid' = 'SignatureManifestIsInvalid', // The extension has an invalid signature manifest file (.signature.manifest).\n\t'SignatureIntegrityCheckFailed' = 'SignatureIntegrityCheckFailed', // The extension's signature integrity check failed.  Extension integrity is suspect.\n\t'EntryIsMissing' = 'EntryIsMissing', // An entry referenced in the signature manifest was not found in the extension.\n\t'EntryIsTampered' = 'EntryIsTampered', // The integrity check for an entry referenced in the signature manifest failed.\n\t'Untrusted' = 'Untrusted', // An X.509 certificate in the extension signature is untrusted.\n\t'CertificateRevoked' = 'CertificateRevoked', // An X.509 certificate in the extension signature has been revoked.\n\t'SignatureIsNotValid' = 'SignatureIsNotValid', // The extension signature is invalid.\n\t'UnknownError' = 'UnknownError', // An unknown error occurred.\n\t'PackageIsInvalidZip' = 'PackageIsInvalidZip', // The extension package is not valid ZIP format.\n\t'SignatureArchiveHasTooManyEntries' = 'SignatureArchiveHasTooManyEntries', // The signature archive has too many entries.\n}\n\nexport class ExtensionManagementError extends Error {\n\tconstructor(message: string, readonly code: ExtensionManagementErrorCode) {\n\t\tsuper(message);\n\t\tthis.name = code;\n\t}\n}\n\nexport interface InstallExtensionSummary {\n\tfailed: {\n\t\tid: string;\n\t\tinstallOptions: InstallOptions;\n\t}[];\n}\n\nexport type InstallOptions = {\n\tisBuiltin?: boolean;\n\tisWorkspaceScoped?: boolean;\n\tisMachineScoped?: boolean;\n\tisApplicationScoped?: boolean;\n\tpinned?: boolean;\n\tdonotIncludePackAndDependencies?: boolean;\n\tinstallGivenVersion?: boolean;\n\tpreRelease?: boolean;\n\tinstallPreReleaseVersion?: boolean;\n\tdonotVerifySignature?: boolean;\n\toperation?: InstallOperation;\n\tprofileLocation?: URI;\n\tproductVersion?: IProductVersion;\n\tkeepExisting?: boolean;\n\tdownloadExtensionsLocally?: boolean;\n\t/**\n\t * Context passed through to InstallExtensionResult\n\t */\n\tcontext?: IStringDictionary<any>;\n};\n\nexport type UninstallOptions = {\n\treadonly profileLocation?: URI;\n\treadonly donotIncludePack?: boolean;\n\treadonly donotCheckDependents?: boolean;\n\treadonly versionOnly?: boolean;\n\treadonly remove?: boolean;\n};\n\nexport interface IExtensionManagementParticipant {\n\tpostInstall(local: ILocalExtension, source: URI | IGalleryExtension, options: InstallOptions, token: CancellationToken): Promise<void>;\n\tpostUninstall(local: ILocalExtension, options: UninstallOptions, token: CancellationToken): Promise<void>;\n}\n\nexport type InstallExtensionInfo = { readonly extension: IGalleryExtension; readonly options: InstallOptions };\nexport type UninstallExtensionInfo = { readonly extension: ILocalExtension; readonly options?: UninstallOptions };\n\nexport const IExtensionManagementService = createDecorator<IExtensionManagementService>('extensionManagementService');\nexport interface IExtensionManagementService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly preferPreReleases: boolean;\n\n\tonInstallExtension: Event<InstallExtensionEvent>;\n\tonDidInstallExtensions: Event<readonly InstallExtensionResult[]>;\n\tonUninstallExtension: Event<UninstallExtensionEvent>;\n\tonDidUninstallExtension: Event<DidUninstallExtensionEvent>;\n\tonDidUpdateExtensionMetadata: Event<DidUpdateExtensionMetadata>;\n\n\tzip(extension: ILocalExtension): Promise<URI>;\n\tgetManifest(vsix: URI): Promise<IExtensionManifest>;\n\tinstall(vsix: URI, options?: InstallOptions): Promise<ILocalExtension>;\n\tcanInstall(extension: IGalleryExtension): Promise<true | IMarkdownString>;\n\tinstallFromGallery(extension: IGalleryExtension, options?: InstallOptions): Promise<ILocalExtension>;\n\tinstallGalleryExtensions(extensions: InstallExtensionInfo[]): Promise<InstallExtensionResult[]>;\n\tinstallFromLocation(location: URI, profileLocation: URI): Promise<ILocalExtension>;\n\tinstallExtensionsFromProfile(extensions: IExtensionIdentifier[], fromProfileLocation: URI, toProfileLocation: URI): Promise<ILocalExtension[]>;\n\tuninstall(extension: ILocalExtension, options?: UninstallOptions): Promise<void>;\n\tuninstallExtensions(extensions: UninstallExtensionInfo[]): Promise<void>;\n\ttoggleApplicationScope(extension: ILocalExtension, fromProfileLocation: URI): Promise<ILocalExtension>;\n\tgetInstalled(type?: ExtensionType, profileLocation?: URI, productVersion?: IProductVersion, language?: string): Promise<ILocalExtension[]>;\n\tgetExtensionsControlManifest(): Promise<IExtensionsControlManifest>;\n\tcopyExtensions(fromProfileLocation: URI, toProfileLocation: URI): Promise<void>;\n\tupdateMetadata(local: ILocalExtension, metadata: Partial<Metadata>, profileLocation: URI): Promise<ILocalExtension>;\n\tresetPinnedStateForAllUserExtensions(pinned: boolean): Promise<void>;\n\n\tdownload(extension: IGalleryExtension, operation: InstallOperation, donotVerifySignature: boolean): Promise<URI>;\n\n\tregisterParticipant(pariticipant: IExtensionManagementParticipant): void;\n\tgetTargetPlatform(): Promise<TargetPlatform>;\n\n\tcleanUp(): Promise<void>;\n}\n\nexport const DISABLED_EXTENSIONS_STORAGE_PATH = 'extensionsIdentifiers/disabled';\nexport const ENABLED_EXTENSIONS_STORAGE_PATH = 'extensionsIdentifiers/enabled';\nexport const IGlobalExtensionEnablementService = createDecorator<IGlobalExtensionEnablementService>('IGlobalExtensionEnablementService');\n\nexport interface IGlobalExtensionEnablementService {\n\treadonly _serviceBrand: undefined;\n\treadonly onDidChangeEnablement: Event<{ readonly extensions: IExtensionIdentifier[]; readonly source?: string }>;\n\n\tgetDisabledExtensions(): IExtensionIdentifier[];\n\tenableExtension(extension: IExtensionIdentifier, source?: string): Promise<boolean>;\n\tdisableExtension(extension: IExtensionIdentifier, source?: string): Promise<boolean>;\n\n}\n\nexport type IConfigBasedExtensionTip = {\n\treadonly extensionId: string;\n\treadonly extensionName: string;\n\treadonly isExtensionPack: boolean;\n\treadonly configName: string;\n\treadonly important: boolean;\n\treadonly whenNotInstalled?: string[];\n};\n\nexport type IExecutableBasedExtensionTip = {\n\treadonly extensionId: string;\n\treadonly extensionName: string;\n\treadonly isExtensionPack: boolean;\n\treadonly exeName: string;\n\treadonly exeFriendlyName: string;\n\treadonly windowsPath?: string;\n\treadonly whenNotInstalled?: string[];\n};\n\nexport const IExtensionTipsService = createDecorator<IExtensionTipsService>('IExtensionTipsService');\nexport interface IExtensionTipsService {\n\treadonly _serviceBrand: undefined;\n\n\tgetConfigBasedTips(folder: URI): Promise<IConfigBasedExtensionTip[]>;\n\tgetImportantExecutableBasedTips(): Promise<IExecutableBasedExtensionTip[]>;\n\tgetOtherExecutableBasedTips(): Promise<IExecutableBasedExtensionTip[]>;\n}\n\nexport type AllowedExtensionsConfigValueType = IStringDictionary<boolean | string | string[]>;\n\nexport const IAllowedExtensionsService = createDecorator<IAllowedExtensionsService>('IAllowedExtensionsService');\nexport interface IAllowedExtensionsService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly allowedExtensionsConfigValue: AllowedExtensionsConfigValueType | undefined;\n\treadonly onDidChangeAllowedExtensionsConfigValue: Event<void>;\n\n\tisAllowed(extension: IGalleryExtension | IExtension): true | IMarkdownString;\n\tisAllowed(extension: { id: string; publisherDisplayName: string | undefined; version?: string; prerelease?: boolean; targetPlatform?: TargetPlatform }): true | IMarkdownString;\n}\n\nexport async function computeSize(location: URI, fileService: IFileService): Promise<number> {\n\tlet stat: IFileStat;\n\ttry {\n\t\tstat = await fileService.resolve(location);\n\t} catch (e) {\n\t\tif ((<FileOperationError>e).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {\n\t\t\treturn 0;\n\t\t}\n\t\tthrow e;\n\t}\n\tif (stat.children) {\n\t\tconst sizes = await Promise.all(stat.children.map(c => computeSize(c.resource, fileService)));\n\t\treturn sizes.reduce((r, s) => r + s, 0);\n\t}\n\treturn stat.size ?? 0;\n}\n\nexport const ExtensionsLocalizedLabel = localize2('extensions', \"Extensions\");\nexport const PreferencesLocalizedLabel = localize2('preferences', 'Preferences');\nexport const AllowedExtensionsConfigKey = 'extensions.allowed';\nexport const VerifyExtensionSignatureConfigKey = 'extensions.verifySignature';\n\nRegistry.as<IConfigurationRegistry>(Extensions.Configuration)\n\t.registerConfiguration({\n\t\tid: 'extensions',\n\t\torder: 30,\n\t\ttitle: localize('extensionsConfigurationTitle', \"Extensions\"),\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\t[AllowedExtensionsConfigKey]: {\n\t\t\t\t// Note: Type is set only to object because to support policies generation during build time, where single type is expected.\n\t\t\t\ttype: 'object',\n\t\t\t\tmarkdownDescription: localize('extensions.allowed', \"Specify a list of extensions that are allowed to use. This helps maintain a secure and consistent development environment by restricting the use of unauthorized extensions. For more information on how to configure this setting, please visit the [Configure Allowed Extensions](https://code.visualstudio.com/docs/setup/enterprise#_configure-allowed-extensions) section.\"),\n\t\t\t\tdefault: '*',\n\t\t\t\tdefaultSnippets: [{\n\t\t\t\t\tbody: {},\n\t\t\t\t\tdescription: localize('extensions.allowed.none', \"No extensions are allowed.\"),\n\t\t\t\t}, {\n\t\t\t\t\tbody: {\n\t\t\t\t\t\t'*': true\n\t\t\t\t\t},\n\t\t\t\t\tdescription: localize('extensions.allowed.all', \"All extensions are allowed.\"),\n\t\t\t\t}],\n\t\t\t\tscope: ConfigurationScope.APPLICATION,\n\t\t\t\tpolicy: {\n\t\t\t\t\tname: 'AllowedExtensions',\n\t\t\t\t\tminimumVersion: '1.96',\n\t\t\t\t\tdescription: localize('extensions.allowed.policy', \"Specify a list of extensions that are allowed to use. This helps maintain a secure and consistent development environment by restricting the use of unauthorized extensions. More information: https://code.visualstudio.com/docs/setup/enterprise#_configure-allowed-extensions\"),\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tpatternProperties: {\n\t\t\t\t\t'([a-z0-9A-Z][a-z0-9-A-Z]*)\\\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$': {\n\t\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: ['boolean', 'string'],\n\t\t\t\t\t\t\t\tenum: [true, false, 'stable'],\n\t\t\t\t\t\t\t\tdescription: localize('extensions.allow.description', \"Allow or disallow the extension.\"),\n\t\t\t\t\t\t\t\tenumDescriptions: [\n\t\t\t\t\t\t\t\t\tlocalize('extensions.allowed.enable.desc', \"Extension is allowed.\"),\n\t\t\t\t\t\t\t\t\tlocalize('extensions.allowed.disable.desc', \"Extension is not allowed.\"),\n\t\t\t\t\t\t\t\t\tlocalize('extensions.allowed.disable.stable.desc', \"Allow only stable versions of the extension.\"),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: localize('extensions.allow.version.description', \"Allow or disallow specific versions of the extension. To specifcy a platform specific version, use the format `platform@1.2.3`, e.g. `win32-x64@1.2.3`. Supported platforms are `win32-x64`, `win32-arm64`, `linux-x64`, `linux-arm64`, `linux-armhf`, `alpine-x64`, `alpine-arm64`, `darwin-x64`, `darwin-arm64`\"),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t'([a-z0-9A-Z][a-z0-9-A-Z]*)$': {\n\t\t\t\t\t\ttype: ['boolean', 'string'],\n\t\t\t\t\t\tenum: [true, false, 'stable'],\n\t\t\t\t\t\tdescription: localize('extension.publisher.allow.description', \"Allow or disallow all extensions from the publisher.\"),\n\t\t\t\t\t\tenumDescriptions: [\n\t\t\t\t\t\t\tlocalize('extensions.publisher.allowed.enable.desc', \"All extensions from the publisher are allowed.\"),\n\t\t\t\t\t\t\tlocalize('extensions.publisher.allowed.disable.desc', \"All extensions from the publisher are not allowed.\"),\n\t\t\t\t\t\t\tlocalize('extensions.publisher.allowed.disable.stable.desc', \"Allow only stable versions of the extensions from the publisher.\"),\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t'\\\\*': {\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tenum: [true, false],\n\t\t\t\t\t\tdescription: localize('extensions.allow.all.description', \"Allow or disallow all extensions.\"),\n\t\t\t\t\t\tenumDescriptions: [\n\t\t\t\t\t\t\tlocalize('extensions.allow.all.enable', \"Allow all extensions.\"),\n\t\t\t\t\t\t\tlocalize('extensions.allow.all.disable', \"Disallow all extensions.\")\n\t\t\t\t\t\t],\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\nexport function shouldRequireRepositorySignatureFor(isPrivate: boolean, galleryManifest: IExtensionGalleryManifest | null): boolean {\n\tif (isPrivate) {\n\t\treturn galleryManifest?.capabilities.signing?.allPrivateRepositorySigned === true;\n\t}\n\treturn galleryManifest?.capabilities.signing?.allPublicRepositorySigned === true;\n}\n\n","/**\n * Semver UMD module\n * Copyright (c) Isaac Z. Schlueter and Contributors\n * https://github.com/npm/node-semver\n */\n\n/**\n * DO NOT EDIT THIS FILE\n */\n\nconst exports = {};\nconst module = { exports };\n\n!function(e,r){if(\"object\"==typeof exports&&\"object\"==typeof module)module.exports=r();else if(\"function\"==typeof define&&define.amd)define([],r);else{var t=r();for(var n in t)(\"object\"==typeof exports?exports:e)[n]=t[n]}}(\"undefined\"!=typeof self?self:this,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&\"object\"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,\"default\",{enumerable:!0,value:e}),2&r&&\"string\"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,\"a\",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p=\"\",t(t.s=0)}([function(e,r,t){(function(t){var n;r=e.exports=H,n=\"object\"==typeof t&&t.env&&t.env.NODE_DEBUG&&/\\bsemver\\b/i.test(t.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift(\"SEMVER\"),console.log.apply(console,e)}:function(){},r.SEMVER_SPEC_VERSION=\"2.0.0\";var o=256,i=Number.MAX_SAFE_INTEGER||9007199254740991,s=r.re=[],a=r.src=[],u=0,c=u++;a[c]=\"0|[1-9]\\\\d*\";var p=u++;a[p]=\"[0-9]+\";var f=u++;a[f]=\"\\\\d*[a-zA-Z-][a-zA-Z0-9-]*\";var l=u++;a[l]=\"(\"+a[c]+\")\\\\.(\"+a[c]+\")\\\\.(\"+a[c]+\")\";var h=u++;a[h]=\"(\"+a[p]+\")\\\\.(\"+a[p]+\")\\\\.(\"+a[p]+\")\";var v=u++;a[v]=\"(?:\"+a[c]+\"|\"+a[f]+\")\";var m=u++;a[m]=\"(?:\"+a[p]+\"|\"+a[f]+\")\";var w=u++;a[w]=\"(?:-(\"+a[v]+\"(?:\\\\.\"+a[v]+\")*))\";var g=u++;a[g]=\"(?:-?(\"+a[m]+\"(?:\\\\.\"+a[m]+\")*))\";var y=u++;a[y]=\"[0-9A-Za-z-]+\";var d=u++;a[d]=\"(?:\\\\+(\"+a[y]+\"(?:\\\\.\"+a[y]+\")*))\";var b=u++,j=\"v?\"+a[l]+a[w]+\"?\"+a[d]+\"?\";a[b]=\"^\"+j+\"$\";var E=\"[v=\\\\s]*\"+a[h]+a[g]+\"?\"+a[d]+\"?\",T=u++;a[T]=\"^\"+E+\"$\";var x=u++;a[x]=\"((?:<|>)?=?)\";var $=u++;a[$]=a[p]+\"|x|X|\\\\*\";var k=u++;a[k]=a[c]+\"|x|X|\\\\*\";var S=u++;a[S]=\"[v=\\\\s]*(\"+a[k]+\")(?:\\\\.(\"+a[k]+\")(?:\\\\.(\"+a[k]+\")(?:\"+a[w]+\")?\"+a[d]+\"?)?)?\";var R=u++;a[R]=\"[v=\\\\s]*(\"+a[$]+\")(?:\\\\.(\"+a[$]+\")(?:\\\\.(\"+a[$]+\")(?:\"+a[g]+\")?\"+a[d]+\"?)?)?\";var I=u++;a[I]=\"^\"+a[x]+\"\\\\s*\"+a[S]+\"$\";var _=u++;a[_]=\"^\"+a[x]+\"\\\\s*\"+a[R]+\"$\";var O=u++;a[O]=\"(?:^|[^\\\\d])(\\\\d{1,16})(?:\\\\.(\\\\d{1,16}))?(?:\\\\.(\\\\d{1,16}))?(?:$|[^\\\\d])\";var A=u++;a[A]=\"(?:~>?)\";var M=u++;a[M]=\"(\\\\s*)\"+a[A]+\"\\\\s+\",s[M]=new RegExp(a[M],\"g\");var V=u++;a[V]=\"^\"+a[A]+a[S]+\"$\";var P=u++;a[P]=\"^\"+a[A]+a[R]+\"$\";var C=u++;a[C]=\"(?:\\\\^)\";var L=u++;a[L]=\"(\\\\s*)\"+a[C]+\"\\\\s+\",s[L]=new RegExp(a[L],\"g\");var N=u++;a[N]=\"^\"+a[C]+a[S]+\"$\";var q=u++;a[q]=\"^\"+a[C]+a[R]+\"$\";var D=u++;a[D]=\"^\"+a[x]+\"\\\\s*(\"+E+\")$|^$\";var X=u++;a[X]=\"^\"+a[x]+\"\\\\s*(\"+j+\")$|^$\";var z=u++;a[z]=\"(\\\\s*)\"+a[x]+\"\\\\s*(\"+E+\"|\"+a[S]+\")\",s[z]=new RegExp(a[z],\"g\");var G=u++;a[G]=\"^\\\\s*(\"+a[S]+\")\\\\s+-\\\\s+(\"+a[S]+\")\\\\s*$\";var Z=u++;a[Z]=\"^\\\\s*(\"+a[R]+\")\\\\s+-\\\\s+(\"+a[R]+\")\\\\s*$\";var B=u++;a[B]=\"(<|>)?=?\\\\s*\\\\*\";for(var U=0;U<35;U++)n(U,a[U]),s[U]||(s[U]=new RegExp(a[U]));function F(e,r){if(e instanceof H)return e;if(\"string\"!=typeof e)return null;if(e.length>o)return null;if(!(r?s[T]:s[b]).test(e))return null;try{return new H(e,r)}catch(e){return null}}function H(e,r){if(e instanceof H){if(e.loose===r)return e;e=e.version}else if(\"string\"!=typeof e)throw new TypeError(\"Invalid Version: \"+e);if(e.length>o)throw new TypeError(\"version is longer than \"+o+\" characters\");if(!(this instanceof H))return new H(e,r);n(\"SemVer\",e,r),this.loose=r;var t=e.trim().match(r?s[T]:s[b]);if(!t)throw new TypeError(\"Invalid Version: \"+e);if(this.raw=e,this.major=+t[1],this.minor=+t[2],this.patch=+t[3],this.major>i||this.major<0)throw new TypeError(\"Invalid major version\");if(this.minor>i||this.minor<0)throw new TypeError(\"Invalid minor version\");if(this.patch>i||this.patch<0)throw new TypeError(\"Invalid patch version\");t[4]?this.prerelease=t[4].split(\".\").map((function(e){if(/^[0-9]+$/.test(e)){var r=+e;if(r>=0&&r<i)return r}return e})):this.prerelease=[],this.build=t[5]?t[5].split(\".\"):[],this.format()}r.parse=F,r.valid=function(e,r){var t=F(e,r);return t?t.version:null},r.clean=function(e,r){var t=F(e.trim().replace(/^[=v]+/,\"\"),r);return t?t.version:null},r.SemVer=H,H.prototype.format=function(){return this.version=this.major+\".\"+this.minor+\".\"+this.patch,this.prerelease.length&&(this.version+=\"-\"+this.prerelease.join(\".\")),this.version},H.prototype.toString=function(){return this.version},H.prototype.compare=function(e){return n(\"SemVer.compare\",this.version,this.loose,e),e instanceof H||(e=new H(e,this.loose)),this.compareMain(e)||this.comparePre(e)},H.prototype.compareMain=function(e){return e instanceof H||(e=new H(e,this.loose)),K(this.major,e.major)||K(this.minor,e.minor)||K(this.patch,e.patch)},H.prototype.comparePre=function(e){if(e instanceof H||(e=new H(e,this.loose)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r],o=e.prerelease[r];if(n(\"prerelease compare\",r,t,o),void 0===t&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===t)return-1;if(t!==o)return K(t,o)}while(++r)},H.prototype.inc=function(e,r){switch(e){case\"premajor\":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(\"pre\",r);break;case\"preminor\":this.prerelease.length=0,this.patch=0,this.minor++,this.inc(\"pre\",r);break;case\"prepatch\":this.prerelease.length=0,this.inc(\"patch\",r),this.inc(\"pre\",r);break;case\"prerelease\":0===this.prerelease.length&&this.inc(\"patch\",r),this.inc(\"pre\",r);break;case\"major\":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case\"minor\":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case\"patch\":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case\"pre\":if(0===this.prerelease.length)this.prerelease=[0];else{for(var t=this.prerelease.length;--t>=0;)\"number\"==typeof this.prerelease[t]&&(this.prerelease[t]++,t=-2);-1===t&&this.prerelease.push(0)}r&&(this.prerelease[0]===r?isNaN(this.prerelease[1])&&(this.prerelease=[r,0]):this.prerelease=[r,0]);break;default:throw new Error(\"invalid increment argument: \"+e)}return this.format(),this.raw=this.version,this},r.inc=function(e,r,t,n){\"string\"==typeof t&&(n=t,t=void 0);try{return new H(e,t).inc(r,n).version}catch(e){return null}},r.diff=function(e,r){if(ee(e,r))return null;var t=F(e),n=F(r);if(t.prerelease.length||n.prerelease.length){for(var o in t)if((\"major\"===o||\"minor\"===o||\"patch\"===o)&&t[o]!==n[o])return\"pre\"+o;return\"prerelease\"}for(var o in t)if((\"major\"===o||\"minor\"===o||\"patch\"===o)&&t[o]!==n[o])return o},r.compareIdentifiers=K;var J=/^[0-9]+$/;function K(e,r){var t=J.test(e),n=J.test(r);return t&&n&&(e=+e,r=+r),t&&!n?-1:n&&!t?1:e<r?-1:e>r?1:0}function Q(e,r,t){return new H(e,t).compare(new H(r,t))}function W(e,r,t){return Q(e,r,t)>0}function Y(e,r,t){return Q(e,r,t)<0}function ee(e,r,t){return 0===Q(e,r,t)}function re(e,r,t){return 0!==Q(e,r,t)}function te(e,r,t){return Q(e,r,t)>=0}function ne(e,r,t){return Q(e,r,t)<=0}function oe(e,r,t,n){var o;switch(r){case\"===\":\"object\"==typeof e&&(e=e.version),\"object\"==typeof t&&(t=t.version),o=e===t;break;case\"!==\":\"object\"==typeof e&&(e=e.version),\"object\"==typeof t&&(t=t.version),o=e!==t;break;case\"\":case\"=\":case\"==\":o=ee(e,t,n);break;case\"!=\":o=re(e,t,n);break;case\">\":o=W(e,t,n);break;case\">=\":o=te(e,t,n);break;case\"<\":o=Y(e,t,n);break;case\"<=\":o=ne(e,t,n);break;default:throw new TypeError(\"Invalid operator: \"+r)}return o}function ie(e,r){if(e instanceof ie){if(e.loose===r)return e;e=e.value}if(!(this instanceof ie))return new ie(e,r);n(\"comparator\",e,r),this.loose=r,this.parse(e),this.semver===se?this.value=\"\":this.value=this.operator+this.semver.version,n(\"comp\",this)}r.rcompareIdentifiers=function(e,r){return K(r,e)},r.major=function(e,r){return new H(e,r).major},r.minor=function(e,r){return new H(e,r).minor},r.patch=function(e,r){return new H(e,r).patch},r.compare=Q,r.compareLoose=function(e,r){return Q(e,r,!0)},r.rcompare=function(e,r,t){return Q(r,e,t)},r.sort=function(e,t){return e.sort((function(e,n){return r.compare(e,n,t)}))},r.rsort=function(e,t){return e.sort((function(e,n){return r.rcompare(e,n,t)}))},r.gt=W,r.lt=Y,r.eq=ee,r.neq=re,r.gte=te,r.lte=ne,r.cmp=oe,r.Comparator=ie;var se={};function ae(e,r){if(e instanceof ae)return e.loose===r?e:new ae(e.raw,r);if(e instanceof ie)return new ae(e.value,r);if(!(this instanceof ae))return new ae(e,r);if(this.loose=r,this.raw=e,this.set=e.split(/\\s*\\|\\|\\s*/).map((function(e){return this.parseRange(e.trim())}),this).filter((function(e){return e.length})),!this.set.length)throw new TypeError(\"Invalid SemVer Range: \"+e);this.format()}function ue(e){return!e||\"x\"===e.toLowerCase()||\"*\"===e}function ce(e,r,t,n,o,i,s,a,u,c,p,f,l){return((r=ue(t)?\"\":ue(n)?\">=\"+t+\".0.0\":ue(o)?\">=\"+t+\".\"+n+\".0\":\">=\"+r)+\" \"+(a=ue(u)?\"\":ue(c)?\"<\"+(+u+1)+\".0.0\":ue(p)?\"<\"+u+\".\"+(+c+1)+\".0\":f?\"<=\"+u+\".\"+c+\".\"+p+\"-\"+f:\"<=\"+a)).trim()}function pe(e,r){for(var t=0;t<e.length;t++)if(!e[t].test(r))return!1;if(r.prerelease.length){for(t=0;t<e.length;t++)if(n(e[t].semver),e[t].semver!==se&&e[t].semver.prerelease.length>0){var o=e[t].semver;if(o.major===r.major&&o.minor===r.minor&&o.patch===r.patch)return!0}return!1}return!0}function fe(e,r,t){try{r=new ae(r,t)}catch(e){return!1}return r.test(e)}function le(e,r,t,n){var o,i,s,a,u;switch(e=new H(e,n),r=new ae(r,n),t){case\">\":o=W,i=ne,s=Y,a=\">\",u=\">=\";break;case\"<\":o=Y,i=te,s=W,a=\"<\",u=\"<=\";break;default:throw new TypeError('Must provide a hilo val of \"<\" or \">\"')}if(fe(e,r,n))return!1;for(var c=0;c<r.set.length;++c){var p=r.set[c],f=null,l=null;if(p.forEach((function(e){e.semver===se&&(e=new ie(\">=0.0.0\")),f=f||e,l=l||e,o(e.semver,f.semver,n)?f=e:s(e.semver,l.semver,n)&&(l=e)})),f.operator===a||f.operator===u)return!1;if((!l.operator||l.operator===a)&&i(e,l.semver))return!1;if(l.operator===u&&s(e,l.semver))return!1}return!0}ie.prototype.parse=function(e){var r=this.loose?s[D]:s[X],t=e.match(r);if(!t)throw new TypeError(\"Invalid comparator: \"+e);this.operator=t[1],\"=\"===this.operator&&(this.operator=\"\"),t[2]?this.semver=new H(t[2],this.loose):this.semver=se},ie.prototype.toString=function(){return this.value},ie.prototype.test=function(e){return n(\"Comparator.test\",e,this.loose),this.semver===se||(\"string\"==typeof e&&(e=new H(e,this.loose)),oe(e,this.operator,this.semver,this.loose))},ie.prototype.intersects=function(e,r){if(!(e instanceof ie))throw new TypeError(\"a Comparator is required\");var t;if(\"\"===this.operator)return t=new ae(e.value,r),fe(this.value,t,r);if(\"\"===e.operator)return t=new ae(this.value,r),fe(e.semver,t,r);var n=!(\">=\"!==this.operator&&\">\"!==this.operator||\">=\"!==e.operator&&\">\"!==e.operator),o=!(\"<=\"!==this.operator&&\"<\"!==this.operator||\"<=\"!==e.operator&&\"<\"!==e.operator),i=this.semver.version===e.semver.version,s=!(\">=\"!==this.operator&&\"<=\"!==this.operator||\">=\"!==e.operator&&\"<=\"!==e.operator),a=oe(this.semver,\"<\",e.semver,r)&&(\">=\"===this.operator||\">\"===this.operator)&&(\"<=\"===e.operator||\"<\"===e.operator),u=oe(this.semver,\">\",e.semver,r)&&(\"<=\"===this.operator||\"<\"===this.operator)&&(\">=\"===e.operator||\">\"===e.operator);return n||o||i&&s||a||u},r.Range=ae,ae.prototype.format=function(){return this.range=this.set.map((function(e){return e.join(\" \").trim()})).join(\"||\").trim(),this.range},ae.prototype.toString=function(){return this.range},ae.prototype.parseRange=function(e){var r=this.loose;e=e.trim(),n(\"range\",e,r);var t=r?s[Z]:s[G];e=e.replace(t,ce),n(\"hyphen replace\",e),e=e.replace(s[z],\"$1$2$3\"),n(\"comparator trim\",e,s[z]),e=(e=(e=e.replace(s[M],\"$1~\")).replace(s[L],\"$1^\")).split(/\\s+/).join(\" \");var o=r?s[D]:s[X],i=e.split(\" \").map((function(e){return function(e,r){return n(\"comp\",e),e=function(e,r){return e.trim().split(/\\s+/).map((function(e){return function(e,r){n(\"caret\",e,r);var t=r?s[q]:s[N];return e.replace(t,(function(r,t,o,i,s){var a;return n(\"caret\",e,r,t,o,i,s),ue(t)?a=\"\":ue(o)?a=\">=\"+t+\".0.0 <\"+(+t+1)+\".0.0\":ue(i)?a=\"0\"===t?\">=\"+t+\".\"+o+\".0 <\"+t+\".\"+(+o+1)+\".0\":\">=\"+t+\".\"+o+\".0 <\"+(+t+1)+\".0.0\":s?(n(\"replaceCaret pr\",s),\"-\"!==s.charAt(0)&&(s=\"-\"+s),a=\"0\"===t?\"0\"===o?\">=\"+t+\".\"+o+\".\"+i+s+\" <\"+t+\".\"+o+\".\"+(+i+1):\">=\"+t+\".\"+o+\".\"+i+s+\" <\"+t+\".\"+(+o+1)+\".0\":\">=\"+t+\".\"+o+\".\"+i+s+\" <\"+(+t+1)+\".0.0\"):(n(\"no pr\"),a=\"0\"===t?\"0\"===o?\">=\"+t+\".\"+o+\".\"+i+\" <\"+t+\".\"+o+\".\"+(+i+1):\">=\"+t+\".\"+o+\".\"+i+\" <\"+t+\".\"+(+o+1)+\".0\":\">=\"+t+\".\"+o+\".\"+i+\" <\"+(+t+1)+\".0.0\"),n(\"caret return\",a),a}))}(e,r)})).join(\" \")}(e,r),n(\"caret\",e),e=function(e,r){return e.trim().split(/\\s+/).map((function(e){return function(e,r){var t=r?s[P]:s[V];return e.replace(t,(function(r,t,o,i,s){var a;return n(\"tilde\",e,r,t,o,i,s),ue(t)?a=\"\":ue(o)?a=\">=\"+t+\".0.0 <\"+(+t+1)+\".0.0\":ue(i)?a=\">=\"+t+\".\"+o+\".0 <\"+t+\".\"+(+o+1)+\".0\":s?(n(\"replaceTilde pr\",s),\"-\"!==s.charAt(0)&&(s=\"-\"+s),a=\">=\"+t+\".\"+o+\".\"+i+s+\" <\"+t+\".\"+(+o+1)+\".0\"):a=\">=\"+t+\".\"+o+\".\"+i+\" <\"+t+\".\"+(+o+1)+\".0\",n(\"tilde return\",a),a}))}(e,r)})).join(\" \")}(e,r),n(\"tildes\",e),e=function(e,r){return n(\"replaceXRanges\",e,r),e.split(/\\s+/).map((function(e){return function(e,r){e=e.trim();var t=r?s[_]:s[I];return e.replace(t,(function(r,t,o,i,s,a){n(\"xRange\",e,r,t,o,i,s,a);var u=ue(o),c=u||ue(i),p=c||ue(s);return\"=\"===t&&p&&(t=\"\"),u?r=\">\"===t||\"<\"===t?\"<0.0.0\":\"*\":t&&p?(c&&(i=0),p&&(s=0),\">\"===t?(t=\">=\",c?(o=+o+1,i=0,s=0):p&&(i=+i+1,s=0)):\"<=\"===t&&(t=\"<\",c?o=+o+1:i=+i+1),r=t+o+\".\"+i+\".\"+s):c?r=\">=\"+o+\".0.0 <\"+(+o+1)+\".0.0\":p&&(r=\">=\"+o+\".\"+i+\".0 <\"+o+\".\"+(+i+1)+\".0\"),n(\"xRange return\",r),r}))}(e,r)})).join(\" \")}(e,r),n(\"xrange\",e),e=function(e,r){return n(\"replaceStars\",e,r),e.trim().replace(s[B],\"\")}(e,r),n(\"stars\",e),e}(e,r)})).join(\" \").split(/\\s+/);return this.loose&&(i=i.filter((function(e){return!!e.match(o)}))),i=i.map((function(e){return new ie(e,r)}))},ae.prototype.intersects=function(e,r){if(!(e instanceof ae))throw new TypeError(\"a Range is required\");return this.set.some((function(t){return t.every((function(t){return e.set.some((function(e){return e.every((function(e){return t.intersects(e,r)}))}))}))}))},r.toComparators=function(e,r){return new ae(e,r).set.map((function(e){return e.map((function(e){return e.value})).join(\" \").trim().split(\" \")}))},ae.prototype.test=function(e){if(!e)return!1;\"string\"==typeof e&&(e=new H(e,this.loose));for(var r=0;r<this.set.length;r++)if(pe(this.set[r],e))return!0;return!1},r.satisfies=fe,r.maxSatisfying=function(e,r,t){var n=null,o=null;try{var i=new ae(r,t)}catch(e){return null}return e.forEach((function(e){i.test(e)&&(n&&-1!==o.compare(e)||(o=new H(n=e,t)))})),n},r.minSatisfying=function(e,r,t){var n=null,o=null;try{var i=new ae(r,t)}catch(e){return null}return e.forEach((function(e){i.test(e)&&(n&&1!==o.compare(e)||(o=new H(n=e,t)))})),n},r.validRange=function(e,r){try{return new ae(e,r).range||\"*\"}catch(e){return null}},r.ltr=function(e,r,t){return le(e,r,\"<\",t)},r.gtr=function(e,r,t){return le(e,r,\">\",t)},r.outside=le,r.prerelease=function(e,r){var t=F(e,r);return t&&t.prerelease.length?t.prerelease:null},r.intersects=function(e,r,t){return e=new ae(e,t),r=new ae(r,t),e.intersects(r)},r.coerce=function(e){if(e instanceof H)return e;if(\"string\"!=typeof e)return null;var r=e.match(s[O]);return null==r?null:F((r[1]||\"0\")+\".\"+(r[2]||\"0\")+\".\"+(r[3]||\"0\"))}}).call(this,t(1))},function(e,r){var t,n,o=e.exports={};function i(){throw new Error(\"setTimeout has not been defined\")}function s(){throw new Error(\"clearTimeout has not been defined\")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t=\"function\"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n=\"function\"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],p=!1,f=-1;function l(){p&&u&&(p=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!p){var e=a(l);p=!0;for(var r=c.length;r;){for(u=c,c=[];++f<r;)u&&u[f].run();f=-1,r=c.length}u=null,p=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(r){try{return n.call(null,e)}catch(r){return n.call(this,e)}}}(e)}}function v(e,r){this.fun=e,this.array=r}function m(){}o.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];c.push(new v(e,r)),1!==c.length||p||a(h)},v.prototype.run=function(){this.fun.apply(null,this.array)},o.title=\"browser\",o.browser=!0,o.env={},o.argv=[],o.version=\"\",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error(\"process.binding is not supported\")},o.cwd=function(){return\"/\"},o.chdir=function(e){throw new Error(\"process.chdir is not supported\")},o.umask=function(){return 0}}])}));\n\nexport const SEMVER_SPEC_VERSION = module.exports.SEMVER_SPEC_VERSION;\nexport const parse = module.exports.parse;\nexport const valid = module.exports.valid;\nexport const coerce = module.exports.coerce;\nexport const clean = module.exports.clean;\nexport const inc = module.exports.inc;\nexport const major = module.exports.major;\nexport const minor = module.exports.minor;\nexport const patch = module.exports.patch;\nexport const prerelease = module.exports.prerelease;\nexport const gt = module.exports.gt;\nexport const gte = module.exports.gte;\nexport const lt = module.exports.lt;\nexport const lte = module.exports.lte;\nexport const eq = module.exports.eq;\nexport const neq = module.exports.neq;\nexport const cmp = module.exports.cmp;\nexport const compare = module.exports.compare;\nexport const rcompare = module.exports.rcompare;\nexport const compareIdentifiers = module.exports.compareIdentifiers;\nexport const rcompareIdentifiers = module.exports.rcompareIdentifiers;\nexport const compareBuild = module.exports.compareBuild;\nexport const sort = module.exports.sort;\nexport const rsort = module.exports.rsort;\nexport const diff = module.exports.diff;\nexport const validRange = module.exports.validRange;\nexport const satisfies = module.exports.satisfies;\nexport const maxSatisfying = module.exports.maxSatisfying;\nexport const minSatisfying = module.exports.minSatisfying;\nexport const minVersion = module.exports.minVersion;\nexport const gtr = module.exports.gtr;\nexport const ltr = module.exports.ltr;\nexport const outside = module.exports.outside;\nexport const intersects = module.exports.intersects;\nexport const SemVer = module.exports.SemVer;\nexport const Comparator = module.exports.Comparator;\nexport const Range = module.exports.Range;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBufferReadableStream } from '../../../common/buffer.js';\n\nconst offlineName = 'Offline';\n\n/**\n * Checks if the given error is offline error\n */\nexport function isOfflineError(error: unknown): boolean {\n\tif (error instanceof OfflineError) {\n\t\treturn true;\n\t}\n\treturn error instanceof Error && error.name === offlineName && error.message === offlineName;\n}\n\nexport class OfflineError extends Error {\n\tconstructor() {\n\t\tsuper(offlineName);\n\t\tthis.name = this.message;\n\t}\n}\n\nexport interface IHeaders {\n\t'Proxy-Authorization'?: string;\n\t'x-operation-id'?: string;\n\t'retry-after'?: string;\n\tetag?: string;\n\t'Content-Length'?: string;\n\t'activityid'?: string;\n\t'X-Market-User-Id'?: string;\n\t[header: string]: string | string[] | undefined;\n}\n\nexport interface IRequestOptions {\n\ttype?: string;\n\turl?: string;\n\tuser?: string;\n\tpassword?: string;\n\theaders?: IHeaders;\n\ttimeout?: number;\n\tdata?: string;\n\tfollowRedirects?: number;\n\tproxyAuthorization?: string;\n\t/**\n\t * A signal to not cache the response. This may not\n\t * be supported in all implementations.\n\t */\n\tdisableCache?: boolean;\n}\n\nexport interface IRequestContext {\n\tres: {\n\t\theaders: IHeaders;\n\t\tstatusCode?: number;\n\t};\n\tstream: VSBufferReadableStream;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport Severity from '../../../base/common/severity.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { ILocalizedString } from '../../action/common/action.js';\nimport { ExtensionKind } from '../../environment/common/environment.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { getRemoteName } from '../../remote/common/remoteHosts.js';\n\nexport const USER_MANIFEST_CACHE_FILE = 'extensions.user.cache';\nexport const BUILTIN_MANIFEST_CACHE_FILE = 'extensions.builtin.cache';\nexport const UNDEFINED_PUBLISHER = 'undefined_publisher';\n\nexport interface ICommand {\n\tcommand: string;\n\ttitle: string | ILocalizedString;\n\tcategory?: string | ILocalizedString;\n}\n\nexport interface IDebugger {\n\tlabel?: string;\n\ttype: string;\n\truntime?: string;\n}\n\nexport interface IGrammar {\n\tlanguage?: string;\n}\n\nexport interface IJSONValidation {\n\tfileMatch: string | string[];\n\turl: string;\n}\n\nexport interface IKeyBinding {\n\tcommand: string;\n\tkey: string;\n\twhen?: string;\n\tmac?: string;\n\tlinux?: string;\n\twin?: string;\n}\n\nexport interface ILanguage {\n\tid: string;\n\textensions: string[];\n\taliases: string[];\n}\n\nexport interface IMenu {\n\tcommand: string;\n\talt?: string;\n\twhen?: string;\n\tgroup?: string;\n}\n\nexport interface ISnippet {\n\tlanguage: string;\n}\n\nexport interface ITheme {\n\tlabel: string;\n}\n\nexport interface IViewContainer {\n\tid: string;\n\ttitle: string;\n}\n\nexport interface IView {\n\tid: string;\n\tname: string;\n}\n\nexport interface IColor {\n\tid: string;\n\tdescription: string;\n\tdefaults: { light: string; dark: string; highContrast: string };\n}\n\ninterface IWebviewEditor {\n\treadonly viewType: string;\n\treadonly priority: string;\n\treadonly selector: readonly {\n\t\treadonly filenamePattern?: string;\n\t}[];\n}\n\nexport interface ICodeActionContributionAction {\n\treadonly kind: string;\n\treadonly title: string;\n\treadonly description?: string;\n}\n\nexport interface ICodeActionContribution {\n\treadonly languages: readonly string[];\n\treadonly actions: readonly ICodeActionContributionAction[];\n}\n\nexport interface IAuthenticationContribution {\n\treadonly id: string;\n\treadonly label: string;\n\treadonly authorizationServerGlobs?: string[];\n}\n\nexport interface IWalkthroughStep {\n\treadonly id: string;\n\treadonly title: string;\n\treadonly description: string | undefined;\n\treadonly media:\n\t| { image: string | { dark: string; light: string; hc: string }; altText: string; markdown?: never; svg?: never; video?: never }\n\t| { markdown: string; image?: never; svg?: never; video?: never }\n\t| { svg: string; altText: string; markdown?: never; image?: never; video?: never }\n\t| { video: string | { dark: string; light: string; hc: string }; poster: string | { dark: string; light: string; hc: string }; altText: string; markdown?: never; image?: never; svg?: never };\n\treadonly completionEvents?: string[];\n\t/** @deprecated use `completionEvents: 'onCommand:...'` */\n\treadonly doneOn?: { command: string };\n\treadonly when?: string;\n}\n\nexport interface IWalkthrough {\n\treadonly id: string;\n\treadonly title: string;\n\treadonly icon?: string;\n\treadonly description: string;\n\treadonly steps: IWalkthroughStep[];\n\treadonly featuredFor: string[] | undefined;\n\treadonly when?: string;\n}\n\nexport interface IStartEntry {\n\treadonly title: string;\n\treadonly description: string;\n\treadonly command: string;\n\treadonly when?: string;\n\treadonly category: 'file' | 'folder' | 'notebook';\n}\n\nexport interface INotebookEntry {\n\treadonly type: string;\n\treadonly displayName: string;\n}\n\nexport interface INotebookRendererContribution {\n\treadonly id: string;\n\treadonly displayName: string;\n\treadonly mimeTypes: string[];\n}\n\nexport interface IDebugVisualizationContribution {\n\treadonly id: string;\n\treadonly when: string;\n}\n\nexport interface ITranslation {\n\tid: string;\n\tpath: string;\n}\n\nexport interface ILocalizationContribution {\n\tlanguageId: string;\n\tlanguageName?: string;\n\tlocalizedLanguageName?: string;\n\ttranslations: ITranslation[];\n\tminimalTranslations?: { [key: string]: string };\n}\n\nexport interface IChatParticipantContribution {\n\tid: string;\n\tname: string;\n\tfullName: string;\n\tdescription?: string;\n\tisDefault?: boolean;\n\tcommands?: { name: string }[];\n}\n\nexport interface IToolContribution {\n\tname: string;\n\tdisplayName: string;\n\tmodelDescription: string;\n\tuserDescription?: string;\n}\n\nexport interface IToolSetContribution {\n\tname: string;\n\treferenceName: string;\n\tdescription: string;\n\ticon?: string;\n\ttools: string[];\n}\n\nexport interface IMcpCollectionContribution {\n\treadonly id: string;\n\treadonly label: string;\n}\n\nexport interface IExtensionContributions {\n\tcommands?: ICommand[];\n\tconfiguration?: any;\n\tdebuggers?: IDebugger[];\n\tgrammars?: IGrammar[];\n\tjsonValidation?: IJSONValidation[];\n\tkeybindings?: IKeyBinding[];\n\tlanguages?: ILanguage[];\n\tmenus?: { [context: string]: IMenu[] };\n\tsnippets?: ISnippet[];\n\tthemes?: ITheme[];\n\ticonThemes?: ITheme[];\n\tproductIconThemes?: ITheme[];\n\tviewsContainers?: { [location: string]: IViewContainer[] };\n\tviews?: { [location: string]: IView[] };\n\tcolors?: IColor[];\n\tlocalizations?: ILocalizationContribution[];\n\treadonly customEditors?: readonly IWebviewEditor[];\n\treadonly codeActions?: readonly ICodeActionContribution[];\n\tauthentication?: IAuthenticationContribution[];\n\twalkthroughs?: IWalkthrough[];\n\tstartEntries?: IStartEntry[];\n\treadonly notebooks?: INotebookEntry[];\n\treadonly notebookRenderer?: INotebookRendererContribution[];\n\treadonly debugVisualizers?: IDebugVisualizationContribution[];\n\treadonly chatParticipants?: ReadonlyArray<IChatParticipantContribution>;\n\treadonly languageModelTools?: ReadonlyArray<IToolContribution>;\n\treadonly languageModelToolSets?: ReadonlyArray<IToolSetContribution>;\n\treadonly mcpServerDefinitionProviders?: ReadonlyArray<IMcpCollectionContribution>;\n}\n\nexport interface IExtensionCapabilities {\n\treadonly virtualWorkspaces?: ExtensionVirtualWorkspaceSupport;\n\treadonly untrustedWorkspaces?: ExtensionUntrustedWorkspaceSupport;\n}\n\n\nexport const ALL_EXTENSION_KINDS: readonly ExtensionKind[] = ['ui', 'workspace', 'web'];\n\nexport type LimitedWorkspaceSupportType = 'limited';\nexport type ExtensionUntrustedWorkspaceSupportType = boolean | LimitedWorkspaceSupportType;\nexport type ExtensionUntrustedWorkspaceSupport = { supported: true } | { supported: false; description: string } | { supported: LimitedWorkspaceSupportType; description: string; restrictedConfigurations?: string[] };\n\nexport type ExtensionVirtualWorkspaceSupportType = boolean | LimitedWorkspaceSupportType;\nexport type ExtensionVirtualWorkspaceSupport = boolean | { supported: true } | { supported: false | LimitedWorkspaceSupportType; description: string };\n\nexport function getWorkspaceSupportTypeMessage(supportType: ExtensionUntrustedWorkspaceSupport | ExtensionVirtualWorkspaceSupport | undefined): string | undefined {\n\tif (typeof supportType === 'object' && supportType !== null) {\n\t\tif (supportType.supported !== true) {\n\t\t\treturn supportType.description;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n\nexport interface IExtensionIdentifier {\n\tid: string;\n\tuuid?: string;\n}\n\nexport const EXTENSION_CATEGORIES = [\n\t'AI',\n\t'Azure',\n\t'Chat',\n\t'Data Science',\n\t'Debuggers',\n\t'Extension Packs',\n\t'Education',\n\t'Formatters',\n\t'Keymaps',\n\t'Language Packs',\n\t'Linters',\n\t'Machine Learning',\n\t'Notebooks',\n\t'Programming Languages',\n\t'SCM Providers',\n\t'Snippets',\n\t'Testing',\n\t'Themes',\n\t'Visualization',\n\t'Other',\n];\n\nexport interface IRelaxedExtensionManifest {\n\tname: string;\n\tdisplayName?: string;\n\tpublisher: string;\n\tversion: string;\n\tengines: { readonly vscode: string };\n\tdescription?: string;\n\tmain?: string;\n\ttype?: string;\n\tbrowser?: string;\n\tpreview?: boolean;\n\t// For now this only supports pointing to l10n bundle files\n\t// but it will be used for package.l10n.json files in the future\n\tl10n?: string;\n\ticon?: string;\n\tcategories?: string[];\n\tkeywords?: string[];\n\tactivationEvents?: string[];\n\textensionDependencies?: string[];\n\textensionPack?: string[];\n\textensionKind?: ExtensionKind | ExtensionKind[];\n\tcontributes?: IExtensionContributions;\n\trepository?: { url: string };\n\tbugs?: { url: string };\n\toriginalEnabledApiProposals?: readonly string[];\n\tenabledApiProposals?: readonly string[];\n\tapi?: string;\n\tscripts?: { [key: string]: string };\n\tcapabilities?: IExtensionCapabilities;\n}\n\nexport type IExtensionManifest = Readonly<IRelaxedExtensionManifest>;\n\nexport const enum ExtensionType {\n\tSystem,\n\tUser\n}\n\nexport const enum TargetPlatform {\n\tWIN32_X64 = 'win32-x64',\n\tWIN32_ARM64 = 'win32-arm64',\n\n\tLINUX_X64 = 'linux-x64',\n\tLINUX_ARM64 = 'linux-arm64',\n\tLINUX_ARMHF = 'linux-armhf',\n\n\tALPINE_X64 = 'alpine-x64',\n\tALPINE_ARM64 = 'alpine-arm64',\n\n\tDARWIN_X64 = 'darwin-x64',\n\tDARWIN_ARM64 = 'darwin-arm64',\n\n\tWEB = 'web',\n\n\tUNIVERSAL = 'universal',\n\tUNKNOWN = 'unknown',\n\tUNDEFINED = 'undefined',\n}\n\nexport interface IExtension {\n\treadonly type: ExtensionType;\n\treadonly isBuiltin: boolean;\n\treadonly identifier: IExtensionIdentifier;\n\treadonly manifest: IExtensionManifest;\n\treadonly location: URI;\n\treadonly targetPlatform: TargetPlatform;\n\treadonly publisherDisplayName?: string;\n\treadonly readmeUrl?: URI;\n\treadonly changelogUrl?: URI;\n\treadonly isValid: boolean;\n\treadonly validations: readonly [Severity, string][];\n\treadonly preRelease: boolean;\n}\n\n/**\n * **!Do not construct directly!**\n *\n * **!Only static methods because it gets serialized!**\n *\n * This represents the \"canonical\" version for an extension identifier. Extension ids\n * have to be case-insensitive (due to the marketplace), but we must ensure case\n * preservation because the extension API is already public at this time.\n *\n * For example, given an extension with the publisher `\"Hello\"` and the name `\"World\"`,\n * its canonical extension identifier is `\"Hello.World\"`. This extension could be\n * referenced in some other extension's dependencies using the string `\"hello.world\"`.\n *\n * To make matters more complicated, an extension can optionally have an UUID. When two\n * extensions have the same UUID, they are considered equal even if their identifier is different.\n */\nexport class ExtensionIdentifier {\n\tpublic readonly value: string;\n\n\t/**\n\t * Do not use directly. This is public to avoid mangling and thus\n\t * allow compatibility between running from source and a built version.\n\t */\n\treadonly _lower: string;\n\n\tconstructor(value: string) {\n\t\tthis.value = value;\n\t\tthis._lower = value.toLowerCase();\n\t}\n\n\tpublic static equals(a: ExtensionIdentifier | string | null | undefined, b: ExtensionIdentifier | string | null | undefined) {\n\t\tif (typeof a === 'undefined' || a === null) {\n\t\t\treturn (typeof b === 'undefined' || b === null);\n\t\t}\n\t\tif (typeof b === 'undefined' || b === null) {\n\t\t\treturn false;\n\t\t}\n\t\tif (typeof a === 'string' || typeof b === 'string') {\n\t\t\t// At least one of the arguments is an extension id in string form,\n\t\t\t// so we have to use the string comparison which ignores case.\n\t\t\tconst aValue = (typeof a === 'string' ? a : a.value);\n\t\t\tconst bValue = (typeof b === 'string' ? b : b.value);\n\t\t\treturn strings.equalsIgnoreCase(aValue, bValue);\n\t\t}\n\n\t\t// Now we know both arguments are ExtensionIdentifier\n\t\treturn (a._lower === b._lower);\n\t}\n\n\t/**\n\t * Gives the value by which to index (for equality).\n\t */\n\tpublic static toKey(id: ExtensionIdentifier | string): string {\n\t\tif (typeof id === 'string') {\n\t\t\treturn id.toLowerCase();\n\t\t}\n\t\treturn id._lower;\n\t}\n}\n\nexport class ExtensionIdentifierSet {\n\n\tprivate readonly _set = new Set<string>();\n\n\tpublic get size(): number {\n\t\treturn this._set.size;\n\t}\n\n\tconstructor(iterable?: Iterable<ExtensionIdentifier | string>) {\n\t\tif (iterable) {\n\t\t\tfor (const value of iterable) {\n\t\t\t\tthis.add(value);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic add(id: ExtensionIdentifier | string): void {\n\t\tthis._set.add(ExtensionIdentifier.toKey(id));\n\t}\n\n\tpublic delete(extensionId: ExtensionIdentifier): boolean {\n\t\treturn this._set.delete(ExtensionIdentifier.toKey(extensionId));\n\t}\n\n\tpublic has(id: ExtensionIdentifier | string): boolean {\n\t\treturn this._set.has(ExtensionIdentifier.toKey(id));\n\t}\n}\n\nexport class ExtensionIdentifierMap<T> {\n\n\tprivate readonly _map = new Map<string, T>();\n\n\tpublic clear(): void {\n\t\tthis._map.clear();\n\t}\n\n\tpublic delete(id: ExtensionIdentifier | string): void {\n\t\tthis._map.delete(ExtensionIdentifier.toKey(id));\n\t}\n\n\tpublic get(id: ExtensionIdentifier | string): T | undefined {\n\t\treturn this._map.get(ExtensionIdentifier.toKey(id));\n\t}\n\n\tpublic has(id: ExtensionIdentifier | string): boolean {\n\t\treturn this._map.has(ExtensionIdentifier.toKey(id));\n\t}\n\n\tpublic set(id: ExtensionIdentifier | string, value: T): void {\n\t\tthis._map.set(ExtensionIdentifier.toKey(id), value);\n\t}\n\n\tpublic values(): IterableIterator<T> {\n\t\treturn this._map.values();\n\t}\n\n\tforEach(callbackfn: (value: T, key: string, map: Map<string, T>) => void): void {\n\t\tthis._map.forEach(callbackfn);\n\t}\n\n\t[Symbol.iterator](): IterableIterator<[string, T]> {\n\t\treturn this._map[Symbol.iterator]();\n\t}\n}\n\n/**\n * An error that is clearly from an extension, identified by the `ExtensionIdentifier`\n */\nexport class ExtensionError extends Error {\n\n\treadonly extension: ExtensionIdentifier;\n\n\tconstructor(extensionIdentifier: ExtensionIdentifier, cause: Error, message?: string) {\n\t\tsuper(`Error in extension ${ExtensionIdentifier.toKey(extensionIdentifier)}: ${message ?? cause.message}`, { cause });\n\t\tthis.name = 'ExtensionError';\n\t\tthis.extension = extensionIdentifier;\n\t}\n}\n\nexport interface IRelaxedExtensionDescription extends IRelaxedExtensionManifest {\n\tid?: string;\n\tidentifier: ExtensionIdentifier;\n\tuuid?: string;\n\tpublisherDisplayName?: string;\n\ttargetPlatform: TargetPlatform;\n\tisBuiltin: boolean;\n\tisUserBuiltin: boolean;\n\tisUnderDevelopment: boolean;\n\textensionLocation: URI;\n\tpreRelease: boolean;\n}\n\nexport type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;\n\nexport function isApplicationScopedExtension(manifest: IExtensionManifest): boolean {\n\treturn isLanguagePackExtension(manifest);\n}\n\nexport function isLanguagePackExtension(manifest: IExtensionManifest): boolean {\n\treturn manifest.contributes && manifest.contributes.localizations ? manifest.contributes.localizations.length > 0 : false;\n}\n\nexport function isAuthenticationProviderExtension(manifest: IExtensionManifest): boolean {\n\treturn manifest.contributes && manifest.contributes.authentication ? manifest.contributes.authentication.length > 0 : false;\n}\n\nexport function isResolverExtension(manifest: IExtensionManifest, remoteAuthority: string | undefined): boolean {\n\tif (remoteAuthority) {\n\t\tconst activationEvent = `onResolveRemoteAuthority:${getRemoteName(remoteAuthority)}`;\n\t\treturn !!manifest.activationEvents?.includes(activationEvent);\n\t}\n\treturn false;\n}\n\nexport function parseApiProposals(enabledApiProposals: string[]): { proposalName: string; version?: number }[] {\n\treturn enabledApiProposals.map(proposal => {\n\t\tconst [proposalName, version] = proposal.split('@');\n\t\treturn { proposalName, version: version ? parseInt(version) : undefined };\n\t});\n}\n\nexport function parseEnabledApiProposalNames(enabledApiProposals: string[]): string[] {\n\treturn enabledApiProposals.map(proposal => proposal.split('@')[0]);\n}\n\nexport const IBuiltinExtensionsScannerService = createDecorator<IBuiltinExtensionsScannerService>('IBuiltinExtensionsScannerService');\nexport interface IBuiltinExtensionsScannerService {\n\treadonly _serviceBrand: undefined;\n\tscanBuiltinExtensions(): Promise<IExtension[]>;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { compareIgnoreCase } from '../../../base/common/strings.js';\nimport { IExtensionIdentifier, IGalleryExtension, ILocalExtension, MaliciousExtensionInfo, getTargetPlatform } from './extensionManagement.js';\nimport { ExtensionIdentifier, IExtension, TargetPlatform, UNDEFINED_PUBLISHER } from '../../extensions/common/extensions.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { isLinux, platform } from '../../../base/common/platform.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { getErrorMessage } from '../../../base/common/errors.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { arch } from '../../../base/common/process.js';\nimport { TelemetryTrustedValue } from '../../telemetry/common/telemetryUtils.js';\nimport { isString } from '../../../base/common/types.js';\n\nexport function areSameExtensions(a: IExtensionIdentifier, b: IExtensionIdentifier): boolean {\n\tif (a.uuid && b.uuid) {\n\t\treturn a.uuid === b.uuid;\n\t}\n\tif (a.id === b.id) {\n\t\treturn true;\n\t}\n\treturn compareIgnoreCase(a.id, b.id) === 0;\n}\n\nconst ExtensionKeyRegex = /^([^.]+\\..+)-(\\d+\\.\\d+\\.\\d+)(-(.+))?$/;\n\nexport class ExtensionKey {\n\n\tstatic create(extension: IExtension | IGalleryExtension): ExtensionKey {\n\t\tconst version = (extension as IExtension).manifest ? (extension as IExtension).manifest.version : (extension as IGalleryExtension).version;\n\t\tconst targetPlatform = (extension as IExtension).manifest ? (extension as IExtension).targetPlatform : (extension as IGalleryExtension).properties.targetPlatform;\n\t\treturn new ExtensionKey(extension.identifier, version, targetPlatform);\n\t}\n\n\tstatic parse(key: string): ExtensionKey | null {\n\t\tconst matches = ExtensionKeyRegex.exec(key);\n\t\treturn matches && matches[1] && matches[2] ? new ExtensionKey({ id: matches[1] }, matches[2], matches[4] as TargetPlatform || undefined) : null;\n\t}\n\n\treadonly id: string;\n\n\tconstructor(\n\t\treadonly identifier: IExtensionIdentifier,\n\t\treadonly version: string,\n\t\treadonly targetPlatform: TargetPlatform = TargetPlatform.UNDEFINED,\n\t) {\n\t\tthis.id = identifier.id;\n\t}\n\n\ttoString(): string {\n\t\treturn `${this.id}-${this.version}${this.targetPlatform !== TargetPlatform.UNDEFINED ? `-${this.targetPlatform}` : ''}`;\n\t}\n\n\tequals(o: any): boolean {\n\t\tif (!(o instanceof ExtensionKey)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn areSameExtensions(this, o) && this.version === o.version && this.targetPlatform === o.targetPlatform;\n\t}\n}\n\nconst EXTENSION_IDENTIFIER_WITH_VERSION_REGEX = /^([^.]+\\..+)@((prerelease)|(\\d+\\.\\d+\\.\\d+(-.*)?))$/;\nexport function getIdAndVersion(id: string): [string, string | undefined] {\n\tconst matches = EXTENSION_IDENTIFIER_WITH_VERSION_REGEX.exec(id);\n\tif (matches && matches[1]) {\n\t\treturn [adoptToGalleryExtensionId(matches[1]), matches[2]];\n\t}\n\treturn [adoptToGalleryExtensionId(id), undefined];\n}\n\nexport function getExtensionId(publisher: string, name: string): string {\n\treturn `${publisher}.${name}`;\n}\n\nexport function adoptToGalleryExtensionId(id: string): string {\n\treturn id.toLowerCase();\n}\n\nexport function getGalleryExtensionId(publisher: string | undefined, name: string): string {\n\treturn adoptToGalleryExtensionId(getExtensionId(publisher ?? UNDEFINED_PUBLISHER, name));\n}\n\nexport function groupByExtension<T>(extensions: T[], getExtensionIdentifier: (t: T) => IExtensionIdentifier): T[][] {\n\tconst byExtension: T[][] = [];\n\tconst findGroup = (extension: T) => {\n\t\tfor (const group of byExtension) {\n\t\t\tif (group.some(e => areSameExtensions(getExtensionIdentifier(e), getExtensionIdentifier(extension)))) {\n\t\t\t\treturn group;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t};\n\tfor (const extension of extensions) {\n\t\tconst group = findGroup(extension);\n\t\tif (group) {\n\t\t\tgroup.push(extension);\n\t\t} else {\n\t\t\tbyExtension.push([extension]);\n\t\t}\n\t}\n\treturn byExtension;\n}\n\nexport function getLocalExtensionTelemetryData(extension: ILocalExtension) {\n\treturn {\n\t\tid: extension.identifier.id,\n\t\tname: extension.manifest.name,\n\t\tgalleryId: null,\n\t\tpublisherId: extension.publisherId,\n\t\tpublisherName: extension.manifest.publisher,\n\t\tpublisherDisplayName: extension.publisherDisplayName,\n\t\tdependencies: extension.manifest.extensionDependencies && extension.manifest.extensionDependencies.length > 0\n\t};\n}\n\n\n/* __GDPR__FRAGMENT__\n\t\"GalleryExtensionTelemetryData\" : {\n\t\t\"id\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"name\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"extensionVersion\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"galleryId\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"publisherId\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"publisherName\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"publisherDisplayName\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"isPreReleaseVersion\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"dependencies\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\", \"isMeasurement\": true },\n\t\t\"isSigned\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"${include}\": [\n\t\t\t\"${GalleryExtensionTelemetryData2}\"\n\t\t]\n\t}\n*/\nexport function getGalleryExtensionTelemetryData(extension: IGalleryExtension) {\n\treturn {\n\t\tid: new TelemetryTrustedValue(extension.identifier.id),\n\t\tname: new TelemetryTrustedValue(extension.name),\n\t\textensionVersion: extension.version,\n\t\tgalleryId: extension.identifier.uuid,\n\t\tpublisherId: extension.publisherId,\n\t\tpublisherName: extension.publisher,\n\t\tpublisherDisplayName: extension.publisherDisplayName,\n\t\tisPreReleaseVersion: extension.properties.isPreReleaseVersion,\n\t\tdependencies: !!(extension.properties.dependencies && extension.properties.dependencies.length > 0),\n\t\tisSigned: extension.isSigned,\n\t\t...extension.telemetryData\n\t};\n}\n\nexport const BetterMergeId = new ExtensionIdentifier('pprice.better-merge');\n\nexport function getExtensionDependencies(installedExtensions: ReadonlyArray<IExtension>, extension: IExtension): IExtension[] {\n\tconst dependencies: IExtension[] = [];\n\tconst extensions = extension.manifest.extensionDependencies?.slice(0) ?? [];\n\n\twhile (extensions.length) {\n\t\tconst id = extensions.shift();\n\n\t\tif (id && dependencies.every(e => !areSameExtensions(e.identifier, { id }))) {\n\t\t\tconst ext = installedExtensions.filter(e => areSameExtensions(e.identifier, { id }));\n\t\t\tif (ext.length === 1) {\n\t\t\t\tdependencies.push(ext[0]);\n\t\t\t\textensions.push(...ext[0].manifest.extensionDependencies?.slice(0) ?? []);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dependencies;\n}\n\nasync function isAlpineLinux(fileService: IFileService, logService: ILogService): Promise<boolean> {\n\tif (!isLinux) {\n\t\treturn false;\n\t}\n\tlet content: string | undefined;\n\ttry {\n\t\tconst fileContent = await fileService.readFile(URI.file('/etc/os-release'));\n\t\tcontent = fileContent.value.toString();\n\t} catch (error) {\n\t\ttry {\n\t\t\tconst fileContent = await fileService.readFile(URI.file('/usr/lib/os-release'));\n\t\t\tcontent = fileContent.value.toString();\n\t\t} catch (error) {\n\t\t\t/* Ignore */\n\t\t\tlogService.debug(`Error while getting the os-release file.`, getErrorMessage(error));\n\t\t}\n\t}\n\treturn !!content && (content.match(/^ID=([^\\u001b\\r\\n]*)/m) || [])[1] === 'alpine';\n}\n\nexport async function computeTargetPlatform(fileService: IFileService, logService: ILogService): Promise<TargetPlatform> {\n\tconst alpineLinux = await isAlpineLinux(fileService, logService);\n\tconst targetPlatform = getTargetPlatform(alpineLinux ? 'alpine' : platform, arch);\n\tlogService.debug('ComputeTargetPlatform:', targetPlatform);\n\treturn targetPlatform;\n}\n\nexport function isMalicious(identifier: IExtensionIdentifier, malicious: ReadonlyArray<MaliciousExtensionInfo>): boolean {\n\treturn findMatchingMaliciousEntry(identifier, malicious) !== undefined;\n}\n\nexport function findMatchingMaliciousEntry(identifier: IExtensionIdentifier, malicious: ReadonlyArray<MaliciousExtensionInfo>): MaliciousExtensionInfo | undefined {\n\treturn malicious.find(({ extensionOrPublisher }) => {\n\t\tif (isString(extensionOrPublisher)) {\n\t\t\treturn compareIgnoreCase(identifier.id.split('.')[0], extensionOrPublisher) === 0;\n\t\t}\n\t\treturn areSameExtensions(identifier, extensionOrPublisher);\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as strings from './strings.js';\n\nenum Severity {\n\tIgnore = 0,\n\tInfo = 1,\n\tWarning = 2,\n\tError = 3\n}\n\nnamespace Severity {\n\n\tconst _error = 'error';\n\tconst _warning = 'warning';\n\tconst _warn = 'warn';\n\tconst _info = 'info';\n\tconst _ignore = 'ignore';\n\n\t/**\n\t * Parses 'error', 'warning', 'warn', 'info' in call casings\n\t * and falls back to ignore.\n\t */\n\texport function fromValue(value: string): Severity {\n\t\tif (!value) {\n\t\t\treturn Severity.Ignore;\n\t\t}\n\n\t\tif (strings.equalsIgnoreCase(_error, value)) {\n\t\t\treturn Severity.Error;\n\t\t}\n\n\t\tif (strings.equalsIgnoreCase(_warning, value) || strings.equalsIgnoreCase(_warn, value)) {\n\t\t\treturn Severity.Warning;\n\t\t}\n\n\t\tif (strings.equalsIgnoreCase(_info, value)) {\n\t\t\treturn Severity.Info;\n\t\t}\n\t\treturn Severity.Ignore;\n\t}\n\n\texport function toString(severity: Severity): string {\n\t\tswitch (severity) {\n\t\t\tcase Severity.Error: return _error;\n\t\t\tcase Severity.Warning: return _warning;\n\t\t\tcase Severity.Info: return _info;\n\t\t\tdefault: return _ignore;\n\t\t}\n\t}\n}\n\nexport default Severity;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.\n\nconst _allApiProposals = {\n\tactiveComment: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.activeComment.d.ts',\n\t},\n\taiRelatedInformation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts',\n\t},\n\taiSettingsSearch: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiSettingsSearch.d.ts',\n\t},\n\taiTextSearchProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts',\n\t\tversion: 2\n\t},\n\tauthIssuers: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authIssuers.d.ts',\n\t},\n\tauthLearnMore: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authLearnMore.d.ts',\n\t},\n\tauthProviderSpecific: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authProviderSpecific.d.ts',\n\t},\n\tauthSession: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts',\n\t},\n\tcanonicalUriProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts',\n\t},\n\tchatEditing: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatEditing.d.ts',\n\t},\n\tchatParticipantAdditions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts',\n\t},\n\tchatParticipantPrivate: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts',\n\t\tversion: 9\n\t},\n\tchatProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts',\n\t},\n\tchatReferenceBinaryData: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts',\n\t},\n\tchatReferenceDiagnostic: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceDiagnostic.d.ts',\n\t},\n\tchatStatusItem: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatStatusItem.d.ts',\n\t},\n\tchatTab: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatTab.d.ts',\n\t},\n\tcodeActionAI: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionAI.d.ts',\n\t},\n\tcodeActionRanges: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionRanges.d.ts',\n\t},\n\tcodiconDecoration: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codiconDecoration.d.ts',\n\t},\n\tcommentReactor: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReactor.d.ts',\n\t},\n\tcommentReveal: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReveal.d.ts',\n\t},\n\tcommentThreadApplicability: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts',\n\t},\n\tcommentingRangeHint: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentingRangeHint.d.ts',\n\t},\n\tcommentsDraftState: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentsDraftState.d.ts',\n\t},\n\tcontribAccessibilityHelpContent: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts',\n\t},\n\tcontribCommentEditorActionsMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts',\n\t},\n\tcontribCommentPeekContext: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts',\n\t},\n\tcontribCommentThreadAdditionalMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts',\n\t},\n\tcontribCommentsViewThreadMenus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts',\n\t},\n\tcontribDebugCreateConfiguration: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts',\n\t},\n\tcontribDiffEditorGutterToolBarMenus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts',\n\t},\n\tcontribEditSessions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditSessions.d.ts',\n\t},\n\tcontribEditorContentMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts',\n\t},\n\tcontribLabelFormatterWorkspaceTooltip: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts',\n\t},\n\tcontribLanguageModelToolSets: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLanguageModelToolSets.d.ts',\n\t},\n\tcontribMenuBarHome: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts',\n\t},\n\tcontribMergeEditorMenus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts',\n\t},\n\tcontribMultiDiffEditorMenus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts',\n\t},\n\tcontribNotebookStaticPreloads: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts',\n\t},\n\tcontribRemoteHelp: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts',\n\t},\n\tcontribShareMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribShareMenu.d.ts',\n\t},\n\tcontribSourceControlHistoryItemMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts',\n\t},\n\tcontribSourceControlHistoryTitleMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts',\n\t},\n\tcontribSourceControlInputBoxMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts',\n\t},\n\tcontribSourceControlTitleMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts',\n\t},\n\tcontribStatusBarItems: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts',\n\t},\n\tcontribViewContainerTitle: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts',\n\t},\n\tcontribViewsRemote: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts',\n\t},\n\tcontribViewsWelcome: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts',\n\t},\n\tcustomEditorMove: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.d.ts',\n\t},\n\tdebugVisualization: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.debugVisualization.d.ts',\n\t},\n\tdefaultChatParticipant: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts',\n\t\tversion: 4\n\t},\n\tdiffCommand: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffCommand.d.ts',\n\t},\n\tdiffContentOptions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffContentOptions.d.ts',\n\t},\n\tdocumentFiltersExclusive: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts',\n\t},\n\teditSessionIdentityProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts',\n\t},\n\teditorHoverVerbosityLevel: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts',\n\t},\n\teditorInsets: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts',\n\t},\n\tembeddings: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.embeddings.d.ts',\n\t},\n\textensionRuntime: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts',\n\t},\n\textensionsAny: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionsAny.d.ts',\n\t},\n\texternalUriOpener: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts',\n\t},\n\tfileSearchProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider.d.ts',\n\t},\n\tfileSearchProvider2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts',\n\t},\n\tfindFiles2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findFiles2.d.ts',\n\t\tversion: 2\n\t},\n\tfindTextInFiles: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles.d.ts',\n\t},\n\tfindTextInFiles2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles2.d.ts',\n\t},\n\tfsChunks: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts',\n\t},\n\tidToken: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.idToken.d.ts',\n\t},\n\tinlineCompletionsAdditions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts',\n\t},\n\tinteractive: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactive.d.ts',\n\t},\n\tinteractiveWindow: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveWindow.d.ts',\n\t},\n\tipc: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts',\n\t},\n\tlanguageModelCapabilities: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelCapabilities.d.ts',\n\t},\n\tlanguageModelDataPart: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelDataPart.d.ts',\n\t\tversion: 3\n\t},\n\tlanguageModelSystem: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelSystem.d.ts',\n\t},\n\tlanguageStatusText: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatusText.d.ts',\n\t},\n\tmappedEditsProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts',\n\t},\n\tmultiDocumentHighlightProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts',\n\t},\n\tnativeWindowHandle: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.nativeWindowHandle.d.ts',\n\t},\n\tnewSymbolNamesProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts',\n\t},\n\tnotebookCellExecution: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecution.d.ts',\n\t},\n\tnotebookControllerAffinityHidden: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts',\n\t},\n\tnotebookDeprecated: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts',\n\t},\n\tnotebookExecution: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookExecution.d.ts',\n\t},\n\tnotebookKernelSource: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookKernelSource.d.ts',\n\t},\n\tnotebookLiveShare: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookLiveShare.d.ts',\n\t},\n\tnotebookMessaging: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts',\n\t},\n\tnotebookMime: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMime.d.ts',\n\t},\n\tnotebookReplDocument: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookReplDocument.d.ts',\n\t},\n\tnotebookVariableProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts',\n\t},\n\tportsAttributes: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts',\n\t},\n\tprofileContentHandlers: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.profileContentHandlers.d.ts',\n\t},\n\tquickDiffProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickDiffProvider.d.ts',\n\t},\n\tquickInputButtonLocation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickInputButtonLocation.d.ts',\n\t},\n\tquickPickItemTooltip: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts',\n\t},\n\tquickPickSortByLabel: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts',\n\t},\n\tremoteCodingAgents: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.remoteCodingAgents.d.ts',\n\t},\n\tresolvers: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.resolvers.d.ts',\n\t},\n\tscmActionButton: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmActionButton.d.ts',\n\t},\n\tscmHistoryProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts',\n\t},\n\tscmMultiDiffEditor: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts',\n\t},\n\tscmSelectedProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts',\n\t},\n\tscmTextDocument: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmTextDocument.d.ts',\n\t},\n\tscmValidation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmValidation.d.ts',\n\t},\n\tshareProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.shareProvider.d.ts',\n\t},\n\tspeech: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.speech.d.ts',\n\t},\n\tstatusBarItemTooltip: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts',\n\t},\n\ttabInputMultiDiff: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts',\n\t},\n\ttabInputTextMerge: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts',\n\t},\n\ttaskPresentationGroup: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts',\n\t},\n\ttaskProblemMatcherStatus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskProblemMatcherStatus.d.ts',\n\t},\n\ttelemetry: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.telemetry.d.ts',\n\t},\n\tterminalCompletionProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalCompletionProvider.d.ts',\n\t},\n\tterminalDataWriteEvent: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts',\n\t},\n\tterminalDimensions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts',\n\t},\n\tterminalExecuteCommandEvent: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts',\n\t},\n\tterminalQuickFixProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts',\n\t},\n\tterminalSelection: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts',\n\t},\n\tterminalShellEnv: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalShellEnv.d.ts',\n\t},\n\ttestObserver: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',\n\t},\n\ttestRelatedCode: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testRelatedCode.d.ts',\n\t},\n\ttextDocumentChangeReason: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textDocumentChangeReason.d.ts',\n\t},\n\ttextEditorDiffInformation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textEditorDiffInformation.d.ts',\n\t},\n\ttextSearchComplete2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchComplete2.d.ts',\n\t},\n\ttextSearchProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',\n\t},\n\ttextSearchProvider2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider2.d.ts',\n\t},\n\ttimeline: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts',\n\t},\n\ttokenInformation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tokenInformation.d.ts',\n\t},\n\ttoolProgress: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.toolProgress.d.ts',\n\t},\n\ttreeViewActiveItem: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts',\n\t},\n\ttreeViewMarkdownMessage: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts',\n\t},\n\ttreeViewReveal: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewReveal.d.ts',\n\t},\n\ttunnelFactory: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnelFactory.d.ts',\n\t},\n\ttunnels: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnels.d.ts',\n\t},\n\tvalueSelectionInQuickPick: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.valueSelectionInQuickPick.d.ts',\n\t},\n\tworkspaceTrust: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.workspaceTrust.d.ts',\n\t}\n};\nexport const allApiProposals = Object.freeze<{ [proposalName: string]: Readonly<{ proposal: string; version?: number }> }>(_allApiProposals);\nexport type ApiProposalName = keyof typeof _allApiProposals;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.\n\nconst _allApiProposals = {\n\tactiveComment: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.activeComment.d.ts',\n\t},\n\taiRelatedInformation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts',\n\t},\n\taiSettingsSearch: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiSettingsSearch.d.ts',\n\t},\n\taiTextSearchProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts',\n\t\tversion: 2\n\t},\n\tauthIssuers: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authIssuers.d.ts',\n\t},\n\tauthLearnMore: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authLearnMore.d.ts',\n\t},\n\tauthProviderSpecific: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authProviderSpecific.d.ts',\n\t},\n\tauthSession: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts',\n\t},\n\tcanonicalUriProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts',\n\t},\n\tchatEditing: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatEditing.d.ts',\n\t},\n\tchatParticipantAdditions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts',\n\t},\n\tchatParticipantPrivate: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts',\n\t\tversion: 9\n\t},\n\tchatProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts',\n\t},\n\tchatReferenceBinaryData: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts',\n\t},\n\tchatReferenceDiagnostic: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceDiagnostic.d.ts',\n\t},\n\tchatStatusItem: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatStatusItem.d.ts',\n\t},\n\tchatTab: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatTab.d.ts',\n\t},\n\tcodeActionAI: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionAI.d.ts',\n\t},\n\tcodeActionRanges: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionRanges.d.ts',\n\t},\n\tcodiconDecoration: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codiconDecoration.d.ts',\n\t},\n\tcommentReactor: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReactor.d.ts',\n\t},\n\tcommentReveal: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReveal.d.ts',\n\t},\n\tcommentThreadApplicability: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts',\n\t},\n\tcommentingRangeHint: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentingRangeHint.d.ts',\n\t},\n\tcommentsDraftState: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentsDraftState.d.ts',\n\t},\n\tcontribAccessibilityHelpContent: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts',\n\t},\n\tcontribCommentEditorActionsMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts',\n\t},\n\tcontribCommentPeekContext: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts',\n\t},\n\tcontribCommentThreadAdditionalMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts',\n\t},\n\tcontribCommentsViewThreadMenus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts',\n\t},\n\tcontribDebugCreateConfiguration: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts',\n\t},\n\tcontribDiffEditorGutterToolBarMenus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts',\n\t},\n\tcontribEditSessions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditSessions.d.ts',\n\t},\n\tcontribEditorContentMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts',\n\t},\n\tcontribLabelFormatterWorkspaceTooltip: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts',\n\t},\n\tcontribLanguageModelToolSets: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLanguageModelToolSets.d.ts',\n\t},\n\tcontribMenuBarHome: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts',\n\t},\n\tcontribMergeEditorMenus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts',\n\t},\n\tcontribMultiDiffEditorMenus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts',\n\t},\n\tcontribNotebookStaticPreloads: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts',\n\t},\n\tcontribRemoteHelp: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts',\n\t},\n\tcontribShareMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribShareMenu.d.ts',\n\t},\n\tcontribSourceControlHistoryItemMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts',\n\t},\n\tcontribSourceControlHistoryTitleMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts',\n\t},\n\tcontribSourceControlInputBoxMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts',\n\t},\n\tcontribSourceControlTitleMenu: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts',\n\t},\n\tcontribStatusBarItems: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts',\n\t},\n\tcontribViewContainerTitle: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts',\n\t},\n\tcontribViewsRemote: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts',\n\t},\n\tcontribViewsWelcome: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts',\n\t},\n\tcustomEditorMove: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.d.ts',\n\t},\n\tdebugVisualization: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.debugVisualization.d.ts',\n\t},\n\tdefaultChatParticipant: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts',\n\t\tversion: 4\n\t},\n\tdiffCommand: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffCommand.d.ts',\n\t},\n\tdiffContentOptions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffContentOptions.d.ts',\n\t},\n\tdocumentFiltersExclusive: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts',\n\t},\n\teditSessionIdentityProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts',\n\t},\n\teditorHoverVerbosityLevel: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts',\n\t},\n\teditorInsets: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts',\n\t},\n\tembeddings: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.embeddings.d.ts',\n\t},\n\textensionRuntime: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts',\n\t},\n\textensionsAny: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionsAny.d.ts',\n\t},\n\texternalUriOpener: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts',\n\t},\n\tfileSearchProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider.d.ts',\n\t},\n\tfileSearchProvider2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts',\n\t},\n\tfindFiles2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findFiles2.d.ts',\n\t\tversion: 2\n\t},\n\tfindTextInFiles: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles.d.ts',\n\t},\n\tfindTextInFiles2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles2.d.ts',\n\t},\n\tfsChunks: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts',\n\t},\n\tidToken: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.idToken.d.ts',\n\t},\n\tinlineCompletionsAdditions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts',\n\t},\n\tinteractive: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactive.d.ts',\n\t},\n\tinteractiveWindow: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveWindow.d.ts',\n\t},\n\tipc: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts',\n\t},\n\tlanguageModelCapabilities: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelCapabilities.d.ts',\n\t},\n\tlanguageModelDataPart: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelDataPart.d.ts',\n\t\tversion: 3\n\t},\n\tlanguageModelSystem: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelSystem.d.ts',\n\t},\n\tlanguageStatusText: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatusText.d.ts',\n\t},\n\tmappedEditsProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts',\n\t},\n\tmultiDocumentHighlightProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts',\n\t},\n\tnativeWindowHandle: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.nativeWindowHandle.d.ts',\n\t},\n\tnewSymbolNamesProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts',\n\t},\n\tnotebookCellExecution: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecution.d.ts',\n\t},\n\tnotebookControllerAffinityHidden: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts',\n\t},\n\tnotebookDeprecated: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts',\n\t},\n\tnotebookExecution: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookExecution.d.ts',\n\t},\n\tnotebookKernelSource: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookKernelSource.d.ts',\n\t},\n\tnotebookLiveShare: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookLiveShare.d.ts',\n\t},\n\tnotebookMessaging: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts',\n\t},\n\tnotebookMime: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMime.d.ts',\n\t},\n\tnotebookReplDocument: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookReplDocument.d.ts',\n\t},\n\tnotebookVariableProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts',\n\t},\n\tportsAttributes: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts',\n\t},\n\tprofileContentHandlers: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.profileContentHandlers.d.ts',\n\t},\n\tquickDiffProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickDiffProvider.d.ts',\n\t},\n\tquickInputButtonLocation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickInputButtonLocation.d.ts',\n\t},\n\tquickPickItemTooltip: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts',\n\t},\n\tquickPickSortByLabel: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts',\n\t},\n\tremoteCodingAgents: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.remoteCodingAgents.d.ts',\n\t},\n\tresolvers: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.resolvers.d.ts',\n\t},\n\tscmActionButton: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmActionButton.d.ts',\n\t},\n\tscmHistoryProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts',\n\t},\n\tscmMultiDiffEditor: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts',\n\t},\n\tscmSelectedProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts',\n\t},\n\tscmTextDocument: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmTextDocument.d.ts',\n\t},\n\tscmValidation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmValidation.d.ts',\n\t},\n\tshareProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.shareProvider.d.ts',\n\t},\n\tspeech: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.speech.d.ts',\n\t},\n\tstatusBarItemTooltip: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts',\n\t},\n\ttabInputMultiDiff: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts',\n\t},\n\ttabInputTextMerge: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts',\n\t},\n\ttaskPresentationGroup: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts',\n\t},\n\ttaskProblemMatcherStatus: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskProblemMatcherStatus.d.ts',\n\t},\n\ttelemetry: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.telemetry.d.ts',\n\t},\n\tterminalCompletionProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalCompletionProvider.d.ts',\n\t},\n\tterminalDataWriteEvent: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts',\n\t},\n\tterminalDimensions: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts',\n\t},\n\tterminalExecuteCommandEvent: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts',\n\t},\n\tterminalQuickFixProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts',\n\t},\n\tterminalSelection: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts',\n\t},\n\tterminalShellEnv: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalShellEnv.d.ts',\n\t},\n\ttestObserver: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',\n\t},\n\ttestRelatedCode: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testRelatedCode.d.ts',\n\t},\n\ttextDocumentChangeReason: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textDocumentChangeReason.d.ts',\n\t},\n\ttextEditorDiffInformation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textEditorDiffInformation.d.ts',\n\t},\n\ttextSearchComplete2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchComplete2.d.ts',\n\t},\n\ttextSearchProvider: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',\n\t},\n\ttextSearchProvider2: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider2.d.ts',\n\t},\n\ttimeline: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts',\n\t},\n\ttokenInformation: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tokenInformation.d.ts',\n\t},\n\ttoolProgress: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.toolProgress.d.ts',\n\t},\n\ttreeViewActiveItem: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts',\n\t},\n\ttreeViewMarkdownMessage: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts',\n\t},\n\ttreeViewReveal: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewReveal.d.ts',\n\t},\n\ttunnelFactory: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnelFactory.d.ts',\n\t},\n\ttunnels: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnels.d.ts',\n\t},\n\tvalueSelectionInQuickPick: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.valueSelectionInQuickPick.d.ts',\n\t},\n\tworkspaceTrust: {\n\t\tproposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.workspaceTrust.d.ts',\n\t}\n};\nexport const allApiProposals = Object.freeze<{ [proposalName: string]: Readonly<{ proposal: string; version?: number }> }>(_allApiProposals);\nexport type ApiProposalName = keyof typeof _allApiProposals;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { isEqualOrParent, joinPath } from '../../../base/common/resources.js';\nimport Severity from '../../../base/common/severity.js';\nimport { URI } from '../../../base/common/uri.js';\nimport * as nls from '../../../nls.js';\nimport * as semver from '../../../base/common/semver/semver.js';\nimport { IExtensionManifest, parseApiProposals } from './extensions.js';\nimport { allApiProposals } from './extensionsApiProposals.js';\n\nexport interface IParsedVersion {\n\thasCaret: boolean;\n\thasGreaterEquals: boolean;\n\tmajorBase: number;\n\tmajorMustEqual: boolean;\n\tminorBase: number;\n\tminorMustEqual: boolean;\n\tpatchBase: number;\n\tpatchMustEqual: boolean;\n\tpreRelease: string | null;\n}\n\nexport interface INormalizedVersion {\n\tmajorBase: number;\n\tmajorMustEqual: boolean;\n\tminorBase: number;\n\tminorMustEqual: boolean;\n\tpatchBase: number;\n\tpatchMustEqual: boolean;\n\tnotBefore: number; /* milliseconds timestamp, or 0 */\n\tisMinimum: boolean;\n}\n\nconst VERSION_REGEXP = /^(\\^|>=)?((\\d+)|x)\\.((\\d+)|x)\\.((\\d+)|x)(\\-.*)?$/;\nconst NOT_BEFORE_REGEXP = /^-(\\d{4})(\\d{2})(\\d{2})$/;\n\nexport function isValidVersionStr(version: string): boolean {\n\tversion = version.trim();\n\treturn (version === '*' || VERSION_REGEXP.test(version));\n}\n\nexport function parseVersion(version: string): IParsedVersion | null {\n\tif (!isValidVersionStr(version)) {\n\t\treturn null;\n\t}\n\n\tversion = version.trim();\n\n\tif (version === '*') {\n\t\treturn {\n\t\t\thasCaret: false,\n\t\t\thasGreaterEquals: false,\n\t\t\tmajorBase: 0,\n\t\t\tmajorMustEqual: false,\n\t\t\tminorBase: 0,\n\t\t\tminorMustEqual: false,\n\t\t\tpatchBase: 0,\n\t\t\tpatchMustEqual: false,\n\t\t\tpreRelease: null\n\t\t};\n\t}\n\n\tconst m = version.match(VERSION_REGEXP);\n\tif (!m) {\n\t\treturn null;\n\t}\n\treturn {\n\t\thasCaret: m[1] === '^',\n\t\thasGreaterEquals: m[1] === '>=',\n\t\tmajorBase: m[2] === 'x' ? 0 : parseInt(m[2], 10),\n\t\tmajorMustEqual: (m[2] === 'x' ? false : true),\n\t\tminorBase: m[4] === 'x' ? 0 : parseInt(m[4], 10),\n\t\tminorMustEqual: (m[4] === 'x' ? false : true),\n\t\tpatchBase: m[6] === 'x' ? 0 : parseInt(m[6], 10),\n\t\tpatchMustEqual: (m[6] === 'x' ? false : true),\n\t\tpreRelease: m[8] || null\n\t};\n}\n\nexport function normalizeVersion(version: IParsedVersion | null): INormalizedVersion | null {\n\tif (!version) {\n\t\treturn null;\n\t}\n\n\tconst majorBase = version.majorBase;\n\tconst majorMustEqual = version.majorMustEqual;\n\tconst minorBase = version.minorBase;\n\tlet minorMustEqual = version.minorMustEqual;\n\tconst patchBase = version.patchBase;\n\tlet patchMustEqual = version.patchMustEqual;\n\n\tif (version.hasCaret) {\n\t\tif (majorBase === 0) {\n\t\t\tpatchMustEqual = false;\n\t\t} else {\n\t\t\tminorMustEqual = false;\n\t\t\tpatchMustEqual = false;\n\t\t}\n\t}\n\n\tlet notBefore = 0;\n\tif (version.preRelease) {\n\t\tconst match = NOT_BEFORE_REGEXP.exec(version.preRelease);\n\t\tif (match) {\n\t\t\tconst [, year, month, day] = match;\n\t\t\tnotBefore = Date.UTC(Number(year), Number(month) - 1, Number(day));\n\t\t}\n\t}\n\n\treturn {\n\t\tmajorBase: majorBase,\n\t\tmajorMustEqual: majorMustEqual,\n\t\tminorBase: minorBase,\n\t\tminorMustEqual: minorMustEqual,\n\t\tpatchBase: patchBase,\n\t\tpatchMustEqual: patchMustEqual,\n\t\tisMinimum: version.hasGreaterEquals,\n\t\tnotBefore,\n\t};\n}\n\nexport function isValidVersion(_inputVersion: string | INormalizedVersion, _inputDate: ProductDate, _desiredVersion: string | INormalizedVersion): boolean {\n\tlet version: INormalizedVersion | null;\n\tif (typeof _inputVersion === 'string') {\n\t\tversion = normalizeVersion(parseVersion(_inputVersion));\n\t} else {\n\t\tversion = _inputVersion;\n\t}\n\n\tlet productTs: number | undefined;\n\tif (_inputDate instanceof Date) {\n\t\tproductTs = _inputDate.getTime();\n\t} else if (typeof _inputDate === 'string') {\n\t\tproductTs = new Date(_inputDate).getTime();\n\t}\n\n\tlet desiredVersion: INormalizedVersion | null;\n\tif (typeof _desiredVersion === 'string') {\n\t\tdesiredVersion = normalizeVersion(parseVersion(_desiredVersion));\n\t} else {\n\t\tdesiredVersion = _desiredVersion;\n\t}\n\n\tif (!version || !desiredVersion) {\n\t\treturn false;\n\t}\n\n\tconst majorBase = version.majorBase;\n\tconst minorBase = version.minorBase;\n\tconst patchBase = version.patchBase;\n\n\tlet desiredMajorBase = desiredVersion.majorBase;\n\tlet desiredMinorBase = desiredVersion.minorBase;\n\tlet desiredPatchBase = desiredVersion.patchBase;\n\tconst desiredNotBefore = desiredVersion.notBefore;\n\n\tlet majorMustEqual = desiredVersion.majorMustEqual;\n\tlet minorMustEqual = desiredVersion.minorMustEqual;\n\tlet patchMustEqual = desiredVersion.patchMustEqual;\n\n\tif (desiredVersion.isMinimum) {\n\t\tif (majorBase > desiredMajorBase) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (majorBase < desiredMajorBase) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (minorBase > desiredMinorBase) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (minorBase < desiredMinorBase) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (productTs && productTs < desiredNotBefore) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn patchBase >= desiredPatchBase;\n\t}\n\n\t// Anything < 1.0.0 is compatible with >= 1.0.0, except exact matches\n\tif (majorBase === 1 && desiredMajorBase === 0 && (!majorMustEqual || !minorMustEqual || !patchMustEqual)) {\n\t\tdesiredMajorBase = 1;\n\t\tdesiredMinorBase = 0;\n\t\tdesiredPatchBase = 0;\n\t\tmajorMustEqual = true;\n\t\tminorMustEqual = false;\n\t\tpatchMustEqual = false;\n\t}\n\n\tif (majorBase < desiredMajorBase) {\n\t\t// smaller major version\n\t\treturn false;\n\t}\n\n\tif (majorBase > desiredMajorBase) {\n\t\t// higher major version\n\t\treturn (!majorMustEqual);\n\t}\n\n\t// at this point, majorBase are equal\n\n\tif (minorBase < desiredMinorBase) {\n\t\t// smaller minor version\n\t\treturn false;\n\t}\n\n\tif (minorBase > desiredMinorBase) {\n\t\t// higher minor version\n\t\treturn (!minorMustEqual);\n\t}\n\n\t// at this point, minorBase are equal\n\n\tif (patchBase < desiredPatchBase) {\n\t\t// smaller patch version\n\t\treturn false;\n\t}\n\n\tif (patchBase > desiredPatchBase) {\n\t\t// higher patch version\n\t\treturn (!patchMustEqual);\n\t}\n\n\t// at this point, patchBase are equal\n\n\tif (productTs && productTs < desiredNotBefore) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\ntype ProductDate = string | Date | undefined;\n\nexport function validateExtensionManifest(productVersion: string, productDate: ProductDate, extensionLocation: URI, extensionManifest: IExtensionManifest, extensionIsBuiltin: boolean, validateApiVersion: boolean): readonly [Severity, string][] {\n\tconst validations: [Severity, string][] = [];\n\tif (typeof extensionManifest.publisher !== 'undefined' && typeof extensionManifest.publisher !== 'string') {\n\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.publisher', \"property publisher must be of type `string`.\")]);\n\t\treturn validations;\n\t}\n\tif (typeof extensionManifest.name !== 'string') {\n\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.name', \"property `{0}` is mandatory and must be of type `string`\", 'name')]);\n\t\treturn validations;\n\t}\n\tif (typeof extensionManifest.version !== 'string') {\n\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.version', \"property `{0}` is mandatory and must be of type `string`\", 'version')]);\n\t\treturn validations;\n\t}\n\tif (!extensionManifest.engines) {\n\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.engines', \"property `{0}` is mandatory and must be of type `object`\", 'engines')]);\n\t\treturn validations;\n\t}\n\tif (typeof extensionManifest.engines.vscode !== 'string') {\n\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.engines.vscode', \"property `{0}` is mandatory and must be of type `string`\", 'engines.vscode')]);\n\t\treturn validations;\n\t}\n\tif (typeof extensionManifest.extensionDependencies !== 'undefined') {\n\t\tif (!isStringArray(extensionManifest.extensionDependencies)) {\n\t\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.extensionDependencies', \"property `{0}` can be omitted or must be of type `string[]`\", 'extensionDependencies')]);\n\t\t\treturn validations;\n\t\t}\n\t}\n\tif (typeof extensionManifest.activationEvents !== 'undefined') {\n\t\tif (!isStringArray(extensionManifest.activationEvents)) {\n\t\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.activationEvents1', \"property `{0}` can be omitted or must be of type `string[]`\", 'activationEvents')]);\n\t\t\treturn validations;\n\t\t}\n\t\tif (typeof extensionManifest.main === 'undefined' && typeof extensionManifest.browser === 'undefined') {\n\t\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.activationEvents2', \"property `{0}` should be omitted if the extension doesn't have a `{1}` or `{2}` property.\", 'activationEvents', 'main', 'browser')]);\n\t\t\treturn validations;\n\t\t}\n\t}\n\tif (typeof extensionManifest.extensionKind !== 'undefined') {\n\t\tif (typeof extensionManifest.main === 'undefined') {\n\t\t\tvalidations.push([Severity.Warning, nls.localize('extensionDescription.extensionKind', \"property `{0}` can be defined only if property `main` is also defined.\", 'extensionKind')]);\n\t\t\t// not a failure case\n\t\t}\n\t}\n\tif (typeof extensionManifest.main !== 'undefined') {\n\t\tif (typeof extensionManifest.main !== 'string') {\n\t\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.main1', \"property `{0}` can be omitted or must be of type `string`\", 'main')]);\n\t\t\treturn validations;\n\t\t} else {\n\t\t\tconst mainLocation = joinPath(extensionLocation, extensionManifest.main);\n\t\t\tif (!isEqualOrParent(mainLocation, extensionLocation)) {\n\t\t\t\tvalidations.push([Severity.Warning, nls.localize('extensionDescription.main2', \"Expected `main` ({0}) to be included inside extension's folder ({1}). This might make the extension non-portable.\", mainLocation.path, extensionLocation.path)]);\n\t\t\t\t// not a failure case\n\t\t\t}\n\t\t}\n\t}\n\tif (typeof extensionManifest.browser !== 'undefined') {\n\t\tif (typeof extensionManifest.browser !== 'string') {\n\t\t\tvalidations.push([Severity.Error, nls.localize('extensionDescription.browser1', \"property `{0}` can be omitted or must be of type `string`\", 'browser')]);\n\t\t\treturn validations;\n\t\t} else {\n\t\t\tconst browserLocation = joinPath(extensionLocation, extensionManifest.browser);\n\t\t\tif (!isEqualOrParent(browserLocation, extensionLocation)) {\n\t\t\t\tvalidations.push([Severity.Warning, nls.localize('extensionDescription.browser2', \"Expected `browser` ({0}) to be included inside extension's folder ({1}). This might make the extension non-portable.\", browserLocation.path, extensionLocation.path)]);\n\t\t\t\t// not a failure case\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!semver.valid(extensionManifest.version)) {\n\t\tvalidations.push([Severity.Error, nls.localize('notSemver', \"Extension version is not semver compatible.\")]);\n\t\treturn validations;\n\t}\n\n\tconst notices: string[] = [];\n\tconst validExtensionVersion = isValidExtensionVersion(productVersion, productDate, extensionManifest, extensionIsBuiltin, notices);\n\tif (!validExtensionVersion) {\n\t\tfor (const notice of notices) {\n\t\t\tvalidations.push([Severity.Error, notice]);\n\t\t}\n\t}\n\n\tif (validateApiVersion && extensionManifest.enabledApiProposals?.length) {\n\t\tconst incompatibleNotices: string[] = [];\n\t\tif (!areApiProposalsCompatible([...extensionManifest.enabledApiProposals], incompatibleNotices)) {\n\t\t\tfor (const notice of incompatibleNotices) {\n\t\t\t\tvalidations.push([Severity.Error, notice]);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn validations;\n}\n\nexport function isValidExtensionVersion(productVersion: string, productDate: ProductDate, extensionManifest: IExtensionManifest, extensionIsBuiltin: boolean, notices: string[]): boolean {\n\n\tif (extensionIsBuiltin || (typeof extensionManifest.main === 'undefined' && typeof extensionManifest.browser === 'undefined')) {\n\t\t// No version check for builtin or declarative extensions\n\t\treturn true;\n\t}\n\n\treturn isVersionValid(productVersion, productDate, extensionManifest.engines.vscode, notices);\n}\n\nexport function isEngineValid(engine: string, version: string, date: ProductDate): boolean {\n\t// TODO@joao: discuss with alex '*' doesn't seem to be a valid engine version\n\treturn engine === '*' || isVersionValid(version, date, engine);\n}\n\nexport function areApiProposalsCompatible(apiProposals: string[]): boolean;\nexport function areApiProposalsCompatible(apiProposals: string[], notices: string[]): boolean;\nexport function areApiProposalsCompatible(apiProposals: string[], productApiProposals: Readonly<{ [proposalName: string]: Readonly<{ proposal: string; version?: number }> }>): boolean;\nexport function areApiProposalsCompatible(apiProposals: string[], arg1?: any): boolean {\n\tif (apiProposals.length === 0) {\n\t\treturn true;\n\t}\n\tconst notices: string[] | undefined = Array.isArray(arg1) ? arg1 : undefined;\n\tconst productApiProposals: Readonly<{ [proposalName: string]: Readonly<{ proposal: string; version?: number }> }> = (notices ? undefined : arg1) ?? allApiProposals;\n\tconst incompatibleProposals: string[] = [];\n\tconst parsedProposals = parseApiProposals(apiProposals);\n\tfor (const { proposalName, version } of parsedProposals) {\n\t\tif (!version) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst existingProposal = productApiProposals[proposalName];\n\t\tif (existingProposal?.version !== version) {\n\t\t\tincompatibleProposals.push(proposalName);\n\t\t}\n\t}\n\tif (incompatibleProposals.length) {\n\t\tif (notices) {\n\t\t\tif (incompatibleProposals.length === 1) {\n\t\t\t\tnotices.push(nls.localize('apiProposalMismatch1', \"This extension is using the API proposal '{0}' that is not compatible with the current version of VS Code.\", incompatibleProposals[0]));\n\t\t\t} else {\n\t\t\t\tnotices.push(nls.localize('apiProposalMismatch2', \"This extension is using the API proposals {0} and '{1}' that are not compatible with the current version of VS Code.\",\n\t\t\t\t\tincompatibleProposals.slice(0, incompatibleProposals.length - 1).map(p => `'${p}'`).join(', '),\n\t\t\t\t\tincompatibleProposals[incompatibleProposals.length - 1]));\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction isVersionValid(currentVersion: string, date: ProductDate, requestedVersion: string, notices: string[] = []): boolean {\n\n\tconst desiredVersion = normalizeVersion(parseVersion(requestedVersion));\n\tif (!desiredVersion) {\n\t\tnotices.push(nls.localize('versionSyntax', \"Could not parse `engines.vscode` value {0}. Please use, for example: ^1.22.0, ^1.22.x, etc.\", requestedVersion));\n\t\treturn false;\n\t}\n\n\t// enforce that a breaking API version is specified.\n\t// for 0.X.Y, that means up to 0.X must be specified\n\t// otherwise for Z.X.Y, that means Z must be specified\n\tif (desiredVersion.majorBase === 0) {\n\t\t// force that major and minor must be specific\n\t\tif (!desiredVersion.majorMustEqual || !desiredVersion.minorMustEqual) {\n\t\t\tnotices.push(nls.localize('versionSpecificity1', \"Version specified in `engines.vscode` ({0}) is not specific enough. For vscode versions before 1.0.0, please define at a minimum the major and minor desired version. E.g. ^0.10.0, 0.10.x, 0.11.0, etc.\", requestedVersion));\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\t// force that major must be specific\n\t\tif (!desiredVersion.majorMustEqual) {\n\t\t\tnotices.push(nls.localize('versionSpecificity2', \"Version specified in `engines.vscode` ({0}) is not specific enough. For vscode versions after 1.0.0, please define at a minimum the major desired version. E.g. ^1.10.0, 1.10.x, 1.x.x, 2.x.x, etc.\", requestedVersion));\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tif (!isValidVersion(currentVersion, date, desiredVersion)) {\n\t\tnotices.push(nls.localize('versionMismatch', \"Extension is not compatible with Code {0}. Extension requires: {1}.\", currentVersion, requestedVersion));\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nfunction isStringArray(arr: string[]): boolean {\n\tif (!Array.isArray(arr)) {\n\t\treturn false;\n\t}\n\tfor (let i = 0, len = arr.length; i < len; i++) {\n\t\tif (typeof arr[i] !== 'string') {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { shuffle } from './arrays.js';\nimport { assert } from './assert.js';\nimport { CharCode } from './charCode.js';\nimport { compare, compareIgnoreCase, compareSubstring, compareSubstringIgnoreCase } from './strings.js';\nimport { URI } from './uri.js';\n\nexport interface IKeyIterator<K> {\n\treset(key: K): this;\n\tnext(): this;\n\n\thasNext(): boolean;\n\tcmp(a: string): number;\n\tvalue(): string;\n}\n\nexport class StringIterator implements IKeyIterator<string> {\n\n\tprivate _value: string = '';\n\tprivate _pos: number = 0;\n\n\treset(key: string): this {\n\t\tthis._value = key;\n\t\tthis._pos = 0;\n\t\treturn this;\n\t}\n\n\tnext(): this {\n\t\tthis._pos += 1;\n\t\treturn this;\n\t}\n\n\thasNext(): boolean {\n\t\treturn this._pos < this._value.length - 1;\n\t}\n\n\tcmp(a: string): number {\n\t\tconst aCode = a.charCodeAt(0);\n\t\tconst thisCode = this._value.charCodeAt(this._pos);\n\t\treturn aCode - thisCode;\n\t}\n\n\tvalue(): string {\n\t\treturn this._value[this._pos];\n\t}\n}\n\nexport class ConfigKeysIterator implements IKeyIterator<string> {\n\n\tprivate _value!: string;\n\tprivate _from!: number;\n\tprivate _to!: number;\n\n\tconstructor(\n\t\tprivate readonly _caseSensitive: boolean = true\n\t) { }\n\n\treset(key: string): this {\n\t\tthis._value = key;\n\t\tthis._from = 0;\n\t\tthis._to = 0;\n\t\treturn this.next();\n\t}\n\n\thasNext(): boolean {\n\t\treturn this._to < this._value.length;\n\t}\n\n\tnext(): this {\n\t\t// this._data = key.split(/[\\\\/]/).filter(s => !!s);\n\t\tthis._from = this._to;\n\t\tlet justSeps = true;\n\t\tfor (; this._to < this._value.length; this._to++) {\n\t\t\tconst ch = this._value.charCodeAt(this._to);\n\t\t\tif (ch === CharCode.Period) {\n\t\t\t\tif (justSeps) {\n\t\t\t\t\tthis._from++;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjustSeps = false;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\tcmp(a: string): number {\n\t\treturn this._caseSensitive\n\t\t\t? compareSubstring(a, this._value, 0, a.length, this._from, this._to)\n\t\t\t: compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);\n\t}\n\n\tvalue(): string {\n\t\treturn this._value.substring(this._from, this._to);\n\t}\n}\n\nexport class PathIterator implements IKeyIterator<string> {\n\n\tprivate _value!: string;\n\tprivate _valueLen!: number;\n\tprivate _from!: number;\n\tprivate _to!: number;\n\n\tconstructor(\n\t\tprivate readonly _splitOnBackslash: boolean = true,\n\t\tprivate readonly _caseSensitive: boolean = true\n\t) { }\n\n\treset(key: string): this {\n\t\tthis._from = 0;\n\t\tthis._to = 0;\n\t\tthis._value = key;\n\t\tthis._valueLen = key.length;\n\t\tfor (let pos = key.length - 1; pos >= 0; pos--, this._valueLen--) {\n\t\t\tconst ch = this._value.charCodeAt(pos);\n\t\t\tif (!(ch === CharCode.Slash || this._splitOnBackslash && ch === CharCode.Backslash)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn this.next();\n\t}\n\n\thasNext(): boolean {\n\t\treturn this._to < this._valueLen;\n\t}\n\n\tnext(): this {\n\t\t// this._data = key.split(/[\\\\/]/).filter(s => !!s);\n\t\tthis._from = this._to;\n\t\tlet justSeps = true;\n\t\tfor (; this._to < this._valueLen; this._to++) {\n\t\t\tconst ch = this._value.charCodeAt(this._to);\n\t\t\tif (ch === CharCode.Slash || this._splitOnBackslash && ch === CharCode.Backslash) {\n\t\t\t\tif (justSeps) {\n\t\t\t\t\tthis._from++;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjustSeps = false;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\tcmp(a: string): number {\n\t\treturn this._caseSensitive\n\t\t\t? compareSubstring(a, this._value, 0, a.length, this._from, this._to)\n\t\t\t: compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);\n\t}\n\n\tvalue(): string {\n\t\treturn this._value.substring(this._from, this._to);\n\t}\n}\n\nconst enum UriIteratorState {\n\tScheme = 1, Authority = 2, Path = 3, Query = 4, Fragment = 5\n}\n\nexport class UriIterator implements IKeyIterator<URI> {\n\n\tprivate _pathIterator!: PathIterator;\n\tprivate _value!: URI;\n\tprivate _states: UriIteratorState[] = [];\n\tprivate _stateIdx: number = 0;\n\n\tconstructor(\n\t\tprivate readonly _ignorePathCasing: (uri: URI) => boolean,\n\t\tprivate readonly _ignoreQueryAndFragment: (uri: URI) => boolean) { }\n\n\treset(key: URI): this {\n\t\tthis._value = key;\n\t\tthis._states = [];\n\t\tif (this._value.scheme) {\n\t\t\tthis._states.push(UriIteratorState.Scheme);\n\t\t}\n\t\tif (this._value.authority) {\n\t\t\tthis._states.push(UriIteratorState.Authority);\n\t\t}\n\t\tif (this._value.path) {\n\t\t\tthis._pathIterator = new PathIterator(false, !this._ignorePathCasing(key));\n\t\t\tthis._pathIterator.reset(key.path);\n\t\t\tif (this._pathIterator.value()) {\n\t\t\t\tthis._states.push(UriIteratorState.Path);\n\t\t\t}\n\t\t}\n\t\tif (!this._ignoreQueryAndFragment(key)) {\n\t\t\tif (this._value.query) {\n\t\t\t\tthis._states.push(UriIteratorState.Query);\n\t\t\t}\n\t\t\tif (this._value.fragment) {\n\t\t\t\tthis._states.push(UriIteratorState.Fragment);\n\t\t\t}\n\t\t}\n\t\tthis._stateIdx = 0;\n\t\treturn this;\n\t}\n\n\tnext(): this {\n\t\tif (this._states[this._stateIdx] === UriIteratorState.Path && this._pathIterator.hasNext()) {\n\t\t\tthis._pathIterator.next();\n\t\t} else {\n\t\t\tthis._stateIdx += 1;\n\t\t}\n\t\treturn this;\n\t}\n\n\thasNext(): boolean {\n\t\treturn (this._states[this._stateIdx] === UriIteratorState.Path && this._pathIterator.hasNext())\n\t\t\t|| this._stateIdx < this._states.length - 1;\n\t}\n\n\tcmp(a: string): number {\n\t\tif (this._states[this._stateIdx] === UriIteratorState.Scheme) {\n\t\t\treturn compareIgnoreCase(a, this._value.scheme);\n\t\t} else if (this._states[this._stateIdx] === UriIteratorState.Authority) {\n\t\t\treturn compareIgnoreCase(a, this._value.authority);\n\t\t} else if (this._states[this._stateIdx] === UriIteratorState.Path) {\n\t\t\treturn this._pathIterator.cmp(a);\n\t\t} else if (this._states[this._stateIdx] === UriIteratorState.Query) {\n\t\t\treturn compare(a, this._value.query);\n\t\t} else if (this._states[this._stateIdx] === UriIteratorState.Fragment) {\n\t\t\treturn compare(a, this._value.fragment);\n\t\t}\n\t\tthrow new Error();\n\t}\n\n\tvalue(): string {\n\t\tif (this._states[this._stateIdx] === UriIteratorState.Scheme) {\n\t\t\treturn this._value.scheme;\n\t\t} else if (this._states[this._stateIdx] === UriIteratorState.Authority) {\n\t\t\treturn this._value.authority;\n\t\t} else if (this._states[this._stateIdx] === UriIteratorState.Path) {\n\t\t\treturn this._pathIterator.value();\n\t\t} else if (this._states[this._stateIdx] === UriIteratorState.Query) {\n\t\t\treturn this._value.query;\n\t\t} else if (this._states[this._stateIdx] === UriIteratorState.Fragment) {\n\t\t\treturn this._value.fragment;\n\t\t}\n\t\tthrow new Error();\n\t}\n}\n\nabstract class Undef {\n\n\tstatic readonly Val: unique symbol = Symbol('undefined_placeholder');\n\n\tstatic wrap<V>(value: V | undefined): V | typeof Undef.Val {\n\t\treturn value === undefined ? Undef.Val : value;\n\t}\n\n\tstatic unwrap<V>(value: V | typeof Undef.Val): V | undefined {\n\t\treturn value === Undef.Val ? undefined : value as V;\n\t}\n}\n\nclass TernarySearchTreeNode<K, V> {\n\theight: number = 1;\n\tsegment!: string;\n\tvalue: V | typeof Undef.Val | undefined = undefined;\n\tkey: K | undefined = undefined;\n\tleft: TernarySearchTreeNode<K, V> | undefined = undefined;\n\tmid: TernarySearchTreeNode<K, V> | undefined = undefined;\n\tright: TernarySearchTreeNode<K, V> | undefined = undefined;\n\n\tisEmpty(): boolean {\n\t\treturn !this.left && !this.mid && !this.right && this.value === undefined;\n\t}\n\n\trotateLeft() {\n\t\tconst tmp = this.right!;\n\t\tthis.right = tmp.left;\n\t\ttmp.left = this;\n\t\tthis.updateHeight();\n\t\ttmp.updateHeight();\n\t\treturn tmp;\n\t}\n\n\trotateRight() {\n\t\tconst tmp = this.left!;\n\t\tthis.left = tmp.right;\n\t\ttmp.right = this;\n\t\tthis.updateHeight();\n\t\ttmp.updateHeight();\n\t\treturn tmp;\n\t}\n\n\tupdateHeight() {\n\t\tthis.height = 1 + Math.max(this.heightLeft, this.heightRight);\n\t}\n\n\tbalanceFactor() {\n\t\treturn this.heightRight - this.heightLeft;\n\t}\n\n\tget heightLeft() {\n\t\treturn this.left?.height ?? 0;\n\t}\n\n\tget heightRight() {\n\t\treturn this.right?.height ?? 0;\n\t}\n}\n\nconst enum Dir {\n\tLeft = -1,\n\tMid = 0,\n\tRight = 1\n}\n\nexport class TernarySearchTree<K, V> {\n\n\tstatic forUris<E>(ignorePathCasing: (key: URI) => boolean = () => false, ignoreQueryAndFragment: (key: URI) => boolean = () => false): TernarySearchTree<URI, E> {\n\t\treturn new TernarySearchTree<URI, E>(new UriIterator(ignorePathCasing, ignoreQueryAndFragment));\n\t}\n\n\tstatic forPaths<E>(ignorePathCasing = false): TernarySearchTree<string, E> {\n\t\treturn new TernarySearchTree<string, E>(new PathIterator(undefined, !ignorePathCasing));\n\t}\n\n\tstatic forStrings<E>(): TernarySearchTree<string, E> {\n\t\treturn new TernarySearchTree<string, E>(new StringIterator());\n\t}\n\n\tstatic forConfigKeys<E>(): TernarySearchTree<string, E> {\n\t\treturn new TernarySearchTree<string, E>(new ConfigKeysIterator());\n\t}\n\n\tprivate _iter: IKeyIterator<K>;\n\tprivate _root: TernarySearchTreeNode<K, V> | undefined;\n\n\tconstructor(segments: IKeyIterator<K>) {\n\t\tthis._iter = segments;\n\t}\n\n\tclear(): void {\n\t\tthis._root = undefined;\n\t}\n\n\t/**\n\t * Fill the tree with the same value of the given keys\n\t */\n\tfill(element: V, keys: readonly K[]): void;\n\t/**\n\t * Fill the tree with given [key,value]-tuples\n\t */\n\tfill(values: readonly [K, V][]): void;\n\tfill(values: readonly [K, V][] | V, keys?: readonly K[]): void {\n\t\tif (keys) {\n\t\t\tconst arr = keys.slice(0);\n\t\t\tshuffle(arr);\n\t\t\tfor (const k of arr) {\n\t\t\t\tthis.set(k, (<V>values));\n\t\t\t}\n\t\t} else {\n\t\t\tconst arr = (<[K, V][]>values).slice(0);\n\t\t\tshuffle(arr);\n\t\t\tfor (const entry of arr) {\n\t\t\t\tthis.set(entry[0], entry[1]);\n\t\t\t}\n\t\t}\n\t}\n\n\tset(key: K, element: V): V | undefined {\n\t\tconst iter = this._iter.reset(key);\n\t\tlet node: TernarySearchTreeNode<K, V>;\n\n\t\tif (!this._root) {\n\t\t\tthis._root = new TernarySearchTreeNode<K, V>();\n\t\t\tthis._root.segment = iter.value();\n\t\t}\n\t\tconst stack: [Dir, TernarySearchTreeNode<K, V>][] = [];\n\n\t\t// find insert_node\n\t\tnode = this._root;\n\t\twhile (true) {\n\t\t\tconst val = iter.cmp(node.segment);\n\t\t\tif (val > 0) {\n\t\t\t\t// left\n\t\t\t\tif (!node.left) {\n\t\t\t\t\tnode.left = new TernarySearchTreeNode<K, V>();\n\t\t\t\t\tnode.left.segment = iter.value();\n\t\t\t\t}\n\t\t\t\tstack.push([Dir.Left, node]);\n\t\t\t\tnode = node.left;\n\n\t\t\t} else if (val < 0) {\n\t\t\t\t// right\n\t\t\t\tif (!node.right) {\n\t\t\t\t\tnode.right = new TernarySearchTreeNode<K, V>();\n\t\t\t\t\tnode.right.segment = iter.value();\n\t\t\t\t}\n\t\t\t\tstack.push([Dir.Right, node]);\n\t\t\t\tnode = node.right;\n\n\t\t\t} else if (iter.hasNext()) {\n\t\t\t\t// mid\n\t\t\t\titer.next();\n\t\t\t\tif (!node.mid) {\n\t\t\t\t\tnode.mid = new TernarySearchTreeNode<K, V>();\n\t\t\t\t\tnode.mid.segment = iter.value();\n\t\t\t\t}\n\t\t\t\tstack.push([Dir.Mid, node]);\n\t\t\t\tnode = node.mid;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// set value\n\t\tconst oldElement = Undef.unwrap(node.value);\n\t\tnode.value = Undef.wrap(element);\n\t\tnode.key = key;\n\n\t\t// balance\n\t\tfor (let i = stack.length - 1; i >= 0; i--) {\n\t\t\tconst node = stack[i][1];\n\n\t\t\tnode.updateHeight();\n\t\t\tconst bf = node.balanceFactor();\n\n\t\t\tif (bf < -1 || bf > 1) {\n\t\t\t\t// needs rotate\n\t\t\t\tconst d1 = stack[i][0];\n\t\t\t\tconst d2 = stack[i + 1][0];\n\n\t\t\t\tif (d1 === Dir.Right && d2 === Dir.Right) {\n\t\t\t\t\t//right, right -> rotate left\n\t\t\t\t\tstack[i][1] = node.rotateLeft();\n\n\t\t\t\t} else if (d1 === Dir.Left && d2 === Dir.Left) {\n\t\t\t\t\t// left, left -> rotate right\n\t\t\t\t\tstack[i][1] = node.rotateRight();\n\n\t\t\t\t} else if (d1 === Dir.Right && d2 === Dir.Left) {\n\t\t\t\t\t// right, left -> double rotate right, left\n\t\t\t\t\tnode.right = stack[i + 1][1] = stack[i + 1][1].rotateRight();\n\t\t\t\t\tstack[i][1] = node.rotateLeft();\n\n\t\t\t\t} else if (d1 === Dir.Left && d2 === Dir.Right) {\n\t\t\t\t\t// left, right -> double rotate left, right\n\t\t\t\t\tnode.left = stack[i + 1][1] = stack[i + 1][1].rotateLeft();\n\t\t\t\t\tstack[i][1] = node.rotateRight();\n\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error();\n\t\t\t\t}\n\n\t\t\t\t// patch path to parent\n\t\t\t\tif (i > 0) {\n\t\t\t\t\tswitch (stack[i - 1][0]) {\n\t\t\t\t\t\tcase Dir.Left:\n\t\t\t\t\t\t\tstack[i - 1][1].left = stack[i][1];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Dir.Right:\n\t\t\t\t\t\t\tstack[i - 1][1].right = stack[i][1];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Dir.Mid:\n\t\t\t\t\t\t\tstack[i - 1][1].mid = stack[i][1];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis._root = stack[0][1];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn oldElement;\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn Undef.unwrap(this._getNode(key)?.value);\n\t}\n\n\tprivate _getNode(key: K) {\n\t\tconst iter = this._iter.reset(key);\n\t\tlet node = this._root;\n\t\twhile (node) {\n\t\t\tconst val = iter.cmp(node.segment);\n\t\t\tif (val > 0) {\n\t\t\t\t// left\n\t\t\t\tnode = node.left;\n\t\t\t} else if (val < 0) {\n\t\t\t\t// right\n\t\t\t\tnode = node.right;\n\t\t\t} else if (iter.hasNext()) {\n\t\t\t\t// mid\n\t\t\t\titer.next();\n\t\t\t\tnode = node.mid;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn node;\n\t}\n\n\thas(key: K): boolean {\n\t\tconst node = this._getNode(key);\n\t\treturn !(node?.value === undefined && node?.mid === undefined);\n\t}\n\n\tdelete(key: K): void {\n\t\treturn this._delete(key, false);\n\t}\n\n\tdeleteSuperstr(key: K): void {\n\t\treturn this._delete(key, true);\n\t}\n\n\tprivate _delete(key: K, superStr: boolean): void {\n\t\tconst iter = this._iter.reset(key);\n\t\tconst stack: [Dir, TernarySearchTreeNode<K, V>][] = [];\n\t\tlet node = this._root;\n\n\t\t// find node\n\t\twhile (node) {\n\t\t\tconst val = iter.cmp(node.segment);\n\t\t\tif (val > 0) {\n\t\t\t\t// left\n\t\t\t\tstack.push([Dir.Left, node]);\n\t\t\t\tnode = node.left;\n\t\t\t} else if (val < 0) {\n\t\t\t\t// right\n\t\t\t\tstack.push([Dir.Right, node]);\n\t\t\t\tnode = node.right;\n\t\t\t} else if (iter.hasNext()) {\n\t\t\t\t// mid\n\t\t\t\titer.next();\n\t\t\t\tstack.push([Dir.Mid, node]);\n\t\t\t\tnode = node.mid;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!node) {\n\t\t\t// node not found\n\t\t\treturn;\n\t\t}\n\n\t\tif (superStr) {\n\t\t\t// removing children, reset height\n\t\t\tnode.left = undefined;\n\t\t\tnode.mid = undefined;\n\t\t\tnode.right = undefined;\n\t\t\tnode.height = 1;\n\t\t} else {\n\t\t\t// removing element\n\t\t\tnode.key = undefined;\n\t\t\tnode.value = undefined;\n\t\t}\n\n\t\t// BST node removal\n\t\tif (!node.mid && !node.value) {\n\t\t\tif (node.left && node.right) {\n\t\t\t\t// full node\n\t\t\t\t// replace deleted-node with the min-node of the right branch.\n\t\t\t\t// If there is no true min-node leave things as they are\n\t\t\t\tconst stack2: typeof stack = [[Dir.Right, node]];\n\t\t\t\tconst min = this._min(node.right, stack2);\n\n\t\t\t\tif (min.key) {\n\n\t\t\t\t\tnode.key = min.key;\n\t\t\t\t\tnode.value = min.value;\n\t\t\t\t\tnode.segment = min.segment;\n\n\t\t\t\t\t// remove NODE (inorder successor can only have right child)\n\t\t\t\t\tconst newChild = min.right;\n\t\t\t\t\tif (stack2.length > 1) {\n\t\t\t\t\t\tconst [dir, parent] = stack2[stack2.length - 1];\n\t\t\t\t\t\tswitch (dir) {\n\t\t\t\t\t\t\tcase Dir.Left: parent.left = newChild; break;\n\t\t\t\t\t\t\tcase Dir.Mid: assert(false);\n\t\t\t\t\t\t\tcase Dir.Right: assert(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.right = newChild;\n\t\t\t\t\t}\n\n\t\t\t\t\t// balance right branch and UPDATE parent pointer for stack\n\t\t\t\t\tconst newChild2 = this._balanceByStack(stack2)!;\n\t\t\t\t\tif (stack.length > 0) {\n\t\t\t\t\t\tconst [dir, parent] = stack[stack.length - 1];\n\t\t\t\t\t\tswitch (dir) {\n\t\t\t\t\t\t\tcase Dir.Left: parent.left = newChild2; break;\n\t\t\t\t\t\t\tcase Dir.Mid: parent.mid = newChild2; break;\n\t\t\t\t\t\t\tcase Dir.Right: parent.right = newChild2; break;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._root = newChild2;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t// empty or half empty\n\t\t\t\tconst newChild = node.left ?? node.right;\n\t\t\t\tif (stack.length > 0) {\n\t\t\t\t\tconst [dir, parent] = stack[stack.length - 1];\n\t\t\t\t\tswitch (dir) {\n\t\t\t\t\t\tcase Dir.Left: parent.left = newChild; break;\n\t\t\t\t\t\tcase Dir.Mid: parent.mid = newChild; break;\n\t\t\t\t\t\tcase Dir.Right: parent.right = newChild; break;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis._root = newChild;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// AVL balance\n\t\tthis._root = this._balanceByStack(stack) ?? this._root;\n\t}\n\n\tprivate _min(node: TernarySearchTreeNode<K, V>, stack: [Dir, TernarySearchTreeNode<K, V>][]): TernarySearchTreeNode<K, V> {\n\t\twhile (node.left) {\n\t\t\tstack.push([Dir.Left, node]);\n\t\t\tnode = node.left;\n\t\t}\n\t\treturn node;\n\t}\n\n\tprivate _balanceByStack(stack: [Dir, TernarySearchTreeNode<K, V>][]) {\n\n\t\tfor (let i = stack.length - 1; i >= 0; i--) {\n\t\t\tconst node = stack[i][1];\n\n\t\t\tnode.updateHeight();\n\t\t\tconst bf = node.balanceFactor();\n\t\t\tif (bf > 1) {\n\t\t\t\t// right heavy\n\t\t\t\tif (node.right!.balanceFactor() >= 0) {\n\t\t\t\t\t// right, right -> rotate left\n\t\t\t\t\tstack[i][1] = node.rotateLeft();\n\t\t\t\t} else {\n\t\t\t\t\t// right, left -> double rotate\n\t\t\t\t\tnode.right = node.right!.rotateRight();\n\t\t\t\t\tstack[i][1] = node.rotateLeft();\n\t\t\t\t}\n\n\t\t\t} else if (bf < -1) {\n\t\t\t\t// left heavy\n\t\t\t\tif (node.left!.balanceFactor() <= 0) {\n\t\t\t\t\t// left, left -> rotate right\n\t\t\t\t\tstack[i][1] = node.rotateRight();\n\t\t\t\t} else {\n\t\t\t\t\t// left, right -> double rotate\n\t\t\t\t\tnode.left = node.left!.rotateLeft();\n\t\t\t\t\tstack[i][1] = node.rotateRight();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// patch path to parent\n\t\t\tif (i > 0) {\n\t\t\t\tswitch (stack[i - 1][0]) {\n\t\t\t\t\tcase Dir.Left:\n\t\t\t\t\t\tstack[i - 1][1].left = stack[i][1];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Dir.Right:\n\t\t\t\t\t\tstack[i - 1][1].right = stack[i][1];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Dir.Mid:\n\t\t\t\t\t\tstack[i - 1][1].mid = stack[i][1];\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn stack[0][1];\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tfindSubstr(key: K): V | undefined {\n\t\tconst iter = this._iter.reset(key);\n\t\tlet node = this._root;\n\t\tlet candidate: V | undefined = undefined;\n\t\twhile (node) {\n\t\t\tconst val = iter.cmp(node.segment);\n\t\t\tif (val > 0) {\n\t\t\t\t// left\n\t\t\t\tnode = node.left;\n\t\t\t} else if (val < 0) {\n\t\t\t\t// right\n\t\t\t\tnode = node.right;\n\t\t\t} else if (iter.hasNext()) {\n\t\t\t\t// mid\n\t\t\t\titer.next();\n\t\t\t\tcandidate = Undef.unwrap(node.value) || candidate;\n\t\t\t\tnode = node.mid;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn node && Undef.unwrap(node.value) || candidate;\n\t}\n\n\tfindSuperstr(key: K): IterableIterator<[K, V]> | undefined {\n\t\treturn this._findSuperstrOrElement(key, false);\n\t}\n\n\tprivate _findSuperstrOrElement(key: K, allowValue: true): IterableIterator<[K, V]> | V | undefined;\n\tprivate _findSuperstrOrElement(key: K, allowValue: false): IterableIterator<[K, V]> | undefined;\n\tprivate _findSuperstrOrElement(key: K, allowValue: boolean): IterableIterator<[K, V]> | V | undefined {\n\t\tconst iter = this._iter.reset(key);\n\t\tlet node = this._root;\n\t\twhile (node) {\n\t\t\tconst val = iter.cmp(node.segment);\n\t\t\tif (val > 0) {\n\t\t\t\t// left\n\t\t\t\tnode = node.left;\n\t\t\t} else if (val < 0) {\n\t\t\t\t// right\n\t\t\t\tnode = node.right;\n\t\t\t} else if (iter.hasNext()) {\n\t\t\t\t// mid\n\t\t\t\titer.next();\n\t\t\t\tnode = node.mid;\n\t\t\t} else {\n\t\t\t\t// collect\n\t\t\t\tif (!node.mid) {\n\t\t\t\t\tif (allowValue) {\n\t\t\t\t\t\treturn Undef.unwrap(node.value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn this._entries(node.mid);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\thasElementOrSubtree(key: K): boolean {\n\t\treturn this._findSuperstrOrElement(key, true) !== undefined;\n\t}\n\n\tforEach(callback: (value: V, index: K) => unknown): void {\n\t\tfor (const [key, value] of this) {\n\t\t\tcallback(value, key);\n\t\t}\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\tyield* this._entries(this._root);\n\t}\n\n\tprivate _entries(node: TernarySearchTreeNode<K, V> | undefined): IterableIterator<[K, V]> {\n\t\tconst result: [K, V][] = [];\n\t\tthis._dfsEntries(node, result);\n\t\treturn result[Symbol.iterator]();\n\t}\n\n\tprivate _dfsEntries(node: TernarySearchTreeNode<K, V> | undefined, bucket: [K, V][]) {\n\t\t// DFS\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\t\tif (node.left) {\n\t\t\tthis._dfsEntries(node.left, bucket);\n\t\t}\n\t\tif (node.value !== undefined) {\n\t\t\tbucket.push([node.key!, Undef.unwrap(node.value)!]);\n\t\t}\n\t\tif (node.mid) {\n\t\t\tthis._dfsEntries(node.mid, bucket);\n\t\t}\n\t\tif (node.right) {\n\t\t\tthis._dfsEntries(node.right, bucket);\n\t\t}\n\t}\n\n\t// for debug/testing\n\t_isBalanced(): boolean {\n\t\tconst nodeIsBalanced = (node: TernarySearchTreeNode<any, any> | undefined): boolean => {\n\t\t\tif (!node) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst bf = node.balanceFactor();\n\t\t\tif (bf < -1 || bf > 1) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn nodeIsBalanced(node.left) && nodeIsBalanced(node.right);\n\t\t};\n\t\treturn nodeIsBalanced(this._root);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer, VSBufferReadable, VSBufferReadableStream } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { Event } from '../../../base/common/event.js';\nimport { IExpression, IRelativePattern } from '../../../base/common/glob.js';\nimport { IDisposable } from '../../../base/common/lifecycle.js';\nimport { TernarySearchTree } from '../../../base/common/ternarySearchTree.js';\nimport { sep } from '../../../base/common/path.js';\nimport { ReadableStreamEvents } from '../../../base/common/stream.js';\nimport { startsWithIgnoreCase } from '../../../base/common/strings.js';\nimport { isNumber } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { isWeb } from '../../../base/common/platform.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { IMarkdownString } from '../../../base/common/htmlContent.js';\nimport { Lazy } from '../../../base/common/lazy.js';\n\n//#region file service & providers\n\nexport const IFileService = createDecorator<IFileService>('fileService');\n\nexport interface IFileService {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * An event that is fired when a file system provider is added or removed\n\t */\n\treadonly onDidChangeFileSystemProviderRegistrations: Event<IFileSystemProviderRegistrationEvent>;\n\n\t/**\n\t * An event that is fired when a registered file system provider changes its capabilities.\n\t */\n\treadonly onDidChangeFileSystemProviderCapabilities: Event<IFileSystemProviderCapabilitiesChangeEvent>;\n\n\t/**\n\t * An event that is fired when a file system provider is about to be activated. Listeners\n\t * can join this event with a long running promise to help in the activation process.\n\t */\n\treadonly onWillActivateFileSystemProvider: Event<IFileSystemProviderActivationEvent>;\n\n\t/**\n\t * Registers a file system provider for a certain scheme.\n\t */\n\tregisterProvider(scheme: string, provider: IFileSystemProvider): IDisposable;\n\n\t/**\n\t * Returns a file system provider for a certain scheme.\n\t */\n\tgetProvider(scheme: string): IFileSystemProvider | undefined;\n\n\t/**\n\t * Tries to activate a provider with the given scheme.\n\t */\n\tactivateProvider(scheme: string): Promise<void>;\n\n\t/**\n\t * Checks if this file service can handle the given resource by\n\t * first activating any extension that wants to be activated\n\t * on the provided resource scheme to include extensions that\n\t * contribute file system providers for the given resource.\n\t */\n\tcanHandleResource(resource: URI): Promise<boolean>;\n\n\t/**\n\t * Checks if the file service has a registered provider for the\n\t * provided resource.\n\t *\n\t * Note: this does NOT account for contributed providers from\n\t * extensions that have not been activated yet. To include those,\n\t * consider to call `await fileService.canHandleResource(resource)`.\n\t */\n\thasProvider(resource: URI): boolean;\n\n\t/**\n\t * Checks if the provider for the provided resource has the provided file system capability.\n\t */\n\thasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean;\n\n\t/**\n\t * List the schemes and capabilities for registered file system providers\n\t */\n\tlistCapabilities(): Iterable<{ scheme: string; capabilities: FileSystemProviderCapabilities }>;\n\n\t/**\n\t * Allows to listen for file changes. The event will fire for every file within the opened workspace\n\t * (if any) as well as all files that have been watched explicitly using the #watch() API.\n\t */\n\treadonly onDidFilesChange: Event<FileChangesEvent>;\n\n\t/**\n\t * An event that is fired upon successful completion of a certain file operation.\n\t */\n\treadonly onDidRunOperation: Event<FileOperationEvent>;\n\n\t/**\n\t * Resolve the properties of a file/folder identified by the resource. For a folder, children\n\t * information is resolved as well depending on the provided options. Use `stat()` method if\n\t * you do not need children information.\n\t *\n\t * If the optional parameter \"resolveTo\" is specified in options, the stat service is asked\n\t * to provide a stat object that should contain the full graph of folders up to all of the\n\t * target resources.\n\t *\n\t * If the optional parameter \"resolveSingleChildDescendants\" is specified in options,\n\t * the stat service is asked to automatically resolve child folders that only\n\t * contain a single element.\n\t *\n\t * If the optional parameter \"resolveMetadata\" is specified in options,\n\t * the stat will contain metadata information such as size, mtime and etag.\n\t */\n\tresolve(resource: URI, options: IResolveMetadataFileOptions): Promise<IFileStatWithMetadata>;\n\tresolve(resource: URI, options?: IResolveFileOptions): Promise<IFileStat>;\n\n\t/**\n\t * Same as `resolve()` but supports resolving multiple resources in parallel.\n\t *\n\t * If one of the resolve targets fails to resolve returns a fake `IFileStat` instead of\n\t * making the whole call fail.\n\t */\n\tresolveAll(toResolve: { resource: URI; options: IResolveMetadataFileOptions }[]): Promise<IFileStatResult[]>;\n\tresolveAll(toResolve: { resource: URI; options?: IResolveFileOptions }[]): Promise<IFileStatResult[]>;\n\n\t/**\n\t * Same as `resolve()` but without resolving the children of a folder if the\n\t * resource is pointing to a folder.\n\t */\n\tstat(resource: URI): Promise<IFileStatWithPartialMetadata>;\n\n\t/**\n\t * Attempts to resolve the real path of the provided resource. The real path can be\n\t * different from the resource path for example when it is a symlink.\n\t *\n\t * Will return `undefined` if the real path cannot be resolved.\n\t */\n\trealpath(resource: URI): Promise<URI | undefined>;\n\n\t/**\n\t * Finds out if a file/folder identified by the resource exists.\n\t */\n\texists(resource: URI): Promise<boolean>;\n\n\t/**\n\t * Read the contents of the provided resource unbuffered.\n\t */\n\treadFile(resource: URI, options?: IReadFileOptions, token?: CancellationToken): Promise<IFileContent>;\n\n\t/**\n\t * Read the contents of the provided resource buffered as stream.\n\t */\n\treadFileStream(resource: URI, options?: IReadFileStreamOptions, token?: CancellationToken): Promise<IFileStreamContent>;\n\n\t/**\n\t * Updates the content replacing its previous value.\n\t *\n\t * Emits a `FileOperation.WRITE` file operation event when successful.\n\t */\n\twriteFile(resource: URI, bufferOrReadableOrStream: VSBuffer | VSBufferReadable | VSBufferReadableStream, options?: IWriteFileOptions): Promise<IFileStatWithMetadata>;\n\n\t/**\n\t * Moves the file/folder to a new path identified by the resource.\n\t *\n\t * The optional parameter overwrite can be set to replace an existing file at the location.\n\t *\n\t * Emits a `FileOperation.MOVE` file operation event when successful.\n\t */\n\tmove(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata>;\n\n\t/**\n\t * Find out if a move operation is possible given the arguments. No changes on disk will\n\t * be performed. Returns an Error if the operation cannot be done.\n\t */\n\tcanMove(source: URI, target: URI, overwrite?: boolean): Promise<Error | true>;\n\n\t/**\n\t * Copies the file/folder to a path identified by the resource. A folder is copied\n\t * recursively.\n\t *\n\t * Emits a `FileOperation.COPY` file operation event when successful.\n\t */\n\tcopy(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata>;\n\n\t/**\n\t * Find out if a copy operation is possible given the arguments. No changes on disk will\n\t * be performed. Returns an Error if the operation cannot be done.\n\t */\n\tcanCopy(source: URI, target: URI, overwrite?: boolean): Promise<Error | true>;\n\n\t/**\n\t * Clones a file to a path identified by the resource. Folders are not supported.\n\t *\n\t * If the target path exists, it will be overwritten.\n\t */\n\tcloneFile(source: URI, target: URI): Promise<void>;\n\n\t/**\n\t * Creates a new file with the given path and optional contents. The returned promise\n\t * will have the stat model object as a result.\n\t *\n\t * The optional parameter content can be used as value to fill into the new file.\n\t *\n\t * Emits a `FileOperation.CREATE` file operation event when successful.\n\t */\n\tcreateFile(resource: URI, bufferOrReadableOrStream?: VSBuffer | VSBufferReadable | VSBufferReadableStream, options?: ICreateFileOptions): Promise<IFileStatWithMetadata>;\n\n\t/**\n\t * Find out if a file create operation is possible given the arguments. No changes on disk will\n\t * be performed. Returns an Error if the operation cannot be done.\n\t */\n\tcanCreateFile(resource: URI, options?: ICreateFileOptions): Promise<Error | true>;\n\n\t/**\n\t * Creates a new folder with the given path. The returned promise\n\t * will have the stat model object as a result.\n\t *\n\t * Emits a `FileOperation.CREATE` file operation event when successful.\n\t */\n\tcreateFolder(resource: URI): Promise<IFileStatWithMetadata>;\n\n\t/**\n\t * Deletes the provided file. The optional useTrash parameter allows to\n\t * move the file to trash. The optional recursive parameter allows to delete\n\t * non-empty folders recursively.\n\t *\n\t * Emits a `FileOperation.DELETE` file operation event when successful.\n\t */\n\tdel(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<void>;\n\n\t/**\n\t * Find out if a delete operation is possible given the arguments. No changes on disk will\n\t * be performed. Returns an Error if the operation cannot be done.\n\t */\n\tcanDelete(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<Error | true>;\n\n\t/**\n\t * An event that signals an error when watching for file changes.\n\t */\n\treadonly onDidWatchError: Event<Error>;\n\n\t/**\n\t * Allows to start a watcher that reports file/folder change events on the provided resource.\n\t *\n\t * The watcher runs correlated and thus, file events will be reported on the returned\n\t * `IFileSystemWatcher` and not on the generic `IFileService.onDidFilesChange` event.\n\t *\n\t * Note: only non-recursive file watching supports event correlation for now.\n\t */\n\tcreateWatcher(resource: URI, options: IWatchOptionsWithoutCorrelation & { recursive: false }): IFileSystemWatcher;\n\n\t/**\n\t * Allows to start a watcher that reports file/folder change events on the provided resource.\n\t *\n\t * The watcher runs uncorrelated and thus will report all events from `IFileService.onDidFilesChange`.\n\t * This means, most listeners in the application will receive your events. It is encouraged to\n\t * use correlated watchers (via `IWatchOptionsWithCorrelation`) to limit events to your listener.\n\t*/\n\twatch(resource: URI, options?: IWatchOptionsWithoutCorrelation): IDisposable;\n\n\t/**\n\t * Frees up any resources occupied by this service.\n\t */\n\tdispose(): void;\n}\n\nexport interface IFileOverwriteOptions {\n\n\t/**\n\t * Set to `true` to overwrite a file if it exists. Will\n\t * throw an error otherwise if the file does exist.\n\t */\n\treadonly overwrite: boolean;\n}\n\nexport interface IFileUnlockOptions {\n\n\t/**\n\t * Set to `true` to try to remove any write locks the file might\n\t * have. A file that is write locked will throw an error for any\n\t * attempt to write to unless `unlock: true` is provided.\n\t */\n\treadonly unlock: boolean;\n}\n\nexport interface IFileAtomicReadOptions {\n\n\t/**\n\t * The optional `atomic` flag can be used to make sure\n\t * the `readFile` method is not running in parallel with\n\t * any `write` operations in the same process.\n\t *\n\t * Typically you should not need to use this flag but if\n\t * for example you are quickly reading a file right after\n\t * a file event occurred and the file changes a lot, there\n\t * is a chance that a read returns an empty or partial file\n\t * because a pending write has not finished yet.\n\t *\n\t * Note: this does not prevent the file from being written\n\t * to from a different process. If you need such atomic\n\t * operations, you better use a real database as storage.\n\t */\n\treadonly atomic: boolean;\n}\n\nexport interface IFileAtomicOptions {\n\n\t/**\n\t * The postfix is used to create a temporary file based\n\t * on the original resource. The resulting temporary\n\t * file will be in the same folder as the resource and\n\t * have `postfix` appended to the resource name.\n\t *\n\t * Example: given a file resource `file:///some/path/foo.txt`\n\t * and a postfix `.vsctmp`, the temporary file will be\n\t * created as `file:///some/path/foo.txt.vsctmp`.\n\t */\n\treadonly postfix: string;\n}\n\nexport interface IFileAtomicWriteOptions {\n\n\t/**\n\t * The optional `atomic` flag can be used to make sure\n\t * the `writeFile` method updates the target file atomically\n\t * by first writing to a temporary file in the same folder\n\t * and then renaming it over the target.\n\t */\n\treadonly atomic: IFileAtomicOptions | false;\n}\n\nexport interface IFileAtomicDeleteOptions {\n\n\t/**\n\t * The optional `atomic` flag can be used to make sure\n\t * the `delete` method deletes the target atomically by\n\t * first renaming it to a temporary resource in the same\n\t * folder and then deleting it.\n\t */\n\treadonly atomic: IFileAtomicOptions | false;\n}\n\nexport interface IFileReadLimits {\n\n\t/**\n\t * If the file exceeds the given size, an error of kind\n\t * `FILE_TOO_LARGE` will be thrown.\n\t */\n\tsize?: number;\n}\n\nexport interface IFileReadStreamOptions {\n\n\t/**\n\t * Is an integer specifying where to begin reading from in the file. If position is undefined,\n\t * data will be read from the current file position.\n\t */\n\treadonly position?: number;\n\n\t/**\n\t * Is an integer specifying how many bytes to read from the file. By default, all bytes\n\t * will be read.\n\t */\n\treadonly length?: number;\n\n\t/**\n\t * If provided, the size of the file will be checked against the limits\n\t * and an error will be thrown if any limit is exceeded.\n\t */\n\treadonly limits?: IFileReadLimits;\n}\n\nexport interface IFileWriteOptions extends IFileOverwriteOptions, IFileUnlockOptions, IFileAtomicWriteOptions {\n\n\t/**\n\t * Set to `true` to create a file when it does not exist. Will\n\t * throw an error otherwise if the file does not exist.\n\t */\n\treadonly create: boolean;\n}\n\nexport type IFileOpenOptions = IFileOpenForReadOptions | IFileOpenForWriteOptions;\n\nexport function isFileOpenForWriteOptions(options: IFileOpenOptions): options is IFileOpenForWriteOptions {\n\treturn options.create === true;\n}\n\nexport interface IFileOpenForReadOptions {\n\n\t/**\n\t * A hint that the file should be opened for reading only.\n\t */\n\treadonly create: false;\n}\n\nexport interface IFileOpenForWriteOptions extends IFileUnlockOptions {\n\n\t/**\n\t * A hint that the file should be opened for reading and writing.\n\t */\n\treadonly create: true;\n}\n\nexport interface IFileDeleteOptions {\n\n\t/**\n\t * Set to `true` to recursively delete any children of the file. This\n\t * only applies to folders and can lead to an error unless provided\n\t * if the folder is not empty.\n\t */\n\treadonly recursive: boolean;\n\n\t/**\n\t * Set to `true` to attempt to move the file to trash\n\t * instead of deleting it permanently from disk.\n\t *\n\t * This option maybe not be supported on all providers.\n\t */\n\treadonly useTrash: boolean;\n\n\t/**\n\t * The optional `atomic` flag can be used to make sure\n\t * the `delete` method deletes the target atomically by\n\t * first renaming it to a temporary resource in the same\n\t * folder and then deleting it.\n\t *\n\t * This option maybe not be supported on all providers.\n\t */\n\treadonly atomic: IFileAtomicOptions | false;\n}\n\nexport enum FileType {\n\n\t/**\n\t * File is unknown (neither file, directory nor symbolic link).\n\t */\n\tUnknown = 0,\n\n\t/**\n\t * File is a normal file.\n\t */\n\tFile = 1,\n\n\t/**\n\t * File is a directory.\n\t */\n\tDirectory = 2,\n\n\t/**\n\t * File is a symbolic link.\n\t *\n\t * Note: even when the file is a symbolic link, you can test for\n\t * `FileType.File` and `FileType.Directory` to know the type of\n\t * the target the link points to.\n\t */\n\tSymbolicLink = 64\n}\n\nexport enum FilePermission {\n\n\t/**\n\t * File is readonly. Components like editors should not\n\t * offer to edit the contents.\n\t */\n\tReadonly = 1,\n\n\t/**\n\t * File is locked. Components like editors should offer\n\t * to edit the contents and ask the user upon saving to\n\t * remove the lock.\n\t */\n\tLocked = 2\n}\n\nexport interface IStat {\n\n\t/**\n\t * The file type.\n\t */\n\treadonly type: FileType;\n\n\t/**\n\t * The last modification date represented as millis from unix epoch.\n\t */\n\treadonly mtime: number;\n\n\t/**\n\t * The creation date represented as millis from unix epoch.\n\t */\n\treadonly ctime: number;\n\n\t/**\n\t * The size of the file in bytes.\n\t */\n\treadonly size: number;\n\n\t/**\n\t * The file permissions.\n\t */\n\treadonly permissions?: FilePermission;\n}\n\nexport interface IWatchOptionsWithoutCorrelation {\n\n\t/**\n\t * Set to `true` to watch for changes recursively in a folder\n\t * and all of its children.\n\t */\n\trecursive: boolean;\n\n\t/**\n\t * A set of glob patterns or paths to exclude from watching.\n\t * Paths can be relative or absolute and when relative are\n\t * resolved against the watched folder. Glob patterns are\n\t * always matched relative to the watched folder.\n\t */\n\texcludes: string[];\n\n\t/**\n\t * An optional set of glob patterns or paths to include for\n\t * watching. If not provided, all paths are considered for\n\t * events.\n\t * Paths can be relative or absolute and when relative are\n\t * resolved against the watched folder. Glob patterns are\n\t * always matched relative to the watched folder.\n\t */\n\tincludes?: Array<string | IRelativePattern>;\n\n\t/**\n\t * If provided, allows to filter the events that the watcher should consider\n\t * for emitting. If not provided, all events are emitted.\n\t *\n\t * For example, to emit added and updated events, set to:\n\t * `FileChangeFilter.ADDED | FileChangeFilter.UPDATED`.\n\t */\n\tfilter?: FileChangeFilter;\n}\n\nexport interface IWatchOptions extends IWatchOptionsWithoutCorrelation {\n\n\t/**\n\t * If provided, file change events from the watcher that\n\t * are a result of this watch request will carry the same\n\t * id.\n\t */\n\treadonly correlationId?: number;\n}\n\nexport const enum FileChangeFilter {\n\tUPDATED = 1 << 1,\n\tADDED = 1 << 2,\n\tDELETED = 1 << 3\n}\n\nexport interface IWatchOptionsWithCorrelation extends IWatchOptions {\n\treadonly correlationId: number;\n}\n\nexport interface IFileSystemWatcher extends IDisposable {\n\n\t/**\n\t * An event which fires on file/folder change only for changes\n\t * that correlate to the watch request with matching correlation\n\t * identifier.\n\t */\n\treadonly onDidChange: Event<FileChangesEvent>;\n}\n\nexport function isFileSystemWatcher(thing: unknown): thing is IFileSystemWatcher {\n\tconst candidate = thing as IFileSystemWatcher | undefined;\n\n\treturn !!candidate && typeof candidate.onDidChange === 'function';\n}\n\nexport const enum FileSystemProviderCapabilities {\n\n\t/**\n\t * No capabilities.\n\t */\n\tNone = 0,\n\n\t/**\n\t * Provider supports unbuffered read/write.\n\t */\n\tFileReadWrite = 1 << 1,\n\n\t/**\n\t * Provider supports open/read/write/close low level file operations.\n\t */\n\tFileOpenReadWriteClose = 1 << 2,\n\n\t/**\n\t * Provider supports stream based reading.\n\t */\n\tFileReadStream = 1 << 4,\n\n\t/**\n\t * Provider supports copy operation.\n\t */\n\tFileFolderCopy = 1 << 3,\n\n\t/**\n\t * Provider is path case sensitive.\n\t */\n\tPathCaseSensitive = 1 << 10,\n\n\t/**\n\t * All files of the provider are readonly.\n\t */\n\tReadonly = 1 << 11,\n\n\t/**\n\t * Provider supports to delete via trash.\n\t */\n\tTrash = 1 << 12,\n\n\t/**\n\t * Provider support to unlock files for writing.\n\t */\n\tFileWriteUnlock = 1 << 13,\n\n\t/**\n\t * Provider support to read files atomically. This implies the\n\t * provider provides the `FileReadWrite` capability too.\n\t */\n\tFileAtomicRead = 1 << 14,\n\n\t/**\n\t * Provider support to write files atomically. This implies the\n\t * provider provides the `FileReadWrite` capability too.\n\t */\n\tFileAtomicWrite = 1 << 15,\n\n\t/**\n\t * Provider support to delete atomically.\n\t */\n\tFileAtomicDelete = 1 << 16,\n\n\t/**\n\t * Provider support to clone files atomically.\n\t */\n\tFileClone = 1 << 17,\n\n\t/**\n\t * Provider support to resolve real paths.\n\t */\n\tFileRealpath = 1 << 18\n}\n\nexport interface IFileSystemProvider {\n\n\treadonly capabilities: FileSystemProviderCapabilities;\n\treadonly onDidChangeCapabilities: Event<void>;\n\n\treadonly onDidChangeFile: Event<readonly IFileChange[]>;\n\treadonly onDidWatchError?: Event<string>;\n\twatch(resource: URI, opts: IWatchOptions): IDisposable;\n\n\tstat(resource: URI): Promise<IStat>;\n\tmkdir(resource: URI): Promise<void>;\n\treaddir(resource: URI): Promise<[string, FileType][]>;\n\tdelete(resource: URI, opts: IFileDeleteOptions): Promise<void>;\n\n\trename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void>;\n\tcopy?(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void>;\n\n\treadFile?(resource: URI): Promise<Uint8Array>;\n\twriteFile?(resource: URI, content: Uint8Array, opts: IFileWriteOptions): Promise<void>;\n\n\treadFileStream?(resource: URI, opts: IFileReadStreamOptions, token: CancellationToken): ReadableStreamEvents<Uint8Array>;\n\n\topen?(resource: URI, opts: IFileOpenOptions): Promise<number>;\n\tclose?(fd: number): Promise<void>;\n\tread?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number>;\n\twrite?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number>;\n\n\tcloneFile?(from: URI, to: URI): Promise<void>;\n}\n\nexport interface IFileSystemProviderWithFileReadWriteCapability extends IFileSystemProvider {\n\treadFile(resource: URI): Promise<Uint8Array>;\n\twriteFile(resource: URI, content: Uint8Array, opts: IFileWriteOptions): Promise<void>;\n}\n\nexport function hasReadWriteCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithFileReadWriteCapability {\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileReadWrite);\n}\n\nexport interface IFileSystemProviderWithFileFolderCopyCapability extends IFileSystemProvider {\n\tcopy(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void>;\n}\n\nexport function hasFileFolderCopyCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithFileFolderCopyCapability {\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileFolderCopy);\n}\n\nexport interface IFileSystemProviderWithFileCloneCapability extends IFileSystemProvider {\n\tcloneFile(from: URI, to: URI): Promise<void>;\n}\n\nexport function hasFileCloneCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithFileCloneCapability {\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileClone);\n}\n\nexport interface IFileSystemProviderWithFileRealpathCapability extends IFileSystemProvider {\n\trealpath(resource: URI): Promise<string>;\n}\n\nexport function hasFileRealpathCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithFileRealpathCapability {\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileRealpath);\n}\n\nexport interface IFileSystemProviderWithOpenReadWriteCloseCapability extends IFileSystemProvider {\n\topen(resource: URI, opts: IFileOpenOptions): Promise<number>;\n\tclose(fd: number): Promise<void>;\n\tread(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number>;\n\twrite(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number>;\n}\n\nexport function hasOpenReadWriteCloseCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithOpenReadWriteCloseCapability {\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileOpenReadWriteClose);\n}\n\nexport interface IFileSystemProviderWithFileReadStreamCapability extends IFileSystemProvider {\n\treadFileStream(resource: URI, opts: IFileReadStreamOptions, token: CancellationToken): ReadableStreamEvents<Uint8Array>;\n}\n\nexport function hasFileReadStreamCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithFileReadStreamCapability {\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileReadStream);\n}\n\nexport interface IFileSystemProviderWithFileAtomicReadCapability extends IFileSystemProvider {\n\treadFile(resource: URI, opts?: IFileAtomicReadOptions): Promise<Uint8Array>;\n\tenforceAtomicReadFile?(resource: URI): boolean;\n}\n\nexport function hasFileAtomicReadCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithFileAtomicReadCapability {\n\tif (!hasReadWriteCapability(provider)) {\n\t\treturn false; // we require the `FileReadWrite` capability too\n\t}\n\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicRead);\n}\n\nexport interface IFileSystemProviderWithFileAtomicWriteCapability extends IFileSystemProvider {\n\twriteFile(resource: URI, contents: Uint8Array, opts?: IFileAtomicWriteOptions): Promise<void>;\n\tenforceAtomicWriteFile?(resource: URI): IFileAtomicOptions | false;\n}\n\nexport function hasFileAtomicWriteCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithFileAtomicWriteCapability {\n\tif (!hasReadWriteCapability(provider)) {\n\t\treturn false; // we require the `FileReadWrite` capability too\n\t}\n\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicWrite);\n}\n\nexport interface IFileSystemProviderWithFileAtomicDeleteCapability extends IFileSystemProvider {\n\tdelete(resource: URI, opts: IFileAtomicDeleteOptions): Promise<void>;\n\tenforceAtomicDelete?(resource: URI): IFileAtomicOptions | false;\n}\n\nexport function hasFileAtomicDeleteCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithFileAtomicDeleteCapability {\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicDelete);\n}\n\nexport interface IFileSystemProviderWithReadonlyCapability extends IFileSystemProvider {\n\n\treadonly capabilities: FileSystemProviderCapabilities.Readonly & FileSystemProviderCapabilities;\n\n\t/**\n\t * An optional message to show in the UI to explain why the file system is readonly.\n\t */\n\treadonly readOnlyMessage?: IMarkdownString;\n}\n\nexport function hasReadonlyCapability(provider: IFileSystemProvider): provider is IFileSystemProviderWithReadonlyCapability {\n\treturn !!(provider.capabilities & FileSystemProviderCapabilities.Readonly);\n}\n\nexport enum FileSystemProviderErrorCode {\n\tFileExists = 'EntryExists',\n\tFileNotFound = 'EntryNotFound',\n\tFileNotADirectory = 'EntryNotADirectory',\n\tFileIsADirectory = 'EntryIsADirectory',\n\tFileExceedsStorageQuota = 'EntryExceedsStorageQuota',\n\tFileTooLarge = 'EntryTooLarge',\n\tFileWriteLocked = 'EntryWriteLocked',\n\tNoPermissions = 'NoPermissions',\n\tUnavailable = 'Unavailable',\n\tUnknown = 'Unknown'\n}\n\nexport interface IFileSystemProviderError extends Error {\n\treadonly name: string;\n\treadonly code: FileSystemProviderErrorCode;\n}\n\nexport class FileSystemProviderError extends Error implements IFileSystemProviderError {\n\n\tstatic create(error: Error | string, code: FileSystemProviderErrorCode): FileSystemProviderError {\n\t\tconst providerError = new FileSystemProviderError(error.toString(), code);\n\t\tmarkAsFileSystemProviderError(providerError, code);\n\n\t\treturn providerError;\n\t}\n\n\tprivate constructor(message: string, readonly code: FileSystemProviderErrorCode) {\n\t\tsuper(message);\n\t}\n}\n\nexport function createFileSystemProviderError(error: Error | string, code: FileSystemProviderErrorCode): FileSystemProviderError {\n\treturn FileSystemProviderError.create(error, code);\n}\n\nexport function ensureFileSystemProviderError(error?: Error): Error {\n\tif (!error) {\n\t\treturn createFileSystemProviderError(localize('unknownError', \"Unknown Error\"), FileSystemProviderErrorCode.Unknown); // https://github.com/microsoft/vscode/issues/72798\n\t}\n\n\treturn error;\n}\n\nexport function markAsFileSystemProviderError(error: Error, code: FileSystemProviderErrorCode): Error {\n\terror.name = code ? `${code} (FileSystemError)` : `FileSystemError`;\n\n\treturn error;\n}\n\nexport function toFileSystemProviderErrorCode(error: Error | undefined | null): FileSystemProviderErrorCode {\n\n\t// Guard against abuse\n\tif (!error) {\n\t\treturn FileSystemProviderErrorCode.Unknown;\n\t}\n\n\t// FileSystemProviderError comes with the code\n\tif (error instanceof FileSystemProviderError) {\n\t\treturn error.code;\n\t}\n\n\t// Any other error, check for name match by assuming that the error\n\t// went through the markAsFileSystemProviderError() method\n\tconst match = /^(.+) \\(FileSystemError\\)$/.exec(error.name);\n\tif (!match) {\n\t\treturn FileSystemProviderErrorCode.Unknown;\n\t}\n\n\tswitch (match[1]) {\n\t\tcase FileSystemProviderErrorCode.FileExists: return FileSystemProviderErrorCode.FileExists;\n\t\tcase FileSystemProviderErrorCode.FileIsADirectory: return FileSystemProviderErrorCode.FileIsADirectory;\n\t\tcase FileSystemProviderErrorCode.FileNotADirectory: return FileSystemProviderErrorCode.FileNotADirectory;\n\t\tcase FileSystemProviderErrorCode.FileNotFound: return FileSystemProviderErrorCode.FileNotFound;\n\t\tcase FileSystemProviderErrorCode.FileTooLarge: return FileSystemProviderErrorCode.FileTooLarge;\n\t\tcase FileSystemProviderErrorCode.FileWriteLocked: return FileSystemProviderErrorCode.FileWriteLocked;\n\t\tcase FileSystemProviderErrorCode.NoPermissions: return FileSystemProviderErrorCode.NoPermissions;\n\t\tcase FileSystemProviderErrorCode.Unavailable: return FileSystemProviderErrorCode.Unavailable;\n\t}\n\n\treturn FileSystemProviderErrorCode.Unknown;\n}\n\nexport function toFileOperationResult(error: Error): FileOperationResult {\n\n\t// FileSystemProviderError comes with the result already\n\tif (error instanceof FileOperationError) {\n\t\treturn error.fileOperationResult;\n\t}\n\n\t// Otherwise try to find from code\n\tswitch (toFileSystemProviderErrorCode(error)) {\n\t\tcase FileSystemProviderErrorCode.FileNotFound:\n\t\t\treturn FileOperationResult.FILE_NOT_FOUND;\n\t\tcase FileSystemProviderErrorCode.FileIsADirectory:\n\t\t\treturn FileOperationResult.FILE_IS_DIRECTORY;\n\t\tcase FileSystemProviderErrorCode.FileNotADirectory:\n\t\t\treturn FileOperationResult.FILE_NOT_DIRECTORY;\n\t\tcase FileSystemProviderErrorCode.FileWriteLocked:\n\t\t\treturn FileOperationResult.FILE_WRITE_LOCKED;\n\t\tcase FileSystemProviderErrorCode.NoPermissions:\n\t\t\treturn FileOperationResult.FILE_PERMISSION_DENIED;\n\t\tcase FileSystemProviderErrorCode.FileExists:\n\t\t\treturn FileOperationResult.FILE_MOVE_CONFLICT;\n\t\tcase FileSystemProviderErrorCode.FileTooLarge:\n\t\t\treturn FileOperationResult.FILE_TOO_LARGE;\n\t\tdefault:\n\t\t\treturn FileOperationResult.FILE_OTHER_ERROR;\n\t}\n}\n\nexport interface IFileSystemProviderRegistrationEvent {\n\treadonly added: boolean;\n\treadonly scheme: string;\n\treadonly provider?: IFileSystemProvider;\n}\n\nexport interface IFileSystemProviderCapabilitiesChangeEvent {\n\treadonly provider: IFileSystemProvider;\n\treadonly scheme: string;\n}\n\nexport interface IFileSystemProviderActivationEvent {\n\treadonly scheme: string;\n\tjoin(promise: Promise<void>): void;\n}\n\nexport const enum FileOperation {\n\tCREATE,\n\tDELETE,\n\tMOVE,\n\tCOPY,\n\tWRITE\n}\n\nexport interface IFileOperationEvent {\n\n\treadonly resource: URI;\n\treadonly operation: FileOperation;\n\n\tisOperation(operation: FileOperation.DELETE | FileOperation.WRITE): boolean;\n\tisOperation(operation: FileOperation.CREATE | FileOperation.MOVE | FileOperation.COPY): this is IFileOperationEventWithMetadata;\n}\n\nexport interface IFileOperationEventWithMetadata extends IFileOperationEvent {\n\treadonly target: IFileStatWithMetadata;\n}\n\nexport class FileOperationEvent implements IFileOperationEvent {\n\n\tconstructor(resource: URI, operation: FileOperation.DELETE | FileOperation.WRITE);\n\tconstructor(resource: URI, operation: FileOperation.CREATE | FileOperation.MOVE | FileOperation.COPY, target: IFileStatWithMetadata);\n\tconstructor(readonly resource: URI, readonly operation: FileOperation, readonly target?: IFileStatWithMetadata) { }\n\n\tisOperation(operation: FileOperation.DELETE | FileOperation.WRITE): boolean;\n\tisOperation(operation: FileOperation.CREATE | FileOperation.MOVE | FileOperation.COPY): this is IFileOperationEventWithMetadata;\n\tisOperation(operation: FileOperation): boolean {\n\t\treturn this.operation === operation;\n\t}\n}\n\n/**\n * Possible changes that can occur to a file.\n */\nexport const enum FileChangeType {\n\tUPDATED,\n\tADDED,\n\tDELETED\n}\n\n/**\n * Identifies a single change in a file.\n */\nexport interface IFileChange {\n\n\t/**\n\t * The type of change that occurred to the file.\n\t */\n\ttype: FileChangeType;\n\n\t/**\n\t * The unified resource identifier of the file that changed.\n\t */\n\treadonly resource: URI;\n\n\t/**\n\t * If provided when starting the file watcher, the correlation\n\t * identifier will match the original file watching request as\n\t * a way to identify the original component that is interested\n\t * in the change.\n\t */\n\treadonly cId?: number;\n}\n\nexport class FileChangesEvent {\n\n\tprivate static readonly MIXED_CORRELATION = null;\n\n\tprivate readonly correlationId: number | undefined | typeof FileChangesEvent.MIXED_CORRELATION = undefined;\n\n\tconstructor(changes: readonly IFileChange[], private readonly ignorePathCasing: boolean) {\n\t\tfor (const change of changes) {\n\n\t\t\t// Split by type\n\t\t\tswitch (change.type) {\n\t\t\t\tcase FileChangeType.ADDED:\n\t\t\t\t\tthis.rawAdded.push(change.resource);\n\t\t\t\t\tbreak;\n\t\t\t\tcase FileChangeType.UPDATED:\n\t\t\t\t\tthis.rawUpdated.push(change.resource);\n\t\t\t\t\tbreak;\n\t\t\t\tcase FileChangeType.DELETED:\n\t\t\t\t\tthis.rawDeleted.push(change.resource);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Figure out events correlation\n\t\t\tif (this.correlationId !== FileChangesEvent.MIXED_CORRELATION) {\n\t\t\t\tif (typeof change.cId === 'number') {\n\t\t\t\t\tif (this.correlationId === undefined) {\n\t\t\t\t\t\tthis.correlationId = change.cId; \t\t\t\t\t\t\t// correlation not yet set, just take it\n\t\t\t\t\t} else if (this.correlationId !== change.cId) {\n\t\t\t\t\t\tthis.correlationId = FileChangesEvent.MIXED_CORRELATION;\t// correlation mismatch, we have mixed correlation\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (this.correlationId !== undefined) {\n\t\t\t\t\t\tthis.correlationId = FileChangesEvent.MIXED_CORRELATION;\t// correlation mismatch, we have mixed correlation\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readonly added = new Lazy(() => {\n\t\tconst added = TernarySearchTree.forUris<boolean>(() => this.ignorePathCasing);\n\t\tadded.fill(this.rawAdded.map(resource => [resource, true]));\n\n\t\treturn added;\n\t});\n\n\tprivate readonly updated = new Lazy(() => {\n\t\tconst updated = TernarySearchTree.forUris<boolean>(() => this.ignorePathCasing);\n\t\tupdated.fill(this.rawUpdated.map(resource => [resource, true]));\n\n\t\treturn updated;\n\t});\n\n\tprivate readonly deleted = new Lazy(() => {\n\t\tconst deleted = TernarySearchTree.forUris<boolean>(() => this.ignorePathCasing);\n\t\tdeleted.fill(this.rawDeleted.map(resource => [resource, true]));\n\n\t\treturn deleted;\n\t});\n\n\t/**\n\t * Find out if the file change events match the provided resource.\n\t *\n\t * Note: when passing `FileChangeType.DELETED`, we consider a match\n\t * also when the parent of the resource got deleted.\n\t */\n\tcontains(resource: URI, ...types: FileChangeType[]): boolean {\n\t\treturn this.doContains(resource, { includeChildren: false }, ...types);\n\t}\n\n\t/**\n\t * Find out if the file change events either match the provided\n\t * resource, or contain a child of this resource.\n\t */\n\taffects(resource: URI, ...types: FileChangeType[]): boolean {\n\t\treturn this.doContains(resource, { includeChildren: true }, ...types);\n\t}\n\n\tprivate doContains(resource: URI, options: { includeChildren: boolean }, ...types: FileChangeType[]): boolean {\n\t\tif (!resource) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst hasTypesFilter = types.length > 0;\n\n\t\t// Added\n\t\tif (!hasTypesFilter || types.includes(FileChangeType.ADDED)) {\n\t\t\tif (this.added.value.get(resource)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (options.includeChildren && this.added.value.findSuperstr(resource)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\t// Updated\n\t\tif (!hasTypesFilter || types.includes(FileChangeType.UPDATED)) {\n\t\t\tif (this.updated.value.get(resource)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (options.includeChildren && this.updated.value.findSuperstr(resource)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\t// Deleted\n\t\tif (!hasTypesFilter || types.includes(FileChangeType.DELETED)) {\n\t\t\tif (this.deleted.value.findSubstr(resource) /* deleted also considers parent folders */) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (options.includeChildren && this.deleted.value.findSuperstr(resource)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns if this event contains added files.\n\t */\n\tgotAdded(): boolean {\n\t\treturn this.rawAdded.length > 0;\n\t}\n\n\t/**\n\t * Returns if this event contains deleted files.\n\t */\n\tgotDeleted(): boolean {\n\t\treturn this.rawDeleted.length > 0;\n\t}\n\n\t/**\n\t * Returns if this event contains updated files.\n\t */\n\tgotUpdated(): boolean {\n\t\treturn this.rawUpdated.length > 0;\n\t}\n\n\t/**\n\t * Returns if this event contains changes that correlate to the\n\t * provided `correlationId`.\n\t *\n\t * File change event correlation is an advanced watch feature that\n\t * allows to  identify from which watch request the events originate\n\t * from. This correlation allows to route events specifically\n\t * only to the requestor and not emit them to all listeners.\n\t */\n\tcorrelates(correlationId: number): boolean {\n\t\treturn this.correlationId === correlationId;\n\t}\n\n\t/**\n\t * Figure out if the event contains changes that correlate to one\n\t * correlation identifier.\n\t *\n\t * File change event correlation is an advanced watch feature that\n\t * allows to  identify from which watch request the events originate\n\t * from. This correlation allows to route events specifically\n\t * only to the requestor and not emit them to all listeners.\n\t */\n\thasCorrelation(): boolean {\n\t\treturn typeof this.correlationId === 'number';\n\t}\n\n\t/**\n\t * @deprecated use the `contains` or `affects` method to efficiently find\n\t * out if the event relates to a given resource. these methods ensure:\n\t * - that there is no expensive lookup needed (by using a `TernarySearchTree`)\n\t * - correctly handles `FileChangeType.DELETED` events\n\t */\n\treadonly rawAdded: URI[] = [];\n\n\t/**\n\t* @deprecated use the `contains` or `affects` method to efficiently find\n\t* out if the event relates to a given resource. these methods ensure:\n\t* - that there is no expensive lookup needed (by using a `TernarySearchTree`)\n\t* - correctly handles `FileChangeType.DELETED` events\n\t*/\n\treadonly rawUpdated: URI[] = [];\n\n\t/**\n\t* @deprecated use the `contains` or `affects` method to efficiently find\n\t* out if the event relates to a given resource. these methods ensure:\n\t* - that there is no expensive lookup needed (by using a `TernarySearchTree`)\n\t* - correctly handles `FileChangeType.DELETED` events\n\t*/\n\treadonly rawDeleted: URI[] = [];\n}\n\nexport function isParent(path: string, candidate: string, ignoreCase?: boolean): boolean {\n\tif (!path || !candidate || path === candidate) {\n\t\treturn false;\n\t}\n\n\tif (candidate.length > path.length) {\n\t\treturn false;\n\t}\n\n\tif (candidate.charAt(candidate.length - 1) !== sep) {\n\t\tcandidate += sep;\n\t}\n\n\tif (ignoreCase) {\n\t\treturn startsWithIgnoreCase(path, candidate);\n\t}\n\n\treturn path.indexOf(candidate) === 0;\n}\n\nexport interface IBaseFileStat {\n\n\t/**\n\t * The unified resource identifier of this file or folder.\n\t */\n\treadonly resource: URI;\n\n\t/**\n\t * The name which is the last segment\n\t * of the {{path}}.\n\t */\n\treadonly name: string;\n\n\t/**\n\t * The size of the file.\n\t *\n\t * The value may or may not be resolved as\n\t * it is optional.\n\t */\n\treadonly size?: number;\n\n\t/**\n\t * The last modification date represented as millis from unix epoch.\n\t *\n\t * The value may or may not be resolved as\n\t * it is optional.\n\t */\n\treadonly mtime?: number;\n\n\t/**\n\t * The creation date represented as millis from unix epoch.\n\t *\n\t * The value may or may not be resolved as\n\t * it is optional.\n\t */\n\treadonly ctime?: number;\n\n\t/**\n\t * A unique identifier that represents the\n\t * current state of the file or directory.\n\t *\n\t * The value may or may not be resolved as\n\t * it is optional.\n\t */\n\treadonly etag?: string;\n\n\t/**\n\t * File is readonly. Components like editors should not\n\t * offer to edit the contents.\n\t */\n\treadonly readonly?: boolean;\n\n\t/**\n\t * File is locked. Components like editors should offer\n\t * to edit the contents and ask the user upon saving to\n\t * remove the lock.\n\t */\n\treadonly locked?: boolean;\n}\n\nexport interface IBaseFileStatWithMetadata extends Required<IBaseFileStat> { }\n\n/**\n * A file resource with meta information and resolved children if any.\n */\nexport interface IFileStat extends IBaseFileStat {\n\n\t/**\n\t * The resource is a file.\n\t */\n\treadonly isFile: boolean;\n\n\t/**\n\t * The resource is a directory.\n\t */\n\treadonly isDirectory: boolean;\n\n\t/**\n\t * The resource is a symbolic link. Note: even when the\n\t * file is a symbolic link, you can test for `FileType.File`\n\t * and `FileType.Directory` to know the type of the target\n\t * the link points to.\n\t */\n\treadonly isSymbolicLink: boolean;\n\n\t/**\n\t * The children of the file stat or undefined if none.\n\t */\n\tchildren: IFileStat[] | undefined;\n}\n\nexport interface IFileStatWithMetadata extends IFileStat, IBaseFileStatWithMetadata {\n\treadonly mtime: number;\n\treadonly ctime: number;\n\treadonly etag: string;\n\treadonly size: number;\n\treadonly readonly: boolean;\n\treadonly locked: boolean;\n\treadonly children: IFileStatWithMetadata[] | undefined;\n}\n\nexport interface IFileStatResult {\n\treadonly stat?: IFileStat;\n\treadonly success: boolean;\n}\n\nexport interface IFileStatResultWithMetadata extends IFileStatResult {\n\treadonly stat?: IFileStatWithMetadata;\n}\n\nexport interface IFileStatWithPartialMetadata extends Omit<IFileStatWithMetadata, 'children'> { }\n\nexport interface IFileContent extends IBaseFileStatWithMetadata {\n\n\t/**\n\t * The content of a file as buffer.\n\t */\n\treadonly value: VSBuffer;\n}\n\nexport interface IFileStreamContent extends IBaseFileStatWithMetadata {\n\n\t/**\n\t * The content of a file as stream.\n\t */\n\treadonly value: VSBufferReadableStream;\n}\n\nexport interface IBaseReadFileOptions extends IFileReadStreamOptions {\n\n\t/**\n\t * The optional etag parameter allows to return early from resolving the resource if\n\t * the contents on disk match the etag. This prevents accumulated reading of resources\n\t * that have been read already with the same etag.\n\t * It is the task of the caller to makes sure to handle this error case from the promise.\n\t */\n\treadonly etag?: string;\n}\n\nexport interface IReadFileStreamOptions extends IBaseReadFileOptions { }\n\nexport interface IReadFileOptions extends IBaseReadFileOptions {\n\n\t/**\n\t * The optional `atomic` flag can be used to make sure\n\t * the `readFile` method is not running in parallel with\n\t * any `write` operations in the same process.\n\t *\n\t * Typically you should not need to use this flag but if\n\t * for example you are quickly reading a file right after\n\t * a file event occurred and the file changes a lot, there\n\t * is a chance that a read returns an empty or partial file\n\t * because a pending write has not finished yet.\n\t *\n\t * Note: this does not prevent the file from being written\n\t * to from a different process. If you need such atomic\n\t * operations, you better use a real database as storage.\n\t */\n\treadonly atomic?: boolean;\n}\n\nexport interface IWriteFileOptions {\n\n\t/**\n\t * The last known modification time of the file. This can be used to prevent dirty writes.\n\t */\n\treadonly mtime?: number;\n\n\t/**\n\t * The etag of the file. This can be used to prevent dirty writes.\n\t */\n\treadonly etag?: string;\n\n\t/**\n\t * Whether to attempt to unlock a file before writing.\n\t */\n\treadonly unlock?: boolean;\n\n\t/**\n\t * The optional `atomic` flag can be used to make sure\n\t * the `writeFile` method updates the target file atomically\n\t * by first writing to a temporary file in the same folder\n\t * and then renaming it over the target.\n\t */\n\treadonly atomic?: IFileAtomicOptions | false;\n}\n\nexport interface IResolveFileOptions {\n\n\t/**\n\t * Automatically continue resolving children of a directory until the provided resources\n\t * are found.\n\t */\n\treadonly resolveTo?: readonly URI[];\n\n\t/**\n\t * Automatically continue resolving children of a directory if the number of children is 1.\n\t */\n\treadonly resolveSingleChildDescendants?: boolean;\n\n\t/**\n\t * Will resolve mtime, ctime, size and etag of files if enabled. This can have a negative impact\n\t * on performance and thus should only be used when these values are required.\n\t */\n\treadonly resolveMetadata?: boolean;\n}\n\nexport interface IResolveMetadataFileOptions extends IResolveFileOptions {\n\treadonly resolveMetadata: true;\n}\n\nexport interface ICreateFileOptions {\n\n\t/**\n\t * Overwrite the file to create if it already exists on disk. Otherwise\n\t * an error will be thrown (FILE_MODIFIED_SINCE).\n\t */\n\treadonly overwrite?: boolean;\n}\n\nexport class FileOperationError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly fileOperationResult: FileOperationResult,\n\t\treadonly options?: IReadFileOptions | IWriteFileOptions | ICreateFileOptions\n\t) {\n\t\tsuper(message);\n\t}\n}\n\nexport class TooLargeFileOperationError extends FileOperationError {\n\tconstructor(\n\t\tmessage: string,\n\t\toverride readonly fileOperationResult: FileOperationResult.FILE_TOO_LARGE,\n\t\treadonly size: number,\n\t\toptions?: IReadFileOptions\n\t) {\n\t\tsuper(message, fileOperationResult, options);\n\t}\n}\n\nexport class NotModifiedSinceFileOperationError extends FileOperationError {\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly stat: IFileStatWithMetadata,\n\t\toptions?: IReadFileOptions\n\t) {\n\t\tsuper(message, FileOperationResult.FILE_NOT_MODIFIED_SINCE, options);\n\t}\n}\n\nexport const enum FileOperationResult {\n\tFILE_IS_DIRECTORY,\n\tFILE_NOT_FOUND,\n\tFILE_NOT_MODIFIED_SINCE,\n\tFILE_MODIFIED_SINCE,\n\tFILE_MOVE_CONFLICT,\n\tFILE_WRITE_LOCKED,\n\tFILE_PERMISSION_DENIED,\n\tFILE_TOO_LARGE,\n\tFILE_INVALID_PATH,\n\tFILE_NOT_DIRECTORY,\n\tFILE_OTHER_ERROR\n}\n\n//#endregion\n\n//#region Settings\n\nexport const AutoSaveConfiguration = {\n\tOFF: 'off',\n\tAFTER_DELAY: 'afterDelay',\n\tON_FOCUS_CHANGE: 'onFocusChange',\n\tON_WINDOW_CHANGE: 'onWindowChange'\n};\n\nexport const HotExitConfiguration = {\n\tOFF: 'off',\n\tON_EXIT: 'onExit',\n\tON_EXIT_AND_WINDOW_CLOSE: 'onExitAndWindowClose'\n};\n\nexport const FILES_ASSOCIATIONS_CONFIG = 'files.associations';\nexport const FILES_EXCLUDE_CONFIG = 'files.exclude';\nexport const FILES_READONLY_INCLUDE_CONFIG = 'files.readonlyInclude';\nexport const FILES_READONLY_EXCLUDE_CONFIG = 'files.readonlyExclude';\nexport const FILES_READONLY_FROM_PERMISSIONS_CONFIG = 'files.readonlyFromPermissions';\n\nexport interface IGlobPatterns {\n\t[filepattern: string]: boolean;\n}\n\nexport interface IFilesConfiguration {\n\tfiles?: IFilesConfigurationNode;\n}\n\nexport interface IFilesConfigurationNode {\n\tassociations: { [filepattern: string]: string };\n\texclude: IExpression;\n\twatcherExclude: IGlobPatterns;\n\twatcherInclude: string[];\n\tencoding: string;\n\tautoGuessEncoding: boolean;\n\tcandidateGuessEncodings: string[];\n\tdefaultLanguage: string;\n\ttrimTrailingWhitespace: boolean;\n\tautoSave: string;\n\tautoSaveDelay: number;\n\tautoSaveWorkspaceFilesOnly: boolean;\n\tautoSaveWhenNoErrors: boolean;\n\teol: string;\n\tenableTrash: boolean;\n\thotExit: string;\n\tsaveConflictResolution: 'askUser' | 'overwriteFileOnDisk';\n\treadonlyInclude: IGlobPatterns;\n\treadonlyExclude: IGlobPatterns;\n\treadonlyFromPermissions: boolean;\n}\n\n//#endregion\n\n//#region Utilities\n\nexport enum FileKind {\n\tFILE,\n\tFOLDER,\n\tROOT_FOLDER\n}\n\n/**\n * A hint to disable etag checking for reading/writing.\n */\nexport const ETAG_DISABLED = '';\n\nexport function etag(stat: { mtime: number; size: number }): string;\nexport function etag(stat: { mtime: number | undefined; size: number | undefined }): string | undefined;\nexport function etag(stat: { mtime: number | undefined; size: number | undefined }): string | undefined {\n\tif (typeof stat.size !== 'number' || typeof stat.mtime !== 'number') {\n\t\treturn undefined;\n\t}\n\n\treturn stat.mtime.toString(29) + stat.size.toString(31);\n}\n\nexport async function whenProviderRegistered(file: URI, fileService: IFileService): Promise<void> {\n\tif (fileService.hasProvider(URI.from({ scheme: file.scheme }))) {\n\t\treturn;\n\t}\n\n\treturn new Promise(resolve => {\n\t\tconst disposable = fileService.onDidChangeFileSystemProviderRegistrations(e => {\n\t\t\tif (e.scheme === file.scheme && e.added) {\n\t\t\t\tdisposable.dispose();\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Helper to format a raw byte size into a human readable label.\n */\nexport class ByteSize {\n\n\tstatic readonly KB = 1024;\n\tstatic readonly MB = ByteSize.KB * ByteSize.KB;\n\tstatic readonly GB = ByteSize.MB * ByteSize.KB;\n\tstatic readonly TB = ByteSize.GB * ByteSize.KB;\n\n\tstatic formatSize(size: number): string {\n\t\tif (!isNumber(size)) {\n\t\t\tsize = 0;\n\t\t}\n\n\t\tif (size < ByteSize.KB) {\n\t\t\treturn localize('sizeB', \"{0}B\", size.toFixed(0));\n\t\t}\n\n\t\tif (size < ByteSize.MB) {\n\t\t\treturn localize('sizeKB', \"{0}KB\", (size / ByteSize.KB).toFixed(2));\n\t\t}\n\n\t\tif (size < ByteSize.GB) {\n\t\t\treturn localize('sizeMB', \"{0}MB\", (size / ByteSize.MB).toFixed(2));\n\t\t}\n\n\t\tif (size < ByteSize.TB) {\n\t\t\treturn localize('sizeGB', \"{0}GB\", (size / ByteSize.GB).toFixed(2));\n\t\t}\n\n\t\treturn localize('sizeTB', \"{0}TB\", (size / ByteSize.TB).toFixed(2));\n\t}\n}\n\n// File limits\n\nexport function getLargeFileConfirmationLimit(remoteAuthority?: string): number;\nexport function getLargeFileConfirmationLimit(uri?: URI): number;\nexport function getLargeFileConfirmationLimit(arg?: string | URI): number {\n\tconst isRemote = typeof arg === 'string' || arg?.scheme === Schemas.vscodeRemote;\n\tconst isLocal = typeof arg !== 'string' && arg?.scheme === Schemas.file;\n\n\tif (isLocal) {\n\t\t// Local almost has no limit in file size\n\t\treturn 1024 * ByteSize.MB;\n\t}\n\n\tif (isRemote) {\n\t\t// With a remote, pick a low limit to avoid\n\t\t// potentially costly file transfers\n\t\treturn 10 * ByteSize.MB;\n\t}\n\n\tif (isWeb) {\n\t\t// Web: we cannot know for sure if a cost\n\t\t// is associated with the file transfer\n\t\t// so we pick a reasonably small limit\n\t\treturn 50 * ByteSize.MB;\n\t}\n\n\t// Local desktop: almost no limit in file size\n\treturn 1024 * ByteSize.MB;\n}\n\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IProductConfiguration } from '../../../base/common/product.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const IProductService = createDecorator<IProductService>('productService');\n\nexport interface IProductService extends Readonly<IProductConfiguration> {\n\n\treadonly _serviceBrand: undefined;\n\n}\n\nexport const productSchemaId = 'vscode://schemas/vscode-product';\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { generateUuid, isUUID } from '../../../base/common/uuid.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { IStorageService, StorageScope, StorageTarget } from '../../storage/common/storage.js';\n\nexport async function getServiceMachineId(environmentService: IEnvironmentService, fileService: IFileService, storageService: IStorageService | undefined): Promise<string> {\n\tlet uuid: string | null = storageService ? storageService.get('storage.serviceMachineId', StorageScope.APPLICATION) || null : null;\n\tif (uuid) {\n\t\treturn uuid;\n\t}\n\ttry {\n\t\tconst contents = await fileService.readFile(environmentService.serviceMachineIdResource);\n\t\tconst value = contents.value.toString();\n\t\tuuid = isUUID(value) ? value : null;\n\t} catch (e) {\n\t\tuuid = null;\n\t}\n\n\tif (!uuid) {\n\t\tuuid = generateUuid();\n\t\ttry {\n\t\t\tawait fileService.writeFile(environmentService.serviceMachineIdResource, VSBuffer.fromString(uuid));\n\t\t} catch (error) {\n\t\t\t//noop\n\t\t}\n\t}\n\n\tstorageService?.store('storage.serviceMachineId', uuid, StorageScope.APPLICATION, StorageTarget.MACHINE);\n\n\treturn uuid;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IHeaders } from '../../../base/parts/request/common/request.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { getServiceMachineId } from './serviceMachineId.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { IStorageService } from '../../storage/common/storage.js';\nimport { ITelemetryService, TelemetryLevel } from '../../telemetry/common/telemetry.js';\nimport { getTelemetryLevel, supportsTelemetry } from '../../telemetry/common/telemetryUtils.js';\n\nexport async function resolveMarketplaceHeaders(version: string,\n\tproductService: IProductService,\n\tenvironmentService: IEnvironmentService,\n\tconfigurationService: IConfigurationService,\n\tfileService: IFileService,\n\tstorageService: IStorageService | undefined,\n\ttelemetryService: ITelemetryService): Promise<IHeaders> {\n\n\tconst headers: IHeaders = {\n\t\t'X-Market-Client-Id': `VSCode ${version}`,\n\t\t'User-Agent': `VSCode ${version} (${productService.nameShort})`\n\t};\n\n\tif (supportsTelemetry(productService, environmentService) && getTelemetryLevel(configurationService) === TelemetryLevel.USAGE) {\n\t\tconst serviceMachineId = await getServiceMachineId(environmentService, fileService, storageService);\n\t\theaders['X-Market-User-Id'] = serviceMachineId;\n\t\t// Send machineId as VSCode-SessionId so we can correlate telemetry events across different services\n\t\t// machineId can be undefined sometimes (eg: when launching from CLI), so send serviceMachineId instead otherwise\n\t\t// Marketplace will reject the request if there is no VSCode-SessionId header\n\t\theaders['VSCode-SessionId'] = telemetryService.machineId || serviceMachineId;\n\t}\n\n\treturn headers;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from './buffer.js';\nimport { URI, UriComponents } from './uri.js';\nimport { MarshalledId } from './marshallingIds.js';\n\nexport function stringify(obj: unknown): string {\n\treturn JSON.stringify(obj, replacer);\n}\n\nexport function parse(text: string): any {\n\tlet data = JSON.parse(text);\n\tdata = revive(data);\n\treturn data;\n}\n\nexport interface MarshalledObject {\n\t$mid: MarshalledId;\n}\n\nfunction replacer(key: string, value: any): any {\n\t// URI is done via toJSON-member\n\tif (value instanceof RegExp) {\n\t\treturn {\n\t\t\t$mid: MarshalledId.Regexp,\n\t\t\tsource: value.source,\n\t\t\tflags: value.flags,\n\t\t};\n\t}\n\treturn value;\n}\n\n\ntype Deserialize<T> = T extends UriComponents ? URI\n\t: T extends VSBuffer ? VSBuffer\n\t: T extends object\n\t? Revived<T>\n\t: T;\n\nexport type Revived<T> = { [K in keyof T]: Deserialize<T[K]> };\n\nexport function revive<T = any>(obj: any, depth = 0): Revived<T> {\n\tif (!obj || depth > 200) {\n\t\treturn obj;\n\t}\n\n\tif (typeof obj === 'object') {\n\n\t\tswitch ((<MarshalledObject>obj).$mid) {\n\t\t\tcase MarshalledId.Uri: return <any>URI.revive(obj);\n\t\t\tcase MarshalledId.Regexp: return <any>new RegExp(obj.source, obj.flags);\n\t\t\tcase MarshalledId.Date: return <any>new Date(obj.source);\n\t\t}\n\n\t\tif (\n\t\t\tobj instanceof VSBuffer\n\t\t\t|| obj instanceof Uint8Array\n\t\t) {\n\t\t\treturn <any>obj;\n\t\t}\n\n\t\tif (Array.isArray(obj)) {\n\t\t\tfor (let i = 0; i < obj.length; ++i) {\n\t\t\t\tobj[i] = revive(obj[i], depth + 1);\n\t\t\t}\n\t\t} else {\n\t\t\t// walk object\n\t\t\tfor (const key in obj) {\n\t\t\t\tif (Object.hasOwnProperty.call(obj, key)) {\n\t\t\t\t\tobj[key] = revive(obj[key], depth + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn obj;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ThrottledDelayer } from '../../../common/async.js';\nimport { Event, PauseableEmitter } from '../../../common/event.js';\nimport { Disposable, IDisposable } from '../../../common/lifecycle.js';\nimport { parse, stringify } from '../../../common/marshalling.js';\nimport { isObject, isUndefinedOrNull } from '../../../common/types.js';\n\nexport enum StorageHint {\n\n\t// A hint to the storage that the storage\n\t// does not exist on disk yet. This allows\n\t// the storage library to improve startup\n\t// time by not checking the storage for data.\n\tSTORAGE_DOES_NOT_EXIST,\n\n\t// A hint to the storage that the storage\n\t// is backed by an in-memory storage.\n\tSTORAGE_IN_MEMORY\n}\n\nexport interface IStorageOptions {\n\treadonly hint?: StorageHint;\n}\n\nexport interface IUpdateRequest {\n\treadonly insert?: Map<string, string>;\n\treadonly delete?: Set<string>;\n}\n\nexport interface IStorageItemsChangeEvent {\n\treadonly changed?: Map<string, string>;\n\treadonly deleted?: Set<string>;\n}\n\nexport function isStorageItemsChangeEvent(thing: unknown): thing is IStorageItemsChangeEvent {\n\tconst candidate = thing as IStorageItemsChangeEvent | undefined;\n\n\treturn candidate?.changed instanceof Map || candidate?.deleted instanceof Set;\n}\n\nexport interface IStorageDatabase {\n\n\treadonly onDidChangeItemsExternal: Event<IStorageItemsChangeEvent>;\n\n\tgetItems(): Promise<Map<string, string>>;\n\tupdateItems(request: IUpdateRequest): Promise<void>;\n\n\toptimize(): Promise<void>;\n\n\tclose(recovery?: () => Map<string, string>): Promise<void>;\n}\n\nexport interface IStorageChangeEvent {\n\n\t/**\n\t * The `key` of the storage entry that was changed\n\t * or was removed.\n\t */\n\treadonly key: string;\n\n\t/**\n\t * A hint how the storage change event was triggered. If\n\t * `true`, the storage change was triggered by an external\n\t * source, such as:\n\t * - another process (for example another window)\n\t * - operations such as settings sync or profiles change\n\t */\n\treadonly external?: boolean;\n}\n\nexport type StorageValue = string | boolean | number | undefined | null | object;\n\nexport interface IStorage extends IDisposable {\n\n\treadonly onDidChangeStorage: Event<IStorageChangeEvent>;\n\n\treadonly items: Map<string, string>;\n\treadonly size: number;\n\n\tinit(): Promise<void>;\n\n\tget(key: string, fallbackValue: string): string;\n\tget(key: string, fallbackValue?: string): string | undefined;\n\n\tgetBoolean(key: string, fallbackValue: boolean): boolean;\n\tgetBoolean(key: string, fallbackValue?: boolean): boolean | undefined;\n\n\tgetNumber(key: string, fallbackValue: number): number;\n\tgetNumber(key: string, fallbackValue?: number): number | undefined;\n\n\tgetObject<T extends object>(key: string, fallbackValue: T): T;\n\tgetObject<T extends object>(key: string, fallbackValue?: T): T | undefined;\n\n\tset(key: string, value: StorageValue, external?: boolean): Promise<void>;\n\tdelete(key: string, external?: boolean): Promise<void>;\n\n\tflush(delay?: number): Promise<void>;\n\twhenFlushed(): Promise<void>;\n\n\toptimize(): Promise<void>;\n\n\tclose(): Promise<void>;\n}\n\nexport enum StorageState {\n\tNone,\n\tInitialized,\n\tClosed\n}\n\nexport class Storage extends Disposable implements IStorage {\n\n\tprivate static readonly DEFAULT_FLUSH_DELAY = 100;\n\n\tprivate readonly _onDidChangeStorage = this._register(new PauseableEmitter<IStorageChangeEvent>());\n\treadonly onDidChangeStorage = this._onDidChangeStorage.event;\n\n\tprivate state = StorageState.None;\n\n\tprivate cache = new Map<string, string>();\n\n\tprivate readonly flushDelayer = this._register(new ThrottledDelayer<void>(Storage.DEFAULT_FLUSH_DELAY));\n\n\tprivate pendingDeletes = new Set<string>();\n\tprivate pendingInserts = new Map<string, string>();\n\n\tprivate pendingClose: Promise<void> | undefined = undefined;\n\n\tprivate readonly whenFlushedCallbacks: Function[] = [];\n\n\tconstructor(\n\t\tprotected readonly database: IStorageDatabase,\n\t\tprivate readonly options: IStorageOptions = Object.create(null)\n\t) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tthis._register(this.database.onDidChangeItemsExternal(e => this.onDidChangeItemsExternal(e)));\n\t}\n\n\tprivate onDidChangeItemsExternal(e: IStorageItemsChangeEvent): void {\n\t\tthis._onDidChangeStorage.pause();\n\n\t\ttry {\n\t\t\t// items that change external require us to update our\n\t\t\t// caches with the values. we just accept the value and\n\t\t\t// emit an event if there is a change.\n\n\t\t\te.changed?.forEach((value, key) => this.acceptExternal(key, value));\n\t\t\te.deleted?.forEach(key => this.acceptExternal(key, undefined));\n\n\t\t} finally {\n\t\t\tthis._onDidChangeStorage.resume();\n\t\t}\n\t}\n\n\tprivate acceptExternal(key: string, value: string | undefined): void {\n\t\tif (this.state === StorageState.Closed) {\n\t\t\treturn; // Return early if we are already closed\n\t\t}\n\n\t\tlet changed = false;\n\n\t\t// Item got removed, check for deletion\n\t\tif (isUndefinedOrNull(value)) {\n\t\t\tchanged = this.cache.delete(key);\n\t\t}\n\n\t\t// Item got updated, check for change\n\t\telse {\n\t\t\tconst currentValue = this.cache.get(key);\n\t\t\tif (currentValue !== value) {\n\t\t\t\tthis.cache.set(key, value);\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t}\n\n\t\t// Signal to outside listeners\n\t\tif (changed) {\n\t\t\tthis._onDidChangeStorage.fire({ key, external: true });\n\t\t}\n\t}\n\n\tget items(): Map<string, string> {\n\t\treturn this.cache;\n\t}\n\n\tget size(): number {\n\t\treturn this.cache.size;\n\t}\n\n\tasync init(): Promise<void> {\n\t\tif (this.state !== StorageState.None) {\n\t\t\treturn; // either closed or already initialized\n\t\t}\n\n\t\tthis.state = StorageState.Initialized;\n\n\t\tif (this.options.hint === StorageHint.STORAGE_DOES_NOT_EXIST) {\n\t\t\t// return early if we know the storage file does not exist. this is a performance\n\t\t\t// optimization to not load all items of the underlying storage if we know that\n\t\t\t// there can be no items because the storage does not exist.\n\t\t\treturn;\n\t\t}\n\n\t\tthis.cache = await this.database.getItems();\n\t}\n\n\tget(key: string, fallbackValue: string): string;\n\tget(key: string, fallbackValue?: string): string | undefined;\n\tget(key: string, fallbackValue?: string): string | undefined {\n\t\tconst value = this.cache.get(key);\n\n\t\tif (isUndefinedOrNull(value)) {\n\t\t\treturn fallbackValue;\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tgetBoolean(key: string, fallbackValue: boolean): boolean;\n\tgetBoolean(key: string, fallbackValue?: boolean): boolean | undefined;\n\tgetBoolean(key: string, fallbackValue?: boolean): boolean | undefined {\n\t\tconst value = this.get(key);\n\n\t\tif (isUndefinedOrNull(value)) {\n\t\t\treturn fallbackValue;\n\t\t}\n\n\t\treturn value === 'true';\n\t}\n\n\tgetNumber(key: string, fallbackValue: number): number;\n\tgetNumber(key: string, fallbackValue?: number): number | undefined;\n\tgetNumber(key: string, fallbackValue?: number): number | undefined {\n\t\tconst value = this.get(key);\n\n\t\tif (isUndefinedOrNull(value)) {\n\t\t\treturn fallbackValue;\n\t\t}\n\n\t\treturn parseInt(value, 10);\n\t}\n\n\tgetObject(key: string, fallbackValue: object): object;\n\tgetObject(key: string, fallbackValue?: object | undefined): object | undefined;\n\tgetObject(key: string, fallbackValue?: object): object | undefined {\n\t\tconst value = this.get(key);\n\n\t\tif (isUndefinedOrNull(value)) {\n\t\t\treturn fallbackValue;\n\t\t}\n\n\t\treturn parse(value);\n\t}\n\n\tasync set(key: string, value: string | boolean | number | null | undefined | object, external = false): Promise<void> {\n\t\tif (this.state === StorageState.Closed) {\n\t\t\treturn; // Return early if we are already closed\n\t\t}\n\n\t\t// We remove the key for undefined/null values\n\t\tif (isUndefinedOrNull(value)) {\n\t\t\treturn this.delete(key, external);\n\t\t}\n\n\t\t// Otherwise, convert to String and store\n\t\tconst valueStr = isObject(value) || Array.isArray(value) ? stringify(value) : String(value);\n\n\t\t// Return early if value already set\n\t\tconst currentValue = this.cache.get(key);\n\t\tif (currentValue === valueStr) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update in cache and pending\n\t\tthis.cache.set(key, valueStr);\n\t\tthis.pendingInserts.set(key, valueStr);\n\t\tthis.pendingDeletes.delete(key);\n\n\t\t// Event\n\t\tthis._onDidChangeStorage.fire({ key, external });\n\n\t\t// Accumulate work by scheduling after timeout\n\t\treturn this.doFlush();\n\t}\n\n\tasync delete(key: string, external = false): Promise<void> {\n\t\tif (this.state === StorageState.Closed) {\n\t\t\treturn; // Return early if we are already closed\n\t\t}\n\n\t\t// Remove from cache and add to pending\n\t\tconst wasDeleted = this.cache.delete(key);\n\t\tif (!wasDeleted) {\n\t\t\treturn; // Return early if value already deleted\n\t\t}\n\n\t\tif (!this.pendingDeletes.has(key)) {\n\t\t\tthis.pendingDeletes.add(key);\n\t\t}\n\n\t\tthis.pendingInserts.delete(key);\n\n\t\t// Event\n\t\tthis._onDidChangeStorage.fire({ key, external });\n\n\t\t// Accumulate work by scheduling after timeout\n\t\treturn this.doFlush();\n\t}\n\n\tasync optimize(): Promise<void> {\n\t\tif (this.state === StorageState.Closed) {\n\t\t\treturn; // Return early if we are already closed\n\t\t}\n\n\t\t// Await pending data to be flushed to the DB\n\t\t// before attempting to optimize the DB\n\t\tawait this.flush(0);\n\n\t\treturn this.database.optimize();\n\t}\n\n\tasync close(): Promise<void> {\n\t\tif (!this.pendingClose) {\n\t\t\tthis.pendingClose = this.doClose();\n\t\t}\n\n\t\treturn this.pendingClose;\n\t}\n\n\tprivate async doClose(): Promise<void> {\n\n\t\t// Update state\n\t\tthis.state = StorageState.Closed;\n\n\t\t// Trigger new flush to ensure data is persisted and then close\n\t\t// even if there is an error flushing. We must always ensure\n\t\t// the DB is closed to avoid corruption.\n\t\t//\n\t\t// Recovery: we pass our cache over as recovery option in case\n\t\t// the DB is not healthy.\n\t\ttry {\n\t\t\tawait this.doFlush(0 /* as soon as possible */);\n\t\t} catch (error) {\n\t\t\t// Ignore\n\t\t}\n\n\t\tawait this.database.close(() => this.cache);\n\t}\n\n\tprivate get hasPending() {\n\t\treturn this.pendingInserts.size > 0 || this.pendingDeletes.size > 0;\n\t}\n\n\tprivate async flushPending(): Promise<void> {\n\t\tif (!this.hasPending) {\n\t\t\treturn; // return early if nothing to do\n\t\t}\n\n\t\t// Get pending data\n\t\tconst updateRequest: IUpdateRequest = { insert: this.pendingInserts, delete: this.pendingDeletes };\n\n\t\t// Reset pending data for next run\n\t\tthis.pendingDeletes = new Set<string>();\n\t\tthis.pendingInserts = new Map<string, string>();\n\n\t\t// Update in storage and release any\n\t\t// waiters we have once done\n\t\treturn this.database.updateItems(updateRequest).finally(() => {\n\t\t\tif (!this.hasPending) {\n\t\t\t\twhile (this.whenFlushedCallbacks.length) {\n\t\t\t\t\tthis.whenFlushedCallbacks.pop()?.();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tasync flush(delay?: number): Promise<void> {\n\t\tif (\n\t\t\tthis.state === StorageState.Closed || \t// Return early if we are already closed\n\t\t\tthis.pendingClose \t\t\t\t\t\t// return early if nothing to do\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.doFlush(delay);\n\t}\n\n\tprivate async doFlush(delay?: number): Promise<void> {\n\t\tif (this.options.hint === StorageHint.STORAGE_IN_MEMORY) {\n\t\t\treturn this.flushPending(); // return early if in-memory\n\t\t}\n\n\t\treturn this.flushDelayer.trigger(() => this.flushPending(), delay);\n\t}\n\n\tasync whenFlushed(): Promise<void> {\n\t\tif (!this.hasPending) {\n\t\t\treturn; // return early if nothing to do\n\t\t}\n\n\t\treturn new Promise(resolve => this.whenFlushedCallbacks.push(resolve));\n\t}\n\n\tisInMemory(): boolean {\n\t\treturn this.options.hint === StorageHint.STORAGE_IN_MEMORY;\n\t}\n}\n\nexport class InMemoryStorageDatabase implements IStorageDatabase {\n\n\treadonly onDidChangeItemsExternal = Event.None;\n\n\tprivate readonly items = new Map<string, string>();\n\n\tasync getItems(): Promise<Map<string, string>> {\n\t\treturn this.items;\n\t}\n\n\tasync updateItems(request: IUpdateRequest): Promise<void> {\n\t\trequest.insert?.forEach((value, key) => this.items.set(key, value));\n\n\t\trequest.delete?.forEach(key => this.items.delete(key));\n\t}\n\n\tasync optimize(): Promise<void> { }\n\tasync close(): Promise<void> { }\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { localize } from '../../../nls.js';\nimport { Event } from '../../../base/common/event.js';\nimport { basename, extname } from '../../../base/common/path.js';\nimport { TernarySearchTree } from '../../../base/common/ternarySearchTree.js';\nimport { extname as resourceExtname, basenameOrAuthority, joinPath, extUriBiasedIgnorePathCase } from '../../../base/common/resources.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { Schemas } from '../../../base/common/network.js';\n\nexport const IWorkspaceContextService = createDecorator<IWorkspaceContextService>('contextService');\n\nexport interface IWorkspaceContextService {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * An event which fires on workbench state changes.\n\t */\n\treadonly onDidChangeWorkbenchState: Event<WorkbenchState>;\n\n\t/**\n\t * An event which fires on workspace name changes.\n\t */\n\treadonly onDidChangeWorkspaceName: Event<void>;\n\n\t/**\n\t * An event which fires before workspace folders change.\n\t */\n\treadonly onWillChangeWorkspaceFolders: Event<IWorkspaceFoldersWillChangeEvent>;\n\n\t/**\n\t * An event which fires on workspace folders change.\n\t */\n\treadonly onDidChangeWorkspaceFolders: Event<IWorkspaceFoldersChangeEvent>;\n\n\t/**\n\t * Provides access to the complete workspace object.\n\t */\n\tgetCompleteWorkspace(): Promise<IWorkspace>;\n\n\t/**\n\t * Provides access to the workspace object the window is running with.\n\t * Use `getCompleteWorkspace` to get complete workspace object.\n\t */\n\tgetWorkspace(): IWorkspace;\n\n\t/**\n\t * Return the state of the workbench.\n\t *\n\t * WorkbenchState.EMPTY - if the workbench was opened with empty window or file\n\t * WorkbenchState.FOLDER - if the workbench was opened with a folder\n\t * WorkbenchState.WORKSPACE - if the workbench was opened with a workspace\n\t */\n\tgetWorkbenchState(): WorkbenchState;\n\n\t/**\n\t * Returns the folder for the given resource from the workspace.\n\t * Can be null if there is no workspace or the resource is not inside the workspace.\n\t */\n\tgetWorkspaceFolder(resource: URI): IWorkspaceFolder | null;\n\n\t/**\n\t * Return `true` if the current workspace has the given identifier or root URI otherwise `false`.\n\t */\n\tisCurrentWorkspace(workspaceIdOrFolder: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI): boolean;\n\n\t/**\n\t * Returns if the provided resource is inside the workspace or not.\n\t */\n\tisInsideWorkspace(resource: URI): boolean;\n}\n\nexport interface IResolvedWorkspace extends IWorkspaceIdentifier, IBaseWorkspace {\n\treadonly folders: IWorkspaceFolder[];\n}\n\nexport interface IBaseWorkspace {\n\n\t/**\n\t * If present, marks the window that opens the workspace\n\t * as a remote window with the given authority.\n\t */\n\treadonly remoteAuthority?: string;\n\n\t/**\n\t * Transient workspaces are meant to go away after being used\n\t * once, e.g. a window reload of a transient workspace will\n\t * open an empty window.\n\t *\n\t * See: https://github.com/microsoft/vscode/issues/119695\n\t */\n\treadonly transient?: boolean;\n}\n\nexport interface IBaseWorkspaceIdentifier {\n\n\t/**\n\t * Every workspace (multi-root, single folder or empty)\n\t * has a unique identifier. It is not possible to open\n\t * a workspace with the same `id` in multiple windows\n\t */\n\treadonly id: string;\n}\n\n/**\n * A single folder workspace identifier is a path to a folder + id.\n */\nexport interface ISingleFolderWorkspaceIdentifier extends IBaseWorkspaceIdentifier {\n\n\t/**\n\t * Folder path as `URI`.\n\t */\n\treadonly uri: URI;\n}\n\n/**\n * A multi-root workspace identifier is a path to a workspace file + id.\n */\nexport interface IWorkspaceIdentifier extends IBaseWorkspaceIdentifier {\n\n\t/**\n\t * Workspace config file path as `URI`.\n\t */\n\tconfigPath: URI;\n}\n\nexport interface IEmptyWorkspaceIdentifier extends IBaseWorkspaceIdentifier { }\n\nexport type IAnyWorkspaceIdentifier = IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IEmptyWorkspaceIdentifier;\n\nexport function isSingleFolderWorkspaceIdentifier(obj: unknown): obj is ISingleFolderWorkspaceIdentifier {\n\tconst singleFolderIdentifier = obj as ISingleFolderWorkspaceIdentifier | undefined;\n\n\treturn typeof singleFolderIdentifier?.id === 'string' && URI.isUri(singleFolderIdentifier.uri);\n}\n\nexport function isEmptyWorkspaceIdentifier(obj: unknown): obj is IEmptyWorkspaceIdentifier {\n\tconst emptyWorkspaceIdentifier = obj as IEmptyWorkspaceIdentifier | undefined;\n\treturn typeof emptyWorkspaceIdentifier?.id === 'string'\n\t\t&& !isSingleFolderWorkspaceIdentifier(obj)\n\t\t&& !isWorkspaceIdentifier(obj);\n}\n\nexport const EXTENSION_DEVELOPMENT_EMPTY_WINDOW_WORKSPACE: IEmptyWorkspaceIdentifier = { id: 'ext-dev' };\nexport const UNKNOWN_EMPTY_WINDOW_WORKSPACE: IEmptyWorkspaceIdentifier = { id: 'empty-window' };\n\nexport function toWorkspaceIdentifier(workspace: IWorkspace): IAnyWorkspaceIdentifier;\nexport function toWorkspaceIdentifier(backupPath: string | undefined, isExtensionDevelopment: boolean): IEmptyWorkspaceIdentifier;\nexport function toWorkspaceIdentifier(arg0: IWorkspace | string | undefined, isExtensionDevelopment?: boolean): IAnyWorkspaceIdentifier {\n\n\t// Empty workspace\n\tif (typeof arg0 === 'string' || typeof arg0 === 'undefined') {\n\n\t\t// With a backupPath, the basename is the empty workspace identifier\n\t\tif (typeof arg0 === 'string') {\n\t\t\treturn {\n\t\t\t\tid: basename(arg0)\n\t\t\t};\n\t\t}\n\n\t\t// Extension development empty windows have backups disabled\n\t\t// so we return a constant workspace identifier for extension\n\t\t// authors to allow to restore their workspace state even then.\n\t\tif (isExtensionDevelopment) {\n\t\t\treturn EXTENSION_DEVELOPMENT_EMPTY_WINDOW_WORKSPACE;\n\t\t}\n\n\t\treturn UNKNOWN_EMPTY_WINDOW_WORKSPACE;\n\t}\n\n\t// Multi root\n\tconst workspace = arg0;\n\tif (workspace.configuration) {\n\t\treturn {\n\t\t\tid: workspace.id,\n\t\t\tconfigPath: workspace.configuration\n\t\t};\n\t}\n\n\t// Single folder\n\tif (workspace.folders.length === 1) {\n\t\treturn {\n\t\t\tid: workspace.id,\n\t\t\turi: workspace.folders[0].uri\n\t\t};\n\t}\n\n\t// Empty window\n\treturn {\n\t\tid: workspace.id\n\t};\n}\n\nexport function isWorkspaceIdentifier(obj: unknown): obj is IWorkspaceIdentifier {\n\tconst workspaceIdentifier = obj as IWorkspaceIdentifier | undefined;\n\n\treturn typeof workspaceIdentifier?.id === 'string' && URI.isUri(workspaceIdentifier.configPath);\n}\n\nexport interface ISerializedSingleFolderWorkspaceIdentifier extends IBaseWorkspaceIdentifier {\n\treadonly uri: UriComponents;\n}\n\nexport interface ISerializedWorkspaceIdentifier extends IBaseWorkspaceIdentifier {\n\treadonly configPath: UriComponents;\n}\n\nexport function reviveIdentifier(identifier: undefined): undefined;\nexport function reviveIdentifier(identifier: ISerializedWorkspaceIdentifier): IWorkspaceIdentifier;\nexport function reviveIdentifier(identifier: ISerializedSingleFolderWorkspaceIdentifier): ISingleFolderWorkspaceIdentifier;\nexport function reviveIdentifier(identifier: IEmptyWorkspaceIdentifier): IEmptyWorkspaceIdentifier;\nexport function reviveIdentifier(identifier: ISerializedWorkspaceIdentifier | ISerializedSingleFolderWorkspaceIdentifier | IEmptyWorkspaceIdentifier | undefined): IAnyWorkspaceIdentifier | undefined;\nexport function reviveIdentifier(identifier: ISerializedWorkspaceIdentifier | ISerializedSingleFolderWorkspaceIdentifier | IEmptyWorkspaceIdentifier | undefined): IAnyWorkspaceIdentifier | undefined {\n\n\t// Single Folder\n\tconst singleFolderIdentifierCandidate = identifier as ISerializedSingleFolderWorkspaceIdentifier | undefined;\n\tif (singleFolderIdentifierCandidate?.uri) {\n\t\treturn { id: singleFolderIdentifierCandidate.id, uri: URI.revive(singleFolderIdentifierCandidate.uri) };\n\t}\n\n\t// Multi folder\n\tconst workspaceIdentifierCandidate = identifier as ISerializedWorkspaceIdentifier | undefined;\n\tif (workspaceIdentifierCandidate?.configPath) {\n\t\treturn { id: workspaceIdentifierCandidate.id, configPath: URI.revive(workspaceIdentifierCandidate.configPath) };\n\t}\n\n\t// Empty\n\tif (identifier?.id) {\n\t\treturn { id: identifier.id };\n\t}\n\n\treturn undefined;\n}\n\nexport const enum WorkbenchState {\n\tEMPTY = 1,\n\tFOLDER,\n\tWORKSPACE\n}\n\nexport interface IWorkspaceFoldersWillChangeEvent {\n\n\treadonly changes: IWorkspaceFoldersChangeEvent;\n\treadonly fromCache: boolean;\n\n\tjoin(promise: Promise<void>): void;\n}\n\nexport interface IWorkspaceFoldersChangeEvent {\n\tadded: IWorkspaceFolder[];\n\tremoved: IWorkspaceFolder[];\n\tchanged: IWorkspaceFolder[];\n}\n\nexport interface IWorkspace {\n\n\t/**\n\t * the unique identifier of the workspace.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * Folders in the workspace.\n\t */\n\treadonly folders: IWorkspaceFolder[];\n\n\t/**\n\t * Transient workspaces are meant to go away after being used\n\t * once, e.g. a window reload of a transient workspace will\n\t * open an empty window.\n\t */\n\treadonly transient?: boolean;\n\n\t/**\n\t * the location of the workspace configuration\n\t */\n\treadonly configuration?: URI | null;\n}\n\nexport function isWorkspace(thing: unknown): thing is IWorkspace {\n\tconst candidate = thing as IWorkspace | undefined;\n\n\treturn !!(candidate && typeof candidate === 'object'\n\t\t&& typeof candidate.id === 'string'\n\t\t&& Array.isArray(candidate.folders));\n}\n\nexport interface IWorkspaceFolderData {\n\n\t/**\n\t * The associated URI for this workspace folder.\n\t */\n\treadonly uri: URI;\n\n\t/**\n\t * The name of this workspace folder. Defaults to\n\t * the basename of its [uri-path](#Uri.path)\n\t */\n\treadonly name: string;\n\n\t/**\n\t * The ordinal number of this workspace folder.\n\t */\n\treadonly index: number;\n}\n\nexport interface IWorkspaceFolder extends IWorkspaceFolderData {\n\n\t/**\n\t * Given workspace folder relative path, returns the resource with the absolute path.\n\t */\n\ttoResource: (relativePath: string) => URI;\n}\n\nexport function isWorkspaceFolder(thing: unknown): thing is IWorkspaceFolder {\n\tconst candidate = thing as IWorkspaceFolder;\n\n\treturn !!(candidate && typeof candidate === 'object'\n\t\t&& URI.isUri(candidate.uri)\n\t\t&& typeof candidate.name === 'string'\n\t\t&& typeof candidate.toResource === 'function');\n}\n\nexport class Workspace implements IWorkspace {\n\n\tprivate foldersMap: TernarySearchTree<URI, WorkspaceFolder>;\n\n\tprivate _folders!: WorkspaceFolder[];\n\tget folders(): WorkspaceFolder[] { return this._folders; }\n\tset folders(folders: WorkspaceFolder[]) {\n\t\tthis._folders = folders;\n\t\tthis.updateFoldersMap();\n\t}\n\n\tconstructor(\n\t\tprivate _id: string,\n\t\tfolders: WorkspaceFolder[],\n\t\tprivate _transient: boolean,\n\t\tprivate _configuration: URI | null,\n\t\tprivate ignorePathCasing: (key: URI) => boolean,\n\t) {\n\t\tthis.foldersMap = TernarySearchTree.forUris<WorkspaceFolder>(this.ignorePathCasing, () => true);\n\t\tthis.folders = folders;\n\t}\n\n\tupdate(workspace: Workspace) {\n\t\tthis._id = workspace.id;\n\t\tthis._configuration = workspace.configuration;\n\t\tthis._transient = workspace.transient;\n\t\tthis.ignorePathCasing = workspace.ignorePathCasing;\n\t\tthis.folders = workspace.folders;\n\t}\n\n\tget id(): string {\n\t\treturn this._id;\n\t}\n\n\tget transient(): boolean {\n\t\treturn this._transient;\n\t}\n\n\tget configuration(): URI | null {\n\t\treturn this._configuration;\n\t}\n\n\tset configuration(configuration: URI | null) {\n\t\tthis._configuration = configuration;\n\t}\n\n\tgetFolder(resource: URI): IWorkspaceFolder | null {\n\t\tif (!resource) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this.foldersMap.findSubstr(resource) || null;\n\t}\n\n\tprivate updateFoldersMap(): void {\n\t\tthis.foldersMap = TernarySearchTree.forUris<WorkspaceFolder>(this.ignorePathCasing, () => true);\n\t\tfor (const folder of this.folders) {\n\t\t\tthis.foldersMap.set(folder.uri, folder);\n\t\t}\n\t}\n\n\ttoJSON(): IWorkspace {\n\t\treturn { id: this.id, folders: this.folders, transient: this.transient, configuration: this.configuration };\n\t}\n}\n\nexport interface IRawFileWorkspaceFolder {\n\treadonly path: string;\n\tname?: string;\n}\n\nexport interface IRawUriWorkspaceFolder {\n\treadonly uri: string;\n\tname?: string;\n}\n\nexport class WorkspaceFolder implements IWorkspaceFolder {\n\n\treadonly uri: URI;\n\treadonly name: string;\n\treadonly index: number;\n\n\tconstructor(\n\t\tdata: IWorkspaceFolderData,\n\t\t/**\n\t\t * Provides access to the original metadata for this workspace\n\t\t * folder. This can be different from the metadata provided in\n\t\t * this class:\n\t\t * - raw paths can be relative\n\t\t * - raw paths are not normalized\n\t\t */\n\t\treadonly raw?: IRawFileWorkspaceFolder | IRawUriWorkspaceFolder\n\t) {\n\t\tthis.uri = data.uri;\n\t\tthis.index = data.index;\n\t\tthis.name = data.name;\n\t}\n\n\ttoResource(relativePath: string): URI {\n\t\treturn joinPath(this.uri, relativePath);\n\t}\n\n\ttoJSON(): IWorkspaceFolderData {\n\t\treturn { uri: this.uri, name: this.name, index: this.index };\n\t}\n}\n\nexport function toWorkspaceFolder(resource: URI): WorkspaceFolder {\n\treturn new WorkspaceFolder({ uri: resource, index: 0, name: basenameOrAuthority(resource) }, { uri: resource.toString() });\n}\n\nexport const WORKSPACE_EXTENSION = 'code-workspace';\nexport const WORKSPACE_SUFFIX = `.${WORKSPACE_EXTENSION}`;\nexport const WORKSPACE_FILTER = [{ name: localize('codeWorkspace', \"Code Workspace\"), extensions: [WORKSPACE_EXTENSION] }];\nexport const UNTITLED_WORKSPACE_NAME = 'workspace.json';\n\nexport function isUntitledWorkspace(path: URI, environmentService: IEnvironmentService): boolean {\n\treturn extUriBiasedIgnorePathCase.isEqualOrParent(path, environmentService.untitledWorkspacesHome);\n}\n\nexport function isTemporaryWorkspace(workspace: IWorkspace): boolean;\nexport function isTemporaryWorkspace(path: URI): boolean;\nexport function isTemporaryWorkspace(arg1: IWorkspace | URI): boolean {\n\tlet path: URI | null | undefined;\n\tif (URI.isUri(arg1)) {\n\t\tpath = arg1;\n\t} else {\n\t\tpath = arg1.configuration;\n\t}\n\n\treturn path?.scheme === Schemas.tmp;\n}\n\nexport const STANDALONE_EDITOR_WORKSPACE_ID = '4064f6ec-cb38-4ad0-af64-ee6467e63c82';\nexport function isStandaloneEditorWorkspace(workspace: IWorkspace): boolean {\n\treturn workspace.id === STANDALONE_EDITOR_WORKSPACE_ID;\n}\n\nexport function isSavedWorkspace(path: URI, environmentService: IEnvironmentService): boolean {\n\treturn !isUntitledWorkspace(path, environmentService) && !isTemporaryWorkspace(path);\n}\n\nexport function hasWorkspaceFileExtension(path: string | URI) {\n\tconst ext = (typeof path === 'string') ? extname(path) : resourceExtname(path);\n\n\treturn ext === WORKSPACE_SUFFIX;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { URI } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { IExtUri } from '../../../base/common/resources.js';\n\n\nexport const IUriIdentityService = createDecorator<IUriIdentityService>('IUriIdentityService');\n\nexport interface IUriIdentityService {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Uri extensions that are aware of casing.\n\t */\n\treadonly extUri: IExtUri;\n\n\t/**\n\t * Returns a canonical uri for the given resource. Different uris can point to the same\n\t * resource. That's because of casing or missing normalization, e.g the following uris\n\t * are different but refer to the same document (because windows paths are not case-sensitive)\n\t *\n\t * ```txt\n\t * file:///c:/foo/bar.txt\n\t * file:///c:/FOO/BAR.txt\n\t * ```\n\t *\n\t * This function should be invoked when feeding uris into the system that represent the truth,\n\t * e.g document uris or marker-to-document associations etc. This function should NOT be called\n\t * to pretty print a label nor to sanitize a uri.\n\t *\n\t * Samples:\n\t *\n\t * | in | out | |\n\t * |---|---|---|\n\t * | `file:///foo/bar/../bar` | `file:///foo/bar` | n/a |\n\t * | `file:///foo/bar/../bar#frag` | `file:///foo/bar#frag` | keep fragment |\n\t * | `file:///foo/BAR` | `file:///foo/bar` | assume ignore case |\n\t * | `file:///foo/bar/../BAR?q=2` | `file:///foo/BAR?q=2` | query makes it a different document |\n\t */\n\tasCanonicalUri(uri: URI): URI;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { hash } from '../../../base/common/hash.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { basename, joinPath } from '../../../base/common/resources.js';\nimport { URI, UriDto } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { FileOperationResult, IFileService, toFileOperationResult } from '../../files/common/files.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IAnyWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from '../../workspace/common/workspace.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { Promises } from '../../../base/common/async.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { escapeRegExpCharacters } from '../../../base/common/strings.js';\nimport { isString, Mutable } from '../../../base/common/types.js';\n\nexport const enum ProfileResourceType {\n\tSettings = 'settings',\n\tKeybindings = 'keybindings',\n\tSnippets = 'snippets',\n\tPrompts = 'prompts',\n\tTasks = 'tasks',\n\tExtensions = 'extensions',\n\tGlobalState = 'globalState',\n\tMcp = 'mcp',\n}\n\n/**\n * Flags to indicate whether to use the default profile or not.\n */\nexport type UseDefaultProfileFlags = { [key in ProfileResourceType]?: boolean };\nexport type ProfileResourceTypeFlags = UseDefaultProfileFlags;\n\nexport interface IUserDataProfile {\n\treadonly id: string;\n\treadonly isDefault: boolean;\n\treadonly name: string;\n\treadonly icon?: string;\n\treadonly location: URI;\n\treadonly globalStorageHome: URI;\n\treadonly settingsResource: URI;\n\treadonly keybindingsResource: URI;\n\treadonly tasksResource: URI;\n\treadonly snippetsHome: URI;\n\treadonly promptsHome: URI;\n\treadonly extensionsResource: URI;\n\treadonly mcpResource: URI;\n\treadonly cacheHome: URI;\n\treadonly useDefaultFlags?: UseDefaultProfileFlags;\n\treadonly isTransient?: boolean;\n\treadonly workspaces?: readonly URI[];\n}\n\nexport function isUserDataProfile(thing: unknown): thing is IUserDataProfile {\n\tconst candidate = thing as IUserDataProfile | undefined;\n\n\treturn !!(candidate && typeof candidate === 'object'\n\t\t&& typeof candidate.id === 'string'\n\t\t&& typeof candidate.isDefault === 'boolean'\n\t\t&& typeof candidate.name === 'string'\n\t\t&& URI.isUri(candidate.location)\n\t\t&& URI.isUri(candidate.globalStorageHome)\n\t\t&& URI.isUri(candidate.settingsResource)\n\t\t&& URI.isUri(candidate.keybindingsResource)\n\t\t&& URI.isUri(candidate.tasksResource)\n\t\t&& URI.isUri(candidate.snippetsHome)\n\t\t&& URI.isUri(candidate.promptsHome)\n\t\t&& URI.isUri(candidate.extensionsResource)\n\t\t&& URI.isUri(candidate.mcpResource)\n\t);\n}\n\nexport type DidChangeProfilesEvent = { readonly added: readonly IUserDataProfile[]; readonly removed: readonly IUserDataProfile[]; readonly updated: readonly IUserDataProfile[]; readonly all: readonly IUserDataProfile[] };\n\nexport type WillCreateProfileEvent = {\n\tprofile: IUserDataProfile;\n\tjoin(promise: Promise<void>): void;\n};\n\nexport type WillRemoveProfileEvent = {\n\tprofile: IUserDataProfile;\n\tjoin(promise: Promise<void>): void;\n};\n\nexport interface IUserDataProfileOptions {\n\treadonly icon?: string;\n\treadonly useDefaultFlags?: UseDefaultProfileFlags;\n\treadonly transient?: boolean;\n\treadonly workspaces?: readonly URI[];\n}\n\nexport interface IUserDataProfileUpdateOptions extends Omit<IUserDataProfileOptions, 'icon'> {\n\treadonly name?: string;\n\treadonly icon?: string | null;\n}\n\nexport const IUserDataProfilesService = createDecorator<IUserDataProfilesService>('IUserDataProfilesService');\nexport interface IUserDataProfilesService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly profilesHome: URI;\n\treadonly defaultProfile: IUserDataProfile;\n\n\treadonly onDidChangeProfiles: Event<DidChangeProfilesEvent>;\n\treadonly profiles: readonly IUserDataProfile[];\n\n\treadonly onDidResetWorkspaces: Event<void>;\n\n\tcreateNamedProfile(name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile>;\n\tcreateTransientProfile(workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile>;\n\tcreateProfile(id: string, name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile>;\n\tupdateProfile(profile: IUserDataProfile, options?: IUserDataProfileUpdateOptions,): Promise<IUserDataProfile>;\n\tremoveProfile(profile: IUserDataProfile): Promise<void>;\n\n\tsetProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, profile: IUserDataProfile): Promise<void>;\n\tresetWorkspaces(): Promise<void>;\n\n\tcleanUp(): Promise<void>;\n\tcleanUpTransientProfiles(): Promise<void>;\n}\n\nexport function reviveProfile(profile: UriDto<IUserDataProfile>, scheme: string): IUserDataProfile {\n\treturn {\n\t\tid: profile.id,\n\t\tisDefault: profile.isDefault,\n\t\tname: profile.name,\n\t\ticon: profile.icon,\n\t\tlocation: URI.revive(profile.location).with({ scheme }),\n\t\tglobalStorageHome: URI.revive(profile.globalStorageHome).with({ scheme }),\n\t\tsettingsResource: URI.revive(profile.settingsResource).with({ scheme }),\n\t\tkeybindingsResource: URI.revive(profile.keybindingsResource).with({ scheme }),\n\t\ttasksResource: URI.revive(profile.tasksResource).with({ scheme }),\n\t\tsnippetsHome: URI.revive(profile.snippetsHome).with({ scheme }),\n\t\tpromptsHome: URI.revive(profile.promptsHome).with({ scheme }),\n\t\textensionsResource: URI.revive(profile.extensionsResource).with({ scheme }),\n\t\tmcpResource: URI.revive(profile.mcpResource).with({ scheme }),\n\t\tcacheHome: URI.revive(profile.cacheHome).with({ scheme }),\n\t\tuseDefaultFlags: profile.useDefaultFlags,\n\t\tisTransient: profile.isTransient,\n\t\tworkspaces: profile.workspaces?.map(w => URI.revive(w)),\n\t};\n}\n\nexport function toUserDataProfile(id: string, name: string, location: URI, profilesCacheHome: URI, options?: IUserDataProfileOptions, defaultProfile?: IUserDataProfile): IUserDataProfile {\n\treturn {\n\t\tid,\n\t\tname,\n\t\tlocation,\n\t\tisDefault: false,\n\t\ticon: options?.icon,\n\t\tglobalStorageHome: defaultProfile && options?.useDefaultFlags?.globalState ? defaultProfile.globalStorageHome : joinPath(location, 'globalStorage'),\n\t\tsettingsResource: defaultProfile && options?.useDefaultFlags?.settings ? defaultProfile.settingsResource : joinPath(location, 'settings.json'),\n\t\tkeybindingsResource: defaultProfile && options?.useDefaultFlags?.keybindings ? defaultProfile.keybindingsResource : joinPath(location, 'keybindings.json'),\n\t\ttasksResource: defaultProfile && options?.useDefaultFlags?.tasks ? defaultProfile.tasksResource : joinPath(location, 'tasks.json'),\n\t\tsnippetsHome: defaultProfile && options?.useDefaultFlags?.snippets ? defaultProfile.snippetsHome : joinPath(location, 'snippets'),\n\t\tpromptsHome: defaultProfile && options?.useDefaultFlags?.prompts ? defaultProfile.promptsHome : joinPath(location, 'prompts'),\n\t\textensionsResource: defaultProfile && options?.useDefaultFlags?.extensions ? defaultProfile.extensionsResource : joinPath(location, 'extensions.json'),\n\t\tmcpResource: defaultProfile && options?.useDefaultFlags?.mcp ? defaultProfile.mcpResource : joinPath(location, 'mcp.json'),\n\t\tcacheHome: joinPath(profilesCacheHome, id),\n\t\tuseDefaultFlags: options?.useDefaultFlags,\n\t\tisTransient: options?.transient,\n\t\tworkspaces: options?.workspaces,\n\t};\n}\n\nexport type UserDataProfilesObject = {\n\tprofiles: IUserDataProfile[];\n\temptyWindows: Map<string, IUserDataProfile>;\n};\n\nexport type StoredUserDataProfile = {\n\tname: string;\n\tlocation: URI;\n\ticon?: string;\n\tuseDefaultFlags?: UseDefaultProfileFlags;\n};\n\nexport type StoredProfileAssociations = {\n\tworkspaces?: IStringDictionary<string>;\n\temptyWindows?: IStringDictionary<string>;\n};\n\nexport class UserDataProfilesService extends Disposable implements IUserDataProfilesService {\n\n\tprotected static readonly PROFILES_KEY = 'userDataProfiles';\n\tprotected static readonly PROFILE_ASSOCIATIONS_KEY = 'profileAssociations';\n\n\treadonly _serviceBrand: undefined;\n\n\treadonly profilesHome: URI;\n\tprivate readonly profilesCacheHome: URI;\n\n\tget defaultProfile(): IUserDataProfile { return this.profiles[0]; }\n\tget profiles(): IUserDataProfile[] { return [...this.profilesObject.profiles, ...this.transientProfilesObject.profiles]; }\n\n\tprotected readonly _onDidChangeProfiles = this._register(new Emitter<DidChangeProfilesEvent>());\n\treadonly onDidChangeProfiles = this._onDidChangeProfiles.event;\n\n\tprotected readonly _onWillCreateProfile = this._register(new Emitter<WillCreateProfileEvent>());\n\treadonly onWillCreateProfile = this._onWillCreateProfile.event;\n\n\tprotected readonly _onWillRemoveProfile = this._register(new Emitter<WillRemoveProfileEvent>());\n\treadonly onWillRemoveProfile = this._onWillRemoveProfile.event;\n\n\tprivate readonly _onDidResetWorkspaces = this._register(new Emitter<void>());\n\treadonly onDidResetWorkspaces = this._onDidResetWorkspaces.event;\n\n\tprivate profileCreationPromises = new Map<string, Promise<IUserDataProfile>>();\n\n\tprotected readonly transientProfilesObject: UserDataProfilesObject = {\n\t\tprofiles: [],\n\t\temptyWindows: new Map()\n\t};\n\n\tconstructor(\n\t\t@IEnvironmentService protected readonly environmentService: IEnvironmentService,\n\t\t@IFileService protected readonly fileService: IFileService,\n\t\t@IUriIdentityService protected readonly uriIdentityService: IUriIdentityService,\n\t\t@ILogService protected readonly logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis.profilesHome = joinPath(this.environmentService.userRoamingDataHome, 'profiles');\n\t\tthis.profilesCacheHome = joinPath(this.environmentService.cacheHome, 'CachedProfilesData');\n\t}\n\n\tinit(): void {\n\t\tthis._profilesObject = undefined;\n\t}\n\n\tprotected _profilesObject: UserDataProfilesObject | undefined;\n\tprotected get profilesObject(): UserDataProfilesObject {\n\t\tif (!this._profilesObject) {\n\t\t\tconst defaultProfile = this.createDefaultProfile();\n\t\t\tconst profiles: Array<Mutable<IUserDataProfile>> = [defaultProfile];\n\t\t\ttry {\n\t\t\t\tfor (const storedProfile of this.getStoredProfiles()) {\n\t\t\t\t\tif (!storedProfile.name || !isString(storedProfile.name) || !storedProfile.location) {\n\t\t\t\t\t\tthis.logService.warn('Skipping the invalid stored profile', storedProfile.location || storedProfile.name);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tprofiles.push(toUserDataProfile(basename(storedProfile.location), storedProfile.name, storedProfile.location, this.profilesCacheHome, { icon: storedProfile.icon, useDefaultFlags: storedProfile.useDefaultFlags }, defaultProfile));\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.error(error);\n\t\t\t}\n\t\t\tconst emptyWindows = new Map<string, IUserDataProfile>();\n\t\t\tif (profiles.length) {\n\t\t\t\ttry {\n\t\t\t\t\tconst profileAssociaitions = this.getStoredProfileAssociations();\n\t\t\t\t\tif (profileAssociaitions.workspaces) {\n\t\t\t\t\t\tfor (const [workspacePath, profileId] of Object.entries(profileAssociaitions.workspaces)) {\n\t\t\t\t\t\t\tconst workspace = URI.parse(workspacePath);\n\t\t\t\t\t\t\tconst profile = profiles.find(p => p.id === profileId);\n\t\t\t\t\t\t\tif (profile) {\n\t\t\t\t\t\t\t\tconst workspaces = profile.workspaces ? profile.workspaces.slice(0) : [];\n\t\t\t\t\t\t\t\tworkspaces.push(workspace);\n\t\t\t\t\t\t\t\tprofile.workspaces = workspaces;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (profileAssociaitions.emptyWindows) {\n\t\t\t\t\t\tfor (const [windowId, profileId] of Object.entries(profileAssociaitions.emptyWindows)) {\n\t\t\t\t\t\t\tconst profile = profiles.find(p => p.id === profileId);\n\t\t\t\t\t\t\tif (profile) {\n\t\t\t\t\t\t\t\temptyWindows.set(windowId, profile);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._profilesObject = { profiles, emptyWindows };\n\t\t}\n\t\treturn this._profilesObject;\n\t}\n\n\tprivate createDefaultProfile() {\n\t\tconst defaultProfile = toUserDataProfile('__default__profile__', localize('defaultProfile', \"Default\"), this.environmentService.userRoamingDataHome, this.profilesCacheHome);\n\t\treturn { ...defaultProfile, extensionsResource: this.getDefaultProfileExtensionsLocation() ?? defaultProfile.extensionsResource, isDefault: true };\n\t}\n\n\tasync createTransientProfile(workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile> {\n\t\tconst namePrefix = `Temp`;\n\t\tconst nameRegEx = new RegExp(`${escapeRegExpCharacters(namePrefix)}\\\\s(\\\\d+)`);\n\t\tlet nameIndex = 0;\n\t\tfor (const profile of this.profiles) {\n\t\t\tconst matches = nameRegEx.exec(profile.name);\n\t\t\tconst index = matches ? parseInt(matches[1]) : 0;\n\t\t\tnameIndex = index > nameIndex ? index : nameIndex;\n\t\t}\n\t\tconst name = `${namePrefix} ${nameIndex + 1}`;\n\t\treturn this.createProfile(hash(generateUuid()).toString(16), name, { transient: true }, workspaceIdentifier);\n\t}\n\n\tasync createNamedProfile(name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile> {\n\t\treturn this.createProfile(hash(generateUuid()).toString(16), name, options, workspaceIdentifier);\n\t}\n\n\tasync createProfile(id: string, name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile> {\n\t\tconst profile = await this.doCreateProfile(id, name, options, workspaceIdentifier);\n\n\t\treturn profile;\n\t}\n\n\tprivate async doCreateProfile(id: string, name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile> {\n\t\tif (!isString(name) || !name) {\n\t\t\tthrow new Error('Name of the profile is mandatory and must be of type `string`');\n\t\t}\n\n\t\tlet profileCreationPromise = this.profileCreationPromises.get(name);\n\t\tif (!profileCreationPromise) {\n\t\t\tprofileCreationPromise = (async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst existing = this.profiles.find(p => p.id === id || (!p.isTransient && !options?.transient && p.name === name));\n\t\t\t\t\tif (existing) {\n\t\t\t\t\t\tthrow new Error(`Profile with ${name} name already exists`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst workspace = workspaceIdentifier ? this.getWorkspace(workspaceIdentifier) : undefined;\n\t\t\t\t\tif (URI.isUri(workspace)) {\n\t\t\t\t\t\toptions = { ...options, workspaces: [workspace] };\n\t\t\t\t\t}\n\t\t\t\t\tconst profile = toUserDataProfile(id, name, joinPath(this.profilesHome, id), this.profilesCacheHome, options, this.defaultProfile);\n\t\t\t\t\tawait this.fileService.createFolder(profile.location);\n\n\t\t\t\t\tconst joiners: Promise<void>[] = [];\n\t\t\t\t\tthis._onWillCreateProfile.fire({\n\t\t\t\t\t\tprofile,\n\t\t\t\t\t\tjoin(promise) {\n\t\t\t\t\t\t\tjoiners.push(promise);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tawait Promises.settled(joiners);\n\n\t\t\t\t\tif (workspace && !URI.isUri(workspace)) {\n\t\t\t\t\t\tthis.updateEmptyWindowAssociation(workspace, profile, !!profile.isTransient);\n\t\t\t\t\t}\n\t\t\t\t\tthis.updateProfiles([profile], [], []);\n\t\t\t\t\treturn profile;\n\t\t\t\t} finally {\n\t\t\t\t\tthis.profileCreationPromises.delete(name);\n\t\t\t\t}\n\t\t\t})();\n\t\t\tthis.profileCreationPromises.set(name, profileCreationPromise);\n\t\t}\n\t\treturn profileCreationPromise;\n\t}\n\n\tasync updateProfile(profile: IUserDataProfile, options: IUserDataProfileUpdateOptions): Promise<IUserDataProfile> {\n\t\tconst profilesToUpdate: IUserDataProfile[] = [];\n\t\tfor (const existing of this.profiles) {\n\t\t\tlet profileToUpdate: Mutable<IUserDataProfile> | undefined;\n\n\t\t\tif (profile.id === existing.id) {\n\t\t\t\tif (!existing.isDefault) {\n\t\t\t\t\tprofileToUpdate = toUserDataProfile(existing.id, options.name ?? existing.name, existing.location, this.profilesCacheHome, {\n\t\t\t\t\t\ticon: options.icon === null ? undefined : options.icon ?? existing.icon,\n\t\t\t\t\t\ttransient: options.transient ?? existing.isTransient,\n\t\t\t\t\t\tuseDefaultFlags: options.useDefaultFlags ?? existing.useDefaultFlags,\n\t\t\t\t\t\tworkspaces: options.workspaces ?? existing.workspaces,\n\t\t\t\t\t}, this.defaultProfile);\n\t\t\t\t} else if (options.workspaces) {\n\t\t\t\t\tprofileToUpdate = existing;\n\t\t\t\t\tprofileToUpdate.workspaces = options.workspaces;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\telse if (options.workspaces) {\n\t\t\t\tconst workspaces = existing.workspaces?.filter(w1 => !options.workspaces?.some(w2 => this.uriIdentityService.extUri.isEqual(w1, w2)));\n\t\t\t\tif (existing.workspaces?.length !== workspaces?.length) {\n\t\t\t\t\tprofileToUpdate = existing;\n\t\t\t\t\tprofileToUpdate.workspaces = workspaces;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (profileToUpdate) {\n\t\t\t\tprofilesToUpdate.push(profileToUpdate);\n\t\t\t}\n\t\t}\n\n\t\tif (!profilesToUpdate.length) {\n\t\t\tif (profile.isDefault) {\n\t\t\t\tthrow new Error('Cannot update default profile');\n\t\t\t}\n\t\t\tthrow new Error(`Profile '${profile.name}' does not exist`);\n\t\t}\n\n\t\tthis.updateProfiles([], [], profilesToUpdate);\n\n\t\tconst updatedProfile = this.profiles.find(p => p.id === profile.id);\n\t\tif (!updatedProfile) {\n\t\t\tthrow new Error(`Profile '${profile.name}' was not updated`);\n\t\t}\n\n\t\treturn updatedProfile;\n\t}\n\n\tasync removeProfile(profileToRemove: IUserDataProfile): Promise<void> {\n\t\tif (profileToRemove.isDefault) {\n\t\t\tthrow new Error('Cannot remove default profile');\n\t\t}\n\t\tconst profile = this.profiles.find(p => p.id === profileToRemove.id);\n\t\tif (!profile) {\n\t\t\tthrow new Error(`Profile '${profileToRemove.name}' does not exist`);\n\t\t}\n\n\t\tconst joiners: Promise<void>[] = [];\n\t\tthis._onWillRemoveProfile.fire({\n\t\t\tprofile,\n\t\t\tjoin(promise) {\n\t\t\t\tjoiners.push(promise);\n\t\t\t}\n\t\t});\n\n\t\ttry {\n\t\t\tawait Promise.allSettled(joiners);\n\t\t} catch (error) {\n\t\t\tthis.logService.error(error);\n\t\t}\n\n\t\tthis.updateProfiles([], [profile], []);\n\n\t\ttry {\n\t\t\tawait this.fileService.del(profile.cacheHome, { recursive: true });\n\t\t} catch (error) {\n\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\tthis.logService.error(error);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync setProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, profileToSet: IUserDataProfile): Promise<void> {\n\t\tconst profile = this.profiles.find(p => p.id === profileToSet.id);\n\t\tif (!profile) {\n\t\t\tthrow new Error(`Profile '${profileToSet.name}' does not exist`);\n\t\t}\n\n\t\tconst workspace = this.getWorkspace(workspaceIdentifier);\n\t\tif (URI.isUri(workspace)) {\n\t\t\tconst workspaces = profile.workspaces ? [...profile.workspaces] : [];\n\t\t\tif (!workspaces.some(w => this.uriIdentityService.extUri.isEqual(w, workspace))) {\n\t\t\t\tworkspaces.push(workspace);\n\t\t\t\tawait this.updateProfile(profile, { workspaces });\n\t\t\t}\n\t\t} else {\n\t\t\tthis.updateEmptyWindowAssociation(workspace, profile, false);\n\t\t\tthis.updateStoredProfiles(this.profiles);\n\t\t}\n\t}\n\n\tunsetWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, transient: boolean = false): void {\n\t\tconst workspace = this.getWorkspace(workspaceIdentifier);\n\t\tif (URI.isUri(workspace)) {\n\t\t\tconst currentlyAssociatedProfile = this.getProfileForWorkspace(workspaceIdentifier);\n\t\t\tif (currentlyAssociatedProfile) {\n\t\t\t\tthis.updateProfile(currentlyAssociatedProfile, { workspaces: currentlyAssociatedProfile.workspaces?.filter(w => !this.uriIdentityService.extUri.isEqual(w, workspace)) });\n\t\t\t}\n\t\t} else {\n\t\t\tthis.updateEmptyWindowAssociation(workspace, undefined, transient);\n\t\t\tthis.updateStoredProfiles(this.profiles);\n\t\t}\n\t}\n\n\tasync resetWorkspaces(): Promise<void> {\n\t\tthis.transientProfilesObject.emptyWindows.clear();\n\t\tthis.profilesObject.emptyWindows.clear();\n\t\tfor (const profile of this.profiles) {\n\t\t\t(<Mutable<IUserDataProfile>>profile).workspaces = undefined;\n\t\t}\n\t\tthis.updateProfiles([], [], this.profiles);\n\t\tthis._onDidResetWorkspaces.fire();\n\t}\n\n\tasync cleanUp(): Promise<void> {\n\t\tif (await this.fileService.exists(this.profilesHome)) {\n\t\t\tconst stat = await this.fileService.resolve(this.profilesHome);\n\t\t\tawait Promise.all((stat.children || [])\n\t\t\t\t.filter(child => child.isDirectory && this.profiles.every(p => !this.uriIdentityService.extUri.isEqual(p.location, child.resource)))\n\t\t\t\t.map(child => this.fileService.del(child.resource, { recursive: true })));\n\t\t}\n\t}\n\n\tasync cleanUpTransientProfiles(): Promise<void> {\n\t\tconst unAssociatedTransientProfiles = this.transientProfilesObject.profiles.filter(p => !this.isProfileAssociatedToWorkspace(p));\n\t\tawait Promise.allSettled(unAssociatedTransientProfiles.map(p => this.removeProfile(p)));\n\t}\n\n\tgetProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier): IUserDataProfile | undefined {\n\t\tconst workspace = this.getWorkspace(workspaceIdentifier);\n\t\treturn URI.isUri(workspace)\n\t\t\t? this.profiles.find(p => p.workspaces?.some(w => this.uriIdentityService.extUri.isEqual(w, workspace)))\n\t\t\t: (this.profilesObject.emptyWindows.get(workspace) ?? this.transientProfilesObject.emptyWindows.get(workspace));\n\t}\n\n\tprotected getWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier): URI | string {\n\t\tif (isSingleFolderWorkspaceIdentifier(workspaceIdentifier)) {\n\t\t\treturn workspaceIdentifier.uri;\n\t\t}\n\t\tif (isWorkspaceIdentifier(workspaceIdentifier)) {\n\t\t\treturn workspaceIdentifier.configPath;\n\t\t}\n\t\treturn workspaceIdentifier.id;\n\t}\n\n\tprivate isProfileAssociatedToWorkspace(profile: IUserDataProfile): boolean {\n\t\tif (profile.workspaces?.length) {\n\t\t\treturn true;\n\t\t}\n\t\tif ([...this.profilesObject.emptyWindows.values()].some(windowProfile => this.uriIdentityService.extUri.isEqual(windowProfile.location, profile.location))) {\n\t\t\treturn true;\n\t\t}\n\t\tif ([...this.transientProfilesObject.emptyWindows.values()].some(windowProfile => this.uriIdentityService.extUri.isEqual(windowProfile.location, profile.location))) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate updateProfiles(added: IUserDataProfile[], removed: IUserDataProfile[], updated: IUserDataProfile[]): void {\n\t\tconst allProfiles: Mutable<IUserDataProfile>[] = [...this.profiles, ...added];\n\n\t\tconst transientProfiles = this.transientProfilesObject.profiles;\n\t\tthis.transientProfilesObject.profiles = [];\n\n\t\tconst profiles: IUserDataProfile[] = [];\n\n\t\tfor (let profile of allProfiles) {\n\t\t\t// removed\n\t\t\tif (removed.some(p => profile.id === p.id)) {\n\t\t\t\tfor (const windowId of [...this.profilesObject.emptyWindows.keys()]) {\n\t\t\t\t\tif (profile.id === this.profilesObject.emptyWindows.get(windowId)?.id) {\n\t\t\t\t\t\tthis.profilesObject.emptyWindows.delete(windowId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!profile.isDefault) {\n\t\t\t\tprofile = updated.find(p => profile.id === p.id) ?? profile;\n\t\t\t\tconst transientProfile = transientProfiles.find(p => profile.id === p.id);\n\t\t\t\tif (profile.isTransient) {\n\t\t\t\t\tthis.transientProfilesObject.profiles.push(profile);\n\t\t\t\t} else {\n\t\t\t\t\tif (transientProfile) {\n\t\t\t\t\t\t// Move the empty window associations from the transient profile to the persisted profile\n\t\t\t\t\t\tfor (const [windowId, p] of this.transientProfilesObject.emptyWindows.entries()) {\n\t\t\t\t\t\t\tif (profile.id === p.id) {\n\t\t\t\t\t\t\t\tthis.transientProfilesObject.emptyWindows.delete(windowId);\n\t\t\t\t\t\t\t\tthis.profilesObject.emptyWindows.set(windowId, profile);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (profile.workspaces?.length === 0) {\n\t\t\t\tprofile.workspaces = undefined;\n\t\t\t}\n\n\t\t\tprofiles.push(profile);\n\t\t}\n\n\t\tthis.updateStoredProfiles(profiles);\n\t\tthis.triggerProfilesChanges(added, removed, updated);\n\t}\n\n\tprotected triggerProfilesChanges(added: IUserDataProfile[], removed: IUserDataProfile[], updated: IUserDataProfile[]) {\n\t\tthis._onDidChangeProfiles.fire({ added, removed, updated, all: this.profiles });\n\t}\n\n\tprivate updateEmptyWindowAssociation(windowId: string, newProfile: IUserDataProfile | undefined, transient: boolean): void {\n\t\t// Force transient if the new profile to associate is transient\n\t\ttransient = newProfile?.isTransient ? true : transient;\n\n\t\tif (transient) {\n\t\t\tif (newProfile) {\n\t\t\t\tthis.transientProfilesObject.emptyWindows.set(windowId, newProfile);\n\t\t\t} else {\n\t\t\t\tthis.transientProfilesObject.emptyWindows.delete(windowId);\n\t\t\t}\n\t\t}\n\n\t\telse {\n\t\t\t// Unset the transiet association if any\n\t\t\tthis.transientProfilesObject.emptyWindows.delete(windowId);\n\t\t\tif (newProfile) {\n\t\t\t\tthis.profilesObject.emptyWindows.set(windowId, newProfile);\n\t\t\t} else {\n\t\t\t\tthis.profilesObject.emptyWindows.delete(windowId);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateStoredProfiles(profiles: IUserDataProfile[]): void {\n\t\tconst storedProfiles: StoredUserDataProfile[] = [];\n\t\tconst workspaces: IStringDictionary<string> = {};\n\t\tconst emptyWindows: IStringDictionary<string> = {};\n\n\t\tfor (const profile of profiles) {\n\t\t\tif (profile.isTransient) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!profile.isDefault) {\n\t\t\t\tstoredProfiles.push({ location: profile.location, name: profile.name, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });\n\t\t\t}\n\t\t\tif (profile.workspaces) {\n\t\t\t\tfor (const workspace of profile.workspaces) {\n\t\t\t\t\tworkspaces[workspace.toString()] = profile.id;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const [windowId, profile] of this.profilesObject.emptyWindows.entries()) {\n\t\t\temptyWindows[windowId.toString()] = profile.id;\n\t\t}\n\n\t\tthis.saveStoredProfileAssociations({ workspaces, emptyWindows });\n\t\tthis.saveStoredProfiles(storedProfiles);\n\t\tthis._profilesObject = undefined;\n\t}\n\n\tprotected getStoredProfiles(): StoredUserDataProfile[] { return []; }\n\tprotected saveStoredProfiles(storedProfiles: StoredUserDataProfile[]): void { throw new Error('not implemented'); }\n\n\tprotected getStoredProfileAssociations(): StoredProfileAssociations { return {}; }\n\tprotected saveStoredProfileAssociations(storedProfileAssociations: StoredProfileAssociations): void { throw new Error('not implemented'); }\n\tprotected getDefaultProfileExtensionsLocation(): URI | undefined { return undefined; }\n}\n\nexport class InMemoryUserDataProfilesService extends UserDataProfilesService {\n\tprivate storedProfiles: StoredUserDataProfile[] = [];\n\tprotected override getStoredProfiles(): StoredUserDataProfile[] { return this.storedProfiles; }\n\tprotected override saveStoredProfiles(storedProfiles: StoredUserDataProfile[]): void { this.storedProfiles = storedProfiles; }\n\n\tprivate storedProfileAssociations: StoredProfileAssociations = {};\n\tprotected override getStoredProfileAssociations(): StoredProfileAssociations { return this.storedProfileAssociations; }\n\tprotected override saveStoredProfileAssociations(storedProfileAssociations: StoredProfileAssociations): void { this.storedProfileAssociations = storedProfileAssociations; }\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Promises, RunOnceScheduler, runWhenGlobalIdle } from '../../../base/common/async.js';\nimport { Emitter, Event, PauseableEmitter } from '../../../base/common/event.js';\nimport { Disposable, DisposableStore, dispose, MutableDisposable } from '../../../base/common/lifecycle.js';\nimport { mark } from '../../../base/common/performance.js';\nimport { isUndefinedOrNull } from '../../../base/common/types.js';\nimport { InMemoryStorageDatabase, IStorage, IStorageChangeEvent, Storage, StorageHint, StorageValue } from '../../../base/parts/storage/common/storage.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { isUserDataProfile, IUserDataProfile } from '../../userDataProfile/common/userDataProfile.js';\nimport { IAnyWorkspaceIdentifier } from '../../workspace/common/workspace.js';\n\nexport const IS_NEW_KEY = '__$__isNewStorageMarker';\nexport const TARGET_KEY = '__$__targetStorageMarker';\n\nexport const IStorageService = createDecorator<IStorageService>('storageService');\n\nexport enum WillSaveStateReason {\n\n\t/**\n\t * No specific reason to save state.\n\t */\n\tNONE,\n\n\t/**\n\t * A hint that the workbench is about to shutdown.\n\t */\n\tSHUTDOWN\n}\n\nexport interface IWillSaveStateEvent {\n\treadonly reason: WillSaveStateReason;\n}\n\nexport interface IStorageEntry {\n\treadonly key: string;\n\treadonly value: StorageValue;\n\treadonly scope: StorageScope;\n\treadonly target: StorageTarget;\n}\n\nexport interface IWorkspaceStorageValueChangeEvent extends IStorageValueChangeEvent {\n\treadonly scope: StorageScope.WORKSPACE;\n}\n\nexport interface IProfileStorageValueChangeEvent extends IStorageValueChangeEvent {\n\treadonly scope: StorageScope.PROFILE;\n}\n\nexport interface IApplicationStorageValueChangeEvent extends IStorageValueChangeEvent {\n\treadonly scope: StorageScope.APPLICATION;\n}\n\nexport interface IStorageService {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Emitted whenever data is updated or deleted on the given\n\t * scope and optional key.\n\t *\n\t * @param scope the `StorageScope` to listen to changes\n\t * @param key the optional key to filter for or all keys of\n\t * the scope if `undefined`\n\t */\n\tonDidChangeValue(scope: StorageScope.WORKSPACE, key: string | undefined, disposable: DisposableStore): Event<IWorkspaceStorageValueChangeEvent>;\n\tonDidChangeValue(scope: StorageScope.PROFILE, key: string | undefined, disposable: DisposableStore): Event<IProfileStorageValueChangeEvent>;\n\tonDidChangeValue(scope: StorageScope.APPLICATION, key: string | undefined, disposable: DisposableStore): Event<IApplicationStorageValueChangeEvent>;\n\tonDidChangeValue(scope: StorageScope, key: string | undefined, disposable: DisposableStore): Event<IStorageValueChangeEvent>;\n\n\t/**\n\t * Emitted whenever target of a storage entry changes.\n\t */\n\treadonly onDidChangeTarget: Event<IStorageTargetChangeEvent>;\n\n\t/**\n\t * Emitted when the storage is about to persist. This is the right time\n\t * to persist data to ensure it is stored before the application shuts\n\t * down.\n\t *\n\t * The will save state event allows to optionally ask for the reason of\n\t * saving the state, e.g. to find out if the state is saved due to a\n\t * shutdown.\n\t *\n\t * Note: this event may be fired many times, not only on shutdown to prevent\n\t * loss of state in situations where the shutdown is not sufficient to\n\t * persist the data properly.\n\t */\n\treadonly onWillSaveState: Event<IWillSaveStateEvent>;\n\n\t/**\n\t * Retrieve an element stored with the given key from storage. Use\n\t * the provided `defaultValue` if the element is `null` or `undefined`.\n\t *\n\t * @param scope allows to define the scope of the storage operation\n\t * to either the current workspace only, all workspaces or all profiles.\n\t */\n\tget(key: string, scope: StorageScope, fallbackValue: string): string;\n\tget(key: string, scope: StorageScope, fallbackValue?: string): string | undefined;\n\n\t/**\n\t * Retrieve an element stored with the given key from storage. Use\n\t * the provided `defaultValue` if the element is `null` or `undefined`.\n\t * The element will be converted to a `boolean`.\n\t *\n\t * @param scope allows to define the scope of the storage operation\n\t * to either the current workspace only, all workspaces or all profiles.\n\t */\n\tgetBoolean(key: string, scope: StorageScope, fallbackValue: boolean): boolean;\n\tgetBoolean(key: string, scope: StorageScope, fallbackValue?: boolean): boolean | undefined;\n\n\t/**\n\t * Retrieve an element stored with the given key from storage. Use\n\t * the provided `defaultValue` if the element is `null` or `undefined`.\n\t * The element will be converted to a `number` using `parseInt` with a\n\t * base of `10`.\n\t *\n\t * @param scope allows to define the scope of the storage operation\n\t * to either the current workspace only, all workspaces or all profiles.\n\t */\n\tgetNumber(key: string, scope: StorageScope, fallbackValue: number): number;\n\tgetNumber(key: string, scope: StorageScope, fallbackValue?: number): number | undefined;\n\n\t/**\n\t * Retrieve an element stored with the given key from storage. Use\n\t * the provided `defaultValue` if the element is `null` or `undefined`.\n\t * The element will be converted to a `object` using `JSON.parse`.\n\t *\n\t * @param scope allows to define the scope of the storage operation\n\t * to either the current workspace only, all workspaces or all profiles.\n\t */\n\tgetObject<T extends object>(key: string, scope: StorageScope, fallbackValue: T): T;\n\tgetObject<T extends object>(key: string, scope: StorageScope, fallbackValue?: T): T | undefined;\n\n\t/**\n\t * Store a value under the given key to storage. The value will be\n\t * converted to a `string`. Storing either `undefined` or `null` will\n\t * remove the entry under the key.\n\t *\n\t * @param scope allows to define the scope of the storage operation\n\t * to either the current workspace only, all workspaces or all profiles.\n\t *\n\t * @param target allows to define the target of the storage operation\n\t * to either the current machine or user.\n\t */\n\tstore(key: string, value: StorageValue, scope: StorageScope, target: StorageTarget): void;\n\n\t/**\n\t * Allows to store multiple values in a bulk operation. Events will only\n\t * be emitted when all values have been stored.\n\t *\n\t * @param external a hint to indicate the source of the operation is external,\n\t * such as settings sync or profile changes.\n\t */\n\tstoreAll(entries: Array<IStorageEntry>, external: boolean): void;\n\n\t/**\n\t * Delete an element stored under the provided key from storage.\n\t *\n\t * The scope argument allows to define the scope of the storage\n\t * operation to either the current workspace only, all workspaces\n\t * or all profiles.\n\t */\n\tremove(key: string, scope: StorageScope): void;\n\n\t/**\n\t * Returns all the keys used in the storage for the provided `scope`\n\t * and `target`.\n\t *\n\t * Note: this will NOT return all keys stored in the storage layer.\n\t * Some keys may not have an associated `StorageTarget` and thus\n\t * will be excluded from the results.\n\t *\n\t * @param scope allows to define the scope for the keys\n\t * to either the current workspace only, all workspaces or all profiles.\n\t *\n\t * @param target allows to define the target for the keys\n\t * to either the current machine or user.\n\t */\n\tkeys(scope: StorageScope, target: StorageTarget): string[];\n\n\t/**\n\t * Log the contents of the storage to the console.\n\t */\n\tlog(): void;\n\n\t/**\n\t * Returns true if the storage service handles the provided scope.\n\t */\n\thasScope(scope: IAnyWorkspaceIdentifier | IUserDataProfile): boolean;\n\n\t/**\n\t * Switch storage to another workspace or profile. Optionally preserve the\n\t * current data to the new storage.\n\t */\n\tswitch(to: IAnyWorkspaceIdentifier | IUserDataProfile, preserveData: boolean): Promise<void>;\n\n\t/**\n\t * Whether the storage for the given scope was created during this session or\n\t * existed before.\n\t */\n\tisNew(scope: StorageScope): boolean;\n\n\t/**\n\t * Attempts to reduce the DB size via optimization commands if supported.\n\t */\n\toptimize(scope: StorageScope): Promise<void>;\n\n\t/**\n\t * Allows to flush state, e.g. in cases where a shutdown is\n\t * imminent. This will send out the `onWillSaveState` to ask\n\t * everyone for latest state.\n\t *\n\t * @returns a `Promise` that can be awaited on when all updates\n\t * to the underlying storage have been flushed.\n\t */\n\tflush(reason?: WillSaveStateReason): Promise<void>;\n}\n\nexport const enum StorageScope {\n\n\t/**\n\t * The stored data will be scoped to all workspaces across all profiles.\n\t */\n\tAPPLICATION = -1,\n\n\t/**\n\t * The stored data will be scoped to all workspaces of the same profile.\n\t */\n\tPROFILE = 0,\n\n\t/**\n\t * The stored data will be scoped to the current workspace.\n\t */\n\tWORKSPACE = 1\n}\n\nexport const enum StorageTarget {\n\n\t/**\n\t * The stored data is user specific and applies across machines.\n\t */\n\tUSER,\n\n\t/**\n\t * The stored data is machine specific.\n\t */\n\tMACHINE\n}\n\nexport interface IStorageValueChangeEvent {\n\n\t/**\n\t * The scope for the storage entry that changed\n\t * or was removed.\n\t */\n\treadonly scope: StorageScope;\n\n\t/**\n\t * The `key` of the storage entry that was changed\n\t * or was removed.\n\t */\n\treadonly key: string;\n\n\t/**\n\t * The `target` can be `undefined` if a key is being\n\t * removed.\n\t */\n\treadonly target: StorageTarget | undefined;\n\n\t/**\n\t * A hint how the storage change event was triggered. If\n\t * `true`, the storage change was triggered by an external\n\t * source, such as:\n\t * - another process (for example another window)\n\t * - operations such as settings sync or profiles change\n\t */\n\treadonly external?: boolean;\n}\n\nexport interface IStorageTargetChangeEvent {\n\n\t/**\n\t * The scope for the target that changed. Listeners\n\t * should use `keys(scope, target)` to get an updated\n\t * list of keys for the given `scope` and `target`.\n\t */\n\treadonly scope: StorageScope;\n}\n\ninterface IKeyTargets {\n\t[key: string]: StorageTarget;\n}\n\nexport interface IStorageServiceOptions {\n\treadonly flushInterval: number;\n}\n\nexport function loadKeyTargets(storage: IStorage): IKeyTargets {\n\tconst keysRaw = storage.get(TARGET_KEY);\n\tif (keysRaw) {\n\t\ttry {\n\t\t\treturn JSON.parse(keysRaw);\n\t\t} catch (error) {\n\t\t\t// Fail gracefully\n\t\t}\n\t}\n\n\treturn Object.create(null);\n}\n\nexport abstract class AbstractStorageService extends Disposable implements IStorageService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate static DEFAULT_FLUSH_INTERVAL = 60 * 1000; // every minute\n\n\tprivate readonly _onDidChangeValue = this._register(new PauseableEmitter<IStorageValueChangeEvent>());\n\n\tprivate readonly _onDidChangeTarget = this._register(new PauseableEmitter<IStorageTargetChangeEvent>());\n\treadonly onDidChangeTarget = this._onDidChangeTarget.event;\n\n\tprivate readonly _onWillSaveState = this._register(new Emitter<IWillSaveStateEvent>());\n\treadonly onWillSaveState = this._onWillSaveState.event;\n\n\tprivate initializationPromise: Promise<void> | undefined;\n\n\tprivate readonly flushWhenIdleScheduler: RunOnceScheduler;\n\tprivate readonly runFlushWhenIdle = this._register(new MutableDisposable());\n\n\tconstructor(options: IStorageServiceOptions = { flushInterval: AbstractStorageService.DEFAULT_FLUSH_INTERVAL }) {\n\t\tsuper();\n\n\t\tthis.flushWhenIdleScheduler = this._register(new RunOnceScheduler(() => this.doFlushWhenIdle(), options.flushInterval));\n\t}\n\n\tonDidChangeValue(scope: StorageScope.WORKSPACE, key: string | undefined, disposable: DisposableStore): Event<IWorkspaceStorageValueChangeEvent>;\n\tonDidChangeValue(scope: StorageScope.PROFILE, key: string | undefined, disposable: DisposableStore): Event<IProfileStorageValueChangeEvent>;\n\tonDidChangeValue(scope: StorageScope.APPLICATION, key: string | undefined, disposable: DisposableStore): Event<IApplicationStorageValueChangeEvent>;\n\tonDidChangeValue(scope: StorageScope, key: string | undefined, disposable: DisposableStore): Event<IStorageValueChangeEvent> {\n\t\treturn Event.filter(this._onDidChangeValue.event, e => e.scope === scope && (key === undefined || e.key === key), disposable);\n\t}\n\n\tprivate doFlushWhenIdle(): void {\n\t\tthis.runFlushWhenIdle.value = runWhenGlobalIdle(() => {\n\t\t\tif (this.shouldFlushWhenIdle()) {\n\t\t\t\tthis.flush();\n\t\t\t}\n\n\t\t\t// repeat\n\t\t\tthis.flushWhenIdleScheduler.schedule();\n\t\t});\n\t}\n\n\tprotected shouldFlushWhenIdle(): boolean {\n\t\treturn true;\n\t}\n\n\tprotected stopFlushWhenIdle(): void {\n\t\tdispose([this.runFlushWhenIdle, this.flushWhenIdleScheduler]);\n\t}\n\n\tinitialize(): Promise<void> {\n\t\tif (!this.initializationPromise) {\n\t\t\tthis.initializationPromise = (async () => {\n\n\t\t\t\t// Init all storage locations\n\t\t\t\tmark('code/willInitStorage');\n\t\t\t\ttry {\n\t\t\t\t\tawait this.doInitialize(); // Ask subclasses to initialize storage\n\t\t\t\t} finally {\n\t\t\t\t\tmark('code/didInitStorage');\n\t\t\t\t}\n\n\t\t\t\t// On some OS we do not get enough time to persist state on shutdown (e.g. when\n\t\t\t\t// Windows restarts after applying updates). In other cases, VSCode might crash,\n\t\t\t\t// so we periodically save state to reduce the chance of loosing any state.\n\t\t\t\t// In the browser we do not have support for long running unload sequences. As such,\n\t\t\t\t// we cannot ask for saving state in that moment, because that would result in a\n\t\t\t\t// long running operation.\n\t\t\t\t// Instead, periodically ask customers to save save. The library will be clever enough\n\t\t\t\t// to only save state that has actually changed.\n\t\t\t\tthis.flushWhenIdleScheduler.schedule();\n\t\t\t})();\n\t\t}\n\n\t\treturn this.initializationPromise;\n\t}\n\n\tprotected emitDidChangeValue(scope: StorageScope, event: IStorageChangeEvent): void {\n\t\tconst { key, external } = event;\n\n\t\t// Specially handle `TARGET_KEY`\n\t\tif (key === TARGET_KEY) {\n\n\t\t\t// Clear our cached version which is now out of date\n\t\t\tswitch (scope) {\n\t\t\t\tcase StorageScope.APPLICATION:\n\t\t\t\t\tthis._applicationKeyTargets = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\tcase StorageScope.PROFILE:\n\t\t\t\t\tthis._profileKeyTargets = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\tcase StorageScope.WORKSPACE:\n\t\t\t\t\tthis._workspaceKeyTargets = undefined;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Emit as `didChangeTarget` event\n\t\t\tthis._onDidChangeTarget.fire({ scope });\n\t\t}\n\n\t\t// Emit any other key to outside\n\t\telse {\n\t\t\tthis._onDidChangeValue.fire({ scope, key, target: this.getKeyTargets(scope)[key], external });\n\t\t}\n\t}\n\n\tprotected emitWillSaveState(reason: WillSaveStateReason): void {\n\t\tthis._onWillSaveState.fire({ reason });\n\t}\n\n\tget(key: string, scope: StorageScope, fallbackValue: string): string;\n\tget(key: string, scope: StorageScope): string | undefined;\n\tget(key: string, scope: StorageScope, fallbackValue?: string): string | undefined {\n\t\treturn this.getStorage(scope)?.get(key, fallbackValue);\n\t}\n\n\tgetBoolean(key: string, scope: StorageScope, fallbackValue: boolean): boolean;\n\tgetBoolean(key: string, scope: StorageScope): boolean | undefined;\n\tgetBoolean(key: string, scope: StorageScope, fallbackValue?: boolean): boolean | undefined {\n\t\treturn this.getStorage(scope)?.getBoolean(key, fallbackValue);\n\t}\n\n\tgetNumber(key: string, scope: StorageScope, fallbackValue: number): number;\n\tgetNumber(key: string, scope: StorageScope): number | undefined;\n\tgetNumber(key: string, scope: StorageScope, fallbackValue?: number): number | undefined {\n\t\treturn this.getStorage(scope)?.getNumber(key, fallbackValue);\n\t}\n\n\tgetObject(key: string, scope: StorageScope, fallbackValue: object): object;\n\tgetObject(key: string, scope: StorageScope): object | undefined;\n\tgetObject(key: string, scope: StorageScope, fallbackValue?: object): object | undefined {\n\t\treturn this.getStorage(scope)?.getObject(key, fallbackValue);\n\t}\n\n\tstoreAll(entries: Array<IStorageEntry>, external: boolean): void {\n\t\tthis.withPausedEmitters(() => {\n\t\t\tfor (const entry of entries) {\n\t\t\t\tthis.store(entry.key, entry.value, entry.scope, entry.target, external);\n\t\t\t}\n\t\t});\n\t}\n\n\tstore(key: string, value: StorageValue, scope: StorageScope, target: StorageTarget, external = false): void {\n\n\t\t// We remove the key for undefined/null values\n\t\tif (isUndefinedOrNull(value)) {\n\t\t\tthis.remove(key, scope, external);\n\t\t\treturn;\n\t\t}\n\n\t\t// Update our datastructures but send events only after\n\t\tthis.withPausedEmitters(() => {\n\n\t\t\t// Update key-target map\n\t\t\tthis.updateKeyTarget(key, scope, target);\n\n\t\t\t// Store actual value\n\t\t\tthis.getStorage(scope)?.set(key, value, external);\n\t\t});\n\t}\n\n\tremove(key: string, scope: StorageScope, external = false): void {\n\n\t\t// Update our datastructures but send events only after\n\t\tthis.withPausedEmitters(() => {\n\n\t\t\t// Update key-target map\n\t\t\tthis.updateKeyTarget(key, scope, undefined);\n\n\t\t\t// Remove actual key\n\t\t\tthis.getStorage(scope)?.delete(key, external);\n\t\t});\n\t}\n\n\tprivate withPausedEmitters(fn: Function): void {\n\n\t\t// Pause emitters\n\t\tthis._onDidChangeValue.pause();\n\t\tthis._onDidChangeTarget.pause();\n\n\t\ttry {\n\t\t\tfn();\n\t\t} finally {\n\n\t\t\t// Resume emitters\n\t\t\tthis._onDidChangeValue.resume();\n\t\t\tthis._onDidChangeTarget.resume();\n\t\t}\n\t}\n\n\tkeys(scope: StorageScope, target: StorageTarget): string[] {\n\t\tconst keys: string[] = [];\n\n\t\tconst keyTargets = this.getKeyTargets(scope);\n\t\tfor (const key of Object.keys(keyTargets)) {\n\t\t\tconst keyTarget = keyTargets[key];\n\t\t\tif (keyTarget === target) {\n\t\t\t\tkeys.push(key);\n\t\t\t}\n\t\t}\n\n\t\treturn keys;\n\t}\n\n\tprivate updateKeyTarget(key: string, scope: StorageScope, target: StorageTarget | undefined, external = false): void {\n\n\t\t// Add\n\t\tconst keyTargets = this.getKeyTargets(scope);\n\t\tif (typeof target === 'number') {\n\t\t\tif (keyTargets[key] !== target) {\n\t\t\t\tkeyTargets[key] = target;\n\t\t\t\tthis.getStorage(scope)?.set(TARGET_KEY, JSON.stringify(keyTargets), external);\n\t\t\t}\n\t\t}\n\n\t\t// Remove\n\t\telse {\n\t\t\tif (typeof keyTargets[key] === 'number') {\n\t\t\t\tdelete keyTargets[key];\n\t\t\t\tthis.getStorage(scope)?.set(TARGET_KEY, JSON.stringify(keyTargets), external);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _workspaceKeyTargets: IKeyTargets | undefined = undefined;\n\tprivate get workspaceKeyTargets(): IKeyTargets {\n\t\tif (!this._workspaceKeyTargets) {\n\t\t\tthis._workspaceKeyTargets = this.loadKeyTargets(StorageScope.WORKSPACE);\n\t\t}\n\n\t\treturn this._workspaceKeyTargets;\n\t}\n\n\tprivate _profileKeyTargets: IKeyTargets | undefined = undefined;\n\tprivate get profileKeyTargets(): IKeyTargets {\n\t\tif (!this._profileKeyTargets) {\n\t\t\tthis._profileKeyTargets = this.loadKeyTargets(StorageScope.PROFILE);\n\t\t}\n\n\t\treturn this._profileKeyTargets;\n\t}\n\n\tprivate _applicationKeyTargets: IKeyTargets | undefined = undefined;\n\tprivate get applicationKeyTargets(): IKeyTargets {\n\t\tif (!this._applicationKeyTargets) {\n\t\t\tthis._applicationKeyTargets = this.loadKeyTargets(StorageScope.APPLICATION);\n\t\t}\n\n\t\treturn this._applicationKeyTargets;\n\t}\n\n\tprivate getKeyTargets(scope: StorageScope): IKeyTargets {\n\t\tswitch (scope) {\n\t\t\tcase StorageScope.APPLICATION:\n\t\t\t\treturn this.applicationKeyTargets;\n\t\t\tcase StorageScope.PROFILE:\n\t\t\t\treturn this.profileKeyTargets;\n\t\t\tdefault:\n\t\t\t\treturn this.workspaceKeyTargets;\n\t\t}\n\t}\n\n\tprivate loadKeyTargets(scope: StorageScope): { [key: string]: StorageTarget } {\n\t\tconst storage = this.getStorage(scope);\n\n\t\treturn storage ? loadKeyTargets(storage) : Object.create(null);\n\t}\n\n\tisNew(scope: StorageScope): boolean {\n\t\treturn this.getBoolean(IS_NEW_KEY, scope) === true;\n\t}\n\n\tasync flush(reason = WillSaveStateReason.NONE): Promise<void> {\n\n\t\t// Signal event to collect changes\n\t\tthis._onWillSaveState.fire({ reason });\n\n\t\tconst applicationStorage = this.getStorage(StorageScope.APPLICATION);\n\t\tconst profileStorage = this.getStorage(StorageScope.PROFILE);\n\t\tconst workspaceStorage = this.getStorage(StorageScope.WORKSPACE);\n\n\t\tswitch (reason) {\n\n\t\t\t// Unspecific reason: just wait when data is flushed\n\t\t\tcase WillSaveStateReason.NONE:\n\t\t\t\tawait Promises.settled([\n\t\t\t\t\tapplicationStorage?.whenFlushed() ?? Promise.resolve(),\n\t\t\t\t\tprofileStorage?.whenFlushed() ?? Promise.resolve(),\n\t\t\t\t\tworkspaceStorage?.whenFlushed() ?? Promise.resolve()\n\t\t\t\t]);\n\t\t\t\tbreak;\n\n\t\t\t// Shutdown: we want to flush as soon as possible\n\t\t\t// and not hit any delays that might be there\n\t\t\tcase WillSaveStateReason.SHUTDOWN:\n\t\t\t\tawait Promises.settled([\n\t\t\t\t\tapplicationStorage?.flush(0) ?? Promise.resolve(),\n\t\t\t\t\tprofileStorage?.flush(0) ?? Promise.resolve(),\n\t\t\t\t\tworkspaceStorage?.flush(0) ?? Promise.resolve()\n\t\t\t\t]);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tasync log(): Promise<void> {\n\t\tconst applicationItems = this.getStorage(StorageScope.APPLICATION)?.items ?? new Map<string, string>();\n\t\tconst profileItems = this.getStorage(StorageScope.PROFILE)?.items ?? new Map<string, string>();\n\t\tconst workspaceItems = this.getStorage(StorageScope.WORKSPACE)?.items ?? new Map<string, string>();\n\n\t\treturn logStorage(\n\t\t\tapplicationItems,\n\t\t\tprofileItems,\n\t\t\tworkspaceItems,\n\t\t\tthis.getLogDetails(StorageScope.APPLICATION) ?? '',\n\t\t\tthis.getLogDetails(StorageScope.PROFILE) ?? '',\n\t\t\tthis.getLogDetails(StorageScope.WORKSPACE) ?? ''\n\t\t);\n\t}\n\n\tasync optimize(scope: StorageScope): Promise<void> {\n\n\t\t// Await pending data to be flushed to the DB\n\t\t// before attempting to optimize the DB\n\t\tawait this.flush();\n\n\t\treturn this.getStorage(scope)?.optimize();\n\t}\n\n\tasync switch(to: IAnyWorkspaceIdentifier | IUserDataProfile, preserveData: boolean): Promise<void> {\n\n\t\t// Signal as event so that clients can store data before we switch\n\t\tthis.emitWillSaveState(WillSaveStateReason.NONE);\n\n\t\tif (isUserDataProfile(to)) {\n\t\t\treturn this.switchToProfile(to, preserveData);\n\t\t}\n\n\t\treturn this.switchToWorkspace(to, preserveData);\n\t}\n\n\tprotected canSwitchProfile(from: IUserDataProfile, to: IUserDataProfile): boolean {\n\t\tif (from.id === to.id) {\n\t\t\treturn false; // both profiles are same\n\t\t}\n\n\t\tif (isProfileUsingDefaultStorage(to) && isProfileUsingDefaultStorage(from)) {\n\t\t\treturn false; // both profiles are using default\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprotected switchData(oldStorage: Map<string, string>, newStorage: IStorage, scope: StorageScope): void {\n\t\tthis.withPausedEmitters(() => {\n\t\t\t// Signal storage keys that have changed\n\t\t\tconst handledkeys = new Set<string>();\n\t\t\tfor (const [key, oldValue] of oldStorage) {\n\t\t\t\thandledkeys.add(key);\n\n\t\t\t\tconst newValue = newStorage.get(key);\n\t\t\t\tif (newValue !== oldValue) {\n\t\t\t\t\tthis.emitDidChangeValue(scope, { key, external: true });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [key] of newStorage.items) {\n\t\t\t\tif (!handledkeys.has(key)) {\n\t\t\t\t\tthis.emitDidChangeValue(scope, { key, external: true });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t// --- abstract\n\n\tabstract hasScope(scope: IAnyWorkspaceIdentifier | IUserDataProfile): boolean;\n\n\tprotected abstract doInitialize(): Promise<void>;\n\n\tprotected abstract getStorage(scope: StorageScope): IStorage | undefined;\n\n\tprotected abstract getLogDetails(scope: StorageScope): string | undefined;\n\n\tprotected abstract switchToProfile(toProfile: IUserDataProfile, preserveData: boolean): Promise<void>;\n\tprotected abstract switchToWorkspace(toWorkspace: IAnyWorkspaceIdentifier | IUserDataProfile, preserveData: boolean): Promise<void>;\n}\n\nexport function isProfileUsingDefaultStorage(profile: IUserDataProfile): boolean {\n\treturn profile.isDefault || !!profile.useDefaultFlags?.globalState;\n}\n\nexport class InMemoryStorageService extends AbstractStorageService {\n\n\tprivate readonly applicationStorage = this._register(new Storage(new InMemoryStorageDatabase(), { hint: StorageHint.STORAGE_IN_MEMORY }));\n\tprivate readonly profileStorage = this._register(new Storage(new InMemoryStorageDatabase(), { hint: StorageHint.STORAGE_IN_MEMORY }));\n\tprivate readonly workspaceStorage = this._register(new Storage(new InMemoryStorageDatabase(), { hint: StorageHint.STORAGE_IN_MEMORY }));\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._register(this.workspaceStorage.onDidChangeStorage(e => this.emitDidChangeValue(StorageScope.WORKSPACE, e)));\n\t\tthis._register(this.profileStorage.onDidChangeStorage(e => this.emitDidChangeValue(StorageScope.PROFILE, e)));\n\t\tthis._register(this.applicationStorage.onDidChangeStorage(e => this.emitDidChangeValue(StorageScope.APPLICATION, e)));\n\t}\n\n\tprotected getStorage(scope: StorageScope): IStorage {\n\t\tswitch (scope) {\n\t\t\tcase StorageScope.APPLICATION:\n\t\t\t\treturn this.applicationStorage;\n\t\t\tcase StorageScope.PROFILE:\n\t\t\t\treturn this.profileStorage;\n\t\t\tdefault:\n\t\t\t\treturn this.workspaceStorage;\n\t\t}\n\t}\n\n\tprotected getLogDetails(scope: StorageScope): string | undefined {\n\t\tswitch (scope) {\n\t\t\tcase StorageScope.APPLICATION:\n\t\t\t\treturn 'inMemory (application)';\n\t\t\tcase StorageScope.PROFILE:\n\t\t\t\treturn 'inMemory (profile)';\n\t\t\tdefault:\n\t\t\t\treturn 'inMemory (workspace)';\n\t\t}\n\t}\n\n\tprotected async doInitialize(): Promise<void> { }\n\n\tprotected async switchToProfile(): Promise<void> {\n\t\t// no-op when in-memory\n\t}\n\n\tprotected async switchToWorkspace(): Promise<void> {\n\t\t// no-op when in-memory\n\t}\n\n\tprotected override shouldFlushWhenIdle(): boolean {\n\t\treturn false;\n\t}\n\n\thasScope(scope: IAnyWorkspaceIdentifier | IUserDataProfile): boolean {\n\t\treturn false;\n\t}\n}\n\nexport async function logStorage(application: Map<string, string>, profile: Map<string, string>, workspace: Map<string, string>, applicationPath: string, profilePath: string, workspacePath: string): Promise<void> {\n\tconst safeParse = (value: string) => {\n\t\ttry {\n\t\t\treturn JSON.parse(value);\n\t\t} catch (error) {\n\t\t\treturn value;\n\t\t}\n\t};\n\n\tconst applicationItems = new Map<string, string>();\n\tconst applicationItemsParsed = new Map<string, string>();\n\tapplication.forEach((value, key) => {\n\t\tapplicationItems.set(key, value);\n\t\tapplicationItemsParsed.set(key, safeParse(value));\n\t});\n\n\tconst profileItems = new Map<string, string>();\n\tconst profileItemsParsed = new Map<string, string>();\n\tprofile.forEach((value, key) => {\n\t\tprofileItems.set(key, value);\n\t\tprofileItemsParsed.set(key, safeParse(value));\n\t});\n\n\tconst workspaceItems = new Map<string, string>();\n\tconst workspaceItemsParsed = new Map<string, string>();\n\tworkspace.forEach((value, key) => {\n\t\tworkspaceItems.set(key, value);\n\t\tworkspaceItemsParsed.set(key, safeParse(value));\n\t});\n\n\tif (applicationPath !== profilePath) {\n\t\tconsole.group(`Storage: Application (path: ${applicationPath})`);\n\t} else {\n\t\tconsole.group(`Storage: Application & Profile (path: ${applicationPath}, default profile)`);\n\t}\n\tconst applicationValues: { key: string; value: string }[] = [];\n\tapplicationItems.forEach((value, key) => {\n\t\tapplicationValues.push({ key, value });\n\t});\n\tconsole.table(applicationValues);\n\tconsole.groupEnd();\n\n\tconsole.log(applicationItemsParsed);\n\n\tif (applicationPath !== profilePath) {\n\t\tconsole.group(`Storage: Profile (path: ${profilePath}, profile specific)`);\n\t\tconst profileValues: { key: string; value: string }[] = [];\n\t\tprofileItems.forEach((value, key) => {\n\t\t\tprofileValues.push({ key, value });\n\t\t});\n\t\tconsole.table(profileValues);\n\t\tconsole.groupEnd();\n\n\t\tconsole.log(profileItemsParsed);\n\t}\n\n\tconsole.group(`Storage: Workspace (path: ${workspacePath})`);\n\tconst workspaceValues: { key: string; value: string }[] = [];\n\tworkspaceItems.forEach((value, key) => {\n\t\tworkspaceValues.push({ key, value });\n\t});\n\tconsole.table(workspaceValues);\n\tconsole.groupEnd();\n\n\tconsole.log(workspaceItemsParsed);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const enum ExtensionGalleryResourceType {\n\tExtensionQueryService = 'ExtensionQueryService',\n\tExtensionLatestVersionUri = 'ExtensionLatestVersionUriTemplate',\n\tExtensionStatisticsUri = 'ExtensionStatisticsUriTemplate',\n\tWebExtensionStatisticsUri = 'WebExtensionStatisticsUriTemplate',\n\tPublisherViewUri = 'PublisherViewUriTemplate',\n\tExtensionDetailsViewUri = 'ExtensionDetailsViewUriTemplate',\n\tExtensionRatingViewUri = 'ExtensionRatingViewUriTemplate',\n\tExtensionResourceUri = 'ExtensionResourceUriTemplate',\n\tContactSupportUri = 'ContactSupportUri',\n}\n\nexport const enum Flag {\n\tNone = 'None',\n\tIncludeVersions = 'IncludeVersions',\n\tIncludeFiles = 'IncludeFiles',\n\tIncludeCategoryAndTags = 'IncludeCategoryAndTags',\n\tIncludeSharedAccounts = 'IncludeSharedAccounts',\n\tIncludeVersionProperties = 'IncludeVersionProperties',\n\tExcludeNonValidated = 'ExcludeNonValidated',\n\tIncludeInstallationTargets = 'IncludeInstallationTargets',\n\tIncludeAssetUri = 'IncludeAssetUri',\n\tIncludeStatistics = 'IncludeStatistics',\n\tIncludeLatestVersionOnly = 'IncludeLatestVersionOnly',\n\tUnpublished = 'Unpublished',\n\tIncludeNameConflictInfo = 'IncludeNameConflictInfo',\n\tIncludeLatestPrereleaseAndStableVersionOnly = 'IncludeLatestPrereleaseAndStableVersionOnly',\n}\n\nexport type ExtensionGalleryManifestResource = {\n\treadonly id: string;\n\treadonly type: string;\n};\n\nexport type ExtensionQueryCapabilityValue = {\n\treadonly name: string;\n\treadonly value: number;\n};\n\nexport interface IExtensionGalleryManifest {\n\treadonly version: string;\n\treadonly resources: readonly ExtensionGalleryManifestResource[];\n\treadonly capabilities: {\n\t\treadonly extensionQuery: {\n\t\t\treadonly filtering?: readonly ExtensionQueryCapabilityValue[];\n\t\t\treadonly sorting?: readonly ExtensionQueryCapabilityValue[];\n\t\t\treadonly flags?: readonly ExtensionQueryCapabilityValue[];\n\t\t};\n\t\treadonly signing?: {\n\t\t\treadonly allPublicRepositorySigned: boolean;\n\t\t\treadonly allPrivateRepositorySigned?: boolean;\n\t\t};\n\t\treadonly extensions?: {\n\t\t\treadonly includePublicExtensions?: boolean;\n\t\t\treadonly includePrivateExtensions?: boolean;\n\t\t};\n\t};\n}\n\nexport const IExtensionGalleryManifestService = createDecorator<IExtensionGalleryManifestService>('IExtensionGalleryManifestService');\n\nexport interface IExtensionGalleryManifestService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly onDidChangeExtensionGalleryManifest: Event<IExtensionGalleryManifest | null>;\n\tisEnabled(): boolean;\n\tgetExtensionGalleryManifest(): Promise<IExtensionGalleryManifest | null>;\n}\n\nexport function getExtensionGalleryManifestResourceUri(manifest: IExtensionGalleryManifest, type: string): string | undefined {\n\tconst [name, version] = type.split('/');\n\tfor (const resource of manifest.resources) {\n\t\tconst [r, v] = resource.type.split('/');\n\t\tif (r !== name) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!version || v === version) {\n\t\t\treturn resource.id;\n\t\t}\n\t\tbreak;\n\t}\n\treturn undefined;\n}\n\nexport const ExtensionGalleryServiceUrlConfigKey = 'extensions.gallery.serviceUrl';\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { distinct } from '../../../base/common/arrays.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport * as semver from '../../../base/common/semver/semver.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { CancellationError, getErrorMessage, isCancellationError } from '../../../base/common/errors.js';\nimport { IPager } from '../../../base/common/paging.js';\nimport { isWeb, platform } from '../../../base/common/platform.js';\nimport { arch } from '../../../base/common/process.js';\nimport { isBoolean, isString } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IHeaders, IRequestContext, IRequestOptions, isOfflineError } from '../../../base/parts/request/common/request.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { getTargetPlatform, IExtensionGalleryService, IExtensionIdentifier, IExtensionInfo, IGalleryExtension, IGalleryExtensionAsset, IGalleryExtensionAssets, IGalleryExtensionVersion, InstallOperation, IQueryOptions, IExtensionsControlManifest, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ITranslation, SortOrder, StatisticType, toTargetPlatform, WEB_EXTENSION_TAG, IExtensionQueryOptions, IDeprecationInfo, ISearchPrefferedResults, ExtensionGalleryError, ExtensionGalleryErrorCode, IProductVersion, IAllowedExtensionsService, EXTENSION_IDENTIFIER_REGEX, SortBy, FilterType, MaliciousExtensionInfo } from './extensionManagement.js';\nimport { adoptToGalleryExtensionId, areSameExtensions, getGalleryExtensionId, getGalleryExtensionTelemetryData } from './extensionManagementUtil.js';\nimport { IExtensionManifest, TargetPlatform } from '../../extensions/common/extensions.js';\nimport { areApiProposalsCompatible, isEngineValid } from '../../extensions/common/extensionValidator.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { asJson, asTextOrError, IRequestService, isSuccess } from '../../request/common/request.js';\nimport { resolveMarketplaceHeaders } from '../../externalServices/common/marketplace.js';\nimport { IStorageService } from '../../storage/common/storage.js';\nimport { ITelemetryService } from '../../telemetry/common/telemetry.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { format2 } from '../../../base/common/strings.js';\nimport { IAssignmentService } from '../../assignment/common/assignment.js';\nimport { ExtensionGalleryResourceType, Flag, getExtensionGalleryManifestResourceUri, IExtensionGalleryManifest, IExtensionGalleryManifestService } from './extensionGalleryManifest.js';\nimport { TelemetryTrustedValue } from '../../telemetry/common/telemetryUtils.js';\n\nconst CURRENT_TARGET_PLATFORM = isWeb ? TargetPlatform.WEB : getTargetPlatform(platform, arch);\nconst SEARCH_ACTIVITY_HEADER_NAME = 'X-Market-Search-Activity-Id';\nconst ACTIVITY_HEADER_NAME = 'Activityid';\nconst SERVER_HEADER_NAME = 'Server';\nconst END_END_ID_HEADER_NAME = 'X-Vss-E2eid';\nconst REQUEST_TIME_OUT = 10_000;\n\ninterface IRawGalleryExtensionFile {\n\treadonly assetType: string;\n\treadonly source: string;\n}\n\ninterface IRawGalleryExtensionProperty {\n\treadonly key: string;\n\treadonly value: string;\n}\n\nexport interface IRawGalleryExtensionVersion {\n\treadonly version: string;\n\treadonly lastUpdated: string;\n\treadonly assetUri: string;\n\treadonly fallbackAssetUri: string;\n\treadonly files: IRawGalleryExtensionFile[];\n\treadonly properties?: IRawGalleryExtensionProperty[];\n\treadonly targetPlatform?: string;\n}\n\ninterface IRawGalleryExtensionStatistics {\n\treadonly statisticName: string;\n\treadonly value: number;\n}\n\ninterface IRawGalleryExtensionPublisher {\n\treadonly displayName: string;\n\treadonly publisherId: string;\n\treadonly publisherName: string;\n\treadonly domain?: string | null;\n\treadonly isDomainVerified?: boolean;\n\treadonly linkType?: string;\n}\n\ninterface IRawGalleryExtension {\n\treadonly extensionId: string;\n\treadonly extensionName: string;\n\treadonly displayName: string;\n\treadonly shortDescription?: string;\n\treadonly publisher: IRawGalleryExtensionPublisher;\n\treadonly versions: IRawGalleryExtensionVersion[];\n\treadonly statistics: IRawGalleryExtensionStatistics[];\n\treadonly tags: string[] | undefined;\n\treadonly releaseDate: string;\n\treadonly publishedDate: string;\n\treadonly lastUpdated: string;\n\treadonly categories: string[] | undefined;\n\treadonly flags: string;\n\treadonly linkType?: string;\n\treadonly ratingLinkType?: string;\n}\n\ninterface IRawGalleryExtensionsResult {\n\treadonly galleryExtensions: IRawGalleryExtension[];\n\treadonly total: number;\n\treadonly context?: IStringDictionary<string>;\n}\n\ninterface IRawGalleryQueryResult {\n\treadonly results: {\n\t\treadonly extensions: IRawGalleryExtension[];\n\t\treadonly resultMetadata: {\n\t\t\treadonly metadataType: string;\n\t\t\treadonly metadataItems: {\n\t\t\t\treadonly name: string;\n\t\t\t\treadonly count: number;\n\t\t\t}[];\n\t\t}[];\n\t}[];\n}\n\nconst AssetType = {\n\tIcon: 'Microsoft.VisualStudio.Services.Icons.Default',\n\tDetails: 'Microsoft.VisualStudio.Services.Content.Details',\n\tChangelog: 'Microsoft.VisualStudio.Services.Content.Changelog',\n\tManifest: 'Microsoft.VisualStudio.Code.Manifest',\n\tVSIX: 'Microsoft.VisualStudio.Services.VSIXPackage',\n\tLicense: 'Microsoft.VisualStudio.Services.Content.License',\n\tRepository: 'Microsoft.VisualStudio.Services.Links.Source',\n\tSignature: 'Microsoft.VisualStudio.Services.VsixSignature'\n};\n\nconst PropertyType = {\n\tDependency: 'Microsoft.VisualStudio.Code.ExtensionDependencies',\n\tExtensionPack: 'Microsoft.VisualStudio.Code.ExtensionPack',\n\tEngine: 'Microsoft.VisualStudio.Code.Engine',\n\tPreRelease: 'Microsoft.VisualStudio.Code.PreRelease',\n\tEnabledApiProposals: 'Microsoft.VisualStudio.Code.EnabledApiProposals',\n\tLocalizedLanguages: 'Microsoft.VisualStudio.Code.LocalizedLanguages',\n\tWebExtension: 'Microsoft.VisualStudio.Code.WebExtension',\n\tSponsorLink: 'Microsoft.VisualStudio.Code.SponsorLink',\n\tSupportLink: 'Microsoft.VisualStudio.Services.Links.Support',\n\tExecutesCode: 'Microsoft.VisualStudio.Code.ExecutesCode',\n\tPrivate: 'PrivateMarketplace',\n};\n\ninterface ICriterium {\n\treadonly filterType: FilterType;\n\treadonly value?: string;\n}\n\nconst DefaultPageSize = 10;\n\ninterface IQueryState {\n\treadonly pageNumber: number;\n\treadonly pageSize: number;\n\treadonly sortBy: SortBy;\n\treadonly sortOrder: SortOrder;\n\treadonly flags: Flag[];\n\treadonly criteria: ICriterium[];\n\treadonly assetTypes: string[];\n\treadonly source?: string;\n}\n\nconst DefaultQueryState: IQueryState = {\n\tpageNumber: 1,\n\tpageSize: DefaultPageSize,\n\tsortBy: SortBy.NoneOrRelevance,\n\tsortOrder: SortOrder.Default,\n\tflags: [],\n\tcriteria: [],\n\tassetTypes: []\n};\n\ntype GalleryServiceQueryClassification = {\n\towner: 'sandy081';\n\tcomment: 'Information about Marketplace query and its response';\n\treadonly filterTypes: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Filter types used in the query.' };\n\treadonly flags: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Flags passed in the query.' };\n\treadonly sortBy: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'sorted by option passed in the query' };\n\treadonly sortOrder: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'sort order option passed in the query' };\n\treadonly pageNumber: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'requested page number in the query' };\n\treadonly duration: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; 'isMeasurement': true; comment: 'amount of time taken by the query request' };\n\treadonly success: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'whether the query request is success or not' };\n\treadonly requestBodySize: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'size of the request body' };\n\treadonly responseBodySize?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'size of the response body' };\n\treadonly statusCode?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'status code of the response' };\n\treadonly errorCode?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'error code of the response' };\n\treadonly count?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'total number of extensions matching the query' };\n\treadonly source?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'source that requested this query, eg., recommendations, viewlet' };\n\treadonly searchTextLength?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'length of the search text in the query' };\n\treadonly server?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'server that handled the query' };\n\treadonly endToEndId?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'end to end operation id' };\n\treadonly activityId?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'activity id' };\n};\n\ntype QueryTelemetryData = {\n\treadonly filterTypes: string[];\n\treadonly flags: string[];\n\treadonly sortBy: string;\n\treadonly sortOrder: string;\n\treadonly pageNumber: string;\n\treadonly source?: string;\n\treadonly searchTextLength?: number;\n};\n\ntype GalleryServiceQueryEvent = QueryTelemetryData & {\n\treadonly duration: number;\n\treadonly success: boolean;\n\treadonly requestBodySize: string;\n\treadonly responseBodySize?: string;\n\treadonly statusCode?: string;\n\treadonly errorCode?: string;\n\treadonly count?: string;\n\treadonly server?: TelemetryTrustedValue<string>;\n\treadonly endToEndId?: TelemetryTrustedValue<string>;\n\treadonly activityId?: TelemetryTrustedValue<string>;\n};\n\ntype GalleryServiceAdditionalQueryClassification = {\n\towner: 'sandy081';\n\tcomment: 'Response information about the additional query to the Marketplace for fetching all versions to get release version';\n\treadonly duration: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; 'isMeasurement': true; comment: 'Amount of time taken by the additional query' };\n\treadonly count: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Total number of extensions returned by this additional query' };\n};\n\ntype GalleryServiceAdditionalQueryEvent = {\n\treadonly duration: number;\n\treadonly count: number;\n};\n\ntype ExtensionsCriteria = {\n\treadonly productVersion: IProductVersion;\n\treadonly targetPlatform: TargetPlatform;\n\treadonly compatible: boolean;\n\treadonly includePreRelease: boolean | (IExtensionIdentifier & { includePreRelease: boolean })[];\n\treadonly versions?: (IExtensionIdentifier & { version: string })[];\n\treadonly isQueryForReleaseVersionFromPreReleaseVersion?: boolean;\n};\n\nconst enum VersionKind {\n\tRelease,\n\tPrerelease,\n\tLatest\n}\n\ntype ExtensionVersionCriteria = {\n\treadonly productVersion: IProductVersion;\n\treadonly targetPlatform: TargetPlatform;\n\treadonly compatible: boolean;\n\treadonly version: VersionKind | string;\n};\n\nclass Query {\n\n\tconstructor(private state = DefaultQueryState) { }\n\n\tget pageNumber(): number { return this.state.pageNumber; }\n\tget pageSize(): number { return this.state.pageSize; }\n\tget sortBy(): SortBy { return this.state.sortBy; }\n\tget sortOrder(): number { return this.state.sortOrder; }\n\tget flags(): Flag[] { return this.state.flags; }\n\tget criteria(): ICriterium[] { return this.state.criteria; }\n\tget assetTypes(): string[] { return this.state.assetTypes; }\n\tget source(): string | undefined { return this.state.source; }\n\tget searchText(): string {\n\t\tconst criterium = this.state.criteria.filter(criterium => criterium.filterType === FilterType.SearchText)[0];\n\t\treturn criterium && criterium.value ? criterium.value : '';\n\t}\n\n\n\twithPage(pageNumber: number, pageSize: number = this.state.pageSize): Query {\n\t\treturn new Query({ ...this.state, pageNumber, pageSize });\n\t}\n\n\twithFilter(filterType: FilterType, ...values: string[]): Query {\n\t\tconst criteria = [\n\t\t\t...this.state.criteria,\n\t\t\t...values.length ? values.map(value => ({ filterType, value })) : [{ filterType }]\n\t\t];\n\n\t\treturn new Query({ ...this.state, criteria });\n\t}\n\n\twithSortBy(sortBy: SortBy): Query {\n\t\treturn new Query({ ...this.state, sortBy });\n\t}\n\n\twithSortOrder(sortOrder: SortOrder): Query {\n\t\treturn new Query({ ...this.state, sortOrder });\n\t}\n\n\twithFlags(...flags: Flag[]): Query {\n\t\treturn new Query({ ...this.state, flags: distinct(flags) });\n\t}\n\n\twithAssetTypes(...assetTypes: string[]): Query {\n\t\treturn new Query({ ...this.state, assetTypes });\n\t}\n\n\twithSource(source: string): Query {\n\t\treturn new Query({ ...this.state, source });\n\t}\n}\n\nfunction getStatistic(statistics: IRawGalleryExtensionStatistics[], name: string): number {\n\tconst result = (statistics || []).filter(s => s.statisticName === name)[0];\n\treturn result ? result.value : 0;\n}\n\nfunction getCoreTranslationAssets(version: IRawGalleryExtensionVersion): [string, IGalleryExtensionAsset][] {\n\tconst coreTranslationAssetPrefix = 'Microsoft.VisualStudio.Code.Translation.';\n\tconst result = version.files.filter(f => f.assetType.indexOf(coreTranslationAssetPrefix) === 0);\n\treturn result.reduce<[string, IGalleryExtensionAsset][]>((result, file) => {\n\t\tconst asset = getVersionAsset(version, file.assetType);\n\t\tif (asset) {\n\t\t\tresult.push([file.assetType.substring(coreTranslationAssetPrefix.length), asset]);\n\t\t}\n\t\treturn result;\n\t}, []);\n}\n\nfunction getRepositoryAsset(version: IRawGalleryExtensionVersion): IGalleryExtensionAsset | null {\n\tif (version.properties) {\n\t\tconst results = version.properties.filter(p => p.key === AssetType.Repository);\n\t\tconst gitRegExp = new RegExp('((git|ssh|http(s)?)|(git@[\\\\w.]+))(:(//)?)([\\\\w.@:/\\\\-~]+)(.git)(/)?');\n\n\t\tconst uri = results.filter(r => gitRegExp.test(r.value))[0];\n\t\treturn uri ? { uri: uri.value, fallbackUri: uri.value } : null;\n\t}\n\treturn getVersionAsset(version, AssetType.Repository);\n}\n\nfunction getDownloadAsset(version: IRawGalleryExtensionVersion): IGalleryExtensionAsset {\n\treturn {\n\t\t// always use fallbackAssetUri for download asset to hit the Marketplace API so that downloads are counted\n\t\turi: `${version.fallbackAssetUri}/${AssetType.VSIX}?redirect=true${version.targetPlatform ? `&targetPlatform=${version.targetPlatform}` : ''}`,\n\t\tfallbackUri: `${version.fallbackAssetUri}/${AssetType.VSIX}${version.targetPlatform ? `?targetPlatform=${version.targetPlatform}` : ''}`\n\t};\n}\n\nfunction getVersionAsset(version: IRawGalleryExtensionVersion, type: string): IGalleryExtensionAsset | null {\n\tconst result = version.files.filter(f => f.assetType === type)[0];\n\treturn result ? {\n\t\turi: `${version.assetUri}/${type}${version.targetPlatform ? `?targetPlatform=${version.targetPlatform}` : ''}`,\n\t\tfallbackUri: `${version.fallbackAssetUri}/${type}${version.targetPlatform ? `?targetPlatform=${version.targetPlatform}` : ''}`\n\t} : null;\n}\n\nfunction getExtensions(version: IRawGalleryExtensionVersion, property: string): string[] {\n\tconst values = version.properties ? version.properties.filter(p => p.key === property) : [];\n\tconst value = values.length > 0 && values[0].value;\n\treturn value ? value.split(',').map(v => adoptToGalleryExtensionId(v)) : [];\n}\n\nfunction getEngine(version: IRawGalleryExtensionVersion): string {\n\tconst values = version.properties ? version.properties.filter(p => p.key === PropertyType.Engine) : [];\n\treturn (values.length > 0 && values[0].value) || '';\n}\n\nfunction isPreReleaseVersion(version: IRawGalleryExtensionVersion): boolean {\n\tconst values = version.properties ? version.properties.filter(p => p.key === PropertyType.PreRelease) : [];\n\treturn values.length > 0 && values[0].value === 'true';\n}\n\nfunction hasPreReleaseForExtension(id: string, productService: IProductService): boolean | undefined {\n\treturn productService.extensionProperties?.[id.toLowerCase()]?.hasPrereleaseVersion;\n}\n\nfunction getExcludeVersionRangeForExtension(id: string, productService: IProductService): string | undefined {\n\treturn productService.extensionProperties?.[id.toLowerCase()]?.excludeVersionRange;\n}\n\nfunction isPrivateExtension(version: IRawGalleryExtensionVersion): boolean {\n\tconst values = version.properties ? version.properties.filter(p => p.key === PropertyType.Private) : [];\n\treturn values.length > 0 && values[0].value === 'true';\n}\n\nfunction executesCode(version: IRawGalleryExtensionVersion): boolean | undefined {\n\tconst values = version.properties ? version.properties.filter(p => p.key === PropertyType.ExecutesCode) : [];\n\treturn values.length > 0 ? values[0].value === 'true' : undefined;\n}\n\nfunction getEnabledApiProposals(version: IRawGalleryExtensionVersion): string[] {\n\tconst values = version.properties ? version.properties.filter(p => p.key === PropertyType.EnabledApiProposals) : [];\n\tconst value = (values.length > 0 && values[0].value) || '';\n\treturn value ? value.split(',') : [];\n}\n\nfunction getLocalizedLanguages(version: IRawGalleryExtensionVersion): string[] {\n\tconst values = version.properties ? version.properties.filter(p => p.key === PropertyType.LocalizedLanguages) : [];\n\tconst value = (values.length > 0 && values[0].value) || '';\n\treturn value ? value.split(',') : [];\n}\n\nfunction getSponsorLink(version: IRawGalleryExtensionVersion): string | undefined {\n\treturn version.properties?.find(p => p.key === PropertyType.SponsorLink)?.value;\n}\n\nfunction getSupportLink(version: IRawGalleryExtensionVersion): string | undefined {\n\treturn version.properties?.find(p => p.key === PropertyType.SupportLink)?.value;\n}\n\nfunction getIsPreview(flags: string): boolean {\n\treturn flags.indexOf('preview') !== -1;\n}\n\nfunction getTargetPlatformForExtensionVersion(version: IRawGalleryExtensionVersion): TargetPlatform {\n\treturn version.targetPlatform ? toTargetPlatform(version.targetPlatform) : TargetPlatform.UNDEFINED;\n}\n\nfunction getAllTargetPlatforms(rawGalleryExtension: IRawGalleryExtension): TargetPlatform[] {\n\tconst allTargetPlatforms = distinct(rawGalleryExtension.versions.map(getTargetPlatformForExtensionVersion));\n\n\t// Is a web extension only if it has WEB_EXTENSION_TAG\n\tconst isWebExtension = !!rawGalleryExtension.tags?.includes(WEB_EXTENSION_TAG);\n\n\t// Include Web Target Platform only if it is a web extension\n\tconst webTargetPlatformIndex = allTargetPlatforms.indexOf(TargetPlatform.WEB);\n\tif (isWebExtension) {\n\t\tif (webTargetPlatformIndex === -1) {\n\t\t\t// Web extension but does not has web target platform -> add it\n\t\t\tallTargetPlatforms.push(TargetPlatform.WEB);\n\t\t}\n\t} else {\n\t\tif (webTargetPlatformIndex !== -1) {\n\t\t\t// Not a web extension but has web target platform -> remove it\n\t\t\tallTargetPlatforms.splice(webTargetPlatformIndex, 1);\n\t\t}\n\t}\n\n\treturn allTargetPlatforms;\n}\n\nexport function sortExtensionVersions(versions: IRawGalleryExtensionVersion[], preferredTargetPlatform: TargetPlatform): IRawGalleryExtensionVersion[] {\n\t/* It is expected that versions from Marketplace are sorted by version. So we are just sorting by preferred targetPlatform */\n\tfor (let index = 0; index < versions.length; index++) {\n\t\tconst version = versions[index];\n\t\tif (version.version === versions[index - 1]?.version) {\n\t\t\tlet insertionIndex = index;\n\t\t\tconst versionTargetPlatform = getTargetPlatformForExtensionVersion(version);\n\t\t\t/* put it at the beginning */\n\t\t\tif (versionTargetPlatform === preferredTargetPlatform) {\n\t\t\t\twhile (insertionIndex > 0 && versions[insertionIndex - 1].version === version.version) { insertionIndex--; }\n\t\t\t}\n\t\t\tif (insertionIndex !== index) {\n\t\t\t\tversions.splice(index, 1);\n\t\t\t\tversions.splice(insertionIndex, 0, version);\n\t\t\t}\n\t\t}\n\t}\n\treturn versions;\n}\n\nfunction setTelemetry(extension: IGalleryExtension, index: number, querySource?: string): void {\n\t/* __GDPR__FRAGMENT__\n\t\"GalleryExtensionTelemetryData2\" : {\n\t\t\"index\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\", \"isMeasurement\": true },\n\t\t\"querySource\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\"queryActivityId\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" }\n\t}\n\t*/\n\textension.telemetryData = { index, querySource, queryActivityId: extension.queryContext?.[SEARCH_ACTIVITY_HEADER_NAME] };\n}\n\nfunction toExtension(galleryExtension: IRawGalleryExtension, version: IRawGalleryExtensionVersion, allTargetPlatforms: TargetPlatform[], extensionGalleryManifest: IExtensionGalleryManifest, productService: IProductService, queryContext?: IStringDictionary<any>): IGalleryExtension {\n\tconst latestVersion = galleryExtension.versions[0];\n\tconst assets: IGalleryExtensionAssets = {\n\t\tmanifest: getVersionAsset(version, AssetType.Manifest),\n\t\treadme: getVersionAsset(version, AssetType.Details),\n\t\tchangelog: getVersionAsset(version, AssetType.Changelog),\n\t\tlicense: getVersionAsset(version, AssetType.License),\n\t\trepository: getRepositoryAsset(version),\n\t\tdownload: getDownloadAsset(version),\n\t\ticon: getVersionAsset(version, AssetType.Icon),\n\t\tsignature: getVersionAsset(version, AssetType.Signature),\n\t\tcoreTranslations: getCoreTranslationAssets(version)\n\t};\n\n\tconst detailsViewUri = getExtensionGalleryManifestResourceUri(extensionGalleryManifest, galleryExtension.linkType ?? ExtensionGalleryResourceType.ExtensionDetailsViewUri);\n\tconst publisherViewUri = getExtensionGalleryManifestResourceUri(extensionGalleryManifest, galleryExtension.publisher.linkType ?? ExtensionGalleryResourceType.PublisherViewUri);\n\tconst ratingViewUri = getExtensionGalleryManifestResourceUri(extensionGalleryManifest, galleryExtension.ratingLinkType ?? ExtensionGalleryResourceType.ExtensionRatingViewUri);\n\tconst id = getGalleryExtensionId(galleryExtension.publisher.publisherName, galleryExtension.extensionName);\n\n\treturn {\n\t\ttype: 'gallery',\n\t\tidentifier: {\n\t\t\tid,\n\t\t\tuuid: galleryExtension.extensionId\n\t\t},\n\t\tname: galleryExtension.extensionName,\n\t\tversion: version.version,\n\t\tdisplayName: galleryExtension.displayName,\n\t\tpublisherId: galleryExtension.publisher.publisherId,\n\t\tpublisher: galleryExtension.publisher.publisherName,\n\t\tpublisherDisplayName: galleryExtension.publisher.displayName,\n\t\tpublisherDomain: galleryExtension.publisher.domain ? { link: galleryExtension.publisher.domain, verified: !!galleryExtension.publisher.isDomainVerified } : undefined,\n\t\tpublisherSponsorLink: getSponsorLink(latestVersion),\n\t\tdescription: galleryExtension.shortDescription ?? '',\n\t\tinstallCount: getStatistic(galleryExtension.statistics, 'install'),\n\t\trating: getStatistic(galleryExtension.statistics, 'averagerating'),\n\t\tratingCount: getStatistic(galleryExtension.statistics, 'ratingcount'),\n\t\tcategories: galleryExtension.categories || [],\n\t\ttags: galleryExtension.tags || [],\n\t\treleaseDate: Date.parse(galleryExtension.releaseDate),\n\t\tlastUpdated: Date.parse(galleryExtension.lastUpdated),\n\t\tallTargetPlatforms,\n\t\tassets,\n\t\tproperties: {\n\t\t\tdependencies: getExtensions(version, PropertyType.Dependency),\n\t\t\textensionPack: getExtensions(version, PropertyType.ExtensionPack),\n\t\t\tengine: getEngine(version),\n\t\t\tenabledApiProposals: getEnabledApiProposals(version),\n\t\t\tlocalizedLanguages: getLocalizedLanguages(version),\n\t\t\ttargetPlatform: getTargetPlatformForExtensionVersion(version),\n\t\t\tisPreReleaseVersion: isPreReleaseVersion(version),\n\t\t\texecutesCode: executesCode(version)\n\t\t},\n\t\thasPreReleaseVersion: hasPreReleaseForExtension(id, productService) ?? isPreReleaseVersion(latestVersion),\n\t\thasReleaseVersion: true,\n\t\tprivate: isPrivateExtension(latestVersion),\n\t\tpreview: getIsPreview(galleryExtension.flags),\n\t\tisSigned: !!assets.signature,\n\t\tqueryContext,\n\t\tsupportLink: getSupportLink(latestVersion),\n\t\tdetailsLink: detailsViewUri ? format2(detailsViewUri, { publisher: galleryExtension.publisher.publisherName, name: galleryExtension.extensionName }) : undefined,\n\t\tpublisherLink: publisherViewUri ? format2(publisherViewUri, { publisher: galleryExtension.publisher.publisherName }) : undefined,\n\t\tratingLink: ratingViewUri ? format2(ratingViewUri, { publisher: galleryExtension.publisher.publisherName, name: galleryExtension.extensionName }) : undefined,\n\t};\n}\n\ninterface IRawExtensionsControlManifest {\n\tmalicious: string[];\n\tlearnMoreLinks?: IStringDictionary<string>;\n\tmigrateToPreRelease?: IStringDictionary<{\n\t\tid: string;\n\t\tdisplayName: string;\n\t\tmigrateStorage?: boolean;\n\t\tengine?: string;\n\t}>;\n\tdeprecated?: IStringDictionary<boolean | {\n\t\tdisallowInstall?: boolean;\n\t\textension?: {\n\t\t\tid: string;\n\t\t\tdisplayName: string;\n\t\t};\n\t\tsettings?: string[];\n\t\tadditionalInfo?: string;\n\t}>;\n\tsearch?: ISearchPrefferedResults[];\n\tautoUpdate?: IStringDictionary<string>;\n}\n\nexport abstract class AbstractExtensionGalleryService implements IExtensionGalleryService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly extensionsControlUrl: string | undefined;\n\tprivate readonly unpkgResourceApi: string | undefined;\n\n\tprivate readonly commonHeadersPromise: Promise<IHeaders>;\n\tprivate readonly extensionsEnabledWithApiProposalVersion: string[];\n\n\tconstructor(\n\t\tstorageService: IStorageService | undefined,\n\t\tprivate readonly assignmentService: IAssignmentService | undefined,\n\t\t@IRequestService private readonly requestService: IRequestService,\n\t\t@ILogService private readonly logService: ILogService,\n\t\t@IEnvironmentService private readonly environmentService: IEnvironmentService,\n\t\t@ITelemetryService private readonly telemetryService: ITelemetryService,\n\t\t@IFileService private readonly fileService: IFileService,\n\t\t@IProductService private readonly productService: IProductService,\n\t\t@IConfigurationService private readonly configurationService: IConfigurationService,\n\t\t@IAllowedExtensionsService private readonly allowedExtensionsService: IAllowedExtensionsService,\n\t\t@IExtensionGalleryManifestService private readonly extensionGalleryManifestService: IExtensionGalleryManifestService,\n\t) {\n\t\tthis.extensionsControlUrl = productService.extensionsGallery?.controlUrl;\n\t\tthis.unpkgResourceApi = productService.extensionsGallery?.extensionUrlTemplate;\n\t\tthis.extensionsEnabledWithApiProposalVersion = productService.extensionsEnabledWithApiProposalVersion?.map(id => id.toLowerCase()) ?? [];\n\t\tthis.commonHeadersPromise = resolveMarketplaceHeaders(\n\t\t\tproductService.version,\n\t\t\tproductService,\n\t\t\tthis.environmentService,\n\t\t\tthis.configurationService,\n\t\t\tthis.fileService,\n\t\t\tstorageService,\n\t\t\tthis.telemetryService);\n\t}\n\n\tisEnabled(): boolean {\n\t\treturn this.extensionGalleryManifestService.isEnabled();\n\t}\n\n\tgetExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, token: CancellationToken): Promise<IGalleryExtension[]>;\n\tgetExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, options: IExtensionQueryOptions, token: CancellationToken): Promise<IGalleryExtension[]>;\n\tasync getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, arg1: any, arg2?: any): Promise<IGalleryExtension[]> {\n\t\tconst extensionGalleryManifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();\n\t\tif (!extensionGalleryManifest) {\n\t\t\tthrow new Error('No extension gallery service configured.');\n\t\t}\n\n\t\tconst options = CancellationToken.isCancellationToken(arg1) ? {} : arg1 as IExtensionQueryOptions;\n\t\tconst token = CancellationToken.isCancellationToken(arg1) ? arg1 : arg2 as CancellationToken;\n\n\t\tconst resourceApi = await this.getResourceApi(extensionGalleryManifest, !!options.updateCheck);\n\t\tconst result = resourceApi\n\t\t\t? await this.getExtensionsUsingResourceApi(extensionInfos, options, resourceApi, extensionGalleryManifest, token)\n\t\t\t: await this.getExtensionsUsingQueryApi(extensionInfos, options, extensionGalleryManifest, token);\n\n\t\tconst uuids = result.map(r => r.identifier.uuid);\n\t\tconst extensionInfosByName: IExtensionInfo[] = [];\n\t\tfor (const e of extensionInfos) {\n\t\t\tif (e.uuid && !uuids.includes(e.uuid)) {\n\t\t\t\textensionInfosByName.push({ ...e, uuid: undefined });\n\t\t\t}\n\t\t}\n\n\t\tif (extensionInfosByName.length) {\n\t\t\t// report telemetry data for additional query\n\t\t\tthis.telemetryService.publicLog2<\n\t\t\t\t{ count: number },\n\t\t\t\t{\n\t\t\t\t\towner: 'sandy081';\n\t\t\t\t\tcomment: 'Report the query to the Marketplace for fetching extensions by name';\n\t\t\t\t\treadonly count: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of extensions to fetch' };\n\t\t\t\t}>('galleryService:additionalQueryByName', {\n\t\t\t\t\tcount: extensionInfosByName.length\n\t\t\t\t});\n\n\t\t\tconst extensions = await this.getExtensionsUsingQueryApi(extensionInfosByName, options, extensionGalleryManifest, token);\n\t\t\tresult.push(...extensions);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate async getResourceApi(extensionGalleryManifest: IExtensionGalleryManifest, updateCheck: boolean): Promise<{ uri: string; fallback?: string } | undefined> {\n\t\tconst latestVersionResource = getExtensionGalleryManifestResourceUri(extensionGalleryManifest, ExtensionGalleryResourceType.ExtensionLatestVersionUri);\n\t\tif (!latestVersionResource) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (this.productService.quality !== 'stable') {\n\t\t\treturn {\n\t\t\t\turi: latestVersionResource,\n\t\t\t\tfallback: this.unpkgResourceApi\n\t\t\t};\n\t\t}\n\n\t\tconst value = updateCheck\n\t\t\t? await this.assignmentService?.getTreatment<'unpkg' | 'marketplace' | 'none'>('extensions.gallery.useResourceApi') ?? 'marketplace'\n\t\t\t: await this.assignmentService?.getTreatment<'unpkg' | 'marketplace' | 'none'>('extensions.gallery.useLatestApi') ?? 'unpkg';\n\n\t\tif (value === 'marketplace') {\n\t\t\treturn {\n\t\t\t\turi: latestVersionResource,\n\t\t\t\tfallback: this.unpkgResourceApi\n\t\t\t};\n\t\t}\n\n\t\tif (value === 'unpkg' && this.unpkgResourceApi) {\n\t\t\treturn { uri: this.unpkgResourceApi };\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tprivate async getExtensionsUsingQueryApi(extensionInfos: ReadonlyArray<IExtensionInfo>, options: IExtensionQueryOptions, extensionGalleryManifest: IExtensionGalleryManifest, token: CancellationToken): Promise<IGalleryExtension[]> {\n\t\tconst names: string[] = [],\n\t\t\tids: string[] = [],\n\t\t\tincludePreRelease: (IExtensionIdentifier & { includePreRelease: boolean })[] = [],\n\t\t\tversions: (IExtensionIdentifier & { version: string })[] = [];\n\t\tlet isQueryForReleaseVersionFromPreReleaseVersion = true;\n\n\t\tfor (const extensionInfo of extensionInfos) {\n\t\t\tif (extensionInfo.uuid) {\n\t\t\t\tids.push(extensionInfo.uuid);\n\t\t\t} else {\n\t\t\t\tnames.push(extensionInfo.id);\n\t\t\t}\n\t\t\tif (extensionInfo.version) {\n\t\t\t\tversions.push({ id: extensionInfo.id, uuid: extensionInfo.uuid, version: extensionInfo.version });\n\t\t\t} else {\n\t\t\t\tincludePreRelease.push({ id: extensionInfo.id, uuid: extensionInfo.uuid, includePreRelease: !!extensionInfo.preRelease });\n\t\t\t}\n\t\t\tisQueryForReleaseVersionFromPreReleaseVersion = isQueryForReleaseVersionFromPreReleaseVersion && (!!extensionInfo.hasPreRelease && !extensionInfo.preRelease);\n\t\t}\n\n\t\tif (!ids.length && !names.length) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet query = new Query().withPage(1, extensionInfos.length);\n\t\tif (ids.length) {\n\t\t\tquery = query.withFilter(FilterType.ExtensionId, ...ids);\n\t\t}\n\t\tif (names.length) {\n\t\t\tquery = query.withFilter(FilterType.ExtensionName, ...names);\n\t\t}\n\t\tif (options.queryAllVersions) {\n\t\t\tquery = query.withFlags(...query.flags, Flag.IncludeVersions);\n\t\t}\n\t\tif (options.source) {\n\t\t\tquery = query.withSource(options.source);\n\t\t}\n\n\t\tconst { extensions } = await this.queryGalleryExtensions(\n\t\t\tquery,\n\t\t\t{\n\t\t\t\ttargetPlatform: options.targetPlatform ?? CURRENT_TARGET_PLATFORM,\n\t\t\t\tincludePreRelease,\n\t\t\t\tversions,\n\t\t\t\tcompatible: !!options.compatible,\n\t\t\t\tproductVersion: options.productVersion ?? { version: this.productService.version, date: this.productService.date },\n\t\t\t\tisQueryForReleaseVersionFromPreReleaseVersion\n\t\t\t},\n\t\t\textensionGalleryManifest,\n\t\t\ttoken);\n\n\t\tif (options.source) {\n\t\t\textensions.forEach((e, index) => setTelemetry(e, index, options.source));\n\t\t}\n\n\t\treturn extensions;\n\t}\n\n\tprivate async getExtensionsUsingResourceApi(extensionInfos: ReadonlyArray<IExtensionInfo>, options: IExtensionQueryOptions, resourceApi: { uri: string; fallback?: string }, extensionGalleryManifest: IExtensionGalleryManifest, token: CancellationToken): Promise<IGalleryExtension[]> {\n\n\t\tconst result: IGalleryExtension[] = [];\n\t\tconst toQuery: IExtensionInfo[] = [];\n\t\tconst toFetchLatest: IExtensionInfo[] = [];\n\n\t\tfor (const extensionInfo of extensionInfos) {\n\t\t\tif (!EXTENSION_IDENTIFIER_REGEX.test(extensionInfo.id)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (extensionInfo.version) {\n\t\t\t\ttoQuery.push(extensionInfo);\n\t\t\t} else {\n\t\t\t\ttoFetchLatest.push(extensionInfo);\n\t\t\t}\n\t\t}\n\n\t\tawait Promise.allSettled(toFetchLatest.map(async extensionInfo => {\n\t\t\tlet galleryExtension: IGalleryExtension | null | 'NOT_FOUND';\n\t\t\ttry {\n\t\t\t\ttry {\n\t\t\t\t\tgalleryExtension = await this.getLatestGalleryExtension(extensionInfo, options, resourceApi.uri, extensionGalleryManifest, token);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!resourceApi.fallback) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\n\t\t\t\t\t// fallback to unpkg\n\t\t\t\t\tthis.logService.error(`Error while getting the latest version for the extension ${extensionInfo.id} from ${resourceApi.uri}. Trying the fallback ${resourceApi.fallback}`, getErrorMessage(error));\n\t\t\t\t\tthis.telemetryService.publicLog2<\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\textension: string;\n\t\t\t\t\t\t\tpreRelease: boolean;\n\t\t\t\t\t\t\tcompatible: boolean;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\towner: 'sandy081';\n\t\t\t\t\t\t\tcomment: 'Report the fallback to the unpkg service for getting latest extension';\n\t\t\t\t\t\t\textension: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Extension id' };\n\t\t\t\t\t\t\tpreRelease: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Get pre-release version' };\n\t\t\t\t\t\t\tcompatible: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Get compatible version' };\n\t\t\t\t\t\t}>('galleryService:fallbacktounpkg', {\n\t\t\t\t\t\t\textension: extensionInfo.id,\n\t\t\t\t\t\t\tpreRelease: !!extensionInfo.preRelease,\n\t\t\t\t\t\t\tcompatible: !!options.compatible\n\t\t\t\t\t\t});\n\t\t\t\t\tgalleryExtension = await this.getLatestGalleryExtension(extensionInfo, options, resourceApi.fallback, extensionGalleryManifest, token);\n\t\t\t\t}\n\n\t\t\t\tif (galleryExtension === 'NOT_FOUND') {\n\t\t\t\t\tif (extensionInfo.uuid) {\n\t\t\t\t\t\t// Fallback to query if extension with UUID is not found. Probably extension is renamed.\n\t\t\t\t\t\ttoQuery.push(extensionInfo);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (galleryExtension) {\n\t\t\t\t\tresult.push(galleryExtension);\n\t\t\t\t}\n\n\t\t\t} catch (error) {\n\t\t\t\t// fallback to query\n\t\t\t\tthis.logService.error(`Error while getting the latest version for the extension ${extensionInfo.id}.`, getErrorMessage(error));\n\t\t\t\tthis.telemetryService.publicLog2<\n\t\t\t\t\t{\n\t\t\t\t\t\textension: string;\n\t\t\t\t\t\tpreRelease: boolean;\n\t\t\t\t\t\tcompatible: boolean;\n\t\t\t\t\t\tfromFallback: boolean;\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\towner: 'sandy081';\n\t\t\t\t\t\tcomment: 'Report the fallback to the Marketplace query for fetching extensions';\n\t\t\t\t\t\textension: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Extension id' };\n\t\t\t\t\t\tpreRelease: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Get pre-release version' };\n\t\t\t\t\t\tcompatible: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Get compatible version' };\n\t\t\t\t\t\tfromFallback: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'From fallback' };\n\t\t\t\t\t}>('galleryService:fallbacktoquery', {\n\t\t\t\t\t\textension: extensionInfo.id,\n\t\t\t\t\t\tpreRelease: !!extensionInfo.preRelease,\n\t\t\t\t\t\tcompatible: !!options.compatible,\n\t\t\t\t\t\tfromFallback: !!resourceApi.fallback\n\t\t\t\t\t});\n\t\t\t\ttoQuery.push(extensionInfo);\n\t\t\t}\n\n\t\t}));\n\n\t\tif (toQuery.length) {\n\t\t\tconst extensions = await this.getExtensionsUsingQueryApi(toQuery, options, extensionGalleryManifest, token);\n\t\t\tresult.push(...extensions);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate async getLatestGalleryExtension(extensionInfo: IExtensionInfo, options: IExtensionQueryOptions, resourceUriTemplate: string, extensionGalleryManifest: IExtensionGalleryManifest, token: CancellationToken): Promise<IGalleryExtension | null | 'NOT_FOUND'> {\n\t\tconst [publisher, name] = extensionInfo.id.split('.');\n\t\tconst uri = URI.parse(format2(resourceUriTemplate, { publisher, name }));\n\t\tconst rawGalleryExtension = await this.getLatestRawGalleryExtension(extensionInfo.id, uri, token);\n\n\t\tif (!rawGalleryExtension) {\n\t\t\treturn 'NOT_FOUND';\n\t\t}\n\n\t\tconst allTargetPlatforms = getAllTargetPlatforms(rawGalleryExtension);\n\t\tconst rawGalleryExtensionVersion = await this.getRawGalleryExtensionVersion(\n\t\t\trawGalleryExtension,\n\t\t\t{\n\t\t\t\ttargetPlatform: options.targetPlatform ?? CURRENT_TARGET_PLATFORM,\n\t\t\t\tcompatible: !!options.compatible,\n\t\t\t\tproductVersion: options.productVersion ?? {\n\t\t\t\t\tversion: this.productService.version,\n\t\t\t\t\tdate: this.productService.date\n\t\t\t\t},\n\t\t\t\tversion: extensionInfo.preRelease ? VersionKind.Latest : VersionKind.Release\n\t\t\t}, allTargetPlatforms);\n\n\t\tif (rawGalleryExtensionVersion) {\n\t\t\treturn toExtension(rawGalleryExtension, rawGalleryExtensionVersion, allTargetPlatforms, extensionGalleryManifest, this.productService);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tasync getCompatibleExtension(extension: IGalleryExtension, includePreRelease: boolean, targetPlatform: TargetPlatform, productVersion: IProductVersion = { version: this.productService.version, date: this.productService.date }): Promise<IGalleryExtension | null> {\n\t\tif (isNotWebExtensionInWebTargetPlatform(extension.allTargetPlatforms, targetPlatform)) {\n\t\t\treturn null;\n\t\t}\n\t\tif (await this.isExtensionCompatible(extension, includePreRelease, targetPlatform)) {\n\t\t\treturn extension;\n\t\t}\n\t\tif (this.allowedExtensionsService.isAllowed({ id: extension.identifier.id, publisherDisplayName: extension.publisherDisplayName }) !== true) {\n\t\t\treturn null;\n\t\t}\n\t\tconst result = await this.getExtensions([{\n\t\t\t...extension.identifier,\n\t\t\tpreRelease: includePreRelease,\n\t\t\thasPreRelease: extension.hasPreReleaseVersion,\n\t\t}], {\n\t\t\tcompatible: true,\n\t\t\tproductVersion,\n\t\t\tqueryAllVersions: true,\n\t\t\ttargetPlatform,\n\t\t}, CancellationToken.None);\n\n\t\treturn result[0] ?? null;\n\t}\n\n\tasync isExtensionCompatible(extension: IGalleryExtension, includePreRelease: boolean, targetPlatform: TargetPlatform, productVersion: IProductVersion = { version: this.productService.version, date: this.productService.date }): Promise<boolean> {\n\t\treturn this.isValidVersion(\n\t\t\t{\n\t\t\t\tid: extension.identifier.id,\n\t\t\t\tversion: extension.version,\n\t\t\t\tisPreReleaseVersion: extension.properties.isPreReleaseVersion,\n\t\t\t\ttargetPlatform: extension.properties.targetPlatform,\n\t\t\t\tmanifestAsset: extension.assets.manifest,\n\t\t\t\tengine: extension.properties.engine,\n\t\t\t\tenabledApiProposals: extension.properties.enabledApiProposals\n\t\t\t},\n\t\t\t{\n\t\t\t\ttargetPlatform,\n\t\t\t\tcompatible: true,\n\t\t\t\tproductVersion,\n\t\t\t\tversion: includePreRelease ? VersionKind.Latest : VersionKind.Release\n\t\t\t},\n\t\t\textension.publisherDisplayName,\n\t\t\textension.allTargetPlatforms\n\t\t);\n\t}\n\n\tprivate async isValidVersion(\n\t\textension: { id: string; version: string; isPreReleaseVersion: boolean; targetPlatform: TargetPlatform; manifestAsset: IGalleryExtensionAsset | null; engine: string | undefined; enabledApiProposals: string[] | undefined },\n\t\t{ targetPlatform, compatible, productVersion, version }: ExtensionVersionCriteria,\n\t\tpublisherDisplayName: string,\n\t\tallTargetPlatforms: TargetPlatform[]\n\t): Promise<boolean> {\n\n\t\tconst hasPreRelease = hasPreReleaseForExtension(extension.id, this.productService);\n\t\tconst excludeVersionRange = getExcludeVersionRangeForExtension(extension.id, this.productService);\n\n\t\tif (extension.isPreReleaseVersion && hasPreRelease === false /* Skip if hasPreRelease is not defined for this extension */) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (excludeVersionRange && semver.satisfies(extension.version, excludeVersionRange)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Specific version\n\t\tif (isString(version)) {\n\t\t\tif (extension.version !== version) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// Prerelease or release version kind\n\t\telse if (version === VersionKind.Release || version === VersionKind.Prerelease) {\n\t\t\tif (extension.isPreReleaseVersion !== (version === VersionKind.Prerelease)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif (!isTargetPlatformCompatible(extension.targetPlatform, allTargetPlatforms, targetPlatform)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (compatible) {\n\t\t\tif (this.allowedExtensionsService.isAllowed({ id: extension.id, publisherDisplayName, version: extension.version, prerelease: extension.isPreReleaseVersion, targetPlatform: extension.targetPlatform }) !== true) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (!this.areApiProposalsCompatible(extension.id, extension.enabledApiProposals)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (!(await this.isEngineValid(extension.id, extension.version, extension.engine, extension.manifestAsset, productVersion))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate areApiProposalsCompatible(extensionId: string, enabledApiProposals: string[] | undefined): boolean {\n\t\tif (!enabledApiProposals) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!this.extensionsEnabledWithApiProposalVersion.includes(extensionId.toLowerCase())) {\n\t\t\treturn true;\n\t\t}\n\t\treturn areApiProposalsCompatible(enabledApiProposals);\n\t}\n\n\tprivate async isEngineValid(extensionId: string, version: string, engine: string | undefined, manifestAsset: IGalleryExtensionAsset | null, productVersion: IProductVersion): Promise<boolean> {\n\t\tif (!engine) {\n\t\t\tif (!manifestAsset) {\n\t\t\t\tthis.logService.error(`Missing engine and manifest asset for the extension ${extensionId} with version ${version}`);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\ttype GalleryServiceEngineFallbackClassification = {\n\t\t\t\t\towner: 'sandy081';\n\t\t\t\t\tcomment: 'Fallback request when engine is not found in properties of an extension version';\n\t\t\t\t\textension: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'extension name' };\n\t\t\t\t\textensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'version' };\n\t\t\t\t};\n\t\t\t\ttype GalleryServiceEngineFallbackEvent = {\n\t\t\t\t\textension: string;\n\t\t\t\t\textensionVersion: string;\n\t\t\t\t};\n\t\t\t\tthis.telemetryService.publicLog2<GalleryServiceEngineFallbackEvent, GalleryServiceEngineFallbackClassification>('galleryService:engineFallback', { extension: extensionId, extensionVersion: version });\n\n\t\t\t\tconst headers = { 'Accept-Encoding': 'gzip' };\n\t\t\t\tconst context = await this.getAsset(extensionId, manifestAsset, AssetType.Manifest, version, { headers });\n\t\t\t\tconst manifest = await asJson<IExtensionManifest>(context);\n\t\t\t\tif (!manifest) {\n\t\t\t\t\tthis.logService.error(`Manifest was not found for the extension ${extensionId} with version ${version}`);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tengine = manifest.engines.vscode;\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.error(`Error while getting the engine for the version ${version}.`, getErrorMessage(error));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn isEngineValid(engine, productVersion.version, productVersion.date);\n\t}\n\n\tasync query(options: IQueryOptions, token: CancellationToken): Promise<IPager<IGalleryExtension>> {\n\t\tconst extensionGalleryManifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();\n\n\t\tif (!extensionGalleryManifest) {\n\t\t\tthrow new Error('No extension gallery service configured.');\n\t\t}\n\n\t\tlet text = options.text || '';\n\t\tconst pageSize = options.pageSize ?? 50;\n\n\t\tlet query = new Query()\n\t\t\t.withPage(1, pageSize);\n\n\t\tif (text) {\n\t\t\t// Use category filter instead of \"category:themes\"\n\t\t\ttext = text.replace(/\\bcategory:(\"([^\"]*)\"|([^\"]\\S*))(\\s+|\\b|$)/g, (_, quotedCategory, category) => {\n\t\t\t\tquery = query.withFilter(FilterType.Category, category || quotedCategory);\n\t\t\t\treturn '';\n\t\t\t});\n\n\t\t\t// Use tag filter instead of \"tag:debuggers\"\n\t\t\ttext = text.replace(/\\btag:(\"([^\"]*)\"|([^\"]\\S*))(\\s+|\\b|$)/g, (_, quotedTag, tag) => {\n\t\t\t\tquery = query.withFilter(FilterType.Tag, tag || quotedTag);\n\t\t\t\treturn '';\n\t\t\t});\n\n\t\t\t// Use featured filter\n\t\t\ttext = text.replace(/\\bfeatured(\\s+|\\b|$)/g, () => {\n\t\t\t\tquery = query.withFilter(FilterType.Featured);\n\t\t\t\treturn '';\n\t\t\t});\n\n\t\t\ttext = text.trim();\n\n\t\t\tif (text) {\n\t\t\t\ttext = text.length < 200 ? text : text.substring(0, 200);\n\t\t\t\tquery = query.withFilter(FilterType.SearchText, text);\n\t\t\t}\n\n\t\t\tif (extensionGalleryManifest.capabilities.extensionQuery.sorting?.some(c => c.name === SortBy.NoneOrRelevance)) {\n\t\t\t\tquery = query.withSortBy(SortBy.NoneOrRelevance);\n\t\t\t}\n\t\t} else {\n\t\t\tif (extensionGalleryManifest.capabilities.extensionQuery.sorting?.some(c => c.name === SortBy.InstallCount)) {\n\t\t\t\tquery = query.withSortBy(SortBy.InstallCount);\n\t\t\t}\n\t\t}\n\n\t\tif (options.sortBy && extensionGalleryManifest.capabilities.extensionQuery.sorting?.some(c => c.name === options.sortBy)) {\n\t\t\tquery = query.withSortBy(options.sortBy);\n\t\t}\n\n\t\tif (typeof options.sortOrder === 'number') {\n\t\t\tquery = query.withSortOrder(options.sortOrder);\n\t\t}\n\n\t\tif (options.source) {\n\t\t\tquery = query.withSource(options.source);\n\t\t}\n\n\t\tconst runQuery = async (query: Query, token: CancellationToken) => {\n\t\t\tconst { extensions, total } = await this.queryGalleryExtensions(query, { targetPlatform: CURRENT_TARGET_PLATFORM, compatible: false, includePreRelease: !!options.includePreRelease, productVersion: options.productVersion ?? { version: this.productService.version, date: this.productService.date } }, extensionGalleryManifest, token);\n\t\t\textensions.forEach((e, index) => setTelemetry(e, ((query.pageNumber - 1) * query.pageSize) + index, options.source));\n\t\t\treturn { extensions, total };\n\t\t};\n\t\tconst { extensions, total } = await runQuery(query, token);\n\t\tconst getPage = async (pageIndex: number, ct: CancellationToken) => {\n\t\t\tif (ct.isCancellationRequested) {\n\t\t\t\tthrow new CancellationError();\n\t\t\t}\n\t\t\tconst { extensions } = await runQuery(query.withPage(pageIndex + 1), ct);\n\t\t\treturn extensions;\n\t\t};\n\n\t\treturn { firstPage: extensions, total, pageSize: query.pageSize, getPage };\n\t}\n\n\tprivate async queryGalleryExtensions(query: Query, criteria: ExtensionsCriteria, extensionGalleryManifest: IExtensionGalleryManifest, token: CancellationToken): Promise<{ extensions: IGalleryExtension[]; total: number }> {\n\t\tif (\n\t\t\tthis.productService.quality !== 'stable'\n\t\t\t&& (await this.assignmentService?.getTreatment<boolean>('useLatestPrereleaseAndStableVersionFlag'))\n\t\t) {\n\t\t\treturn this.queryGalleryExtensionsUsingIncludeLatestPrereleaseAndStableVersionFlag(query, criteria, extensionGalleryManifest, token);\n\t\t}\n\n\t\treturn this.queryGalleryExtensionsWithAllVersionsAsFallback(query, criteria, extensionGalleryManifest, token);\n\t}\n\n\tprivate async queryGalleryExtensionsWithAllVersionsAsFallback(query: Query, criteria: ExtensionsCriteria, extensionGalleryManifest: IExtensionGalleryManifest, token: CancellationToken): Promise<{ extensions: IGalleryExtension[]; total: number }> {\n\t\tconst flags = query.flags;\n\n\t\t/**\n\t\t * If both version flags (IncludeLatestVersionOnly and IncludeVersions) are included, then only include latest versions (IncludeLatestVersionOnly) flag.\n\t\t */\n\t\tif (query.flags.includes(Flag.IncludeLatestVersionOnly) && query.flags.includes(Flag.IncludeVersions)) {\n\t\t\tquery = query.withFlags(...query.flags.filter(flag => flag !== Flag.IncludeVersions));\n\t\t}\n\n\t\t/**\n\t\t * If version flags (IncludeLatestVersionOnly and IncludeVersions) are not included, default is to query for latest versions (IncludeLatestVersionOnly).\n\t\t */\n\t\tif (!query.flags.includes(Flag.IncludeLatestVersionOnly) && !query.flags.includes(Flag.IncludeVersions)) {\n\t\t\tquery = query.withFlags(...query.flags, Flag.IncludeLatestVersionOnly);\n\t\t}\n\n\t\t/**\n\t\t * If versions criteria exist or every requested extension is for release version and has a pre-release version, then remove latest flags and add all versions flag.\n\t\t */\n\t\tif (criteria.versions?.length || criteria.isQueryForReleaseVersionFromPreReleaseVersion) {\n\t\t\tquery = query.withFlags(...query.flags.filter(flag => flag !== Flag.IncludeLatestVersionOnly), Flag.IncludeVersions);\n\t\t}\n\n\t\t/**\n\t\t * Add necessary extension flags\n\t\t */\n\t\tquery = query.withFlags(...query.flags, Flag.IncludeAssetUri, Flag.IncludeCategoryAndTags, Flag.IncludeFiles, Flag.IncludeStatistics, Flag.IncludeVersionProperties);\n\t\tconst { galleryExtensions: rawGalleryExtensions, total, context } = await this.queryRawGalleryExtensions(query, extensionGalleryManifest, token);\n\n\t\tconst hasAllVersions: boolean = !query.flags.includes(Flag.IncludeLatestVersionOnly);\n\t\tif (hasAllVersions) {\n\t\t\tconst extensions: IGalleryExtension[] = [];\n\t\t\tfor (const rawGalleryExtension of rawGalleryExtensions) {\n\t\t\t\tconst allTargetPlatforms = getAllTargetPlatforms(rawGalleryExtension);\n\t\t\t\tconst extensionIdentifier = { id: getGalleryExtensionId(rawGalleryExtension.publisher.publisherName, rawGalleryExtension.extensionName), uuid: rawGalleryExtension.extensionId };\n\t\t\t\tconst includePreRelease = isBoolean(criteria.includePreRelease) ? criteria.includePreRelease : !!criteria.includePreRelease.find(extensionIdentifierWithPreRelease => areSameExtensions(extensionIdentifierWithPreRelease, extensionIdentifier))?.includePreRelease;\n\t\t\t\tconst rawGalleryExtensionVersion = await this.getRawGalleryExtensionVersion(\n\t\t\t\t\trawGalleryExtension,\n\t\t\t\t\t{\n\t\t\t\t\t\tcompatible: criteria.compatible,\n\t\t\t\t\t\ttargetPlatform: criteria.targetPlatform,\n\t\t\t\t\t\tproductVersion: criteria.productVersion,\n\t\t\t\t\t\tversion: criteria.versions?.find(extensionIdentifierWithVersion => areSameExtensions(extensionIdentifierWithVersion, extensionIdentifier))?.version\n\t\t\t\t\t\t\t?? (includePreRelease ? VersionKind.Latest : VersionKind.Release)\n\t\t\t\t\t},\n\t\t\t\t\tallTargetPlatforms\n\t\t\t\t);\n\t\t\t\tif (rawGalleryExtensionVersion) {\n\t\t\t\t\textensions.push(toExtension(rawGalleryExtension, rawGalleryExtensionVersion, allTargetPlatforms, extensionGalleryManifest, this.productService, context));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { extensions, total };\n\t\t}\n\n\t\tconst result: [number, IGalleryExtension][] = [];\n\t\tconst needAllVersions = new Map<string, number>();\n\t\tfor (let index = 0; index < rawGalleryExtensions.length; index++) {\n\t\t\tconst rawGalleryExtension = rawGalleryExtensions[index];\n\t\t\tconst extensionIdentifier = { id: getGalleryExtensionId(rawGalleryExtension.publisher.publisherName, rawGalleryExtension.extensionName), uuid: rawGalleryExtension.extensionId };\n\t\t\tconst includePreRelease = isBoolean(criteria.includePreRelease) ? criteria.includePreRelease : !!criteria.includePreRelease.find(extensionIdentifierWithPreRelease => areSameExtensions(extensionIdentifierWithPreRelease, extensionIdentifier))?.includePreRelease;\n\t\t\tconst allTargetPlatforms = getAllTargetPlatforms(rawGalleryExtension);\n\t\t\tif (criteria.compatible) {\n\t\t\t\t// Skip looking for all versions if requested for a web-compatible extension and it is not a web extension.\n\t\t\t\tif (isNotWebExtensionInWebTargetPlatform(allTargetPlatforms, criteria.targetPlatform)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// Skip looking for all versions if the extension is not allowed.\n\t\t\t\tif (this.allowedExtensionsService.isAllowed({ id: extensionIdentifier.id, publisherDisplayName: rawGalleryExtension.publisher.displayName }) !== true) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst rawGalleryExtensionVersion = await this.getRawGalleryExtensionVersion(\n\t\t\t\trawGalleryExtension,\n\t\t\t\t{\n\t\t\t\t\tcompatible: criteria.compatible,\n\t\t\t\t\ttargetPlatform: criteria.targetPlatform,\n\t\t\t\t\tproductVersion: criteria.productVersion,\n\t\t\t\t\tversion: criteria.versions?.find(extensionIdentifierWithVersion => areSameExtensions(extensionIdentifierWithVersion, extensionIdentifier))?.version\n\t\t\t\t\t\t?? (includePreRelease ? VersionKind.Latest : VersionKind.Release)\n\t\t\t\t},\n\t\t\t\tallTargetPlatforms\n\t\t\t);\n\t\t\tconst extension = rawGalleryExtensionVersion ? toExtension(rawGalleryExtension, rawGalleryExtensionVersion, allTargetPlatforms, extensionGalleryManifest, this.productService, context) : null;\n\t\t\tif (!extension\n\t\t\t\t/** Need all versions if the extension is a pre-release version but\n\t\t\t\t * \t\t- the query is to look for a release version or\n\t\t\t\t * \t\t- the extension has no release version\n\t\t\t\t * Get all versions to get or check the release version\n\t\t\t\t*/\n\t\t\t\t|| (extension.properties.isPreReleaseVersion && (!includePreRelease || !extension.hasReleaseVersion))\n\t\t\t\t/**\n\t\t\t\t * Need all versions if the extension is a release version with a different target platform than requested and also has a pre-release version\n\t\t\t\t * Because, this is a platform specific extension and can have a newer release version supporting this platform.\n\t\t\t\t * See https://github.com/microsoft/vscode/issues/139628\n\t\t\t\t*/\n\t\t\t\t|| (!extension.properties.isPreReleaseVersion && extension.properties.targetPlatform !== criteria.targetPlatform && extension.hasPreReleaseVersion)\n\t\t\t) {\n\t\t\t\tneedAllVersions.set(rawGalleryExtension.extensionId, index);\n\t\t\t} else {\n\t\t\t\tresult.push([index, extension]);\n\t\t\t}\n\t\t}\n\n\t\tif (needAllVersions.size) {\n\t\t\tconst stopWatch = new StopWatch();\n\t\t\tconst query = new Query()\n\t\t\t\t.withFlags(...flags.filter(flag => flag !== Flag.IncludeLatestVersionOnly), Flag.IncludeVersions)\n\t\t\t\t.withPage(1, needAllVersions.size)\n\t\t\t\t.withFilter(FilterType.ExtensionId, ...needAllVersions.keys());\n\t\t\tconst { extensions } = await this.queryGalleryExtensions(query, criteria, extensionGalleryManifest, token);\n\t\t\tthis.telemetryService.publicLog2<GalleryServiceAdditionalQueryEvent, GalleryServiceAdditionalQueryClassification>('galleryService:additionalQuery', {\n\t\t\t\tduration: stopWatch.elapsed(),\n\t\t\t\tcount: needAllVersions.size\n\t\t\t});\n\t\t\tfor (const extension of extensions) {\n\t\t\t\tconst index = needAllVersions.get(extension.identifier.uuid)!;\n\t\t\t\tresult.push([index, extension]);\n\t\t\t}\n\t\t}\n\n\t\treturn { extensions: result.sort((a, b) => a[0] - b[0]).map(([, extension]) => extension), total };\n\t}\n\n\tprivate async queryGalleryExtensionsUsingIncludeLatestPrereleaseAndStableVersionFlag(query: Query, criteria: ExtensionsCriteria, extensionGalleryManifest: IExtensionGalleryManifest, token: CancellationToken): Promise<{ extensions: IGalleryExtension[]; total: number }> {\n\n\t\t/**\n\t\t * If versions criteria exist, then remove latest flags and add all versions flag.\n\t\t*/\n\t\tif (criteria.versions?.length) {\n\t\t\tquery = query.withFlags(...query.flags.filter(flag => flag !== Flag.IncludeLatestVersionOnly && flag !== Flag.IncludeLatestPrereleaseAndStableVersionOnly), Flag.IncludeVersions);\n\t\t}\n\n\t\t/**\n\t\t * If the query does not specify all versions flag, handle latest versions.\n\t\t */\n\t\telse if (!query.flags.includes(Flag.IncludeVersions)) {\n\t\t\tconst includeLatest = isBoolean(criteria.includePreRelease) ? criteria.includePreRelease : criteria.includePreRelease.every(({ includePreRelease }) => includePreRelease);\n\t\t\tquery = includeLatest ? query.withFlags(...query.flags.filter(flag => flag !== Flag.IncludeLatestPrereleaseAndStableVersionOnly), Flag.IncludeLatestVersionOnly) : query.withFlags(...query.flags.filter(flag => flag !== Flag.IncludeLatestVersionOnly), Flag.IncludeLatestPrereleaseAndStableVersionOnly);\n\t\t}\n\n\t\t/**\n\t\t * If all versions flag is set, remove latest flags.\n\t\t */\n\t\tif (query.flags.includes(Flag.IncludeVersions) && (query.flags.includes(Flag.IncludeLatestVersionOnly) || query.flags.includes(Flag.IncludeLatestPrereleaseAndStableVersionOnly))) {\n\t\t\tquery = query.withFlags(...query.flags.filter(flag => flag !== Flag.IncludeLatestVersionOnly && flag !== Flag.IncludeLatestPrereleaseAndStableVersionOnly), Flag.IncludeVersions);\n\t\t}\n\n\t\t/**\n\t\t * Add necessary extension flags\n\t\t */\n\t\tquery = query.withFlags(...query.flags, Flag.IncludeAssetUri, Flag.IncludeCategoryAndTags, Flag.IncludeFiles, Flag.IncludeStatistics, Flag.IncludeVersionProperties);\n\t\tconst { galleryExtensions: rawGalleryExtensions, total, context } = await this.queryRawGalleryExtensions(query, extensionGalleryManifest, token);\n\n\t\tconst extensions: IGalleryExtension[] = [];\n\t\tfor (let index = 0; index < rawGalleryExtensions.length; index++) {\n\t\t\tconst rawGalleryExtension = rawGalleryExtensions[index];\n\t\t\tconst extensionIdentifier = { id: getGalleryExtensionId(rawGalleryExtension.publisher.publisherName, rawGalleryExtension.extensionName), uuid: rawGalleryExtension.extensionId };\n\t\t\tconst allTargetPlatforms = getAllTargetPlatforms(rawGalleryExtension);\n\t\t\tif (criteria.compatible) {\n\t\t\t\t// Skip looking for all versions if requested for a web-compatible extension and it is not a web extension.\n\t\t\t\tif (isNotWebExtensionInWebTargetPlatform(allTargetPlatforms, criteria.targetPlatform)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// Skip looking for all versions if the extension is not allowed.\n\t\t\t\tif (this.allowedExtensionsService.isAllowed({ id: extensionIdentifier.id, publisherDisplayName: rawGalleryExtension.publisher.displayName }) !== true) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst version = criteria.versions?.find(extensionIdentifierWithVersion => areSameExtensions(extensionIdentifierWithVersion, extensionIdentifier))?.version\n\t\t\t\t?? ((isBoolean(criteria.includePreRelease) ? criteria.includePreRelease : !!criteria.includePreRelease.find(extensionIdentifierWithPreRelease => areSameExtensions(extensionIdentifierWithPreRelease, extensionIdentifier))?.includePreRelease) ? VersionKind.Latest : VersionKind.Release);\n\t\t\tconst rawGalleryExtensionVersion = await this.getRawGalleryExtensionVersion(\n\t\t\t\trawGalleryExtension,\n\t\t\t\t{\n\t\t\t\t\tcompatible: criteria.compatible,\n\t\t\t\t\ttargetPlatform: criteria.targetPlatform,\n\t\t\t\t\tproductVersion: criteria.productVersion,\n\t\t\t\t\tversion\n\t\t\t\t},\n\t\t\t\tallTargetPlatforms\n\t\t\t);\n\t\t\tif (rawGalleryExtensionVersion) {\n\t\t\t\textensions.push(toExtension(rawGalleryExtension, rawGalleryExtensionVersion, allTargetPlatforms, extensionGalleryManifest, this.productService, context));\n\t\t\t}\n\t\t}\n\n\t\treturn { extensions, total };\n\t}\n\n\tprivate async getRawGalleryExtensionVersion(rawGalleryExtension: IRawGalleryExtension, criteria: ExtensionVersionCriteria, allTargetPlatforms: TargetPlatform[]): Promise<IRawGalleryExtensionVersion | null> {\n\t\tconst extensionIdentifier = { id: getGalleryExtensionId(rawGalleryExtension.publisher.publisherName, rawGalleryExtension.extensionName), uuid: rawGalleryExtension.extensionId };\n\t\tconst rawGalleryExtensionVersions = sortExtensionVersions(rawGalleryExtension.versions, criteria.targetPlatform);\n\n\t\tif (criteria.compatible && isNotWebExtensionInWebTargetPlatform(allTargetPlatforms, criteria.targetPlatform)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst version = isString(criteria.version) ? criteria.version : undefined;\n\n\t\tfor (let index = 0; index < rawGalleryExtensionVersions.length; index++) {\n\t\t\tconst rawGalleryExtensionVersion = rawGalleryExtensionVersions[index];\n\t\t\tif (await this.isValidVersion(\n\t\t\t\t{\n\t\t\t\t\tid: extensionIdentifier.id,\n\t\t\t\t\tversion: rawGalleryExtensionVersion.version,\n\t\t\t\t\tisPreReleaseVersion: isPreReleaseVersion(rawGalleryExtensionVersion),\n\t\t\t\t\ttargetPlatform: getTargetPlatformForExtensionVersion(rawGalleryExtensionVersion),\n\t\t\t\t\tengine: getEngine(rawGalleryExtensionVersion),\n\t\t\t\t\tmanifestAsset: getVersionAsset(rawGalleryExtensionVersion, AssetType.Manifest),\n\t\t\t\t\tenabledApiProposals: getEnabledApiProposals(rawGalleryExtensionVersion)\n\t\t\t\t},\n\t\t\t\tcriteria,\n\t\t\t\trawGalleryExtension.publisher.displayName,\n\t\t\t\tallTargetPlatforms)\n\t\t\t) {\n\t\t\t\treturn rawGalleryExtensionVersion;\n\t\t\t}\n\t\t\tif (version && rawGalleryExtensionVersion.version === version) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tif (version || criteria.compatible) {\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Fallback: Return the latest version\n\t\t * This can happen when the extension does not have a release version or does not have a version compatible with the given target platform.\n\t\t */\n\t\treturn rawGalleryExtension.versions[0];\n\t}\n\n\tprivate async queryRawGalleryExtensions(query: Query, extensionGalleryManifest: IExtensionGalleryManifest, token: CancellationToken): Promise<IRawGalleryExtensionsResult> {\n\t\tconst extensionsQueryApi = getExtensionGalleryManifestResourceUri(extensionGalleryManifest, ExtensionGalleryResourceType.ExtensionQueryService);\n\n\t\tif (!extensionsQueryApi) {\n\t\t\tthrow new Error('No extension gallery query service configured.');\n\t\t}\n\n\t\tquery = query\n\t\t\t/* Always exclude non validated extensions */\n\t\t\t.withFlags(...query.flags, Flag.ExcludeNonValidated)\n\t\t\t.withFilter(FilterType.Target, 'Microsoft.VisualStudio.Code');\n\n\t\tconst unpublishedFlag = extensionGalleryManifest.capabilities.extensionQuery.flags?.find(f => f.name === Flag.Unpublished);\n\t\t/* Always exclude unpublished extensions */\n\t\tif (unpublishedFlag) {\n\t\t\tquery = query.withFilter(FilterType.ExcludeWithFlags, String(unpublishedFlag.value));\n\t\t}\n\n\t\tconst data = JSON.stringify({\n\t\t\tfilters: [\n\t\t\t\t{\n\t\t\t\t\tcriteria: query.criteria.reduce<{ filterType: number; value?: string }[]>((criteria, c) => {\n\t\t\t\t\t\tconst criterium = extensionGalleryManifest.capabilities.extensionQuery.filtering?.find(f => f.name === c.filterType);\n\t\t\t\t\t\tif (criterium) {\n\t\t\t\t\t\t\tcriteria.push({\n\t\t\t\t\t\t\t\tfilterType: criterium.value,\n\t\t\t\t\t\t\t\tvalue: c.value,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn criteria;\n\t\t\t\t\t}, []),\n\t\t\t\t\tpageNumber: query.pageNumber,\n\t\t\t\t\tpageSize: query.pageSize,\n\t\t\t\t\tsortBy: extensionGalleryManifest.capabilities.extensionQuery.sorting?.find(s => s.name === query.sortBy)?.value,\n\t\t\t\t\tsortOrder: query.sortOrder,\n\t\t\t\t}\n\t\t\t],\n\t\t\tassetTypes: query.assetTypes,\n\t\t\tflags: query.flags.reduce<number>((flags, flag) => {\n\t\t\t\tconst flagValue = extensionGalleryManifest.capabilities.extensionQuery.flags?.find(f => f.name === flag);\n\t\t\t\tif (flagValue) {\n\t\t\t\t\tflags |= flagValue.value;\n\t\t\t\t}\n\t\t\t\treturn flags;\n\t\t\t}, 0)\n\t\t});\n\n\t\tconst commonHeaders = await this.commonHeadersPromise;\n\t\tconst headers = {\n\t\t\t...commonHeaders,\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Accept': 'application/json;api-version=3.0-preview.1',\n\t\t\t'Accept-Encoding': 'gzip',\n\t\t\t'Content-Length': String(data.length),\n\t\t};\n\n\t\tconst stopWatch = new StopWatch();\n\t\tlet context: IRequestContext | undefined, errorCode: ExtensionGalleryErrorCode | undefined, total: number = 0;\n\n\t\ttry {\n\t\t\tcontext = await this.requestService.request({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: extensionsQueryApi,\n\t\t\t\tdata,\n\t\t\t\theaders\n\t\t\t}, token);\n\n\t\t\tif (context.res.statusCode && context.res.statusCode >= 400 && context.res.statusCode < 500) {\n\t\t\t\treturn { galleryExtensions: [], total };\n\t\t\t}\n\n\t\t\tconst result = await asJson<IRawGalleryQueryResult>(context);\n\t\t\tif (result) {\n\t\t\t\tconst r = result.results[0];\n\t\t\t\tconst galleryExtensions = r.extensions;\n\t\t\t\tconst resultCount = r.resultMetadata && r.resultMetadata.filter(m => m.metadataType === 'ResultCount')[0];\n\t\t\t\ttotal = resultCount && resultCount.metadataItems.filter(i => i.name === 'TotalCount')[0].count || 0;\n\n\t\t\t\treturn {\n\t\t\t\t\tgalleryExtensions,\n\t\t\t\t\ttotal,\n\t\t\t\t\tcontext: context.res.headers['activityid'] ? {\n\t\t\t\t\t\t[SEARCH_ACTIVITY_HEADER_NAME]: context.res.headers['activityid']\n\t\t\t\t\t} : {}\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { galleryExtensions: [], total };\n\n\t\t} catch (e) {\n\t\t\tif (isCancellationError(e)) {\n\t\t\t\terrorCode = ExtensionGalleryErrorCode.Cancelled;\n\t\t\t\tthrow e;\n\t\t\t} else {\n\t\t\t\tconst errorMessage = getErrorMessage(e);\n\t\t\t\terrorCode = isOfflineError(e)\n\t\t\t\t\t? ExtensionGalleryErrorCode.Offline\n\t\t\t\t\t: errorMessage.startsWith('XHR timeout')\n\t\t\t\t\t\t? ExtensionGalleryErrorCode.Timeout\n\t\t\t\t\t\t: ExtensionGalleryErrorCode.Failed;\n\t\t\t\tthrow new ExtensionGalleryError(errorMessage, errorCode);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.telemetryService.publicLog2<GalleryServiceQueryEvent, GalleryServiceQueryClassification>('galleryService:query', {\n\t\t\t\tfilterTypes: query.criteria.map(criterium => criterium.filterType),\n\t\t\t\tflags: query.flags,\n\t\t\t\tsortBy: query.sortBy,\n\t\t\t\tsortOrder: String(query.sortOrder),\n\t\t\t\tpageNumber: String(query.pageNumber),\n\t\t\t\tsource: query.source,\n\t\t\t\tsearchTextLength: query.searchText.length,\n\t\t\t\trequestBodySize: String(data.length),\n\t\t\t\tduration: stopWatch.elapsed(),\n\t\t\t\tsuccess: !!context && isSuccess(context),\n\t\t\t\tresponseBodySize: context?.res.headers['Content-Length'],\n\t\t\t\tstatusCode: context ? String(context.res.statusCode) : undefined,\n\t\t\t\terrorCode,\n\t\t\t\tcount: String(total),\n\t\t\t\tserver: this.getHeaderValue(context?.res.headers, SERVER_HEADER_NAME),\n\t\t\t\tactivityId: this.getHeaderValue(context?.res.headers, ACTIVITY_HEADER_NAME),\n\t\t\t\tendToEndId: this.getHeaderValue(context?.res.headers, END_END_ID_HEADER_NAME),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate getHeaderValue(headers: IHeaders | undefined, name: string): TelemetryTrustedValue<string> | undefined {\n\t\tconst headerValue = headers?.[name.toLowerCase()];\n\t\tconst value = Array.isArray(headerValue) ? headerValue[0] : headerValue;\n\t\treturn value ? new TelemetryTrustedValue(value) : undefined;\n\t}\n\n\tprivate async getLatestRawGalleryExtension(extension: string, uri: URI, token: CancellationToken): Promise<IRawGalleryExtension | null> {\n\t\tlet errorCode: string | undefined;\n\t\tconst stopWatch = new StopWatch();\n\n\t\tlet context;\n\t\ttry {\n\t\t\tconst commonHeaders = await this.commonHeadersPromise;\n\t\t\tconst headers = {\n\t\t\t\t...commonHeaders,\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'Accept': 'application/json;api-version=7.2-preview',\n\t\t\t\t'Accept-Encoding': 'gzip',\n\t\t\t};\n\n\t\t\tcontext = await this.requestService.request({\n\t\t\t\ttype: 'GET',\n\t\t\t\turl: uri.toString(true),\n\t\t\t\theaders,\n\t\t\t\ttimeout: REQUEST_TIME_OUT\n\t\t\t}, token);\n\n\t\t\tif (context.res.statusCode === 404) {\n\t\t\t\terrorCode = 'NotFound';\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif (context.res.statusCode && context.res.statusCode !== 200) {\n\t\t\t\terrorCode = `GalleryServiceError:` + context.res.statusCode;\n\t\t\t\tthrow new Error('Unexpected HTTP response: ' + context.res.statusCode);\n\t\t\t}\n\n\t\t\tconst result = await asJson<IRawGalleryExtension>(context);\n\t\t\tif (!result) {\n\t\t\t\terrorCode = 'NoData';\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tcatch (error) {\n\t\t\tif (isCancellationError(error)) {\n\t\t\t\terrorCode = ExtensionGalleryErrorCode.Cancelled;\n\t\t\t} else if (isOfflineError(error)) {\n\t\t\t\terrorCode = ExtensionGalleryErrorCode.Offline;\n\t\t\t} else if (getErrorMessage(error).startsWith('XHR timeout')) {\n\t\t\t\terrorCode = ExtensionGalleryErrorCode.Timeout;\n\t\t\t} else if (!errorCode) {\n\t\t\t\terrorCode = ExtensionGalleryErrorCode.Failed;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\tfinally {\n\t\t\ttype GalleryServiceGetLatestEventClassification = {\n\t\t\t\towner: 'sandy081';\n\t\t\t\tcomment: 'Report the query to the Marketplace for fetching latest version of an extension';\n\t\t\t\thost: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The host of the end point' };\n\t\t\t\textension: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier of the extension' };\n\t\t\t\tduration: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'Duration in ms for the query' };\n\t\t\t\terrorCode?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The error code in case of error' };\n\t\t\t\tserver?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The server of the end point' };\n\t\t\t\tactivityId?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The activity ID of the request' };\n\t\t\t\tendToEndId?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The end-to-end ID of the request' };\n\t\t\t};\n\t\t\ttype GalleryServiceGetLatestEvent = {\n\t\t\t\textension: string;\n\t\t\t\thost: string;\n\t\t\t\tduration: number;\n\t\t\t\terrorCode?: string;\n\t\t\t\tserver?: TelemetryTrustedValue<string>;\n\t\t\t\tactivityId?: TelemetryTrustedValue<string>;\n\t\t\t\tendToEndId?: TelemetryTrustedValue<string>;\n\t\t\t};\n\t\t\tthis.telemetryService.publicLog2<GalleryServiceGetLatestEvent, GalleryServiceGetLatestEventClassification>('galleryService:getLatest', {\n\t\t\t\textension,\n\t\t\t\thost: uri.authority,\n\t\t\t\tduration: stopWatch.elapsed(),\n\t\t\t\terrorCode,\n\t\t\t\tserver: this.getHeaderValue(context?.res.headers, SERVER_HEADER_NAME),\n\t\t\t\tactivityId: this.getHeaderValue(context?.res.headers, ACTIVITY_HEADER_NAME),\n\t\t\t\tendToEndId: this.getHeaderValue(context?.res.headers, END_END_ID_HEADER_NAME),\n\t\t\t});\n\t\t}\n\t}\n\n\tasync reportStatistic(publisher: string, name: string, version: string, type: StatisticType): Promise<void> {\n\t\tconst manifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();\n\t\tif (!manifest) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tlet url: string;\n\n\t\tif (isWeb) {\n\t\t\tconst resource = getExtensionGalleryManifestResourceUri(manifest, ExtensionGalleryResourceType.WebExtensionStatisticsUri);\n\t\t\tif (!resource) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\turl = format2(resource, { publisher, name, version, statTypeValue: type === StatisticType.Install ? '1' : '3' });\n\t\t} else {\n\t\t\tconst resource = getExtensionGalleryManifestResourceUri(manifest, ExtensionGalleryResourceType.ExtensionStatisticsUri);\n\t\t\tif (!resource) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\turl = format2(resource, { publisher, name, version, statTypeName: type });\n\t\t}\n\n\t\tconst Accept = isWeb ? 'api-version=6.1-preview.1' : '*/*;api-version=4.0-preview.1';\n\t\tconst commonHeaders = await this.commonHeadersPromise;\n\t\tconst headers = { ...commonHeaders, Accept };\n\t\ttry {\n\t\t\tawait this.requestService.request({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl,\n\t\t\t\theaders\n\t\t\t}, CancellationToken.None);\n\t\t} catch (error) { /* Ignore */ }\n\t}\n\n\tasync download(extension: IGalleryExtension, location: URI, operation: InstallOperation): Promise<void> {\n\t\tthis.logService.trace('ExtensionGalleryService#download', extension.identifier.id);\n\t\tconst data = getGalleryExtensionTelemetryData(extension);\n\t\tconst startTime = new Date().getTime();\n\n\t\tconst operationParam = operation === InstallOperation.Install ? 'install' : operation === InstallOperation.Update ? 'update' : '';\n\t\tconst downloadAsset = operationParam ? {\n\t\t\turi: `${extension.assets.download.uri}${URI.parse(extension.assets.download.uri).query ? '&' : '?'}${operationParam}=true`,\n\t\t\tfallbackUri: `${extension.assets.download.fallbackUri}${URI.parse(extension.assets.download.fallbackUri).query ? '&' : '?'}${operationParam}=true`\n\t\t} : extension.assets.download;\n\n\t\tconst headers: IHeaders | undefined = extension.queryContext?.[SEARCH_ACTIVITY_HEADER_NAME] ? { [SEARCH_ACTIVITY_HEADER_NAME]: extension.queryContext[SEARCH_ACTIVITY_HEADER_NAME] } : undefined;\n\t\tconst context = await this.getAsset(extension.identifier.id, downloadAsset, AssetType.VSIX, extension.version, headers ? { headers } : undefined);\n\n\t\ttry {\n\t\t\tawait this.fileService.writeFile(location, context.stream);\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait this.fileService.del(location);\n\t\t\t} catch (e) {\n\t\t\t\t/* ignore */\n\t\t\t\tthis.logService.warn(`Error while deleting the file ${location.toString()}`, getErrorMessage(e));\n\t\t\t}\n\t\t\tthrow new ExtensionGalleryError(getErrorMessage(error), ExtensionGalleryErrorCode.DownloadFailedWriting);\n\t\t}\n\n\t\t/* __GDPR__\n\t\t\t\"galleryService:downloadVSIX\" : {\n\t\t\t\t\"owner\": \"sandy081\",\n\t\t\t\t\"duration\": { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\", \"isMeasurement\": true },\n\t\t\t\t\"${include}\": [\n\t\t\t\t\t\"${GalleryExtensionTelemetryData}\"\n\t\t\t\t]\n\t\t\t}\n\t\t*/\n\t\tthis.telemetryService.publicLog('galleryService:downloadVSIX', { ...data, duration: new Date().getTime() - startTime });\n\t}\n\n\tasync downloadSignatureArchive(extension: IGalleryExtension, location: URI): Promise<void> {\n\t\tif (!extension.assets.signature) {\n\t\t\tthrow new Error('No signature asset found');\n\t\t}\n\n\t\tthis.logService.trace('ExtensionGalleryService#downloadSignatureArchive', extension.identifier.id);\n\n\t\tconst context = await this.getAsset(extension.identifier.id, extension.assets.signature, AssetType.Signature, extension.version);\n\t\ttry {\n\t\t\tawait this.fileService.writeFile(location, context.stream);\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait this.fileService.del(location);\n\t\t\t} catch (e) {\n\t\t\t\t/* ignore */\n\t\t\t\tthis.logService.warn(`Error while deleting the file ${location.toString()}`, getErrorMessage(e));\n\t\t\t}\n\t\t\tthrow new ExtensionGalleryError(getErrorMessage(error), ExtensionGalleryErrorCode.DownloadFailedWriting);\n\t\t}\n\n\t}\n\n\tasync getReadme(extension: IGalleryExtension, token: CancellationToken): Promise<string> {\n\t\tif (extension.assets.readme) {\n\t\t\tconst context = await this.getAsset(extension.identifier.id, extension.assets.readme, AssetType.Details, extension.version, {}, token);\n\t\t\tconst content = await asTextOrError(context);\n\t\t\treturn content || '';\n\t\t}\n\t\treturn '';\n\t}\n\n\tasync getManifest(extension: IGalleryExtension, token: CancellationToken): Promise<IExtensionManifest | null> {\n\t\tif (extension.assets.manifest) {\n\t\t\tconst context = await this.getAsset(extension.identifier.id, extension.assets.manifest, AssetType.Manifest, extension.version, {}, token);\n\t\t\tconst text = await asTextOrError(context);\n\t\t\treturn text ? JSON.parse(text) : null;\n\t\t}\n\t\treturn null;\n\t}\n\n\tasync getCoreTranslation(extension: IGalleryExtension, languageId: string): Promise<ITranslation | null> {\n\t\tconst asset = extension.assets.coreTranslations.filter(t => t[0] === languageId.toUpperCase())[0];\n\t\tif (asset) {\n\t\t\tconst context = await this.getAsset(extension.identifier.id, asset[1], asset[0], extension.version);\n\t\t\tconst text = await asTextOrError(context);\n\t\t\treturn text ? JSON.parse(text) : null;\n\t\t}\n\t\treturn null;\n\t}\n\n\tasync getChangelog(extension: IGalleryExtension, token: CancellationToken): Promise<string> {\n\t\tif (extension.assets.changelog) {\n\t\t\tconst context = await this.getAsset(extension.identifier.id, extension.assets.changelog, AssetType.Changelog, extension.version, {}, token);\n\t\t\tconst content = await asTextOrError(context);\n\t\t\treturn content || '';\n\t\t}\n\t\treturn '';\n\t}\n\n\tasync getAllVersions(extensionIdentifier: IExtensionIdentifier): Promise<IGalleryExtensionVersion[]> {\n\t\treturn this.getVersions(extensionIdentifier);\n\t}\n\n\tasync getAllCompatibleVersions(extensionIdentifier: IExtensionIdentifier, includePreRelease: boolean, targetPlatform: TargetPlatform): Promise<IGalleryExtensionVersion[]> {\n\t\treturn this.getVersions(extensionIdentifier, { version: includePreRelease ? VersionKind.Latest : VersionKind.Release, targetPlatform });\n\t}\n\n\tprivate async getVersions(extensionIdentifier: IExtensionIdentifier, onlyCompatible?: { version: VersionKind; targetPlatform: TargetPlatform }): Promise<IGalleryExtensionVersion[]> {\n\t\tconst extensionGalleryManifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();\n\t\tif (!extensionGalleryManifest) {\n\t\t\tthrow new Error('No extension gallery service configured.');\n\t\t}\n\n\t\tlet query = new Query()\n\t\t\t.withFlags(Flag.IncludeVersions, Flag.IncludeCategoryAndTags, Flag.IncludeFiles, Flag.IncludeVersionProperties)\n\t\t\t.withPage(1, 1);\n\n\t\tif (extensionIdentifier.uuid) {\n\t\t\tquery = query.withFilter(FilterType.ExtensionId, extensionIdentifier.uuid);\n\t\t} else {\n\t\t\tquery = query.withFilter(FilterType.ExtensionName, extensionIdentifier.id);\n\t\t}\n\n\t\tconst { galleryExtensions } = await this.queryRawGalleryExtensions(query, extensionGalleryManifest, CancellationToken.None);\n\t\tif (!galleryExtensions.length) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst allTargetPlatforms = getAllTargetPlatforms(galleryExtensions[0]);\n\t\tif (onlyCompatible && isNotWebExtensionInWebTargetPlatform(allTargetPlatforms, onlyCompatible.targetPlatform)) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst versions: IRawGalleryExtensionVersion[] = [];\n\t\tconst productVersion = { version: this.productService.version, date: this.productService.date };\n\t\tawait Promise.all(galleryExtensions[0].versions.map(async (version) => {\n\t\t\ttry {\n\t\t\t\tif (\n\t\t\t\t\t(await this.isValidVersion(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: extensionIdentifier.id,\n\t\t\t\t\t\t\tversion: version.version,\n\t\t\t\t\t\t\tisPreReleaseVersion: isPreReleaseVersion(version),\n\t\t\t\t\t\t\ttargetPlatform: getTargetPlatformForExtensionVersion(version),\n\t\t\t\t\t\t\tengine: getEngine(version),\n\t\t\t\t\t\t\tmanifestAsset: getVersionAsset(version, AssetType.Manifest),\n\t\t\t\t\t\t\tenabledApiProposals: getEnabledApiProposals(version)\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcompatible: !!onlyCompatible,\n\t\t\t\t\t\t\tproductVersion,\n\t\t\t\t\t\t\ttargetPlatform: onlyCompatible?.targetPlatform ?? CURRENT_TARGET_PLATFORM,\n\t\t\t\t\t\t\tversion: onlyCompatible?.version ?? version.version\n\t\t\t\t\t\t},\n\t\t\t\t\t\tgalleryExtensions[0].publisher.displayName,\n\t\t\t\t\t\tallTargetPlatforms))\n\t\t\t\t) {\n\t\t\t\t\tversions.push(version);\n\t\t\t\t}\n\t\t\t} catch (error) { /* Ignore error and skip version */ }\n\t\t}));\n\n\t\tconst result: IGalleryExtensionVersion[] = [];\n\t\tconst seen = new Set<string>();\n\t\tfor (const version of sortExtensionVersions(versions, onlyCompatible?.targetPlatform ?? CURRENT_TARGET_PLATFORM)) {\n\t\t\tif (!seen.has(version.version)) {\n\t\t\t\tseen.add(version.version);\n\t\t\t\tresult.push({ version: version.version, date: version.lastUpdated, isPreReleaseVersion: isPreReleaseVersion(version) });\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate async getAsset(extension: string, asset: IGalleryExtensionAsset, assetType: string, extensionVersion: string, options: IRequestOptions = {}, token: CancellationToken = CancellationToken.None): Promise<IRequestContext> {\n\t\tconst commonHeaders = await this.commonHeadersPromise;\n\t\tconst baseOptions = { type: 'GET' };\n\t\tconst headers = { ...commonHeaders, ...(options.headers || {}) };\n\t\toptions = { ...options, ...baseOptions, headers };\n\n\t\tconst url = asset.uri;\n\t\tconst fallbackUrl = asset.fallbackUri;\n\t\tconst firstOptions = { ...options, url, timeout: REQUEST_TIME_OUT };\n\n\t\tlet context;\n\t\ttry {\n\t\t\tcontext = await this.requestService.request(firstOptions, token);\n\t\t\tif (context.res.statusCode === 200) {\n\t\t\t\treturn context;\n\t\t\t}\n\t\t\tconst message = await asTextOrError(context);\n\t\t\tthrow new Error(`Expected 200, got back ${context.res.statusCode} instead.\\n\\n${message}`);\n\t\t} catch (err) {\n\t\t\tif (isCancellationError(err)) {\n\t\t\t\tthrow err;\n\t\t\t}\n\n\t\t\tconst message = getErrorMessage(err);\n\t\t\ttype GalleryServiceCDNFallbackClassification = {\n\t\t\t\towner: 'sandy081';\n\t\t\t\tcomment: 'Fallback request information when the primary asset request to CDN fails';\n\t\t\t\textension: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'extension name' };\n\t\t\t\tassetType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'asset that failed' };\n\t\t\t\tmessage: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'error message' };\n\t\t\t\textensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'version' };\n\t\t\t\treadonly server?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'server that handled the query' };\n\t\t\t\treadonly endToEndId?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'end to end operation id' };\n\t\t\t\treadonly activityId?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'activity id' };\n\t\t\t};\n\t\t\ttype GalleryServiceCDNFallbackEvent = {\n\t\t\t\textension: string;\n\t\t\t\tassetType: string;\n\t\t\t\tmessage: string;\n\t\t\t\textensionVersion: string;\n\t\t\t\tserver?: TelemetryTrustedValue<string>;\n\t\t\t\tendToEndId?: TelemetryTrustedValue<string>;\n\t\t\t\tactivityId?: TelemetryTrustedValue<string>;\n\t\t\t};\n\t\t\tthis.telemetryService.publicLog2<GalleryServiceCDNFallbackEvent, GalleryServiceCDNFallbackClassification>('galleryService:cdnFallback', {\n\t\t\t\textension,\n\t\t\t\tassetType,\n\t\t\t\tmessage,\n\t\t\t\textensionVersion,\n\t\t\t\tserver: this.getHeaderValue(context?.res.headers, SERVER_HEADER_NAME),\n\t\t\t\tactivityId: this.getHeaderValue(context?.res.headers, ACTIVITY_HEADER_NAME),\n\t\t\t\tendToEndId: this.getHeaderValue(context?.res.headers, END_END_ID_HEADER_NAME),\n\t\t\t});\n\n\t\t\tconst fallbackOptions = { ...options, url: fallbackUrl, timeout: REQUEST_TIME_OUT };\n\t\t\treturn this.requestService.request(fallbackOptions, token);\n\t\t}\n\t}\n\n\tasync getExtensionsControlManifest(): Promise<IExtensionsControlManifest> {\n\t\tif (!this.isEnabled()) {\n\t\t\tthrow new Error('No extension gallery service configured.');\n\t\t}\n\n\t\tif (!this.extensionsControlUrl) {\n\t\t\treturn { malicious: [], deprecated: {}, search: [], autoUpdate: {} };\n\t\t}\n\n\t\tconst context = await this.requestService.request({\n\t\t\ttype: 'GET',\n\t\t\turl: this.extensionsControlUrl,\n\t\t\ttimeout: REQUEST_TIME_OUT\n\t\t}, CancellationToken.None);\n\n\t\tif (context.res.statusCode !== 200) {\n\t\t\tthrow new Error('Could not get extensions report.');\n\t\t}\n\n\t\tconst result = await asJson<IRawExtensionsControlManifest>(context);\n\t\tconst malicious: Array<MaliciousExtensionInfo> = [];\n\t\tconst deprecated: IStringDictionary<IDeprecationInfo> = {};\n\t\tconst search: ISearchPrefferedResults[] = [];\n\t\tconst autoUpdate: IStringDictionary<string> = result?.autoUpdate ?? {};\n\t\tif (result) {\n\t\t\tfor (const id of result.malicious) {\n\t\t\t\tif (!isString(id)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst publisherOrExtension = EXTENSION_IDENTIFIER_REGEX.test(id) ? { id } : id;\n\t\t\t\tmalicious.push({ extensionOrPublisher: publisherOrExtension, learnMoreLink: result.learnMoreLinks?.[id] });\n\t\t\t}\n\t\t\tif (result.migrateToPreRelease) {\n\t\t\t\tfor (const [unsupportedPreReleaseExtensionId, preReleaseExtensionInfo] of Object.entries(result.migrateToPreRelease)) {\n\t\t\t\t\tif (!preReleaseExtensionInfo.engine || isEngineValid(preReleaseExtensionInfo.engine, this.productService.version, this.productService.date)) {\n\t\t\t\t\t\tdeprecated[unsupportedPreReleaseExtensionId.toLowerCase()] = {\n\t\t\t\t\t\t\tdisallowInstall: true,\n\t\t\t\t\t\t\textension: {\n\t\t\t\t\t\t\t\tid: preReleaseExtensionInfo.id,\n\t\t\t\t\t\t\t\tdisplayName: preReleaseExtensionInfo.displayName,\n\t\t\t\t\t\t\t\tautoMigrate: { storage: !!preReleaseExtensionInfo.migrateStorage },\n\t\t\t\t\t\t\t\tpreRelease: true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result.deprecated) {\n\t\t\t\tfor (const [deprecatedExtensionId, deprecationInfo] of Object.entries(result.deprecated)) {\n\t\t\t\t\tif (deprecationInfo) {\n\t\t\t\t\t\tdeprecated[deprecatedExtensionId.toLowerCase()] = isBoolean(deprecationInfo) ? {} : deprecationInfo;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result.search) {\n\t\t\t\tfor (const s of result.search) {\n\t\t\t\t\tsearch.push(s);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { malicious, deprecated, search, autoUpdate };\n\t}\n\n}\n\nexport class ExtensionGalleryService extends AbstractExtensionGalleryService {\n\n\tconstructor(\n\t\t@IStorageService storageService: IStorageService,\n\t\t@IRequestService requestService: IRequestService,\n\t\t@ILogService logService: ILogService,\n\t\t@IEnvironmentService environmentService: IEnvironmentService,\n\t\t@ITelemetryService telemetryService: ITelemetryService,\n\t\t@IFileService fileService: IFileService,\n\t\t@IProductService productService: IProductService,\n\t\t@IConfigurationService configurationService: IConfigurationService,\n\t\t@IAllowedExtensionsService allowedExtensionsService: IAllowedExtensionsService,\n\t\t@IExtensionGalleryManifestService extensionGalleryManifestService: IExtensionGalleryManifestService,\n\t) {\n\t\tsuper(storageService, undefined, requestService, logService, environmentService, telemetryService, fileService, productService, configurationService, allowedExtensionsService, extensionGalleryManifestService);\n\t}\n}\n\nexport class ExtensionGalleryServiceWithNoStorageService extends AbstractExtensionGalleryService {\n\n\tconstructor(\n\t\t@IRequestService requestService: IRequestService,\n\t\t@ILogService logService: ILogService,\n\t\t@IEnvironmentService environmentService: IEnvironmentService,\n\t\t@ITelemetryService telemetryService: ITelemetryService,\n\t\t@IFileService fileService: IFileService,\n\t\t@IProductService productService: IProductService,\n\t\t@IConfigurationService configurationService: IConfigurationService,\n\t\t@IAllowedExtensionsService allowedExtensionsService: IAllowedExtensionsService,\n\t\t@IExtensionGalleryManifestService extensionGalleryManifestService: IExtensionGalleryManifestService,\n\t) {\n\t\tsuper(undefined, undefined, requestService, logService, environmentService, telemetryService, fileService, productService, configurationService, allowedExtensionsService, extensionGalleryManifestService);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createWriteStream, WriteStream, promises } from 'fs';\nimport { Readable } from 'stream';\nimport { createCancelablePromise, Sequencer } from '../common/async.js';\nimport { CancellationToken } from '../common/cancellation.js';\nimport * as path from '../common/path.js';\nimport { assertReturnsDefined } from '../common/types.js';\nimport { Promises } from './pfs.js';\nimport * as nls from '../../nls.js';\nimport type { Entry, ZipFile } from 'yauzl';\n\nexport const CorruptZipMessage: string = 'end of central directory record signature not found';\nconst CORRUPT_ZIP_PATTERN = new RegExp(CorruptZipMessage);\n\nexport interface IExtractOptions {\n\toverwrite?: boolean;\n\n\t/**\n\t * Source path within the ZIP archive. Only the files contained in this\n\t * path will be extracted.\n\t */\n\tsourcePath?: string;\n}\n\ninterface IOptions {\n\tsourcePathRegex: RegExp;\n}\n\nexport type ExtractErrorType = 'CorruptZip' | 'Incomplete';\n\nexport class ExtractError extends Error {\n\n\treadonly type?: ExtractErrorType;\n\n\tconstructor(type: ExtractErrorType | undefined, cause: Error) {\n\t\tlet message = cause.message;\n\n\t\tswitch (type) {\n\t\t\tcase 'CorruptZip': message = `Corrupt ZIP: ${message}`; break;\n\t\t}\n\n\t\tsuper(message);\n\t\tthis.type = type;\n\t\tthis.cause = cause;\n\t}\n}\n\nfunction modeFromEntry(entry: Entry) {\n\tconst attr = entry.externalFileAttributes >> 16 || 33188;\n\n\treturn [448 /* S_IRWXU */, 56 /* S_IRWXG */, 7 /* S_IRWXO */]\n\t\t.map(mask => attr & mask)\n\t\t.reduce((a, b) => a + b, attr & 61440 /* S_IFMT */);\n}\n\nfunction toExtractError(err: Error): ExtractError {\n\tif (err instanceof ExtractError) {\n\t\treturn err;\n\t}\n\n\tlet type: ExtractErrorType | undefined = undefined;\n\n\tif (CORRUPT_ZIP_PATTERN.test(err.message)) {\n\t\ttype = 'CorruptZip';\n\t}\n\n\treturn new ExtractError(type, err);\n}\n\nfunction extractEntry(stream: Readable, fileName: string, mode: number, targetPath: string, options: IOptions, token: CancellationToken): Promise<void> {\n\tconst dirName = path.dirname(fileName);\n\tconst targetDirName = path.join(targetPath, dirName);\n\tif (!targetDirName.startsWith(targetPath)) {\n\t\treturn Promise.reject(new Error(nls.localize('invalid file', \"Error extracting {0}. Invalid file.\", fileName)));\n\t}\n\tconst targetFileName = path.join(targetPath, fileName);\n\n\tlet istream: WriteStream;\n\n\ttoken.onCancellationRequested(() => {\n\t\tistream?.destroy();\n\t});\n\n\treturn Promise.resolve(promises.mkdir(targetDirName, { recursive: true })).then(() => new Promise<void>((c, e) => {\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tistream = createWriteStream(targetFileName, { mode });\n\t\t\tistream.once('close', () => c());\n\t\t\tistream.once('error', e);\n\t\t\tstream.once('error', e);\n\t\t\tstream.pipe(istream);\n\t\t} catch (error) {\n\t\t\te(error);\n\t\t}\n\t}));\n}\n\nfunction extractZip(zipfile: ZipFile, targetPath: string, options: IOptions, token: CancellationToken): Promise<void> {\n\tlet last = createCancelablePromise<void>(() => Promise.resolve());\n\tlet extractedEntriesCount = 0;\n\n\tconst listener = token.onCancellationRequested(() => {\n\t\tlast.cancel();\n\t\tzipfile.close();\n\t});\n\n\treturn new Promise<void>((c, e) => {\n\t\tconst throttler = new Sequencer();\n\n\t\tconst readNextEntry = (token: CancellationToken) => {\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\textractedEntriesCount++;\n\t\t\tzipfile.readEntry();\n\t\t};\n\n\t\tzipfile.once('error', e);\n\t\tzipfile.once('close', () => last.then(() => {\n\t\t\tif (token.isCancellationRequested || zipfile.entryCount === extractedEntriesCount) {\n\t\t\t\tc();\n\t\t\t} else {\n\t\t\t\te(new ExtractError('Incomplete', new Error(nls.localize('incompleteExtract', \"Incomplete. Found {0} of {1} entries\", extractedEntriesCount, zipfile.entryCount))));\n\t\t\t}\n\t\t}, e));\n\t\tzipfile.readEntry();\n\t\tzipfile.on('entry', (entry: Entry) => {\n\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!options.sourcePathRegex.test(entry.fileName)) {\n\t\t\t\treadNextEntry(token);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileName = entry.fileName.replace(options.sourcePathRegex, '');\n\n\t\t\t// directory file names end with '/'\n\t\t\tif (/\\/$/.test(fileName)) {\n\t\t\t\tconst targetFileName = path.join(targetPath, fileName);\n\t\t\t\tlast = createCancelablePromise(token => promises.mkdir(targetFileName, { recursive: true }).then(() => readNextEntry(token)).then(undefined, e));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst stream = openZipStream(zipfile, entry);\n\t\t\tconst mode = modeFromEntry(entry);\n\n\t\t\tlast = createCancelablePromise(token => throttler.queue(() => stream.then(stream => extractEntry(stream, fileName, mode, targetPath, options, token).then(() => readNextEntry(token)))).then(null, e));\n\t\t});\n\t}).finally(() => listener.dispose());\n}\n\nasync function openZip(zipFile: string, lazy: boolean = false): Promise<ZipFile> {\n\tconst { open } = await import('yauzl');\n\n\treturn new Promise<ZipFile>((resolve, reject) => {\n\t\topen(zipFile, lazy ? { lazyEntries: true } : undefined!, (error: Error | null, zipfile?: ZipFile) => {\n\t\t\tif (error) {\n\t\t\t\treject(toExtractError(error));\n\t\t\t} else {\n\t\t\t\tresolve(assertReturnsDefined(zipfile));\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction openZipStream(zipFile: ZipFile, entry: Entry): Promise<Readable> {\n\treturn new Promise<Readable>((resolve, reject) => {\n\t\tzipFile.openReadStream(entry, (error: Error | null, stream?: Readable) => {\n\t\t\tif (error) {\n\t\t\t\treject(toExtractError(error));\n\t\t\t} else {\n\t\t\t\tresolve(assertReturnsDefined(stream));\n\t\t\t}\n\t\t});\n\t});\n}\n\nexport interface IFile {\n\tpath: string;\n\tcontents?: Buffer | string;\n\tlocalPath?: string;\n}\n\nexport async function zip(zipPath: string, files: IFile[]): Promise<string> {\n\tconst { ZipFile } = await import('yazl');\n\n\treturn new Promise<string>((c, e) => {\n\t\tconst zip = new ZipFile();\n\t\tfiles.forEach(f => {\n\t\t\tif (f.contents) {\n\t\t\t\tzip.addBuffer(typeof f.contents === 'string' ? Buffer.from(f.contents, 'utf8') : f.contents, f.path);\n\t\t\t} else if (f.localPath) {\n\t\t\t\tzip.addFile(f.localPath, f.path);\n\t\t\t}\n\t\t});\n\t\tzip.end();\n\n\t\tconst zipStream = createWriteStream(zipPath);\n\t\tzip.outputStream.pipe(zipStream);\n\n\t\tzip.outputStream.once('error', e);\n\t\tzipStream.once('error', e);\n\t\tzipStream.once('finish', () => c(zipPath));\n\t});\n}\n\nexport function extract(zipPath: string, targetPath: string, options: IExtractOptions = {}, token: CancellationToken): Promise<void> {\n\tconst sourcePathRegex = new RegExp(options.sourcePath ? `^${options.sourcePath}` : '');\n\n\tlet promise = openZip(zipPath, true);\n\n\tif (options.overwrite) {\n\t\tpromise = promise.then(zipfile => Promises.rm(targetPath).then(() => zipfile));\n\t}\n\n\treturn promise.then(zipfile => extractZip(zipfile, targetPath, { sourcePathRegex }, token));\n}\n\nfunction read(zipPath: string, filePath: string): Promise<Readable> {\n\treturn openZip(zipPath).then(zipfile => {\n\t\treturn new Promise<Readable>((c, e) => {\n\t\t\tzipfile.on('entry', (entry: Entry) => {\n\t\t\t\tif (entry.fileName === filePath) {\n\t\t\t\t\topenZipStream(zipfile, entry).then(stream => c(stream), err => e(err));\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tzipfile.once('close', () => e(new Error(nls.localize('notFound', \"{0} not found inside zip.\", filePath))));\n\t\t});\n\t});\n}\n\nexport function buffer(zipPath: string, filePath: string): Promise<Buffer> {\n\treturn read(zipPath, filePath).then(stream => {\n\t\treturn new Promise<Buffer>((c, e) => {\n\t\t\tconst buffers: Buffer[] = [];\n\t\t\tstream.once('error', e);\n\t\t\tstream.on('data', (b: Buffer) => buffers.push(b));\n\t\t\tstream.on('end', () => c(Buffer.concat(buffers)));\n\t\t});\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const IDownloadService = createDecorator<IDownloadService>('downloadService');\n\nexport interface IDownloadService {\n\n\treadonly _serviceBrand: undefined;\n\n\tdownload(uri: URI, to: URI, cancellationToken?: CancellationToken): Promise<void>;\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// allow-any-unicode-comment-file\n\n/**\n * Gets alternative Korean characters for the character code. This will return the ascii\n * character code(s) that a Hangul character may have been input with using a qwerty layout.\n *\n * This only aims to cover modern (not archaic) Hangul syllables.\n *\n * @param code The character code to get alternate characters for\n */\nexport function getKoreanAltChars(code: number): ArrayLike<number> | undefined {\n\tconst result = disassembleKorean(code);\n\tif (result && result.length > 0) {\n\t\treturn new Uint32Array(result);\n\t}\n\treturn undefined;\n}\n\nlet codeBufferLength = 0;\nconst codeBuffer = new Uint32Array(10);\nfunction disassembleKorean(code: number): Uint32Array | undefined {\n\tcodeBufferLength = 0;\n\n\t// Initial consonants (초성)\n\tgetCodesFromArray(code, modernConsonants, HangulRangeStartCode.InitialConsonant);\n\tif (codeBufferLength > 0) {\n\t\treturn codeBuffer.subarray(0, codeBufferLength);\n\t}\n\n\t// Vowels (중성)\n\tgetCodesFromArray(code, modernVowels, HangulRangeStartCode.Vowel);\n\tif (codeBufferLength > 0) {\n\t\treturn codeBuffer.subarray(0, codeBufferLength);\n\t}\n\n\t// Final consonants (종성)\n\tgetCodesFromArray(code, modernFinalConsonants, HangulRangeStartCode.FinalConsonant);\n\tif (codeBufferLength > 0) {\n\t\treturn codeBuffer.subarray(0, codeBufferLength);\n\t}\n\n\t// Hangul Compatibility Jamo\n\tgetCodesFromArray(code, compatibilityJamo, HangulRangeStartCode.CompatibilityJamo);\n\tif (codeBufferLength) {\n\t\treturn codeBuffer.subarray(0, codeBufferLength);\n\t}\n\n\t// Hangul Syllables\n\tif (code >= 0xAC00 && code <= 0xD7A3) {\n\t\tconst hangulIndex = code - 0xAC00;\n\t\tconst vowelAndFinalConsonantProduct = hangulIndex % 588;\n\n\t\t// 0-based starting at 0x1100\n\t\tconst initialConsonantIndex = Math.floor(hangulIndex / 588);\n\t\t// 0-based starting at 0x1161\n\t\tconst vowelIndex = Math.floor(vowelAndFinalConsonantProduct / 28);\n\t\t// 0-based starting at 0x11A8\n\t\t// Subtract 1 as the standard algorithm uses the 0 index to represent no\n\t\t// final consonant\n\t\tconst finalConsonantIndex = vowelAndFinalConsonantProduct % 28 - 1;\n\n\t\tif (initialConsonantIndex < modernConsonants.length) {\n\t\t\tgetCodesFromArray(initialConsonantIndex, modernConsonants, 0);\n\t\t} else if (HangulRangeStartCode.InitialConsonant + initialConsonantIndex - HangulRangeStartCode.CompatibilityJamo < compatibilityJamo.length) {\n\t\t\tgetCodesFromArray(HangulRangeStartCode.InitialConsonant + initialConsonantIndex, compatibilityJamo, HangulRangeStartCode.CompatibilityJamo);\n\t\t}\n\n\t\tif (vowelIndex < modernVowels.length) {\n\t\t\tgetCodesFromArray(vowelIndex, modernVowels, 0);\n\t\t} else if (HangulRangeStartCode.Vowel + vowelIndex - HangulRangeStartCode.CompatibilityJamo < compatibilityJamo.length) {\n\t\t\tgetCodesFromArray(HangulRangeStartCode.Vowel + vowelIndex - HangulRangeStartCode.CompatibilityJamo, compatibilityJamo, HangulRangeStartCode.CompatibilityJamo);\n\t\t}\n\n\t\tif (finalConsonantIndex >= 0) {\n\t\t\tif (finalConsonantIndex < modernFinalConsonants.length) {\n\t\t\t\tgetCodesFromArray(finalConsonantIndex, modernFinalConsonants, 0);\n\t\t\t} else if (HangulRangeStartCode.FinalConsonant + finalConsonantIndex - HangulRangeStartCode.CompatibilityJamo < compatibilityJamo.length) {\n\t\t\t\tgetCodesFromArray(HangulRangeStartCode.FinalConsonant + finalConsonantIndex - HangulRangeStartCode.CompatibilityJamo, compatibilityJamo, HangulRangeStartCode.CompatibilityJamo);\n\t\t\t}\n\t\t}\n\n\t\tif (codeBufferLength > 0) {\n\t\t\treturn codeBuffer.subarray(0, codeBufferLength);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction getCodesFromArray(code: number, array: ArrayLike<number>, arrayStartIndex: number): void {\n\t// Verify the code is within the array's range\n\tif (code >= arrayStartIndex && code < arrayStartIndex + array.length) {\n\t\taddCodesToBuffer(array[code - arrayStartIndex]);\n\t}\n}\n\nfunction addCodesToBuffer(codes: number): void {\n\t// NUL is ignored, this is used for archaic characters to avoid using a Map\n\t// for the data\n\tif (codes === AsciiCode.NUL) {\n\t\treturn;\n\t}\n\t// Number stored in format: OptionalThirdCode << 16 | OptionalSecondCode << 8 | Code\n\tcodeBuffer[codeBufferLength++] = codes & 0xFF;\n\tif (codes >> 8) {\n\t\tcodeBuffer[codeBufferLength++] = (codes >> 8) & 0xFF;\n\t}\n\tif (codes >> 16) {\n\t\tcodeBuffer[codeBufferLength++] = (codes >> 16) & 0xFF;\n\t}\n}\n\nconst enum HangulRangeStartCode {\n\tInitialConsonant = 0x1100,\n\tVowel = 0x1161,\n\tFinalConsonant = 0x11A8,\n\tCompatibilityJamo = 0x3131,\n}\n\nconst enum AsciiCode {\n\tNUL = 0,\n\tA = 65,\n\tB = 66,\n\tC = 67,\n\tD = 68,\n\tE = 69,\n\tF = 70,\n\tG = 71,\n\tH = 72,\n\tI = 73,\n\tJ = 74,\n\tK = 75,\n\tL = 76,\n\tM = 77,\n\tN = 78,\n\tO = 79,\n\tP = 80,\n\tQ = 81,\n\tR = 82,\n\tS = 83,\n\tT = 84,\n\tU = 85,\n\tV = 86,\n\tW = 87,\n\tX = 88,\n\tY = 89,\n\tZ = 90,\n\ta = 97,\n\tb = 98,\n\tc = 99,\n\td = 100,\n\te = 101,\n\tf = 102,\n\tg = 103,\n\th = 104,\n\ti = 105,\n\tj = 106,\n\tk = 107,\n\tl = 108,\n\tm = 109,\n\tn = 110,\n\to = 111,\n\tp = 112,\n\tq = 113,\n\tr = 114,\n\ts = 115,\n\tt = 116,\n\tu = 117,\n\tv = 118,\n\tw = 119,\n\tx = 120,\n\ty = 121,\n\tz = 122,\n}\n\n/**\n * Numbers that represent multiple ascii codes. These are precomputed at compile time to reduce\n * bundle and runtime overhead.\n */\nconst enum AsciiCodeCombo {\n\tfa = AsciiCode.a << 8 | AsciiCode.f,\n\tfg = AsciiCode.g << 8 | AsciiCode.f,\n\tfq = AsciiCode.q << 8 | AsciiCode.f,\n\tfr = AsciiCode.r << 8 | AsciiCode.f,\n\tft = AsciiCode.t << 8 | AsciiCode.f,\n\tfv = AsciiCode.v << 8 | AsciiCode.f,\n\tfx = AsciiCode.x << 8 | AsciiCode.f,\n\thk = AsciiCode.k << 8 | AsciiCode.h,\n\thl = AsciiCode.l << 8 | AsciiCode.h,\n\tho = AsciiCode.o << 8 | AsciiCode.h,\n\tml = AsciiCode.l << 8 | AsciiCode.m,\n\tnj = AsciiCode.j << 8 | AsciiCode.n,\n\tnl = AsciiCode.l << 8 | AsciiCode.n,\n\tnp = AsciiCode.p << 8 | AsciiCode.n,\n\tqt = AsciiCode.t << 8 | AsciiCode.q,\n\trt = AsciiCode.t << 8 | AsciiCode.r,\n\tsg = AsciiCode.g << 8 | AsciiCode.s,\n\tsw = AsciiCode.w << 8 | AsciiCode.s,\n}\n\n/**\n * Hangul Jamo - Modern consonants #1\n *\n * Range U+1100..U+1112\n *\n * |        | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |\n * |--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|\n * | U+110x | ᄀ | ᄁ | ᄂ | ᄃ | ᄄ | ᄅ | ᄆ | ᄇ | ᄈ | ᄉ | ᄊ | ᄋ | ᄌ | ᄍ | ᄎ | ᄏ |\n * | U+111x | ᄐ | ᄑ | ᄒ |\n */\nconst modernConsonants = new Uint8Array([\n\tAsciiCode.r, // ㄱ\n\tAsciiCode.R, // ㄲ\n\tAsciiCode.s, // ㄴ\n\tAsciiCode.e, // ㄷ\n\tAsciiCode.E, // ㄸ\n\tAsciiCode.f, // ㄹ\n\tAsciiCode.a, // ㅁ\n\tAsciiCode.q, // ㅂ\n\tAsciiCode.Q, // ㅃ\n\tAsciiCode.t, // ㅅ\n\tAsciiCode.T, // ㅆ\n\tAsciiCode.d, // ㅇ\n\tAsciiCode.w, // ㅈ\n\tAsciiCode.W, // ㅉ\n\tAsciiCode.c, // ㅊ\n\tAsciiCode.z, // ㅋ\n\tAsciiCode.x, // ㅌ\n\tAsciiCode.v, // ㅍ\n\tAsciiCode.g, // ㅎ\n]);\n\n/**\n * Hangul Jamo - Modern Vowels\n *\n * Range U+1161..U+1175\n *\n * |        | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |\n * |--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|\n * | U+116x |   | ᅡ | ᅢ | ᅣ | ᅤ | ᅥ | ᅦ | ᅧ | ᅨ | ᅩ | ᅪ | ᅫ | ᅬ | ᅭ | ᅮ | ᅯ |\n * | U+117x | ᅰ | ᅱ | ᅲ | ᅳ | ᅴ | ᅵ |\n */\nconst modernVowels = new Uint16Array([\n\tAsciiCode.k,       //  -> ㅏ\n\tAsciiCode.o,       //  -> ㅐ\n\tAsciiCode.i,       //  -> ㅑ\n\tAsciiCode.O,       //  -> ㅒ\n\tAsciiCode.j,       //  -> ㅓ\n\tAsciiCode.p,       //  -> ㅔ\n\tAsciiCode.u,       //  -> ㅕ\n\tAsciiCode.P,       //  -> ㅖ\n\tAsciiCode.h,       //  -> ㅗ\n\tAsciiCodeCombo.hk, //  -> ㅘ\n\tAsciiCodeCombo.ho, //  -> ㅙ\n\tAsciiCodeCombo.hl, //  -> ㅚ\n\tAsciiCode.y,       //  -> ㅛ\n\tAsciiCode.n,       //  -> ㅜ\n\tAsciiCodeCombo.nj, //  -> ㅝ\n\tAsciiCodeCombo.np, //  -> ㅞ\n\tAsciiCodeCombo.nl, //  -> ㅟ\n\tAsciiCode.b,       //  -> ㅠ\n\tAsciiCode.m,       //  -> ㅡ\n\tAsciiCodeCombo.ml, //  -> ㅢ\n\tAsciiCode.l,       //  -> ㅣ\n]);\n\n/**\n * Hangul Jamo - Modern Consonants #2\n *\n * Range U+11A8..U+11C2\n *\n * |        | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |\n * |--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|\n * | U+11Ax |   |   |   |   |   |   |   |   | ᆨ | ᆩ | ᆪ | ᆫ | ᆬ | ᆭ | ᆮ | ᆯ |\n * | U+11Bx | ᆰ | ᆱ | ᆲ | ᆳ | ᆴ | ᆵ | ᆶ | ᆷ | ᆸ | ᆹ | ᆺ | ᆻ | ᆼ | ᆽ | ᆾ | ᆿ |\n * | U+11Cx | ᇀ | ᇁ | ᇂ |\n */\nconst modernFinalConsonants = new Uint16Array([\n\tAsciiCode.r,       // ㄱ\n\tAsciiCode.R,       // ㄲ\n\tAsciiCodeCombo.rt, // ㄳ\n\tAsciiCode.s,       // ㄴ\n\tAsciiCodeCombo.sw, // ㄵ\n\tAsciiCodeCombo.sg, // ㄶ\n\tAsciiCode.e,       // ㄷ\n\tAsciiCode.f,       // ㄹ\n\tAsciiCodeCombo.fr, // ㄺ\n\tAsciiCodeCombo.fa, // ㄻ\n\tAsciiCodeCombo.fq, // ㄼ\n\tAsciiCodeCombo.ft, // ㄽ\n\tAsciiCodeCombo.fx, // ㄾ\n\tAsciiCodeCombo.fv, // ㄿ\n\tAsciiCodeCombo.fg, // ㅀ\n\tAsciiCode.a,       // ㅁ\n\tAsciiCode.q,       // ㅂ\n\tAsciiCodeCombo.qt, // ㅄ\n\tAsciiCode.t,       // ㅅ\n\tAsciiCode.T,       // ㅆ\n\tAsciiCode.d,       // ㅇ\n\tAsciiCode.w,       // ㅈ\n\tAsciiCode.c,       // ㅊ\n\tAsciiCode.z,       // ㅋ\n\tAsciiCode.x,       // ㅌ\n\tAsciiCode.v,       // ㅍ\n\tAsciiCode.g,       // ㅎ\n]);\n\n/**\n * Hangul Compatibility Jamo\n *\n * Range U+3131..U+318F\n *\n * This includes range includes archaic jamo which we don't consider, these are\n * given the NUL character code in order to be ignored.\n *\n * |        | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |\n * |--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|\n * | U+313x |   | ㄱ | ㄲ | ㄳ | ㄴ | ㄵ | ㄶ | ㄷ | ㄸ | ㄹ | ㄺ | ㄻ | ㄼ | ㄽ | ㄾ | ㄿ |\n * | U+314x | ㅀ | ㅁ | ㅂ | ㅃ | ㅄ | ㅅ | ㅆ | ㅇ | ㅈ | ㅉ | ㅊ | ㅋ | ㅌ | ㅍ | ㅎ | ㅏ |\n * | U+315x | ㅐ | ㅑ | ㅒ | ㅓ | ㅔ | ㅕ | ㅖ | ㅗ | ㅘ | ㅙ | ㅚ | ㅛ | ㅜ | ㅝ | ㅞ | ㅟ |\n * | U+316x | ㅠ | ㅡ | ㅢ | ㅣ | HF | ㅥ | ㅦ | ㅧ | ㅨ | ㅩ | ㅪ | ㅫ | ㅬ | ㅭ | ㅮ | ㅯ |\n * | U+317x | ㅰ | ㅱ | ㅲ | ㅳ | ㅴ | ㅵ | ㅶ | ㅷ | ㅸ | ㅹ | ㅺ | ㅻ | ㅼ | ㅽ | ㅾ | ㅿ |\n * | U+318x | ㆀ | ㆁ | ㆂ | ㆃ | ㆄ | ㆅ | ㆆ | ㆇ | ㆈ | ㆉ | ㆊ | ㆋ | ㆌ | ㆍ | ㆎ |\n */\nconst compatibilityJamo = new Uint16Array([\n\tAsciiCode.r,        // ㄱ\n\tAsciiCode.R,        // ㄲ\n\tAsciiCodeCombo.rt,  // ㄳ\n\tAsciiCode.s,        // ㄴ\n\tAsciiCodeCombo.sw,  // ㄵ\n\tAsciiCodeCombo.sg,  // ㄶ\n\tAsciiCode.e,        // ㄷ\n\tAsciiCode.E,        // ㄸ\n\tAsciiCode.f,        // ㄹ\n\tAsciiCodeCombo.fr,  // ㄺ\n\tAsciiCodeCombo.fa,  // ㄻ\n\tAsciiCodeCombo.fq,  // ㄼ\n\tAsciiCodeCombo.ft,  // ㄽ\n\tAsciiCodeCombo.fx,  // ㄾ\n\tAsciiCodeCombo.fv,  // ㄿ\n\tAsciiCodeCombo.fg,  // ㅀ\n\tAsciiCode.a,        // ㅁ\n\tAsciiCode.q,        // ㅂ\n\tAsciiCode.Q,        // ㅃ\n\tAsciiCodeCombo.qt,  // ㅄ\n\tAsciiCode.t,        // ㅅ\n\tAsciiCode.T,        // ㅆ\n\tAsciiCode.d,        // ㅇ\n\tAsciiCode.w,        // ㅈ\n\tAsciiCode.W,        // ㅉ\n\tAsciiCode.c,        // ㅊ\n\tAsciiCode.z,        // ㅋ\n\tAsciiCode.x,        // ㅌ\n\tAsciiCode.v,        // ㅍ\n\tAsciiCode.g,        // ㅎ\n\tAsciiCode.k,        // ㅏ\n\tAsciiCode.o,        // ㅐ\n\tAsciiCode.i,        // ㅑ\n\tAsciiCode.O,        // ㅒ\n\tAsciiCode.j,        // ㅓ\n\tAsciiCode.p,        // ㅔ\n\tAsciiCode.u,        // ㅕ\n\tAsciiCode.P,        // ㅖ\n\tAsciiCode.h,        // ㅗ\n\tAsciiCodeCombo.hk,  // ㅘ\n\tAsciiCodeCombo.ho,  // ㅙ\n\tAsciiCodeCombo.hl,  // ㅚ\n\tAsciiCode.y,        // ㅛ\n\tAsciiCode.n,        // ㅜ\n\tAsciiCodeCombo.nj,  // ㅝ\n\tAsciiCodeCombo.np,  // ㅞ\n\tAsciiCodeCombo.nl,  // ㅟ\n\tAsciiCode.b,        // ㅠ\n\tAsciiCode.m,        // ㅡ\n\tAsciiCodeCombo.ml,  // ㅢ\n\tAsciiCode.l,        // ㅣ\n\t// HF: Hangul Filler (everything after this is archaic)\n\t// ㅥ\n\t// ㅦ\n\t// ㅧ\n\t// ㅨ\n\t// ㅩ\n\t// ㅪ\n\t// ㅫ\n\t// ㅬ\n\t// ㅮ\n\t// ㅯ\n\t// ㅰ\n\t// ㅱ\n\t// ㅲ\n\t// ㅳ\n\t// ㅴ\n\t// ㅵ\n\t// ㅶ\n\t// ㅷ\n\t// ㅸ\n\t// ㅹ\n\t// ㅺ\n\t// ㅻ\n\t// ㅼ\n\t// ㅽ\n\t// ㅾ\n\t// ㅿ\n\t// ㆀ\n\t// ㆁ\n\t// ㆂ\n\t// ㆃ\n\t// ㆄ\n\t// ㆅ\n\t// ㆆ\n\t// ㆇ\n\t// ㆈ\n\t// ㆉ\n\t// ㆊ\n\t// ㆋ\n\t// ㆌ\n\t// ㆍ\n\t// ㆎ\n]);\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from './charCode.js';\nimport { LRUCache } from './map.js';\nimport { getKoreanAltChars } from './naturalLanguage/korean.js';\nimport * as strings from './strings.js';\n\nexport interface IFilter {\n\t// Returns null if word doesn't match.\n\t(word: string, wordToMatchAgainst: string): IMatch[] | null;\n}\n\nexport interface IMatch {\n\tstart: number;\n\tend: number;\n}\n\n// Combined filters\n\n/**\n * @returns A filter which combines the provided set\n * of filters with an or. The *first* filters that\n * matches defined the return value of the returned\n * filter.\n */\nexport function or(...filter: IFilter[]): IFilter {\n\treturn function (word: string, wordToMatchAgainst: string): IMatch[] | null {\n\t\tfor (let i = 0, len = filter.length; i < len; i++) {\n\t\t\tconst match = filter[i](word, wordToMatchAgainst);\n\t\t\tif (match) {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t};\n}\n\n// Prefix\n\nexport const matchesStrictPrefix: IFilter = _matchesPrefix.bind(undefined, false);\nexport const matchesPrefix: IFilter = _matchesPrefix.bind(undefined, true);\n\nfunction _matchesPrefix(ignoreCase: boolean, word: string, wordToMatchAgainst: string): IMatch[] | null {\n\tif (!wordToMatchAgainst || wordToMatchAgainst.length < word.length) {\n\t\treturn null;\n\t}\n\n\tlet matches: boolean;\n\tif (ignoreCase) {\n\t\tmatches = strings.startsWithIgnoreCase(wordToMatchAgainst, word);\n\t} else {\n\t\tmatches = wordToMatchAgainst.indexOf(word) === 0;\n\t}\n\n\tif (!matches) {\n\t\treturn null;\n\t}\n\n\treturn word.length > 0 ? [{ start: 0, end: word.length }] : [];\n}\n\n// Contiguous Substring\n\nexport function matchesContiguousSubString(word: string, wordToMatchAgainst: string): IMatch[] | null {\n\tconst index = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase());\n\tif (index === -1) {\n\t\treturn null;\n\t}\n\n\treturn [{ start: index, end: index + word.length }];\n}\n\n// Substring\n\nexport function matchesSubString(word: string, wordToMatchAgainst: string): IMatch[] | null {\n\treturn _matchesSubString(word.toLowerCase(), wordToMatchAgainst.toLowerCase(), 0, 0);\n}\n\nfunction _matchesSubString(word: string, wordToMatchAgainst: string, i: number, j: number): IMatch[] | null {\n\tif (i === word.length) {\n\t\treturn [];\n\t} else if (j === wordToMatchAgainst.length) {\n\t\treturn null;\n\t} else {\n\t\tif (word[i] === wordToMatchAgainst[j]) {\n\t\t\tlet result: IMatch[] | null = null;\n\t\t\tif (result = _matchesSubString(word, wordToMatchAgainst, i + 1, j + 1)) {\n\t\t\t\treturn join({ start: j, end: j + 1 }, result);\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\treturn _matchesSubString(word, wordToMatchAgainst, i, j + 1);\n\t}\n}\n\n// CamelCase\n\nfunction isLower(code: number): boolean {\n\treturn CharCode.a <= code && code <= CharCode.z;\n}\n\nexport function isUpper(code: number): boolean {\n\treturn CharCode.A <= code && code <= CharCode.Z;\n}\n\nfunction isNumber(code: number): boolean {\n\treturn CharCode.Digit0 <= code && code <= CharCode.Digit9;\n}\n\nfunction isWhitespace(code: number): boolean {\n\treturn (\n\t\tcode === CharCode.Space\n\t\t|| code === CharCode.Tab\n\t\t|| code === CharCode.LineFeed\n\t\t|| code === CharCode.CarriageReturn\n\t);\n}\n\nconst wordSeparators = new Set<number>();\n// These are chosen as natural word separators based on writen text.\n// It is a subset of the word separators used by the monaco editor.\n'()[]{}<>`\\'\"-/;:,.?!'\n\t.split('')\n\t.forEach(s => wordSeparators.add(s.charCodeAt(0)));\n\nfunction isWordSeparator(code: number): boolean {\n\treturn isWhitespace(code) || wordSeparators.has(code);\n}\n\nfunction charactersMatch(codeA: number, codeB: number): boolean {\n\treturn (codeA === codeB) || (isWordSeparator(codeA) && isWordSeparator(codeB));\n}\n\nconst alternateCharsCache: Map<number, ArrayLike<number> | undefined> = new Map();\n/**\n * Gets alternative codes to the character code passed in. This comes in the\n * form of an array of character codes, all of which must match _in order_ to\n * successfully match.\n *\n * @param code The character code to check.\n */\nfunction getAlternateCodes(code: number): ArrayLike<number> | undefined {\n\tif (alternateCharsCache.has(code)) {\n\t\treturn alternateCharsCache.get(code);\n\t}\n\n\t// NOTE: This function is written in such a way that it can be extended in\n\t// the future, but right now the return type takes into account it's only\n\t// supported by a single \"alt codes provider\".\n\t// `ArrayLike<ArrayLike<number>>` is a more appropriate type if changed.\n\tlet result: ArrayLike<number> | undefined;\n\tconst codes = getKoreanAltChars(code);\n\tif (codes) {\n\t\tresult = codes;\n\t}\n\n\talternateCharsCache.set(code, result);\n\treturn result;\n}\n\nfunction isAlphanumeric(code: number): boolean {\n\treturn isLower(code) || isUpper(code) || isNumber(code);\n}\n\nfunction join(head: IMatch, tail: IMatch[]): IMatch[] {\n\tif (tail.length === 0) {\n\t\ttail = [head];\n\t} else if (head.end === tail[0].start) {\n\t\ttail[0].start = head.start;\n\t} else {\n\t\ttail.unshift(head);\n\t}\n\treturn tail;\n}\n\nfunction nextAnchor(camelCaseWord: string, start: number): number {\n\tfor (let i = start; i < camelCaseWord.length; i++) {\n\t\tconst c = camelCaseWord.charCodeAt(i);\n\t\tif (isUpper(c) || isNumber(c) || (i > 0 && !isAlphanumeric(camelCaseWord.charCodeAt(i - 1)))) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn camelCaseWord.length;\n}\n\nfunction _matchesCamelCase(word: string, camelCaseWord: string, i: number, j: number): IMatch[] | null {\n\tif (i === word.length) {\n\t\treturn [];\n\t} else if (j === camelCaseWord.length) {\n\t\treturn null;\n\t} else if (word[i] !== camelCaseWord[j].toLowerCase()) {\n\t\treturn null;\n\t} else {\n\t\tlet result: IMatch[] | null = null;\n\t\tlet nextUpperIndex = j + 1;\n\t\tresult = _matchesCamelCase(word, camelCaseWord, i + 1, j + 1);\n\t\twhile (!result && (nextUpperIndex = nextAnchor(camelCaseWord, nextUpperIndex)) < camelCaseWord.length) {\n\t\t\tresult = _matchesCamelCase(word, camelCaseWord, i + 1, nextUpperIndex);\n\t\t\tnextUpperIndex++;\n\t\t}\n\t\treturn result === null ? null : join({ start: j, end: j + 1 }, result);\n\t}\n}\n\ninterface ICamelCaseAnalysis {\n\tupperPercent: number;\n\tlowerPercent: number;\n\talphaPercent: number;\n\tnumericPercent: number;\n}\n\n// Heuristic to avoid computing camel case matcher for words that don't\n// look like camelCaseWords.\nfunction analyzeCamelCaseWord(word: string): ICamelCaseAnalysis {\n\tlet upper = 0, lower = 0, alpha = 0, numeric = 0, code = 0;\n\n\tfor (let i = 0; i < word.length; i++) {\n\t\tcode = word.charCodeAt(i);\n\n\t\tif (isUpper(code)) { upper++; }\n\t\tif (isLower(code)) { lower++; }\n\t\tif (isAlphanumeric(code)) { alpha++; }\n\t\tif (isNumber(code)) { numeric++; }\n\t}\n\n\tconst upperPercent = upper / word.length;\n\tconst lowerPercent = lower / word.length;\n\tconst alphaPercent = alpha / word.length;\n\tconst numericPercent = numeric / word.length;\n\n\treturn { upperPercent, lowerPercent, alphaPercent, numericPercent };\n}\n\nfunction isUpperCaseWord(analysis: ICamelCaseAnalysis): boolean {\n\tconst { upperPercent, lowerPercent } = analysis;\n\treturn lowerPercent === 0 && upperPercent > 0.6;\n}\n\nfunction isCamelCaseWord(analysis: ICamelCaseAnalysis): boolean {\n\tconst { upperPercent, lowerPercent, alphaPercent, numericPercent } = analysis;\n\treturn lowerPercent > 0.2 && upperPercent < 0.8 && alphaPercent > 0.6 && numericPercent < 0.2;\n}\n\n// Heuristic to avoid computing camel case matcher for words that don't\n// look like camel case patterns.\nfunction isCamelCasePattern(word: string): boolean {\n\tlet upper = 0, lower = 0, code = 0, whitespace = 0;\n\n\tfor (let i = 0; i < word.length; i++) {\n\t\tcode = word.charCodeAt(i);\n\n\t\tif (isUpper(code)) { upper++; }\n\t\tif (isLower(code)) { lower++; }\n\t\tif (isWhitespace(code)) { whitespace++; }\n\t}\n\n\tif ((upper === 0 || lower === 0) && whitespace === 0) {\n\t\treturn word.length <= 30;\n\t} else {\n\t\treturn upper <= 5;\n\t}\n}\n\nexport function matchesCamelCase(word: string, camelCaseWord: string): IMatch[] | null {\n\tif (!camelCaseWord) {\n\t\treturn null;\n\t}\n\n\tcamelCaseWord = camelCaseWord.trim();\n\n\tif (camelCaseWord.length === 0) {\n\t\treturn null;\n\t}\n\n\tif (!isCamelCasePattern(word)) {\n\t\treturn null;\n\t}\n\n\t// TODO: Consider removing this check\n\tif (camelCaseWord.length > 60) {\n\t\tcamelCaseWord = camelCaseWord.substring(0, 60);\n\t}\n\n\tconst analysis = analyzeCamelCaseWord(camelCaseWord);\n\n\tif (!isCamelCaseWord(analysis)) {\n\t\tif (!isUpperCaseWord(analysis)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tcamelCaseWord = camelCaseWord.toLowerCase();\n\t}\n\n\tlet result: IMatch[] | null = null;\n\tlet i = 0;\n\n\tword = word.toLowerCase();\n\twhile (i < camelCaseWord.length && (result = _matchesCamelCase(word, camelCaseWord, 0, i)) === null) {\n\t\ti = nextAnchor(camelCaseWord, i + 1);\n\t}\n\n\treturn result;\n}\n\n// Matches beginning of words supporting non-ASCII languages\n// If `contiguous` is true then matches word with beginnings of the words in the target. E.g. \"pul\" will match \"Git: Pull\"\n// Otherwise also matches sub string of the word with beginnings of the words in the target. E.g. \"gp\" or \"g p\" will match \"Git: Pull\"\n// Useful in cases where the target is words (e.g. command labels)\n\nexport function matchesWords(word: string, target: string, contiguous: boolean = false): IMatch[] | null {\n\tif (!target || target.length === 0) {\n\t\treturn null;\n\t}\n\n\tlet result: IMatch[] | null = null;\n\tlet targetIndex = 0;\n\n\tword = word.toLowerCase();\n\ttarget = target.toLowerCase();\n\twhile (targetIndex < target.length) {\n\t\tresult = _matchesWords(word, target, 0, targetIndex, contiguous);\n\t\tif (result !== null) {\n\t\t\tbreak;\n\t\t}\n\t\ttargetIndex = nextWord(target, targetIndex + 1);\n\t}\n\n\treturn result;\n}\n\nfunction _matchesWords(word: string, target: string, wordIndex: number, targetIndex: number, contiguous: boolean): IMatch[] | null {\n\tlet targetIndexOffset = 0;\n\n\tif (wordIndex === word.length) {\n\t\treturn [];\n\t} else if (targetIndex === target.length) {\n\t\treturn null;\n\t} else if (!charactersMatch(word.charCodeAt(wordIndex), target.charCodeAt(targetIndex))) {\n\t\t// Verify alternate characters before exiting\n\t\tconst altChars = getAlternateCodes(word.charCodeAt(wordIndex));\n\t\tif (!altChars) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let k = 0; k < altChars.length; k++) {\n\t\t\tif (!charactersMatch(altChars[k], target.charCodeAt(targetIndex + k))) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\ttargetIndexOffset += altChars.length - 1;\n\t}\n\n\tlet result: IMatch[] | null = null;\n\tlet nextWordIndex = targetIndex + targetIndexOffset + 1;\n\tresult = _matchesWords(word, target, wordIndex + 1, nextWordIndex, contiguous);\n\tif (!contiguous) {\n\t\twhile (!result && (nextWordIndex = nextWord(target, nextWordIndex)) < target.length) {\n\t\t\tresult = _matchesWords(word, target, wordIndex + 1, nextWordIndex, contiguous);\n\t\t\tnextWordIndex++;\n\t\t}\n\t}\n\n\tif (!result) {\n\t\treturn null;\n\t}\n\n\t// If the characters don't exactly match, then they must be word separators (see charactersMatch(...)).\n\t// We don't want to include this in the matches but we don't want to throw the target out all together so we return `result`.\n\tif (word.charCodeAt(wordIndex) !== target.charCodeAt(targetIndex)) {\n\t\t// Verify alternate characters before exiting\n\t\tconst altChars = getAlternateCodes(word.charCodeAt(wordIndex));\n\t\tif (!altChars) {\n\t\t\treturn result;\n\t\t}\n\t\tfor (let k = 0; k < altChars.length; k++) {\n\t\t\tif (altChars[k] !== target.charCodeAt(targetIndex + k)) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn join({ start: targetIndex, end: targetIndex + targetIndexOffset + 1 }, result);\n}\n\nfunction nextWord(word: string, start: number): number {\n\tfor (let i = start; i < word.length; i++) {\n\t\tif (isWordSeparator(word.charCodeAt(i)) ||\n\t\t\t(i > 0 && isWordSeparator(word.charCodeAt(i - 1)))) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn word.length;\n}\n\n// Fuzzy\n\nconst fuzzyContiguousFilter = or(matchesPrefix, matchesCamelCase, matchesContiguousSubString);\nconst fuzzySeparateFilter = or(matchesPrefix, matchesCamelCase, matchesSubString);\nconst fuzzyRegExpCache = new LRUCache<string, RegExp>(10000); // bounded to 10000 elements\n\nexport function matchesFuzzy(word: string, wordToMatchAgainst: string, enableSeparateSubstringMatching = false): IMatch[] | null {\n\tif (typeof word !== 'string' || typeof wordToMatchAgainst !== 'string') {\n\t\treturn null; // return early for invalid input\n\t}\n\n\t// Form RegExp for wildcard matches\n\tlet regexp = fuzzyRegExpCache.get(word);\n\tif (!regexp) {\n\t\tregexp = new RegExp(strings.convertSimple2RegExpPattern(word), 'i');\n\t\tfuzzyRegExpCache.set(word, regexp);\n\t}\n\n\t// RegExp Filter\n\tconst match = regexp.exec(wordToMatchAgainst);\n\tif (match) {\n\t\treturn [{ start: match.index, end: match.index + match[0].length }];\n\t}\n\n\t// Default Filter\n\treturn enableSeparateSubstringMatching ? fuzzySeparateFilter(word, wordToMatchAgainst) : fuzzyContiguousFilter(word, wordToMatchAgainst);\n}\n\n/**\n * Match pattern against word in a fuzzy way. As in IntelliSense and faster and more\n * powerful than `matchesFuzzy`\n */\nexport function matchesFuzzy2(pattern: string, word: string): IMatch[] | null {\n\tconst score = fuzzyScore(pattern, pattern.toLowerCase(), 0, word, word.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true });\n\treturn score ? createMatches(score) : null;\n}\n\nexport function anyScore(pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number): FuzzyScore {\n\tconst max = Math.min(13, pattern.length);\n\tfor (; patternPos < max; patternPos++) {\n\t\tconst result = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, { firstMatchCanBeWeak: true, boostFullMatch: true });\n\t\tif (result) {\n\t\t\treturn result;\n\t\t}\n\t}\n\treturn [0, wordPos];\n}\n\n//#region --- fuzzyScore ---\n\nexport function createMatches(score: undefined | FuzzyScore): IMatch[] {\n\tif (typeof score === 'undefined') {\n\t\treturn [];\n\t}\n\tconst res: IMatch[] = [];\n\tconst wordPos = score[1];\n\tfor (let i = score.length - 1; i > 1; i--) {\n\t\tconst pos = score[i] + wordPos;\n\t\tconst last = res[res.length - 1];\n\t\tif (last && last.end === pos) {\n\t\t\tlast.end = pos + 1;\n\t\t} else {\n\t\t\tres.push({ start: pos, end: pos + 1 });\n\t\t}\n\t}\n\treturn res;\n}\n\nconst _maxLen = 128;\n\nfunction initTable() {\n\tconst table: number[][] = [];\n\tconst row: number[] = [];\n\tfor (let i = 0; i <= _maxLen; i++) {\n\t\trow[i] = 0;\n\t}\n\tfor (let i = 0; i <= _maxLen; i++) {\n\t\ttable.push(row.slice(0));\n\t}\n\treturn table;\n}\n\nfunction initArr(maxLen: number) {\n\tconst row: number[] = [];\n\tfor (let i = 0; i <= maxLen; i++) {\n\t\trow[i] = 0;\n\t}\n\treturn row;\n}\n\nconst _minWordMatchPos = initArr(2 * _maxLen); // min word position for a certain pattern position\nconst _maxWordMatchPos = initArr(2 * _maxLen); // max word position for a certain pattern position\nconst _diag = initTable(); // the length of a contiguous diagonal match\nconst _table = initTable();\nconst _arrows = <Arrow[][]>initTable();\nconst _debug = false;\n\nfunction printTable(table: number[][], pattern: string, patternLen: number, word: string, wordLen: number): string {\n\tfunction pad(s: string, n: number, pad = ' ') {\n\t\twhile (s.length < n) {\n\t\t\ts = pad + s;\n\t\t}\n\t\treturn s;\n\t}\n\tlet ret = ` |   |${word.split('').map(c => pad(c, 3)).join('|')}\\n`;\n\n\tfor (let i = 0; i <= patternLen; i++) {\n\t\tif (i === 0) {\n\t\t\tret += ' |';\n\t\t} else {\n\t\t\tret += `${pattern[i - 1]}|`;\n\t\t}\n\t\tret += table[i].slice(0, wordLen + 1).map(n => pad(n.toString(), 3)).join('|') + '\\n';\n\t}\n\treturn ret;\n}\n\nfunction printTables(pattern: string, patternStart: number, word: string, wordStart: number): void {\n\tpattern = pattern.substr(patternStart);\n\tword = word.substr(wordStart);\n\tconsole.log(printTable(_table, pattern, pattern.length, word, word.length));\n\tconsole.log(printTable(_arrows, pattern, pattern.length, word, word.length));\n\tconsole.log(printTable(_diag, pattern, pattern.length, word, word.length));\n}\n\nfunction isSeparatorAtPos(value: string, index: number): boolean {\n\tif (index < 0 || index >= value.length) {\n\t\treturn false;\n\t}\n\tconst code = value.codePointAt(index);\n\tswitch (code) {\n\t\tcase CharCode.Underline:\n\t\tcase CharCode.Dash:\n\t\tcase CharCode.Period:\n\t\tcase CharCode.Space:\n\t\tcase CharCode.Slash:\n\t\tcase CharCode.Backslash:\n\t\tcase CharCode.SingleQuote:\n\t\tcase CharCode.DoubleQuote:\n\t\tcase CharCode.Colon:\n\t\tcase CharCode.DollarSign:\n\t\tcase CharCode.LessThan:\n\t\tcase CharCode.GreaterThan:\n\t\tcase CharCode.OpenParen:\n\t\tcase CharCode.CloseParen:\n\t\tcase CharCode.OpenSquareBracket:\n\t\tcase CharCode.CloseSquareBracket:\n\t\tcase CharCode.OpenCurlyBrace:\n\t\tcase CharCode.CloseCurlyBrace:\n\t\t\treturn true;\n\t\tcase undefined:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\tif (strings.isEmojiImprecise(code)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t}\n}\n\nfunction isWhitespaceAtPos(value: string, index: number): boolean {\n\tif (index < 0 || index >= value.length) {\n\t\treturn false;\n\t}\n\tconst code = value.charCodeAt(index);\n\tswitch (code) {\n\t\tcase CharCode.Space:\n\t\tcase CharCode.Tab:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nfunction isUpperCaseAtPos(pos: number, word: string, wordLow: string): boolean {\n\treturn word[pos] !== wordLow[pos];\n}\n\nexport function isPatternInWord(patternLow: string, patternPos: number, patternLen: number, wordLow: string, wordPos: number, wordLen: number, fillMinWordPosArr = false): boolean {\n\twhile (patternPos < patternLen && wordPos < wordLen) {\n\t\tif (patternLow[patternPos] === wordLow[wordPos]) {\n\t\t\tif (fillMinWordPosArr) {\n\t\t\t\t// Remember the min word position for each pattern position\n\t\t\t\t_minWordMatchPos[patternPos] = wordPos;\n\t\t\t}\n\t\t\tpatternPos += 1;\n\t\t}\n\t\twordPos += 1;\n\t}\n\treturn patternPos === patternLen; // pattern must be exhausted\n}\n\nconst enum Arrow { Diag = 1, Left = 2, LeftLeft = 3 }\n\n/**\n * An array representing a fuzzy match.\n *\n * 0. the score\n * 1. the offset at which matching started\n * 2. `<match_pos_N>`\n * 3. `<match_pos_1>`\n * 4. `<match_pos_0>` etc\n */\nexport type FuzzyScore = [score: number, wordStart: number, ...matches: number[]];\n\nexport namespace FuzzyScore {\n\t/**\n\t * No matches and value `-100`\n\t */\n\texport const Default: FuzzyScore = ([-100, 0]);\n\n\texport function isDefault(score?: FuzzyScore): score is [-100, 0] {\n\t\treturn !score || (score.length === 2 && score[0] === -100 && score[1] === 0);\n\t}\n}\n\nexport abstract class FuzzyScoreOptions {\n\n\tstatic default = { boostFullMatch: true, firstMatchCanBeWeak: false };\n\n\tconstructor(\n\t\treadonly firstMatchCanBeWeak: boolean,\n\t\treadonly boostFullMatch: boolean,\n\t) { }\n}\n\nexport interface FuzzyScorer {\n\t(pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number, options?: FuzzyScoreOptions): FuzzyScore | undefined;\n}\n\nexport function fuzzyScore(pattern: string, patternLow: string, patternStart: number, word: string, wordLow: string, wordStart: number, options: FuzzyScoreOptions = FuzzyScoreOptions.default): FuzzyScore | undefined {\n\n\tconst patternLen = pattern.length > _maxLen ? _maxLen : pattern.length;\n\tconst wordLen = word.length > _maxLen ? _maxLen : word.length;\n\n\tif (patternStart >= patternLen || wordStart >= wordLen || (patternLen - patternStart) > (wordLen - wordStart)) {\n\t\treturn undefined;\n\t}\n\n\t// Run a simple check if the characters of pattern occur\n\t// (in order) at all in word. If that isn't the case we\n\t// stop because no match will be possible\n\tif (!isPatternInWord(patternLow, patternStart, patternLen, wordLow, wordStart, wordLen, true)) {\n\t\treturn undefined;\n\t}\n\n\t// Find the max matching word position for each pattern position\n\t// NOTE: the min matching word position was filled in above, in the `isPatternInWord` call\n\t_fillInMaxWordMatchPos(patternLen, wordLen, patternStart, wordStart, patternLow, wordLow);\n\n\tlet row: number = 1;\n\tlet column: number = 1;\n\tlet patternPos = patternStart;\n\tlet wordPos = wordStart;\n\n\tconst hasStrongFirstMatch = [false];\n\n\t// There will be a match, fill in tables\n\tfor (row = 1, patternPos = patternStart; patternPos < patternLen; row++, patternPos++) {\n\n\t\t// Reduce search space to possible matching word positions and to possible access from next row\n\t\tconst minWordMatchPos = _minWordMatchPos[patternPos];\n\t\tconst maxWordMatchPos = _maxWordMatchPos[patternPos];\n\t\tconst nextMaxWordMatchPos = (patternPos + 1 < patternLen ? _maxWordMatchPos[patternPos + 1] : wordLen);\n\n\t\tfor (column = minWordMatchPos - wordStart + 1, wordPos = minWordMatchPos; wordPos < nextMaxWordMatchPos; column++, wordPos++) {\n\n\t\t\tlet score = Number.MIN_SAFE_INTEGER;\n\t\t\tlet canComeDiag = false;\n\n\t\t\tif (wordPos <= maxWordMatchPos) {\n\t\t\t\tscore = _doScore(\n\t\t\t\t\tpattern, patternLow, patternPos, patternStart,\n\t\t\t\t\tword, wordLow, wordPos, wordLen, wordStart,\n\t\t\t\t\t_diag[row - 1][column - 1] === 0,\n\t\t\t\t\thasStrongFirstMatch\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tlet diagScore = 0;\n\t\t\tif (score !== Number.MIN_SAFE_INTEGER) {\n\t\t\t\tcanComeDiag = true;\n\t\t\t\tdiagScore = score + _table[row - 1][column - 1];\n\t\t\t}\n\n\t\t\tconst canComeLeft = wordPos > minWordMatchPos;\n\t\t\tconst leftScore = canComeLeft ? _table[row][column - 1] + (_diag[row][column - 1] > 0 ? -5 : 0) : 0; // penalty for a gap start\n\n\t\t\tconst canComeLeftLeft = wordPos > minWordMatchPos + 1 && _diag[row][column - 1] > 0;\n\t\t\tconst leftLeftScore = canComeLeftLeft ? _table[row][column - 2] + (_diag[row][column - 2] > 0 ? -5 : 0) : 0; // penalty for a gap start\n\n\t\t\tif (canComeLeftLeft && (!canComeLeft || leftLeftScore >= leftScore) && (!canComeDiag || leftLeftScore >= diagScore)) {\n\t\t\t\t// always prefer choosing left left to jump over a diagonal because that means a match is earlier in the word\n\t\t\t\t_table[row][column] = leftLeftScore;\n\t\t\t\t_arrows[row][column] = Arrow.LeftLeft;\n\t\t\t\t_diag[row][column] = 0;\n\t\t\t} else if (canComeLeft && (!canComeDiag || leftScore >= diagScore)) {\n\t\t\t\t// always prefer choosing left since that means a match is earlier in the word\n\t\t\t\t_table[row][column] = leftScore;\n\t\t\t\t_arrows[row][column] = Arrow.Left;\n\t\t\t\t_diag[row][column] = 0;\n\t\t\t} else if (canComeDiag) {\n\t\t\t\t_table[row][column] = diagScore;\n\t\t\t\t_arrows[row][column] = Arrow.Diag;\n\t\t\t\t_diag[row][column] = _diag[row - 1][column - 1] + 1;\n\t\t\t} else {\n\t\t\t\tthrow new Error(`not possible`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (_debug) {\n\t\tprintTables(pattern, patternStart, word, wordStart);\n\t}\n\n\tif (!hasStrongFirstMatch[0] && !options.firstMatchCanBeWeak) {\n\t\treturn undefined;\n\t}\n\n\trow--;\n\tcolumn--;\n\n\tconst result: FuzzyScore = [_table[row][column], wordStart];\n\n\tlet backwardsDiagLength = 0;\n\tlet maxMatchColumn = 0;\n\n\twhile (row >= 1) {\n\t\t// Find the column where we go diagonally up\n\t\tlet diagColumn = column;\n\t\tdo {\n\t\t\tconst arrow = _arrows[row][diagColumn];\n\t\t\tif (arrow === Arrow.LeftLeft) {\n\t\t\t\tdiagColumn = diagColumn - 2;\n\t\t\t} else if (arrow === Arrow.Left) {\n\t\t\t\tdiagColumn = diagColumn - 1;\n\t\t\t} else {\n\t\t\t\t// found the diagonal\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} while (diagColumn >= 1);\n\n\t\t// Overturn the \"forwards\" decision if keeping the \"backwards\" diagonal would give a better match\n\t\tif (\n\t\t\tbackwardsDiagLength > 1 // only if we would have a contiguous match of 3 characters\n\t\t\t&& patternLow[patternStart + row - 1] === wordLow[wordStart + column - 1] // only if we can do a contiguous match diagonally\n\t\t\t&& !isUpperCaseAtPos(diagColumn + wordStart - 1, word, wordLow) // only if the forwards chose diagonal is not an uppercase\n\t\t\t&& backwardsDiagLength + 1 > _diag[row][diagColumn] // only if our contiguous match would be longer than the \"forwards\" contiguous match\n\t\t) {\n\t\t\tdiagColumn = column;\n\t\t}\n\n\t\tif (diagColumn === column) {\n\t\t\t// this is a contiguous match\n\t\t\tbackwardsDiagLength++;\n\t\t} else {\n\t\t\tbackwardsDiagLength = 1;\n\t\t}\n\n\t\tif (!maxMatchColumn) {\n\t\t\t// remember the last matched column\n\t\t\tmaxMatchColumn = diagColumn;\n\t\t}\n\n\t\trow--;\n\t\tcolumn = diagColumn - 1;\n\t\tresult.push(column);\n\t}\n\n\tif (wordLen - wordStart === patternLen && options.boostFullMatch) {\n\t\t// the word matches the pattern with all characters!\n\t\t// giving the score a total match boost (to come up ahead other words)\n\t\tresult[0] += 2;\n\t}\n\n\t// Add 1 penalty for each skipped character in the word\n\tconst skippedCharsCount = maxMatchColumn - patternLen;\n\tresult[0] -= skippedCharsCount;\n\n\treturn result;\n}\n\nfunction _fillInMaxWordMatchPos(patternLen: number, wordLen: number, patternStart: number, wordStart: number, patternLow: string, wordLow: string) {\n\tlet patternPos = patternLen - 1;\n\tlet wordPos = wordLen - 1;\n\twhile (patternPos >= patternStart && wordPos >= wordStart) {\n\t\tif (patternLow[patternPos] === wordLow[wordPos]) {\n\t\t\t_maxWordMatchPos[patternPos] = wordPos;\n\t\t\tpatternPos--;\n\t\t}\n\t\twordPos--;\n\t}\n}\n\nfunction _doScore(\n\tpattern: string, patternLow: string, patternPos: number, patternStart: number,\n\tword: string, wordLow: string, wordPos: number, wordLen: number, wordStart: number,\n\tnewMatchStart: boolean,\n\toutFirstMatchStrong: boolean[],\n): number {\n\tif (patternLow[patternPos] !== wordLow[wordPos]) {\n\t\treturn Number.MIN_SAFE_INTEGER;\n\t}\n\n\tlet score = 1;\n\tlet isGapLocation = false;\n\tif (wordPos === (patternPos - patternStart)) {\n\t\t// common prefix: `foobar <-> foobaz`\n\t\t//                            ^^^^^\n\t\tscore = pattern[patternPos] === word[wordPos] ? 7 : 5;\n\n\t} else if (isUpperCaseAtPos(wordPos, word, wordLow) && (wordPos === 0 || !isUpperCaseAtPos(wordPos - 1, word, wordLow))) {\n\t\t// hitting upper-case: `foo <-> forOthers`\n\t\t//                              ^^ ^\n\t\tscore = pattern[patternPos] === word[wordPos] ? 7 : 5;\n\t\tisGapLocation = true;\n\n\t} else if (isSeparatorAtPos(wordLow, wordPos) && (wordPos === 0 || !isSeparatorAtPos(wordLow, wordPos - 1))) {\n\t\t// hitting a separator: `. <-> foo.bar`\n\t\t//                                ^\n\t\tscore = 5;\n\n\t} else if (isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1)) {\n\t\t// post separator: `foo <-> bar_foo`\n\t\t//                              ^^^\n\t\tscore = 5;\n\t\tisGapLocation = true;\n\t}\n\n\tif (score > 1 && patternPos === patternStart) {\n\t\toutFirstMatchStrong[0] = true;\n\t}\n\n\tif (!isGapLocation) {\n\t\tisGapLocation = isUpperCaseAtPos(wordPos, word, wordLow) || isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1);\n\t}\n\n\t//\n\tif (patternPos === patternStart) { // first character in pattern\n\t\tif (wordPos > wordStart) {\n\t\t\t// the first pattern character would match a word character that is not at the word start\n\t\t\t// so introduce a penalty to account for the gap preceding this match\n\t\t\tscore -= isGapLocation ? 3 : 5;\n\t\t}\n\t} else {\n\t\tif (newMatchStart) {\n\t\t\t// this would be the beginning of a new match (i.e. there would be a gap before this location)\n\t\t\tscore += isGapLocation ? 2 : 0;\n\t\t} else {\n\t\t\t// this is part of a contiguous match, so give it a slight bonus, but do so only if it would not be a preferred gap location\n\t\t\tscore += isGapLocation ? 0 : 1;\n\t\t}\n\t}\n\n\tif (wordPos + 1 === wordLen) {\n\t\t// we always penalize gaps, but this gives unfair advantages to a match that would match the last character in the word\n\t\t// so pretend there is a gap after the last character in the word to normalize things\n\t\tscore -= isGapLocation ? 3 : 5;\n\t}\n\n\treturn score;\n}\n\n//#endregion\n\n\n//#region --- graceful ---\n\nexport function fuzzyScoreGracefulAggressive(pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number, options?: FuzzyScoreOptions): FuzzyScore | undefined {\n\treturn fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, true, options);\n}\n\nexport function fuzzyScoreGraceful(pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number, options?: FuzzyScoreOptions): FuzzyScore | undefined {\n\treturn fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, false, options);\n}\n\nfunction fuzzyScoreWithPermutations(pattern: string, lowPattern: string, patternPos: number, word: string, lowWord: string, wordPos: number, aggressive: boolean, options?: FuzzyScoreOptions): FuzzyScore | undefined {\n\tlet top = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, options);\n\n\tif (top && !aggressive) {\n\t\t// when using the original pattern yield a result we`\n\t\t// return it unless we are aggressive and try to find\n\t\t// a better alignment, e.g. `cno` -> `^co^ns^ole` or `^c^o^nsole`.\n\t\treturn top;\n\t}\n\n\tif (pattern.length >= 3) {\n\t\t// When the pattern is long enough then try a few (max 7)\n\t\t// permutations of the pattern to find a better match. The\n\t\t// permutations only swap neighbouring characters, e.g\n\t\t// `cnoso` becomes `conso`, `cnsoo`, `cnoos`.\n\t\tconst tries = Math.min(7, pattern.length - 1);\n\t\tfor (let movingPatternPos = patternPos + 1; movingPatternPos < tries; movingPatternPos++) {\n\t\t\tconst newPattern = nextTypoPermutation(pattern, movingPatternPos);\n\t\t\tif (newPattern) {\n\t\t\t\tconst candidate = fuzzyScore(newPattern, newPattern.toLowerCase(), patternPos, word, lowWord, wordPos, options);\n\t\t\t\tif (candidate) {\n\t\t\t\t\tcandidate[0] -= 3; // permutation penalty\n\t\t\t\t\tif (!top || candidate[0] > top[0]) {\n\t\t\t\t\t\ttop = candidate;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn top;\n}\n\nfunction nextTypoPermutation(pattern: string, patternPos: number): string | undefined {\n\n\tif (patternPos + 1 >= pattern.length) {\n\t\treturn undefined;\n\t}\n\n\tconst swap1 = pattern[patternPos];\n\tconst swap2 = pattern[patternPos + 1];\n\n\tif (swap1 === swap2) {\n\t\treturn undefined;\n\t}\n\n\treturn pattern.slice(0, patternPos)\n\t\t+ swap2\n\t\t+ swap1\n\t\t+ pattern.slice(patternPos + 2);\n}\n\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { ThemeIcon } from './themables.js';\nimport { isString } from './types.js';\n\n\nconst _codiconFontCharacters: { [id: string]: number } = Object.create(null);\n\nexport function register(id: string, fontCharacter: number | string): ThemeIcon {\n\tif (isString(fontCharacter)) {\n\t\tconst val = _codiconFontCharacters[fontCharacter];\n\t\tif (val === undefined) {\n\t\t\tthrow new Error(`${id} references an unknown codicon: ${fontCharacter}`);\n\t\t}\n\t\tfontCharacter = val;\n\t}\n\t_codiconFontCharacters[id] = fontCharacter;\n\treturn { id };\n}\n\n/**\n * Only to be used by the iconRegistry.\n */\nexport function getCodiconFontCharacters(): { [id: string]: number } {\n\treturn _codiconFontCharacters;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { register } from './codiconsUtil.js';\n\n\n// This file is automatically generated by (microsoft/vscode-codicons)/scripts/export-to-ts.js\n// Please don't edit it, as your changes will be overwritten.\n// Instead, add mappings to codiconsDerived in codicons.ts.\nexport const codiconsLibrary = {\n\tadd: register('add', 0xea60),\n\tplus: register('plus', 0xea60),\n\tgistNew: register('gist-new', 0xea60),\n\trepoCreate: register('repo-create', 0xea60),\n\tlightbulb: register('lightbulb', 0xea61),\n\tlightBulb: register('light-bulb', 0xea61),\n\trepo: register('repo', 0xea62),\n\trepoDelete: register('repo-delete', 0xea62),\n\tgistFork: register('gist-fork', 0xea63),\n\trepoForked: register('repo-forked', 0xea63),\n\tgitPullRequest: register('git-pull-request', 0xea64),\n\tgitPullRequestAbandoned: register('git-pull-request-abandoned', 0xea64),\n\trecordKeys: register('record-keys', 0xea65),\n\tkeyboard: register('keyboard', 0xea65),\n\ttag: register('tag', 0xea66),\n\tgitPullRequestLabel: register('git-pull-request-label', 0xea66),\n\ttagAdd: register('tag-add', 0xea66),\n\ttagRemove: register('tag-remove', 0xea66),\n\tperson: register('person', 0xea67),\n\tpersonFollow: register('person-follow', 0xea67),\n\tpersonOutline: register('person-outline', 0xea67),\n\tpersonFilled: register('person-filled', 0xea67),\n\tgitBranch: register('git-branch', 0xea68),\n\tgitBranchCreate: register('git-branch-create', 0xea68),\n\tgitBranchDelete: register('git-branch-delete', 0xea68),\n\tsourceControl: register('source-control', 0xea68),\n\tmirror: register('mirror', 0xea69),\n\tmirrorPublic: register('mirror-public', 0xea69),\n\tstar: register('star', 0xea6a),\n\tstarAdd: register('star-add', 0xea6a),\n\tstarDelete: register('star-delete', 0xea6a),\n\tstarEmpty: register('star-empty', 0xea6a),\n\tcomment: register('comment', 0xea6b),\n\tcommentAdd: register('comment-add', 0xea6b),\n\talert: register('alert', 0xea6c),\n\twarning: register('warning', 0xea6c),\n\tsearch: register('search', 0xea6d),\n\tsearchSave: register('search-save', 0xea6d),\n\tlogOut: register('log-out', 0xea6e),\n\tsignOut: register('sign-out', 0xea6e),\n\tlogIn: register('log-in', 0xea6f),\n\tsignIn: register('sign-in', 0xea6f),\n\teye: register('eye', 0xea70),\n\teyeUnwatch: register('eye-unwatch', 0xea70),\n\teyeWatch: register('eye-watch', 0xea70),\n\tcircleFilled: register('circle-filled', 0xea71),\n\tprimitiveDot: register('primitive-dot', 0xea71),\n\tcloseDirty: register('close-dirty', 0xea71),\n\tdebugBreakpoint: register('debug-breakpoint', 0xea71),\n\tdebugBreakpointDisabled: register('debug-breakpoint-disabled', 0xea71),\n\tdebugHint: register('debug-hint', 0xea71),\n\tterminalDecorationSuccess: register('terminal-decoration-success', 0xea71),\n\tprimitiveSquare: register('primitive-square', 0xea72),\n\tedit: register('edit', 0xea73),\n\tpencil: register('pencil', 0xea73),\n\tinfo: register('info', 0xea74),\n\tissueOpened: register('issue-opened', 0xea74),\n\tgistPrivate: register('gist-private', 0xea75),\n\tgitForkPrivate: register('git-fork-private', 0xea75),\n\tlock: register('lock', 0xea75),\n\tmirrorPrivate: register('mirror-private', 0xea75),\n\tclose: register('close', 0xea76),\n\tremoveClose: register('remove-close', 0xea76),\n\tx: register('x', 0xea76),\n\trepoSync: register('repo-sync', 0xea77),\n\tsync: register('sync', 0xea77),\n\tclone: register('clone', 0xea78),\n\tdesktopDownload: register('desktop-download', 0xea78),\n\tbeaker: register('beaker', 0xea79),\n\tmicroscope: register('microscope', 0xea79),\n\tvm: register('vm', 0xea7a),\n\tdeviceDesktop: register('device-desktop', 0xea7a),\n\tfile: register('file', 0xea7b),\n\tfileText: register('file-text', 0xea7b),\n\tmore: register('more', 0xea7c),\n\tellipsis: register('ellipsis', 0xea7c),\n\tkebabHorizontal: register('kebab-horizontal', 0xea7c),\n\tmailReply: register('mail-reply', 0xea7d),\n\treply: register('reply', 0xea7d),\n\torganization: register('organization', 0xea7e),\n\torganizationFilled: register('organization-filled', 0xea7e),\n\torganizationOutline: register('organization-outline', 0xea7e),\n\tnewFile: register('new-file', 0xea7f),\n\tfileAdd: register('file-add', 0xea7f),\n\tnewFolder: register('new-folder', 0xea80),\n\tfileDirectoryCreate: register('file-directory-create', 0xea80),\n\ttrash: register('trash', 0xea81),\n\ttrashcan: register('trashcan', 0xea81),\n\thistory: register('history', 0xea82),\n\tclock: register('clock', 0xea82),\n\tfolder: register('folder', 0xea83),\n\tfileDirectory: register('file-directory', 0xea83),\n\tsymbolFolder: register('symbol-folder', 0xea83),\n\tlogoGithub: register('logo-github', 0xea84),\n\tmarkGithub: register('mark-github', 0xea84),\n\tgithub: register('github', 0xea84),\n\tterminal: register('terminal', 0xea85),\n\tconsole: register('console', 0xea85),\n\trepl: register('repl', 0xea85),\n\tzap: register('zap', 0xea86),\n\tsymbolEvent: register('symbol-event', 0xea86),\n\terror: register('error', 0xea87),\n\tstop: register('stop', 0xea87),\n\tvariable: register('variable', 0xea88),\n\tsymbolVariable: register('symbol-variable', 0xea88),\n\tarray: register('array', 0xea8a),\n\tsymbolArray: register('symbol-array', 0xea8a),\n\tsymbolModule: register('symbol-module', 0xea8b),\n\tsymbolPackage: register('symbol-package', 0xea8b),\n\tsymbolNamespace: register('symbol-namespace', 0xea8b),\n\tsymbolObject: register('symbol-object', 0xea8b),\n\tsymbolMethod: register('symbol-method', 0xea8c),\n\tsymbolFunction: register('symbol-function', 0xea8c),\n\tsymbolConstructor: register('symbol-constructor', 0xea8c),\n\tsymbolBoolean: register('symbol-boolean', 0xea8f),\n\tsymbolNull: register('symbol-null', 0xea8f),\n\tsymbolNumeric: register('symbol-numeric', 0xea90),\n\tsymbolNumber: register('symbol-number', 0xea90),\n\tsymbolStructure: register('symbol-structure', 0xea91),\n\tsymbolStruct: register('symbol-struct', 0xea91),\n\tsymbolParameter: register('symbol-parameter', 0xea92),\n\tsymbolTypeParameter: register('symbol-type-parameter', 0xea92),\n\tsymbolKey: register('symbol-key', 0xea93),\n\tsymbolText: register('symbol-text', 0xea93),\n\tsymbolReference: register('symbol-reference', 0xea94),\n\tgoToFile: register('go-to-file', 0xea94),\n\tsymbolEnum: register('symbol-enum', 0xea95),\n\tsymbolValue: register('symbol-value', 0xea95),\n\tsymbolRuler: register('symbol-ruler', 0xea96),\n\tsymbolUnit: register('symbol-unit', 0xea96),\n\tactivateBreakpoints: register('activate-breakpoints', 0xea97),\n\tarchive: register('archive', 0xea98),\n\tarrowBoth: register('arrow-both', 0xea99),\n\tarrowDown: register('arrow-down', 0xea9a),\n\tarrowLeft: register('arrow-left', 0xea9b),\n\tarrowRight: register('arrow-right', 0xea9c),\n\tarrowSmallDown: register('arrow-small-down', 0xea9d),\n\tarrowSmallLeft: register('arrow-small-left', 0xea9e),\n\tarrowSmallRight: register('arrow-small-right', 0xea9f),\n\tarrowSmallUp: register('arrow-small-up', 0xeaa0),\n\tarrowUp: register('arrow-up', 0xeaa1),\n\tbell: register('bell', 0xeaa2),\n\tbold: register('bold', 0xeaa3),\n\tbook: register('book', 0xeaa4),\n\tbookmark: register('bookmark', 0xeaa5),\n\tdebugBreakpointConditionalUnverified: register('debug-breakpoint-conditional-unverified', 0xeaa6),\n\tdebugBreakpointConditional: register('debug-breakpoint-conditional', 0xeaa7),\n\tdebugBreakpointConditionalDisabled: register('debug-breakpoint-conditional-disabled', 0xeaa7),\n\tdebugBreakpointDataUnverified: register('debug-breakpoint-data-unverified', 0xeaa8),\n\tdebugBreakpointData: register('debug-breakpoint-data', 0xeaa9),\n\tdebugBreakpointDataDisabled: register('debug-breakpoint-data-disabled', 0xeaa9),\n\tdebugBreakpointLogUnverified: register('debug-breakpoint-log-unverified', 0xeaaa),\n\tdebugBreakpointLog: register('debug-breakpoint-log', 0xeaab),\n\tdebugBreakpointLogDisabled: register('debug-breakpoint-log-disabled', 0xeaab),\n\tbriefcase: register('briefcase', 0xeaac),\n\tbroadcast: register('broadcast', 0xeaad),\n\tbrowser: register('browser', 0xeaae),\n\tbug: register('bug', 0xeaaf),\n\tcalendar: register('calendar', 0xeab0),\n\tcaseSensitive: register('case-sensitive', 0xeab1),\n\tcheck: register('check', 0xeab2),\n\tchecklist: register('checklist', 0xeab3),\n\tchevronDown: register('chevron-down', 0xeab4),\n\tchevronLeft: register('chevron-left', 0xeab5),\n\tchevronRight: register('chevron-right', 0xeab6),\n\tchevronUp: register('chevron-up', 0xeab7),\n\tchromeClose: register('chrome-close', 0xeab8),\n\tchromeMaximize: register('chrome-maximize', 0xeab9),\n\tchromeMinimize: register('chrome-minimize', 0xeaba),\n\tchromeRestore: register('chrome-restore', 0xeabb),\n\tcircleOutline: register('circle-outline', 0xeabc),\n\tcircle: register('circle', 0xeabc),\n\tdebugBreakpointUnverified: register('debug-breakpoint-unverified', 0xeabc),\n\tterminalDecorationIncomplete: register('terminal-decoration-incomplete', 0xeabc),\n\tcircleSlash: register('circle-slash', 0xeabd),\n\tcircuitBoard: register('circuit-board', 0xeabe),\n\tclearAll: register('clear-all', 0xeabf),\n\tclippy: register('clippy', 0xeac0),\n\tcloseAll: register('close-all', 0xeac1),\n\tcloudDownload: register('cloud-download', 0xeac2),\n\tcloudUpload: register('cloud-upload', 0xeac3),\n\tcode: register('code', 0xeac4),\n\tcollapseAll: register('collapse-all', 0xeac5),\n\tcolorMode: register('color-mode', 0xeac6),\n\tcommentDiscussion: register('comment-discussion', 0xeac7),\n\tcreditCard: register('credit-card', 0xeac9),\n\tdash: register('dash', 0xeacc),\n\tdashboard: register('dashboard', 0xeacd),\n\tdatabase: register('database', 0xeace),\n\tdebugContinue: register('debug-continue', 0xeacf),\n\tdebugDisconnect: register('debug-disconnect', 0xead0),\n\tdebugPause: register('debug-pause', 0xead1),\n\tdebugRestart: register('debug-restart', 0xead2),\n\tdebugStart: register('debug-start', 0xead3),\n\tdebugStepInto: register('debug-step-into', 0xead4),\n\tdebugStepOut: register('debug-step-out', 0xead5),\n\tdebugStepOver: register('debug-step-over', 0xead6),\n\tdebugStop: register('debug-stop', 0xead7),\n\tdebug: register('debug', 0xead8),\n\tdeviceCameraVideo: register('device-camera-video', 0xead9),\n\tdeviceCamera: register('device-camera', 0xeada),\n\tdeviceMobile: register('device-mobile', 0xeadb),\n\tdiffAdded: register('diff-added', 0xeadc),\n\tdiffIgnored: register('diff-ignored', 0xeadd),\n\tdiffModified: register('diff-modified', 0xeade),\n\tdiffRemoved: register('diff-removed', 0xeadf),\n\tdiffRenamed: register('diff-renamed', 0xeae0),\n\tdiff: register('diff', 0xeae1),\n\tdiffSidebyside: register('diff-sidebyside', 0xeae1),\n\tdiscard: register('discard', 0xeae2),\n\teditorLayout: register('editor-layout', 0xeae3),\n\temptyWindow: register('empty-window', 0xeae4),\n\texclude: register('exclude', 0xeae5),\n\textensions: register('extensions', 0xeae6),\n\teyeClosed: register('eye-closed', 0xeae7),\n\tfileBinary: register('file-binary', 0xeae8),\n\tfileCode: register('file-code', 0xeae9),\n\tfileMedia: register('file-media', 0xeaea),\n\tfilePdf: register('file-pdf', 0xeaeb),\n\tfileSubmodule: register('file-submodule', 0xeaec),\n\tfileSymlinkDirectory: register('file-symlink-directory', 0xeaed),\n\tfileSymlinkFile: register('file-symlink-file', 0xeaee),\n\tfileZip: register('file-zip', 0xeaef),\n\tfiles: register('files', 0xeaf0),\n\tfilter: register('filter', 0xeaf1),\n\tflame: register('flame', 0xeaf2),\n\tfoldDown: register('fold-down', 0xeaf3),\n\tfoldUp: register('fold-up', 0xeaf4),\n\tfold: register('fold', 0xeaf5),\n\tfolderActive: register('folder-active', 0xeaf6),\n\tfolderOpened: register('folder-opened', 0xeaf7),\n\tgear: register('gear', 0xeaf8),\n\tgift: register('gift', 0xeaf9),\n\tgistSecret: register('gist-secret', 0xeafa),\n\tgist: register('gist', 0xeafb),\n\tgitCommit: register('git-commit', 0xeafc),\n\tgitCompare: register('git-compare', 0xeafd),\n\tcompareChanges: register('compare-changes', 0xeafd),\n\tgitMerge: register('git-merge', 0xeafe),\n\tgithubAction: register('github-action', 0xeaff),\n\tgithubAlt: register('github-alt', 0xeb00),\n\tglobe: register('globe', 0xeb01),\n\tgrabber: register('grabber', 0xeb02),\n\tgraph: register('graph', 0xeb03),\n\tgripper: register('gripper', 0xeb04),\n\theart: register('heart', 0xeb05),\n\thome: register('home', 0xeb06),\n\thorizontalRule: register('horizontal-rule', 0xeb07),\n\thubot: register('hubot', 0xeb08),\n\tinbox: register('inbox', 0xeb09),\n\tissueReopened: register('issue-reopened', 0xeb0b),\n\tissues: register('issues', 0xeb0c),\n\titalic: register('italic', 0xeb0d),\n\tjersey: register('jersey', 0xeb0e),\n\tjson: register('json', 0xeb0f),\n\tkebabVertical: register('kebab-vertical', 0xeb10),\n\tkey: register('key', 0xeb11),\n\tlaw: register('law', 0xeb12),\n\tlightbulbAutofix: register('lightbulb-autofix', 0xeb13),\n\tlinkExternal: register('link-external', 0xeb14),\n\tlink: register('link', 0xeb15),\n\tlistOrdered: register('list-ordered', 0xeb16),\n\tlistUnordered: register('list-unordered', 0xeb17),\n\tliveShare: register('live-share', 0xeb18),\n\tloading: register('loading', 0xeb19),\n\tlocation: register('location', 0xeb1a),\n\tmailRead: register('mail-read', 0xeb1b),\n\tmail: register('mail', 0xeb1c),\n\tmarkdown: register('markdown', 0xeb1d),\n\tmegaphone: register('megaphone', 0xeb1e),\n\tmention: register('mention', 0xeb1f),\n\tmilestone: register('milestone', 0xeb20),\n\tgitPullRequestMilestone: register('git-pull-request-milestone', 0xeb20),\n\tmortarBoard: register('mortar-board', 0xeb21),\n\tmove: register('move', 0xeb22),\n\tmultipleWindows: register('multiple-windows', 0xeb23),\n\tmute: register('mute', 0xeb24),\n\tnoNewline: register('no-newline', 0xeb25),\n\tnote: register('note', 0xeb26),\n\toctoface: register('octoface', 0xeb27),\n\topenPreview: register('open-preview', 0xeb28),\n\tpackage: register('package', 0xeb29),\n\tpaintcan: register('paintcan', 0xeb2a),\n\tpin: register('pin', 0xeb2b),\n\tplay: register('play', 0xeb2c),\n\trun: register('run', 0xeb2c),\n\tplug: register('plug', 0xeb2d),\n\tpreserveCase: register('preserve-case', 0xeb2e),\n\tpreview: register('preview', 0xeb2f),\n\tproject: register('project', 0xeb30),\n\tpulse: register('pulse', 0xeb31),\n\tquestion: register('question', 0xeb32),\n\tquote: register('quote', 0xeb33),\n\tradioTower: register('radio-tower', 0xeb34),\n\treactions: register('reactions', 0xeb35),\n\treferences: register('references', 0xeb36),\n\trefresh: register('refresh', 0xeb37),\n\tregex: register('regex', 0xeb38),\n\tremoteExplorer: register('remote-explorer', 0xeb39),\n\tremote: register('remote', 0xeb3a),\n\tremove: register('remove', 0xeb3b),\n\treplaceAll: register('replace-all', 0xeb3c),\n\treplace: register('replace', 0xeb3d),\n\trepoClone: register('repo-clone', 0xeb3e),\n\trepoForcePush: register('repo-force-push', 0xeb3f),\n\trepoPull: register('repo-pull', 0xeb40),\n\trepoPush: register('repo-push', 0xeb41),\n\treport: register('report', 0xeb42),\n\trequestChanges: register('request-changes', 0xeb43),\n\trocket: register('rocket', 0xeb44),\n\trootFolderOpened: register('root-folder-opened', 0xeb45),\n\trootFolder: register('root-folder', 0xeb46),\n\trss: register('rss', 0xeb47),\n\truby: register('ruby', 0xeb48),\n\tsaveAll: register('save-all', 0xeb49),\n\tsaveAs: register('save-as', 0xeb4a),\n\tsave: register('save', 0xeb4b),\n\tscreenFull: register('screen-full', 0xeb4c),\n\tscreenNormal: register('screen-normal', 0xeb4d),\n\tsearchStop: register('search-stop', 0xeb4e),\n\tserver: register('server', 0xeb50),\n\tsettingsGear: register('settings-gear', 0xeb51),\n\tsettings: register('settings', 0xeb52),\n\tshield: register('shield', 0xeb53),\n\tsmiley: register('smiley', 0xeb54),\n\tsortPrecedence: register('sort-precedence', 0xeb55),\n\tsplitHorizontal: register('split-horizontal', 0xeb56),\n\tsplitVertical: register('split-vertical', 0xeb57),\n\tsquirrel: register('squirrel', 0xeb58),\n\tstarFull: register('star-full', 0xeb59),\n\tstarHalf: register('star-half', 0xeb5a),\n\tsymbolClass: register('symbol-class', 0xeb5b),\n\tsymbolColor: register('symbol-color', 0xeb5c),\n\tsymbolConstant: register('symbol-constant', 0xeb5d),\n\tsymbolEnumMember: register('symbol-enum-member', 0xeb5e),\n\tsymbolField: register('symbol-field', 0xeb5f),\n\tsymbolFile: register('symbol-file', 0xeb60),\n\tsymbolInterface: register('symbol-interface', 0xeb61),\n\tsymbolKeyword: register('symbol-keyword', 0xeb62),\n\tsymbolMisc: register('symbol-misc', 0xeb63),\n\tsymbolOperator: register('symbol-operator', 0xeb64),\n\tsymbolProperty: register('symbol-property', 0xeb65),\n\twrench: register('wrench', 0xeb65),\n\twrenchSubaction: register('wrench-subaction', 0xeb65),\n\tsymbolSnippet: register('symbol-snippet', 0xeb66),\n\ttasklist: register('tasklist', 0xeb67),\n\ttelescope: register('telescope', 0xeb68),\n\ttextSize: register('text-size', 0xeb69),\n\tthreeBars: register('three-bars', 0xeb6a),\n\tthumbsdown: register('thumbsdown', 0xeb6b),\n\tthumbsup: register('thumbsup', 0xeb6c),\n\ttools: register('tools', 0xeb6d),\n\ttriangleDown: register('triangle-down', 0xeb6e),\n\ttriangleLeft: register('triangle-left', 0xeb6f),\n\ttriangleRight: register('triangle-right', 0xeb70),\n\ttriangleUp: register('triangle-up', 0xeb71),\n\ttwitter: register('twitter', 0xeb72),\n\tunfold: register('unfold', 0xeb73),\n\tunlock: register('unlock', 0xeb74),\n\tunmute: register('unmute', 0xeb75),\n\tunverified: register('unverified', 0xeb76),\n\tverified: register('verified', 0xeb77),\n\tversions: register('versions', 0xeb78),\n\tvmActive: register('vm-active', 0xeb79),\n\tvmOutline: register('vm-outline', 0xeb7a),\n\tvmRunning: register('vm-running', 0xeb7b),\n\twatch: register('watch', 0xeb7c),\n\twhitespace: register('whitespace', 0xeb7d),\n\twholeWord: register('whole-word', 0xeb7e),\n\twindow: register('window', 0xeb7f),\n\twordWrap: register('word-wrap', 0xeb80),\n\tzoomIn: register('zoom-in', 0xeb81),\n\tzoomOut: register('zoom-out', 0xeb82),\n\tlistFilter: register('list-filter', 0xeb83),\n\tlistFlat: register('list-flat', 0xeb84),\n\tlistSelection: register('list-selection', 0xeb85),\n\tselection: register('selection', 0xeb85),\n\tlistTree: register('list-tree', 0xeb86),\n\tdebugBreakpointFunctionUnverified: register('debug-breakpoint-function-unverified', 0xeb87),\n\tdebugBreakpointFunction: register('debug-breakpoint-function', 0xeb88),\n\tdebugBreakpointFunctionDisabled: register('debug-breakpoint-function-disabled', 0xeb88),\n\tdebugStackframeActive: register('debug-stackframe-active', 0xeb89),\n\tcircleSmallFilled: register('circle-small-filled', 0xeb8a),\n\tdebugStackframeDot: register('debug-stackframe-dot', 0xeb8a),\n\tterminalDecorationMark: register('terminal-decoration-mark', 0xeb8a),\n\tdebugStackframe: register('debug-stackframe', 0xeb8b),\n\tdebugStackframeFocused: register('debug-stackframe-focused', 0xeb8b),\n\tdebugBreakpointUnsupported: register('debug-breakpoint-unsupported', 0xeb8c),\n\tsymbolString: register('symbol-string', 0xeb8d),\n\tdebugReverseContinue: register('debug-reverse-continue', 0xeb8e),\n\tdebugStepBack: register('debug-step-back', 0xeb8f),\n\tdebugRestartFrame: register('debug-restart-frame', 0xeb90),\n\tdebugAlt: register('debug-alt', 0xeb91),\n\tcallIncoming: register('call-incoming', 0xeb92),\n\tcallOutgoing: register('call-outgoing', 0xeb93),\n\tmenu: register('menu', 0xeb94),\n\texpandAll: register('expand-all', 0xeb95),\n\tfeedback: register('feedback', 0xeb96),\n\tgitPullRequestReviewer: register('git-pull-request-reviewer', 0xeb96),\n\tgroupByRefType: register('group-by-ref-type', 0xeb97),\n\tungroupByRefType: register('ungroup-by-ref-type', 0xeb98),\n\taccount: register('account', 0xeb99),\n\tgitPullRequestAssignee: register('git-pull-request-assignee', 0xeb99),\n\tbellDot: register('bell-dot', 0xeb9a),\n\tdebugConsole: register('debug-console', 0xeb9b),\n\tlibrary: register('library', 0xeb9c),\n\toutput: register('output', 0xeb9d),\n\trunAll: register('run-all', 0xeb9e),\n\tsyncIgnored: register('sync-ignored', 0xeb9f),\n\tpinned: register('pinned', 0xeba0),\n\tgithubInverted: register('github-inverted', 0xeba1),\n\tserverProcess: register('server-process', 0xeba2),\n\tserverEnvironment: register('server-environment', 0xeba3),\n\tpass: register('pass', 0xeba4),\n\tissueClosed: register('issue-closed', 0xeba4),\n\tstopCircle: register('stop-circle', 0xeba5),\n\tplayCircle: register('play-circle', 0xeba6),\n\trecord: register('record', 0xeba7),\n\tdebugAltSmall: register('debug-alt-small', 0xeba8),\n\tvmConnect: register('vm-connect', 0xeba9),\n\tcloud: register('cloud', 0xebaa),\n\tmerge: register('merge', 0xebab),\n\texport: register('export', 0xebac),\n\tgraphLeft: register('graph-left', 0xebad),\n\tmagnet: register('magnet', 0xebae),\n\tnotebook: register('notebook', 0xebaf),\n\tredo: register('redo', 0xebb0),\n\tcheckAll: register('check-all', 0xebb1),\n\tpinnedDirty: register('pinned-dirty', 0xebb2),\n\tpassFilled: register('pass-filled', 0xebb3),\n\tcircleLargeFilled: register('circle-large-filled', 0xebb4),\n\tcircleLarge: register('circle-large', 0xebb5),\n\tcircleLargeOutline: register('circle-large-outline', 0xebb5),\n\tcombine: register('combine', 0xebb6),\n\tgather: register('gather', 0xebb6),\n\ttable: register('table', 0xebb7),\n\tvariableGroup: register('variable-group', 0xebb8),\n\ttypeHierarchy: register('type-hierarchy', 0xebb9),\n\ttypeHierarchySub: register('type-hierarchy-sub', 0xebba),\n\ttypeHierarchySuper: register('type-hierarchy-super', 0xebbb),\n\tgitPullRequestCreate: register('git-pull-request-create', 0xebbc),\n\trunAbove: register('run-above', 0xebbd),\n\trunBelow: register('run-below', 0xebbe),\n\tnotebookTemplate: register('notebook-template', 0xebbf),\n\tdebugRerun: register('debug-rerun', 0xebc0),\n\tworkspaceTrusted: register('workspace-trusted', 0xebc1),\n\tworkspaceUntrusted: register('workspace-untrusted', 0xebc2),\n\tworkspaceUnknown: register('workspace-unknown', 0xebc3),\n\tterminalCmd: register('terminal-cmd', 0xebc4),\n\tterminalDebian: register('terminal-debian', 0xebc5),\n\tterminalLinux: register('terminal-linux', 0xebc6),\n\tterminalPowershell: register('terminal-powershell', 0xebc7),\n\tterminalTmux: register('terminal-tmux', 0xebc8),\n\tterminalUbuntu: register('terminal-ubuntu', 0xebc9),\n\tterminalBash: register('terminal-bash', 0xebca),\n\tarrowSwap: register('arrow-swap', 0xebcb),\n\tcopy: register('copy', 0xebcc),\n\tpersonAdd: register('person-add', 0xebcd),\n\tfilterFilled: register('filter-filled', 0xebce),\n\twand: register('wand', 0xebcf),\n\tdebugLineByLine: register('debug-line-by-line', 0xebd0),\n\tinspect: register('inspect', 0xebd1),\n\tlayers: register('layers', 0xebd2),\n\tlayersDot: register('layers-dot', 0xebd3),\n\tlayersActive: register('layers-active', 0xebd4),\n\tcompass: register('compass', 0xebd5),\n\tcompassDot: register('compass-dot', 0xebd6),\n\tcompassActive: register('compass-active', 0xebd7),\n\tazure: register('azure', 0xebd8),\n\tissueDraft: register('issue-draft', 0xebd9),\n\tgitPullRequestClosed: register('git-pull-request-closed', 0xebda),\n\tgitPullRequestDraft: register('git-pull-request-draft', 0xebdb),\n\tdebugAll: register('debug-all', 0xebdc),\n\tdebugCoverage: register('debug-coverage', 0xebdd),\n\trunErrors: register('run-errors', 0xebde),\n\tfolderLibrary: register('folder-library', 0xebdf),\n\tdebugContinueSmall: register('debug-continue-small', 0xebe0),\n\tbeakerStop: register('beaker-stop', 0xebe1),\n\tgraphLine: register('graph-line', 0xebe2),\n\tgraphScatter: register('graph-scatter', 0xebe3),\n\tpieChart: register('pie-chart', 0xebe4),\n\tbracket: register('bracket', 0xeb0f),\n\tbracketDot: register('bracket-dot', 0xebe5),\n\tbracketError: register('bracket-error', 0xebe6),\n\tlockSmall: register('lock-small', 0xebe7),\n\tazureDevops: register('azure-devops', 0xebe8),\n\tverifiedFilled: register('verified-filled', 0xebe9),\n\tnewline: register('newline', 0xebea),\n\tlayout: register('layout', 0xebeb),\n\tlayoutActivitybarLeft: register('layout-activitybar-left', 0xebec),\n\tlayoutActivitybarRight: register('layout-activitybar-right', 0xebed),\n\tlayoutPanelLeft: register('layout-panel-left', 0xebee),\n\tlayoutPanelCenter: register('layout-panel-center', 0xebef),\n\tlayoutPanelJustify: register('layout-panel-justify', 0xebf0),\n\tlayoutPanelRight: register('layout-panel-right', 0xebf1),\n\tlayoutPanel: register('layout-panel', 0xebf2),\n\tlayoutSidebarLeft: register('layout-sidebar-left', 0xebf3),\n\tlayoutSidebarRight: register('layout-sidebar-right', 0xebf4),\n\tlayoutStatusbar: register('layout-statusbar', 0xebf5),\n\tlayoutMenubar: register('layout-menubar', 0xebf6),\n\tlayoutCentered: register('layout-centered', 0xebf7),\n\ttarget: register('target', 0xebf8),\n\tindent: register('indent', 0xebf9),\n\trecordSmall: register('record-small', 0xebfa),\n\terrorSmall: register('error-small', 0xebfb),\n\tterminalDecorationError: register('terminal-decoration-error', 0xebfb),\n\tarrowCircleDown: register('arrow-circle-down', 0xebfc),\n\tarrowCircleLeft: register('arrow-circle-left', 0xebfd),\n\tarrowCircleRight: register('arrow-circle-right', 0xebfe),\n\tarrowCircleUp: register('arrow-circle-up', 0xebff),\n\tlayoutSidebarRightOff: register('layout-sidebar-right-off', 0xec00),\n\tlayoutPanelOff: register('layout-panel-off', 0xec01),\n\tlayoutSidebarLeftOff: register('layout-sidebar-left-off', 0xec02),\n\tblank: register('blank', 0xec03),\n\theartFilled: register('heart-filled', 0xec04),\n\tmap: register('map', 0xec05),\n\tmapHorizontal: register('map-horizontal', 0xec05),\n\tfoldHorizontal: register('fold-horizontal', 0xec05),\n\tmapFilled: register('map-filled', 0xec06),\n\tmapHorizontalFilled: register('map-horizontal-filled', 0xec06),\n\tfoldHorizontalFilled: register('fold-horizontal-filled', 0xec06),\n\tcircleSmall: register('circle-small', 0xec07),\n\tbellSlash: register('bell-slash', 0xec08),\n\tbellSlashDot: register('bell-slash-dot', 0xec09),\n\tcommentUnresolved: register('comment-unresolved', 0xec0a),\n\tgitPullRequestGoToChanges: register('git-pull-request-go-to-changes', 0xec0b),\n\tgitPullRequestNewChanges: register('git-pull-request-new-changes', 0xec0c),\n\tsearchFuzzy: register('search-fuzzy', 0xec0d),\n\tcommentDraft: register('comment-draft', 0xec0e),\n\tsend: register('send', 0xec0f),\n\tsparkle: register('sparkle', 0xec10),\n\tinsert: register('insert', 0xec11),\n\tmic: register('mic', 0xec12),\n\tthumbsdownFilled: register('thumbsdown-filled', 0xec13),\n\tthumbsupFilled: register('thumbsup-filled', 0xec14),\n\tcoffee: register('coffee', 0xec15),\n\tsnake: register('snake', 0xec16),\n\tgame: register('game', 0xec17),\n\tvr: register('vr', 0xec18),\n\tchip: register('chip', 0xec19),\n\tpiano: register('piano', 0xec1a),\n\tmusic: register('music', 0xec1b),\n\tmicFilled: register('mic-filled', 0xec1c),\n\trepoFetch: register('repo-fetch', 0xec1d),\n\tcopilot: register('copilot', 0xec1e),\n\tlightbulbSparkle: register('lightbulb-sparkle', 0xec1f),\n\trobot: register('robot', 0xec20),\n\tsparkleFilled: register('sparkle-filled', 0xec21),\n\tdiffSingle: register('diff-single', 0xec22),\n\tdiffMultiple: register('diff-multiple', 0xec23),\n\tsurroundWith: register('surround-with', 0xec24),\n\tshare: register('share', 0xec25),\n\tgitStash: register('git-stash', 0xec26),\n\tgitStashApply: register('git-stash-apply', 0xec27),\n\tgitStashPop: register('git-stash-pop', 0xec28),\n\tvscode: register('vscode', 0xec29),\n\tvscodeInsiders: register('vscode-insiders', 0xec2a),\n\tcodeOss: register('code-oss', 0xec2b),\n\trunCoverage: register('run-coverage', 0xec2c),\n\trunAllCoverage: register('run-all-coverage', 0xec2d),\n\tcoverage: register('coverage', 0xec2e),\n\tgithubProject: register('github-project', 0xec2f),\n\tmapVertical: register('map-vertical', 0xec30),\n\tfoldVertical: register('fold-vertical', 0xec30),\n\tmapVerticalFilled: register('map-vertical-filled', 0xec31),\n\tfoldVerticalFilled: register('fold-vertical-filled', 0xec31),\n\tgoToSearch: register('go-to-search', 0xec32),\n\tpercentage: register('percentage', 0xec33),\n\tsortPercentage: register('sort-percentage', 0xec33),\n\tattach: register('attach', 0xec34),\n\tgoToEditingSession: register('go-to-editing-session', 0xec35),\n\teditSession: register('edit-session', 0xec36),\n\tcodeReview: register('code-review', 0xec37),\n\tcopilotWarning: register('copilot-warning', 0xec38),\n\tpython: register('python', 0xec39),\n\tcopilotLarge: register('copilot-large', 0xec3a),\n\tcopilotWarningLarge: register('copilot-warning-large', 0xec3b),\n\tkeyboardTab: register('keyboard-tab', 0xec3c),\n\tcopilotBlocked: register('copilot-blocked', 0xec3d),\n\tcopilotNotConnected: register('copilot-not-connected', 0xec3e),\n\tflag: register('flag', 0xec3f),\n\tlightbulbEmpty: register('lightbulb-empty', 0xec40),\n\tsymbolMethodArrow: register('symbol-method-arrow', 0xec41),\n\tcopilotUnavailable: register('copilot-unavailable', 0xec42),\n\trepoPinned: register('repo-pinned', 0xec43),\n\tkeyboardTabAbove: register('keyboard-tab-above', 0xec44),\n\tkeyboardTabBelow: register('keyboard-tab-below', 0xec45),\n\tgitPullRequestDone: register('git-pull-request-done', 0xec46),\n\tmcp: register('mcp', 0xec47),\n\textensionsLarge: register('extensions-large', 0xec48),\n\tlayoutPanelDock: register('layout-panel-dock', 0xec49),\n\tlayoutSidebarLeftDock: register('layout-sidebar-left-dock', 0xec4a),\n\tlayoutSidebarRightDock: register('layout-sidebar-right-dock', 0xec4b),\n\tcopilotInProgress: register('copilot-in-progress', 0xec4c),\n\tcopilotError: register('copilot-error', 0xec4d),\n\tcopilotSuccess: register('copilot-success', 0xec4e),\n\tchatSparkle: register('chat-sparkle', 0xec4f),\n\tsearchSparkle: register('search-sparkle', 0xec50),\n\teditSparkle: register('edit-sparkle', 0xec51),\n\tcopilotSnooze: register('copilot-snooze', 0xec52),\n} as const;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { ThemeIcon } from './themables.js';\nimport { register } from './codiconsUtil.js';\nimport { codiconsLibrary } from './codiconsLibrary.js';\n\n\n/**\n * Only to be used by the iconRegistry.\n */\nexport function getAllCodicons(): ThemeIcon[] {\n\treturn Object.values(Codicon);\n}\n\n/**\n * Derived icons, that could become separate icons.\n * These mappings should be moved into the mapping file in the vscode-codicons repo at some point.\n */\nexport const codiconsDerived = {\n\tdialogError: register('dialog-error', 'error'),\n\tdialogWarning: register('dialog-warning', 'warning'),\n\tdialogInfo: register('dialog-info', 'info'),\n\tdialogClose: register('dialog-close', 'close'),\n\ttreeItemExpanded: register('tree-item-expanded', 'chevron-down'), // collapsed is done with rotation\n\ttreeFilterOnTypeOn: register('tree-filter-on-type-on', 'list-filter'),\n\ttreeFilterOnTypeOff: register('tree-filter-on-type-off', 'list-selection'),\n\ttreeFilterClear: register('tree-filter-clear', 'close'),\n\ttreeItemLoading: register('tree-item-loading', 'loading'),\n\tmenuSelection: register('menu-selection', 'check'),\n\tmenuSubmenu: register('menu-submenu', 'chevron-right'),\n\tmenuBarMore: register('menubar-more', 'more'),\n\tscrollbarButtonLeft: register('scrollbar-button-left', 'triangle-left'),\n\tscrollbarButtonRight: register('scrollbar-button-right', 'triangle-right'),\n\tscrollbarButtonUp: register('scrollbar-button-up', 'triangle-up'),\n\tscrollbarButtonDown: register('scrollbar-button-down', 'triangle-down'),\n\ttoolBarMore: register('toolbar-more', 'more'),\n\tquickInputBack: register('quick-input-back', 'arrow-left'),\n\tdropDownButton: register('drop-down-button', 0xeab4),\n\tsymbolCustomColor: register('symbol-customcolor', 0xeb5c),\n\texportIcon: register('export', 0xebac),\n\tworkspaceUnspecified: register('workspace-unspecified', 0xebc3),\n\tnewLine: register('newline', 0xebea),\n\tthumbsDownFilled: register('thumbsdown-filled', 0xec13),\n\tthumbsUpFilled: register('thumbsup-filled', 0xec14),\n\tgitFetch: register('git-fetch', 0xec1d),\n\tlightbulbSparkleAutofix: register('lightbulb-sparkle-autofix', 0xec1f),\n\tdebugBreakpointPending: register('debug-breakpoint-pending', 0xebd9),\n\n} as const;\n\n/**\n * The Codicon library is a set of default icons that are built-in in VS Code.\n *\n * In the product (outside of base) Codicons should only be used as defaults. In order to have all icons in VS Code\n * themeable, component should define new, UI component specific icons using `iconRegistry.registerIcon`.\n * In that call a Codicon can be named as default.\n */\nexport const Codicon = {\n\t...codiconsLibrary,\n\t...codiconsDerived\n\n} as const;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Codicon } from './codicons.js';\n\nexport type ColorIdentifier = string;\n\nexport type IconIdentifier = string;\n\nexport interface ThemeColor {\n\tid: string;\n}\n\nexport namespace ThemeColor {\n\texport function isThemeColor(obj: unknown): obj is ThemeColor {\n\t\treturn !!obj && typeof obj === 'object' && typeof (<ThemeColor>obj).id === 'string';\n\t}\n}\n\nexport function themeColorFromId(id: ColorIdentifier) {\n\treturn { id };\n}\n\n\nexport interface ThemeIcon {\n\treadonly id: string;\n\treadonly color?: ThemeColor;\n}\n\nexport namespace ThemeIcon {\n\texport const iconNameSegment = '[A-Za-z0-9]+';\n\texport const iconNameExpression = '[A-Za-z0-9-]+';\n\texport const iconModifierExpression = '~[A-Za-z]+';\n\texport const iconNameCharacter = '[A-Za-z0-9~-]';\n\n\tconst ThemeIconIdRegex = new RegExp(`^(${iconNameExpression})(${iconModifierExpression})?$`);\n\n\texport function asClassNameArray(icon: ThemeIcon): string[] {\n\t\tconst match = ThemeIconIdRegex.exec(icon.id);\n\t\tif (!match) {\n\t\t\treturn asClassNameArray(Codicon.error);\n\t\t}\n\t\tconst [, id, modifier] = match;\n\t\tconst classNames = ['codicon', 'codicon-' + id];\n\t\tif (modifier) {\n\t\t\tclassNames.push('codicon-modifier-' + modifier.substring(1));\n\t\t}\n\t\treturn classNames;\n\t}\n\n\texport function asClassName(icon: ThemeIcon): string {\n\t\treturn asClassNameArray(icon).join(' ');\n\t}\n\n\texport function asCSSSelector(icon: ThemeIcon): string {\n\t\treturn '.' + asClassNameArray(icon).join('.');\n\t}\n\n\texport function isThemeIcon(obj: unknown): obj is ThemeIcon {\n\t\treturn !!obj && typeof obj === 'object' && typeof (<ThemeIcon>obj).id === 'string' && (typeof (<ThemeIcon>obj).color === 'undefined' || ThemeColor.isThemeColor((<ThemeIcon>obj).color));\n\t}\n\n\tconst _regexFromString = new RegExp(`^\\\\$\\\\((${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?)\\\\)$`);\n\n\texport function fromString(str: string): ThemeIcon | undefined {\n\t\tconst match = _regexFromString.exec(str);\n\t\tif (!match) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst [, name] = match;\n\t\treturn { id: name };\n\t}\n\n\texport function fromId(id: string): ThemeIcon {\n\t\treturn { id };\n\t}\n\n\texport function modify(icon: ThemeIcon, modifier: 'disabled' | 'spin' | undefined): ThemeIcon {\n\t\tlet id = icon.id;\n\t\tconst tildeIndex = id.lastIndexOf('~');\n\t\tif (tildeIndex !== -1) {\n\t\t\tid = id.substring(0, tildeIndex);\n\t\t}\n\t\tif (modifier) {\n\t\t\tid = `${id}~${modifier}`;\n\t\t}\n\t\treturn { id };\n\t}\n\n\texport function getModifier(icon: ThemeIcon): string | undefined {\n\t\tconst tildeIndex = icon.id.lastIndexOf('~');\n\t\tif (tildeIndex !== -1) {\n\t\t\treturn icon.id.substring(tildeIndex + 1);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\texport function isEqual(ti1: ThemeIcon, ti2: ThemeIcon): boolean {\n\t\treturn ti1.id === ti2.id && ti1.color?.id === ti2.color?.id;\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IMatch, matchesFuzzy } from './filters.js';\nimport { ltrim } from './strings.js';\nimport { ThemeIcon } from './themables.js';\n\nconst iconStartMarker = '$(';\n\nconst iconsRegex = new RegExp(`\\\\$\\\\(${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?\\\\)`, 'g'); // no capturing groups\n\nconst escapeIconsRegex = new RegExp(`(\\\\\\\\)?${iconsRegex.source}`, 'g');\nexport function escapeIcons(text: string): string {\n\treturn text.replace(escapeIconsRegex, (match, escaped) => escaped ? match : `\\\\${match}`);\n}\n\nconst markdownEscapedIconsRegex = new RegExp(`\\\\\\\\${iconsRegex.source}`, 'g');\nexport function markdownEscapeEscapedIcons(text: string): string {\n\t// Need to add an extra \\ for escaping in markdown\n\treturn text.replace(markdownEscapedIconsRegex, match => `\\\\${match}`);\n}\n\nconst stripIconsRegex = new RegExp(`(\\\\s)?(\\\\\\\\)?${iconsRegex.source}(\\\\s)?`, 'g');\n\n/**\n * Takes a label with icons (`$(iconId)xyz`)  and strips the icons out (`xyz`)\n */\nexport function stripIcons(text: string): string {\n\tif (text.indexOf(iconStartMarker) === -1) {\n\t\treturn text;\n\t}\n\n\treturn text.replace(stripIconsRegex, (match, preWhitespace, escaped, postWhitespace) => escaped ? match : preWhitespace || postWhitespace || '');\n}\n\n\n/**\n * Takes a label with icons (`$(iconId)xyz`), removes the icon syntax adds whitespace so that screen readers can read the text better.\n */\nexport function getCodiconAriaLabel(text: string | undefined) {\n\tif (!text) {\n\t\treturn '';\n\t}\n\n\treturn text.replace(/\\$\\((.*?)\\)/g, (_match, codiconName) => ` ${codiconName} `).trim();\n}\n\n\nexport interface IParsedLabelWithIcons {\n\treadonly text: string;\n\treadonly iconOffsets?: readonly number[];\n}\n\nconst _parseIconsRegex = new RegExp(`\\\\$\\\\(${ThemeIcon.iconNameCharacter}+\\\\)`, 'g');\n\n/**\n * Takes a label with icons (`abc $(iconId)xyz`) and returns the text (`abc xyz`) and the offsets of the icons (`[3]`)\n */\nexport function parseLabelWithIcons(input: string): IParsedLabelWithIcons {\n\n\t_parseIconsRegex.lastIndex = 0;\n\n\tlet text = '';\n\tconst iconOffsets: number[] = [];\n\tlet iconsOffset = 0;\n\n\twhile (true) {\n\t\tconst pos = _parseIconsRegex.lastIndex;\n\t\tconst match = _parseIconsRegex.exec(input);\n\n\t\tconst chars = input.substring(pos, match?.index);\n\t\tif (chars.length > 0) {\n\t\t\ttext += chars;\n\t\t\tfor (let i = 0; i < chars.length; i++) {\n\t\t\t\ticonOffsets.push(iconsOffset);\n\t\t\t}\n\t\t}\n\t\tif (!match) {\n\t\t\tbreak;\n\t\t}\n\t\ticonsOffset += match[0].length;\n\t}\n\n\treturn { text, iconOffsets };\n}\n\n\nexport function matchesFuzzyIconAware(query: string, target: IParsedLabelWithIcons, enableSeparateSubstringMatching = false): IMatch[] | null {\n\tconst { text, iconOffsets } = target;\n\n\t// Return early if there are no icon markers in the word to match against\n\tif (!iconOffsets || iconOffsets.length === 0) {\n\t\treturn matchesFuzzy(query, text, enableSeparateSubstringMatching);\n\t}\n\n\t// Trim the word to match against because it could have leading\n\t// whitespace now if the word started with an icon\n\tconst wordToMatchAgainstWithoutIconsTrimmed = ltrim(text, ' ');\n\tconst leadingWhitespaceOffset = text.length - wordToMatchAgainstWithoutIconsTrimmed.length;\n\n\t// match on value without icon\n\tconst matches = matchesFuzzy(query, wordToMatchAgainstWithoutIconsTrimmed, enableSeparateSubstringMatching);\n\n\t// Map matches back to offsets with icon and trimming\n\tif (matches) {\n\t\tfor (const match of matches) {\n\t\t\tconst iconOffset = iconOffsets[match.start + leadingWhitespaceOffset] /* icon offsets at index */ + leadingWhitespaceOffset /* overall leading whitespace offset */;\n\t\t\tmatch.start += iconOffset;\n\t\t\tmatch.end += iconOffset;\n\t\t}\n\t}\n\n\treturn matches;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { illegalArgument } from './errors.js';\nimport { escapeIcons } from './iconLabels.js';\nimport { Schemas } from './network.js';\nimport { isEqual } from './resources.js';\nimport { escapeRegExpCharacters } from './strings.js';\nimport { URI, UriComponents } from './uri.js';\n\nexport interface MarkdownStringTrustedOptions {\n\treadonly enabledCommands: readonly string[];\n}\n\nexport interface IMarkdownString {\n\treadonly value: string;\n\treadonly isTrusted?: boolean | MarkdownStringTrustedOptions;\n\treadonly supportThemeIcons?: boolean;\n\treadonly supportHtml?: boolean;\n\treadonly baseUri?: UriComponents;\n\turis?: { [href: string]: UriComponents };\n}\n\nexport const enum MarkdownStringTextNewlineStyle {\n\tParagraph = 0,\n\tBreak = 1,\n}\n\nexport class MarkdownString implements IMarkdownString {\n\n\tpublic value: string;\n\tpublic isTrusted?: boolean | MarkdownStringTrustedOptions;\n\tpublic supportThemeIcons?: boolean;\n\tpublic supportHtml?: boolean;\n\tpublic baseUri?: URI;\n\tpublic uris?: { [href: string]: UriComponents } | undefined;\n\n\tpublic static lift(dto: IMarkdownString): MarkdownString {\n\t\tconst markdownString = new MarkdownString(dto.value, dto);\n\t\tmarkdownString.uris = dto.uris;\n\t\tmarkdownString.baseUri = dto.baseUri ? URI.revive(dto.baseUri) : undefined;\n\t\treturn markdownString;\n\t}\n\n\tconstructor(\n\t\tvalue: string = '',\n\t\tisTrustedOrOptions: boolean | { isTrusted?: boolean | MarkdownStringTrustedOptions; supportThemeIcons?: boolean; supportHtml?: boolean } = false,\n\t) {\n\t\tthis.value = value;\n\t\tif (typeof this.value !== 'string') {\n\t\t\tthrow illegalArgument('value');\n\t\t}\n\n\t\tif (typeof isTrustedOrOptions === 'boolean') {\n\t\t\tthis.isTrusted = isTrustedOrOptions;\n\t\t\tthis.supportThemeIcons = false;\n\t\t\tthis.supportHtml = false;\n\t\t}\n\t\telse {\n\t\t\tthis.isTrusted = isTrustedOrOptions.isTrusted ?? undefined;\n\t\t\tthis.supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false;\n\t\t\tthis.supportHtml = isTrustedOrOptions.supportHtml ?? false;\n\t\t}\n\t}\n\n\tappendText(value: string, newlineStyle: MarkdownStringTextNewlineStyle = MarkdownStringTextNewlineStyle.Paragraph): MarkdownString {\n\t\tthis.value += escapeMarkdownSyntaxTokens(this.supportThemeIcons ? escapeIcons(value) : value) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/([ \\t]+)/g, (_match, g1) => '&nbsp;'.repeat(g1.length)) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\>/gm, '\\\\>') // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\n/g, newlineStyle === MarkdownStringTextNewlineStyle.Break ? '\\\\\\n' : '\\n\\n'); // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\n\t\treturn this;\n\t}\n\n\tappendMarkdown(value: string): MarkdownString {\n\t\tthis.value += value;\n\t\treturn this;\n\t}\n\n\tappendCodeblock(langId: string, code: string): MarkdownString {\n\t\tthis.value += `\\n${appendEscapedMarkdownCodeBlockFence(code, langId)}\\n`;\n\t\treturn this;\n\t}\n\n\tappendLink(target: URI | string, label: string, title?: string): MarkdownString {\n\t\tthis.value += '[';\n\t\tthis.value += this._escape(label, ']');\n\t\tthis.value += '](';\n\t\tthis.value += this._escape(String(target), ')');\n\t\tif (title) {\n\t\t\tthis.value += ` \"${this._escape(this._escape(title, '\"'), ')')}\"`;\n\t\t}\n\t\tthis.value += ')';\n\t\treturn this;\n\t}\n\n\tprivate _escape(value: string, ch: string): string {\n\t\tconst r = new RegExp(escapeRegExpCharacters(ch), 'g');\n\t\treturn value.replace(r, (match, offset) => {\n\t\t\tif (value.charAt(offset - 1) !== '\\\\') {\n\t\t\t\treturn `\\\\${match}`;\n\t\t\t} else {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function isEmptyMarkdownString(oneOrMany: IMarkdownString | IMarkdownString[] | null | undefined): boolean {\n\tif (isMarkdownString(oneOrMany)) {\n\t\treturn !oneOrMany.value;\n\t} else if (Array.isArray(oneOrMany)) {\n\t\treturn oneOrMany.every(isEmptyMarkdownString);\n\t} else {\n\t\treturn true;\n\t}\n}\n\nexport function isMarkdownString(thing: unknown): thing is IMarkdownString {\n\tif (thing instanceof MarkdownString) {\n\t\treturn true;\n\t} else if (thing && typeof thing === 'object') {\n\t\treturn typeof (<IMarkdownString>thing).value === 'string'\n\t\t\t&& (typeof (<IMarkdownString>thing).isTrusted === 'boolean' || typeof (<IMarkdownString>thing).isTrusted === 'object' || (<IMarkdownString>thing).isTrusted === undefined)\n\t\t\t&& (typeof (<IMarkdownString>thing).supportThemeIcons === 'boolean' || (<IMarkdownString>thing).supportThemeIcons === undefined);\n\t}\n\treturn false;\n}\n\nexport function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t} else if (!a || !b) {\n\t\treturn false;\n\t} else {\n\t\treturn a.value === b.value\n\t\t\t&& a.isTrusted === b.isTrusted\n\t\t\t&& a.supportThemeIcons === b.supportThemeIcons\n\t\t\t&& a.supportHtml === b.supportHtml\n\t\t\t&& (a.baseUri === b.baseUri || !!a.baseUri && !!b.baseUri && isEqual(URI.from(a.baseUri), URI.from(b.baseUri)));\n\t}\n}\n\nexport function escapeMarkdownSyntaxTokens(text: string): string {\n\t// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n\treturn text.replace(/[\\\\`*_{}[\\]()#+\\-!~]/g, '\\\\$&'); // CodeQL [SM02383] Backslash is escaped in the character class\n}\n\n/**\n * @see https://github.com/microsoft/vscode/issues/193746\n */\nexport function appendEscapedMarkdownCodeBlockFence(code: string, langId: string) {\n\tconst longestFenceLength =\n\t\tcode.match(/^`+/gm)?.reduce((a, b) => (a.length > b.length ? a : b)).length ??\n\t\t0;\n\tconst desiredFenceLength =\n\t\tlongestFenceLength >= 3 ? longestFenceLength + 1 : 3;\n\n\t// the markdown result\n\treturn [\n\t\t`${'`'.repeat(desiredFenceLength)}${langId}`,\n\t\tcode,\n\t\t`${'`'.repeat(desiredFenceLength)}`,\n\t].join('\\n');\n}\n\nexport function escapeDoubleQuotes(input: string) {\n\treturn input.replace(/\"/g, '&quot;');\n}\n\nexport function removeMarkdownEscapes(text: string): string {\n\tif (!text) {\n\t\treturn text;\n\t}\n\treturn text.replace(/\\\\([\\\\`*_{}[\\]()#+\\-.!~])/g, '$1');\n}\n\nexport function parseHrefAndDimensions(href: string): { href: string; dimensions: string[] } {\n\tconst dimensions: string[] = [];\n\tconst splitted = href.split('|').map(s => s.trim());\n\thref = splitted[0];\n\tconst parameters = splitted[1];\n\tif (parameters) {\n\t\tconst heightFromParams = /height=(\\d+)/.exec(parameters);\n\t\tconst widthFromParams = /width=(\\d+)/.exec(parameters);\n\t\tconst height = heightFromParams ? heightFromParams[1] : '';\n\t\tconst width = widthFromParams ? widthFromParams[1] : '';\n\t\tconst widthIsFinite = isFinite(parseInt(width));\n\t\tconst heightIsFinite = isFinite(parseInt(height));\n\t\tif (widthIsFinite) {\n\t\t\tdimensions.push(`width=\"${width}\"`);\n\t\t}\n\t\tif (heightIsFinite) {\n\t\t\tdimensions.push(`height=\"${height}\"`);\n\t\t}\n\t}\n\treturn { href, dimensions };\n}\n\nexport function markdownCommandLink(command: { title: string; id: string; arguments?: unknown[] }): string {\n\tconst uri = URI.from({\n\t\tscheme: Schemas.command,\n\t\tpath: command.id,\n\t\tquery: command.arguments?.length ? encodeURIComponent(JSON.stringify(command.arguments)) : undefined,\n\t}).toString();\n\n\treturn `[${escapeMarkdownSyntaxTokens(command.title)}](${uri})`;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { distinct, isNonEmptyArray } from '../../../base/common/arrays.js';\nimport { Barrier, CancelablePromise, createCancelablePromise } from '../../../base/common/async.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { CancellationError, getErrorMessage, isCancellationError } from '../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { isWeb } from '../../../base/common/platform.js';\nimport { URI } from '../../../base/common/uri.js';\nimport * as nls from '../../../nls.js';\nimport {\n\tExtensionManagementError, IExtensionGalleryService, IExtensionIdentifier, IExtensionManagementParticipant, IGalleryExtension, ILocalExtension, InstallOperation,\n\tIExtensionsControlManifest, StatisticType, isTargetPlatformCompatible, TargetPlatformToString, ExtensionManagementErrorCode,\n\tInstallOptions, UninstallOptions, Metadata, InstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionResult, UninstallExtensionEvent, IExtensionManagementService, InstallExtensionInfo, EXTENSION_INSTALL_DEP_PACK_CONTEXT, ExtensionGalleryError,\n\tIProductVersion, ExtensionGalleryErrorCode,\n\tEXTENSION_INSTALL_SOURCE_CONTEXT,\n\tDidUpdateExtensionMetadata,\n\tUninstallExtensionInfo,\n\tExtensionSignatureVerificationCode,\n\tIAllowedExtensionsService\n} from './extensionManagement.js';\nimport { areSameExtensions, ExtensionKey, getGalleryExtensionId, getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData, isMalicious } from './extensionManagementUtil.js';\nimport { ExtensionType, IExtensionManifest, isApplicationScopedExtension, TargetPlatform } from '../../extensions/common/extensions.js';\nimport { areApiProposalsCompatible } from '../../extensions/common/extensionValidator.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { ITelemetryService } from '../../telemetry/common/telemetry.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\nimport { IMarkdownString, MarkdownString } from '../../../base/common/htmlContent.js';\n\nexport type InstallableExtension = { readonly manifest: IExtensionManifest; extension: IGalleryExtension | URI; options: InstallOptions };\n\nexport type InstallExtensionTaskOptions = InstallOptions & { readonly profileLocation: URI; readonly productVersion: IProductVersion };\nexport interface IInstallExtensionTask {\n\treadonly manifest: IExtensionManifest;\n\treadonly identifier: IExtensionIdentifier;\n\treadonly source: IGalleryExtension | URI;\n\treadonly operation: InstallOperation;\n\treadonly options: InstallExtensionTaskOptions;\n\treadonly verificationStatus?: ExtensionSignatureVerificationCode;\n\trun(): Promise<ILocalExtension>;\n\twaitUntilTaskIsFinished(): Promise<ILocalExtension>;\n\tcancel(): void;\n}\n\nexport type UninstallExtensionTaskOptions = UninstallOptions & { readonly profileLocation: URI };\nexport interface IUninstallExtensionTask {\n\treadonly options: UninstallExtensionTaskOptions;\n\treadonly extension: ILocalExtension;\n\trun(): Promise<void>;\n\twaitUntilTaskIsFinished(): Promise<void>;\n\tcancel(): void;\n}\n\nexport abstract class CommontExtensionManagementService extends Disposable implements IExtensionManagementService {\n\n\t_serviceBrand: undefined;\n\n\treadonly preferPreReleases: boolean;\n\n\tconstructor(\n\t\t@IProductService protected readonly productService: IProductService,\n\t\t@IAllowedExtensionsService protected readonly allowedExtensionsService: IAllowedExtensionsService,\n\t) {\n\t\tsuper();\n\t\tthis.preferPreReleases = this.productService.quality !== 'stable';\n\t}\n\n\tasync canInstall(extension: IGalleryExtension): Promise<true | IMarkdownString> {\n\t\tconst allowedToInstall = this.allowedExtensionsService.isAllowed({ id: extension.identifier.id, publisherDisplayName: extension.publisherDisplayName });\n\t\tif (allowedToInstall !== true) {\n\t\t\treturn new MarkdownString(nls.localize('not allowed to install', \"This extension cannot be installed because {0}\", allowedToInstall.value));\n\t\t}\n\n\t\tif (!(await this.isExtensionPlatformCompatible(extension))) {\n\t\t\tconst learnLink = isWeb ? 'https://aka.ms/vscode-web-extensions-guide' : 'https://aka.ms/vscode-platform-specific-extensions';\n\t\t\treturn new MarkdownString(`${nls.localize('incompatible platform', \"The '{0}' extension is not available in {1} for the {2}.\",\n\t\t\t\textension.displayName ?? extension.identifier.id, this.productService.nameLong, TargetPlatformToString(await this.getTargetPlatform()))} [${nls.localize('learn why', \"Learn Why\")}](${learnLink})`);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprotected async isExtensionPlatformCompatible(extension: IGalleryExtension): Promise<boolean> {\n\t\tconst currentTargetPlatform = await this.getTargetPlatform();\n\t\treturn extension.allTargetPlatforms.some(targetPlatform => isTargetPlatformCompatible(targetPlatform, extension.allTargetPlatforms, currentTargetPlatform));\n\t}\n\n\tabstract readonly onInstallExtension: Event<InstallExtensionEvent>;\n\tabstract readonly onDidInstallExtensions: Event<readonly InstallExtensionResult[]>;\n\tabstract readonly onUninstallExtension: Event<UninstallExtensionEvent>;\n\tabstract readonly onDidUninstallExtension: Event<DidUninstallExtensionEvent>;\n\tabstract readonly onDidUpdateExtensionMetadata: Event<DidUpdateExtensionMetadata>;\n\tabstract installFromGallery(extension: IGalleryExtension, options?: InstallOptions): Promise<ILocalExtension>;\n\tabstract installGalleryExtensions(extensions: InstallExtensionInfo[]): Promise<InstallExtensionResult[]>;\n\tabstract uninstall(extension: ILocalExtension, options?: UninstallOptions): Promise<void>;\n\tabstract uninstallExtensions(extensions: UninstallExtensionInfo[]): Promise<void>;\n\tabstract toggleApplicationScope(extension: ILocalExtension, fromProfileLocation: URI): Promise<ILocalExtension>;\n\tabstract getExtensionsControlManifest(): Promise<IExtensionsControlManifest>;\n\tabstract resetPinnedStateForAllUserExtensions(pinned: boolean): Promise<void>;\n\tabstract registerParticipant(pariticipant: IExtensionManagementParticipant): void;\n\tabstract getTargetPlatform(): Promise<TargetPlatform>;\n\tabstract zip(extension: ILocalExtension): Promise<URI>;\n\tabstract getManifest(vsix: URI): Promise<IExtensionManifest>;\n\tabstract install(vsix: URI, options?: InstallOptions): Promise<ILocalExtension>;\n\tabstract installFromLocation(location: URI, profileLocation: URI): Promise<ILocalExtension>;\n\tabstract installExtensionsFromProfile(extensions: IExtensionIdentifier[], fromProfileLocation: URI, toProfileLocation: URI): Promise<ILocalExtension[]>;\n\tabstract getInstalled(type?: ExtensionType, profileLocation?: URI, productVersion?: IProductVersion): Promise<ILocalExtension[]>;\n\tabstract copyExtensions(fromProfileLocation: URI, toProfileLocation: URI): Promise<void>;\n\tabstract download(extension: IGalleryExtension, operation: InstallOperation, donotVerifySignature: boolean): Promise<URI>;\n\tabstract cleanUp(): Promise<void>;\n\tabstract updateMetadata(local: ILocalExtension, metadata: Partial<Metadata>, profileLocation: URI): Promise<ILocalExtension>;\n}\n\nexport abstract class AbstractExtensionManagementService extends CommontExtensionManagementService implements IExtensionManagementService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate extensionsControlManifest: Promise<IExtensionsControlManifest> | undefined;\n\tprivate lastReportTimestamp = 0;\n\tprivate readonly installingExtensions = new Map<string, { task: IInstallExtensionTask; waitingTasks: IInstallExtensionTask[] }>();\n\tprivate readonly uninstallingExtensions = new Map<string, IUninstallExtensionTask>();\n\n\tprivate readonly _onInstallExtension = this._register(new Emitter<InstallExtensionEvent>());\n\tget onInstallExtension() { return this._onInstallExtension.event; }\n\n\tprotected readonly _onDidInstallExtensions = this._register(new Emitter<InstallExtensionResult[]>());\n\tget onDidInstallExtensions() { return this._onDidInstallExtensions.event; }\n\n\tprotected readonly _onUninstallExtension = this._register(new Emitter<UninstallExtensionEvent>());\n\tget onUninstallExtension() { return this._onUninstallExtension.event; }\n\n\tprotected _onDidUninstallExtension = this._register(new Emitter<DidUninstallExtensionEvent>());\n\tget onDidUninstallExtension() { return this._onDidUninstallExtension.event; }\n\n\tprotected readonly _onDidUpdateExtensionMetadata = this._register(new Emitter<DidUpdateExtensionMetadata>());\n\tget onDidUpdateExtensionMetadata() { return this._onDidUpdateExtensionMetadata.event; }\n\n\tprivate readonly participants: IExtensionManagementParticipant[] = [];\n\n\tconstructor(\n\t\t@IExtensionGalleryService protected readonly galleryService: IExtensionGalleryService,\n\t\t@ITelemetryService protected readonly telemetryService: ITelemetryService,\n\t\t@IUriIdentityService protected readonly uriIdentityService: IUriIdentityService,\n\t\t@ILogService protected readonly logService: ILogService,\n\t\t@IProductService productService: IProductService,\n\t\t@IAllowedExtensionsService allowedExtensionsService: IAllowedExtensionsService,\n\t\t@IUserDataProfilesService protected readonly userDataProfilesService: IUserDataProfilesService,\n\t) {\n\t\tsuper(productService, allowedExtensionsService);\n\t\tthis._register(toDisposable(() => {\n\t\t\tthis.installingExtensions.forEach(({ task }) => task.cancel());\n\t\t\tthis.uninstallingExtensions.forEach(promise => promise.cancel());\n\t\t\tthis.installingExtensions.clear();\n\t\t\tthis.uninstallingExtensions.clear();\n\t\t}));\n\t}\n\n\tasync installFromGallery(extension: IGalleryExtension, options: InstallOptions = {}): Promise<ILocalExtension> {\n\t\ttry {\n\t\t\tconst results = await this.installGalleryExtensions([{ extension, options }]);\n\t\t\tconst result = results.find(({ identifier }) => areSameExtensions(identifier, extension.identifier));\n\t\t\tif (result?.local) {\n\t\t\t\treturn result?.local;\n\t\t\t}\n\t\t\tif (result?.error) {\n\t\t\t\tthrow result.error;\n\t\t\t}\n\t\t\tthrow new ExtensionManagementError(`Unknown error while installing extension ${extension.identifier.id}`, ExtensionManagementErrorCode.Unknown);\n\t\t} catch (error) {\n\t\t\tthrow toExtensionManagementError(error);\n\t\t}\n\t}\n\n\tasync installGalleryExtensions(extensions: InstallExtensionInfo[]): Promise<InstallExtensionResult[]> {\n\t\tif (!this.galleryService.isEnabled()) {\n\t\t\tthrow new ExtensionManagementError(nls.localize('MarketPlaceDisabled', \"Marketplace is not enabled\"), ExtensionManagementErrorCode.NotAllowed);\n\t\t}\n\n\t\tconst results: InstallExtensionResult[] = [];\n\t\tconst installableExtensions: InstallableExtension[] = [];\n\n\t\tawait Promise.allSettled(extensions.map(async ({ extension, options }) => {\n\t\t\ttry {\n\t\t\t\tconst compatible = await this.checkAndGetCompatibleVersion(extension, !!options?.installGivenVersion, !!options?.installPreReleaseVersion, options.productVersion ?? { version: this.productService.version, date: this.productService.date });\n\t\t\t\tinstallableExtensions.push({ ...compatible, options });\n\t\t\t} catch (error) {\n\t\t\t\tresults.push({ identifier: extension.identifier, operation: InstallOperation.Install, source: extension, error, profileLocation: options.profileLocation ?? this.getCurrentExtensionsManifestLocation() });\n\t\t\t}\n\t\t}));\n\n\t\tif (installableExtensions.length) {\n\t\t\tresults.push(...await this.installExtensions(installableExtensions));\n\t\t}\n\n\t\treturn results;\n\t}\n\n\tasync uninstall(extension: ILocalExtension, options?: UninstallOptions): Promise<void> {\n\t\tthis.logService.trace('ExtensionManagementService#uninstall', extension.identifier.id);\n\t\treturn this.uninstallExtensions([{ extension, options }]);\n\t}\n\n\tasync toggleApplicationScope(extension: ILocalExtension, fromProfileLocation: URI): Promise<ILocalExtension> {\n\t\tif (isApplicationScopedExtension(extension.manifest) || extension.isBuiltin) {\n\t\t\treturn extension;\n\t\t}\n\n\t\tif (extension.isApplicationScoped) {\n\t\t\tlet local = await this.updateMetadata(extension, { isApplicationScoped: false }, this.userDataProfilesService.defaultProfile.extensionsResource);\n\t\t\tif (!this.uriIdentityService.extUri.isEqual(fromProfileLocation, this.userDataProfilesService.defaultProfile.extensionsResource)) {\n\t\t\t\tlocal = await this.copyExtension(extension, this.userDataProfilesService.defaultProfile.extensionsResource, fromProfileLocation);\n\t\t\t}\n\n\t\t\tfor (const profile of this.userDataProfilesService.profiles) {\n\t\t\t\tconst existing = (await this.getInstalled(ExtensionType.User, profile.extensionsResource))\n\t\t\t\t\t.find(e => areSameExtensions(e.identifier, extension.identifier));\n\t\t\t\tif (existing) {\n\t\t\t\t\tthis._onDidUpdateExtensionMetadata.fire({ local: existing, profileLocation: profile.extensionsResource });\n\t\t\t\t} else {\n\t\t\t\t\tthis._onDidUninstallExtension.fire({ identifier: extension.identifier, profileLocation: profile.extensionsResource });\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn local;\n\t\t}\n\n\t\telse {\n\t\t\tconst local = this.uriIdentityService.extUri.isEqual(fromProfileLocation, this.userDataProfilesService.defaultProfile.extensionsResource)\n\t\t\t\t? await this.updateMetadata(extension, { isApplicationScoped: true }, this.userDataProfilesService.defaultProfile.extensionsResource)\n\t\t\t\t: await this.copyExtension(extension, fromProfileLocation, this.userDataProfilesService.defaultProfile.extensionsResource, { isApplicationScoped: true });\n\n\t\t\tthis._onDidInstallExtensions.fire([{ identifier: local.identifier, operation: InstallOperation.Install, local, profileLocation: this.userDataProfilesService.defaultProfile.extensionsResource, applicationScoped: true }]);\n\t\t\treturn local;\n\t\t}\n\n\t}\n\n\tgetExtensionsControlManifest(): Promise<IExtensionsControlManifest> {\n\t\tconst now = new Date().getTime();\n\n\t\tif (!this.extensionsControlManifest || now - this.lastReportTimestamp > 1000 * 60 * 5) { // 5 minute cache freshness\n\t\t\tthis.extensionsControlManifest = this.updateControlCache();\n\t\t\tthis.lastReportTimestamp = now;\n\t\t}\n\n\t\treturn this.extensionsControlManifest;\n\t}\n\n\tregisterParticipant(participant: IExtensionManagementParticipant): void {\n\t\tthis.participants.push(participant);\n\t}\n\n\tasync resetPinnedStateForAllUserExtensions(pinned: boolean): Promise<void> {\n\t\ttry {\n\t\t\tawait this.joinAllSettled(this.userDataProfilesService.profiles.map(\n\t\t\t\tasync profile => {\n\t\t\t\t\tconst extensions = await this.getInstalled(ExtensionType.User, profile.extensionsResource);\n\t\t\t\t\tawait this.joinAllSettled(extensions.map(\n\t\t\t\t\t\tasync extension => {\n\t\t\t\t\t\t\tif (extension.pinned !== pinned) {\n\t\t\t\t\t\t\t\tawait this.updateMetadata(extension, { pinned }, profile.extensionsResource);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}));\n\t\t\t\t}));\n\t\t} catch (error) {\n\t\t\tthis.logService.error('Error while resetting pinned state for all user extensions', getErrorMessage(error));\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprotected async installExtensions(extensions: InstallableExtension[]): Promise<InstallExtensionResult[]> {\n\t\tconst installExtensionResultsMap = new Map<string, InstallExtensionResult & { profileLocation: URI }>();\n\t\tconst installingExtensionsMap = new Map<string, { task: IInstallExtensionTask; root: IInstallExtensionTask | undefined }>();\n\t\tconst alreadyRequestedInstallations: Promise<any>[] = [];\n\n\t\tconst getInstallExtensionTaskKey = (extension: IGalleryExtension, profileLocation: URI) => `${ExtensionKey.create(extension).toString()}-${profileLocation.toString()}`;\n\t\tconst createInstallExtensionTask = (manifest: IExtensionManifest, extension: IGalleryExtension | URI, options: InstallExtensionTaskOptions, root: IInstallExtensionTask | undefined): void => {\n\t\t\tif (!URI.isUri(extension)) {\n\t\t\t\tif (installingExtensionsMap.has(`${extension.identifier.id.toLowerCase()}-${options.profileLocation.toString()}`)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst existingInstallingExtension = this.installingExtensions.get(getInstallExtensionTaskKey(extension, options.profileLocation));\n\t\t\t\tif (existingInstallingExtension) {\n\t\t\t\t\tif (root && this.canWaitForTask(root, existingInstallingExtension.task)) {\n\t\t\t\t\t\tconst identifier = existingInstallingExtension.task.identifier;\n\t\t\t\t\t\tthis.logService.info('Waiting for already requested installing extension', identifier.id, root.identifier.id, options.profileLocation.toString());\n\t\t\t\t\t\texistingInstallingExtension.waitingTasks.push(root);\n\t\t\t\t\t\t// add promise that waits until the extension is completely installed, ie., onDidInstallExtensions event is triggered for this extension\n\t\t\t\t\t\talreadyRequestedInstallations.push(\n\t\t\t\t\t\t\tEvent.toPromise(\n\t\t\t\t\t\t\t\tEvent.filter(this.onDidInstallExtensions, results => results.some(result => areSameExtensions(result.identifier, identifier)))\n\t\t\t\t\t\t\t).then(results => {\n\t\t\t\t\t\t\t\tthis.logService.info('Finished waiting for already requested installing extension', identifier.id, root.identifier.id, options.profileLocation.toString());\n\t\t\t\t\t\t\t\tconst result = results.find(result => areSameExtensions(result.identifier, identifier));\n\t\t\t\t\t\t\t\tif (!result?.local) {\n\t\t\t\t\t\t\t\t\t// Extension failed to install\n\t\t\t\t\t\t\t\t\tthrow new Error(`Extension ${identifier.id} is not installed`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst installExtensionTask = this.createInstallExtensionTask(manifest, extension, options);\n\t\t\tconst key = `${getGalleryExtensionId(manifest.publisher, manifest.name)}-${options.profileLocation.toString()}`;\n\t\t\tinstallingExtensionsMap.set(key, { task: installExtensionTask, root });\n\t\t\tthis._onInstallExtension.fire({ identifier: installExtensionTask.identifier, source: extension, profileLocation: options.profileLocation });\n\t\t\tthis.logService.info('Installing extension:', installExtensionTask.identifier.id, options);\n\t\t\t// only cache gallery extensions tasks\n\t\t\tif (!URI.isUri(extension)) {\n\t\t\t\tthis.installingExtensions.set(getInstallExtensionTaskKey(extension, options.profileLocation), { task: installExtensionTask, waitingTasks: [] });\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\t// Start installing extensions\n\t\t\tfor (const { manifest, extension, options } of extensions) {\n\t\t\t\tconst isApplicationScoped = options.isApplicationScoped || options.isBuiltin || isApplicationScopedExtension(manifest);\n\t\t\t\tconst installExtensionTaskOptions: InstallExtensionTaskOptions = {\n\t\t\t\t\t...options,\n\t\t\t\t\tisApplicationScoped,\n\t\t\t\t\tprofileLocation: isApplicationScoped ? this.userDataProfilesService.defaultProfile.extensionsResource : options.profileLocation ?? this.getCurrentExtensionsManifestLocation(),\n\t\t\t\t\tproductVersion: options.productVersion ?? { version: this.productService.version, date: this.productService.date }\n\t\t\t\t};\n\n\t\t\t\tconst existingInstallExtensionTask = !URI.isUri(extension) ? this.installingExtensions.get(getInstallExtensionTaskKey(extension, installExtensionTaskOptions.profileLocation)) : undefined;\n\t\t\t\tif (existingInstallExtensionTask) {\n\t\t\t\t\tthis.logService.info('Extension is already requested to install', existingInstallExtensionTask.task.identifier.id, installExtensionTaskOptions.profileLocation.toString());\n\t\t\t\t\talreadyRequestedInstallations.push(existingInstallExtensionTask.task.waitUntilTaskIsFinished());\n\t\t\t\t} else {\n\t\t\t\t\tcreateInstallExtensionTask(manifest, extension, installExtensionTaskOptions, undefined);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// collect and start installing all dependencies and pack extensions\n\t\t\tawait Promise.all([...installingExtensionsMap.values()].map(async ({ task }) => {\n\t\t\t\tif (task.options.donotIncludePackAndDependencies) {\n\t\t\t\t\tthis.logService.info('Installing the extension without checking dependencies and pack', task.identifier.id);\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet preferPreRelease = this.preferPreReleases;\n\t\t\t\t\t\tif (task.options.installPreReleaseVersion) {\n\t\t\t\t\t\t\tpreferPreRelease = true;\n\t\t\t\t\t\t} else if (!URI.isUri(task.source) && task.source.hasPreReleaseVersion) {\n\t\t\t\t\t\t\t// Explicitly asked to install the release version\n\t\t\t\t\t\t\tpreferPreRelease = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst installed = await this.getInstalled(undefined, task.options.profileLocation, task.options.productVersion);\n\t\t\t\t\t\tconst allDepsAndPackExtensionsToInstall = await this.getAllDepsAndPackExtensions(task.identifier, task.manifest, preferPreRelease, task.options.productVersion, installed);\n\t\t\t\t\t\tconst options: InstallExtensionTaskOptions = { ...task.options, pinned: false, installGivenVersion: false, context: { ...task.options.context, [EXTENSION_INSTALL_DEP_PACK_CONTEXT]: true } };\n\t\t\t\t\t\tfor (const { gallery, manifest } of distinct(allDepsAndPackExtensionsToInstall, ({ gallery }) => gallery.identifier.id)) {\n\t\t\t\t\t\t\tconst existing = installed.find(e => areSameExtensions(e.identifier, gallery.identifier));\n\t\t\t\t\t\t\t// Skip if the extension is already installed and has the same application scope\n\t\t\t\t\t\t\tif (existing && existing.isApplicationScoped === !!options.isApplicationScoped) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcreateInstallExtensionTask(manifest, gallery, options, task);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t// Installing through VSIX\n\t\t\t\t\t\tif (URI.isUri(task.source)) {\n\t\t\t\t\t\t\t// Ignore installing dependencies and packs\n\t\t\t\t\t\t\tif (isNonEmptyArray(task.manifest.extensionDependencies)) {\n\t\t\t\t\t\t\t\tthis.logService.warn(`Cannot install dependencies of extension:`, task.identifier.id, error.message);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (isNonEmptyArray(task.manifest.extensionPack)) {\n\t\t\t\t\t\t\t\tthis.logService.warn(`Cannot install packed extensions of extension:`, task.identifier.id, error.message);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.logService.error('Error while preparing to install dependencies and extension packs of the extension:', task.identifier.id);\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tconst otherProfilesToUpdate = await this.getOtherProfilesToUpdateExtension([...installingExtensionsMap.values()].map(({ task }) => task));\n\t\t\tfor (const [profileLocation, task] of otherProfilesToUpdate) {\n\t\t\t\tcreateInstallExtensionTask(task.manifest, task.source, { ...task.options, profileLocation }, undefined);\n\t\t\t}\n\n\t\t\t// Install extensions in parallel and wait until all extensions are installed / failed\n\t\t\tawait this.joinAllSettled([...installingExtensionsMap.entries()].map(async ([key, { task }]) => {\n\t\t\t\tconst startTime = new Date().getTime();\n\t\t\t\tlet local: ILocalExtension;\n\t\t\t\ttry {\n\t\t\t\t\tlocal = await task.run();\n\t\t\t\t\tawait this.joinAllSettled(this.participants.map(participant => participant.postInstall(local, task.source, task.options, CancellationToken.None)), ExtensionManagementErrorCode.PostInstall);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconst error = toExtensionManagementError(e);\n\t\t\t\t\tif (!URI.isUri(task.source)) {\n\t\t\t\t\t\treportTelemetry(this.telemetryService, task.operation === InstallOperation.Update ? 'extensionGallery:update' : 'extensionGallery:install', {\n\t\t\t\t\t\t\textensionData: getGalleryExtensionTelemetryData(task.source),\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\tsource: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT]\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tinstallExtensionResultsMap.set(key, { error, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, applicationScoped: task.options.isApplicationScoped });\n\t\t\t\t\tthis.logService.error('Error while installing the extension', task.identifier.id, getErrorMessage(error), task.options.profileLocation.toString());\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tif (!URI.isUri(task.source)) {\n\t\t\t\t\tconst isUpdate = task.operation === InstallOperation.Update;\n\t\t\t\t\tconst durationSinceUpdate = isUpdate ? undefined : (new Date().getTime() - task.source.lastUpdated) / 1000;\n\t\t\t\t\treportTelemetry(this.telemetryService, isUpdate ? 'extensionGallery:update' : 'extensionGallery:install', {\n\t\t\t\t\t\textensionData: getGalleryExtensionTelemetryData(task.source),\n\t\t\t\t\t\tverificationStatus: task.verificationStatus,\n\t\t\t\t\t\tduration: new Date().getTime() - startTime,\n\t\t\t\t\t\tdurationSinceUpdate,\n\t\t\t\t\t\tsource: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT]\n\t\t\t\t\t});\n\t\t\t\t\t// In web, report extension install statistics explicitly. In Desktop, statistics are automatically updated while downloading the VSIX.\n\t\t\t\t\tif (isWeb && task.operation !== InstallOperation.Update) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait this.galleryService.reportStatistic(local.manifest.publisher, local.manifest.name, local.manifest.version, StatisticType.Install);\n\t\t\t\t\t\t} catch (error) { /* ignore */ }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tinstallExtensionResultsMap.set(key, { local, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, applicationScoped: local.isApplicationScoped });\n\t\t\t}));\n\n\t\t\tif (alreadyRequestedInstallations.length) {\n\t\t\t\tawait this.joinAllSettled(alreadyRequestedInstallations);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst getAllDepsAndPacks = (extension: ILocalExtension, profileLocation: URI, allDepsOrPacks: string[]) => {\n\t\t\t\tconst depsOrPacks = [];\n\t\t\t\tif (extension.manifest.extensionDependencies?.length) {\n\t\t\t\t\tdepsOrPacks.push(...extension.manifest.extensionDependencies);\n\t\t\t\t}\n\t\t\t\tif (extension.manifest.extensionPack?.length) {\n\t\t\t\t\tdepsOrPacks.push(...extension.manifest.extensionPack);\n\t\t\t\t}\n\t\t\t\tfor (const id of depsOrPacks) {\n\t\t\t\t\tif (allDepsOrPacks.includes(id.toLowerCase())) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tallDepsOrPacks.push(id.toLowerCase());\n\t\t\t\t\tconst installed = installExtensionResultsMap.get(`${id.toLowerCase()}-${profileLocation.toString()}`);\n\t\t\t\t\tif (installed?.local) {\n\t\t\t\t\t\tallDepsOrPacks = getAllDepsAndPacks(installed.local, profileLocation, allDepsOrPacks);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn allDepsOrPacks;\n\t\t\t};\n\t\t\tconst getErrorResult = (task: IInstallExtensionTask) => ({ identifier: task.identifier, operation: InstallOperation.Install, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, error });\n\n\t\t\tconst rollbackTasks: IUninstallExtensionTask[] = [];\n\t\t\tfor (const [key, { task, root }] of installingExtensionsMap) {\n\t\t\t\tconst result = installExtensionResultsMap.get(key);\n\t\t\t\tif (!result) {\n\t\t\t\t\ttask.cancel();\n\t\t\t\t\tinstallExtensionResultsMap.set(key, getErrorResult(task));\n\t\t\t\t}\n\t\t\t\t// If the extension is installed by a root task and the root task is failed, then uninstall the extension\n\t\t\t\telse if (result.local && root && !installExtensionResultsMap.get(`${root.identifier.id.toLowerCase()}-${task.options.profileLocation.toString()}`)?.local) {\n\t\t\t\t\trollbackTasks.push(this.createUninstallExtensionTask(result.local, { versionOnly: true, profileLocation: task.options.profileLocation }));\n\t\t\t\t\tinstallExtensionResultsMap.set(key, getErrorResult(task));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const [key, { task }] of installingExtensionsMap) {\n\t\t\t\tconst result = installExtensionResultsMap.get(key);\n\t\t\t\tif (!result?.local) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (task.options.donotIncludePackAndDependencies) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst depsOrPacks = getAllDepsAndPacks(result.local, task.options.profileLocation, [result.local.identifier.id.toLowerCase()]).slice(1);\n\t\t\t\tif (depsOrPacks.some(depOrPack => installingExtensionsMap.has(`${depOrPack.toLowerCase()}-${task.options.profileLocation.toString()}`) && !installExtensionResultsMap.get(`${depOrPack.toLowerCase()}-${task.options.profileLocation.toString()}`)?.local)) {\n\t\t\t\t\trollbackTasks.push(this.createUninstallExtensionTask(result.local, { versionOnly: true, profileLocation: task.options.profileLocation }));\n\t\t\t\t\tinstallExtensionResultsMap.set(key, getErrorResult(task));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (rollbackTasks.length) {\n\t\t\t\tawait Promise.allSettled(rollbackTasks.map(async rollbackTask => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait rollbackTask.run();\n\t\t\t\t\t\tthis.logService.info('Rollback: Uninstalled extension', rollbackTask.extension.identifier.id);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthis.logService.warn('Rollback: Error while uninstalling extension', rollbackTask.extension.identifier.id, getErrorMessage(error));\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t}\n\t\t} finally {\n\t\t\t// Finally, remove all the tasks from the cache\n\t\t\tfor (const { task } of installingExtensionsMap.values()) {\n\t\t\t\tif (task.source && !URI.isUri(task.source)) {\n\t\t\t\t\tthis.installingExtensions.delete(getInstallExtensionTaskKey(task.source, task.options.profileLocation));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst results = [...installExtensionResultsMap.values()];\n\t\tfor (const result of results) {\n\t\t\tif (result.local) {\n\t\t\t\tthis.logService.info(`Extension installed successfully:`, result.identifier.id, result.profileLocation.toString());\n\t\t\t}\n\t\t}\n\t\tthis._onDidInstallExtensions.fire(results);\n\t\treturn results;\n\t}\n\n\tprivate async getOtherProfilesToUpdateExtension(tasks: IInstallExtensionTask[]): Promise<[URI, IInstallExtensionTask][]> {\n\t\tconst otherProfilesToUpdate: [URI, IInstallExtensionTask][] = [];\n\t\tconst profileExtensionsCache = new ResourceMap<ILocalExtension[]>();\n\t\tfor (const task of tasks) {\n\t\t\tif (task.operation !== InstallOperation.Update\n\t\t\t\t|| task.options.isApplicationScoped\n\t\t\t\t|| task.options.pinned\n\t\t\t\t|| task.options.installGivenVersion\n\t\t\t\t|| URI.isUri(task.source)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const profile of this.userDataProfilesService.profiles) {\n\t\t\t\tif (this.uriIdentityService.extUri.isEqual(profile.extensionsResource, task.options.profileLocation)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tlet installedExtensions = profileExtensionsCache.get(profile.extensionsResource);\n\t\t\t\tif (!installedExtensions) {\n\t\t\t\t\tinstalledExtensions = await this.getInstalled(ExtensionType.User, profile.extensionsResource);\n\t\t\t\t\tprofileExtensionsCache.set(profile.extensionsResource, installedExtensions);\n\t\t\t\t}\n\t\t\t\tconst installedExtension = installedExtensions.find(e => areSameExtensions(e.identifier, task.identifier));\n\t\t\t\tif (installedExtension && !installedExtension.pinned) {\n\t\t\t\t\totherProfilesToUpdate.push([profile.extensionsResource, task]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn otherProfilesToUpdate;\n\t}\n\n\tprivate canWaitForTask(taskToWait: IInstallExtensionTask, taskToWaitFor: IInstallExtensionTask): boolean {\n\t\tfor (const [, { task, waitingTasks }] of this.installingExtensions.entries()) {\n\t\t\tif (task === taskToWait) {\n\t\t\t\t// Cannot be waited, If taskToWaitFor is waiting for taskToWait\n\t\t\t\tif (waitingTasks.includes(taskToWaitFor)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// Cannot be waited, If taskToWaitFor is waiting for tasks waiting for taskToWait\n\t\t\t\tif (waitingTasks.some(waitingTask => this.canWaitForTask(waitingTask, taskToWaitFor))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Cannot be waited, if the taskToWait cannot be waited for the task created the taskToWaitFor\n\t\t\t// Because, the task waits for the tasks it created\n\t\t\tif (task === taskToWaitFor && waitingTasks[0] && !this.canWaitForTask(taskToWait, waitingTasks[0])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate async joinAllSettled<T>(promises: Promise<T>[], errorCode?: ExtensionManagementErrorCode): Promise<T[]> {\n\t\tconst results: T[] = [];\n\t\tconst errors: ExtensionManagementError[] = [];\n\t\tconst promiseResults = await Promise.allSettled(promises);\n\t\tfor (const r of promiseResults) {\n\t\t\tif (r.status === 'fulfilled') {\n\t\t\t\tresults.push(r.value);\n\t\t\t} else {\n\t\t\t\terrors.push(toExtensionManagementError(r.reason, errorCode));\n\t\t\t}\n\t\t}\n\n\t\tif (!errors.length) {\n\t\t\treturn results;\n\t\t}\n\n\t\t// Throw if there are errors\n\t\tif (errors.length === 1) {\n\t\t\tthrow errors[0];\n\t\t}\n\n\t\tlet error = new ExtensionManagementError('', ExtensionManagementErrorCode.Unknown);\n\t\tfor (const current of errors) {\n\t\t\terror = new ExtensionManagementError(\n\t\t\t\terror.message ? `${error.message}, ${current.message}` : current.message,\n\t\t\t\tcurrent.code !== ExtensionManagementErrorCode.Unknown && current.code !== ExtensionManagementErrorCode.Internal ? current.code : error.code\n\t\t\t);\n\t\t}\n\t\tthrow error;\n\t}\n\n\tprivate async getAllDepsAndPackExtensions(extensionIdentifier: IExtensionIdentifier, manifest: IExtensionManifest, preferPreRelease: boolean, productVersion: IProductVersion, installed: ILocalExtension[]): Promise<{ gallery: IGalleryExtension; manifest: IExtensionManifest }[]> {\n\t\tif (!this.galleryService.isEnabled()) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst knownIdentifiers: IExtensionIdentifier[] = [];\n\n\t\tconst allDependenciesAndPacks: { gallery: IGalleryExtension; manifest: IExtensionManifest }[] = [];\n\t\tconst collectDependenciesAndPackExtensionsToInstall = async (extensionIdentifier: IExtensionIdentifier, manifest: IExtensionManifest): Promise<void> => {\n\t\t\tknownIdentifiers.push(extensionIdentifier);\n\t\t\tconst dependecies: string[] = manifest.extensionDependencies || [];\n\t\t\tconst dependenciesAndPackExtensions = [...dependecies];\n\t\t\tif (manifest.extensionPack) {\n\t\t\t\tconst existing = installed.find(e => areSameExtensions(e.identifier, extensionIdentifier));\n\t\t\t\tfor (const extension of manifest.extensionPack) {\n\t\t\t\t\t// add only those extensions which are new in currently installed extension\n\t\t\t\t\tif (!(existing && existing.manifest.extensionPack && existing.manifest.extensionPack.some(old => areSameExtensions({ id: old }, { id: extension })))) {\n\t\t\t\t\t\tif (dependenciesAndPackExtensions.every(e => !areSameExtensions({ id: e }, { id: extension }))) {\n\t\t\t\t\t\t\tdependenciesAndPackExtensions.push(extension);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dependenciesAndPackExtensions.length) {\n\t\t\t\t// filter out known extensions\n\t\t\t\tconst ids = dependenciesAndPackExtensions.filter(id => knownIdentifiers.every(galleryIdentifier => !areSameExtensions(galleryIdentifier, { id })));\n\t\t\t\tif (ids.length) {\n\t\t\t\t\tconst galleryExtensions = await this.galleryService.getExtensions(ids.map(id => ({ id, preRelease: preferPreRelease })), CancellationToken.None);\n\t\t\t\t\tfor (const galleryExtension of galleryExtensions) {\n\t\t\t\t\t\tif (knownIdentifiers.find(identifier => areSameExtensions(identifier, galleryExtension.identifier))) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst isDependency = dependecies.some(id => areSameExtensions({ id }, galleryExtension.identifier));\n\t\t\t\t\t\tlet compatible;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcompatible = await this.checkAndGetCompatibleVersion(galleryExtension, false, preferPreRelease, productVersion);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tif (!isDependency) {\n\t\t\t\t\t\t\t\tthis.logService.info('Skipping the packed extension as it cannot be installed', galleryExtension.identifier.id, getErrorMessage(error));\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tallDependenciesAndPacks.push({ gallery: compatible.extension, manifest: compatible.manifest });\n\t\t\t\t\t\tawait collectDependenciesAndPackExtensionsToInstall(compatible.extension.identifier, compatible.manifest);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tawait collectDependenciesAndPackExtensionsToInstall(extensionIdentifier, manifest);\n\t\treturn allDependenciesAndPacks;\n\t}\n\n\tprivate async checkAndGetCompatibleVersion(extension: IGalleryExtension, sameVersion: boolean, installPreRelease: boolean, productVersion: IProductVersion): Promise<{ extension: IGalleryExtension; manifest: IExtensionManifest }> {\n\t\tlet compatibleExtension: IGalleryExtension | null;\n\n\t\tconst extensionsControlManifest = await this.getExtensionsControlManifest();\n\t\tif (isMalicious(extension.identifier, extensionsControlManifest.malicious)) {\n\t\t\tthrow new ExtensionManagementError(nls.localize('malicious extension', \"Can't install '{0}' extension since it was reported to be problematic.\", extension.identifier.id), ExtensionManagementErrorCode.Malicious);\n\t\t}\n\n\t\tconst deprecationInfo = extensionsControlManifest.deprecated[extension.identifier.id.toLowerCase()];\n\t\tif (deprecationInfo?.extension?.autoMigrate) {\n\t\t\tthis.logService.info(`The '${extension.identifier.id}' extension is deprecated, fetching the compatible '${deprecationInfo.extension.id}' extension instead.`);\n\t\t\tcompatibleExtension = (await this.galleryService.getExtensions([{ id: deprecationInfo.extension.id, preRelease: deprecationInfo.extension.preRelease }], { targetPlatform: await this.getTargetPlatform(), compatible: true, productVersion }, CancellationToken.None))[0];\n\t\t\tif (!compatibleExtension) {\n\t\t\t\tthrow new ExtensionManagementError(nls.localize('notFoundDeprecatedReplacementExtension', \"Can't install '{0}' extension since it was deprecated and the replacement extension '{1}' can't be found.\", extension.identifier.id, deprecationInfo.extension.id), ExtensionManagementErrorCode.Deprecated);\n\t\t\t}\n\t\t}\n\n\t\telse {\n\t\t\tif (await this.canInstall(extension) !== true) {\n\t\t\t\tconst targetPlatform = await this.getTargetPlatform();\n\t\t\t\tthrow new ExtensionManagementError(nls.localize('incompatible platform', \"The '{0}' extension is not available in {1} for the {2}.\", extension.identifier.id, this.productService.nameLong, TargetPlatformToString(targetPlatform)), ExtensionManagementErrorCode.IncompatibleTargetPlatform);\n\t\t\t}\n\n\t\t\tcompatibleExtension = await this.getCompatibleVersion(extension, sameVersion, installPreRelease, productVersion);\n\t\t\tif (!compatibleExtension) {\n\t\t\t\tconst incompatibleApiProposalsMessages: string[] = [];\n\t\t\t\tif (!areApiProposalsCompatible(extension.properties.enabledApiProposals ?? [], incompatibleApiProposalsMessages)) {\n\t\t\t\t\tthrow new ExtensionManagementError(nls.localize('incompatibleAPI', \"Can't install '{0}' extension. {1}\", extension.displayName ?? extension.identifier.id, incompatibleApiProposalsMessages[0]), ExtensionManagementErrorCode.IncompatibleApi);\n\t\t\t\t}\n\t\t\t\t/** If no compatible release version is found, check if the extension has a release version or not and throw relevant error */\n\t\t\t\tif (!installPreRelease && extension.hasPreReleaseVersion && extension.properties.isPreReleaseVersion && (await this.galleryService.getExtensions([extension.identifier], CancellationToken.None))[0]) {\n\t\t\t\t\tthrow new ExtensionManagementError(nls.localize('notFoundReleaseExtension', \"Can't install release version of '{0}' extension because it has no release version.\", extension.displayName ?? extension.identifier.id), ExtensionManagementErrorCode.ReleaseVersionNotFound);\n\t\t\t\t}\n\t\t\t\tthrow new ExtensionManagementError(nls.localize('notFoundCompatibleDependency', \"Can't install '{0}' extension because it is not compatible with the current version of {1} (version {2}).\", extension.identifier.id, this.productService.nameLong, this.productService.version), ExtensionManagementErrorCode.Incompatible);\n\t\t\t}\n\t\t}\n\n\t\tthis.logService.info('Getting Manifest...', compatibleExtension.identifier.id);\n\t\tconst manifest = await this.galleryService.getManifest(compatibleExtension, CancellationToken.None);\n\t\tif (manifest === null) {\n\t\t\tthrow new ExtensionManagementError(`Missing manifest for extension ${compatibleExtension.identifier.id}`, ExtensionManagementErrorCode.Invalid);\n\t\t}\n\n\t\tif (manifest.version !== compatibleExtension.version) {\n\t\t\tthrow new ExtensionManagementError(`Cannot install '${compatibleExtension.identifier.id}' extension because of version mismatch in Marketplace`, ExtensionManagementErrorCode.Invalid);\n\t\t}\n\n\t\treturn { extension: compatibleExtension, manifest };\n\t}\n\n\tprotected async getCompatibleVersion(extension: IGalleryExtension, sameVersion: boolean, includePreRelease: boolean, productVersion: IProductVersion): Promise<IGalleryExtension | null> {\n\t\tconst targetPlatform = await this.getTargetPlatform();\n\t\tlet compatibleExtension: IGalleryExtension | null = null;\n\n\t\tif (!sameVersion && extension.hasPreReleaseVersion && extension.properties.isPreReleaseVersion !== includePreRelease) {\n\t\t\tcompatibleExtension = (await this.galleryService.getExtensions([{ ...extension.identifier, preRelease: includePreRelease }], { targetPlatform, compatible: true, productVersion }, CancellationToken.None))[0] || null;\n\t\t}\n\n\t\tif (!compatibleExtension && await this.galleryService.isExtensionCompatible(extension, includePreRelease, targetPlatform, productVersion)) {\n\t\t\tcompatibleExtension = extension;\n\t\t}\n\n\t\tif (!compatibleExtension) {\n\t\t\tif (sameVersion) {\n\t\t\t\tcompatibleExtension = (await this.galleryService.getExtensions([{ ...extension.identifier, version: extension.version }], { targetPlatform, compatible: true, productVersion }, CancellationToken.None))[0] || null;\n\t\t\t} else {\n\t\t\t\tcompatibleExtension = await this.galleryService.getCompatibleExtension(extension, includePreRelease, targetPlatform, productVersion);\n\t\t\t}\n\t\t}\n\n\t\treturn compatibleExtension;\n\t}\n\n\tasync uninstallExtensions(extensions: UninstallExtensionInfo[]): Promise<void> {\n\n\t\tconst getUninstallExtensionTaskKey = (extension: ILocalExtension, uninstallOptions: UninstallExtensionTaskOptions) => `${extension.identifier.id.toLowerCase()}${uninstallOptions.versionOnly ? `-${extension.manifest.version}` : ''}@${uninstallOptions.profileLocation.toString()}`;\n\n\t\tconst createUninstallExtensionTask = (extension: ILocalExtension, uninstallOptions: UninstallExtensionTaskOptions): IUninstallExtensionTask => {\n\t\t\tconst uninstallExtensionTask = this.createUninstallExtensionTask(extension, uninstallOptions);\n\t\t\tthis.uninstallingExtensions.set(getUninstallExtensionTaskKey(uninstallExtensionTask.extension, uninstallOptions), uninstallExtensionTask);\n\t\t\tthis.logService.info('Uninstalling extension from the profile:', `${extension.identifier.id}@${extension.manifest.version}`, uninstallOptions.profileLocation.toString());\n\t\t\tthis._onUninstallExtension.fire({ identifier: extension.identifier, profileLocation: uninstallOptions.profileLocation, applicationScoped: extension.isApplicationScoped });\n\t\t\treturn uninstallExtensionTask;\n\t\t};\n\n\t\tconst postUninstallExtension = (extension: ILocalExtension, uninstallOptions: UninstallExtensionTaskOptions, error?: ExtensionManagementError): void => {\n\t\t\tif (error) {\n\t\t\t\tthis.logService.error('Failed to uninstall extension from the profile:', `${extension.identifier.id}@${extension.manifest.version}`, uninstallOptions.profileLocation.toString(), error.message);\n\t\t\t} else {\n\t\t\t\tthis.logService.info('Successfully uninstalled extension from the profile', `${extension.identifier.id}@${extension.manifest.version}`, uninstallOptions.profileLocation.toString());\n\t\t\t}\n\t\t\treportTelemetry(this.telemetryService, 'extensionGallery:uninstall', { extensionData: getLocalExtensionTelemetryData(extension), error });\n\t\t\tthis._onDidUninstallExtension.fire({ identifier: extension.identifier, error: error?.code, profileLocation: uninstallOptions.profileLocation, applicationScoped: extension.isApplicationScoped });\n\t\t};\n\n\t\tconst allTasks: IUninstallExtensionTask[] = [];\n\t\tconst processedTasks: IUninstallExtensionTask[] = [];\n\t\tconst alreadyRequestedUninstalls: Promise<any>[] = [];\n\t\tconst extensionsToRemove: ILocalExtension[] = [];\n\n\t\tconst installedExtensionsMap = new ResourceMap<ILocalExtension[]>();\n\t\tconst getInstalledExtensions = async (profileLocation: URI) => {\n\t\t\tlet installed = installedExtensionsMap.get(profileLocation);\n\t\t\tif (!installed) {\n\t\t\t\tinstalledExtensionsMap.set(profileLocation, installed = await this.getInstalled(ExtensionType.User, profileLocation));\n\t\t\t}\n\t\t\treturn installed;\n\t\t};\n\n\t\tfor (const { extension, options } of extensions) {\n\t\t\tconst uninstallOptions: UninstallExtensionTaskOptions = {\n\t\t\t\t...options,\n\t\t\t\tprofileLocation: extension.isApplicationScoped ? this.userDataProfilesService.defaultProfile.extensionsResource : options?.profileLocation ?? this.getCurrentExtensionsManifestLocation()\n\t\t\t};\n\t\t\tconst uninstallExtensionTask = this.uninstallingExtensions.get(getUninstallExtensionTaskKey(extension, uninstallOptions));\n\t\t\tif (uninstallExtensionTask) {\n\t\t\t\tthis.logService.info('Extensions is already requested to uninstall', extension.identifier.id);\n\t\t\t\talreadyRequestedUninstalls.push(uninstallExtensionTask.waitUntilTaskIsFinished());\n\t\t\t} else {\n\t\t\t\tallTasks.push(createUninstallExtensionTask(extension, uninstallOptions));\n\t\t\t}\n\n\t\t\tif (uninstallOptions.remove || extension.isApplicationScoped) {\n\t\t\t\tif (uninstallOptions.remove) {\n\t\t\t\t\textensionsToRemove.push(extension);\n\t\t\t\t}\n\t\t\t\tfor (const profile of this.userDataProfilesService.profiles) {\n\t\t\t\t\tif (this.uriIdentityService.extUri.isEqual(profile.extensionsResource, uninstallOptions.profileLocation)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst installed = await getInstalledExtensions(profile.extensionsResource);\n\t\t\t\t\tconst profileExtension = installed.find(e => areSameExtensions(e.identifier, extension.identifier));\n\t\t\t\t\tif (profileExtension) {\n\t\t\t\t\t\tconst uninstallOptionsWithProfile = { ...uninstallOptions, profileLocation: profile.extensionsResource };\n\t\t\t\t\t\tconst uninstallExtensionTask = this.uninstallingExtensions.get(getUninstallExtensionTaskKey(profileExtension, uninstallOptionsWithProfile));\n\t\t\t\t\t\tif (uninstallExtensionTask) {\n\t\t\t\t\t\t\tthis.logService.info('Extensions is already requested to uninstall', profileExtension.identifier.id);\n\t\t\t\t\t\t\talreadyRequestedUninstalls.push(uninstallExtensionTask.waitUntilTaskIsFinished());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tallTasks.push(createUninstallExtensionTask(profileExtension, uninstallOptionsWithProfile));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tfor (const task of allTasks.slice(0)) {\n\t\t\t\tconst installed = await getInstalledExtensions(task.options.profileLocation);\n\n\t\t\t\tif (task.options.donotIncludePack) {\n\t\t\t\t\tthis.logService.info('Uninstalling the extension without including packed extension', `${task.extension.identifier.id}@${task.extension.manifest.version}`);\n\t\t\t\t} else {\n\t\t\t\t\tconst packedExtensions = this.getAllPackExtensionsToUninstall(task.extension, installed);\n\t\t\t\t\tfor (const packedExtension of packedExtensions) {\n\t\t\t\t\t\tif (this.uninstallingExtensions.has(getUninstallExtensionTaskKey(packedExtension, task.options))) {\n\t\t\t\t\t\t\tthis.logService.info('Extensions is already requested to uninstall', packedExtension.identifier.id);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tallTasks.push(createUninstallExtensionTask(packedExtension, task.options));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (task.options.donotCheckDependents) {\n\t\t\t\t\tthis.logService.info('Uninstalling the extension without checking dependents', `${task.extension.identifier.id}@${task.extension.manifest.version}`);\n\t\t\t\t} else {\n\t\t\t\t\tthis.checkForDependents(allTasks.map(task => task.extension), installed, task.extension);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Uninstall extensions in parallel and wait until all extensions are uninstalled / failed\n\t\t\tawait this.joinAllSettled(allTasks.map(async task => {\n\t\t\t\ttry {\n\t\t\t\t\tawait task.run();\n\t\t\t\t\tawait this.joinAllSettled(this.participants.map(participant => participant.postUninstall(task.extension, task.options, CancellationToken.None)));\n\t\t\t\t\t// only report if extension has a mapped gallery extension. UUID identifies the gallery extension.\n\t\t\t\t\tif (task.extension.identifier.uuid) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait this.galleryService.reportStatistic(task.extension.manifest.publisher, task.extension.manifest.name, task.extension.manifest.version, StatisticType.Uninstall);\n\t\t\t\t\t\t} catch (error) { /* ignore */ }\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconst error = toExtensionManagementError(e);\n\t\t\t\t\tpostUninstallExtension(task.extension, task.options, error);\n\t\t\t\t\tthrow error;\n\t\t\t\t} finally {\n\t\t\t\t\tprocessedTasks.push(task);\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tif (alreadyRequestedUninstalls.length) {\n\t\t\t\tawait this.joinAllSettled(alreadyRequestedUninstalls);\n\t\t\t}\n\n\t\t\tfor (const task of allTasks) {\n\t\t\t\tpostUninstallExtension(task.extension, task.options);\n\t\t\t}\n\n\t\t\tif (extensionsToRemove.length) {\n\t\t\t\tawait this.joinAllSettled(extensionsToRemove.map(extension => this.deleteExtension(extension)));\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconst error = toExtensionManagementError(e);\n\t\t\tfor (const task of allTasks) {\n\t\t\t\t// cancel the tasks\n\t\t\t\ttry { task.cancel(); } catch (error) { /* ignore */ }\n\t\t\t\tif (!processedTasks.includes(task)) {\n\t\t\t\t\tpostUninstallExtension(task.extension, task.options, error);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\t// Remove tasks from cache\n\t\t\tfor (const task of allTasks) {\n\t\t\t\tif (!this.uninstallingExtensions.delete(getUninstallExtensionTaskKey(task.extension, task.options))) {\n\t\t\t\t\tthis.logService.warn('Uninstallation task is not found in the cache', task.extension.identifier.id);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate checkForDependents(extensionsToUninstall: ILocalExtension[], installed: ILocalExtension[], extensionToUninstall: ILocalExtension): void {\n\t\tfor (const extension of extensionsToUninstall) {\n\t\t\tconst dependents = this.getDependents(extension, installed);\n\t\t\tif (dependents.length) {\n\t\t\t\tconst remainingDependents = dependents.filter(dependent => !extensionsToUninstall.some(e => areSameExtensions(e.identifier, dependent.identifier)));\n\t\t\t\tif (remainingDependents.length) {\n\t\t\t\t\tthrow new Error(this.getDependentsErrorMessage(extension, remainingDependents, extensionToUninstall));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getDependentsErrorMessage(dependingExtension: ILocalExtension, dependents: ILocalExtension[], extensionToUninstall: ILocalExtension): string {\n\t\tif (extensionToUninstall === dependingExtension) {\n\t\t\tif (dependents.length === 1) {\n\t\t\t\treturn nls.localize('singleDependentError', \"Cannot uninstall '{0}' extension. '{1}' extension depends on this.\",\n\t\t\t\t\textensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name);\n\t\t\t}\n\t\t\tif (dependents.length === 2) {\n\t\t\t\treturn nls.localize('twoDependentsError', \"Cannot uninstall '{0}' extension. '{1}' and '{2}' extensions depend on this.\",\n\t\t\t\t\textensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);\n\t\t\t}\n\t\t\treturn nls.localize('multipleDependentsError', \"Cannot uninstall '{0}' extension. '{1}', '{2}' and other extension depend on this.\",\n\t\t\t\textensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);\n\t\t}\n\t\tif (dependents.length === 1) {\n\t\t\treturn nls.localize('singleIndirectDependentError', \"Cannot uninstall '{0}' extension . It includes uninstalling '{1}' extension and '{2}' extension depends on this.\",\n\t\t\t\textensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependingExtension.manifest.displayName\n\t\t\t|| dependingExtension.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name);\n\t\t}\n\t\tif (dependents.length === 2) {\n\t\t\treturn nls.localize('twoIndirectDependentsError', \"Cannot uninstall '{0}' extension. It includes uninstalling '{1}' extension and '{2}' and '{3}' extensions depend on this.\",\n\t\t\t\textensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependingExtension.manifest.displayName\n\t\t\t|| dependingExtension.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);\n\t\t}\n\t\treturn nls.localize('multipleIndirectDependentsError', \"Cannot uninstall '{0}' extension. It includes uninstalling '{1}' extension and '{2}', '{3}' and other extensions depend on this.\",\n\t\t\textensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependingExtension.manifest.displayName\n\t\t|| dependingExtension.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);\n\n\t}\n\n\tprivate getAllPackExtensionsToUninstall(extension: ILocalExtension, installed: ILocalExtension[], checked: ILocalExtension[] = []): ILocalExtension[] {\n\t\tif (checked.indexOf(extension) !== -1) {\n\t\t\treturn [];\n\t\t}\n\t\tchecked.push(extension);\n\t\tconst extensionsPack = extension.manifest.extensionPack ? extension.manifest.extensionPack : [];\n\t\tif (extensionsPack.length) {\n\t\t\tconst packedExtensions = installed.filter(i => !i.isBuiltin && extensionsPack.some(id => areSameExtensions({ id }, i.identifier)));\n\t\t\tconst packOfPackedExtensions: ILocalExtension[] = [];\n\t\t\tfor (const packedExtension of packedExtensions) {\n\t\t\t\tpackOfPackedExtensions.push(...this.getAllPackExtensionsToUninstall(packedExtension, installed, checked));\n\t\t\t}\n\t\t\treturn [...packedExtensions, ...packOfPackedExtensions];\n\t\t}\n\t\treturn [];\n\t}\n\n\tprivate getDependents(extension: ILocalExtension, installed: ILocalExtension[]): ILocalExtension[] {\n\t\treturn installed.filter(e => e.manifest.extensionDependencies && e.manifest.extensionDependencies.some(id => areSameExtensions({ id }, extension.identifier)));\n\t}\n\n\tprivate async updateControlCache(): Promise<IExtensionsControlManifest> {\n\t\ttry {\n\t\t\tthis.logService.trace('ExtensionManagementService.updateControlCache');\n\t\t\treturn await this.galleryService.getExtensionsControlManifest();\n\t\t} catch (err) {\n\t\t\tthis.logService.trace('ExtensionManagementService.refreshControlCache - failed to get extension control manifest', getErrorMessage(err));\n\t\t\treturn { malicious: [], deprecated: {}, search: [] };\n\t\t}\n\t}\n\n\tprotected abstract getCurrentExtensionsManifestLocation(): URI;\n\tprotected abstract createInstallExtensionTask(manifest: IExtensionManifest, extension: URI | IGalleryExtension, options: InstallExtensionTaskOptions): IInstallExtensionTask;\n\tprotected abstract createUninstallExtensionTask(extension: ILocalExtension, options: UninstallExtensionTaskOptions): IUninstallExtensionTask;\n\tprotected abstract copyExtension(extension: ILocalExtension, fromProfileLocation: URI, toProfileLocation: URI, metadata?: Partial<Metadata>): Promise<ILocalExtension>;\n\tprotected abstract moveExtension(extension: ILocalExtension, fromProfileLocation: URI, toProfileLocation: URI, metadata?: Partial<Metadata>): Promise<ILocalExtension>;\n\tprotected abstract removeExtension(extension: ILocalExtension, fromProfileLocation: URI): Promise<void>;\n\tprotected abstract deleteExtension(extension: ILocalExtension): Promise<void>;\n}\n\nexport function toExtensionManagementError(error: Error, code?: ExtensionManagementErrorCode): ExtensionManagementError {\n\tif (error instanceof ExtensionManagementError) {\n\t\treturn error;\n\t}\n\tlet extensionManagementError: ExtensionManagementError;\n\tif (error instanceof ExtensionGalleryError) {\n\t\textensionManagementError = new ExtensionManagementError(error.message, error.code === ExtensionGalleryErrorCode.DownloadFailedWriting ? ExtensionManagementErrorCode.DownloadFailedWriting : ExtensionManagementErrorCode.Gallery);\n\t} else {\n\t\textensionManagementError = new ExtensionManagementError(error.message, isCancellationError(error) ? ExtensionManagementErrorCode.Cancelled : (code ?? ExtensionManagementErrorCode.Internal));\n\t}\n\textensionManagementError.stack = error.stack;\n\treturn extensionManagementError;\n}\n\nfunction reportTelemetry(telemetryService: ITelemetryService, eventName: string,\n\t{\n\t\textensionData,\n\t\tverificationStatus,\n\t\tduration,\n\t\terror,\n\t\tsource,\n\t\tdurationSinceUpdate\n\t}: {\n\t\textensionData: any;\n\t\tverificationStatus?: ExtensionSignatureVerificationCode;\n\t\tduration?: number;\n\t\tdurationSinceUpdate?: number;\n\t\tsource?: string;\n\t\terror?: ExtensionManagementError | ExtensionGalleryError;\n\t}): void {\n\n\t/* __GDPR__\n\t\t\"extensionGallery:install\" : {\n\t\t\t\"owner\": \"sandy081\",\n\t\t\t\"success\": { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\", \"isMeasurement\": true },\n\t\t\t\"duration\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\", \"isMeasurement\": true },\n\t\t\t\"durationSinceUpdate\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\", \"isMeasurement\": true },\n\t\t\t\"errorcode\": { \"classification\": \"CallstackOrException\", \"purpose\": \"PerformanceAndHealth\" },\n\t\t\t\"recommendationReason\": { \"retiredFromVersion\": \"1.23.0\", \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\", \"isMeasurement\": true },\n\t\t\t\"verificationStatus\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\t\"source\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\t\"${include}\": [\n\t\t\t\t\"${GalleryExtensionTelemetryData}\"\n\t\t\t]\n\t\t}\n\t*/\n\t/* __GDPR__\n\t\t\"extensionGallery:uninstall\" : {\n\t\t\t\"owner\": \"sandy081\",\n\t\t\t\"success\": { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\", \"isMeasurement\": true },\n\t\t\t\"duration\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\", \"isMeasurement\": true },\n\t\t\t\"errorcode\": { \"classification\": \"CallstackOrException\", \"purpose\": \"PerformanceAndHealth\" },\n\t\t\t\"${include}\": [\n\t\t\t\t\"${GalleryExtensionTelemetryData}\"\n\t\t\t]\n\t\t}\n\t*/\n\t/* __GDPR__\n\t\t\"extensionGallery:update\" : {\n\t\t\t\"owner\": \"sandy081\",\n\t\t\t\"success\": { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\", \"isMeasurement\": true },\n\t\t\t\"duration\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"PerformanceAndHealth\", \"isMeasurement\": true },\n\t\t\t\"errorcode\": { \"classification\": \"CallstackOrException\", \"purpose\": \"PerformanceAndHealth\" },\n\t\t\t\"verificationStatus\" : { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\t\"source\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\" },\n\t\t\t\"${include}\": [\n\t\t\t\t\"${GalleryExtensionTelemetryData}\"\n\t\t\t]\n\t\t}\n\t*/\n\ttelemetryService.publicLog(eventName, {\n\t\t...extensionData,\n\t\tsource,\n\t\tduration,\n\t\tdurationSinceUpdate,\n\t\tsuccess: !error,\n\t\terrorcode: error?.code,\n\t\tverificationStatus: verificationStatus === ExtensionSignatureVerificationCode.Success ? 'Verified' : (verificationStatus ?? 'Unverified')\n\t});\n}\n\nexport abstract class AbstractExtensionTask<T> {\n\n\tprivate readonly barrier = new Barrier();\n\tprivate cancellablePromise: CancelablePromise<T> | undefined;\n\n\tasync waitUntilTaskIsFinished(): Promise<T> {\n\t\tawait this.barrier.wait();\n\t\treturn this.cancellablePromise!;\n\t}\n\n\trun(): Promise<T> {\n\t\tif (!this.cancellablePromise) {\n\t\t\tthis.cancellablePromise = createCancelablePromise(token => this.doRun(token));\n\t\t}\n\t\tthis.barrier.open();\n\t\treturn this.cancellablePromise;\n\t}\n\n\tcancel(): void {\n\t\tif (!this.cancellablePromise) {\n\t\t\tthis.cancellablePromise = createCancelablePromise(token => {\n\t\t\t\treturn new Promise((c, e) => {\n\t\t\t\t\tconst disposable = token.onCancellationRequested(() => {\n\t\t\t\t\t\tdisposable.dispose();\n\t\t\t\t\t\te(new CancellationError());\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t\tthis.barrier.open();\n\t\t}\n\t\tthis.cancellablePromise.cancel();\n\t}\n\n\tprotected abstract doRun(token: CancellationToken): Promise<T>;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Queue } from '../../../base/common/async.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { Metadata, isIExtensionIdentifier } from './extensionManagement.js';\nimport { areSameExtensions } from './extensionManagementUtil.js';\nimport { IExtension, IExtensionIdentifier } from '../../extensions/common/extensions.js';\nimport { FileOperationResult, IFileService, toFileOperationResult } from '../../files/common/files.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { Mutable, isObject, isString, isUndefined } from '../../../base/common/types.js';\nimport { getErrorMessage } from '../../../base/common/errors.js';\n\ninterface IStoredProfileExtension {\n\tidentifier: IExtensionIdentifier;\n\tlocation: UriComponents | string;\n\trelativeLocation: string | undefined;\n\tversion: string;\n\tmetadata?: Metadata;\n}\n\nexport const enum ExtensionsProfileScanningErrorCode {\n\n\t/**\n\t * Error when trying to scan extensions from a profile that does not exist.\n\t */\n\tERROR_PROFILE_NOT_FOUND = 'ERROR_PROFILE_NOT_FOUND',\n\n\t/**\n\t * Error when profile file is invalid.\n\t */\n\tERROR_INVALID_CONTENT = 'ERROR_INVALID_CONTENT',\n\n}\n\nexport class ExtensionsProfileScanningError extends Error {\n\tconstructor(message: string, public code: ExtensionsProfileScanningErrorCode) {\n\t\tsuper(message);\n\t}\n}\n\nexport interface IScannedProfileExtension {\n\treadonly identifier: IExtensionIdentifier;\n\treadonly version: string;\n\treadonly location: URI;\n\treadonly metadata?: Metadata;\n}\n\nexport interface ProfileExtensionsEvent {\n\treadonly extensions: readonly IScannedProfileExtension[];\n\treadonly profileLocation: URI;\n}\n\nexport interface DidAddProfileExtensionsEvent extends ProfileExtensionsEvent {\n\treadonly error?: Error;\n}\n\nexport interface DidRemoveProfileExtensionsEvent extends ProfileExtensionsEvent {\n\treadonly error?: Error;\n}\n\nexport interface IProfileExtensionsScanOptions {\n\treadonly bailOutWhenFileNotFound?: boolean;\n}\n\nexport const IExtensionsProfileScannerService = createDecorator<IExtensionsProfileScannerService>('IExtensionsProfileScannerService');\nexport interface IExtensionsProfileScannerService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly onAddExtensions: Event<ProfileExtensionsEvent>;\n\treadonly onDidAddExtensions: Event<DidAddProfileExtensionsEvent>;\n\treadonly onRemoveExtensions: Event<ProfileExtensionsEvent>;\n\treadonly onDidRemoveExtensions: Event<DidRemoveProfileExtensionsEvent>;\n\n\tscanProfileExtensions(profileLocation: URI, options?: IProfileExtensionsScanOptions): Promise<IScannedProfileExtension[]>;\n\taddExtensionsToProfile(extensions: [IExtension, Metadata | undefined][], profileLocation: URI, keepExistingVersions?: boolean): Promise<IScannedProfileExtension[]>;\n\tupdateMetadata(extensions: [IExtension, Metadata | undefined][], profileLocation: URI): Promise<IScannedProfileExtension[]>;\n\tremoveExtensionsFromProfile(extensions: IExtensionIdentifier[], profileLocation: URI): Promise<void>;\n}\n\nexport abstract class AbstractExtensionsProfileScannerService extends Disposable implements IExtensionsProfileScannerService {\n\treadonly _serviceBrand: undefined;\n\n\tprivate readonly _onAddExtensions = this._register(new Emitter<ProfileExtensionsEvent>());\n\treadonly onAddExtensions = this._onAddExtensions.event;\n\n\tprivate readonly _onDidAddExtensions = this._register(new Emitter<DidAddProfileExtensionsEvent>());\n\treadonly onDidAddExtensions = this._onDidAddExtensions.event;\n\n\tprivate readonly _onRemoveExtensions = this._register(new Emitter<ProfileExtensionsEvent>());\n\treadonly onRemoveExtensions = this._onRemoveExtensions.event;\n\n\tprivate readonly _onDidRemoveExtensions = this._register(new Emitter<DidRemoveProfileExtensionsEvent>());\n\treadonly onDidRemoveExtensions = this._onDidRemoveExtensions.event;\n\n\tprivate readonly resourcesAccessQueueMap = new ResourceMap<Queue<IScannedProfileExtension[]>>();\n\n\tconstructor(\n\t\tprivate readonly extensionsLocation: URI,\n\t\t@IFileService private readonly fileService: IFileService,\n\t\t@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,\n\t\t@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,\n\t\t@ILogService private readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t}\n\n\tscanProfileExtensions(profileLocation: URI, options?: IProfileExtensionsScanOptions): Promise<IScannedProfileExtension[]> {\n\t\treturn this.withProfileExtensions(profileLocation, undefined, options);\n\t}\n\n\tasync addExtensionsToProfile(extensions: [IExtension, Metadata | undefined][], profileLocation: URI, keepExistingVersions?: boolean): Promise<IScannedProfileExtension[]> {\n\t\tconst extensionsToRemove: IScannedProfileExtension[] = [];\n\t\tconst extensionsToAdd: IScannedProfileExtension[] = [];\n\t\ttry {\n\t\t\tawait this.withProfileExtensions(profileLocation, existingExtensions => {\n\t\t\t\tconst result: IScannedProfileExtension[] = [];\n\t\t\t\tif (keepExistingVersions) {\n\t\t\t\t\tresult.push(...existingExtensions);\n\t\t\t\t} else {\n\t\t\t\t\tfor (const existing of existingExtensions) {\n\t\t\t\t\t\tif (extensions.some(([e]) => areSameExtensions(e.identifier, existing.identifier) && e.manifest.version !== existing.version)) {\n\t\t\t\t\t\t\t// Remove the existing extension with different version\n\t\t\t\t\t\t\textensionsToRemove.push(existing);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.push(existing);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const [extension, metadata] of extensions) {\n\t\t\t\t\tconst index = result.findIndex(e => areSameExtensions(e.identifier, extension.identifier) && e.version === extension.manifest.version);\n\t\t\t\t\tconst extensionToAdd = { identifier: extension.identifier, version: extension.manifest.version, location: extension.location, metadata };\n\t\t\t\t\tif (index === -1) {\n\t\t\t\t\t\textensionsToAdd.push(extensionToAdd);\n\t\t\t\t\t\tresult.push(extensionToAdd);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.splice(index, 1, extensionToAdd);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (extensionsToAdd.length) {\n\t\t\t\t\tthis._onAddExtensions.fire({ extensions: extensionsToAdd, profileLocation });\n\t\t\t\t}\n\t\t\t\tif (extensionsToRemove.length) {\n\t\t\t\t\tthis._onRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t});\n\t\t\tif (extensionsToAdd.length) {\n\t\t\t\tthis._onDidAddExtensions.fire({ extensions: extensionsToAdd, profileLocation });\n\t\t\t}\n\t\t\tif (extensionsToRemove.length) {\n\t\t\t\tthis._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });\n\t\t\t}\n\t\t\treturn extensionsToAdd;\n\t\t} catch (error) {\n\t\t\tif (extensionsToAdd.length) {\n\t\t\t\tthis._onDidAddExtensions.fire({ extensions: extensionsToAdd, error, profileLocation });\n\t\t\t}\n\t\t\tif (extensionsToRemove.length) {\n\t\t\t\tthis._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, error, profileLocation });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync updateMetadata(extensions: [IExtension, Metadata][], profileLocation: URI): Promise<IScannedProfileExtension[]> {\n\t\tconst updatedExtensions: IScannedProfileExtension[] = [];\n\t\tawait this.withProfileExtensions(profileLocation, profileExtensions => {\n\t\t\tconst result: IScannedProfileExtension[] = [];\n\t\t\tfor (const profileExtension of profileExtensions) {\n\t\t\t\tconst extension = extensions.find(([e]) => areSameExtensions({ id: e.identifier.id }, { id: profileExtension.identifier.id }) && e.manifest.version === profileExtension.version);\n\t\t\t\tif (extension) {\n\t\t\t\t\tprofileExtension.metadata = { ...profileExtension.metadata, ...extension[1] };\n\t\t\t\t\tupdatedExtensions.push(profileExtension);\n\t\t\t\t\tresult.push(profileExtension);\n\t\t\t\t} else {\n\t\t\t\t\tresult.push(profileExtension);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t});\n\t\treturn updatedExtensions;\n\t}\n\n\tasync removeExtensionsFromProfile(extensions: IExtensionIdentifier[], profileLocation: URI): Promise<void> {\n\t\tconst extensionsToRemove: IScannedProfileExtension[] = [];\n\t\ttry {\n\t\t\tawait this.withProfileExtensions(profileLocation, profileExtensions => {\n\t\t\t\tconst result: IScannedProfileExtension[] = [];\n\t\t\t\tfor (const e of profileExtensions) {\n\t\t\t\t\tif (extensions.some(extension => areSameExtensions(e.identifier, extension))) {\n\t\t\t\t\t\textensionsToRemove.push(e);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.push(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (extensionsToRemove.length) {\n\t\t\t\t\tthis._onRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t});\n\t\t\tif (extensionsToRemove.length) {\n\t\t\t\tthis._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (extensionsToRemove.length) {\n\t\t\t\tthis._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, error, profileLocation });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate async withProfileExtensions(file: URI, updateFn?: (extensions: Mutable<IScannedProfileExtension>[]) => IScannedProfileExtension[], options?: IProfileExtensionsScanOptions): Promise<IScannedProfileExtension[]> {\n\t\treturn this.getResourceAccessQueue(file).queue(async () => {\n\t\t\tlet extensions: IScannedProfileExtension[] = [];\n\n\t\t\t// Read\n\t\t\tlet storedProfileExtensions: IStoredProfileExtension[] | undefined;\n\t\t\ttry {\n\t\t\t\tconst content = await this.fileService.readFile(file);\n\t\t\t\tstoredProfileExtensions = JSON.parse(content.value.toString().trim() || '[]');\n\t\t\t} catch (error) {\n\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\t// migrate from old location, remove this after couple of releases\n\t\t\t\tif (this.uriIdentityService.extUri.isEqual(file, this.userDataProfilesService.defaultProfile.extensionsResource)) {\n\t\t\t\t\tstoredProfileExtensions = await this.migrateFromOldDefaultProfileExtensionsLocation();\n\t\t\t\t}\n\t\t\t\tif (!storedProfileExtensions && options?.bailOutWhenFileNotFound) {\n\t\t\t\t\tthrow new ExtensionsProfileScanningError(getErrorMessage(error), ExtensionsProfileScanningErrorCode.ERROR_PROFILE_NOT_FOUND);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (storedProfileExtensions) {\n\t\t\t\tif (!Array.isArray(storedProfileExtensions)) {\n\t\t\t\t\tthis.throwInvalidConentError(file);\n\t\t\t\t}\n\t\t\t\t// TODO @sandy081: Remove this migration after couple of releases\n\t\t\t\tlet migrate = false;\n\t\t\t\tfor (const e of storedProfileExtensions) {\n\t\t\t\t\tif (!isStoredProfileExtension(e)) {\n\t\t\t\t\t\tthis.throwInvalidConentError(file);\n\t\t\t\t\t}\n\t\t\t\t\tlet location: URI;\n\t\t\t\t\tif (isString(e.relativeLocation) && e.relativeLocation) {\n\t\t\t\t\t\t// Extension in new format. No migration needed.\n\t\t\t\t\t\tlocation = this.resolveExtensionLocation(e.relativeLocation);\n\t\t\t\t\t} else if (isString(e.location)) {\n\t\t\t\t\t\tthis.logService.warn(`Extensions profile: Ignoring extension with invalid location: ${e.location}`);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlocation = URI.revive(e.location);\n\t\t\t\t\t\tconst relativePath = this.toRelativePath(location);\n\t\t\t\t\t\tif (relativePath) {\n\t\t\t\t\t\t\t// Extension in old format. Migrate to new format.\n\t\t\t\t\t\t\tmigrate = true;\n\t\t\t\t\t\t\te.relativeLocation = relativePath;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (isUndefined(e.metadata?.hasPreReleaseVersion) && e.metadata?.preRelease) {\n\t\t\t\t\t\tmigrate = true;\n\t\t\t\t\t\te.metadata.hasPreReleaseVersion = true;\n\t\t\t\t\t}\n\t\t\t\t\tconst uuid = e.metadata?.id ?? e.identifier.uuid;\n\t\t\t\t\textensions.push({\n\t\t\t\t\t\tidentifier: uuid ? { id: e.identifier.id, uuid } : { id: e.identifier.id },\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\tversion: e.version,\n\t\t\t\t\t\tmetadata: e.metadata,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (migrate) {\n\t\t\t\t\tawait this.fileService.writeFile(file, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update\n\t\t\tif (updateFn) {\n\t\t\t\textensions = updateFn(extensions);\n\t\t\t\tconst storedProfileExtensions: IStoredProfileExtension[] = extensions.map(e => ({\n\t\t\t\t\tidentifier: e.identifier,\n\t\t\t\t\tversion: e.version,\n\t\t\t\t\t// retain old format so that old clients can read it\n\t\t\t\t\tlocation: e.location.toJSON(),\n\t\t\t\t\trelativeLocation: this.toRelativePath(e.location),\n\t\t\t\t\tmetadata: e.metadata\n\t\t\t\t}));\n\t\t\t\tawait this.fileService.writeFile(file, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)));\n\t\t\t}\n\n\t\t\treturn extensions;\n\t\t});\n\t}\n\n\tprivate throwInvalidConentError(file: URI): void {\n\t\tthrow new ExtensionsProfileScanningError(`Invalid extensions content in ${file.toString()}`, ExtensionsProfileScanningErrorCode.ERROR_INVALID_CONTENT);\n\t}\n\n\tprivate toRelativePath(extensionLocation: URI): string | undefined {\n\t\treturn this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.dirname(extensionLocation), this.extensionsLocation)\n\t\t\t? this.uriIdentityService.extUri.basename(extensionLocation)\n\t\t\t: undefined;\n\t}\n\n\tprivate resolveExtensionLocation(path: string): URI {\n\t\treturn this.uriIdentityService.extUri.joinPath(this.extensionsLocation, path);\n\t}\n\n\tprivate _migrationPromise: Promise<IStoredProfileExtension[] | undefined> | undefined;\n\tprivate async migrateFromOldDefaultProfileExtensionsLocation(): Promise<IStoredProfileExtension[] | undefined> {\n\t\tif (!this._migrationPromise) {\n\t\t\tthis._migrationPromise = (async () => {\n\t\t\t\tconst oldDefaultProfileExtensionsLocation = this.uriIdentityService.extUri.joinPath(this.userDataProfilesService.defaultProfile.location, 'extensions.json');\n\t\t\t\tconst oldDefaultProfileExtensionsInitLocation = this.uriIdentityService.extUri.joinPath(this.extensionsLocation, '.init-default-profile-extensions');\n\t\t\t\tlet content: string;\n\t\t\t\ttry {\n\t\t\t\t\tcontent = (await this.fileService.readFile(oldDefaultProfileExtensionsLocation)).value.toString();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (toFileOperationResult(error) === FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\n\t\t\t\tthis.logService.info('Migrating extensions from old default profile location', oldDefaultProfileExtensionsLocation.toString());\n\t\t\t\tlet storedProfileExtensions: IStoredProfileExtension[] | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tconst parsedData = JSON.parse(content);\n\t\t\t\t\tif (Array.isArray(parsedData) && parsedData.every(candidate => isStoredProfileExtension(candidate))) {\n\t\t\t\t\t\tstoredProfileExtensions = parsedData;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.logService.warn('Skipping migrating from old default profile locaiton: Found invalid data', parsedData);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\t/* Ignore */\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t}\n\n\t\t\t\tif (storedProfileExtensions) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)), { overwrite: false });\n\t\t\t\t\t\tthis.logService.info('Migrated extensions from old default profile location to new location', oldDefaultProfileExtensionsLocation.toString(), this.userDataProfilesService.defaultProfile.extensionsResource.toString());\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (toFileOperationResult(error) === FileOperationResult.FILE_MODIFIED_SINCE) {\n\t\t\t\t\t\t\tthis.logService.info('Migration from old default profile location to new location is done by another window', oldDefaultProfileExtensionsLocation.toString(), this.userDataProfilesService.defaultProfile.extensionsResource.toString());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait this.fileService.del(oldDefaultProfileExtensionsLocation);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait this.fileService.del(oldDefaultProfileExtensionsInitLocation);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn storedProfileExtensions;\n\t\t\t})();\n\t\t}\n\t\treturn this._migrationPromise;\n\t}\n\n\tprivate getResourceAccessQueue(file: URI): Queue<IScannedProfileExtension[]> {\n\t\tlet resourceQueue = this.resourcesAccessQueueMap.get(file);\n\t\tif (!resourceQueue) {\n\t\t\tresourceQueue = new Queue<IScannedProfileExtension[]>();\n\t\t\tthis.resourcesAccessQueueMap.set(file, resourceQueue);\n\t\t}\n\t\treturn resourceQueue;\n\t}\n}\n\nfunction isStoredProfileExtension(candidate: any): candidate is IStoredProfileExtension {\n\treturn isObject(candidate)\n\t\t&& isIExtensionIdentifier(candidate.identifier)\n\t\t&& (isUriComponents(candidate.location) || (isString(candidate.location) && candidate.location))\n\t\t&& (isUndefined(candidate.relativeLocation) || isString(candidate.relativeLocation))\n\t\t&& candidate.version && isString(candidate.version);\n}\n\nfunction isUriComponents(thing: unknown): thing is UriComponents {\n\tif (!thing) {\n\t\treturn false;\n\t}\n\treturn isString((<any>thing).path) &&\n\t\tisString((<any>thing).scheme);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Extracted from json.ts to keep json nls free.\n */\nimport { localize } from '../../nls.js';\nimport { ParseErrorCode } from './json.js';\n\nexport function getParseErrorMessage(errorCode: ParseErrorCode): string {\n\tswitch (errorCode) {\n\t\tcase ParseErrorCode.InvalidSymbol: return localize('error.invalidSymbol', 'Invalid symbol');\n\t\tcase ParseErrorCode.InvalidNumberFormat: return localize('error.invalidNumberFormat', 'Invalid number format');\n\t\tcase ParseErrorCode.PropertyNameExpected: return localize('error.propertyNameExpected', 'Property name expected');\n\t\tcase ParseErrorCode.ValueExpected: return localize('error.valueExpected', 'Value expected');\n\t\tcase ParseErrorCode.ColonExpected: return localize('error.colonExpected', 'Colon expected');\n\t\tcase ParseErrorCode.CommaExpected: return localize('error.commaExpected', 'Comma expected');\n\t\tcase ParseErrorCode.CloseBraceExpected: return localize('error.closeBraceExpected', 'Closing brace expected');\n\t\tcase ParseErrorCode.CloseBracketExpected: return localize('error.closeBracketExpected', 'Closing bracket expected');\n\t\tcase ParseErrorCode.EndOfFileExpected: return localize('error.endOfFileExpected', 'End of file expected');\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { isObject, isString } from '../../../base/common/types.js';\nimport { ILocalizedString } from '../../action/common/action.js';\nimport { IExtensionManifest } from '../../extensions/common/extensions.js';\nimport { localize } from '../../../nls.js';\nimport { ILogger } from '../../log/common/log.js';\n\nexport interface ITranslations {\n\t[key: string]: string | { message: string; comment: string[] } | undefined;\n}\n\nexport function localizeManifest(logger: ILogger, extensionManifest: IExtensionManifest, translations: ITranslations, fallbackTranslations?: ITranslations): IExtensionManifest {\n\ttry {\n\t\treplaceNLStrings(logger, extensionManifest, translations, fallbackTranslations);\n\t} catch (error) {\n\t\tlogger.error(error?.message ?? error);\n\t\t/*Ignore Error*/\n\t}\n\treturn extensionManifest;\n}\n\n/**\n * This routine makes the following assumptions:\n * The root element is an object literal\n */\nfunction replaceNLStrings(logger: ILogger, extensionManifest: IExtensionManifest, messages: ITranslations, originalMessages?: ITranslations): void {\n\tconst processEntry = (obj: any, key: string | number, command?: boolean) => {\n\t\tconst value = obj[key];\n\t\tif (isString(value)) {\n\t\t\tconst str = <string>value;\n\t\t\tconst length = str.length;\n\t\t\tif (length > 1 && str[0] === '%' && str[length - 1] === '%') {\n\t\t\t\tconst messageKey = str.substr(1, length - 2);\n\t\t\t\tlet translated = messages[messageKey];\n\t\t\t\t// If the messages come from a language pack they might miss some keys\n\t\t\t\t// Fill them from the original messages.\n\t\t\t\tif (translated === undefined && originalMessages) {\n\t\t\t\t\ttranslated = originalMessages[messageKey];\n\t\t\t\t}\n\t\t\t\tconst message: string | undefined = typeof translated === 'string' ? translated : translated?.message;\n\n\t\t\t\t// This branch returns ILocalizedString's instead of Strings so that the Command Palette can contain both the localized and the original value.\n\t\t\t\tconst original = originalMessages?.[messageKey];\n\t\t\t\tconst originalMessage: string | undefined = typeof original === 'string' ? original : original?.message;\n\n\t\t\t\tif (!message) {\n\t\t\t\t\tif (!originalMessage) {\n\t\t\t\t\t\tlogger.warn(`[${extensionManifest.name}]: ${localize('missingNLSKey', \"Couldn't find message for key {0}.\", messageKey)}`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t// if we are translating the title or category of a command\n\t\t\t\t\tcommand && (key === 'title' || key === 'category') &&\n\t\t\t\t\t// and the original value is not the same as the translated value\n\t\t\t\t\toriginalMessage && originalMessage !== message\n\t\t\t\t) {\n\t\t\t\t\tconst localizedString: ILocalizedString = {\n\t\t\t\t\t\tvalue: message,\n\t\t\t\t\t\toriginal: originalMessage\n\t\t\t\t\t};\n\t\t\t\t\tobj[key] = localizedString;\n\t\t\t\t} else {\n\t\t\t\t\tobj[key] = message;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isObject(value)) {\n\t\t\tfor (const k in value) {\n\t\t\t\tif (value.hasOwnProperty(k)) {\n\t\t\t\t\tk === 'commands' ? processEntry(value, k, true) : processEntry(value, k, command);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Array.isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tprocessEntry(value, i, command);\n\t\t\t}\n\t\t}\n\t};\n\n\tfor (const key in extensionManifest) {\n\t\tif (extensionManifest.hasOwnProperty(key)) {\n\t\t\tprocessEntry(extensionManifest, key);\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { coalesce } from '../../../base/common/arrays.js';\nimport { ThrottledDelayer } from '../../../base/common/async.js';\nimport * as objects from '../../../base/common/objects.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { getErrorMessage } from '../../../base/common/errors.js';\nimport { getNodeType, parse, ParseError } from '../../../base/common/json.js';\nimport { getParseErrorMessage } from '../../../base/common/jsonErrorMessages.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { FileAccess, Schemas } from '../../../base/common/network.js';\nimport * as path from '../../../base/common/path.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { basename, isEqual, joinPath } from '../../../base/common/resources.js';\nimport * as semver from '../../../base/common/semver/semver.js';\nimport Severity from '../../../base/common/severity.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { IProductVersion, Metadata } from './extensionManagement.js';\nimport { areSameExtensions, computeTargetPlatform, getExtensionId, getGalleryExtensionId } from './extensionManagementUtil.js';\nimport { ExtensionType, ExtensionIdentifier, IExtensionManifest, TargetPlatform, IExtensionIdentifier, IRelaxedExtensionManifest, UNDEFINED_PUBLISHER, IExtensionDescription, BUILTIN_MANIFEST_CACHE_FILE, USER_MANIFEST_CACHE_FILE, ExtensionIdentifierMap, parseEnabledApiProposalNames } from '../../extensions/common/extensions.js';\nimport { validateExtensionManifest } from '../../extensions/common/extensionValidator.js';\nimport { FileOperationResult, IFileService, toFileOperationResult } from '../../files/common/files.js';\nimport { createDecorator, IInstantiationService } from '../../instantiation/common/instantiation.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { revive } from '../../../base/common/marshalling.js';\nimport { ExtensionsProfileScanningError, ExtensionsProfileScanningErrorCode, IExtensionsProfileScannerService, IProfileExtensionsScanOptions, IScannedProfileExtension } from './extensionsProfileScannerService.js';\nimport { IUserDataProfile, IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { localizeManifest } from './extensionNls.js';\n\nexport type ManifestMetadata = Partial<{\n\ttargetPlatform: TargetPlatform;\n\tinstalledTimestamp: number;\n\tsize: number;\n}>;\n\nexport type IScannedExtensionManifest = IRelaxedExtensionManifest & { __metadata?: ManifestMetadata };\n\ninterface IRelaxedScannedExtension {\n\ttype: ExtensionType;\n\tisBuiltin: boolean;\n\tidentifier: IExtensionIdentifier;\n\tmanifest: IRelaxedExtensionManifest;\n\tlocation: URI;\n\ttargetPlatform: TargetPlatform;\n\tpublisherDisplayName?: string;\n\tmetadata: Metadata | undefined;\n\tisValid: boolean;\n\tvalidations: readonly [Severity, string][];\n\tpreRelease: boolean;\n}\n\nexport type IScannedExtension = Readonly<IRelaxedScannedExtension> & { manifest: IExtensionManifest };\n\nexport interface Translations {\n\t[id: string]: string;\n}\n\nexport namespace Translations {\n\texport function equals(a: Translations, b: Translations): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tconst aKeys = Object.keys(a);\n\t\tconst bKeys: Set<string> = new Set<string>();\n\t\tfor (const key of Object.keys(b)) {\n\t\t\tbKeys.add(key);\n\t\t}\n\t\tif (aKeys.length !== bKeys.size) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const key of aKeys) {\n\t\t\tif (a[key] !== b[key]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tbKeys.delete(key);\n\t\t}\n\t\treturn bKeys.size === 0;\n\t}\n}\n\ninterface MessageBag {\n\t[key: string]: string | { message: string; comment: string[] };\n}\n\ninterface TranslationBundle {\n\tcontents: {\n\t\tpackage: MessageBag;\n\t};\n}\n\ninterface LocalizedMessages {\n\tvalues: MessageBag | undefined;\n\tdefault: URI | null;\n}\n\ninterface IBuiltInExtensionControl {\n\t[name: string]: 'marketplace' | 'disabled' | string;\n}\n\nexport type SystemExtensionsScanOptions = {\n\treadonly checkControlFile?: boolean;\n\treadonly language?: string;\n};\n\nexport type UserExtensionsScanOptions = {\n\treadonly profileLocation: URI;\n\treadonly includeInvalid?: boolean;\n\treadonly language?: string;\n\treadonly useCache?: boolean;\n\treadonly productVersion?: IProductVersion;\n};\n\nexport type ScanOptions = {\n\treadonly includeInvalid?: boolean;\n\treadonly language?: string;\n};\n\nexport const IExtensionsScannerService = createDecorator<IExtensionsScannerService>('IExtensionsScannerService');\nexport interface IExtensionsScannerService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly systemExtensionsLocation: URI;\n\treadonly userExtensionsLocation: URI;\n\treadonly onDidChangeCache: Event<ExtensionType>;\n\n\tscanAllExtensions(systemScanOptions: SystemExtensionsScanOptions, userScanOptions: UserExtensionsScanOptions): Promise<IScannedExtension[]>;\n\tscanSystemExtensions(scanOptions: SystemExtensionsScanOptions): Promise<IScannedExtension[]>;\n\tscanUserExtensions(scanOptions: UserExtensionsScanOptions): Promise<IScannedExtension[]>;\n\tscanAllUserExtensions(): Promise<IScannedExtension[]>;\n\n\tscanExtensionsUnderDevelopment(existingExtensions: IScannedExtension[], scanOptions: ScanOptions): Promise<IScannedExtension[]>;\n\tscanExistingExtension(extensionLocation: URI, extensionType: ExtensionType, scanOptions: ScanOptions): Promise<IScannedExtension | null>;\n\tscanMultipleExtensions(extensionLocations: URI[], extensionType: ExtensionType, scanOptions: ScanOptions): Promise<IScannedExtension[]>;\n\tscanOneOrMultipleExtensions(extensionLocation: URI, extensionType: ExtensionType, scanOptions: ScanOptions): Promise<IScannedExtension[]>;\n\n\tupdateManifestMetadata(extensionLocation: URI, metadata: ManifestMetadata): Promise<void>;\n\tinitializeDefaultProfileExtensions(): Promise<void>;\n}\n\nexport abstract class AbstractExtensionsScannerService extends Disposable implements IExtensionsScannerService {\n\n\treadonly _serviceBrand: undefined;\n\n\tprotected abstract getTranslations(language: string): Promise<Translations>;\n\n\tprivate readonly _onDidChangeCache = this._register(new Emitter<ExtensionType>());\n\treadonly onDidChangeCache = this._onDidChangeCache.event;\n\n\tprivate readonly systemExtensionsCachedScanner: CachedExtensionsScanner;\n\tprivate readonly userExtensionsCachedScanner: CachedExtensionsScanner;\n\tprivate readonly extensionsScanner: ExtensionsScanner;\n\n\tconstructor(\n\t\treadonly systemExtensionsLocation: URI,\n\t\treadonly userExtensionsLocation: URI,\n\t\tprivate readonly extensionsControlLocation: URI,\n\t\tcurrentProfile: IUserDataProfile,\n\t\t@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,\n\t\t@IExtensionsProfileScannerService protected readonly extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\t@IFileService protected readonly fileService: IFileService,\n\t\t@ILogService protected readonly logService: ILogService,\n\t\t@IEnvironmentService private readonly environmentService: IEnvironmentService,\n\t\t@IProductService private readonly productService: IProductService,\n\t\t@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,\n\t\t@IInstantiationService private readonly instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis.systemExtensionsCachedScanner = this._register(this.instantiationService.createInstance(CachedExtensionsScanner, currentProfile));\n\t\tthis.userExtensionsCachedScanner = this._register(this.instantiationService.createInstance(CachedExtensionsScanner, currentProfile));\n\t\tthis.extensionsScanner = this._register(this.instantiationService.createInstance(ExtensionsScanner));\n\n\t\tthis._register(this.systemExtensionsCachedScanner.onDidChangeCache(() => this._onDidChangeCache.fire(ExtensionType.System)));\n\t\tthis._register(this.userExtensionsCachedScanner.onDidChangeCache(() => this._onDidChangeCache.fire(ExtensionType.User)));\n\t}\n\n\tprivate _targetPlatformPromise: Promise<TargetPlatform> | undefined;\n\tprivate getTargetPlatform(): Promise<TargetPlatform> {\n\t\tif (!this._targetPlatformPromise) {\n\t\t\tthis._targetPlatformPromise = computeTargetPlatform(this.fileService, this.logService);\n\t\t}\n\t\treturn this._targetPlatformPromise;\n\t}\n\n\tasync scanAllExtensions(systemScanOptions: SystemExtensionsScanOptions, userScanOptions: UserExtensionsScanOptions): Promise<IScannedExtension[]> {\n\t\tconst [system, user] = await Promise.all([\n\t\t\tthis.scanSystemExtensions(systemScanOptions),\n\t\t\tthis.scanUserExtensions(userScanOptions),\n\t\t]);\n\t\treturn this.dedupExtensions(system, user, [], await this.getTargetPlatform(), true);\n\t}\n\n\tasync scanSystemExtensions(scanOptions: SystemExtensionsScanOptions): Promise<IScannedExtension[]> {\n\t\tconst promises: Promise<IRelaxedScannedExtension[]>[] = [];\n\t\tpromises.push(this.scanDefaultSystemExtensions(scanOptions.language));\n\t\tpromises.push(this.scanDevSystemExtensions(scanOptions.language, !!scanOptions.checkControlFile));\n\t\tconst [defaultSystemExtensions, devSystemExtensions] = await Promise.all(promises);\n\t\treturn this.applyScanOptions([...defaultSystemExtensions, ...devSystemExtensions], ExtensionType.System, { pickLatest: false });\n\t}\n\n\tasync scanUserExtensions(scanOptions: UserExtensionsScanOptions): Promise<IScannedExtension[]> {\n\t\tthis.logService.trace('Started scanning user extensions', scanOptions.profileLocation);\n\t\tconst profileScanOptions: IProfileExtensionsScanOptions | undefined = this.uriIdentityService.extUri.isEqual(scanOptions.profileLocation, this.userDataProfilesService.defaultProfile.extensionsResource) ? { bailOutWhenFileNotFound: true } : undefined;\n\t\tconst extensionsScannerInput = await this.createExtensionScannerInput(scanOptions.profileLocation, true, ExtensionType.User, scanOptions.language, true, profileScanOptions, scanOptions.productVersion ?? this.getProductVersion());\n\t\tconst extensionsScanner = scanOptions.useCache && !extensionsScannerInput.devMode ? this.userExtensionsCachedScanner : this.extensionsScanner;\n\t\tlet extensions: IRelaxedScannedExtension[];\n\t\ttry {\n\t\t\textensions = await extensionsScanner.scanExtensions(extensionsScannerInput);\n\t\t} catch (error) {\n\t\t\tif (error instanceof ExtensionsProfileScanningError && error.code === ExtensionsProfileScanningErrorCode.ERROR_PROFILE_NOT_FOUND) {\n\t\t\t\tawait this.doInitializeDefaultProfileExtensions();\n\t\t\t\textensions = await extensionsScanner.scanExtensions(extensionsScannerInput);\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\textensions = await this.applyScanOptions(extensions, ExtensionType.User, { includeInvalid: scanOptions.includeInvalid, pickLatest: true });\n\t\tthis.logService.trace('Scanned user extensions:', extensions.length);\n\t\treturn extensions;\n\t}\n\n\tasync scanAllUserExtensions(scanOptions: { includeAllVersions?: boolean; includeInvalid: boolean } = { includeInvalid: true, includeAllVersions: true }): Promise<IScannedExtension[]> {\n\t\tconst extensionsScannerInput = await this.createExtensionScannerInput(this.userExtensionsLocation, false, ExtensionType.User, undefined, true, undefined, this.getProductVersion());\n\t\tconst extensions = await this.extensionsScanner.scanExtensions(extensionsScannerInput);\n\t\treturn this.applyScanOptions(extensions, ExtensionType.User, { includeAllVersions: scanOptions.includeAllVersions, includeInvalid: scanOptions.includeInvalid });\n\t}\n\n\tasync scanExtensionsUnderDevelopment(existingExtensions: IScannedExtension[], scanOptions: ScanOptions): Promise<IScannedExtension[]> {\n\t\tif (this.environmentService.isExtensionDevelopment && this.environmentService.extensionDevelopmentLocationURI) {\n\t\t\tconst extensions = (await Promise.all(this.environmentService.extensionDevelopmentLocationURI.filter(extLoc => extLoc.scheme === Schemas.file)\n\t\t\t\t.map(async extensionDevelopmentLocationURI => {\n\t\t\t\t\tconst input = await this.createExtensionScannerInput(extensionDevelopmentLocationURI, false, ExtensionType.User, scanOptions.language, false /* do not validate */, undefined, this.getProductVersion());\n\t\t\t\t\tconst extensions = await this.extensionsScanner.scanOneOrMultipleExtensions(input);\n\t\t\t\t\treturn extensions.map(extension => {\n\t\t\t\t\t\t// Override the extension type from the existing extensions\n\t\t\t\t\t\textension.type = existingExtensions.find(e => areSameExtensions(e.identifier, extension.identifier))?.type ?? extension.type;\n\t\t\t\t\t\t// Validate the extension\n\t\t\t\t\t\treturn this.extensionsScanner.validate(extension, input);\n\t\t\t\t\t});\n\t\t\t\t})))\n\t\t\t\t.flat();\n\t\t\treturn this.applyScanOptions(extensions, 'development', { includeInvalid: scanOptions.includeInvalid, pickLatest: true });\n\t\t}\n\t\treturn [];\n\t}\n\n\tasync scanExistingExtension(extensionLocation: URI, extensionType: ExtensionType, scanOptions: ScanOptions): Promise<IScannedExtension | null> {\n\t\tconst extensionsScannerInput = await this.createExtensionScannerInput(extensionLocation, false, extensionType, scanOptions.language, true, undefined, this.getProductVersion());\n\t\tconst extension = await this.extensionsScanner.scanExtension(extensionsScannerInput);\n\t\tif (!extension) {\n\t\t\treturn null;\n\t\t}\n\t\tif (!scanOptions.includeInvalid && !extension.isValid) {\n\t\t\treturn null;\n\t\t}\n\t\treturn extension;\n\t}\n\n\tasync scanOneOrMultipleExtensions(extensionLocation: URI, extensionType: ExtensionType, scanOptions: ScanOptions): Promise<IScannedExtension[]> {\n\t\tconst extensionsScannerInput = await this.createExtensionScannerInput(extensionLocation, false, extensionType, scanOptions.language, true, undefined, this.getProductVersion());\n\t\tconst extensions = await this.extensionsScanner.scanOneOrMultipleExtensions(extensionsScannerInput);\n\t\treturn this.applyScanOptions(extensions, extensionType, { includeInvalid: scanOptions.includeInvalid, pickLatest: true });\n\t}\n\n\tasync scanMultipleExtensions(extensionLocations: URI[], extensionType: ExtensionType, scanOptions: ScanOptions): Promise<IScannedExtension[]> {\n\t\tconst extensions: IRelaxedScannedExtension[] = [];\n\t\tawait Promise.all(extensionLocations.map(async extensionLocation => {\n\t\t\tconst scannedExtensions = await this.scanOneOrMultipleExtensions(extensionLocation, extensionType, scanOptions);\n\t\t\textensions.push(...scannedExtensions);\n\t\t}));\n\t\treturn this.applyScanOptions(extensions, extensionType, { includeInvalid: scanOptions.includeInvalid, pickLatest: true });\n\t}\n\n\tasync updateManifestMetadata(extensionLocation: URI, metaData: ManifestMetadata): Promise<void> {\n\t\tconst manifestLocation = joinPath(extensionLocation, 'package.json');\n\t\tconst content = (await this.fileService.readFile(manifestLocation)).value.toString();\n\t\tconst manifest: IScannedExtensionManifest = JSON.parse(content);\n\t\tmanifest.__metadata = { ...manifest.__metadata, ...metaData };\n\n\t\tawait this.fileService.writeFile(joinPath(extensionLocation, 'package.json'), VSBuffer.fromString(JSON.stringify(manifest, null, '\\t')));\n\t}\n\n\tasync initializeDefaultProfileExtensions(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.extensionsProfileScannerService.scanProfileExtensions(this.userDataProfilesService.defaultProfile.extensionsResource, { bailOutWhenFileNotFound: true });\n\t\t} catch (error) {\n\t\t\tif (error instanceof ExtensionsProfileScanningError && error.code === ExtensionsProfileScanningErrorCode.ERROR_PROFILE_NOT_FOUND) {\n\t\t\t\tawait this.doInitializeDefaultProfileExtensions();\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate initializeDefaultProfileExtensionsPromise: Promise<void> | undefined = undefined;\n\tprivate async doInitializeDefaultProfileExtensions(): Promise<void> {\n\t\tif (!this.initializeDefaultProfileExtensionsPromise) {\n\t\t\tthis.initializeDefaultProfileExtensionsPromise = (async () => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.logService.info('Started initializing default profile extensions in extensions installation folder.', this.userExtensionsLocation.toString());\n\t\t\t\t\tconst userExtensions = await this.scanAllUserExtensions({ includeInvalid: true });\n\t\t\t\t\tif (userExtensions.length) {\n\t\t\t\t\t\tawait this.extensionsProfileScannerService.addExtensionsToProfile(userExtensions.map(e => [e, e.metadata]), this.userDataProfilesService.defaultProfile.extensionsResource);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource, VSBuffer.fromString(JSON.stringify([])));\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\t\t\t\tthis.logService.warn('Failed to create default profile extensions manifest in extensions installation folder.', this.userExtensionsLocation.toString(), getErrorMessage(error));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.logService.info('Completed initializing default profile extensions in extensions installation folder.', this.userExtensionsLocation.toString());\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t} finally {\n\t\t\t\t\tthis.initializeDefaultProfileExtensionsPromise = undefined;\n\t\t\t\t}\n\t\t\t})();\n\t\t}\n\t\treturn this.initializeDefaultProfileExtensionsPromise;\n\t}\n\n\tprivate async applyScanOptions(extensions: IRelaxedScannedExtension[], type: ExtensionType | 'development', scanOptions: { includeAllVersions?: boolean; includeInvalid?: boolean; pickLatest?: boolean } = {}): Promise<IRelaxedScannedExtension[]> {\n\t\tif (!scanOptions.includeAllVersions) {\n\t\t\textensions = this.dedupExtensions(type === ExtensionType.System ? extensions : undefined, type === ExtensionType.User ? extensions : undefined, type === 'development' ? extensions : undefined, await this.getTargetPlatform(), !!scanOptions.pickLatest);\n\t\t}\n\t\tif (!scanOptions.includeInvalid) {\n\t\t\textensions = extensions.filter(extension => extension.isValid);\n\t\t}\n\t\treturn extensions.sort((a, b) => {\n\t\t\tconst aLastSegment = path.basename(a.location.fsPath);\n\t\t\tconst bLastSegment = path.basename(b.location.fsPath);\n\t\t\tif (aLastSegment < bLastSegment) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (aLastSegment > bLastSegment) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t});\n\t}\n\n\tprivate dedupExtensions(system: IScannedExtension[] | undefined, user: IScannedExtension[] | undefined, development: IScannedExtension[] | undefined, targetPlatform: TargetPlatform, pickLatest: boolean): IScannedExtension[] {\n\t\tconst pick = (existing: IScannedExtension, extension: IScannedExtension, isDevelopment: boolean): boolean => {\n\t\t\tif (!isDevelopment) {\n\t\t\t\tif (existing.metadata?.isApplicationScoped && !extension.metadata?.isApplicationScoped) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (!existing.metadata?.isApplicationScoped && extension.metadata?.isApplicationScoped) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (existing.isValid && !extension.isValid) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (existing.isValid === extension.isValid) {\n\t\t\t\tif (pickLatest && semver.gt(existing.manifest.version, extension.manifest.version)) {\n\t\t\t\t\tthis.logService.debug(`Skipping extension ${extension.location.path} with lower version ${extension.manifest.version} in favour of ${existing.location.path} with version ${existing.manifest.version}`);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (semver.eq(existing.manifest.version, extension.manifest.version)) {\n\t\t\t\t\tif (existing.type === ExtensionType.System) {\n\t\t\t\t\t\tthis.logService.debug(`Skipping extension ${extension.location.path} in favour of system extension ${existing.location.path} with same version`);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (existing.targetPlatform === targetPlatform) {\n\t\t\t\t\t\tthis.logService.debug(`Skipping extension ${extension.location.path} from different target platform ${extension.targetPlatform}`);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isDevelopment) {\n\t\t\t\tthis.logService.warn(`Overwriting user extension ${existing.location.path} with ${extension.location.path}.`);\n\t\t\t} else {\n\t\t\t\tthis.logService.debug(`Overwriting user extension ${existing.location.path} with ${extension.location.path}.`);\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tconst result = new ExtensionIdentifierMap<IScannedExtension>();\n\t\tsystem?.forEach((extension) => {\n\t\t\tconst existing = result.get(extension.identifier.id);\n\t\t\tif (!existing || pick(existing, extension, false)) {\n\t\t\t\tresult.set(extension.identifier.id, extension);\n\t\t\t}\n\t\t});\n\t\tuser?.forEach((extension) => {\n\t\t\tconst existing = result.get(extension.identifier.id);\n\t\t\tif (!existing && system && extension.type === ExtensionType.System) {\n\t\t\t\tthis.logService.debug(`Skipping obsolete system extension ${extension.location.path}.`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!existing || pick(existing, extension, false)) {\n\t\t\t\tresult.set(extension.identifier.id, extension);\n\t\t\t}\n\t\t});\n\t\tdevelopment?.forEach(extension => {\n\t\t\tconst existing = result.get(extension.identifier.id);\n\t\t\tif (!existing || pick(existing, extension, true)) {\n\t\t\t\tresult.set(extension.identifier.id, extension);\n\t\t\t}\n\t\t\tresult.set(extension.identifier.id, extension);\n\t\t});\n\t\treturn [...result.values()];\n\t}\n\n\tprivate async scanDefaultSystemExtensions(language: string | undefined): Promise<IRelaxedScannedExtension[]> {\n\t\tthis.logService.trace('Started scanning system extensions');\n\t\tconst extensionsScannerInput = await this.createExtensionScannerInput(this.systemExtensionsLocation, false, ExtensionType.System, language, true, undefined, this.getProductVersion());\n\t\tconst extensionsScanner = extensionsScannerInput.devMode ? this.extensionsScanner : this.systemExtensionsCachedScanner;\n\t\tconst result = await extensionsScanner.scanExtensions(extensionsScannerInput);\n\t\tthis.logService.trace('Scanned system extensions:', result.length);\n\t\treturn result;\n\t}\n\n\tprivate async scanDevSystemExtensions(language: string | undefined, checkControlFile: boolean): Promise<IRelaxedScannedExtension[]> {\n\t\tconst devSystemExtensionsList = this.environmentService.isBuilt ? [] : this.productService.builtInExtensions;\n\t\tif (!devSystemExtensionsList?.length) {\n\t\t\treturn [];\n\t\t}\n\n\t\tthis.logService.trace('Started scanning dev system extensions');\n\t\tconst builtinExtensionControl = checkControlFile ? await this.getBuiltInExtensionControl() : {};\n\t\tconst devSystemExtensionsLocations: URI[] = [];\n\t\tconst devSystemExtensionsLocation = URI.file(path.normalize(path.join(FileAccess.asFileUri('').fsPath, '..', '.build', 'builtInExtensions')));\n\t\tfor (const extension of devSystemExtensionsList) {\n\t\t\tconst controlState = builtinExtensionControl[extension.name] || 'marketplace';\n\t\t\tswitch (controlState) {\n\t\t\t\tcase 'disabled':\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'marketplace':\n\t\t\t\t\tdevSystemExtensionsLocations.push(joinPath(devSystemExtensionsLocation, extension.name));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tdevSystemExtensionsLocations.push(URI.file(controlState));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tconst result = await Promise.all(devSystemExtensionsLocations.map(async location => this.extensionsScanner.scanExtension((await this.createExtensionScannerInput(location, false, ExtensionType.System, language, true, undefined, this.getProductVersion())))));\n\t\tthis.logService.trace('Scanned dev system extensions:', result.length);\n\t\treturn coalesce(result);\n\t}\n\n\tprivate async getBuiltInExtensionControl(): Promise<IBuiltInExtensionControl> {\n\t\ttry {\n\t\t\tconst content = await this.fileService.readFile(this.extensionsControlLocation);\n\t\t\treturn JSON.parse(content.value.toString());\n\t\t} catch (error) {\n\t\t\treturn {};\n\t\t}\n\t}\n\n\tprivate async createExtensionScannerInput(location: URI, profile: boolean, type: ExtensionType, language: string | undefined, validate: boolean, profileScanOptions: IProfileExtensionsScanOptions | undefined, productVersion: IProductVersion): Promise<ExtensionScannerInput> {\n\t\tconst translations = await this.getTranslations(language ?? platform.language);\n\t\tconst mtime = await this.getMtime(location);\n\t\tconst applicationExtensionsLocation = profile && !this.uriIdentityService.extUri.isEqual(location, this.userDataProfilesService.defaultProfile.extensionsResource) ? this.userDataProfilesService.defaultProfile.extensionsResource : undefined;\n\t\tconst applicationExtensionsLocationMtime = applicationExtensionsLocation ? await this.getMtime(applicationExtensionsLocation) : undefined;\n\t\treturn new ExtensionScannerInput(\n\t\t\tlocation,\n\t\t\tmtime,\n\t\t\tapplicationExtensionsLocation,\n\t\t\tapplicationExtensionsLocationMtime,\n\t\t\tprofile,\n\t\t\tprofileScanOptions,\n\t\t\ttype,\n\t\t\tvalidate,\n\t\t\tproductVersion.version,\n\t\t\tproductVersion.date,\n\t\t\tthis.productService.commit,\n\t\t\t!this.environmentService.isBuilt,\n\t\t\tlanguage,\n\t\t\ttranslations,\n\t\t);\n\t}\n\n\tprivate async getMtime(location: URI): Promise<number | undefined> {\n\t\ttry {\n\t\t\tconst stat = await this.fileService.stat(location);\n\t\t\tif (typeof stat.mtime === 'number') {\n\t\t\t\treturn stat.mtime;\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t// That's ok...\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate getProductVersion(): IProductVersion {\n\t\treturn {\n\t\t\tversion: this.productService.version,\n\t\t\tdate: this.productService.date,\n\t\t};\n\t}\n\n}\n\nexport class ExtensionScannerInput {\n\n\tconstructor(\n\t\tpublic readonly location: URI,\n\t\tpublic readonly mtime: number | undefined,\n\t\tpublic readonly applicationExtensionslocation: URI | undefined,\n\t\tpublic readonly applicationExtensionslocationMtime: number | undefined,\n\t\tpublic readonly profile: boolean,\n\t\tpublic readonly profileScanOptions: IProfileExtensionsScanOptions | undefined,\n\t\tpublic readonly type: ExtensionType,\n\t\tpublic readonly validate: boolean,\n\t\tpublic readonly productVersion: string,\n\t\tpublic readonly productDate: string | undefined,\n\t\tpublic readonly productCommit: string | undefined,\n\t\tpublic readonly devMode: boolean,\n\t\tpublic readonly language: string | undefined,\n\t\tpublic readonly translations: Translations\n\t) {\n\t\t// Keep empty!! (JSON.parse)\n\t}\n\n\tpublic static createNlsConfiguration(input: ExtensionScannerInput): NlsConfiguration {\n\t\treturn {\n\t\t\tlanguage: input.language,\n\t\t\tpseudo: input.language === 'pseudo',\n\t\t\tdevMode: input.devMode,\n\t\t\ttranslations: input.translations\n\t\t};\n\t}\n\n\tpublic static equals(a: ExtensionScannerInput, b: ExtensionScannerInput): boolean {\n\t\treturn (\n\t\t\tisEqual(a.location, b.location)\n\t\t\t&& a.mtime === b.mtime\n\t\t\t&& isEqual(a.applicationExtensionslocation, b.applicationExtensionslocation)\n\t\t\t&& a.applicationExtensionslocationMtime === b.applicationExtensionslocationMtime\n\t\t\t&& a.profile === b.profile\n\t\t\t&& objects.equals(a.profileScanOptions, b.profileScanOptions)\n\t\t\t&& a.type === b.type\n\t\t\t&& a.validate === b.validate\n\t\t\t&& a.productVersion === b.productVersion\n\t\t\t&& a.productDate === b.productDate\n\t\t\t&& a.productCommit === b.productCommit\n\t\t\t&& a.devMode === b.devMode\n\t\t\t&& a.language === b.language\n\t\t\t&& Translations.equals(a.translations, b.translations)\n\t\t);\n\t}\n}\n\ntype NlsConfiguration = {\n\tlanguage: string | undefined;\n\tpseudo: boolean;\n\tdevMode: boolean;\n\ttranslations: Translations;\n};\n\nclass ExtensionsScanner extends Disposable {\n\n\tprivate readonly extensionsEnabledWithApiProposalVersion: string[];\n\n\tconstructor(\n\t\t@IExtensionsProfileScannerService protected readonly extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\t@IUriIdentityService protected readonly uriIdentityService: IUriIdentityService,\n\t\t@IFileService protected readonly fileService: IFileService,\n\t\t@IProductService productService: IProductService,\n\t\t@IEnvironmentService private readonly environmentService: IEnvironmentService,\n\t\t@ILogService protected readonly logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis.extensionsEnabledWithApiProposalVersion = productService.extensionsEnabledWithApiProposalVersion?.map(id => id.toLowerCase()) ?? [];\n\t}\n\n\tasync scanExtensions(input: ExtensionScannerInput): Promise<IRelaxedScannedExtension[]> {\n\t\treturn input.profile\n\t\t\t? this.scanExtensionsFromProfile(input)\n\t\t\t: this.scanExtensionsFromLocation(input);\n\t}\n\n\tprivate async scanExtensionsFromLocation(input: ExtensionScannerInput): Promise<IRelaxedScannedExtension[]> {\n\t\tconst stat = await this.fileService.resolve(input.location);\n\t\tif (!stat.children?.length) {\n\t\t\treturn [];\n\t\t}\n\t\tconst extensions = await Promise.all<IRelaxedScannedExtension | null>(\n\t\t\tstat.children.map(async c => {\n\t\t\t\tif (!c.isDirectory) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\t// Do not consider user extension folder starting with `.`\n\t\t\t\tif (input.type === ExtensionType.User && basename(c.resource).indexOf('.') === 0) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tconst extensionScannerInput = new ExtensionScannerInput(c.resource, input.mtime, input.applicationExtensionslocation, input.applicationExtensionslocationMtime, input.profile, input.profileScanOptions, input.type, input.validate, input.productVersion, input.productDate, input.productCommit, input.devMode, input.language, input.translations);\n\t\t\t\treturn this.scanExtension(extensionScannerInput);\n\t\t\t}));\n\t\treturn coalesce(extensions)\n\t\t\t// Sort: Make sure extensions are in the same order always. Helps cache invalidation even if the order changes.\n\t\t\t.sort((a, b) => a.location.path < b.location.path ? -1 : 1);\n\t}\n\n\tprivate async scanExtensionsFromProfile(input: ExtensionScannerInput): Promise<IRelaxedScannedExtension[]> {\n\t\tlet profileExtensions = await this.scanExtensionsFromProfileResource(input.location, () => true, input);\n\t\tif (input.applicationExtensionslocation && !this.uriIdentityService.extUri.isEqual(input.location, input.applicationExtensionslocation)) {\n\t\t\tprofileExtensions = profileExtensions.filter(e => !e.metadata?.isApplicationScoped);\n\t\t\tconst applicationExtensions = await this.scanExtensionsFromProfileResource(input.applicationExtensionslocation, (e) => !!e.metadata?.isBuiltin || !!e.metadata?.isApplicationScoped, input);\n\t\t\tprofileExtensions.push(...applicationExtensions);\n\t\t}\n\t\treturn profileExtensions;\n\t}\n\n\tprivate async scanExtensionsFromProfileResource(profileResource: URI, filter: (extensionInfo: IScannedProfileExtension) => boolean, input: ExtensionScannerInput): Promise<IRelaxedScannedExtension[]> {\n\t\tconst scannedProfileExtensions = await this.extensionsProfileScannerService.scanProfileExtensions(profileResource, input.profileScanOptions);\n\t\tif (!scannedProfileExtensions.length) {\n\t\t\treturn [];\n\t\t}\n\t\tconst extensions = await Promise.all<IRelaxedScannedExtension | null>(\n\t\t\tscannedProfileExtensions.map(async extensionInfo => {\n\t\t\t\tif (filter(extensionInfo)) {\n\t\t\t\t\tconst extensionScannerInput = new ExtensionScannerInput(extensionInfo.location, input.mtime, input.applicationExtensionslocation, input.applicationExtensionslocationMtime, input.profile, input.profileScanOptions, input.type, input.validate, input.productVersion, input.productDate, input.productCommit, input.devMode, input.language, input.translations);\n\t\t\t\t\treturn this.scanExtension(extensionScannerInput, extensionInfo);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t}));\n\t\treturn coalesce(extensions);\n\t}\n\n\tasync scanOneOrMultipleExtensions(input: ExtensionScannerInput): Promise<IRelaxedScannedExtension[]> {\n\t\ttry {\n\t\t\tif (await this.fileService.exists(joinPath(input.location, 'package.json'))) {\n\t\t\t\tconst extension = await this.scanExtension(input);\n\t\t\t\treturn extension ? [extension] : [];\n\t\t\t} else {\n\t\t\t\treturn await this.scanExtensions(input);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logService.error(`Error scanning extensions at ${input.location.path}:`, getErrorMessage(error));\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tasync scanExtension(input: ExtensionScannerInput): Promise<IRelaxedScannedExtension | null>;\n\tasync scanExtension(input: ExtensionScannerInput, scannedProfileExtension: IScannedProfileExtension): Promise<IRelaxedScannedExtension>;\n\tasync scanExtension(input: ExtensionScannerInput, scannedProfileExtension?: IScannedProfileExtension): Promise<IRelaxedScannedExtension | null> {\n\t\tconst validations: [Severity, string][] = [];\n\t\tlet isValid = true;\n\t\tlet manifest: IScannedExtensionManifest;\n\t\ttry {\n\t\t\tmanifest = await this.scanExtensionManifest(input.location);\n\t\t} catch (e) {\n\t\t\tif (scannedProfileExtension) {\n\t\t\t\tvalidations.push([Severity.Error, getErrorMessage(e)]);\n\t\t\t\tisValid = false;\n\t\t\t\tconst [publisher, name] = scannedProfileExtension.identifier.id.split('.');\n\t\t\t\tmanifest = {\n\t\t\t\t\tname,\n\t\t\t\t\tpublisher,\n\t\t\t\t\tversion: scannedProfileExtension.version,\n\t\t\t\t\tengines: { vscode: '' }\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tif (input.type !== ExtensionType.System) {\n\t\t\t\t\tthis.logService.error(e);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\t// allow publisher to be undefined to make the initial extension authoring experience smoother\n\t\tif (!manifest.publisher) {\n\t\t\tmanifest.publisher = UNDEFINED_PUBLISHER;\n\t\t}\n\n\t\tlet metadata: Metadata | undefined;\n\t\tif (scannedProfileExtension) {\n\t\t\tmetadata = {\n\t\t\t\t...scannedProfileExtension.metadata,\n\t\t\t\tsize: manifest.__metadata?.size,\n\t\t\t};\n\t\t} else if (manifest.__metadata) {\n\t\t\tmetadata = {\n\t\t\t\tinstalledTimestamp: manifest.__metadata.installedTimestamp,\n\t\t\t\tsize: manifest.__metadata.size,\n\t\t\t\ttargetPlatform: manifest.__metadata.targetPlatform,\n\t\t\t};\n\t\t}\n\n\t\tdelete manifest.__metadata;\n\t\tconst id = getGalleryExtensionId(manifest.publisher, manifest.name);\n\t\tconst identifier = metadata?.id ? { id, uuid: metadata.id } : { id };\n\t\tconst type = metadata?.isSystem ? ExtensionType.System : input.type;\n\t\tconst isBuiltin = type === ExtensionType.System || !!metadata?.isBuiltin;\n\t\ttry {\n\t\t\tmanifest = await this.translateManifest(input.location, manifest, ExtensionScannerInput.createNlsConfiguration(input));\n\t\t} catch (error) {\n\t\t\tthis.logService.warn('Failed to translate manifest', getErrorMessage(error));\n\t\t}\n\t\tlet extension: IRelaxedScannedExtension = {\n\t\t\ttype,\n\t\t\tidentifier,\n\t\t\tmanifest,\n\t\t\tlocation: input.location,\n\t\t\tisBuiltin,\n\t\t\ttargetPlatform: metadata?.targetPlatform ?? TargetPlatform.UNDEFINED,\n\t\t\tpublisherDisplayName: metadata?.publisherDisplayName,\n\t\t\tmetadata,\n\t\t\tisValid,\n\t\t\tvalidations,\n\t\t\tpreRelease: !!metadata?.preRelease,\n\t\t};\n\t\tif (input.validate) {\n\t\t\textension = this.validate(extension, input);\n\t\t}\n\t\tif (manifest.enabledApiProposals && (!this.environmentService.isBuilt || this.extensionsEnabledWithApiProposalVersion.includes(id.toLowerCase()))) {\n\t\t\tmanifest.originalEnabledApiProposals = manifest.enabledApiProposals;\n\t\t\tmanifest.enabledApiProposals = parseEnabledApiProposalNames([...manifest.enabledApiProposals]);\n\t\t}\n\t\treturn extension;\n\t}\n\n\tvalidate(extension: IRelaxedScannedExtension, input: ExtensionScannerInput): IRelaxedScannedExtension {\n\t\tlet isValid = extension.isValid;\n\t\tconst validateApiVersion = this.environmentService.isBuilt && this.extensionsEnabledWithApiProposalVersion.includes(extension.identifier.id.toLowerCase());\n\t\tconst validations = validateExtensionManifest(input.productVersion, input.productDate, input.location, extension.manifest, extension.isBuiltin, validateApiVersion);\n\t\tfor (const [severity, message] of validations) {\n\t\t\tif (severity === Severity.Error) {\n\t\t\t\tisValid = false;\n\t\t\t\tthis.logService.error(this.formatMessage(input.location, message));\n\t\t\t}\n\t\t}\n\t\textension.isValid = isValid;\n\t\textension.validations = [...extension.validations, ...validations];\n\t\treturn extension;\n\t}\n\n\tprivate async scanExtensionManifest(extensionLocation: URI): Promise<IScannedExtensionManifest> {\n\t\tconst manifestLocation = joinPath(extensionLocation, 'package.json');\n\t\tlet content;\n\t\ttry {\n\t\t\tcontent = (await this.fileService.readFile(manifestLocation)).value.toString();\n\t\t} catch (error) {\n\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\tthis.logService.error(this.formatMessage(extensionLocation, localize('fileReadFail', \"Cannot read file {0}: {1}.\", manifestLocation.path, error.message)));\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tlet manifest: IScannedExtensionManifest;\n\t\ttry {\n\t\t\tmanifest = JSON.parse(content);\n\t\t} catch (err) {\n\t\t\t// invalid JSON, let's get good errors\n\t\t\tconst errors: ParseError[] = [];\n\t\t\tparse(content, errors);\n\t\t\tfor (const e of errors) {\n\t\t\t\tthis.logService.error(this.formatMessage(extensionLocation, localize('jsonParseFail', \"Failed to parse {0}: [{1}, {2}] {3}.\", manifestLocation.path, e.offset, e.length, getParseErrorMessage(e.error))));\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t\tif (getNodeType(manifest) !== 'object') {\n\t\t\tconst errorMessage = this.formatMessage(extensionLocation, localize('jsonParseInvalidType', \"Invalid manifest file {0}: Not a JSON object.\", manifestLocation.path));\n\t\t\tthis.logService.error(errorMessage);\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\t\treturn manifest;\n\t}\n\n\tprivate async translateManifest(extensionLocation: URI, extensionManifest: IExtensionManifest, nlsConfiguration: NlsConfiguration): Promise<IExtensionManifest> {\n\t\tconst localizedMessages = await this.getLocalizedMessages(extensionLocation, extensionManifest, nlsConfiguration);\n\t\tif (localizedMessages) {\n\t\t\ttry {\n\t\t\t\tconst errors: ParseError[] = [];\n\t\t\t\t// resolveOriginalMessageBundle returns null if localizedMessages.default === undefined;\n\t\t\t\tconst defaults = await this.resolveOriginalMessageBundle(localizedMessages.default, errors);\n\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\terrors.forEach((error) => {\n\t\t\t\t\t\tthis.logService.error(this.formatMessage(extensionLocation, localize('jsonsParseReportErrors', \"Failed to parse {0}: {1}.\", localizedMessages.default?.path, getParseErrorMessage(error.error))));\n\t\t\t\t\t});\n\t\t\t\t\treturn extensionManifest;\n\t\t\t\t} else if (getNodeType(localizedMessages) !== 'object') {\n\t\t\t\t\tthis.logService.error(this.formatMessage(extensionLocation, localize('jsonInvalidFormat', \"Invalid format {0}: JSON object expected.\", localizedMessages.default?.path)));\n\t\t\t\t\treturn extensionManifest;\n\t\t\t\t}\n\t\t\t\tconst localized = localizedMessages.values || Object.create(null);\n\t\t\t\treturn localizeManifest(this.logService, extensionManifest, localized, defaults);\n\t\t\t} catch (error) {\n\t\t\t\t/*Ignore Error*/\n\t\t\t}\n\t\t}\n\t\treturn extensionManifest;\n\t}\n\n\tprivate async getLocalizedMessages(extensionLocation: URI, extensionManifest: IExtensionManifest, nlsConfiguration: NlsConfiguration): Promise<LocalizedMessages | undefined> {\n\t\tconst defaultPackageNLS = joinPath(extensionLocation, 'package.nls.json');\n\t\tconst reportErrors = (localized: URI | null, errors: ParseError[]): void => {\n\t\t\terrors.forEach((error) => {\n\t\t\t\tthis.logService.error(this.formatMessage(extensionLocation, localize('jsonsParseReportErrors', \"Failed to parse {0}: {1}.\", localized?.path, getParseErrorMessage(error.error))));\n\t\t\t});\n\t\t};\n\t\tconst reportInvalidFormat = (localized: URI | null): void => {\n\t\t\tthis.logService.error(this.formatMessage(extensionLocation, localize('jsonInvalidFormat', \"Invalid format {0}: JSON object expected.\", localized?.path)));\n\t\t};\n\n\t\tconst translationId = `${extensionManifest.publisher}.${extensionManifest.name}`;\n\t\tconst translationPath = nlsConfiguration.translations[translationId];\n\n\t\tif (translationPath) {\n\t\t\ttry {\n\t\t\t\tconst translationResource = URI.file(translationPath);\n\t\t\t\tconst content = (await this.fileService.readFile(translationResource)).value.toString();\n\t\t\t\tconst errors: ParseError[] = [];\n\t\t\t\tconst translationBundle: TranslationBundle = parse(content, errors);\n\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\treportErrors(translationResource, errors);\n\t\t\t\t\treturn { values: undefined, default: defaultPackageNLS };\n\t\t\t\t} else if (getNodeType(translationBundle) !== 'object') {\n\t\t\t\t\treportInvalidFormat(translationResource);\n\t\t\t\t\treturn { values: undefined, default: defaultPackageNLS };\n\t\t\t\t} else {\n\t\t\t\t\tconst values = translationBundle.contents ? translationBundle.contents.package : undefined;\n\t\t\t\t\treturn { values: values, default: defaultPackageNLS };\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\treturn { values: undefined, default: defaultPackageNLS };\n\t\t\t}\n\t\t} else {\n\t\t\tconst exists = await this.fileService.exists(defaultPackageNLS);\n\t\t\tif (!exists) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tlet messageBundle;\n\t\t\ttry {\n\t\t\t\tmessageBundle = await this.findMessageBundles(extensionLocation, nlsConfiguration);\n\t\t\t} catch (error) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (!messageBundle.localized) {\n\t\t\t\treturn { values: undefined, default: messageBundle.original };\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst messageBundleContent = (await this.fileService.readFile(messageBundle.localized)).value.toString();\n\t\t\t\tconst errors: ParseError[] = [];\n\t\t\t\tconst messages: MessageBag = parse(messageBundleContent, errors);\n\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\treportErrors(messageBundle.localized, errors);\n\t\t\t\t\treturn { values: undefined, default: messageBundle.original };\n\t\t\t\t} else if (getNodeType(messages) !== 'object') {\n\t\t\t\t\treportInvalidFormat(messageBundle.localized);\n\t\t\t\t\treturn { values: undefined, default: messageBundle.original };\n\t\t\t\t}\n\t\t\t\treturn { values: messages, default: messageBundle.original };\n\t\t\t} catch (error) {\n\t\t\t\treturn { values: undefined, default: messageBundle.original };\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Parses original message bundle, returns null if the original message bundle is null.\n\t */\n\tprivate async resolveOriginalMessageBundle(originalMessageBundle: URI | null, errors: ParseError[]): Promise<{ [key: string]: string } | undefined> {\n\t\tif (originalMessageBundle) {\n\t\t\ttry {\n\t\t\t\tconst originalBundleContent = (await this.fileService.readFile(originalMessageBundle)).value.toString();\n\t\t\t\treturn parse(originalBundleContent, errors);\n\t\t\t} catch (error) {\n\t\t\t\t/* Ignore Error */\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\t/**\n\t * Finds localized message bundle and the original (unlocalized) one.\n\t * If the localized file is not present, returns null for the original and marks original as localized.\n\t */\n\tprivate findMessageBundles(extensionLocation: URI, nlsConfiguration: NlsConfiguration): Promise<{ localized: URI; original: URI | null }> {\n\t\treturn new Promise<{ localized: URI; original: URI | null }>((c, e) => {\n\t\t\tconst loop = (locale: string): void => {\n\t\t\t\tconst toCheck = joinPath(extensionLocation, `package.nls.${locale}.json`);\n\t\t\t\tthis.fileService.exists(toCheck).then(exists => {\n\t\t\t\t\tif (exists) {\n\t\t\t\t\t\tc({ localized: toCheck, original: joinPath(extensionLocation, 'package.nls.json') });\n\t\t\t\t\t}\n\t\t\t\t\tconst index = locale.lastIndexOf('-');\n\t\t\t\t\tif (index === -1) {\n\t\t\t\t\t\tc({ localized: joinPath(extensionLocation, 'package.nls.json'), original: null });\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlocale = locale.substring(0, index);\n\t\t\t\t\t\tloop(locale);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t\tif (nlsConfiguration.devMode || nlsConfiguration.pseudo || !nlsConfiguration.language) {\n\t\t\t\treturn c({ localized: joinPath(extensionLocation, 'package.nls.json'), original: null });\n\t\t\t}\n\t\t\tloop(nlsConfiguration.language);\n\t\t});\n\t}\n\n\tprivate formatMessage(extensionLocation: URI, message: string): string {\n\t\treturn `[${extensionLocation.path}]: ${message}`;\n\t}\n\n}\n\ninterface IExtensionCacheData {\n\tinput: ExtensionScannerInput;\n\tresult: IRelaxedScannedExtension[];\n}\n\nclass CachedExtensionsScanner extends ExtensionsScanner {\n\n\tprivate input: ExtensionScannerInput | undefined;\n\tprivate readonly cacheValidatorThrottler: ThrottledDelayer<void> = this._register(new ThrottledDelayer(3000));\n\n\tprivate readonly _onDidChangeCache = this._register(new Emitter<void>());\n\treadonly onDidChangeCache = this._onDidChangeCache.event;\n\n\tconstructor(\n\t\tprivate readonly currentProfile: IUserDataProfile,\n\t\t@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,\n\t\t@IExtensionsProfileScannerService extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\t@IUriIdentityService uriIdentityService: IUriIdentityService,\n\t\t@IFileService fileService: IFileService,\n\t\t@IProductService productService: IProductService,\n\t\t@IEnvironmentService environmentService: IEnvironmentService,\n\t\t@ILogService logService: ILogService\n\t) {\n\t\tsuper(extensionsProfileScannerService, uriIdentityService, fileService, productService, environmentService, logService);\n\t}\n\n\toverride async scanExtensions(input: ExtensionScannerInput): Promise<IRelaxedScannedExtension[]> {\n\t\tconst cacheFile = this.getCacheFile(input);\n\t\tconst cacheContents = await this.readExtensionCache(cacheFile);\n\t\tthis.input = input;\n\t\tif (cacheContents && cacheContents.input && ExtensionScannerInput.equals(cacheContents.input, this.input)) {\n\t\t\tthis.logService.debug('Using cached extensions scan result', input.type === ExtensionType.System ? 'system' : 'user', input.location.toString());\n\t\t\tthis.cacheValidatorThrottler.trigger(() => this.validateCache());\n\t\t\treturn cacheContents.result.map((extension) => {\n\t\t\t\t// revive URI object\n\t\t\t\textension.location = URI.revive(extension.location);\n\t\t\t\treturn extension;\n\t\t\t});\n\t\t}\n\t\tconst result = await super.scanExtensions(input);\n\t\tawait this.writeExtensionCache(cacheFile, { input, result });\n\t\treturn result;\n\t}\n\n\tprivate async readExtensionCache(cacheFile: URI): Promise<IExtensionCacheData | null> {\n\t\ttry {\n\t\t\tconst cacheRawContents = await this.fileService.readFile(cacheFile);\n\t\t\tconst extensionCacheData: IExtensionCacheData = JSON.parse(cacheRawContents.value.toString());\n\t\t\treturn { result: extensionCacheData.result, input: revive(extensionCacheData.input) };\n\t\t} catch (error) {\n\t\t\tthis.logService.debug('Error while reading the extension cache file:', cacheFile.path, getErrorMessage(error));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate async writeExtensionCache(cacheFile: URI, cacheContents: IExtensionCacheData): Promise<void> {\n\t\ttry {\n\t\t\tawait this.fileService.writeFile(cacheFile, VSBuffer.fromString(JSON.stringify(cacheContents)));\n\t\t} catch (error) {\n\t\t\tthis.logService.debug('Error while writing the extension cache file:', cacheFile.path, getErrorMessage(error));\n\t\t}\n\t}\n\n\tprivate async validateCache(): Promise<void> {\n\t\tif (!this.input) {\n\t\t\t// Input has been unset by the time we get here, so skip validation\n\t\t\treturn;\n\t\t}\n\n\t\tconst cacheFile = this.getCacheFile(this.input);\n\t\tconst cacheContents = await this.readExtensionCache(cacheFile);\n\t\tif (!cacheContents) {\n\t\t\t// Cache has been deleted by someone else, which is perfectly fine...\n\t\t\treturn;\n\t\t}\n\n\t\tconst actual = cacheContents.result;\n\t\tconst expected = JSON.parse(JSON.stringify(await super.scanExtensions(this.input)));\n\t\tif (objects.equals(expected, actual)) {\n\t\t\t// Cache is valid and running with it is perfectly fine...\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis.logService.info('Invalidating Cache', actual, expected);\n\t\t\t// Cache is invalid, delete it\n\t\t\tawait this.fileService.del(cacheFile);\n\t\t\tthis._onDidChangeCache.fire();\n\t\t} catch (error) {\n\t\t\tthis.logService.error(error);\n\t\t}\n\t}\n\n\tprivate getCacheFile(input: ExtensionScannerInput): URI {\n\t\tconst profile = this.getProfile(input);\n\t\treturn this.uriIdentityService.extUri.joinPath(profile.cacheHome, input.type === ExtensionType.System ? BUILTIN_MANIFEST_CACHE_FILE : USER_MANIFEST_CACHE_FILE);\n\t}\n\n\tprivate getProfile(input: ExtensionScannerInput): IUserDataProfile {\n\t\tif (input.type === ExtensionType.System) {\n\t\t\treturn this.userDataProfilesService.defaultProfile;\n\t\t}\n\t\tif (!input.profile) {\n\t\t\treturn this.userDataProfilesService.defaultProfile;\n\t\t}\n\t\tif (this.uriIdentityService.extUri.isEqual(input.location, this.currentProfile.extensionsResource)) {\n\t\t\treturn this.currentProfile;\n\t\t}\n\t\treturn this.userDataProfilesService.profiles.find(p => this.uriIdentityService.extUri.isEqual(input.location, p.extensionsResource)) ?? this.currentProfile;\n\t}\n\n}\n\nexport function toExtensionDescription(extension: IScannedExtension, isUnderDevelopment: boolean): IExtensionDescription {\n\tconst id = getExtensionId(extension.manifest.publisher, extension.manifest.name);\n\treturn {\n\t\tid,\n\t\tidentifier: new ExtensionIdentifier(id),\n\t\tisBuiltin: extension.type === ExtensionType.System,\n\t\tisUserBuiltin: extension.type === ExtensionType.User && extension.isBuiltin,\n\t\tisUnderDevelopment,\n\t\textensionLocation: extension.location,\n\t\tuuid: extension.identifier.uuid,\n\t\ttargetPlatform: extension.targetPlatform,\n\t\tpublisherDisplayName: extension.publisherDisplayName,\n\t\tpreRelease: extension.preRelease,\n\t\t...extension.manifest,\n\t};\n}\n\nexport class NativeExtensionsScannerService extends AbstractExtensionsScannerService implements IExtensionsScannerService {\n\n\tprivate readonly translationsPromise: Promise<Translations>;\n\n\tconstructor(\n\t\tsystemExtensionsLocation: URI,\n\t\tuserExtensionsLocation: URI,\n\t\tuserHome: URI,\n\t\tcurrentProfile: IUserDataProfile,\n\t\tuserDataProfilesService: IUserDataProfilesService,\n\t\textensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\tfileService: IFileService,\n\t\tlogService: ILogService,\n\t\tenvironmentService: IEnvironmentService,\n\t\tproductService: IProductService,\n\t\turiIdentityService: IUriIdentityService,\n\t\tinstantiationService: IInstantiationService,\n\t) {\n\t\tsuper(\n\t\t\tsystemExtensionsLocation,\n\t\t\tuserExtensionsLocation,\n\t\t\tjoinPath(userHome, '.vscode-oss-dev', 'extensions', 'control.json'),\n\t\t\tcurrentProfile,\n\t\t\tuserDataProfilesService, extensionsProfileScannerService, fileService, logService, environmentService, productService, uriIdentityService, instantiationService);\n\t\tthis.translationsPromise = (async () => {\n\t\t\tif (platform.translationsConfigFile) {\n\t\t\t\ttry {\n\t\t\t\t\tconst content = await this.fileService.readFile(URI.file(platform.translationsConfigFile));\n\t\t\t\t\treturn JSON.parse(content.value.toString());\n\t\t\t\t} catch (err) { /* Ignore Error */ }\n\t\t\t}\n\t\t\treturn Object.create(null);\n\t\t})();\n\t}\n\n\tprotected getTranslations(language: string): Promise<Translations> {\n\t\treturn this.translationsPromise;\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { buffer, ExtractError } from '../../../base/node/zip.js';\nimport { localize } from '../../../nls.js';\nimport { toExtensionManagementError } from '../common/abstractExtensionManagementService.js';\nimport { ExtensionManagementError, ExtensionManagementErrorCode } from '../common/extensionManagement.js';\nimport { IExtensionManifest } from '../../extensions/common/extensions.js';\n\nexport function fromExtractError(e: Error): ExtensionManagementError {\n\tlet errorCode = ExtensionManagementErrorCode.Extract;\n\tif (e instanceof ExtractError) {\n\t\tif (e.type === 'CorruptZip') {\n\t\t\terrorCode = ExtensionManagementErrorCode.CorruptZip;\n\t\t} else if (e.type === 'Incomplete') {\n\t\t\terrorCode = ExtensionManagementErrorCode.IncompleteZip;\n\t\t}\n\t}\n\treturn toExtensionManagementError(e, errorCode);\n}\n\nexport async function getManifest(vsixPath: string): Promise<IExtensionManifest> {\n\tlet data;\n\ttry {\n\t\tdata = await buffer(vsixPath, 'extension/package.json');\n\t} catch (e) {\n\t\tthrow fromExtractError(e);\n\t}\n\n\ttry {\n\t\treturn JSON.parse(data.toString('utf8'));\n\t} catch (err) {\n\t\tthrow new ExtensionManagementError(localize('invalidManifest', \"VSIX invalid: package.json is not a JSON file.\"), ExtensionManagementErrorCode.Invalid);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { getErrorMessage } from '../../../base/common/errors.js';\nimport { isDefined } from '../../../base/common/types.js';\nimport { TargetPlatform } from '../../extensions/common/extensions.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { ILogService, LogLevel } from '../../log/common/log.js';\nimport { ITelemetryService } from '../../telemetry/common/telemetry.js';\nimport { ExtensionSignatureVerificationCode } from '../common/extensionManagement.js';\n\nexport const IExtensionSignatureVerificationService = createDecorator<IExtensionSignatureVerificationService>('IExtensionSignatureVerificationService');\n\nexport interface IExtensionSignatureVerificationResult {\n\treadonly code: ExtensionSignatureVerificationCode;\n}\n\n/**\n * A service for verifying signed extensions.\n */\nexport interface IExtensionSignatureVerificationService {\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Verifies an extension file (.vsix) against a signature archive file.\n\t * @param extensionId The extension identifier.\n\t * @param version The extension version.\n\t * @param vsixFilePath The extension file path.\n\t * @param signatureArchiveFilePath The signature archive file path.\n\t * @returns returns the verification result or undefined if the verification was not executed.\n\t */\n\tverify(extensionId: string, version: string, vsixFilePath: string, signatureArchiveFilePath: string, clientTargetPlatform?: TargetPlatform): Promise<IExtensionSignatureVerificationResult | undefined>;\n}\n\ndeclare module vsceSign {\n\texport function verify(vsixFilePath: string, signatureArchiveFilePath: string, verbose: boolean): Promise<ExtensionSignatureVerificationResult>;\n}\n\n/**\n * Extension signature verification result\n */\nexport interface ExtensionSignatureVerificationResult {\n\treadonly code: ExtensionSignatureVerificationCode;\n\treadonly didExecute: boolean;\n\treadonly internalCode?: number;\n\treadonly output?: string;\n}\n\nexport class ExtensionSignatureVerificationService implements IExtensionSignatureVerificationService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate moduleLoadingPromise: Promise<typeof vsceSign> | undefined;\n\n\tconstructor(\n\t\t@ILogService private readonly logService: ILogService,\n\t\t@ITelemetryService private readonly telemetryService: ITelemetryService,\n\t) { }\n\n\tprivate vsceSign(): Promise<typeof vsceSign> {\n\t\tif (!this.moduleLoadingPromise) {\n\t\t\tthis.moduleLoadingPromise = this.resolveVsceSign();\n\t\t}\n\n\t\treturn this.moduleLoadingPromise;\n\t}\n\n\tprivate async resolveVsceSign(): Promise<typeof vsceSign> {\n\t\tconst mod = '@vscode/vsce-sign';\n\t\treturn import(mod);\n\t}\n\n\tpublic async verify(extensionId: string, version: string, vsixFilePath: string, signatureArchiveFilePath: string, clientTargetPlatform?: TargetPlatform): Promise<IExtensionSignatureVerificationResult | undefined> {\n\t\tlet module: typeof vsceSign;\n\n\t\ttry {\n\t\t\tmodule = await this.vsceSign();\n\t\t} catch (error) {\n\t\t\tthis.logService.error('Could not load vsce-sign module', getErrorMessage(error));\n\t\t\tthis.logService.info(`Extension signature verification is not done: ${extensionId}`);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst startTime = new Date().getTime();\n\t\tlet result: ExtensionSignatureVerificationResult;\n\n\t\ttry {\n\t\t\tthis.logService.trace(`Verifying extension signature for ${extensionId}...`);\n\t\t\tresult = await module.verify(vsixFilePath, signatureArchiveFilePath, this.logService.getLevel() === LogLevel.Trace);\n\t\t} catch (e) {\n\t\t\tresult = {\n\t\t\t\tcode: ExtensionSignatureVerificationCode.UnknownError,\n\t\t\t\tdidExecute: false,\n\t\t\t\toutput: getErrorMessage(e)\n\t\t\t};\n\t\t}\n\n\t\tconst duration = new Date().getTime() - startTime;\n\n\t\tthis.logService.info(`Extension signature verification result for ${extensionId}: ${result.code}. ${isDefined(result.internalCode) ? `Internal Code: ${result.internalCode}. ` : ''}Executed: ${result.didExecute}. Duration: ${duration}ms.`);\n\t\tthis.logService.trace(`Extension signature verification output for ${extensionId}:\\n${result.output}`);\n\n\t\ttype ExtensionSignatureVerificationClassification = {\n\t\t\towner: 'sandy081';\n\t\t\tcomment: 'Extension signature verification event';\n\t\t\textensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'extension identifier' };\n\t\t\textensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'extension version' };\n\t\t\tcode: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'result code of the verification' };\n\t\t\tinternalCode?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; 'isMeasurement': true; comment: 'internal code of the verification' };\n\t\t\tduration: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; 'isMeasurement': true; comment: 'amount of time taken to verify the signature' };\n\t\t\tdidExecute: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'whether the verification was executed' };\n\t\t\tclientTargetPlatform?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'target platform of the client' };\n\t\t};\n\t\ttype ExtensionSignatureVerificationEvent = {\n\t\t\textensionId: string;\n\t\t\textensionVersion: string;\n\t\t\tcode: string;\n\t\t\tinternalCode?: number;\n\t\t\tduration: number;\n\t\t\tdidExecute: boolean;\n\t\t\tclientTargetPlatform?: string;\n\t\t};\n\t\tthis.telemetryService.publicLog2<ExtensionSignatureVerificationEvent, ExtensionSignatureVerificationClassification>('extensionsignature:verification', {\n\t\t\textensionId,\n\t\t\textensionVersion: version,\n\t\t\tcode: result.code,\n\t\t\tinternalCode: result.internalCode,\n\t\t\tduration,\n\t\t\tdidExecute: result.didExecute,\n\t\t\tclientTargetPlatform,\n\t\t});\n\n\t\treturn { code: result.code };\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Promises } from '../../../base/common/async.js';\nimport { getErrorMessage } from '../../../base/common/errors.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { joinPath } from '../../../base/common/resources.js';\nimport * as semver from '../../../base/common/semver/semver.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { Promises as FSPromises } from '../../../base/node/pfs.js';\nimport { buffer, CorruptZipMessage } from '../../../base/node/zip.js';\nimport { INativeEnvironmentService } from '../../environment/common/environment.js';\nimport { toExtensionManagementError } from '../common/abstractExtensionManagementService.js';\nimport { ExtensionManagementError, ExtensionManagementErrorCode, ExtensionSignatureVerificationCode, IExtensionGalleryService, IGalleryExtension, InstallOperation } from '../common/extensionManagement.js';\nimport { ExtensionKey, groupByExtension } from '../common/extensionManagementUtil.js';\nimport { fromExtractError } from './extensionManagementUtil.js';\nimport { IExtensionSignatureVerificationService } from './extensionSignatureVerificationService.js';\nimport { TargetPlatform } from '../../extensions/common/extensions.js';\nimport { FileOperationResult, IFileService, IFileStatWithMetadata, toFileOperationResult } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { ITelemetryService } from '../../telemetry/common/telemetry.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\n\ntype RetryDownloadClassification = {\n\towner: 'sandy081';\n\tcomment: 'Event reporting the retry of downloading';\n\textensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Extension Id' };\n\tattempts: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'Number of Attempts' };\n};\ntype RetryDownloadEvent = {\n\textensionId: string;\n\tattempts: number;\n};\n\nexport class ExtensionsDownloader extends Disposable {\n\n\tprivate static readonly SignatureArchiveExtension = '.sigzip';\n\n\treadonly extensionsDownloadDir: URI;\n\tprivate readonly extensionsTrashDir: URI;\n\tprivate readonly cache: number;\n\tprivate readonly cleanUpPromise: Promise<void>;\n\n\tconstructor(\n\t\t@INativeEnvironmentService environmentService: INativeEnvironmentService,\n\t\t@IFileService private readonly fileService: IFileService,\n\t\t@IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService,\n\t\t@IExtensionSignatureVerificationService private readonly extensionSignatureVerificationService: IExtensionSignatureVerificationService,\n\t\t@ITelemetryService private readonly telemetryService: ITelemetryService,\n\t\t@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,\n\t\t@ILogService private readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis.extensionsDownloadDir = environmentService.extensionsDownloadLocation;\n\t\tthis.extensionsTrashDir = uriIdentityService.extUri.joinPath(environmentService.extensionsDownloadLocation, `.trash`);\n\t\tthis.cache = 20; // Cache 20 downloaded VSIX files\n\t\tthis.cleanUpPromise = this.cleanUp();\n\t}\n\n\tasync download(extension: IGalleryExtension, operation: InstallOperation, verifySignature: boolean, clientTargetPlatform?: TargetPlatform): Promise<{ readonly location: URI; readonly verificationStatus: ExtensionSignatureVerificationCode | undefined }> {\n\t\tawait this.cleanUpPromise;\n\n\t\tconst location = await this.downloadVSIX(extension, operation);\n\n\t\tif (!verifySignature) {\n\t\t\treturn { location, verificationStatus: undefined };\n\t\t}\n\n\t\tif (!extension.isSigned) {\n\t\t\treturn { location, verificationStatus: ExtensionSignatureVerificationCode.NotSigned };\n\t\t}\n\n\t\tlet signatureArchiveLocation;\n\t\ttry {\n\t\t\tsignatureArchiveLocation = await this.downloadSignatureArchive(extension);\n\t\t\tconst verificationStatus = (await this.extensionSignatureVerificationService.verify(extension.identifier.id, extension.version, location.fsPath, signatureArchiveLocation.fsPath, clientTargetPlatform))?.code;\n\t\t\tif (verificationStatus === ExtensionSignatureVerificationCode.PackageIsInvalidZip || verificationStatus === ExtensionSignatureVerificationCode.SignatureArchiveIsInvalidZip) {\n\t\t\t\ttry {\n\t\t\t\t\t// Delete the downloaded vsix if VSIX or signature archive is invalid\n\t\t\t\t\tawait this.delete(location);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t}\n\t\t\t\tthrow new ExtensionManagementError(CorruptZipMessage, ExtensionManagementErrorCode.CorruptZip);\n\t\t\t}\n\t\t\treturn { location, verificationStatus };\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\t// Delete the downloaded VSIX if signature archive download fails\n\t\t\t\tawait this.delete(location);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.error(error);\n\t\t\t}\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (signatureArchiveLocation) {\n\t\t\t\ttry {\n\t\t\t\t\t// Delete signature archive always\n\t\t\t\t\tawait this.delete(signatureArchiveLocation);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async downloadVSIX(extension: IGalleryExtension, operation: InstallOperation): Promise<URI> {\n\t\ttry {\n\t\t\tconst location = joinPath(this.extensionsDownloadDir, this.getName(extension));\n\t\t\tconst attempts = await this.doDownload(extension, 'vsix', async () => {\n\t\t\t\tawait this.downloadFile(extension, location, location => this.extensionGalleryService.download(extension, location, operation));\n\t\t\t\ttry {\n\t\t\t\t\tawait this.validate(location.fsPath, 'extension/package.json');\n\t\t\t\t} catch (error) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.fileService.del(location);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.logService.warn(`Error while deleting: ${location.path}`, getErrorMessage(e));\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}, 2);\n\n\t\t\tif (attempts > 1) {\n\t\t\t\tthis.telemetryService.publicLog2<RetryDownloadEvent, RetryDownloadClassification>('extensiongallery:downloadvsix:retry', {\n\t\t\t\t\textensionId: extension.identifier.id,\n\t\t\t\t\tattempts\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn location;\n\t\t} catch (e) {\n\t\t\tthrow toExtensionManagementError(e, ExtensionManagementErrorCode.Download);\n\t\t}\n\t}\n\n\tprivate async downloadSignatureArchive(extension: IGalleryExtension): Promise<URI> {\n\t\ttry {\n\t\t\tconst location = joinPath(this.extensionsDownloadDir, `${this.getName(extension)}${ExtensionsDownloader.SignatureArchiveExtension}`);\n\t\t\tconst attempts = await this.doDownload(extension, 'sigzip', async () => {\n\t\t\t\tawait this.extensionGalleryService.downloadSignatureArchive(extension, location);\n\t\t\t\ttry {\n\t\t\t\t\tawait this.validate(location.fsPath, '.signature.p7s');\n\t\t\t\t} catch (error) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.fileService.del(location);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.logService.warn(`Error while deleting: ${location.path}`, getErrorMessage(e));\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}, 2);\n\n\t\t\tif (attempts > 1) {\n\t\t\t\tthis.telemetryService.publicLog2<RetryDownloadEvent, RetryDownloadClassification>('extensiongallery:downloadsigzip:retry', {\n\t\t\t\t\textensionId: extension.identifier.id,\n\t\t\t\t\tattempts\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn location;\n\t\t} catch (e) {\n\t\t\tthrow toExtensionManagementError(e, ExtensionManagementErrorCode.DownloadSignature);\n\t\t}\n\t}\n\n\tprivate async downloadFile(extension: IGalleryExtension, location: URI, downloadFn: (location: URI) => Promise<void>): Promise<void> {\n\t\t// Do not download if exists\n\t\tif (await this.fileService.exists(location)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Download directly if locaiton is not file scheme\n\t\tif (location.scheme !== Schemas.file) {\n\t\t\tawait downloadFn(location);\n\t\t\treturn;\n\t\t}\n\n\t\t// Download to temporary location first only if file does not exist\n\t\tconst tempLocation = joinPath(this.extensionsDownloadDir, `.${generateUuid()}`);\n\t\ttry {\n\t\t\tawait downloadFn(tempLocation);\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait this.fileService.del(tempLocation);\n\t\t\t} catch (e) { /* ignore */ }\n\t\t\tthrow error;\n\t\t}\n\n\t\ttry {\n\t\t\t// Rename temp location to original\n\t\t\tawait FSPromises.rename(tempLocation.fsPath, location.fsPath, 2 * 60 * 1000 /* Retry for 2 minutes */);\n\t\t} catch (error) {\n\t\t\ttry { await this.fileService.del(tempLocation); } catch (e) { /* ignore */ }\n\t\t\tlet exists = false;\n\t\t\ttry { exists = await this.fileService.exists(location); } catch (e) { /* ignore */ }\n\t\t\tif (exists) {\n\t\t\t\tthis.logService.info(`Rename failed because the file was downloaded by another source. So ignoring renaming.`, extension.identifier.id, location.path);\n\t\t\t} else {\n\t\t\t\tthis.logService.info(`Rename failed because of ${getErrorMessage(error)}. Deleted the file from downloaded location`, tempLocation.path);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async doDownload(extension: IGalleryExtension, name: string, downloadFn: () => Promise<void>, retries: number): Promise<number> {\n\t\tlet attempts = 1;\n\t\twhile (true) {\n\t\t\ttry {\n\t\t\t\tawait downloadFn();\n\t\t\t\treturn attempts;\n\t\t\t} catch (e) {\n\t\t\t\tif (attempts++ > retries) {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t\tthis.logService.warn(`Failed downloading ${name}. ${getErrorMessage(e)}. Retry again...`, extension.identifier.id);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected async validate(zipPath: string, filePath: string): Promise<void> {\n\t\ttry {\n\t\t\tawait buffer(zipPath, filePath);\n\t\t} catch (e) {\n\t\t\tthrow fromExtractError(e);\n\t\t}\n\t}\n\n\tasync delete(location: URI): Promise<void> {\n\t\tawait this.cleanUpPromise;\n\t\tconst trashRelativePath = this.uriIdentityService.extUri.relativePath(this.extensionsDownloadDir, location);\n\t\tif (trashRelativePath) {\n\t\t\tawait this.fileService.move(location, this.uriIdentityService.extUri.joinPath(this.extensionsTrashDir, trashRelativePath), true);\n\t\t} else {\n\t\t\tawait this.fileService.del(location);\n\t\t}\n\t}\n\n\tprivate async cleanUp(): Promise<void> {\n\t\ttry {\n\t\t\tif (!(await this.fileService.exists(this.extensionsDownloadDir))) {\n\t\t\t\tthis.logService.trace('Extension VSIX downloads cache dir does not exist');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait this.fileService.del(this.extensionsTrashDir, { recursive: true });\n\t\t\t} catch (error) {\n\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst folderStat = await this.fileService.resolve(this.extensionsDownloadDir, { resolveMetadata: true });\n\t\t\tif (folderStat.children) {\n\t\t\t\tconst toDelete: URI[] = [];\n\t\t\t\tconst vsixs: [ExtensionKey, IFileStatWithMetadata][] = [];\n\t\t\t\tconst signatureArchives: URI[] = [];\n\n\t\t\t\tfor (const stat of folderStat.children) {\n\t\t\t\t\tif (stat.name.endsWith(ExtensionsDownloader.SignatureArchiveExtension)) {\n\t\t\t\t\t\tsignatureArchives.push(stat.resource);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst extension = ExtensionKey.parse(stat.name);\n\t\t\t\t\t\tif (extension) {\n\t\t\t\t\t\t\tvsixs.push([extension, stat]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst byExtension = groupByExtension(vsixs, ([extension]) => extension);\n\t\t\t\tconst distinct: IFileStatWithMetadata[] = [];\n\t\t\t\tfor (const p of byExtension) {\n\t\t\t\t\tp.sort((a, b) => semver.rcompare(a[0].version, b[0].version));\n\t\t\t\t\ttoDelete.push(...p.slice(1).map(e => e[1].resource)); // Delete outdated extensions\n\t\t\t\t\tdistinct.push(p[0][1]);\n\t\t\t\t}\n\t\t\t\tdistinct.sort((a, b) => a.mtime - b.mtime); // sort by modified time\n\t\t\t\ttoDelete.push(...distinct.slice(0, Math.max(0, distinct.length - this.cache)).map(s => s.resource)); // Retain minimum cacheSize and delete the rest\n\t\t\t\ttoDelete.push(...signatureArchives); // Delete all signature archives\n\n\t\t\t\tawait Promises.settled(toDelete.map(resource => {\n\t\t\t\t\tthis.logService.trace('Deleting from cache', resource.path);\n\t\t\t\t\treturn this.fileService.del(resource);\n\t\t\t\t}));\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis.logService.error(e);\n\t\t}\n\t}\n\n\tprivate getName(extension: IGalleryExtension): string {\n\t\treturn ExtensionKey.create(extension).toString().toLowerCase();\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ChildProcess, fork } from 'child_process';\nimport { Limiter } from '../../../base/common/async.js';\nimport { toErrorMessage } from '../../../base/common/errorMessage.js';\nimport { Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { join } from '../../../base/common/path.js';\nimport { Promises } from '../../../base/node/pfs.js';\nimport { ILocalExtension } from '../common/extensionManagement.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\n\nexport class ExtensionsLifecycle extends Disposable {\n\n\tprivate processesLimiter: Limiter<void> = new Limiter(5); // Run max 5 processes in parallel\n\n\tconstructor(\n\t\t@IUserDataProfilesService private userDataProfilesService: IUserDataProfilesService,\n\t\t@ILogService private readonly logService: ILogService\n\t) {\n\t\tsuper();\n\t}\n\n\tasync postUninstall(extension: ILocalExtension): Promise<void> {\n\t\tconst script = this.parseScript(extension, 'uninstall');\n\t\tif (script) {\n\t\t\tthis.logService.info(extension.identifier.id, extension.manifest.version, `Running post uninstall script`);\n\t\t\tawait this.processesLimiter.queue(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.runLifecycleHook(script.script, 'uninstall', script.args, true, extension);\n\t\t\t\t\tthis.logService.info(`Finished running post uninstall script`, extension.identifier.id, extension.manifest.version);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logService.error('Failed to run post uninstall script', extension.identifier.id, extension.manifest.version);\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\ttry {\n\t\t\tawait Promises.rm(this.getExtensionStoragePath(extension));\n\t\t} catch (error) {\n\t\t\tthis.logService.error('Error while removing extension storage path', extension.identifier.id);\n\t\t\tthis.logService.error(error);\n\t\t}\n\t}\n\n\tprivate parseScript(extension: ILocalExtension, type: string): { script: string; args: string[] } | null {\n\t\tconst scriptKey = `vscode:${type}`;\n\t\tif (extension.location.scheme === Schemas.file && extension.manifest && extension.manifest['scripts'] && typeof extension.manifest['scripts'][scriptKey] === 'string') {\n\t\t\tconst script = (<string>extension.manifest['scripts'][scriptKey]).split(' ');\n\t\t\tif (script.length < 2 || script[0] !== 'node' || !script[1]) {\n\t\t\t\tthis.logService.warn(extension.identifier.id, extension.manifest.version, `${scriptKey} should be a node script`);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn { script: join(extension.location.fsPath, script[1]), args: script.slice(2) || [] };\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate runLifecycleHook(lifecycleHook: string, lifecycleType: string, args: string[], timeout: boolean, extension: ILocalExtension): Promise<void> {\n\t\treturn new Promise<void>((c, e) => {\n\n\t\t\tconst extensionLifecycleProcess = this.start(lifecycleHook, lifecycleType, args, extension);\n\t\t\tlet timeoutHandler: Timeout | null;\n\n\t\t\tconst onexit = (error?: string) => {\n\t\t\t\tif (timeoutHandler) {\n\t\t\t\t\tclearTimeout(timeoutHandler);\n\t\t\t\t\ttimeoutHandler = null;\n\t\t\t\t}\n\t\t\t\tif (error) {\n\t\t\t\t\te(error);\n\t\t\t\t} else {\n\t\t\t\t\tc(undefined);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// on error\n\t\t\textensionLifecycleProcess.on('error', (err) => {\n\t\t\t\tonexit(toErrorMessage(err) || 'Unknown');\n\t\t\t});\n\n\t\t\t// on exit\n\t\t\textensionLifecycleProcess.on('exit', (code: number, signal: string) => {\n\t\t\t\tonexit(code ? `post-${lifecycleType} process exited with code ${code}` : undefined);\n\t\t\t});\n\n\t\t\tif (timeout) {\n\t\t\t\t// timeout: kill process after waiting for 5s\n\t\t\t\ttimeoutHandler = setTimeout(() => {\n\t\t\t\t\ttimeoutHandler = null;\n\t\t\t\t\textensionLifecycleProcess.kill();\n\t\t\t\t\te('timed out');\n\t\t\t\t}, 5000);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate start(uninstallHook: string, lifecycleType: string, args: string[], extension: ILocalExtension): ChildProcess {\n\t\tconst opts = {\n\t\t\tsilent: true,\n\t\t\texecArgv: undefined\n\t\t};\n\t\tconst extensionUninstallProcess = fork(uninstallHook, [`--type=extension-post-${lifecycleType}`, ...args], opts);\n\n\t\t// Catch all output coming from the process\n\t\ttype Output = { data: string; format: string[] };\n\t\textensionUninstallProcess.stdout!.setEncoding('utf8');\n\t\textensionUninstallProcess.stderr!.setEncoding('utf8');\n\n\t\tconst onStdout = Event.fromNodeEventEmitter<string>(extensionUninstallProcess.stdout!, 'data');\n\t\tconst onStderr = Event.fromNodeEventEmitter<string>(extensionUninstallProcess.stderr!, 'data');\n\n\t\t// Log output\n\t\tthis._register(onStdout(data => this.logService.info(extension.identifier.id, extension.manifest.version, `post-${lifecycleType}`, data)));\n\t\tthis._register(onStderr(data => this.logService.error(extension.identifier.id, extension.manifest.version, `post-${lifecycleType}`, data)));\n\n\t\tconst onOutput = Event.any(\n\t\t\tEvent.map(onStdout, o => ({ data: `%c${o}`, format: [''] }), this._store),\n\t\t\tEvent.map(onStderr, o => ({ data: `%c${o}`, format: ['color: red'] }), this._store)\n\t\t);\n\t\t// Debounce all output, so we can render it in the Chrome console as a group\n\t\tconst onDebouncedOutput = Event.debounce<Output>(onOutput, (r, o) => {\n\t\t\treturn r\n\t\t\t\t? { data: r.data + o.data, format: [...r.format, ...o.format] }\n\t\t\t\t: { data: o.data, format: o.format };\n\t\t}, 100, undefined, undefined, undefined, this._store);\n\n\t\t// Print out output\n\t\tonDebouncedOutput(data => {\n\t\t\tconsole.group(extension.identifier.id);\n\t\t\tconsole.log(data.data, ...data.format);\n\t\t\tconsole.groupEnd();\n\t\t});\n\n\t\treturn extensionUninstallProcess;\n\t}\n\n\tprivate getExtensionStoragePath(extension: ILocalExtension): string {\n\t\treturn join(this.userDataProfilesService.defaultProfile.globalStorageHome.fsPath, extension.identifier.id.toLowerCase());\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { DidUninstallExtensionEvent, IExtensionManagementService, InstallExtensionResult } from '../common/extensionManagement.js';\nimport { USER_MANIFEST_CACHE_FILE } from '../../extensions/common/extensions.js';\nimport { FileOperationResult, IFileService, toFileOperationResult } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { IUserDataProfile, IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\n\nexport class ExtensionsManifestCache extends Disposable {\n\n\tconstructor(\n\t\tprivate readonly userDataProfilesService: IUserDataProfilesService,\n\t\tprivate readonly fileService: IFileService,\n\t\tprivate readonly uriIdentityService: IUriIdentityService,\n\t\textensionsManagementService: IExtensionManagementService,\n\t\tprivate readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis._register(extensionsManagementService.onDidInstallExtensions(e => this.onDidInstallExtensions(e)));\n\t\tthis._register(extensionsManagementService.onDidUninstallExtension(e => this.onDidUnInstallExtension(e)));\n\t}\n\n\tprivate onDidInstallExtensions(results: readonly InstallExtensionResult[]): void {\n\t\tfor (const r of results) {\n\t\t\tif (r.local) {\n\t\t\t\tthis.invalidate(r.profileLocation);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate onDidUnInstallExtension(e: DidUninstallExtensionEvent): void {\n\t\tif (!e.error) {\n\t\t\tthis.invalidate(e.profileLocation);\n\t\t}\n\t}\n\n\tasync invalidate(extensionsManifestLocation: URI | undefined): Promise<void> {\n\t\tif (extensionsManifestLocation) {\n\t\t\tfor (const profile of this.userDataProfilesService.profiles) {\n\t\t\t\tif (this.uriIdentityService.extUri.isEqual(profile.extensionsResource, extensionsManifestLocation)) {\n\t\t\t\t\tawait this.deleteUserCacheFile(profile);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tawait this.deleteUserCacheFile(this.userDataProfilesService.defaultProfile);\n\t\t}\n\t}\n\n\tprivate async deleteUserCacheFile(profile: IUserDataProfile): Promise<void> {\n\t\ttry {\n\t\t\tawait this.fileService.del(this.uriIdentityService.extUri.joinPath(profile.cacheHome, USER_MANIFEST_CACHE_FILE));\n\t\t} catch (error) {\n\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\tthis.logService.error(error);\n\t\t\t}\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { getErrorMessage } from '../../../base/common/errors.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { combinedDisposable, Disposable, DisposableMap } from '../../../base/common/lifecycle.js';\nimport { ResourceSet } from '../../../base/common/map.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { getIdAndVersion } from '../common/extensionManagementUtil.js';\nimport { DidAddProfileExtensionsEvent, DidRemoveProfileExtensionsEvent, IExtensionsProfileScannerService, ProfileExtensionsEvent } from '../common/extensionsProfileScannerService.js';\nimport { IExtensionsScannerService } from '../common/extensionsScannerService.js';\nimport { INativeServerExtensionManagementService } from './extensionManagementService.js';\nimport { ExtensionIdentifier, IExtension, IExtensionIdentifier } from '../../extensions/common/extensions.js';\nimport { FileChangesEvent, FileChangeType, IFileService } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { IUserDataProfile, IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\n\nexport interface DidChangeProfileExtensionsEvent {\n\treadonly added?: { readonly extensions: readonly IExtensionIdentifier[]; readonly profileLocation: URI };\n\treadonly removed?: { readonly extensions: readonly IExtensionIdentifier[]; readonly profileLocation: URI };\n}\n\nexport class ExtensionsWatcher extends Disposable {\n\n\tprivate readonly _onDidChangeExtensionsByAnotherSource = this._register(new Emitter<DidChangeProfileExtensionsEvent>());\n\treadonly onDidChangeExtensionsByAnotherSource = this._onDidChangeExtensionsByAnotherSource.event;\n\n\tprivate readonly allExtensions = new Map<string, ResourceSet>;\n\tprivate readonly extensionsProfileWatchDisposables = this._register(new DisposableMap<string>());\n\n\tconstructor(\n\t\tprivate readonly extensionManagementService: INativeServerExtensionManagementService,\n\t\tprivate readonly extensionsScannerService: IExtensionsScannerService,\n\t\tprivate readonly userDataProfilesService: IUserDataProfilesService,\n\t\tprivate readonly extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\tprivate readonly uriIdentityService: IUriIdentityService,\n\t\tprivate readonly fileService: IFileService,\n\t\tprivate readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis.initialize().then(null, error => logService.error('Error while initializing Extensions Watcher', getErrorMessage(error)));\n\t}\n\n\tprivate async initialize(): Promise<void> {\n\t\tawait this.extensionsScannerService.initializeDefaultProfileExtensions();\n\t\tawait this.onDidChangeProfiles(this.userDataProfilesService.profiles);\n\t\tthis.registerListeners();\n\t\tawait this.deleteExtensionsNotInProfiles();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tthis._register(this.userDataProfilesService.onDidChangeProfiles(e => this.onDidChangeProfiles(e.added)));\n\t\tthis._register(this.extensionsProfileScannerService.onAddExtensions(e => this.onAddExtensions(e)));\n\t\tthis._register(this.extensionsProfileScannerService.onDidAddExtensions(e => this.onDidAddExtensions(e)));\n\t\tthis._register(this.extensionsProfileScannerService.onRemoveExtensions(e => this.onRemoveExtensions(e)));\n\t\tthis._register(this.extensionsProfileScannerService.onDidRemoveExtensions(e => this.onDidRemoveExtensions(e)));\n\t\tthis._register(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));\n\t}\n\n\tprivate async onDidChangeProfiles(added: readonly IUserDataProfile[]): Promise<void> {\n\t\ttry {\n\t\t\tif (added.length) {\n\t\t\t\tawait Promise.all(added.map(profile => {\n\t\t\t\t\tthis.extensionsProfileWatchDisposables.set(profile.id, combinedDisposable(\n\t\t\t\t\t\tthis.fileService.watch(this.uriIdentityService.extUri.dirname(profile.extensionsResource)),\n\t\t\t\t\t\t// Also listen to the resource incase the resource is a symlink - https://github.com/microsoft/vscode/issues/118134\n\t\t\t\t\t\tthis.fileService.watch(profile.extensionsResource)\n\t\t\t\t\t));\n\t\t\t\t\treturn this.populateExtensionsFromProfile(profile.extensionsResource);\n\t\t\t\t}));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logService.error(error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate async onAddExtensions(e: ProfileExtensionsEvent): Promise<void> {\n\t\tfor (const extension of e.extensions) {\n\t\t\tthis.addExtensionWithKey(this.getKey(extension.identifier, extension.version), e.profileLocation);\n\t\t}\n\t}\n\n\tprivate async onDidAddExtensions(e: DidAddProfileExtensionsEvent): Promise<void> {\n\t\tfor (const extension of e.extensions) {\n\t\t\tconst key = this.getKey(extension.identifier, extension.version);\n\t\t\tif (e.error) {\n\t\t\t\tthis.removeExtensionWithKey(key, e.profileLocation);\n\t\t\t} else {\n\t\t\t\tthis.addExtensionWithKey(key, e.profileLocation);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async onRemoveExtensions(e: ProfileExtensionsEvent): Promise<void> {\n\t\tfor (const extension of e.extensions) {\n\t\t\tthis.removeExtensionWithKey(this.getKey(extension.identifier, extension.version), e.profileLocation);\n\t\t}\n\t}\n\n\tprivate async onDidRemoveExtensions(e: DidRemoveProfileExtensionsEvent): Promise<void> {\n\t\tconst extensionsToDelete: IExtension[] = [];\n\t\tconst promises: Promise<void>[] = [];\n\t\tfor (const extension of e.extensions) {\n\t\t\tconst key = this.getKey(extension.identifier, extension.version);\n\t\t\tif (e.error) {\n\t\t\t\tthis.addExtensionWithKey(key, e.profileLocation);\n\t\t\t} else {\n\t\t\t\tthis.removeExtensionWithKey(key, e.profileLocation);\n\t\t\t\tif (!this.allExtensions.has(key)) {\n\t\t\t\t\tthis.logService.debug('Extension is removed from all profiles', extension.identifier.id, extension.version);\n\t\t\t\t\tpromises.push(this.extensionManagementService.scanInstalledExtensionAtLocation(extension.location)\n\t\t\t\t\t\t.then(result => {\n\t\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t\textensionsToDelete.push(result);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.logService.info('Extension not found at the location', extension.location.toString());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, error => this.logService.error(error)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tawait Promise.all(promises);\n\t\t\tif (extensionsToDelete.length) {\n\t\t\t\tawait this.deleteExtensionsNotInProfiles(extensionsToDelete);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logService.error(error);\n\t\t}\n\t}\n\n\tprivate onDidFilesChange(e: FileChangesEvent): void {\n\t\tfor (const profile of this.userDataProfilesService.profiles) {\n\t\t\tif (e.contains(profile.extensionsResource, FileChangeType.UPDATED, FileChangeType.ADDED)) {\n\t\t\t\tthis.onDidExtensionsProfileChange(profile.extensionsResource);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async onDidExtensionsProfileChange(profileLocation: URI): Promise<void> {\n\t\tconst added: IExtensionIdentifier[] = [], removed: IExtensionIdentifier[] = [];\n\t\tconst extensions = await this.extensionsProfileScannerService.scanProfileExtensions(profileLocation);\n\t\tconst extensionKeys = new Set<string>();\n\t\tconst cached = new Set<string>();\n\t\tfor (const [key, profiles] of this.allExtensions) {\n\t\t\tif (profiles.has(profileLocation)) {\n\t\t\t\tcached.add(key);\n\t\t\t}\n\t\t}\n\t\tfor (const extension of extensions) {\n\t\t\tconst key = this.getKey(extension.identifier, extension.version);\n\t\t\textensionKeys.add(key);\n\t\t\tif (!cached.has(key)) {\n\t\t\t\tadded.push(extension.identifier);\n\t\t\t\tthis.addExtensionWithKey(key, profileLocation);\n\t\t\t}\n\t\t}\n\t\tfor (const key of cached) {\n\t\t\tif (!extensionKeys.has(key)) {\n\t\t\t\tconst extension = this.fromKey(key);\n\t\t\t\tif (extension) {\n\t\t\t\t\tremoved.push(extension.identifier);\n\t\t\t\t\tthis.removeExtensionWithKey(key, profileLocation);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (added.length || removed.length) {\n\t\t\tthis._onDidChangeExtensionsByAnotherSource.fire({ added: added.length ? { extensions: added, profileLocation } : undefined, removed: removed.length ? { extensions: removed, profileLocation } : undefined });\n\t\t}\n\t}\n\n\tprivate async populateExtensionsFromProfile(extensionsProfileLocation: URI): Promise<void> {\n\t\tconst extensions = await this.extensionsProfileScannerService.scanProfileExtensions(extensionsProfileLocation);\n\t\tfor (const extension of extensions) {\n\t\t\tthis.addExtensionWithKey(this.getKey(extension.identifier, extension.version), extensionsProfileLocation);\n\t\t}\n\t}\n\n\tprivate async deleteExtensionsNotInProfiles(toDelete?: IExtension[]): Promise<void> {\n\t\tif (!toDelete) {\n\t\t\tconst installed = await this.extensionManagementService.scanAllUserInstalledExtensions();\n\t\t\ttoDelete = installed.filter(installedExtension => !this.allExtensions.has(this.getKey(installedExtension.identifier, installedExtension.manifest.version)));\n\t\t}\n\t\tif (toDelete.length) {\n\t\t\tawait this.extensionManagementService.deleteExtensions(...toDelete);\n\t\t}\n\t}\n\n\tprivate addExtensionWithKey(key: string, extensionsProfileLocation: URI): void {\n\t\tlet profiles = this.allExtensions.get(key);\n\t\tif (!profiles) {\n\t\t\tthis.allExtensions.set(key, profiles = new ResourceSet((uri) => this.uriIdentityService.extUri.getComparisonKey(uri)));\n\t\t}\n\t\tprofiles.add(extensionsProfileLocation);\n\t}\n\n\tprivate removeExtensionWithKey(key: string, profileLocation: URI): void {\n\t\tconst profiles = this.allExtensions.get(key);\n\t\tif (profiles) {\n\t\t\tprofiles.delete(profileLocation);\n\t\t}\n\t\tif (!profiles?.size) {\n\t\t\tthis.allExtensions.delete(key);\n\t\t}\n\t}\n\n\tprivate getKey(identifier: IExtensionIdentifier, version: string): string {\n\t\treturn `${ExtensionIdentifier.toKey(identifier.id)}@${version}`;\n\t}\n\n\tprivate fromKey(key: string): { identifier: IExtensionIdentifier; version: string } | undefined {\n\t\tconst [id, version] = getIdAndVersion(key);\n\t\treturn version ? { identifier: { id }, version } : undefined;\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as fs from 'fs';\nimport { Promises, Queue } from '../../../base/common/async.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { CancellationError, getErrorMessage } from '../../../base/common/errors.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { hash } from '../../../base/common/hash.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { ResourceMap, ResourceSet } from '../../../base/common/map.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport * as path from '../../../base/common/path.js';\nimport { joinPath } from '../../../base/common/resources.js';\nimport * as semver from '../../../base/common/semver/semver.js';\nimport { isBoolean, isDefined, isUndefined } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport * as pfs from '../../../base/node/pfs.js';\nimport { extract, IFile, zip } from '../../../base/node/zip.js';\nimport * as nls from '../../../nls.js';\nimport { IDownloadService } from '../../download/common/download.js';\nimport { INativeEnvironmentService } from '../../environment/common/environment.js';\nimport { AbstractExtensionManagementService, AbstractExtensionTask, IInstallExtensionTask, InstallExtensionTaskOptions, IUninstallExtensionTask, toExtensionManagementError, UninstallExtensionTaskOptions } from '../common/abstractExtensionManagementService.js';\nimport {\n\tExtensionManagementError, ExtensionManagementErrorCode, IExtensionGalleryService, IExtensionIdentifier, IExtensionManagementService, IGalleryExtension, ILocalExtension, InstallOperation,\n\tMetadata, InstallOptions,\n\tIProductVersion,\n\tEXTENSION_INSTALL_CLIENT_TARGET_PLATFORM_CONTEXT,\n\tExtensionSignatureVerificationCode,\n\tcomputeSize,\n\tIAllowedExtensionsService,\n\t// @ts-expect-error no-unused-variable\n\tVerifyExtensionSignatureConfigKey,\n\tshouldRequireRepositorySignatureFor,\n} from '../common/extensionManagement.js';\nimport { areSameExtensions, computeTargetPlatform, ExtensionKey, getGalleryExtensionId, groupByExtension } from '../common/extensionManagementUtil.js';\nimport { IExtensionsProfileScannerService, IScannedProfileExtension } from '../common/extensionsProfileScannerService.js';\nimport { IExtensionsScannerService, IScannedExtension, ManifestMetadata, UserExtensionsScanOptions } from '../common/extensionsScannerService.js';\nimport { ExtensionsDownloader } from './extensionDownloader.js';\nimport { ExtensionsLifecycle } from './extensionLifecycle.js';\nimport { fromExtractError, getManifest } from './extensionManagementUtil.js';\nimport { ExtensionsManifestCache } from './extensionsManifestCache.js';\nimport { DidChangeProfileExtensionsEvent, ExtensionsWatcher } from './extensionsWatcher.js';\nimport { ExtensionType, IExtension, IExtensionManifest, TargetPlatform } from '../../extensions/common/extensions.js';\nimport { isEngineValid } from '../../extensions/common/extensionValidator.js';\nimport { FileChangesEvent, FileChangeType, FileOperationResult, IFileService, IFileStat, toFileOperationResult } from '../../files/common/files.js';\nimport { IInstantiationService, refineServiceDecorator } from '../../instantiation/common/instantiation.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { ITelemetryService } from '../../telemetry/common/telemetry.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IExtensionGalleryManifestService } from '../common/extensionGalleryManifest.js';\n\nexport const INativeServerExtensionManagementService = refineServiceDecorator<IExtensionManagementService, INativeServerExtensionManagementService>(IExtensionManagementService);\nexport interface INativeServerExtensionManagementService extends IExtensionManagementService {\n\treadonly _serviceBrand: undefined;\n\tscanAllUserInstalledExtensions(): Promise<ILocalExtension[]>;\n\tscanInstalledExtensionAtLocation(location: URI): Promise<ILocalExtension | null>;\n\tdeleteExtensions(...extensions: IExtension[]): Promise<void>;\n}\n\ntype ExtractExtensionResult = { readonly local: ILocalExtension; readonly verificationStatus?: ExtensionSignatureVerificationCode };\n\nconst DELETED_FOLDER_POSTFIX = '.vsctmp';\n\nexport class ExtensionManagementService extends AbstractExtensionManagementService implements INativeServerExtensionManagementService {\n\n\tprivate readonly extensionsScanner: ExtensionsScanner;\n\tprivate readonly manifestCache: ExtensionsManifestCache;\n\tprivate readonly extensionsDownloader: ExtensionsDownloader;\n\n\tprivate readonly extractingGalleryExtensions = new Map<string, Promise<ExtractExtensionResult>>();\n\n\tconstructor(\n\t\t@IExtensionGalleryService galleryService: IExtensionGalleryService,\n\t\t@ITelemetryService telemetryService: ITelemetryService,\n\t\t@ILogService logService: ILogService,\n\t\t@INativeEnvironmentService private readonly environmentService: INativeEnvironmentService,\n\t\t@IExtensionsScannerService private readonly extensionsScannerService: IExtensionsScannerService,\n\t\t@IExtensionsProfileScannerService private readonly extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\t@IDownloadService private downloadService: IDownloadService,\n\t\t@IInstantiationService private readonly instantiationService: IInstantiationService,\n\t\t@IFileService private readonly fileService: IFileService,\n\t\t// @ts-expect-error no-unused-variable\n\t\t@IConfigurationService private readonly configurationService: IConfigurationService,\n\t\t@IExtensionGalleryManifestService protected readonly extensionGalleryManifestService: IExtensionGalleryManifestService,\n\t\t@IProductService productService: IProductService,\n\t\t@IAllowedExtensionsService allowedExtensionsService: IAllowedExtensionsService,\n\t\t@IUriIdentityService uriIdentityService: IUriIdentityService,\n\t\t@IUserDataProfilesService userDataProfilesService: IUserDataProfilesService\n\t) {\n\t\tsuper(galleryService, telemetryService, uriIdentityService, logService, productService, allowedExtensionsService, userDataProfilesService);\n\t\tconst extensionLifecycle = this._register(instantiationService.createInstance(ExtensionsLifecycle));\n\t\tthis.extensionsScanner = this._register(instantiationService.createInstance(ExtensionsScanner, extension => extensionLifecycle.postUninstall(extension)));\n\t\tthis.manifestCache = this._register(new ExtensionsManifestCache(userDataProfilesService, fileService, uriIdentityService, this, this.logService));\n\t\tthis.extensionsDownloader = this._register(instantiationService.createInstance(ExtensionsDownloader));\n\n\t\tconst extensionsWatcher = this._register(new ExtensionsWatcher(this, this.extensionsScannerService, userDataProfilesService, extensionsProfileScannerService, uriIdentityService, fileService, logService));\n\t\tthis._register(extensionsWatcher.onDidChangeExtensionsByAnotherSource(e => this.onDidChangeExtensionsFromAnotherSource(e)));\n\t\tthis.watchForExtensionsNotInstalledBySystem();\n\t}\n\n\tprivate _targetPlatformPromise: Promise<TargetPlatform> | undefined;\n\tgetTargetPlatform(): Promise<TargetPlatform> {\n\t\tif (!this._targetPlatformPromise) {\n\t\t\tthis._targetPlatformPromise = computeTargetPlatform(this.fileService, this.logService);\n\t\t}\n\t\treturn this._targetPlatformPromise;\n\t}\n\n\tasync zip(extension: ILocalExtension): Promise<URI> {\n\t\tthis.logService.trace('ExtensionManagementService#zip', extension.identifier.id);\n\t\tconst files = await this.collectFiles(extension);\n\t\tconst location = await zip(joinPath(this.extensionsDownloader.extensionsDownloadDir, generateUuid()).fsPath, files);\n\t\treturn URI.file(location);\n\t}\n\n\tasync getManifest(vsix: URI): Promise<IExtensionManifest> {\n\t\tconst { location, cleanup } = await this.downloadVsix(vsix);\n\t\tconst zipPath = path.resolve(location.fsPath);\n\t\ttry {\n\t\t\treturn await getManifest(zipPath);\n\t\t} finally {\n\t\t\tawait cleanup();\n\t\t}\n\t}\n\n\tgetInstalled(type?: ExtensionType, profileLocation: URI = this.userDataProfilesService.defaultProfile.extensionsResource, productVersion: IProductVersion = { version: this.productService.version, date: this.productService.date }, language?: string): Promise<ILocalExtension[]> {\n\t\treturn this.extensionsScanner.scanExtensions(type ?? null, profileLocation, productVersion, language);\n\t}\n\n\tscanAllUserInstalledExtensions(): Promise<ILocalExtension[]> {\n\t\treturn this.extensionsScanner.scanAllUserExtensions();\n\t}\n\n\tscanInstalledExtensionAtLocation(location: URI): Promise<ILocalExtension | null> {\n\t\treturn this.extensionsScanner.scanUserExtensionAtLocation(location);\n\t}\n\n\tasync install(vsix: URI, options: InstallOptions = {}): Promise<ILocalExtension> {\n\t\tthis.logService.trace('ExtensionManagementService#install', vsix.toString());\n\n\t\tconst { location, cleanup } = await this.downloadVsix(vsix);\n\n\t\ttry {\n\t\t\tconst manifest = await getManifest(path.resolve(location.fsPath));\n\t\t\tconst extensionId = getGalleryExtensionId(manifest.publisher, manifest.name);\n\t\t\tif (manifest.engines && manifest.engines.vscode && !isEngineValid(manifest.engines.vscode, this.productService.version, this.productService.date)) {\n\t\t\t\tthrow new Error(nls.localize('incompatible', \"Unable to install extension '{0}' as it is not compatible with VS Code '{1}'.\", extensionId, this.productService.version));\n\t\t\t}\n\n\t\t\tconst allowedToInstall = this.allowedExtensionsService.isAllowed({ id: extensionId, version: manifest.version, publisherDisplayName: undefined });\n\t\t\tif (allowedToInstall !== true) {\n\t\t\t\tthrow new Error(nls.localize('notAllowed', \"This extension cannot be installed because {0}\", allowedToInstall.value));\n\t\t\t}\n\n\t\t\tconst results = await this.installExtensions([{ manifest, extension: location, options }]);\n\t\t\tconst result = results.find(({ identifier }) => areSameExtensions(identifier, { id: extensionId }));\n\t\t\tif (result?.local) {\n\t\t\t\treturn result.local;\n\t\t\t}\n\t\t\tif (result?.error) {\n\t\t\t\tthrow result.error;\n\t\t\t}\n\t\t\tthrow toExtensionManagementError(new Error(`Unknown error while installing extension ${extensionId}`));\n\t\t} finally {\n\t\t\tawait cleanup();\n\t\t}\n\t}\n\n\tasync installFromLocation(location: URI, profileLocation: URI): Promise<ILocalExtension> {\n\t\tthis.logService.trace('ExtensionManagementService#installFromLocation', location.toString());\n\t\tconst local = await this.extensionsScanner.scanUserExtensionAtLocation(location);\n\t\tif (!local || !local.manifest.name || !local.manifest.version) {\n\t\t\tthrow new Error(`Cannot find a valid extension from the location ${location.toString()}`);\n\t\t}\n\t\tawait this.addExtensionsToProfile([[local, { source: 'resource' }]], profileLocation);\n\t\tthis.logService.info('Successfully installed extension', local.identifier.id, profileLocation.toString());\n\t\treturn local;\n\t}\n\n\tasync installExtensionsFromProfile(extensions: IExtensionIdentifier[], fromProfileLocation: URI, toProfileLocation: URI): Promise<ILocalExtension[]> {\n\t\tthis.logService.trace('ExtensionManagementService#installExtensionsFromProfile', extensions, fromProfileLocation.toString(), toProfileLocation.toString());\n\t\tconst extensionsToInstall = (await this.getInstalled(ExtensionType.User, fromProfileLocation)).filter(e => extensions.some(id => areSameExtensions(id, e.identifier)));\n\t\tif (extensionsToInstall.length) {\n\t\t\tconst metadata = await Promise.all(extensionsToInstall.map(e => this.extensionsScanner.scanMetadata(e, fromProfileLocation)));\n\t\t\tawait this.addExtensionsToProfile(extensionsToInstall.map((e, index) => [e, metadata[index]]), toProfileLocation);\n\t\t\tthis.logService.info('Successfully installed extensions', extensionsToInstall.map(e => e.identifier.id), toProfileLocation.toString());\n\t\t}\n\t\treturn extensionsToInstall;\n\t}\n\n\tasync updateMetadata(local: ILocalExtension, metadata: Partial<Metadata>, profileLocation: URI): Promise<ILocalExtension> {\n\t\tthis.logService.trace('ExtensionManagementService#updateMetadata', local.identifier.id);\n\t\tif (metadata.isPreReleaseVersion) {\n\t\t\tmetadata.preRelease = true;\n\t\t\tmetadata.hasPreReleaseVersion = true;\n\t\t}\n\t\t// unset if false\n\t\tif (metadata.isMachineScoped === false) {\n\t\t\tmetadata.isMachineScoped = undefined;\n\t\t}\n\t\tif (metadata.isBuiltin === false) {\n\t\t\tmetadata.isBuiltin = undefined;\n\t\t}\n\t\tif (metadata.pinned === false) {\n\t\t\tmetadata.pinned = undefined;\n\t\t}\n\t\tlocal = await this.extensionsScanner.updateMetadata(local, metadata, profileLocation);\n\t\tthis.manifestCache.invalidate(profileLocation);\n\t\tthis._onDidUpdateExtensionMetadata.fire({ local, profileLocation });\n\t\treturn local;\n\t}\n\n\tprotected deleteExtension(extension: ILocalExtension): Promise<void> {\n\t\treturn this.extensionsScanner.deleteExtension(extension, 'remove');\n\t}\n\n\tprotected copyExtension(extension: ILocalExtension, fromProfileLocation: URI, toProfileLocation: URI, metadata: Partial<Metadata>): Promise<ILocalExtension> {\n\t\treturn this.extensionsScanner.copyExtension(extension, fromProfileLocation, toProfileLocation, metadata);\n\t}\n\n\tprotected moveExtension(extension: ILocalExtension, fromProfileLocation: URI, toProfileLocation: URI, metadata: Partial<Metadata>): Promise<ILocalExtension> {\n\t\treturn this.extensionsScanner.moveExtension(extension, fromProfileLocation, toProfileLocation, metadata);\n\t}\n\n\tprotected removeExtension(extension: ILocalExtension, fromProfileLocation: URI): Promise<void> {\n\t\treturn this.extensionsScanner.removeExtension(extension.identifier, fromProfileLocation);\n\t}\n\n\tcopyExtensions(fromProfileLocation: URI, toProfileLocation: URI): Promise<void> {\n\t\treturn this.extensionsScanner.copyExtensions(fromProfileLocation, toProfileLocation, { version: this.productService.version, date: this.productService.date });\n\t}\n\n\tdeleteExtensions(...extensions: IExtension[]): Promise<void> {\n\t\treturn this.extensionsScanner.setExtensionsForRemoval(...extensions);\n\t}\n\n\tasync cleanUp(): Promise<void> {\n\t\tthis.logService.trace('ExtensionManagementService#cleanUp');\n\t\ttry {\n\t\t\tawait this.extensionsScanner.cleanUp();\n\t\t} catch (error) {\n\t\t\tthis.logService.error(error);\n\t\t}\n\t}\n\n\tasync download(extension: IGalleryExtension, operation: InstallOperation, donotVerifySignature: boolean): Promise<URI> {\n\t\tconst { location } = await this.downloadExtension(extension, operation, !donotVerifySignature);\n\t\treturn location;\n\t}\n\n\tprivate async downloadVsix(vsix: URI): Promise<{ location: URI; cleanup: () => Promise<void> }> {\n\t\tif (vsix.scheme === Schemas.file) {\n\t\t\treturn { location: vsix, async cleanup() { } };\n\t\t}\n\t\tthis.logService.trace('Downloading extension from', vsix.toString());\n\t\tconst location = joinPath(this.extensionsDownloader.extensionsDownloadDir, generateUuid());\n\t\tawait this.downloadService.download(vsix, location);\n\t\tthis.logService.info('Downloaded extension to', location.toString());\n\t\tconst cleanup = async () => {\n\t\t\ttry {\n\t\t\t\tawait this.fileService.del(location);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.error(error);\n\t\t\t}\n\t\t};\n\t\treturn { location, cleanup };\n\t}\n\n\tprotected getCurrentExtensionsManifestLocation(): URI {\n\t\treturn this.userDataProfilesService.defaultProfile.extensionsResource;\n\t}\n\n\tprotected createInstallExtensionTask(manifest: IExtensionManifest, extension: URI | IGalleryExtension, options: InstallExtensionTaskOptions): IInstallExtensionTask {\n\t\tconst extensionKey = extension instanceof URI ? new ExtensionKey({ id: getGalleryExtensionId(manifest.publisher, manifest.name) }, manifest.version) : ExtensionKey.create(extension);\n\t\treturn this.instantiationService.createInstance(InstallExtensionInProfileTask, extensionKey, manifest, extension, options, (operation, token) => {\n\t\t\tif (extension instanceof URI) {\n\t\t\t\treturn this.extractVSIX(extensionKey, extension, options, token);\n\t\t\t}\n\t\t\tlet promise = this.extractingGalleryExtensions.get(extensionKey.toString());\n\t\t\tif (!promise) {\n\t\t\t\tthis.extractingGalleryExtensions.set(extensionKey.toString(), promise = this.downloadAndExtractGalleryExtension(extensionKey, extension, operation, options, token));\n\t\t\t\tpromise.finally(() => this.extractingGalleryExtensions.delete(extensionKey.toString()));\n\t\t\t}\n\t\t\treturn promise;\n\t\t}, this.extensionsScanner);\n\t}\n\n\tprotected createUninstallExtensionTask(extension: ILocalExtension, options: UninstallExtensionTaskOptions): IUninstallExtensionTask {\n\t\treturn new UninstallExtensionInProfileTask(extension, options, this.extensionsProfileScannerService);\n\t}\n\n\tprivate async downloadAndExtractGalleryExtension(extensionKey: ExtensionKey, gallery: IGalleryExtension, operation: InstallOperation, options: InstallExtensionTaskOptions, token: CancellationToken): Promise<ExtractExtensionResult> {\n\t\tconst { verificationStatus, location } = await this.downloadExtension(gallery, operation, !options.donotVerifySignature, options.context?.[EXTENSION_INSTALL_CLIENT_TARGET_PLATFORM_CONTEXT]);\n\t\ttry {\n\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\tthrow new CancellationError();\n\t\t\t}\n\n\t\t\t// validate manifest\n\t\t\tconst manifest = await getManifest(location.fsPath);\n\t\t\tif (!new ExtensionKey(gallery.identifier, gallery.version).equals(new ExtensionKey({ id: getGalleryExtensionId(manifest.publisher, manifest.name) }, manifest.version))) {\n\t\t\t\tthrow new ExtensionManagementError(nls.localize('invalidManifest', \"Cannot install '{0}' extension because of manifest mismatch with Marketplace\", gallery.identifier.id), ExtensionManagementErrorCode.Invalid);\n\t\t\t}\n\n\t\t\tconst local = await this.extensionsScanner.extractUserExtension(\n\t\t\t\textensionKey,\n\t\t\t\tlocation.fsPath,\n\t\t\t\tfalse,\n\t\t\t\ttoken);\n\n\t\t\tif (verificationStatus !== ExtensionSignatureVerificationCode.Success && this.environmentService.isBuilt) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.extensionsDownloader.delete(location);\n\t\t\t\t} catch (e) {\n\t\t\t\t\t/* Ignore */\n\t\t\t\t\tthis.logService.warn(`Error while deleting the downloaded file`, location.toString(), getErrorMessage(e));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { local, verificationStatus };\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait this.extensionsDownloader.delete(location);\n\t\t\t} catch (e) {\n\t\t\t\t/* Ignore */\n\t\t\t\tthis.logService.warn(`Error while deleting the downloaded file`, location.toString(), getErrorMessage(e));\n\t\t\t}\n\t\t\tthrow toExtensionManagementError(error);\n\t\t}\n\t}\n\n\tprivate async downloadExtension(extension: IGalleryExtension, operation: InstallOperation, verifySignature: boolean, clientTargetPlatform?: TargetPlatform): Promise<{ readonly location: URI; readonly verificationStatus: ExtensionSignatureVerificationCode | undefined }> {\n\t\tif (verifySignature) {\n\t\t\tverifySignature = false;\n\t\t}\n\t\tconst { location, verificationStatus } = await this.extensionsDownloader.download(extension, operation, verifySignature, clientTargetPlatform);\n\t\tconst shouldRequireSignature = shouldRequireRepositorySignatureFor(extension.private, await this.extensionGalleryManifestService.getExtensionGalleryManifest());\n\n\t\tif (\n\t\t\tverificationStatus !== ExtensionSignatureVerificationCode.Success\n\t\t\t&& !(verificationStatus === ExtensionSignatureVerificationCode.NotSigned && !shouldRequireSignature)\n\t\t\t&& verifySignature\n\t\t\t&& this.environmentService.isBuilt\n\t\t\t&& (await this.getTargetPlatform()) !== TargetPlatform.LINUX_ARMHF\n\t\t) {\n\t\t\ttry {\n\t\t\t\tawait this.extensionsDownloader.delete(location);\n\t\t\t} catch (e) {\n\t\t\t\t/* Ignore */\n\t\t\t\tthis.logService.warn(`Error while deleting the downloaded file`, location.toString(), getErrorMessage(e));\n\t\t\t}\n\n\t\t\tif (!verificationStatus) {\n\t\t\t\tthrow new ExtensionManagementError(nls.localize('signature verification not executed', \"Signature verification was not executed.\"), ExtensionManagementErrorCode.SignatureVerificationInternal);\n\t\t\t}\n\n\t\t\tswitch (verificationStatus) {\n\t\t\t\tcase ExtensionSignatureVerificationCode.PackageIntegrityCheckFailed:\n\t\t\t\tcase ExtensionSignatureVerificationCode.SignatureIsInvalid:\n\t\t\t\tcase ExtensionSignatureVerificationCode.SignatureManifestIsInvalid:\n\t\t\t\tcase ExtensionSignatureVerificationCode.SignatureIntegrityCheckFailed:\n\t\t\t\tcase ExtensionSignatureVerificationCode.EntryIsMissing:\n\t\t\t\tcase ExtensionSignatureVerificationCode.EntryIsTampered:\n\t\t\t\tcase ExtensionSignatureVerificationCode.Untrusted:\n\t\t\t\tcase ExtensionSignatureVerificationCode.CertificateRevoked:\n\t\t\t\tcase ExtensionSignatureVerificationCode.SignatureIsNotValid:\n\t\t\t\tcase ExtensionSignatureVerificationCode.SignatureArchiveHasTooManyEntries:\n\t\t\t\tcase ExtensionSignatureVerificationCode.NotSigned:\n\t\t\t\t\tthrow new ExtensionManagementError(nls.localize('signature verification failed', \"Signature verification failed with '{0}' error.\", verificationStatus), ExtensionManagementErrorCode.SignatureVerificationFailed);\n\t\t\t}\n\n\t\t\tthrow new ExtensionManagementError(nls.localize('signature verification failed', \"Signature verification failed with '{0}' error.\", verificationStatus), ExtensionManagementErrorCode.SignatureVerificationInternal);\n\t\t}\n\n\t\treturn { location, verificationStatus };\n\t}\n\n\tprivate async extractVSIX(extensionKey: ExtensionKey, location: URI, options: InstallExtensionTaskOptions, token: CancellationToken): Promise<ExtractExtensionResult> {\n\t\tconst local = await this.extensionsScanner.extractUserExtension(\n\t\t\textensionKey,\n\t\t\tpath.resolve(location.fsPath),\n\t\t\tisBoolean(options.keepExisting) ? !options.keepExisting : true,\n\t\t\ttoken);\n\t\treturn { local };\n\t}\n\n\tprivate async collectFiles(extension: ILocalExtension): Promise<IFile[]> {\n\n\t\tconst collectFilesFromDirectory = async (dir: string): Promise<string[]> => {\n\t\t\tlet entries = await pfs.Promises.readdir(dir);\n\t\t\tentries = entries.map(e => path.join(dir, e));\n\t\t\tconst stats = await Promise.all(entries.map(e => fs.promises.stat(e)));\n\t\t\tlet promise: Promise<string[]> = Promise.resolve([]);\n\t\t\tstats.forEach((stat, index) => {\n\t\t\t\tconst entry = entries[index];\n\t\t\t\tif (stat.isFile()) {\n\t\t\t\t\tpromise = promise.then(result => ([...result, entry]));\n\t\t\t\t}\n\t\t\t\tif (stat.isDirectory()) {\n\t\t\t\t\tpromise = promise\n\t\t\t\t\t\t.then(result => collectFilesFromDirectory(entry)\n\t\t\t\t\t\t\t.then(files => ([...result, ...files])));\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn promise;\n\t\t};\n\n\t\tconst files = await collectFilesFromDirectory(extension.location.fsPath);\n\t\treturn files.map(f => ({ path: `extension/${path.relative(extension.location.fsPath, f)}`, localPath: f }));\n\t}\n\n\tprivate async onDidChangeExtensionsFromAnotherSource({ added, removed }: DidChangeProfileExtensionsEvent): Promise<void> {\n\t\tif (removed) {\n\t\t\tconst removedExtensions = added && this.uriIdentityService.extUri.isEqual(removed.profileLocation, added.profileLocation)\n\t\t\t\t? removed.extensions.filter(e => added.extensions.every(identifier => !areSameExtensions(identifier, e)))\n\t\t\t\t: removed.extensions;\n\t\t\tfor (const identifier of removedExtensions) {\n\t\t\t\tthis.logService.info('Extensions removed from another source', identifier.id, removed.profileLocation.toString());\n\t\t\t\tthis._onDidUninstallExtension.fire({ identifier, profileLocation: removed.profileLocation });\n\t\t\t}\n\t\t}\n\t\tif (added) {\n\t\t\tconst extensions = await this.getInstalled(ExtensionType.User, added.profileLocation);\n\t\t\tconst addedExtensions = extensions.filter(e => added.extensions.some(identifier => areSameExtensions(identifier, e.identifier)));\n\t\t\tthis._onDidInstallExtensions.fire(addedExtensions.map(local => {\n\t\t\t\tthis.logService.info('Extensions added from another source', local.identifier.id, added.profileLocation.toString());\n\t\t\t\treturn { identifier: local.identifier, local, profileLocation: added.profileLocation, operation: InstallOperation.None };\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate readonly knownDirectories = new ResourceSet();\n\tprivate async watchForExtensionsNotInstalledBySystem(): Promise<void> {\n\t\tthis._register(this.extensionsScanner.onExtract(resource => this.knownDirectories.add(resource)));\n\t\tconst stat = await this.fileService.resolve(this.extensionsScannerService.userExtensionsLocation);\n\t\tfor (const childStat of stat.children ?? []) {\n\t\t\tif (childStat.isDirectory) {\n\t\t\t\tthis.knownDirectories.add(childStat.resource);\n\t\t\t}\n\t\t}\n\t\tthis._register(this.fileService.watch(this.extensionsScannerService.userExtensionsLocation));\n\t\tthis._register(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));\n\t}\n\n\tprivate async onDidFilesChange(e: FileChangesEvent): Promise<void> {\n\t\tif (!e.affects(this.extensionsScannerService.userExtensionsLocation, FileChangeType.ADDED)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst added: ILocalExtension[] = [];\n\t\tfor (const resource of e.rawAdded) {\n\t\t\t// Check if this is a known directory\n\t\t\tif (this.knownDirectories.has(resource)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Is not immediate child of extensions resource\n\t\t\tif (!this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.dirname(resource), this.extensionsScannerService.userExtensionsLocation)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// .obsolete file changed\n\t\t\tif (this.uriIdentityService.extUri.isEqual(resource, this.uriIdentityService.extUri.joinPath(this.extensionsScannerService.userExtensionsLocation, '.obsolete'))) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Ignore changes to files starting with `.`\n\t\t\tif (this.uriIdentityService.extUri.basename(resource).startsWith('.')) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Ignore changes to the deleted folder\n\t\t\tif (this.uriIdentityService.extUri.basename(resource).endsWith(DELETED_FOLDER_POSTFIX)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t// Check if this is a directory\n\t\t\t\tif (!(await this.fileService.stat(resource)).isDirectory) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Check if this is an extension added by another source\n\t\t\t// Extension added by another source will not have installed timestamp\n\t\t\tconst extension = await this.extensionsScanner.scanUserExtensionAtLocation(resource);\n\t\t\tif (extension && extension.installedTimestamp === undefined) {\n\t\t\t\tthis.knownDirectories.add(resource);\n\t\t\t\tadded.push(extension);\n\t\t\t}\n\t\t}\n\n\t\tif (added.length) {\n\t\t\tawait this.addExtensionsToProfile(added.map(e => [e, undefined]), this.userDataProfilesService.defaultProfile.extensionsResource);\n\t\t\tthis.logService.info('Added extensions to default profile from external source', added.map(e => e.identifier.id));\n\t\t}\n\t}\n\n\tprivate async addExtensionsToProfile(extensions: [ILocalExtension, Metadata | undefined][], profileLocation: URI): Promise<void> {\n\t\tconst localExtensions = extensions.map(e => e[0]);\n\t\tawait this.extensionsScanner.unsetExtensionsForRemoval(...localExtensions.map(extension => ExtensionKey.create(extension)));\n\t\tawait this.extensionsProfileScannerService.addExtensionsToProfile(extensions, profileLocation);\n\t\tthis._onDidInstallExtensions.fire(localExtensions.map(local => ({ local, identifier: local.identifier, operation: InstallOperation.None, profileLocation })));\n\t}\n}\n\ntype UpdateMetadataErrorClassification = {\n\towner: 'sandy081';\n\tcomment: 'Update metadata error';\n\textensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'extension identifier' };\n\tcode?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'error code' };\n\tisProfile?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Is writing into profile' };\n};\ntype UpdateMetadataErrorEvent = {\n\textensionId: string;\n\tcode?: string;\n\tisProfile?: boolean;\n};\n\nexport class ExtensionsScanner extends Disposable {\n\n\tprivate readonly obsoletedResource: URI;\n\tprivate readonly obsoleteFileLimiter: Queue<any>;\n\n\tprivate readonly _onExtract = this._register(new Emitter<URI>());\n\treadonly onExtract = this._onExtract.event;\n\n\tprivate scanAllExtensionPromise = new ResourceMap<Promise<IScannedExtension[]>>();\n\tprivate scanUserExtensionsPromise = new ResourceMap<Promise<IScannedExtension[]>>();\n\n\tconstructor(\n\t\tprivate readonly beforeRemovingExtension: (e: ILocalExtension) => Promise<void>,\n\t\t@IFileService private readonly fileService: IFileService,\n\t\t@IExtensionsScannerService private readonly extensionsScannerService: IExtensionsScannerService,\n\t\t@IExtensionsProfileScannerService private readonly extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\t@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,\n\t\t@ITelemetryService private readonly telemetryService: ITelemetryService,\n\t\t@ILogService private readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis.obsoletedResource = joinPath(this.extensionsScannerService.userExtensionsLocation, '.obsolete');\n\t\tthis.obsoleteFileLimiter = new Queue();\n\t}\n\n\tasync cleanUp(): Promise<void> {\n\t\tawait this.removeTemporarilyDeletedFolders();\n\t\tawait this.deleteExtensionsMarkedForRemoval();\n\t\t//TODO: Remove this initiialization after coupe of releases\n\t\tawait this.initializeExtensionSize();\n\t}\n\n\tasync scanExtensions(type: ExtensionType | null, profileLocation: URI, productVersion: IProductVersion, language?: string): Promise<ILocalExtension[]> {\n\t\ttry {\n\t\t\tconst cacheKey: URI = profileLocation.with({ query: language });\n\t\t\tconst userScanOptions: UserExtensionsScanOptions = { includeInvalid: true, profileLocation, productVersion, language };\n\t\t\tlet scannedExtensions: IScannedExtension[] = [];\n\t\t\tif (type === null || type === ExtensionType.System) {\n\t\t\t\tlet scanAllExtensionsPromise = this.scanAllExtensionPromise.get(cacheKey);\n\t\t\t\tif (!scanAllExtensionsPromise) {\n\t\t\t\t\tscanAllExtensionsPromise = this.extensionsScannerService.scanAllExtensions({ language }, userScanOptions)\n\t\t\t\t\t\t.finally(() => this.scanAllExtensionPromise.delete(cacheKey));\n\t\t\t\t\tthis.scanAllExtensionPromise.set(cacheKey, scanAllExtensionsPromise);\n\t\t\t\t}\n\t\t\t\tscannedExtensions.push(...await scanAllExtensionsPromise);\n\t\t\t} else if (type === ExtensionType.User) {\n\t\t\t\tlet scanUserExtensionsPromise = this.scanUserExtensionsPromise.get(cacheKey);\n\t\t\t\tif (!scanUserExtensionsPromise) {\n\t\t\t\t\tscanUserExtensionsPromise = this.extensionsScannerService.scanUserExtensions(userScanOptions)\n\t\t\t\t\t\t.finally(() => this.scanUserExtensionsPromise.delete(cacheKey));\n\t\t\t\t\tthis.scanUserExtensionsPromise.set(cacheKey, scanUserExtensionsPromise);\n\t\t\t\t}\n\t\t\t\tscannedExtensions.push(...await scanUserExtensionsPromise);\n\t\t\t}\n\t\t\tscannedExtensions = type !== null ? scannedExtensions.filter(r => r.type === type) : scannedExtensions;\n\t\t\treturn await Promise.all(scannedExtensions.map(extension => this.toLocalExtension(extension)));\n\t\t} catch (error) {\n\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.Scanning);\n\t\t}\n\t}\n\n\tasync scanAllUserExtensions(): Promise<ILocalExtension[]> {\n\t\ttry {\n\t\t\tconst scannedExtensions = await this.extensionsScannerService.scanAllUserExtensions();\n\t\t\treturn await Promise.all(scannedExtensions.map(extension => this.toLocalExtension(extension)));\n\t\t} catch (error) {\n\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.Scanning);\n\t\t}\n\t}\n\n\tasync scanUserExtensionAtLocation(location: URI): Promise<ILocalExtension | null> {\n\t\ttry {\n\t\t\tconst scannedExtension = await this.extensionsScannerService.scanExistingExtension(location, ExtensionType.User, { includeInvalid: true });\n\t\t\tif (scannedExtension) {\n\t\t\t\treturn await this.toLocalExtension(scannedExtension);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logService.error(error);\n\t\t}\n\t\treturn null;\n\t}\n\n\tasync extractUserExtension(extensionKey: ExtensionKey, zipPath: string, removeIfExists: boolean, token: CancellationToken): Promise<ILocalExtension> {\n\t\tconst folderName = extensionKey.toString();\n\t\tconst tempLocation = URI.file(path.join(this.extensionsScannerService.userExtensionsLocation.fsPath, `.${generateUuid()}`));\n\t\tconst extensionLocation = URI.file(path.join(this.extensionsScannerService.userExtensionsLocation.fsPath, folderName));\n\n\t\tif (await this.fileService.exists(extensionLocation)) {\n\t\t\tif (!removeIfExists) {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.scanLocalExtension(extensionLocation, ExtensionType.User);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logService.warn(`Error while scanning the existing extension at ${extensionLocation.path}. Deleting the existing extension and extracting it.`, getErrorMessage(error));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait this.deleteExtensionFromLocation(extensionKey.id, extensionLocation, 'removeExisting');\n\t\t\t} catch (error) {\n\t\t\t\tthrow new ExtensionManagementError(nls.localize('errorDeleting', \"Unable to delete the existing folder '{0}' while installing the extension '{1}'. Please delete the folder manually and try again\", extensionLocation.fsPath, extensionKey.id), ExtensionManagementErrorCode.Delete);\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\tthrow new CancellationError();\n\t\t\t}\n\n\t\t\t// Extract\n\t\t\ttry {\n\t\t\t\tthis.logService.trace(`Started extracting the extension from ${zipPath} to ${extensionLocation.fsPath}`);\n\t\t\t\tawait extract(zipPath, tempLocation.fsPath, { sourcePath: 'extension', overwrite: true }, token);\n\t\t\t\tthis.logService.info(`Extracted extension to ${extensionLocation}:`, extensionKey.id);\n\t\t\t} catch (e) {\n\t\t\t\tthrow fromExtractError(e);\n\t\t\t}\n\n\t\t\tconst metadata: ManifestMetadata = { installedTimestamp: Date.now(), targetPlatform: extensionKey.targetPlatform };\n\t\t\ttry {\n\t\t\t\tmetadata.size = await computeSize(tempLocation, this.fileService);\n\t\t\t} catch (error) {\n\t\t\t\t// Log & ignore\n\t\t\t\tthis.logService.warn(`Error while getting the size of the extracted extension : ${tempLocation.fsPath}`, getErrorMessage(error));\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait this.extensionsScannerService.updateManifestMetadata(tempLocation, metadata);\n\t\t\t} catch (error) {\n\t\t\t\tthis.telemetryService.publicLog2<UpdateMetadataErrorEvent, UpdateMetadataErrorClassification>('extension:extract', { extensionId: extensionKey.id, code: `${toFileOperationResult(error)}` });\n\t\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.UpdateMetadata);\n\t\t\t}\n\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\tthrow new CancellationError();\n\t\t\t}\n\n\t\t\t// Rename\n\t\t\ttry {\n\t\t\t\tthis.logService.trace(`Started renaming the extension from ${tempLocation.fsPath} to ${extensionLocation.fsPath}`);\n\t\t\t\tawait this.rename(tempLocation.fsPath, extensionLocation.fsPath);\n\t\t\t\tthis.logService.info('Renamed to', extensionLocation.fsPath);\n\t\t\t} catch (error) {\n\t\t\t\tif (error.code === 'ENOTEMPTY') {\n\t\t\t\t\tthis.logService.info(`Rename failed because extension was installed by another source. So ignoring renaming.`, extensionKey.id);\n\t\t\t\t\ttry { await this.fileService.del(tempLocation, { recursive: true }); } catch (e) { /* ignore */ }\n\t\t\t\t} else {\n\t\t\t\t\tthis.logService.info(`Rename failed because of ${getErrorMessage(error)}. Deleted from extracted location`, tempLocation);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._onExtract.fire(extensionLocation);\n\n\t\t} catch (error) {\n\t\t\ttry { await this.fileService.del(tempLocation, { recursive: true }); } catch (e) { /* ignore */ }\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn this.scanLocalExtension(extensionLocation, ExtensionType.User);\n\t}\n\n\tasync scanMetadata(local: ILocalExtension, profileLocation: URI): Promise<Metadata | undefined> {\n\t\tconst extension = await this.getScannedExtension(local, profileLocation);\n\t\treturn extension?.metadata;\n\t}\n\n\tprivate async getScannedExtension(local: ILocalExtension, profileLocation: URI): Promise<IScannedProfileExtension | undefined> {\n\t\tconst extensions = await this.extensionsProfileScannerService.scanProfileExtensions(profileLocation);\n\t\treturn extensions.find(e => areSameExtensions(e.identifier, local.identifier));\n\t}\n\n\tasync updateMetadata(local: ILocalExtension, metadata: Partial<Metadata>, profileLocation: URI): Promise<ILocalExtension> {\n\t\ttry {\n\t\t\tawait this.extensionsProfileScannerService.updateMetadata([[local, metadata]], profileLocation);\n\t\t} catch (error) {\n\t\t\tthis.telemetryService.publicLog2<UpdateMetadataErrorEvent, UpdateMetadataErrorClassification>('extension:extract', { extensionId: local.identifier.id, code: `${toFileOperationResult(error)}`, isProfile: !!profileLocation });\n\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.UpdateMetadata);\n\t\t}\n\t\treturn this.scanLocalExtension(local.location, local.type, profileLocation);\n\t}\n\n\tasync setExtensionsForRemoval(...extensions: IExtension[]): Promise<void> {\n\t\tconst extensionsToRemove = [];\n\t\tfor (const extension of extensions) {\n\t\t\tif (await this.fileService.exists(extension.location)) {\n\t\t\t\textensionsToRemove.push(extension);\n\t\t\t}\n\t\t}\n\t\tconst extensionKeys: ExtensionKey[] = extensionsToRemove.map(e => ExtensionKey.create(e));\n\t\tawait this.withRemovedExtensions(removedExtensions =>\n\t\t\textensionKeys.forEach(extensionKey => {\n\t\t\t\tremovedExtensions[extensionKey.toString()] = true;\n\t\t\t\tthis.logService.info('Marked extension as removed', extensionKey.toString());\n\t\t\t}));\n\t}\n\n\tasync unsetExtensionsForRemoval(...extensionKeys: ExtensionKey[]): Promise<boolean[]> {\n\t\ttry {\n\t\t\tconst results: boolean[] = [];\n\t\t\tawait this.withRemovedExtensions(removedExtensions =>\n\t\t\t\textensionKeys.forEach(extensionKey => {\n\t\t\t\t\tif (removedExtensions[extensionKey.toString()]) {\n\t\t\t\t\t\tresults.push(true);\n\t\t\t\t\t\tdelete removedExtensions[extensionKey.toString()];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresults.push(false);\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\treturn results;\n\t\t} catch (error) {\n\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.UnsetRemoved);\n\t\t}\n\t}\n\n\tasync deleteExtension(extension: ILocalExtension | IScannedExtension, type: string): Promise<void> {\n\t\tif (this.uriIdentityService.extUri.isEqualOrParent(extension.location, this.extensionsScannerService.userExtensionsLocation)) {\n\t\t\tawait this.deleteExtensionFromLocation(extension.identifier.id, extension.location, type);\n\t\t\tawait this.unsetExtensionsForRemoval(ExtensionKey.create(extension));\n\t\t}\n\t}\n\n\tasync copyExtension(extension: ILocalExtension, fromProfileLocation: URI, toProfileLocation: URI, metadata: Partial<Metadata>): Promise<ILocalExtension> {\n\t\tconst source = await this.getScannedExtension(extension, fromProfileLocation);\n\t\tconst target = await this.getScannedExtension(extension, toProfileLocation);\n\t\tmetadata = { ...source?.metadata, ...metadata };\n\n\t\tif (target) {\n\t\t\tif (this.uriIdentityService.extUri.isEqual(target.location, extension.location)) {\n\t\t\t\tawait this.extensionsProfileScannerService.updateMetadata([[extension, { ...target.metadata, ...metadata }]], toProfileLocation);\n\t\t\t} else {\n\t\t\t\tconst targetExtension = await this.scanLocalExtension(target.location, extension.type, toProfileLocation);\n\t\t\t\tawait this.extensionsProfileScannerService.removeExtensionsFromProfile([targetExtension.identifier], toProfileLocation);\n\t\t\t\tawait this.extensionsProfileScannerService.addExtensionsToProfile([[extension, { ...target.metadata, ...metadata }]], toProfileLocation);\n\t\t\t}\n\t\t} else {\n\t\t\tawait this.extensionsProfileScannerService.addExtensionsToProfile([[extension, metadata]], toProfileLocation);\n\t\t}\n\n\t\treturn this.scanLocalExtension(extension.location, extension.type, toProfileLocation);\n\t}\n\n\tasync moveExtension(extension: ILocalExtension, fromProfileLocation: URI, toProfileLocation: URI, metadata: Partial<Metadata>): Promise<ILocalExtension> {\n\t\tconst source = await this.getScannedExtension(extension, fromProfileLocation);\n\t\tconst target = await this.getScannedExtension(extension, toProfileLocation);\n\t\tmetadata = { ...source?.metadata, ...metadata };\n\n\t\tif (target) {\n\t\t\tif (this.uriIdentityService.extUri.isEqual(target.location, extension.location)) {\n\t\t\t\tawait this.extensionsProfileScannerService.updateMetadata([[extension, { ...target.metadata, ...metadata }]], toProfileLocation);\n\t\t\t} else {\n\t\t\t\tconst targetExtension = await this.scanLocalExtension(target.location, extension.type, toProfileLocation);\n\t\t\t\tawait this.removeExtension(targetExtension.identifier, toProfileLocation);\n\t\t\t\tawait this.extensionsProfileScannerService.addExtensionsToProfile([[extension, { ...target.metadata, ...metadata }]], toProfileLocation);\n\t\t\t}\n\t\t} else {\n\t\t\tawait this.extensionsProfileScannerService.addExtensionsToProfile([[extension, metadata]], toProfileLocation);\n\t\t\tif (source) {\n\t\t\t\tawait this.removeExtension(source.identifier, fromProfileLocation);\n\t\t\t}\n\t\t}\n\n\t\treturn this.scanLocalExtension(extension.location, extension.type, toProfileLocation);\n\t}\n\n\tasync removeExtension(identifier: IExtensionIdentifier, fromProfileLocation: URI): Promise<void> {\n\t\tawait this.extensionsProfileScannerService.removeExtensionsFromProfile([identifier], fromProfileLocation);\n\t}\n\n\tasync copyExtensions(fromProfileLocation: URI, toProfileLocation: URI, productVersion: IProductVersion): Promise<void> {\n\t\tconst fromExtensions = await this.scanExtensions(ExtensionType.User, fromProfileLocation, productVersion);\n\t\tconst extensions: [ILocalExtension, Metadata | undefined][] = await Promise.all(fromExtensions\n\t\t\t.filter(e => !e.isApplicationScoped) /* remove application scoped extensions */\n\t\t\t.map(async e => ([e, await this.scanMetadata(e, fromProfileLocation)])));\n\t\tawait this.extensionsProfileScannerService.addExtensionsToProfile(extensions, toProfileLocation);\n\t}\n\n\tprivate async deleteExtensionFromLocation(id: string, location: URI, type: string): Promise<void> {\n\t\tthis.logService.trace(`Deleting ${type} extension from disk`, id, location.fsPath);\n\t\tconst renamedLocation = this.uriIdentityService.extUri.joinPath(this.uriIdentityService.extUri.dirname(location), `${this.uriIdentityService.extUri.basename(location)}.${hash(generateUuid()).toString(16)}${DELETED_FOLDER_POSTFIX}`);\n\t\tawait this.rename(location.fsPath, renamedLocation.fsPath);\n\t\tawait this.fileService.del(renamedLocation, { recursive: true });\n\t\tthis.logService.info(`Deleted ${type} extension from disk`, id, location.fsPath);\n\t}\n\n\tprivate withRemovedExtensions(updateFn?: (removed: IStringDictionary<boolean>) => void): Promise<IStringDictionary<boolean>> {\n\t\treturn this.obsoleteFileLimiter.queue(async () => {\n\t\t\tlet raw: string | undefined;\n\t\t\ttry {\n\t\t\t\tconst content = await this.fileService.readFile(this.obsoletedResource, 'utf8');\n\t\t\t\traw = content.value.toString();\n\t\t\t} catch (error) {\n\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet removed = {};\n\t\t\tif (raw) {\n\t\t\t\ttry {\n\t\t\t\t\tremoved = JSON.parse(raw);\n\t\t\t\t} catch (e) { /* ignore */ }\n\t\t\t}\n\n\t\t\tif (updateFn) {\n\t\t\t\tupdateFn(removed);\n\t\t\t\tif (Object.keys(removed).length) {\n\t\t\t\t\tawait this.fileService.writeFile(this.obsoletedResource, VSBuffer.fromString(JSON.stringify(removed)));\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.fileService.del(this.obsoletedResource);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn removed;\n\t\t});\n\t}\n\n\tprivate async rename(extractPath: string, renamePath: string): Promise<void> {\n\t\ttry {\n\t\t\tawait pfs.Promises.rename(extractPath, renamePath, 2 * 60 * 1000 /* Retry for 2 minutes */);\n\t\t} catch (error) {\n\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.Rename);\n\t\t}\n\t}\n\n\tasync scanLocalExtension(location: URI, type: ExtensionType, profileLocation?: URI): Promise<ILocalExtension> {\n\t\ttry {\n\t\t\tif (profileLocation) {\n\t\t\t\tconst scannedExtensions = await this.extensionsScannerService.scanUserExtensions({ profileLocation });\n\t\t\t\tconst scannedExtension = scannedExtensions.find(e => this.uriIdentityService.extUri.isEqual(e.location, location));\n\t\t\t\tif (scannedExtension) {\n\t\t\t\t\treturn await this.toLocalExtension(scannedExtension);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst scannedExtension = await this.extensionsScannerService.scanExistingExtension(location, type, { includeInvalid: true });\n\t\t\t\tif (scannedExtension) {\n\t\t\t\t\treturn await this.toLocalExtension(scannedExtension);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow new ExtensionManagementError(nls.localize('cannot read', \"Cannot read the extension from {0}\", location.path), ExtensionManagementErrorCode.ScanningExtension);\n\t\t} catch (error) {\n\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.ScanningExtension);\n\t\t}\n\t}\n\n\tprivate async toLocalExtension(extension: IScannedExtension): Promise<ILocalExtension> {\n\t\tlet stat: IFileStat | undefined;\n\t\ttry {\n\t\t\tstat = await this.fileService.resolve(extension.location);\n\t\t} catch (error) {/* ignore */ }\n\n\t\tlet readmeUrl: URI | undefined;\n\t\tlet changelogUrl: URI | undefined;\n\t\tif (stat?.children) {\n\t\t\treadmeUrl = stat.children.find(({ name }) => /^readme(\\.txt|\\.md|)$/i.test(name))?.resource;\n\t\t\tchangelogUrl = stat.children.find(({ name }) => /^changelog(\\.txt|\\.md|)$/i.test(name))?.resource;\n\t\t}\n\t\treturn {\n\t\t\tidentifier: extension.identifier,\n\t\t\ttype: extension.type,\n\t\t\tisBuiltin: extension.isBuiltin || !!extension.metadata?.isBuiltin,\n\t\t\tlocation: extension.location,\n\t\t\tmanifest: extension.manifest,\n\t\t\ttargetPlatform: extension.targetPlatform,\n\t\t\tvalidations: extension.validations,\n\t\t\tisValid: extension.isValid,\n\t\t\treadmeUrl,\n\t\t\tchangelogUrl,\n\t\t\tpublisherDisplayName: extension.metadata?.publisherDisplayName,\n\t\t\tpublisherId: extension.metadata?.publisherId || null,\n\t\t\tisApplicationScoped: !!extension.metadata?.isApplicationScoped,\n\t\t\tisMachineScoped: !!extension.metadata?.isMachineScoped,\n\t\t\tisPreReleaseVersion: !!extension.metadata?.isPreReleaseVersion,\n\t\t\thasPreReleaseVersion: !!extension.metadata?.hasPreReleaseVersion,\n\t\t\tpreRelease: extension.preRelease,\n\t\t\tinstalledTimestamp: extension.metadata?.installedTimestamp,\n\t\t\tupdated: !!extension.metadata?.updated,\n\t\t\tpinned: !!extension.metadata?.pinned,\n\t\t\tprivate: !!extension.metadata?.private,\n\t\t\tisWorkspaceScoped: false,\n\t\t\tsource: extension.metadata?.source ?? (extension.identifier.uuid ? 'gallery' : 'vsix'),\n\t\t\tsize: extension.metadata?.size ?? 0,\n\t\t};\n\t}\n\n\tprivate async initializeExtensionSize(): Promise<void> {\n\t\tconst extensions = await this.extensionsScannerService.scanAllUserExtensions();\n\t\tawait Promise.all(extensions.map(async extension => {\n\t\t\t// set size if not set before\n\t\t\tif (isDefined(extension.metadata?.installedTimestamp) && isUndefined(extension.metadata?.size)) {\n\t\t\t\tconst size = await computeSize(extension.location, this.fileService);\n\t\t\t\tawait this.extensionsScannerService.updateManifestMetadata(extension.location, { size });\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate async deleteExtensionsMarkedForRemoval(): Promise<void> {\n\t\tlet removed: IStringDictionary<boolean>;\n\t\ttry {\n\t\t\tremoved = await this.withRemovedExtensions();\n\t\t} catch (error) {\n\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.ReadRemoved);\n\t\t}\n\n\t\tif (Object.keys(removed).length === 0) {\n\t\t\tthis.logService.debug(`No extensions are marked as removed.`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.logService.debug(`Deleting extensions marked as removed:`, Object.keys(removed));\n\n\t\tconst extensions = await this.scanAllUserExtensions();\n\t\tconst installed: Set<string> = new Set<string>();\n\t\tfor (const e of extensions) {\n\t\t\tif (!removed[ExtensionKey.create(e).toString()]) {\n\t\t\t\tinstalled.add(e.identifier.id.toLowerCase());\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\t// running post uninstall tasks for extensions that are not installed anymore\n\t\t\tconst byExtension = groupByExtension(extensions, e => e.identifier);\n\t\t\tawait Promises.settled(byExtension.map(async e => {\n\t\t\t\tconst latest = e.sort((a, b) => semver.rcompare(a.manifest.version, b.manifest.version))[0];\n\t\t\t\tif (!installed.has(latest.identifier.id.toLowerCase())) {\n\t\t\t\t\tawait this.beforeRemovingExtension(latest);\n\t\t\t\t}\n\t\t\t}));\n\t\t} catch (error) {\n\t\t\tthis.logService.error(error);\n\t\t}\n\n\t\tconst toRemove = extensions.filter(e => e.installedTimestamp /* Installed by System */ && removed[ExtensionKey.create(e).toString()]);\n\t\tawait Promise.allSettled(toRemove.map(e => this.deleteExtension(e, 'marked for removal')));\n\t}\n\n\tprivate async removeTemporarilyDeletedFolders(): Promise<void> {\n\t\tthis.logService.trace('ExtensionManagementService#removeTempDeleteFolders');\n\n\t\tlet stat;\n\t\ttry {\n\t\t\tstat = await this.fileService.resolve(this.extensionsScannerService.userExtensionsLocation);\n\t\t} catch (error) {\n\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\tthis.logService.error(error);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (!stat?.children) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait Promise.allSettled(stat.children.map(async child => {\n\t\t\t\tif (!child.isDirectory || !child.name.endsWith(DELETED_FOLDER_POSTFIX)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.logService.trace('Deleting the temporarily deleted folder', child.resource.toString());\n\t\t\t\ttry {\n\t\t\t\t\tawait this.fileService.del(child.resource, { recursive: true });\n\t\t\t\t\tthis.logService.trace('Deleted the temporarily deleted folder', child.resource.toString());\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\t\t} catch (error) { /* ignore */ }\n\t}\n\n}\n\nclass InstallExtensionInProfileTask extends AbstractExtensionTask<ILocalExtension> implements IInstallExtensionTask {\n\n\tprivate _operation = InstallOperation.Install;\n\tget operation() { return this.options.operation ?? this._operation; }\n\n\tprivate _verificationStatus: ExtensionSignatureVerificationCode | undefined;\n\tget verificationStatus() { return this._verificationStatus; }\n\n\treadonly identifier: IExtensionIdentifier;\n\n\tconstructor(\n\t\tprivate readonly extensionKey: ExtensionKey,\n\t\treadonly manifest: IExtensionManifest,\n\t\treadonly source: IGalleryExtension | URI,\n\t\treadonly options: InstallExtensionTaskOptions,\n\t\tprivate readonly extractExtensionFn: (operation: InstallOperation, token: CancellationToken) => Promise<ExtractExtensionResult>,\n\t\tprivate readonly extensionsScanner: ExtensionsScanner,\n\t\t@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,\n\t\t@IExtensionGalleryService private readonly galleryService: IExtensionGalleryService,\n\t\t@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,\n\t\t@IExtensionsScannerService private readonly extensionsScannerService: IExtensionsScannerService,\n\t\t@IExtensionsProfileScannerService private readonly extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\t@ILogService private readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis.identifier = this.extensionKey.identifier;\n\t}\n\n\tprotected async doRun(token: CancellationToken): Promise<ILocalExtension> {\n\t\tconst installed = await this.extensionsScanner.scanExtensions(ExtensionType.User, this.options.profileLocation, this.options.productVersion);\n\t\tconst existingExtension = installed.find(i => areSameExtensions(i.identifier, this.identifier));\n\t\tif (existingExtension) {\n\t\t\tthis._operation = InstallOperation.Update;\n\t\t}\n\n\t\tconst metadata: Metadata = {\n\t\t\tisApplicationScoped: this.options.isApplicationScoped || existingExtension?.isApplicationScoped,\n\t\t\tisMachineScoped: this.options.isMachineScoped || existingExtension?.isMachineScoped,\n\t\t\tisBuiltin: this.options.isBuiltin || existingExtension?.isBuiltin,\n\t\t\tisSystem: existingExtension?.type === ExtensionType.System ? true : undefined,\n\t\t\tinstalledTimestamp: Date.now(),\n\t\t\tpinned: this.options.installGivenVersion ? true : (this.options.pinned ?? existingExtension?.pinned),\n\t\t\tsource: this.source instanceof URI ? 'vsix' : 'gallery',\n\t\t};\n\n\t\tlet local: ILocalExtension | undefined;\n\n\t\t// VSIX\n\t\tif (this.source instanceof URI) {\n\t\t\tif (existingExtension) {\n\t\t\t\tif (this.extensionKey.equals(new ExtensionKey(existingExtension.identifier, existingExtension.manifest.version))) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.extensionsScanner.deleteExtension(existingExtension, 'existing');\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthrow new Error(nls.localize('restartCode', \"Please restart VS Code before reinstalling {0}.\", this.manifest.displayName || this.manifest.name));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Remove the extension with same version if it is already uninstalled.\n\t\t\t// Installing a VSIX extension shall replace the existing extension always.\n\t\t\tconst existingWithSameVersion = await this.unsetIfRemoved(this.extensionKey);\n\t\t\tif (existingWithSameVersion) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.extensionsScanner.deleteExtension(existingWithSameVersion, 'existing');\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthrow new Error(nls.localize('restartCode', \"Please restart VS Code before reinstalling {0}.\", this.manifest.displayName || this.manifest.name));\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t// Gallery\n\t\telse {\n\t\t\tmetadata.id = this.source.identifier.uuid;\n\t\t\tmetadata.publisherId = this.source.publisherId;\n\t\t\tmetadata.publisherDisplayName = this.source.publisherDisplayName;\n\t\t\tmetadata.targetPlatform = this.source.properties.targetPlatform;\n\t\t\tmetadata.updated = !!existingExtension;\n\t\t\tmetadata.private = this.source.private;\n\t\t\tmetadata.isPreReleaseVersion = this.source.properties.isPreReleaseVersion;\n\t\t\tmetadata.hasPreReleaseVersion = existingExtension?.hasPreReleaseVersion || this.source.properties.isPreReleaseVersion;\n\t\t\tmetadata.preRelease = isBoolean(this.options.preRelease)\n\t\t\t\t? this.options.preRelease\n\t\t\t\t: this.options.installPreReleaseVersion || this.source.properties.isPreReleaseVersion || existingExtension?.preRelease;\n\n\t\t\tif (existingExtension && existingExtension.type !== ExtensionType.System && existingExtension.manifest.version === this.source.version) {\n\t\t\t\treturn this.extensionsScanner.updateMetadata(existingExtension, metadata, this.options.profileLocation);\n\t\t\t}\n\n\t\t\t// Unset if the extension is uninstalled and return the unset extension.\n\t\t\tlocal = await this.unsetIfRemoved(this.extensionKey);\n\t\t}\n\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow toExtensionManagementError(new CancellationError());\n\t\t}\n\n\t\tif (!local) {\n\t\t\tconst result = await this.extractExtensionFn(this.operation, token);\n\t\t\tlocal = result.local;\n\t\t\tthis._verificationStatus = result.verificationStatus;\n\t\t}\n\n\t\tif (this.uriIdentityService.extUri.isEqual(this.userDataProfilesService.defaultProfile.extensionsResource, this.options.profileLocation)) {\n\t\t\ttry {\n\t\t\t\tawait this.extensionsScannerService.initializeDefaultProfileExtensions();\n\t\t\t} catch (error) {\n\t\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.IntializeDefaultProfile);\n\t\t\t}\n\t\t}\n\n\t\tif (token.isCancellationRequested) {\n\t\t\tthrow toExtensionManagementError(new CancellationError());\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.extensionsProfileScannerService.addExtensionsToProfile([[local, metadata]], this.options.profileLocation, !local.isValid);\n\t\t} catch (error) {\n\t\t\tthrow toExtensionManagementError(error, ExtensionManagementErrorCode.AddToProfile);\n\t\t}\n\n\t\tconst result = await this.extensionsScanner.scanLocalExtension(local.location, ExtensionType.User, this.options.profileLocation);\n\t\tif (!result) {\n\t\t\tthrow new ExtensionManagementError('Cannot find the installed extension', ExtensionManagementErrorCode.InstalledExtensionNotFound);\n\t\t}\n\n\t\tif (this.source instanceof URI) {\n\t\t\tthis.updateMetadata(local, token);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate async unsetIfRemoved(extensionKey: ExtensionKey): Promise<ILocalExtension | undefined> {\n\t\t// If the same version of extension is marked as removed, remove it from there and return the local.\n\t\tconst [removed] = await this.extensionsScanner.unsetExtensionsForRemoval(extensionKey);\n\t\tif (removed) {\n\t\t\tthis.logService.info('Removed the extension from removed list:', extensionKey.id);\n\t\t\tconst userExtensions = await this.extensionsScanner.scanAllUserExtensions();\n\t\t\treturn userExtensions.find(i => ExtensionKey.create(i).equals(extensionKey));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate async updateMetadata(extension: ILocalExtension, token: CancellationToken): Promise<void> {\n\t\ttry {\n\t\t\tlet [galleryExtension] = await this.galleryService.getExtensions([{ id: extension.identifier.id, version: extension.manifest.version }], token);\n\t\t\tif (!galleryExtension) {\n\t\t\t\t[galleryExtension] = await this.galleryService.getExtensions([{ id: extension.identifier.id }], token);\n\t\t\t}\n\t\t\tif (galleryExtension) {\n\t\t\t\tconst metadata = {\n\t\t\t\t\tid: galleryExtension.identifier.uuid,\n\t\t\t\t\tpublisherDisplayName: galleryExtension.publisherDisplayName,\n\t\t\t\t\tpublisherId: galleryExtension.publisherId,\n\t\t\t\t\tisPreReleaseVersion: galleryExtension.properties.isPreReleaseVersion,\n\t\t\t\t\thasPreReleaseVersion: extension.hasPreReleaseVersion || galleryExtension.properties.isPreReleaseVersion,\n\t\t\t\t\tpreRelease: galleryExtension.properties.isPreReleaseVersion || this.options.installPreReleaseVersion\n\t\t\t\t};\n\t\t\t\tawait this.extensionsScanner.updateMetadata(extension, metadata, this.options.profileLocation);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t/* Ignore Error */\n\t\t}\n\t}\n}\n\nclass UninstallExtensionInProfileTask extends AbstractExtensionTask<void> implements IUninstallExtensionTask {\n\n\tconstructor(\n\t\treadonly extension: ILocalExtension,\n\t\treadonly options: UninstallExtensionTaskOptions,\n\t\tprivate readonly extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t) {\n\t\tsuper();\n\t}\n\n\tprotected doRun(token: CancellationToken): Promise<void> {\n\t\treturn this.extensionsProfileScannerService.removeExtensionsFromProfile([this.extension.identifier], this.options.profileLocation);\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport class Node<T> {\n\n\n\treadonly incoming = new Map<string, Node<T>>();\n\treadonly outgoing = new Map<string, Node<T>>();\n\n\tconstructor(\n\t\treadonly key: string,\n\t\treadonly data: T\n\t) { }\n}\n\nexport class Graph<T> {\n\n\tprivate readonly _nodes = new Map<string, Node<T>>();\n\n\tconstructor(private readonly _hashFn: (element: T) => string) {\n\t\t// empty\n\t}\n\n\troots(): Node<T>[] {\n\t\tconst ret: Node<T>[] = [];\n\t\tfor (const node of this._nodes.values()) {\n\t\t\tif (node.outgoing.size === 0) {\n\t\t\t\tret.push(node);\n\t\t\t}\n\t\t}\n\t\treturn ret;\n\t}\n\n\tinsertEdge(from: T, to: T): void {\n\t\tconst fromNode = this.lookupOrInsertNode(from);\n\t\tconst toNode = this.lookupOrInsertNode(to);\n\n\t\tfromNode.outgoing.set(toNode.key, toNode);\n\t\ttoNode.incoming.set(fromNode.key, fromNode);\n\t}\n\n\tremoveNode(data: T): void {\n\t\tconst key = this._hashFn(data);\n\t\tthis._nodes.delete(key);\n\t\tfor (const node of this._nodes.values()) {\n\t\t\tnode.outgoing.delete(key);\n\t\t\tnode.incoming.delete(key);\n\t\t}\n\t}\n\n\tlookupOrInsertNode(data: T): Node<T> {\n\t\tconst key = this._hashFn(data);\n\t\tlet node = this._nodes.get(key);\n\n\t\tif (!node) {\n\t\t\tnode = new Node(key, data);\n\t\t\tthis._nodes.set(key, node);\n\t\t}\n\n\t\treturn node;\n\t}\n\n\tlookup(data: T): Node<T> | undefined {\n\t\treturn this._nodes.get(this._hashFn(data));\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this._nodes.size === 0;\n\t}\n\n\ttoString(): string {\n\t\tconst data: string[] = [];\n\t\tfor (const [key, value] of this._nodes) {\n\t\t\tdata.push(`${key}\\n\\t(-> incoming)[${[...value.incoming.keys()].join(', ')}]\\n\\t(outgoing ->)[${[...value.outgoing.keys()].join(',')}]\\n`);\n\n\t\t}\n\t\treturn data.join('\\n');\n\t}\n\n\t/**\n\t * This is brute force and slow and **only** be used\n\t * to trouble shoot.\n\t */\n\tfindCycleSlow() {\n\t\tfor (const [id, node] of this._nodes) {\n\t\t\tconst seen = new Set<string>([id]);\n\t\t\tconst res = this._findCycle(node, seen);\n\t\t\tif (res) {\n\t\t\t\treturn res;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate _findCycle(node: Node<T>, seen: Set<string>): string | undefined {\n\t\tfor (const [id, outgoing] of node.outgoing) {\n\t\t\tif (seen.has(id)) {\n\t\t\t\treturn [...seen, id].join(' -> ');\n\t\t\t}\n\t\t\tseen.add(id);\n\t\t\tconst value = this._findCycle(outgoing, seen);\n\t\t\tif (value) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tseen.delete(id);\n\t\t}\n\t\treturn undefined;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { GlobalIdleValue } from '../../../base/common/async.js';\nimport { Event } from '../../../base/common/event.js';\nimport { illegalState } from '../../../base/common/errors.js';\nimport { DisposableStore, dispose, IDisposable, isDisposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { SyncDescriptor, SyncDescriptor0 } from './descriptors.js';\nimport { Graph } from './graph.js';\nimport { GetLeadingNonServiceArgs, IInstantiationService, ServiceIdentifier, ServicesAccessor, _util } from './instantiation.js';\nimport { ServiceCollection } from './serviceCollection.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\n\n// TRACING\nconst _enableAllTracing = false\n\t// || \"TRUE\" // DO NOT CHECK IN!\n\t;\n\nclass CyclicDependencyError extends Error {\n\tconstructor(graph: Graph<any>) {\n\t\tsuper('cyclic dependency between services');\n\t\tthis.message = graph.findCycleSlow() ?? `UNABLE to detect cycle, dumping graph: \\n${graph.toString()}`;\n\t}\n}\n\nexport class InstantiationService implements IInstantiationService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\treadonly _globalGraph?: Graph<string>;\n\tprivate _globalGraphImplicitDependency?: string;\n\n\tprivate _isDisposed = false;\n\tprivate readonly _servicesToMaybeDispose = new Set<any>();\n\tprivate readonly _children = new Set<InstantiationService>();\n\n\tconstructor(\n\t\tprivate readonly _services: ServiceCollection = new ServiceCollection(),\n\t\tprivate readonly _strict: boolean = false,\n\t\tprivate readonly _parent?: InstantiationService,\n\t\tprivate readonly _enableTracing: boolean = _enableAllTracing\n\t) {\n\n\t\tthis._services.set(IInstantiationService, this);\n\t\tthis._globalGraph = _enableTracing ? _parent?._globalGraph ?? new Graph(e => e) : undefined;\n\t}\n\n\tdispose(): void {\n\t\tif (!this._isDisposed) {\n\t\t\tthis._isDisposed = true;\n\t\t\t// dispose all child services\n\t\t\tdispose(this._children);\n\t\t\tthis._children.clear();\n\n\t\t\t// dispose all services created by this service\n\t\t\tfor (const candidate of this._servicesToMaybeDispose) {\n\t\t\t\tif (isDisposable(candidate)) {\n\t\t\t\t\tcandidate.dispose();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._servicesToMaybeDispose.clear();\n\t\t}\n\t}\n\n\tprivate _throwIfDisposed(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('InstantiationService has been disposed');\n\t\t}\n\t}\n\n\tcreateChild(services: ServiceCollection, store?: DisposableStore): IInstantiationService {\n\t\tthis._throwIfDisposed();\n\n\t\tconst that = this;\n\t\tconst result = new class extends InstantiationService {\n\t\t\toverride dispose(): void {\n\t\t\t\tthat._children.delete(result);\n\t\t\t\tsuper.dispose();\n\t\t\t}\n\t\t}(services, this._strict, this, this._enableTracing);\n\t\tthis._children.add(result);\n\n\t\tstore?.add(result);\n\t\treturn result;\n\t}\n\n\tinvokeFunction<R, TS extends any[] = []>(fn: (accessor: ServicesAccessor, ...args: TS) => R, ...args: TS): R {\n\t\tthis._throwIfDisposed();\n\n\t\tconst _trace = Trace.traceInvocation(this._enableTracing, fn);\n\t\tlet _done = false;\n\t\ttry {\n\t\t\tconst accessor: ServicesAccessor = {\n\t\t\t\tget: <T>(id: ServiceIdentifier<T>) => {\n\n\t\t\t\t\tif (_done) {\n\t\t\t\t\t\tthrow illegalState('service accessor is only valid during the invocation of its target method');\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = this._getOrCreateServiceInstance(id, _trace);\n\t\t\t\t\tif (!result) {\n\t\t\t\t\t\tthrow new Error(`[invokeFunction] unknown service '${id}'`);\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn fn(accessor, ...args);\n\t\t} finally {\n\t\t\t_done = true;\n\t\t\t_trace.stop();\n\t\t}\n\t}\n\n\tcreateInstance<T>(descriptor: SyncDescriptor0<T>): T;\n\tcreateInstance<Ctor extends new (...args: any[]) => unknown, R extends InstanceType<Ctor>>(ctor: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;\n\tcreateInstance(ctorOrDescriptor: any | SyncDescriptor<any>, ...rest: any[]): unknown {\n\t\tthis._throwIfDisposed();\n\n\t\tlet _trace: Trace;\n\t\tlet result: unknown;\n\t\tif (ctorOrDescriptor instanceof SyncDescriptor) {\n\t\t\t_trace = Trace.traceCreation(this._enableTracing, ctorOrDescriptor.ctor);\n\t\t\tresult = this._createInstance(ctorOrDescriptor.ctor, ctorOrDescriptor.staticArguments.concat(rest), _trace);\n\t\t} else {\n\t\t\t_trace = Trace.traceCreation(this._enableTracing, ctorOrDescriptor);\n\t\t\tresult = this._createInstance(ctorOrDescriptor, rest, _trace);\n\t\t}\n\t\t_trace.stop();\n\t\treturn result;\n\t}\n\n\tprivate _createInstance<T>(ctor: any, args: any[] = [], _trace: Trace): T {\n\n\t\t// arguments defined by service decorators\n\t\tconst serviceDependencies = _util.getServiceDependencies(ctor).sort((a, b) => a.index - b.index);\n\t\tconst serviceArgs: any[] = [];\n\t\tfor (const dependency of serviceDependencies) {\n\t\t\tconst service = this._getOrCreateServiceInstance(dependency.id, _trace);\n\t\t\tif (!service) {\n\t\t\t\tthis._throwIfStrict(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`, false);\n\t\t\t}\n\t\t\tserviceArgs.push(service);\n\t\t}\n\n\t\tconst firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;\n\n\t\t// check for argument mismatches, adjust static args if needed\n\t\tif (args.length !== firstServiceArgPos) {\n\t\t\tconsole.trace(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);\n\n\t\t\tconst delta = firstServiceArgPos - args.length;\n\t\t\tif (delta > 0) {\n\t\t\t\targs = args.concat(new Array(delta));\n\t\t\t} else {\n\t\t\t\targs = args.slice(0, firstServiceArgPos);\n\t\t\t}\n\t\t}\n\n\t\t// now create the instance\n\t\treturn Reflect.construct<any, T>(ctor, args.concat(serviceArgs));\n\t}\n\n\tprivate _setCreatedServiceInstance<T>(id: ServiceIdentifier<T>, instance: T): void {\n\t\tif (this._services.get(id) instanceof SyncDescriptor) {\n\t\t\tthis._services.set(id, instance);\n\t\t} else if (this._parent) {\n\t\t\tthis._parent._setCreatedServiceInstance(id, instance);\n\t\t} else {\n\t\t\tthrow new Error('illegalState - setting UNKNOWN service instance');\n\t\t}\n\t}\n\n\tprivate _getServiceInstanceOrDescriptor<T>(id: ServiceIdentifier<T>): T | SyncDescriptor<T> {\n\t\tconst instanceOrDesc = this._services.get(id);\n\t\tif (!instanceOrDesc && this._parent) {\n\t\t\treturn this._parent._getServiceInstanceOrDescriptor(id);\n\t\t} else {\n\t\t\treturn instanceOrDesc;\n\t\t}\n\t}\n\n\tprotected _getOrCreateServiceInstance<T>(id: ServiceIdentifier<T>, _trace: Trace): T {\n\t\tif (this._globalGraph && this._globalGraphImplicitDependency) {\n\t\t\tthis._globalGraph.insertEdge(this._globalGraphImplicitDependency, String(id));\n\t\t}\n\t\tconst thing = this._getServiceInstanceOrDescriptor(id);\n\t\tif (thing instanceof SyncDescriptor) {\n\t\t\treturn this._safeCreateAndCacheServiceInstance(id, thing, _trace.branch(id, true));\n\t\t} else {\n\t\t\t_trace.branch(id, false);\n\t\t\treturn thing;\n\t\t}\n\t}\n\n\tprivate readonly _activeInstantiations = new Set<ServiceIdentifier<any>>();\n\n\n\tprivate _safeCreateAndCacheServiceInstance<T>(id: ServiceIdentifier<T>, desc: SyncDescriptor<T>, _trace: Trace): T {\n\t\tif (this._activeInstantiations.has(id)) {\n\t\t\tthrow new Error(`illegal state - RECURSIVELY instantiating service '${id}'`);\n\t\t}\n\t\tthis._activeInstantiations.add(id);\n\t\ttry {\n\t\t\treturn this._createAndCacheServiceInstance(id, desc, _trace);\n\t\t} finally {\n\t\t\tthis._activeInstantiations.delete(id);\n\t\t}\n\t}\n\n\tprivate _createAndCacheServiceInstance<T>(id: ServiceIdentifier<T>, desc: SyncDescriptor<T>, _trace: Trace): T {\n\n\t\ttype Triple = { id: ServiceIdentifier<any>; desc: SyncDescriptor<any>; _trace: Trace };\n\t\tconst graph = new Graph<Triple>(data => data.id.toString());\n\n\t\tlet cycleCount = 0;\n\t\tconst stack = [{ id, desc, _trace }];\n\t\tconst seen = new Set<string>();\n\t\twhile (stack.length) {\n\t\t\tconst item = stack.pop()!;\n\n\t\t\tif (seen.has(String(item.id))) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(String(item.id));\n\n\t\t\tgraph.lookupOrInsertNode(item);\n\n\t\t\t// a weak but working heuristic for cycle checks\n\t\t\tif (cycleCount++ > 1000) {\n\t\t\t\tthrow new CyclicDependencyError(graph);\n\t\t\t}\n\n\t\t\t// check all dependencies for existence and if they need to be created first\n\t\t\tfor (const dependency of _util.getServiceDependencies(item.desc.ctor)) {\n\n\t\t\t\tconst instanceOrDesc = this._getServiceInstanceOrDescriptor(dependency.id);\n\t\t\t\tif (!instanceOrDesc) {\n\t\t\t\t\tthis._throwIfStrict(`[createInstance] ${id} depends on ${dependency.id} which is NOT registered.`, true);\n\t\t\t\t}\n\n\t\t\t\t// take note of all service dependencies\n\t\t\t\tthis._globalGraph?.insertEdge(String(item.id), String(dependency.id));\n\n\t\t\t\tif (instanceOrDesc instanceof SyncDescriptor) {\n\t\t\t\t\tconst d = { id: dependency.id, desc: instanceOrDesc, _trace: item._trace.branch(dependency.id, true) };\n\t\t\t\t\tgraph.insertEdge(item, d);\n\t\t\t\t\tstack.push(d);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (true) {\n\t\t\tconst roots = graph.roots();\n\n\t\t\t// if there is no more roots but still\n\t\t\t// nodes in the graph we have a cycle\n\t\t\tif (roots.length === 0) {\n\t\t\t\tif (!graph.isEmpty()) {\n\t\t\t\t\tthrow new CyclicDependencyError(graph);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tfor (const { data } of roots) {\n\t\t\t\t// Repeat the check for this still being a service sync descriptor. That's because\n\t\t\t\t// instantiating a dependency might have side-effect and recursively trigger instantiation\n\t\t\t\t// so that some dependencies are now fullfilled already.\n\t\t\t\tconst instanceOrDesc = this._getServiceInstanceOrDescriptor(data.id);\n\t\t\t\tif (instanceOrDesc instanceof SyncDescriptor) {\n\t\t\t\t\t// create instance and overwrite the service collections\n\t\t\t\t\tconst instance = this._createServiceInstanceWithOwner(data.id, data.desc.ctor, data.desc.staticArguments, data.desc.supportsDelayedInstantiation, data._trace);\n\t\t\t\t\tthis._setCreatedServiceInstance(data.id, instance);\n\t\t\t\t}\n\t\t\t\tgraph.removeNode(data);\n\t\t\t}\n\t\t}\n\t\treturn <T>this._getServiceInstanceOrDescriptor(id);\n\t}\n\n\tprivate _createServiceInstanceWithOwner<T>(id: ServiceIdentifier<T>, ctor: any, args: any[] = [], supportsDelayedInstantiation: boolean, _trace: Trace): T {\n\t\tif (this._services.get(id) instanceof SyncDescriptor) {\n\t\t\treturn this._createServiceInstance(id, ctor, args, supportsDelayedInstantiation, _trace, this._servicesToMaybeDispose);\n\t\t} else if (this._parent) {\n\t\t\treturn this._parent._createServiceInstanceWithOwner(id, ctor, args, supportsDelayedInstantiation, _trace);\n\t\t} else {\n\t\t\tthrow new Error(`illegalState - creating UNKNOWN service instance ${ctor.name}`);\n\t\t}\n\t}\n\n\tprivate _createServiceInstance<T>(id: ServiceIdentifier<T>, ctor: any, args: any[] = [], supportsDelayedInstantiation: boolean, _trace: Trace, disposeBucket: Set<any>): T {\n\t\tif (!supportsDelayedInstantiation) {\n\t\t\t// eager instantiation\n\t\t\tconst result = this._createInstance<T>(ctor, args, _trace);\n\t\t\tdisposeBucket.add(result);\n\t\t\treturn result;\n\n\t\t} else {\n\t\t\tconst child = new InstantiationService(undefined, this._strict, this, this._enableTracing);\n\t\t\tchild._globalGraphImplicitDependency = String(id);\n\n\t\t\ttype EaryListenerData = {\n\t\t\t\tlistener: Parameters<Event<any>>;\n\t\t\t\tdisposable?: IDisposable;\n\t\t\t};\n\n\t\t\t// Return a proxy object that's backed by an idle value. That\n\t\t\t// strategy is to instantiate services in our idle time or when actually\n\t\t\t// needed but not when injected into a consumer\n\n\t\t\t// return \"empty events\" when the service isn't instantiated yet\n\t\t\tconst earlyListeners = new Map<string, LinkedList<EaryListenerData>>();\n\n\t\t\tconst idle = new GlobalIdleValue<any>(() => {\n\t\t\t\tconst result = child._createInstance<T>(ctor, args, _trace);\n\n\t\t\t\t// early listeners that we kept are now being subscribed to\n\t\t\t\t// the real service\n\t\t\t\tfor (const [key, values] of earlyListeners) {\n\t\t\t\t\tconst candidate = <Event<any>>(<any>result)[key];\n\t\t\t\t\tif (typeof candidate === 'function') {\n\t\t\t\t\t\tfor (const value of values) {\n\t\t\t\t\t\t\tvalue.disposable = candidate.apply(result, value.listener);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tearlyListeners.clear();\n\t\t\t\tdisposeBucket.add(result);\n\t\t\t\treturn result;\n\t\t\t});\n\t\t\treturn <T>new Proxy(Object.create(null), {\n\t\t\t\tget(target: any, key: PropertyKey): unknown {\n\n\t\t\t\t\tif (!idle.isInitialized) {\n\t\t\t\t\t\t// looks like an event\n\t\t\t\t\t\tif (typeof key === 'string' && (key.startsWith('onDid') || key.startsWith('onWill'))) {\n\t\t\t\t\t\t\tlet list = earlyListeners.get(key);\n\t\t\t\t\t\t\tif (!list) {\n\t\t\t\t\t\t\t\tlist = new LinkedList();\n\t\t\t\t\t\t\t\tearlyListeners.set(key, list);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst event: Event<any> = (callback, thisArg, disposables) => {\n\t\t\t\t\t\t\t\tif (idle.isInitialized) {\n\t\t\t\t\t\t\t\t\treturn idle.value[key](callback, thisArg, disposables);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst entry: EaryListenerData = { listener: [callback, thisArg, disposables], disposable: undefined };\n\t\t\t\t\t\t\t\t\tconst rm = list.push(entry);\n\t\t\t\t\t\t\t\t\tconst result = toDisposable(() => {\n\t\t\t\t\t\t\t\t\t\trm();\n\t\t\t\t\t\t\t\t\t\tentry.disposable?.dispose();\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn event;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// value already exists\n\t\t\t\t\tif (key in target) {\n\t\t\t\t\t\treturn target[key];\n\t\t\t\t\t}\n\n\t\t\t\t\t// create value\n\t\t\t\t\tconst obj = idle.value;\n\t\t\t\t\tlet prop = obj[key];\n\t\t\t\t\tif (typeof prop !== 'function') {\n\t\t\t\t\t\treturn prop;\n\t\t\t\t\t}\n\t\t\t\t\tprop = prop.bind(obj);\n\t\t\t\t\ttarget[key] = prop;\n\t\t\t\t\treturn prop;\n\t\t\t\t},\n\t\t\t\tset(_target: T, p: PropertyKey, value: any): boolean {\n\t\t\t\t\tidle.value[p] = value;\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t\tgetPrototypeOf(_target: T) {\n\t\t\t\t\treturn ctor.prototype;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate _throwIfStrict(msg: string, printWarning: boolean): void {\n\t\tif (printWarning) {\n\t\t\tconsole.warn(msg);\n\t\t}\n\t\tif (this._strict) {\n\t\t\tthrow new Error(msg);\n\t\t}\n\t}\n}\n\n//#region -- tracing ---\n\nconst enum TraceType {\n\tNone = 0,\n\tCreation = 1,\n\tInvocation = 2,\n\tBranch = 3,\n}\n\nexport class Trace {\n\n\tstatic all = new Set<string>();\n\n\tprivate static readonly _None = new class extends Trace {\n\t\tconstructor() { super(TraceType.None, null); }\n\t\toverride stop() { }\n\t\toverride branch() { return this; }\n\t};\n\n\tstatic traceInvocation(_enableTracing: boolean, ctor: any): Trace {\n\t\treturn !_enableTracing ? Trace._None : new Trace(TraceType.Invocation, ctor.name || new Error().stack!.split('\\n').slice(3, 4).join('\\n'));\n\t}\n\n\tstatic traceCreation(_enableTracing: boolean, ctor: any): Trace {\n\t\treturn !_enableTracing ? Trace._None : new Trace(TraceType.Creation, ctor.name);\n\t}\n\n\tprivate static _totals: number = 0;\n\tprivate readonly _start: number = Date.now();\n\tprivate readonly _dep: [ServiceIdentifier<any>, boolean, Trace?][] = [];\n\n\tprivate constructor(\n\t\treadonly type: TraceType,\n\t\treadonly name: string | null\n\t) { }\n\n\tbranch(id: ServiceIdentifier<any>, first: boolean): Trace {\n\t\tconst child = new Trace(TraceType.Branch, id.toString());\n\t\tthis._dep.push([id, first, child]);\n\t\treturn child;\n\t}\n\n\tstop() {\n\t\tconst dur = Date.now() - this._start;\n\t\tTrace._totals += dur;\n\n\t\tlet causedCreation = false;\n\n\t\tfunction printChild(n: number, trace: Trace) {\n\t\t\tconst res: string[] = [];\n\t\t\tconst prefix = new Array(n + 1).join('\\t');\n\t\t\tfor (const [id, first, child] of trace._dep) {\n\t\t\t\tif (first && child) {\n\t\t\t\t\tcausedCreation = true;\n\t\t\t\t\tres.push(`${prefix}CREATES -> ${id}`);\n\t\t\t\t\tconst nested = printChild(n + 1, child);\n\t\t\t\t\tif (nested) {\n\t\t\t\t\t\tres.push(nested);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tres.push(`${prefix}uses -> ${id}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res.join('\\n');\n\t\t}\n\n\t\tconst lines = [\n\t\t\t`${this.type === TraceType.Creation ? 'CREATE' : 'CALL'} ${this.name}`,\n\t\t\t`${printChild(1, this)}`,\n\t\t\t`DONE, took ${dur.toFixed(2)}ms (grand total ${Trace._totals.toFixed(2)}ms)`\n\t\t];\n\n\t\tif (dur > 2 || causedCreation) {\n\t\t\tTrace.all.add(lines.join('\\n'));\n\t\t}\n\t}\n}\n\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { env } from '../../../base/common/process.js';\nimport { IProductConfiguration } from '../../../base/common/product.js';\nimport { ISandboxConfiguration } from '../../../base/parts/sandbox/common/sandboxTypes.js';\n\n/**\n * @deprecated It is preferred that you use `IProductService` if you can. This\n * allows web embedders to override our defaults. But for things like `product.quality`,\n * the use is fine because that property is not overridable.\n */\nlet product: IProductConfiguration;\n\n// Native sandbox environment\nconst vscodeGlobal = (globalThis as any).vscode;\nif (typeof vscodeGlobal !== 'undefined' && typeof vscodeGlobal.context !== 'undefined') {\n\tconst configuration: ISandboxConfiguration | undefined = vscodeGlobal.context.configuration();\n\tif (configuration) {\n\t\tproduct = configuration.product;\n\t} else {\n\t\tthrow new Error('Sandbox: unable to resolve product configuration from preload script.');\n\t}\n}\n// _VSCODE environment\nelse if (globalThis._VSCODE_PRODUCT_JSON && globalThis._VSCODE_PACKAGE_JSON) {\n\t// Obtain values from product.json and package.json-data\n\tproduct = globalThis._VSCODE_PRODUCT_JSON as unknown as IProductConfiguration;\n\n\t// Running out of sources\n\tif (env['VSCODE_DEV']) {\n\t\tObject.assign(product, {\n\t\t\tnameShort: `${product.nameShort} Dev`,\n\t\t\tnameLong: `${product.nameLong} Dev`,\n\t\t\tdataFolderName: `${product.dataFolderName}-dev`,\n\t\t\tserverDataFolderName: product.serverDataFolderName ? `${product.serverDataFolderName}-dev` : undefined\n\t\t});\n\t}\n\n\t// Version is added during built time, but we still\n\t// want to have it running out of sources so we\n\t// read it from package.json only when we need it.\n\tif (!product.version) {\n\t\tconst pkg = globalThis._VSCODE_PACKAGE_JSON as { version: string };\n\n\t\tObject.assign(product, {\n\t\t\tversion: pkg.version\n\t\t});\n\t}\n\n\tObject.assign(product, {\n\t\textensionsGallery: env.EXTENSIONS_GALLERY ? JSON.parse(env.EXTENSIONS_GALLERY) : (product.extensionsGallery || {\n\t\t\tserviceUrl: \"https://open-vsx.org/vscode/gallery\",\n\t\t\titemUrl: \"https://open-vsx.org/vscode/item\",\n\t\t\tresourceUrlTemplate: \"https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}\",\n\t\t\tcontrolUrl: \"\",\n\t\t\trecommendationsUrl: \"\",\n\t\t}),\n\t\ttelemetryEndpoint: env.CS_TELEMETRY_URL || product.telemetryEndpoint || \"https://v1.telemetry.coder.com/track\",\n\t});\n}\n\n// Web environment or unknown\nelse {\n\n\t// Built time configuration (do NOT modify)\n\tproduct = { /*BUILD->INSERT_PRODUCT_CONFIGURATION*/ } as any;\n\n\t// Running out of sources\n\tif (Object.keys(product).length === 0) {\n\t\tObject.assign(product, {\n\t\t\tversion: '1.102.0-dev',\n\t\t\tnameShort: 'Code - OSS Dev',\n\t\t\tnameLong: 'Code - OSS Dev',\n\t\t\tapplicationName: 'code-oss',\n\t\t\tdataFolderName: '.vscode-oss',\n\t\t\turlProtocol: 'code-oss',\n\t\t\treportIssueUrl: 'https://github.com/microsoft/vscode/issues/new',\n\t\t\tlicenseName: 'MIT',\n\t\t\tlicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt',\n\t\t\tserverLicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt'\n\t\t});\n\t}\n}\n\nexport default product;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { canceled } from '../../../base/common/errors.js';\nimport { IDataTransformer, IErrorTransformer, WriteableStream } from '../../../base/common/stream.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { createFileSystemProviderError, ensureFileSystemProviderError, IFileReadStreamOptions, FileSystemProviderErrorCode, IFileSystemProviderWithOpenReadWriteCloseCapability } from './files.js';\n\nexport interface ICreateReadStreamOptions extends IFileReadStreamOptions {\n\n\t/**\n\t * The size of the buffer to use before sending to the stream.\n\t */\n\treadonly bufferSize: number;\n\n\t/**\n\t * Allows to massage any possibly error that happens during reading.\n\t */\n\treadonly errorTransformer?: IErrorTransformer;\n}\n\n/**\n * A helper to read a file from a provider with open/read/close capability into a stream.\n */\nexport async function readFileIntoStream<T>(\n\tprovider: IFileSystemProviderWithOpenReadWriteCloseCapability,\n\tresource: URI,\n\ttarget: WriteableStream<T>,\n\ttransformer: IDataTransformer<VSBuffer, T>,\n\toptions: ICreateReadStreamOptions,\n\ttoken: CancellationToken\n): Promise<void> {\n\tlet error: Error | undefined = undefined;\n\n\ttry {\n\t\tawait doReadFileIntoStream(provider, resource, target, transformer, options, token);\n\t} catch (err) {\n\t\terror = err;\n\t} finally {\n\t\tif (error && options.errorTransformer) {\n\t\t\terror = options.errorTransformer(error);\n\t\t}\n\n\t\tif (typeof error !== 'undefined') {\n\t\t\ttarget.error(error);\n\t\t}\n\n\t\ttarget.end();\n\t}\n}\n\nasync function doReadFileIntoStream<T>(provider: IFileSystemProviderWithOpenReadWriteCloseCapability, resource: URI, target: WriteableStream<T>, transformer: IDataTransformer<VSBuffer, T>, options: ICreateReadStreamOptions, token: CancellationToken): Promise<void> {\n\n\t// Check for cancellation\n\tthrowIfCancelled(token);\n\n\t// open handle through provider\n\tconst handle = await provider.open(resource, { create: false });\n\n\ttry {\n\n\t\t// Check for cancellation\n\t\tthrowIfCancelled(token);\n\n\t\tlet totalBytesRead = 0;\n\t\tlet bytesRead = 0;\n\t\tlet allowedRemainingBytes = (options && typeof options.length === 'number') ? options.length : undefined;\n\n\t\tlet buffer = VSBuffer.alloc(Math.min(options.bufferSize, typeof allowedRemainingBytes === 'number' ? allowedRemainingBytes : options.bufferSize));\n\n\t\tlet posInFile = options && typeof options.position === 'number' ? options.position : 0;\n\t\tlet posInBuffer = 0;\n\t\tdo {\n\t\t\t// read from source (handle) at current position (pos) into buffer (buffer) at\n\t\t\t// buffer position (posInBuffer) up to the size of the buffer (buffer.byteLength).\n\t\t\tbytesRead = await provider.read(handle, posInFile, buffer.buffer, posInBuffer, buffer.byteLength - posInBuffer);\n\n\t\t\tposInFile += bytesRead;\n\t\t\tposInBuffer += bytesRead;\n\t\t\ttotalBytesRead += bytesRead;\n\n\t\t\tif (typeof allowedRemainingBytes === 'number') {\n\t\t\t\tallowedRemainingBytes -= bytesRead;\n\t\t\t}\n\n\t\t\t// when buffer full, create a new one and emit it through stream\n\t\t\tif (posInBuffer === buffer.byteLength) {\n\t\t\t\tawait target.write(transformer(buffer));\n\n\t\t\t\tbuffer = VSBuffer.alloc(Math.min(options.bufferSize, typeof allowedRemainingBytes === 'number' ? allowedRemainingBytes : options.bufferSize));\n\n\t\t\t\tposInBuffer = 0;\n\t\t\t}\n\t\t} while (bytesRead > 0 && (typeof allowedRemainingBytes !== 'number' || allowedRemainingBytes > 0) && throwIfCancelled(token) && throwIfTooLarge(totalBytesRead, options));\n\n\t\t// wrap up with last buffer (also respect maxBytes if provided)\n\t\tif (posInBuffer > 0) {\n\t\t\tlet lastChunkLength = posInBuffer;\n\t\t\tif (typeof allowedRemainingBytes === 'number') {\n\t\t\t\tlastChunkLength = Math.min(posInBuffer, allowedRemainingBytes);\n\t\t\t}\n\n\t\t\ttarget.write(transformer(buffer.slice(0, lastChunkLength)));\n\t\t}\n\t} catch (error) {\n\t\tthrow ensureFileSystemProviderError(error);\n\t} finally {\n\t\tawait provider.close(handle);\n\t}\n}\n\nfunction throwIfCancelled(token: CancellationToken): boolean {\n\tif (token.isCancellationRequested) {\n\t\tthrow canceled();\n\t}\n\n\treturn true;\n}\n\nfunction throwIfTooLarge(totalBytesRead: number, options: ICreateReadStreamOptions): boolean {\n\n\t// Return early if file is too large to load and we have configured limits\n\tif (typeof options?.limits?.size === 'number' && totalBytesRead > options.limits.size) {\n\t\tthrow createFileSystemProviderError(localize('fileTooLargeError', \"File is too large to open\"), FileSystemProviderErrorCode.FileTooLarge);\n\t}\n\n\treturn true;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { coalesce } from '../../../base/common/arrays.js';\nimport { Promises, ResourceQueue } from '../../../base/common/async.js';\nimport { bufferedStreamToBuffer, bufferToReadable, newWriteableBufferStream, readableToBuffer, streamToBuffer, VSBuffer, VSBufferReadable, VSBufferReadableBufferedStream, VSBufferReadableStream } from '../../../base/common/buffer.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../base/common/cancellation.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { hash } from '../../../base/common/hash.js';\nimport { Iterable } from '../../../base/common/iterator.js';\nimport { Disposable, DisposableStore, dispose, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { TernarySearchTree } from '../../../base/common/ternarySearchTree.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { mark } from '../../../base/common/performance.js';\nimport { extUri, extUriIgnorePathCase, IExtUri, isAbsolutePath } from '../../../base/common/resources.js';\nimport { consumeStream, isReadableBufferedStream, isReadableStream, listenStream, newWriteableStream, peekReadable, peekStream, transform } from '../../../base/common/stream.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { ensureFileSystemProviderError, etag, ETAG_DISABLED, FileChangesEvent, IFileDeleteOptions, FileOperation, FileOperationError, FileOperationEvent, FileOperationResult, FilePermission, FileSystemProviderCapabilities, FileSystemProviderErrorCode, FileType, hasFileAtomicReadCapability, hasFileFolderCopyCapability, hasFileReadStreamCapability, hasOpenReadWriteCloseCapability, hasReadWriteCapability, ICreateFileOptions, IFileContent, IFileService, IFileStat, IFileStatWithMetadata, IFileStreamContent, IFileSystemProvider, IFileSystemProviderActivationEvent, IFileSystemProviderCapabilitiesChangeEvent, IFileSystemProviderRegistrationEvent, IFileSystemProviderWithFileAtomicReadCapability, IFileSystemProviderWithFileReadStreamCapability, IFileSystemProviderWithFileReadWriteCapability, IFileSystemProviderWithOpenReadWriteCloseCapability, IReadFileOptions, IReadFileStreamOptions, IResolveFileOptions, IFileStatResult, IFileStatResultWithMetadata, IResolveMetadataFileOptions, IStat, IFileStatWithPartialMetadata, IWatchOptions, IWriteFileOptions, NotModifiedSinceFileOperationError, toFileOperationResult, toFileSystemProviderErrorCode, hasFileCloneCapability, TooLargeFileOperationError, hasFileAtomicDeleteCapability, hasFileAtomicWriteCapability, IWatchOptionsWithCorrelation, IFileSystemWatcher, IWatchOptionsWithoutCorrelation, hasFileRealpathCapability } from './files.js';\nimport { readFileIntoStream } from './io.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { ErrorNoTelemetry } from '../../../base/common/errors.js';\n\nexport class FileService extends Disposable implements IFileService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\t// Choose a buffer size that is a balance between memory needs and\n\t// manageable IPC overhead. The larger the buffer size, the less\n\t// roundtrips we have to do for reading/writing data.\n\tprivate readonly BUFFER_SIZE = 256 * 1024;\n\n\tconstructor(@ILogService private readonly logService: ILogService) {\n\t\tsuper();\n\t}\n\n\t//#region File System Provider\n\n\tprivate readonly _onDidChangeFileSystemProviderRegistrations = this._register(new Emitter<IFileSystemProviderRegistrationEvent>());\n\treadonly onDidChangeFileSystemProviderRegistrations = this._onDidChangeFileSystemProviderRegistrations.event;\n\n\tprivate readonly _onWillActivateFileSystemProvider = this._register(new Emitter<IFileSystemProviderActivationEvent>());\n\treadonly onWillActivateFileSystemProvider = this._onWillActivateFileSystemProvider.event;\n\n\tprivate readonly _onDidChangeFileSystemProviderCapabilities = this._register(new Emitter<IFileSystemProviderCapabilitiesChangeEvent>());\n\treadonly onDidChangeFileSystemProviderCapabilities = this._onDidChangeFileSystemProviderCapabilities.event;\n\n\tprivate readonly provider = new Map<string, IFileSystemProvider>();\n\n\tregisterProvider(scheme: string, provider: IFileSystemProvider): IDisposable {\n\t\tif (this.provider.has(scheme)) {\n\t\t\tthrow new Error(`A filesystem provider for the scheme '${scheme}' is already registered.`);\n\t\t}\n\n\t\tmark(`code/registerFilesystem/${scheme}`);\n\n\t\tconst providerDisposables = new DisposableStore();\n\n\t\t// Add provider with event\n\t\tthis.provider.set(scheme, provider);\n\t\tthis._onDidChangeFileSystemProviderRegistrations.fire({ added: true, scheme, provider });\n\n\t\t// Forward events from provider\n\t\tproviderDisposables.add(provider.onDidChangeFile(changes => {\n\t\t\tconst event = new FileChangesEvent(changes, !this.isPathCaseSensitive(provider));\n\n\t\t\t// Always emit any event internally\n\t\t\tthis.internalOnDidFilesChange.fire(event);\n\n\t\t\t// Only emit uncorrelated events in the global `onDidFilesChange` event\n\t\t\tif (!event.hasCorrelation()) {\n\t\t\t\tthis._onDidUncorrelatedFilesChange.fire(event);\n\t\t\t}\n\t\t}));\n\t\tif (typeof provider.onDidWatchError === 'function') {\n\t\t\tproviderDisposables.add(provider.onDidWatchError(error => this._onDidWatchError.fire(new Error(error))));\n\t\t}\n\t\tproviderDisposables.add(provider.onDidChangeCapabilities(() => this._onDidChangeFileSystemProviderCapabilities.fire({ provider, scheme })));\n\n\t\treturn toDisposable(() => {\n\t\t\tthis._onDidChangeFileSystemProviderRegistrations.fire({ added: false, scheme, provider });\n\t\t\tthis.provider.delete(scheme);\n\n\t\t\tdispose(providerDisposables);\n\t\t});\n\t}\n\n\tgetProvider(scheme: string): IFileSystemProvider | undefined {\n\t\treturn this.provider.get(scheme);\n\t}\n\n\tasync activateProvider(scheme: string): Promise<void> {\n\n\t\t// Emit an event that we are about to activate a provider with the given scheme.\n\t\t// Listeners can participate in the activation by registering a provider for it.\n\t\tconst joiners: Promise<void>[] = [];\n\t\tthis._onWillActivateFileSystemProvider.fire({\n\t\t\tscheme,\n\t\t\tjoin(promise) {\n\t\t\t\tjoiners.push(promise);\n\t\t\t},\n\t\t});\n\n\t\tif (this.provider.has(scheme)) {\n\t\t\treturn; // provider is already here so we can return directly\n\t\t}\n\n\t\t// If the provider is not yet there, make sure to join on the listeners assuming\n\t\t// that it takes a bit longer to register the file system provider.\n\t\tawait Promises.settled(joiners);\n\t}\n\n\tasync canHandleResource(resource: URI): Promise<boolean> {\n\n\t\t// Await activation of potentially extension contributed providers\n\t\tawait this.activateProvider(resource.scheme);\n\n\t\treturn this.hasProvider(resource);\n\t}\n\n\thasProvider(resource: URI): boolean {\n\t\treturn this.provider.has(resource.scheme);\n\t}\n\n\thasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean {\n\t\tconst provider = this.provider.get(resource.scheme);\n\n\t\treturn !!(provider && (provider.capabilities & capability));\n\t}\n\n\tlistCapabilities(): Iterable<{ scheme: string; capabilities: FileSystemProviderCapabilities }> {\n\t\treturn Iterable.map(this.provider, ([scheme, provider]) => ({ scheme, capabilities: provider.capabilities }));\n\t}\n\n\tprotected async withProvider(resource: URI): Promise<IFileSystemProvider> {\n\n\t\t// Assert path is absolute\n\t\tif (!isAbsolutePath(resource)) {\n\t\t\tthrow new FileOperationError(localize('invalidPath', \"Unable to resolve filesystem provider with relative file path '{0}'\", this.resourceForError(resource)), FileOperationResult.FILE_INVALID_PATH);\n\t\t}\n\n\t\t// Activate provider\n\t\tawait this.activateProvider(resource.scheme);\n\n\t\t// Assert provider\n\t\tconst provider = this.provider.get(resource.scheme);\n\t\tif (!provider) {\n\t\t\tconst error = new ErrorNoTelemetry();\n\t\t\terror.message = localize('noProviderFound', \"ENOPRO: No file system provider found for resource '{0}'\", resource.toString());\n\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn provider;\n\t}\n\n\tprivate async withReadProvider(resource: URI): Promise<IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithOpenReadWriteCloseCapability | IFileSystemProviderWithFileReadStreamCapability> {\n\t\tconst provider = await this.withProvider(resource);\n\n\t\tif (hasOpenReadWriteCloseCapability(provider) || hasReadWriteCapability(provider) || hasFileReadStreamCapability(provider)) {\n\t\t\treturn provider;\n\t\t}\n\n\t\tthrow new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`);\n\t}\n\n\tprivate async withWriteProvider(resource: URI): Promise<IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithOpenReadWriteCloseCapability> {\n\t\tconst provider = await this.withProvider(resource);\n\n\t\tif (hasOpenReadWriteCloseCapability(provider) || hasReadWriteCapability(provider)) {\n\t\t\treturn provider;\n\t\t}\n\n\t\tthrow new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`);\n\t}\n\n\t//#endregion\n\n\t//#region Operation events\n\n\tprivate readonly _onDidRunOperation = this._register(new Emitter<FileOperationEvent>());\n\treadonly onDidRunOperation = this._onDidRunOperation.event;\n\n\t//#endregion\n\n\t//#region File Metadata Resolving\n\n\tasync resolve(resource: URI, options: IResolveMetadataFileOptions): Promise<IFileStatWithMetadata>;\n\tasync resolve(resource: URI, options?: IResolveFileOptions): Promise<IFileStat>;\n\tasync resolve(resource: URI, options?: IResolveFileOptions): Promise<IFileStat> {\n\t\ttry {\n\t\t\treturn await this.doResolveFile(resource, options);\n\t\t} catch (error) {\n\n\t\t\t// Specially handle file not found case as file operation result\n\t\t\tif (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {\n\t\t\t\tthrow new FileOperationError(localize('fileNotFoundError', \"Unable to resolve nonexistent file '{0}'\", this.resourceForError(resource)), FileOperationResult.FILE_NOT_FOUND);\n\t\t\t}\n\n\t\t\t// Bubble up any other error as is\n\t\t\tthrow ensureFileSystemProviderError(error);\n\t\t}\n\t}\n\n\tprivate async doResolveFile(resource: URI, options: IResolveMetadataFileOptions): Promise<IFileStatWithMetadata>;\n\tprivate async doResolveFile(resource: URI, options?: IResolveFileOptions): Promise<IFileStat>;\n\tprivate async doResolveFile(resource: URI, options?: IResolveFileOptions): Promise<IFileStat> {\n\t\tconst provider = await this.withProvider(resource);\n\t\tconst isPathCaseSensitive = this.isPathCaseSensitive(provider);\n\n\t\tconst resolveTo = options?.resolveTo;\n\t\tconst resolveSingleChildDescendants = options?.resolveSingleChildDescendants;\n\t\tconst resolveMetadata = options?.resolveMetadata;\n\n\t\tconst stat = await provider.stat(resource);\n\n\t\tlet trie: TernarySearchTree<URI, boolean> | undefined;\n\n\t\treturn this.toFileStat(provider, resource, stat, undefined, !!resolveMetadata, (stat, siblings) => {\n\n\t\t\t// lazy trie to check for recursive resolving\n\t\t\tif (!trie) {\n\t\t\t\ttrie = TernarySearchTree.forUris<true>(() => !isPathCaseSensitive);\n\t\t\t\ttrie.set(resource, true);\n\t\t\t\tif (resolveTo) {\n\t\t\t\t\ttrie.fill(true, resolveTo);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// check for recursive resolving\n\t\t\tif (trie.get(stat.resource) || trie.findSuperstr(stat.resource.with({ query: null, fragment: null } /* required for https://github.com/microsoft/vscode/issues/128151 */))) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// check for resolving single child folders\n\t\t\tif (stat.isDirectory && resolveSingleChildDescendants) {\n\t\t\t\treturn siblings === 1;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t});\n\t}\n\n\tprivate async toFileStat(provider: IFileSystemProvider, resource: URI, stat: IStat | { type: FileType } & Partial<IStat>, siblings: number | undefined, resolveMetadata: boolean, recurse: (stat: IFileStat, siblings?: number) => boolean): Promise<IFileStat>;\n\tprivate async toFileStat(provider: IFileSystemProvider, resource: URI, stat: IStat, siblings: number | undefined, resolveMetadata: true, recurse: (stat: IFileStat, siblings?: number) => boolean): Promise<IFileStatWithMetadata>;\n\tprivate async toFileStat(provider: IFileSystemProvider, resource: URI, stat: IStat | { type: FileType } & Partial<IStat>, siblings: number | undefined, resolveMetadata: boolean, recurse: (stat: IFileStat, siblings?: number) => boolean): Promise<IFileStat> {\n\t\tconst { providerExtUri } = this.getExtUri(provider);\n\n\t\t// convert to file stat\n\t\tconst fileStat: IFileStat = {\n\t\t\tresource,\n\t\t\tname: providerExtUri.basename(resource),\n\t\t\tisFile: (stat.type & FileType.File) !== 0,\n\t\t\tisDirectory: (stat.type & FileType.Directory) !== 0,\n\t\t\tisSymbolicLink: (stat.type & FileType.SymbolicLink) !== 0,\n\t\t\tmtime: stat.mtime,\n\t\t\tctime: stat.ctime,\n\t\t\tsize: stat.size,\n\t\t\treadonly: Boolean((stat.permissions ?? 0) & FilePermission.Readonly) || Boolean(provider.capabilities & FileSystemProviderCapabilities.Readonly),\n\t\t\tlocked: Boolean((stat.permissions ?? 0) & FilePermission.Locked),\n\t\t\tetag: etag({ mtime: stat.mtime, size: stat.size }),\n\t\t\tchildren: undefined\n\t\t};\n\n\t\t// check to recurse for directories\n\t\tif (fileStat.isDirectory && recurse(fileStat, siblings)) {\n\t\t\ttry {\n\t\t\t\tconst entries = await provider.readdir(resource);\n\t\t\t\tconst resolvedEntries = await Promises.settled(entries.map(async ([name, type]) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst childResource = providerExtUri.joinPath(resource, name);\n\t\t\t\t\t\tconst childStat = resolveMetadata ? await provider.stat(childResource) : { type };\n\n\t\t\t\t\t\treturn await this.toFileStat(provider, childResource, childStat, entries.length, resolveMetadata, recurse);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthis.logService.trace(error);\n\n\t\t\t\t\t\treturn null; // can happen e.g. due to permission errors\n\t\t\t\t\t}\n\t\t\t\t}));\n\n\t\t\t\t// make sure to get rid of null values that signal a failure to resolve a particular entry\n\t\t\t\tfileStat.children = coalesce(resolvedEntries);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.trace(error);\n\n\t\t\t\tfileStat.children = []; // gracefully handle errors, we may not have permissions to read\n\t\t\t}\n\n\t\t\treturn fileStat;\n\t\t}\n\n\t\treturn fileStat;\n\t}\n\n\tasync resolveAll(toResolve: { resource: URI; options?: IResolveFileOptions }[]): Promise<IFileStatResult[]>;\n\tasync resolveAll(toResolve: { resource: URI; options: IResolveMetadataFileOptions }[]): Promise<IFileStatResultWithMetadata[]>;\n\tasync resolveAll(toResolve: { resource: URI; options?: IResolveFileOptions }[]): Promise<IFileStatResult[]> {\n\t\treturn Promises.settled(toResolve.map(async entry => {\n\t\t\ttry {\n\t\t\t\treturn { stat: await this.doResolveFile(entry.resource, entry.options), success: true };\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.trace(error);\n\n\t\t\t\treturn { stat: undefined, success: false };\n\t\t\t}\n\t\t}));\n\t}\n\n\tasync stat(resource: URI): Promise<IFileStatWithPartialMetadata> {\n\t\tconst provider = await this.withProvider(resource);\n\n\t\tconst stat = await provider.stat(resource);\n\n\t\treturn this.toFileStat(provider, resource, stat, undefined, true, () => false /* Do not resolve any children */);\n\t}\n\n\tasync realpath(resource: URI): Promise<URI | undefined> {\n\t\tconst provider = await this.withProvider(resource);\n\n\t\tif (hasFileRealpathCapability(provider)) {\n\t\t\tconst realpath = await provider.realpath(resource);\n\n\t\t\treturn resource.with({ path: realpath });\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tasync exists(resource: URI): Promise<boolean> {\n\t\tconst provider = await this.withProvider(resource);\n\n\t\ttry {\n\t\t\tconst stat = await provider.stat(resource);\n\n\t\t\treturn !!stat;\n\t\t} catch (error) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t//#endregion\n\n\t//#region File Reading/Writing\n\n\tasync canCreateFile(resource: URI, options?: ICreateFileOptions): Promise<Error | true> {\n\t\ttry {\n\t\t\tawait this.doValidateCreateFile(resource, options);\n\t\t} catch (error) {\n\t\t\treturn error;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate async doValidateCreateFile(resource: URI, options?: ICreateFileOptions): Promise<void> {\n\n\t\t// validate overwrite\n\t\tif (!options?.overwrite && await this.exists(resource)) {\n\t\t\tthrow new FileOperationError(localize('fileExists', \"Unable to create file '{0}' that already exists when overwrite flag is not set\", this.resourceForError(resource)), FileOperationResult.FILE_MODIFIED_SINCE, options);\n\t\t}\n\t}\n\n\tasync createFile(resource: URI, bufferOrReadableOrStream: VSBuffer | VSBufferReadable | VSBufferReadableStream = VSBuffer.fromString(''), options?: ICreateFileOptions): Promise<IFileStatWithMetadata> {\n\n\t\t// validate\n\t\tawait this.doValidateCreateFile(resource, options);\n\n\t\t// do write into file (this will create it too)\n\t\tconst fileStat = await this.writeFile(resource, bufferOrReadableOrStream);\n\n\t\t// events\n\t\tthis._onDidRunOperation.fire(new FileOperationEvent(resource, FileOperation.CREATE, fileStat));\n\n\t\treturn fileStat;\n\t}\n\n\tasync writeFile(resource: URI, bufferOrReadableOrStream: VSBuffer | VSBufferReadable | VSBufferReadableStream, options?: IWriteFileOptions): Promise<IFileStatWithMetadata> {\n\t\tconst provider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(resource), resource);\n\t\tconst { providerExtUri } = this.getExtUri(provider);\n\n\t\tlet writeFileOptions = options;\n\t\tif (hasFileAtomicWriteCapability(provider) && !writeFileOptions?.atomic) {\n\t\t\tconst enforcedAtomicWrite = provider.enforceAtomicWriteFile?.(resource);\n\t\t\tif (enforcedAtomicWrite) {\n\t\t\t\twriteFileOptions = { ...options, atomic: enforcedAtomicWrite };\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\n\t\t\t// validate write (this may already return a peeked-at buffer)\n\t\t\tlet { stat, buffer: bufferOrReadableOrStreamOrBufferedStream } = await this.validateWriteFile(provider, resource, bufferOrReadableOrStream, writeFileOptions);\n\n\t\t\t// mkdir recursively as needed\n\t\t\tif (!stat) {\n\t\t\t\tawait this.mkdirp(provider, providerExtUri.dirname(resource));\n\t\t\t}\n\n\t\t\t// optimization: if the provider has unbuffered write capability and the data\n\t\t\t// to write is not a buffer, we consume up to 3 chunks and try to write the data\n\t\t\t// unbuffered to reduce the overhead. If the stream or readable has more data\n\t\t\t// to provide we continue to write buffered.\n\t\t\tif (!bufferOrReadableOrStreamOrBufferedStream) {\n\t\t\t\tbufferOrReadableOrStreamOrBufferedStream = await this.peekBufferForWriting(provider, bufferOrReadableOrStream);\n\t\t\t}\n\n\t\t\t// write file: unbuffered\n\t\t\tif (\n\t\t\t\t!hasOpenReadWriteCloseCapability(provider) ||\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// buffered writing is unsupported\n\t\t\t\t(hasReadWriteCapability(provider) && bufferOrReadableOrStreamOrBufferedStream instanceof VSBuffer) ||\t\t// data is a full buffer already\n\t\t\t\t(hasReadWriteCapability(provider) && hasFileAtomicWriteCapability(provider) && writeFileOptions?.atomic)\t// atomic write forces unbuffered write if the provider supports it\n\t\t\t) {\n\t\t\t\tawait this.doWriteUnbuffered(provider, resource, writeFileOptions, bufferOrReadableOrStreamOrBufferedStream);\n\t\t\t}\n\n\t\t\t// write file: buffered\n\t\t\telse {\n\t\t\t\tawait this.doWriteBuffered(provider, resource, writeFileOptions, bufferOrReadableOrStreamOrBufferedStream instanceof VSBuffer ? bufferToReadable(bufferOrReadableOrStreamOrBufferedStream) : bufferOrReadableOrStreamOrBufferedStream);\n\t\t\t}\n\n\t\t\t// events\n\t\t\tthis._onDidRunOperation.fire(new FileOperationEvent(resource, FileOperation.WRITE));\n\t\t} catch (error) {\n\t\t\tthrow new FileOperationError(localize('err.write', \"Unable to write file '{0}' ({1})\", this.resourceForError(resource), ensureFileSystemProviderError(error).toString()), toFileOperationResult(error), writeFileOptions);\n\t\t}\n\n\t\treturn this.resolve(resource, { resolveMetadata: true });\n\t}\n\n\n\tprivate async peekBufferForWriting(provider: IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithOpenReadWriteCloseCapability, bufferOrReadableOrStream: VSBuffer | VSBufferReadable | VSBufferReadableStream): Promise<VSBuffer | VSBufferReadable | VSBufferReadableStream | VSBufferReadableBufferedStream> {\n\t\tlet peekResult: VSBuffer | VSBufferReadable | VSBufferReadableStream | VSBufferReadableBufferedStream;\n\t\tif (hasReadWriteCapability(provider) && !(bufferOrReadableOrStream instanceof VSBuffer)) {\n\t\t\tif (isReadableStream(bufferOrReadableOrStream)) {\n\t\t\t\tconst bufferedStream = await peekStream(bufferOrReadableOrStream, 3);\n\t\t\t\tif (bufferedStream.ended) {\n\t\t\t\t\tpeekResult = VSBuffer.concat(bufferedStream.buffer);\n\t\t\t\t} else {\n\t\t\t\t\tpeekResult = bufferedStream;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpeekResult = peekReadable(bufferOrReadableOrStream, data => VSBuffer.concat(data), 3);\n\t\t\t}\n\t\t} else {\n\t\t\tpeekResult = bufferOrReadableOrStream;\n\t\t}\n\n\t\treturn peekResult;\n\t}\n\n\tprivate async validateWriteFile(provider: IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithOpenReadWriteCloseCapability, resource: URI, bufferOrReadableOrStream: VSBuffer | VSBufferReadable | VSBufferReadableStream, options?: IWriteFileOptions): Promise<{ stat: IStat | undefined; buffer: VSBuffer | VSBufferReadable | VSBufferReadableStream | VSBufferReadableBufferedStream | undefined }> {\n\n\t\t// Validate unlock support\n\t\tconst unlock = !!options?.unlock;\n\t\tif (unlock && !(provider.capabilities & FileSystemProviderCapabilities.FileWriteUnlock)) {\n\t\t\tthrow new Error(localize('writeFailedUnlockUnsupported', \"Unable to unlock file '{0}' because provider does not support it.\", this.resourceForError(resource)));\n\t\t}\n\n\t\t// Validate atomic support\n\t\tconst atomic = !!options?.atomic;\n\t\tif (atomic) {\n\t\t\tif (!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicWrite)) {\n\t\t\t\tthrow new Error(localize('writeFailedAtomicUnsupported1', \"Unable to atomically write file '{0}' because provider does not support it.\", this.resourceForError(resource)));\n\t\t\t}\n\n\t\t\tif (!(provider.capabilities & FileSystemProviderCapabilities.FileReadWrite)) {\n\t\t\t\tthrow new Error(localize('writeFailedAtomicUnsupported2', \"Unable to atomically write file '{0}' because provider does not support unbuffered writes.\", this.resourceForError(resource)));\n\t\t\t}\n\n\t\t\tif (unlock) {\n\t\t\t\tthrow new Error(localize('writeFailedAtomicUnlock', \"Unable to unlock file '{0}' because atomic write is enabled.\", this.resourceForError(resource)));\n\t\t\t}\n\t\t}\n\n\t\t// Validate via file stat meta data\n\t\tlet stat: IStat | undefined = undefined;\n\t\ttry {\n\t\t\tstat = await provider.stat(resource);\n\t\t} catch (error) {\n\t\t\treturn Object.create(null); // file might not exist\n\t\t}\n\n\t\t// File cannot be directory\n\t\tif ((stat.type & FileType.Directory) !== 0) {\n\t\t\tthrow new FileOperationError(localize('fileIsDirectoryWriteError', \"Unable to write file '{0}' that is actually a directory\", this.resourceForError(resource)), FileOperationResult.FILE_IS_DIRECTORY, options);\n\t\t}\n\n\t\t// File cannot be readonly\n\t\tthis.throwIfFileIsReadonly(resource, stat);\n\n\t\t// Dirty write prevention: if the file on disk has been changed and does not match our expected\n\t\t// mtime and etag, we bail out to prevent dirty writing.\n\t\t//\n\t\t// First, we check for a mtime that is in the future before we do more checks. The assumption is\n\t\t// that only the mtime is an indicator for a file that has changed on disk.\n\t\t//\n\t\t// Second, if the mtime has advanced, we compare the size of the file on disk with our previous\n\t\t// one using the etag() function. Relying only on the mtime check has prooven to produce false\n\t\t// positives due to file system weirdness (especially around remote file systems). As such, the\n\t\t// check for size is a weaker check because it can return a false negative if the file has changed\n\t\t// but to the same length. This is a compromise we take to avoid having to produce checksums of\n\t\t// the file content for comparison which would be much slower to compute.\n\t\t//\n\t\t// Third, if the etag() turns out to be different, we do one attempt to compare the buffer we\n\t\t// are about to write with the contents on disk to figure out if the contents are identical.\n\t\t// In that case we allow the writing as it would result in the same contents in the file.\n\t\tlet buffer: VSBuffer | VSBufferReadable | VSBufferReadableStream | VSBufferReadableBufferedStream | undefined;\n\t\tif (\n\t\t\ttypeof options?.mtime === 'number' && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED &&\n\t\t\ttypeof stat.mtime === 'number' && typeof stat.size === 'number' &&\n\t\t\toptions.mtime < stat.mtime && options.etag !== etag({ mtime: options.mtime /* not using stat.mtime for a reason, see above */, size: stat.size })\n\t\t) {\n\t\t\tbuffer = await this.peekBufferForWriting(provider, bufferOrReadableOrStream);\n\t\t\tif (buffer instanceof VSBuffer && buffer.byteLength === stat.size) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { value } = await this.readFile(resource, { limits: { size: stat.size } });\n\t\t\t\t\tif (buffer.equals(value)) {\n\t\t\t\t\t\treturn { stat, buffer }; // allow writing since contents are identical\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// ignore, throw the FILE_MODIFIED_SINCE error\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthrow new FileOperationError(localize('fileModifiedError', \"File Modified Since\"), FileOperationResult.FILE_MODIFIED_SINCE, options);\n\t\t}\n\n\t\treturn { stat, buffer };\n\t}\n\n\tasync readFile(resource: URI, options?: IReadFileOptions, token?: CancellationToken): Promise<IFileContent> {\n\t\tconst provider = await this.withReadProvider(resource);\n\n\t\tif (options?.atomic) {\n\t\t\treturn this.doReadFileAtomic(provider, resource, options, token);\n\t\t}\n\n\t\treturn this.doReadFile(provider, resource, options, token);\n\t}\n\n\tprivate async doReadFileAtomic(provider: IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithOpenReadWriteCloseCapability | IFileSystemProviderWithFileReadStreamCapability, resource: URI, options?: IReadFileOptions, token?: CancellationToken): Promise<IFileContent> {\n\t\treturn new Promise<IFileContent>((resolve, reject) => {\n\t\t\tthis.writeQueue.queueFor(resource, async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst content = await this.doReadFile(provider, resource, options, token);\n\t\t\t\t\tresolve(content);\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\t\t\t}, this.getExtUri(provider).providerExtUri);\n\t\t});\n\t}\n\n\tprivate async doReadFile(provider: IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithOpenReadWriteCloseCapability | IFileSystemProviderWithFileReadStreamCapability, resource: URI, options?: IReadFileOptions, token?: CancellationToken): Promise<IFileContent> {\n\t\tconst stream = await this.doReadFileStream(provider, resource, {\n\t\t\t...options,\n\t\t\t// optimization: since we know that the caller does not\n\t\t\t// care about buffering, we indicate this to the reader.\n\t\t\t// this reduces all the overhead the buffered reading\n\t\t\t// has (open, read, close) if the provider supports\n\t\t\t// unbuffered reading.\n\t\t\tpreferUnbuffered: true\n\t\t}, token);\n\n\t\treturn {\n\t\t\t...stream,\n\t\t\tvalue: await streamToBuffer(stream.value)\n\t\t};\n\t}\n\n\tasync readFileStream(resource: URI, options?: IReadFileStreamOptions, token?: CancellationToken): Promise<IFileStreamContent> {\n\t\tconst provider = await this.withReadProvider(resource);\n\n\t\treturn this.doReadFileStream(provider, resource, options, token);\n\t}\n\n\tprivate async doReadFileStream(provider: IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithOpenReadWriteCloseCapability | IFileSystemProviderWithFileReadStreamCapability, resource: URI, options?: IReadFileOptions & IReadFileStreamOptions & { preferUnbuffered?: boolean }, token?: CancellationToken): Promise<IFileStreamContent> {\n\n\t\t// install a cancellation token that gets cancelled\n\t\t// when any error occurs. this allows us to resolve\n\t\t// the content of the file while resolving metadata\n\t\t// but still cancel the operation in certain cases.\n\t\t//\n\t\t// in addition, we pass the optional token in that\n\t\t// we got from the outside to even allow for external\n\t\t// cancellation of the read operation.\n\t\tconst cancellableSource = new CancellationTokenSource(token);\n\n\t\tlet readFileOptions = options;\n\t\tif (hasFileAtomicReadCapability(provider) && provider.enforceAtomicReadFile?.(resource)) {\n\t\t\treadFileOptions = { ...options, atomic: true };\n\t\t}\n\n\t\t// validate read operation\n\t\tconst statPromise = this.validateReadFile(resource, readFileOptions).then(stat => stat, error => {\n\t\t\tcancellableSource.dispose(true);\n\n\t\t\tthrow error;\n\t\t});\n\n\t\tlet fileStream: VSBufferReadableStream | undefined = undefined;\n\t\ttry {\n\n\t\t\t// if the etag is provided, we await the result of the validation\n\t\t\t// due to the likelihood of hitting a NOT_MODIFIED_SINCE result.\n\t\t\t// otherwise, we let it run in parallel to the file reading for\n\t\t\t// optimal startup performance.\n\t\t\tif (typeof readFileOptions?.etag === 'string' && readFileOptions.etag !== ETAG_DISABLED) {\n\t\t\t\tawait statPromise;\n\t\t\t}\n\n\t\t\t// read unbuffered\n\t\t\tif (\n\t\t\t\t(readFileOptions?.atomic && hasFileAtomicReadCapability(provider)) ||\t\t\t\t\t\t\t\t// atomic reads are always unbuffered\n\t\t\t\t!(hasOpenReadWriteCloseCapability(provider) || hasFileReadStreamCapability(provider)) ||\t// provider has no buffered capability\n\t\t\t\t(hasReadWriteCapability(provider) && readFileOptions?.preferUnbuffered)\t\t\t\t\t\t\t\t// unbuffered read is preferred\n\t\t\t) {\n\t\t\t\tfileStream = this.readFileUnbuffered(provider, resource, readFileOptions);\n\t\t\t}\n\n\t\t\t// read streamed (always prefer over primitive buffered read)\n\t\t\telse if (hasFileReadStreamCapability(provider)) {\n\t\t\t\tfileStream = this.readFileStreamed(provider, resource, cancellableSource.token, readFileOptions);\n\t\t\t}\n\n\t\t\t// read buffered\n\t\t\telse {\n\t\t\t\tfileStream = this.readFileBuffered(provider, resource, cancellableSource.token, readFileOptions);\n\t\t\t}\n\n\t\t\tfileStream.on('end', () => cancellableSource.dispose());\n\t\t\tfileStream.on('error', () => cancellableSource.dispose());\n\n\t\t\tconst fileStat = await statPromise;\n\n\t\t\treturn {\n\t\t\t\t...fileStat,\n\t\t\t\tvalue: fileStream\n\t\t\t};\n\t\t} catch (error) {\n\n\t\t\t// Await the stream to finish so that we exit this method\n\t\t\t// in a consistent state with file handles closed\n\t\t\t// (https://github.com/microsoft/vscode/issues/114024)\n\t\t\tif (fileStream) {\n\t\t\t\tawait consumeStream(fileStream);\n\t\t\t}\n\n\t\t\t// Re-throw errors as file operation errors but preserve\n\t\t\t// specific errors (such as not modified since)\n\t\t\tthrow this.restoreReadError(error, resource, readFileOptions);\n\t\t}\n\t}\n\n\tprivate restoreReadError(error: Error, resource: URI, options?: IReadFileStreamOptions): FileOperationError {\n\t\tconst message = localize('err.read', \"Unable to read file '{0}' ({1})\", this.resourceForError(resource), ensureFileSystemProviderError(error).toString());\n\n\t\tif (error instanceof NotModifiedSinceFileOperationError) {\n\t\t\treturn new NotModifiedSinceFileOperationError(message, error.stat, options);\n\t\t}\n\n\t\tif (error instanceof TooLargeFileOperationError) {\n\t\t\treturn new TooLargeFileOperationError(message, error.fileOperationResult, error.size, error.options as IReadFileOptions);\n\t\t}\n\n\t\treturn new FileOperationError(message, toFileOperationResult(error), options);\n\t}\n\n\tprivate readFileStreamed(provider: IFileSystemProviderWithFileReadStreamCapability, resource: URI, token: CancellationToken, options: IReadFileStreamOptions = Object.create(null)): VSBufferReadableStream {\n\t\tconst fileStream = provider.readFileStream(resource, options, token);\n\n\t\treturn transform(fileStream, {\n\t\t\tdata: data => data instanceof VSBuffer ? data : VSBuffer.wrap(data),\n\t\t\terror: error => this.restoreReadError(error, resource, options)\n\t\t}, data => VSBuffer.concat(data));\n\t}\n\n\tprivate readFileBuffered(provider: IFileSystemProviderWithOpenReadWriteCloseCapability, resource: URI, token: CancellationToken, options: IReadFileStreamOptions = Object.create(null)): VSBufferReadableStream {\n\t\tconst stream = newWriteableBufferStream();\n\n\t\treadFileIntoStream(provider, resource, stream, data => data, {\n\t\t\t...options,\n\t\t\tbufferSize: this.BUFFER_SIZE,\n\t\t\terrorTransformer: error => this.restoreReadError(error, resource, options)\n\t\t}, token);\n\n\t\treturn stream;\n\t}\n\n\tprivate readFileUnbuffered(provider: IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithFileAtomicReadCapability, resource: URI, options?: IReadFileOptions & IReadFileStreamOptions): VSBufferReadableStream {\n\t\tconst stream = newWriteableStream<VSBuffer>(data => VSBuffer.concat(data));\n\n\t\t// Read the file into the stream async but do not wait for\n\t\t// this to complete because streams work via events\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tlet buffer: Uint8Array;\n\t\t\t\tif (options?.atomic && hasFileAtomicReadCapability(provider)) {\n\t\t\t\t\tbuffer = await provider.readFile(resource, { atomic: true });\n\t\t\t\t} else {\n\t\t\t\t\tbuffer = await provider.readFile(resource);\n\t\t\t\t}\n\n\t\t\t\t// respect position option\n\t\t\t\tif (typeof options?.position === 'number') {\n\t\t\t\t\tbuffer = buffer.slice(options.position);\n\t\t\t\t}\n\n\t\t\t\t// respect length option\n\t\t\t\tif (typeof options?.length === 'number') {\n\t\t\t\t\tbuffer = buffer.slice(0, options.length);\n\t\t\t\t}\n\n\t\t\t\t// Throw if file is too large to load\n\t\t\t\tthis.validateReadFileLimits(resource, buffer.byteLength, options);\n\n\t\t\t\t// End stream with data\n\t\t\t\tstream.end(VSBuffer.wrap(buffer));\n\t\t\t} catch (err) {\n\t\t\t\tstream.error(err);\n\t\t\t\tstream.end();\n\t\t\t}\n\t\t})();\n\n\t\treturn stream;\n\t}\n\n\tprivate async validateReadFile(resource: URI, options?: IReadFileStreamOptions): Promise<IFileStatWithMetadata> {\n\t\tconst stat = await this.resolve(resource, { resolveMetadata: true });\n\n\t\t// Throw if resource is a directory\n\t\tif (stat.isDirectory) {\n\t\t\tthrow new FileOperationError(localize('fileIsDirectoryReadError', \"Unable to read file '{0}' that is actually a directory\", this.resourceForError(resource)), FileOperationResult.FILE_IS_DIRECTORY, options);\n\t\t}\n\n\t\t// Throw if file not modified since (unless disabled)\n\t\tif (typeof options?.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {\n\t\t\tthrow new NotModifiedSinceFileOperationError(localize('fileNotModifiedError', \"File not modified since\"), stat, options);\n\t\t}\n\n\t\t// Throw if file is too large to load\n\t\tthis.validateReadFileLimits(resource, stat.size, options);\n\n\t\treturn stat;\n\t}\n\n\tprivate validateReadFileLimits(resource: URI, size: number, options?: IReadFileStreamOptions): void {\n\t\tif (typeof options?.limits?.size === 'number' && size > options.limits.size) {\n\t\t\tthrow new TooLargeFileOperationError(localize('fileTooLargeError', \"Unable to read file '{0}' that is too large to open\", this.resourceForError(resource)), FileOperationResult.FILE_TOO_LARGE, size, options);\n\t\t}\n\t}\n\n\t//#endregion\n\n\t//#region Move/Copy/Delete/Create Folder\n\n\tasync canMove(source: URI, target: URI, overwrite?: boolean): Promise<Error | true> {\n\t\treturn this.doCanMoveCopy(source, target, 'move', overwrite);\n\t}\n\n\tasync canCopy(source: URI, target: URI, overwrite?: boolean): Promise<Error | true> {\n\t\treturn this.doCanMoveCopy(source, target, 'copy', overwrite);\n\t}\n\n\tprivate async doCanMoveCopy(source: URI, target: URI, mode: 'move' | 'copy', overwrite?: boolean): Promise<Error | true> {\n\t\tif (source.toString() !== target.toString()) {\n\t\t\ttry {\n\t\t\t\tconst sourceProvider = mode === 'move' ? this.throwIfFileSystemIsReadonly(await this.withWriteProvider(source), source) : await this.withReadProvider(source);\n\t\t\t\tconst targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);\n\n\t\t\t\tawait this.doValidateMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite);\n\t\t\t} catch (error) {\n\t\t\t\treturn error;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tasync move(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata> {\n\t\tconst sourceProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(source), source);\n\t\tconst targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);\n\n\t\t// move\n\t\tconst mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'move', !!overwrite);\n\n\t\t// resolve and send events\n\t\tconst fileStat = await this.resolve(target, { resolveMetadata: true });\n\t\tthis._onDidRunOperation.fire(new FileOperationEvent(source, mode === 'move' ? FileOperation.MOVE : FileOperation.COPY, fileStat));\n\n\t\treturn fileStat;\n\t}\n\n\tasync copy(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata> {\n\t\tconst sourceProvider = await this.withReadProvider(source);\n\t\tconst targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);\n\n\t\t// copy\n\t\tconst mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'copy', !!overwrite);\n\n\t\t// resolve and send events\n\t\tconst fileStat = await this.resolve(target, { resolveMetadata: true });\n\t\tthis._onDidRunOperation.fire(new FileOperationEvent(source, mode === 'copy' ? FileOperation.COPY : FileOperation.MOVE, fileStat));\n\n\t\treturn fileStat;\n\t}\n\n\tprivate async doMoveCopy(sourceProvider: IFileSystemProvider, source: URI, targetProvider: IFileSystemProvider, target: URI, mode: 'move' | 'copy', overwrite: boolean): Promise<'move' | 'copy'> {\n\t\tif (source.toString() === target.toString()) {\n\t\t\treturn mode; // simulate node.js behaviour here and do a no-op if paths match\n\t\t}\n\n\t\t// validation\n\t\tconst { exists, isSameResourceWithDifferentPathCase } = await this.doValidateMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite);\n\n\t\t// delete as needed (unless target is same resurce with different path case)\n\t\tif (exists && !isSameResourceWithDifferentPathCase && overwrite) {\n\t\t\tawait this.del(target, { recursive: true });\n\t\t}\n\n\t\t// create parent folders\n\t\tawait this.mkdirp(targetProvider, this.getExtUri(targetProvider).providerExtUri.dirname(target));\n\n\t\t// copy source => target\n\t\tif (mode === 'copy') {\n\n\t\t\t// same provider with fast copy: leverage copy() functionality\n\t\t\tif (sourceProvider === targetProvider && hasFileFolderCopyCapability(sourceProvider)) {\n\t\t\t\tawait sourceProvider.copy(source, target, { overwrite });\n\t\t\t}\n\n\t\t\t// when copying via buffer/unbuffered, we have to manually\n\t\t\t// traverse the source if it is a folder and not a file\n\t\t\telse {\n\t\t\t\tconst sourceFile = await this.resolve(source);\n\t\t\t\tif (sourceFile.isDirectory) {\n\t\t\t\t\tawait this.doCopyFolder(sourceProvider, sourceFile, targetProvider, target);\n\t\t\t\t} else {\n\t\t\t\t\tawait this.doCopyFile(sourceProvider, source, targetProvider, target);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mode;\n\t\t}\n\n\t\t// move source => target\n\t\telse {\n\n\t\t\t// same provider: leverage rename() functionality\n\t\t\tif (sourceProvider === targetProvider) {\n\t\t\t\tawait sourceProvider.rename(source, target, { overwrite });\n\n\t\t\t\treturn mode;\n\t\t\t}\n\n\t\t\t// across providers: copy to target & delete at source\n\t\t\telse {\n\t\t\t\tawait this.doMoveCopy(sourceProvider, source, targetProvider, target, 'copy', overwrite);\n\t\t\t\tawait this.del(source, { recursive: true });\n\n\t\t\t\treturn 'copy';\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async doCopyFile(sourceProvider: IFileSystemProvider, source: URI, targetProvider: IFileSystemProvider, target: URI): Promise<void> {\n\n\t\t// copy: source (buffered) => target (buffered)\n\t\tif (hasOpenReadWriteCloseCapability(sourceProvider) && hasOpenReadWriteCloseCapability(targetProvider)) {\n\t\t\treturn this.doPipeBuffered(sourceProvider, source, targetProvider, target);\n\t\t}\n\n\t\t// copy: source (buffered) => target (unbuffered)\n\t\tif (hasOpenReadWriteCloseCapability(sourceProvider) && hasReadWriteCapability(targetProvider)) {\n\t\t\treturn this.doPipeBufferedToUnbuffered(sourceProvider, source, targetProvider, target);\n\t\t}\n\n\t\t// copy: source (unbuffered) => target (buffered)\n\t\tif (hasReadWriteCapability(sourceProvider) && hasOpenReadWriteCloseCapability(targetProvider)) {\n\t\t\treturn this.doPipeUnbufferedToBuffered(sourceProvider, source, targetProvider, target);\n\t\t}\n\n\t\t// copy: source (unbuffered) => target (unbuffered)\n\t\tif (hasReadWriteCapability(sourceProvider) && hasReadWriteCapability(targetProvider)) {\n\t\t\treturn this.doPipeUnbuffered(sourceProvider, source, targetProvider, target);\n\t\t}\n\t}\n\n\tprivate async doCopyFolder(sourceProvider: IFileSystemProvider, sourceFolder: IFileStat, targetProvider: IFileSystemProvider, targetFolder: URI): Promise<void> {\n\n\t\t// create folder in target\n\t\tawait targetProvider.mkdir(targetFolder);\n\n\t\t// create children in target\n\t\tif (Array.isArray(sourceFolder.children)) {\n\t\t\tawait Promises.settled(sourceFolder.children.map(async sourceChild => {\n\t\t\t\tconst targetChild = this.getExtUri(targetProvider).providerExtUri.joinPath(targetFolder, sourceChild.name);\n\t\t\t\tif (sourceChild.isDirectory) {\n\t\t\t\t\treturn this.doCopyFolder(sourceProvider, await this.resolve(sourceChild.resource), targetProvider, targetChild);\n\t\t\t\t} else {\n\t\t\t\t\treturn this.doCopyFile(sourceProvider, sourceChild.resource, targetProvider, targetChild);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate async doValidateMoveCopy(sourceProvider: IFileSystemProvider, source: URI, targetProvider: IFileSystemProvider, target: URI, mode: 'move' | 'copy', overwrite?: boolean): Promise<{ exists: boolean; isSameResourceWithDifferentPathCase: boolean }> {\n\t\tlet isSameResourceWithDifferentPathCase = false;\n\n\t\t// Check if source is equal or parent to target (requires providers to be the same)\n\t\tif (sourceProvider === targetProvider) {\n\t\t\tconst { providerExtUri, isPathCaseSensitive } = this.getExtUri(sourceProvider);\n\t\t\tif (!isPathCaseSensitive) {\n\t\t\t\tisSameResourceWithDifferentPathCase = providerExtUri.isEqual(source, target);\n\t\t\t}\n\n\t\t\tif (isSameResourceWithDifferentPathCase && mode === 'copy') {\n\t\t\t\tthrow new Error(localize('unableToMoveCopyError1', \"Unable to copy when source '{0}' is same as target '{1}' with different path case on a case insensitive file system\", this.resourceForError(source), this.resourceForError(target)));\n\t\t\t}\n\n\t\t\tif (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {\n\t\t\t\tthrow new Error(localize('unableToMoveCopyError2', \"Unable to move/copy when source '{0}' is parent of target '{1}'.\", this.resourceForError(source), this.resourceForError(target)));\n\t\t\t}\n\t\t}\n\n\t\t// Extra checks if target exists and this is not a rename\n\t\tconst exists = await this.exists(target);\n\t\tif (exists && !isSameResourceWithDifferentPathCase) {\n\n\t\t\t// Bail out if target exists and we are not about to overwrite\n\t\t\tif (!overwrite) {\n\t\t\t\tthrow new FileOperationError(localize('unableToMoveCopyError3', \"Unable to move/copy '{0}' because target '{1}' already exists at destination.\", this.resourceForError(source), this.resourceForError(target)), FileOperationResult.FILE_MOVE_CONFLICT);\n\t\t\t}\n\n\t\t\t// Special case: if the target is a parent of the source, we cannot delete\n\t\t\t// it as it would delete the source as well. In this case we have to throw\n\t\t\tif (sourceProvider === targetProvider) {\n\t\t\t\tconst { providerExtUri } = this.getExtUri(sourceProvider);\n\t\t\t\tif (providerExtUri.isEqualOrParent(source, target)) {\n\t\t\t\t\tthrow new Error(localize('unableToMoveCopyError4', \"Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.\", this.resourceForError(source), this.resourceForError(target)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { exists, isSameResourceWithDifferentPathCase };\n\t}\n\n\tprivate getExtUri(provider: IFileSystemProvider): { providerExtUri: IExtUri; isPathCaseSensitive: boolean } {\n\t\tconst isPathCaseSensitive = this.isPathCaseSensitive(provider);\n\n\t\treturn {\n\t\t\tproviderExtUri: isPathCaseSensitive ? extUri : extUriIgnorePathCase,\n\t\t\tisPathCaseSensitive\n\t\t};\n\t}\n\n\tprivate isPathCaseSensitive(provider: IFileSystemProvider): boolean {\n\t\treturn !!(provider.capabilities & FileSystemProviderCapabilities.PathCaseSensitive);\n\t}\n\n\tasync createFolder(resource: URI): Promise<IFileStatWithMetadata> {\n\t\tconst provider = this.throwIfFileSystemIsReadonly(await this.withProvider(resource), resource);\n\n\t\t// mkdir recursively\n\t\tawait this.mkdirp(provider, resource);\n\n\t\t// events\n\t\tconst fileStat = await this.resolve(resource, { resolveMetadata: true });\n\t\tthis._onDidRunOperation.fire(new FileOperationEvent(resource, FileOperation.CREATE, fileStat));\n\n\t\treturn fileStat;\n\t}\n\n\tprivate async mkdirp(provider: IFileSystemProvider, directory: URI): Promise<void> {\n\t\tconst directoriesToCreate: string[] = [];\n\n\t\t// mkdir until we reach root\n\t\tconst { providerExtUri } = this.getExtUri(provider);\n\t\twhile (!providerExtUri.isEqual(directory, providerExtUri.dirname(directory))) {\n\t\t\ttry {\n\t\t\t\tconst stat = await provider.stat(directory);\n\t\t\t\tif ((stat.type & FileType.Directory) === 0) {\n\t\t\t\t\tthrow new Error(localize('mkdirExistsError', \"Unable to create folder '{0}' that already exists but is not a directory\", this.resourceForError(directory)));\n\t\t\t\t}\n\n\t\t\t\tbreak; // we have hit a directory that exists -> good\n\t\t\t} catch (error) {\n\n\t\t\t\t// Bubble up any other error that is not file not found\n\t\t\t\tif (toFileSystemProviderErrorCode(error) !== FileSystemProviderErrorCode.FileNotFound) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\n\t\t\t\t// Upon error, remember directories that need to be created\n\t\t\t\tdirectoriesToCreate.push(providerExtUri.basename(directory));\n\n\t\t\t\t// Continue up\n\t\t\t\tdirectory = providerExtUri.dirname(directory);\n\t\t\t}\n\t\t}\n\n\t\t// Create directories as needed\n\t\tfor (let i = directoriesToCreate.length - 1; i >= 0; i--) {\n\t\t\tdirectory = providerExtUri.joinPath(directory, directoriesToCreate[i]);\n\n\t\t\ttry {\n\t\t\t\tawait provider.mkdir(directory);\n\t\t\t} catch (error) {\n\t\t\t\tif (toFileSystemProviderErrorCode(error) !== FileSystemProviderErrorCode.FileExists) {\n\t\t\t\t\t// For mkdirp() we tolerate that the mkdir() call fails\n\t\t\t\t\t// in case the folder already exists. This follows node.js\n\t\t\t\t\t// own implementation of fs.mkdir({ recursive: true }) and\n\t\t\t\t\t// reduces the chances of race conditions leading to errors\n\t\t\t\t\t// if multiple calls try to create the same folders\n\t\t\t\t\t// As such, we only throw an error here if it is other than\n\t\t\t\t\t// the fact that the file already exists.\n\t\t\t\t\t// (see also https://github.com/microsoft/vscode/issues/89834)\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync canDelete(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<Error | true> {\n\t\ttry {\n\t\t\tawait this.doValidateDelete(resource, options);\n\t\t} catch (error) {\n\t\t\treturn error;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate async doValidateDelete(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<IFileSystemProvider> {\n\t\tconst provider = this.throwIfFileSystemIsReadonly(await this.withProvider(resource), resource);\n\n\t\t// Validate trash support\n\t\tconst useTrash = !!options?.useTrash;\n\t\tif (useTrash && !(provider.capabilities & FileSystemProviderCapabilities.Trash)) {\n\t\t\tthrow new Error(localize('deleteFailedTrashUnsupported', \"Unable to delete file '{0}' via trash because provider does not support it.\", this.resourceForError(resource)));\n\t\t}\n\n\t\t// Validate atomic support\n\t\tconst atomic = options?.atomic;\n\t\tif (atomic && !(provider.capabilities & FileSystemProviderCapabilities.FileAtomicDelete)) {\n\t\t\tthrow new Error(localize('deleteFailedAtomicUnsupported', \"Unable to delete file '{0}' atomically because provider does not support it.\", this.resourceForError(resource)));\n\t\t}\n\n\t\tif (useTrash && atomic) {\n\t\t\tthrow new Error(localize('deleteFailedTrashAndAtomicUnsupported', \"Unable to atomically delete file '{0}' because using trash is enabled.\", this.resourceForError(resource)));\n\t\t}\n\n\t\t// Validate delete\n\t\tlet stat: IStat | undefined = undefined;\n\t\ttry {\n\t\t\tstat = await provider.stat(resource);\n\t\t} catch (error) {\n\t\t\t// Handled later\n\t\t}\n\n\t\tif (stat) {\n\t\t\tthis.throwIfFileIsReadonly(resource, stat);\n\t\t} else {\n\t\t\tthrow new FileOperationError(localize('deleteFailedNotFound', \"Unable to delete nonexistent file '{0}'\", this.resourceForError(resource)), FileOperationResult.FILE_NOT_FOUND);\n\t\t}\n\n\t\t// Validate recursive\n\t\tconst recursive = !!options?.recursive;\n\t\tif (!recursive) {\n\t\t\tconst stat = await this.resolve(resource);\n\t\t\tif (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {\n\t\t\t\tthrow new Error(localize('deleteFailedNonEmptyFolder', \"Unable to delete non-empty folder '{0}'.\", this.resourceForError(resource)));\n\t\t\t}\n\t\t}\n\n\t\treturn provider;\n\t}\n\n\tasync del(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<void> {\n\t\tconst provider = await this.doValidateDelete(resource, options);\n\n\t\tlet deleteFileOptions = options;\n\t\tif (hasFileAtomicDeleteCapability(provider) && !deleteFileOptions?.atomic) {\n\t\t\tconst enforcedAtomicDelete = provider.enforceAtomicDelete?.(resource);\n\t\t\tif (enforcedAtomicDelete) {\n\t\t\t\tdeleteFileOptions = { ...options, atomic: enforcedAtomicDelete };\n\t\t\t}\n\t\t}\n\n\t\tconst useTrash = !!deleteFileOptions?.useTrash;\n\t\tconst recursive = !!deleteFileOptions?.recursive;\n\t\tconst atomic = deleteFileOptions?.atomic ?? false;\n\n\t\t// Delete through provider\n\t\tawait provider.delete(resource, { recursive, useTrash, atomic });\n\n\t\t// Events\n\t\tthis._onDidRunOperation.fire(new FileOperationEvent(resource, FileOperation.DELETE));\n\t}\n\n\t//#endregion\n\n\t//#region Clone File\n\n\tasync cloneFile(source: URI, target: URI): Promise<void> {\n\t\tconst sourceProvider = await this.withProvider(source);\n\t\tconst targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);\n\n\t\tif (sourceProvider === targetProvider && this.getExtUri(sourceProvider).providerExtUri.isEqual(source, target)) {\n\t\t\treturn; // return early if paths are equal\n\t\t}\n\n\t\t// same provider, use `cloneFile` when native support is provided\n\t\tif (sourceProvider === targetProvider && hasFileCloneCapability(sourceProvider)) {\n\t\t\treturn sourceProvider.cloneFile(source, target);\n\t\t}\n\n\t\t// otherwise, either providers are different or there is no native\n\t\t// `cloneFile` support, then we fallback to emulate a clone as best\n\t\t// as we can with the other primitives\n\n\t\t// create parent folders\n\t\tawait this.mkdirp(targetProvider, this.getExtUri(targetProvider).providerExtUri.dirname(target));\n\n\t\t// leverage `copy` method if provided and providers are identical\n\t\t// queue on the source to ensure atomic read\n\t\tif (sourceProvider === targetProvider && hasFileFolderCopyCapability(sourceProvider)) {\n\t\t\treturn this.writeQueue.queueFor(source, () => sourceProvider.copy(source, target, { overwrite: true }), this.getExtUri(sourceProvider).providerExtUri);\n\t\t}\n\n\t\t// otherwise copy via buffer/unbuffered and use a write queue\n\t\t// on the source to ensure atomic operation as much as possible\n\t\treturn this.writeQueue.queueFor(source, () => this.doCopyFile(sourceProvider, source, targetProvider, target), this.getExtUri(sourceProvider).providerExtUri);\n\t}\n\n\t//#endregion\n\n\t//#region File Watching\n\n\tprivate readonly internalOnDidFilesChange = this._register(new Emitter<FileChangesEvent>());\n\n\tprivate readonly _onDidUncorrelatedFilesChange = this._register(new Emitter<FileChangesEvent>());\n\treadonly onDidFilesChange = this._onDidUncorrelatedFilesChange.event; // global `onDidFilesChange` skips correlated events\n\n\tprivate readonly _onDidWatchError = this._register(new Emitter<Error>());\n\treadonly onDidWatchError = this._onDidWatchError.event;\n\n\tprivate readonly activeWatchers = new Map<number /* watch request hash */, { disposable: IDisposable; count: number }>();\n\n\tprivate static WATCHER_CORRELATION_IDS = 0;\n\n\tcreateWatcher(resource: URI, options: IWatchOptionsWithoutCorrelation & { recursive: false }): IFileSystemWatcher {\n\t\treturn this.watch(resource, {\n\t\t\t...options,\n\t\t\t// Explicitly set a correlation id so that file events that originate\n\t\t\t// from requests from extensions are exclusively routed back to the\n\t\t\t// extension host and not into the workbench.\n\t\t\tcorrelationId: FileService.WATCHER_CORRELATION_IDS++\n\t\t});\n\t}\n\n\twatch(resource: URI, options: IWatchOptionsWithCorrelation): IFileSystemWatcher;\n\twatch(resource: URI, options?: IWatchOptionsWithoutCorrelation): IDisposable;\n\twatch(resource: URI, options: IWatchOptions = { recursive: false, excludes: [] }): IFileSystemWatcher | IDisposable {\n\t\tconst disposables = new DisposableStore();\n\n\t\t// Forward watch request to provider and wire in disposables\n\t\tlet watchDisposed = false;\n\t\tlet disposeWatch = () => { watchDisposed = true; };\n\t\tdisposables.add(toDisposable(() => disposeWatch()));\n\n\t\t// Watch and wire in disposable which is async but\n\t\t// check if we got disposed meanwhile and forward\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tconst disposable = await this.doWatch(resource, options);\n\t\t\t\tif (watchDisposed) {\n\t\t\t\t\tdispose(disposable);\n\t\t\t\t} else {\n\t\t\t\t\tdisposeWatch = () => dispose(disposable);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.error(error);\n\t\t\t}\n\t\t})();\n\n\t\t// When a correlation identifier is set, return a specific\n\t\t// watcher that only emits events matching that correalation.\n\t\tconst correlationId = options.correlationId;\n\t\tif (typeof correlationId === 'number') {\n\t\t\tconst fileChangeEmitter = disposables.add(new Emitter<FileChangesEvent>());\n\t\t\tdisposables.add(this.internalOnDidFilesChange.event(e => {\n\t\t\t\tif (e.correlates(correlationId)) {\n\t\t\t\t\tfileChangeEmitter.fire(e);\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tconst watcher: IFileSystemWatcher = {\n\t\t\t\tonDidChange: fileChangeEmitter.event,\n\t\t\t\tdispose: () => disposables.dispose()\n\t\t\t};\n\n\t\t\treturn watcher;\n\t\t}\n\n\t\treturn disposables;\n\t}\n\n\tprivate async doWatch(resource: URI, options: IWatchOptions): Promise<IDisposable> {\n\t\tconst provider = await this.withProvider(resource);\n\n\t\t// Deduplicate identical watch requests\n\t\tconst watchHash = hash([this.getExtUri(provider).providerExtUri.getComparisonKey(resource), options]);\n\t\tlet watcher = this.activeWatchers.get(watchHash);\n\t\tif (!watcher) {\n\t\t\twatcher = {\n\t\t\t\tcount: 0,\n\t\t\t\tdisposable: provider.watch(resource, options)\n\t\t\t};\n\n\t\t\tthis.activeWatchers.set(watchHash, watcher);\n\t\t}\n\n\t\t// Increment usage counter\n\t\twatcher.count += 1;\n\n\t\treturn toDisposable(() => {\n\t\t\tif (watcher) {\n\n\t\t\t\t// Unref\n\t\t\t\twatcher.count--;\n\n\t\t\t\t// Dispose only when last user is reached\n\t\t\t\tif (watcher.count === 0) {\n\t\t\t\t\tdispose(watcher.disposable);\n\t\t\t\t\tthis.activeWatchers.delete(watchHash);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\n\t\tfor (const [, watcher] of this.activeWatchers) {\n\t\t\tdispose(watcher.disposable);\n\t\t}\n\n\t\tthis.activeWatchers.clear();\n\t}\n\n\t//#endregion\n\n\t//#region Helpers\n\n\tprivate readonly writeQueue = this._register(new ResourceQueue());\n\n\tprivate async doWriteBuffered(provider: IFileSystemProviderWithOpenReadWriteCloseCapability, resource: URI, options: IWriteFileOptions | undefined, readableOrStreamOrBufferedStream: VSBufferReadable | VSBufferReadableStream | VSBufferReadableBufferedStream): Promise<void> {\n\t\treturn this.writeQueue.queueFor(resource, async () => {\n\n\t\t\t// open handle\n\t\t\tconst handle = await provider.open(resource, { create: true, unlock: options?.unlock ?? false });\n\n\t\t\t// write into handle until all bytes from buffer have been written\n\t\t\ttry {\n\t\t\t\tif (isReadableStream(readableOrStreamOrBufferedStream) || isReadableBufferedStream(readableOrStreamOrBufferedStream)) {\n\t\t\t\t\tawait this.doWriteStreamBufferedQueued(provider, handle, readableOrStreamOrBufferedStream);\n\t\t\t\t} else {\n\t\t\t\t\tawait this.doWriteReadableBufferedQueued(provider, handle, readableOrStreamOrBufferedStream);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow ensureFileSystemProviderError(error);\n\t\t\t} finally {\n\n\t\t\t\t// close handle always\n\t\t\t\tawait provider.close(handle);\n\t\t\t}\n\t\t}, this.getExtUri(provider).providerExtUri);\n\t}\n\n\tprivate async doWriteStreamBufferedQueued(provider: IFileSystemProviderWithOpenReadWriteCloseCapability, handle: number, streamOrBufferedStream: VSBufferReadableStream | VSBufferReadableBufferedStream): Promise<void> {\n\t\tlet posInFile = 0;\n\t\tlet stream: VSBufferReadableStream;\n\n\t\t// Buffered stream: consume the buffer first by writing\n\t\t// it to the target before reading from the stream.\n\t\tif (isReadableBufferedStream(streamOrBufferedStream)) {\n\t\t\tif (streamOrBufferedStream.buffer.length > 0) {\n\t\t\t\tconst chunk = VSBuffer.concat(streamOrBufferedStream.buffer);\n\t\t\t\tawait this.doWriteBuffer(provider, handle, chunk, chunk.byteLength, posInFile, 0);\n\n\t\t\t\tposInFile += chunk.byteLength;\n\t\t\t}\n\n\t\t\t// If the stream has been consumed, return early\n\t\t\tif (streamOrBufferedStream.ended) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tstream = streamOrBufferedStream.stream;\n\t\t}\n\n\t\t// Unbuffered stream - just take as is\n\t\telse {\n\t\t\tstream = streamOrBufferedStream;\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tlistenStream(stream, {\n\t\t\t\tonData: async chunk => {\n\n\t\t\t\t\t// pause stream to perform async write operation\n\t\t\t\t\tstream.pause();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.doWriteBuffer(provider, handle, chunk, chunk.byteLength, posInFile, 0);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn reject(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tposInFile += chunk.byteLength;\n\n\t\t\t\t\t// resume stream now that we have successfully written\n\t\t\t\t\t// run this on the next tick to prevent increasing the\n\t\t\t\t\t// execution stack because resume() may call the event\n\t\t\t\t\t// handler again before finishing.\n\t\t\t\t\tsetTimeout(() => stream.resume());\n\t\t\t\t},\n\t\t\t\tonError: error => reject(error),\n\t\t\t\tonEnd: () => resolve()\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate async doWriteReadableBufferedQueued(provider: IFileSystemProviderWithOpenReadWriteCloseCapability, handle: number, readable: VSBufferReadable): Promise<void> {\n\t\tlet posInFile = 0;\n\n\t\tlet chunk: VSBuffer | null;\n\t\twhile ((chunk = readable.read()) !== null) {\n\t\t\tawait this.doWriteBuffer(provider, handle, chunk, chunk.byteLength, posInFile, 0);\n\n\t\t\tposInFile += chunk.byteLength;\n\t\t}\n\t}\n\n\tprivate async doWriteBuffer(provider: IFileSystemProviderWithOpenReadWriteCloseCapability, handle: number, buffer: VSBuffer, length: number, posInFile: number, posInBuffer: number): Promise<void> {\n\t\tlet totalBytesWritten = 0;\n\t\twhile (totalBytesWritten < length) {\n\n\t\t\t// Write through the provider\n\t\t\tconst bytesWritten = await provider.write(handle, posInFile + totalBytesWritten, buffer.buffer, posInBuffer + totalBytesWritten, length - totalBytesWritten);\n\t\t\ttotalBytesWritten += bytesWritten;\n\t\t}\n\t}\n\n\tprivate async doWriteUnbuffered(provider: IFileSystemProviderWithFileReadWriteCapability, resource: URI, options: IWriteFileOptions | undefined, bufferOrReadableOrStreamOrBufferedStream: VSBuffer | VSBufferReadable | VSBufferReadableStream | VSBufferReadableBufferedStream): Promise<void> {\n\t\treturn this.writeQueue.queueFor(resource, () => this.doWriteUnbufferedQueued(provider, resource, options, bufferOrReadableOrStreamOrBufferedStream), this.getExtUri(provider).providerExtUri);\n\t}\n\n\tprivate async doWriteUnbufferedQueued(provider: IFileSystemProviderWithFileReadWriteCapability, resource: URI, options: IWriteFileOptions | undefined, bufferOrReadableOrStreamOrBufferedStream: VSBuffer | VSBufferReadable | VSBufferReadableStream | VSBufferReadableBufferedStream): Promise<void> {\n\t\tlet buffer: VSBuffer;\n\t\tif (bufferOrReadableOrStreamOrBufferedStream instanceof VSBuffer) {\n\t\t\tbuffer = bufferOrReadableOrStreamOrBufferedStream;\n\t\t} else if (isReadableStream(bufferOrReadableOrStreamOrBufferedStream)) {\n\t\t\tbuffer = await streamToBuffer(bufferOrReadableOrStreamOrBufferedStream);\n\t\t} else if (isReadableBufferedStream(bufferOrReadableOrStreamOrBufferedStream)) {\n\t\t\tbuffer = await bufferedStreamToBuffer(bufferOrReadableOrStreamOrBufferedStream);\n\t\t} else {\n\t\t\tbuffer = readableToBuffer(bufferOrReadableOrStreamOrBufferedStream);\n\t\t}\n\n\t\t// Write through the provider\n\t\tawait provider.writeFile(resource, buffer.buffer, { create: true, overwrite: true, unlock: options?.unlock ?? false, atomic: options?.atomic ?? false });\n\t}\n\n\tprivate async doPipeBuffered(sourceProvider: IFileSystemProviderWithOpenReadWriteCloseCapability, source: URI, targetProvider: IFileSystemProviderWithOpenReadWriteCloseCapability, target: URI): Promise<void> {\n\t\treturn this.writeQueue.queueFor(target, () => this.doPipeBufferedQueued(sourceProvider, source, targetProvider, target), this.getExtUri(targetProvider).providerExtUri);\n\t}\n\n\tprivate async doPipeBufferedQueued(sourceProvider: IFileSystemProviderWithOpenReadWriteCloseCapability, source: URI, targetProvider: IFileSystemProviderWithOpenReadWriteCloseCapability, target: URI): Promise<void> {\n\t\tlet sourceHandle: number | undefined = undefined;\n\t\tlet targetHandle: number | undefined = undefined;\n\n\t\ttry {\n\n\t\t\t// Open handles\n\t\t\tsourceHandle = await sourceProvider.open(source, { create: false });\n\t\t\ttargetHandle = await targetProvider.open(target, { create: true, unlock: false });\n\n\t\t\tconst buffer = VSBuffer.alloc(this.BUFFER_SIZE);\n\n\t\t\tlet posInFile = 0;\n\t\t\tlet posInBuffer = 0;\n\t\t\tlet bytesRead = 0;\n\t\t\tdo {\n\t\t\t\t// read from source (sourceHandle) at current position (posInFile) into buffer (buffer) at\n\t\t\t\t// buffer position (posInBuffer) up to the size of the buffer (buffer.byteLength).\n\t\t\t\tbytesRead = await sourceProvider.read(sourceHandle, posInFile, buffer.buffer, posInBuffer, buffer.byteLength - posInBuffer);\n\n\t\t\t\t// write into target (targetHandle) at current position (posInFile) from buffer (buffer) at\n\t\t\t\t// buffer position (posInBuffer) all bytes we read (bytesRead).\n\t\t\t\tawait this.doWriteBuffer(targetProvider, targetHandle, buffer, bytesRead, posInFile, posInBuffer);\n\n\t\t\t\tposInFile += bytesRead;\n\t\t\t\tposInBuffer += bytesRead;\n\n\t\t\t\t// when buffer full, fill it again from the beginning\n\t\t\t\tif (posInBuffer === buffer.byteLength) {\n\t\t\t\t\tposInBuffer = 0;\n\t\t\t\t}\n\t\t\t} while (bytesRead > 0);\n\t\t} catch (error) {\n\t\t\tthrow ensureFileSystemProviderError(error);\n\t\t} finally {\n\t\t\tawait Promises.settled([\n\t\t\t\ttypeof sourceHandle === 'number' ? sourceProvider.close(sourceHandle) : Promise.resolve(),\n\t\t\t\ttypeof targetHandle === 'number' ? targetProvider.close(targetHandle) : Promise.resolve(),\n\t\t\t]);\n\t\t}\n\t}\n\n\tprivate async doPipeUnbuffered(sourceProvider: IFileSystemProviderWithFileReadWriteCapability, source: URI, targetProvider: IFileSystemProviderWithFileReadWriteCapability, target: URI): Promise<void> {\n\t\treturn this.writeQueue.queueFor(target, () => this.doPipeUnbufferedQueued(sourceProvider, source, targetProvider, target), this.getExtUri(targetProvider).providerExtUri);\n\t}\n\n\tprivate async doPipeUnbufferedQueued(sourceProvider: IFileSystemProviderWithFileReadWriteCapability, source: URI, targetProvider: IFileSystemProviderWithFileReadWriteCapability, target: URI): Promise<void> {\n\t\treturn targetProvider.writeFile(target, await sourceProvider.readFile(source), { create: true, overwrite: true, unlock: false, atomic: false });\n\t}\n\n\tprivate async doPipeUnbufferedToBuffered(sourceProvider: IFileSystemProviderWithFileReadWriteCapability, source: URI, targetProvider: IFileSystemProviderWithOpenReadWriteCloseCapability, target: URI): Promise<void> {\n\t\treturn this.writeQueue.queueFor(target, () => this.doPipeUnbufferedToBufferedQueued(sourceProvider, source, targetProvider, target), this.getExtUri(targetProvider).providerExtUri);\n\t}\n\n\tprivate async doPipeUnbufferedToBufferedQueued(sourceProvider: IFileSystemProviderWithFileReadWriteCapability, source: URI, targetProvider: IFileSystemProviderWithOpenReadWriteCloseCapability, target: URI): Promise<void> {\n\n\t\t// Open handle\n\t\tconst targetHandle = await targetProvider.open(target, { create: true, unlock: false });\n\n\t\t// Read entire buffer from source and write buffered\n\t\ttry {\n\t\t\tconst buffer = await sourceProvider.readFile(source);\n\t\t\tawait this.doWriteBuffer(targetProvider, targetHandle, VSBuffer.wrap(buffer), buffer.byteLength, 0, 0);\n\t\t} catch (error) {\n\t\t\tthrow ensureFileSystemProviderError(error);\n\t\t} finally {\n\t\t\tawait targetProvider.close(targetHandle);\n\t\t}\n\t}\n\n\tprivate async doPipeBufferedToUnbuffered(sourceProvider: IFileSystemProviderWithOpenReadWriteCloseCapability, source: URI, targetProvider: IFileSystemProviderWithFileReadWriteCapability, target: URI): Promise<void> {\n\n\t\t// Read buffer via stream buffered\n\t\tconst buffer = await streamToBuffer(this.readFileBuffered(sourceProvider, source, CancellationToken.None));\n\n\t\t// Write buffer into target at once\n\t\tawait this.doWriteUnbuffered(targetProvider, target, undefined, buffer);\n\t}\n\n\tprotected throwIfFileSystemIsReadonly<T extends IFileSystemProvider>(provider: T, resource: URI): T {\n\t\tif (provider.capabilities & FileSystemProviderCapabilities.Readonly) {\n\t\t\tthrow new FileOperationError(localize('err.readonly', \"Unable to modify read-only file '{0}'\", this.resourceForError(resource)), FileOperationResult.FILE_PERMISSION_DENIED);\n\t\t}\n\n\t\treturn provider;\n\t}\n\n\tprivate throwIfFileIsReadonly(resource: URI, stat: IStat): void {\n\t\tif ((stat.permissions ?? 0) & FilePermission.Readonly) {\n\t\t\tthrow new FileOperationError(localize('err.readonly', \"Unable to modify read-only file '{0}'\", this.resourceForError(resource)), FileOperationResult.FILE_PERMISSION_DENIED);\n\t\t}\n\t}\n\n\tprivate resourceForError(resource: URI): string {\n\t\tif (resource.scheme === Schemas.file) {\n\t\t\treturn resource.fsPath;\n\t\t}\n\n\t\treturn resource.toString(true);\n\t}\n\n\t//#endregion\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { equals } from './arrays.js';\nimport { isThenable } from './async.js';\nimport { CharCode } from './charCode.js';\nimport { isEqualOrParent } from './extpath.js';\nimport { LRUCache } from './map.js';\nimport { basename, extname, posix, sep } from './path.js';\nimport { isLinux } from './platform.js';\nimport { escapeRegExpCharacters, ltrim } from './strings.js';\n\nexport interface IRelativePattern {\n\n\t/**\n\t * A base file path to which this pattern will be matched against relatively.\n\t */\n\treadonly base: string;\n\n\t/**\n\t * A file glob pattern like `*.{ts,js}` that will be matched on file paths\n\t * relative to the base path.\n\t *\n\t * Example: Given a base of `/home/work/folder` and a file path of `/home/work/folder/index.js`,\n\t * the file glob pattern will match on `index.js`.\n\t */\n\treadonly pattern: string;\n}\n\nexport interface IExpression {\n\t[pattern: string]: boolean | SiblingClause;\n}\n\nexport function getEmptyExpression(): IExpression {\n\treturn Object.create(null);\n}\n\ninterface SiblingClause {\n\twhen: string;\n}\n\nexport const GLOBSTAR = '**';\nexport const GLOB_SPLIT = '/';\n\nconst PATH_REGEX = '[/\\\\\\\\]';\t\t// any slash or backslash\nconst NO_PATH_REGEX = '[^/\\\\\\\\]';\t// any non-slash and non-backslash\nconst ALL_FORWARD_SLASHES = /\\//g;\n\nfunction starsToRegExp(starCount: number, isLastPattern?: boolean): string {\n\tswitch (starCount) {\n\t\tcase 0:\n\t\t\treturn '';\n\t\tcase 1:\n\t\t\treturn `${NO_PATH_REGEX}*?`; // 1 star matches any number of characters except path separator (/ and \\) - non greedy (?)\n\t\tdefault:\n\t\t\t// Matches:  (Path Sep OR Path Val followed by Path Sep) 0-many times except when it's the last pattern\n\t\t\t//           in which case also matches (Path Sep followed by Path Val)\n\t\t\t// Group is non capturing because we don't need to capture at all (?:...)\n\t\t\t// Overall we use non-greedy matching because it could be that we match too much\n\t\t\treturn `(?:${PATH_REGEX}|${NO_PATH_REGEX}+${PATH_REGEX}${isLastPattern ? `|${PATH_REGEX}${NO_PATH_REGEX}+` : ''})*?`;\n\t}\n}\n\nexport function splitGlobAware(pattern: string, splitChar: string): string[] {\n\tif (!pattern) {\n\t\treturn [];\n\t}\n\n\tconst segments: string[] = [];\n\n\tlet inBraces = false;\n\tlet inBrackets = false;\n\n\tlet curVal = '';\n\tfor (const char of pattern) {\n\t\tswitch (char) {\n\t\t\tcase splitChar:\n\t\t\t\tif (!inBraces && !inBrackets) {\n\t\t\t\t\tsegments.push(curVal);\n\t\t\t\t\tcurVal = '';\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '{':\n\t\t\t\tinBraces = true;\n\t\t\t\tbreak;\n\t\t\tcase '}':\n\t\t\t\tinBraces = false;\n\t\t\t\tbreak;\n\t\t\tcase '[':\n\t\t\t\tinBrackets = true;\n\t\t\t\tbreak;\n\t\t\tcase ']':\n\t\t\t\tinBrackets = false;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tcurVal += char;\n\t}\n\n\t// Tail\n\tif (curVal) {\n\t\tsegments.push(curVal);\n\t}\n\n\treturn segments;\n}\n\nfunction parseRegExp(pattern: string): string {\n\tif (!pattern) {\n\t\treturn '';\n\t}\n\n\tlet regEx = '';\n\n\t// Split up into segments for each slash found\n\tconst segments = splitGlobAware(pattern, GLOB_SPLIT);\n\n\t// Special case where we only have globstars\n\tif (segments.every(segment => segment === GLOBSTAR)) {\n\t\tregEx = '.*';\n\t}\n\n\t// Build regex over segments\n\telse {\n\t\tlet previousSegmentWasGlobStar = false;\n\t\tsegments.forEach((segment, index) => {\n\n\t\t\t// Treat globstar specially\n\t\t\tif (segment === GLOBSTAR) {\n\n\t\t\t\t// if we have more than one globstar after another, just ignore it\n\t\t\t\tif (previousSegmentWasGlobStar) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tregEx += starsToRegExp(2, index === segments.length - 1);\n\t\t\t}\n\n\t\t\t// Anything else, not globstar\n\t\t\telse {\n\n\t\t\t\t// States\n\t\t\t\tlet inBraces = false;\n\t\t\t\tlet braceVal = '';\n\n\t\t\t\tlet inBrackets = false;\n\t\t\t\tlet bracketVal = '';\n\n\t\t\t\tfor (const char of segment) {\n\n\t\t\t\t\t// Support brace expansion\n\t\t\t\t\tif (char !== '}' && inBraces) {\n\t\t\t\t\t\tbraceVal += char;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Support brackets\n\t\t\t\t\tif (inBrackets && (char !== ']' || !bracketVal) /* ] is literally only allowed as first character in brackets to match it */) {\n\t\t\t\t\t\tlet res: string;\n\n\t\t\t\t\t\t// range operator\n\t\t\t\t\t\tif (char === '-') {\n\t\t\t\t\t\t\tres = char;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// negation operator (only valid on first index in bracket)\n\t\t\t\t\t\telse if ((char === '^' || char === '!') && !bracketVal) {\n\t\t\t\t\t\t\tres = '^';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// glob split matching is not allowed within character ranges\n\t\t\t\t\t\t// see http://man7.org/linux/man-pages/man7/glob.7.html\n\t\t\t\t\t\telse if (char === GLOB_SPLIT) {\n\t\t\t\t\t\t\tres = '';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// anything else gets escaped\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tres = escapeRegExpCharacters(char);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbracketVal += res;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (char) {\n\t\t\t\t\t\tcase '{':\n\t\t\t\t\t\t\tinBraces = true;\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\tcase '[':\n\t\t\t\t\t\t\tinBrackets = true;\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\tcase '}': {\n\t\t\t\t\t\t\tconst choices = splitGlobAware(braceVal, ',');\n\n\t\t\t\t\t\t\t// Converts {foo,bar} => [foo|bar]\n\t\t\t\t\t\t\tconst braceRegExp = `(?:${choices.map(choice => parseRegExp(choice)).join('|')})`;\n\n\t\t\t\t\t\t\tregEx += braceRegExp;\n\n\t\t\t\t\t\t\tinBraces = false;\n\t\t\t\t\t\t\tbraceVal = '';\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcase ']': {\n\t\t\t\t\t\t\tregEx += ('[' + bracketVal + ']');\n\n\t\t\t\t\t\t\tinBrackets = false;\n\t\t\t\t\t\t\tbracketVal = '';\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcase '?':\n\t\t\t\t\t\t\tregEx += NO_PATH_REGEX; // 1 ? matches any single character except path separator (/ and \\)\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\tcase '*':\n\t\t\t\t\t\t\tregEx += starsToRegExp(1);\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tregEx += escapeRegExpCharacters(char);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Tail: Add the slash we had split on if there is more to\n\t\t\t\t// come and the remaining pattern is not a globstar\n\t\t\t\t// For example if pattern: some/**/*.js we want the \"/\" after\n\t\t\t\t// some to be included in the RegEx to prevent a folder called\n\t\t\t\t// \"something\" to match as well.\n\t\t\t\tif (\n\t\t\t\t\tindex < segments.length - 1 &&\t\t\t// more segments to come after this\n\t\t\t\t\t(\n\t\t\t\t\t\tsegments[index + 1] !== GLOBSTAR ||\t// next segment is not **, or...\n\t\t\t\t\t\tindex + 2 < segments.length\t\t\t// ...next segment is ** but there is more segments after that\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tregEx += PATH_REGEX;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// update globstar state\n\t\t\tpreviousSegmentWasGlobStar = (segment === GLOBSTAR);\n\t\t});\n\t}\n\n\treturn regEx;\n}\n\n// regexes to check for trivial glob patterns that just check for String#endsWith\nconst T1 = /^\\*\\*\\/\\*\\.[\\w\\.-]+$/; \t\t\t\t\t\t\t\t\t\t\t\t\t// **/*.something\nconst T2 = /^\\*\\*\\/([\\w\\.-]+)\\/?$/; \t\t\t\t\t\t\t\t\t\t\t\t// **/something\nconst T3 = /^{\\*\\*\\/\\*?[\\w\\.-]+\\/?(,\\*\\*\\/\\*?[\\w\\.-]+\\/?)*}$/; \t\t\t\t\t\t// {**/*.something,**/*.else} or {**/package.json,**/project.json}\nconst T3_2 = /^{\\*\\*\\/\\*?[\\w\\.-]+(\\/(\\*\\*)?)?(,\\*\\*\\/\\*?[\\w\\.-]+(\\/(\\*\\*)?)?)*}$/; \t// Like T3, with optional trailing /**\nconst T4 = /^\\*\\*((\\/[\\w\\.-]+)+)\\/?$/; \t\t\t\t\t\t\t\t\t\t\t\t// **/something/else\nconst T5 = /^([\\w\\.-]+(\\/[\\w\\.-]+)*)\\/?$/; \t\t\t\t\t\t\t\t\t\t\t// something/else\n\nexport type ParsedPattern = (path: string, basename?: string) => boolean;\n\n// The `ParsedExpression` returns a `Promise`\n// iff `hasSibling` returns a `Promise`.\nexport type ParsedExpression = (path: string, basename?: string, hasSibling?: (name: string) => boolean | Promise<boolean>) => string | null | Promise<string | null> /* the matching pattern */;\n\ninterface IGlobOptions {\n\n\t/**\n\t * Simplify patterns for use as exclusion filters during\n\t * tree traversal to skip entire subtrees. Cannot be used\n\t * outside of a tree traversal.\n\t */\n\ttrimForExclusions?: boolean;\n}\n\ninterface ParsedStringPattern {\n\t(path: string, basename?: string): string | null | Promise<string | null> /* the matching pattern */;\n\tbasenames?: string[];\n\tpatterns?: string[];\n\tallBasenames?: string[];\n\tallPaths?: string[];\n}\n\ninterface ParsedExpressionPattern {\n\t(path: string, basename?: string, name?: string, hasSibling?: (name: string) => boolean | Promise<boolean>): string | null | Promise<string | null> /* the matching pattern */;\n\trequiresSiblings?: boolean;\n\tallBasenames?: string[];\n\tallPaths?: string[];\n}\n\nconst CACHE = new LRUCache<string, ParsedStringPattern>(10000); // bounded to 10000 elements\n\nconst FALSE = function () {\n\treturn false;\n};\n\nconst NULL = function (): string | null {\n\treturn null;\n};\n\n/**\n * Check if a provided parsed pattern or expression\n * is empty - hence it won't ever match anything.\n *\n * See {@link FALSE} and {@link NULL}.\n */\nexport function isEmptyPattern(pattern: ParsedPattern | ParsedExpression): pattern is (typeof FALSE | typeof NULL) {\n\tif (pattern === FALSE) {\n\t\treturn true;\n\t}\n\n\tif (pattern === NULL) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction parsePattern(arg1: string | IRelativePattern, options: IGlobOptions): ParsedStringPattern {\n\tif (!arg1) {\n\t\treturn NULL;\n\t}\n\n\t// Handle relative patterns\n\tlet pattern: string;\n\tif (typeof arg1 !== 'string') {\n\t\tpattern = arg1.pattern;\n\t} else {\n\t\tpattern = arg1;\n\t}\n\n\t// Whitespace trimming\n\tpattern = pattern.trim();\n\n\t// Check cache\n\tconst patternKey = `${pattern}_${!!options.trimForExclusions}`;\n\tlet parsedPattern = CACHE.get(patternKey);\n\tif (parsedPattern) {\n\t\treturn wrapRelativePattern(parsedPattern, arg1);\n\t}\n\n\t// Check for Trivials\n\tlet match: RegExpExecArray | null;\n\tif (T1.test(pattern)) {\n\t\tparsedPattern = trivia1(pattern.substr(4), pattern); \t\t\t// common pattern: **/*.txt just need endsWith check\n\t} else if (match = T2.exec(trimForExclusions(pattern, options))) { \t// common pattern: **/some.txt just need basename check\n\t\tparsedPattern = trivia2(match[1], pattern);\n\t} else if ((options.trimForExclusions ? T3_2 : T3).test(pattern)) { // repetition of common patterns (see above) {**/*.txt,**/*.png}\n\t\tparsedPattern = trivia3(pattern, options);\n\t} else if (match = T4.exec(trimForExclusions(pattern, options))) { \t// common pattern: **/something/else just need endsWith check\n\t\tparsedPattern = trivia4and5(match[1].substr(1), pattern, true);\n\t} else if (match = T5.exec(trimForExclusions(pattern, options))) { \t// common pattern: something/else just need equals check\n\t\tparsedPattern = trivia4and5(match[1], pattern, false);\n\t}\n\n\t// Otherwise convert to pattern\n\telse {\n\t\tparsedPattern = toRegExp(pattern);\n\t}\n\n\t// Cache\n\tCACHE.set(patternKey, parsedPattern);\n\n\treturn wrapRelativePattern(parsedPattern, arg1);\n}\n\nfunction wrapRelativePattern(parsedPattern: ParsedStringPattern, arg2: string | IRelativePattern): ParsedStringPattern {\n\tif (typeof arg2 === 'string') {\n\t\treturn parsedPattern;\n\t}\n\n\tconst wrappedPattern: ParsedStringPattern = function (path, basename) {\n\t\tif (!isEqualOrParent(path, arg2.base, !isLinux)) {\n\t\t\t// skip glob matching if `base` is not a parent of `path`\n\t\t\treturn null;\n\t\t}\n\n\t\t// Given we have checked `base` being a parent of `path`,\n\t\t// we can now remove the `base` portion of the `path`\n\t\t// and only match on the remaining path components\n\t\t// For that we try to extract the portion of the `path`\n\t\t// that comes after the `base` portion. We have to account\n\t\t// for the fact that `base` might end in a path separator\n\t\t// (https://github.com/microsoft/vscode/issues/162498)\n\n\t\treturn parsedPattern(ltrim(path.substr(arg2.base.length), sep), basename);\n\t};\n\n\t// Make sure to preserve associated metadata\n\twrappedPattern.allBasenames = parsedPattern.allBasenames;\n\twrappedPattern.allPaths = parsedPattern.allPaths;\n\twrappedPattern.basenames = parsedPattern.basenames;\n\twrappedPattern.patterns = parsedPattern.patterns;\n\n\treturn wrappedPattern;\n}\n\nfunction trimForExclusions(pattern: string, options: IGlobOptions): string {\n\treturn options.trimForExclusions && pattern.endsWith('/**') ? pattern.substr(0, pattern.length - 2) : pattern; // dropping **, tailing / is dropped later\n}\n\n// common pattern: **/*.txt just need endsWith check\nfunction trivia1(base: string, pattern: string): ParsedStringPattern {\n\treturn function (path: string, basename?: string) {\n\t\treturn typeof path === 'string' && path.endsWith(base) ? pattern : null;\n\t};\n}\n\n// common pattern: **/some.txt just need basename check\nfunction trivia2(base: string, pattern: string): ParsedStringPattern {\n\tconst slashBase = `/${base}`;\n\tconst backslashBase = `\\\\${base}`;\n\n\tconst parsedPattern: ParsedStringPattern = function (path: string, basename?: string) {\n\t\tif (typeof path !== 'string') {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (basename) {\n\t\t\treturn basename === base ? pattern : null;\n\t\t}\n\n\t\treturn path === base || path.endsWith(slashBase) || path.endsWith(backslashBase) ? pattern : null;\n\t};\n\n\tconst basenames = [base];\n\tparsedPattern.basenames = basenames;\n\tparsedPattern.patterns = [pattern];\n\tparsedPattern.allBasenames = basenames;\n\n\treturn parsedPattern;\n}\n\n// repetition of common patterns (see above) {**/*.txt,**/*.png}\nfunction trivia3(pattern: string, options: IGlobOptions): ParsedStringPattern {\n\tconst parsedPatterns = aggregateBasenameMatches(pattern.slice(1, -1)\n\t\t.split(',')\n\t\t.map(pattern => parsePattern(pattern, options))\n\t\t.filter(pattern => pattern !== NULL), pattern);\n\n\tconst patternsLength = parsedPatterns.length;\n\tif (!patternsLength) {\n\t\treturn NULL;\n\t}\n\n\tif (patternsLength === 1) {\n\t\treturn parsedPatterns[0];\n\t}\n\n\tconst parsedPattern: ParsedStringPattern = function (path: string, basename?: string) {\n\t\tfor (let i = 0, n = parsedPatterns.length; i < n; i++) {\n\t\t\tif (parsedPatterns[i](path, basename)) {\n\t\t\t\treturn pattern;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tconst withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames);\n\tif (withBasenames) {\n\t\tparsedPattern.allBasenames = withBasenames.allBasenames;\n\t}\n\n\tconst allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, [] as string[]);\n\tif (allPaths.length) {\n\t\tparsedPattern.allPaths = allPaths;\n\t}\n\n\treturn parsedPattern;\n}\n\n// common patterns: **/something/else just need endsWith check, something/else just needs and equals check\nfunction trivia4and5(targetPath: string, pattern: string, matchPathEnds: boolean): ParsedStringPattern {\n\tconst usingPosixSep = sep === posix.sep;\n\tconst nativePath = usingPosixSep ? targetPath : targetPath.replace(ALL_FORWARD_SLASHES, sep);\n\tconst nativePathEnd = sep + nativePath;\n\tconst targetPathEnd = posix.sep + targetPath;\n\n\tlet parsedPattern: ParsedStringPattern;\n\tif (matchPathEnds) {\n\t\tparsedPattern = function (path: string, basename?: string) {\n\t\t\treturn typeof path === 'string' && ((path === nativePath || path.endsWith(nativePathEnd)) || !usingPosixSep && (path === targetPath || path.endsWith(targetPathEnd))) ? pattern : null;\n\t\t};\n\t} else {\n\t\tparsedPattern = function (path: string, basename?: string) {\n\t\t\treturn typeof path === 'string' && (path === nativePath || (!usingPosixSep && path === targetPath)) ? pattern : null;\n\t\t};\n\t}\n\n\tparsedPattern.allPaths = [(matchPathEnds ? '*/' : './') + targetPath];\n\n\treturn parsedPattern;\n}\n\nfunction toRegExp(pattern: string): ParsedStringPattern {\n\ttry {\n\t\tconst regExp = new RegExp(`^${parseRegExp(pattern)}$`);\n\t\treturn function (path: string) {\n\t\t\tregExp.lastIndex = 0; // reset RegExp to its initial state to reuse it!\n\n\t\t\treturn typeof path === 'string' && regExp.test(path) ? pattern : null;\n\t\t};\n\t} catch (error) {\n\t\treturn NULL;\n\t}\n}\n\n/**\n * Simplified glob matching. Supports a subset of glob patterns:\n * * `*` to match zero or more characters in a path segment\n * * `?` to match on one character in a path segment\n * * `**` to match any number of path segments, including none\n * * `{}` to group conditions (e.g. *.{ts,js} matches all TypeScript and JavaScript files)\n * * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)\n * * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)\n */\nexport function match(pattern: string | IRelativePattern, path: string): boolean;\nexport function match(expression: IExpression, path: string, hasSibling?: (name: string) => boolean): string /* the matching pattern */;\nexport function match(arg1: string | IExpression | IRelativePattern, path: string, hasSibling?: (name: string) => boolean): boolean | string | null | Promise<string | null> {\n\tif (!arg1 || typeof path !== 'string') {\n\t\treturn false;\n\t}\n\n\treturn parse(arg1)(path, undefined, hasSibling);\n}\n\n/**\n * Simplified glob matching. Supports a subset of glob patterns:\n * * `*` to match zero or more characters in a path segment\n * * `?` to match on one character in a path segment\n * * `**` to match any number of path segments, including none\n * * `{}` to group conditions (e.g. *.{ts,js} matches all TypeScript and JavaScript files)\n * * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)\n * * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)\n */\nexport function parse(pattern: string | IRelativePattern, options?: IGlobOptions): ParsedPattern;\nexport function parse(expression: IExpression, options?: IGlobOptions): ParsedExpression;\nexport function parse(arg1: string | IExpression | IRelativePattern, options?: IGlobOptions): ParsedPattern | ParsedExpression;\nexport function parse(arg1: string | IExpression | IRelativePattern, options: IGlobOptions = {}): ParsedPattern | ParsedExpression {\n\tif (!arg1) {\n\t\treturn FALSE;\n\t}\n\n\t// Glob with String\n\tif (typeof arg1 === 'string' || isRelativePattern(arg1)) {\n\t\tconst parsedPattern = parsePattern(arg1, options);\n\t\tif (parsedPattern === NULL) {\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tconst resultPattern: ParsedPattern & { allBasenames?: string[]; allPaths?: string[] } = function (path: string, basename?: string) {\n\t\t\treturn !!parsedPattern(path, basename);\n\t\t};\n\n\t\tif (parsedPattern.allBasenames) {\n\t\t\tresultPattern.allBasenames = parsedPattern.allBasenames;\n\t\t}\n\n\t\tif (parsedPattern.allPaths) {\n\t\t\tresultPattern.allPaths = parsedPattern.allPaths;\n\t\t}\n\n\t\treturn resultPattern;\n\t}\n\n\t// Glob with Expression\n\treturn parsedExpression(<IExpression>arg1, options);\n}\n\nexport function isRelativePattern(obj: unknown): obj is IRelativePattern {\n\tconst rp = obj as IRelativePattern | undefined | null;\n\tif (!rp) {\n\t\treturn false;\n\t}\n\n\treturn typeof rp.base === 'string' && typeof rp.pattern === 'string';\n}\n\nexport function getBasenameTerms(patternOrExpression: ParsedPattern | ParsedExpression): string[] {\n\treturn (<ParsedStringPattern>patternOrExpression).allBasenames || [];\n}\n\nexport function getPathTerms(patternOrExpression: ParsedPattern | ParsedExpression): string[] {\n\treturn (<ParsedStringPattern>patternOrExpression).allPaths || [];\n}\n\nfunction parsedExpression(expression: IExpression, options: IGlobOptions): ParsedExpression {\n\tconst parsedPatterns = aggregateBasenameMatches(Object.getOwnPropertyNames(expression)\n\t\t.map(pattern => parseExpressionPattern(pattern, expression[pattern], options))\n\t\t.filter(pattern => pattern !== NULL));\n\n\tconst patternsLength = parsedPatterns.length;\n\tif (!patternsLength) {\n\t\treturn NULL;\n\t}\n\n\tif (!parsedPatterns.some(parsedPattern => !!(<ParsedExpressionPattern>parsedPattern).requiresSiblings)) {\n\t\tif (patternsLength === 1) {\n\t\t\treturn parsedPatterns[0] as ParsedStringPattern;\n\t\t}\n\n\t\tconst resultExpression: ParsedStringPattern = function (path: string, basename?: string) {\n\t\t\tlet resultPromises: Promise<string | null>[] | undefined = undefined;\n\n\t\t\tfor (let i = 0, n = parsedPatterns.length; i < n; i++) {\n\t\t\t\tconst result = parsedPatterns[i](path, basename);\n\t\t\t\tif (typeof result === 'string') {\n\t\t\t\t\treturn result; // immediately return as soon as the first expression matches\n\t\t\t\t}\n\n\t\t\t\t// If the result is a promise, we have to keep it for\n\t\t\t\t// later processing and await the result properly.\n\t\t\t\tif (isThenable(result)) {\n\t\t\t\t\tif (!resultPromises) {\n\t\t\t\t\t\tresultPromises = [];\n\t\t\t\t\t}\n\n\t\t\t\t\tresultPromises.push(result);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// With result promises, we have to loop over each and\n\t\t\t// await the result before we can return any result.\n\t\t\tif (resultPromises) {\n\t\t\t\treturn (async () => {\n\t\t\t\t\tfor (const resultPromise of resultPromises) {\n\t\t\t\t\t\tconst result = await resultPromise;\n\t\t\t\t\t\tif (typeof result === 'string') {\n\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn null;\n\t\t\t\t})();\n\t\t\t}\n\n\t\t\treturn null;\n\t\t};\n\n\t\tconst withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames);\n\t\tif (withBasenames) {\n\t\t\tresultExpression.allBasenames = withBasenames.allBasenames;\n\t\t}\n\n\t\tconst allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, [] as string[]);\n\t\tif (allPaths.length) {\n\t\t\tresultExpression.allPaths = allPaths;\n\t\t}\n\n\t\treturn resultExpression;\n\t}\n\n\tconst resultExpression: ParsedStringPattern = function (path: string, base?: string, hasSibling?: (name: string) => boolean | Promise<boolean>) {\n\t\tlet name: string | undefined = undefined;\n\t\tlet resultPromises: Promise<string | null>[] | undefined = undefined;\n\n\t\tfor (let i = 0, n = parsedPatterns.length; i < n; i++) {\n\n\t\t\t// Pattern matches path\n\t\t\tconst parsedPattern = (<ParsedExpressionPattern>parsedPatterns[i]);\n\t\t\tif (parsedPattern.requiresSiblings && hasSibling) {\n\t\t\t\tif (!base) {\n\t\t\t\t\tbase = basename(path);\n\t\t\t\t}\n\n\t\t\t\tif (!name) {\n\t\t\t\t\tname = base.substr(0, base.length - extname(path).length);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst result = parsedPattern(path, base, name, hasSibling);\n\t\t\tif (typeof result === 'string') {\n\t\t\t\treturn result; // immediately return as soon as the first expression matches\n\t\t\t}\n\n\t\t\t// If the result is a promise, we have to keep it for\n\t\t\t// later processing and await the result properly.\n\t\t\tif (isThenable(result)) {\n\t\t\t\tif (!resultPromises) {\n\t\t\t\t\tresultPromises = [];\n\t\t\t\t}\n\n\t\t\t\tresultPromises.push(result);\n\t\t\t}\n\t\t}\n\n\t\t// With result promises, we have to loop over each and\n\t\t// await the result before we can return any result.\n\t\tif (resultPromises) {\n\t\t\treturn (async () => {\n\t\t\t\tfor (const resultPromise of resultPromises) {\n\t\t\t\t\tconst result = await resultPromise;\n\t\t\t\t\tif (typeof result === 'string') {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\t\t\t})();\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tconst withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames);\n\tif (withBasenames) {\n\t\tresultExpression.allBasenames = withBasenames.allBasenames;\n\t}\n\n\tconst allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, [] as string[]);\n\tif (allPaths.length) {\n\t\tresultExpression.allPaths = allPaths;\n\t}\n\n\treturn resultExpression;\n}\n\nfunction parseExpressionPattern(pattern: string, value: boolean | SiblingClause, options: IGlobOptions): (ParsedStringPattern | ParsedExpressionPattern) {\n\tif (value === false) {\n\t\treturn NULL; // pattern is disabled\n\t}\n\n\tconst parsedPattern = parsePattern(pattern, options);\n\tif (parsedPattern === NULL) {\n\t\treturn NULL;\n\t}\n\n\t// Expression Pattern is <boolean>\n\tif (typeof value === 'boolean') {\n\t\treturn parsedPattern;\n\t}\n\n\t// Expression Pattern is <SiblingClause>\n\tif (value) {\n\t\tconst when = value.when;\n\t\tif (typeof when === 'string') {\n\t\t\tconst result: ParsedExpressionPattern = (path: string, basename?: string, name?: string, hasSibling?: (name: string) => boolean | Promise<boolean>) => {\n\t\t\t\tif (!hasSibling || !parsedPattern(path, basename)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst clausePattern = when.replace('$(basename)', () => name!);\n\t\t\t\tconst matched = hasSibling(clausePattern);\n\t\t\t\treturn isThenable(matched) ?\n\t\t\t\t\tmatched.then(match => match ? pattern : null) :\n\t\t\t\t\tmatched ? pattern : null;\n\t\t\t};\n\n\t\t\tresult.requiresSiblings = true;\n\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t// Expression is anything\n\treturn parsedPattern;\n}\n\nfunction aggregateBasenameMatches(parsedPatterns: Array<ParsedStringPattern | ParsedExpressionPattern>, result?: string): Array<ParsedStringPattern | ParsedExpressionPattern> {\n\tconst basenamePatterns = parsedPatterns.filter(parsedPattern => !!(<ParsedStringPattern>parsedPattern).basenames);\n\tif (basenamePatterns.length < 2) {\n\t\treturn parsedPatterns;\n\t}\n\n\tconst basenames = basenamePatterns.reduce<string[]>((all, current) => {\n\t\tconst basenames = (<ParsedStringPattern>current).basenames;\n\n\t\treturn basenames ? all.concat(basenames) : all;\n\t}, [] as string[]);\n\n\tlet patterns: string[];\n\tif (result) {\n\t\tpatterns = [];\n\n\t\tfor (let i = 0, n = basenames.length; i < n; i++) {\n\t\t\tpatterns.push(result);\n\t\t}\n\t} else {\n\t\tpatterns = basenamePatterns.reduce((all, current) => {\n\t\t\tconst patterns = (<ParsedStringPattern>current).patterns;\n\n\t\t\treturn patterns ? all.concat(patterns) : all;\n\t\t}, [] as string[]);\n\t}\n\n\tconst aggregate: ParsedStringPattern = function (path: string, basename?: string) {\n\t\tif (typeof path !== 'string') {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (!basename) {\n\t\t\tlet i: number;\n\t\t\tfor (i = path.length; i > 0; i--) {\n\t\t\t\tconst ch = path.charCodeAt(i - 1);\n\t\t\t\tif (ch === CharCode.Slash || ch === CharCode.Backslash) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbasename = path.substr(i);\n\t\t}\n\n\t\tconst index = basenames.indexOf(basename);\n\t\treturn index !== -1 ? patterns[index] : null;\n\t};\n\n\taggregate.basenames = basenames;\n\taggregate.patterns = patterns;\n\taggregate.allBasenames = basenames;\n\n\tconst aggregatedPatterns = parsedPatterns.filter(parsedPattern => !(<ParsedStringPattern>parsedPattern).basenames);\n\taggregatedPatterns.push(aggregate);\n\n\treturn aggregatedPatterns;\n}\n\nexport function patternsEquals(patternsA: Array<string | IRelativePattern> | undefined, patternsB: Array<string | IRelativePattern> | undefined): boolean {\n\treturn equals(patternsA, patternsB, (a, b) => {\n\t\tif (typeof a === 'string' && typeof b === 'string') {\n\t\t\treturn a === b;\n\t\t}\n\n\t\tif (typeof a !== 'string' && typeof b !== 'string') {\n\t\t\treturn a.base === b.base && a.pattern === b.pattern;\n\t\t}\n\n\t\treturn false;\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { GLOBSTAR, IRelativePattern, parse, ParsedPattern } from '../../../base/common/glob.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable } from '../../../base/common/lifecycle.js';\nimport { isAbsolute } from '../../../base/common/path.js';\nimport { isLinux } from '../../../base/common/platform.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { FileChangeFilter, FileChangeType, IFileChange, isParent } from './files.js';\n\ninterface IWatchRequest {\n\n\t/**\n\t * The path to watch.\n\t */\n\treadonly path: string;\n\n\t/**\n\t * Whether to watch recursively or not.\n\t */\n\treadonly recursive: boolean;\n\n\t/**\n\t * A set of glob patterns or paths to exclude from watching.\n\t */\n\treadonly excludes: string[];\n\n\t/**\n\t * An optional set of glob patterns or paths to include for\n\t * watching. If not provided, all paths are considered for\n\t * events.\n\t */\n\treadonly includes?: Array<string | IRelativePattern>;\n\n\t/**\n\t * If provided, file change events from the watcher that\n\t * are a result of this watch request will carry the same\n\t * id.\n\t */\n\treadonly correlationId?: number;\n\n\t/**\n\t * If provided, allows to filter the events that the watcher should consider\n\t * for emitting. If not provided, all events are emitted.\n\t *\n\t * For example, to emit added and updated events, set to:\n\t * `FileChangeFilter.ADDED | FileChangeFilter.UPDATED`.\n\t */\n\treadonly filter?: FileChangeFilter;\n}\n\nexport interface IWatchRequestWithCorrelation extends IWatchRequest {\n\treadonly correlationId: number;\n}\n\nexport function isWatchRequestWithCorrelation(request: IWatchRequest): request is IWatchRequestWithCorrelation {\n\treturn typeof request.correlationId === 'number';\n}\n\nexport interface INonRecursiveWatchRequest extends IWatchRequest {\n\n\t/**\n\t * The watcher will be non-recursive.\n\t */\n\treadonly recursive: false;\n}\n\nexport interface IRecursiveWatchRequest extends IWatchRequest {\n\n\t/**\n\t * The watcher will be recursive.\n\t */\n\treadonly recursive: true;\n\n\t/**\n\t * @deprecated this only exists for WSL1 support and should never\n\t * be used in any other case.\n\t */\n\tpollingInterval?: number;\n}\n\nexport function isRecursiveWatchRequest(request: IWatchRequest): request is IRecursiveWatchRequest {\n\treturn request.recursive === true;\n}\n\nexport type IUniversalWatchRequest = IRecursiveWatchRequest | INonRecursiveWatchRequest;\n\nexport interface IWatcherErrorEvent {\n\treadonly error: string;\n\treadonly request?: IUniversalWatchRequest;\n}\n\nexport interface IWatcher {\n\n\t/**\n\t * A normalized file change event from the raw events\n\t * the watcher emits.\n\t */\n\treadonly onDidChangeFile: Event<IFileChange[]>;\n\n\t/**\n\t * An event to indicate a message that should get logged.\n\t */\n\treadonly onDidLogMessage: Event<ILogMessage>;\n\n\t/**\n\t * An event to indicate an error occurred from the watcher\n\t * that is unrecoverable. Listeners should restart the\n\t * watcher if possible.\n\t */\n\treadonly onDidError: Event<IWatcherErrorEvent>;\n\n\t/**\n\t * Configures the watcher to watch according to the\n\t * requests. Any existing watched path that is not\n\t * in the array, will be removed from watching and\n\t * any new path will be added to watching.\n\t */\n\twatch(requests: IWatchRequest[]): Promise<void>;\n\n\t/**\n\t * Enable verbose logging in the watcher.\n\t */\n\tsetVerboseLogging(enabled: boolean): Promise<void>;\n\n\t/**\n\t * Stop all watchers.\n\t */\n\tstop(): Promise<void>;\n}\n\nexport interface IRecursiveWatcher extends IWatcher {\n\twatch(requests: IRecursiveWatchRequest[]): Promise<void>;\n}\n\nexport interface IRecursiveWatcherWithSubscribe extends IRecursiveWatcher {\n\n\t/**\n\t * Subscribe to file events for the given path. The callback is called\n\t * whenever a file event occurs for the path. If the watcher failed,\n\t * the error parameter is set to `true`.\n\t *\n\t * @returns an `IDisposable` to stop listening to events or `undefined`\n\t * if no events can be watched for the path given the current set of\n\t * recursive watch requests.\n\t */\n\tsubscribe(path: string, callback: (error: true | null, change?: IFileChange) => void): IDisposable | undefined;\n}\n\nexport interface IRecursiveWatcherOptions {\n\n\t/**\n\t * If `true`, will enable polling for all watchers, otherwise\n\t * will enable it for paths included in the string array.\n\t *\n\t * @deprecated this only exists for WSL1 support and should never\n\t * be used in any other case.\n\t */\n\treadonly usePolling: boolean | string[];\n\n\t/**\n\t * If polling is enabled (via `usePolling`), defines the duration\n\t * in which the watcher will poll for changes.\n\t *\n\t * @deprecated this only exists for WSL1 support and should never\n\t * be used in any other case.\n\t */\n\treadonly pollingInterval?: number;\n}\n\nexport interface INonRecursiveWatcher extends IWatcher {\n\twatch(requests: INonRecursiveWatchRequest[]): Promise<void>;\n}\n\nexport interface IUniversalWatcher extends IWatcher {\n\twatch(requests: IUniversalWatchRequest[]): Promise<void>;\n}\n\nexport abstract class AbstractWatcherClient extends Disposable {\n\n\tprivate static readonly MAX_RESTARTS = 5;\n\n\tprivate watcher: IWatcher | undefined;\n\tprivate readonly watcherDisposables = this._register(new MutableDisposable());\n\n\tprivate requests: IWatchRequest[] | undefined = undefined;\n\n\tprivate restartCounter = 0;\n\n\tconstructor(\n\t\tprivate readonly onFileChanges: (changes: IFileChange[]) => void,\n\t\tprivate readonly onLogMessage: (msg: ILogMessage) => void,\n\t\tprivate verboseLogging: boolean,\n\t\tprivate options: {\n\t\t\treadonly type: string;\n\t\t\treadonly restartOnError: boolean;\n\t\t}\n\t) {\n\t\tsuper();\n\t}\n\n\tprotected abstract createWatcher(disposables: DisposableStore): IWatcher;\n\n\tprotected init(): void {\n\n\t\t// Associate disposables to the watcher\n\t\tconst disposables = new DisposableStore();\n\t\tthis.watcherDisposables.value = disposables;\n\n\t\t// Ask implementors to create the watcher\n\t\tthis.watcher = this.createWatcher(disposables);\n\t\tthis.watcher.setVerboseLogging(this.verboseLogging);\n\n\t\t// Wire in event handlers\n\t\tdisposables.add(this.watcher.onDidChangeFile(changes => this.onFileChanges(changes)));\n\t\tdisposables.add(this.watcher.onDidLogMessage(msg => this.onLogMessage(msg)));\n\t\tdisposables.add(this.watcher.onDidError(e => this.onError(e.error, e.request)));\n\t}\n\n\tprotected onError(error: string, failedRequest?: IUniversalWatchRequest): void {\n\n\t\t// Restart on error (up to N times, if possible)\n\t\tif (this.canRestart(error, failedRequest)) {\n\t\t\tif (this.restartCounter < AbstractWatcherClient.MAX_RESTARTS && this.requests) {\n\t\t\t\tthis.error(`restarting watcher after unexpected error: ${error}`);\n\t\t\t\tthis.restart(this.requests);\n\t\t\t} else {\n\t\t\t\tthis.error(`gave up attempting to restart watcher after unexpected error: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\t// Do not attempt to restart otherwise, report the error\n\t\telse {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\tprivate canRestart(error: string, failedRequest?: IUniversalWatchRequest): boolean {\n\t\tif (!this.options.restartOnError) {\n\t\t\treturn false; // disabled by options\n\t\t}\n\n\t\tif (failedRequest) {\n\t\t\t// do not treat a failing request as a reason to restart the entire\n\t\t\t// watcher. it is possible that from a large amount of watch requests\n\t\t\t// some fail and we would constantly restart all requests only because\n\t\t\t// of that. rather, continue the watcher and leave the failed request\n\t\t\treturn false;\n\t\t}\n\n\t\tif (\n\t\t\terror.indexOf('No space left on device') !== -1 ||\n\t\t\terror.indexOf('EMFILE') !== -1\n\t\t) {\n\t\t\t// do not restart when the error indicates that the system is running\n\t\t\t// out of handles for file watching. this is not recoverable anyway\n\t\t\t// and needs changes to the system before continuing\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate restart(requests: IUniversalWatchRequest[]): void {\n\t\tthis.restartCounter++;\n\n\t\tthis.init();\n\t\tthis.watch(requests);\n\t}\n\n\tasync watch(requests: IUniversalWatchRequest[]): Promise<void> {\n\t\tthis.requests = requests;\n\n\t\tawait this.watcher?.watch(requests);\n\t}\n\n\tasync setVerboseLogging(verboseLogging: boolean): Promise<void> {\n\t\tthis.verboseLogging = verboseLogging;\n\n\t\tawait this.watcher?.setVerboseLogging(verboseLogging);\n\t}\n\n\tprivate error(message: string) {\n\t\tthis.onLogMessage({ type: 'error', message: `[File Watcher (${this.options.type})] ${message}` });\n\t}\n\n\tprotected trace(message: string) {\n\t\tthis.onLogMessage({ type: 'trace', message: `[File Watcher (${this.options.type})] ${message}` });\n\t}\n\n\toverride dispose(): void {\n\n\t\t// Render the watcher invalid from here\n\t\tthis.watcher = undefined;\n\n\t\treturn super.dispose();\n\t}\n}\n\nexport abstract class AbstractNonRecursiveWatcherClient extends AbstractWatcherClient {\n\n\tconstructor(\n\t\tonFileChanges: (changes: IFileChange[]) => void,\n\t\tonLogMessage: (msg: ILogMessage) => void,\n\t\tverboseLogging: boolean\n\t) {\n\t\tsuper(onFileChanges, onLogMessage, verboseLogging, { type: 'node.js', restartOnError: false });\n\t}\n\n\tprotected abstract override createWatcher(disposables: DisposableStore): INonRecursiveWatcher;\n}\n\nexport abstract class AbstractUniversalWatcherClient extends AbstractWatcherClient {\n\n\tconstructor(\n\t\tonFileChanges: (changes: IFileChange[]) => void,\n\t\tonLogMessage: (msg: ILogMessage) => void,\n\t\tverboseLogging: boolean\n\t) {\n\t\tsuper(onFileChanges, onLogMessage, verboseLogging, { type: 'universal', restartOnError: true });\n\t}\n\n\tprotected abstract override createWatcher(disposables: DisposableStore): IUniversalWatcher;\n}\n\nexport interface ILogMessage {\n\treadonly type: 'trace' | 'warn' | 'error' | 'info' | 'debug';\n\treadonly message: string;\n}\n\nexport function reviveFileChanges(changes: IFileChange[]): IFileChange[] {\n\treturn changes.map(change => ({\n\t\ttype: change.type,\n\t\tresource: URI.revive(change.resource),\n\t\tcId: change.cId\n\t}));\n}\n\nexport function coalesceEvents(changes: IFileChange[]): IFileChange[] {\n\n\t// Build deltas\n\tconst coalescer = new EventCoalescer();\n\tfor (const event of changes) {\n\t\tcoalescer.processEvent(event);\n\t}\n\n\treturn coalescer.coalesce();\n}\n\nexport function normalizeWatcherPattern(path: string, pattern: string | IRelativePattern): string | IRelativePattern {\n\n\t// Patterns are always matched on the full absolute path\n\t// of the event. As such, if the pattern is not absolute\n\t// and is a string and does not start with a leading\n\t// `**`, we have to convert it to a relative pattern with\n\t// the given `base`\n\n\tif (typeof pattern === 'string' && !pattern.startsWith(GLOBSTAR) && !isAbsolute(pattern)) {\n\t\treturn { base: path, pattern };\n\t}\n\n\treturn pattern;\n}\n\nexport function parseWatcherPatterns(path: string, patterns: Array<string | IRelativePattern>): ParsedPattern[] {\n\tconst parsedPatterns: ParsedPattern[] = [];\n\n\tfor (const pattern of patterns) {\n\t\tparsedPatterns.push(parse(normalizeWatcherPattern(path, pattern)));\n\t}\n\n\treturn parsedPatterns;\n}\n\nclass EventCoalescer {\n\n\tprivate readonly coalesced = new Set<IFileChange>();\n\tprivate readonly mapPathToChange = new Map<string, IFileChange>();\n\n\tprivate toKey(event: IFileChange): string {\n\t\tif (isLinux) {\n\t\t\treturn event.resource.fsPath;\n\t\t}\n\n\t\treturn event.resource.fsPath.toLowerCase(); // normalise to file system case sensitivity\n\t}\n\n\tprocessEvent(event: IFileChange): void {\n\t\tconst existingEvent = this.mapPathToChange.get(this.toKey(event));\n\n\t\tlet keepEvent = false;\n\n\t\t// Event path already exists\n\t\tif (existingEvent) {\n\t\t\tconst currentChangeType = existingEvent.type;\n\t\t\tconst newChangeType = event.type;\n\n\t\t\t// macOS/Windows: track renames to different case\n\t\t\t// by keeping both CREATE and DELETE events\n\t\t\tif (existingEvent.resource.fsPath !== event.resource.fsPath && (event.type === FileChangeType.DELETED || event.type === FileChangeType.ADDED)) {\n\t\t\t\tkeepEvent = true;\n\t\t\t}\n\n\t\t\t// Ignore CREATE followed by DELETE in one go\n\t\t\telse if (currentChangeType === FileChangeType.ADDED && newChangeType === FileChangeType.DELETED) {\n\t\t\t\tthis.mapPathToChange.delete(this.toKey(event));\n\t\t\t\tthis.coalesced.delete(existingEvent);\n\t\t\t}\n\n\t\t\t// Flatten DELETE followed by CREATE into CHANGE\n\t\t\telse if (currentChangeType === FileChangeType.DELETED && newChangeType === FileChangeType.ADDED) {\n\t\t\t\texistingEvent.type = FileChangeType.UPDATED;\n\t\t\t}\n\n\t\t\t// Do nothing. Keep the created event\n\t\t\telse if (currentChangeType === FileChangeType.ADDED && newChangeType === FileChangeType.UPDATED) { }\n\n\t\t\t// Otherwise apply change type\n\t\t\telse {\n\t\t\t\texistingEvent.type = newChangeType;\n\t\t\t}\n\t\t}\n\n\t\t// Otherwise keep\n\t\telse {\n\t\t\tkeepEvent = true;\n\t\t}\n\n\t\tif (keepEvent) {\n\t\t\tthis.coalesced.add(event);\n\t\t\tthis.mapPathToChange.set(this.toKey(event), event);\n\t\t}\n\t}\n\n\tcoalesce(): IFileChange[] {\n\t\tconst addOrChangeEvents: IFileChange[] = [];\n\t\tconst deletedPaths: string[] = [];\n\n\t\t// This algorithm will remove all DELETE events up to the root folder\n\t\t// that got deleted if any. This ensures that we are not producing\n\t\t// DELETE events for each file inside a folder that gets deleted.\n\t\t//\n\t\t// 1.) split ADD/CHANGE and DELETED events\n\t\t// 2.) sort short deleted paths to the top\n\t\t// 3.) for each DELETE, check if there is a deleted parent and ignore the event in that case\n\t\treturn Array.from(this.coalesced).filter(e => {\n\t\t\tif (e.type !== FileChangeType.DELETED) {\n\t\t\t\taddOrChangeEvents.push(e);\n\n\t\t\t\treturn false; // remove ADD / CHANGE\n\t\t\t}\n\n\t\t\treturn true; // keep DELETE\n\t\t}).sort((e1, e2) => {\n\t\t\treturn e1.resource.fsPath.length - e2.resource.fsPath.length; // shortest path first\n\t\t}).filter(e => {\n\t\t\tif (deletedPaths.some(deletedPath => isParent(e.resource.fsPath, deletedPath, !isLinux /* ignorecase */))) {\n\t\t\t\treturn false; // DELETE is ignored if parent is deleted already\n\t\t\t}\n\n\t\t\t// otherwise mark as deleted\n\t\t\tdeletedPaths.push(e.resource.fsPath);\n\n\t\t\treturn true;\n\t\t}).concat(addOrChangeEvents);\n\t}\n}\n\nexport function isFiltered(event: IFileChange, filter: FileChangeFilter | undefined): boolean {\n\tif (typeof filter === 'number') {\n\t\tswitch (event.type) {\n\t\t\tcase FileChangeType.ADDED:\n\t\t\t\treturn (filter & FileChangeFilter.ADDED) === 0;\n\t\t\tcase FileChangeType.DELETED:\n\t\t\t\treturn (filter & FileChangeFilter.DELETED) === 0;\n\t\t\tcase FileChangeType.UPDATED:\n\t\t\t\treturn (filter & FileChangeFilter.UPDATED) === 0;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nexport function requestFilterToString(filter: FileChangeFilter | undefined): string {\n\tif (typeof filter === 'number') {\n\t\tconst filters = [];\n\t\tif (filter & FileChangeFilter.ADDED) {\n\t\t\tfilters.push('Added');\n\t\t}\n\t\tif (filter & FileChangeFilter.DELETED) {\n\t\t\tfilters.push('Deleted');\n\t\t}\n\t\tif (filter & FileChangeFilter.UPDATED) {\n\t\t\tfilters.push('Updated');\n\t\t}\n\n\t\tif (filters.length === 0) {\n\t\t\treturn '<all>';\n\t\t}\n\n\t\treturn `[${filters.join(', ')}]`;\n\t}\n\n\treturn '<none>';\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { insert } from '../../../base/common/arrays.js';\nimport { ThrottledDelayer } from '../../../base/common/async.js';\nimport { onUnexpectedError } from '../../../base/common/errors.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { removeTrailingPathSeparator } from '../../../base/common/extpath.js';\nimport { Disposable, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { normalize } from '../../../base/common/path.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IFileChange, IFileSystemProvider, IWatchOptions } from './files.js';\nimport { AbstractNonRecursiveWatcherClient, AbstractUniversalWatcherClient, ILogMessage, INonRecursiveWatchRequest, IRecursiveWatcherOptions, isRecursiveWatchRequest, IUniversalWatchRequest, reviveFileChanges } from './watcher.js';\nimport { ILogService, LogLevel } from '../../log/common/log.js';\n\nexport interface IDiskFileSystemProviderOptions {\n\twatcher?: {\n\n\t\t/**\n\t\t * Extra options for the recursive file watching.\n\t\t */\n\t\trecursive?: IRecursiveWatcherOptions;\n\n\t\t/**\n\t\t * Forces all file watch requests to run through a\n\t\t * single universal file watcher, both recursive\n\t\t * and non-recursively.\n\t\t *\n\t\t * Enabling this option might cause some overhead,\n\t\t * specifically the universal file watcher will run\n\t\t * in a separate process given its complexity. Only\n\t\t * enable it when you understand the consequences.\n\t\t */\n\t\tforceUniversal?: boolean;\n\t};\n}\n\nexport abstract class AbstractDiskFileSystemProvider extends Disposable implements\n\tPick<IFileSystemProvider, 'watch'>,\n\tPick<IFileSystemProvider, 'onDidChangeFile'>,\n\tPick<IFileSystemProvider, 'onDidWatchError'> {\n\n\tconstructor(\n\t\tprotected readonly logService: ILogService,\n\t\tprivate readonly options?: IDiskFileSystemProviderOptions\n\t) {\n\t\tsuper();\n\t}\n\n\tprotected readonly _onDidChangeFile = this._register(new Emitter<readonly IFileChange[]>());\n\treadonly onDidChangeFile = this._onDidChangeFile.event;\n\n\tprotected readonly _onDidWatchError = this._register(new Emitter<string>());\n\treadonly onDidWatchError = this._onDidWatchError.event;\n\n\twatch(resource: URI, opts: IWatchOptions): IDisposable {\n\t\tif (opts.recursive || this.options?.watcher?.forceUniversal) {\n\t\t\treturn this.watchUniversal(resource, opts);\n\t\t}\n\n\t\treturn this.watchNonRecursive(resource, opts);\n\t}\n\n\tprivate getRefreshWatchersDelay(count: number): number {\n\t\tif (count > 200) {\n\t\t\t// If there are many requests to refresh, start to throttle\n\t\t\t// the refresh to reduce pressure. We see potentially thousands\n\t\t\t// of requests coming in on startup repeatedly so we take it easy.\n\t\t\treturn 500;\n\t\t}\n\n\t\t// By default, use a short delay to keep watchers updating fast but still\n\t\t// with a delay so that we can efficiently deduplicate requests or reuse\n\t\t// existing watchers.\n\t\treturn 0;\n\t}\n\n\t//#region File Watching (universal)\n\n\tprivate universalWatcher: AbstractUniversalWatcherClient | undefined;\n\n\tprivate readonly universalWatchRequests: IUniversalWatchRequest[] = [];\n\tprivate readonly universalWatchRequestDelayer = this._register(new ThrottledDelayer<void>(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));\n\n\tprivate watchUniversal(resource: URI, opts: IWatchOptions): IDisposable {\n\t\tconst request = this.toWatchRequest(resource, opts);\n\t\tconst remove = insert(this.universalWatchRequests, request);\n\n\t\t// Trigger update\n\t\tthis.refreshUniversalWatchers();\n\n\t\treturn toDisposable(() => {\n\n\t\t\t// Remove from list of paths to watch universally\n\t\t\tremove();\n\n\t\t\t// Trigger update\n\t\t\tthis.refreshUniversalWatchers();\n\t\t});\n\t}\n\n\tprivate toWatchRequest(resource: URI, opts: IWatchOptions): IUniversalWatchRequest {\n\t\tconst request: IUniversalWatchRequest = {\n\t\t\tpath: this.toWatchPath(resource),\n\t\t\texcludes: opts.excludes,\n\t\t\tincludes: opts.includes,\n\t\t\trecursive: opts.recursive,\n\t\t\tfilter: opts.filter,\n\t\t\tcorrelationId: opts.correlationId\n\t\t};\n\n\t\tif (isRecursiveWatchRequest(request)) {\n\n\t\t\t// Adjust for polling\n\t\t\tconst usePolling = this.options?.watcher?.recursive?.usePolling;\n\t\t\tif (usePolling === true) {\n\t\t\t\trequest.pollingInterval = this.options?.watcher?.recursive?.pollingInterval ?? 5000;\n\t\t\t} else if (Array.isArray(usePolling)) {\n\t\t\t\tif (usePolling.includes(request.path)) {\n\t\t\t\t\trequest.pollingInterval = this.options?.watcher?.recursive?.pollingInterval ?? 5000;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn request;\n\t}\n\n\tprivate refreshUniversalWatchers(): void {\n\t\tthis.universalWatchRequestDelayer.trigger(() => {\n\t\t\treturn this.doRefreshUniversalWatchers();\n\t\t}, this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(error => onUnexpectedError(error));\n\t}\n\n\tprivate doRefreshUniversalWatchers(): Promise<void> {\n\n\t\t// Create watcher if this is the first time\n\t\tif (!this.universalWatcher) {\n\t\t\tthis.universalWatcher = this._register(this.createUniversalWatcher(\n\t\t\t\tchanges => this._onDidChangeFile.fire(reviveFileChanges(changes)),\n\t\t\t\tmsg => this.onWatcherLogMessage(msg),\n\t\t\t\tthis.logService.getLevel() === LogLevel.Trace\n\t\t\t));\n\n\t\t\t// Apply log levels dynamically\n\t\t\tthis._register(this.logService.onDidChangeLogLevel(() => {\n\t\t\t\tthis.universalWatcher?.setVerboseLogging(this.logService.getLevel() === LogLevel.Trace);\n\t\t\t}));\n\t\t}\n\n\t\t// Ask to watch the provided paths\n\t\treturn this.universalWatcher.watch(this.universalWatchRequests);\n\t}\n\n\tprotected abstract createUniversalWatcher(\n\t\tonChange: (changes: IFileChange[]) => void,\n\t\tonLogMessage: (msg: ILogMessage) => void,\n\t\tverboseLogging: boolean\n\t): AbstractUniversalWatcherClient;\n\n\t//#endregion\n\n\t//#region File Watching (non-recursive)\n\n\tprivate nonRecursiveWatcher: AbstractNonRecursiveWatcherClient | undefined;\n\n\tprivate readonly nonRecursiveWatchRequests: INonRecursiveWatchRequest[] = [];\n\tprivate readonly nonRecursiveWatchRequestDelayer = this._register(new ThrottledDelayer<void>(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)));\n\n\tprivate watchNonRecursive(resource: URI, opts: IWatchOptions): IDisposable {\n\n\t\t// Add to list of paths to watch non-recursively\n\t\tconst request: INonRecursiveWatchRequest = {\n\t\t\tpath: this.toWatchPath(resource),\n\t\t\texcludes: opts.excludes,\n\t\t\tincludes: opts.includes,\n\t\t\trecursive: false,\n\t\t\tfilter: opts.filter,\n\t\t\tcorrelationId: opts.correlationId\n\t\t};\n\t\tconst remove = insert(this.nonRecursiveWatchRequests, request);\n\n\t\t// Trigger update\n\t\tthis.refreshNonRecursiveWatchers();\n\n\t\treturn toDisposable(() => {\n\n\t\t\t// Remove from list of paths to watch non-recursively\n\t\t\tremove();\n\n\t\t\t// Trigger update\n\t\t\tthis.refreshNonRecursiveWatchers();\n\t\t});\n\t}\n\n\tprivate refreshNonRecursiveWatchers(): void {\n\t\tthis.nonRecursiveWatchRequestDelayer.trigger(() => {\n\t\t\treturn this.doRefreshNonRecursiveWatchers();\n\t\t}, this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(error => onUnexpectedError(error));\n\t}\n\n\tprivate doRefreshNonRecursiveWatchers(): Promise<void> {\n\n\t\t// Create watcher if this is the first time\n\t\tif (!this.nonRecursiveWatcher) {\n\t\t\tthis.nonRecursiveWatcher = this._register(this.createNonRecursiveWatcher(\n\t\t\t\tchanges => this._onDidChangeFile.fire(reviveFileChanges(changes)),\n\t\t\t\tmsg => this.onWatcherLogMessage(msg),\n\t\t\t\tthis.logService.getLevel() === LogLevel.Trace\n\t\t\t));\n\n\t\t\t// Apply log levels dynamically\n\t\t\tthis._register(this.logService.onDidChangeLogLevel(() => {\n\t\t\t\tthis.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel() === LogLevel.Trace);\n\t\t\t}));\n\t\t}\n\n\t\t// Ask to watch the provided paths\n\t\treturn this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests);\n\t}\n\n\tprotected abstract createNonRecursiveWatcher(\n\t\tonChange: (changes: IFileChange[]) => void,\n\t\tonLogMessage: (msg: ILogMessage) => void,\n\t\tverboseLogging: boolean\n\t): AbstractNonRecursiveWatcherClient;\n\n\t//#endregion\n\n\tprivate onWatcherLogMessage(msg: ILogMessage): void {\n\t\tif (msg.type === 'error') {\n\t\t\tthis._onDidWatchError.fire(msg.message);\n\t\t}\n\n\t\tthis.logWatcherMessage(msg);\n\t}\n\n\tprotected logWatcherMessage(msg: ILogMessage): void {\n\t\tthis.logService[msg.type](msg.message);\n\t}\n\n\tprotected toFilePath(resource: URI): string {\n\t\treturn normalize(resource.fsPath);\n\t}\n\n\tprivate toWatchPath(resource: URI): string {\n\t\tconst filePath = this.toFilePath(resource);\n\n\t\t// Ensure to have any trailing path separators removed, otherwise\n\t\t// we may believe the path is not \"real\" and will convert every\n\t\t// event back to this form, which is not warranted.\n\t\t// See also https://github.com/microsoft/vscode/issues/210517\n\t\treturn removeTrailingPathSeparator(filePath);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { assertDefined } from '../types.js';\nimport { Disposable, DisposableMap } from '../lifecycle.js';\nimport { CancellationTokenSource, CancellationToken } from '../cancellation.js';\n\n/**\n * Helper type that represents a function that has an optional {@linkcode CancellationToken}\n * argument argument at the end of the arguments list.\n *\n * @typeparam `TFunction` - Type of the function arguments list of which will be extended\n * \t\t\t\t\t\t\twith an optional {@linkcode CancellationToken} argument.\n */\ntype TWithOptionalCancellationToken<TFunction extends Function> = TFunction extends (...args: infer TArgs) => infer TReturn\n\t? (...args: [...TArgs, cancellatioNToken?: CancellationToken]) => TReturn\n\t: never;\n\n/**\n * Decorator that provides a mechanism to cancel previous calls of the decorated method\n * by providing a `cancellation token` as the last argument of the method, which gets\n * cancelled immediately on subsequent call of the decorated method.\n *\n * Therefore to use this decorator, the two conditions must be met:\n *\n * - the decorated method must have an *optional* {@linkcode CancellationToken} argument at\n * \t the end of the arguments list\n * - the object that the decorated method belongs to must implement the {@linkcode Disposable};\n *   this requirement comes from the internal implementation of the decorator that\n *   creates new resources that need to be eventually disposed by someone\n *\n * @typeparam `TObject` - Object type that the decorated method belongs to.\n * @typeparam `TArgs` - Argument list of the decorated method.\n * @typeparam `TReturn` - Return value type of the decorated method.\n *\n * ### Examples\n *\n * ```typescript\n * // let's say we have a class that implements the `Disposable` interface that we want\n * // to use the decorator on\n * class Example extends Disposable {\n * \t\tasync doSomethingAsync(arg1: number, arg2: string): Promise<void> {\n * \t\t\t// do something async..\n * \t\t\tawait new Promise(resolve => setTimeout(resolve, 1000));\n * \t\t}\n * }\n * ```\n *\n * ```typescript\n * // to do that we need to add the `CancellationToken` argument to the end of args list\n * class Example extends Disposable {\n * \t\t@cancelPreviousCalls\n * \t\tasync doSomethingAsync(arg1: number, arg2: string, cancellationToken?: CancellationToken): Promise<void> {\n * \t\t\tconsole.log(`call with args ${arg1} and ${arg2} initiated`);\n *\n * \t\t\t// the decorator will create the cancellation token automatically\n * \t\t\tassertDefined(\n * \t\t\t\tcancellationToken,\n * \t\t\t\t`The method must now have the `CancellationToken` passed to it.`,\n * \t\t\t);\n *\n * \t\t\tcancellationToken.onCancellationRequested(() => {\n * \t\t\t\tconsole.log(`call with args ${arg1} and ${arg2} was cancelled`);\n * \t\t\t});\n *\n * \t\t\t// do something async..\n * \t\t\tawait new Promise(resolve => setTimeout(resolve, 1000));\n *\n * \t\t\t// check cancellation token state after the async operations\n * \t\t\tconsole.log(\n * \t\t\t\t`call with args ${arg1} and ${arg2} completed, canceled?: ${cancellationToken.isCancellationRequested}`,\n * \t\t\t);\n * \t\t}\n * }\n *\n * const example = new Example();\n * // call the decorate method first time\n * example.doSomethingAsync(1, 'foo');\n * // wait for 500ms which is less than 1000ms of the async operation in the first call\n * await new Promise(resolve => setTimeout(resolve, 500));\n * // calling the decorate method second time cancels the token passed to the first call\n * example.doSomethingAsync(2, 'bar');\n * ```\n */\nexport function cancelPreviousCalls<\n\tTObject extends Disposable,\n\tTArgs extends unknown[],\n\tTReturn extends unknown,\n>(\n\t_proto: TObject,\n\tmethodName: string,\n\tdescriptor: TypedPropertyDescriptor<TWithOptionalCancellationToken<(...args: TArgs) => TReturn>>,\n) {\n\tconst originalMethod = descriptor.value;\n\n\tassertDefined(\n\t\toriginalMethod,\n\t\t`Method '${methodName}' is not defined.`,\n\t);\n\n\t// we create the global map that contains `TObjectRecord` for each object instance that\n\t// uses this decorator, which itself contains a `{method name} -> TMethodRecord` mapping\n\t// for each decorated method on the object; the `TMethodRecord` record stores current\n\t// `cancellationTokenSource`, token of which was passed to the previous call of the method\n\tconst objectRecords = new WeakMap<TObject, DisposableMap<string, CancellationTokenSource>>();\n\n\t// decorate the original method with the following logic that upon a new invocation\n\t// of the method cancels the cancellation token that was passed to a previous call\n\tdescriptor.value = function (\n\t\tthis: TObject,\n\t\t...args: Parameters<typeof originalMethod>\n\t): TReturn {\n\t\t// get or create a record for the current object instance\n\t\t// the creation is done once per each object instance\n\t\tlet record = objectRecords.get(this);\n\t\tif (!record) {\n\t\t\trecord = new DisposableMap();\n\t\t\tobjectRecords.set(this, record);\n\n\t\t\tthis._register({\n\t\t\t\tdispose: () => {\n\t\t\t\t\tobjectRecords.get(this)?.dispose();\n\t\t\t\t\tobjectRecords.delete(this);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// when the decorated method is called again and there is a cancellation token\n\t\t// source exists from a previous call, cancel and dispose it, then remove it\n\t\trecord.get(methodName)?.dispose(true);\n\n\t\t// now we need to provide a cancellation token to the original method\n\t\t// as the last argument, there are two cases to consider:\n\t\t// \t- (common case) the arguments list does not have a cancellation token\n\t\t// \t   as the last argument, - in this case we need to add a new one\n\t\t//  - (possible case) - the arguments list already has a cancellation token\n\t\t//    as the last argument, - in this case we need to reuse the token when\n\t\t//    we create ours, and replace the old token with the new one\n\t\t// therefore,\n\n\t\t// get the last argument of the arguments list and if it is present,\n\t\t// reuse it as the token for the new cancellation token source\n\t\tconst lastArgument = (args.length > 0)\n\t\t\t? args[args.length - 1]\n\t\t\t: undefined;\n\t\tconst token = CancellationToken.isCancellationToken(lastArgument)\n\t\t\t? lastArgument\n\t\t\t: undefined;\n\n\t\tconst cancellationSource = new CancellationTokenSource(token);\n\t\trecord.set(methodName, cancellationSource);\n\n\t\t// then update or add cancellation token at the end of the arguments list\n\t\tif (CancellationToken.isCancellationToken(lastArgument)) {\n\t\t\targs[args.length - 1] = cancellationSource.token;\n\t\t} else {\n\t\t\targs.push(cancellationSource.token);\n\t\t}\n\n\t\t// finally invoke the original method passing original arguments and\n\t\t// the new cancellation token at the end of the arguments list\n\t\treturn originalMethod.call(this, ...args);\n\t};\n\n\treturn descriptor;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nfunction createDecorator(mapFn: (fn: Function, key: string) => Function): MethodDecorator {\n\treturn (_target: Object, key: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {\n\t\tlet fnKey: 'value' | 'get' | null = null;\n\t\tlet fn: Function | null = null;\n\n\t\tif (typeof descriptor.value === 'function') {\n\t\t\tfnKey = 'value';\n\t\t\tfn = descriptor.value;\n\t\t} else if (typeof descriptor.get === 'function') {\n\t\t\tfnKey = 'get';\n\t\t\tfn = descriptor.get;\n\t\t}\n\n\t\tif (!fn || typeof key === 'symbol') {\n\t\t\tthrow new Error('not supported');\n\t\t}\n\n\t\tdescriptor[fnKey!] = mapFn(fn, key);\n\t};\n}\n\nexport function memoize(_target: Object, key: string, descriptor: PropertyDescriptor) {\n\tlet fnKey: 'value' | 'get' | null = null;\n\tlet fn: Function | null = null;\n\n\tif (typeof descriptor.value === 'function') {\n\t\tfnKey = 'value';\n\t\tfn = descriptor.value;\n\n\t\tif (fn!.length !== 0) {\n\t\t\tconsole.warn('Memoize should only be used in functions with zero parameters');\n\t\t}\n\t} else if (typeof descriptor.get === 'function') {\n\t\tfnKey = 'get';\n\t\tfn = descriptor.get;\n\t}\n\n\tif (!fn) {\n\t\tthrow new Error('not supported');\n\t}\n\n\tconst memoizeKey = `$memoize$${key}`;\n\tdescriptor[fnKey!] = function (...args: any[]) {\n\t\tif (!this.hasOwnProperty(memoizeKey)) {\n\t\t\tObject.defineProperty(this, memoizeKey, {\n\t\t\t\tconfigurable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: false,\n\t\t\t\tvalue: fn.apply(this, args)\n\t\t\t});\n\t\t}\n\t\treturn (this as any)[memoizeKey];\n\t};\n}\n\nexport interface IDebounceReducer<T> {\n\t(previousValue: T, ...args: any[]): T;\n}\n\nexport function debounce<T>(delay: number, reducer?: IDebounceReducer<T>, initialValueProvider?: () => T) {\n\treturn createDecorator((fn, key) => {\n\t\tconst timerKey = `$debounce$${key}`;\n\t\tconst resultKey = `$debounce$result$${key}`;\n\n\t\treturn function (this: any, ...args: any[]) {\n\t\t\tif (!this[resultKey]) {\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}\n\n\t\t\tclearTimeout(this[timerKey]);\n\n\t\t\tif (reducer) {\n\t\t\t\tthis[resultKey] = reducer(this[resultKey], ...args);\n\t\t\t\targs = [this[resultKey]];\n\t\t\t}\n\n\t\t\tthis[timerKey] = setTimeout(() => {\n\t\t\t\tfn.apply(this, args);\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}, delay);\n\t\t};\n\t});\n}\n\nexport function throttle<T>(delay: number, reducer?: IDebounceReducer<T>, initialValueProvider?: () => T) {\n\treturn createDecorator((fn, key) => {\n\t\tconst timerKey = `$throttle$timer$${key}`;\n\t\tconst resultKey = `$throttle$result$${key}`;\n\t\tconst lastRunKey = `$throttle$lastRun$${key}`;\n\t\tconst pendingKey = `$throttle$pending$${key}`;\n\n\t\treturn function (this: any, ...args: any[]) {\n\t\t\tif (!this[resultKey]) {\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}\n\t\t\tif (this[lastRunKey] === null || this[lastRunKey] === undefined) {\n\t\t\t\tthis[lastRunKey] = -Number.MAX_VALUE;\n\t\t\t}\n\n\t\t\tif (reducer) {\n\t\t\t\tthis[resultKey] = reducer(this[resultKey], ...args);\n\t\t\t}\n\n\t\t\tif (this[pendingKey]) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextTime = this[lastRunKey] + delay;\n\t\t\tif (nextTime <= Date.now()) {\n\t\t\t\tthis[lastRunKey] = Date.now();\n\t\t\t\tfn.apply(this, [this[resultKey]]);\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t} else {\n\t\t\t\tthis[pendingKey] = true;\n\t\t\t\tthis[timerKey] = setTimeout(() => {\n\t\t\t\t\tthis[pendingKey] = false;\n\t\t\t\t\tthis[lastRunKey] = Date.now();\n\t\t\t\t\tfn.apply(this, [this[resultKey]]);\n\t\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t\t}, nextTime - Date.now());\n\t\t\t}\n\t\t};\n\t});\n}\n\nexport { cancelPreviousCalls } from './decorators/cancelPreviousCalls.js';\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { getRandomElement } from '../../../common/arrays.js';\nimport { CancelablePromise, createCancelablePromise, timeout } from '../../../common/async.js';\nimport { VSBuffer } from '../../../common/buffer.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../common/cancellation.js';\nimport { memoize } from '../../../common/decorators.js';\nimport { CancellationError, ErrorNoTelemetry } from '../../../common/errors.js';\nimport { Emitter, Event, EventMultiplexer, Relay } from '../../../common/event.js';\nimport { createSingleCallFunction } from '../../../common/functional.js';\nimport { DisposableStore, dispose, IDisposable, toDisposable } from '../../../common/lifecycle.js';\nimport { revive } from '../../../common/marshalling.js';\nimport * as strings from '../../../common/strings.js';\nimport { isFunction, isUndefinedOrNull } from '../../../common/types.js';\n\n/**\n * An `IChannel` is an abstraction over a collection of commands.\n * You can `call` several commands on a channel, each taking at\n * most one single argument. A `call` always returns a promise\n * with at most one single return value.\n */\nexport interface IChannel {\n\tcall<T>(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T>;\n\tlisten<T>(event: string, arg?: any): Event<T>;\n}\n\n/**\n * An `IServerChannel` is the counter part to `IChannel`,\n * on the server-side. You should implement this interface\n * if you'd like to handle remote promises or events.\n */\nexport interface IServerChannel<TContext = string> {\n\tcall<T>(ctx: TContext, command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T>;\n\tlisten<T>(ctx: TContext, event: string, arg?: any): Event<T>;\n}\n\nconst enum RequestType {\n\tPromise = 100,\n\tPromiseCancel = 101,\n\tEventListen = 102,\n\tEventDispose = 103\n}\n\nfunction requestTypeToStr(type: RequestType): string {\n\tswitch (type) {\n\t\tcase RequestType.Promise:\n\t\t\treturn 'req';\n\t\tcase RequestType.PromiseCancel:\n\t\t\treturn 'cancel';\n\t\tcase RequestType.EventListen:\n\t\t\treturn 'subscribe';\n\t\tcase RequestType.EventDispose:\n\t\t\treturn 'unsubscribe';\n\t}\n}\n\ntype IRawPromiseRequest = { type: RequestType.Promise; id: number; channelName: string; name: string; arg: any };\ntype IRawPromiseCancelRequest = { type: RequestType.PromiseCancel; id: number };\ntype IRawEventListenRequest = { type: RequestType.EventListen; id: number; channelName: string; name: string; arg: any };\ntype IRawEventDisposeRequest = { type: RequestType.EventDispose; id: number };\ntype IRawRequest = IRawPromiseRequest | IRawPromiseCancelRequest | IRawEventListenRequest | IRawEventDisposeRequest;\n\nconst enum ResponseType {\n\tInitialize = 200,\n\tPromiseSuccess = 201,\n\tPromiseError = 202,\n\tPromiseErrorObj = 203,\n\tEventFire = 204\n}\n\nfunction responseTypeToStr(type: ResponseType): string {\n\tswitch (type) {\n\t\tcase ResponseType.Initialize:\n\t\t\treturn `init`;\n\t\tcase ResponseType.PromiseSuccess:\n\t\t\treturn `reply:`;\n\t\tcase ResponseType.PromiseError:\n\t\tcase ResponseType.PromiseErrorObj:\n\t\t\treturn `replyErr:`;\n\t\tcase ResponseType.EventFire:\n\t\t\treturn `event:`;\n\t}\n}\n\ntype IRawInitializeResponse = { type: ResponseType.Initialize };\ntype IRawPromiseSuccessResponse = { type: ResponseType.PromiseSuccess; id: number; data: any };\ntype IRawPromiseErrorResponse = { type: ResponseType.PromiseError; id: number; data: { message: string; name: string; stack: string[] | undefined } };\ntype IRawPromiseErrorObjResponse = { type: ResponseType.PromiseErrorObj; id: number; data: any };\ntype IRawEventFireResponse = { type: ResponseType.EventFire; id: number; data: any };\ntype IRawResponse = IRawInitializeResponse | IRawPromiseSuccessResponse | IRawPromiseErrorResponse | IRawPromiseErrorObjResponse | IRawEventFireResponse;\n\ninterface IHandler {\n\t(response: IRawResponse): void;\n}\n\nexport interface IMessagePassingProtocol {\n\tsend(buffer: VSBuffer): void;\n\tonMessage: Event<VSBuffer>;\n\t/**\n\t * Wait for the write buffer (if applicable) to become empty.\n\t */\n\tdrain?(): Promise<void>;\n}\n\nenum State {\n\tUninitialized,\n\tIdle\n}\n\n/**\n * An `IChannelServer` hosts a collection of channels. You are\n * able to register channels onto it, provided a channel name.\n */\nexport interface IChannelServer<TContext = string> {\n\tregisterChannel(channelName: string, channel: IServerChannel<TContext>): void;\n}\n\n/**\n * An `IChannelClient` has access to a collection of channels. You\n * are able to get those channels, given their channel name.\n */\nexport interface IChannelClient {\n\tgetChannel<T extends IChannel>(channelName: string): T;\n}\n\nexport interface Client<TContext> {\n\treadonly ctx: TContext;\n}\n\nexport interface IConnectionHub<TContext> {\n\treadonly connections: Connection<TContext>[];\n\treadonly onDidAddConnection: Event<Connection<TContext>>;\n\treadonly onDidRemoveConnection: Event<Connection<TContext>>;\n}\n\n/**\n * An `IClientRouter` is responsible for routing calls to specific\n * channels, in scenarios in which there are multiple possible\n * channels (each from a separate client) to pick from.\n */\nexport interface IClientRouter<TContext = string> {\n\trouteCall(hub: IConnectionHub<TContext>, command: string, arg?: any, cancellationToken?: CancellationToken): Promise<Client<TContext>>;\n\trouteEvent(hub: IConnectionHub<TContext>, event: string, arg?: any): Promise<Client<TContext>>;\n}\n\n/**\n * Similar to the `IChannelClient`, you can get channels from this\n * collection of channels. The difference being that in the\n * `IRoutingChannelClient`, there are multiple clients providing\n * the same channel. You'll need to pass in an `IClientRouter` in\n * order to pick the right one.\n */\nexport interface IRoutingChannelClient<TContext = string> {\n\tgetChannel<T extends IChannel>(channelName: string, router?: IClientRouter<TContext>): T;\n}\n\ninterface IReader {\n\tread(bytes: number): VSBuffer;\n}\n\ninterface IWriter {\n\twrite(buffer: VSBuffer): void;\n}\n\n\n/**\n * @see https://en.wikipedia.org/wiki/Variable-length_quantity\n */\nfunction readIntVQL(reader: IReader) {\n\tlet value = 0;\n\tfor (let n = 0; ; n += 7) {\n\t\tconst next = reader.read(1);\n\t\tvalue |= (next.buffer[0] & 0b01111111) << n;\n\t\tif (!(next.buffer[0] & 0b10000000)) {\n\t\t\treturn value;\n\t\t}\n\t}\n}\n\nconst vqlZero = createOneByteBuffer(0);\n\n/**\n * @see https://en.wikipedia.org/wiki/Variable-length_quantity\n */\nfunction writeInt32VQL(writer: IWriter, value: number) {\n\tif (value === 0) {\n\t\twriter.write(vqlZero);\n\t\treturn;\n\t}\n\n\tlet len = 0;\n\tfor (let v2 = value; v2 !== 0; v2 = v2 >>> 7) {\n\t\tlen++;\n\t}\n\n\tconst scratch = VSBuffer.alloc(len);\n\tfor (let i = 0; value !== 0; i++) {\n\t\tscratch.buffer[i] = value & 0b01111111;\n\t\tvalue = value >>> 7;\n\t\tif (value > 0) {\n\t\t\tscratch.buffer[i] |= 0b10000000;\n\t\t}\n\t}\n\n\twriter.write(scratch);\n}\n\nexport class BufferReader implements IReader {\n\n\tprivate pos = 0;\n\n\tconstructor(private buffer: VSBuffer) { }\n\n\tread(bytes: number): VSBuffer {\n\t\tconst result = this.buffer.slice(this.pos, this.pos + bytes);\n\t\tthis.pos += result.byteLength;\n\t\treturn result;\n\t}\n}\n\nexport class BufferWriter implements IWriter {\n\n\tprivate buffers: VSBuffer[] = [];\n\n\tget buffer(): VSBuffer {\n\t\treturn VSBuffer.concat(this.buffers);\n\t}\n\n\twrite(buffer: VSBuffer): void {\n\t\tthis.buffers.push(buffer);\n\t}\n}\n\nenum DataType {\n\tUndefined = 0,\n\tString = 1,\n\tBuffer = 2,\n\tVSBuffer = 3,\n\tArray = 4,\n\tObject = 5,\n\tInt = 6\n}\n\nfunction createOneByteBuffer(value: number): VSBuffer {\n\tconst result = VSBuffer.alloc(1);\n\tresult.writeUInt8(value, 0);\n\treturn result;\n}\n\nconst BufferPresets = {\n\tUndefined: createOneByteBuffer(DataType.Undefined),\n\tString: createOneByteBuffer(DataType.String),\n\tBuffer: createOneByteBuffer(DataType.Buffer),\n\tVSBuffer: createOneByteBuffer(DataType.VSBuffer),\n\tArray: createOneByteBuffer(DataType.Array),\n\tObject: createOneByteBuffer(DataType.Object),\n\tUint: createOneByteBuffer(DataType.Int),\n};\n\nexport function serialize(writer: IWriter, data: any): void {\n\tif (typeof data === 'undefined') {\n\t\twriter.write(BufferPresets.Undefined);\n\t} else if (typeof data === 'string') {\n\t\tconst buffer = VSBuffer.fromString(data);\n\t\twriter.write(BufferPresets.String);\n\t\twriteInt32VQL(writer, buffer.byteLength);\n\t\twriter.write(buffer);\n\t} else if (VSBuffer.isNativeBuffer(data)) {\n\t\tconst buffer = VSBuffer.wrap(data);\n\t\twriter.write(BufferPresets.Buffer);\n\t\twriteInt32VQL(writer, buffer.byteLength);\n\t\twriter.write(buffer);\n\t} else if (data instanceof VSBuffer) {\n\t\twriter.write(BufferPresets.VSBuffer);\n\t\twriteInt32VQL(writer, data.byteLength);\n\t\twriter.write(data);\n\t} else if (Array.isArray(data)) {\n\t\twriter.write(BufferPresets.Array);\n\t\twriteInt32VQL(writer, data.length);\n\n\t\tfor (const el of data) {\n\t\t\tserialize(writer, el);\n\t\t}\n\t} else if (typeof data === 'number' && (data | 0) === data) {\n\t\t// write a vql if it's a number that we can do bitwise operations on\n\t\twriter.write(BufferPresets.Uint);\n\t\twriteInt32VQL(writer, data);\n\t} else {\n\t\tconst buffer = VSBuffer.fromString(JSON.stringify(data));\n\t\twriter.write(BufferPresets.Object);\n\t\twriteInt32VQL(writer, buffer.byteLength);\n\t\twriter.write(buffer);\n\t}\n}\n\nexport function deserialize(reader: IReader): any {\n\tconst type = reader.read(1).readUInt8(0);\n\n\tswitch (type) {\n\t\tcase DataType.Undefined: return undefined;\n\t\tcase DataType.String: return reader.read(readIntVQL(reader)).toString();\n\t\tcase DataType.Buffer: return reader.read(readIntVQL(reader)).buffer;\n\t\tcase DataType.VSBuffer: return reader.read(readIntVQL(reader));\n\t\tcase DataType.Array: {\n\t\t\tconst length = readIntVQL(reader);\n\t\t\tconst result: any[] = [];\n\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\tresult.push(deserialize(reader));\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t\tcase DataType.Object: return JSON.parse(reader.read(readIntVQL(reader)).toString());\n\t\tcase DataType.Int: return readIntVQL(reader);\n\t}\n}\n\ninterface PendingRequest {\n\trequest: IRawPromiseRequest | IRawEventListenRequest;\n\ttimeoutTimer: Timeout;\n}\n\nexport class ChannelServer<TContext = string> implements IChannelServer<TContext>, IDisposable {\n\n\tprivate channels = new Map<string, IServerChannel<TContext>>();\n\tprivate activeRequests = new Map<number, IDisposable>();\n\tprivate protocolListener: IDisposable | null;\n\n\t// Requests might come in for channels which are not yet registered.\n\t// They will timeout after `timeoutDelay`.\n\tprivate pendingRequests = new Map<string, PendingRequest[]>();\n\n\tconstructor(private protocol: IMessagePassingProtocol, private ctx: TContext, private logger: IIPCLogger | null = null, private timeoutDelay: number = 1000) {\n\t\tthis.protocolListener = this.protocol.onMessage(msg => this.onRawMessage(msg));\n\t\tthis.sendResponse({ type: ResponseType.Initialize });\n\t}\n\n\tregisterChannel(channelName: string, channel: IServerChannel<TContext>): void {\n\t\tthis.channels.set(channelName, channel);\n\n\t\t// https://github.com/microsoft/vscode/issues/72531\n\t\tsetTimeout(() => this.flushPendingRequests(channelName), 0);\n\t}\n\n\tprivate sendResponse(response: IRawResponse): void {\n\t\tswitch (response.type) {\n\t\t\tcase ResponseType.Initialize: {\n\t\t\t\tconst msgLength = this.send([response.type]);\n\t\t\t\tthis.logger?.logOutgoing(msgLength, 0, RequestInitiator.OtherSide, responseTypeToStr(response.type));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcase ResponseType.PromiseSuccess:\n\t\t\tcase ResponseType.PromiseError:\n\t\t\tcase ResponseType.EventFire:\n\t\t\tcase ResponseType.PromiseErrorObj: {\n\t\t\t\tconst msgLength = this.send([response.type, response.id], response.data);\n\t\t\t\tthis.logger?.logOutgoing(msgLength, response.id, RequestInitiator.OtherSide, responseTypeToStr(response.type), response.data);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate send(header: unknown, body: any = undefined): number {\n\t\tconst writer = new BufferWriter();\n\t\tserialize(writer, header);\n\t\tserialize(writer, body);\n\t\treturn this.sendBuffer(writer.buffer);\n\t}\n\n\tprivate sendBuffer(message: VSBuffer): number {\n\t\ttry {\n\t\t\tthis.protocol.send(message);\n\t\t\treturn message.byteLength;\n\t\t} catch (err) {\n\t\t\t// noop\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tprivate onRawMessage(message: VSBuffer): void {\n\t\tconst reader = new BufferReader(message);\n\t\tconst header = deserialize(reader);\n\t\tconst body = deserialize(reader);\n\t\tconst type = header[0] as RequestType;\n\n\t\tswitch (type) {\n\t\t\tcase RequestType.Promise:\n\t\t\t\tthis.logger?.logIncoming(message.byteLength, header[1], RequestInitiator.OtherSide, `${requestTypeToStr(type)}: ${header[2]}.${header[3]}`, body);\n\t\t\t\treturn this.onPromise({ type, id: header[1], channelName: header[2], name: header[3], arg: body });\n\t\t\tcase RequestType.EventListen:\n\t\t\t\tthis.logger?.logIncoming(message.byteLength, header[1], RequestInitiator.OtherSide, `${requestTypeToStr(type)}: ${header[2]}.${header[3]}`, body);\n\t\t\t\treturn this.onEventListen({ type, id: header[1], channelName: header[2], name: header[3], arg: body });\n\t\t\tcase RequestType.PromiseCancel:\n\t\t\t\tthis.logger?.logIncoming(message.byteLength, header[1], RequestInitiator.OtherSide, `${requestTypeToStr(type)}`);\n\t\t\t\treturn this.disposeActiveRequest({ type, id: header[1] });\n\t\t\tcase RequestType.EventDispose:\n\t\t\t\tthis.logger?.logIncoming(message.byteLength, header[1], RequestInitiator.OtherSide, `${requestTypeToStr(type)}`);\n\t\t\t\treturn this.disposeActiveRequest({ type, id: header[1] });\n\t\t}\n\t}\n\n\tprivate onPromise(request: IRawPromiseRequest): void {\n\t\tconst channel = this.channels.get(request.channelName);\n\n\t\tif (!channel) {\n\t\t\tthis.collectPendingRequest(request);\n\t\t\treturn;\n\t\t}\n\n\t\tconst cancellationTokenSource = new CancellationTokenSource();\n\t\tlet promise: Promise<any>;\n\n\t\ttry {\n\t\t\tpromise = channel.call(this.ctx, request.name, request.arg, cancellationTokenSource.token);\n\t\t} catch (err) {\n\t\t\tpromise = Promise.reject(err);\n\t\t}\n\n\t\tconst id = request.id;\n\n\t\tpromise.then(data => {\n\t\t\tthis.sendResponse({ id, data, type: ResponseType.PromiseSuccess });\n\t\t}, err => {\n\t\t\tif (err instanceof Error) {\n\t\t\t\tthis.sendResponse({\n\t\t\t\t\tid, data: {\n\t\t\t\t\t\tmessage: err.message,\n\t\t\t\t\t\tname: err.name,\n\t\t\t\t\t\tstack: err.stack ? err.stack.split('\\n') : undefined\n\t\t\t\t\t}, type: ResponseType.PromiseError\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.sendResponse({ id, data: err, type: ResponseType.PromiseErrorObj });\n\t\t\t}\n\t\t}).finally(() => {\n\t\t\tdisposable.dispose();\n\t\t\tthis.activeRequests.delete(request.id);\n\t\t});\n\n\t\tconst disposable = toDisposable(() => cancellationTokenSource.cancel());\n\t\tthis.activeRequests.set(request.id, disposable);\n\t}\n\n\tprivate onEventListen(request: IRawEventListenRequest): void {\n\t\tconst channel = this.channels.get(request.channelName);\n\n\t\tif (!channel) {\n\t\t\tthis.collectPendingRequest(request);\n\t\t\treturn;\n\t\t}\n\n\t\tconst id = request.id;\n\t\tconst event = channel.listen(this.ctx, request.name, request.arg);\n\t\tconst disposable = event(data => this.sendResponse({ id, data, type: ResponseType.EventFire }));\n\n\t\tthis.activeRequests.set(request.id, disposable);\n\t}\n\n\tprivate disposeActiveRequest(request: IRawRequest): void {\n\t\tconst disposable = this.activeRequests.get(request.id);\n\n\t\tif (disposable) {\n\t\t\tdisposable.dispose();\n\t\t\tthis.activeRequests.delete(request.id);\n\t\t}\n\t}\n\n\tprivate collectPendingRequest(request: IRawPromiseRequest | IRawEventListenRequest): void {\n\t\tlet pendingRequests = this.pendingRequests.get(request.channelName);\n\n\t\tif (!pendingRequests) {\n\t\t\tpendingRequests = [];\n\t\t\tthis.pendingRequests.set(request.channelName, pendingRequests);\n\t\t}\n\n\t\tconst timer = setTimeout(() => {\n\t\t\tconsole.error(`Unknown channel: ${request.channelName}`);\n\n\t\t\tif (request.type === RequestType.Promise) {\n\t\t\t\tthis.sendResponse({\n\t\t\t\t\tid: request.id,\n\t\t\t\t\tdata: { name: 'Unknown channel', message: `Channel name '${request.channelName}' timed out after ${this.timeoutDelay}ms`, stack: undefined },\n\t\t\t\t\ttype: ResponseType.PromiseError\n\t\t\t\t});\n\t\t\t}\n\t\t}, this.timeoutDelay);\n\n\t\tpendingRequests.push({ request, timeoutTimer: timer });\n\t}\n\n\tprivate flushPendingRequests(channelName: string): void {\n\t\tconst requests = this.pendingRequests.get(channelName);\n\n\t\tif (requests) {\n\t\t\tfor (const request of requests) {\n\t\t\t\tclearTimeout(request.timeoutTimer);\n\n\t\t\t\tswitch (request.request.type) {\n\t\t\t\t\tcase RequestType.Promise: this.onPromise(request.request); break;\n\t\t\t\t\tcase RequestType.EventListen: this.onEventListen(request.request); break;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.pendingRequests.delete(channelName);\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this.protocolListener) {\n\t\t\tthis.protocolListener.dispose();\n\t\t\tthis.protocolListener = null;\n\t\t}\n\t\tdispose(this.activeRequests.values());\n\t\tthis.activeRequests.clear();\n\t}\n}\n\nexport const enum RequestInitiator {\n\tLocalSide = 0,\n\tOtherSide = 1\n}\n\nexport interface IIPCLogger {\n\tlogIncoming(msgLength: number, requestId: number, initiator: RequestInitiator, str: string, data?: any): void;\n\tlogOutgoing(msgLength: number, requestId: number, initiator: RequestInitiator, str: string, data?: any): void;\n}\n\nexport class ChannelClient implements IChannelClient, IDisposable {\n\n\tprivate isDisposed: boolean = false;\n\tprivate state: State = State.Uninitialized;\n\tprivate activeRequests = new Set<IDisposable>();\n\tprivate handlers = new Map<number, IHandler>();\n\tprivate lastRequestId: number = 0;\n\tprivate protocolListener: IDisposable | null;\n\tprivate logger: IIPCLogger | null;\n\n\tprivate readonly _onDidInitialize = new Emitter<void>();\n\treadonly onDidInitialize = this._onDidInitialize.event;\n\n\tconstructor(private protocol: IMessagePassingProtocol, logger: IIPCLogger | null = null) {\n\t\tthis.protocolListener = this.protocol.onMessage(msg => this.onBuffer(msg));\n\t\tthis.logger = logger;\n\t}\n\n\tgetChannel<T extends IChannel>(channelName: string): T {\n\t\tconst that = this;\n\n\t\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\t\treturn {\n\t\t\tcall(command: string, arg?: any, cancellationToken?: CancellationToken) {\n\t\t\t\tif (that.isDisposed) {\n\t\t\t\t\treturn Promise.reject(new CancellationError());\n\t\t\t\t}\n\t\t\t\treturn that.requestPromise(channelName, command, arg, cancellationToken);\n\t\t\t},\n\t\t\tlisten(event: string, arg: any) {\n\t\t\t\tif (that.isDisposed) {\n\t\t\t\t\treturn Event.None;\n\t\t\t\t}\n\t\t\t\treturn that.requestEvent(channelName, event, arg);\n\t\t\t}\n\t\t} as T;\n\t}\n\n\tprivate requestPromise(channelName: string, name: string, arg?: any, cancellationToken = CancellationToken.None): Promise<unknown> {\n\t\tconst id = this.lastRequestId++;\n\t\tconst type = RequestType.Promise;\n\t\tconst request: IRawRequest = { id, type, channelName, name, arg };\n\n\t\tif (cancellationToken.isCancellationRequested) {\n\t\t\treturn Promise.reject(new CancellationError());\n\t\t}\n\n\t\tlet disposable: IDisposable;\n\t\tlet disposableWithRequestCancel: IDisposable;\n\n\t\tconst result = new Promise((c, e) => {\n\t\t\tif (cancellationToken.isCancellationRequested) {\n\t\t\t\treturn e(new CancellationError());\n\t\t\t}\n\n\t\t\tconst doRequest = () => {\n\t\t\t\tconst handler: IHandler = response => {\n\t\t\t\t\tswitch (response.type) {\n\t\t\t\t\t\tcase ResponseType.PromiseSuccess:\n\t\t\t\t\t\t\tthis.handlers.delete(id);\n\t\t\t\t\t\t\tc(response.data);\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase ResponseType.PromiseError: {\n\t\t\t\t\t\t\tthis.handlers.delete(id);\n\t\t\t\t\t\t\tconst error = new Error(response.data.message);\n\t\t\t\t\t\t\t(<any>error).stack = Array.isArray(response.data.stack) ? response.data.stack.join('\\n') : response.data.stack;\n\t\t\t\t\t\t\terror.name = response.data.name;\n\t\t\t\t\t\t\te(error);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase ResponseType.PromiseErrorObj:\n\t\t\t\t\t\t\tthis.handlers.delete(id);\n\t\t\t\t\t\t\te(response.data);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.handlers.set(id, handler);\n\t\t\t\tthis.sendRequest(request);\n\t\t\t};\n\n\t\t\tlet uninitializedPromise: CancelablePromise<void> | null = null;\n\t\t\tif (this.state === State.Idle) {\n\t\t\t\tdoRequest();\n\t\t\t} else {\n\t\t\t\tuninitializedPromise = createCancelablePromise(_ => this.whenInitialized());\n\t\t\t\tuninitializedPromise.then(() => {\n\t\t\t\t\tuninitializedPromise = null;\n\t\t\t\t\tdoRequest();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst cancel = () => {\n\t\t\t\tif (uninitializedPromise) {\n\t\t\t\t\tuninitializedPromise.cancel();\n\t\t\t\t\tuninitializedPromise = null;\n\t\t\t\t} else {\n\t\t\t\t\tthis.sendRequest({ id, type: RequestType.PromiseCancel });\n\t\t\t\t}\n\n\t\t\t\te(new CancellationError());\n\t\t\t};\n\n\t\t\tdisposable = cancellationToken.onCancellationRequested(cancel);\n\t\t\tdisposableWithRequestCancel = {\n\t\t\t\tdispose: createSingleCallFunction(() => {\n\t\t\t\t\tcancel();\n\t\t\t\t\tdisposable.dispose();\n\t\t\t\t})\n\t\t\t};\n\n\t\t\tthis.activeRequests.add(disposableWithRequestCancel);\n\t\t});\n\n\t\treturn result.finally(() => {\n\t\t\tdisposable?.dispose(); // Seen as undefined in tests.\n\t\t\tthis.activeRequests.delete(disposableWithRequestCancel);\n\t\t});\n\t}\n\n\tprivate requestEvent(channelName: string, name: string, arg?: any): Event<any> {\n\t\tconst id = this.lastRequestId++;\n\t\tconst type = RequestType.EventListen;\n\t\tconst request: IRawRequest = { id, type, channelName, name, arg };\n\n\t\tlet uninitializedPromise: CancelablePromise<void> | null = null;\n\n\t\tconst emitter = new Emitter<any>({\n\t\t\tonWillAddFirstListener: () => {\n\t\t\t\tconst doRequest = () => {\n\t\t\t\t\tthis.activeRequests.add(emitter);\n\t\t\t\t\tthis.sendRequest(request);\n\t\t\t\t};\n\t\t\t\tif (this.state === State.Idle) {\n\t\t\t\t\tdoRequest();\n\t\t\t\t} else {\n\t\t\t\t\tuninitializedPromise = createCancelablePromise(_ => this.whenInitialized());\n\t\t\t\t\tuninitializedPromise.then(() => {\n\t\t\t\t\t\tuninitializedPromise = null;\n\t\t\t\t\t\tdoRequest();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\tif (uninitializedPromise) {\n\t\t\t\t\tuninitializedPromise.cancel();\n\t\t\t\t\tuninitializedPromise = null;\n\t\t\t\t} else {\n\t\t\t\t\tthis.activeRequests.delete(emitter);\n\t\t\t\t\tthis.sendRequest({ id, type: RequestType.EventDispose });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tconst handler: IHandler = (res: IRawResponse) => emitter.fire((res as IRawEventFireResponse).data);\n\t\tthis.handlers.set(id, handler);\n\n\t\treturn emitter.event;\n\t}\n\n\tprivate sendRequest(request: IRawRequest): void {\n\t\tswitch (request.type) {\n\t\t\tcase RequestType.Promise:\n\t\t\tcase RequestType.EventListen: {\n\t\t\t\tconst msgLength = this.send([request.type, request.id, request.channelName, request.name], request.arg);\n\t\t\t\tthis.logger?.logOutgoing(msgLength, request.id, RequestInitiator.LocalSide, `${requestTypeToStr(request.type)}: ${request.channelName}.${request.name}`, request.arg);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcase RequestType.PromiseCancel:\n\t\t\tcase RequestType.EventDispose: {\n\t\t\t\tconst msgLength = this.send([request.type, request.id]);\n\t\t\t\tthis.logger?.logOutgoing(msgLength, request.id, RequestInitiator.LocalSide, requestTypeToStr(request.type));\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate send(header: unknown, body: any = undefined): number {\n\t\tconst writer = new BufferWriter();\n\t\tserialize(writer, header);\n\t\tserialize(writer, body);\n\t\treturn this.sendBuffer(writer.buffer);\n\t}\n\n\tprivate sendBuffer(message: VSBuffer): number {\n\t\ttry {\n\t\t\tthis.protocol.send(message);\n\t\t\treturn message.byteLength;\n\t\t} catch (err) {\n\t\t\t// noop\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tprivate onBuffer(message: VSBuffer): void {\n\t\tconst reader = new BufferReader(message);\n\t\tconst header = deserialize(reader);\n\t\tconst body = deserialize(reader);\n\t\tconst type: ResponseType = header[0];\n\n\t\tswitch (type) {\n\t\t\tcase ResponseType.Initialize:\n\t\t\t\tthis.logger?.logIncoming(message.byteLength, 0, RequestInitiator.LocalSide, responseTypeToStr(type));\n\t\t\t\treturn this.onResponse({ type: header[0] });\n\n\t\t\tcase ResponseType.PromiseSuccess:\n\t\t\tcase ResponseType.PromiseError:\n\t\t\tcase ResponseType.EventFire:\n\t\t\tcase ResponseType.PromiseErrorObj:\n\t\t\t\tthis.logger?.logIncoming(message.byteLength, header[1], RequestInitiator.LocalSide, responseTypeToStr(type), body);\n\t\t\t\treturn this.onResponse({ type: header[0], id: header[1], data: body });\n\t\t}\n\t}\n\n\tprivate onResponse(response: IRawResponse): void {\n\t\tif (response.type === ResponseType.Initialize) {\n\t\t\tthis.state = State.Idle;\n\t\t\tthis._onDidInitialize.fire();\n\t\t\treturn;\n\t\t}\n\n\t\tconst handler = this.handlers.get(response.id);\n\n\t\thandler?.(response);\n\t}\n\n\t@memoize\n\tget onDidInitializePromise(): Promise<void> {\n\t\treturn Event.toPromise(this.onDidInitialize);\n\t}\n\n\tprivate whenInitialized(): Promise<void> {\n\t\tif (this.state === State.Idle) {\n\t\t\treturn Promise.resolve();\n\t\t} else {\n\t\t\treturn this.onDidInitializePromise;\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tthis.isDisposed = true;\n\t\tif (this.protocolListener) {\n\t\t\tthis.protocolListener.dispose();\n\t\t\tthis.protocolListener = null;\n\t\t}\n\t\tdispose(this.activeRequests.values());\n\t\tthis.activeRequests.clear();\n\t}\n}\n\nexport interface ClientConnectionEvent {\n\tprotocol: IMessagePassingProtocol;\n\tonDidClientDisconnect: Event<void>;\n}\n\ninterface Connection<TContext> extends Client<TContext> {\n\treadonly channelServer: ChannelServer<TContext>;\n\treadonly channelClient: ChannelClient;\n}\n\n/**\n * An `IPCServer` is both a channel server and a routing channel\n * client.\n *\n * As the owner of a protocol, you should extend both this\n * and the `IPCClient` classes to get IPC implementations\n * for your protocol.\n */\nexport class IPCServer<TContext = string> implements IChannelServer<TContext>, IRoutingChannelClient<TContext>, IConnectionHub<TContext>, IDisposable {\n\n\tprivate channels = new Map<string, IServerChannel<TContext>>();\n\tprivate _connections = new Set<Connection<TContext>>();\n\n\tprivate readonly _onDidAddConnection = new Emitter<Connection<TContext>>();\n\treadonly onDidAddConnection: Event<Connection<TContext>> = this._onDidAddConnection.event;\n\n\tprivate readonly _onDidRemoveConnection = new Emitter<Connection<TContext>>();\n\treadonly onDidRemoveConnection: Event<Connection<TContext>> = this._onDidRemoveConnection.event;\n\n\tprivate readonly disposables = new DisposableStore();\n\n\tget connections(): Connection<TContext>[] {\n\t\tconst result: Connection<TContext>[] = [];\n\t\tthis._connections.forEach(ctx => result.push(ctx));\n\t\treturn result;\n\t}\n\n\tconstructor(onDidClientConnect: Event<ClientConnectionEvent>, ipcLogger?: IIPCLogger | null, timeoutDelay?: number) {\n\t\tthis.disposables.add(onDidClientConnect(({ protocol, onDidClientDisconnect }) => {\n\t\t\tconst onFirstMessage = Event.once(protocol.onMessage);\n\n\t\t\tthis.disposables.add(onFirstMessage(msg => {\n\t\t\t\tconst reader = new BufferReader(msg);\n\t\t\t\tconst ctx = deserialize(reader) as TContext;\n\n\t\t\t\tconst channelServer = new ChannelServer(protocol, ctx, ipcLogger, timeoutDelay);\n\t\t\t\tconst channelClient = new ChannelClient(protocol, ipcLogger);\n\n\t\t\t\tthis.channels.forEach((channel, name) => channelServer.registerChannel(name, channel));\n\n\t\t\t\tconst connection: Connection<TContext> = { channelServer, channelClient, ctx };\n\t\t\t\tthis._connections.add(connection);\n\t\t\t\tthis._onDidAddConnection.fire(connection);\n\n\t\t\t\tthis.disposables.add(onDidClientDisconnect(() => {\n\t\t\t\t\tchannelServer.dispose();\n\t\t\t\t\tchannelClient.dispose();\n\t\t\t\t\tthis._connections.delete(connection);\n\t\t\t\t\tthis._onDidRemoveConnection.fire(connection);\n\t\t\t\t}));\n\t\t\t}));\n\t\t}));\n\t}\n\n\t/**\n\t * Get a channel from a remote client. When passed a router,\n\t * one can specify which client it wants to call and listen to/from.\n\t * Otherwise, when calling without a router, a random client will\n\t * be selected and when listening without a router, every client\n\t * will be listened to.\n\t */\n\tgetChannel<T extends IChannel>(channelName: string, router: IClientRouter<TContext>): T;\n\tgetChannel<T extends IChannel>(channelName: string, clientFilter: (client: Client<TContext>) => boolean): T;\n\tgetChannel<T extends IChannel>(channelName: string, routerOrClientFilter: IClientRouter<TContext> | ((client: Client<TContext>) => boolean)): T {\n\t\tconst that = this;\n\n\t\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\t\treturn {\n\t\t\tcall(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T> {\n\t\t\t\tlet connectionPromise: Promise<Client<TContext>>;\n\n\t\t\t\tif (isFunction(routerOrClientFilter)) {\n\t\t\t\t\t// when no router is provided, we go random client picking\n\t\t\t\t\tconst connection = getRandomElement(that.connections.filter(routerOrClientFilter));\n\n\t\t\t\t\tconnectionPromise = connection\n\t\t\t\t\t\t// if we found a client, let's call on it\n\t\t\t\t\t\t? Promise.resolve(connection)\n\t\t\t\t\t\t// else, let's wait for a client to come along\n\t\t\t\t\t\t: Event.toPromise(Event.filter(that.onDidAddConnection, routerOrClientFilter));\n\t\t\t\t} else {\n\t\t\t\t\tconnectionPromise = routerOrClientFilter.routeCall(that, command, arg);\n\t\t\t\t}\n\n\t\t\t\tconst channelPromise = connectionPromise\n\t\t\t\t\t.then(connection => (connection as Connection<TContext>).channelClient.getChannel(channelName));\n\n\t\t\t\treturn getDelayedChannel(channelPromise)\n\t\t\t\t\t.call(command, arg, cancellationToken);\n\t\t\t},\n\t\t\tlisten(event: string, arg: any): Event<T> {\n\t\t\t\tif (isFunction(routerOrClientFilter)) {\n\t\t\t\t\treturn that.getMulticastEvent(channelName, routerOrClientFilter, event, arg);\n\t\t\t\t}\n\n\t\t\t\tconst channelPromise = routerOrClientFilter.routeEvent(that, event, arg)\n\t\t\t\t\t.then(connection => (connection as Connection<TContext>).channelClient.getChannel(channelName));\n\n\t\t\t\treturn getDelayedChannel(channelPromise)\n\t\t\t\t\t.listen(event, arg);\n\t\t\t}\n\t\t} as T;\n\t}\n\n\tprivate getMulticastEvent<T extends IChannel>(channelName: string, clientFilter: (client: Client<TContext>) => boolean, eventName: string, arg: any): Event<T> {\n\t\tconst that = this;\n\t\tlet disposables: DisposableStore | undefined;\n\n\t\t// Create an emitter which hooks up to all clients\n\t\t// as soon as first listener is added. It also\n\t\t// disconnects from all clients as soon as the last listener\n\t\t// is removed.\n\t\tconst emitter = new Emitter<T>({\n\t\t\tonWillAddFirstListener: () => {\n\t\t\t\tdisposables = new DisposableStore();\n\n\t\t\t\t// The event multiplexer is useful since the active\n\t\t\t\t// client list is dynamic. We need to hook up and disconnection\n\t\t\t\t// to/from clients as they come and go.\n\t\t\t\tconst eventMultiplexer = new EventMultiplexer<T>();\n\t\t\t\tconst map = new Map<Connection<TContext>, IDisposable>();\n\n\t\t\t\tconst onDidAddConnection = (connection: Connection<TContext>) => {\n\t\t\t\t\tconst channel = connection.channelClient.getChannel(channelName);\n\t\t\t\t\tconst event = channel.listen<T>(eventName, arg);\n\t\t\t\t\tconst disposable = eventMultiplexer.add(event);\n\n\t\t\t\t\tmap.set(connection, disposable);\n\t\t\t\t};\n\n\t\t\t\tconst onDidRemoveConnection = (connection: Connection<TContext>) => {\n\t\t\t\t\tconst disposable = map.get(connection);\n\n\t\t\t\t\tif (!disposable) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tdisposable.dispose();\n\t\t\t\t\tmap.delete(connection);\n\t\t\t\t};\n\n\t\t\t\tthat.connections.filter(clientFilter).forEach(onDidAddConnection);\n\t\t\t\tEvent.filter(that.onDidAddConnection, clientFilter)(onDidAddConnection, undefined, disposables);\n\t\t\t\tthat.onDidRemoveConnection(onDidRemoveConnection, undefined, disposables);\n\t\t\t\teventMultiplexer.event(emitter.fire, emitter, disposables);\n\n\t\t\t\tdisposables.add(eventMultiplexer);\n\t\t\t},\n\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\tdisposables?.dispose();\n\t\t\t\tdisposables = undefined;\n\t\t\t}\n\t\t});\n\t\tthat.disposables.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\tregisterChannel(channelName: string, channel: IServerChannel<TContext>): void {\n\t\tthis.channels.set(channelName, channel);\n\n\t\tfor (const connection of this._connections) {\n\t\t\tconnection.channelServer.registerChannel(channelName, channel);\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tthis.disposables.dispose();\n\n\t\tfor (const connection of this._connections) {\n\t\t\tconnection.channelClient.dispose();\n\t\t\tconnection.channelServer.dispose();\n\t\t}\n\n\t\tthis._connections.clear();\n\t\tthis.channels.clear();\n\t\tthis._onDidAddConnection.dispose();\n\t\tthis._onDidRemoveConnection.dispose();\n\t}\n}\n\n/**\n * An `IPCClient` is both a channel client and a channel server.\n *\n * As the owner of a protocol, you should extend both this\n * and the `IPCServer` classes to get IPC implementations\n * for your protocol.\n */\nexport class IPCClient<TContext = string> implements IChannelClient, IChannelServer<TContext>, IDisposable {\n\n\tprivate channelClient: ChannelClient;\n\tprivate channelServer: ChannelServer<TContext>;\n\n\tconstructor(protocol: IMessagePassingProtocol, ctx: TContext, ipcLogger: IIPCLogger | null = null) {\n\t\tconst writer = new BufferWriter();\n\t\tserialize(writer, ctx);\n\t\tprotocol.send(writer.buffer);\n\n\t\tthis.channelClient = new ChannelClient(protocol, ipcLogger);\n\t\tthis.channelServer = new ChannelServer(protocol, ctx, ipcLogger);\n\t}\n\n\tgetChannel<T extends IChannel>(channelName: string): T {\n\t\treturn this.channelClient.getChannel(channelName) as T;\n\t}\n\n\tregisterChannel(channelName: string, channel: IServerChannel<TContext>): void {\n\t\tthis.channelServer.registerChannel(channelName, channel);\n\t}\n\n\tdispose(): void {\n\t\tthis.channelClient.dispose();\n\t\tthis.channelServer.dispose();\n\t}\n}\n\nexport function getDelayedChannel<T extends IChannel>(promise: Promise<T>): T {\n\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\treturn {\n\t\tcall(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T> {\n\t\t\treturn promise.then(c => c.call<T>(command, arg, cancellationToken));\n\t\t},\n\n\t\tlisten<T>(event: string, arg?: any): Event<T> {\n\t\t\tconst relay = new Relay<any>();\n\t\t\tpromise.then(c => relay.input = c.listen(event, arg));\n\t\t\treturn relay.event;\n\t\t}\n\t} as T;\n}\n\nexport function getNextTickChannel<T extends IChannel>(channel: T): T {\n\tlet didTick = false;\n\n\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\treturn {\n\t\tcall<T>(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T> {\n\t\t\tif (didTick) {\n\t\t\t\treturn channel.call(command, arg, cancellationToken);\n\t\t\t}\n\n\t\t\treturn timeout(0)\n\t\t\t\t.then(() => didTick = true)\n\t\t\t\t.then(() => channel.call<T>(command, arg, cancellationToken));\n\t\t},\n\t\tlisten<T>(event: string, arg?: any): Event<T> {\n\t\t\tif (didTick) {\n\t\t\t\treturn channel.listen<T>(event, arg);\n\t\t\t}\n\n\t\t\tconst relay = new Relay<T>();\n\n\t\t\ttimeout(0)\n\t\t\t\t.then(() => didTick = true)\n\t\t\t\t.then(() => relay.input = channel.listen<T>(event, arg));\n\n\t\t\treturn relay.event;\n\t\t}\n\t} as T;\n}\n\nexport class StaticRouter<TContext = string> implements IClientRouter<TContext> {\n\n\tconstructor(private fn: (ctx: TContext) => boolean | Promise<boolean>) { }\n\n\trouteCall(hub: IConnectionHub<TContext>): Promise<Client<TContext>> {\n\t\treturn this.route(hub);\n\t}\n\n\trouteEvent(hub: IConnectionHub<TContext>): Promise<Client<TContext>> {\n\t\treturn this.route(hub);\n\t}\n\n\tprivate async route(hub: IConnectionHub<TContext>): Promise<Client<TContext>> {\n\t\tfor (const connection of hub.connections) {\n\t\t\tif (await Promise.resolve(this.fn(connection.ctx))) {\n\t\t\t\treturn Promise.resolve(connection);\n\t\t\t}\n\t\t}\n\n\t\tawait Event.toPromise(hub.onDidAddConnection);\n\t\treturn await this.route(hub);\n\t}\n}\n\n/**\n * Use ProxyChannels to automatically wrapping and unwrapping\n * services to/from IPC channels, instead of manually wrapping\n * each service method and event.\n *\n * Restrictions:\n * - If marshalling is enabled, only `URI` and `RegExp` is converted\n *   automatically for you\n * - Events must follow the naming convention `onUpperCase`\n * - `CancellationToken` is currently not supported\n * - If a context is provided, you can use `AddFirstParameterToFunctions`\n *   utility to signal this in the receiving side type\n */\nexport namespace ProxyChannel {\n\n\texport interface IProxyOptions {\n\n\t\t/**\n\t\t * Disables automatic marshalling of `URI`.\n\t\t * If marshalling is disabled, `UriComponents`\n\t\t * must be used instead.\n\t\t */\n\t\tdisableMarshalling?: boolean;\n\t}\n\n\texport interface ICreateServiceChannelOptions extends IProxyOptions { }\n\n\texport function fromService<TContext>(service: unknown, disposables: DisposableStore, options?: ICreateServiceChannelOptions): IServerChannel<TContext> {\n\t\tconst handler = service as { [key: string]: unknown };\n\t\tconst disableMarshalling = options && options.disableMarshalling;\n\n\t\t// Buffer any event that should be supported by\n\t\t// iterating over all property keys and finding them\n\t\t// However, this will not work for services that\n\t\t// are lazy and use a Proxy within. For that we\n\t\t// still need to check later (see below).\n\t\tconst mapEventNameToEvent = new Map<string, Event<unknown>>();\n\t\tfor (const key in handler) {\n\t\t\tif (propertyIsEvent(key)) {\n\t\t\t\tmapEventNameToEvent.set(key, Event.buffer(handler[key] as Event<unknown>, true, undefined, disposables));\n\t\t\t}\n\t\t}\n\n\t\treturn new class implements IServerChannel {\n\n\t\t\tlisten<T>(_: unknown, event: string, arg: any): Event<T> {\n\t\t\t\tconst eventImpl = mapEventNameToEvent.get(event);\n\t\t\t\tif (eventImpl) {\n\t\t\t\t\treturn eventImpl as Event<T>;\n\t\t\t\t}\n\n\t\t\t\tconst target = handler[event];\n\t\t\t\tif (typeof target === 'function') {\n\t\t\t\t\tif (propertyIsDynamicEvent(event)) {\n\t\t\t\t\t\treturn target.call(handler, arg);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (propertyIsEvent(event)) {\n\t\t\t\t\t\tmapEventNameToEvent.set(event, Event.buffer(handler[event] as Event<unknown>, true, undefined, disposables));\n\n\t\t\t\t\t\treturn mapEventNameToEvent.get(event) as Event<T>;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthrow new ErrorNoTelemetry(`Event not found: ${event}`);\n\t\t\t}\n\n\t\t\tcall(_: unknown, command: string, args?: any[]): Promise<any> {\n\t\t\t\tconst target = handler[command];\n\t\t\t\tif (typeof target === 'function') {\n\n\t\t\t\t\t// Revive unless marshalling disabled\n\t\t\t\t\tif (!disableMarshalling && Array.isArray(args)) {\n\t\t\t\t\t\tfor (let i = 0; i < args.length; i++) {\n\t\t\t\t\t\t\targs[i] = revive(args[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tlet res = target.apply(handler, args);\n\t\t\t\t\tif (!(res instanceof Promise)) {\n\t\t\t\t\t\tres = Promise.resolve(res);\n\t\t\t\t\t}\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\n\t\t\t\tthrow new ErrorNoTelemetry(`Method not found: ${command}`);\n\t\t\t}\n\t\t};\n\t}\n\n\texport interface ICreateProxyServiceOptions extends IProxyOptions {\n\n\t\t/**\n\t\t * If provided, will add the value of `context`\n\t\t * to each method call to the target.\n\t\t */\n\t\tcontext?: unknown;\n\n\t\t/**\n\t\t * If provided, will not proxy any of the properties\n\t\t * that are part of the Map but rather return that value.\n\t\t */\n\t\tproperties?: Map<string, unknown>;\n\t}\n\n\texport function toService<T extends object>(channel: IChannel, options?: ICreateProxyServiceOptions): T {\n\t\tconst disableMarshalling = options && options.disableMarshalling;\n\n\t\treturn new Proxy({}, {\n\t\t\tget(_target: T, propKey: PropertyKey) {\n\t\t\t\tif (typeof propKey === 'string') {\n\n\t\t\t\t\t// Check for predefined values\n\t\t\t\t\tif (options?.properties?.has(propKey)) {\n\t\t\t\t\t\treturn options.properties.get(propKey);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Dynamic Event\n\t\t\t\t\tif (propertyIsDynamicEvent(propKey)) {\n\t\t\t\t\t\treturn function (arg: unknown) {\n\t\t\t\t\t\t\treturn channel.listen(propKey, arg);\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Event\n\t\t\t\t\tif (propertyIsEvent(propKey)) {\n\t\t\t\t\t\treturn channel.listen(propKey);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Function\n\t\t\t\t\treturn async function (...args: any[]) {\n\n\t\t\t\t\t\t// Add context if any\n\t\t\t\t\t\tlet methodArgs: any[];\n\t\t\t\t\t\tif (options && !isUndefinedOrNull(options.context)) {\n\t\t\t\t\t\t\tmethodArgs = [options.context, ...args];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmethodArgs = args;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst result = await channel.call(propKey, methodArgs);\n\n\t\t\t\t\t\t// Revive unless marshalling disabled\n\t\t\t\t\t\tif (!disableMarshalling) {\n\t\t\t\t\t\t\treturn revive(result);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tthrow new ErrorNoTelemetry(`Property not found: ${String(propKey)}`);\n\t\t\t}\n\t\t}) as T;\n\t}\n\n\tfunction propertyIsEvent(name: string): boolean {\n\t\t// Assume a property is an event if it has a form of \"onSomething\"\n\t\treturn name[0] === 'o' && name[1] === 'n' && strings.isUpperAsciiLetter(name.charCodeAt(2));\n\t}\n\n\tfunction propertyIsDynamicEvent(name: string): boolean {\n\t\t// Assume a property is a dynamic event (a method that returns an event) if it has a form of \"onDynamicSomething\"\n\t\treturn /^onDynamic/.test(name) && strings.isUpperAsciiLetter(name.charCodeAt(9));\n\t}\n}\n\nconst colorTables = [\n\t['#2977B1', '#FC802D', '#34A13A', '#D3282F', '#9366BA'],\n\t['#8B564C', '#E177C0', '#7F7F7F', '#BBBE3D', '#2EBECD']\n];\n\nfunction prettyWithoutArrays(data: unknown): any {\n\tif (Array.isArray(data)) {\n\t\treturn data;\n\t}\n\tif (data && typeof data === 'object' && typeof data.toString === 'function') {\n\t\tconst result = data.toString();\n\t\tif (result !== '[object Object]') {\n\t\t\treturn result;\n\t\t}\n\t}\n\treturn data;\n}\n\nfunction pretty(data: unknown): any {\n\tif (Array.isArray(data)) {\n\t\treturn data.map(prettyWithoutArrays);\n\t}\n\treturn prettyWithoutArrays(data);\n}\n\nfunction logWithColors(direction: string, totalLength: number, msgLength: number, req: number, initiator: RequestInitiator, str: string, data: any): void {\n\tdata = pretty(data);\n\n\tconst colorTable = colorTables[initiator];\n\tconst color = colorTable[req % colorTable.length];\n\tlet args = [`%c[${direction}]%c[${String(totalLength).padStart(7, ' ')}]%c[len: ${String(msgLength).padStart(5, ' ')}]%c${String(req).padStart(5, ' ')} - ${str}`, 'color: darkgreen', 'color: grey', 'color: grey', `color: ${color}`];\n\tif (/\\($/.test(str)) {\n\t\targs = args.concat(data);\n\t\targs.push(')');\n\t} else {\n\t\targs.push(data);\n\t}\n\tconsole.log.apply(console, args as [string, ...string[]]);\n}\n\nexport class IPCLogger implements IIPCLogger {\n\tprivate _totalIncoming = 0;\n\tprivate _totalOutgoing = 0;\n\n\tconstructor(\n\t\tprivate readonly _outgoingPrefix: string,\n\t\tprivate readonly _incomingPrefix: string,\n\t) { }\n\n\tpublic logOutgoing(msgLength: number, requestId: number, initiator: RequestInitiator, str: string, data?: any): void {\n\t\tthis._totalOutgoing += msgLength;\n\t\tlogWithColors(this._outgoingPrefix, this._totalOutgoing, msgLength, requestId, initiator, str, data);\n\t}\n\n\tpublic logIncoming(msgLength: number, requestId: number, initiator: RequestInitiator, str: string, data?: any): void {\n\t\tthis._totalIncoming += msgLength;\n\t\tlogWithColors(this._incomingPrefix, this._totalIncoming, msgLength, requestId, initiator, str, data);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { URI } from './uri.js';\n\nexport interface IRemoteConsoleLog {\n\ttype: string;\n\tseverity: string;\n\targuments: string;\n}\n\nexport interface IStackArgument {\n\t__$stack: string;\n}\n\nexport interface IStackFrame {\n\turi: URI;\n\tline: number;\n\tcolumn: number;\n}\n\nexport function isRemoteConsoleLog(obj: unknown): obj is IRemoteConsoleLog {\n\tconst entry = obj as IRemoteConsoleLog;\n\n\treturn entry && typeof entry.type === 'string' && typeof entry.severity === 'string';\n}\n\nexport function parse(entry: IRemoteConsoleLog): { args: any[]; stack?: string } {\n\tconst args: any[] = [];\n\tlet stack: string | undefined;\n\n\t// Parse Entry\n\ttry {\n\t\tconst parsedArguments: any[] = JSON.parse(entry.arguments);\n\n\t\t// Check for special stack entry as last entry\n\t\tconst stackArgument = parsedArguments[parsedArguments.length - 1] as IStackArgument;\n\t\tif (stackArgument && stackArgument.__$stack) {\n\t\t\tparsedArguments.pop(); // stack is handled specially\n\t\t\tstack = stackArgument.__$stack;\n\t\t}\n\n\t\targs.push(...parsedArguments);\n\t} catch (error) {\n\t\targs.push('Unable to log remote console arguments', entry.arguments);\n\t}\n\n\treturn { args, stack };\n}\n\nexport function getFirstFrame(entry: IRemoteConsoleLog): IStackFrame | undefined;\nexport function getFirstFrame(stack: string | undefined): IStackFrame | undefined;\nexport function getFirstFrame(arg0: IRemoteConsoleLog | string | undefined): IStackFrame | undefined {\n\tif (typeof arg0 !== 'string') {\n\t\treturn getFirstFrame(parse(arg0!).stack);\n\t}\n\n\t// Parse a source information out of the stack if we have one. Format can be:\n\t// at vscode.commands.registerCommand (/Users/someone/Desktop/test-ts/out/src/extension.js:18:17)\n\t// or\n\t// at /Users/someone/Desktop/test-ts/out/src/extension.js:18:17\n\t// or\n\t// at c:\\Users\\someone\\Desktop\\end-js\\extension.js:19:17\n\t// or\n\t// at e.$executeContributedCommand(c:\\Users\\someone\\Desktop\\end-js\\extension.js:19:17)\n\tconst stack = arg0;\n\tif (stack) {\n\t\tconst topFrame = findFirstFrame(stack);\n\n\t\t// at [^\\/]* => line starts with \"at\" followed by any character except '/' (to not capture unix paths too late)\n\t\t// (?:(?:[a-zA-Z]+:)|(?:[\\/])|(?:\\\\\\\\) => windows drive letter OR unix root OR unc root\n\t\t// (?:.+) => simple pattern for the path, only works because of the line/col pattern after\n\t\t// :(?:\\d+):(?:\\d+) => :line:column data\n\t\tconst matches = /at [^\\/]*((?:(?:[a-zA-Z]+:)|(?:[\\/])|(?:\\\\\\\\))(?:.+)):(\\d+):(\\d+)/.exec(topFrame || '');\n\t\tif (matches && matches.length === 4) {\n\t\t\treturn {\n\t\t\t\turi: URI.file(matches[1]),\n\t\t\t\tline: Number(matches[2]),\n\t\t\t\tcolumn: Number(matches[3])\n\t\t\t};\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction findFirstFrame(stack: string | undefined): string | undefined {\n\tif (!stack) {\n\t\treturn stack;\n\t}\n\n\tconst newlineIndex = stack.indexOf('\\n');\n\tif (newlineIndex === -1) {\n\t\treturn stack;\n\t}\n\n\treturn stack.substring(0, newlineIndex);\n}\n\nexport function log(entry: IRemoteConsoleLog, label: string): void {\n\tconst { args, stack } = parse(entry);\n\n\tconst isOneStringArg = typeof args[0] === 'string' && args.length === 1;\n\n\tlet topFrame = findFirstFrame(stack);\n\tif (topFrame) {\n\t\ttopFrame = `(${topFrame.trim()})`;\n\t}\n\n\tlet consoleArgs: string[] = [];\n\n\t// First arg is a string\n\tif (typeof args[0] === 'string') {\n\t\tif (topFrame && isOneStringArg) {\n\t\t\tconsoleArgs = [`%c[${label}] %c${args[0]} %c${topFrame}`, color('blue'), color(''), color('grey')];\n\t\t} else {\n\t\t\tconsoleArgs = [`%c[${label}] %c${args[0]}`, color('blue'), color(''), ...args.slice(1)];\n\t\t}\n\t}\n\n\t// First arg is something else, just apply all\n\telse {\n\t\tconsoleArgs = [`%c[${label}]%`, color('blue'), ...args];\n\t}\n\n\t// Stack: add to args unless already added\n\tif (topFrame && !isOneStringArg) {\n\t\tconsoleArgs.push(topFrame);\n\t}\n\n\t// Log it\n\tif (typeof (console as any)[entry.severity] !== 'function') {\n\t\tthrow new Error('Unknown console method');\n\t}\n\t(console as any)[entry.severity].apply(console, consoleArgs);\n}\n\nfunction color(color: string): string {\n\treturn `color: ${color}`;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ChildProcess, fork, ForkOptions } from 'child_process';\nimport { createCancelablePromise, Delayer } from '../../../common/async.js';\nimport { VSBuffer } from '../../../common/buffer.js';\nimport { CancellationToken } from '../../../common/cancellation.js';\nimport { isRemoteConsoleLog, log } from '../../../common/console.js';\nimport * as errors from '../../../common/errors.js';\nimport { Emitter, Event } from '../../../common/event.js';\nimport { dispose, IDisposable, toDisposable } from '../../../common/lifecycle.js';\nimport { deepClone } from '../../../common/objects.js';\nimport { createQueuedSender } from '../../../node/processes.js';\nimport { removeDangerousEnvVariables } from '../../../common/processes.js';\nimport { ChannelClient as IPCClient, ChannelServer as IPCServer, IChannel, IChannelClient } from '../common/ipc.js';\n\n/**\n * This implementation doesn't perform well since it uses base64 encoding for buffers.\n * We should move all implementations to use named ipc.net, so we stop depending on cp.fork.\n */\n\nexport class Server<TContext extends string> extends IPCServer<TContext> {\n\tconstructor(ctx: TContext) {\n\t\tsuper({\n\t\t\tsend: r => {\n\t\t\t\ttry {\n\t\t\t\t\tprocess.send?.((<Buffer>r.buffer).toString('base64'));\n\t\t\t\t} catch (e) { /* not much to do */ }\n\t\t\t},\n\t\t\tonMessage: Event.fromNodeEventEmitter(process, 'message', msg => VSBuffer.wrap(Buffer.from(msg, 'base64')))\n\t\t}, ctx);\n\n\t\tprocess.once('disconnect', () => this.dispose());\n\t}\n}\n\nexport interface IIPCOptions {\n\n\t/**\n\t * A descriptive name for the server this connection is to. Used in logging.\n\t */\n\tserverName: string;\n\n\t/**\n\t * Time in millies before killing the ipc process. The next request after killing will start it again.\n\t */\n\ttimeout?: number;\n\n\t/**\n\t * Arguments to the module to execute.\n\t */\n\targs?: string[];\n\n\t/**\n\t * Environment key-value pairs to be passed to the process that gets spawned for the ipc.\n\t */\n\tenv?: any;\n\n\t/**\n\t * Allows to assign a debug port for debugging the application executed.\n\t */\n\tdebug?: number;\n\n\t/**\n\t * Allows to assign a debug port for debugging the application and breaking it on the first line.\n\t */\n\tdebugBrk?: number;\n\n\t/**\n\t * If set, starts the fork with empty execArgv. If not set, execArgv from the parent process are inherited,\n\t * except --inspect= and --inspect-brk= which are filtered as they would result in a port conflict.\n\t */\n\tfreshExecArgv?: boolean;\n\n\t/**\n\t * Enables our createQueuedSender helper for this Client. Uses a queue when the internal Node.js queue is\n\t * full of messages - see notes on that method.\n\t */\n\tuseQueue?: boolean;\n}\n\nexport class Client implements IChannelClient, IDisposable {\n\n\tprivate disposeDelayer: Delayer<void> | undefined;\n\tprivate activeRequests = new Set<IDisposable>();\n\tprivate child: ChildProcess | null;\n\tprivate _client: IPCClient | null;\n\tprivate channels = new Map<string, IChannel>();\n\n\tprivate readonly _onDidProcessExit = new Emitter<{ code: number; signal: string }>();\n\treadonly onDidProcessExit = this._onDidProcessExit.event;\n\n\tconstructor(private modulePath: string, private options: IIPCOptions) {\n\t\tconst timeout = options && options.timeout ? options.timeout : 60000;\n\t\tthis.disposeDelayer = new Delayer<void>(timeout);\n\t\tthis.child = null;\n\t\tthis._client = null;\n\t}\n\n\tgetChannel<T extends IChannel>(channelName: string): T {\n\t\tconst that = this;\n\n\t\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\t\treturn {\n\t\t\tcall<T>(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T> {\n\t\t\t\treturn that.requestPromise<T>(channelName, command, arg, cancellationToken);\n\t\t\t},\n\t\t\tlisten(event: string, arg?: any) {\n\t\t\t\treturn that.requestEvent(channelName, event, arg);\n\t\t\t}\n\t\t} as T;\n\t}\n\n\tprotected requestPromise<T>(channelName: string, name: string, arg?: any, cancellationToken = CancellationToken.None): Promise<T> {\n\t\tif (!this.disposeDelayer) {\n\t\t\treturn Promise.reject(new Error('disposed'));\n\t\t}\n\n\t\tif (cancellationToken.isCancellationRequested) {\n\t\t\treturn Promise.reject(errors.canceled());\n\t\t}\n\n\t\tthis.disposeDelayer.cancel();\n\n\t\tconst channel = this.getCachedChannel(channelName);\n\t\tconst result = createCancelablePromise(token => channel.call<T>(name, arg, token));\n\t\tconst cancellationTokenListener = cancellationToken.onCancellationRequested(() => result.cancel());\n\n\t\tconst disposable = toDisposable(() => result.cancel());\n\t\tthis.activeRequests.add(disposable);\n\n\t\tresult.finally(() => {\n\t\t\tcancellationTokenListener.dispose();\n\t\t\tthis.activeRequests.delete(disposable);\n\n\t\t\tif (this.activeRequests.size === 0 && this.disposeDelayer) {\n\t\t\t\tthis.disposeDelayer.trigger(() => this.disposeClient());\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\tprotected requestEvent<T>(channelName: string, name: string, arg?: any): Event<T> {\n\t\tif (!this.disposeDelayer) {\n\t\t\treturn Event.None;\n\t\t}\n\n\t\tthis.disposeDelayer.cancel();\n\n\t\tlet listener: IDisposable;\n\t\tconst emitter = new Emitter<any>({\n\t\t\tonWillAddFirstListener: () => {\n\t\t\t\tconst channel = this.getCachedChannel(channelName);\n\t\t\t\tconst event: Event<T> = channel.listen(name, arg);\n\n\t\t\t\tlistener = event(emitter.fire, emitter);\n\t\t\t\tthis.activeRequests.add(listener);\n\t\t\t},\n\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\tthis.activeRequests.delete(listener);\n\t\t\t\tlistener.dispose();\n\n\t\t\t\tif (this.activeRequests.size === 0 && this.disposeDelayer) {\n\t\t\t\t\tthis.disposeDelayer.trigger(() => this.disposeClient());\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn emitter.event;\n\t}\n\n\tprivate get client(): IPCClient {\n\t\tif (!this._client) {\n\t\t\tconst args = this.options && this.options.args ? this.options.args : [];\n\t\t\tconst forkOpts: ForkOptions = Object.create(null);\n\n\t\t\tforkOpts.env = { ...deepClone(process.env), 'VSCODE_PARENT_PID': String(process.pid) };\n\n\t\t\tif (this.options && this.options.env) {\n\t\t\t\tforkOpts.env = { ...forkOpts.env, ...this.options.env };\n\t\t\t}\n\n\t\t\tif (this.options && this.options.freshExecArgv) {\n\t\t\t\tforkOpts.execArgv = [];\n\t\t\t}\n\n\t\t\tif (this.options && typeof this.options.debug === 'number') {\n\t\t\t\tforkOpts.execArgv = ['--nolazy', '--inspect=' + this.options.debug];\n\t\t\t}\n\n\t\t\tif (this.options && typeof this.options.debugBrk === 'number') {\n\t\t\t\tforkOpts.execArgv = ['--nolazy', '--inspect-brk=' + this.options.debugBrk];\n\t\t\t}\n\n\t\t\tif (forkOpts.execArgv === undefined) {\n\t\t\t\tforkOpts.execArgv = process.execArgv\t\t\t// if not set, the forked process inherits the execArgv of the parent process\n\t\t\t\t\t.filter(a => !/^--inspect(-brk)?=/.test(a)) // --inspect and --inspect-brk can not be inherited as the port would conflict\n\t\t\t\t\t.filter(a => !a.startsWith('--vscode-')); \t// --vscode-* arguments are unsupported by node.js and thus need to remove\n\t\t\t}\n\n\t\t\tremoveDangerousEnvVariables(forkOpts.env);\n\n\t\t\tthis.child = fork(this.modulePath, args, forkOpts);\n\n\t\t\tconst onMessageEmitter = new Emitter<VSBuffer>();\n\t\t\tconst onRawMessage = Event.fromNodeEventEmitter(this.child, 'message', msg => msg);\n\n\t\t\tconst rawMessageDisposable = onRawMessage(msg => {\n\n\t\t\t\t// Handle remote console logs specially\n\t\t\t\tif (isRemoteConsoleLog(msg)) {\n\t\t\t\t\tlog(msg, `IPC Library: ${this.options.serverName}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Anything else goes to the outside\n\t\t\t\tonMessageEmitter.fire(VSBuffer.wrap(Buffer.from(msg, 'base64')));\n\t\t\t});\n\n\t\t\tconst sender = this.options.useQueue ? createQueuedSender(this.child) : this.child;\n\t\t\tconst send = (r: VSBuffer) => this.child && this.child.connected && sender.send((<Buffer>r.buffer).toString('base64'));\n\t\t\tconst onMessage = onMessageEmitter.event;\n\t\t\tconst protocol = { send, onMessage };\n\n\t\t\tthis._client = new IPCClient(protocol);\n\n\t\t\tconst onExit = () => this.disposeClient();\n\t\t\tprocess.once('exit', onExit);\n\n\t\t\tthis.child.on('error', err => console.warn('IPC \"' + this.options.serverName + '\" errored with ' + err));\n\n\t\t\tthis.child.on('exit', (code: any, signal: any) => {\n\t\t\t\tprocess.removeListener('exit' as 'loaded', onExit); // https://github.com/electron/electron/issues/21475\n\t\t\t\trawMessageDisposable.dispose();\n\n\t\t\t\tthis.activeRequests.forEach(r => dispose(r));\n\t\t\t\tthis.activeRequests.clear();\n\n\t\t\t\tif (code !== 0 && signal !== 'SIGTERM') {\n\t\t\t\t\tconsole.warn('IPC \"' + this.options.serverName + '\" crashed with exit code ' + code + ' and signal ' + signal);\n\t\t\t\t}\n\n\t\t\t\tthis.disposeDelayer?.cancel();\n\t\t\t\tthis.disposeClient();\n\t\t\t\tthis._onDidProcessExit.fire({ code, signal });\n\t\t\t});\n\t\t}\n\n\t\treturn this._client;\n\t}\n\n\tprivate getCachedChannel(name: string): IChannel {\n\t\tlet channel = this.channels.get(name);\n\n\t\tif (!channel) {\n\t\t\tchannel = this.client.getChannel(name);\n\t\t\tthis.channels.set(name, channel);\n\t\t}\n\n\t\treturn channel;\n\t}\n\n\tprivate disposeClient() {\n\t\tif (this._client) {\n\t\t\tif (this.child) {\n\t\t\t\tthis.child.kill();\n\t\t\t\tthis.child = null;\n\t\t\t}\n\t\t\tthis._client = null;\n\t\t\tthis.channels.clear();\n\t\t}\n\t}\n\n\tdispose() {\n\t\tthis._onDidProcessExit.dispose();\n\t\tthis.disposeDelayer?.cancel();\n\t\tthis.disposeDelayer = undefined;\n\t\tthis.disposeClient();\n\t\tthis.activeRequests.clear();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { FileAccess } from '../../../../base/common/network.js';\nimport { getNextTickChannel, ProxyChannel } from '../../../../base/parts/ipc/common/ipc.js';\nimport { Client } from '../../../../base/parts/ipc/node/ipc.cp.js';\nimport { IFileChange } from '../../common/files.js';\nimport { AbstractUniversalWatcherClient, ILogMessage, IUniversalWatcher } from '../../common/watcher.js';\n\nexport class UniversalWatcherClient extends AbstractUniversalWatcherClient {\n\n\tconstructor(\n\t\tonFileChanges: (changes: IFileChange[]) => void,\n\t\tonLogMessage: (msg: ILogMessage) => void,\n\t\tverboseLogging: boolean\n\t) {\n\t\tsuper(onFileChanges, onLogMessage, verboseLogging);\n\n\t\tthis.init();\n\t}\n\n\tprotected override createWatcher(disposables: DisposableStore): IUniversalWatcher {\n\n\t\t// Fork the universal file watcher and build a client around\n\t\t// its server for passing over requests and receiving events.\n\t\tconst client = disposables.add(new Client(\n\t\t\tFileAccess.asFileUri('bootstrap-fork').fsPath,\n\t\t\t{\n\t\t\t\tserverName: 'File Watcher',\n\t\t\t\targs: ['--type=fileWatcher'],\n\t\t\t\tenv: {\n\t\t\t\t\tVSCODE_ESM_ENTRYPOINT: 'vs/platform/files/node/watcher/watcherMain',\n\t\t\t\t\tVSCODE_PIPE_LOGGING: 'true',\n\t\t\t\t\tVSCODE_VERBOSE_LOGGING: 'true' // transmit console logs from server to client\n\t\t\t\t}\n\t\t\t}\n\t\t));\n\n\t\t// React on unexpected termination of the watcher process\n\t\tdisposables.add(client.onDidProcessExit(({ code, signal }) => this.onError(`terminated by itself with code ${code}, signal: ${signal} (ETERM)`)));\n\n\t\treturn ProxyChannel.toService<IUniversalWatcher>(getNextTickChannel(client.getChannel('watcher')));\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { watchFile, unwatchFile, Stats } from 'fs';\nimport { Disposable, DisposableMap, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { ILogMessage, IRecursiveWatcherWithSubscribe, IUniversalWatchRequest, IWatchRequestWithCorrelation, IWatcher, IWatcherErrorEvent, isWatchRequestWithCorrelation, requestFilterToString } from '../../common/watcher.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { FileChangeType, IFileChange } from '../../common/files.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { DeferredPromise, ThrottledDelayer } from '../../../../base/common/async.js';\nimport { hash } from '../../../../base/common/hash.js';\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\n\ninterface ISuspendedWatchRequest {\n\treadonly id: number;\n\treadonly correlationId: number | undefined;\n\treadonly path: string;\n}\n\nexport abstract class BaseWatcher extends Disposable implements IWatcher {\n\n\tprotected readonly _onDidChangeFile = this._register(new Emitter<IFileChange[]>());\n\treadonly onDidChangeFile = this._onDidChangeFile.event;\n\n\tprotected readonly _onDidLogMessage = this._register(new Emitter<ILogMessage>());\n\treadonly onDidLogMessage = this._onDidLogMessage.event;\n\n\tprotected readonly _onDidWatchFail = this._register(new Emitter<IUniversalWatchRequest>());\n\tprivate readonly onDidWatchFail = this._onDidWatchFail.event;\n\n\tprivate readonly correlatedWatchRequests = new Map<number /* request ID */, IWatchRequestWithCorrelation>();\n\tprivate readonly nonCorrelatedWatchRequests = new Map<number /* request ID */, IUniversalWatchRequest>();\n\n\tprivate readonly suspendedWatchRequests = this._register(new DisposableMap<number /* request ID */>());\n\tprivate readonly suspendedWatchRequestsWithPolling = new Set<number /* request ID */>();\n\n\tprivate readonly updateWatchersDelayer = this._register(new ThrottledDelayer<void>(this.getUpdateWatchersDelay()));\n\n\tprotected readonly suspendedWatchRequestPollingInterval: number = 5007; // node.js default\n\n\tprivate joinWatch = new DeferredPromise<void>();\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._register(this.onDidWatchFail(request => this.suspendWatchRequest({\n\t\t\tid: this.computeId(request),\n\t\t\tcorrelationId: this.isCorrelated(request) ? request.correlationId : undefined,\n\t\t\tpath: request.path\n\t\t})));\n\t}\n\n\tprotected isCorrelated(request: IUniversalWatchRequest): request is IWatchRequestWithCorrelation {\n\t\treturn isWatchRequestWithCorrelation(request);\n\t}\n\n\tprivate computeId(request: IUniversalWatchRequest): number {\n\t\tif (this.isCorrelated(request)) {\n\t\t\treturn request.correlationId;\n\t\t} else {\n\t\t\t// Requests without correlation do not carry any unique identifier, so we have to\n\t\t\t// come up with one based on the options of the request. This matches what the\n\t\t\t// file service does (vs/platform/files/common/fileService.ts#L1178).\n\t\t\treturn hash(request);\n\t\t}\n\t}\n\n\tasync watch(requests: IUniversalWatchRequest[]): Promise<void> {\n\t\tif (!this.joinWatch.isSettled) {\n\t\t\tthis.joinWatch.complete();\n\t\t}\n\t\tthis.joinWatch = new DeferredPromise<void>();\n\n\t\ttry {\n\t\t\tthis.correlatedWatchRequests.clear();\n\t\t\tthis.nonCorrelatedWatchRequests.clear();\n\n\t\t\t// Figure out correlated vs. non-correlated requests\n\t\t\tfor (const request of requests) {\n\t\t\t\tif (this.isCorrelated(request)) {\n\t\t\t\t\tthis.correlatedWatchRequests.set(request.correlationId, request);\n\t\t\t\t} else {\n\t\t\t\t\tthis.nonCorrelatedWatchRequests.set(this.computeId(request), request);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove all suspended watch requests that are no longer watched\n\t\t\tfor (const [id] of this.suspendedWatchRequests) {\n\t\t\t\tif (!this.nonCorrelatedWatchRequests.has(id) && !this.correlatedWatchRequests.has(id)) {\n\t\t\t\t\tthis.suspendedWatchRequests.deleteAndDispose(id);\n\t\t\t\t\tthis.suspendedWatchRequestsWithPolling.delete(id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn await this.updateWatchers(false /* not delayed */);\n\t\t} finally {\n\t\t\tthis.joinWatch.complete();\n\t\t}\n\t}\n\n\tprivate updateWatchers(delayed: boolean): Promise<void> {\n\t\tconst nonSuspendedRequests: IUniversalWatchRequest[] = [];\n\t\tfor (const [id, request] of [...this.nonCorrelatedWatchRequests, ...this.correlatedWatchRequests]) {\n\t\t\tif (!this.suspendedWatchRequests.has(id)) {\n\t\t\t\tnonSuspendedRequests.push(request);\n\t\t\t}\n\t\t}\n\n\t\treturn this.updateWatchersDelayer.trigger(() => this.doWatch(nonSuspendedRequests), delayed ? this.getUpdateWatchersDelay() : 0).catch(error => onUnexpectedError(error));\n\t}\n\n\tprotected getUpdateWatchersDelay(): number {\n\t\treturn 800;\n\t}\n\n\tisSuspended(request: IUniversalWatchRequest): 'polling' | boolean {\n\t\tconst id = this.computeId(request);\n\t\treturn this.suspendedWatchRequestsWithPolling.has(id) ? 'polling' : this.suspendedWatchRequests.has(id);\n\t}\n\n\tprivate async suspendWatchRequest(request: ISuspendedWatchRequest): Promise<void> {\n\t\tif (this.suspendedWatchRequests.has(request.id)) {\n\t\t\treturn; // already suspended\n\t\t}\n\n\t\tconst disposables = new DisposableStore();\n\t\tthis.suspendedWatchRequests.set(request.id, disposables);\n\n\t\t// It is possible that a watch request fails right during watch()\n\t\t// phase while other requests succeed. To increase the chance of\n\t\t// reusing another watcher for suspend/resume tracking, we await\n\t\t// all watch requests having processed.\n\n\t\tawait this.joinWatch.p;\n\n\t\tif (disposables.isDisposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.monitorSuspendedWatchRequest(request, disposables);\n\n\t\tthis.updateWatchers(true /* delay this call as we might accumulate many failing watch requests on startup */);\n\t}\n\n\tprivate resumeWatchRequest(request: ISuspendedWatchRequest): void {\n\t\tthis.suspendedWatchRequests.deleteAndDispose(request.id);\n\t\tthis.suspendedWatchRequestsWithPolling.delete(request.id);\n\n\t\tthis.updateWatchers(false);\n\t}\n\n\tprivate monitorSuspendedWatchRequest(request: ISuspendedWatchRequest, disposables: DisposableStore): void {\n\t\tif (this.doMonitorWithExistingWatcher(request, disposables)) {\n\t\t\tthis.trace(`reusing an existing recursive watcher to monitor ${request.path}`);\n\t\t\tthis.suspendedWatchRequestsWithPolling.delete(request.id);\n\t\t} else {\n\t\t\tthis.doMonitorWithNodeJS(request, disposables);\n\t\t\tthis.suspendedWatchRequestsWithPolling.add(request.id);\n\t\t}\n\t}\n\n\tprivate doMonitorWithExistingWatcher(request: ISuspendedWatchRequest, disposables: DisposableStore): boolean {\n\t\tconst subscription = this.recursiveWatcher?.subscribe(request.path, (error, change) => {\n\t\t\tif (disposables.isDisposed) {\n\t\t\t\treturn; // return early if already disposed\n\t\t\t}\n\n\t\t\tif (error) {\n\t\t\t\tthis.monitorSuspendedWatchRequest(request, disposables);\n\t\t\t} else if (change?.type === FileChangeType.ADDED) {\n\t\t\t\tthis.onMonitoredPathAdded(request);\n\t\t\t}\n\t\t});\n\n\t\tif (subscription) {\n\t\t\tdisposables.add(subscription);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate doMonitorWithNodeJS(request: ISuspendedWatchRequest, disposables: DisposableStore): void {\n\t\tlet pathNotFound = false;\n\n\t\tconst watchFileCallback: (curr: Stats, prev: Stats) => void = (curr, prev) => {\n\t\t\tif (disposables.isDisposed) {\n\t\t\t\treturn; // return early if already disposed\n\t\t\t}\n\n\t\t\tconst currentPathNotFound = this.isPathNotFound(curr);\n\t\t\tconst previousPathNotFound = this.isPathNotFound(prev);\n\t\t\tconst oldPathNotFound = pathNotFound;\n\t\t\tpathNotFound = currentPathNotFound;\n\n\t\t\t// Watch path created: resume watching request\n\t\t\tif (!currentPathNotFound && (previousPathNotFound || oldPathNotFound)) {\n\t\t\t\tthis.onMonitoredPathAdded(request);\n\t\t\t}\n\t\t};\n\n\t\tthis.trace(`starting fs.watchFile() on ${request.path} (correlationId: ${request.correlationId})`);\n\t\ttry {\n\t\t\twatchFile(request.path, { persistent: false, interval: this.suspendedWatchRequestPollingInterval }, watchFileCallback);\n\t\t} catch (error) {\n\t\t\tthis.warn(`fs.watchFile() failed with error ${error} on path ${request.path} (correlationId: ${request.correlationId})`);\n\t\t}\n\n\t\tdisposables.add(toDisposable(() => {\n\t\t\tthis.trace(`stopping fs.watchFile() on ${request.path} (correlationId: ${request.correlationId})`);\n\n\t\t\ttry {\n\t\t\t\tunwatchFile(request.path, watchFileCallback);\n\t\t\t} catch (error) {\n\t\t\t\tthis.warn(`fs.unwatchFile() failed with error ${error} on path ${request.path} (correlationId: ${request.correlationId})`);\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate onMonitoredPathAdded(request: ISuspendedWatchRequest): void {\n\t\tthis.trace(`detected ${request.path} exists again, resuming watcher (correlationId: ${request.correlationId})`);\n\n\t\t// Emit as event\n\t\tconst event: IFileChange = { resource: URI.file(request.path), type: FileChangeType.ADDED, cId: request.correlationId };\n\t\tthis._onDidChangeFile.fire([event]);\n\t\tthis.traceEvent(event, request);\n\n\t\t// Resume watching\n\t\tthis.resumeWatchRequest(request);\n\t}\n\n\tprivate isPathNotFound(stats: Stats): boolean {\n\t\treturn stats.ctimeMs === 0 && stats.ino === 0;\n\t}\n\n\tasync stop(): Promise<void> {\n\t\tthis.suspendedWatchRequests.clearAndDisposeAll();\n\t\tthis.suspendedWatchRequestsWithPolling.clear();\n\t}\n\n\tprotected traceEvent(event: IFileChange, request: IUniversalWatchRequest | ISuspendedWatchRequest): void {\n\t\tif (this.verboseLogging) {\n\t\t\tconst traceMsg = ` >> normalized ${event.type === FileChangeType.ADDED ? '[ADDED]' : event.type === FileChangeType.DELETED ? '[DELETED]' : '[CHANGED]'} ${event.resource.fsPath}`;\n\t\t\tthis.traceWithCorrelation(traceMsg, request);\n\t\t}\n\t}\n\n\tprotected traceWithCorrelation(message: string, request: IUniversalWatchRequest | ISuspendedWatchRequest): void {\n\t\tif (this.verboseLogging) {\n\t\t\tthis.trace(`${message}${typeof request.correlationId === 'number' ? ` <${request.correlationId}> ` : ``}`);\n\t\t}\n\t}\n\n\tprotected requestToString(request: IUniversalWatchRequest): string {\n\t\treturn `${request.path} (excludes: ${request.excludes.length > 0 ? request.excludes : '<none>'}, includes: ${request.includes && request.includes.length > 0 ? JSON.stringify(request.includes) : '<all>'}, filter: ${requestFilterToString(request.filter)}, correlationId: ${typeof request.correlationId === 'number' ? request.correlationId : '<none>'})`;\n\t}\n\n\tprotected abstract doWatch(requests: IUniversalWatchRequest[]): Promise<void>;\n\n\tprotected abstract readonly recursiveWatcher: IRecursiveWatcherWithSubscribe | undefined;\n\n\tprotected abstract trace(message: string): void;\n\tprotected abstract warn(message: string): void;\n\n\tabstract onDidError: Event<IWatcherErrorEvent>;\n\n\tprotected verboseLogging = false;\n\n\tasync setVerboseLogging(enabled: boolean): Promise<void> {\n\t\tthis.verboseLogging = enabled;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { watch, promises } from 'fs';\nimport { RunOnceWorker, ThrottledWorker } from '../../../../../base/common/async.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { isEqual, isEqualOrParent } from '../../../../../base/common/extpath.js';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { normalizeNFC } from '../../../../../base/common/normalization.js';\nimport { basename, dirname, join } from '../../../../../base/common/path.js';\nimport { isLinux, isMacintosh } from '../../../../../base/common/platform.js';\nimport { joinPath } from '../../../../../base/common/resources.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { Promises } from '../../../../../base/node/pfs.js';\nimport { FileChangeFilter, FileChangeType, IFileChange } from '../../../common/files.js';\nimport { ILogMessage, coalesceEvents, INonRecursiveWatchRequest, parseWatcherPatterns, IRecursiveWatcherWithSubscribe, isFiltered, isWatchRequestWithCorrelation } from '../../../common/watcher.js';\nimport { Lazy } from '../../../../../base/common/lazy.js';\nimport { ParsedPattern } from '../../../../../base/common/glob.js';\n\nexport class NodeJSFileWatcherLibrary extends Disposable {\n\n\t// A delay in reacting to file deletes to support\n\t// atomic save operations where a tool may chose\n\t// to delete a file before creating it again for\n\t// an update.\n\tprivate static readonly FILE_DELETE_HANDLER_DELAY = 100;\n\n\t// A delay for collecting file changes from node.js\n\t// before collecting them for coalescing and emitting\n\t// Same delay as used for the recursive watcher.\n\tprivate static readonly FILE_CHANGES_HANDLER_DELAY = 75;\n\n\t// Reduce likelyhood of spam from file events via throttling.\n\t// These numbers are a bit more aggressive compared to the\n\t// recursive watcher because we can have many individual\n\t// node.js watchers per request.\n\t// (https://github.com/microsoft/vscode/issues/124723)\n\tprivate readonly throttledFileChangesEmitter = this._register(new ThrottledWorker<IFileChange>(\n\t\t{\n\t\t\tmaxWorkChunkSize: 100,\t// only process up to 100 changes at once before...\n\t\t\tthrottleDelay: 200,\t  \t// ...resting for 200ms until we process events again...\n\t\t\tmaxBufferedWork: 10000 \t// ...but never buffering more than 10000 events in memory\n\t\t},\n\t\tevents => this.onDidFilesChange(events)\n\t));\n\n\t// Aggregate file changes over FILE_CHANGES_HANDLER_DELAY\n\t// to coalesce events and reduce spam.\n\tprivate readonly fileChangesAggregator = this._register(new RunOnceWorker<IFileChange>(events => this.handleFileChanges(events), NodeJSFileWatcherLibrary.FILE_CHANGES_HANDLER_DELAY));\n\n\tprivate readonly excludes: ParsedPattern[];\n\tprivate readonly includes: ParsedPattern[] | undefined;\n\tprivate readonly filter: FileChangeFilter | undefined;\n\n\tprivate readonly cts = new CancellationTokenSource();\n\n\tprivate readonly realPath = new Lazy(async () => {\n\n\t\t// This property is intentionally `Lazy` and not using `realcase()` as the counterpart\n\t\t// in the recursive watcher because of the amount of paths this watcher is dealing with.\n\t\t// We try as much as possible to avoid even needing `realpath()` if we can because even\n\t\t// that method does an `lstat()` per segment of the path.\n\n\t\tlet result = this.request.path;\n\n\t\ttry {\n\t\t\tresult = await Promises.realpath(this.request.path);\n\n\t\t\tif (this.request.path !== result) {\n\t\t\t\tthis.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${result})`);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// ignore\n\t\t}\n\n\t\treturn result;\n\t});\n\n\treadonly ready: Promise<void>;\n\n\tprivate _isReusingRecursiveWatcher = false;\n\tget isReusingRecursiveWatcher(): boolean { return this._isReusingRecursiveWatcher; }\n\n\tprivate didFail = false;\n\tget failed(): boolean { return this.didFail; }\n\n\tconstructor(\n\t\tprivate readonly request: INonRecursiveWatchRequest,\n\t\tprivate readonly recursiveWatcher: IRecursiveWatcherWithSubscribe | undefined,\n\t\tprivate readonly onDidFilesChange: (changes: IFileChange[]) => void,\n\t\tprivate readonly onDidWatchFail?: () => void,\n\t\tprivate readonly onLogMessage?: (msg: ILogMessage) => void,\n\t\tprivate verboseLogging?: boolean\n\t) {\n\t\tsuper();\n\n\t\tthis.excludes = parseWatcherPatterns(this.request.path, this.request.excludes);\n\t\tthis.includes = this.request.includes ? parseWatcherPatterns(this.request.path, this.request.includes) : undefined;\n\t\tthis.filter = isWatchRequestWithCorrelation(this.request) ? this.request.filter : undefined; // filtering is only enabled when correlating because watchers are otherwise potentially reused\n\n\t\tthis.ready = this.watch();\n\t}\n\n\tprivate async watch(): Promise<void> {\n\t\ttry {\n\t\t\tconst stat = await promises.stat(this.request.path);\n\n\t\t\tif (this.cts.token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._register(await this.doWatch(stat.isDirectory()));\n\t\t} catch (error) {\n\t\t\tif (error.code !== 'ENOENT') {\n\t\t\t\tthis.error(error);\n\t\t\t} else {\n\t\t\t\tthis.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${error})`);\n\t\t\t}\n\n\t\t\tthis.notifyWatchFailed();\n\t\t}\n\t}\n\n\tprivate notifyWatchFailed(): void {\n\t\tthis.didFail = true;\n\n\t\tthis.onDidWatchFail?.();\n\t}\n\n\tprivate async doWatch(isDirectory: boolean): Promise<IDisposable> {\n\t\tconst disposables = new DisposableStore();\n\n\t\tif (this.doWatchWithExistingWatcher(isDirectory, disposables)) {\n\t\t\tthis.trace(`reusing an existing recursive watcher for ${this.request.path}`);\n\t\t\tthis._isReusingRecursiveWatcher = true;\n\t\t} else {\n\t\t\tthis._isReusingRecursiveWatcher = false;\n\t\t\tawait this.doWatchWithNodeJS(isDirectory, disposables);\n\t\t}\n\n\t\treturn disposables;\n\t}\n\n\tprivate doWatchWithExistingWatcher(isDirectory: boolean, disposables: DisposableStore): boolean {\n\t\tif (isDirectory) {\n\t\t\t// Recursive watcher re-use is currently not enabled for when\n\t\t\t// folders are watched. this is because the dispatching in the\n\t\t\t// recursive watcher for non-recurive requests is optimized for\n\t\t\t// file changes  where we really only match on the exact path\n\t\t\t// and not child paths.\n\t\t\treturn false;\n\t\t}\n\n\t\tconst resource = URI.file(this.request.path);\n\t\tconst subscription = this.recursiveWatcher?.subscribe(this.request.path, async (error, change) => {\n\t\t\tif (disposables.isDisposed) {\n\t\t\t\treturn; // return early if already disposed\n\t\t\t}\n\n\t\t\tif (error) {\n\t\t\t\tconst watchDisposable = await this.doWatch(isDirectory);\n\t\t\t\tif (!disposables.isDisposed) {\n\t\t\t\t\tdisposables.add(watchDisposable);\n\t\t\t\t} else {\n\t\t\t\t\twatchDisposable.dispose();\n\t\t\t\t}\n\t\t\t} else if (change) {\n\t\t\t\tif (typeof change.cId === 'number' || typeof this.request.correlationId === 'number') {\n\t\t\t\t\t// Re-emit this change with the correlation id of the request\n\t\t\t\t\t// so that the client can correlate the event with the request\n\t\t\t\t\t// properly. Without correlation, we do not have to do that\n\t\t\t\t\t// because the event will appear on the global listener already.\n\t\t\t\t\tthis.onFileChange({ resource, type: change.type, cId: this.request.correlationId }, true /* skip excludes/includes (file is explicitly watched) */);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif (subscription) {\n\t\t\tdisposables.add(subscription);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate async doWatchWithNodeJS(isDirectory: boolean, disposables: DisposableStore): Promise<void> {\n\t\tconst realPath = await this.realPath.value;\n\n\t\tif (this.cts.token.isCancellationRequested) {\n\t\t\treturn;\n\t\t}\n\n\t\t// macOS: watching samba shares can crash VSCode so we do\n\t\t// a simple check for the file path pointing to /Volumes\n\t\t// (https://github.com/microsoft/vscode/issues/106879)\n\t\t// TODO@electron this needs a revisit when the crash is\n\t\t// fixed or mitigated upstream.\n\t\tif (isMacintosh && isEqualOrParent(realPath, '/Volumes/', true)) {\n\t\t\tthis.error(`Refusing to watch ${realPath} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst cts = new CancellationTokenSource(this.cts.token);\n\t\tdisposables.add(toDisposable(() => cts.dispose(true)));\n\n\t\tconst watcherDisposables = new DisposableStore(); // we need a separate disposable store because we re-create the watcher from within in some cases\n\t\tdisposables.add(watcherDisposables);\n\n\t\ttry {\n\t\t\tconst requestResource = URI.file(this.request.path);\n\t\t\tconst pathBasename = basename(realPath);\n\n\t\t\t// Creating watcher can fail with an exception\n\t\t\tconst watcher = watch(realPath);\n\t\t\twatcherDisposables.add(toDisposable(() => {\n\t\t\t\twatcher.removeAllListeners();\n\t\t\t\twatcher.close();\n\t\t\t}));\n\n\t\t\tthis.trace(`Started watching: '${realPath}'`);\n\n\t\t\t// Folder: resolve children to emit proper events\n\t\t\tconst folderChildren = new Set<string>();\n\t\t\tif (isDirectory) {\n\t\t\t\ttry {\n\t\t\t\t\tfor (const child of await Promises.readdir(realPath)) {\n\t\t\t\t\t\tfolderChildren.add(child);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.error(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst mapPathToStatDisposable = new Map<string, IDisposable>();\n\t\t\twatcherDisposables.add(toDisposable(() => {\n\t\t\t\tfor (const [, disposable] of mapPathToStatDisposable) {\n\t\t\t\t\tdisposable.dispose();\n\t\t\t\t}\n\t\t\t\tmapPathToStatDisposable.clear();\n\t\t\t}));\n\n\t\t\twatcher.on('error', (code: number, signal: string) => {\n\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.error(`Failed to watch ${realPath} for changes using fs.watch() (${code}, ${signal})`);\n\n\t\t\t\tthis.notifyWatchFailed();\n\t\t\t});\n\n\t\t\twatcher.on('change', (type, raw) => {\n\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\treturn; // ignore if already disposed\n\t\t\t\t}\n\n\t\t\t\tif (this.verboseLogging) {\n\t\t\t\t\tthis.traceWithCorrelation(`[raw] [\"${type}\"] ${raw}`);\n\t\t\t\t}\n\n\t\t\t\t// Normalize file name\n\t\t\t\tlet changedFileName = '';\n\t\t\t\tif (raw) { // https://github.com/microsoft/vscode/issues/38191\n\t\t\t\t\tchangedFileName = raw.toString();\n\t\t\t\t\tif (isMacintosh) {\n\t\t\t\t\t\t// Mac: uses NFD unicode form on disk, but we want NFC\n\t\t\t\t\t\t// See also https://github.com/nodejs/node/issues/2165\n\t\t\t\t\t\tchangedFileName = normalizeNFC(changedFileName);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!changedFileName || (type !== 'change' && type !== 'rename')) {\n\t\t\t\t\treturn; // ignore unexpected events\n\t\t\t\t}\n\n\t\t\t\t// Folder\n\t\t\t\tif (isDirectory) {\n\n\t\t\t\t\t// Folder child added/deleted\n\t\t\t\t\tif (type === 'rename') {\n\n\t\t\t\t\t\t// Cancel any previous stats for this file if existing\n\t\t\t\t\t\tmapPathToStatDisposable.get(changedFileName)?.dispose();\n\n\t\t\t\t\t\t// Wait a bit and try see if the file still exists on disk\n\t\t\t\t\t\t// to decide on the resulting event\n\t\t\t\t\t\tconst timeoutHandle = setTimeout(async () => {\n\t\t\t\t\t\t\tmapPathToStatDisposable.delete(changedFileName);\n\n\t\t\t\t\t\t\t// Depending on the OS the watcher runs on, there\n\t\t\t\t\t\t\t// is different behaviour for when the watched\n\t\t\t\t\t\t\t// folder path is being deleted:\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// -   macOS: not reported but events continue to\n\t\t\t\t\t\t\t//            work even when the folder is brought\n\t\t\t\t\t\t\t//            back, though it seems every change\n\t\t\t\t\t\t\t//            to a file is reported as \"rename\"\n\t\t\t\t\t\t\t// -   Linux: \"rename\" event is reported with the\n\t\t\t\t\t\t\t//            name of the folder and events stop\n\t\t\t\t\t\t\t//            working\n\t\t\t\t\t\t\t// - Windows: an EPERM error is thrown that we\n\t\t\t\t\t\t\t//            handle from the `on('error')` event\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// We do not re-attach the watcher after timeout\n\t\t\t\t\t\t\t// though as we do for file watches because for\n\t\t\t\t\t\t\t// file watching specifically we want to handle\n\t\t\t\t\t\t\t// the atomic-write cases where the file is being\n\t\t\t\t\t\t\t// deleted and recreated with different contents.\n\t\t\t\t\t\t\tif (isEqual(changedFileName, pathBasename, !isLinux) && !await Promises.exists(realPath)) {\n\t\t\t\t\t\t\t\tthis.onWatchedPathDeleted(requestResource);\n\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// In order to properly detect renames on a case-insensitive\n\t\t\t\t\t\t\t// file system, we need to use `existsChildStrictCase` helper\n\t\t\t\t\t\t\t// because otherwise we would wrongly assume a file exists\n\t\t\t\t\t\t\t// when it was renamed to same name but different case.\n\t\t\t\t\t\t\tconst fileExists = await this.existsChildStrictCase(join(realPath, changedFileName));\n\n\t\t\t\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\t\t\t\treturn; // ignore if disposed by now\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Figure out the correct event type:\n\t\t\t\t\t\t\t// File Exists: either 'added' or 'updated' if known before\n\t\t\t\t\t\t\t// File Does not Exist: always 'deleted'\n\t\t\t\t\t\t\tlet type: FileChangeType;\n\t\t\t\t\t\t\tif (fileExists) {\n\t\t\t\t\t\t\t\tif (folderChildren.has(changedFileName)) {\n\t\t\t\t\t\t\t\t\ttype = FileChangeType.UPDATED;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ttype = FileChangeType.ADDED;\n\t\t\t\t\t\t\t\t\tfolderChildren.add(changedFileName);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfolderChildren.delete(changedFileName);\n\t\t\t\t\t\t\t\ttype = FileChangeType.DELETED;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tthis.onFileChange({ resource: joinPath(requestResource, changedFileName), type, cId: this.request.correlationId });\n\t\t\t\t\t\t}, NodeJSFileWatcherLibrary.FILE_DELETE_HANDLER_DELAY);\n\n\t\t\t\t\t\tmapPathToStatDisposable.set(changedFileName, toDisposable(() => clearTimeout(timeoutHandle)));\n\t\t\t\t\t}\n\n\t\t\t\t\t// Folder child changed\n\t\t\t\t\telse {\n\n\t\t\t\t\t\t// Figure out the correct event type: if this is the\n\t\t\t\t\t\t// first time we see this child, it can only be added\n\t\t\t\t\t\tlet type: FileChangeType;\n\t\t\t\t\t\tif (folderChildren.has(changedFileName)) {\n\t\t\t\t\t\t\ttype = FileChangeType.UPDATED;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttype = FileChangeType.ADDED;\n\t\t\t\t\t\t\tfolderChildren.add(changedFileName);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthis.onFileChange({ resource: joinPath(requestResource, changedFileName), type, cId: this.request.correlationId });\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// File\n\t\t\t\telse {\n\n\t\t\t\t\t// File added/deleted\n\t\t\t\t\tif (type === 'rename' || !isEqual(changedFileName, pathBasename, !isLinux)) {\n\n\t\t\t\t\t\t// Depending on the OS the watcher runs on, there\n\t\t\t\t\t\t// is different behaviour for when the watched\n\t\t\t\t\t\t// file path is being deleted:\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// -   macOS: \"rename\" event is reported and events\n\t\t\t\t\t\t//            stop working\n\t\t\t\t\t\t// -   Linux: \"rename\" event is reported and events\n\t\t\t\t\t\t//            stop working\n\t\t\t\t\t\t// - Windows: \"rename\" event is reported and events\n\t\t\t\t\t\t//            continue to work when file is restored\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// As opposed to folder watching, we re-attach the\n\t\t\t\t\t\t// watcher after brief timeout to support \"atomic save\"\n\t\t\t\t\t\t// operations where a tool may decide to delete a file\n\t\t\t\t\t\t// and then create it with the updated contents.\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// Different to folder watching, we emit a delete event\n\t\t\t\t\t\t// though we never detect when the file is brought back\n\t\t\t\t\t\t// because the watcher is disposed then.\n\n\t\t\t\t\t\tconst timeoutHandle = setTimeout(async () => {\n\t\t\t\t\t\t\tconst fileExists = await Promises.exists(realPath);\n\n\t\t\t\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\t\t\t\treturn; // ignore if disposed by now\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// File still exists, so emit as change event and reapply the watcher\n\t\t\t\t\t\t\tif (fileExists) {\n\t\t\t\t\t\t\t\tthis.onFileChange({ resource: requestResource, type: FileChangeType.UPDATED, cId: this.request.correlationId }, true /* skip excludes/includes (file is explicitly watched) */);\n\n\t\t\t\t\t\t\t\twatcherDisposables.add(await this.doWatch(false));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// File seems to be really gone, so emit a deleted and failed event\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthis.onWatchedPathDeleted(requestResource);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, NodeJSFileWatcherLibrary.FILE_DELETE_HANDLER_DELAY);\n\n\t\t\t\t\t\t// Very important to dispose the watcher which now points to a stale inode\n\t\t\t\t\t\t// and wire in a new disposable that tracks our timeout that is installed\n\t\t\t\t\t\twatcherDisposables.clear();\n\t\t\t\t\t\twatcherDisposables.add(toDisposable(() => clearTimeout(timeoutHandle)));\n\t\t\t\t\t}\n\n\t\t\t\t\t// File changed\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis.onFileChange({ resource: requestResource, type: FileChangeType.UPDATED, cId: this.request.correlationId }, true /* skip excludes/includes (file is explicitly watched) */);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.error(`Failed to watch ${realPath} for changes using fs.watch() (${error.toString()})`);\n\n\t\t\tthis.notifyWatchFailed();\n\t\t}\n\t}\n\n\tprivate onWatchedPathDeleted(resource: URI): void {\n\t\tthis.warn('Watcher shutdown because watched path got deleted');\n\n\t\t// Emit events and flush in case the watcher gets disposed\n\t\tthis.onFileChange({ resource, type: FileChangeType.DELETED, cId: this.request.correlationId }, true /* skip excludes/includes (file is explicitly watched) */);\n\t\tthis.fileChangesAggregator.flush();\n\n\t\tthis.notifyWatchFailed();\n\t}\n\n\tprivate onFileChange(event: IFileChange, skipIncludeExcludeChecks = false): void {\n\t\tif (this.cts.token.isCancellationRequested) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Logging\n\t\tif (this.verboseLogging) {\n\t\t\tthis.traceWithCorrelation(`${event.type === FileChangeType.ADDED ? '[ADDED]' : event.type === FileChangeType.DELETED ? '[DELETED]' : '[CHANGED]'} ${event.resource.fsPath}`);\n\t\t}\n\n\t\t// Add to aggregator unless excluded or not included (not if explicitly disabled)\n\t\tif (!skipIncludeExcludeChecks && this.excludes.some(exclude => exclude(event.resource.fsPath))) {\n\t\t\tif (this.verboseLogging) {\n\t\t\t\tthis.traceWithCorrelation(` >> ignored (excluded) ${event.resource.fsPath}`);\n\t\t\t}\n\t\t} else if (!skipIncludeExcludeChecks && this.includes && this.includes.length > 0 && !this.includes.some(include => include(event.resource.fsPath))) {\n\t\t\tif (this.verboseLogging) {\n\t\t\t\tthis.traceWithCorrelation(` >> ignored (not included) ${event.resource.fsPath}`);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.fileChangesAggregator.work(event);\n\t\t}\n\t}\n\n\tprivate handleFileChanges(fileChanges: IFileChange[]): void {\n\n\t\t// Coalesce events: merge events of same kind\n\t\tconst coalescedFileChanges = coalesceEvents(fileChanges);\n\n\t\t// Filter events: based on request filter property\n\t\tconst filteredEvents: IFileChange[] = [];\n\t\tfor (const event of coalescedFileChanges) {\n\t\t\tif (isFiltered(event, this.filter)) {\n\t\t\t\tif (this.verboseLogging) {\n\t\t\t\t\tthis.traceWithCorrelation(` >> ignored (filtered) ${event.resource.fsPath}`);\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tfilteredEvents.push(event);\n\t\t}\n\n\t\tif (filteredEvents.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Logging\n\t\tif (this.verboseLogging) {\n\t\t\tfor (const event of filteredEvents) {\n\t\t\t\tthis.traceWithCorrelation(` >> normalized ${event.type === FileChangeType.ADDED ? '[ADDED]' : event.type === FileChangeType.DELETED ? '[DELETED]' : '[CHANGED]'} ${event.resource.fsPath}`);\n\t\t\t}\n\t\t}\n\n\t\t// Broadcast to clients via throttled emitter\n\t\tconst worked = this.throttledFileChangesEmitter.work(filteredEvents);\n\n\t\t// Logging\n\t\tif (!worked) {\n\t\t\tthis.warn(`started ignoring events due to too many file change events at once (incoming: ${filteredEvents.length}, most recent change: ${filteredEvents[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`);\n\t\t} else {\n\t\t\tif (this.throttledFileChangesEmitter.pending > 0) {\n\t\t\t\tthis.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${filteredEvents[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async existsChildStrictCase(path: string): Promise<boolean> {\n\t\tif (isLinux) {\n\t\t\treturn Promises.exists(path);\n\t\t}\n\n\t\ttry {\n\t\t\tconst pathBasename = basename(path);\n\t\t\tconst children = await Promises.readdir(dirname(path));\n\n\t\t\treturn children.some(child => child === pathBasename);\n\t\t} catch (error) {\n\t\t\tthis.trace(error);\n\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tsetVerboseLogging(verboseLogging: boolean): void {\n\t\tthis.verboseLogging = verboseLogging;\n\t}\n\n\tprivate error(error: string): void {\n\t\tif (!this.cts.token.isCancellationRequested) {\n\t\t\tthis.onLogMessage?.({ type: 'error', message: `[File Watcher (node.js)] ${error}` });\n\t\t}\n\t}\n\n\tprivate warn(message: string): void {\n\t\tif (!this.cts.token.isCancellationRequested) {\n\t\t\tthis.onLogMessage?.({ type: 'warn', message: `[File Watcher (node.js)] ${message}` });\n\t\t}\n\t}\n\n\tprivate trace(message: string): void {\n\t\tif (!this.cts.token.isCancellationRequested && this.verboseLogging) {\n\t\t\tthis.onLogMessage?.({ type: 'trace', message: `[File Watcher (node.js)] ${message}` });\n\t\t}\n\t}\n\n\tprivate traceWithCorrelation(message: string): void {\n\t\tif (!this.cts.token.isCancellationRequested && this.verboseLogging) {\n\t\t\tthis.trace(`${message}${typeof this.request.correlationId === 'number' ? ` <${this.request.correlationId}> ` : ``}`);\n\t\t}\n\t}\n\n\toverride dispose(): void {\n\t\tthis.cts.dispose(true);\n\n\t\tsuper.dispose();\n\t}\n}\n\n/**\n * Watch the provided `path` for changes and return\n * the data in chunks of `Uint8Array` for further use.\n */\nexport async function watchFileContents(path: string, onData: (chunk: Uint8Array) => void, onReady: () => void, token: CancellationToken, bufferSize = 512): Promise<void> {\n\tconst handle = await Promises.open(path, 'r');\n\tconst buffer = Buffer.allocUnsafe(bufferSize);\n\n\tconst cts = new CancellationTokenSource(token);\n\n\tlet error: Error | undefined = undefined;\n\tlet isReading = false;\n\n\tconst request: INonRecursiveWatchRequest = { path, excludes: [], recursive: false };\n\tconst watcher = new NodeJSFileWatcherLibrary(request, undefined, changes => {\n\t\t(async () => {\n\t\t\tfor (const { type } of changes) {\n\t\t\t\tif (type === FileChangeType.UPDATED) {\n\n\t\t\t\t\tif (isReading) {\n\t\t\t\t\t\treturn; // return early if we are already reading the output\n\t\t\t\t\t}\n\n\t\t\t\t\tisReading = true;\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Consume the new contents of the file until finished\n\t\t\t\t\t\t// everytime there is a change event signalling a change\n\t\t\t\t\t\twhile (!cts.token.isCancellationRequested) {\n\t\t\t\t\t\t\tconst { bytesRead } = await Promises.read(handle, buffer, 0, bufferSize, null);\n\t\t\t\t\t\t\tif (!bytesRead || cts.token.isCancellationRequested) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tonData(buffer.slice(0, bytesRead));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\terror = new Error(err);\n\t\t\t\t\t\tcts.dispose(true);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tisReading = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})();\n\t});\n\n\tawait watcher.ready;\n\tonReady();\n\n\treturn new Promise<void>((resolve, reject) => {\n\t\tcts.token.onCancellationRequested(async () => {\n\t\t\twatcher.dispose();\n\n\t\t\ttry {\n\t\t\t\tawait Promises.close(handle);\n\t\t\t} catch (err) {\n\t\t\t\terror = new Error(err);\n\t\t\t}\n\n\t\t\tif (error) {\n\t\t\t\treject(error);\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../../../base/common/event.js';\nimport { patternsEquals } from '../../../../../base/common/glob.js';\nimport { BaseWatcher } from '../baseWatcher.js';\nimport { isLinux } from '../../../../../base/common/platform.js';\nimport { INonRecursiveWatchRequest, INonRecursiveWatcher, IRecursiveWatcherWithSubscribe } from '../../../common/watcher.js';\nimport { NodeJSFileWatcherLibrary } from './nodejsWatcherLib.js';\nimport { ThrottledWorker } from '../../../../../base/common/async.js';\nimport { MutableDisposable } from '../../../../../base/common/lifecycle.js';\n\nexport interface INodeJSWatcherInstance {\n\n\t/**\n\t * The watcher instance.\n\t */\n\treadonly instance: NodeJSFileWatcherLibrary;\n\n\t/**\n\t * The watch request associated to the watcher.\n\t */\n\treadonly request: INonRecursiveWatchRequest;\n}\n\nexport class NodeJSWatcher extends BaseWatcher implements INonRecursiveWatcher {\n\n\treadonly onDidError = Event.None;\n\n\tprivate readonly _watchers = new Map<string /* path */ | number /* correlation ID */, INodeJSWatcherInstance>();\n\tget watchers() { return this._watchers.values(); }\n\n\tprivate readonly worker = this._register(new MutableDisposable<ThrottledWorker<INonRecursiveWatchRequest>>());\n\n\tconstructor(protected readonly recursiveWatcher: IRecursiveWatcherWithSubscribe | undefined) {\n\t\tsuper();\n\t}\n\n\tprotected override async doWatch(requests: INonRecursiveWatchRequest[]): Promise<void> {\n\n\t\t// Figure out duplicates to remove from the requests\n\t\trequests = this.removeDuplicateRequests(requests);\n\n\t\t// Figure out which watchers to start and which to stop\n\t\tconst requestsToStart: INonRecursiveWatchRequest[] = [];\n\t\tconst watchersToStop = new Set(Array.from(this.watchers));\n\t\tfor (const request of requests) {\n\t\t\tconst watcher = this._watchers.get(this.requestToWatcherKey(request));\n\t\t\tif (watcher && patternsEquals(watcher.request.excludes, request.excludes) && patternsEquals(watcher.request.includes, request.includes)) {\n\t\t\t\twatchersToStop.delete(watcher); // keep watcher\n\t\t\t} else {\n\t\t\t\trequestsToStart.push(request); // start watching\n\t\t\t}\n\t\t}\n\n\t\t// Logging\n\n\t\tif (requestsToStart.length) {\n\t\t\tthis.trace(`Request to start watching: ${requestsToStart.map(request => this.requestToString(request)).join(',')}`);\n\t\t}\n\n\t\tif (watchersToStop.size) {\n\t\t\tthis.trace(`Request to stop watching: ${Array.from(watchersToStop).map(watcher => this.requestToString(watcher.request)).join(',')}`);\n\t\t}\n\n\t\t// Stop the worker\n\t\tthis.worker.clear();\n\n\t\t// Stop watching as instructed\n\t\tfor (const watcher of watchersToStop) {\n\t\t\tthis.stopWatching(watcher);\n\t\t}\n\n\t\t// Start watching as instructed\n\t\tthis.createWatchWorker().work(requestsToStart);\n\t}\n\n\tprivate createWatchWorker(): ThrottledWorker<INonRecursiveWatchRequest> {\n\n\t\t// We see very large amount of non-recursive file watcher requests\n\t\t// in large workspaces. To prevent the overhead of starting thousands\n\t\t// of watchers at once, we use a throttled worker to distribute this\n\t\t// work over time.\n\n\t\tthis.worker.value = new ThrottledWorker<INonRecursiveWatchRequest>({\n\t\t\tmaxWorkChunkSize: 100,\t\t\t\t// only start 100 watchers at once before...\n\t\t\tthrottleDelay: 100,\t  \t\t\t\t// ...resting for 100ms until we start watchers again...\n\t\t\tmaxBufferedWork: Number.MAX_VALUE \t// ...and never refuse any work.\n\t\t}, requests => {\n\t\t\tfor (const request of requests) {\n\t\t\t\tthis.startWatching(request);\n\t\t\t}\n\t\t});\n\n\t\treturn this.worker.value;\n\t}\n\n\tprivate requestToWatcherKey(request: INonRecursiveWatchRequest): string | number {\n\t\treturn typeof request.correlationId === 'number' ? request.correlationId : this.pathToWatcherKey(request.path);\n\t}\n\n\tprivate pathToWatcherKey(path: string): string {\n\t\treturn isLinux ? path : path.toLowerCase() /* ignore path casing */;\n\t}\n\n\tprivate startWatching(request: INonRecursiveWatchRequest): void {\n\n\t\t// Start via node.js lib\n\t\tconst instance = new NodeJSFileWatcherLibrary(request, this.recursiveWatcher, changes => this._onDidChangeFile.fire(changes), () => this._onDidWatchFail.fire(request), msg => this._onDidLogMessage.fire(msg), this.verboseLogging);\n\n\t\t// Remember as watcher instance\n\t\tconst watcher: INodeJSWatcherInstance = { request, instance };\n\t\tthis._watchers.set(this.requestToWatcherKey(request), watcher);\n\t}\n\n\toverride async stop(): Promise<void> {\n\t\tawait super.stop();\n\n\t\tfor (const watcher of this.watchers) {\n\t\t\tthis.stopWatching(watcher);\n\t\t}\n\t}\n\n\tprivate stopWatching(watcher: INodeJSWatcherInstance): void {\n\t\tthis.trace(`stopping file watcher`, watcher);\n\n\t\tthis._watchers.delete(this.requestToWatcherKey(watcher.request));\n\n\t\twatcher.instance.dispose();\n\t}\n\n\tprivate removeDuplicateRequests(requests: INonRecursiveWatchRequest[]): INonRecursiveWatchRequest[] {\n\t\tconst mapCorrelationtoRequests = new Map<number | undefined /* correlation */, Map<string, INonRecursiveWatchRequest>>();\n\n\t\t// Ignore requests for the same paths that have the same correlation\n\t\tfor (const request of requests) {\n\n\t\t\tlet requestsForCorrelation = mapCorrelationtoRequests.get(request.correlationId);\n\t\t\tif (!requestsForCorrelation) {\n\t\t\t\trequestsForCorrelation = new Map<string, INonRecursiveWatchRequest>();\n\t\t\t\tmapCorrelationtoRequests.set(request.correlationId, requestsForCorrelation);\n\t\t\t}\n\n\t\t\tconst path = this.pathToWatcherKey(request.path);\n\t\t\tif (requestsForCorrelation.has(path)) {\n\t\t\t\tthis.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(request)}`);\n\t\t\t}\n\n\t\t\trequestsForCorrelation.set(path, request);\n\t\t}\n\n\t\treturn Array.from(mapCorrelationtoRequests.values()).map(requests => Array.from(requests.values())).flat();\n\t}\n\n\toverride async setVerboseLogging(enabled: boolean): Promise<void> {\n\t\tsuper.setVerboseLogging(enabled);\n\n\t\tfor (const watcher of this.watchers) {\n\t\t\twatcher.instance.setVerboseLogging(enabled);\n\t\t}\n\t}\n\n\tprotected trace(message: string, watcher?: INodeJSWatcherInstance): void {\n\t\tif (this.verboseLogging) {\n\t\t\tthis._onDidLogMessage.fire({ type: 'trace', message: this.toMessage(message, watcher) });\n\t\t}\n\t}\n\n\tprotected warn(message: string): void {\n\t\tthis._onDidLogMessage.fire({ type: 'warn', message: this.toMessage(message) });\n\t}\n\n\tprivate toMessage(message: string, watcher?: INodeJSWatcherInstance): string {\n\t\treturn watcher ? `[File Watcher (node.js)] ${message} (${this.requestToString(watcher.request)})` : `[File Watcher (node.js)] ${message}`;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { DisposableStore } from '../../../../../base/common/lifecycle.js';\nimport { IFileChange } from '../../../common/files.js';\nimport { ILogMessage, AbstractNonRecursiveWatcherClient, INonRecursiveWatcher } from '../../../common/watcher.js';\nimport { NodeJSWatcher } from './nodejsWatcher.js';\n\nexport class NodeJSWatcherClient extends AbstractNonRecursiveWatcherClient {\n\n\tconstructor(\n\t\tonFileChanges: (changes: IFileChange[]) => void,\n\t\tonLogMessage: (msg: ILogMessage) => void,\n\t\tverboseLogging: boolean\n\t) {\n\t\tsuper(onFileChanges, onLogMessage, verboseLogging);\n\n\t\tthis.init();\n\t}\n\n\tprotected override createWatcher(disposables: DisposableStore): INonRecursiveWatcher {\n\t\treturn disposables.add(new NodeJSWatcher(undefined /* no recursive watching support here */)) satisfies INonRecursiveWatcher;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Stats, promises } from 'fs';\nimport { Barrier, retry } from '../../../base/common/async.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { Event } from '../../../base/common/event.js';\nimport { isEqual } from '../../../base/common/extpath.js';\nimport { DisposableStore, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { basename, dirname, join } from '../../../base/common/path.js';\nimport { isLinux, isWindows } from '../../../base/common/platform.js';\nimport { extUriBiasedIgnorePathCase, joinPath, basename as resourcesBasename, dirname as resourcesDirname } from '../../../base/common/resources.js';\nimport { newWriteableStream, ReadableStreamEvents } from '../../../base/common/stream.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IDirent, Promises, RimRafMode, SymlinkSupport } from '../../../base/node/pfs.js';\nimport { localize } from '../../../nls.js';\nimport { createFileSystemProviderError, IFileAtomicReadOptions, IFileDeleteOptions, IFileOpenOptions, IFileOverwriteOptions, IFileReadStreamOptions, FileSystemProviderCapabilities, FileSystemProviderError, FileSystemProviderErrorCode, FileType, IFileWriteOptions, IFileSystemProviderWithFileAtomicReadCapability, IFileSystemProviderWithFileCloneCapability, IFileSystemProviderWithFileFolderCopyCapability, IFileSystemProviderWithFileReadStreamCapability, IFileSystemProviderWithFileReadWriteCapability, IFileSystemProviderWithOpenReadWriteCloseCapability, isFileOpenForWriteOptions, IStat, FilePermission, IFileSystemProviderWithFileAtomicWriteCapability, IFileSystemProviderWithFileAtomicDeleteCapability, IFileChange, IFileSystemProviderWithFileRealpathCapability } from '../common/files.js';\nimport { readFileIntoStream } from '../common/io.js';\nimport { AbstractNonRecursiveWatcherClient, AbstractUniversalWatcherClient, ILogMessage } from '../common/watcher.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { AbstractDiskFileSystemProvider, IDiskFileSystemProviderOptions } from '../common/diskFileSystemProvider.js';\nimport { UniversalWatcherClient } from './watcher/watcherClient.js';\nimport { NodeJSWatcherClient } from './watcher/nodejs/nodejsClient.js';\n\nexport class DiskFileSystemProvider extends AbstractDiskFileSystemProvider implements\n\tIFileSystemProviderWithFileReadWriteCapability,\n\tIFileSystemProviderWithOpenReadWriteCloseCapability,\n\tIFileSystemProviderWithFileReadStreamCapability,\n\tIFileSystemProviderWithFileFolderCopyCapability,\n\tIFileSystemProviderWithFileAtomicReadCapability,\n\tIFileSystemProviderWithFileAtomicWriteCapability,\n\tIFileSystemProviderWithFileAtomicDeleteCapability,\n\tIFileSystemProviderWithFileCloneCapability,\n\tIFileSystemProviderWithFileRealpathCapability {\n\n\tprivate static TRACE_LOG_RESOURCE_LOCKS = false; // not enabled by default because very spammy\n\n\tconstructor(\n\t\tlogService: ILogService,\n\t\toptions?: IDiskFileSystemProviderOptions\n\t) {\n\t\tsuper(logService, options);\n\t}\n\n\t//#region File Capabilities\n\n\treadonly onDidChangeCapabilities = Event.None;\n\n\tprivate _capabilities: FileSystemProviderCapabilities | undefined;\n\tget capabilities(): FileSystemProviderCapabilities {\n\t\tif (!this._capabilities) {\n\t\t\tthis._capabilities =\n\t\t\t\tFileSystemProviderCapabilities.FileReadWrite |\n\t\t\t\tFileSystemProviderCapabilities.FileOpenReadWriteClose |\n\t\t\t\tFileSystemProviderCapabilities.FileReadStream |\n\t\t\t\tFileSystemProviderCapabilities.FileFolderCopy |\n\t\t\t\tFileSystemProviderCapabilities.FileWriteUnlock |\n\t\t\t\tFileSystemProviderCapabilities.FileAtomicRead |\n\t\t\t\tFileSystemProviderCapabilities.FileAtomicWrite |\n\t\t\t\tFileSystemProviderCapabilities.FileAtomicDelete |\n\t\t\t\tFileSystemProviderCapabilities.FileClone |\n\t\t\t\tFileSystemProviderCapabilities.FileRealpath;\n\n\t\t\tif (isLinux) {\n\t\t\t\tthis._capabilities |= FileSystemProviderCapabilities.PathCaseSensitive;\n\t\t\t}\n\t\t}\n\n\t\treturn this._capabilities;\n\t}\n\n\t//#endregion\n\n\t//#region File Metadata Resolving\n\n\tasync stat(resource: URI): Promise<IStat> {\n\t\ttry {\n\t\t\tconst { stat, symbolicLink } = await SymlinkSupport.stat(this.toFilePath(resource)); // cannot use fs.stat() here to support links properly\n\n\t\t\treturn {\n\t\t\t\ttype: this.toType(stat, symbolicLink),\n\t\t\t\tctime: stat.birthtime.getTime(), // intentionally not using ctime here, we want the creation time\n\t\t\t\tmtime: stat.mtime.getTime(),\n\t\t\t\tsize: stat.size,\n\t\t\t\tpermissions: (stat.mode & 0o200) === 0 ? FilePermission.Locked : undefined\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t}\n\t}\n\n\tprivate async statIgnoreError(resource: URI): Promise<IStat | undefined> {\n\t\ttry {\n\t\t\treturn await this.stat(resource);\n\t\t} catch (error) {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tasync realpath(resource: URI): Promise<string> {\n\t\tconst filePath = this.toFilePath(resource);\n\n\t\treturn Promises.realpath(filePath);\n\t}\n\n\tasync readdir(resource: URI): Promise<[string, FileType][]> {\n\t\ttry {\n\t\t\tconst children = await Promises.readdir(this.toFilePath(resource), { withFileTypes: true });\n\n\t\t\tconst result: [string, FileType][] = [];\n\t\t\tawait Promise.all(children.map(async child => {\n\t\t\t\ttry {\n\t\t\t\t\tlet type: FileType;\n\t\t\t\t\tif (child.isSymbolicLink()) {\n\t\t\t\t\t\ttype = (await this.stat(joinPath(resource, child.name))).type; // always resolve target the link points to if any\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttype = this.toType(child);\n\t\t\t\t\t}\n\n\t\t\t\t\tresult.push([child.name, type]);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logService.trace(error); // ignore errors for individual entries that can arise from permission denied\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t}\n\t}\n\n\tprivate toType(entry: Stats | IDirent, symbolicLink?: { dangling: boolean }): FileType {\n\n\t\t// Signal file type by checking for file / directory, except:\n\t\t// - symbolic links pointing to nonexistent files are FileType.Unknown\n\t\t// - files that are neither file nor directory are FileType.Unknown\n\t\tlet type: FileType;\n\t\tif (symbolicLink?.dangling) {\n\t\t\ttype = FileType.Unknown;\n\t\t} else if (entry.isFile()) {\n\t\t\ttype = FileType.File;\n\t\t} else if (entry.isDirectory()) {\n\t\t\ttype = FileType.Directory;\n\t\t} else {\n\t\t\ttype = FileType.Unknown;\n\t\t}\n\n\t\t// Always signal symbolic link as file type additionally\n\t\tif (symbolicLink) {\n\t\t\ttype |= FileType.SymbolicLink;\n\t\t}\n\n\t\treturn type;\n\t}\n\n\t//#endregion\n\n\t//#region File Reading/Writing\n\n\tprivate readonly resourceLocks = new ResourceMap<Barrier>(resource => extUriBiasedIgnorePathCase.getComparisonKey(resource));\n\n\tprivate async createResourceLock(resource: URI): Promise<IDisposable> {\n\t\tconst filePath = this.toFilePath(resource);\n\t\tthis.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${filePath})`);\n\n\t\t// Await pending locks for resource. It is possible for a new lock being\n\t\t// added right after opening, so we have to loop over locks until no lock\n\t\t// remains.\n\t\tlet existingLock: Barrier | undefined = undefined;\n\t\twhile (existingLock = this.resourceLocks.get(resource)) {\n\t\t\tthis.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${filePath})`);\n\t\t\tawait existingLock.wait();\n\t\t}\n\n\t\t// Store new\n\t\tconst newLock = new Barrier();\n\t\tthis.resourceLocks.set(resource, newLock);\n\n\t\tthis.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${filePath})`);\n\n\t\treturn toDisposable(() => {\n\t\t\tthis.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${filePath})`);\n\n\t\t\t// Delete lock if it is still ours\n\t\t\tif (this.resourceLocks.get(resource) === newLock) {\n\t\t\t\tthis.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${filePath})`);\n\t\t\t\tthis.resourceLocks.delete(resource);\n\t\t\t}\n\n\t\t\t// Open lock\n\t\t\tthis.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${filePath})`);\n\t\t\tnewLock.open();\n\t\t});\n\t}\n\n\tasync readFile(resource: URI, options?: IFileAtomicReadOptions): Promise<Uint8Array> {\n\t\tlet lock: IDisposable | undefined = undefined;\n\t\ttry {\n\t\t\tif (options?.atomic) {\n\t\t\t\tthis.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(resource)})`);\n\n\t\t\t\t// When the read should be atomic, make sure\n\t\t\t\t// to await any pending locks for the resource\n\t\t\t\t// and lock for the duration of the read.\n\t\t\t\tlock = await this.createResourceLock(resource);\n\t\t\t}\n\n\t\t\tconst filePath = this.toFilePath(resource);\n\n\t\t\treturn await promises.readFile(filePath);\n\t\t} catch (error) {\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t} finally {\n\t\t\tlock?.dispose();\n\t\t}\n\t}\n\n\tprivate traceLock(msg: string): void {\n\t\tif (DiskFileSystemProvider.TRACE_LOG_RESOURCE_LOCKS) {\n\t\t\tthis.logService.trace(msg);\n\t\t}\n\t}\n\n\treadFileStream(resource: URI, opts: IFileReadStreamOptions, token: CancellationToken): ReadableStreamEvents<Uint8Array> {\n\t\tconst stream = newWriteableStream<Uint8Array>(data => VSBuffer.concat(data.map(data => VSBuffer.wrap(data))).buffer);\n\n\t\treadFileIntoStream(this, resource, stream, data => data.buffer, {\n\t\t\t...opts,\n\t\t\tbufferSize: 256 * 1024 // read into chunks of 256kb each to reduce IPC overhead\n\t\t}, token);\n\n\t\treturn stream;\n\t}\n\n\tasync writeFile(resource: URI, content: Uint8Array, opts: IFileWriteOptions): Promise<void> {\n\t\tif (opts?.atomic !== false && opts?.atomic?.postfix && await this.canWriteFileAtomic(resource)) {\n\t\t\treturn this.doWriteFileAtomic(resource, joinPath(resourcesDirname(resource), `${resourcesBasename(resource)}${opts.atomic.postfix}`), content, opts);\n\t\t} else {\n\t\t\treturn this.doWriteFile(resource, content, opts);\n\t\t}\n\t}\n\n\tprivate async canWriteFileAtomic(resource: URI): Promise<boolean> {\n\t\ttry {\n\t\t\tconst filePath = this.toFilePath(resource);\n\t\t\tconst { symbolicLink } = await SymlinkSupport.stat(filePath);\n\t\t\tif (symbolicLink) {\n\t\t\t\t// atomic writes are unsupported for symbolic links because\n\t\t\t\t// we need to ensure that the `rename` operation is atomic\n\t\t\t\t// and that only works if the link is on the same disk.\n\t\t\t\t// Since we do not know where the symbolic link points to\n\t\t\t\t// we refuse to write atomically.\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// ignore stat errors here and just proceed trying to write\n\t\t}\n\n\t\treturn true; // atomic writing supported\n\t}\n\n\tprivate async doWriteFileAtomic(resource: URI, tempResource: URI, content: Uint8Array, opts: IFileWriteOptions): Promise<void> {\n\n\t\t// Ensure to create locks for all resources involved\n\t\t// since atomic write involves mutiple disk operations\n\t\t// and resources.\n\n\t\tconst locks = new DisposableStore();\n\n\t\ttry {\n\t\t\tlocks.add(await this.createResourceLock(resource));\n\t\t\tlocks.add(await this.createResourceLock(tempResource));\n\n\t\t\t// Write to temp resource first\n\t\t\tawait this.doWriteFile(tempResource, content, opts, true /* disable write lock */);\n\n\t\t\ttry {\n\n\t\t\t\t// Rename over existing to ensure atomic replace\n\t\t\t\tawait this.rename(tempResource, resource, { overwrite: true });\n\n\t\t\t} catch (error) {\n\n\t\t\t\t// Cleanup in case of rename error\n\t\t\t\ttry {\n\t\t\t\t\tawait this.delete(tempResource, { recursive: false, useTrash: false, atomic: false });\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// ignore - we want the outer error to bubble up\n\t\t\t\t}\n\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t} finally {\n\t\t\tlocks.dispose();\n\t\t}\n\t}\n\n\tprivate async doWriteFile(resource: URI, content: Uint8Array, opts: IFileWriteOptions, disableWriteLock?: boolean): Promise<void> {\n\t\tlet handle: number | undefined = undefined;\n\t\ttry {\n\t\t\tconst filePath = this.toFilePath(resource);\n\n\t\t\t// Validate target unless { create: true, overwrite: true }\n\t\t\tif (!opts.create || !opts.overwrite) {\n\t\t\t\tconst fileExists = await Promises.exists(filePath);\n\t\t\t\tif (fileExists) {\n\t\t\t\t\tif (!opts.overwrite) {\n\t\t\t\t\t\tthrow createFileSystemProviderError(localize('fileExists', \"File already exists\"), FileSystemProviderErrorCode.FileExists);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (!opts.create) {\n\t\t\t\t\t\tthrow createFileSystemProviderError(localize('fileNotExists', \"File does not exist\"), FileSystemProviderErrorCode.FileNotFound);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Open\n\t\t\thandle = await this.open(resource, { create: true, unlock: opts.unlock }, disableWriteLock);\n\n\t\t\t// Write content at once\n\t\t\tawait this.write(handle, 0, content, 0, content.byteLength);\n\t\t} catch (error) {\n\t\t\tthrow await this.toFileSystemProviderWriteError(resource, error);\n\t\t} finally {\n\t\t\tif (typeof handle === 'number') {\n\t\t\t\tawait this.close(handle);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readonly mapHandleToPos = new Map<number, number>();\n\tprivate readonly mapHandleToLock = new Map<number, IDisposable>();\n\n\tprivate readonly writeHandles = new Map<number, URI>();\n\n\tprivate static canFlush: boolean = true;\n\n\tstatic configureFlushOnWrite(enabled: boolean): void {\n\t\tDiskFileSystemProvider.canFlush = enabled;\n\t}\n\n\tasync open(resource: URI, opts: IFileOpenOptions, disableWriteLock?: boolean): Promise<number> {\n\t\tconst filePath = this.toFilePath(resource);\n\n\t\t// Writes: guard multiple writes to the same resource\n\t\t// behind a single lock to prevent races when writing\n\t\t// from multiple places at the same time to the same file\n\t\tlet lock: IDisposable | undefined = undefined;\n\t\tif (isFileOpenForWriteOptions(opts) && !disableWriteLock) {\n\t\t\tlock = await this.createResourceLock(resource);\n\t\t}\n\n\t\tlet fd: number | undefined = undefined;\n\t\ttry {\n\n\t\t\t// Determine whether to unlock the file (write only)\n\t\t\tif (isFileOpenForWriteOptions(opts) && opts.unlock) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { stat } = await SymlinkSupport.stat(filePath);\n\t\t\t\t\tif (!(stat.mode & 0o200 /* File mode indicating writable by owner */)) {\n\t\t\t\t\t\tawait promises.chmod(filePath, stat.mode | 0o200);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error.code !== 'ENOENT') {\n\t\t\t\t\t\tthis.logService.trace(error); // log errors but do not give up writing\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Windows gets special treatment (write only)\n\t\t\tif (isWindows && isFileOpenForWriteOptions(opts)) {\n\t\t\t\ttry {\n\n\t\t\t\t\t// We try to use 'r+' for opening (which will fail if the file does not exist)\n\t\t\t\t\t// to prevent issues when saving hidden files or preserving alternate data\n\t\t\t\t\t// streams.\n\t\t\t\t\t// Related issues:\n\t\t\t\t\t// - https://github.com/microsoft/vscode/issues/931\n\t\t\t\t\t// - https://github.com/microsoft/vscode/issues/6363\n\t\t\t\t\tfd = await Promises.open(filePath, 'r+');\n\n\t\t\t\t\t// The flag 'r+' will not truncate the file, so we have to do this manually\n\t\t\t\t\tawait Promises.ftruncate(fd, 0);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error.code !== 'ENOENT') {\n\t\t\t\t\t\tthis.logService.trace(error); // log errors but do not give up writing\n\t\t\t\t\t}\n\n\t\t\t\t\t// Make sure to close the file handle if we have one\n\t\t\t\t\tif (typeof fd === 'number') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait Promises.close(fd);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthis.logService.trace(error); // log errors but do not give up writing\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Reset `fd` to be able to try again with 'w'\n\t\t\t\t\t\tfd = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof fd !== 'number') {\n\t\t\t\tfd = await Promises.open(filePath, isFileOpenForWriteOptions(opts) ?\n\t\t\t\t\t// We take `opts.create` as a hint that the file is opened for writing\n\t\t\t\t\t// as such we use 'w' to truncate an existing or create the\n\t\t\t\t\t// file otherwise. we do not allow reading.\n\t\t\t\t\t'w' :\n\t\t\t\t\t// Otherwise we assume the file is opened for reading\n\t\t\t\t\t// as such we use 'r' to neither truncate, nor create\n\t\t\t\t\t// the file.\n\t\t\t\t\t'r'\n\t\t\t\t);\n\t\t\t}\n\n\t\t} catch (error) {\n\n\t\t\t// Release lock because we have no valid handle\n\t\t\t// if we did open a lock during this operation\n\t\t\tlock?.dispose();\n\n\t\t\t// Rethrow as file system provider error\n\t\t\tif (isFileOpenForWriteOptions(opts)) {\n\t\t\t\tthrow await this.toFileSystemProviderWriteError(resource, error);\n\t\t\t} else {\n\t\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t\t}\n\t\t}\n\n\t\t// Remember this handle to track file position of the handle\n\t\t// we init the position to 0 since the file descriptor was\n\t\t// just created and the position was not moved so far (see\n\t\t// also http://man7.org/linux/man-pages/man2/open.2.html -\n\t\t// \"The file offset is set to the beginning of the file.\")\n\t\tthis.mapHandleToPos.set(fd, 0);\n\n\t\t// remember that this handle was used for writing\n\t\tif (isFileOpenForWriteOptions(opts)) {\n\t\t\tthis.writeHandles.set(fd, resource);\n\t\t}\n\n\t\tif (lock) {\n\t\t\tconst previousLock = this.mapHandleToLock.get(fd);\n\n\t\t\t// Remember that this handle has an associated lock\n\t\t\tthis.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${fd} (${filePath})`);\n\t\t\tthis.mapHandleToLock.set(fd, lock);\n\n\t\t\t// There is a slight chance that a resource lock for a\n\t\t\t// handle was not yet disposed when we acquire a new\n\t\t\t// lock, so we must ensure to dispose the previous lock\n\t\t\t// before storing a new one for the same handle, other\n\t\t\t// wise we end up in a deadlock situation\n\t\t\t// https://github.com/microsoft/vscode/issues/142462\n\t\t\tif (previousLock) {\n\t\t\t\tthis.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${fd} (${filePath})`);\n\t\t\t\tpreviousLock.dispose();\n\t\t\t}\n\t\t}\n\n\t\treturn fd;\n\t}\n\n\tasync close(fd: number): Promise<void> {\n\n\t\t// It is very important that we keep any associated lock\n\t\t// for the file handle before attempting to call `fs.close(fd)`\n\t\t// because of a possible race condition: as soon as a file\n\t\t// handle is released, the OS may assign the same handle to\n\t\t// the next `fs.open` call and as such it is possible that our\n\t\t// lock is getting overwritten\n\t\tconst lockForHandle = this.mapHandleToLock.get(fd);\n\n\t\ttry {\n\n\t\t\t// Remove this handle from map of positions\n\t\t\tthis.mapHandleToPos.delete(fd);\n\n\t\t\t// If a handle is closed that was used for writing, ensure\n\t\t\t// to flush the contents to disk if possible.\n\t\t\tif (this.writeHandles.delete(fd) && DiskFileSystemProvider.canFlush) {\n\t\t\t\ttry {\n\t\t\t\t\tawait Promises.fdatasync(fd); // https://github.com/microsoft/vscode/issues/9589\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// In some exotic setups it is well possible that node fails to sync\n\t\t\t\t\t// In that case we disable flushing and log the error to our logger\n\t\t\t\t\tDiskFileSystemProvider.configureFlushOnWrite(false);\n\t\t\t\t\tthis.logService.error(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn await Promises.close(fd);\n\t\t} catch (error) {\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t} finally {\n\t\t\tif (lockForHandle) {\n\t\t\t\tif (this.mapHandleToLock.get(fd) === lockForHandle) {\n\t\t\t\t\tthis.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${fd}`);\n\t\t\t\t\tthis.mapHandleToLock.delete(fd); // only delete from map if this is still our lock!\n\t\t\t\t}\n\n\t\t\t\tthis.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${fd}`);\n\t\t\t\tlockForHandle.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tasync read(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {\n\t\tconst normalizedPos = this.normalizePos(fd, pos);\n\n\t\tlet bytesRead: number | null = null;\n\t\ttry {\n\t\t\tbytesRead = (await Promises.read(fd, data, offset, length, normalizedPos)).bytesRead;\n\t\t} catch (error) {\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t} finally {\n\t\t\tthis.updatePos(fd, normalizedPos, bytesRead);\n\t\t}\n\n\t\treturn bytesRead;\n\t}\n\n\tprivate normalizePos(fd: number, pos: number): number | null {\n\n\t\t// When calling fs.read/write we try to avoid passing in the \"pos\" argument and\n\t\t// rather prefer to pass in \"null\" because this avoids an extra seek(pos)\n\t\t// call that in some cases can even fail (e.g. when opening a file over FTP -\n\t\t// see https://github.com/microsoft/vscode/issues/73884).\n\t\t//\n\t\t// as such, we compare the passed in position argument with our last known\n\t\t// position for the file descriptor and use \"null\" if they match.\n\t\tif (pos === this.mapHandleToPos.get(fd)) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn pos;\n\t}\n\n\tprivate updatePos(fd: number, pos: number | null, bytesLength: number | null): void {\n\t\tconst lastKnownPos = this.mapHandleToPos.get(fd);\n\t\tif (typeof lastKnownPos === 'number') {\n\n\t\t\t// pos !== null signals that previously a position was used that is\n\t\t\t// not null. node.js documentation explains, that in this case\n\t\t\t// the internal file pointer is not moving and as such we do not move\n\t\t\t// our position pointer.\n\t\t\t//\n\t\t\t// Docs: \"If position is null, data will be read from the current file position,\n\t\t\t// and the file position will be updated. If position is an integer, the file position\n\t\t\t// will remain unchanged.\"\n\t\t\tif (typeof pos === 'number') {\n\t\t\t\t// do not modify the position\n\t\t\t}\n\n\t\t\t// bytesLength = number is a signal that the read/write operation was\n\t\t\t// successful and as such we need to advance the position in the Map\n\t\t\t//\n\t\t\t// Docs (http://man7.org/linux/man-pages/man2/read.2.html):\n\t\t\t// \"On files that support seeking, the read operation commences at the\n\t\t\t// file offset, and the file offset is incremented by the number of\n\t\t\t// bytes read.\"\n\t\t\t//\n\t\t\t// Docs (http://man7.org/linux/man-pages/man2/write.2.html):\n\t\t\t// \"For a seekable file (i.e., one to which lseek(2) may be applied, for\n\t\t\t// example, a regular file) writing takes place at the file offset, and\n\t\t\t// the file offset is incremented by the number of bytes actually\n\t\t\t// written.\"\n\t\t\telse if (typeof bytesLength === 'number') {\n\t\t\t\tthis.mapHandleToPos.set(fd, lastKnownPos + bytesLength);\n\t\t\t}\n\n\t\t\t// bytesLength = null signals an error in the read/write operation\n\t\t\t// and as such we drop the handle from the Map because the position\n\t\t\t// is unspecificed at this point.\n\t\t\telse {\n\t\t\t\tthis.mapHandleToPos.delete(fd);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync write(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {\n\n\t\t// We know at this point that the file to write to is truncated and thus empty\n\t\t// if the write now fails, the file remains empty. as such we really try hard\n\t\t// to ensure the write succeeds by retrying up to three times.\n\t\treturn retry(() => this.doWrite(fd, pos, data, offset, length), 100 /* ms delay */, 3 /* retries */);\n\t}\n\n\tprivate async doWrite(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {\n\t\tconst normalizedPos = this.normalizePos(fd, pos);\n\n\t\tlet bytesWritten: number | null = null;\n\t\ttry {\n\t\t\tbytesWritten = (await Promises.write(fd, data, offset, length, normalizedPos)).bytesWritten;\n\t\t} catch (error) {\n\t\t\tthrow await this.toFileSystemProviderWriteError(this.writeHandles.get(fd), error);\n\t\t} finally {\n\t\t\tthis.updatePos(fd, normalizedPos, bytesWritten);\n\t\t}\n\n\t\treturn bytesWritten;\n\t}\n\n\t//#endregion\n\n\t//#region Move/Copy/Delete/Create Folder\n\n\tasync mkdir(resource: URI): Promise<void> {\n\t\ttry {\n\t\t\tawait promises.mkdir(this.toFilePath(resource));\n\t\t} catch (error) {\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t}\n\t}\n\n\tasync delete(resource: URI, opts: IFileDeleteOptions): Promise<void> {\n\t\ttry {\n\t\t\tconst filePath = this.toFilePath(resource);\n\t\t\tif (opts.recursive) {\n\t\t\t\tlet rmMoveToPath: string | undefined = undefined;\n\t\t\t\tif (opts?.atomic !== false && opts.atomic.postfix) {\n\t\t\t\t\trmMoveToPath = join(dirname(filePath), `${basename(filePath)}${opts.atomic.postfix}`);\n\t\t\t\t}\n\n\t\t\t\tawait Promises.rm(filePath, RimRafMode.MOVE, rmMoveToPath);\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tawait promises.unlink(filePath);\n\t\t\t\t} catch (unlinkError) {\n\n\t\t\t\t\t// `fs.unlink` will throw when used on directories\n\t\t\t\t\t// we try to detect this error and then see if the\n\t\t\t\t\t// provided resource is actually a directory. in that\n\t\t\t\t\t// case we use `fs.rmdir` to delete the directory.\n\n\t\t\t\t\tif (unlinkError.code === 'EPERM' || unlinkError.code === 'EISDIR') {\n\t\t\t\t\t\tlet isDirectory = false;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst { stat, symbolicLink } = await SymlinkSupport.stat(filePath);\n\t\t\t\t\t\t\tisDirectory = stat.isDirectory() && !symbolicLink;\n\t\t\t\t\t\t} catch (statError) {\n\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (isDirectory) {\n\t\t\t\t\t\t\tawait promises.rmdir(filePath);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow unlinkError;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow unlinkError;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t}\n\t}\n\n\tasync rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void> {\n\t\tconst fromFilePath = this.toFilePath(from);\n\t\tconst toFilePath = this.toFilePath(to);\n\n\t\tif (fromFilePath === toFilePath) {\n\t\t\treturn; // simulate node.js behaviour here and do a no-op if paths match\n\t\t}\n\n\t\ttry {\n\n\t\t\t// Validate the move operation can perform\n\t\t\tawait this.validateMoveCopy(from, to, 'move', opts.overwrite);\n\n\t\t\t// Rename\n\t\t\tawait Promises.rename(fromFilePath, toFilePath);\n\t\t} catch (error) {\n\n\t\t\t// Rewrite some typical errors that can happen especially around symlinks\n\t\t\t// to something the user can better understand\n\t\t\tif (error.code === 'EINVAL' || error.code === 'EBUSY' || error.code === 'ENAMETOOLONG') {\n\t\t\t\terror = new Error(localize('moveError', \"Unable to move '{0}' into '{1}' ({2}).\", basename(fromFilePath), basename(dirname(toFilePath)), error.toString()));\n\t\t\t}\n\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t}\n\t}\n\n\tasync copy(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void> {\n\t\tconst fromFilePath = this.toFilePath(from);\n\t\tconst toFilePath = this.toFilePath(to);\n\n\t\tif (fromFilePath === toFilePath) {\n\t\t\treturn; // simulate node.js behaviour here and do a no-op if paths match\n\t\t}\n\n\t\ttry {\n\n\t\t\t// Validate the copy operation can perform\n\t\t\tawait this.validateMoveCopy(from, to, 'copy', opts.overwrite);\n\n\t\t\t// Copy\n\t\t\tawait Promises.copy(fromFilePath, toFilePath, { preserveSymlinks: true });\n\t\t} catch (error) {\n\n\t\t\t// Rewrite some typical errors that can happen especially around symlinks\n\t\t\t// to something the user can better understand\n\t\t\tif (error.code === 'EINVAL' || error.code === 'EBUSY' || error.code === 'ENAMETOOLONG') {\n\t\t\t\terror = new Error(localize('copyError', \"Unable to copy '{0}' into '{1}' ({2}).\", basename(fromFilePath), basename(dirname(toFilePath)), error.toString()));\n\t\t\t}\n\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t}\n\t}\n\n\tprivate async validateMoveCopy(from: URI, to: URI, mode: 'move' | 'copy', overwrite?: boolean): Promise<void> {\n\t\tconst fromFilePath = this.toFilePath(from);\n\t\tconst toFilePath = this.toFilePath(to);\n\n\t\tlet isSameResourceWithDifferentPathCase = false;\n\t\tconst isPathCaseSensitive = !!(this.capabilities & FileSystemProviderCapabilities.PathCaseSensitive);\n\t\tif (!isPathCaseSensitive) {\n\t\t\tisSameResourceWithDifferentPathCase = isEqual(fromFilePath, toFilePath, true /* ignore case */);\n\t\t}\n\n\t\tif (isSameResourceWithDifferentPathCase) {\n\n\t\t\t// You cannot copy the same file to the same location with different\n\t\t\t// path case unless you are on a case sensitive file system\n\t\t\tif (mode === 'copy') {\n\t\t\t\tthrow createFileSystemProviderError(localize('fileCopyErrorPathCase', \"File cannot be copied to same path with different path case\"), FileSystemProviderErrorCode.FileExists);\n\t\t\t}\n\n\t\t\t// You can move the same file to the same location with different\n\t\t\t// path case on case insensitive file systems\n\t\t\telse if (mode === 'move') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Here we have to see if the target to move/copy to exists or not.\n\t\t// We need to respect the `overwrite` option to throw in case the\n\t\t// target exists.\n\n\t\tconst fromStat = await this.statIgnoreError(from);\n\t\tif (!fromStat) {\n\t\t\tthrow createFileSystemProviderError(localize('fileMoveCopyErrorNotFound', \"File to move/copy does not exist\"), FileSystemProviderErrorCode.FileNotFound);\n\t\t}\n\n\t\tconst toStat = await this.statIgnoreError(to);\n\t\tif (!toStat) {\n\t\t\treturn; // target does not exist so we are good\n\t\t}\n\n\t\tif (!overwrite) {\n\t\t\tthrow createFileSystemProviderError(localize('fileMoveCopyErrorExists', \"File at target already exists and thus will not be moved/copied to unless overwrite is specified\"), FileSystemProviderErrorCode.FileExists);\n\t\t}\n\n\t\t// Handle existing target for move/copy\n\t\tif ((fromStat.type & FileType.File) !== 0 && (toStat.type & FileType.File) !== 0) {\n\t\t\treturn; // node.js can move/copy a file over an existing file without having to delete it first\n\t\t} else {\n\t\t\tawait this.delete(to, { recursive: true, useTrash: false, atomic: false });\n\t\t}\n\t}\n\n\t//#endregion\n\n\t//#region Clone File\n\n\tasync cloneFile(from: URI, to: URI): Promise<void> {\n\t\treturn this.doCloneFile(from, to, false /* optimistically assume parent folders exist */);\n\t}\n\n\tprivate async doCloneFile(from: URI, to: URI, mkdir: boolean): Promise<void> {\n\t\tconst fromFilePath = this.toFilePath(from);\n\t\tconst toFilePath = this.toFilePath(to);\n\n\t\tconst isPathCaseSensitive = !!(this.capabilities & FileSystemProviderCapabilities.PathCaseSensitive);\n\t\tif (isEqual(fromFilePath, toFilePath, !isPathCaseSensitive)) {\n\t\t\treturn; // cloning is only supported `from` and `to` are different files\n\t\t}\n\n\t\t// Implement clone by using `fs.copyFile`, however setup locks\n\t\t// for both `from` and `to` because node.js does not ensure\n\t\t// this to be an atomic operation\n\n\t\tconst locks = new DisposableStore();\n\n\t\ttry {\n\t\t\tlocks.add(await this.createResourceLock(from));\n\t\t\tlocks.add(await this.createResourceLock(to));\n\n\t\t\tif (mkdir) {\n\t\t\t\tawait promises.mkdir(dirname(toFilePath), { recursive: true });\n\t\t\t}\n\n\t\t\tawait promises.copyFile(fromFilePath, toFilePath);\n\t\t} catch (error) {\n\t\t\tif (error.code === 'ENOENT' && !mkdir) {\n\t\t\t\treturn this.doCloneFile(from, to, true);\n\t\t\t}\n\n\t\t\tthrow this.toFileSystemProviderError(error);\n\t\t} finally {\n\t\t\tlocks.dispose();\n\t\t}\n\t}\n\n\t//#endregion\n\n\t//#region File Watching\n\n\tprotected createUniversalWatcher(\n\t\tonChange: (changes: IFileChange[]) => void,\n\t\tonLogMessage: (msg: ILogMessage) => void,\n\t\tverboseLogging: boolean\n\t): AbstractUniversalWatcherClient {\n\t\treturn new UniversalWatcherClient(changes => onChange(changes), msg => onLogMessage(msg), verboseLogging);\n\t}\n\n\tprotected createNonRecursiveWatcher(\n\t\tonChange: (changes: IFileChange[]) => void,\n\t\tonLogMessage: (msg: ILogMessage) => void,\n\t\tverboseLogging: boolean\n\t): AbstractNonRecursiveWatcherClient {\n\t\treturn new NodeJSWatcherClient(changes => onChange(changes), msg => onLogMessage(msg), verboseLogging);\n\t}\n\n\t//#endregion\n\n\t//#region Helpers\n\n\tprivate toFileSystemProviderError(error: NodeJS.ErrnoException): FileSystemProviderError {\n\t\tif (error instanceof FileSystemProviderError) {\n\t\t\treturn error; // avoid double conversion\n\t\t}\n\n\t\tlet resultError: Error | string = error;\n\t\tlet code: FileSystemProviderErrorCode;\n\t\tswitch (error.code) {\n\t\t\tcase 'ENOENT':\n\t\t\t\tcode = FileSystemProviderErrorCode.FileNotFound;\n\t\t\t\tbreak;\n\t\t\tcase 'EISDIR':\n\t\t\t\tcode = FileSystemProviderErrorCode.FileIsADirectory;\n\t\t\t\tbreak;\n\t\t\tcase 'ENOTDIR':\n\t\t\t\tcode = FileSystemProviderErrorCode.FileNotADirectory;\n\t\t\t\tbreak;\n\t\t\tcase 'EEXIST':\n\t\t\t\tcode = FileSystemProviderErrorCode.FileExists;\n\t\t\t\tbreak;\n\t\t\tcase 'EPERM':\n\t\t\tcase 'EACCES':\n\t\t\t\tcode = FileSystemProviderErrorCode.NoPermissions;\n\t\t\t\tbreak;\n\t\t\tcase 'ERR_UNC_HOST_NOT_ALLOWED':\n\t\t\t\tresultError = `${error.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`;\n\t\t\t\tcode = FileSystemProviderErrorCode.Unknown;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcode = FileSystemProviderErrorCode.Unknown;\n\t\t}\n\n\t\treturn createFileSystemProviderError(resultError, code);\n\t}\n\n\tprivate async toFileSystemProviderWriteError(resource: URI | undefined, error: NodeJS.ErrnoException): Promise<FileSystemProviderError> {\n\t\tlet fileSystemProviderWriteError = this.toFileSystemProviderError(error);\n\n\t\t// If the write error signals permission issues, we try\n\t\t// to read the file's mode to see if the file is write\n\t\t// locked.\n\t\tif (resource && fileSystemProviderWriteError.code === FileSystemProviderErrorCode.NoPermissions) {\n\t\t\ttry {\n\t\t\t\tconst { stat } = await SymlinkSupport.stat(this.toFilePath(resource));\n\t\t\t\tif (!(stat.mode & 0o200 /* File mode indicating writable by owner */)) {\n\t\t\t\t\tfileSystemProviderWriteError = createFileSystemProviderError(error, FileSystemProviderErrorCode.FileWriteLocked);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.trace(error); // ignore - return original error\n\t\t\t}\n\t\t}\n\n\t\treturn fileSystemProviderWriteError;\n\t}\n\n\t//#endregion\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { localize } from '../../nls.js';\nimport { Lazy } from './lazy.js';\nimport { LANGUAGE_DEFAULT } from './platform.js';\n\nconst minute = 60;\nconst hour = minute * 60;\nconst day = hour * 24;\nconst week = day * 7;\nconst month = day * 30;\nconst year = day * 365;\n\n/**\n * Create a localized difference of the time between now and the specified date.\n * @param date The date to generate the difference from.\n * @param appendAgoLabel Whether to append the \" ago\" to the end.\n * @param useFullTimeWords Whether to use full words (eg. seconds) instead of\n * shortened (eg. secs).\n * @param disallowNow Whether to disallow the string \"now\" when the difference\n * is less than 30 seconds.\n */\nexport function fromNow(date: number | Date, appendAgoLabel?: boolean, useFullTimeWords?: boolean, disallowNow?: boolean): string {\n\tif (typeof date !== 'number') {\n\t\tdate = date.getTime();\n\t}\n\n\tconst seconds = Math.round((new Date().getTime() - date) / 1000);\n\tif (seconds < -30) {\n\t\treturn localize('date.fromNow.in', 'in {0}', fromNow(new Date().getTime() + seconds * 1000, false));\n\t}\n\n\tif (!disallowNow && seconds < 30) {\n\t\treturn localize('date.fromNow.now', 'now');\n\t}\n\n\tlet value: number;\n\tif (seconds < minute) {\n\t\tvalue = seconds;\n\n\t\tif (appendAgoLabel) {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.seconds.singular.ago.fullWord', '{0} second ago', value)\n\t\t\t\t\t: localize('date.fromNow.seconds.singular.ago', '{0} sec ago', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.seconds.plural.ago.fullWord', '{0} seconds ago', value)\n\t\t\t\t\t: localize('date.fromNow.seconds.plural.ago', '{0} secs ago', value);\n\t\t\t}\n\t\t} else {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.seconds.singular.fullWord', '{0} second', value)\n\t\t\t\t\t: localize('date.fromNow.seconds.singular', '{0} sec', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.seconds.plural.fullWord', '{0} seconds', value)\n\t\t\t\t\t: localize('date.fromNow.seconds.plural', '{0} secs', value);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (seconds < hour) {\n\t\tvalue = Math.floor(seconds / minute);\n\t\tif (appendAgoLabel) {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.minutes.singular.ago.fullWord', '{0} minute ago', value)\n\t\t\t\t\t: localize('date.fromNow.minutes.singular.ago', '{0} min ago', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.minutes.plural.ago.fullWord', '{0} minutes ago', value)\n\t\t\t\t\t: localize('date.fromNow.minutes.plural.ago', '{0} mins ago', value);\n\t\t\t}\n\t\t} else {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.minutes.singular.fullWord', '{0} minute', value)\n\t\t\t\t\t: localize('date.fromNow.minutes.singular', '{0} min', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.minutes.plural.fullWord', '{0} minutes', value)\n\t\t\t\t\t: localize('date.fromNow.minutes.plural', '{0} mins', value);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (seconds < day) {\n\t\tvalue = Math.floor(seconds / hour);\n\t\tif (appendAgoLabel) {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.hours.singular.ago.fullWord', '{0} hour ago', value)\n\t\t\t\t\t: localize('date.fromNow.hours.singular.ago', '{0} hr ago', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.hours.plural.ago.fullWord', '{0} hours ago', value)\n\t\t\t\t\t: localize('date.fromNow.hours.plural.ago', '{0} hrs ago', value);\n\t\t\t}\n\t\t} else {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.hours.singular.fullWord', '{0} hour', value)\n\t\t\t\t\t: localize('date.fromNow.hours.singular', '{0} hr', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.hours.plural.fullWord', '{0} hours', value)\n\t\t\t\t\t: localize('date.fromNow.hours.plural', '{0} hrs', value);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (seconds < week) {\n\t\tvalue = Math.floor(seconds / day);\n\t\tif (appendAgoLabel) {\n\t\t\treturn value === 1\n\t\t\t\t? localize('date.fromNow.days.singular.ago', '{0} day ago', value)\n\t\t\t\t: localize('date.fromNow.days.plural.ago', '{0} days ago', value);\n\t\t} else {\n\t\t\treturn value === 1\n\t\t\t\t? localize('date.fromNow.days.singular', '{0} day', value)\n\t\t\t\t: localize('date.fromNow.days.plural', '{0} days', value);\n\t\t}\n\t}\n\n\tif (seconds < month) {\n\t\tvalue = Math.floor(seconds / week);\n\t\tif (appendAgoLabel) {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.weeks.singular.ago.fullWord', '{0} week ago', value)\n\t\t\t\t\t: localize('date.fromNow.weeks.singular.ago', '{0} wk ago', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.weeks.plural.ago.fullWord', '{0} weeks ago', value)\n\t\t\t\t\t: localize('date.fromNow.weeks.plural.ago', '{0} wks ago', value);\n\t\t\t}\n\t\t} else {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.weeks.singular.fullWord', '{0} week', value)\n\t\t\t\t\t: localize('date.fromNow.weeks.singular', '{0} wk', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.weeks.plural.fullWord', '{0} weeks', value)\n\t\t\t\t\t: localize('date.fromNow.weeks.plural', '{0} wks', value);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (seconds < year) {\n\t\tvalue = Math.floor(seconds / month);\n\t\tif (appendAgoLabel) {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.months.singular.ago.fullWord', '{0} month ago', value)\n\t\t\t\t\t: localize('date.fromNow.months.singular.ago', '{0} mo ago', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.months.plural.ago.fullWord', '{0} months ago', value)\n\t\t\t\t\t: localize('date.fromNow.months.plural.ago', '{0} mos ago', value);\n\t\t\t}\n\t\t} else {\n\t\t\tif (value === 1) {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.months.singular.fullWord', '{0} month', value)\n\t\t\t\t\t: localize('date.fromNow.months.singular', '{0} mo', value);\n\t\t\t} else {\n\t\t\t\treturn useFullTimeWords\n\t\t\t\t\t? localize('date.fromNow.months.plural.fullWord', '{0} months', value)\n\t\t\t\t\t: localize('date.fromNow.months.plural', '{0} mos', value);\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue = Math.floor(seconds / year);\n\tif (appendAgoLabel) {\n\t\tif (value === 1) {\n\t\t\treturn useFullTimeWords\n\t\t\t\t? localize('date.fromNow.years.singular.ago.fullWord', '{0} year ago', value)\n\t\t\t\t: localize('date.fromNow.years.singular.ago', '{0} yr ago', value);\n\t\t} else {\n\t\t\treturn useFullTimeWords\n\t\t\t\t? localize('date.fromNow.years.plural.ago.fullWord', '{0} years ago', value)\n\t\t\t\t: localize('date.fromNow.years.plural.ago', '{0} yrs ago', value);\n\t\t}\n\t} else {\n\t\tif (value === 1) {\n\t\t\treturn useFullTimeWords\n\t\t\t\t? localize('date.fromNow.years.singular.fullWord', '{0} year', value)\n\t\t\t\t: localize('date.fromNow.years.singular', '{0} yr', value);\n\t\t} else {\n\t\t\treturn useFullTimeWords\n\t\t\t\t? localize('date.fromNow.years.plural.fullWord', '{0} years', value)\n\t\t\t\t: localize('date.fromNow.years.plural', '{0} yrs', value);\n\t\t}\n\t}\n}\n\nexport function fromNowByDay(date: number | Date, appendAgoLabel?: boolean, useFullTimeWords?: boolean): string {\n\tif (typeof date !== 'number') {\n\t\tdate = date.getTime();\n\t}\n\n\tconst todayMidnightTime = new Date();\n\ttodayMidnightTime.setHours(0, 0, 0, 0);\n\tconst yesterdayMidnightTime = new Date(todayMidnightTime.getTime());\n\tyesterdayMidnightTime.setDate(yesterdayMidnightTime.getDate() - 1);\n\n\tif (date > todayMidnightTime.getTime()) {\n\t\treturn localize('today', 'Today');\n\t}\n\n\tif (date > yesterdayMidnightTime.getTime()) {\n\t\treturn localize('yesterday', 'Yesterday');\n\t}\n\n\treturn fromNow(date, appendAgoLabel, useFullTimeWords);\n}\n\n/**\n * Gets a readable duration with intelligent/lossy precision. For example \"40ms\" or \"3.040s\")\n * @param ms The duration to get in milliseconds.\n * @param useFullTimeWords Whether to use full words (eg. seconds) instead of\n * shortened (eg. secs).\n */\nexport function getDurationString(ms: number, useFullTimeWords?: boolean) {\n\tconst seconds = Math.abs(ms / 1000);\n\tif (seconds < 1) {\n\t\treturn useFullTimeWords\n\t\t\t? localize('duration.ms.full', '{0} milliseconds', ms)\n\t\t\t: localize('duration.ms', '{0}ms', ms);\n\t}\n\tif (seconds < minute) {\n\t\treturn useFullTimeWords\n\t\t\t? localize('duration.s.full', '{0} seconds', Math.round(ms) / 1000)\n\t\t\t: localize('duration.s', '{0}s', Math.round(ms) / 1000);\n\t}\n\tif (seconds < hour) {\n\t\treturn useFullTimeWords\n\t\t\t? localize('duration.m.full', '{0} minutes', Math.round(ms / (1000 * minute)))\n\t\t\t: localize('duration.m', '{0} mins', Math.round(ms / (1000 * minute)));\n\t}\n\tif (seconds < day) {\n\t\treturn useFullTimeWords\n\t\t\t? localize('duration.h.full', '{0} hours', Math.round(ms / (1000 * hour)))\n\t\t\t: localize('duration.h', '{0} hrs', Math.round(ms / (1000 * hour)));\n\t}\n\treturn localize('duration.d', '{0} days', Math.round(ms / (1000 * day)));\n}\n\nexport function toLocalISOString(date: Date): string {\n\treturn date.getFullYear() +\n\t\t'-' + String(date.getMonth() + 1).padStart(2, '0') +\n\t\t'-' + String(date.getDate()).padStart(2, '0') +\n\t\t'T' + String(date.getHours()).padStart(2, '0') +\n\t\t':' + String(date.getMinutes()).padStart(2, '0') +\n\t\t':' + String(date.getSeconds()).padStart(2, '0') +\n\t\t'.' + (date.getMilliseconds() / 1000).toFixed(3).slice(2, 5) +\n\t\t'Z';\n}\n\nexport const safeIntl = {\n\tDateTimeFormat(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): Lazy<Intl.DateTimeFormat> {\n\t\treturn new Lazy(() => {\n\t\t\ttry {\n\t\t\t\treturn new Intl.DateTimeFormat(locales, options);\n\t\t\t} catch {\n\t\t\t\treturn new Intl.DateTimeFormat(undefined, options);\n\t\t\t}\n\t\t});\n\t},\n\tCollator(locales?: Intl.LocalesArgument, options?: Intl.CollatorOptions): Lazy<Intl.Collator> {\n\t\treturn new Lazy(() => {\n\t\t\ttry {\n\t\t\t\treturn new Intl.Collator(locales, options);\n\t\t\t} catch {\n\t\t\t\treturn new Intl.Collator(undefined, options);\n\t\t\t}\n\t\t});\n\t},\n\tSegmenter(locales?: Intl.LocalesArgument, options?: Intl.SegmenterOptions): Lazy<Intl.Segmenter> {\n\t\treturn new Lazy(() => {\n\t\t\ttry {\n\t\t\t\treturn new Intl.Segmenter(locales, options);\n\t\t\t} catch {\n\t\t\t\treturn new Intl.Segmenter(undefined, options);\n\t\t\t}\n\t\t});\n\t},\n\tLocale(tag: Intl.Locale | string, options?: Intl.LocaleOptions): Lazy<Intl.Locale> {\n\t\treturn new Lazy(() => {\n\t\t\ttry {\n\t\t\t\treturn new Intl.Locale(tag, options);\n\t\t\t} catch {\n\t\t\t\treturn new Intl.Locale(LANGUAGE_DEFAULT, options);\n\t\t\t}\n\t\t});\n\t},\n\tNumberFormat(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): Lazy<Intl.NumberFormat> {\n\t\treturn new Lazy(() => {\n\t\t\ttry {\n\t\t\t\treturn new Intl.NumberFormat(locales, options);\n\t\t\t} catch {\n\t\t\t\treturn new Intl.NumberFormat(undefined, options);\n\t\t\t}\n\t\t});\n\t}\n};\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { toLocalISOString } from '../../../base/common/date.js';\nimport { memoize } from '../../../base/common/decorators.js';\nimport { FileAccess, Schemas } from '../../../base/common/network.js';\nimport { dirname, join, normalize, resolve } from '../../../base/common/path.js';\nimport { env } from '../../../base/common/process.js';\nimport { joinPath } from '../../../base/common/resources.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { NativeParsedArgs } from './argv.js';\nimport { ExtensionKind, IExtensionHostDebugParams, INativeEnvironmentService } from './environment.js';\nimport { IProductService } from '../../product/common/productService.js';\n\nexport const EXTENSION_IDENTIFIER_WITH_LOG_REGEX = /^([^.]+\\..+)[:=](.+)$/;\n\nexport interface INativeEnvironmentPaths {\n\n\t/**\n\t * The user data directory to use for anything that should be\n\t * persisted except for the content that is meant for the `homeDir`.\n\t *\n\t * Only one instance of VSCode can use the same `userDataDir`.\n\t */\n\tuserDataDir: string;\n\n\t/**\n\t * The user home directory mainly used for persisting extensions\n\t * and global configuration that should be shared across all\n\t * versions.\n\t */\n\thomeDir: string;\n\n\t/**\n\t * OS tmp dir.\n\t */\n\ttmpDir: string;\n}\n\nexport abstract class AbstractNativeEnvironmentService implements INativeEnvironmentService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\t@memoize\n\tget appRoot(): string { return dirname(FileAccess.asFileUri('').fsPath); }\n\n\t@memoize\n\tget userHome(): URI { return URI.file(this.paths.homeDir); }\n\n\t@memoize\n\tget userDataPath(): string { return this.paths.userDataDir; }\n\n\t@memoize\n\tget appSettingsHome(): URI { return URI.file(join(this.userDataPath, 'User')); }\n\n\t@memoize\n\tget tmpDir(): URI { return URI.file(this.paths.tmpDir); }\n\n\t@memoize\n\tget cacheHome(): URI { return URI.file(this.userDataPath); }\n\n\t@memoize\n\tget stateResource(): URI { return joinPath(this.appSettingsHome, 'globalStorage', 'storage.json'); }\n\n\t@memoize\n\tget userRoamingDataHome(): URI { return this.appSettingsHome.with({ scheme: Schemas.vscodeUserData }); }\n\n\t@memoize\n\tget userDataSyncHome(): URI { return joinPath(this.appSettingsHome, 'sync'); }\n\n\tget logsHome(): URI {\n\t\tif (!this.args.logsPath) {\n\t\t\tconst key = toLocalISOString(new Date()).replace(/-|:|\\.\\d+Z$/g, '');\n\t\t\tthis.args.logsPath = join(this.userDataPath, 'logs', key);\n\t\t}\n\n\t\treturn URI.file(this.args.logsPath);\n\t}\n\n\t@memoize\n\tget sync(): 'on' | 'off' | undefined { return this.args.sync; }\n\n\t@memoize\n\tget workspaceStorageHome(): URI { return joinPath(this.appSettingsHome, 'workspaceStorage'); }\n\n\t@memoize\n\tget localHistoryHome(): URI { return joinPath(this.appSettingsHome, 'History'); }\n\n\t@memoize\n\tget keyboardLayoutResource(): URI { return joinPath(this.userRoamingDataHome, 'keyboardLayout.json'); }\n\n\t@memoize\n\tget argvResource(): URI {\n\t\tconst vscodePortable = env['VSCODE_PORTABLE'];\n\t\tif (vscodePortable) {\n\t\t\treturn URI.file(join(vscodePortable, 'argv.json'));\n\t\t}\n\n\t\treturn joinPath(this.appSettingsHome, 'argv.json');\n\t}\n\n\t@memoize\n\tget isExtensionDevelopment(): boolean { return !!this.args.extensionDevelopmentPath; }\n\n\t@memoize\n\tget untitledWorkspacesHome(): URI { return URI.file(join(this.userDataPath, 'Workspaces')); }\n\n\t@memoize\n\tget builtinExtensionsPath(): string {\n\t\tconst cliBuiltinExtensionsDir = this.args['builtin-extensions-dir'];\n\t\tif (cliBuiltinExtensionsDir) {\n\t\t\treturn resolve(cliBuiltinExtensionsDir);\n\t\t}\n\n\t\treturn normalize(join(FileAccess.asFileUri('').fsPath, '..', 'extensions'));\n\t}\n\n\tget extensionsDownloadLocation(): URI {\n\t\tconst cliExtensionsDownloadDir = this.args['extensions-download-dir'];\n\t\tif (cliExtensionsDownloadDir) {\n\t\t\treturn URI.file(resolve(cliExtensionsDownloadDir));\n\t\t}\n\n\t\treturn URI.file(join(this.userDataPath, 'CachedExtensionVSIXs'));\n\t}\n\n\t@memoize\n\tget extensionsPath(): string {\n\t\tconst cliExtensionsDir = this.args['extensions-dir'];\n\t\tif (cliExtensionsDir) {\n\t\t\treturn resolve(cliExtensionsDir);\n\t\t}\n\n\t\tconst vscodeExtensions = env['VSCODE_EXTENSIONS'];\n\t\tif (vscodeExtensions) {\n\t\t\treturn vscodeExtensions;\n\t\t}\n\n\t\tconst vscodePortable = env['VSCODE_PORTABLE'];\n\t\tif (vscodePortable) {\n\t\t\treturn join(vscodePortable, 'extensions');\n\t\t}\n\n\t\treturn joinPath(this.userHome, this.productService.dataFolderName, 'extensions').fsPath;\n\t}\n\n\t@memoize\n\tget extensionDevelopmentLocationURI(): URI[] | undefined {\n\t\tconst extensionDevelopmentPaths = this.args.extensionDevelopmentPath;\n\t\tif (Array.isArray(extensionDevelopmentPaths)) {\n\t\t\treturn extensionDevelopmentPaths.map(extensionDevelopmentPath => {\n\t\t\t\tif (/^[^:/?#]+?:\\/\\//.test(extensionDevelopmentPath)) {\n\t\t\t\t\treturn URI.parse(extensionDevelopmentPath);\n\t\t\t\t}\n\n\t\t\t\treturn URI.file(normalize(extensionDevelopmentPath));\n\t\t\t});\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t@memoize\n\tget extensionDevelopmentKind(): ExtensionKind[] | undefined {\n\t\treturn this.args.extensionDevelopmentKind?.map(kind => kind === 'ui' || kind === 'workspace' || kind === 'web' ? kind : 'workspace');\n\t}\n\n\t@memoize\n\tget extensionTestsLocationURI(): URI | undefined {\n\t\tconst extensionTestsPath = this.args.extensionTestsPath;\n\t\tif (extensionTestsPath) {\n\t\t\tif (/^[^:/?#]+?:\\/\\//.test(extensionTestsPath)) {\n\t\t\t\treturn URI.parse(extensionTestsPath);\n\t\t\t}\n\n\t\t\treturn URI.file(normalize(extensionTestsPath));\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tget disableExtensions(): boolean | string[] {\n\t\tif (this.args['disable-extensions']) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst disableExtensions = this.args['disable-extension'];\n\t\tif (disableExtensions) {\n\t\t\tif (typeof disableExtensions === 'string') {\n\t\t\t\treturn [disableExtensions];\n\t\t\t}\n\n\t\t\tif (Array.isArray(disableExtensions) && disableExtensions.length > 0) {\n\t\t\t\treturn disableExtensions;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t@memoize\n\tget debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostDebugPort(this.args, this.isBuilt); }\n\tget debugRenderer(): boolean { return !!this.args.debugRenderer; }\n\n\tget isBuilt(): boolean { return !env['VSCODE_DEV']; }\n\tget verbose(): boolean { return !!this.args.verbose; }\n\n\t@memoize\n\tget logLevel(): string | undefined { return this.args.log?.find(entry => !EXTENSION_IDENTIFIER_WITH_LOG_REGEX.test(entry)); }\n\t@memoize\n\tget extensionLogLevel(): [string, string][] | undefined {\n\t\tconst result: [string, string][] = [];\n\t\tfor (const entry of this.args.log || []) {\n\t\t\tconst matches = EXTENSION_IDENTIFIER_WITH_LOG_REGEX.exec(entry);\n\t\t\tif (matches && matches[1] && matches[2]) {\n\t\t\t\tresult.push([matches[1], matches[2]]);\n\t\t\t}\n\t\t}\n\t\treturn result.length ? result : undefined;\n\t}\n\n\t@memoize\n\tget serviceMachineIdResource(): URI { return joinPath(URI.file(this.userDataPath), 'machineid'); }\n\n\tget crashReporterId(): string | undefined { return this.args['crash-reporter-id']; }\n\tget crashReporterDirectory(): string | undefined { return this.args['crash-reporter-directory']; }\n\n\t@memoize\n\tget disableTelemetry(): boolean { return !!this.args['disable-telemetry']; }\n\n\t@memoize\n\tget disableWorkspaceTrust(): boolean { return !!this.args['disable-workspace-trust']; }\n\n\t@memoize\n\tget useInMemorySecretStorage(): boolean { return !!this.args['use-inmemory-secretstorage']; }\n\n\t@memoize\n\tget policyFile(): URI | undefined {\n\t\tif (this.args['__enable-file-policy']) {\n\t\t\tconst vscodePortable = env['VSCODE_PORTABLE'];\n\t\t\tif (vscodePortable) {\n\t\t\t\treturn URI.file(join(vscodePortable, 'policy.json'));\n\t\t\t}\n\n\t\t\treturn joinPath(this.userHome, this.productService.dataFolderName, 'policy.json');\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tget editSessionId(): string | undefined { return this.args['editSessionId']; }\n\n\tget continueOn(): string | undefined {\n\t\treturn this.args['continueOn'];\n\t}\n\n\tset continueOn(value: string | undefined) {\n\t\tthis.args['continueOn'] = value;\n\t}\n\n\tget args(): NativeParsedArgs { return this._args; }\n\n\tconstructor(\n\t\tprivate readonly _args: NativeParsedArgs,\n\t\tprivate readonly paths: INativeEnvironmentPaths,\n\t\tprotected readonly productService: IProductService\n\t) { }\n}\n\nexport function parseExtensionHostDebugPort(args: NativeParsedArgs, isBuilt: boolean): IExtensionHostDebugParams {\n\treturn parseDebugParams(args['inspect-extensions'], args['inspect-brk-extensions'], 5870, isBuilt, args.debugId, args.extensionEnvironment);\n}\n\nexport function parseDebugParams(debugArg: string | undefined, debugBrkArg: string | undefined, defaultBuildPort: number, isBuilt: boolean, debugId?: string, environmentString?: string): IExtensionHostDebugParams {\n\tconst portStr = debugBrkArg || debugArg;\n\tconst port = Number(portStr) || (!isBuilt ? defaultBuildPort : null);\n\tconst brk = port ? Boolean(!!debugBrkArg) : false;\n\tlet env: Record<string, string> | undefined;\n\tif (environmentString) {\n\t\ttry {\n\t\t\tenv = JSON.parse(environmentString);\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t}\n\n\treturn { port, break: brk, debugId, env };\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { homedir } from 'os';\nimport { NativeParsedArgs } from '../common/argv.js';\n\n// This file used to be a pure JS file and was always\n// importing `path` from node.js even though we ship\n// our own version of the library and prefer to use\n// that.\n// However, resolution of user-data-path is critical\n// and while our version of `path` is a copy of node.js\n// one, you never know. As such, preserve the use of\n// the built-in `path` lib for the time being.\n// eslint-disable-next-line local/code-import-patterns\nimport { resolve, isAbsolute, join } from 'path';\n\nconst cwd = process.env['VSCODE_CWD'] || process.cwd();\n\n/**\n * Returns the user data path to use with some rules:\n * - respect portable mode\n * - respect VSCODE_APPDATA environment variable\n * - respect --user-data-dir CLI argument\n */\nexport function getUserDataPath(cliArgs: NativeParsedArgs, productName: string): string {\n\tconst userDataPath = doGetUserDataPath(cliArgs, productName);\n\tconst pathsToResolve = [userDataPath];\n\n\t// If the user-data-path is not absolute, make\n\t// sure to resolve it against the passed in\n\t// current working directory. We cannot use the\n\t// node.js `path.resolve()` logic because it will\n\t// not pick up our `VSCODE_CWD` environment variable\n\t// (https://github.com/microsoft/vscode/issues/120269)\n\tif (!isAbsolute(userDataPath)) {\n\t\tpathsToResolve.unshift(cwd);\n\t}\n\n\treturn resolve(...pathsToResolve);\n}\n\nfunction doGetUserDataPath(cliArgs: NativeParsedArgs, productName: string): string {\n\n\t// 0. Running out of sources has a fixed productName\n\tif (process.env['VSCODE_DEV']) {\n\t\tproductName = 'code-oss-dev';\n\t}\n\n\t// 1. Support portable mode\n\tconst portablePath = process.env['VSCODE_PORTABLE'];\n\tif (portablePath) {\n\t\treturn join(portablePath, 'user-data');\n\t}\n\n\t// 2. Support global VSCODE_APPDATA environment variable\n\tlet appDataPath = process.env['VSCODE_APPDATA'];\n\tif (appDataPath) {\n\t\treturn join(appDataPath, productName);\n\t}\n\n\t// With Electron>=13 --user-data-dir switch will be propagated to\n\t// all processes https://github.com/electron/electron/blob/1897b14af36a02e9aa7e4d814159303441548251/shell/browser/electron_browser_client.cc#L546-L553\n\t// Check VSCODE_PORTABLE and VSCODE_APPDATA before this case to get correct values.\n\t// 3. Support explicit --user-data-dir\n\tconst cliPath = cliArgs['user-data-dir'];\n\tif (cliPath) {\n\t\treturn cliPath;\n\t}\n\n\t// 4. Otherwise check per platform\n\tswitch (process.platform) {\n\t\tcase 'win32':\n\t\t\tappDataPath = process.env['APPDATA'];\n\t\t\tif (!appDataPath) {\n\t\t\t\tconst userProfile = process.env['USERPROFILE'];\n\t\t\t\tif (typeof userProfile !== 'string') {\n\t\t\t\t\tthrow new Error('Windows: Unexpected undefined %USERPROFILE% environment variable');\n\t\t\t\t}\n\n\t\t\t\tappDataPath = join(userProfile, 'AppData', 'Roaming');\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'darwin':\n\t\t\tappDataPath = join(homedir(), 'Library', 'Application Support');\n\t\t\tbreak;\n\t\tcase 'linux':\n\t\t\tappDataPath = process.env['XDG_CONFIG_HOME'] || join(homedir(), '.config');\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error('Platform not supported');\n\t}\n\n\treturn join(appDataPath, productName);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { homedir, tmpdir } from 'os';\nimport { NativeParsedArgs } from '../common/argv.js';\nimport { IDebugParams } from '../common/environment.js';\nimport { AbstractNativeEnvironmentService, parseDebugParams } from '../common/environmentService.js';\nimport { getUserDataPath } from './userDataPath.js';\nimport { IProductService } from '../../product/common/productService.js';\n\nexport class NativeEnvironmentService extends AbstractNativeEnvironmentService {\n\n\tconstructor(args: NativeParsedArgs, productService: IProductService) {\n\t\tsuper(args, {\n\t\t\thomeDir: homedir(),\n\t\t\ttmpDir: tmpdir(),\n\t\t\tuserDataDir: getUserDataPath(args, productService.nameShort)\n\t\t}, productService);\n\t}\n}\n\nexport function parsePtyHostDebugPort(args: NativeParsedArgs, isBuilt: boolean): IDebugParams {\n\treturn parseDebugParams(args['inspect-ptyhost'], args['inspect-brk-ptyhost'], 5877, isBuilt, args.extensionEnvironment);\n}\n\nexport function parseSharedProcessDebugPort(args: NativeParsedArgs, isBuilt: boolean): IDebugParams {\n\treturn parseDebugParams(args['inspect-sharedprocess'], args['inspect-brk-sharedprocess'], 5879, isBuilt, args.extensionEnvironment);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as nls from '../../nls.js';\n\nimport { NativeEnvironmentService } from '../../platform/environment/node/environmentService.js';\nimport { OPTIONS, OptionDescriptions } from '../../platform/environment/node/argv.js';\nimport { refineServiceDecorator } from '../../platform/instantiation/common/instantiation.js';\nimport { IEnvironmentService, INativeEnvironmentService } from '../../platform/environment/common/environment.js';\nimport { memoize } from '../../base/common/decorators.js';\nimport { URI } from '../../base/common/uri.js';\nimport { joinPath } from '../../base/common/resources.js';\nimport { join } from '../../base/common/path.js';\n\nexport const serverOptions: OptionDescriptions<Required<ServerParsedArgs>> = {\n\t/* ----- code-server ----- */\n\t'disable-update-check': { type: 'boolean' },\n\t'auth': { type: 'string' },\n\t'disable-file-downloads': { type: 'boolean' },\n\t'disable-file-uploads': { type: 'boolean' },\n\t'disable-getting-started-override': { type: 'boolean' },\n\t'locale': { type: 'string' },\n\t'link-protection-trusted-domains': { type: 'string[]' },\n\n\t/* ----- server setup ----- */\n\n\t'host': { type: 'string', cat: 'o', args: 'ip-address', description: nls.localize('host', \"The host name or IP address the server should listen to. If not set, defaults to 'localhost'.\") },\n\t'port': { type: 'string', cat: 'o', args: 'port | port range', description: nls.localize('port', \"The port the server should listen to. If 0 is passed a random free port is picked. If a range in the format num-num is passed, a free port from the range (end inclusive) is selected.\") },\n\t'socket-path': { type: 'string', cat: 'o', args: 'path', description: nls.localize('socket-path', \"The path to a socket file for the server to listen to.\") },\n\t'server-base-path': { type: 'string', cat: 'o', args: 'path', description: nls.localize('server-base-path', \"The path under which the web UI and the code server is provided. Defaults to '/'.`\") },\n\t'connection-token': { type: 'string', cat: 'o', args: 'token', deprecates: ['connectionToken'], description: nls.localize('connection-token', \"A secret that must be included with all requests.\") },\n\t'connection-token-file': { type: 'string', cat: 'o', args: 'path', deprecates: ['connection-secret', 'connectionTokenFile'], description: nls.localize('connection-token-file', \"Path to a file that contains the connection token.\") },\n\t'without-connection-token': { type: 'boolean', cat: 'o', description: nls.localize('without-connection-token', \"Run without a connection token. Only use this if the connection is secured by other means.\") },\n\t'disable-websocket-compression': { type: 'boolean' },\n\t'print-startup-performance': { type: 'boolean' },\n\t'print-ip-address': { type: 'boolean' },\n\t'accept-server-license-terms': { type: 'boolean', cat: 'o', description: nls.localize('acceptLicenseTerms', \"If set, the user accepts the server license terms and the server will be started without a user prompt.\") },\n\t'server-data-dir': { type: 'string', cat: 'o', description: nls.localize('serverDataDir', \"Specifies the directory that server data is kept in.\") },\n\t'telemetry-level': { type: 'string', cat: 'o', args: 'level', description: nls.localize('telemetry-level', \"Sets the initial telemetry level. Valid levels are: 'off', 'crash', 'error' and 'all'. If not specified, the server will send telemetry until a client connects, it will then use the clients telemetry setting. Setting this to 'off' is equivalent to --disable-telemetry\") },\n\n\t/* ----- vs code options ---\t-- */\n\n\t'user-data-dir': OPTIONS['user-data-dir'],\n\t'enable-smoke-test-driver': OPTIONS['enable-smoke-test-driver'],\n\t'disable-telemetry': OPTIONS['disable-telemetry'],\n\t'disable-workspace-trust': OPTIONS['disable-workspace-trust'],\n\t'file-watcher-polling': { type: 'string', deprecates: ['fileWatcherPolling'] },\n\t'log': OPTIONS['log'],\n\t'logsPath': OPTIONS['logsPath'],\n\t'force-disable-user-env': OPTIONS['force-disable-user-env'],\n\t'enable-proposed-api': OPTIONS['enable-proposed-api'],\n\n\t/* ----- vs code web options ----- */\n\n\t'folder': { type: 'string', deprecationMessage: 'No longer supported. Folder needs to be provided in the browser URL or with `default-folder`.' },\n\t'workspace': { type: 'string', deprecationMessage: 'No longer supported. Workspace needs to be provided in the browser URL or with `default-workspace`.' },\n\n\t'default-folder': { type: 'string', description: nls.localize('default-folder', 'The workspace folder to open when no input is specified in the browser URL. A relative or absolute path resolved against the current working directory.') },\n\t'default-workspace': { type: 'string', description: nls.localize('default-workspace', 'The workspace to open when no input is specified in the browser URL. A relative or absolute path resolved against the current working directory.') },\n\n\t'enable-sync': { type: 'boolean' },\n\t'github-auth': { type: 'string' },\n\t'use-test-resolver': { type: 'boolean' },\n\n\t/* ----- extension management ----- */\n\n\t'extensions-dir': OPTIONS['extensions-dir'],\n\t'extensions-download-dir': OPTIONS['extensions-download-dir'],\n\t'builtin-extensions-dir': OPTIONS['builtin-extensions-dir'],\n\t'install-extension': OPTIONS['install-extension'],\n\t'install-builtin-extension': OPTIONS['install-builtin-extension'],\n\t'update-extensions': OPTIONS['update-extensions'],\n\t'uninstall-extension': OPTIONS['uninstall-extension'],\n\t'list-extensions': OPTIONS['list-extensions'],\n\t'locate-extension': OPTIONS['locate-extension'],\n\n\t'show-versions': OPTIONS['show-versions'],\n\t'category': OPTIONS['category'],\n\t'force': OPTIONS['force'],\n\t'do-not-sync': OPTIONS['do-not-sync'],\n\t'do-not-include-pack-dependencies': OPTIONS['do-not-include-pack-dependencies'],\n\t'pre-release': OPTIONS['pre-release'],\n\t'start-server': { type: 'boolean', cat: 'e', description: nls.localize('start-server', \"Start the server when installing or uninstalling extensions. To be used in combination with 'install-extension', 'install-builtin-extension' and 'uninstall-extension'.\") },\n\n\n\t/* ----- remote development options ----- */\n\n\t'enable-remote-auto-shutdown': { type: 'boolean' },\n\t'remote-auto-shutdown-without-delay': { type: 'boolean' },\n\n\t'use-host-proxy': { type: 'boolean' },\n\t'without-browser-env-var': { type: 'boolean' },\n\n\t/* ----- server cli ----- */\n\n\t'help': OPTIONS['help'],\n\t'version': OPTIONS['version'],\n\t'locate-shell-integration-path': OPTIONS['locate-shell-integration-path'],\n\n\t'compatibility': { type: 'string' },\n\n\t_: OPTIONS['_']\n};\n\nexport interface ServerParsedArgs {\n\t/* ----- code-server ----- */\n\t'disable-update-check'?: boolean;\n\t'auth'?: string;\n\t'disable-file-downloads'?: boolean;\n\t'disable-file-uploads'?: boolean;\n\t'disable-getting-started-override'?: boolean,\n\t'locale'?: string\n\t'link-protection-trusted-domains'?: string[],\n\n\t/* ----- server setup ----- */\n\n\thost?: string;\n\t/**\n\t * A port or a port range\n\t */\n\tport?: string;\n\t'socket-path'?: string;\n\n\t/**\n\t * The path under which the web UI and the code server is provided.\n\t * By defaults it is '/'.`\n\t */\n\t'server-base-path'?: string;\n\n\t/**\n\t * A secret token that must be provided by the web client with all requests.\n\t * Use only `[0-9A-Za-z\\-]`.\n\t *\n\t * By default, a UUID will be generated every time the server starts up.\n\t *\n\t * If the server is running on a multi-user system, then consider\n\t * using `--connection-token-file` which has the advantage that the token cannot\n\t * be seen by other users using `ps` or similar commands.\n\t */\n\t'connection-token'?: string;\n\t/**\n\t * A path to a filename which will be read on startup.\n\t * Consider placing this file in a folder readable only by the same user (a `chmod 0700` directory).\n\t *\n\t * The contents of the file will be used as the connection token. Use only `[0-9A-Z\\-]` as contents in the file.\n\t * The file can optionally end in a `\\n` which will be ignored.\n\t *\n\t * This secret must be communicated to any vscode instance via the resolver or embedder API.\n\t */\n\t'connection-token-file'?: string;\n\n\t/**\n\t * Run the server without a connection token\n\t */\n\t'without-connection-token'?: boolean;\n\n\t'disable-websocket-compression'?: boolean;\n\n\t'print-startup-performance'?: boolean;\n\t'print-ip-address'?: boolean;\n\n\t'accept-server-license-terms': boolean;\n\n\t'server-data-dir'?: string;\n\n\t'telemetry-level'?: string;\n\n\t'disable-workspace-trust'?: boolean;\n\n\t/* ----- vs code options ----- */\n\n\t'user-data-dir'?: string;\n\n\t'enable-smoke-test-driver'?: boolean;\n\n\t'disable-telemetry'?: boolean;\n\t'file-watcher-polling'?: string;\n\n\t'log'?: string[];\n\t'logsPath'?: string;\n\n\t'force-disable-user-env'?: boolean;\n\t'enable-proposed-api'?: string[];\n\n\t/* ----- vs code web options ----- */\n\n\t'default-workspace'?: string;\n\t'default-folder'?: string;\n\n\t/** @deprecated use default-workspace instead */\n\tworkspace: string;\n\t/** @deprecated use default-folder instead */\n\tfolder: string;\n\n\n\t'enable-sync'?: boolean;\n\t'github-auth'?: string;\n\t'use-test-resolver'?: boolean;\n\n\t/* ----- extension management ----- */\n\n\t'extensions-dir'?: string;\n\t'extensions-download-dir'?: string;\n\t'builtin-extensions-dir'?: string;\n\t'install-extension'?: string[];\n\t'install-builtin-extension'?: string[];\n\t'update-extensions'?: boolean;\n\t'uninstall-extension'?: string[];\n\t'list-extensions'?: boolean;\n\t'locate-extension'?: string[];\n\t'show-versions'?: boolean;\n\t'category'?: string;\n\tforce?: boolean; // used by install-extension\n\t'do-not-sync'?: boolean; // used by install-extension\n\t'pre-release'?: boolean; // used by install-extension\n\t'do-not-include-pack-dependencies'?: boolean; // used by install-extension\n\n\n\t'start-server'?: boolean;\n\n\t/* ----- remote development options ----- */\n\n\t'enable-remote-auto-shutdown'?: boolean;\n\t'remote-auto-shutdown-without-delay'?: boolean;\n\n\t'use-host-proxy'?: boolean;\n\t'without-browser-env-var'?: boolean;\n\n\t/* ----- server cli ----- */\n\thelp: boolean;\n\tversion: boolean;\n\t'locate-shell-integration-path'?: string;\n\n\tcompatibility: string;\n\n\t_: string[];\n}\n\nexport const IServerEnvironmentService = refineServiceDecorator<IEnvironmentService, IServerEnvironmentService>(IEnvironmentService);\n\nexport interface IServerEnvironmentService extends INativeEnvironmentService {\n\treadonly machineSettingsResource: URI;\n\treadonly mcpResource: URI;\n\treadonly args: ServerParsedArgs;\n}\n\nexport class ServerEnvironmentService extends NativeEnvironmentService implements IServerEnvironmentService {\n\t@memoize\n\toverride get userRoamingDataHome(): URI { return this.appSettingsHome; }\n\t@memoize\n\tget machineSettingsResource(): URI { return joinPath(URI.file(join(this.userDataPath, 'Machine')), 'settings.json'); }\n\t@memoize\n\tget mcpResource(): URI { return joinPath(URI.file(join(this.userDataPath, 'User')), 'mcp.json'); }\n\toverride get args(): ServerParsedArgs { return super.args as ServerParsedArgs; }\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { getErrorMessage, isCancellationError } from '../../../base/common/errors.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { basename } from '../../../base/common/resources.js';\nimport { gt } from '../../../base/common/semver/semver.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { EXTENSION_IDENTIFIER_REGEX, IExtensionGalleryService, IExtensionInfo, IExtensionManagementService, IGalleryExtension, ILocalExtension, InstallOptions, InstallExtensionInfo, InstallOperation } from './extensionManagement.js';\nimport { areSameExtensions, getExtensionId, getGalleryExtensionId, getIdAndVersion } from './extensionManagementUtil.js';\nimport { ExtensionType, EXTENSION_CATEGORIES, IExtensionManifest } from '../../extensions/common/extensions.js';\nimport { ILogger } from '../../log/common/log.js';\n\n\nconst notFound = (id: string) => localize('notFound', \"Extension '{0}' not found.\", id);\nconst useId = localize('useId', \"Make sure you use the full extension ID, including the publisher, e.g.: {0}\", 'ms-dotnettools.csharp');\n\ntype InstallVSIXInfo = { vsix: URI; installOptions: InstallOptions };\ntype InstallGalleryExtensionInfo = { id: string; version?: string; installOptions: InstallOptions };\n\nexport class ExtensionManagementCLI {\n\n\tconstructor(\n\t\tprotected readonly logger: ILogger,\n\t\t@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,\n\t\t@IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService,\n\t) { }\n\n\tprotected get location(): string | undefined {\n\t\treturn undefined;\n\t}\n\n\tpublic async listExtensions(showVersions: boolean, category?: string, profileLocation?: URI): Promise<void> {\n\t\tlet extensions = await this.extensionManagementService.getInstalled(ExtensionType.User, profileLocation);\n\t\tconst categories = EXTENSION_CATEGORIES.map(c => c.toLowerCase());\n\t\tif (category && category !== '') {\n\t\t\tif (categories.indexOf(category.toLowerCase()) < 0) {\n\t\t\t\tthis.logger.info('Invalid category please enter a valid category. To list valid categories run --category without a category specified');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\textensions = extensions.filter(e => {\n\t\t\t\tif (e.manifest.categories) {\n\t\t\t\t\tconst lowerCaseCategories: string[] = e.manifest.categories.map(c => c.toLowerCase());\n\t\t\t\t\treturn lowerCaseCategories.indexOf(category.toLowerCase()) > -1;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});\n\t\t} else if (category === '') {\n\t\t\tthis.logger.info('Possible Categories: ');\n\t\t\tcategories.forEach(category => {\n\t\t\t\tthis.logger.info(category);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (this.location) {\n\t\t\tthis.logger.info(localize('listFromLocation', \"Extensions installed on {0}:\", this.location));\n\t\t}\n\n\t\textensions = extensions.sort((e1, e2) => e1.identifier.id.localeCompare(e2.identifier.id));\n\t\tlet lastId: string | undefined = undefined;\n\t\tfor (const extension of extensions) {\n\t\t\tif (lastId !== extension.identifier.id) {\n\t\t\t\tlastId = extension.identifier.id;\n\t\t\t\tthis.logger.info(showVersions ? `${lastId}@${extension.manifest.version}` : lastId);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async installExtensions(extensions: (string | URI)[], builtinExtensions: (string | URI)[], installOptions: InstallOptions, force: boolean): Promise<void> {\n\t\tconst failed: string[] = [];\n\n\t\ttry {\n\t\t\tif (extensions.length) {\n\t\t\t\tthis.logger.info(this.location ? localize('installingExtensionsOnLocation', \"Installing extensions on {0}...\", this.location) : localize('installingExtensions', \"Installing extensions...\"));\n\t\t\t}\n\n\t\t\tconst installVSIXInfos: InstallVSIXInfo[] = [];\n\t\t\tconst installExtensionInfos: InstallGalleryExtensionInfo[] = [];\n\t\t\tconst addInstallExtensionInfo = (id: string, version: string | undefined, isBuiltin: boolean) => {\n\t\t\t\tinstallExtensionInfos.push({ id, version: version !== 'prerelease' ? version : undefined, installOptions: { ...installOptions, isBuiltin, installPreReleaseVersion: version === 'prerelease' || installOptions.installPreReleaseVersion } });\n\t\t\t};\n\t\t\tfor (const extension of extensions) {\n\t\t\t\tif (extension instanceof URI) {\n\t\t\t\t\tinstallVSIXInfos.push({ vsix: extension, installOptions });\n\t\t\t\t} else {\n\t\t\t\t\tconst [id, version] = getIdAndVersion(extension);\n\t\t\t\t\taddInstallExtensionInfo(id, version, false);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const extension of builtinExtensions) {\n\t\t\t\tif (extension instanceof URI) {\n\t\t\t\t\tinstallVSIXInfos.push({ vsix: extension, installOptions: { ...installOptions, isBuiltin: true, donotIncludePackAndDependencies: true } });\n\t\t\t\t} else {\n\t\t\t\t\tconst [id, version] = getIdAndVersion(extension);\n\t\t\t\t\taddInstallExtensionInfo(id, version, true);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst installed = await this.extensionManagementService.getInstalled(undefined, installOptions.profileLocation);\n\n\t\t\tif (installVSIXInfos.length) {\n\t\t\t\tawait Promise.all(installVSIXInfos.map(async ({ vsix, installOptions }) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.installVSIX(vsix, installOptions, force, installed);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tthis.logger.error(err);\n\t\t\t\t\t\tfailed.push(vsix.toString());\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t}\n\n\t\t\tif (installExtensionInfos.length) {\n\t\t\t\tconst failedGalleryExtensions = await this.installGalleryExtensions(installExtensionInfos, installed, force);\n\t\t\t\tfailed.push(...failedGalleryExtensions);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logger.error(localize('error while installing extensions', \"Error while installing extensions: {0}\", getErrorMessage(error)));\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (failed.length) {\n\t\t\tthrow new Error(localize('installation failed', \"Failed Installing Extensions: {0}\", failed.join(', ')));\n\t\t}\n\t}\n\n\tpublic async updateExtensions(profileLocation?: URI): Promise<void> {\n\t\tconst installedExtensions = await this.extensionManagementService.getInstalled(ExtensionType.User, profileLocation);\n\n\t\tconst installedExtensionsQuery: IExtensionInfo[] = [];\n\t\tfor (const extension of installedExtensions) {\n\t\t\tif (!!extension.identifier.uuid) { // No need to check new version for an unpublished extension\n\t\t\t\tinstalledExtensionsQuery.push({ ...extension.identifier, preRelease: extension.preRelease });\n\t\t\t}\n\t\t}\n\n\t\tthis.logger.trace(localize({ key: 'updateExtensionsQuery', comment: ['Placeholder is for the count of extensions'] }, \"Fetching latest versions for {0} extensions\", installedExtensionsQuery.length));\n\t\tconst availableVersions = await this.extensionGalleryService.getExtensions(installedExtensionsQuery, { compatible: true }, CancellationToken.None);\n\n\t\tconst extensionsToUpdate: InstallExtensionInfo[] = [];\n\t\tfor (const newVersion of availableVersions) {\n\t\t\tfor (const oldVersion of installedExtensions) {\n\t\t\t\tif (areSameExtensions(oldVersion.identifier, newVersion.identifier) && gt(newVersion.version, oldVersion.manifest.version)) {\n\t\t\t\t\textensionsToUpdate.push({\n\t\t\t\t\t\textension: newVersion,\n\t\t\t\t\t\toptions: { operation: InstallOperation.Update, installPreReleaseVersion: oldVersion.preRelease, profileLocation, isApplicationScoped: oldVersion.isApplicationScoped }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!extensionsToUpdate.length) {\n\t\t\tthis.logger.info(localize('updateExtensionsNoExtensions', \"No extension to update\"));\n\t\t\treturn;\n\t\t}\n\n\t\tthis.logger.info(localize('updateExtensionsNewVersionsAvailable', \"Updating extensions: {0}\", extensionsToUpdate.map(ext => ext.extension.identifier.id).join(', ')));\n\t\tconst installationResult = await this.extensionManagementService.installGalleryExtensions(extensionsToUpdate);\n\n\t\tfor (const extensionResult of installationResult) {\n\t\t\tif (extensionResult.error) {\n\t\t\t\tthis.logger.error(localize('errorUpdatingExtension', \"Error while updating extension {0}: {1}\", extensionResult.identifier.id, getErrorMessage(extensionResult.error)));\n\t\t\t} else {\n\t\t\t\tthis.logger.info(localize('successUpdate', \"Extension '{0}' v{1} was successfully updated.\", extensionResult.identifier.id, extensionResult.local?.manifest.version));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async installGalleryExtensions(installExtensionInfos: InstallGalleryExtensionInfo[], installed: ILocalExtension[], force: boolean): Promise<string[]> {\n\t\tinstallExtensionInfos = installExtensionInfos.filter(installExtensionInfo => {\n\t\t\tconst { id, version, installOptions } = installExtensionInfo;\n\t\t\tconst installedExtension = installed.find(i => areSameExtensions(i.identifier, { id }));\n\t\t\tif (installedExtension) {\n\t\t\t\tif (!force && (!version || (version === 'prerelease' && installedExtension.preRelease))) {\n\t\t\t\t\tthis.logger.info(localize('alreadyInstalled-checkAndUpdate', \"Extension '{0}' v{1} is already installed. Use '--force' option to update to latest version or provide '@<version>' to install a specific version, for example: '{2}@1.2.3'.\", id, installedExtension.manifest.version, id));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (version && installedExtension.manifest.version === version) {\n\t\t\t\t\tthis.logger.info(localize('alreadyInstalled', \"Extension '{0}' is already installed.\", `${id}@${version}`));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (installedExtension.preRelease && version !== 'prerelease') {\n\t\t\t\t\tinstallOptions.preRelease = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\n\t\tif (!installExtensionInfos.length) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst failed: string[] = [];\n\t\tconst extensionsToInstall: InstallExtensionInfo[] = [];\n\t\tconst galleryExtensions = await this.getGalleryExtensions(installExtensionInfos);\n\t\tawait Promise.all(installExtensionInfos.map(async ({ id, version, installOptions }) => {\n\t\t\tconst gallery = galleryExtensions.get(id.toLowerCase());\n\t\t\tif (!gallery) {\n\t\t\t\tthis.logger.error(`${notFound(version ? `${id}@${version}` : id)}\\n${useId}`);\n\t\t\t\tfailed.push(id);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst manifest = await this.extensionGalleryService.getManifest(gallery, CancellationToken.None);\n\t\t\t\tif (manifest && !this.validateExtensionKind(manifest)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tthis.logger.error(err.message || err.stack || err);\n\t\t\t\tfailed.push(id);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst installedExtension = installed.find(e => areSameExtensions(e.identifier, gallery.identifier));\n\t\t\tif (installedExtension) {\n\t\t\t\tif (gallery.version === installedExtension.manifest.version) {\n\t\t\t\t\tthis.logger.info(localize('alreadyInstalled', \"Extension '{0}' is already installed.\", version ? `${id}@${version}` : id));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.logger.info(localize('updateMessage', \"Updating the extension '{0}' to the version {1}\", id, gallery.version));\n\t\t\t}\n\t\t\tif (installOptions.isBuiltin) {\n\t\t\t\tthis.logger.info(version ? localize('installing builtin with version', \"Installing builtin extension '{0}' v{1}...\", id, version) : localize('installing builtin ', \"Installing builtin extension '{0}'...\", id));\n\t\t\t} else {\n\t\t\t\tthis.logger.info(version ? localize('installing with version', \"Installing extension '{0}' v{1}...\", id, version) : localize('installing', \"Installing extension '{0}'...\", id));\n\t\t\t}\n\t\t\textensionsToInstall.push({\n\t\t\t\textension: gallery,\n\t\t\t\toptions: { ...installOptions, installGivenVersion: !!version, isApplicationScoped: installOptions.isApplicationScoped || installedExtension?.isApplicationScoped },\n\t\t\t});\n\t\t}));\n\n\t\tif (extensionsToInstall.length) {\n\t\t\tconst installationResult = await this.extensionManagementService.installGalleryExtensions(extensionsToInstall);\n\t\t\tfor (const extensionResult of installationResult) {\n\t\t\t\tif (extensionResult.error) {\n\t\t\t\t\tthis.logger.error(localize('errorInstallingExtension', \"Error while installing extension {0}: {1}\", extensionResult.identifier.id, getErrorMessage(extensionResult.error)));\n\t\t\t\t\tfailed.push(extensionResult.identifier.id);\n\t\t\t\t} else {\n\t\t\t\t\tthis.logger.info(localize('successInstall', \"Extension '{0}' v{1} was successfully installed.\", extensionResult.identifier.id, extensionResult.local?.manifest.version));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn failed;\n\t}\n\n\tprivate async installVSIX(vsix: URI, installOptions: InstallOptions, force: boolean, installedExtensions: ILocalExtension[]): Promise<void> {\n\n\t\tconst manifest = await this.extensionManagementService.getManifest(vsix);\n\t\tif (!manifest) {\n\t\t\tthrow new Error('Invalid vsix');\n\t\t}\n\n\t\tconst valid = await this.validateVSIX(manifest, force, installOptions.profileLocation, installedExtensions);\n\t\tif (valid) {\n\t\t\ttry {\n\t\t\t\tawait this.extensionManagementService.install(vsix, { ...installOptions, installGivenVersion: true });\n\t\t\t\tthis.logger.info(localize('successVsixInstall', \"Extension '{0}' was successfully installed.\", basename(vsix)));\n\t\t\t} catch (error) {\n\t\t\t\tif (isCancellationError(error)) {\n\t\t\t\t\tthis.logger.info(localize('cancelVsixInstall', \"Cancelled installing extension '{0}'.\", basename(vsix)));\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async getGalleryExtensions(extensions: InstallGalleryExtensionInfo[]): Promise<Map<string, IGalleryExtension>> {\n\t\tconst galleryExtensions = new Map<string, IGalleryExtension>();\n\t\tconst preRelease = extensions.some(e => e.installOptions.installPreReleaseVersion);\n\t\tconst targetPlatform = await this.extensionManagementService.getTargetPlatform();\n\t\tconst extensionInfos: IExtensionInfo[] = [];\n\t\tfor (const extension of extensions) {\n\t\t\tif (EXTENSION_IDENTIFIER_REGEX.test(extension.id)) {\n\t\t\t\textensionInfos.push({ ...extension, preRelease });\n\t\t\t}\n\t\t}\n\t\tif (extensionInfos.length) {\n\t\t\tconst result = await this.extensionGalleryService.getExtensions(extensionInfos, { targetPlatform }, CancellationToken.None);\n\t\t\tfor (const extension of result) {\n\t\t\t\tgalleryExtensions.set(extension.identifier.id.toLowerCase(), extension);\n\t\t\t}\n\t\t}\n\t\treturn galleryExtensions;\n\t}\n\n\tprotected validateExtensionKind(_manifest: IExtensionManifest): boolean {\n\t\treturn true;\n\t}\n\n\tprivate async validateVSIX(manifest: IExtensionManifest, force: boolean, profileLocation: URI | undefined, installedExtensions: ILocalExtension[]): Promise<boolean> {\n\t\tif (!force) {\n\t\t\tconst extensionIdentifier = { id: getGalleryExtensionId(manifest.publisher, manifest.name) };\n\t\t\tconst newer = installedExtensions.find(local => areSameExtensions(extensionIdentifier, local.identifier) && gt(local.manifest.version, manifest.version));\n\t\t\tif (newer) {\n\t\t\t\tthis.logger.info(localize('forceDowngrade', \"A newer version of extension '{0}' v{1} is already installed. Use '--force' option to downgrade to older version.\", newer.identifier.id, newer.manifest.version, manifest.version));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn this.validateExtensionKind(manifest);\n\t}\n\n\tpublic async uninstallExtensions(extensions: (string | URI)[], force: boolean, profileLocation?: URI): Promise<void> {\n\t\tconst getId = async (extensionDescription: string | URI): Promise<string> => {\n\t\t\tif (extensionDescription instanceof URI) {\n\t\t\t\tconst manifest = await this.extensionManagementService.getManifest(extensionDescription);\n\t\t\t\treturn getExtensionId(manifest.publisher, manifest.name);\n\t\t\t}\n\t\t\treturn extensionDescription;\n\t\t};\n\n\t\tconst uninstalledExtensions: ILocalExtension[] = [];\n\t\tfor (const extension of extensions) {\n\t\t\tconst id = await getId(extension);\n\t\t\tconst installed = await this.extensionManagementService.getInstalled(undefined, profileLocation);\n\t\t\tconst extensionsToUninstall = installed.filter(e => areSameExtensions(e.identifier, { id }));\n\t\t\tif (!extensionsToUninstall.length) {\n\t\t\t\tthrow new Error(`${this.notInstalled(id)}\\n${useId}`);\n\t\t\t}\n\t\t\tif (extensionsToUninstall.some(e => e.type === ExtensionType.System)) {\n\t\t\t\tthis.logger.info(localize('builtin', \"Extension '{0}' is a Built-in extension and cannot be uninstalled\", id));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!force && extensionsToUninstall.some(e => e.isBuiltin)) {\n\t\t\t\tthis.logger.info(localize('forceUninstall', \"Extension '{0}' is marked as a Built-in extension by user. Please use '--force' option to uninstall it.\", id));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.logger.info(localize('uninstalling', \"Uninstalling {0}...\", id));\n\t\t\tfor (const extensionToUninstall of extensionsToUninstall) {\n\t\t\t\tawait this.extensionManagementService.uninstall(extensionToUninstall, { profileLocation });\n\t\t\t\tuninstalledExtensions.push(extensionToUninstall);\n\t\t\t}\n\n\t\t\tif (this.location) {\n\t\t\t\tthis.logger.info(localize('successUninstallFromLocation', \"Extension '{0}' was successfully uninstalled from {1}!\", id, this.location));\n\t\t\t} else {\n\t\t\t\tthis.logger.info(localize('successUninstall', \"Extension '{0}' was successfully uninstalled!\", id));\n\t\t\t}\n\n\t\t}\n\t}\n\n\tpublic async locateExtension(extensions: string[]): Promise<void> {\n\t\tconst installed = await this.extensionManagementService.getInstalled();\n\t\textensions.forEach(e => {\n\t\t\tinstalled.forEach(i => {\n\t\t\t\tif (i.identifier.id === e) {\n\t\t\t\t\tif (i.location.scheme === Schemas.file) {\n\t\t\t\t\t\tthis.logger.info(i.location.fsPath);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate notInstalled(id: string) {\n\t\treturn this.location ? localize('notInstalleddOnLocation', \"Extension '{0}' is not installed on {1}.\", id, this.location) : localize('notInstalled', \"Extension '{0}' is not installed.\", id);\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationTokenSource } from '../../../base/common/cancellation.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { language } from '../../../base/common/platform.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IQuickPickItem } from '../../quickinput/common/quickInput.js';\nimport { localize } from '../../../nls.js';\nimport { IExtensionGalleryService, IGalleryExtension } from '../../extensionManagement/common/extensionManagement.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport function getLocale(extension: IGalleryExtension): string | undefined {\n\treturn extension.tags.find(t => t.startsWith('lp-'))?.split('lp-')[1];\n}\n\nexport const ILanguagePackService = createDecorator<ILanguagePackService>('languagePackService');\n\nexport interface ILanguagePackItem extends IQuickPickItem {\n\treadonly extensionId?: string;\n\treadonly galleryExtension?: IGalleryExtension;\n}\n\nexport interface ILanguagePackService {\n\treadonly _serviceBrand: undefined;\n\tgetAvailableLanguages(): Promise<Array<ILanguagePackItem>>;\n\tgetInstalledLanguages(): Promise<Array<ILanguagePackItem>>;\n\tgetBuiltInExtensionTranslationsUri(id: string, language: string): Promise<URI | undefined>;\n}\n\nexport abstract class LanguagePackBaseService extends Disposable implements ILanguagePackService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tconstructor(@IExtensionGalleryService protected readonly extensionGalleryService: IExtensionGalleryService) {\n\t\tsuper();\n\t}\n\n\tabstract getBuiltInExtensionTranslationsUri(id: string, language: string): Promise<URI | undefined>;\n\n\tabstract getInstalledLanguages(): Promise<Array<ILanguagePackItem>>;\n\n\tasync getAvailableLanguages(): Promise<ILanguagePackItem[]> {\n\t\tconst timeout = new CancellationTokenSource();\n\t\tsetTimeout(() => timeout.cancel(), 1000);\n\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await this.extensionGalleryService.query({\n\t\t\t\ttext: 'category:\"language packs\"',\n\t\t\t\tpageSize: 20\n\t\t\t}, timeout.token);\n\t\t} catch (_) {\n\t\t\t// This method is best effort. So, we ignore any errors.\n\t\t\treturn [];\n\t\t}\n\n\t\tconst languagePackExtensions = result.firstPage.filter(e => e.properties.localizedLanguages?.length && e.tags.some(t => t.startsWith('lp-')));\n\t\tconst allFromMarketplace: ILanguagePackItem[] = languagePackExtensions.map(lp => {\n\t\t\tconst languageName = lp.properties.localizedLanguages?.[0];\n\t\t\tconst locale = getLocale(lp)!;\n\t\t\tconst baseQuickPick = this.createQuickPickItem(locale, languageName, lp);\n\t\t\treturn {\n\t\t\t\t...baseQuickPick,\n\t\t\t\textensionId: lp.identifier.id,\n\t\t\t\tgalleryExtension: lp\n\t\t\t};\n\t\t});\n\n\t\tallFromMarketplace.push(this.createQuickPickItem('en', 'English'));\n\n\t\treturn allFromMarketplace;\n\t}\n\n\tprotected createQuickPickItem(locale: string, languageName?: string, languagePack?: IGalleryExtension): IQuickPickItem {\n\t\tconst label = languageName ?? locale;\n\t\tlet description: string | undefined;\n\t\tif (label !== locale) {\n\t\t\tdescription = `(${locale})`;\n\t\t}\n\n\t\tif (locale.toLowerCase() === language.toLowerCase()) {\n\t\t\tdescription ??= '';\n\t\t\tdescription += localize('currentDisplayLanguage', \" (Current)\");\n\t\t}\n\n\t\tif (languagePack?.installCount) {\n\t\t\tdescription ??= '';\n\n\t\t\tconst count = languagePack.installCount;\n\t\t\tlet countLabel: string;\n\t\t\tif (count > 1000000) {\n\t\t\t\tcountLabel = `${Math.floor(count / 100000) / 10}M`;\n\t\t\t} else if (count > 1000) {\n\t\t\t\tcountLabel = `${Math.floor(count / 1000)}K`;\n\t\t\t} else {\n\t\t\t\tcountLabel = String(count);\n\t\t\t}\n\t\t\tdescription += ` $(cloud-download) ${countLabel}`;\n\t\t}\n\n\t\treturn {\n\t\t\tid: locale,\n\t\t\tlabel,\n\t\t\tdescription\n\t\t};\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as fs from 'fs';\nimport { createHash } from 'crypto';\nimport { equals } from '../../../base/common/arrays.js';\nimport { Queue } from '../../../base/common/async.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { join } from '../../../base/common/path.js';\nimport { Promises } from '../../../base/node/pfs.js';\nimport { INativeEnvironmentService } from '../../environment/common/environment.js';\nimport { IExtensionGalleryService, IExtensionIdentifier, IExtensionManagementService, ILocalExtension } from '../../extensionManagement/common/extensionManagement.js';\nimport { areSameExtensions } from '../../extensionManagement/common/extensionManagementUtil.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { ILocalizationContribution } from '../../extensions/common/extensions.js';\nimport { ILanguagePackItem, LanguagePackBaseService } from '../common/languagePacks.js';\nimport { URI } from '../../../base/common/uri.js';\n\ninterface ILanguagePack {\n\thash: string;\n\tlabel: string | undefined;\n\textensions: {\n\t\textensionIdentifier: IExtensionIdentifier;\n\t\tversion: string;\n\t}[];\n\ttranslations: { [id: string]: string };\n}\n\nexport class NativeLanguagePackService extends LanguagePackBaseService {\n\tprivate readonly cache: LanguagePacksCache;\n\n\tconstructor(\n\t\t@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,\n\t\t@INativeEnvironmentService environmentService: INativeEnvironmentService,\n\t\t@IExtensionGalleryService extensionGalleryService: IExtensionGalleryService,\n\t\t@ILogService private readonly logService: ILogService\n\t) {\n\t\tsuper(extensionGalleryService);\n\t\tthis.cache = this._register(new LanguagePacksCache(environmentService, logService));\n\t\tthis.extensionManagementService.registerParticipant({\n\t\t\tpostInstall: async (extension: ILocalExtension): Promise<void> => {\n\t\t\t\treturn this.postInstallExtension(extension);\n\t\t\t},\n\t\t\tpostUninstall: async (extension: ILocalExtension): Promise<void> => {\n\t\t\t\treturn this.postUninstallExtension(extension);\n\t\t\t}\n\t\t});\n\t}\n\n\tasync getBuiltInExtensionTranslationsUri(id: string, language: string): Promise<URI | undefined> {\n\t\tconst packs = await this.cache.getLanguagePacks();\n\t\tconst pack = packs[language];\n\t\tif (!pack) {\n\t\t\tthis.logService.warn(`No language pack found for ${language}`);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst translation = pack.translations[id];\n\t\treturn translation ? URI.file(translation) : undefined;\n\t}\n\n\tasync getInstalledLanguages(): Promise<Array<ILanguagePackItem>> {\n\t\tconst languagePacks = await this.cache.getLanguagePacks();\n\t\tconst languages: ILanguagePackItem[] = Object.keys(languagePacks).map(locale => {\n\t\t\tconst languagePack = languagePacks[locale];\n\t\t\tconst baseQuickPick = this.createQuickPickItem(locale, languagePack.label);\n\t\t\treturn {\n\t\t\t\t...baseQuickPick,\n\t\t\t\textensionId: languagePack.extensions[0].extensionIdentifier.id,\n\t\t\t};\n\t\t});\n\t\tlanguages.push(this.createQuickPickItem('en', 'English'));\n\t\tlanguages.sort((a, b) => a.label.localeCompare(b.label));\n\t\treturn languages;\n\t}\n\n\tprivate async postInstallExtension(extension: ILocalExtension): Promise<void> {\n\t\tif (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) {\n\t\t\tthis.logService.info('Adding language packs from the extension', extension.identifier.id);\n\t\t\tawait this.update();\n\t\t}\n\t}\n\n\tprivate async postUninstallExtension(extension: ILocalExtension): Promise<void> {\n\t\tconst languagePacks = await this.cache.getLanguagePacks();\n\t\tif (Object.keys(languagePacks).some(language => languagePacks[language] && languagePacks[language].extensions.some(e => areSameExtensions(e.extensionIdentifier, extension.identifier)))) {\n\t\t\tthis.logService.info('Removing language packs from the extension', extension.identifier.id);\n\t\t\tawait this.update();\n\t\t}\n\t}\n\n\tasync update(): Promise<boolean> {\n\t\tconst [current, installed] = await Promise.all([this.cache.getLanguagePacks(), this.extensionManagementService.getInstalled()]);\n\t\tconst updated = await this.cache.update(installed);\n\t\treturn !equals(Object.keys(current), Object.keys(updated));\n\t}\n}\n\nclass LanguagePacksCache extends Disposable {\n\n\tprivate languagePacks: { [language: string]: ILanguagePack } = {};\n\tprivate languagePacksFilePath: string;\n\tprivate languagePacksFileLimiter: Queue<any>;\n\tprivate initializedCache: boolean | undefined;\n\n\tconstructor(\n\t\t@INativeEnvironmentService environmentService: INativeEnvironmentService,\n\t\t@ILogService private readonly logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis.languagePacksFilePath = join(environmentService.userDataPath, 'languagepacks.json');\n\t\tthis.languagePacksFileLimiter = new Queue();\n\t}\n\n\tgetLanguagePacks(): Promise<{ [language: string]: ILanguagePack }> {\n\t\t// if queue is not empty, fetch from disk\n\t\tif (this.languagePacksFileLimiter.size || !this.initializedCache) {\n\t\t\treturn this.withLanguagePacks()\n\t\t\t\t.then(() => this.languagePacks);\n\t\t}\n\t\treturn Promise.resolve(this.languagePacks);\n\t}\n\n\tupdate(extensions: ILocalExtension[]): Promise<{ [language: string]: ILanguagePack }> {\n\t\treturn this.withLanguagePacks(languagePacks => {\n\t\t\tObject.keys(languagePacks).forEach(language => delete languagePacks[language]);\n\t\t\tthis.createLanguagePacksFromExtensions(languagePacks, ...extensions);\n\t\t}).then(() => this.languagePacks);\n\t}\n\n\tprivate createLanguagePacksFromExtensions(languagePacks: { [language: string]: ILanguagePack }, ...extensions: ILocalExtension[]): void {\n\t\tfor (const extension of extensions) {\n\t\t\tif (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) {\n\t\t\t\tthis.createLanguagePacksFromExtension(languagePacks, extension);\n\t\t\t}\n\t\t}\n\t\tObject.keys(languagePacks).forEach(languageId => this.updateHash(languagePacks[languageId]));\n\t}\n\n\tprivate createLanguagePacksFromExtension(languagePacks: { [language: string]: ILanguagePack }, extension: ILocalExtension): void {\n\t\tconst extensionIdentifier = extension.identifier;\n\t\tconst localizations = extension.manifest.contributes && extension.manifest.contributes.localizations ? extension.manifest.contributes.localizations : [];\n\t\tfor (const localizationContribution of localizations) {\n\t\t\tif (extension.location.scheme === Schemas.file && isValidLocalization(localizationContribution)) {\n\t\t\t\tlet languagePack = languagePacks[localizationContribution.languageId];\n\t\t\t\tif (!languagePack) {\n\t\t\t\t\tlanguagePack = {\n\t\t\t\t\t\thash: '',\n\t\t\t\t\t\textensions: [],\n\t\t\t\t\t\ttranslations: {},\n\t\t\t\t\t\tlabel: localizationContribution.localizedLanguageName ?? localizationContribution.languageName\n\t\t\t\t\t};\n\t\t\t\t\tlanguagePacks[localizationContribution.languageId] = languagePack;\n\t\t\t\t}\n\t\t\t\tconst extensionInLanguagePack = languagePack.extensions.filter(e => areSameExtensions(e.extensionIdentifier, extensionIdentifier))[0];\n\t\t\t\tif (extensionInLanguagePack) {\n\t\t\t\t\textensionInLanguagePack.version = extension.manifest.version;\n\t\t\t\t} else {\n\t\t\t\t\tlanguagePack.extensions.push({ extensionIdentifier, version: extension.manifest.version });\n\t\t\t\t}\n\t\t\t\tfor (const translation of localizationContribution.translations) {\n\t\t\t\t\tlanguagePack.translations[translation.id] = join(extension.location.fsPath, translation.path);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateHash(languagePack: ILanguagePack): void {\n\t\tif (languagePack) {\n\t\t\tconst md5 = createHash('md5'); // CodeQL [SM04514] Used to create an hash for language pack extension version, which is not a security issue\n\t\t\tfor (const extension of languagePack.extensions) {\n\t\t\t\tmd5.update(extension.extensionIdentifier.uuid || extension.extensionIdentifier.id).update(extension.version); // CodeQL [SM01510] The extension UUID is not sensitive info and is not manually created by a user\n\t\t\t}\n\t\t\tlanguagePack.hash = md5.digest('hex');\n\t\t}\n\t}\n\n\tprivate withLanguagePacks<T>(fn: (languagePacks: { [language: string]: ILanguagePack }) => T | null = () => null): Promise<T> {\n\t\treturn this.languagePacksFileLimiter.queue(() => {\n\t\t\tlet result: T | null = null;\n\t\t\treturn fs.promises.readFile(this.languagePacksFilePath, 'utf8')\n\t\t\t\t.then(undefined, err => err.code === 'ENOENT' ? Promise.resolve('{}') : Promise.reject(err))\n\t\t\t\t.then<{ [language: string]: ILanguagePack }>(raw => { try { return JSON.parse(raw); } catch (e) { return {}; } })\n\t\t\t\t.then(languagePacks => { result = fn(languagePacks); return languagePacks; })\n\t\t\t\t.then(languagePacks => {\n\t\t\t\t\tfor (const language of Object.keys(languagePacks)) {\n\t\t\t\t\t\tif (!languagePacks[language]) {\n\t\t\t\t\t\t\tdelete languagePacks[language];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.languagePacks = languagePacks;\n\t\t\t\t\tthis.initializedCache = true;\n\t\t\t\t\tconst raw = JSON.stringify(this.languagePacks);\n\t\t\t\t\tthis.logService.debug('Writing language packs', raw);\n\t\t\t\t\treturn Promises.writeFile(this.languagePacksFilePath, raw);\n\t\t\t\t})\n\t\t\t\t.then(() => result, error => this.logService.error(error));\n\t\t});\n\t}\n}\n\nfunction isValidLocalization(localization: ILocalizationContribution): boolean {\n\tif (typeof localization.languageId !== 'string') {\n\t\treturn false;\n\t}\n\tif (!Array.isArray(localization.translations) || localization.translations.length === 0) {\n\t\treturn false;\n\t}\n\tfor (const translation of localization.translations) {\n\t\tif (typeof translation.id !== 'string') {\n\t\t\treturn false;\n\t\t}\n\t\tif (typeof translation.path !== 'string') {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (localization.languageName && typeof localization.languageName !== 'string') {\n\t\treturn false;\n\t}\n\tif (localization.localizedLanguageName && typeof localization.localizedLanguageName !== 'string') {\n\t\treturn false;\n\t}\n\treturn true;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IDownloadService } from './download.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { asTextOrError, IRequestService } from '../../request/common/request.js';\n\nexport class DownloadService implements IDownloadService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tconstructor(\n\t\t@IRequestService private readonly requestService: IRequestService,\n\t\t@IFileService private readonly fileService: IFileService\n\t) { }\n\n\tasync download(resource: URI, target: URI, cancellationToken: CancellationToken = CancellationToken.None): Promise<void> {\n\t\tif (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote) {\n\t\t\t// Intentionally only support this for file|remote<->file|remote scenarios\n\t\t\tawait this.fileService.copy(resource, target);\n\t\t\treturn;\n\t\t}\n\t\tconst options = { type: 'GET', url: resource.toString(true) };\n\t\tconst context = await this.requestService.request(options, cancellationToken);\n\t\tif (context.res.statusCode === 200) {\n\t\t\tawait this.fileService.writeFile(target, context.stream);\n\t\t} else {\n\t\t\tconst message = await asTextOrError(context);\n\t\t\tthrow new Error(`Expected 200, got back ${context.res.statusCode} instead.\\n\\n${message}`);\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { SyncDescriptor } from './descriptors.js';\nimport { BrandedService, ServiceIdentifier } from './instantiation.js';\n\nconst _registry: [ServiceIdentifier<any>, SyncDescriptor<any>][] = [];\n\nexport const enum InstantiationType {\n\t/**\n\t * Instantiate this service as soon as a consumer depends on it. _Note_ that this\n\t * is more costly as some upfront work is done that is likely not needed\n\t */\n\tEager = 0,\n\n\t/**\n\t * Instantiate this service as soon as a consumer uses it. This is the _better_\n\t * way of registering a service.\n\t */\n\tDelayed = 1\n}\n\nexport function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, ctor: new (...services: Services) => T, supportsDelayedInstantiation: InstantiationType): void;\nexport function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, descriptor: SyncDescriptor<any>): void;\nexport function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, ctorOrDescriptor: { new(...services: Services): T } | SyncDescriptor<any>, supportsDelayedInstantiation?: boolean | InstantiationType): void {\n\tif (!(ctorOrDescriptor instanceof SyncDescriptor)) {\n\t\tctorOrDescriptor = new SyncDescriptor<T>(ctorOrDescriptor as new (...args: any[]) => T, [], Boolean(supportsDelayedInstantiation));\n\t}\n\n\t_registry.push([id, ctorOrDescriptor]);\n}\n\nexport function getSingletonServiceDescriptors(): [ServiceIdentifier<any>, SyncDescriptor<any>][] {\n\treturn _registry;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n\nclass Node<K, V> {\n\treadonly forward: Node<K, V>[];\n\tconstructor(readonly level: number, readonly key: K, public value: V) {\n\t\tthis.forward = [];\n\t}\n}\n\nconst NIL: undefined = undefined;\n\ninterface Comparator<K> {\n\t(a: K, b: K): number;\n}\n\nexport class SkipList<K, V> implements Map<K, V> {\n\n\treadonly [Symbol.toStringTag] = 'SkipList';\n\n\tprivate _maxLevel: number;\n\tprivate _level: number = 0;\n\tprivate _header: Node<K, V>;\n\tprivate _size: number = 0;\n\n\t/**\n\t *\n\t * @param capacity Capacity at which the list performs best\n\t */\n\tconstructor(\n\t\treadonly comparator: (a: K, b: K) => number,\n\t\tcapacity: number = 2 ** 16\n\t) {\n\t\tthis._maxLevel = Math.max(1, Math.log2(capacity) | 0);\n\t\tthis._header = <any>new Node(this._maxLevel, NIL, NIL);\n\t}\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tclear(): void {\n\t\tthis._header = <any>new Node(this._maxLevel, NIL, NIL);\n\t\tthis._size = 0;\n\t}\n\n\thas(key: K): boolean {\n\t\treturn Boolean(SkipList._search(this, key, this.comparator));\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn SkipList._search(this, key, this.comparator)?.value;\n\t}\n\n\tset(key: K, value: V): this {\n\t\tif (SkipList._insert(this, key, value, this.comparator)) {\n\t\t\tthis._size += 1;\n\t\t}\n\t\treturn this;\n\t}\n\n\tdelete(key: K): boolean {\n\t\tconst didDelete = SkipList._delete(this, key, this.comparator);\n\t\tif (didDelete) {\n\t\t\tthis._size -= 1;\n\t\t}\n\t\treturn didDelete;\n\t}\n\n\t// --- iteration\n\n\tforEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tlet node = this._header.forward[0];\n\t\twhile (node) {\n\t\t\tcallbackfn.call(thisArg, node.value, node.key, this);\n\t\t\tnode = node.forward[0];\n\t\t}\n\t}\n\n\t[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n\n\t*entries(): IterableIterator<[K, V]> {\n\t\tlet node = this._header.forward[0];\n\t\twhile (node) {\n\t\t\tyield [node.key, node.value];\n\t\t\tnode = node.forward[0];\n\t\t}\n\t}\n\n\t*keys(): IterableIterator<K> {\n\t\tlet node = this._header.forward[0];\n\t\twhile (node) {\n\t\t\tyield node.key;\n\t\t\tnode = node.forward[0];\n\t\t}\n\t}\n\n\t*values(): IterableIterator<V> {\n\t\tlet node = this._header.forward[0];\n\t\twhile (node) {\n\t\t\tyield node.value;\n\t\t\tnode = node.forward[0];\n\t\t}\n\t}\n\n\ttoString(): string {\n\t\t// debug string...\n\t\tlet result = '[SkipList]:';\n\t\tlet node = this._header.forward[0];\n\t\twhile (node) {\n\t\t\tresult += `node(${node.key}, ${node.value}, lvl:${node.level})`;\n\t\t\tnode = node.forward[0];\n\t\t}\n\t\treturn result;\n\t}\n\n\t// from https://www.epaperpress.com/sortsearch/download/skiplist.pdf\n\n\tprivate static _search<K, V>(list: SkipList<K, V>, searchKey: K, comparator: Comparator<K>) {\n\t\tlet x = list._header;\n\t\tfor (let i = list._level - 1; i >= 0; i--) {\n\t\t\twhile (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {\n\t\t\t\tx = x.forward[i];\n\t\t\t}\n\t\t}\n\t\tx = x.forward[0];\n\t\tif (x && comparator(x.key, searchKey) === 0) {\n\t\t\treturn x;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate static _insert<K, V>(list: SkipList<K, V>, searchKey: K, value: V, comparator: Comparator<K>) {\n\t\tconst update: Node<K, V>[] = [];\n\t\tlet x = list._header;\n\t\tfor (let i = list._level - 1; i >= 0; i--) {\n\t\t\twhile (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {\n\t\t\t\tx = x.forward[i];\n\t\t\t}\n\t\t\tupdate[i] = x;\n\t\t}\n\t\tx = x.forward[0];\n\t\tif (x && comparator(x.key, searchKey) === 0) {\n\t\t\t// update\n\t\t\tx.value = value;\n\t\t\treturn false;\n\t\t} else {\n\t\t\t// insert\n\t\t\tconst lvl = SkipList._randomLevel(list);\n\t\t\tif (lvl > list._level) {\n\t\t\t\tfor (let i = list._level; i < lvl; i++) {\n\t\t\t\t\tupdate[i] = list._header;\n\t\t\t\t}\n\t\t\t\tlist._level = lvl;\n\t\t\t}\n\t\t\tx = new Node<K, V>(lvl, searchKey, value);\n\t\t\tfor (let i = 0; i < lvl; i++) {\n\t\t\t\tx.forward[i] = update[i].forward[i];\n\t\t\t\tupdate[i].forward[i] = x;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tprivate static _randomLevel(list: SkipList<any, any>, p: number = 0.5): number {\n\t\tlet lvl = 1;\n\t\twhile (Math.random() < p && lvl < list._maxLevel) {\n\t\t\tlvl += 1;\n\t\t}\n\t\treturn lvl;\n\t}\n\n\tprivate static _delete<K, V>(list: SkipList<K, V>, searchKey: K, comparator: Comparator<K>) {\n\t\tconst update: Node<K, V>[] = [];\n\t\tlet x = list._header;\n\t\tfor (let i = list._level - 1; i >= 0; i--) {\n\t\t\twhile (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {\n\t\t\t\tx = x.forward[i];\n\t\t\t}\n\t\t\tupdate[i] = x;\n\t\t}\n\t\tx = x.forward[0];\n\t\tif (!x || comparator(x.key, searchKey) !== 0) {\n\t\t\t// not found\n\t\t\treturn false;\n\t\t}\n\t\tfor (let i = 0; i < list._level; i++) {\n\t\t\tif (update[i].forward[i] !== x) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tupdate[i].forward[i] = x.forward[i];\n\t\t}\n\t\twhile (list._level > 0 && list._header.forward[list._level - 1] === NIL) {\n\t\t\tlist._level -= 1;\n\t\t}\n\t\treturn true;\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IUriIdentityService } from './uriIdentity.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { InstantiationType, registerSingleton } from '../../instantiation/common/extensions.js';\nimport { IFileService, FileSystemProviderCapabilities, IFileSystemProviderCapabilitiesChangeEvent, IFileSystemProviderRegistrationEvent } from '../../files/common/files.js';\nimport { ExtUri, IExtUri, normalizePath } from '../../../base/common/resources.js';\nimport { SkipList } from '../../../base/common/skipList.js';\nimport { Event } from '../../../base/common/event.js';\nimport { DisposableStore } from '../../../base/common/lifecycle.js';\n\nclass Entry {\n\tstatic _clock = 0;\n\ttime: number = Entry._clock++;\n\tconstructor(readonly uri: URI) { }\n\ttouch() {\n\t\tthis.time = Entry._clock++;\n\t\treturn this;\n\t}\n}\n\nexport class UriIdentityService implements IUriIdentityService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\treadonly extUri: IExtUri;\n\n\tprivate readonly _dispooables = new DisposableStore();\n\tprivate readonly _canonicalUris: SkipList<URI, Entry>;\n\tprivate readonly _limit = 2 ** 16;\n\n\tconstructor(@IFileService private readonly _fileService: IFileService) {\n\n\t\tconst schemeIgnoresPathCasingCache = new Map<string, boolean>();\n\n\t\t// assume path casing matters unless the file system provider spec'ed the opposite.\n\t\t// for all other cases path casing matters, e.g for\n\t\t// * virtual documents\n\t\t// * in-memory uris\n\t\t// * all kind of \"private\" schemes\n\t\tconst ignorePathCasing = (uri: URI): boolean => {\n\t\t\tlet ignorePathCasing = schemeIgnoresPathCasingCache.get(uri.scheme);\n\t\t\tif (ignorePathCasing === undefined) {\n\t\t\t\t// retrieve once and then case per scheme until a change happens\n\t\t\t\tignorePathCasing = _fileService.hasProvider(uri) && !this._fileService.hasCapability(uri, FileSystemProviderCapabilities.PathCaseSensitive);\n\t\t\t\tschemeIgnoresPathCasingCache.set(uri.scheme, ignorePathCasing);\n\t\t\t}\n\t\t\treturn ignorePathCasing;\n\t\t};\n\t\tthis._dispooables.add(Event.any<IFileSystemProviderCapabilitiesChangeEvent | IFileSystemProviderRegistrationEvent>(\n\t\t\t_fileService.onDidChangeFileSystemProviderRegistrations,\n\t\t\t_fileService.onDidChangeFileSystemProviderCapabilities\n\t\t)(e => {\n\t\t\t// remove from cache\n\t\t\tschemeIgnoresPathCasingCache.delete(e.scheme);\n\t\t}));\n\n\t\tthis.extUri = new ExtUri(ignorePathCasing);\n\t\tthis._canonicalUris = new SkipList((a, b) => this.extUri.compare(a, b, true), this._limit);\n\t}\n\n\tdispose(): void {\n\t\tthis._dispooables.dispose();\n\t\tthis._canonicalUris.clear();\n\t}\n\n\tasCanonicalUri(uri: URI): URI {\n\n\t\t// (1) normalize URI\n\t\tif (this._fileService.hasProvider(uri)) {\n\t\t\turi = normalizePath(uri);\n\t\t}\n\n\t\t// (2) find the uri in its canonical form or use this uri to define it\n\t\tconst item = this._canonicalUris.get(uri);\n\t\tif (item) {\n\t\t\treturn item.touch().uri.with({ fragment: uri.fragment });\n\t\t}\n\n\t\t// this uri is first and defines the canonical form\n\t\tthis._canonicalUris.set(uri, new Entry(uri));\n\t\tthis._checkTrim();\n\n\t\treturn uri;\n\t}\n\n\tprivate _checkTrim(): void {\n\t\tif (this._canonicalUris.size < this._limit) {\n\t\t\treturn;\n\t\t}\n\n\t\t// get all entries, sort by time (MRU) and re-initalize\n\t\t// the uri cache and the entry clock. this is an expensive\n\t\t// operation and should happen rarely\n\t\tconst entries = [...this._canonicalUris.entries()].sort((a, b) => {\n\t\t\tif (a[1].time < b[1].time) {\n\t\t\t\treturn 1;\n\t\t\t} else if (a[1].time > b[1].time) {\n\t\t\t\treturn -1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t});\n\n\t\tEntry._clock = 0;\n\t\tthis._canonicalUris.clear();\n\t\tconst newSize = this._limit * 0.5;\n\t\tfor (let i = 0; i < newSize; i++) {\n\t\t\tthis._canonicalUris.set(entries[i][0], entries[i][1].touch());\n\t\t}\n\t}\n}\n\nregisterSingleton(IUriIdentityService, UriIdentityService, InstantiationType.Delayed);\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { promises as fs } from 'fs';\nimport * as path from 'path';\nimport { FileAccess } from '../../base/common/network.js';\nimport { join } from '../../base/common/path.js';\nimport type { INLSConfiguration } from '../../nls.js';\nimport { resolveNLSConfiguration } from '../../base/node/nls.js';\nimport { Promises } from '../../base/node/pfs.js';\nimport product from '../../platform/product/common/product.js';\n\nconst nlsMetadataPath = join(FileAccess.asFileUri('').fsPath);\nconst defaultMessagesFile = join(nlsMetadataPath, 'nls.messages.json');\nconst nlsConfigurationCache = new Map<string, Promise<INLSConfiguration>>();\n\nexport async function getNLSConfiguration(language: string, userDataPath: string): Promise<INLSConfiguration> {\n\tif (!product.commit || !(await Promises.exists(defaultMessagesFile))) {\n\t\treturn {\n\t\t\tuserLocale: 'en',\n\t\t\tosLocale: 'en',\n\t\t\tresolvedLanguage: 'en',\n\t\t\tdefaultMessagesFile,\n\n\t\t\t// NLS: below 2 are a relic from old times only used by vscode-nls and deprecated\n\t\t\tlocale: 'en',\n\t\t\tavailableLanguages: {}\n\t\t};\n\t}\n\n\tconst cacheKey = `${language}||${userDataPath}`;\n\tlet result = nlsConfigurationCache.get(cacheKey);\n\tif (!result) {\n\t\tresult = resolveNLSConfiguration({ userLocale: language, osLocale: language, commit: product.commit, userDataPath, nlsMetadataPath });\n\t\tnlsConfigurationCache.set(cacheKey, result);\n\t\t// If the language pack does not yet exist, it defaults to English, which is\n\t\t// then cached and you have to restart even if you then install the pack.\n\t\tresult.then((r) => {\n\t\t\tif (!language.startsWith('en') && r.resolvedLanguage.startsWith('en')) {\n\t\t\t\tnlsConfigurationCache.delete(cacheKey);\n\t\t\t}\n\t\t})\n\t}\n\n\treturn result;\n}\n\n/**\n * Copied from from src/main.js.\n */\nexport const getLocaleFromConfig = async (argvResource: string): Promise<string> => {\n\ttry {\n\t\tconst content = stripComments(await fs.readFile(argvResource, 'utf8'));\n\t\treturn JSON.parse(content).locale;\n\t} catch (error) {\n\t\tif (error.code !== \"ENOENT\") {\n\t\t\tconsole.warn(error)\n\t\t}\n\t\treturn 'en';\n\t}\n};\n\n/**\n * Copied from from src/main.js.\n */\nconst stripComments = (content: string): string => {\n\tconst regexp = /('(?:[^\\\\']*(?:\\\\.)?)*')|('(?:[^\\\\']*(?:\\\\.)?)*')|(\\/\\*(?:\\r?\\n|.)*?\\*\\/)|(\\/{2,}.*?(?:(?:\\r?\\n)|$))/g;\n\n\treturn content.replace(regexp, (match, _m1, _m2, m3, m4) => {\n\t\t// Only one of m1, m2, m3, m4 matches\n\t\tif (m3) {\n\t\t\t// A block comment. Replace with nothing\n\t\t\treturn '';\n\t\t} else if (m4) {\n\t\t\t// A line comment. If it ends in \\r?\\n then keep it.\n\t\t\tconst length_1 = m4.length;\n\t\t\tif (length_1 > 2 && m4[length_1 - 1] === '\\n') {\n\t\t\t\treturn m4[length_1 - 2] === '\\r' ? '\\r\\n' : '\\n';\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t} else {\n\t\t\t// We match a string\n\t\t\treturn match;\n\t\t}\n\t});\n};\n\n/**\n * Generate translations then return a path to a JavaScript file that sets the\n * translations into global variables.  This file is loaded by the browser to\n * set global variables that the loader uses when looking for translations.\n *\n * Normally, VS Code pulls these files from a CDN but we want them to be local.\n */\nexport async function getBrowserNLSConfiguration(locale: string, userDataPath: string): Promise<string> {\n\tif (locale.startsWith('en')) {\n\t\treturn ''; // Use fallback translations.\n\t}\n\n\tconst nlsConfig = await getNLSConfiguration(locale, userDataPath);\n\tconst messagesFile = nlsConfig?.languagePack?.messagesFile;\n\tconst resolvedLanguage = nlsConfig?.resolvedLanguage;\n\tif (!messagesFile || !resolvedLanguage) {\n\t\treturn ''; // Use fallback translations.\n\t}\n\n\tconst nlsFile = path.join(path.dirname(messagesFile), \"nls.messages.js\");\n\ttry {\n\t\tawait fs.stat(nlsFile);\n\t\treturn nlsFile; // We already generated the file.\n\t} catch (error) {\n\t\t// ENOENT is fine, that just means we need to generate the file.\n\t\tif (error.code !== 'ENOENT') {\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tconst messages = (await fs.readFile(messagesFile)).toString();\n\tconst content = `globalThis._VSCODE_NLS_MESSAGES=${messages};\nglobalThis._VSCODE_NLS_LANGUAGE=${JSON.stringify(resolvedLanguage)};`\n\tawait fs.writeFile(nlsFile, content, \"utf-8\");\n\n\treturn nlsFile;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { joinPath } from '../../base/common/resources.js';\nimport { URI } from '../../base/common/uri.js';\nimport { INativeEnvironmentService } from '../../platform/environment/common/environment.js';\nimport { IExtensionsProfileScannerService } from '../../platform/extensionManagement/common/extensionsProfileScannerService.js';\nimport { AbstractExtensionsScannerService, IExtensionsScannerService, Translations } from '../../platform/extensionManagement/common/extensionsScannerService.js';\nimport { IFileService } from '../../platform/files/common/files.js';\nimport { IInstantiationService } from '../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { IProductService } from '../../platform/product/common/productService.js';\nimport { IUriIdentityService } from '../../platform/uriIdentity/common/uriIdentity.js';\nimport { IUserDataProfilesService } from '../../platform/userDataProfile/common/userDataProfile.js';\nimport { getNLSConfiguration } from './remoteLanguagePacks.js';\n\nexport class ExtensionsScannerService extends AbstractExtensionsScannerService implements IExtensionsScannerService {\n\n\tconstructor(\n\t\t@IUserDataProfilesService userDataProfilesService: IUserDataProfilesService,\n\t\t@IExtensionsProfileScannerService extensionsProfileScannerService: IExtensionsProfileScannerService,\n\t\t@IFileService fileService: IFileService,\n\t\t@ILogService logService: ILogService,\n\t\t@INativeEnvironmentService private readonly nativeEnvironmentService: INativeEnvironmentService,\n\t\t@IProductService productService: IProductService,\n\t\t@IUriIdentityService uriIdentityService: IUriIdentityService,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t) {\n\t\tsuper(\n\t\t\tURI.file(nativeEnvironmentService.builtinExtensionsPath),\n\t\t\tURI.file(nativeEnvironmentService.extensionsPath),\n\t\t\tjoinPath(nativeEnvironmentService.userHome, '.vscode-oss-dev', 'extensions', 'control.json'),\n\t\t\tuserDataProfilesService.defaultProfile,\n\t\t\tuserDataProfilesService, extensionsProfileScannerService, fileService, logService, nativeEnvironmentService, productService, uriIdentityService, instantiationService);\n\t}\n\n\tprotected async getTranslations(language: string): Promise<Translations> {\n\t\tconst config = await getNLSConfiguration(language, this.nativeEnvironmentService.userDataPath);\n\t\tif (config.languagePack) {\n\t\t\ttry {\n\t\t\t\tconst content = await this.fileService.readFile(URI.file(config.languagePack.translationsConfigFile));\n\t\t\t\treturn JSON.parse(content.value.toString());\n\t\t\t} catch (err) { /* Ignore error */ }\n\t\t}\n\t\treturn Object.create(null);\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const IStateReadService = createDecorator<IStateReadService>('stateReadService');\nexport interface IStateReadService {\n\n\treadonly _serviceBrand: undefined;\n\n\tgetItem<T>(key: string, defaultValue: T): T;\n\tgetItem<T>(key: string, defaultValue?: T): T | undefined;\n\n}\n\nexport const IStateService = createDecorator<IStateService>('stateService');\nexport interface IStateService extends IStateReadService {\n\n\treadonly _serviceBrand: undefined;\n\n\tsetItem(key: string, data?: object | string | number | boolean | undefined | null): void;\n\tsetItems(items: readonly { key: string; data?: object | string | number | boolean | undefined | null }[]): void;\n\n\tremoveItem(key: string): void;\n\n\tclose(): Promise<void>;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ThrottledDelayer } from '../../../base/common/async.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { isUndefined, isUndefinedOrNull } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { FileOperationError, FileOperationResult, IFileService } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IStateReadService, IStateService } from './state.js';\n\ntype StorageDatabase = { [key: string]: unknown };\n\nexport const enum SaveStrategy {\n\tIMMEDIATE,\n\tDELAYED\n}\n\nexport class FileStorage extends Disposable {\n\n\tprivate storage: StorageDatabase = Object.create(null);\n\tprivate lastSavedStorageContents = '';\n\n\tprivate readonly flushDelayer: ThrottledDelayer<void>;\n\n\tprivate initializing: Promise<void> | undefined = undefined;\n\tprivate closing: Promise<void> | undefined = undefined;\n\n\tconstructor(\n\t\tprivate readonly storagePath: URI,\n\t\tsaveStrategy: SaveStrategy,\n\t\tprivate readonly logService: ILogService,\n\t\tprivate readonly fileService: IFileService,\n\t) {\n\t\tsuper();\n\n\t\tthis.flushDelayer = this._register(new ThrottledDelayer<void>(saveStrategy === SaveStrategy.IMMEDIATE ? 0 : 100 /* buffer saves over a short time */));\n\t}\n\n\tinit(): Promise<void> {\n\t\tif (!this.initializing) {\n\t\t\tthis.initializing = this.doInit();\n\t\t}\n\n\t\treturn this.initializing;\n\t}\n\n\tprivate async doInit(): Promise<void> {\n\t\ttry {\n\t\t\tthis.lastSavedStorageContents = (await this.fileService.readFile(this.storagePath)).value.toString();\n\t\t\tthis.storage = JSON.parse(this.lastSavedStorageContents);\n\t\t} catch (error) {\n\t\t\tif ((<FileOperationError>error).fileOperationResult !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\tthis.logService.error(error);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetItem<T>(key: string, defaultValue: T): T;\n\tgetItem<T>(key: string, defaultValue?: T): T | undefined;\n\tgetItem<T>(key: string, defaultValue?: T): T | undefined {\n\t\tconst res = this.storage[key];\n\t\tif (isUndefinedOrNull(res)) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\treturn res as T;\n\t}\n\n\tsetItem(key: string, data?: object | string | number | boolean | undefined | null): void {\n\t\tthis.setItems([{ key, data }]);\n\t}\n\n\tsetItems(items: readonly { key: string; data?: object | string | number | boolean | undefined | null }[]): void {\n\t\tlet save = false;\n\n\t\tfor (const { key, data } of items) {\n\n\t\t\t// Shortcut for data that did not change\n\t\t\tif (this.storage[key] === data) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Remove items when they are undefined or null\n\t\t\tif (isUndefinedOrNull(data)) {\n\t\t\t\tif (!isUndefined(this.storage[key])) {\n\t\t\t\t\tthis.storage[key] = undefined;\n\t\t\t\t\tsave = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Otherwise add an item\n\t\t\telse {\n\t\t\t\tthis.storage[key] = data;\n\t\t\t\tsave = true;\n\t\t\t}\n\t\t}\n\n\t\tif (save) {\n\t\t\tthis.save();\n\t\t}\n\t}\n\n\tremoveItem(key: string): void {\n\n\t\t// Only update if the key is actually present (not undefined)\n\t\tif (!isUndefined(this.storage[key])) {\n\t\t\tthis.storage[key] = undefined;\n\t\t\tthis.save();\n\t\t}\n\t}\n\n\tprivate async save(): Promise<void> {\n\t\tif (this.closing) {\n\t\t\treturn; // already about to close\n\t\t}\n\n\t\treturn this.flushDelayer.trigger(() => this.doSave());\n\t}\n\n\tprivate async doSave(): Promise<void> {\n\t\tif (!this.initializing) {\n\t\t\treturn; // if we never initialized, we should not save our state\n\t\t}\n\n\t\t// Make sure to wait for init to finish first\n\t\tawait this.initializing;\n\n\t\t// Return early if the database has not changed\n\t\tconst serializedDatabase = JSON.stringify(this.storage, null, 4);\n\t\tif (serializedDatabase === this.lastSavedStorageContents) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Write to disk\n\t\ttry {\n\t\t\tawait this.fileService.writeFile(this.storagePath, VSBuffer.fromString(serializedDatabase), { atomic: { postfix: '.vsctmp' } });\n\t\t\tthis.lastSavedStorageContents = serializedDatabase;\n\t\t} catch (error) {\n\t\t\tthis.logService.error(error);\n\t\t}\n\t}\n\n\tasync close(): Promise<void> {\n\t\tif (!this.closing) {\n\t\t\tthis.closing = this.flushDelayer.trigger(() => this.doSave(), 0 /* as soon as possible */);\n\t\t}\n\n\t\treturn this.closing;\n\t}\n}\n\nexport class StateReadonlyService extends Disposable implements IStateReadService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprotected readonly fileStorage: FileStorage;\n\n\tconstructor(\n\t\tsaveStrategy: SaveStrategy,\n\t\t@IEnvironmentService environmentService: IEnvironmentService,\n\t\t@ILogService logService: ILogService,\n\t\t@IFileService fileService: IFileService\n\t) {\n\t\tsuper();\n\n\t\tthis.fileStorage = this._register(new FileStorage(environmentService.stateResource, saveStrategy, logService, fileService));\n\t}\n\n\tasync init(): Promise<void> {\n\t\tawait this.fileStorage.init();\n\t}\n\n\tgetItem<T>(key: string, defaultValue: T): T;\n\tgetItem<T>(key: string, defaultValue?: T): T | undefined;\n\tgetItem<T>(key: string, defaultValue?: T): T | undefined {\n\t\treturn this.fileStorage.getItem(key, defaultValue);\n\t}\n}\n\nexport class StateService extends StateReadonlyService implements IStateService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tsetItem(key: string, data?: object | string | number | boolean | undefined | null): void {\n\t\tthis.fileStorage.setItem(key, data);\n\t}\n\n\tsetItems(items: readonly { key: string; data?: object | string | number | boolean | undefined | null }[]): void {\n\t\tthis.fileStorage.setItems(items);\n\t}\n\n\tremoveItem(key: string): void {\n\t\tthis.fileStorage.removeItem(key);\n\t}\n\n\tclose(): Promise<void> {\n\t\treturn this.fileStorage.close();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { URI, UriDto } from '../../../base/common/uri.js';\nimport { INativeEnvironmentService } from '../../environment/common/environment.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IStateReadService, IStateService } from '../../state/node/state.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { IUserDataProfilesService, UserDataProfilesService as BaseUserDataProfilesService, StoredUserDataProfile, StoredProfileAssociations } from '../common/userDataProfile.js';\nimport { isString } from '../../../base/common/types.js';\nimport { SaveStrategy, StateService } from '../../state/node/stateService.js';\n\ntype StoredUserDataProfileState = StoredUserDataProfile & { location: URI | string };\n\nexport class UserDataProfilesReadonlyService extends BaseUserDataProfilesService implements IUserDataProfilesService {\n\n\tconstructor(\n\t\t@IStateReadService private readonly stateReadonlyService: IStateReadService,\n\t\t@IUriIdentityService uriIdentityService: IUriIdentityService,\n\t\t@INativeEnvironmentService private readonly nativeEnvironmentService: INativeEnvironmentService,\n\t\t@IFileService fileService: IFileService,\n\t\t@ILogService logService: ILogService,\n\t) {\n\t\tsuper(nativeEnvironmentService, fileService, uriIdentityService, logService);\n\t}\n\n\tprotected override getStoredProfiles(): StoredUserDataProfile[] {\n\t\tconst storedProfilesState = this.stateReadonlyService.getItem<UriDto<StoredUserDataProfileState>[]>(UserDataProfilesReadonlyService.PROFILES_KEY, []);\n\t\treturn storedProfilesState.map(p => ({ ...p, location: isString(p.location) ? this.uriIdentityService.extUri.joinPath(this.profilesHome, p.location) : URI.revive(p.location) }));\n\t}\n\n\tprotected override getStoredProfileAssociations(): StoredProfileAssociations {\n\t\treturn this.stateReadonlyService.getItem<StoredProfileAssociations>(UserDataProfilesReadonlyService.PROFILE_ASSOCIATIONS_KEY, {});\n\t}\n\n\tprotected override getDefaultProfileExtensionsLocation(): URI {\n\t\treturn this.uriIdentityService.extUri.joinPath(URI.file(this.nativeEnvironmentService.extensionsPath).with({ scheme: this.profilesHome.scheme }), 'extensions.json');\n\t}\n\n}\n\nexport class UserDataProfilesService extends UserDataProfilesReadonlyService implements IUserDataProfilesService {\n\n\tconstructor(\n\t\t@IStateService protected readonly stateService: IStateService,\n\t\t@IUriIdentityService uriIdentityService: IUriIdentityService,\n\t\t@INativeEnvironmentService environmentService: INativeEnvironmentService,\n\t\t@IFileService fileService: IFileService,\n\t\t@ILogService logService: ILogService,\n\t) {\n\t\tsuper(stateService, uriIdentityService, environmentService, fileService, logService);\n\t}\n\n\tprotected override saveStoredProfiles(storedProfiles: StoredUserDataProfile[]): void {\n\t\tif (storedProfiles.length) {\n\t\t\tthis.stateService.setItem(UserDataProfilesService.PROFILES_KEY, storedProfiles.map(profile => ({ ...profile, location: this.uriIdentityService.extUri.basename(profile.location) })));\n\t\t} else {\n\t\t\tthis.stateService.removeItem(UserDataProfilesService.PROFILES_KEY);\n\t\t}\n\t}\n\n\tprotected override saveStoredProfileAssociations(storedProfileAssociations: StoredProfileAssociations): void {\n\t\tif (storedProfileAssociations.emptyWindows || storedProfileAssociations.workspaces) {\n\t\t\tthis.stateService.setItem(UserDataProfilesService.PROFILE_ASSOCIATIONS_KEY, storedProfileAssociations);\n\t\t} else {\n\t\t\tthis.stateService.removeItem(UserDataProfilesService.PROFILE_ASSOCIATIONS_KEY);\n\t\t}\n\t}\n}\n\nexport class ServerUserDataProfilesService extends UserDataProfilesService implements IUserDataProfilesService {\n\n\tconstructor(\n\t\t@IUriIdentityService uriIdentityService: IUriIdentityService,\n\t\t@INativeEnvironmentService environmentService: INativeEnvironmentService,\n\t\t@IFileService fileService: IFileService,\n\t\t@ILogService logService: ILogService,\n\t) {\n\t\tsuper(new StateService(SaveStrategy.IMMEDIATE, environmentService, logService, fileService), uriIdentityService, environmentService, fileService, logService);\n\t}\n\n\toverride async init(): Promise<void> {\n\t\tawait (this.stateService as StateService).init();\n\t\treturn super.init();\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ILogService } from '../../log/common/log.js';\nimport { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { AbstractExtensionsProfileScannerService } from '../common/extensionsProfileScannerService.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { INativeEnvironmentService } from '../../environment/common/environment.js';\nimport { URI } from '../../../base/common/uri.js';\n\nexport class ExtensionsProfileScannerService extends AbstractExtensionsProfileScannerService {\n\tconstructor(\n\t\t@INativeEnvironmentService environmentService: INativeEnvironmentService,\n\t\t@IFileService fileService: IFileService,\n\t\t@IUserDataProfilesService userDataProfilesService: IUserDataProfilesService,\n\t\t@IUriIdentityService uriIdentityService: IUriIdentityService,\n\t\t@ILogService logService: ILogService,\n\t) {\n\t\tsuper(URI.file(environmentService.extensionsPath), fileService, userDataProfilesService, uriIdentityService, logService);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { Event } from '../../../base/common/event.js';\nimport { ILogger, ILogService, LogLevel, MultiplexLogger } from './log.js';\n\nexport class LogService extends Disposable implements ILogService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly logger: ILogger;\n\n\tconstructor(primaryLogger: ILogger, otherLoggers: ILogger[] = []) {\n\t\tsuper();\n\t\tthis.logger = new MultiplexLogger([primaryLogger, ...otherLoggers]);\n\t\tthis._register(primaryLogger.onDidChangeLogLevel(level => this.setLevel(level)));\n\t}\n\n\tget onDidChangeLogLevel(): Event<LogLevel> {\n\t\treturn this.logger.onDidChangeLogLevel;\n\t}\n\n\tsetLevel(level: LogLevel): void {\n\t\tthis.logger.setLevel(level);\n\t}\n\n\tgetLevel(): LogLevel {\n\t\treturn this.logger.getLevel();\n\t}\n\n\ttrace(message: string, ...args: any[]): void {\n\t\tthis.logger.trace(message, ...args);\n\t}\n\n\tdebug(message: string, ...args: any[]): void {\n\t\tthis.logger.debug(message, ...args);\n\t}\n\n\tinfo(message: string, ...args: any[]): void {\n\t\tthis.logger.info(message, ...args);\n\t}\n\n\twarn(message: string, ...args: any[]): void {\n\t\tthis.logger.warn(message, ...args);\n\t}\n\n\terror(message: string | Error, ...args: any[]): void {\n\t\tthis.logger.error(message, ...args);\n\t}\n\n\tflush(): void {\n\t\tthis.logger.flush();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type * as spdlog from '@vscode/spdlog';\nimport { ByteSize } from '../../files/common/files.js';\nimport { AbstractMessageLogger, ILogger, LogLevel } from '../common/log.js';\n\nenum SpdLogLevel {\n\tTrace,\n\tDebug,\n\tInfo,\n\tWarning,\n\tError,\n\tCritical,\n\tOff\n}\n\nasync function createSpdLogLogger(name: string, logfilePath: string, filesize: number, filecount: number, donotUseFormatters: boolean): Promise<spdlog.Logger | null> {\n\t// Do not crash if spdlog cannot be loaded\n\ttry {\n\t\tconst _spdlog = await import('@vscode/spdlog');\n\t\t_spdlog.setFlushOn(SpdLogLevel.Trace);\n\t\tconst logger = await _spdlog.createAsyncRotatingLogger(name, logfilePath, filesize, filecount);\n\t\tif (donotUseFormatters) {\n\t\t\tlogger.clearFormatters();\n\t\t} else {\n\t\t\tlogger.setPattern('%Y-%m-%d %H:%M:%S.%e [%l] %v');\n\t\t}\n\t\treturn logger;\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n\treturn null;\n}\n\ninterface ILog {\n\tlevel: LogLevel;\n\tmessage: string;\n}\n\nfunction log(logger: spdlog.Logger, level: LogLevel, message: string): void {\n\tswitch (level) {\n\t\tcase LogLevel.Trace: logger.trace(message); break;\n\t\tcase LogLevel.Debug: logger.debug(message); break;\n\t\tcase LogLevel.Info: logger.info(message); break;\n\t\tcase LogLevel.Warning: logger.warn(message); break;\n\t\tcase LogLevel.Error: logger.error(message); break;\n\t\tcase LogLevel.Off: /* do nothing */ break;\n\t\tdefault: throw new Error(`Invalid log level ${level}`);\n\t}\n}\n\nfunction setLogLevel(logger: spdlog.Logger, level: LogLevel): void {\n\tswitch (level) {\n\t\tcase LogLevel.Trace: logger.setLevel(SpdLogLevel.Trace); break;\n\t\tcase LogLevel.Debug: logger.setLevel(SpdLogLevel.Debug); break;\n\t\tcase LogLevel.Info: logger.setLevel(SpdLogLevel.Info); break;\n\t\tcase LogLevel.Warning: logger.setLevel(SpdLogLevel.Warning); break;\n\t\tcase LogLevel.Error: logger.setLevel(SpdLogLevel.Error); break;\n\t\tcase LogLevel.Off: logger.setLevel(SpdLogLevel.Off); break;\n\t\tdefault: throw new Error(`Invalid log level ${level}`);\n\t}\n}\n\nexport class SpdLogLogger extends AbstractMessageLogger implements ILogger {\n\n\tprivate buffer: ILog[] = [];\n\tprivate readonly _loggerCreationPromise: Promise<void>;\n\tprivate _logger: spdlog.Logger | undefined;\n\n\tconstructor(\n\t\tname: string,\n\t\tfilepath: string,\n\t\trotating: boolean,\n\t\tdonotUseFormatters: boolean,\n\t\tlevel: LogLevel,\n\t) {\n\t\tsuper();\n\t\tthis.setLevel(level);\n\t\tthis._loggerCreationPromise = this._createSpdLogLogger(name, filepath, rotating, donotUseFormatters);\n\t\tthis._register(this.onDidChangeLogLevel(level => {\n\t\t\tif (this._logger) {\n\t\t\t\tsetLogLevel(this._logger, level);\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate async _createSpdLogLogger(name: string, filepath: string, rotating: boolean, donotUseFormatters: boolean): Promise<void> {\n\t\tconst filecount = rotating ? 6 : 1;\n\t\tconst filesize = (30 / filecount) * ByteSize.MB;\n\t\tconst logger = await createSpdLogLogger(name, filepath, filesize, filecount, donotUseFormatters);\n\t\tif (logger) {\n\t\t\tthis._logger = logger;\n\t\t\tsetLogLevel(this._logger, this.getLevel());\n\t\t\tfor (const { level, message } of this.buffer) {\n\t\t\t\tlog(this._logger, level, message);\n\t\t\t}\n\t\t\tthis.buffer = [];\n\t\t}\n\t}\n\n\tprotected log(level: LogLevel, message: string): void {\n\t\tif (this._logger) {\n\t\t\tlog(this._logger, level, message);\n\t\t} else if (this.getLevel() <= level) {\n\t\t\tthis.buffer.push({ level, message });\n\t\t}\n\t}\n\n\toverride flush(): void {\n\t\tif (this._logger) {\n\t\t\tthis.flushLogger();\n\t\t} else {\n\t\t\tthis._loggerCreationPromise.then(() => this.flushLogger());\n\t\t}\n\t}\n\n\toverride dispose(): void {\n\t\tif (this._logger) {\n\t\t\tthis.disposeLogger();\n\t\t} else {\n\t\t\tthis._loggerCreationPromise.then(() => this.disposeLogger());\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\tprivate flushLogger(): void {\n\t\tif (this._logger) {\n\t\t\tthis._logger.flush();\n\t\t}\n\t}\n\n\tprivate disposeLogger(): void {\n\t\tif (this._logger) {\n\t\t\tthis._logger.drop();\n\t\t\tthis._logger = undefined;\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { URI } from '../../../base/common/uri.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { AbstractLoggerService, ILogger, ILoggerOptions, ILoggerService, LogLevel } from '../common/log.js';\nimport { SpdLogLogger } from './spdlogLog.js';\n\nexport class LoggerService extends AbstractLoggerService implements ILoggerService {\n\n\tprotected doCreateLogger(resource: URI, logLevel: LogLevel, options?: ILoggerOptions): ILogger {\n\t\treturn new SpdLogLogger(generateUuid(), resource.fsPath, !options?.donotRotate, !!options?.donotUseFormatters, logLevel);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport function getUNCHostAllowlist(): string[] {\n\tconst allowlist = processUNCHostAllowlist();\n\tif (allowlist) {\n\t\treturn Array.from(allowlist);\n\t}\n\n\treturn [];\n}\n\nfunction processUNCHostAllowlist(): Set<string> {\n\n\t// The property `process.uncHostAllowlist` is not available in official node.js\n\t// releases, only in our own builds, so we have to probe for availability\n\n\treturn (process as any).uncHostAllowlist;\n}\n\nexport function addUNCHostToAllowlist(allowedHost: string | string[]): void {\n\tif (process.platform !== 'win32') {\n\t\treturn;\n\t}\n\n\tconst allowlist = processUNCHostAllowlist();\n\tif (allowlist) {\n\t\tif (typeof allowedHost === 'string') {\n\t\t\tallowlist.add(allowedHost.toLowerCase()); // UNC hosts are case-insensitive\n\t\t} else {\n\t\t\tfor (const host of toSafeStringArray(allowedHost)) {\n\t\t\t\taddUNCHostToAllowlist(host);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction toSafeStringArray(arg0: unknown): string[] {\n\tconst allowedUNCHosts = new Set<string>();\n\n\tif (Array.isArray(arg0)) {\n\t\tfor (const host of arg0) {\n\t\t\tif (typeof host === 'string') {\n\t\t\t\tallowedUNCHosts.add(host);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Array.from(allowedUNCHosts);\n}\n\nexport function getUNCHost(maybeUNCPath: string | undefined | null): string | undefined {\n\tif (typeof maybeUNCPath !== 'string') {\n\t\treturn undefined; // require a valid string\n\t}\n\n\tconst uncRoots = [\n\t\t'\\\\\\\\.\\\\UNC\\\\',\t// DOS Device paths (https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats)\n\t\t'\\\\\\\\?\\\\UNC\\\\',\n\t\t'\\\\\\\\'\t\t\t// standard UNC path\n\t];\n\n\tlet host = undefined;\n\n\tfor (const uncRoot of uncRoots) {\n\t\tconst indexOfUNCRoot = maybeUNCPath.indexOf(uncRoot);\n\t\tif (indexOfUNCRoot !== 0) {\n\t\t\tcontinue; // not matching any of our expected UNC roots\n\t\t}\n\n\t\tconst indexOfUNCPath = maybeUNCPath.indexOf('\\\\', uncRoot.length);\n\t\tif (indexOfUNCPath === -1) {\n\t\t\tcontinue; // no path component found\n\t\t}\n\n\t\tconst hostCandidate = maybeUNCPath.substring(uncRoot.length, indexOfUNCPath);\n\t\tif (hostCandidate) {\n\t\t\thost = hostCandidate;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn host;\n}\n\nexport function disableUNCAccessRestrictions(): void {\n\tif (process.platform !== 'win32') {\n\t\treturn;\n\t}\n\n\t(process as any).restrictUNCAccess = false;\n}\n\nexport function isUNCAccessRestrictionsDisabled(): boolean {\n\tif (process.platform !== 'win32') {\n\t\treturn true;\n\t}\n\n\treturn (process as any).restrictUNCAccess === false;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { URI } from '../../../base/common/uri.js';\nimport * as nls from '../../../nls.js';\nimport { IGalleryExtension, AllowedExtensionsConfigKey, IAllowedExtensionsService, AllowedExtensionsConfigValueType } from './extensionManagement.js';\nimport { ExtensionType, IExtension, TargetPlatform } from '../../extensions/common/extensions.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { IMarkdownString, MarkdownString } from '../../../base/common/htmlContent.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { isBoolean, isObject, isUndefined } from '../../../base/common/types.js';\nimport { Emitter } from '../../../base/common/event.js';\n\nfunction isGalleryExtension(extension: any): extension is IGalleryExtension {\n\treturn extension.type === 'gallery';\n}\n\nfunction isIExtension(extension: any): extension is IExtension {\n\treturn extension.type === ExtensionType.User || extension.type === ExtensionType.System;\n}\n\n\nconst VersionRegex = /^(?<version>\\d+\\.\\d+\\.\\d+(-.*)?)(@(?<platform>.+))?$/;\n\nexport class AllowedExtensionsService extends Disposable implements IAllowedExtensionsService {\n\n\t_serviceBrand: undefined;\n\n\tprivate readonly publisherOrgs: string[];\n\n\tprivate _allowedExtensionsConfigValue: AllowedExtensionsConfigValueType | undefined;\n\tget allowedExtensionsConfigValue(): AllowedExtensionsConfigValueType | undefined {\n\t\treturn this._allowedExtensionsConfigValue;\n\t}\n\tprivate _onDidChangeAllowedExtensions = this._register(new Emitter<void>());\n\treadonly onDidChangeAllowedExtensionsConfigValue = this._onDidChangeAllowedExtensions.event;\n\n\tconstructor(\n\t\t@IProductService productService: IProductService,\n\t\t@IConfigurationService protected readonly configurationService: IConfigurationService\n\t) {\n\t\tsuper();\n\t\tthis.publisherOrgs = productService.extensionPublisherOrgs?.map(p => p.toLowerCase()) ?? [];\n\t\tthis._allowedExtensionsConfigValue = this.getAllowedExtensionsValue();\n\t\tthis._register(this.configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration(AllowedExtensionsConfigKey)) {\n\t\t\t\tthis._allowedExtensionsConfigValue = this.getAllowedExtensionsValue();\n\t\t\t\tthis._onDidChangeAllowedExtensions.fire();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate getAllowedExtensionsValue(): AllowedExtensionsConfigValueType | undefined {\n\t\tconst value = this.configurationService.getValue<AllowedExtensionsConfigValueType | undefined>(AllowedExtensionsConfigKey);\n\t\tif (!isObject(value) || Array.isArray(value)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst entries = Object.entries(value).map(([key, value]) => [key.toLowerCase(), value]);\n\t\tif (entries.length === 1 && entries[0][0] === '*' && entries[0][1] === true) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn Object.fromEntries(entries);\n\t}\n\n\tisAllowed(extension: IGalleryExtension | IExtension | { id: string; publisherDisplayName: string | undefined; version?: string; prerelease?: boolean; targetPlatform?: TargetPlatform }): true | IMarkdownString {\n\t\tif (!this._allowedExtensionsConfigValue) {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet id: string, version: string, targetPlatform: TargetPlatform, prerelease: boolean, publisher: string, publisherDisplayName: string | undefined;\n\n\t\tif (isGalleryExtension(extension)) {\n\t\t\tid = extension.identifier.id.toLowerCase();\n\t\t\tversion = extension.version;\n\t\t\tprerelease = extension.properties.isPreReleaseVersion;\n\t\t\tpublisher = extension.publisher.toLowerCase();\n\t\t\tpublisherDisplayName = extension.publisherDisplayName.toLowerCase();\n\t\t\ttargetPlatform = extension.properties.targetPlatform;\n\t\t} else if (isIExtension(extension)) {\n\t\t\tid = extension.identifier.id.toLowerCase();\n\t\t\tversion = extension.manifest.version;\n\t\t\tprerelease = extension.preRelease;\n\t\t\tpublisher = extension.manifest.publisher.toLowerCase();\n\t\t\tpublisherDisplayName = extension.publisherDisplayName?.toLowerCase();\n\t\t\ttargetPlatform = extension.targetPlatform;\n\t\t} else {\n\t\t\tid = extension.id.toLowerCase();\n\t\t\tversion = extension.version ?? '*';\n\t\t\ttargetPlatform = extension.targetPlatform ?? TargetPlatform.UNIVERSAL;\n\t\t\tprerelease = extension.prerelease ?? false;\n\t\t\tpublisher = extension.id.substring(0, extension.id.indexOf('.')).toLowerCase();\n\t\t\tpublisherDisplayName = extension.publisherDisplayName?.toLowerCase();\n\t\t}\n\n\t\tconst settingsCommandLink = URI.parse(`command:workbench.action.openSettings?${encodeURIComponent(JSON.stringify({ query: `@id:${AllowedExtensionsConfigKey}` }))}`).toString();\n\t\tconst extensionValue = this._allowedExtensionsConfigValue[id];\n\t\tconst extensionReason = new MarkdownString(nls.localize('specific extension not allowed', \"it is not in the [allowed list]({0})\", settingsCommandLink));\n\t\tif (!isUndefined(extensionValue)) {\n\t\t\tif (isBoolean(extensionValue)) {\n\t\t\t\treturn extensionValue ? true : extensionReason;\n\t\t\t}\n\t\t\tif (extensionValue === 'stable' && prerelease) {\n\t\t\t\treturn new MarkdownString(nls.localize('extension prerelease not allowed', \"the pre-release versions of this extension are not in the [allowed list]({0})\", settingsCommandLink));\n\t\t\t}\n\t\t\tif (version !== '*' && Array.isArray(extensionValue) && !extensionValue.some(v => {\n\t\t\t\tconst match = VersionRegex.exec(v);\n\t\t\t\tif (match && match.groups) {\n\t\t\t\t\tconst { platform: p, version: v } = match.groups;\n\t\t\t\t\tif (v !== version) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (targetPlatform !== TargetPlatform.UNIVERSAL && p && targetPlatform !== p) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t})) {\n\t\t\t\treturn new MarkdownString(nls.localize('specific version of extension not allowed', \"the version {0} of this extension is not in the [allowed list]({1})\", version, settingsCommandLink));\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tconst publisherKey = publisherDisplayName && this.publisherOrgs.includes(publisherDisplayName) ? publisherDisplayName : publisher;\n\t\tconst publisherValue = this._allowedExtensionsConfigValue[publisherKey];\n\t\tif (!isUndefined(publisherValue)) {\n\t\t\tif (isBoolean(publisherValue)) {\n\t\t\t\treturn publisherValue ? true : new MarkdownString(nls.localize('publisher not allowed', \"the extensions from this publisher are not in the [allowed list]({1})\", publisherKey, settingsCommandLink));\n\t\t\t}\n\t\t\tif (publisherValue === 'stable' && prerelease) {\n\t\t\t\treturn new MarkdownString(nls.localize('prerelease versions from this publisher not allowed', \"the pre-release versions from this publisher are not in the [allowed list]({1})\", publisherKey, settingsCommandLink));\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this._allowedExtensionsConfigValue['*'] === true) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn extensionReason;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { ExtensionGalleryResourceType, Flag, IExtensionGalleryManifest, IExtensionGalleryManifestService } from './extensionGalleryManifest.js';\nimport { FilterType, SortBy } from './extensionManagement.js';\n\ntype ExtensionGalleryConfig = {\n\treadonly serviceUrl: string;\n\treadonly itemUrl: string;\n\treadonly publisherUrl: string;\n\treadonly resourceUrlTemplate: string;\n\treadonly extensionUrlTemplate: string;\n\treadonly controlUrl: string;\n\treadonly nlsBaseUrl: string;\n};\n\nexport class ExtensionGalleryManifestService extends Disposable implements IExtensionGalleryManifestService {\n\n\treadonly _serviceBrand: undefined;\n\treadonly onDidChangeExtensionGalleryManifest = Event.None;\n\n\tconstructor(\n\t\t@IProductService protected readonly productService: IProductService,\n\t) {\n\t\tsuper();\n\t}\n\n\tisEnabled(): boolean {\n\t\treturn !!this.productService.extensionsGallery?.serviceUrl;\n\t}\n\n\tasync getExtensionGalleryManifest(): Promise<IExtensionGalleryManifest | null> {\n\t\tconst extensionsGallery = this.productService.extensionsGallery as ExtensionGalleryConfig | undefined;\n\t\tif (!extensionsGallery?.serviceUrl) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst resources = [\n\t\t\t{\n\t\t\t\tid: `${extensionsGallery.serviceUrl}/extensionquery`,\n\t\t\t\ttype: ExtensionGalleryResourceType.ExtensionQueryService\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: `${extensionsGallery.serviceUrl}/vscode/{publisher}/{name}/latest`,\n\t\t\t\ttype: ExtensionGalleryResourceType.ExtensionLatestVersionUri\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: `${extensionsGallery.serviceUrl}/publishers/{publisher}/extensions/{name}/{version}/stats?statType={statTypeName}`,\n\t\t\t\ttype: ExtensionGalleryResourceType.ExtensionStatisticsUri\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: `${extensionsGallery.serviceUrl}/itemName/{publisher}.{name}/version/{version}/statType/{statTypeValue}/vscodewebextension`,\n\t\t\t\ttype: ExtensionGalleryResourceType.WebExtensionStatisticsUri\n\t\t\t},\n\t\t];\n\n\t\tif (extensionsGallery.publisherUrl) {\n\t\t\tresources.push({\n\t\t\t\tid: `${extensionsGallery.publisherUrl}/{publisher}`,\n\t\t\t\ttype: ExtensionGalleryResourceType.PublisherViewUri\n\t\t\t});\n\t\t}\n\n\t\tif (extensionsGallery.itemUrl) {\n\t\t\tresources.push({\n\t\t\t\tid: `${extensionsGallery.itemUrl}?itemName={publisher}.{name}`,\n\t\t\t\ttype: ExtensionGalleryResourceType.ExtensionDetailsViewUri\n\t\t\t});\n\t\t\tresources.push({\n\t\t\t\tid: `${extensionsGallery.itemUrl}?itemName={publisher}.{name}&ssr=false#review-details`,\n\t\t\t\ttype: ExtensionGalleryResourceType.ExtensionRatingViewUri\n\t\t\t});\n\t\t}\n\n\t\tif (extensionsGallery.resourceUrlTemplate) {\n\t\t\tresources.push({\n\t\t\t\tid: extensionsGallery.resourceUrlTemplate,\n\t\t\t\ttype: ExtensionGalleryResourceType.ExtensionResourceUri\n\t\t\t});\n\t\t}\n\n\t\tconst filtering = [\n\t\t\t{\n\t\t\t\tname: FilterType.Tag,\n\t\t\t\tvalue: 1,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: FilterType.ExtensionId,\n\t\t\t\tvalue: 4,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: FilterType.Category,\n\t\t\t\tvalue: 5,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: FilterType.ExtensionName,\n\t\t\t\tvalue: 7,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: FilterType.Target,\n\t\t\t\tvalue: 8,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: FilterType.Featured,\n\t\t\t\tvalue: 9,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: FilterType.SearchText,\n\t\t\t\tvalue: 10,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: FilterType.ExcludeWithFlags,\n\t\t\t\tvalue: 12,\n\t\t\t},\n\t\t];\n\n\t\tconst sorting = [\n\t\t\t{\n\t\t\t\tname: SortBy.NoneOrRelevance,\n\t\t\t\tvalue: 0,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: SortBy.LastUpdatedDate,\n\t\t\t\tvalue: 1,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: SortBy.Title,\n\t\t\t\tvalue: 2,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: SortBy.PublisherName,\n\t\t\t\tvalue: 3,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: SortBy.InstallCount,\n\t\t\t\tvalue: 4,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: SortBy.AverageRating,\n\t\t\t\tvalue: 6,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: SortBy.PublishedDate,\n\t\t\t\tvalue: 10,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: SortBy.WeightedRating,\n\t\t\t\tvalue: 12,\n\t\t\t},\n\t\t];\n\n\t\tconst flags = [\n\t\t\t{\n\t\t\t\tname: Flag.None,\n\t\t\t\tvalue: 0x0,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeVersions,\n\t\t\t\tvalue: 0x1,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeFiles,\n\t\t\t\tvalue: 0x2,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeCategoryAndTags,\n\t\t\t\tvalue: 0x4,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeSharedAccounts,\n\t\t\t\tvalue: 0x8,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeVersionProperties,\n\t\t\t\tvalue: 0x10,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.ExcludeNonValidated,\n\t\t\t\tvalue: 0x20,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeInstallationTargets,\n\t\t\t\tvalue: 0x40,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeAssetUri,\n\t\t\t\tvalue: 0x80,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeStatistics,\n\t\t\t\tvalue: 0x100,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeLatestVersionOnly,\n\t\t\t\tvalue: 0x200,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.Unpublished,\n\t\t\t\tvalue: 0x1000,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeNameConflictInfo,\n\t\t\t\tvalue: 0x8000,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: Flag.IncludeLatestPrereleaseAndStableVersionOnly,\n\t\t\t\tvalue: 0x10000,\n\t\t\t},\n\t\t];\n\n\t\treturn {\n\t\t\tversion: '',\n\t\t\tresources,\n\t\t\tcapabilities: {\n\t\t\t\textensionQuery: {\n\t\t\t\t\tfiltering,\n\t\t\t\t\tsorting,\n\t\t\t\t\tflags,\n\t\t\t\t},\n\t\t\t\tsigning: {\n\t\t\t\t\tallPublicRepositorySigned: true,\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ServiceCollection } from '../../platform/instantiation/common/serviceCollection.js';\nimport { ConsoleLogger, getLogLevel, ILoggerService, ILogService } from '../../platform/log/common/log.js';\nimport { SyncDescriptor } from '../../platform/instantiation/common/descriptors.js';\nimport { ConfigurationService } from '../../platform/configuration/common/configurationService.js';\nimport { IConfigurationService } from '../../platform/configuration/common/configuration.js';\nimport { IRequestService } from '../../platform/request/common/request.js';\nimport { RequestService } from '../../platform/request/node/requestService.js';\nimport { NullTelemetryService } from '../../platform/telemetry/common/telemetryUtils.js';\nimport { ITelemetryService } from '../../platform/telemetry/common/telemetry.js';\nimport { IAllowedExtensionsService, IExtensionGalleryService, InstallOptions } from '../../platform/extensionManagement/common/extensionManagement.js';\nimport { ExtensionGalleryServiceWithNoStorageService } from '../../platform/extensionManagement/common/extensionGalleryService.js';\nimport { ExtensionManagementService, INativeServerExtensionManagementService } from '../../platform/extensionManagement/node/extensionManagementService.js';\nimport { ExtensionSignatureVerificationService, IExtensionSignatureVerificationService } from '../../platform/extensionManagement/node/extensionSignatureVerificationService.js';\nimport { InstantiationService } from '../../platform/instantiation/common/instantiationService.js';\nimport { IInstantiationService } from '../../platform/instantiation/common/instantiation.js';\nimport product from '../../platform/product/common/product.js';\nimport { Disposable } from '../../base/common/lifecycle.js';\nimport { FileService } from '../../platform/files/common/fileService.js';\nimport { DiskFileSystemProvider } from '../../platform/files/node/diskFileSystemProvider.js';\nimport { Schemas } from '../../base/common/network.js';\nimport { IFileService } from '../../platform/files/common/files.js';\nimport { IProductService } from '../../platform/product/common/productService.js';\nimport { IServerEnvironmentService, ServerEnvironmentService, ServerParsedArgs } from './serverEnvironmentService.js';\nimport { ExtensionManagementCLI } from '../../platform/extensionManagement/common/extensionManagementCLI.js';\nimport { ILanguagePackService } from '../../platform/languagePacks/common/languagePacks.js';\nimport { NativeLanguagePackService } from '../../platform/languagePacks/node/languagePacks.js';\nimport { getErrorMessage } from '../../base/common/errors.js';\nimport { URI } from '../../base/common/uri.js';\nimport { isAbsolute, join } from '../../base/common/path.js';\nimport { cwd } from '../../base/common/process.js';\nimport { DownloadService } from '../../platform/download/common/downloadService.js';\nimport { IDownloadService } from '../../platform/download/common/download.js';\nimport { IUriIdentityService } from '../../platform/uriIdentity/common/uriIdentity.js';\nimport { UriIdentityService } from '../../platform/uriIdentity/common/uriIdentityService.js';\nimport { buildHelpMessage, buildVersionMessage, OptionDescriptions } from '../../platform/environment/node/argv.js';\nimport { isWindows } from '../../base/common/platform.js';\nimport { IExtensionsScannerService } from '../../platform/extensionManagement/common/extensionsScannerService.js';\nimport { ExtensionsScannerService } from './extensionsScannerService.js';\nimport { IUserDataProfilesService } from '../../platform/userDataProfile/common/userDataProfile.js';\nimport { IExtensionsProfileScannerService } from '../../platform/extensionManagement/common/extensionsProfileScannerService.js';\nimport { NullPolicyService } from '../../platform/policy/common/policy.js';\nimport { ServerUserDataProfilesService } from '../../platform/userDataProfile/node/userDataProfile.js';\nimport { ExtensionsProfileScannerService } from '../../platform/extensionManagement/node/extensionsProfileScannerService.js';\nimport { LogService } from '../../platform/log/common/logService.js';\nimport { LoggerService } from '../../platform/log/node/loggerService.js';\nimport { localize } from '../../nls.js';\nimport { addUNCHostToAllowlist, disableUNCAccessRestrictions } from '../../base/node/unc.js';\nimport { AllowedExtensionsService } from '../../platform/extensionManagement/common/allowedExtensionsService.js';\nimport { IExtensionGalleryManifestService } from '../../platform/extensionManagement/common/extensionGalleryManifest.js';\nimport { ExtensionGalleryManifestService } from '../../platform/extensionManagement/common/extensionGalleryManifestService.js';\n\nclass CliMain extends Disposable {\n\n\tconstructor(private readonly args: ServerParsedArgs, private readonly remoteDataFolder: string) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tprocess.once('exit', () => this.dispose()); // Dispose on exit\n\t}\n\n\tasync run(): Promise<void> {\n\t\tconst instantiationService = await this.initServices();\n\t\tawait instantiationService.invokeFunction(async accessor => {\n\t\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\t\tconst logService = accessor.get(ILogService);\n\n\t\t\t// On Windows, configure the UNC allow list based on settings\n\t\t\tif (isWindows) {\n\t\t\t\tif (configurationService.getValue('security.restrictUNCAccess') === false) {\n\t\t\t\t\tdisableUNCAccessRestrictions();\n\t\t\t\t} else {\n\t\t\t\t\taddUNCHostToAllowlist(configurationService.getValue('security.allowedUNCHosts'));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait this.doRun(instantiationService.createInstance(ExtensionManagementCLI, new ConsoleLogger(logService.getLevel(), false)));\n\t\t\t} catch (error) {\n\t\t\t\tlogService.error(error);\n\t\t\t\tconsole.error(getErrorMessage(error));\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate async initServices(): Promise<IInstantiationService> {\n\t\tconst services = new ServiceCollection();\n\n\t\tconst productService = { _serviceBrand: undefined, ...product };\n\t\tservices.set(IProductService, productService);\n\n\t\tconst environmentService = new ServerEnvironmentService(this.args, productService);\n\t\tservices.set(IServerEnvironmentService, environmentService);\n\n\t\tconst loggerService = new LoggerService(getLogLevel(environmentService), environmentService.logsHome);\n\t\tservices.set(ILoggerService, loggerService);\n\n\t\tconst logService = new LogService(this._register(loggerService.createLogger('remoteCLI', { name: localize('remotecli', \"Remote CLI\") })));\n\t\tservices.set(ILogService, logService);\n\t\tlogService.trace(`Remote configuration data at ${this.remoteDataFolder}`);\n\t\tlogService.trace('process arguments:', this.args);\n\n\t\t// Files\n\t\tconst fileService = this._register(new FileService(logService));\n\t\tservices.set(IFileService, fileService);\n\t\tfileService.registerProvider(Schemas.file, this._register(new DiskFileSystemProvider(logService)));\n\n\t\tconst uriIdentityService = new UriIdentityService(fileService);\n\t\tservices.set(IUriIdentityService, uriIdentityService);\n\n\t\t// User Data Profiles\n\t\tconst userDataProfilesService = this._register(new ServerUserDataProfilesService(uriIdentityService, environmentService, fileService, logService));\n\t\tservices.set(IUserDataProfilesService, userDataProfilesService);\n\n\t\t// Configuration\n\t\tconst configurationService = this._register(new ConfigurationService(userDataProfilesService.defaultProfile.settingsResource, fileService, new NullPolicyService(), logService));\n\t\tservices.set(IConfigurationService, configurationService);\n\n\t\t// Initialize\n\t\tawait Promise.all([\n\t\t\tconfigurationService.initialize(),\n\t\t\tuserDataProfilesService.init()\n\t\t]);\n\n\t\tservices.set(IRequestService, new SyncDescriptor(RequestService, ['remote']));\n\t\tservices.set(IDownloadService, new SyncDescriptor(DownloadService));\n\t\tservices.set(ITelemetryService, NullTelemetryService);\n\t\tservices.set(IExtensionGalleryManifestService, new SyncDescriptor(ExtensionGalleryManifestService));\n\t\tservices.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryServiceWithNoStorageService));\n\t\tservices.set(IExtensionsProfileScannerService, new SyncDescriptor(ExtensionsProfileScannerService));\n\t\tservices.set(IExtensionsScannerService, new SyncDescriptor(ExtensionsScannerService));\n\t\tservices.set(IExtensionSignatureVerificationService, new SyncDescriptor(ExtensionSignatureVerificationService));\n\t\tservices.set(IAllowedExtensionsService, new SyncDescriptor(AllowedExtensionsService));\n\t\tservices.set(INativeServerExtensionManagementService, new SyncDescriptor(ExtensionManagementService));\n\t\tservices.set(ILanguagePackService, new SyncDescriptor(NativeLanguagePackService));\n\n\t\treturn new InstantiationService(services);\n\t}\n\n\tprivate async doRun(extensionManagementCLI: ExtensionManagementCLI): Promise<void> {\n\n\t\t// List Extensions\n\t\tif (this.args['list-extensions']) {\n\t\t\treturn extensionManagementCLI.listExtensions(!!this.args['show-versions'], this.args['category']);\n\t\t}\n\n\t\t// Install Extension\n\t\telse if (this.args['install-extension'] || this.args['install-builtin-extension']) {\n\t\t\tconst installOptions: InstallOptions = { isMachineScoped: !!this.args['do-not-sync'], installPreReleaseVersion: !!this.args['pre-release'], donotIncludePackAndDependencies: !!this.args['do-not-include-pack-dependencies'] };\n\t\t\treturn extensionManagementCLI.installExtensions(this.asExtensionIdOrVSIX(this.args['install-extension'] || []), this.asExtensionIdOrVSIX(this.args['install-builtin-extension'] || []), installOptions, !!this.args['force']);\n\t\t}\n\n\t\t// Uninstall Extension\n\t\telse if (this.args['uninstall-extension']) {\n\t\t\treturn extensionManagementCLI.uninstallExtensions(this.asExtensionIdOrVSIX(this.args['uninstall-extension']), !!this.args['force']);\n\t\t}\n\n\t\t// Update the installed extensions\n\t\telse if (this.args['update-extensions']) {\n\t\t\treturn extensionManagementCLI.updateExtensions();\n\t\t}\n\n\t\t// Locate Extension\n\t\telse if (this.args['locate-extension']) {\n\t\t\treturn extensionManagementCLI.locateExtension(this.args['locate-extension']);\n\t\t}\n\t}\n\n\tprivate asExtensionIdOrVSIX(inputs: string[]): (string | URI)[] {\n\t\treturn inputs.map(input => /\\.vsix$/i.test(input) ? URI.file(isAbsolute(input) ? input : join(cwd(), input)) : input);\n\t}\n}\n\nfunction eventuallyExit(code: number): void {\n\tsetTimeout(() => process.exit(code), 0);\n}\n\nexport async function run(args: ServerParsedArgs, REMOTE_DATA_FOLDER: string, optionDescriptions: OptionDescriptions<ServerParsedArgs>): Promise<void> {\n\tif (args.help) {\n\t\tconst executable = product.serverApplicationName + (isWindows ? '.cmd' : '');\n\t\tconsole.log(buildHelpMessage(product.nameLong, executable, product.version, optionDescriptions, { noInputFiles: true, noPipe: true }));\n\t\treturn;\n\t}\n\n\t// Version Info\n\tif (args.version) {\n\t\tconsole.log(buildVersionMessage(product.version, product.commit));\n\t\treturn;\n\t}\n\n\tconst cliMain = new CliMain(args, REMOTE_DATA_FOLDER);\n\ttry {\n\t\tawait cliMain.run();\n\t\teventuallyExit(0);\n\t} catch (err) {\n\t\teventuallyExit(1);\n\t} finally {\n\t\tcliMain.dispose();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { constants as FSConstants, promises as FSPromises } from 'fs';\nimport { createInterface as readLines } from 'readline';\nimport * as Platform from '../common/platform.js';\n\ntype ReleaseInfo = {\n\tid: string;\n\tid_like?: string;\n\tversion_id?: string;\n};\n\nexport async function getOSReleaseInfo(errorLogger: (error: any) => void): Promise<ReleaseInfo | undefined> {\n\tif (Platform.isMacintosh || Platform.isWindows) {\n\t\treturn;\n\t}\n\n\t// Extract release information on linux based systems\n\t// using the identifiers specified in\n\t// https://www.freedesktop.org/software/systemd/man/os-release.html\n\tlet handle: FSPromises.FileHandle | undefined;\n\tfor (const filePath of ['/etc/os-release', '/usr/lib/os-release', '/etc/lsb-release']) {\n\t\ttry {\n\t\t\thandle = await FSPromises.open(filePath, FSConstants.R_OK);\n\t\t\tbreak;\n\t\t} catch (err) { }\n\t}\n\n\tif (!handle) {\n\t\terrorLogger('Unable to retrieve release information from known identifier paths.');\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst osReleaseKeys = new Set([\n\t\t\t'ID',\n\t\t\t'DISTRIB_ID',\n\t\t\t'ID_LIKE',\n\t\t\t'VERSION_ID',\n\t\t\t'DISTRIB_RELEASE',\n\t\t]);\n\t\tconst releaseInfo: ReleaseInfo = {\n\t\t\tid: 'unknown'\n\t\t};\n\n\t\tfor await (const line of readLines({ input: handle.createReadStream(), crlfDelay: Infinity })) {\n\t\t\tif (!line.includes('=')) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = line.split('=')[0].toUpperCase().trim();\n\t\t\tif (osReleaseKeys.has(key)) {\n\t\t\t\tconst value = line.split('=')[1].replace(/\"/g, '').toLowerCase().trim();\n\t\t\t\tif (key === 'ID' || key === 'DISTRIB_ID') {\n\t\t\t\t\treleaseInfo.id = value;\n\t\t\t\t} else if (key === 'ID_LIKE') {\n\t\t\t\t\treleaseInfo.id_like = value;\n\t\t\t\t} else if (key === 'VERSION_ID' || key === 'DISTRIB_RELEASE') {\n\t\t\t\t\treleaseInfo.version_id = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn releaseInfo;\n\t} catch (err) {\n\t\terrorLogger(err);\n\t}\n\n\treturn;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as net from 'net';\n\n/**\n * Given a start point and a max number of retries, will find a port that\n * is openable. Will return 0 in case no free port can be found.\n */\nexport function findFreePort(startPort: number, giveUpAfter: number, timeout: number, stride = 1): Promise<number> {\n\tlet done = false;\n\n\treturn new Promise(resolve => {\n\t\tconst timeoutHandle = setTimeout(() => {\n\t\t\tif (!done) {\n\t\t\t\tdone = true;\n\t\t\t\treturn resolve(0);\n\t\t\t}\n\t\t}, timeout);\n\n\t\tdoFindFreePort(startPort, giveUpAfter, stride, (port) => {\n\t\t\tif (!done) {\n\t\t\t\tdone = true;\n\t\t\t\tclearTimeout(timeoutHandle);\n\t\t\t\treturn resolve(port);\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction doFindFreePort(startPort: number, giveUpAfter: number, stride: number, clb: (port: number) => void): void {\n\tif (giveUpAfter === 0) {\n\t\treturn clb(0);\n\t}\n\n\tconst client = new net.Socket();\n\n\t// If we can connect to the port it means the port is already taken so we continue searching\n\tclient.once('connect', () => {\n\t\tdispose(client);\n\n\t\treturn doFindFreePort(startPort + stride, giveUpAfter - 1, stride, clb);\n\t});\n\n\tclient.once('data', () => {\n\t\t// this listener is required since node.js 8.x\n\t});\n\n\tclient.once('error', (err: Error & { code?: string }) => {\n\t\tdispose(client);\n\n\t\t// If we receive any non ECONNREFUSED error, it means the port is used but we cannot connect\n\t\tif (err.code !== 'ECONNREFUSED') {\n\t\t\treturn doFindFreePort(startPort + stride, giveUpAfter - 1, stride, clb);\n\t\t}\n\n\t\t// Otherwise it means the port is free to use!\n\t\treturn clb(startPort);\n\t});\n\n\tclient.connect(startPort, '127.0.0.1');\n}\n\n// Reference: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/net/base/port_util.cc#56\nexport const BROWSER_RESTRICTED_PORTS: Record<number, boolean> = {\n\t1: true,      // tcpmux\n\t7: true,      // echo\n\t9: true,      // discard\n\t11: true,     // systat\n\t13: true,     // daytime\n\t15: true,     // netstat\n\t17: true,     // qotd\n\t19: true,     // chargen\n\t20: true,     // ftp data\n\t21: true,     // ftp access\n\t22: true,     // ssh\n\t23: true,     // telnet\n\t25: true,     // smtp\n\t37: true,     // time\n\t42: true,     // name\n\t43: true,     // nicname\n\t53: true,     // domain\n\t69: true,     // tftp\n\t77: true,     // priv-rjs\n\t79: true,     // finger\n\t87: true,     // ttylink\n\t95: true,     // supdup\n\t101: true,    // hostriame\n\t102: true,    // iso-tsap\n\t103: true,    // gppitnp\n\t104: true,    // acr-nema\n\t109: true,    // pop2\n\t110: true,    // pop3\n\t111: true,    // sunrpc\n\t113: true,    // auth\n\t115: true,    // sftp\n\t117: true,    // uucp-path\n\t119: true,    // nntp\n\t123: true,    // NTP\n\t135: true,    // loc-srv /epmap\n\t137: true,    // netbios\n\t139: true,    // netbios\n\t143: true,    // imap2\n\t161: true,    // snmp\n\t179: true,    // BGP\n\t389: true,    // ldap\n\t427: true,    // SLP (Also used by Apple Filing Protocol)\n\t465: true,    // smtp+ssl\n\t512: true,    // print / exec\n\t513: true,    // login\n\t514: true,    // shell\n\t515: true,    // printer\n\t526: true,    // tempo\n\t530: true,    // courier\n\t531: true,    // chat\n\t532: true,    // netnews\n\t540: true,    // uucp\n\t548: true,    // AFP (Apple Filing Protocol)\n\t554: true,    // rtsp\n\t556: true,    // remotefs\n\t563: true,    // nntp+ssl\n\t587: true,    // smtp (rfc6409)\n\t601: true,    // syslog-conn (rfc3195)\n\t636: true,    // ldap+ssl\n\t989: true,    // ftps-data\n\t990: true,    // ftps\n\t993: true,    // ldap+ssl\n\t995: true,    // pop3+ssl\n\t1719: true,   // h323gatestat\n\t1720: true,   // h323hostcall\n\t1723: true,   // pptp\n\t2049: true,   // nfs\n\t3659: true,   // apple-sasl / PasswordServer\n\t4045: true,   // lockd\n\t5060: true,   // sip\n\t5061: true,   // sips\n\t6000: true,   // X11\n\t6566: true,   // sane-port\n\t6665: true,   // Alternate IRC [Apple addition]\n\t6666: true,   // Alternate IRC [Apple addition]\n\t6667: true,   // Standard IRC [Apple addition]\n\t6668: true,   // Alternate IRC [Apple addition]\n\t6669: true,   // Alternate IRC [Apple addition]\n\t6697: true,   // IRC + TLS\n\t10080: true   // Amanda\n};\n\nexport function isPortFree(port: number, timeout: number): Promise<boolean> {\n\treturn findFreePortFaster(port, 0, timeout).then(port => port !== 0);\n}\n\n/**\n * Uses listen instead of connect. Is faster, but if there is another listener on 0.0.0.0 then this will take 127.0.0.1 from that listener.\n */\nexport function findFreePortFaster(startPort: number, giveUpAfter: number, timeout: number, hostname: string = '127.0.0.1'): Promise<number> {\n\tlet resolved: boolean = false;\n\tlet timeoutHandle: Timeout | undefined = undefined;\n\tlet countTried: number = 1;\n\tconst server = net.createServer({ pauseOnConnect: true });\n\tfunction doResolve(port: number, resolve: (port: number) => void) {\n\t\tif (!resolved) {\n\t\t\tresolved = true;\n\t\t\tserver.removeAllListeners();\n\t\t\tserver.close();\n\t\t\tif (timeoutHandle) {\n\t\t\t\tclearTimeout(timeoutHandle);\n\t\t\t}\n\t\t\tresolve(port);\n\t\t}\n\t}\n\treturn new Promise<number>(resolve => {\n\t\ttimeoutHandle = setTimeout(() => {\n\t\t\tdoResolve(0, resolve);\n\t\t}, timeout);\n\n\t\tserver.on('listening', () => {\n\t\t\tdoResolve(startPort, resolve);\n\t\t});\n\t\tserver.on('error', err => {\n\t\t\tif (err && ((<any>err).code === 'EADDRINUSE' || (<any>err).code === 'EACCES') && (countTried < giveUpAfter)) {\n\t\t\t\tstartPort++;\n\t\t\t\tcountTried++;\n\t\t\t\tserver.listen(startPort, hostname);\n\t\t\t} else {\n\t\t\t\tdoResolve(0, resolve);\n\t\t\t}\n\t\t});\n\t\tserver.on('close', () => {\n\t\t\tdoResolve(0, resolve);\n\t\t});\n\t\tserver.listen(startPort, hostname);\n\t});\n}\n\nfunction dispose(socket: net.Socket): void {\n\ttry {\n\t\tsocket.removeAllListeners('connect');\n\t\tsocket.removeAllListeners('error');\n\t\tsocket.end();\n\t\tsocket.destroy();\n\t\tsocket.unref();\n\t} catch (error) {\n\t\tconsole.error(error); // otherwise this error would get lost in the callback chain\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from '../../../common/buffer.js';\nimport { Emitter, Event } from '../../../common/event.js';\nimport { Disposable, DisposableStore, IDisposable } from '../../../common/lifecycle.js';\nimport { IIPCLogger, IMessagePassingProtocol, IPCClient } from './ipc.js';\n\nexport const enum SocketDiagnosticsEventType {\n\tCreated = 'created',\n\tRead = 'read',\n\tWrite = 'write',\n\tOpen = 'open',\n\tError = 'error',\n\tClose = 'close',\n\n\tBrowserWebSocketBlobReceived = 'browserWebSocketBlobReceived',\n\n\tNodeEndReceived = 'nodeEndReceived',\n\tNodeEndSent = 'nodeEndSent',\n\tNodeDrainBegin = 'nodeDrainBegin',\n\tNodeDrainEnd = 'nodeDrainEnd',\n\n\tzlibInflateError = 'zlibInflateError',\n\tzlibInflateData = 'zlibInflateData',\n\tzlibInflateInitialWrite = 'zlibInflateInitialWrite',\n\tzlibInflateInitialFlushFired = 'zlibInflateInitialFlushFired',\n\tzlibInflateWrite = 'zlibInflateWrite',\n\tzlibInflateFlushFired = 'zlibInflateFlushFired',\n\tzlibDeflateError = 'zlibDeflateError',\n\tzlibDeflateData = 'zlibDeflateData',\n\tzlibDeflateWrite = 'zlibDeflateWrite',\n\tzlibDeflateFlushFired = 'zlibDeflateFlushFired',\n\n\tWebSocketNodeSocketWrite = 'webSocketNodeSocketWrite',\n\tWebSocketNodeSocketPeekedHeader = 'webSocketNodeSocketPeekedHeader',\n\tWebSocketNodeSocketReadHeader = 'webSocketNodeSocketReadHeader',\n\tWebSocketNodeSocketReadData = 'webSocketNodeSocketReadData',\n\tWebSocketNodeSocketUnmaskedData = 'webSocketNodeSocketUnmaskedData',\n\tWebSocketNodeSocketDrainBegin = 'webSocketNodeSocketDrainBegin',\n\tWebSocketNodeSocketDrainEnd = 'webSocketNodeSocketDrainEnd',\n\n\tProtocolHeaderRead = 'protocolHeaderRead',\n\tProtocolMessageRead = 'protocolMessageRead',\n\tProtocolHeaderWrite = 'protocolHeaderWrite',\n\tProtocolMessageWrite = 'protocolMessageWrite',\n\tProtocolWrite = 'protocolWrite',\n}\n\nexport namespace SocketDiagnostics {\n\n\texport const enableDiagnostics = false;\n\n\texport interface IRecord {\n\t\ttimestamp: number;\n\t\tid: string;\n\t\tlabel: string;\n\t\ttype: SocketDiagnosticsEventType;\n\t\tbuff?: VSBuffer;\n\t\tdata?: any;\n\t}\n\n\texport const records: IRecord[] = [];\n\tconst socketIds = new WeakMap<any, string>();\n\tlet lastUsedSocketId = 0;\n\n\tfunction getSocketId(nativeObject: unknown, label: string): string {\n\t\tif (!socketIds.has(nativeObject)) {\n\t\t\tconst id = String(++lastUsedSocketId);\n\t\t\tsocketIds.set(nativeObject, id);\n\t\t}\n\t\treturn socketIds.get(nativeObject)!;\n\t}\n\n\texport function traceSocketEvent(nativeObject: unknown, socketDebugLabel: string, type: SocketDiagnosticsEventType, data?: VSBuffer | Uint8Array | ArrayBuffer | ArrayBufferView | any): void {\n\t\tif (!enableDiagnostics) {\n\t\t\treturn;\n\t\t}\n\t\tconst id = getSocketId(nativeObject, socketDebugLabel);\n\n\t\tif (data instanceof VSBuffer || data instanceof Uint8Array || data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {\n\t\t\tconst copiedData = VSBuffer.alloc(data.byteLength);\n\t\t\tcopiedData.set(data);\n\t\t\trecords.push({ timestamp: Date.now(), id, label: socketDebugLabel, type, buff: copiedData });\n\t\t} else {\n\t\t\t// data is a custom object\n\t\t\trecords.push({ timestamp: Date.now(), id, label: socketDebugLabel, type, data: data });\n\t\t}\n\t}\n}\n\nexport const enum SocketCloseEventType {\n\tNodeSocketCloseEvent = 0,\n\tWebSocketCloseEvent = 1\n}\n\nexport interface NodeSocketCloseEvent {\n\t/**\n\t * The type of the event\n\t */\n\treadonly type: SocketCloseEventType.NodeSocketCloseEvent;\n\t/**\n\t * `true` if the socket had a transmission error.\n\t */\n\treadonly hadError: boolean;\n\t/**\n\t * Underlying error.\n\t */\n\treadonly error: Error | undefined;\n}\n\nexport interface WebSocketCloseEvent {\n\t/**\n\t * The type of the event\n\t */\n\treadonly type: SocketCloseEventType.WebSocketCloseEvent;\n\t/**\n\t * Returns the WebSocket connection close code provided by the server.\n\t */\n\treadonly code: number;\n\t/**\n\t * Returns the WebSocket connection close reason provided by the server.\n\t */\n\treadonly reason: string;\n\t/**\n\t * Returns true if the connection closed cleanly; false otherwise.\n\t */\n\treadonly wasClean: boolean;\n\t/**\n\t * Underlying event.\n\t */\n\treadonly event: any | undefined;\n}\n\nexport type SocketCloseEvent = NodeSocketCloseEvent | WebSocketCloseEvent | undefined;\n\nexport interface SocketTimeoutEvent {\n\treadonly unacknowledgedMsgCount: number;\n\treadonly timeSinceOldestUnacknowledgedMsg: number;\n\treadonly timeSinceLastReceivedSomeData: number;\n}\n\nexport interface ISocket extends IDisposable {\n\tonData(listener: (e: VSBuffer) => void): IDisposable;\n\tonClose(listener: (e: SocketCloseEvent) => void): IDisposable;\n\tonEnd(listener: () => void): IDisposable;\n\twrite(buffer: VSBuffer): void;\n\tend(): void;\n\tdrain(): Promise<void>;\n\n\ttraceSocketEvent(type: SocketDiagnosticsEventType, data?: VSBuffer | Uint8Array | ArrayBuffer | ArrayBufferView | any): void;\n}\n\nlet emptyBuffer: VSBuffer | null = null;\nfunction getEmptyBuffer(): VSBuffer {\n\tif (!emptyBuffer) {\n\t\temptyBuffer = VSBuffer.alloc(0);\n\t}\n\treturn emptyBuffer;\n}\n\nexport class ChunkStream {\n\n\tprivate _chunks: VSBuffer[];\n\tprivate _totalLength: number;\n\n\tpublic get byteLength() {\n\t\treturn this._totalLength;\n\t}\n\n\tconstructor() {\n\t\tthis._chunks = [];\n\t\tthis._totalLength = 0;\n\t}\n\n\tpublic acceptChunk(buff: VSBuffer) {\n\t\tthis._chunks.push(buff);\n\t\tthis._totalLength += buff.byteLength;\n\t}\n\n\tpublic read(byteCount: number): VSBuffer {\n\t\treturn this._read(byteCount, true);\n\t}\n\n\tpublic peek(byteCount: number): VSBuffer {\n\t\treturn this._read(byteCount, false);\n\t}\n\n\tprivate _read(byteCount: number, advance: boolean): VSBuffer {\n\n\t\tif (byteCount === 0) {\n\t\t\treturn getEmptyBuffer();\n\t\t}\n\n\t\tif (byteCount > this._totalLength) {\n\t\t\tthrow new Error(`Cannot read so many bytes!`);\n\t\t}\n\n\t\tif (this._chunks[0].byteLength === byteCount) {\n\t\t\t// super fast path, precisely first chunk must be returned\n\t\t\tconst result = this._chunks[0];\n\t\t\tif (advance) {\n\t\t\t\tthis._chunks.shift();\n\t\t\t\tthis._totalLength -= byteCount;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this._chunks[0].byteLength > byteCount) {\n\t\t\t// fast path, the reading is entirely within the first chunk\n\t\t\tconst result = this._chunks[0].slice(0, byteCount);\n\t\t\tif (advance) {\n\t\t\t\tthis._chunks[0] = this._chunks[0].slice(byteCount);\n\t\t\t\tthis._totalLength -= byteCount;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tconst result = VSBuffer.alloc(byteCount);\n\t\tlet resultOffset = 0;\n\t\tlet chunkIndex = 0;\n\t\twhile (byteCount > 0) {\n\t\t\tconst chunk = this._chunks[chunkIndex];\n\t\t\tif (chunk.byteLength > byteCount) {\n\t\t\t\t// this chunk will survive\n\t\t\t\tconst chunkPart = chunk.slice(0, byteCount);\n\t\t\t\tresult.set(chunkPart, resultOffset);\n\t\t\t\tresultOffset += byteCount;\n\n\t\t\t\tif (advance) {\n\t\t\t\t\tthis._chunks[chunkIndex] = chunk.slice(byteCount);\n\t\t\t\t\tthis._totalLength -= byteCount;\n\t\t\t\t}\n\n\t\t\t\tbyteCount -= byteCount;\n\t\t\t} else {\n\t\t\t\t// this chunk will be entirely read\n\t\t\t\tresult.set(chunk, resultOffset);\n\t\t\t\tresultOffset += chunk.byteLength;\n\n\t\t\t\tif (advance) {\n\t\t\t\t\tthis._chunks.shift();\n\t\t\t\t\tthis._totalLength -= chunk.byteLength;\n\t\t\t\t} else {\n\t\t\t\t\tchunkIndex++;\n\t\t\t\t}\n\n\t\t\t\tbyteCount -= chunk.byteLength;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n}\n\nconst enum ProtocolMessageType {\n\tNone = 0,\n\tRegular = 1,\n\tControl = 2,\n\tAck = 3,\n\tDisconnect = 5,\n\tReplayRequest = 6,\n\tPause = 7,\n\tResume = 8,\n\tKeepAlive = 9\n}\n\nfunction protocolMessageTypeToString(messageType: ProtocolMessageType) {\n\tswitch (messageType) {\n\t\tcase ProtocolMessageType.None: return 'None';\n\t\tcase ProtocolMessageType.Regular: return 'Regular';\n\t\tcase ProtocolMessageType.Control: return 'Control';\n\t\tcase ProtocolMessageType.Ack: return 'Ack';\n\t\tcase ProtocolMessageType.Disconnect: return 'Disconnect';\n\t\tcase ProtocolMessageType.ReplayRequest: return 'ReplayRequest';\n\t\tcase ProtocolMessageType.Pause: return 'PauseWriting';\n\t\tcase ProtocolMessageType.Resume: return 'ResumeWriting';\n\t\tcase ProtocolMessageType.KeepAlive: return 'KeepAlive';\n\t}\n}\n\nexport const enum ProtocolConstants {\n\tHeaderLength = 13,\n\t/**\n\t * Send an Acknowledge message at most 2 seconds later...\n\t */\n\tAcknowledgeTime = 2000, // 2 seconds\n\t/**\n\t * If there is a sent message that has been unacknowledged for 20 seconds,\n\t * and we didn't see any incoming server data in the past 20 seconds,\n\t * then consider the connection has timed out.\n\t */\n\tTimeoutTime = 20000, // 20 seconds\n\t/**\n\t * If there is no reconnection within this time-frame, consider the connection permanently closed...\n\t */\n\tReconnectionGraceTime = 3 * 60 * 60 * 1000, // 3hrs\n\t/**\n\t * Maximal grace time between the first and the last reconnection...\n\t */\n\tReconnectionShortGraceTime = 5 * 60 * 1000, // 5min\n\t/**\n\t * Send a message every 5 seconds to avoid that the connection is closed by the OS.\n\t */\n\tKeepAliveSendTime = 5000, // 5 seconds\n}\n\nclass ProtocolMessage {\n\n\tpublic writtenTime: number;\n\n\tconstructor(\n\t\tpublic readonly type: ProtocolMessageType,\n\t\tpublic readonly id: number,\n\t\tpublic readonly ack: number,\n\t\tpublic readonly data: VSBuffer\n\t) {\n\t\tthis.writtenTime = 0;\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.data.byteLength;\n\t}\n}\n\nclass ProtocolReader extends Disposable {\n\n\tprivate readonly _socket: ISocket;\n\tprivate _isDisposed: boolean;\n\tprivate readonly _incomingData: ChunkStream;\n\tpublic lastReadTime: number;\n\n\tprivate readonly _onMessage = this._register(new Emitter<ProtocolMessage>());\n\tpublic readonly onMessage: Event<ProtocolMessage> = this._onMessage.event;\n\n\tprivate readonly _state = {\n\t\treadHead: true,\n\t\treadLen: ProtocolConstants.HeaderLength,\n\t\tmessageType: ProtocolMessageType.None,\n\t\tid: 0,\n\t\tack: 0\n\t};\n\n\tconstructor(socket: ISocket) {\n\t\tsuper();\n\t\tthis._socket = socket;\n\t\tthis._isDisposed = false;\n\t\tthis._incomingData = new ChunkStream();\n\t\tthis._register(this._socket.onData(data => this.acceptChunk(data)));\n\t\tthis.lastReadTime = Date.now();\n\t}\n\n\tpublic acceptChunk(data: VSBuffer | null): void {\n\t\tif (!data || data.byteLength === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lastReadTime = Date.now();\n\n\t\tthis._incomingData.acceptChunk(data);\n\n\t\twhile (this._incomingData.byteLength >= this._state.readLen) {\n\n\t\t\tconst buff = this._incomingData.read(this._state.readLen);\n\n\t\t\tif (this._state.readHead) {\n\t\t\t\t// buff is the header\n\n\t\t\t\t// save new state => next time will read the body\n\t\t\t\tthis._state.readHead = false;\n\t\t\t\tthis._state.readLen = buff.readUInt32BE(9);\n\t\t\t\tthis._state.messageType = buff.readUInt8(0);\n\t\t\t\tthis._state.id = buff.readUInt32BE(1);\n\t\t\t\tthis._state.ack = buff.readUInt32BE(5);\n\n\t\t\t\tthis._socket.traceSocketEvent(SocketDiagnosticsEventType.ProtocolHeaderRead, { messageType: protocolMessageTypeToString(this._state.messageType), id: this._state.id, ack: this._state.ack, messageSize: this._state.readLen });\n\n\t\t\t} else {\n\t\t\t\t// buff is the body\n\t\t\t\tconst messageType = this._state.messageType;\n\t\t\t\tconst id = this._state.id;\n\t\t\t\tconst ack = this._state.ack;\n\n\t\t\t\t// save new state => next time will read the header\n\t\t\t\tthis._state.readHead = true;\n\t\t\t\tthis._state.readLen = ProtocolConstants.HeaderLength;\n\t\t\t\tthis._state.messageType = ProtocolMessageType.None;\n\t\t\t\tthis._state.id = 0;\n\t\t\t\tthis._state.ack = 0;\n\n\t\t\t\tthis._socket.traceSocketEvent(SocketDiagnosticsEventType.ProtocolMessageRead, buff);\n\n\t\t\t\tthis._onMessage.fire(new ProtocolMessage(messageType, id, ack, buff));\n\n\t\t\t\tif (this._isDisposed) {\n\t\t\t\t\t// check if an event listener lead to our disposal\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic readEntireBuffer(): VSBuffer {\n\t\treturn this._incomingData.read(this._incomingData.byteLength);\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._isDisposed = true;\n\t\tsuper.dispose();\n\t}\n}\n\nclass ProtocolWriter {\n\n\tprivate _isDisposed: boolean;\n\tprivate _isPaused: boolean;\n\tprivate readonly _socket: ISocket;\n\tprivate _data: VSBuffer[];\n\tprivate _totalLength: number;\n\tpublic lastWriteTime: number;\n\n\tconstructor(socket: ISocket) {\n\t\tthis._isDisposed = false;\n\t\tthis._isPaused = false;\n\t\tthis._socket = socket;\n\t\tthis._data = [];\n\t\tthis._totalLength = 0;\n\t\tthis.lastWriteTime = 0;\n\t}\n\n\tpublic dispose(): void {\n\t\ttry {\n\t\t\tthis.flush();\n\t\t} catch (err) {\n\t\t\t// ignore error, since the socket could be already closed\n\t\t}\n\t\tthis._isDisposed = true;\n\t}\n\n\tpublic drain(): Promise<void> {\n\t\tthis.flush();\n\t\treturn this._socket.drain();\n\t}\n\n\tpublic flush(): void {\n\t\t// flush\n\t\tthis._writeNow();\n\t}\n\n\tpublic pause(): void {\n\t\tthis._isPaused = true;\n\t}\n\n\tpublic resume(): void {\n\t\tthis._isPaused = false;\n\t\tthis._scheduleWriting();\n\t}\n\n\tpublic write(msg: ProtocolMessage) {\n\t\tif (this._isDisposed) {\n\t\t\t// ignore: there could be left-over promises which complete and then\n\t\t\t// decide to write a response, etc...\n\t\t\treturn;\n\t\t}\n\t\tmsg.writtenTime = Date.now();\n\t\tthis.lastWriteTime = Date.now();\n\t\tconst header = VSBuffer.alloc(ProtocolConstants.HeaderLength);\n\t\theader.writeUInt8(msg.type, 0);\n\t\theader.writeUInt32BE(msg.id, 1);\n\t\theader.writeUInt32BE(msg.ack, 5);\n\t\theader.writeUInt32BE(msg.data.byteLength, 9);\n\n\t\tthis._socket.traceSocketEvent(SocketDiagnosticsEventType.ProtocolHeaderWrite, { messageType: protocolMessageTypeToString(msg.type), id: msg.id, ack: msg.ack, messageSize: msg.data.byteLength });\n\t\tthis._socket.traceSocketEvent(SocketDiagnosticsEventType.ProtocolMessageWrite, msg.data);\n\n\t\tthis._writeSoon(header, msg.data);\n\t}\n\n\tprivate _bufferAdd(head: VSBuffer, body: VSBuffer): boolean {\n\t\tconst wasEmpty = this._totalLength === 0;\n\t\tthis._data.push(head, body);\n\t\tthis._totalLength += head.byteLength + body.byteLength;\n\t\treturn wasEmpty;\n\t}\n\n\tprivate _bufferTake(): VSBuffer {\n\t\tconst ret = VSBuffer.concat(this._data, this._totalLength);\n\t\tthis._data.length = 0;\n\t\tthis._totalLength = 0;\n\t\treturn ret;\n\t}\n\n\tprivate _writeSoon(header: VSBuffer, data: VSBuffer): void {\n\t\tif (this._bufferAdd(header, data)) {\n\t\t\tthis._scheduleWriting();\n\t\t}\n\t}\n\n\tprivate _writeNowTimeout: Timeout | null = null;\n\tprivate _scheduleWriting(): void {\n\t\tif (this._writeNowTimeout) {\n\t\t\treturn;\n\t\t}\n\t\tthis._writeNowTimeout = setTimeout(() => {\n\t\t\tthis._writeNowTimeout = null;\n\t\t\tthis._writeNow();\n\t\t});\n\t}\n\n\tprivate _writeNow(): void {\n\t\tif (this._totalLength === 0) {\n\t\t\treturn;\n\t\t}\n\t\tif (this._isPaused) {\n\t\t\treturn;\n\t\t}\n\t\tconst data = this._bufferTake();\n\t\tthis._socket.traceSocketEvent(SocketDiagnosticsEventType.ProtocolWrite, { byteLength: data.byteLength });\n\t\tthis._socket.write(data);\n\t}\n}\n\n/**\n * A message has the following format:\n * ```\n *     /-------------------------------|------\\\n *     |             HEADER            |      |\n *     |-------------------------------| DATA |\n *     | TYPE | ID | ACK | DATA_LENGTH |      |\n *     \\-------------------------------|------/\n * ```\n * The header is 9 bytes and consists of:\n *  - TYPE is 1 byte (ProtocolMessageType) - the message type\n *  - ID is 4 bytes (u32be) - the message id (can be 0 to indicate to be ignored)\n *  - ACK is 4 bytes (u32be) - the acknowledged message id (can be 0 to indicate to be ignored)\n *  - DATA_LENGTH is 4 bytes (u32be) - the length in bytes of DATA\n *\n * Only Regular messages are counted, other messages are not counted, nor acknowledged.\n */\nexport class Protocol extends Disposable implements IMessagePassingProtocol {\n\n\tprivate _socket: ISocket;\n\tprivate _socketWriter: ProtocolWriter;\n\tprivate _socketReader: ProtocolReader;\n\n\tprivate readonly _onMessage = new Emitter<VSBuffer>();\n\treadonly onMessage: Event<VSBuffer> = this._onMessage.event;\n\n\tprivate readonly _onDidDispose = new Emitter<void>();\n\treadonly onDidDispose: Event<void> = this._onDidDispose.event;\n\n\tconstructor(socket: ISocket) {\n\t\tsuper();\n\t\tthis._socket = socket;\n\t\tthis._socketWriter = this._register(new ProtocolWriter(this._socket));\n\t\tthis._socketReader = this._register(new ProtocolReader(this._socket));\n\n\t\tthis._register(this._socketReader.onMessage((msg) => {\n\t\t\tif (msg.type === ProtocolMessageType.Regular) {\n\t\t\t\tthis._onMessage.fire(msg.data);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this._socket.onClose(() => this._onDidDispose.fire()));\n\t}\n\n\tdrain(): Promise<void> {\n\t\treturn this._socketWriter.drain();\n\t}\n\n\tgetSocket(): ISocket {\n\t\treturn this._socket;\n\t}\n\n\tsendDisconnect(): void {\n\t\t// Nothing to do...\n\t}\n\n\tsend(buffer: VSBuffer): void {\n\t\tthis._socketWriter.write(new ProtocolMessage(ProtocolMessageType.Regular, 0, 0, buffer));\n\t}\n}\n\nexport class Client<TContext = string> extends IPCClient<TContext> {\n\n\tstatic fromSocket<TContext = string>(socket: ISocket, id: TContext): Client<TContext> {\n\t\treturn new Client(new Protocol(socket), id);\n\t}\n\n\tget onDidDispose(): Event<void> { return this.protocol.onDidDispose; }\n\n\tconstructor(private protocol: Protocol | PersistentProtocol, id: TContext, ipcLogger: IIPCLogger | null = null) {\n\t\tsuper(protocol, id, ipcLogger);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tconst socket = this.protocol.getSocket();\n\t\t// should be sent gracefully with a .flush(), but try to send it out as a\n\t\t// last resort here if nothing else:\n\t\tthis.protocol.sendDisconnect();\n\t\tthis.protocol.dispose();\n\t\tsocket.end();\n\t}\n}\n\n/**\n * Will ensure no messages are lost if there are no event listeners.\n */\nexport class BufferedEmitter<T> {\n\tprivate _emitter: Emitter<T>;\n\tpublic readonly event: Event<T>;\n\n\tprivate _hasListeners = false;\n\tprivate _isDeliveringMessages = false;\n\tprivate _bufferedMessages: T[] = [];\n\n\tconstructor() {\n\t\tthis._emitter = new Emitter<T>({\n\t\t\tonWillAddFirstListener: () => {\n\t\t\t\tthis._hasListeners = true;\n\t\t\t\t// it is important to deliver these messages after this call, but before\n\t\t\t\t// other messages have a chance to be received (to guarantee in order delivery)\n\t\t\t\t// that's why we're using here queueMicrotask and not other types of timeouts\n\t\t\t\tqueueMicrotask(() => this._deliverMessages());\n\t\t\t},\n\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\tthis._hasListeners = false;\n\t\t\t}\n\t\t});\n\n\t\tthis.event = this._emitter.event;\n\t}\n\n\tprivate _deliverMessages(): void {\n\t\tif (this._isDeliveringMessages) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isDeliveringMessages = true;\n\t\twhile (this._hasListeners && this._bufferedMessages.length > 0) {\n\t\t\tthis._emitter.fire(this._bufferedMessages.shift()!);\n\t\t}\n\t\tthis._isDeliveringMessages = false;\n\t}\n\n\tpublic fire(event: T): void {\n\t\tif (this._hasListeners) {\n\t\t\tif (this._bufferedMessages.length > 0) {\n\t\t\t\tthis._bufferedMessages.push(event);\n\t\t\t} else {\n\t\t\t\tthis._emitter.fire(event);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._bufferedMessages.push(event);\n\t\t}\n\t}\n\n\tpublic flushBuffer(): void {\n\t\tthis._bufferedMessages = [];\n\t}\n}\n\nclass QueueElement<T> {\n\tpublic readonly data: T;\n\tpublic next: QueueElement<T> | null;\n\n\tconstructor(data: T) {\n\t\tthis.data = data;\n\t\tthis.next = null;\n\t}\n}\n\nclass Queue<T> {\n\n\tprivate _first: QueueElement<T> | null;\n\tprivate _last: QueueElement<T> | null;\n\n\tconstructor() {\n\t\tthis._first = null;\n\t\tthis._last = null;\n\t}\n\n\tpublic length(): number {\n\t\tlet result = 0;\n\t\tlet current = this._first;\n\t\twhile (current) {\n\t\t\tcurrent = current.next;\n\t\t\tresult++;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic peek(): T | null {\n\t\tif (!this._first) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this._first.data;\n\t}\n\n\tpublic toArray(): T[] {\n\t\tconst result: T[] = [];\n\t\tlet resultLen = 0;\n\t\tlet it = this._first;\n\t\twhile (it) {\n\t\t\tresult[resultLen++] = it.data;\n\t\t\tit = it.next;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic pop(): void {\n\t\tif (!this._first) {\n\t\t\treturn;\n\t\t}\n\t\tif (this._first === this._last) {\n\t\t\tthis._first = null;\n\t\t\tthis._last = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._first = this._first.next;\n\t}\n\n\tpublic push(item: T): void {\n\t\tconst element = new QueueElement(item);\n\t\tif (!this._first) {\n\t\t\tthis._first = element;\n\t\t\tthis._last = element;\n\t\t\treturn;\n\t\t}\n\t\tthis._last!.next = element;\n\t\tthis._last = element;\n\t}\n}\n\nclass LoadEstimator {\n\n\tprivate static _HISTORY_LENGTH = 10;\n\tprivate static _INSTANCE: LoadEstimator | null = null;\n\tpublic static getInstance(): LoadEstimator {\n\t\tif (!LoadEstimator._INSTANCE) {\n\t\t\tLoadEstimator._INSTANCE = new LoadEstimator();\n\t\t}\n\t\treturn LoadEstimator._INSTANCE;\n\t}\n\n\tprivate lastRuns: number[];\n\n\tconstructor() {\n\t\tthis.lastRuns = [];\n\t\tconst now = Date.now();\n\t\tfor (let i = 0; i < LoadEstimator._HISTORY_LENGTH; i++) {\n\t\t\tthis.lastRuns[i] = now - 1000 * i;\n\t\t}\n\t\tsetInterval(() => {\n\t\t\tfor (let i = LoadEstimator._HISTORY_LENGTH; i >= 1; i--) {\n\t\t\t\tthis.lastRuns[i] = this.lastRuns[i - 1];\n\t\t\t}\n\t\t\tthis.lastRuns[0] = Date.now();\n\t\t}, 1000);\n\t}\n\n\t/**\n\t * returns an estimative number, from 0 (low load) to 1 (high load)\n\t */\n\tprivate load(): number {\n\t\tconst now = Date.now();\n\t\tconst historyLimit = (1 + LoadEstimator._HISTORY_LENGTH) * 1000;\n\t\tlet score = 0;\n\t\tfor (let i = 0; i < LoadEstimator._HISTORY_LENGTH; i++) {\n\t\t\tif (now - this.lastRuns[i] <= historyLimit) {\n\t\t\t\tscore++;\n\t\t\t}\n\t\t}\n\t\treturn 1 - score / LoadEstimator._HISTORY_LENGTH;\n\t}\n\n\tpublic hasHighLoad(): boolean {\n\t\treturn this.load() >= 0.5;\n\t}\n}\n\nexport interface ILoadEstimator {\n\thasHighLoad(): boolean;\n}\n\nexport interface PersistentProtocolOptions {\n\t/**\n\t * The socket to use.\n\t */\n\tsocket: ISocket;\n\t/**\n\t * The initial chunk of data that has already been received from the socket.\n\t */\n\tinitialChunk?: VSBuffer | null;\n\t/**\n\t * The CPU load estimator to use.\n\t */\n\tloadEstimator?: ILoadEstimator;\n\t/**\n\t * Whether to send keep alive messages. Defaults to true.\n\t */\n\tsendKeepAlive?: boolean;\n}\n\n/**\n * Same as Protocol, but will actually track messages and acks.\n * Moreover, it will ensure no messages are lost if there are no event listeners.\n */\nexport class PersistentProtocol implements IMessagePassingProtocol {\n\n\tprivate _isReconnecting: boolean;\n\tprivate _didSendDisconnect?: boolean;\n\n\tprivate _outgoingUnackMsg: Queue<ProtocolMessage>;\n\tprivate _outgoingMsgId: number;\n\tprivate _outgoingAckId: number;\n\tprivate _outgoingAckTimeout: Timeout | null;\n\n\tprivate _incomingMsgId: number;\n\tprivate _incomingAckId: number;\n\tprivate _incomingMsgLastTime: number;\n\tprivate _incomingAckTimeout: Timeout | null;\n\n\tprivate _keepAliveInterval: Timeout | null;\n\n\tprivate _lastReplayRequestTime: number;\n\tprivate _lastSocketTimeoutTime: number;\n\n\tprivate _socket: ISocket;\n\tprivate _socketWriter: ProtocolWriter;\n\tprivate _socketReader: ProtocolReader;\n\t// eslint-disable-next-line local/code-no-potentially-unsafe-disposables\n\tprivate _socketDisposables: DisposableStore;\n\n\tprivate readonly _loadEstimator: ILoadEstimator;\n\tprivate readonly _shouldSendKeepAlive: boolean;\n\n\tprivate readonly _onControlMessage = new BufferedEmitter<VSBuffer>();\n\treadonly onControlMessage: Event<VSBuffer> = this._onControlMessage.event;\n\n\tprivate readonly _onMessage = new BufferedEmitter<VSBuffer>();\n\treadonly onMessage: Event<VSBuffer> = this._onMessage.event;\n\n\tprivate readonly _onDidDispose = new BufferedEmitter<void>();\n\treadonly onDidDispose: Event<void> = this._onDidDispose.event;\n\n\tprivate readonly _onSocketClose = new BufferedEmitter<SocketCloseEvent>();\n\treadonly onSocketClose: Event<SocketCloseEvent> = this._onSocketClose.event;\n\n\tprivate readonly _onSocketTimeout = new BufferedEmitter<SocketTimeoutEvent>();\n\treadonly onSocketTimeout: Event<SocketTimeoutEvent> = this._onSocketTimeout.event;\n\n\tpublic get unacknowledgedCount(): number {\n\t\treturn this._outgoingMsgId - this._outgoingAckId;\n\t}\n\n\tconstructor(opts: PersistentProtocolOptions) {\n\t\tthis._loadEstimator = opts.loadEstimator ?? LoadEstimator.getInstance();\n\t\tthis._shouldSendKeepAlive = opts.sendKeepAlive ?? true;\n\t\tthis._isReconnecting = false;\n\t\tthis._outgoingUnackMsg = new Queue<ProtocolMessage>();\n\t\tthis._outgoingMsgId = 0;\n\t\tthis._outgoingAckId = 0;\n\t\tthis._outgoingAckTimeout = null;\n\n\t\tthis._incomingMsgId = 0;\n\t\tthis._incomingAckId = 0;\n\t\tthis._incomingMsgLastTime = 0;\n\t\tthis._incomingAckTimeout = null;\n\n\t\tthis._lastReplayRequestTime = 0;\n\t\tthis._lastSocketTimeoutTime = Date.now();\n\n\t\tthis._socketDisposables = new DisposableStore();\n\t\tthis._socket = opts.socket;\n\t\tthis._socketWriter = this._socketDisposables.add(new ProtocolWriter(this._socket));\n\t\tthis._socketReader = this._socketDisposables.add(new ProtocolReader(this._socket));\n\t\tthis._socketDisposables.add(this._socketReader.onMessage(msg => this._receiveMessage(msg)));\n\t\tthis._socketDisposables.add(this._socket.onClose(e => this._onSocketClose.fire(e)));\n\n\t\tif (opts.initialChunk) {\n\t\t\tthis._socketReader.acceptChunk(opts.initialChunk);\n\t\t}\n\n\t\tif (this._shouldSendKeepAlive) {\n\t\t\tthis._keepAliveInterval = setInterval(() => {\n\t\t\t\tthis._sendKeepAlive();\n\t\t\t}, ProtocolConstants.KeepAliveSendTime);\n\t\t} else {\n\t\t\tthis._keepAliveInterval = null;\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tif (this._outgoingAckTimeout) {\n\t\t\tclearTimeout(this._outgoingAckTimeout);\n\t\t\tthis._outgoingAckTimeout = null;\n\t\t}\n\t\tif (this._incomingAckTimeout) {\n\t\t\tclearTimeout(this._incomingAckTimeout);\n\t\t\tthis._incomingAckTimeout = null;\n\t\t}\n\t\tif (this._keepAliveInterval) {\n\t\t\tclearInterval(this._keepAliveInterval);\n\t\t\tthis._keepAliveInterval = null;\n\t\t}\n\t\tthis._socketDisposables.dispose();\n\t}\n\n\tdrain(): Promise<void> {\n\t\treturn this._socketWriter.drain();\n\t}\n\n\tsendDisconnect(): void {\n\t\tif (!this._didSendDisconnect) {\n\t\t\tthis._didSendDisconnect = true;\n\t\t\tconst msg = new ProtocolMessage(ProtocolMessageType.Disconnect, 0, 0, getEmptyBuffer());\n\t\t\tthis._socketWriter.write(msg);\n\t\t\tthis._socketWriter.flush();\n\t\t}\n\t}\n\n\tsendPause(): void {\n\t\tconst msg = new ProtocolMessage(ProtocolMessageType.Pause, 0, 0, getEmptyBuffer());\n\t\tthis._socketWriter.write(msg);\n\t}\n\n\tsendResume(): void {\n\t\tconst msg = new ProtocolMessage(ProtocolMessageType.Resume, 0, 0, getEmptyBuffer());\n\t\tthis._socketWriter.write(msg);\n\t}\n\n\tpauseSocketWriting() {\n\t\tthis._socketWriter.pause();\n\t}\n\n\tpublic getSocket(): ISocket {\n\t\treturn this._socket;\n\t}\n\n\tpublic getMillisSinceLastIncomingData(): number {\n\t\treturn Date.now() - this._socketReader.lastReadTime;\n\t}\n\n\tpublic beginAcceptReconnection(socket: ISocket, initialDataChunk: VSBuffer | null): void {\n\t\tthis._isReconnecting = true;\n\n\t\tthis._socketDisposables.dispose();\n\t\tthis._socketDisposables = new DisposableStore();\n\t\tthis._onControlMessage.flushBuffer();\n\t\tthis._onSocketClose.flushBuffer();\n\t\tthis._onSocketTimeout.flushBuffer();\n\t\tthis._socket.dispose();\n\n\t\tthis._lastReplayRequestTime = 0;\n\t\tthis._lastSocketTimeoutTime = Date.now();\n\n\t\tthis._socket = socket;\n\t\tthis._socketWriter = this._socketDisposables.add(new ProtocolWriter(this._socket));\n\t\tthis._socketReader = this._socketDisposables.add(new ProtocolReader(this._socket));\n\t\tthis._socketDisposables.add(this._socketReader.onMessage(msg => this._receiveMessage(msg)));\n\t\tthis._socketDisposables.add(this._socket.onClose(e => this._onSocketClose.fire(e)));\n\n\t\tthis._socketReader.acceptChunk(initialDataChunk);\n\t}\n\n\tpublic endAcceptReconnection(): void {\n\t\tthis._isReconnecting = false;\n\n\t\t// After a reconnection, let the other party know (again) which messages have been received.\n\t\t// (perhaps the other party didn't receive a previous ACK)\n\t\tthis._incomingAckId = this._incomingMsgId;\n\t\tconst msg = new ProtocolMessage(ProtocolMessageType.Ack, 0, this._incomingAckId, getEmptyBuffer());\n\t\tthis._socketWriter.write(msg);\n\n\t\t// Send again all unacknowledged messages\n\t\tconst toSend = this._outgoingUnackMsg.toArray();\n\t\tfor (let i = 0, len = toSend.length; i < len; i++) {\n\t\t\tthis._socketWriter.write(toSend[i]);\n\t\t}\n\t\tthis._recvAckCheck();\n\t}\n\n\tpublic acceptDisconnect(): void {\n\t\tthis._onDidDispose.fire();\n\t}\n\n\tprivate _receiveMessage(msg: ProtocolMessage): void {\n\t\tif (msg.ack > this._outgoingAckId) {\n\t\t\tthis._outgoingAckId = msg.ack;\n\t\t\tdo {\n\t\t\t\tconst first = this._outgoingUnackMsg.peek();\n\t\t\t\tif (first && first.id <= msg.ack) {\n\t\t\t\t\t// this message has been confirmed, remove it\n\t\t\t\t\tthis._outgoingUnackMsg.pop();\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} while (true);\n\t\t}\n\n\t\tswitch (msg.type) {\n\t\t\tcase ProtocolMessageType.None: {\n\t\t\t\t// N/A\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ProtocolMessageType.Regular: {\n\t\t\t\tif (msg.id > this._incomingMsgId) {\n\t\t\t\t\tif (msg.id !== this._incomingMsgId + 1) {\n\t\t\t\t\t\t// in case we missed some messages we ask the other party to resend them\n\t\t\t\t\t\tconst now = Date.now();\n\t\t\t\t\t\tif (now - this._lastReplayRequestTime > 10000) {\n\t\t\t\t\t\t\t// send a replay request at most once every 10s\n\t\t\t\t\t\t\tthis._lastReplayRequestTime = now;\n\t\t\t\t\t\t\tthis._socketWriter.write(new ProtocolMessage(ProtocolMessageType.ReplayRequest, 0, 0, getEmptyBuffer()));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._incomingMsgId = msg.id;\n\t\t\t\t\t\tthis._incomingMsgLastTime = Date.now();\n\t\t\t\t\t\tthis._sendAckCheck();\n\t\t\t\t\t\tthis._onMessage.fire(msg.data);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ProtocolMessageType.Control: {\n\t\t\t\tthis._onControlMessage.fire(msg.data);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ProtocolMessageType.Ack: {\n\t\t\t\t// nothing to do, .ack is handled above already\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ProtocolMessageType.Disconnect: {\n\t\t\t\tthis._onDidDispose.fire();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ProtocolMessageType.ReplayRequest: {\n\t\t\t\t// Send again all unacknowledged messages\n\t\t\t\tconst toSend = this._outgoingUnackMsg.toArray();\n\t\t\t\tfor (let i = 0, len = toSend.length; i < len; i++) {\n\t\t\t\t\tthis._socketWriter.write(toSend[i]);\n\t\t\t\t}\n\t\t\t\tthis._recvAckCheck();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ProtocolMessageType.Pause: {\n\t\t\t\tthis._socketWriter.pause();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ProtocolMessageType.Resume: {\n\t\t\t\tthis._socketWriter.resume();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ProtocolMessageType.KeepAlive: {\n\t\t\t\t// nothing to do\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treadEntireBuffer(): VSBuffer {\n\t\treturn this._socketReader.readEntireBuffer();\n\t}\n\n\tflush(): void {\n\t\tthis._socketWriter.flush();\n\t}\n\n\tsend(buffer: VSBuffer): void {\n\t\tconst myId = ++this._outgoingMsgId;\n\t\tthis._incomingAckId = this._incomingMsgId;\n\t\tconst msg = new ProtocolMessage(ProtocolMessageType.Regular, myId, this._incomingAckId, buffer);\n\t\tthis._outgoingUnackMsg.push(msg);\n\t\tif (!this._isReconnecting) {\n\t\t\tthis._socketWriter.write(msg);\n\t\t\tthis._recvAckCheck();\n\t\t}\n\t}\n\n\t/**\n\t * Send a message which will not be part of the regular acknowledge flow.\n\t * Use this for early control messages which are repeated in case of reconnection.\n\t */\n\tsendControl(buffer: VSBuffer): void {\n\t\tconst msg = new ProtocolMessage(ProtocolMessageType.Control, 0, 0, buffer);\n\t\tthis._socketWriter.write(msg);\n\t}\n\n\tprivate _sendAckCheck(): void {\n\t\tif (this._incomingMsgId <= this._incomingAckId) {\n\t\t\t// nothink to acknowledge\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._incomingAckTimeout) {\n\t\t\t// there will be a check in the near future\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeSinceLastIncomingMsg = Date.now() - this._incomingMsgLastTime;\n\t\tif (timeSinceLastIncomingMsg >= ProtocolConstants.AcknowledgeTime) {\n\t\t\t// sufficient time has passed since this message has been received,\n\t\t\t// and no message from our side needed to be sent in the meantime,\n\t\t\t// so we will send a message containing only an ack.\n\t\t\tthis._sendAck();\n\t\t\treturn;\n\t\t}\n\n\t\tthis._incomingAckTimeout = setTimeout(() => {\n\t\t\tthis._incomingAckTimeout = null;\n\t\t\tthis._sendAckCheck();\n\t\t}, ProtocolConstants.AcknowledgeTime - timeSinceLastIncomingMsg + 5);\n\t}\n\n\tprivate _recvAckCheck(): void {\n\t\tif (this._outgoingMsgId <= this._outgoingAckId) {\n\t\t\t// everything has been acknowledged\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._outgoingAckTimeout) {\n\t\t\t// there will be a check in the near future\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._isReconnecting) {\n\t\t\t// do not cause a timeout during reconnection,\n\t\t\t// because messages will not be actually written until `endAcceptReconnection`\n\t\t\treturn;\n\t\t}\n\n\t\tconst oldestUnacknowledgedMsg = this._outgoingUnackMsg.peek()!;\n\t\tconst timeSinceOldestUnacknowledgedMsg = Date.now() - oldestUnacknowledgedMsg.writtenTime;\n\t\tconst timeSinceLastReceivedSomeData = Date.now() - this._socketReader.lastReadTime;\n\t\tconst timeSinceLastTimeout = Date.now() - this._lastSocketTimeoutTime;\n\n\t\tif (\n\t\t\ttimeSinceOldestUnacknowledgedMsg >= ProtocolConstants.TimeoutTime\n\t\t\t&& timeSinceLastReceivedSomeData >= ProtocolConstants.TimeoutTime\n\t\t\t&& timeSinceLastTimeout >= ProtocolConstants.TimeoutTime\n\t\t) {\n\t\t\t// It's been a long time since our sent message was acknowledged\n\t\t\t// and a long time since we received some data\n\n\t\t\t// But this might be caused by the event loop being busy and failing to read messages\n\t\t\tif (!this._loadEstimator.hasHighLoad()) {\n\t\t\t\t// Trash the socket\n\t\t\t\tthis._lastSocketTimeoutTime = Date.now();\n\t\t\t\tthis._onSocketTimeout.fire({\n\t\t\t\t\tunacknowledgedMsgCount: this._outgoingUnackMsg.length(),\n\t\t\t\t\ttimeSinceOldestUnacknowledgedMsg,\n\t\t\t\t\ttimeSinceLastReceivedSomeData\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst minimumTimeUntilTimeout = Math.max(\n\t\t\tProtocolConstants.TimeoutTime - timeSinceOldestUnacknowledgedMsg,\n\t\t\tProtocolConstants.TimeoutTime - timeSinceLastReceivedSomeData,\n\t\t\tProtocolConstants.TimeoutTime - timeSinceLastTimeout,\n\t\t\t500\n\t\t);\n\n\t\tthis._outgoingAckTimeout = setTimeout(() => {\n\t\t\tthis._outgoingAckTimeout = null;\n\t\t\tthis._recvAckCheck();\n\t\t}, minimumTimeUntilTimeout);\n\t}\n\n\tprivate _sendAck(): void {\n\t\tif (this._incomingMsgId <= this._incomingAckId) {\n\t\t\t// nothink to acknowledge\n\t\t\treturn;\n\t\t}\n\n\t\tthis._incomingAckId = this._incomingMsgId;\n\t\tconst msg = new ProtocolMessage(ProtocolMessageType.Ack, 0, this._incomingAckId, getEmptyBuffer());\n\t\tthis._socketWriter.write(msg);\n\t}\n\n\tprivate _sendKeepAlive(): void {\n\t\tthis._incomingAckId = this._incomingMsgId;\n\t\tconst msg = new ProtocolMessage(ProtocolMessageType.KeepAlive, 0, this._incomingAckId, getEmptyBuffer());\n\t\tthis._socketWriter.write(msg);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createHash } from 'crypto';\nimport { Server as NetServer, Socket, createServer, createConnection } from 'net';\nimport { tmpdir } from 'os';\nimport { createDeflateRaw, ZlibOptions, InflateRaw, DeflateRaw, createInflateRaw } from 'zlib';\nimport { VSBuffer } from '../../../common/buffer.js';\nimport { onUnexpectedError } from '../../../common/errors.js';\nimport { Emitter, Event } from '../../../common/event.js';\nimport { Disposable, IDisposable } from '../../../common/lifecycle.js';\nimport { join } from '../../../common/path.js';\nimport { Platform, platform } from '../../../common/platform.js';\nimport { generateUuid } from '../../../common/uuid.js';\nimport { ClientConnectionEvent, IPCServer } from '../common/ipc.js';\nimport { ChunkStream, Client, ISocket, Protocol, SocketCloseEvent, SocketCloseEventType, SocketDiagnostics, SocketDiagnosticsEventType } from '../common/ipc.net.js';\n\n/**\n * Maximum time to wait for a 'close' event to fire after the socket stream\n * ends. For unix domain sockets, the close event may not fire consistently\n * due to what appears to be a Node.js bug.\n *\n * @see https://github.com/microsoft/vscode/issues/211462#issuecomment-2155471996\n */\nconst socketEndTimeoutMs = 30_000;\n\nexport class NodeSocket implements ISocket {\n\n\tpublic readonly debugLabel: string;\n\tpublic readonly socket: Socket;\n\tprivate readonly _errorListener: (err: any) => void;\n\tprivate readonly _closeListener: (hadError: boolean) => void;\n\tprivate readonly _endListener: () => void;\n\tprivate _canWrite = true;\n\n\tpublic traceSocketEvent(type: SocketDiagnosticsEventType, data?: VSBuffer | Uint8Array | ArrayBuffer | ArrayBufferView | any): void {\n\t\tSocketDiagnostics.traceSocketEvent(this.socket, this.debugLabel, type, data);\n\t}\n\n\tconstructor(socket: Socket, debugLabel: string = '') {\n\t\tthis.debugLabel = debugLabel;\n\t\tthis.socket = socket;\n\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.Created, { type: 'NodeSocket' });\n\t\tthis._errorListener = (err: any) => {\n\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.Error, { code: err?.code, message: err?.message });\n\t\t\tif (err) {\n\t\t\t\tif (err.code === 'EPIPE') {\n\t\t\t\t\t// An EPIPE exception at the wrong time can lead to a renderer process crash\n\t\t\t\t\t// so ignore the error since the socket will fire the close event soon anyways:\n\t\t\t\t\t// > https://nodejs.org/api/errors.html#errors_common_system_errors\n\t\t\t\t\t// > EPIPE (Broken pipe): A write on a pipe, socket, or FIFO for which there is no\n\t\t\t\t\t// > process to read the data. Commonly encountered at the net and http layers,\n\t\t\t\t\t// > indicative that the remote side of the stream being written to has been closed.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonUnexpectedError(err);\n\t\t\t}\n\t\t};\n\t\tthis.socket.on('error', this._errorListener);\n\n\t\tlet endTimeoutHandle: Timeout | undefined;\n\t\tthis._closeListener = (hadError: boolean) => {\n\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.Close, { hadError });\n\t\t\tthis._canWrite = false;\n\t\t\tif (endTimeoutHandle) {\n\t\t\t\tclearTimeout(endTimeoutHandle);\n\t\t\t}\n\t\t};\n\t\tthis.socket.on('close', this._closeListener);\n\n\t\tthis._endListener = () => {\n\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.NodeEndReceived);\n\t\t\tthis._canWrite = false;\n\t\t\tendTimeoutHandle = setTimeout(() => socket.destroy(), socketEndTimeoutMs);\n\t\t};\n\t\tthis.socket.on('end', this._endListener);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.socket.off('error', this._errorListener);\n\t\tthis.socket.off('close', this._closeListener);\n\t\tthis.socket.off('end', this._endListener);\n\t\tthis.socket.destroy();\n\t}\n\n\tpublic onData(_listener: (e: VSBuffer) => void): IDisposable {\n\t\tconst listener = (buff: Buffer) => {\n\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.Read, buff);\n\t\t\t_listener(VSBuffer.wrap(buff));\n\t\t};\n\t\tthis.socket.on('data', listener);\n\t\treturn {\n\t\t\tdispose: () => this.socket.off('data', listener)\n\t\t};\n\t}\n\n\tpublic onClose(listener: (e: SocketCloseEvent) => void): IDisposable {\n\t\tconst adapter = (hadError: boolean) => {\n\t\t\tlistener({\n\t\t\t\ttype: SocketCloseEventType.NodeSocketCloseEvent,\n\t\t\t\thadError: hadError,\n\t\t\t\terror: undefined\n\t\t\t});\n\t\t};\n\t\tthis.socket.on('close', adapter);\n\t\treturn {\n\t\t\tdispose: () => this.socket.off('close', adapter)\n\t\t};\n\t}\n\n\tpublic onEnd(listener: () => void): IDisposable {\n\t\tconst adapter = () => {\n\t\t\tlistener();\n\t\t};\n\t\tthis.socket.on('end', adapter);\n\t\treturn {\n\t\t\tdispose: () => this.socket.off('end', adapter)\n\t\t};\n\t}\n\n\tpublic write(buffer: VSBuffer): void {\n\t\t// return early if socket has been destroyed in the meantime\n\t\tif (this.socket.destroyed || !this._canWrite) {\n\t\t\treturn;\n\t\t}\n\n\t\t// we ignore the returned value from `write` because we would have to cached the data\n\t\t// anyways and nodejs is already doing that for us:\n\t\t// > https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback\n\t\t// > However, the false return value is only advisory and the writable stream will unconditionally\n\t\t// > accept and buffer chunk even if it has not been allowed to drain.\n\t\ttry {\n\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.Write, buffer);\n\t\t\tthis.socket.write(buffer.buffer, (err: any) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tif (err.code === 'EPIPE') {\n\t\t\t\t\t\t// An EPIPE exception at the wrong time can lead to a renderer process crash\n\t\t\t\t\t\t// so ignore the error since the socket will fire the close event soon anyways:\n\t\t\t\t\t\t// > https://nodejs.org/api/errors.html#errors_common_system_errors\n\t\t\t\t\t\t// > EPIPE (Broken pipe): A write on a pipe, socket, or FIFO for which there is no\n\t\t\t\t\t\t// > process to read the data. Commonly encountered at the net and http layers,\n\t\t\t\t\t\t// > indicative that the remote side of the stream being written to has been closed.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tonUnexpectedError(err);\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tif (err.code === 'EPIPE') {\n\t\t\t\t// An EPIPE exception at the wrong time can lead to a renderer process crash\n\t\t\t\t// so ignore the error since the socket will fire the close event soon anyways:\n\t\t\t\t// > https://nodejs.org/api/errors.html#errors_common_system_errors\n\t\t\t\t// > EPIPE (Broken pipe): A write on a pipe, socket, or FIFO for which there is no\n\t\t\t\t// > process to read the data. Commonly encountered at the net and http layers,\n\t\t\t\t// > indicative that the remote side of the stream being written to has been closed.\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonUnexpectedError(err);\n\t\t}\n\t}\n\n\tpublic end(): void {\n\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.NodeEndSent);\n\t\tthis.socket.end();\n\t}\n\n\tpublic drain(): Promise<void> {\n\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.NodeDrainBegin);\n\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\tif (this.socket.bufferSize === 0) {\n\t\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.NodeDrainEnd);\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst finished = () => {\n\t\t\t\tthis.socket.off('close', finished);\n\t\t\t\tthis.socket.off('end', finished);\n\t\t\t\tthis.socket.off('error', finished);\n\t\t\t\tthis.socket.off('timeout', finished);\n\t\t\t\tthis.socket.off('drain', finished);\n\t\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.NodeDrainEnd);\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\tthis.socket.on('close', finished);\n\t\t\tthis.socket.on('end', finished);\n\t\t\tthis.socket.on('error', finished);\n\t\t\tthis.socket.on('timeout', finished);\n\t\t\tthis.socket.on('drain', finished);\n\t\t});\n\t}\n}\n\nconst enum Constants {\n\tMinHeaderByteSize = 2,\n\t/**\n\t * If we need to write a large buffer, we will split it into 256KB chunks and\n\t * send each chunk as a websocket message. This is to prevent that the sending\n\t * side is stuck waiting for the entire buffer to be compressed before writing\n\t * to the underlying socket or that the receiving side is stuck waiting for the\n\t * entire message to be received before processing the bytes.\n\t */\n\tMaxWebSocketMessageLength = 256 * 1024 // 256 KB\n}\n\nconst enum ReadState {\n\tPeekHeader = 1,\n\tReadHeader = 2,\n\tReadBody = 3,\n\tFin = 4\n}\n\ninterface ISocketTracer {\n\ttraceSocketEvent(type: SocketDiagnosticsEventType, data?: VSBuffer | Uint8Array | ArrayBuffer | ArrayBufferView | any): void;\n}\n\ninterface FrameOptions {\n\tcompressed: boolean;\n\topcode: number;\n}\n\n/**\n * See https://tools.ietf.org/html/rfc6455#section-5.2\n */\nexport class WebSocketNodeSocket extends Disposable implements ISocket, ISocketTracer {\n\n\tpublic readonly socket: NodeSocket;\n\tprivate readonly _flowManager: WebSocketFlowManager;\n\tprivate readonly _incomingData: ChunkStream;\n\tprivate readonly _onData = this._register(new Emitter<VSBuffer>());\n\tprivate readonly _onClose = this._register(new Emitter<SocketCloseEvent>());\n\tprivate _isEnded: boolean = false;\n\n\tprivate readonly _state = {\n\t\tstate: ReadState.PeekHeader,\n\t\treadLen: Constants.MinHeaderByteSize,\n\t\tfin: 0,\n\t\tcompressed: false,\n\t\tfirstFrameOfMessage: true,\n\t\tmask: 0,\n\t\topcode: 0\n\t};\n\n\tpublic get permessageDeflate(): boolean {\n\t\treturn this._flowManager.permessageDeflate;\n\t}\n\n\tpublic get recordedInflateBytes(): VSBuffer {\n\t\treturn this._flowManager.recordedInflateBytes;\n\t}\n\n\tpublic traceSocketEvent(type: SocketDiagnosticsEventType, data?: VSBuffer | Uint8Array | ArrayBuffer | ArrayBufferView | any): void {\n\t\tthis.socket.traceSocketEvent(type, data);\n\t}\n\n\t/**\n\t * Create a socket which can communicate using WebSocket frames.\n\t *\n\t * **NOTE**: When using the permessage-deflate WebSocket extension, if parts of inflating was done\n\t *  in a different zlib instance, we need to pass all those bytes into zlib, otherwise the inflate\n\t *  might hit an inflated portion referencing a distance too far back.\n\t *\n\t * @param socket The underlying socket\n\t * @param permessageDeflate Use the permessage-deflate WebSocket extension\n\t * @param inflateBytes \"Seed\" zlib inflate with these bytes.\n\t * @param recordInflateBytes Record all bytes sent to inflate\n\t */\n\tconstructor(socket: NodeSocket, permessageDeflate: boolean, inflateBytes: VSBuffer | null, recordInflateBytes: boolean) {\n\t\tsuper();\n\t\tthis.socket = socket;\n\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.Created, { type: 'WebSocketNodeSocket', permessageDeflate, inflateBytesLength: inflateBytes?.byteLength || 0, recordInflateBytes });\n\t\tthis._flowManager = this._register(new WebSocketFlowManager(\n\t\t\tthis,\n\t\t\tpermessageDeflate,\n\t\t\tinflateBytes,\n\t\t\trecordInflateBytes,\n\t\t\tthis._onData,\n\t\t\t(data, options) => this._write(data, options)\n\t\t));\n\t\tthis._register(this._flowManager.onError((err) => {\n\t\t\t// zlib errors are fatal, since we have no idea how to recover\n\t\t\tconsole.error(err);\n\t\t\tonUnexpectedError(err);\n\t\t\tthis._onClose.fire({\n\t\t\t\ttype: SocketCloseEventType.NodeSocketCloseEvent,\n\t\t\t\thadError: true,\n\t\t\t\terror: err\n\t\t\t});\n\t\t}));\n\t\tthis._incomingData = new ChunkStream();\n\t\tthis._register(this.socket.onData(data => this._acceptChunk(data)));\n\t\tthis._register(this.socket.onClose(async (e) => {\n\t\t\t// Delay surfacing the close event until the async inflating is done\n\t\t\t// and all data has been emitted\n\t\t\tif (this._flowManager.isProcessingReadQueue()) {\n\t\t\t\tawait Event.toPromise(this._flowManager.onDidFinishProcessingReadQueue);\n\t\t\t}\n\t\t\tthis._onClose.fire(e);\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._flowManager.isProcessingWriteQueue()) {\n\t\t\t// Wait for any outstanding writes to finish before disposing\n\t\t\tthis._register(this._flowManager.onDidFinishProcessingWriteQueue(() => {\n\t\t\t\tthis.dispose();\n\t\t\t}));\n\t\t} else {\n\t\t\tthis.socket.dispose();\n\t\t\tsuper.dispose();\n\t\t}\n\t}\n\n\tpublic onData(listener: (e: VSBuffer) => void): IDisposable {\n\t\treturn this._onData.event(listener);\n\t}\n\n\tpublic onClose(listener: (e: SocketCloseEvent) => void): IDisposable {\n\t\treturn this._onClose.event(listener);\n\t}\n\n\tpublic onEnd(listener: () => void): IDisposable {\n\t\treturn this.socket.onEnd(listener);\n\t}\n\n\tpublic write(buffer: VSBuffer): void {\n\t\t// If we write many logical messages (let's say 1000 messages of 100KB) during a single process tick, we do\n\t\t// this thing where we install a process.nextTick timer and group all of them together and we then issue a\n\t\t// single WebSocketNodeSocket.write with a 100MB buffer.\n\t\t//\n\t\t// The first problem is that the actual writing to the underlying node socket will only happen after all of\n\t\t// the 100MB have been deflated (due to waiting on zlib flush). The second problem is on the reading side,\n\t\t// where we will get a single WebSocketNodeSocket.onData event fired when all the 100MB have arrived,\n\t\t// delaying processing the 1000 received messages until all have arrived, instead of processing them as each\n\t\t// one arrives.\n\t\t//\n\t\t// We therefore split the buffer into chunks, and issue a write for each chunk.\n\n\t\tlet start = 0;\n\t\twhile (start < buffer.byteLength) {\n\t\t\tthis._flowManager.writeMessage(buffer.slice(start, Math.min(start + Constants.MaxWebSocketMessageLength, buffer.byteLength)), { compressed: true, opcode: 0x02 /* Binary frame */ });\n\t\t\tstart += Constants.MaxWebSocketMessageLength;\n\t\t}\n\t}\n\n\tprivate _write(buffer: VSBuffer, { compressed, opcode }: FrameOptions): void {\n\t\tif (this._isEnded) {\n\t\t\t// Avoid ERR_STREAM_WRITE_AFTER_END\n\t\t\treturn;\n\t\t}\n\n\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.WebSocketNodeSocketWrite, buffer);\n\t\tlet headerLen = Constants.MinHeaderByteSize;\n\t\tif (buffer.byteLength < 126) {\n\t\t\theaderLen += 0;\n\t\t} else if (buffer.byteLength < 2 ** 16) {\n\t\t\theaderLen += 2;\n\t\t} else {\n\t\t\theaderLen += 8;\n\t\t}\n\t\tconst header = VSBuffer.alloc(headerLen);\n\n\t\t// The RSV1 bit indicates a compressed frame\n\t\tconst compressedFlag = compressed ? 0b01000000 : 0;\n\t\tconst opcodeFlag = opcode & 0b00001111;\n\t\theader.writeUInt8(0b10000000 | compressedFlag | opcodeFlag, 0);\n\t\tif (buffer.byteLength < 126) {\n\t\t\theader.writeUInt8(buffer.byteLength, 1);\n\t\t} else if (buffer.byteLength < 2 ** 16) {\n\t\t\theader.writeUInt8(126, 1);\n\t\t\tlet offset = 1;\n\t\t\theader.writeUInt8((buffer.byteLength >>> 8) & 0b11111111, ++offset);\n\t\t\theader.writeUInt8((buffer.byteLength >>> 0) & 0b11111111, ++offset);\n\t\t} else {\n\t\t\theader.writeUInt8(127, 1);\n\t\t\tlet offset = 1;\n\t\t\theader.writeUInt8(0, ++offset);\n\t\t\theader.writeUInt8(0, ++offset);\n\t\t\theader.writeUInt8(0, ++offset);\n\t\t\theader.writeUInt8(0, ++offset);\n\t\t\theader.writeUInt8((buffer.byteLength >>> 24) & 0b11111111, ++offset);\n\t\t\theader.writeUInt8((buffer.byteLength >>> 16) & 0b11111111, ++offset);\n\t\t\theader.writeUInt8((buffer.byteLength >>> 8) & 0b11111111, ++offset);\n\t\t\theader.writeUInt8((buffer.byteLength >>> 0) & 0b11111111, ++offset);\n\t\t}\n\n\t\tthis.socket.write(VSBuffer.concat([header, buffer]));\n\t}\n\n\tpublic end(): void {\n\t\tthis._isEnded = true;\n\t\tthis.socket.end();\n\t}\n\n\tprivate _acceptChunk(data: VSBuffer): void {\n\t\tif (data.byteLength === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._incomingData.acceptChunk(data);\n\n\t\twhile (this._incomingData.byteLength >= this._state.readLen) {\n\n\t\t\tif (this._state.state === ReadState.PeekHeader) {\n\t\t\t\t// peek to see if we can read the entire header\n\t\t\t\tconst peekHeader = this._incomingData.peek(this._state.readLen);\n\t\t\t\tconst firstByte = peekHeader.readUInt8(0);\n\t\t\t\tconst finBit = (firstByte & 0b10000000) >>> 7;\n\t\t\t\tconst rsv1Bit = (firstByte & 0b01000000) >>> 6;\n\t\t\t\tconst opcode = (firstByte & 0b00001111);\n\n\t\t\t\tconst secondByte = peekHeader.readUInt8(1);\n\t\t\t\tconst hasMask = (secondByte & 0b10000000) >>> 7;\n\t\t\t\tconst len = (secondByte & 0b01111111);\n\n\t\t\t\tthis._state.state = ReadState.ReadHeader;\n\t\t\t\tthis._state.readLen = Constants.MinHeaderByteSize + (hasMask ? 4 : 0) + (len === 126 ? 2 : 0) + (len === 127 ? 8 : 0);\n\t\t\t\tthis._state.fin = finBit;\n\t\t\t\tif (this._state.firstFrameOfMessage) {\n\t\t\t\t\t// if the frame is compressed, the RSV1 bit is set only for the first frame of the message\n\t\t\t\t\tthis._state.compressed = Boolean(rsv1Bit);\n\t\t\t\t}\n\t\t\t\tthis._state.firstFrameOfMessage = Boolean(finBit);\n\t\t\t\tthis._state.mask = 0;\n\t\t\t\tthis._state.opcode = opcode;\n\n\t\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.WebSocketNodeSocketPeekedHeader, { headerSize: this._state.readLen, compressed: this._state.compressed, fin: this._state.fin, opcode: this._state.opcode });\n\n\t\t\t} else if (this._state.state === ReadState.ReadHeader) {\n\t\t\t\t// read entire header\n\t\t\t\tconst header = this._incomingData.read(this._state.readLen);\n\t\t\t\tconst secondByte = header.readUInt8(1);\n\t\t\t\tconst hasMask = (secondByte & 0b10000000) >>> 7;\n\t\t\t\tlet len = (secondByte & 0b01111111);\n\n\t\t\t\tlet offset = 1;\n\t\t\t\tif (len === 126) {\n\t\t\t\t\tlen = (\n\t\t\t\t\t\theader.readUInt8(++offset) * 2 ** 8\n\t\t\t\t\t\t+ header.readUInt8(++offset)\n\t\t\t\t\t);\n\t\t\t\t} else if (len === 127) {\n\t\t\t\t\tlen = (\n\t\t\t\t\t\theader.readUInt8(++offset) * 0\n\t\t\t\t\t\t+ header.readUInt8(++offset) * 0\n\t\t\t\t\t\t+ header.readUInt8(++offset) * 0\n\t\t\t\t\t\t+ header.readUInt8(++offset) * 0\n\t\t\t\t\t\t+ header.readUInt8(++offset) * 2 ** 24\n\t\t\t\t\t\t+ header.readUInt8(++offset) * 2 ** 16\n\t\t\t\t\t\t+ header.readUInt8(++offset) * 2 ** 8\n\t\t\t\t\t\t+ header.readUInt8(++offset)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlet mask = 0;\n\t\t\t\tif (hasMask) {\n\t\t\t\t\tmask = (\n\t\t\t\t\t\theader.readUInt8(++offset) * 2 ** 24\n\t\t\t\t\t\t+ header.readUInt8(++offset) * 2 ** 16\n\t\t\t\t\t\t+ header.readUInt8(++offset) * 2 ** 8\n\t\t\t\t\t\t+ header.readUInt8(++offset)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis._state.state = ReadState.ReadBody;\n\t\t\t\tthis._state.readLen = len;\n\t\t\t\tthis._state.mask = mask;\n\n\t\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.WebSocketNodeSocketPeekedHeader, { bodySize: this._state.readLen, compressed: this._state.compressed, fin: this._state.fin, mask: this._state.mask, opcode: this._state.opcode });\n\n\t\t\t} else if (this._state.state === ReadState.ReadBody) {\n\t\t\t\t// read body\n\n\t\t\t\tconst body = this._incomingData.read(this._state.readLen);\n\t\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.WebSocketNodeSocketReadData, body);\n\n\t\t\t\tunmask(body, this._state.mask);\n\t\t\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.WebSocketNodeSocketUnmaskedData, body);\n\n\t\t\t\tthis._state.state = ReadState.PeekHeader;\n\t\t\t\tthis._state.readLen = Constants.MinHeaderByteSize;\n\t\t\t\tthis._state.mask = 0;\n\n\t\t\t\tif (this._state.opcode <= 0x02 /* Continuation frame or Text frame or binary frame */) {\n\t\t\t\t\tthis._flowManager.acceptFrame(body, this._state.compressed, !!this._state.fin);\n\t\t\t\t} else if (this._state.opcode === 0x09 /* Ping frame */) {\n\t\t\t\t\t// Ping frames could be send by some browsers e.g. Firefox\n\t\t\t\t\tthis._flowManager.writeMessage(body, { compressed: false, opcode: 0x0A /* Pong frame */ });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async drain(): Promise<void> {\n\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.WebSocketNodeSocketDrainBegin);\n\t\tif (this._flowManager.isProcessingWriteQueue()) {\n\t\t\tawait Event.toPromise(this._flowManager.onDidFinishProcessingWriteQueue);\n\t\t}\n\t\tawait this.socket.drain();\n\t\tthis.traceSocketEvent(SocketDiagnosticsEventType.WebSocketNodeSocketDrainEnd);\n\t}\n}\n\nclass WebSocketFlowManager extends Disposable {\n\n\tprivate readonly _onError = this._register(new Emitter<Error>());\n\tpublic readonly onError = this._onError.event;\n\n\tprivate readonly _zlibInflateStream: ZlibInflateStream | null;\n\tprivate readonly _zlibDeflateStream: ZlibDeflateStream | null;\n\tprivate readonly _writeQueue: { data: VSBuffer; options: FrameOptions }[] = [];\n\tprivate readonly _readQueue: { data: VSBuffer; isCompressed: boolean; isLastFrameOfMessage: boolean }[] = [];\n\n\tprivate readonly _onDidFinishProcessingReadQueue = this._register(new Emitter<void>());\n\tpublic readonly onDidFinishProcessingReadQueue = this._onDidFinishProcessingReadQueue.event;\n\n\tprivate readonly _onDidFinishProcessingWriteQueue = this._register(new Emitter<void>());\n\tpublic readonly onDidFinishProcessingWriteQueue = this._onDidFinishProcessingWriteQueue.event;\n\n\tpublic get permessageDeflate(): boolean {\n\t\treturn Boolean(this._zlibInflateStream && this._zlibDeflateStream);\n\t}\n\n\tpublic get recordedInflateBytes(): VSBuffer {\n\t\tif (this._zlibInflateStream) {\n\t\t\treturn this._zlibInflateStream.recordedInflateBytes;\n\t\t}\n\t\treturn VSBuffer.alloc(0);\n\t}\n\n\tconstructor(\n\t\tprivate readonly _tracer: ISocketTracer,\n\t\tpermessageDeflate: boolean,\n\t\tinflateBytes: VSBuffer | null,\n\t\trecordInflateBytes: boolean,\n\t\tprivate readonly _onData: Emitter<VSBuffer>,\n\t\tprivate readonly _writeFn: (data: VSBuffer, options: FrameOptions) => void\n\t) {\n\t\tsuper();\n\t\tif (permessageDeflate) {\n\t\t\t// See https://tools.ietf.org/html/rfc7692#page-16\n\t\t\t// To simplify our logic, we don't negotiate the window size\n\t\t\t// and simply dedicate (2^15) / 32kb per web socket\n\t\t\tthis._zlibInflateStream = this._register(new ZlibInflateStream(this._tracer, recordInflateBytes, inflateBytes, { windowBits: 15 }));\n\t\t\tthis._zlibDeflateStream = this._register(new ZlibDeflateStream(this._tracer, { windowBits: 15 }));\n\t\t\tthis._register(this._zlibInflateStream.onError((err) => this._onError.fire(err)));\n\t\t\tthis._register(this._zlibDeflateStream.onError((err) => this._onError.fire(err)));\n\t\t} else {\n\t\t\tthis._zlibInflateStream = null;\n\t\t\tthis._zlibDeflateStream = null;\n\t\t}\n\t}\n\n\tpublic writeMessage(data: VSBuffer, options: FrameOptions): void {\n\t\tthis._writeQueue.push({ data, options });\n\t\tthis._processWriteQueue();\n\t}\n\n\tprivate _isProcessingWriteQueue = false;\n\tprivate async _processWriteQueue(): Promise<void> {\n\t\tif (this._isProcessingWriteQueue) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isProcessingWriteQueue = true;\n\t\twhile (this._writeQueue.length > 0) {\n\t\t\tconst { data, options } = this._writeQueue.shift()!;\n\t\t\tif (this._zlibDeflateStream && options.compressed) {\n\t\t\t\tconst compressedData = await this._deflateMessage(this._zlibDeflateStream, data);\n\t\t\t\tthis._writeFn(compressedData, options);\n\t\t\t} else {\n\t\t\t\tthis._writeFn(data, { ...options, compressed: false });\n\t\t\t}\n\t\t}\n\t\tthis._isProcessingWriteQueue = false;\n\t\tthis._onDidFinishProcessingWriteQueue.fire();\n\t}\n\n\tpublic isProcessingWriteQueue(): boolean {\n\t\treturn (this._isProcessingWriteQueue);\n\t}\n\n\t/**\n\t * Subsequent calls should wait for the previous `_deflateBuffer` call to complete.\n\t */\n\tprivate _deflateMessage(zlibDeflateStream: ZlibDeflateStream, buffer: VSBuffer): Promise<VSBuffer> {\n\t\treturn new Promise<VSBuffer>((resolve, reject) => {\n\t\t\tzlibDeflateStream.write(buffer);\n\t\t\tzlibDeflateStream.flush(data => resolve(data));\n\t\t});\n\t}\n\n\tpublic acceptFrame(data: VSBuffer, isCompressed: boolean, isLastFrameOfMessage: boolean): void {\n\t\tthis._readQueue.push({ data, isCompressed, isLastFrameOfMessage });\n\t\tthis._processReadQueue();\n\t}\n\n\tprivate _isProcessingReadQueue = false;\n\tprivate async _processReadQueue(): Promise<void> {\n\t\tif (this._isProcessingReadQueue) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isProcessingReadQueue = true;\n\t\twhile (this._readQueue.length > 0) {\n\t\t\tconst frameInfo = this._readQueue.shift()!;\n\t\t\tif (this._zlibInflateStream && frameInfo.isCompressed) {\n\t\t\t\t// See https://datatracker.ietf.org/doc/html/rfc7692#section-9.2\n\t\t\t\t// Even if permessageDeflate is negotiated, it is possible\n\t\t\t\t// that the other side might decide to send uncompressed messages\n\t\t\t\t// So only decompress messages that have the RSV 1 bit set\n\t\t\t\tconst data = await this._inflateFrame(this._zlibInflateStream, frameInfo.data, frameInfo.isLastFrameOfMessage);\n\t\t\t\tthis._onData.fire(data);\n\t\t\t} else {\n\t\t\t\tthis._onData.fire(frameInfo.data);\n\t\t\t}\n\t\t}\n\t\tthis._isProcessingReadQueue = false;\n\t\tthis._onDidFinishProcessingReadQueue.fire();\n\t}\n\n\tpublic isProcessingReadQueue(): boolean {\n\t\treturn (this._isProcessingReadQueue);\n\t}\n\n\t/**\n\t * Subsequent calls should wait for the previous `transformRead` call to complete.\n\t */\n\tprivate _inflateFrame(zlibInflateStream: ZlibInflateStream, buffer: VSBuffer, isLastFrameOfMessage: boolean): Promise<VSBuffer> {\n\t\treturn new Promise<VSBuffer>((resolve, reject) => {\n\t\t\t// See https://tools.ietf.org/html/rfc7692#section-7.2.2\n\t\t\tzlibInflateStream.write(buffer);\n\t\t\tif (isLastFrameOfMessage) {\n\t\t\t\tzlibInflateStream.write(VSBuffer.fromByteArray([0x00, 0x00, 0xff, 0xff]));\n\t\t\t}\n\t\t\tzlibInflateStream.flush(data => resolve(data));\n\t\t});\n\t}\n}\n\nclass ZlibInflateStream extends Disposable {\n\n\tprivate readonly _onError = this._register(new Emitter<Error>());\n\tpublic readonly onError = this._onError.event;\n\n\tprivate readonly _zlibInflate: InflateRaw;\n\tprivate readonly _recordedInflateBytes: VSBuffer[] = [];\n\tprivate readonly _pendingInflateData: VSBuffer[] = [];\n\n\tpublic get recordedInflateBytes(): VSBuffer {\n\t\tif (this._recordInflateBytes) {\n\t\t\treturn VSBuffer.concat(this._recordedInflateBytes);\n\t\t}\n\t\treturn VSBuffer.alloc(0);\n\t}\n\n\tconstructor(\n\t\tprivate readonly _tracer: ISocketTracer,\n\t\tprivate readonly _recordInflateBytes: boolean,\n\t\tinflateBytes: VSBuffer | null,\n\t\toptions: ZlibOptions\n\t) {\n\t\tsuper();\n\t\tthis._zlibInflate = createInflateRaw(options);\n\t\tthis._zlibInflate.on('error', (err) => {\n\t\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibInflateError, { message: err?.message, code: (<any>err)?.code });\n\t\t\tthis._onError.fire(err);\n\t\t});\n\t\tthis._zlibInflate.on('data', (data: Buffer) => {\n\t\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibInflateData, data);\n\t\t\tthis._pendingInflateData.push(VSBuffer.wrap(data));\n\t\t});\n\t\tif (inflateBytes) {\n\t\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibInflateInitialWrite, inflateBytes.buffer);\n\t\t\tthis._zlibInflate.write(inflateBytes.buffer);\n\t\t\tthis._zlibInflate.flush(() => {\n\t\t\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibInflateInitialFlushFired);\n\t\t\t\tthis._pendingInflateData.length = 0;\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic write(buffer: VSBuffer): void {\n\t\tif (this._recordInflateBytes) {\n\t\t\tthis._recordedInflateBytes.push(buffer.clone());\n\t\t}\n\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibInflateWrite, buffer);\n\t\tthis._zlibInflate.write(buffer.buffer);\n\t}\n\n\tpublic flush(callback: (data: VSBuffer) => void): void {\n\t\tthis._zlibInflate.flush(() => {\n\t\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibInflateFlushFired);\n\t\t\tconst data = VSBuffer.concat(this._pendingInflateData);\n\t\t\tthis._pendingInflateData.length = 0;\n\t\t\tcallback(data);\n\t\t});\n\t}\n}\n\nclass ZlibDeflateStream extends Disposable {\n\n\tprivate readonly _onError = this._register(new Emitter<Error>());\n\tpublic readonly onError = this._onError.event;\n\n\tprivate readonly _zlibDeflate: DeflateRaw;\n\tprivate readonly _pendingDeflateData: VSBuffer[] = [];\n\n\tconstructor(\n\t\tprivate readonly _tracer: ISocketTracer,\n\t\toptions: ZlibOptions\n\t) {\n\t\tsuper();\n\n\t\tthis._zlibDeflate = createDeflateRaw({\n\t\t\twindowBits: 15\n\t\t});\n\t\tthis._zlibDeflate.on('error', (err) => {\n\t\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibDeflateError, { message: err?.message, code: (<any>err)?.code });\n\t\t\tthis._onError.fire(err);\n\t\t});\n\t\tthis._zlibDeflate.on('data', (data: Buffer) => {\n\t\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibDeflateData, data);\n\t\t\tthis._pendingDeflateData.push(VSBuffer.wrap(data));\n\t\t});\n\t}\n\n\tpublic write(buffer: VSBuffer): void {\n\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibDeflateWrite, buffer.buffer);\n\t\tthis._zlibDeflate.write(<Buffer>buffer.buffer);\n\t}\n\n\tpublic flush(callback: (data: VSBuffer) => void): void {\n\t\t// See https://zlib.net/manual.html#Constants\n\t\tthis._zlibDeflate.flush(/*Z_SYNC_FLUSH*/2, () => {\n\t\t\tthis._tracer.traceSocketEvent(SocketDiagnosticsEventType.zlibDeflateFlushFired);\n\n\t\t\tlet data = VSBuffer.concat(this._pendingDeflateData);\n\t\t\tthis._pendingDeflateData.length = 0;\n\n\t\t\t// See https://tools.ietf.org/html/rfc7692#section-7.2.1\n\t\t\tdata = data.slice(0, data.byteLength - 4);\n\n\t\t\tcallback(data);\n\t\t});\n\t}\n}\n\nfunction unmask(buffer: VSBuffer, mask: number): void {\n\tif (mask === 0) {\n\t\treturn;\n\t}\n\tconst cnt = buffer.byteLength >>> 2;\n\tfor (let i = 0; i < cnt; i++) {\n\t\tconst v = buffer.readUInt32BE(i * 4);\n\t\tbuffer.writeUInt32BE(v ^ mask, i * 4);\n\t}\n\tconst offset = cnt * 4;\n\tconst bytesLeft = buffer.byteLength - offset;\n\tconst m3 = (mask >>> 24) & 0b11111111;\n\tconst m2 = (mask >>> 16) & 0b11111111;\n\tconst m1 = (mask >>> 8) & 0b11111111;\n\tif (bytesLeft >= 1) {\n\t\tbuffer.writeUInt8(buffer.readUInt8(offset) ^ m3, offset);\n\t}\n\tif (bytesLeft >= 2) {\n\t\tbuffer.writeUInt8(buffer.readUInt8(offset + 1) ^ m2, offset + 1);\n\t}\n\tif (bytesLeft >= 3) {\n\t\tbuffer.writeUInt8(buffer.readUInt8(offset + 2) ^ m1, offset + 2);\n\t}\n}\n\n// Read this before there's any chance it is overwritten\n// Related to https://github.com/microsoft/vscode/issues/30624\nexport const XDG_RUNTIME_DIR = <string | undefined>process.env['XDG_RUNTIME_DIR'];\n\nconst safeIpcPathLengths: { [platform: number]: number } = {\n\t[Platform.Linux]: 107,\n\t[Platform.Mac]: 103\n};\n\nexport function createRandomIPCHandle(): string {\n\tconst randomSuffix = generateUuid();\n\n\t// Windows: use named pipe\n\tif (process.platform === 'win32') {\n\t\treturn `\\\\\\\\.\\\\pipe\\\\vscode-ipc-${randomSuffix}-sock`;\n\t}\n\n\t// Mac & Unix: Use socket file\n\t// Unix: Prefer XDG_RUNTIME_DIR over user data path\n\tconst basePath = process.platform !== 'darwin' && XDG_RUNTIME_DIR ? XDG_RUNTIME_DIR : tmpdir();\n\tconst result = join(basePath, `vscode-ipc-${randomSuffix}.sock`);\n\n\t// Validate length\n\tvalidateIPCHandleLength(result);\n\n\treturn result;\n}\n\nexport function createStaticIPCHandle(directoryPath: string, type: string, version: string): string {\n\tconst scope = createHash('sha256').update(directoryPath).digest('hex');\n\tconst scopeForSocket = scope.substr(0, 8);\n\n\t// Windows: use named pipe\n\tif (process.platform === 'win32') {\n\t\treturn `\\\\\\\\.\\\\pipe\\\\${scopeForSocket}-${version}-${type}-sock`;\n\t}\n\n\t// Mac & Unix: Use socket file\n\t// Unix: Prefer XDG_RUNTIME_DIR over user data path, unless portable\n\t// Trim the version and type values for the socket to prevent too large\n\t// file names causing issues: https://unix.stackexchange.com/q/367008\n\n\tconst versionForSocket = version.substr(0, 4);\n\tconst typeForSocket = type.substr(0, 6);\n\n\tlet result: string;\n\tif (process.platform !== 'darwin' && XDG_RUNTIME_DIR && !process.env['VSCODE_PORTABLE']) {\n\t\tresult = join(XDG_RUNTIME_DIR, `vscode-${scopeForSocket}-${versionForSocket}-${typeForSocket}.sock`);\n\t} else {\n\t\tresult = join(directoryPath, `${versionForSocket}-${typeForSocket}.sock`);\n\t}\n\n\t// Validate length\n\tvalidateIPCHandleLength(result);\n\n\treturn result;\n}\n\nfunction validateIPCHandleLength(handle: string): void {\n\tconst limit = safeIpcPathLengths[platform];\n\tif (typeof limit === 'number' && handle.length >= limit) {\n\t\t// https://nodejs.org/api/net.html#net_identifying_paths_for_ipc_connections\n\t\tconsole.warn(`WARNING: IPC handle \"${handle}\" is longer than ${limit} chars, try a shorter --user-data-dir`);\n\t}\n}\n\nexport class Server extends IPCServer {\n\n\tprivate static toClientConnectionEvent(server: NetServer): Event<ClientConnectionEvent> {\n\t\tconst onConnection = Event.fromNodeEventEmitter<Socket>(server, 'connection');\n\n\t\treturn Event.map(onConnection, socket => ({\n\t\t\tprotocol: new Protocol(new NodeSocket(socket, 'ipc-server-connection')),\n\t\t\tonDidClientDisconnect: Event.once(Event.fromNodeEventEmitter<void>(socket, 'close'))\n\t\t}));\n\t}\n\n\tprivate server: NetServer | null;\n\n\tconstructor(server: NetServer) {\n\t\tsuper(Server.toClientConnectionEvent(server));\n\t\tthis.server = server;\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tif (this.server) {\n\t\t\tthis.server.close();\n\t\t\tthis.server = null;\n\t\t}\n\t}\n}\n\nexport function serve(port: number): Promise<Server>;\nexport function serve(namedPipe: string): Promise<Server>;\nexport function serve(hook: any): Promise<Server> {\n\treturn new Promise<Server>((c, e) => {\n\t\tconst server = createServer();\n\n\t\tserver.on('error', e);\n\t\tserver.listen(hook, () => {\n\t\t\tserver.removeListener('error', e);\n\t\t\tc(new Server(server));\n\t\t});\n\t});\n}\n\nexport function connect(options: { host: string; port: number }, clientId: string): Promise<Client>;\nexport function connect(port: number, clientId: string): Promise<Client>;\nexport function connect(namedPipe: string, clientId: string): Promise<Client>;\nexport function connect(hook: any, clientId: string): Promise<Client> {\n\treturn new Promise<Client>((c, e) => {\n\t\tconst socket = createConnection(hook, () => {\n\t\t\tsocket.removeListener('error', e);\n\t\t\tc(Client.fromSocket(new NodeSocket(socket, `ipc-client${clientId}`), clientId));\n\t\t});\n\n\t\tsocket.once('error', e);\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createDecorator } from '../../platform/instantiation/common/instantiation.js';\nimport { IExtensionHostExitInfo } from '../../workbench/services/remote/common/remoteAgentService.js';\n\nexport const IExtensionHostStatusService = createDecorator<IExtensionHostStatusService>('extensionHostStatusService');\n\nexport interface IExtensionHostStatusService {\n\treadonly _serviceBrand: undefined;\n\n\tsetExitInfo(reconnectionToken: string, info: IExtensionHostExitInfo): void;\n\tgetExitInfo(reconnectionToken: string): IExtensionHostExitInfo | null;\n}\n\nexport class ExtensionHostStatusService implements IExtensionHostStatusService {\n\t_serviceBrand: undefined;\n\n\tprivate readonly _exitInfo = new Map<string, IExtensionHostExitInfo>();\n\n\tsetExitInfo(reconnectionToken: string, info: IExtensionHostExitInfo): void {\n\t\tthis._exitInfo.set(reconnectionToken, info);\n\t}\n\n\tgetExitInfo(reconnectionToken: string): IExtensionHostExitInfo | null {\n\t\treturn this._exitInfo.get(reconnectionToken) || null;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IProcessEnvironment } from '../../../../base/common/platform.js';\n\nexport const enum ExtHostConnectionType {\n\tIPC = 1,\n\tSocket = 2,\n\tMessagePort = 3\n}\n\n/**\n * The extension host will connect via named pipe / domain socket to its renderer.\n */\nexport class IPCExtHostConnection {\n\tpublic static ENV_KEY = 'VSCODE_EXTHOST_IPC_HOOK';\n\n\tpublic readonly type = ExtHostConnectionType.IPC;\n\n\tconstructor(\n\t\tpublic readonly pipeName: string\n\t) { }\n\n\tpublic serialize(env: IProcessEnvironment): void {\n\t\tenv[IPCExtHostConnection.ENV_KEY] = this.pipeName;\n\t}\n}\n\n/**\n * The extension host will receive via nodejs IPC the socket to its renderer.\n */\nexport class SocketExtHostConnection {\n\tpublic static ENV_KEY = 'VSCODE_EXTHOST_WILL_SEND_SOCKET';\n\n\tpublic readonly type = ExtHostConnectionType.Socket;\n\n\tpublic serialize(env: IProcessEnvironment): void {\n\t\tenv[SocketExtHostConnection.ENV_KEY] = '1';\n\t}\n}\n\n/**\n * The extension host will receive via nodejs IPC the MessagePort to its renderer.\n */\nexport class MessagePortExtHostConnection {\n\tpublic static ENV_KEY = 'VSCODE_WILL_SEND_MESSAGE_PORT';\n\n\tpublic readonly type = ExtHostConnectionType.MessagePort;\n\n\tpublic serialize(env: IProcessEnvironment): void {\n\t\tenv[MessagePortExtHostConnection.ENV_KEY] = '1';\n\t}\n}\n\nexport type ExtHostConnection = IPCExtHostConnection | SocketExtHostConnection | MessagePortExtHostConnection;\n\nfunction clean(env: IProcessEnvironment): void {\n\tdelete env[IPCExtHostConnection.ENV_KEY];\n\tdelete env[SocketExtHostConnection.ENV_KEY];\n\tdelete env[MessagePortExtHostConnection.ENV_KEY];\n}\n\n/**\n * Write `connection` into `env` and clean up `env`.\n */\nexport function writeExtHostConnection(connection: ExtHostConnection, env: IProcessEnvironment): void {\n\t// Avoid having two different keys that might introduce amiguity or problems.\n\tclean(env);\n\tconnection.serialize(env);\n}\n\n/**\n * Read `connection` from `env` and clean up `env`.\n */\nexport function readExtHostConnection(env: IProcessEnvironment): ExtHostConnection {\n\tif (env[IPCExtHostConnection.ENV_KEY]) {\n\t\treturn cleanAndReturn(env, new IPCExtHostConnection(env[IPCExtHostConnection.ENV_KEY]!));\n\t}\n\tif (env[SocketExtHostConnection.ENV_KEY]) {\n\t\treturn cleanAndReturn(env, new SocketExtHostConnection());\n\t}\n\tif (env[MessagePortExtHostConnection.ENV_KEY]) {\n\t\treturn cleanAndReturn(env, new MessagePortExtHostConnection());\n\t}\n\tthrow new Error(`No connection information defined in environment!`);\n}\n\nfunction cleanAndReturn(env: IProcessEnvironment, result: ExtHostConnection): ExtHostConnection {\n\tclean(env);\n\treturn result;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as cp from 'child_process';\nimport * as net from 'net';\nimport { VSBuffer } from '../../base/common/buffer.js';\nimport { Emitter, Event } from '../../base/common/event.js';\nimport { Disposable, DisposableStore, toDisposable } from '../../base/common/lifecycle.js';\nimport { FileAccess } from '../../base/common/network.js';\nimport { delimiter, join } from '../../base/common/path.js';\nimport { IProcessEnvironment, isWindows } from '../../base/common/platform.js';\nimport { removeDangerousEnvVariables } from '../../base/common/processes.js';\nimport { createRandomIPCHandle, NodeSocket, WebSocketNodeSocket } from '../../base/parts/ipc/node/ipc.net.js';\nimport { IConfigurationService } from '../../platform/configuration/common/configuration.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { IRemoteExtensionHostStartParams } from '../../platform/remote/common/remoteAgentConnection.js';\nimport { getResolvedShellEnv } from '../../platform/shell/node/shellEnv.js';\nimport { IExtensionHostStatusService } from './extensionHostStatusService.js';\nimport { getNLSConfiguration } from './remoteLanguagePacks.js';\nimport { IServerEnvironmentService } from './serverEnvironmentService.js';\nimport { IPCExtHostConnection, SocketExtHostConnection, writeExtHostConnection } from '../../workbench/services/extensions/common/extensionHostEnv.js';\nimport { IExtHostReadyMessage, IExtHostReduceGraceTimeMessage, IExtHostSocketMessage } from '../../workbench/services/extensions/common/extensionHostProtocol.js';\n\nexport async function buildUserEnvironment(startParamsEnv: { [key: string]: string | null } = {}, withUserShellEnvironment: boolean, language: string, environmentService: IServerEnvironmentService, logService: ILogService, configurationService: IConfigurationService): Promise<IProcessEnvironment> {\n\tconst nlsConfig = await getNLSConfiguration(language, environmentService.userDataPath);\n\n\tlet userShellEnv: typeof process.env = {};\n\tif (withUserShellEnvironment) {\n\t\ttry {\n\t\t\tuserShellEnv = await getResolvedShellEnv(configurationService, logService, environmentService.args, process.env);\n\t\t} catch (error) {\n\t\t\tlogService.error('ExtensionHostConnection#buildUserEnvironment resolving shell environment failed', error);\n\t\t}\n\t}\n\n\tconst processEnv = process.env;\n\n\tconst env: IProcessEnvironment = {\n\t\t...processEnv,\n\t\t...userShellEnv,\n\t\t...{\n\t\t\tVSCODE_ESM_ENTRYPOINT: 'vs/workbench/api/node/extensionHostProcess',\n\t\t\tVSCODE_HANDLES_UNCAUGHT_ERRORS: 'true',\n\t\t\tVSCODE_NLS_CONFIG: JSON.stringify(nlsConfig)\n\t\t},\n\t\t...startParamsEnv\n\t};\n\n\tconst binFolder = environmentService.isBuilt ? join(environmentService.appRoot, 'bin') : join(environmentService.appRoot, 'resources', 'server', 'bin-dev');\n\tconst remoteCliBinFolder = join(binFolder, 'remote-cli'); // contains the `code` command that can talk to the remote server\n\n\tlet PATH = readCaseInsensitive(env, 'PATH');\n\tif (PATH) {\n\t\tPATH = remoteCliBinFolder + delimiter + PATH;\n\t} else {\n\t\tPATH = remoteCliBinFolder;\n\t}\n\tsetCaseInsensitive(env, 'PATH', PATH);\n\n\tif (!environmentService.args['without-browser-env-var']) {\n\t\tenv.BROWSER = join(binFolder, 'helpers', isWindows ? 'browser.cmd' : 'browser.sh'); // a command that opens a browser on the local machine\n\t}\n\n\tremoveNulls(env);\n\treturn env;\n}\n\nclass ConnectionData {\n\tconstructor(\n\t\tpublic readonly socket: NodeSocket | WebSocketNodeSocket,\n\t\tpublic readonly initialDataChunk: VSBuffer\n\t) { }\n\n\tpublic socketDrain(): Promise<void> {\n\t\treturn this.socket.drain();\n\t}\n\n\tpublic toIExtHostSocketMessage(): IExtHostSocketMessage {\n\n\t\tlet skipWebSocketFrames: boolean;\n\t\tlet permessageDeflate: boolean;\n\t\tlet inflateBytes: VSBuffer;\n\n\t\tif (this.socket instanceof NodeSocket) {\n\t\t\tskipWebSocketFrames = true;\n\t\t\tpermessageDeflate = false;\n\t\t\tinflateBytes = VSBuffer.alloc(0);\n\t\t} else {\n\t\t\tskipWebSocketFrames = false;\n\t\t\tpermessageDeflate = this.socket.permessageDeflate;\n\t\t\tinflateBytes = this.socket.recordedInflateBytes;\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'VSCODE_EXTHOST_IPC_SOCKET',\n\t\t\tinitialDataChunk: (<Buffer>this.initialDataChunk.buffer).toString('base64'),\n\t\t\tskipWebSocketFrames: skipWebSocketFrames,\n\t\t\tpermessageDeflate: permessageDeflate,\n\t\t\tinflateBytes: (<Buffer>inflateBytes.buffer).toString('base64'),\n\t\t};\n\t}\n}\n\nexport class ExtensionHostConnection extends Disposable {\n\n\tprivate _onClose = new Emitter<void>();\n\treadonly onClose: Event<void> = this._onClose.event;\n\n\tprivate readonly _canSendSocket: boolean;\n\tprivate _disposed: boolean;\n\tprivate _remoteAddress: string;\n\tprivate _extensionHostProcess: cp.ChildProcess | null;\n\tprivate _connectionData: ConnectionData | null;\n\n\tconstructor(\n\t\tprivate readonly _reconnectionToken: string,\n\t\tremoteAddress: string,\n\t\tsocket: NodeSocket | WebSocketNodeSocket,\n\t\tinitialDataChunk: VSBuffer,\n\t\t@IServerEnvironmentService private readonly _environmentService: IServerEnvironmentService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IExtensionHostStatusService private readonly _extensionHostStatusService: IExtensionHostStatusService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService\n\t) {\n\t\tsuper();\n\t\tthis._canSendSocket = (!isWindows || !this._environmentService.args['socket-path']);\n\t\tthis._disposed = false;\n\t\tthis._remoteAddress = remoteAddress;\n\t\tthis._extensionHostProcess = null;\n\t\tthis._connectionData = new ConnectionData(socket, initialDataChunk);\n\n\t\tthis._log(`New connection established.`);\n\t}\n\n\toverride dispose(): void {\n\t\tthis._cleanResources();\n\t\tsuper.dispose();\n\t}\n\n\tprivate get _logPrefix(): string {\n\t\treturn `[${this._remoteAddress}][${this._reconnectionToken.substr(0, 8)}][ExtensionHostConnection] `;\n\t}\n\n\tprivate _log(_str: string): void {\n\t\tthis._logService.info(`${this._logPrefix}${_str}`);\n\t}\n\n\tprivate _logError(_str: string): void {\n\t\tthis._logService.error(`${this._logPrefix}${_str}`);\n\t}\n\n\tprivate async _pipeSockets(extHostSocket: net.Socket, connectionData: ConnectionData): Promise<void> {\n\n\t\tconst disposables = new DisposableStore();\n\t\tdisposables.add(connectionData.socket);\n\t\tdisposables.add(toDisposable(() => {\n\t\t\textHostSocket.destroy();\n\t\t}));\n\n\t\tconst stopAndCleanup = () => {\n\t\t\tdisposables.dispose();\n\t\t};\n\n\t\tdisposables.add(connectionData.socket.onEnd(stopAndCleanup));\n\t\tdisposables.add(connectionData.socket.onClose(stopAndCleanup));\n\n\t\tdisposables.add(Event.fromNodeEventEmitter<void>(extHostSocket, 'end')(stopAndCleanup));\n\t\tdisposables.add(Event.fromNodeEventEmitter<void>(extHostSocket, 'close')(stopAndCleanup));\n\t\tdisposables.add(Event.fromNodeEventEmitter<void>(extHostSocket, 'error')(stopAndCleanup));\n\n\t\tdisposables.add(connectionData.socket.onData((e) => extHostSocket.write(e.buffer)));\n\t\tdisposables.add(Event.fromNodeEventEmitter<Buffer>(extHostSocket, 'data')((e) => {\n\t\t\tconnectionData.socket.write(VSBuffer.wrap(e));\n\t\t}));\n\n\t\tif (connectionData.initialDataChunk.byteLength > 0) {\n\t\t\textHostSocket.write(connectionData.initialDataChunk.buffer);\n\t\t}\n\t}\n\n\tprivate async _sendSocketToExtensionHost(extensionHostProcess: cp.ChildProcess, connectionData: ConnectionData): Promise<void> {\n\t\t// Make sure all outstanding writes have been drained before sending the socket\n\t\tawait connectionData.socketDrain();\n\t\tconst msg = connectionData.toIExtHostSocketMessage();\n\t\tlet socket: net.Socket;\n\t\tif (connectionData.socket instanceof NodeSocket) {\n\t\t\tsocket = connectionData.socket.socket;\n\t\t} else {\n\t\t\tsocket = connectionData.socket.socket.socket;\n\t\t}\n\t\textensionHostProcess.send(msg, socket);\n\t}\n\n\tpublic shortenReconnectionGraceTimeIfNecessary(): void {\n\t\tif (!this._extensionHostProcess) {\n\t\t\treturn;\n\t\t}\n\t\tconst msg: IExtHostReduceGraceTimeMessage = {\n\t\t\ttype: 'VSCODE_EXTHOST_IPC_REDUCE_GRACE_TIME'\n\t\t};\n\t\tthis._extensionHostProcess.send(msg);\n\t}\n\n\tpublic acceptReconnection(remoteAddress: string, _socket: NodeSocket | WebSocketNodeSocket, initialDataChunk: VSBuffer): void {\n\t\tthis._remoteAddress = remoteAddress;\n\t\tthis._log(`The client has reconnected.`);\n\t\tconst connectionData = new ConnectionData(_socket, initialDataChunk);\n\n\t\tif (!this._extensionHostProcess) {\n\t\t\t// The extension host didn't even start up yet\n\t\t\tthis._connectionData = connectionData;\n\t\t\treturn;\n\t\t}\n\n\t\tthis._sendSocketToExtensionHost(this._extensionHostProcess, connectionData);\n\t}\n\n\tprivate _cleanResources(): void {\n\t\tif (this._disposed) {\n\t\t\t// already called\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\t\tif (this._connectionData) {\n\t\t\tthis._connectionData.socket.end();\n\t\t\tthis._connectionData = null;\n\t\t}\n\t\tif (this._extensionHostProcess) {\n\t\t\tthis._extensionHostProcess.kill();\n\t\t\tthis._extensionHostProcess = null;\n\t\t}\n\t\tthis._onClose.fire(undefined);\n\t}\n\n\tpublic async start(startParams: IRemoteExtensionHostStartParams): Promise<void> {\n\t\ttry {\n\t\t\tlet execArgv: string[] = process.execArgv ? process.execArgv.filter(a => !/^--inspect(-brk)?=/.test(a)) : [];\n\t\t\tif (startParams.port && !(<any>process).pkg) {\n\t\t\t\texecArgv = [\n\t\t\t\t\t`--inspect${startParams.break ? '-brk' : ''}=${startParams.port}`,\n\t\t\t\t\t'--experimental-network-inspection'\n\t\t\t\t];\n\t\t\t}\n\n\t\t\tconst env = await buildUserEnvironment(startParams.env, true, startParams.language, this._environmentService, this._logService, this._configurationService);\n\t\t\tremoveDangerousEnvVariables(env);\n\n\t\t\tlet extHostNamedPipeServer: net.Server | null;\n\n\t\t\tif (this._canSendSocket) {\n\t\t\t\twriteExtHostConnection(new SocketExtHostConnection(), env);\n\t\t\t\textHostNamedPipeServer = null;\n\t\t\t} else {\n\t\t\t\tconst { namedPipeServer, pipeName } = await this._listenOnPipe();\n\t\t\t\twriteExtHostConnection(new IPCExtHostConnection(pipeName), env);\n\t\t\t\textHostNamedPipeServer = namedPipeServer;\n\t\t\t}\n\n\t\t\tconst opts = {\n\t\t\t\tenv,\n\t\t\t\texecArgv,\n\t\t\t\tsilent: true\n\t\t\t};\n\n\t\t\t// Refs https://github.com/microsoft/vscode/issues/189805\n\t\t\topts.execArgv.unshift('--dns-result-order=ipv4first');\n\n\t\t\t// Run Extension Host as fork of current process\n\t\t\tconst args = ['--type=extensionHost', `--transformURIs`];\n\t\t\tconst useHostProxy = this._environmentService.args['use-host-proxy'];\n\t\t\targs.push(`--useHostProxy=${useHostProxy ? 'true' : 'false'}`);\n\t\t\tif (this._configurationService.getValue<boolean>('extensions.supportNodeGlobalNavigator')) {\n\t\t\t\targs.push('--supportGlobalNavigator');\n\t\t\t}\n\t\t\tthis._extensionHostProcess = cp.fork(FileAccess.asFileUri('bootstrap-fork').fsPath, args, opts);\n\t\t\tconst pid = this._extensionHostProcess.pid;\n\t\t\tthis._log(`<${pid}> Launched Extension Host Process.`);\n\n\t\t\t// Catch all output coming from the extension host process\n\t\t\tthis._extensionHostProcess.stdout!.setEncoding('utf8');\n\t\t\tthis._extensionHostProcess.stderr!.setEncoding('utf8');\n\t\t\tconst onStdout = Event.fromNodeEventEmitter<string>(this._extensionHostProcess.stdout!, 'data');\n\t\t\tconst onStderr = Event.fromNodeEventEmitter<string>(this._extensionHostProcess.stderr!, 'data');\n\t\t\tthis._register(onStdout((e) => this._log(`<${pid}> ${e}`)));\n\t\t\tthis._register(onStderr((e) => this._log(`<${pid}><stderr> ${e}`)));\n\n\t\t\t// Lifecycle\n\t\t\tthis._extensionHostProcess.on('error', (err) => {\n\t\t\t\tthis._logError(`<${pid}> Extension Host Process had an error`);\n\t\t\t\tthis._logService.error(err);\n\t\t\t\tthis._cleanResources();\n\t\t\t});\n\n\t\t\tthis._extensionHostProcess.on('exit', (code: number, signal: string) => {\n\t\t\t\tthis._extensionHostStatusService.setExitInfo(this._reconnectionToken, { code, signal });\n\t\t\t\tthis._log(`<${pid}> Extension Host Process exited with code: ${code}, signal: ${signal}.`);\n\t\t\t\tthis._cleanResources();\n\t\t\t});\n\n\t\t\tif (extHostNamedPipeServer) {\n\t\t\t\textHostNamedPipeServer.on('connection', (socket) => {\n\t\t\t\t\textHostNamedPipeServer.close();\n\t\t\t\t\tthis._pipeSockets(socket, this._connectionData!);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst messageListener = (msg: IExtHostReadyMessage) => {\n\t\t\t\t\tif (msg.type === 'VSCODE_EXTHOST_IPC_READY') {\n\t\t\t\t\t\tthis._extensionHostProcess!.removeListener('message', messageListener);\n\t\t\t\t\t\tthis._sendSocketToExtensionHost(this._extensionHostProcess!, this._connectionData!);\n\t\t\t\t\t\tthis._connectionData = null;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tthis._extensionHostProcess.on('message', messageListener);\n\t\t\t}\n\n\t\t} catch (error) {\n\t\t\tconsole.error('ExtensionHostConnection errored');\n\t\t\tif (error) {\n\t\t\t\tconsole.error(error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _listenOnPipe(): Promise<{ pipeName: string; namedPipeServer: net.Server }> {\n\t\treturn new Promise<{ pipeName: string; namedPipeServer: net.Server }>((resolve, reject) => {\n\t\t\tconst pipeName = createRandomIPCHandle();\n\n\t\t\tconst namedPipeServer = net.createServer();\n\t\t\tnamedPipeServer.on('error', reject);\n\t\t\tnamedPipeServer.listen(pipeName, () => {\n\t\t\t\tnamedPipeServer?.removeListener('error', reject);\n\t\t\t\tresolve({ pipeName, namedPipeServer });\n\t\t\t});\n\t\t});\n\t}\n}\n\nfunction readCaseInsensitive(env: { [key: string]: string | undefined }, key: string): string | undefined {\n\tconst pathKeys = Object.keys(env).filter(k => k.toLowerCase() === key.toLowerCase());\n\tconst pathKey = pathKeys.length > 0 ? pathKeys[0] : key;\n\treturn env[pathKey];\n}\n\nfunction setCaseInsensitive(env: { [key: string]: unknown }, key: string, value: string): void {\n\tconst pathKeys = Object.keys(env).filter(k => k.toLowerCase() === key.toLowerCase());\n\tconst pathKey = pathKeys.length > 0 ? pathKeys[0] : key;\n\tenv[pathKey] = value;\n}\n\nfunction removeNulls(env: { [key: string]: unknown | null }): void {\n\t// Don't delete while iterating the object itself\n\tfor (const key of Object.keys(env)) {\n\t\tif (env[key] === null) {\n\t\t\tdelete env[key];\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { PersistentProtocol, ProtocolConstants, ISocket } from '../../base/parts/ipc/common/ipc.net.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { Emitter, Event } from '../../base/common/event.js';\nimport { VSBuffer } from '../../base/common/buffer.js';\nimport { ProcessTimeRunOnceScheduler } from '../../base/common/async.js';\n\nfunction printTime(ms: number): string {\n\tlet h = 0;\n\tlet m = 0;\n\tlet s = 0;\n\tif (ms >= 1000) {\n\t\ts = Math.floor(ms / 1000);\n\t\tms -= s * 1000;\n\t}\n\tif (s >= 60) {\n\t\tm = Math.floor(s / 60);\n\t\ts -= m * 60;\n\t}\n\tif (m >= 60) {\n\t\th = Math.floor(m / 60);\n\t\tm -= h * 60;\n\t}\n\tconst _h = h ? `${h}h` : ``;\n\tconst _m = m ? `${m}m` : ``;\n\tconst _s = s ? `${s}s` : ``;\n\tconst _ms = ms ? `${ms}ms` : ``;\n\treturn `${_h}${_m}${_s}${_ms}`;\n}\n\nexport class ManagementConnection {\n\n\tprivate _onClose = new Emitter<void>();\n\tpublic readonly onClose: Event<void> = this._onClose.event;\n\n\tprivate readonly _reconnectionGraceTime: number;\n\tprivate readonly _reconnectionShortGraceTime: number;\n\tprivate _remoteAddress: string;\n\n\tpublic readonly protocol: PersistentProtocol;\n\tprivate _disposed: boolean;\n\tprivate _disconnectRunner1: ProcessTimeRunOnceScheduler;\n\tprivate _disconnectRunner2: ProcessTimeRunOnceScheduler;\n\n\tconstructor(\n\t\tprivate readonly _logService: ILogService,\n\t\tprivate readonly _reconnectionToken: string,\n\t\tremoteAddress: string,\n\t\tprotocol: PersistentProtocol\n\t) {\n\t\tthis._reconnectionGraceTime = ProtocolConstants.ReconnectionGraceTime;\n\t\tthis._reconnectionShortGraceTime = ProtocolConstants.ReconnectionShortGraceTime;\n\t\tthis._remoteAddress = remoteAddress;\n\n\t\tthis.protocol = protocol;\n\t\tthis._disposed = false;\n\t\tthis._disconnectRunner1 = new ProcessTimeRunOnceScheduler(() => {\n\t\t\tthis._log(`The reconnection grace time of ${printTime(this._reconnectionGraceTime)} has expired, so the connection will be disposed.`);\n\t\t\tthis._cleanResources();\n\t\t}, this._reconnectionGraceTime);\n\t\tthis._disconnectRunner2 = new ProcessTimeRunOnceScheduler(() => {\n\t\t\tthis._log(`The reconnection short grace time of ${printTime(this._reconnectionShortGraceTime)} has expired, so the connection will be disposed.`);\n\t\t\tthis._cleanResources();\n\t\t}, this._reconnectionShortGraceTime);\n\n\t\tthis.protocol.onDidDispose(() => {\n\t\t\tthis._log(`The client has disconnected gracefully, so the connection will be disposed.`);\n\t\t\tthis._cleanResources();\n\t\t});\n\t\tthis.protocol.onSocketClose(() => {\n\t\t\tthis._log(`The client has disconnected, will wait for reconnection ${printTime(this._reconnectionGraceTime)} before disposing...`);\n\t\t\t// The socket has closed, let's give the renderer a certain amount of time to reconnect\n\t\t\tthis._disconnectRunner1.schedule();\n\t\t});\n\n\t\tthis._log(`New connection established.`);\n\t}\n\n\tprivate _log(_str: string): void {\n\t\tthis._logService.info(`[${this._remoteAddress}][${this._reconnectionToken.substr(0, 8)}][ManagementConnection] ${_str}`);\n\t}\n\n\tpublic shortenReconnectionGraceTimeIfNecessary(): void {\n\t\tif (this._disconnectRunner2.isScheduled()) {\n\t\t\t// we are disconnected and already running the short reconnection timer\n\t\t\treturn;\n\t\t}\n\t\tif (this._disconnectRunner1.isScheduled()) {\n\t\t\tthis._log(`Another client has connected, will shorten the wait for reconnection ${printTime(this._reconnectionShortGraceTime)} before disposing...`);\n\t\t\t// we are disconnected and running the long reconnection timer\n\t\t\tthis._disconnectRunner2.schedule();\n\t\t}\n\t}\n\n\tprivate _cleanResources(): void {\n\t\tif (this._disposed) {\n\t\t\t// already called\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\t\tthis._disconnectRunner1.dispose();\n\t\tthis._disconnectRunner2.dispose();\n\t\tconst socket = this.protocol.getSocket();\n\t\tthis.protocol.sendDisconnect();\n\t\tthis.protocol.dispose();\n\t\tsocket.end();\n\t\tthis._onClose.fire(undefined);\n\t}\n\n\tpublic acceptReconnection(remoteAddress: string, socket: ISocket, initialDataChunk: VSBuffer): void {\n\t\tthis._remoteAddress = remoteAddress;\n\t\tthis._log(`The client has reconnected.`);\n\t\tthis._disconnectRunner1.cancel();\n\t\tthis._disconnectRunner2.cancel();\n\t\tthis.protocol.beginAcceptReconnection(socket, initialDataChunk);\n\t\tthis.protocol.endAcceptReconnection();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as cookie from 'cookie';\nimport * as fs from 'fs';\nimport * as http from 'http';\nimport * as url from 'url';\nimport * as path from '../../base/common/path.js';\nimport { generateUuid } from '../../base/common/uuid.js';\nimport { connectionTokenCookieName, connectionTokenQueryName } from '../../base/common/network.js';\nimport { ServerParsedArgs } from './serverEnvironmentService.js';\nimport { Promises } from '../../base/node/pfs.js';\n\nconst connectionTokenRegex = /^[0-9A-Za-z_-]+$/;\n\nexport const enum ServerConnectionTokenType {\n\tNone,\n\tOptional,// TODO: Remove this soon\n\tMandatory\n}\n\nexport class NoneServerConnectionToken {\n\tpublic readonly type = ServerConnectionTokenType.None;\n\n\tpublic validate(connectionToken: any): boolean {\n\t\treturn true;\n\t}\n}\n\nexport class MandatoryServerConnectionToken {\n\tpublic readonly type = ServerConnectionTokenType.Mandatory;\n\n\tconstructor(public readonly value: string) {\n\t}\n\n\tpublic validate(connectionToken: any): boolean {\n\t\treturn (connectionToken === this.value);\n\t}\n}\n\nexport type ServerConnectionToken = NoneServerConnectionToken | MandatoryServerConnectionToken;\n\nexport class ServerConnectionTokenParseError {\n\tconstructor(\n\t\tpublic readonly message: string\n\t) { }\n}\n\nexport async function parseServerConnectionToken(args: ServerParsedArgs, defaultValue: () => Promise<string>): Promise<ServerConnectionToken | ServerConnectionTokenParseError> {\n\tconst withoutConnectionToken = args['without-connection-token'];\n\tconst connectionToken = args['connection-token'];\n\tconst connectionTokenFile = args['connection-token-file'];\n\n\tif (withoutConnectionToken) {\n\t\tif (typeof connectionToken !== 'undefined' || typeof connectionTokenFile !== 'undefined') {\n\t\t\treturn new ServerConnectionTokenParseError(`Please do not use the argument '--connection-token' or '--connection-token-file' at the same time as '--without-connection-token'.`);\n\t\t}\n\t\treturn new NoneServerConnectionToken();\n\t}\n\n\tif (typeof connectionTokenFile !== 'undefined') {\n\t\tif (typeof connectionToken !== 'undefined') {\n\t\t\treturn new ServerConnectionTokenParseError(`Please do not use the argument '--connection-token' at the same time as '--connection-token-file'.`);\n\t\t}\n\n\t\tlet rawConnectionToken: string;\n\t\ttry {\n\t\t\trawConnectionToken = fs.readFileSync(connectionTokenFile).toString().replace(/\\r?\\n$/, '');\n\t\t} catch (e) {\n\t\t\treturn new ServerConnectionTokenParseError(`Unable to read the connection token file at '${connectionTokenFile}'.`);\n\t\t}\n\n\t\tif (!connectionTokenRegex.test(rawConnectionToken)) {\n\t\t\treturn new ServerConnectionTokenParseError(`The connection token defined in '${connectionTokenFile} does not adhere to the characters 0-9, a-z, A-Z, _, or -.`);\n\t\t}\n\n\t\treturn new MandatoryServerConnectionToken(rawConnectionToken);\n\t}\n\n\tif (typeof connectionToken !== 'undefined') {\n\t\tif (!connectionTokenRegex.test(connectionToken)) {\n\t\t\treturn new ServerConnectionTokenParseError(`The connection token '${connectionToken} does not adhere to the characters 0-9, a-z, A-Z or -.`);\n\t\t}\n\n\t\treturn new MandatoryServerConnectionToken(connectionToken);\n\t}\n\n\treturn new MandatoryServerConnectionToken(await defaultValue());\n}\n\nexport async function determineServerConnectionToken(args: ServerParsedArgs): Promise<ServerConnectionToken | ServerConnectionTokenParseError> {\n\tconst readOrGenerateConnectionToken = async () => {\n\t\tif (!args['user-data-dir']) {\n\t\t\t// No place to store it!\n\t\t\treturn generateUuid();\n\t\t}\n\t\tconst storageLocation = path.join(args['user-data-dir'], 'token');\n\n\t\t// First try to find a connection token\n\t\ttry {\n\t\t\tconst fileContents = await fs.promises.readFile(storageLocation);\n\t\t\tconst connectionToken = fileContents.toString().replace(/\\r?\\n$/, '');\n\t\t\tif (connectionTokenRegex.test(connectionToken)) {\n\t\t\t\treturn connectionToken;\n\t\t\t}\n\t\t} catch (err) { }\n\n\t\t// No connection token found, generate one\n\t\tconst connectionToken = generateUuid();\n\n\t\ttry {\n\t\t\t// Try to store it\n\t\t\tawait Promises.writeFile(storageLocation, connectionToken, { mode: 0o600 });\n\t\t} catch (err) { }\n\n\t\treturn connectionToken;\n\t};\n\treturn parseServerConnectionToken(args, readOrGenerateConnectionToken);\n}\n\nexport function requestHasValidConnectionToken(connectionToken: ServerConnectionToken, req: http.IncomingMessage, parsedUrl: url.UrlWithParsedQuery) {\n\t// First check if there is a valid query parameter\n\tif (connectionToken.validate(parsedUrl.query[connectionTokenQueryName])) {\n\t\treturn true;\n\t}\n\n\t// Otherwise, check if there is a valid cookie\n\tconst cookies = cookie.parse(req.headers.cookie || '');\n\treturn connectionToken.validate(cookies[connectionTokenCookieName]);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { networkInterfaces } from 'os';\n\nconst invalidMacAddresses = new Set([\n\t'00:00:00:00:00:00',\n\t'ff:ff:ff:ff:ff:ff',\n\t'ac:de:48:00:11:22'\n]);\n\nfunction validateMacAddress(candidate: string): boolean {\n\tconst tempCandidate = candidate.replace(/\\-/g, ':').toLowerCase();\n\treturn !invalidMacAddresses.has(tempCandidate);\n}\n\nexport function getMac(): string {\n\tconst ifaces = networkInterfaces();\n\tfor (const name in ifaces) {\n\t\tconst networkInterface = ifaces[name];\n\t\tif (networkInterface) {\n\t\t\tfor (const { mac } of networkInterface) {\n\t\t\t\tif (validateMacAddress(mac)) {\n\t\t\t\t\treturn mac;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error('Unable to retrieve mac address (unexpected format)');\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { networkInterfaces } from 'os';\nimport { TernarySearchTree } from '../common/ternarySearchTree.js';\nimport * as uuid from '../common/uuid.js';\nimport { getMac } from './macAddress.js';\nimport { isWindows } from '../common/platform.js';\n\n// http://www.techrepublic.com/blog/data-center/mac-address-scorecard-for-common-virtual-machine-platforms/\n// VMware ESX 3, Server, Workstation, Player\t00-50-56, 00-0C-29, 00-05-69\n// Microsoft Hyper-V, Virtual Server, Virtual PC\t00-03-FF\n// Parallels Desktop, Workstation, Server, Virtuozzo\t00-1C-42\n// Virtual Iron 4\t00-0F-4B\n// Red Hat Xen\t00-16-3E\n// Oracle VM\t00-16-3E\n// XenSource\t00-16-3E\n// Novell Xen\t00-16-3E\n// Sun xVM VirtualBox\t08-00-27\nexport const virtualMachineHint: { value(): number } = new class {\n\n\tprivate _virtualMachineOUIs?: TernarySearchTree<string, boolean>;\n\tprivate _value?: number;\n\n\tprivate _isVirtualMachineMacAddress(mac: string): boolean {\n\t\tif (!this._virtualMachineOUIs) {\n\t\t\tthis._virtualMachineOUIs = TernarySearchTree.forStrings<boolean>();\n\n\t\t\t// dash-separated\n\t\t\tthis._virtualMachineOUIs.set('00-50-56', true);\n\t\t\tthis._virtualMachineOUIs.set('00-0C-29', true);\n\t\t\tthis._virtualMachineOUIs.set('00-05-69', true);\n\t\t\tthis._virtualMachineOUIs.set('00-03-FF', true);\n\t\t\tthis._virtualMachineOUIs.set('00-1C-42', true);\n\t\t\tthis._virtualMachineOUIs.set('00-16-3E', true);\n\t\t\tthis._virtualMachineOUIs.set('08-00-27', true);\n\n\t\t\t// colon-separated\n\t\t\tthis._virtualMachineOUIs.set('00:50:56', true);\n\t\t\tthis._virtualMachineOUIs.set('00:0C:29', true);\n\t\t\tthis._virtualMachineOUIs.set('00:05:69', true);\n\t\t\tthis._virtualMachineOUIs.set('00:03:FF', true);\n\t\t\tthis._virtualMachineOUIs.set('00:1C:42', true);\n\t\t\tthis._virtualMachineOUIs.set('00:16:3E', true);\n\t\t\tthis._virtualMachineOUIs.set('08:00:27', true);\n\t\t}\n\t\treturn !!this._virtualMachineOUIs.findSubstr(mac);\n\t}\n\n\tvalue(): number {\n\t\tif (this._value === undefined) {\n\t\t\tlet vmOui = 0;\n\t\t\tlet interfaceCount = 0;\n\n\t\t\tconst interfaces = networkInterfaces();\n\t\t\tfor (const name in interfaces) {\n\t\t\t\tconst networkInterface = interfaces[name];\n\t\t\t\tif (networkInterface) {\n\t\t\t\t\tfor (const { mac, internal } of networkInterface) {\n\t\t\t\t\t\tif (!internal) {\n\t\t\t\t\t\t\tinterfaceCount += 1;\n\t\t\t\t\t\t\tif (this._isVirtualMachineMacAddress(mac.toUpperCase())) {\n\t\t\t\t\t\t\t\tvmOui += 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._value = interfaceCount > 0\n\t\t\t\t? vmOui / interfaceCount\n\t\t\t\t: 0;\n\t\t}\n\n\t\treturn this._value;\n\t}\n};\n\nlet machineId: Promise<string>;\nexport async function getMachineId(errorLogger: (error: any) => void): Promise<string> {\n\tif (!machineId) {\n\t\tmachineId = (async () => {\n\t\t\tconst id = await getMacMachineId(errorLogger);\n\n\t\t\treturn id || uuid.generateUuid(); // fallback, generate a UUID\n\t\t})();\n\t}\n\n\treturn machineId;\n}\n\nasync function getMacMachineId(errorLogger: (error: any) => void): Promise<string | undefined> {\n\ttry {\n\t\tconst crypto = await import('crypto');\n\t\tconst macAddress = getMac();\n\t\treturn crypto.createHash('sha256').update(macAddress, 'utf8').digest('hex');\n\t} catch (err) {\n\t\terrorLogger(err);\n\t\treturn undefined;\n\t}\n}\n\nconst SQM_KEY: string = 'Software\\\\Microsoft\\\\SQMClient';\nexport async function getSqmMachineId(errorLogger: (error: any) => void): Promise<string> {\n\tif (isWindows) {\n\t\tconst Registry = await import('@vscode/windows-registry');\n\t\ttry {\n\t\t\treturn Registry.GetStringRegKey('HKEY_LOCAL_MACHINE', SQM_KEY, 'MachineId') || '';\n\t\t} catch (err) {\n\t\t\terrorLogger(err);\n\t\t\treturn '';\n\t\t}\n\t}\n\treturn '';\n}\n\nexport async function getdevDeviceId(errorLogger: (error: any) => void): Promise<string> {\n\ttry {\n\t\tconst deviceIdPackage = await import('@vscode/deviceid');\n\t\tconst id = await deviceIdPackage.getDeviceId();\n\t\treturn id;\n\t} catch (err) {\n\t\terrorLogger(err);\n\t\treturn uuid.generateUuid();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { IAttachSessionEvent, ICloseSessionEvent, IExtensionHostDebugService, IOpenExtensionWindowResult, IReloadSessionEvent, ITerminateSessionEvent } from './extensionHostDebug.js';\n\nexport class ExtensionHostDebugBroadcastChannel<TContext> implements IServerChannel<TContext> {\n\n\tstatic readonly ChannelName = 'extensionhostdebugservice';\n\n\tprivate readonly _onCloseEmitter = new Emitter<ICloseSessionEvent>();\n\tprivate readonly _onReloadEmitter = new Emitter<IReloadSessionEvent>();\n\tprivate readonly _onTerminateEmitter = new Emitter<ITerminateSessionEvent>();\n\tprivate readonly _onAttachEmitter = new Emitter<IAttachSessionEvent>();\n\n\tcall(ctx: TContext, command: string, arg?: any): Promise<any> {\n\t\tswitch (command) {\n\t\t\tcase 'close':\n\t\t\t\treturn Promise.resolve(this._onCloseEmitter.fire({ sessionId: arg[0] }));\n\t\t\tcase 'reload':\n\t\t\t\treturn Promise.resolve(this._onReloadEmitter.fire({ sessionId: arg[0] }));\n\t\t\tcase 'terminate':\n\t\t\t\treturn Promise.resolve(this._onTerminateEmitter.fire({ sessionId: arg[0] }));\n\t\t\tcase 'attach':\n\t\t\t\treturn Promise.resolve(this._onAttachEmitter.fire({ sessionId: arg[0], port: arg[1], subId: arg[2] }));\n\t\t}\n\t\tthrow new Error('Method not implemented.');\n\t}\n\n\tlisten(ctx: TContext, event: string, arg?: any): Event<any> {\n\t\tswitch (event) {\n\t\t\tcase 'close':\n\t\t\t\treturn this._onCloseEmitter.event;\n\t\t\tcase 'reload':\n\t\t\t\treturn this._onReloadEmitter.event;\n\t\t\tcase 'terminate':\n\t\t\t\treturn this._onTerminateEmitter.event;\n\t\t\tcase 'attach':\n\t\t\t\treturn this._onAttachEmitter.event;\n\t\t}\n\t\tthrow new Error('Method not implemented.');\n\t}\n}\n\nexport class ExtensionHostDebugChannelClient extends Disposable implements IExtensionHostDebugService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tconstructor(private channel: IChannel) {\n\t\tsuper();\n\t}\n\n\treload(sessionId: string): void {\n\t\tthis.channel.call('reload', [sessionId]);\n\t}\n\n\tget onReload(): Event<IReloadSessionEvent> {\n\t\treturn this.channel.listen('reload');\n\t}\n\n\tclose(sessionId: string): void {\n\t\tthis.channel.call('close', [sessionId]);\n\t}\n\n\tget onClose(): Event<ICloseSessionEvent> {\n\t\treturn this.channel.listen('close');\n\t}\n\n\tattachSession(sessionId: string, port: number, subId?: string): void {\n\t\tthis.channel.call('attach', [sessionId, port, subId]);\n\t}\n\n\tget onAttachSession(): Event<IAttachSessionEvent> {\n\t\treturn this.channel.listen('attach');\n\t}\n\n\tterminateSession(sessionId: string, subId?: string): void {\n\t\tthis.channel.call('terminate', [sessionId, subId]);\n\t}\n\n\tget onTerminateSession(): Event<ITerminateSessionEvent> {\n\t\treturn this.channel.listen('terminate');\n\t}\n\n\topenExtensionDevelopmentHostWindow(args: string[], debugRenderer: boolean): Promise<IOpenExtensionWindowResult> {\n\t\treturn this.channel.call('openExtensionDevelopmentHostWindow', [args, debugRenderer]);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IURITransformer } from '../../../base/common/uriIpc.js';\nimport { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { IDownloadService } from './download.js';\n\nexport class DownloadServiceChannel implements IServerChannel {\n\n\tconstructor(private readonly service: IDownloadService) { }\n\n\tlisten(_: unknown, event: string, arg?: any): Event<any> {\n\t\tthrow new Error('Invalid listen');\n\t}\n\n\tcall(context: any, command: string, args?: any): Promise<any> {\n\t\tswitch (command) {\n\t\t\tcase 'download': return this.service.download(URI.revive(args[0]), URI.revive(args[1]));\n\t\t}\n\t\tthrow new Error('Invalid call');\n\t}\n}\n\nexport class DownloadServiceChannelClient implements IDownloadService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tconstructor(private channel: IChannel, private getUriTransformer: () => IURITransformer | null) { }\n\n\tasync download(from: URI, to: URI): Promise<void> {\n\t\tconst uriTransformer = this.getUriTransformer();\n\t\tif (uriTransformer) {\n\t\t\tfrom = uriTransformer.transformOutgoingURI(from);\n\t\t\tto = uriTransformer.transformOutgoingURI(to);\n\t\t}\n\t\tawait this.channel.call('download', [from, to]);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from './buffer.js';\nimport { MarshalledObject } from './marshalling.js';\nimport { MarshalledId } from './marshallingIds.js';\nimport { URI, UriComponents } from './uri.js';\n\nexport interface IURITransformer {\n\ttransformIncoming(uri: UriComponents): UriComponents;\n\ttransformOutgoing(uri: UriComponents): UriComponents;\n\ttransformOutgoingURI(uri: URI): URI;\n\ttransformOutgoingScheme(scheme: string): string;\n}\n\nexport interface UriParts {\n\tscheme: string;\n\tauthority?: string;\n\tpath?: string;\n\tquery?: string;\n\tfragment?: string;\n}\n\nexport interface IRawURITransformer {\n\ttransformIncoming(uri: UriParts): UriParts;\n\ttransformOutgoing(uri: UriParts): UriParts;\n\ttransformOutgoingScheme(scheme: string): string;\n}\n\nfunction toJSON(uri: URI): UriComponents {\n\treturn <UriComponents><any>uri.toJSON();\n}\n\nexport class URITransformer implements IURITransformer {\n\n\tprivate readonly _uriTransformer: IRawURITransformer;\n\n\tconstructor(uriTransformer: IRawURITransformer) {\n\t\tthis._uriTransformer = uriTransformer;\n\t}\n\n\tpublic transformIncoming(uri: UriComponents): UriComponents {\n\t\tconst result = this._uriTransformer.transformIncoming(uri);\n\t\treturn (result === uri ? uri : toJSON(URI.from(result)));\n\t}\n\n\tpublic transformOutgoing(uri: UriComponents): UriComponents {\n\t\tconst result = this._uriTransformer.transformOutgoing(uri);\n\t\treturn (result === uri ? uri : toJSON(URI.from(result)));\n\t}\n\n\tpublic transformOutgoingURI(uri: URI): URI {\n\t\tconst result = this._uriTransformer.transformOutgoing(uri);\n\t\treturn (result === uri ? uri : URI.from(result));\n\t}\n\n\tpublic transformOutgoingScheme(scheme: string): string {\n\t\treturn this._uriTransformer.transformOutgoingScheme(scheme);\n\t}\n}\n\nexport const DefaultURITransformer: IURITransformer = new class {\n\ttransformIncoming(uri: UriComponents) {\n\t\treturn uri;\n\t}\n\n\ttransformOutgoing(uri: UriComponents): UriComponents {\n\t\treturn uri;\n\t}\n\n\ttransformOutgoingURI(uri: URI): URI {\n\t\treturn uri;\n\t}\n\n\ttransformOutgoingScheme(scheme: string): string {\n\t\treturn scheme;\n\t}\n};\n\nfunction _transformOutgoingURIs(obj: any, transformer: IURITransformer, depth: number): any {\n\n\tif (!obj || depth > 200) {\n\t\treturn null;\n\t}\n\n\tif (typeof obj === 'object') {\n\t\tif (obj instanceof URI) {\n\t\t\treturn transformer.transformOutgoing(obj);\n\t\t}\n\n\t\t// walk object (or array)\n\t\tfor (const key in obj) {\n\t\t\tif (Object.hasOwnProperty.call(obj, key)) {\n\t\t\t\tconst r = _transformOutgoingURIs(obj[key], transformer, depth + 1);\n\t\t\t\tif (r !== null) {\n\t\t\t\t\tobj[key] = r;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function transformOutgoingURIs<T>(obj: T, transformer: IURITransformer): T {\n\tconst result = _transformOutgoingURIs(obj, transformer, 0);\n\tif (result === null) {\n\t\t// no change\n\t\treturn obj;\n\t}\n\treturn result;\n}\n\n\nfunction _transformIncomingURIs(obj: any, transformer: IURITransformer, revive: boolean, depth: number): any {\n\n\tif (!obj || depth > 200) {\n\t\treturn null;\n\t}\n\n\tif (typeof obj === 'object') {\n\n\t\tif ((<MarshalledObject>obj).$mid === MarshalledId.Uri) {\n\t\t\treturn revive ? URI.revive(transformer.transformIncoming(obj)) : transformer.transformIncoming(obj);\n\t\t}\n\n\t\tif (obj instanceof VSBuffer) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// walk object (or array)\n\t\tfor (const key in obj) {\n\t\t\tif (Object.hasOwnProperty.call(obj, key)) {\n\t\t\t\tconst r = _transformIncomingURIs(obj[key], transformer, revive, depth + 1);\n\t\t\t\tif (r !== null) {\n\t\t\t\t\tobj[key] = r;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function transformIncomingURIs<T>(obj: T, transformer: IURITransformer): T {\n\tconst result = _transformIncomingURIs(obj, transformer, false, 0);\n\tif (result === null) {\n\t\t// no change\n\t\treturn obj;\n\t}\n\treturn result;\n}\n\nexport function transformAndReviveIncomingURIs<T>(obj: T, transformer: IURITransformer): T {\n\tconst result = _transformIncomingURIs(obj, transformer, true, 0);\n\tif (result === null) {\n\t\t// no change\n\t\treturn obj;\n\t}\n\treturn result;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { cloneAndChange } from '../../../base/common/objects.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { DefaultURITransformer, IURITransformer, transformAndReviveIncomingURIs } from '../../../base/common/uriIpc.js';\nimport { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport {\n\tIExtensionIdentifier, IExtensionTipsService, IGalleryExtension, ILocalExtension, IExtensionsControlManifest, InstallOptions,\n\tUninstallOptions, Metadata, IExtensionManagementService, DidUninstallExtensionEvent, InstallExtensionEvent, InstallExtensionResult,\n\tUninstallExtensionEvent, InstallOperation, InstallExtensionInfo, IProductVersion, DidUpdateExtensionMetadata, UninstallExtensionInfo,\n\tIAllowedExtensionsService\n} from './extensionManagement.js';\nimport { ExtensionType, IExtensionManifest, TargetPlatform } from '../../extensions/common/extensions.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { CommontExtensionManagementService } from './abstractExtensionManagementService.js';\nimport { language } from '../../../base/common/platform.js';\n\nfunction transformIncomingURI(uri: UriComponents, transformer: IURITransformer | null): URI;\nfunction transformIncomingURI(uri: UriComponents | undefined, transformer: IURITransformer | null): URI | undefined;\nfunction transformIncomingURI(uri: UriComponents | undefined, transformer: IURITransformer | null): URI | undefined {\n\treturn uri ? URI.revive(transformer ? transformer.transformIncoming(uri) : uri) : undefined;\n}\n\nfunction transformOutgoingURI(uri: URI, transformer: IURITransformer | null): URI {\n\treturn transformer ? transformer.transformOutgoingURI(uri) : uri;\n}\n\nfunction transformIncomingExtension(extension: ILocalExtension, transformer: IURITransformer | null): ILocalExtension {\n\ttransformer = transformer ? transformer : DefaultURITransformer;\n\tconst manifest = extension.manifest;\n\tconst transformed = transformAndReviveIncomingURIs({ ...extension, ...{ manifest: undefined } }, transformer);\n\treturn { ...transformed, ...{ manifest } };\n}\n\nfunction transformIncomingOptions<O extends { profileLocation?: UriComponents }>(options: O | undefined, transformer: IURITransformer | null): O | undefined {\n\treturn options?.profileLocation ? transformAndReviveIncomingURIs(options, transformer ?? DefaultURITransformer) : options;\n}\n\nfunction transformOutgoingExtension(extension: ILocalExtension, transformer: IURITransformer | null): ILocalExtension {\n\treturn transformer ? cloneAndChange(extension, value => value instanceof URI ? transformer.transformOutgoingURI(value) : undefined) : extension;\n}\n\nexport class ExtensionManagementChannel implements IServerChannel {\n\n\tonInstallExtension: Event<InstallExtensionEvent>;\n\tonDidInstallExtensions: Event<readonly InstallExtensionResult[]>;\n\tonUninstallExtension: Event<UninstallExtensionEvent>;\n\tonDidUninstallExtension: Event<DidUninstallExtensionEvent>;\n\tonDidUpdateExtensionMetadata: Event<DidUpdateExtensionMetadata>;\n\n\tconstructor(private service: IExtensionManagementService, private getUriTransformer: (requestContext: any) => IURITransformer | null) {\n\t\tthis.onInstallExtension = Event.buffer(service.onInstallExtension, true);\n\t\tthis.onDidInstallExtensions = Event.buffer(service.onDidInstallExtensions, true);\n\t\tthis.onUninstallExtension = Event.buffer(service.onUninstallExtension, true);\n\t\tthis.onDidUninstallExtension = Event.buffer(service.onDidUninstallExtension, true);\n\t\tthis.onDidUpdateExtensionMetadata = Event.buffer(service.onDidUpdateExtensionMetadata, true);\n\t}\n\n\tlisten(context: any, event: string): Event<any> {\n\t\tconst uriTransformer = this.getUriTransformer(context);\n\t\tswitch (event) {\n\t\t\tcase 'onInstallExtension': {\n\t\t\t\treturn Event.map<InstallExtensionEvent, InstallExtensionEvent>(this.onInstallExtension, e => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...e,\n\t\t\t\t\t\tprofileLocation: e.profileLocation ? transformOutgoingURI(e.profileLocation, uriTransformer) : e.profileLocation\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\t\t\tcase 'onDidInstallExtensions': {\n\t\t\t\treturn Event.map<readonly InstallExtensionResult[], readonly InstallExtensionResult[]>(this.onDidInstallExtensions, results =>\n\t\t\t\t\tresults.map(i => ({\n\t\t\t\t\t\t...i,\n\t\t\t\t\t\tlocal: i.local ? transformOutgoingExtension(i.local, uriTransformer) : i.local,\n\t\t\t\t\t\tprofileLocation: i.profileLocation ? transformOutgoingURI(i.profileLocation, uriTransformer) : i.profileLocation\n\t\t\t\t\t})));\n\t\t\t}\n\t\t\tcase 'onUninstallExtension': {\n\t\t\t\treturn Event.map<UninstallExtensionEvent, UninstallExtensionEvent>(this.onUninstallExtension, e => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...e,\n\t\t\t\t\t\tprofileLocation: e.profileLocation ? transformOutgoingURI(e.profileLocation, uriTransformer) : e.profileLocation\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\t\t\tcase 'onDidUninstallExtension': {\n\t\t\t\treturn Event.map<DidUninstallExtensionEvent, DidUninstallExtensionEvent>(this.onDidUninstallExtension, e => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...e,\n\t\t\t\t\t\tprofileLocation: e.profileLocation ? transformOutgoingURI(e.profileLocation, uriTransformer) : e.profileLocation\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\t\t\tcase 'onDidUpdateExtensionMetadata': {\n\t\t\t\treturn Event.map<DidUpdateExtensionMetadata, DidUpdateExtensionMetadata>(this.onDidUpdateExtensionMetadata, e => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tlocal: transformOutgoingExtension(e.local, uriTransformer),\n\t\t\t\t\t\tprofileLocation: transformOutgoingURI(e.profileLocation, uriTransformer)\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error('Invalid listen');\n\t}\n\n\tasync call(context: any, command: string, args?: any): Promise<any> {\n\t\tconst uriTransformer: IURITransformer | null = this.getUriTransformer(context);\n\t\tswitch (command) {\n\t\t\tcase 'zip': {\n\t\t\t\tconst extension = transformIncomingExtension(args[0], uriTransformer);\n\t\t\t\tconst uri = await this.service.zip(extension);\n\t\t\t\treturn transformOutgoingURI(uri, uriTransformer);\n\t\t\t}\n\t\t\tcase 'install': {\n\t\t\t\treturn this.service.install(transformIncomingURI(args[0], uriTransformer), transformIncomingOptions(args[1], uriTransformer));\n\t\t\t}\n\t\t\tcase 'installFromLocation': {\n\t\t\t\treturn this.service.installFromLocation(transformIncomingURI(args[0], uriTransformer), transformIncomingURI(args[1], uriTransformer));\n\t\t\t}\n\t\t\tcase 'installExtensionsFromProfile': {\n\t\t\t\treturn this.service.installExtensionsFromProfile(args[0], transformIncomingURI(args[1], uriTransformer), transformIncomingURI(args[2], uriTransformer));\n\t\t\t}\n\t\t\tcase 'getManifest': {\n\t\t\t\treturn this.service.getManifest(transformIncomingURI(args[0], uriTransformer));\n\t\t\t}\n\t\t\tcase 'getTargetPlatform': {\n\t\t\t\treturn this.service.getTargetPlatform();\n\t\t\t}\n\t\t\tcase 'installFromGallery': {\n\t\t\t\treturn this.service.installFromGallery(args[0], transformIncomingOptions(args[1], uriTransformer));\n\t\t\t}\n\t\t\tcase 'installGalleryExtensions': {\n\t\t\t\tconst arg: InstallExtensionInfo[] = args[0];\n\t\t\t\treturn this.service.installGalleryExtensions(arg.map(({ extension, options }) => ({ extension, options: transformIncomingOptions(options, uriTransformer) ?? {} })));\n\t\t\t}\n\t\t\tcase 'uninstall': {\n\t\t\t\treturn this.service.uninstall(transformIncomingExtension(args[0], uriTransformer), transformIncomingOptions(args[1], uriTransformer));\n\t\t\t}\n\t\t\tcase 'uninstallExtensions': {\n\t\t\t\tconst arg: UninstallExtensionInfo[] = args[0];\n\t\t\t\treturn this.service.uninstallExtensions(arg.map(({ extension, options }) => ({ extension: transformIncomingExtension(extension, uriTransformer), options: transformIncomingOptions(options, uriTransformer) })));\n\t\t\t}\n\t\t\tcase 'getInstalled': {\n\t\t\t\tconst extensions = await this.service.getInstalled(args[0], transformIncomingURI(args[1], uriTransformer), args[2], args[3]);\n\t\t\t\treturn extensions.map(e => transformOutgoingExtension(e, uriTransformer));\n\t\t\t}\n\t\t\tcase 'toggleApplicationScope': {\n\t\t\t\tconst extension = await this.service.toggleApplicationScope(transformIncomingExtension(args[0], uriTransformer), transformIncomingURI(args[1], uriTransformer));\n\t\t\t\treturn transformOutgoingExtension(extension, uriTransformer);\n\t\t\t}\n\t\t\tcase 'copyExtensions': {\n\t\t\t\treturn this.service.copyExtensions(transformIncomingURI(args[0], uriTransformer), transformIncomingURI(args[1], uriTransformer));\n\t\t\t}\n\t\t\tcase 'updateMetadata': {\n\t\t\t\tconst e = await this.service.updateMetadata(transformIncomingExtension(args[0], uriTransformer), args[1], transformIncomingURI(args[2], uriTransformer));\n\t\t\t\treturn transformOutgoingExtension(e, uriTransformer);\n\t\t\t}\n\t\t\tcase 'resetPinnedStateForAllUserExtensions': {\n\t\t\t\treturn this.service.resetPinnedStateForAllUserExtensions(args[0]);\n\t\t\t}\n\t\t\tcase 'getExtensionsControlManifest': {\n\t\t\t\treturn this.service.getExtensionsControlManifest();\n\t\t\t}\n\t\t\tcase 'download': {\n\t\t\t\treturn this.service.download(args[0], args[1], args[2]);\n\t\t\t}\n\t\t\tcase 'cleanUp': {\n\t\t\t\treturn this.service.cleanUp();\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error('Invalid call');\n\t}\n}\n\nexport interface ExtensionEventResult {\n\treadonly profileLocation: URI;\n\treadonly local?: ILocalExtension;\n\treadonly applicationScoped?: boolean;\n}\n\nexport class ExtensionManagementChannelClient extends CommontExtensionManagementService implements IExtensionManagementService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprotected readonly _onInstallExtension = this._register(new Emitter<InstallExtensionEvent>());\n\tget onInstallExtension() { return this._onInstallExtension.event; }\n\n\tprotected readonly _onDidInstallExtensions = this._register(new Emitter<readonly InstallExtensionResult[]>());\n\tget onDidInstallExtensions() { return this._onDidInstallExtensions.event; }\n\n\tprotected readonly _onUninstallExtension = this._register(new Emitter<UninstallExtensionEvent>());\n\tget onUninstallExtension() { return this._onUninstallExtension.event; }\n\n\tprotected readonly _onDidUninstallExtension = this._register(new Emitter<DidUninstallExtensionEvent>());\n\tget onDidUninstallExtension() { return this._onDidUninstallExtension.event; }\n\n\tprotected readonly _onDidUpdateExtensionMetadata = this._register(new Emitter<DidUpdateExtensionMetadata>());\n\tget onDidUpdateExtensionMetadata() { return this._onDidUpdateExtensionMetadata.event; }\n\n\tconstructor(\n\t\tprivate readonly channel: IChannel,\n\t\tproductService: IProductService,\n\t\tallowedExtensionsService: IAllowedExtensionsService,\n\t) {\n\t\tsuper(productService, allowedExtensionsService);\n\t\tthis._register(this.channel.listen<InstallExtensionEvent>('onInstallExtension')(e => this.onInstallExtensionEvent({ ...e, source: this.isUriComponents(e.source) ? URI.revive(e.source) : e.source, profileLocation: URI.revive(e.profileLocation) })));\n\t\tthis._register(this.channel.listen<readonly InstallExtensionResult[]>('onDidInstallExtensions')(results => this.onDidInstallExtensionsEvent(results.map(e => ({ ...e, local: e.local ? transformIncomingExtension(e.local, null) : e.local, source: this.isUriComponents(e.source) ? URI.revive(e.source) : e.source, profileLocation: URI.revive(e.profileLocation) })))));\n\t\tthis._register(this.channel.listen<UninstallExtensionEvent>('onUninstallExtension')(e => this.onUninstallExtensionEvent({ ...e, profileLocation: URI.revive(e.profileLocation) })));\n\t\tthis._register(this.channel.listen<DidUninstallExtensionEvent>('onDidUninstallExtension')(e => this.onDidUninstallExtensionEvent({ ...e, profileLocation: URI.revive(e.profileLocation) })));\n\t\tthis._register(this.channel.listen<DidUpdateExtensionMetadata>('onDidUpdateExtensionMetadata')(e => this.onDidUpdateExtensionMetadataEvent({ profileLocation: URI.revive(e.profileLocation), local: transformIncomingExtension(e.local, null) })));\n\t}\n\n\tprotected onInstallExtensionEvent(event: InstallExtensionEvent): void {\n\t\tthis._onInstallExtension.fire(event);\n\t}\n\n\tprotected onDidInstallExtensionsEvent(results: readonly InstallExtensionResult[]): void {\n\t\tthis._onDidInstallExtensions.fire(results);\n\t}\n\n\tprotected onUninstallExtensionEvent(event: UninstallExtensionEvent): void {\n\t\tthis._onUninstallExtension.fire(event);\n\t}\n\n\tprotected onDidUninstallExtensionEvent(event: DidUninstallExtensionEvent): void {\n\t\tthis._onDidUninstallExtension.fire(event);\n\t}\n\n\tprotected onDidUpdateExtensionMetadataEvent(event: DidUpdateExtensionMetadata): void {\n\t\tthis._onDidUpdateExtensionMetadata.fire(event);\n\t}\n\n\tprivate isUriComponents(thing: unknown): thing is UriComponents {\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (<any>thing).path === 'string' &&\n\t\t\ttypeof (<any>thing).scheme === 'string';\n\t}\n\n\tprotected _targetPlatformPromise: Promise<TargetPlatform> | undefined;\n\tgetTargetPlatform(): Promise<TargetPlatform> {\n\t\tif (!this._targetPlatformPromise) {\n\t\t\tthis._targetPlatformPromise = this.channel.call<TargetPlatform>('getTargetPlatform');\n\t\t}\n\t\treturn this._targetPlatformPromise;\n\t}\n\n\tzip(extension: ILocalExtension): Promise<URI> {\n\t\treturn Promise.resolve(this.channel.call<UriComponents>('zip', [extension]).then(result => URI.revive(result)));\n\t}\n\n\tinstall(vsix: URI, options?: InstallOptions): Promise<ILocalExtension> {\n\t\treturn Promise.resolve(this.channel.call<ILocalExtension>('install', [vsix, options])).then(local => transformIncomingExtension(local, null));\n\t}\n\n\tinstallFromLocation(location: URI, profileLocation: URI): Promise<ILocalExtension> {\n\t\treturn Promise.resolve(this.channel.call<ILocalExtension>('installFromLocation', [location, profileLocation])).then(local => transformIncomingExtension(local, null));\n\t}\n\n\tasync installExtensionsFromProfile(extensions: IExtensionIdentifier[], fromProfileLocation: URI, toProfileLocation: URI): Promise<ILocalExtension[]> {\n\t\tconst result = await this.channel.call<ILocalExtension[]>('installExtensionsFromProfile', [extensions, fromProfileLocation, toProfileLocation]);\n\t\treturn result.map(local => transformIncomingExtension(local, null));\n\t}\n\n\tgetManifest(vsix: URI): Promise<IExtensionManifest> {\n\t\treturn Promise.resolve(this.channel.call<IExtensionManifest>('getManifest', [vsix]));\n\t}\n\n\tinstallFromGallery(extension: IGalleryExtension, installOptions?: InstallOptions): Promise<ILocalExtension> {\n\t\treturn Promise.resolve(this.channel.call<ILocalExtension>('installFromGallery', [extension, installOptions])).then(local => transformIncomingExtension(local, null));\n\t}\n\n\tasync installGalleryExtensions(extensions: InstallExtensionInfo[]): Promise<InstallExtensionResult[]> {\n\t\tconst results = await this.channel.call<InstallExtensionResult[]>('installGalleryExtensions', [extensions]);\n\t\treturn results.map(e => ({ ...e, local: e.local ? transformIncomingExtension(e.local, null) : e.local, source: this.isUriComponents(e.source) ? URI.revive(e.source) : e.source, profileLocation: URI.revive(e.profileLocation) }));\n\t}\n\n\tuninstall(extension: ILocalExtension, options?: UninstallOptions): Promise<void> {\n\t\tif (extension.isWorkspaceScoped) {\n\t\t\tthrow new Error('Cannot uninstall a workspace extension');\n\t\t}\n\t\treturn Promise.resolve(this.channel.call<void>('uninstall', [extension, options]));\n\t}\n\n\tuninstallExtensions(extensions: UninstallExtensionInfo[]): Promise<void> {\n\t\tif (extensions.some(e => e.extension.isWorkspaceScoped)) {\n\t\t\tthrow new Error('Cannot uninstall a workspace extension');\n\t\t}\n\t\treturn Promise.resolve(this.channel.call<void>('uninstallExtensions', [extensions]));\n\n\t}\n\n\tgetInstalled(type: ExtensionType | null = null, extensionsProfileResource?: URI, productVersion?: IProductVersion): Promise<ILocalExtension[]> {\n\t\treturn Promise.resolve(this.channel.call<ILocalExtension[]>('getInstalled', [type, extensionsProfileResource, productVersion, language]))\n\t\t\t.then(extensions => extensions.map(extension => transformIncomingExtension(extension, null)));\n\t}\n\n\tupdateMetadata(local: ILocalExtension, metadata: Partial<Metadata>, extensionsProfileResource?: URI): Promise<ILocalExtension> {\n\t\treturn Promise.resolve(this.channel.call<ILocalExtension>('updateMetadata', [local, metadata, extensionsProfileResource]))\n\t\t\t.then(extension => transformIncomingExtension(extension, null));\n\t}\n\n\tresetPinnedStateForAllUserExtensions(pinned: boolean): Promise<void> {\n\t\treturn this.channel.call<void>('resetPinnedStateForAllUserExtensions', [pinned]);\n\t}\n\n\ttoggleApplicationScope(local: ILocalExtension, fromProfileLocation: URI): Promise<ILocalExtension> {\n\t\treturn this.channel.call<ILocalExtension>('toggleApplicationScope', [local, fromProfileLocation])\n\t\t\t.then(extension => transformIncomingExtension(extension, null));\n\t}\n\n\tcopyExtensions(fromProfileLocation: URI, toProfileLocation: URI): Promise<void> {\n\t\treturn this.channel.call<void>('copyExtensions', [fromProfileLocation, toProfileLocation]);\n\t}\n\n\tgetExtensionsControlManifest(): Promise<IExtensionsControlManifest> {\n\t\treturn Promise.resolve(this.channel.call<IExtensionsControlManifest>('getExtensionsControlManifest'));\n\t}\n\n\tasync download(extension: IGalleryExtension, operation: InstallOperation, donotVerifySignature: boolean): Promise<URI> {\n\t\tconst result = await this.channel.call<UriComponents>('download', [extension, operation, donotVerifySignature]);\n\t\treturn URI.revive(result);\n\t}\n\n\tasync cleanUp(): Promise<void> {\n\t\treturn this.channel.call('cleanUp');\n\t}\n\n\tregisterParticipant() { throw new Error('Not Supported'); }\n}\n\nexport class ExtensionTipsChannel implements IServerChannel {\n\n\tconstructor(private service: IExtensionTipsService) {\n\t}\n\n\tlisten(context: any, event: string): Event<any> {\n\t\tthrow new Error('Invalid listen');\n\t}\n\n\tcall(context: any, command: string, args?: any): Promise<any> {\n\t\tswitch (command) {\n\t\t\tcase 'getConfigBasedTips': return this.service.getConfigBasedTips(URI.revive(args[0]));\n\t\t\tcase 'getImportantExecutableBasedTips': return this.service.getImportantExecutableBasedTips();\n\t\t\tcase 'getOtherExecutableBasedTips': return this.service.getOtherExecutableBasedTips();\n\t\t}\n\n\t\tthrow new Error('Invalid call');\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { bufferToStream, streamToBuffer, VSBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { Event } from '../../../base/common/event.js';\nimport { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { IHeaders, IRequestContext, IRequestOptions } from '../../../base/parts/request/common/request.js';\nimport { AuthInfo, Credentials, IRequestService } from './request.js';\n\ntype RequestResponse = [\n\t{\n\t\theaders: IHeaders;\n\t\tstatusCode?: number;\n\t},\n\tVSBuffer\n];\n\nexport class RequestChannel implements IServerChannel {\n\n\tconstructor(private readonly service: IRequestService) { }\n\n\tlisten(context: any, event: string): Event<any> {\n\t\tthrow new Error('Invalid listen');\n\t}\n\n\tcall(context: any, command: string, args?: any, token: CancellationToken = CancellationToken.None): Promise<any> {\n\t\tswitch (command) {\n\t\t\tcase 'request': return this.service.request(args[0], token)\n\t\t\t\t.then(async ({ res, stream }) => {\n\t\t\t\t\tconst buffer = await streamToBuffer(stream);\n\t\t\t\t\treturn <RequestResponse>[{ statusCode: res.statusCode, headers: res.headers }, buffer];\n\t\t\t\t});\n\t\t\tcase 'resolveProxy': return this.service.resolveProxy(args[0]);\n\t\t\tcase 'lookupAuthorization': return this.service.lookupAuthorization(args[0]);\n\t\t\tcase 'lookupKerberosAuthorization': return this.service.lookupKerberosAuthorization(args[0]);\n\t\t\tcase 'loadCertificates': return this.service.loadCertificates();\n\t\t}\n\t\tthrow new Error('Invalid call');\n\t}\n}\n\nexport class RequestChannelClient implements IRequestService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tconstructor(private readonly channel: IChannel) { }\n\n\tasync request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext> {\n\t\tconst [res, buffer] = await this.channel.call<RequestResponse>('request', [options], token);\n\t\treturn { res, stream: bufferToStream(buffer) };\n\t}\n\n\tasync resolveProxy(url: string): Promise<string | undefined> {\n\t\treturn this.channel.call<string | undefined>('resolveProxy', [url]);\n\t}\n\n\tasync lookupAuthorization(authInfo: AuthInfo): Promise<Credentials | undefined> {\n\t\treturn this.channel.call<{ username: string; password: string } | undefined>('lookupAuthorization', [authInfo]);\n\t}\n\n\tasync lookupKerberosAuthorization(url: string): Promise<string | undefined> {\n\t\treturn this.channel.call<string | undefined>('lookupKerberosAuthorization', [url]);\n\t}\n\n\tasync loadCertificates(): Promise<string[]> {\n\t\treturn this.channel.call<string[]>('loadCertificates');\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { binarySearch } from '../../../base/common/arrays.js';\nimport { errorHandler, ErrorNoTelemetry } from '../../../base/common/errors.js';\nimport { DisposableStore, toDisposable } from '../../../base/common/lifecycle.js';\nimport { safeStringify } from '../../../base/common/objects.js';\nimport { FileOperationError } from '../../files/common/files.js';\nimport { ITelemetryService } from './telemetry.js';\n\ntype ErrorEventFragment = {\n\towner: 'lramos15, sbatten';\n\tcomment: 'Whenever an error in VS Code is thrown.';\n\tcallstack: { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth'; comment: 'The callstack of the error.' };\n\tmsg?: { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth'; comment: 'The message of the error. Normally the first line int the callstack.' };\n\tfile?: { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth'; comment: 'The file the error originated from.' };\n\tline?: { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth'; comment: 'The line the error originate on.' };\n\tcolumn?: { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth'; comment: 'The column of the line which the error orginated on.' };\n\tuncaught_error_name?: { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth'; comment: 'If the error is uncaught what is the error type' };\n\tuncaught_error_msg?: { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth'; comment: 'If the error is uncaught this is just msg but for uncaught errors.' };\n\tcount?: { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth'; comment: 'How many times this error has been thrown' };\n};\nexport interface ErrorEvent {\n\tcallstack: string;\n\tmsg?: string;\n\tfile?: string;\n\tline?: number;\n\tcolumn?: number;\n\tuncaught_error_name?: string;\n\tuncaught_error_msg?: string;\n\tcount?: number;\n}\n\nexport namespace ErrorEvent {\n\texport function compare(a: ErrorEvent, b: ErrorEvent) {\n\t\tif (a.callstack < b.callstack) {\n\t\t\treturn -1;\n\t\t} else if (a.callstack > b.callstack) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t}\n}\n\nexport default abstract class BaseErrorTelemetry {\n\n\tpublic static ERROR_FLUSH_TIMEOUT: number = 5 * 1000;\n\n\tprivate _telemetryService: ITelemetryService;\n\tprivate _flushDelay: number;\n\tprivate _flushHandle: Timeout | undefined = undefined;\n\tprivate _buffer: ErrorEvent[] = [];\n\tprotected readonly _disposables = new DisposableStore();\n\n\tconstructor(telemetryService: ITelemetryService, flushDelay = BaseErrorTelemetry.ERROR_FLUSH_TIMEOUT) {\n\t\tthis._telemetryService = telemetryService;\n\t\tthis._flushDelay = flushDelay;\n\n\t\t// (1) check for unexpected but handled errors\n\t\tconst unbind = errorHandler.addListener((err) => this._onErrorEvent(err));\n\t\tthis._disposables.add(toDisposable(unbind));\n\n\t\t// (2) install implementation-specific error listeners\n\t\tthis.installErrorListeners();\n\t}\n\n\tdispose() {\n\t\tclearTimeout(this._flushHandle);\n\t\tthis._flushBuffer();\n\t\tthis._disposables.dispose();\n\t}\n\n\tprotected installErrorListeners(): void {\n\t\t// to override\n\t}\n\n\tprivate _onErrorEvent(err: any): void {\n\n\t\tif (!err || err.code) {\n\t\t\treturn;\n\t\t}\n\n\t\t// unwrap nested errors from loader\n\t\tif (err.detail && err.detail.stack) {\n\t\t\terr = err.detail;\n\t\t}\n\n\t\t// If it's the no telemetry error it doesn't get logged\n\t\t// TOOD @lramos15 hacking in FileOperation error because it's too messy to adopt ErrorNoTelemetry. A better solution should be found\n\t\tif (ErrorNoTelemetry.isErrorNoTelemetry(err) || err instanceof FileOperationError || (typeof err?.message === 'string' && err.message.includes('Unable to read file'))) {\n\t\t\treturn;\n\t\t}\n\n\t\t// work around behavior in workerServer.ts that breaks up Error.stack\n\t\tconst callstack = Array.isArray(err.stack) ? err.stack.join('\\n') : err.stack;\n\t\tconst msg = err.message ? err.message : safeStringify(err);\n\n\t\t// errors without a stack are not useful telemetry\n\t\tif (!callstack) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._enqueue({ msg, callstack });\n\t}\n\n\tprotected _enqueue(e: ErrorEvent): void {\n\n\t\tconst idx = binarySearch(this._buffer, e, ErrorEvent.compare);\n\t\tif (idx < 0) {\n\t\t\te.count = 1;\n\t\t\tthis._buffer.splice(~idx, 0, e);\n\t\t} else {\n\t\t\tif (!this._buffer[idx].count) {\n\t\t\t\tthis._buffer[idx].count = 0;\n\t\t\t}\n\t\t\tthis._buffer[idx].count! += 1;\n\t\t}\n\n\t\tif (this._flushHandle === undefined) {\n\t\t\tthis._flushHandle = setTimeout(() => {\n\t\t\t\tthis._flushBuffer();\n\t\t\t\tthis._flushHandle = undefined;\n\t\t\t}, this._flushDelay);\n\t\t}\n\t}\n\n\tprivate _flushBuffer(): void {\n\t\tfor (const error of this._buffer) {\n\t\t\ttype UnhandledErrorClassification = {} & ErrorEventFragment;\n\t\t\tthis._telemetryService.publicLogError2<ErrorEvent, UnhandledErrorClassification>('UnhandledError', error);\n\t\t}\n\t\tthis._buffer.length = 0;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { isCancellationError, isSigPipeError, onUnexpectedError, setUnexpectedErrorHandler } from '../../../base/common/errors.js';\nimport BaseErrorTelemetry from '../common/errorTelemetry.js';\n\nexport default class ErrorTelemetry extends BaseErrorTelemetry {\n\tprotected override installErrorListeners(): void {\n\t\tsetUnexpectedErrorHandler(err => console.error(err));\n\n\t\t// Print a console message when rejection isn't handled within N seconds. For details:\n\t\t// see https://nodejs.org/api/process.html#process_event_unhandledrejection\n\t\t// and https://nodejs.org/api/process.html#process_event_rejectionhandled\n\t\tconst unhandledPromises: Promise<any>[] = [];\n\t\tprocess.on('unhandledRejection', (reason: any, promise: Promise<any>) => {\n\t\t\tunhandledPromises.push(promise);\n\t\t\tsetTimeout(() => {\n\t\t\t\tconst idx = unhandledPromises.indexOf(promise);\n\t\t\t\tif (idx >= 0) {\n\t\t\t\t\tpromise.catch(e => {\n\t\t\t\t\t\tunhandledPromises.splice(idx, 1);\n\t\t\t\t\t\tif (!isCancellationError(e)) {\n\t\t\t\t\t\t\tconsole.warn(`rejected promise not handled within 1 second: ${e}`);\n\t\t\t\t\t\t\tif (e.stack) {\n\t\t\t\t\t\t\t\tconsole.warn(`stack trace: ${e.stack}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (reason) {\n\t\t\t\t\t\t\t\tonUnexpectedError(reason);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}, 1000);\n\t\t});\n\n\t\tprocess.on('rejectionHandled', (promise: Promise<any>) => {\n\t\t\tconst idx = unhandledPromises.indexOf(promise);\n\t\t\tif (idx >= 0) {\n\t\t\t\tunhandledPromises.splice(idx, 1);\n\t\t\t}\n\t\t});\n\n\t\t// Print a console message when an exception isn't handled.\n\t\tprocess.on('uncaughtException', (err: Error | NodeJS.ErrnoException) => {\n\t\t\tif (isSigPipeError(err)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonUnexpectedError(err);\n\t\t});\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { IProcessEnvironment, OperatingSystem } from '../../../base/common/platform.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { IPtyHostProcessReplayEvent, ISerializedCommandDetectionCapability, ITerminalCapabilityStore, type ITerminalCommand } from './capabilities/capabilities.js';\nimport { IGetTerminalLayoutInfoArgs, IProcessDetails, ISetTerminalLayoutInfoArgs } from './terminalProcess.js';\nimport { ThemeIcon } from '../../../base/common/themables.js';\nimport { ISerializableEnvironmentVariableCollections } from './environmentVariable.js';\nimport { RawContextKey } from '../../contextkey/common/contextkey.js';\nimport { IWorkspaceFolder } from '../../workspace/common/workspace.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport type * as performance from '../../../base/common/performance.js';\nimport { ILogService } from '../../log/common/log.js';\nimport type { IAction } from '../../../base/common/actions.js';\nimport type { IDisposable } from '../../../base/common/lifecycle.js';\n\nexport const terminalTabFocusModeContextKey = new RawContextKey<boolean>('terminalTabFocusMode', false, true);\n\nexport const enum TerminalSettingPrefix {\n\tAutomationProfile = 'terminal.integrated.automationProfile.',\n\tDefaultProfile = 'terminal.integrated.defaultProfile.',\n\tProfiles = 'terminal.integrated.profiles.'\n}\n\nexport const enum TerminalSettingId {\n\tSendKeybindingsToShell = 'terminal.integrated.sendKeybindingsToShell',\n\tAutomationProfileLinux = 'terminal.integrated.automationProfile.linux',\n\tAutomationProfileMacOs = 'terminal.integrated.automationProfile.osx',\n\tAutomationProfileWindows = 'terminal.integrated.automationProfile.windows',\n\tProfilesWindows = 'terminal.integrated.profiles.windows',\n\tProfilesMacOs = 'terminal.integrated.profiles.osx',\n\tProfilesLinux = 'terminal.integrated.profiles.linux',\n\tDefaultProfileLinux = 'terminal.integrated.defaultProfile.linux',\n\tDefaultProfileMacOs = 'terminal.integrated.defaultProfile.osx',\n\tDefaultProfileWindows = 'terminal.integrated.defaultProfile.windows',\n\tUseWslProfiles = 'terminal.integrated.useWslProfiles',\n\tTabsDefaultColor = 'terminal.integrated.tabs.defaultColor',\n\tTabsDefaultIcon = 'terminal.integrated.tabs.defaultIcon',\n\tTabsEnabled = 'terminal.integrated.tabs.enabled',\n\tTabsEnableAnimation = 'terminal.integrated.tabs.enableAnimation',\n\tTabsHideCondition = 'terminal.integrated.tabs.hideCondition',\n\tTabsShowActiveTerminal = 'terminal.integrated.tabs.showActiveTerminal',\n\tTabsShowActions = 'terminal.integrated.tabs.showActions',\n\tTabsLocation = 'terminal.integrated.tabs.location',\n\tTabsFocusMode = 'terminal.integrated.tabs.focusMode',\n\tMacOptionIsMeta = 'terminal.integrated.macOptionIsMeta',\n\tMacOptionClickForcesSelection = 'terminal.integrated.macOptionClickForcesSelection',\n\tAltClickMovesCursor = 'terminal.integrated.altClickMovesCursor',\n\tCopyOnSelection = 'terminal.integrated.copyOnSelection',\n\tEnableMultiLinePasteWarning = 'terminal.integrated.enableMultiLinePasteWarning',\n\tDrawBoldTextInBrightColors = 'terminal.integrated.drawBoldTextInBrightColors',\n\tFontFamily = 'terminal.integrated.fontFamily',\n\tFontSize = 'terminal.integrated.fontSize',\n\tLetterSpacing = 'terminal.integrated.letterSpacing',\n\tLineHeight = 'terminal.integrated.lineHeight',\n\tMinimumContrastRatio = 'terminal.integrated.minimumContrastRatio',\n\tTabStopWidth = 'terminal.integrated.tabStopWidth',\n\tFastScrollSensitivity = 'terminal.integrated.fastScrollSensitivity',\n\tMouseWheelScrollSensitivity = 'terminal.integrated.mouseWheelScrollSensitivity',\n\tBellDuration = 'terminal.integrated.bellDuration',\n\tFontWeight = 'terminal.integrated.fontWeight',\n\tFontWeightBold = 'terminal.integrated.fontWeightBold',\n\tCursorBlinking = 'terminal.integrated.cursorBlinking',\n\tCursorStyle = 'terminal.integrated.cursorStyle',\n\tCursorStyleInactive = 'terminal.integrated.cursorStyleInactive',\n\tCursorWidth = 'terminal.integrated.cursorWidth',\n\tScrollback = 'terminal.integrated.scrollback',\n\tDetectLocale = 'terminal.integrated.detectLocale',\n\tDefaultLocation = 'terminal.integrated.defaultLocation',\n\tGpuAcceleration = 'terminal.integrated.gpuAcceleration',\n\tTerminalTitleSeparator = 'terminal.integrated.tabs.separator',\n\tTerminalTitle = 'terminal.integrated.tabs.title',\n\tTerminalDescription = 'terminal.integrated.tabs.description',\n\tRightClickBehavior = 'terminal.integrated.rightClickBehavior',\n\tMiddleClickBehavior = 'terminal.integrated.middleClickBehavior',\n\tCwd = 'terminal.integrated.cwd',\n\tConfirmOnExit = 'terminal.integrated.confirmOnExit',\n\tConfirmOnKill = 'terminal.integrated.confirmOnKill',\n\tEnableBell = 'terminal.integrated.enableBell',\n\tEnableVisualBell = 'terminal.integrated.enableVisualBell',\n\tCommandsToSkipShell = 'terminal.integrated.commandsToSkipShell',\n\tAllowChords = 'terminal.integrated.allowChords',\n\tAllowMnemonics = 'terminal.integrated.allowMnemonics',\n\tTabFocusMode = 'terminal.integrated.tabFocusMode',\n\tEnvMacOs = 'terminal.integrated.env.osx',\n\tEnvLinux = 'terminal.integrated.env.linux',\n\tEnvWindows = 'terminal.integrated.env.windows',\n\tEnvironmentChangesIndicator = 'terminal.integrated.environmentChangesIndicator',\n\tEnvironmentChangesRelaunch = 'terminal.integrated.environmentChangesRelaunch',\n\tShowExitAlert = 'terminal.integrated.showExitAlert',\n\tSplitCwd = 'terminal.integrated.splitCwd',\n\tWindowsEnableConpty = 'terminal.integrated.windowsEnableConpty',\n\tWindowsUseConptyDll = 'terminal.integrated.windowsUseConptyDll',\n\tWordSeparators = 'terminal.integrated.wordSeparators',\n\tEnableFileLinks = 'terminal.integrated.enableFileLinks',\n\tAllowedLinkSchemes = 'terminal.integrated.allowedLinkSchemes',\n\tUnicodeVersion = 'terminal.integrated.unicodeVersion',\n\tEnablePersistentSessions = 'terminal.integrated.enablePersistentSessions',\n\tPersistentSessionReviveProcess = 'terminal.integrated.persistentSessionReviveProcess',\n\tHideOnStartup = 'terminal.integrated.hideOnStartup',\n\tHideOnLastClosed = 'terminal.integrated.hideOnLastClosed',\n\tCustomGlyphs = 'terminal.integrated.customGlyphs',\n\tRescaleOverlappingGlyphs = 'terminal.integrated.rescaleOverlappingGlyphs',\n\tPersistentSessionScrollback = 'terminal.integrated.persistentSessionScrollback',\n\tInheritEnv = 'terminal.integrated.inheritEnv',\n\tShowLinkHover = 'terminal.integrated.showLinkHover',\n\tIgnoreProcessNames = 'terminal.integrated.ignoreProcessNames',\n\tShellIntegrationEnabled = 'terminal.integrated.shellIntegration.enabled',\n\tShellIntegrationShowWelcome = 'terminal.integrated.shellIntegration.showWelcome',\n\tShellIntegrationDecorationsEnabled = 'terminal.integrated.shellIntegration.decorationsEnabled',\n\tShellIntegrationEnvironmentReporting = 'terminal.integrated.shellIntegration.environmentReporting',\n\tEnableImages = 'terminal.integrated.enableImages',\n\tSmoothScrolling = 'terminal.integrated.smoothScrolling',\n\tIgnoreBracketedPasteMode = 'terminal.integrated.ignoreBracketedPasteMode',\n\tFocusAfterRun = 'terminal.integrated.focusAfterRun',\n\tFontLigaturesEnabled = 'terminal.integrated.fontLigatures.enabled',\n\tFontLigaturesFeatureSettings = 'terminal.integrated.fontLigatures.featureSettings',\n\tFontLigaturesFallbackLigatures = 'terminal.integrated.fontLigatures.fallbackLigatures',\n\n\t// Debug settings that are hidden from user\n\n\t/** Simulated latency applied to all calls made to the pty host */\n\tDeveloperPtyHostLatency = 'terminal.integrated.developer.ptyHost.latency',\n\t/** Simulated startup delay of the pty host process */\n\tDeveloperPtyHostStartupDelay = 'terminal.integrated.developer.ptyHost.startupDelay',\n\t/** Shows the textarea element */\n\tDevMode = 'terminal.integrated.developer.devMode'\n}\n\nexport const enum PosixShellType {\n\tBash = 'bash',\n\tFish = 'fish',\n\tSh = 'sh',\n\tCsh = 'csh',\n\tKsh = 'ksh',\n\tZsh = 'zsh',\n\n}\nexport const enum WindowsShellType {\n\tCommandPrompt = 'cmd',\n\tWsl = 'wsl',\n\tGitBash = 'gitbash',\n}\n\nexport const enum GeneralShellType {\n\tPowerShell = 'pwsh',\n\tPython = 'python',\n\tJulia = 'julia',\n\tNuShell = 'nu',\n\tNode = 'node',\n}\nexport type TerminalShellType = PosixShellType | WindowsShellType | GeneralShellType;\n\nexport interface IRawTerminalInstanceLayoutInfo<T> {\n\trelativeSize: number;\n\tterminal: T;\n}\nexport type ITerminalInstanceLayoutInfoById = IRawTerminalInstanceLayoutInfo<number>;\nexport type ITerminalInstanceLayoutInfo = IRawTerminalInstanceLayoutInfo<IPtyHostAttachTarget>;\n\nexport interface IRawTerminalTabLayoutInfo<T> {\n\tisActive: boolean;\n\tactivePersistentProcessId: number | undefined;\n\tterminals: IRawTerminalInstanceLayoutInfo<T>[];\n}\n\nexport type ITerminalTabLayoutInfoById = IRawTerminalTabLayoutInfo<number>;\n\nexport interface IRawTerminalsLayoutInfo<T> {\n\ttabs: IRawTerminalTabLayoutInfo<T>[];\n}\n\nexport interface IPtyHostAttachTarget {\n\tid: number;\n\tpid: number;\n\ttitle: string;\n\ttitleSource: TitleEventSource;\n\tcwd: string;\n\tworkspaceId: string;\n\tworkspaceName: string;\n\tisOrphan: boolean;\n\ticon: TerminalIcon | undefined;\n\tfixedDimensions: IFixedTerminalDimensions | undefined;\n\tenvironmentVariableCollections: ISerializableEnvironmentVariableCollections | undefined;\n\treconnectionProperties?: IReconnectionProperties;\n\twaitOnExit?: WaitOnExitValue;\n\thideFromUser?: boolean;\n\tisFeatureTerminal?: boolean;\n\ttype?: TerminalType;\n\thasChildProcesses: boolean;\n\tshellIntegrationNonce: string;\n\ttabActions?: ITerminalTabAction[];\n}\n\nexport interface IReconnectionProperties {\n\townerId: string;\n\tdata?: unknown;\n}\n\nexport type TerminalType = 'Task' | 'Local' | undefined;\n\nexport enum TitleEventSource {\n\t/** From the API or the rename command that overrides any other type */\n\tApi,\n\t/** From the process name property*/\n\tProcess,\n\t/** From the VT sequence */\n\tSequence,\n\t/** Config changed */\n\tConfig\n}\n\nexport type ITerminalsLayoutInfo = IRawTerminalsLayoutInfo<IPtyHostAttachTarget | null>;\nexport type ITerminalsLayoutInfoById = IRawTerminalsLayoutInfo<number>;\n\nexport enum TerminalIpcChannels {\n\t/**\n\t * Communicates between the renderer process and shared process.\n\t */\n\tLocalPty = 'localPty',\n\t/**\n\t * Communicates between the shared process and the pty host process.\n\t */\n\tPtyHost = 'ptyHost',\n\t/**\n\t * Communicates between the renderer process and the pty host process.\n\t */\n\tPtyHostWindow = 'ptyHostWindow',\n\t/**\n\t * Deals with logging from the pty host process.\n\t */\n\tLogger = 'logger',\n\t/**\n\t * Enables the detection of unresponsive pty hosts.\n\t */\n\tHeartbeat = 'heartbeat'\n}\n\nexport const enum ProcessPropertyType {\n\tCwd = 'cwd',\n\tInitialCwd = 'initialCwd',\n\tFixedDimensions = 'fixedDimensions',\n\tTitle = 'title',\n\tShellType = 'shellType',\n\tHasChildProcesses = 'hasChildProcesses',\n\tResolvedShellLaunchConfig = 'resolvedShellLaunchConfig',\n\tOverrideDimensions = 'overrideDimensions',\n\tFailedShellIntegrationActivation = 'failedShellIntegrationActivation',\n\tUsedShellIntegrationInjection = 'usedShellIntegrationInjection',\n\tShellIntegrationInjectionFailureReason = 'shellIntegrationInjectionFailureReason',\n}\n\nexport interface IProcessProperty<T extends ProcessPropertyType> {\n\ttype: T;\n\tvalue: IProcessPropertyMap[T];\n}\n\nexport interface IProcessPropertyMap {\n\t[ProcessPropertyType.Cwd]: string;\n\t[ProcessPropertyType.InitialCwd]: string;\n\t[ProcessPropertyType.FixedDimensions]: IFixedTerminalDimensions;\n\t[ProcessPropertyType.Title]: string;\n\t[ProcessPropertyType.ShellType]: TerminalShellType | undefined;\n\t[ProcessPropertyType.HasChildProcesses]: boolean;\n\t[ProcessPropertyType.ResolvedShellLaunchConfig]: IShellLaunchConfig;\n\t[ProcessPropertyType.OverrideDimensions]: ITerminalDimensionsOverride | undefined;\n\t[ProcessPropertyType.FailedShellIntegrationActivation]: boolean | undefined;\n\t[ProcessPropertyType.UsedShellIntegrationInjection]: boolean | undefined;\n\t[ProcessPropertyType.ShellIntegrationInjectionFailureReason]: ShellIntegrationInjectionFailureReason | undefined;\n}\n\nexport interface IFixedTerminalDimensions {\n\t/**\n\t * The fixed columns of the terminal.\n\t */\n\tcols?: number;\n\n\t/**\n\t * The fixed rows of the terminal.\n\t */\n\trows?: number;\n}\n\n/**\n * A service that communicates with a pty host.\n*/\nexport interface IPtyService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly onProcessData: Event<{ id: number; event: IProcessDataEvent | string }>;\n\treadonly onProcessReady: Event<{ id: number; event: IProcessReadyEvent }>;\n\treadonly onProcessReplay: Event<{ id: number; event: IPtyHostProcessReplayEvent }>;\n\treadonly onProcessOrphanQuestion: Event<{ id: number }>;\n\treadonly onDidRequestDetach: Event<{ requestId: number; workspaceId: string; instanceId: number }>;\n\treadonly onDidChangeProperty: Event<{ id: number; property: IProcessProperty<any> }>;\n\treadonly onProcessExit: Event<{ id: number; event: number | undefined }>;\n\n\tcreateProcess(\n\t\tshellLaunchConfig: IShellLaunchConfig,\n\t\tcwd: string,\n\t\tcols: number,\n\t\trows: number,\n\t\tunicodeVersion: '6' | '11',\n\t\tenv: IProcessEnvironment,\n\t\texecutableEnv: IProcessEnvironment,\n\t\toptions: ITerminalProcessOptions,\n\t\tshouldPersist: boolean,\n\t\tworkspaceId: string,\n\t\tworkspaceName: string\n\t): Promise<number>;\n\tattachToProcess(id: number): Promise<void>;\n\tdetachFromProcess(id: number, forcePersist?: boolean): Promise<void>;\n\tshutdownAll(): Promise<void>;\n\n\t/**\n\t * Lists all orphaned processes, ie. those without a connected frontend.\n\t */\n\tlistProcesses(): Promise<IProcessDetails[]>;\n\tgetPerformanceMarks(): Promise<performance.PerformanceMark[]>;\n\t/**\n\t * Measures and returns the latency of the current and all other processes to the pty host.\n\t */\n\tgetLatency(): Promise<IPtyHostLatencyMeasurement[]>;\n\n\tstart(id: number): Promise<ITerminalLaunchError | { injectedArgs: string[] } | undefined>;\n\tshutdown(id: number, immediate: boolean): Promise<void>;\n\tinput(id: number, data: string): Promise<void>;\n\tsendSignal(id: number, signal: string): Promise<void>;\n\tresize(id: number, cols: number, rows: number): Promise<void>;\n\tclearBuffer(id: number): Promise<void>;\n\tgetInitialCwd(id: number): Promise<string>;\n\tgetCwd(id: number): Promise<string>;\n\tacknowledgeDataEvent(id: number, charCount: number): Promise<void>;\n\tsetUnicodeVersion(id: number, version: '6' | '11'): Promise<void>;\n\tprocessBinary(id: number, data: string): Promise<void>;\n\t/** Confirm the process is _not_ an orphan. */\n\torphanQuestionReply(id: number): Promise<void>;\n\tupdateTitle(id: number, title: string, titleSource: TitleEventSource): Promise<void>;\n\tupdateIcon(id: number, userInitiated: boolean, icon: TerminalIcon, color?: string): Promise<void>;\n\n\tgetDefaultSystemShell(osOverride?: OperatingSystem): Promise<string>;\n\tgetEnvironment(): Promise<IProcessEnvironment>;\n\tgetWslPath(original: string, direction: 'unix-to-win' | 'win-to-unix'): Promise<string>;\n\tgetRevivedPtyNewId(workspaceId: string, id: number): Promise<number | undefined>;\n\tsetTerminalLayoutInfo(args: ISetTerminalLayoutInfoArgs): Promise<void>;\n\tgetTerminalLayoutInfo(args: IGetTerminalLayoutInfoArgs): Promise<ITerminalsLayoutInfo | undefined>;\n\treduceConnectionGraceTime(): Promise<void>;\n\trequestDetachInstance(workspaceId: string, instanceId: number): Promise<IProcessDetails | undefined>;\n\tacceptDetachInstanceReply(requestId: number, persistentProcessId?: number): Promise<void>;\n\tfreePortKillProcess(port: string): Promise<{ port: string; processId: string }>;\n\t/**\n\t * Serializes and returns terminal state.\n\t * @param ids The persistent terminal IDs to serialize.\n\t */\n\tserializeTerminalState(ids: number[]): Promise<string>;\n\t/**\n\t * Revives a workspaces terminal processes, these can then be reconnected to using the normal\n\t * flow for restoring terminals after reloading.\n\t */\n\treviveTerminalProcesses(workspaceId: string, state: ISerializedTerminalState[], dateTimeFormatLocate: string): Promise<void>;\n\trefreshProperty<T extends ProcessPropertyType>(id: number, property: T): Promise<IProcessPropertyMap[T]>;\n\tupdateProperty<T extends ProcessPropertyType>(id: number, property: T, value: IProcessPropertyMap[T]): Promise<void>;\n\n\t// TODO: Make mandatory and remove impl from pty host service\n\trefreshIgnoreProcessNames?(names: string[]): Promise<void>;\n\n\t// #region Pty service contribution RPC calls\n\n\tinstallAutoReply(match: string, reply: string): Promise<void>;\n\tuninstallAllAutoReplies(): Promise<void>;\n\n\t// #endregion\n}\nexport const IPtyService = createDecorator<IPtyService>('ptyService');\n\nexport interface IPtyServiceContribution {\n\thandleProcessReady(persistentProcessId: number, process: ITerminalChildProcess): void;\n\thandleProcessDispose(persistentProcessId: number): void;\n\thandleProcessInput(persistentProcessId: number, data: string): void;\n\thandleProcessResize(persistentProcessId: number, cols: number, rows: number): void;\n}\n\nexport interface IPtyHostController {\n\treadonly onPtyHostExit: Event<number>;\n\treadonly onPtyHostStart: Event<void>;\n\treadonly onPtyHostUnresponsive: Event<void>;\n\treadonly onPtyHostResponsive: Event<void>;\n\treadonly onPtyHostRequestResolveVariables: Event<IRequestResolveVariablesEvent>;\n\n\trestartPtyHost(): Promise<void>;\n\tacceptPtyHostResolvedVariables(requestId: number, resolved: string[]): Promise<void>;\n\tgetProfiles(workspaceId: string, profiles: unknown, defaultProfile: unknown, includeDetectedProfiles?: boolean): Promise<ITerminalProfile[]>;\n}\n\n/**\n * A service that communicates with a pty host controller (eg. main or server\n * process) and is able to launch and forward requests to the pty host.\n*/\nexport interface IPtyHostService extends IPtyService, IPtyHostController {\n}\n\nexport interface IPtyHostLatencyMeasurement {\n\tlabel: string;\n\tlatency: number;\n}\n\n/**\n * Serialized terminal state matching the interface that can be used across versions, the version\n * should be verified before using the state payload.\n */\nexport interface ICrossVersionSerializedTerminalState {\n\tversion: number;\n\tstate: unknown;\n}\n\nexport interface ISerializedTerminalState {\n\tid: number;\n\tshellLaunchConfig: IShellLaunchConfig;\n\tprocessDetails: IProcessDetails;\n\tprocessLaunchConfig: IPersistentTerminalProcessLaunchConfig;\n\tunicodeVersion: '6' | '11';\n\treplayEvent: IPtyHostProcessReplayEvent;\n\ttimestamp: number;\n}\n\nexport interface IPersistentTerminalProcessLaunchConfig {\n\tenv: IProcessEnvironment;\n\texecutableEnv: IProcessEnvironment;\n\toptions: ITerminalProcessOptions;\n}\n\nexport interface IRequestResolveVariablesEvent {\n\trequestId: number;\n\tworkspaceId: string;\n\toriginalText: string[];\n}\n\nexport enum HeartbeatConstants {\n\t/**\n\t * The duration between heartbeats\n\t */\n\tBeatInterval = 5000,\n\t/**\n\t * The duration of the first heartbeat while the pty host is starting up. This is much larger\n\t * than the regular BeatInterval to accommodate slow machines, we still want to warn about the\n\t * pty host's unresponsiveness eventually though.\n\t */\n\tConnectingBeatInterval = 20000,\n\t/**\n\t * Defines a multiplier for BeatInterval for how long to wait before starting the second wait\n\t * timer.\n\t */\n\tFirstWaitMultiplier = 1.2,\n\t/**\n\t * Defines a multiplier for BeatInterval for how long to wait before telling the user about\n\t * non-responsiveness. The second timer is to avoid informing the user incorrectly when waking\n\t * the computer up from sleep\n\t */\n\tSecondWaitMultiplier = 1,\n\t/**\n\t * How long to wait before telling the user about non-responsiveness when they try to create a\n\t * process. This short circuits the standard wait timeouts to tell the user sooner and only\n\t * create process is handled to avoid additional perf overhead.\n\t */\n\tCreateProcessTimeout = 5000\n}\n\nexport interface IHeartbeatService {\n\treadonly onBeat: Event<void>;\n}\n\n\nexport interface IShellLaunchConfig {\n\t/**\n\t * The name of the terminal, if this is not set the name of the process will be used.\n\t */\n\tname?: string;\n\n\t/**\n\t * A string to follow the name of the terminal with, indicating the type of terminal\n\t */\n\ttype?: 'Task' | 'Local';\n\n\t/**\n\t * The shell executable (bash, cmd, etc.).\n\t */\n\texecutable?: string;\n\n\t/**\n\t * The CLI arguments to use with executable, a string[] is in argv format and will be escaped,\n\t * a string is in \"CommandLine\" pre-escaped format and will be used as is. The string option is\n\t * only supported on Windows and will throw an exception if used on macOS or Linux.\n\t */\n\targs?: string[] | string;\n\n\t/**\n\t * The current working directory of the terminal, this overrides the `terminal.integrated.cwd`\n\t * settings key.\n\t */\n\tcwd?: string | URI;\n\n\t/**\n\t * A custom environment for the terminal, if this is not set the environment will be inherited\n\t * from the VS Code process.\n\t */\n\tenv?: ITerminalEnvironment;\n\n\t/**\n\t * Whether to ignore a custom cwd from the `terminal.integrated.cwd` settings key (e.g. if the\n\t * shell is being launched by an extension).\n\t */\n\tignoreConfigurationCwd?: boolean;\n\n\t/**\n\t * The reconnection properties for this terminal\n\t */\n\treconnectionProperties?: IReconnectionProperties;\n\n\t/** Whether to wait for a key press before closing the terminal. */\n\twaitOnExit?: WaitOnExitValue;\n\n\t/**\n\t * A string including ANSI escape sequences that will be written to the terminal emulator\n\t * _before_ the terminal process has launched, when a string is specified, a trailing \\n is\n\t * added at the end. This allows for example the terminal instance to display a styled message\n\t * as the first line of the terminal. Use \\x1b over \\033 or \\e for the escape control character.\n\t */\n\tinitialText?: string | { text: string; trailingNewLine: boolean };\n\n\t/**\n\t * Custom PTY/pseudoterminal process to use.\n\t */\n\tcustomPtyImplementation?: (terminalId: number, cols: number, rows: number) => ITerminalChildProcess;\n\n\t/**\n\t * A UUID generated by the extension host process for terminals created on the extension host process.\n\t */\n\textHostTerminalId?: string;\n\n\t/**\n\t * This is a terminal that attaches to an already running terminal.\n\t */\n\tattachPersistentProcess?: {\n\t\tid: number;\n\t\tfindRevivedId?: boolean;\n\t\tpid: number;\n\t\ttitle: string;\n\t\ttitleSource: TitleEventSource;\n\t\tcwd: string;\n\t\ticon?: TerminalIcon;\n\t\tcolor?: string;\n\t\thasChildProcesses?: boolean;\n\t\tfixedDimensions?: IFixedTerminalDimensions;\n\t\tenvironmentVariableCollections?: ISerializableEnvironmentVariableCollections;\n\t\treconnectionProperties?: IReconnectionProperties;\n\t\ttype?: TerminalType;\n\t\twaitOnExit?: WaitOnExitValue;\n\t\thideFromUser?: boolean;\n\t\tisFeatureTerminal?: boolean;\n\t\tshellIntegrationNonce: string;\n\t\ttabActions?: ITerminalTabAction[];\n\t};\n\n\t/**\n\t * Whether the terminal process environment should be exactly as provided in\n\t * `TerminalOptions.env`. When this is false (default), the environment will be based on the\n\t * window's environment and also apply configured platform settings like\n\t * `terminal.integrated.env.windows` on top. When this is true, the complete environment must be\n\t * provided as nothing will be inherited from the process or any configuration.\n\t */\n\tstrictEnv?: boolean;\n\n\t/**\n\t * Whether the terminal process environment will inherit VS Code's \"shell environment\" that may\n\t * get sourced from running a login shell depnding on how the application was launched.\n\t * Consumers that rely on development tools being present in the $PATH should set this to true.\n\t * This will overwrite the value of the inheritEnv setting.\n\t */\n\tuseShellEnvironment?: boolean;\n\n\t/**\n\t * When enabled the terminal will run the process as normal but not be surfaced to the user\n\t * until `Terminal.show` is called. The typical usage for this is when you need to run\n\t * something that may need interactivity but only want to tell the user about it when\n\t * interaction is needed. Note that the terminals will still be exposed to all extensions\n\t * as normal. The hidden terminals will not be restored when the workspace is next opened.\n\t */\n\thideFromUser?: boolean;\n\n\t/**\n\t * Whether this terminal is not a terminal that the user directly created and uses, but rather\n\t * a terminal used to drive some VS Code feature.\n\t */\n\tisFeatureTerminal?: boolean;\n\n\t/**\n\t * Whether this terminal was created by an extension.\n\t */\n\tisExtensionOwnedTerminal?: boolean;\n\n\t/**\n\t * The icon for the terminal, used primarily in the terminal tab.\n\t */\n\ticon?: TerminalIcon;\n\n\t/**\n\t * The color ID to use for this terminal. If not specified it will use the default fallback\n\t */\n\tcolor?: string;\n\n\t/**\n\t * When a parent terminal is provided via API, the group needs\n\t * to find the index in order to place the child\n\t * directly to the right of its parent.\n\t */\n\tparentTerminalId?: number;\n\n\t/**\n\t * The dimensions for the instance as set by the user\n\t * or via Size to Content Width\n\t */\n\tfixedDimensions?: IFixedTerminalDimensions;\n\n\t/**\n\t * Opt-out of the default terminal persistence on restart and reload\n\t */\n\tisTransient?: boolean;\n\n\t/**\n\t * Attempt to force shell integration to be enabled by bypassing the {@link isFeatureTerminal}\n\t * equals false requirement.\n\t */\n\tforceShellIntegration?: boolean;\n\n\t/**\n\t * Create a terminal without shell integration even when it's enabled\n\t */\n\tignoreShellIntegration?: boolean;\n\n\t/**\n\t * Actions to include inline on hover of the terminal tab. E.g. the \"Rerun task\" action\n\t */\n\ttabActions?: ITerminalTabAction[];\n\t/**\n\t * Report terminal's shell environment variables to VS Code and extensions\n\t */\n\tshellIntegrationEnvironmentReporting?: boolean;\n}\n\nexport interface ITerminalTabAction {\n\tid: string;\n\tlabel: string;\n\ticon?: ThemeIcon;\n}\n\nexport type WaitOnExitValue = boolean | string | ((exitCode: number) => string);\n\nexport interface ICreateContributedTerminalProfileOptions {\n\ticon?: URI | string | { light: URI; dark: URI };\n\tcolor?: string;\n\tlocation?: TerminalLocation | { viewColumn: number; preserveState?: boolean } | { splitActiveTerminal: boolean };\n\tcwd?: string | URI;\n}\n\nexport enum TerminalLocation {\n\tPanel = 1,\n\tEditor = 2\n}\n\nexport const enum TerminalLocationString {\n\tTerminalView = 'view',\n\tEditor = 'editor'\n}\n\nexport type TerminalIcon = ThemeIcon | URI | { light: URI; dark: URI };\n\nexport interface IShellLaunchConfigDto {\n\tname?: string;\n\texecutable?: string;\n\targs?: string[] | string;\n\tcwd?: string | UriComponents;\n\tenv?: ITerminalEnvironment;\n\tuseShellEnvironment?: boolean;\n\thideFromUser?: boolean;\n\treconnectionProperties?: IReconnectionProperties;\n\ttype?: 'Task' | 'Local';\n\tisFeatureTerminal?: boolean;\n\ttabActions?: ITerminalTabAction[];\n\tshellIntegrationEnvironmentReporting?: boolean;\n}\n\n/**\n * A set of options for the terminal process. These differ from the shell launch config in that they\n * are set internally to the terminal component, not from the outside.\n */\nexport interface ITerminalProcessOptions {\n\tshellIntegration: {\n\t\tenabled: boolean;\n\t\tsuggestEnabled: boolean;\n\t\tnonce: string;\n\t};\n\twindowsEnableConpty: boolean;\n\twindowsUseConptyDll: boolean;\n\tenvironmentVariableCollections: ISerializableEnvironmentVariableCollections | undefined;\n\tworkspaceFolder: IWorkspaceFolder | undefined;\n}\n\nexport interface ITerminalEnvironment {\n\t[key: string]: string | null | undefined;\n}\n\nexport interface ITerminalLaunchError {\n\tmessage: string;\n\tcode?: number;\n}\n\nexport interface IProcessReadyEvent {\n\tpid: number;\n\tcwd: string;\n\twindowsPty: IProcessReadyWindowsPty | undefined;\n}\n\nexport interface IProcessReadyWindowsPty {\n\t/**\n\t * What pty emulation backend is being used.\n\t */\n\tbackend: 'conpty' | 'winpty';\n\t/**\n\t * The Windows build version (eg. 19045)\n\t */\n\tbuildNumber: number;\n}\n\n/**\n * An interface representing a raw terminal child process, this contains a subset of the\n * child_process.ChildProcess node.js interface.\n */\nexport interface ITerminalChildProcess {\n\t/**\n\t * A unique identifier for the terminal process. Note that the uniqueness only applies to a\n\t * given pty service connection, IDs will be duplicated for remote and local terminals for\n\t * example. The ID will be 0 if it does not support reconnection.\n\t */\n\tid: number;\n\n\t/**\n\t * Whether the process should be persisted across reloads.\n\t */\n\tshouldPersist: boolean;\n\n\tonProcessData: Event<IProcessDataEvent | string>;\n\tonProcessReady: Event<IProcessReadyEvent>;\n\tonProcessReplayComplete?: Event<void>;\n\tonDidChangeProperty: Event<IProcessProperty<any>>;\n\tonProcessExit: Event<number | undefined>;\n\tonRestoreCommands?: Event<ISerializedCommandDetectionCapability>;\n\n\t/**\n\t * Starts the process.\n\t *\n\t * @returns undefined when the process was successfully started, otherwise an object containing\n\t * information on what went wrong.\n\t */\n\tstart(): Promise<ITerminalLaunchError | { injectedArgs: string[] } | undefined>;\n\n\t/**\n\t * Detach the process from the UI and await reconnect.\n\t * @param forcePersist Whether to force the process to persist if it supports persistence.\n\t */\n\tdetach?(forcePersist?: boolean): Promise<void>;\n\n\t/**\n\t * Frees the port and kills the process\n\t */\n\tfreePortKillProcess?(port: string): Promise<{ port: string; processId: string }>;\n\n\t/**\n\t * Shutdown the terminal process.\n\t *\n\t * @param immediate When true the process will be killed immediately, otherwise the process will\n\t * be given some time to make sure no additional data comes through.\n\t */\n\tshutdown(immediate: boolean): void;\n\tinput(data: string): void;\n\tsendSignal(signal: string): void;\n\tprocessBinary(data: string): Promise<void>;\n\tresize(cols: number, rows: number): void;\n\tclearBuffer(): void | Promise<void>;\n\n\t/**\n\t * Acknowledge a data event has been parsed by the terminal, this is used to implement flow\n\t * control to ensure remote processes to not get too far ahead of the client and flood the\n\t * connection.\n\t * @param charCount The number of characters being acknowledged.\n\t */\n\tacknowledgeDataEvent(charCount: number): void;\n\n\t/**\n\t * Sets the unicode version for the process, this drives the size of some characters in the\n\t * xterm-headless instance.\n\t */\n\tsetUnicodeVersion(version: '6' | '11'): Promise<void>;\n\n\tgetInitialCwd(): Promise<string>;\n\tgetCwd(): Promise<string>;\n\trefreshProperty<T extends ProcessPropertyType>(property: T): Promise<IProcessPropertyMap[T]>;\n\tupdateProperty<T extends ProcessPropertyType>(property: T, value: IProcessPropertyMap[T]): Promise<void>;\n}\n\nexport interface IReconnectConstants {\n\tgraceTime: number;\n\tshortGraceTime: number;\n\tscrollback: number;\n}\n\nexport const enum LocalReconnectConstants {\n\t/**\n\t * If there is no reconnection within this time-frame, consider the connection permanently closed...\n\t*/\n\tGraceTime = 60000, // 60 seconds\n\t/**\n\t * Maximal grace time between the first and the last reconnection...\n\t*/\n\tShortGraceTime = 6000, // 6 seconds\n}\n\nexport const enum FlowControlConstants {\n\t/**\n\t * The number of _unacknowledged_ chars to have been sent before the pty is paused in order for\n\t * the client to catch up.\n\t */\n\tHighWatermarkChars = 100000,\n\t/**\n\t * After flow control pauses the pty for the client the catch up, this is the number of\n\t * _unacknowledged_ chars to have been caught up to on the client before resuming the pty again.\n\t * This is used to attempt to prevent pauses in the flowing data; ideally while the pty is\n\t * paused the number of unacknowledged chars would always be greater than 0 or the client will\n\t * appear to stutter. In reality this balance is hard to accomplish though so heavy commands\n\t * will likely pause as latency grows, not flooding the connection is the important thing as\n\t * it's shared with other core functionality.\n\t */\n\tLowWatermarkChars = 5000,\n\t/**\n\t * The number characters that are accumulated on the client side before sending an ack event.\n\t * This must be less than or equal to LowWatermarkChars or the terminal max never unpause.\n\t */\n\tCharCountAckSize = 5000\n}\n\nexport interface IProcessDataEvent {\n\tdata: string;\n\ttrackCommit: boolean;\n\t/**\n\t * When trackCommit is set, this will be set to a promise that resolves when the data is parsed.\n\t */\n\twritePromise?: Promise<void>;\n}\n\nexport interface ITerminalDimensions {\n\t/**\n\t * The columns of the terminal.\n\t */\n\tcols: number;\n\n\t/**\n\t * The rows of the terminal.\n\t */\n\trows: number;\n}\n\nexport interface ITerminalProfile {\n\tprofileName: string;\n\tpath: string;\n\tisDefault: boolean;\n\t/**\n\t * Whether the terminal profile contains a potentially unsafe {@link path}. For example, the path\n\t * `C:\\Cygwin` is the default install for Cygwin on Windows, but it could be created by any\n\t * user in a multi-user environment. As such, we don't want to blindly present it as a profile\n\t * without a warning.\n\t */\n\tisUnsafePath?: boolean;\n\t/**\n\t * An additional unsafe path that must exist, for example a script that appears in {@link args}.\n\t */\n\trequiresUnsafePath?: string;\n\tisAutoDetected?: boolean;\n\t/**\n\t * Whether the profile path was found on the `$PATH` environment variable, if so it will be\n\t * cleaner to display this profile in the UI using only `basename(path)`.\n\t */\n\tisFromPath?: boolean;\n\targs?: string | string[] | undefined;\n\tenv?: ITerminalEnvironment;\n\toverrideName?: boolean;\n\tcolor?: string;\n\ticon?: ThemeIcon | URI | { light: URI; dark: URI };\n}\n\nexport interface ITerminalDimensionsOverride extends Readonly<ITerminalDimensions> {\n\t/**\n\t * indicate that xterm must receive these exact dimensions, even if they overflow the ui!\n\t */\n\tforceExactSize?: boolean;\n}\n\nexport const enum ProfileSource {\n\tGitBash = 'Git Bash',\n\tPwsh = 'PowerShell'\n}\n\nexport interface IBaseUnresolvedTerminalProfile {\n\targs?: string | string[] | undefined;\n\tisAutoDetected?: boolean;\n\toverrideName?: boolean;\n\ticon?: string | ThemeIcon | URI | { light: URI; dark: URI };\n\tcolor?: string;\n\tenv?: ITerminalEnvironment;\n\trequiresPath?: string | ITerminalUnsafePath;\n}\n\ntype OneOrN<T> = T | T[];\n\nexport interface ITerminalUnsafePath {\n\tpath: string;\n\tisUnsafe: true;\n}\n\nexport interface ITerminalExecutable extends IBaseUnresolvedTerminalProfile {\n\tpath: OneOrN<string | ITerminalUnsafePath>;\n}\n\nexport interface ITerminalProfileSource extends IBaseUnresolvedTerminalProfile {\n\tsource: ProfileSource;\n}\n\nexport interface ITerminalProfileContribution {\n\ttitle: string;\n\tid: string;\n\ticon?: URI | { light: URI; dark: URI } | string;\n\tcolor?: string;\n}\n\nexport interface IExtensionTerminalProfile extends ITerminalProfileContribution {\n\textensionIdentifier: string;\n}\n\nexport type ITerminalProfileObject = ITerminalExecutable | ITerminalProfileSource | IExtensionTerminalProfile | null;\n\nexport interface IShellIntegration {\n\treadonly capabilities: ITerminalCapabilityStore;\n\treadonly seenSequences: ReadonlySet<string>;\n\treadonly status: ShellIntegrationStatus;\n\n\treadonly onDidChangeStatus: Event<ShellIntegrationStatus>;\n\treadonly onDidChangeSeenSequences: Event<ReadonlySet<string>>;\n\n\tdeserialize(serialized: ISerializedCommandDetectionCapability): void;\n}\n\nexport interface IDecorationAddon {\n\tregisterMenuItems(command: ITerminalCommand, items: IAction[]): IDisposable;\n}\n\nexport interface ITerminalContributions {\n\tprofiles?: ITerminalProfileContribution[];\n}\n\nexport const enum ShellIntegrationStatus {\n\t/** No shell integration sequences have been encountered. */\n\tOff,\n\t/** Final term shell integration sequences have been encountered. */\n\tFinalTerm,\n\t/** VS Code shell integration sequences have been encountered. Supercedes FinalTerm. */\n\tVSCode\n}\n\n\nexport const enum ShellIntegrationInjectionFailureReason {\n\t/**\n\t * The setting is disabled.\n\t */\n\tInjectionSettingDisabled = 'injectionSettingDisabled',\n\t/**\n\t * There is no executable (so there's no way to determine how to inject).\n\t */\n\tNoExecutable = 'noExecutable',\n\t/**\n\t * It's a feature terminal (tasks, debug), unless it's explicitly being forced.\n\t */\n\tFeatureTerminal = 'featureTerminal',\n\t/**\n\t * The ignoreShellIntegration flag is passed (eg. relaunching without shell integration).\n\t */\n\tIgnoreShellIntegrationFlag = 'ignoreShellIntegrationFlag',\n\t/**\n\t * Shell integration doesn't work with winpty.\n\t */\n\tWinpty = 'winpty',\n\t/**\n\t * We're conservative whether we inject when we don't recognize the arguments used for the\n\t * shell as we would prefer launching one without shell integration than breaking their profile.\n\t */\n\tUnsupportedArgs = 'unsupportedArgs',\n\t/**\n\t * The shell doesn't have built-in shell integration. Note that this doesn't mean the shell\n\t * won't have shell integration in the end.\n\t */\n\tUnsupportedShell = 'unsupportedShell',\n\n\n\t/**\n\t * For zsh, we failed to set the sticky bit on the shell integration script folder.\n\t */\n\tFailedToSetStickyBit = 'failedToSetStickyBit',\n\n\t/**\n\t * For zsh, we failed to create a temp directory for the shell integration script.\n\t */\n\tFailedToCreateTmpDir = 'failedToCreateTmpDir',\n}\n\nexport enum TerminalExitReason {\n\tUnknown = 0,\n\tShutdown = 1,\n\tProcess = 2,\n\tUser = 3,\n\tExtension = 4,\n}\n\nexport interface ITerminalOutputMatch {\n\tregexMatch: RegExpMatchArray;\n\toutputLines: string[];\n}\n\n/**\n * A matcher that runs on a sub-section of a terminal command's output\n */\nexport interface ITerminalOutputMatcher {\n\t/**\n\t * A string or regex to match against the unwrapped line. If this is a regex with the multiline\n\t * flag, it will scan an amount of lines equal to `\\n` instances in the regex + 1.\n\t */\n\tlineMatcher: string | RegExp;\n\t/**\n\t * Which side of the output to anchor the {@link offset} and {@link length} against.\n\t */\n\tanchor: 'top' | 'bottom';\n\t/**\n\t * The number of rows above or below the {@link anchor} to start matching against.\n\t */\n\toffset: number;\n\t/**\n\t * The number of rows to match against, this should be as small as possible for performance\n\t * reasons. This is capped at 40.\n\t */\n\tlength: number;\n\n\t/**\n\t * If multiple matches are expected - this will result in {@link outputLines} being returned\n\t * when there's a {@link regexMatch} from {@link offset} to {@link length}\n\t */\n\tmultipleMatches?: boolean;\n}\n\nexport interface ITerminalCommandSelector {\n\tid: string;\n\tcommandLineMatcher: string | RegExp;\n\toutputMatcher?: ITerminalOutputMatcher;\n\texitStatus: boolean;\n\tcommandExitResult: 'success' | 'error';\n\tkind?: 'fix' | 'explain';\n}\n\nexport interface ITerminalBackend extends ITerminalBackendPtyServiceContributions {\n\treadonly remoteAuthority: string | undefined;\n\n\treadonly isResponsive: boolean;\n\n\t/**\n\t * A promise that resolves when the backend is ready to be used, ie. after terminal persistence\n\t * has been actioned.\n\t */\n\treadonly whenReady: Promise<void>;\n\n\t/**\n\t * Signal to the backend that persistence has been actioned and is ready for use.\n\t */\n\tsetReady(): void;\n\n\t/**\n\t * Fired when the ptyHost process becomes non-responsive, this should disable stdin for all\n\t * terminals using this pty host connection and mark them as disconnected.\n\t */\n\tonPtyHostUnresponsive: Event<void>;\n\t/**\n\t * Fired when the ptyHost process becomes responsive after being non-responsive. Allowing\n\t * previously disconnected terminals to reconnect.\n\t */\n\tonPtyHostResponsive: Event<void>;\n\t/**\n\t * Fired when the ptyHost has been restarted, this is used as a signal for listening terminals\n\t * that its pty has been lost and will remain disconnected.\n\t */\n\tonPtyHostRestart: Event<void>;\n\n\tonDidRequestDetach: Event<{ requestId: number; workspaceId: string; instanceId: number }>;\n\n\tattachToProcess(id: number): Promise<ITerminalChildProcess | undefined>;\n\tattachToRevivedProcess(id: number): Promise<ITerminalChildProcess | undefined>;\n\tlistProcesses(): Promise<IProcessDetails[]>;\n\tgetLatency(): Promise<IPtyHostLatencyMeasurement[]>;\n\tgetDefaultSystemShell(osOverride?: OperatingSystem): Promise<string>;\n\tgetProfiles(profiles: unknown, defaultProfile: unknown, includeDetectedProfiles?: boolean): Promise<ITerminalProfile[]>;\n\tgetWslPath(original: string, direction: 'unix-to-win' | 'win-to-unix'): Promise<string>;\n\tgetEnvironment(): Promise<IProcessEnvironment>;\n\tgetShellEnvironment(): Promise<IProcessEnvironment | undefined>;\n\tsetTerminalLayoutInfo(layoutInfo?: ITerminalsLayoutInfoById): Promise<void>;\n\tupdateTitle(id: number, title: string, titleSource: TitleEventSource): Promise<void>;\n\tupdateIcon(id: number, userInitiated: boolean, icon: TerminalIcon, color?: string): Promise<void>;\n\tgetTerminalLayoutInfo(): Promise<ITerminalsLayoutInfo | undefined>;\n\tgetPerformanceMarks(): Promise<performance.PerformanceMark[]>;\n\treduceConnectionGraceTime(): Promise<void>;\n\trequestDetachInstance(workspaceId: string, instanceId: number): Promise<IProcessDetails | undefined>;\n\tacceptDetachInstanceReply(requestId: number, persistentProcessId?: number): Promise<void>;\n\tpersistTerminalState(): Promise<void>;\n\n\tcreateProcess(\n\t\tshellLaunchConfig: IShellLaunchConfig,\n\t\tcwd: string,\n\t\tcols: number,\n\t\trows: number,\n\t\tunicodeVersion: '6' | '11',\n\t\tenv: IProcessEnvironment,\n\t\toptions: ITerminalProcessOptions,\n\t\tshouldPersist: boolean\n\t): Promise<ITerminalChildProcess>;\n\n\trestartPtyHost(): void;\n}\n\nexport interface ITerminalBackendPtyServiceContributions {\n\tinstallAutoReply(match: string, reply: string): Promise<void>;\n\tuninstallAllAutoReplies(): Promise<void>;\n}\n\nexport const TerminalExtensions = {\n\tBackend: 'workbench.contributions.terminal.processBackend'\n};\n\nexport interface ITerminalBackendRegistry {\n\t/**\n\t * Gets all backends in the registry.\n\t */\n\tbackends: ReadonlyMap<string, ITerminalBackend>;\n\n\t/**\n\t * Registers a terminal backend for a remote authority.\n\t */\n\tregisterTerminalBackend(backend: ITerminalBackend): void;\n\n\t/**\n\t * Returns the registered terminal backend for a remote authority.\n\t */\n\tgetTerminalBackend(remoteAuthority?: string): ITerminalBackend | undefined;\n}\n\nclass TerminalBackendRegistry implements ITerminalBackendRegistry {\n\tprivate readonly _backends = new Map<string, ITerminalBackend>();\n\n\tget backends(): ReadonlyMap<string, ITerminalBackend> { return this._backends; }\n\n\tregisterTerminalBackend(backend: ITerminalBackend): void {\n\t\tconst key = this._sanitizeRemoteAuthority(backend.remoteAuthority);\n\t\tif (this._backends.has(key)) {\n\t\t\tthrow new Error(`A terminal backend with remote authority '${key}' was already registered.`);\n\t\t}\n\t\tthis._backends.set(key, backend);\n\t}\n\n\tgetTerminalBackend(remoteAuthority: string | undefined): ITerminalBackend | undefined {\n\t\treturn this._backends.get(this._sanitizeRemoteAuthority(remoteAuthority));\n\t}\n\n\tprivate _sanitizeRemoteAuthority(remoteAuthority: string | undefined) {\n\t\t// Normalize the key to lowercase as the authority is case-insensitive\n\t\treturn remoteAuthority?.toLowerCase() ?? '';\n\t}\n}\nRegistry.add(TerminalExtensions.Backend, new TerminalBackendRegistry());\n\nexport const ILocalPtyService = createDecorator<ILocalPtyService>('localPtyService');\n\n/**\n * A service responsible for communicating with the pty host process on Electron.\n *\n * **This service should only be used within the terminal component.**\n */\nexport interface ILocalPtyService extends IPtyHostService { }\n\nexport const ITerminalLogService = createDecorator<ITerminalLogService>('terminalLogService');\nexport interface ITerminalLogService extends ILogService {\n\t/**\n\t * Similar to _serviceBrand but used to differentiate this service at compile time from\n\t * ILogService; ITerminalLogService is an ILogService, but ILogService is not an\n\t * ITerminalLogService.\n\t */\n\treadonly _logBrand: undefined;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { URI } from '../../../base/common/uri.js';\nimport { Event } from '../../../base/common/event.js';\nimport { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { AbstractLoggerService, AbstractMessageLogger, AdapterLogger, DidChangeLoggersEvent, ILogger, ILoggerOptions, ILoggerResource, ILoggerService, isLogLevel, LogLevel } from './log.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { IURITransformer } from '../../../base/common/uriIpc.js';\n\nexport class LoggerChannelClient extends AbstractLoggerService implements ILoggerService {\n\n\tconstructor(private readonly windowId: number | undefined, logLevel: LogLevel, logsHome: URI, loggers: ILoggerResource[], private readonly channel: IChannel) {\n\t\tsuper(logLevel, logsHome, loggers);\n\t\tthis._register(channel.listen<LogLevel | [URI, LogLevel]>('onDidChangeLogLevel', windowId)(arg => {\n\t\t\tif (isLogLevel(arg)) {\n\t\t\t\tsuper.setLogLevel(arg);\n\t\t\t} else {\n\t\t\t\tsuper.setLogLevel(URI.revive(arg[0]), arg[1]);\n\t\t\t}\n\t\t}));\n\t\tthis._register(channel.listen<[URI, boolean]>('onDidChangeVisibility', windowId)(([resource, visibility]) => super.setVisibility(URI.revive(resource), visibility)));\n\t\tthis._register(channel.listen<DidChangeLoggersEvent>('onDidChangeLoggers', windowId)(({ added, removed }) => {\n\t\t\tfor (const loggerResource of added) {\n\t\t\t\tsuper.registerLogger({ ...loggerResource, resource: URI.revive(loggerResource.resource) });\n\t\t\t}\n\t\t\tfor (const loggerResource of removed) {\n\t\t\t\tsuper.deregisterLogger(loggerResource.resource);\n\t\t\t}\n\t\t}));\n\t}\n\n\tcreateConsoleMainLogger(): ILogger {\n\t\treturn new AdapterLogger({\n\t\t\tlog: (level: LogLevel, args: any[]) => {\n\t\t\t\tthis.channel.call('consoleLog', [level, args]);\n\t\t\t}\n\t\t});\n\t}\n\n\toverride registerLogger(logger: ILoggerResource): void {\n\t\tsuper.registerLogger(logger);\n\t\tthis.channel.call('registerLogger', [logger, this.windowId]);\n\t}\n\n\toverride deregisterLogger(resource: URI): void {\n\t\tsuper.deregisterLogger(resource);\n\t\tthis.channel.call('deregisterLogger', [resource, this.windowId]);\n\t}\n\n\toverride setLogLevel(logLevel: LogLevel): void;\n\toverride setLogLevel(resource: URI, logLevel: LogLevel): void;\n\toverride setLogLevel(arg1: any, arg2?: any): void {\n\t\tsuper.setLogLevel(arg1, arg2);\n\t\tthis.channel.call('setLogLevel', [arg1, arg2]);\n\t}\n\n\toverride setVisibility(resourceOrId: URI | string, visibility: boolean): void {\n\t\tsuper.setVisibility(resourceOrId, visibility);\n\t\tthis.channel.call('setVisibility', [this.toResource(resourceOrId), visibility]);\n\t}\n\n\tprotected doCreateLogger(file: URI, logLevel: LogLevel, options?: ILoggerOptions): ILogger {\n\t\treturn new Logger(this.channel, file, logLevel, options, this.windowId);\n\t}\n\n\tpublic static setLogLevel(channel: IChannel, level: LogLevel): Promise<void>;\n\tpublic static setLogLevel(channel: IChannel, resource: URI, level: LogLevel): Promise<void>;\n\tpublic static setLogLevel(channel: IChannel, arg1: any, arg2?: any): Promise<void> {\n\t\treturn channel.call('setLogLevel', [arg1, arg2]);\n\t}\n\n}\n\nclass Logger extends AbstractMessageLogger {\n\n\tprivate isLoggerCreated: boolean = false;\n\tprivate buffer: [LogLevel, string][] = [];\n\n\tconstructor(\n\t\tprivate readonly channel: IChannel,\n\t\tprivate readonly file: URI,\n\t\tlogLevel: LogLevel,\n\t\tloggerOptions?: ILoggerOptions,\n\t\twindowId?: number | undefined\n\t) {\n\t\tsuper(loggerOptions?.logLevel === 'always');\n\t\tthis.setLevel(logLevel);\n\t\tthis.channel.call('createLogger', [file, loggerOptions, windowId])\n\t\t\t.then(() => {\n\t\t\t\tthis.doLog(this.buffer);\n\t\t\t\tthis.isLoggerCreated = true;\n\t\t\t});\n\t}\n\n\tprotected log(level: LogLevel, message: string) {\n\t\tconst messages: [LogLevel, string][] = [[level, message]];\n\t\tif (this.isLoggerCreated) {\n\t\t\tthis.doLog(messages);\n\t\t} else {\n\t\t\tthis.buffer.push(...messages);\n\t\t}\n\t}\n\n\tprivate doLog(messages: [LogLevel, string][]) {\n\t\tthis.channel.call('log', [this.file, messages]);\n\t}\n}\n\nexport class LoggerChannel implements IServerChannel {\n\n\tconstructor(private readonly loggerService: ILoggerService, private getUriTransformer: (requestContext: any) => IURITransformer) { }\n\n\tlisten(context: any, event: string): Event<any> {\n\t\tconst uriTransformer = this.getUriTransformer(context);\n\t\tswitch (event) {\n\t\t\tcase 'onDidChangeLoggers': return Event.map<DidChangeLoggersEvent, DidChangeLoggersEvent>(this.loggerService.onDidChangeLoggers, (e) =>\n\t\t\t({\n\t\t\t\tadded: [...e.added].map(logger => this.transformLogger(logger, uriTransformer)),\n\t\t\t\tremoved: [...e.removed].map(logger => this.transformLogger(logger, uriTransformer)),\n\t\t\t}));\n\t\t\tcase 'onDidChangeVisibility': return Event.map<[URI, boolean], [URI, boolean]>(this.loggerService.onDidChangeVisibility, e => [uriTransformer.transformOutgoingURI(e[0]), e[1]]);\n\t\t\tcase 'onDidChangeLogLevel': return Event.map<LogLevel | [URI, LogLevel], LogLevel | [URI, LogLevel]>(this.loggerService.onDidChangeLogLevel, e => isLogLevel(e) ? e : [uriTransformer.transformOutgoingURI(e[0]), e[1]]);\n\t\t}\n\t\tthrow new Error(`Event not found: ${event}`);\n\t}\n\n\tasync call(context: any, command: string, arg?: any): Promise<any> {\n\t\tconst uriTransformer: IURITransformer | null = this.getUriTransformer(context);\n\t\tswitch (command) {\n\t\t\tcase 'setLogLevel': return isLogLevel(arg[0]) ? this.loggerService.setLogLevel(arg[0]) : this.loggerService.setLogLevel(URI.revive(uriTransformer.transformIncoming(arg[0][0])), arg[0][1]);\n\t\t\tcase 'getRegisteredLoggers': return Promise.resolve([...this.loggerService.getRegisteredLoggers()].map(logger => this.transformLogger(logger, uriTransformer)));\n\t\t}\n\n\t\tthrow new Error(`Call not found: ${command}`);\n\t}\n\n\tprivate transformLogger(logger: ILoggerResource, transformer: IURITransformer): ILoggerResource {\n\t\treturn {\n\t\t\t...logger,\n\t\t\tresource: transformer.transformOutgoingURI(logger.resource)\n\t\t};\n\t}\n\n}\n\nexport class RemoteLoggerChannelClient extends Disposable {\n\n\tconstructor(loggerService: ILoggerService, channel: IChannel) {\n\t\tsuper();\n\n\t\tchannel.call('setLogLevel', [loggerService.getLogLevel()]);\n\t\tthis._register(loggerService.onDidChangeLogLevel(arg => channel.call('setLogLevel', [arg])));\n\n\t\tchannel.call<ILoggerResource[]>('getRegisteredLoggers').then(loggers => {\n\t\t\tfor (const loggerResource of loggers) {\n\t\t\t\tloggerService.registerLogger({ ...loggerResource, resource: URI.revive(loggerResource.resource) });\n\t\t\t}\n\t\t});\n\n\t\tthis._register(channel.listen<[URI, boolean]>('onDidChangeVisibility')(([resource, visibility]) => loggerService.setVisibility(URI.revive(resource), visibility)));\n\n\t\tthis._register(channel.listen<DidChangeLoggersEvent>('onDidChangeLoggers')(({ added, removed }) => {\n\t\t\tfor (const loggerResource of added) {\n\t\t\t\tloggerService.registerLogger({ ...loggerResource, resource: URI.revive(loggerResource.resource) });\n\t\t\t}\n\t\t\tfor (const loggerResource of removed) {\n\t\t\t\tloggerService.deregisterLogger(loggerResource.resource);\n\t\t\t}\n\t\t}));\n\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { timeout } from '../../../base/common/async.js';\nimport { CancellationTokenSource } from '../../../base/common/cancellation.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable, dispose, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { ILogService } from '../../log/common/log.js';\n\n/**\n * A helper class to track requests that have replies. Using this it's easy to implement an event\n * that accepts a reply.\n */\nexport class RequestStore<T, RequestArgs> extends Disposable {\n\tprivate _lastRequestId = 0;\n\tprivate readonly _timeout: number;\n\tprivate _pendingRequests: Map<number, (resolved: T) => void> = new Map();\n\tprivate _pendingRequestDisposables: Map<number, IDisposable[]> = new Map();\n\n\tprivate readonly _onCreateRequest = this._register(new Emitter<RequestArgs & { requestId: number }>());\n\treadonly onCreateRequest = this._onCreateRequest.event;\n\n\t/**\n\t * @param timeout How long in ms to allow requests to go unanswered for, undefined will use the\n\t * default (15 seconds).\n\t */\n\tconstructor(\n\t\ttimeout: number | undefined,\n\t\t@ILogService private readonly _logService: ILogService\n\t) {\n\t\tsuper();\n\t\tthis._timeout = timeout === undefined ? 15000 : timeout;\n\t\tthis._register(toDisposable(() => {\n\t\t\tfor (const d of this._pendingRequestDisposables.values()) {\n\t\t\t\tdispose(d);\n\t\t\t}\n\t\t}));\n\t}\n\n\t/**\n\t * Creates a request.\n\t * @param args The arguments to pass to the onCreateRequest event.\n\t */\n\tcreateRequest(args: RequestArgs): Promise<T> {\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\tconst requestId = ++this._lastRequestId;\n\t\t\tthis._pendingRequests.set(requestId, resolve);\n\t\t\tthis._onCreateRequest.fire({ requestId, ...args });\n\t\t\tconst tokenSource = new CancellationTokenSource();\n\t\t\ttimeout(this._timeout, tokenSource.token).then(() => reject(`Request ${requestId} timed out (${this._timeout}ms)`));\n\t\t\tthis._pendingRequestDisposables.set(requestId, [toDisposable(() => tokenSource.cancel())]);\n\t\t});\n\t}\n\n\t/**\n\t * Accept a reply to a request.\n\t * @param requestId The request ID originating from the onCreateRequest event.\n\t * @param data The reply data.\n\t */\n\tacceptReply(requestId: number, data: T) {\n\t\tconst resolveRequest = this._pendingRequests.get(requestId);\n\t\tif (resolveRequest) {\n\t\t\tthis._pendingRequests.delete(requestId);\n\t\t\tdispose(this._pendingRequestDisposables.get(requestId) || []);\n\t\t\tthis._pendingRequestDisposables.delete(requestId);\n\t\t\tresolveRequest(data);\n\t\t} else {\n\t\t\tthis._logService.warn(`RequestStore#acceptReply was called without receiving a matching request ${requestId}`);\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Codicon } from '../../../base/common/codicons.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { IExtensionTerminalProfile, ITerminalProfile, TerminalIcon } from './terminal.js';\nimport { ThemeIcon } from '../../../base/common/themables.js';\n\nexport function createProfileSchemaEnums(detectedProfiles: ITerminalProfile[], extensionProfiles?: readonly IExtensionTerminalProfile[]): {\n\tvalues: (string | null)[] | undefined;\n\tmarkdownDescriptions: string[] | undefined;\n} {\n\tconst result: { name: string | null; description: string }[] = [{\n\t\tname: null,\n\t\tdescription: localize('terminalAutomaticProfile', 'Automatically detect the default')\n\t}];\n\tresult.push(...detectedProfiles.map(e => {\n\t\treturn {\n\t\t\tname: e.profileName,\n\t\t\tdescription: createProfileDescription(e)\n\t\t};\n\t}));\n\tif (extensionProfiles) {\n\t\tresult.push(...extensionProfiles.map(extensionProfile => {\n\t\t\treturn {\n\t\t\t\tname: extensionProfile.title,\n\t\t\t\tdescription: createExtensionProfileDescription(extensionProfile)\n\t\t\t};\n\t\t}));\n\t}\n\treturn {\n\t\tvalues: result.map(e => e.name),\n\t\tmarkdownDescriptions: result.map(e => e.description)\n\t};\n}\n\nfunction createProfileDescription(profile: ITerminalProfile): string {\n\tlet description = `$(${ThemeIcon.isThemeIcon(profile.icon) ? profile.icon.id : profile.icon ? profile.icon : Codicon.terminal.id}) ${profile.profileName}\\n- path: ${profile.path}`;\n\tif (profile.args) {\n\t\tif (typeof profile.args === 'string') {\n\t\t\tdescription += `\\n- args: \"${profile.args}\"`;\n\t\t} else {\n\t\t\tdescription += `\\n- args: [${profile.args.length === 0 ? '' : `'${profile.args.join(`','`)}'`}]`;\n\t\t}\n\t}\n\tif (profile.overrideName !== undefined) {\n\t\tdescription += `\\n- overrideName: ${profile.overrideName}`;\n\t}\n\tif (profile.color) {\n\t\tdescription += `\\n- color: ${profile.color}`;\n\t}\n\tif (profile.env) {\n\t\tdescription += `\\n- env: ${JSON.stringify(profile.env)}`;\n\t}\n\treturn description;\n}\n\nfunction createExtensionProfileDescription(profile: IExtensionTerminalProfile): string {\n\tconst description = `$(${ThemeIcon.isThemeIcon(profile.icon) ? profile.icon.id : profile.icon ? profile.icon : Codicon.terminal.id}) ${profile.title}\\n- extensionIdentifier: ${profile.extensionIdentifier}`;\n\treturn description;\n}\n\n\nexport function terminalProfileArgsMatch(args1: string | string[] | undefined, args2: string | string[] | undefined): boolean {\n\tif (!args1 && !args2) {\n\t\treturn true;\n\t} else if (typeof args1 === 'string' && typeof args2 === 'string') {\n\t\treturn args1 === args2;\n\t} else if (Array.isArray(args1) && Array.isArray(args2)) {\n\t\tif (args1.length !== args2.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (let i = 0; i < args1.length; i++) {\n\t\t\tif (args1[i] !== args2[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport function terminalIconsEqual(a?: TerminalIcon, b?: TerminalIcon): boolean {\n\tif (!a && !b) {\n\t\treturn true;\n\t} else if (!a || !b) {\n\t\treturn false;\n\t}\n\n\tif (ThemeIcon.isThemeIcon(a) && ThemeIcon.isThemeIcon(b)) {\n\t\treturn a.id === b.id && a.color === b.color;\n\t}\n\tif (typeof a === 'object' && 'light' in a && 'dark' in a\n\t\t&& typeof b === 'object' && 'light' in b && 'dark' in b) {\n\t\tconst castedA = (a as { light: unknown; dark: unknown });\n\t\tconst castedB = (b as { light: unknown; dark: unknown });\n\t\tif ((URI.isUri(castedA.light) || isUriComponents(castedA.light)) && (URI.isUri(castedA.dark) || isUriComponents(castedA.dark))\n\t\t\t&& (URI.isUri(castedB.light) || isUriComponents(castedB.light)) && (URI.isUri(castedB.dark) || isUriComponents(castedB.dark))) {\n\t\t\treturn castedA.light.path === castedB.light.path && castedA.dark.path === castedB.dark.path;\n\t\t}\n\t}\n\tif ((URI.isUri(a) && URI.isUri(b)) || (isUriComponents(a) || isUriComponents(b))) {\n\t\tconst castedA = (a as { scheme: unknown; path: unknown });\n\t\tconst castedB = (b as { scheme: unknown; path: unknown });\n\t\treturn castedA.path === castedB.path && castedA.scheme === castedB.scheme;\n\t}\n\n\treturn false;\n}\n\n\nexport function isUriComponents(thing: unknown): thing is UriComponents {\n\tif (!thing) {\n\t\treturn false;\n\t}\n\treturn typeof (<any>thing).path === 'string' &&\n\t\ttypeof (<any>thing).scheme === 'string';\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { getAllCodicons } from '../../../base/common/codicons.js';\nimport { IJSONSchema, IJSONSchemaMap } from '../../../base/common/jsonSchema.js';\nimport { OperatingSystem, Platform, PlatformToString } from '../../../base/common/platform.js';\nimport { localize } from '../../../nls.js';\nimport { ConfigurationScope, Extensions, IConfigurationNode, IConfigurationRegistry } from '../../configuration/common/configurationRegistry.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport { IExtensionTerminalProfile, ITerminalProfile, TerminalSettingId } from './terminal.js';\nimport { createProfileSchemaEnums } from './terminalProfiles.js';\n\nexport const terminalColorSchema: IJSONSchema = {\n\ttype: ['string', 'null'],\n\tenum: [\n\t\t'terminal.ansiBlack',\n\t\t'terminal.ansiRed',\n\t\t'terminal.ansiGreen',\n\t\t'terminal.ansiYellow',\n\t\t'terminal.ansiBlue',\n\t\t'terminal.ansiMagenta',\n\t\t'terminal.ansiCyan',\n\t\t'terminal.ansiWhite'\n\t],\n\tdefault: null\n};\n\nexport const terminalIconSchema: IJSONSchema = {\n\ttype: 'string',\n\tenum: Array.from(getAllCodicons(), icon => icon.id),\n\tmarkdownEnumDescriptions: Array.from(getAllCodicons(), icon => `$(${icon.id})`),\n};\n\nconst terminalProfileBaseProperties: IJSONSchemaMap = {\n\targs: {\n\t\tdescription: localize('terminalProfile.args', 'An optional set of arguments to run the shell executable with.'),\n\t\ttype: 'array',\n\t\titems: {\n\t\t\ttype: 'string'\n\t\t}\n\t},\n\toverrideName: {\n\t\tdescription: localize('terminalProfile.overrideName', 'Whether or not to replace the dynamic terminal title that detects what program is running with the static profile name.'),\n\t\ttype: 'boolean'\n\t},\n\ticon: {\n\t\tdescription: localize('terminalProfile.icon', 'A codicon ID to associate with the terminal icon.'),\n\t\t...terminalIconSchema\n\t},\n\tcolor: {\n\t\tdescription: localize('terminalProfile.color', 'A theme color ID to associate with the terminal icon.'),\n\t\t...terminalColorSchema\n\t},\n\tenv: {\n\t\tmarkdownDescription: localize('terminalProfile.env', \"An object with environment variables that will be added to the terminal profile process. Set to `null` to delete environment variables from the base environment.\"),\n\t\ttype: 'object',\n\t\tadditionalProperties: {\n\t\t\ttype: ['string', 'null']\n\t\t},\n\t\tdefault: {}\n\t}\n};\n\nconst terminalProfileSchema: IJSONSchema = {\n\ttype: 'object',\n\trequired: ['path'],\n\tproperties: {\n\t\tpath: {\n\t\t\tdescription: localize('terminalProfile.path', 'A single path to a shell executable or an array of paths that will be used as fallbacks when one fails.'),\n\t\t\ttype: ['string', 'array'],\n\t\t\titems: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t},\n\t\t...terminalProfileBaseProperties\n\t}\n};\n\nconst terminalAutomationProfileSchema: IJSONSchema = {\n\ttype: 'object',\n\trequired: ['path'],\n\tproperties: {\n\t\tpath: {\n\t\t\tdescription: localize('terminalAutomationProfile.path', 'A single path to a shell executable.'),\n\t\t\ttype: ['string'],\n\t\t\titems: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t},\n\t\t...terminalProfileBaseProperties\n\t}\n};\n\nfunction createTerminalProfileMarkdownDescription(platform: Platform.Linux | Platform.Mac | Platform.Windows): string {\n\tconst key = platform === Platform.Linux ? 'linux' : platform === Platform.Mac ? 'osx' : 'windows';\n\treturn localize(\n\t\t{\n\t\t\tkey: 'terminal.integrated.profile',\n\t\t\tcomment: ['{0} is the platform, {1} is a code block, {2} and {3} are a link start and end']\n\t\t},\n\t\t\"A set of terminal profile customizations for {0} which allows adding, removing or changing how terminals are launched. Profiles are made up of a mandatory path, optional arguments and other presentation options.\\n\\nTo override an existing profile use its profile name as the key, for example:\\n\\n{1}\\n\\n{2}Read more about configuring profiles{3}.\",\n\t\tPlatformToString(platform),\n\t\t'```json\\n\"terminal.integrated.profile.' + key + '\": {\\n  \"bash\": null\\n}\\n```',\n\t\t'[',\n\t\t'](https://code.visualstudio.com/docs/terminal/profiles)'\n\t);\n}\n\nconst terminalPlatformConfiguration: IConfigurationNode = {\n\tid: 'terminal',\n\torder: 100,\n\ttitle: localize('terminalIntegratedConfigurationTitle', \"Integrated Terminal\"),\n\ttype: 'object',\n\tproperties: {\n\t\t[TerminalSettingId.AutomationProfileLinux]: {\n\t\t\trestricted: true,\n\t\t\tmarkdownDescription: localize('terminal.integrated.automationProfile.linux', \"The terminal profile to use on Linux for automation-related terminal usage like tasks and debug.\"),\n\t\t\ttype: ['object', 'null'],\n\t\t\tdefault: null,\n\t\t\t'anyOf': [\n\t\t\t\t{ type: 'null' },\n\t\t\t\tterminalAutomationProfileSchema\n\t\t\t],\n\t\t\tdefaultSnippets: [\n\t\t\t\t{\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tpath: '${1}',\n\t\t\t\t\t\ticon: '${2}'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t[TerminalSettingId.AutomationProfileMacOs]: {\n\t\t\trestricted: true,\n\t\t\tmarkdownDescription: localize('terminal.integrated.automationProfile.osx', \"The terminal profile to use on macOS for automation-related terminal usage like tasks and debug.\"),\n\t\t\ttype: ['object', 'null'],\n\t\t\tdefault: null,\n\t\t\t'anyOf': [\n\t\t\t\t{ type: 'null' },\n\t\t\t\tterminalAutomationProfileSchema\n\t\t\t],\n\t\t\tdefaultSnippets: [\n\t\t\t\t{\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tpath: '${1}',\n\t\t\t\t\t\ticon: '${2}'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t[TerminalSettingId.AutomationProfileWindows]: {\n\t\t\trestricted: true,\n\t\t\tmarkdownDescription: localize('terminal.integrated.automationProfile.windows', \"The terminal profile to use for automation-related terminal usage like tasks and debug. This setting will currently be ignored if {0} (now deprecated) is set.\", '`terminal.integrated.automationShell.windows`'),\n\t\t\ttype: ['object', 'null'],\n\t\t\tdefault: null,\n\t\t\t'anyOf': [\n\t\t\t\t{ type: 'null' },\n\t\t\t\tterminalAutomationProfileSchema\n\t\t\t],\n\t\t\tdefaultSnippets: [\n\t\t\t\t{\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tpath: '${1}',\n\t\t\t\t\t\ticon: '${2}'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t[TerminalSettingId.ProfilesWindows]: {\n\t\t\trestricted: true,\n\t\t\tmarkdownDescription: createTerminalProfileMarkdownDescription(Platform.Windows),\n\t\t\ttype: 'object',\n\t\t\tdefault: {\n\t\t\t\t'PowerShell': {\n\t\t\t\t\tsource: 'PowerShell',\n\t\t\t\t\ticon: 'terminal-powershell'\n\t\t\t\t},\n\t\t\t\t'Command Prompt': {\n\t\t\t\t\tpath: [\n\t\t\t\t\t\t'${env:windir}\\\\Sysnative\\\\cmd.exe',\n\t\t\t\t\t\t'${env:windir}\\\\System32\\\\cmd.exe'\n\t\t\t\t\t],\n\t\t\t\t\targs: [],\n\t\t\t\t\ticon: 'terminal-cmd'\n\t\t\t\t},\n\t\t\t\t'Git Bash': {\n\t\t\t\t\tsource: 'Git Bash'\n\t\t\t\t}\n\t\t\t},\n\t\t\tadditionalProperties: {\n\t\t\t\t'anyOf': [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\trequired: ['source'],\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tsource: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.windowsSource', 'A profile source that will auto detect the paths to the shell. Note that non-standard executable locations are not supported and must be created manually in a new profile.'),\n\t\t\t\t\t\t\t\tenum: ['PowerShell', 'Git Bash']\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...terminalProfileBaseProperties\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\trequired: ['extensionIdentifier', 'id', 'title'],\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\textensionIdentifier: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.windowsExtensionIdentifier', 'The extension that contributed this profile.'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tid: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.windowsExtensionId', 'The id of the extension terminal'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttitle: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.windowsExtensionTitle', 'The name of the extension terminal'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...terminalProfileBaseProperties\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{ type: 'null' },\n\t\t\t\t\tterminalProfileSchema\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t[TerminalSettingId.ProfilesMacOs]: {\n\t\t\trestricted: true,\n\t\t\tmarkdownDescription: createTerminalProfileMarkdownDescription(Platform.Mac),\n\t\t\ttype: 'object',\n\t\t\tdefault: {\n\t\t\t\t'bash': {\n\t\t\t\t\tpath: 'bash',\n\t\t\t\t\targs: ['-l'],\n\t\t\t\t\ticon: 'terminal-bash'\n\t\t\t\t},\n\t\t\t\t'zsh': {\n\t\t\t\t\tpath: 'zsh',\n\t\t\t\t\targs: ['-l']\n\t\t\t\t},\n\t\t\t\t'fish': {\n\t\t\t\t\tpath: 'fish',\n\t\t\t\t\targs: ['-l']\n\t\t\t\t},\n\t\t\t\t'tmux': {\n\t\t\t\t\tpath: 'tmux',\n\t\t\t\t\ticon: 'terminal-tmux'\n\t\t\t\t},\n\t\t\t\t'pwsh': {\n\t\t\t\t\tpath: 'pwsh',\n\t\t\t\t\ticon: 'terminal-powershell'\n\t\t\t\t}\n\t\t\t},\n\t\t\tadditionalProperties: {\n\t\t\t\t'anyOf': [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\trequired: ['extensionIdentifier', 'id', 'title'],\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\textensionIdentifier: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.osxExtensionIdentifier', 'The extension that contributed this profile.'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tid: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.osxExtensionId', 'The id of the extension terminal'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttitle: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.osxExtensionTitle', 'The name of the extension terminal'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...terminalProfileBaseProperties\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{ type: 'null' },\n\t\t\t\t\tterminalProfileSchema\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t[TerminalSettingId.ProfilesLinux]: {\n\t\t\trestricted: true,\n\t\t\tmarkdownDescription: createTerminalProfileMarkdownDescription(Platform.Linux),\n\t\t\ttype: 'object',\n\t\t\tdefault: {\n\t\t\t\t'bash': {\n\t\t\t\t\tpath: 'bash',\n\t\t\t\t\ticon: 'terminal-bash'\n\t\t\t\t},\n\t\t\t\t'zsh': {\n\t\t\t\t\tpath: 'zsh'\n\t\t\t\t},\n\t\t\t\t'fish': {\n\t\t\t\t\tpath: 'fish'\n\t\t\t\t},\n\t\t\t\t'tmux': {\n\t\t\t\t\tpath: 'tmux',\n\t\t\t\t\ticon: 'terminal-tmux'\n\t\t\t\t},\n\t\t\t\t'pwsh': {\n\t\t\t\t\tpath: 'pwsh',\n\t\t\t\t\ticon: 'terminal-powershell'\n\t\t\t\t}\n\t\t\t},\n\t\t\tadditionalProperties: {\n\t\t\t\t'anyOf': [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\trequired: ['extensionIdentifier', 'id', 'title'],\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\textensionIdentifier: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.linuxExtensionIdentifier', 'The extension that contributed this profile.'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tid: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.linuxExtensionId', 'The id of the extension terminal'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttitle: {\n\t\t\t\t\t\t\t\tdescription: localize('terminalProfile.linuxExtensionTitle', 'The name of the extension terminal'),\n\t\t\t\t\t\t\t\ttype: 'string'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...terminalProfileBaseProperties\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{ type: 'null' },\n\t\t\t\t\tterminalProfileSchema\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t[TerminalSettingId.UseWslProfiles]: {\n\t\t\tdescription: localize('terminal.integrated.useWslProfiles', 'Controls whether or not WSL distros are shown in the terminal dropdown'),\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true\n\t\t},\n\t\t[TerminalSettingId.InheritEnv]: {\n\t\t\tscope: ConfigurationScope.APPLICATION,\n\t\t\tdescription: localize('terminal.integrated.inheritEnv', \"Whether new shells should inherit their environment from VS Code, which may source a login shell to ensure $PATH and other development variables are initialized. This has no effect on Windows.\"),\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true\n\t\t},\n\t\t[TerminalSettingId.PersistentSessionScrollback]: {\n\t\t\tscope: ConfigurationScope.APPLICATION,\n\t\t\tmarkdownDescription: localize('terminal.integrated.persistentSessionScrollback', \"Controls the maximum amount of lines that will be restored when reconnecting to a persistent terminal session. Increasing this will restore more lines of scrollback at the cost of more memory and increase the time it takes to connect to terminals on start up. This setting requires a restart to take effect and should be set to a value less than or equal to `#terminal.integrated.scrollback#`.\"),\n\t\t\ttype: 'number',\n\t\t\tdefault: 100\n\t\t},\n\t\t[TerminalSettingId.ShowLinkHover]: {\n\t\t\tscope: ConfigurationScope.APPLICATION,\n\t\t\tdescription: localize('terminal.integrated.showLinkHover', \"Whether to show hovers for links in the terminal output.\"),\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true\n\t\t},\n\t\t[TerminalSettingId.IgnoreProcessNames]: {\n\t\t\tmarkdownDescription: localize('terminal.integrated.confirmIgnoreProcesses', \"A set of process names to ignore when using the {0} setting.\", '`#terminal.integrated.confirmOnKill#`'),\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\ttype: 'string',\n\t\t\t\tuniqueItems: true\n\t\t\t},\n\t\t\tdefault: [\n\t\t\t\t// Popular prompt programs, these should not count as child processes\n\t\t\t\t'starship',\n\t\t\t\t'oh-my-posh',\n\t\t\t\t// Git bash may runs a subprocess of itself (bin\\bash.exe -> usr\\bin\\bash.exe)\n\t\t\t\t'bash',\n\t\t\t\t'zsh',\n\t\t\t]\n\t\t}\n\t}\n};\n\n/**\n * Registers terminal configurations required by shared process and remote server.\n */\nexport function registerTerminalPlatformConfiguration() {\n\tRegistry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration(terminalPlatformConfiguration);\n\tregisterTerminalDefaultProfileConfiguration();\n}\n\nlet defaultProfilesConfiguration: IConfigurationNode | undefined;\nexport function registerTerminalDefaultProfileConfiguration(detectedProfiles?: { os: OperatingSystem; profiles: ITerminalProfile[] }, extensionContributedProfiles?: readonly IExtensionTerminalProfile[]) {\n\tconst registry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);\n\tlet profileEnum;\n\tif (detectedProfiles) {\n\t\tprofileEnum = createProfileSchemaEnums(detectedProfiles?.profiles, extensionContributedProfiles);\n\t}\n\tconst oldDefaultProfilesConfiguration = defaultProfilesConfiguration;\n\tdefaultProfilesConfiguration = {\n\t\tid: 'terminal',\n\t\torder: 100,\n\t\ttitle: localize('terminalIntegratedConfigurationTitle', \"Integrated Terminal\"),\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\t[TerminalSettingId.DefaultProfileLinux]: {\n\t\t\t\trestricted: true,\n\t\t\t\tmarkdownDescription: localize('terminal.integrated.defaultProfile.linux', \"The default terminal profile on Linux.\"),\n\t\t\t\ttype: ['string', 'null'],\n\t\t\t\tdefault: null,\n\t\t\t\tenum: detectedProfiles?.os === OperatingSystem.Linux ? profileEnum?.values : undefined,\n\t\t\t\tmarkdownEnumDescriptions: detectedProfiles?.os === OperatingSystem.Linux ? profileEnum?.markdownDescriptions : undefined\n\t\t\t},\n\t\t\t[TerminalSettingId.DefaultProfileMacOs]: {\n\t\t\t\trestricted: true,\n\t\t\t\tmarkdownDescription: localize('terminal.integrated.defaultProfile.osx', \"The default terminal profile on macOS.\"),\n\t\t\t\ttype: ['string', 'null'],\n\t\t\t\tdefault: null,\n\t\t\t\tenum: detectedProfiles?.os === OperatingSystem.Macintosh ? profileEnum?.values : undefined,\n\t\t\t\tmarkdownEnumDescriptions: detectedProfiles?.os === OperatingSystem.Macintosh ? profileEnum?.markdownDescriptions : undefined\n\t\t\t},\n\t\t\t[TerminalSettingId.DefaultProfileWindows]: {\n\t\t\t\trestricted: true,\n\t\t\t\tmarkdownDescription: localize('terminal.integrated.defaultProfile.windows', \"The default terminal profile on Windows.\"),\n\t\t\t\ttype: ['string', 'null'],\n\t\t\t\tdefault: null,\n\t\t\t\tenum: detectedProfiles?.os === OperatingSystem.Windows ? profileEnum?.values : undefined,\n\t\t\t\tmarkdownEnumDescriptions: detectedProfiles?.os === OperatingSystem.Windows ? profileEnum?.markdownDescriptions : undefined\n\t\t\t},\n\t\t}\n\t};\n\tregistry.updateConfigurations({ add: [defaultProfilesConfiguration], remove: oldDefaultProfilesConfiguration ? [oldDefaultProfilesConfiguration] : [] });\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IProcessEnvironment } from '../../../base/common/platform.js';\nimport { IWorkspaceFolderData } from '../../workspace/common/workspace.js';\n\nexport enum EnvironmentVariableMutatorType {\n\tReplace = 1,\n\tAppend = 2,\n\tPrepend = 3\n}\nexport interface IEnvironmentVariableMutator {\n\treadonly variable: string;\n\treadonly value: string;\n\treadonly type: EnvironmentVariableMutatorType;\n\treadonly scope?: EnvironmentVariableScope;\n\treadonly options?: IEnvironmentVariableMutatorOptions;\n}\n\nexport interface IEnvironmentVariableCollectionDescription {\n\treadonly description: string | undefined;\n\treadonly scope?: EnvironmentVariableScope;\n}\n\nexport interface IEnvironmentVariableMutatorOptions {\n\tapplyAtProcessCreation?: boolean;\n\tapplyAtShellIntegration?: boolean;\n}\n\nexport type EnvironmentVariableScope = {\n\tworkspaceFolder?: IWorkspaceFolderData;\n};\n\nexport interface IEnvironmentVariableCollection {\n\treadonly map: ReadonlyMap<string, IEnvironmentVariableMutator>;\n\treadonly descriptionMap?: ReadonlyMap<string, IEnvironmentVariableCollectionDescription>;\n}\n\n/** [variable, mutator] */\nexport type ISerializableEnvironmentVariableCollection = [string, IEnvironmentVariableMutator][];\n\nexport type ISerializableEnvironmentDescriptionMap = [string, IEnvironmentVariableCollectionDescription][];\nexport interface IExtensionOwnedEnvironmentDescriptionMutator extends IEnvironmentVariableCollectionDescription {\n\treadonly extensionIdentifier: string;\n}\n\n/** [extension, collection, description] */\nexport type ISerializableEnvironmentVariableCollections = [string, ISerializableEnvironmentVariableCollection, ISerializableEnvironmentDescriptionMap][];\n\nexport interface IExtensionOwnedEnvironmentVariableMutator extends IEnvironmentVariableMutator {\n\treadonly extensionIdentifier: string;\n}\n\nexport interface IMergedEnvironmentVariableCollectionDiff {\n\tadded: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;\n\tchanged: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;\n\tremoved: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;\n}\n\ntype VariableResolver = (str: string) => Promise<string>;\n\n/**\n * Represents an environment variable collection that results from merging several collections\n * together.\n */\nexport interface IMergedEnvironmentVariableCollection {\n\treadonly collections: ReadonlyMap<string, IEnvironmentVariableCollection>;\n\t/**\n\t * Gets the variable map for a given scope.\n\t * @param scope The scope to get the variable map for. If undefined, the global scope is used.\n\t */\n\tgetVariableMap(scope: EnvironmentVariableScope | undefined): Map<string, IExtensionOwnedEnvironmentVariableMutator[]>;\n\t/**\n\t * Gets the description map for a given scope.\n\t * @param scope The scope to get the description map for. If undefined, description map for the\n\t * global scope is returned.\n\t */\n\tgetDescriptionMap(scope: EnvironmentVariableScope | undefined): Map<string, string | undefined>;\n\t/**\n\t * Applies this collection to a process environment.\n\t * @param variableResolver An optional function to use to resolve variables within the\n\t * environment values.\n\t */\n\tapplyToProcessEnvironment(env: IProcessEnvironment, scope: EnvironmentVariableScope | undefined, variableResolver?: VariableResolver): Promise<void>;\n\n\t/**\n\t * Generates a diff of this collection against another. Returns undefined if the collections are\n\t * the same.\n\t */\n\tdiff(other: IMergedEnvironmentVariableCollection, scope: EnvironmentVariableScope | undefined): IMergedEnvironmentVariableCollectionDiff | undefined;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IProcessEnvironment } from '../../../base/common/platform.js';\nimport { IWorkspaceFolderData } from '../../workspace/common/workspace.js';\n\nexport enum EnvironmentVariableMutatorType {\n\tReplace = 1,\n\tAppend = 2,\n\tPrepend = 3\n}\nexport interface IEnvironmentVariableMutator {\n\treadonly variable: string;\n\treadonly value: string;\n\treadonly type: EnvironmentVariableMutatorType;\n\treadonly scope?: EnvironmentVariableScope;\n\treadonly options?: IEnvironmentVariableMutatorOptions;\n}\n\nexport interface IEnvironmentVariableCollectionDescription {\n\treadonly description: string | undefined;\n\treadonly scope?: EnvironmentVariableScope;\n}\n\nexport interface IEnvironmentVariableMutatorOptions {\n\tapplyAtProcessCreation?: boolean;\n\tapplyAtShellIntegration?: boolean;\n}\n\nexport type EnvironmentVariableScope = {\n\tworkspaceFolder?: IWorkspaceFolderData;\n};\n\nexport interface IEnvironmentVariableCollection {\n\treadonly map: ReadonlyMap<string, IEnvironmentVariableMutator>;\n\treadonly descriptionMap?: ReadonlyMap<string, IEnvironmentVariableCollectionDescription>;\n}\n\n/** [variable, mutator] */\nexport type ISerializableEnvironmentVariableCollection = [string, IEnvironmentVariableMutator][];\n\nexport type ISerializableEnvironmentDescriptionMap = [string, IEnvironmentVariableCollectionDescription][];\nexport interface IExtensionOwnedEnvironmentDescriptionMutator extends IEnvironmentVariableCollectionDescription {\n\treadonly extensionIdentifier: string;\n}\n\n/** [extension, collection, description] */\nexport type ISerializableEnvironmentVariableCollections = [string, ISerializableEnvironmentVariableCollection, ISerializableEnvironmentDescriptionMap][];\n\nexport interface IExtensionOwnedEnvironmentVariableMutator extends IEnvironmentVariableMutator {\n\treadonly extensionIdentifier: string;\n}\n\nexport interface IMergedEnvironmentVariableCollectionDiff {\n\tadded: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;\n\tchanged: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;\n\tremoved: ReadonlyMap<string, IExtensionOwnedEnvironmentVariableMutator[]>;\n}\n\ntype VariableResolver = (str: string) => Promise<string>;\n\n/**\n * Represents an environment variable collection that results from merging several collections\n * together.\n */\nexport interface IMergedEnvironmentVariableCollection {\n\treadonly collections: ReadonlyMap<string, IEnvironmentVariableCollection>;\n\t/**\n\t * Gets the variable map for a given scope.\n\t * @param scope The scope to get the variable map for. If undefined, the global scope is used.\n\t */\n\tgetVariableMap(scope: EnvironmentVariableScope | undefined): Map<string, IExtensionOwnedEnvironmentVariableMutator[]>;\n\t/**\n\t * Gets the description map for a given scope.\n\t * @param scope The scope to get the description map for. If undefined, description map for the\n\t * global scope is returned.\n\t */\n\tgetDescriptionMap(scope: EnvironmentVariableScope | undefined): Map<string, string | undefined>;\n\t/**\n\t * Applies this collection to a process environment.\n\t * @param variableResolver An optional function to use to resolve variables within the\n\t * environment values.\n\t */\n\tapplyToProcessEnvironment(env: IProcessEnvironment, scope: EnvironmentVariableScope | undefined, variableResolver?: VariableResolver): Promise<void>;\n\n\t/**\n\t * Generates a diff of this collection against another. Returns undefined if the collections are\n\t * the same.\n\t */\n\tdiff(other: IMergedEnvironmentVariableCollection, scope: EnvironmentVariableScope | undefined): IMergedEnvironmentVariableCollectionDiff | undefined;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IEnvironmentVariableCollectionDescription, IEnvironmentVariableCollection, IEnvironmentVariableMutator, ISerializableEnvironmentDescriptionMap as ISerializableEnvironmentDescriptionMap, ISerializableEnvironmentVariableCollection, ISerializableEnvironmentVariableCollections } from './environmentVariable.js';\n\n// This file is shared between the renderer and extension host\n\nexport function serializeEnvironmentVariableCollection(collection: ReadonlyMap<string, IEnvironmentVariableMutator>): ISerializableEnvironmentVariableCollection {\n\treturn [...collection.entries()];\n}\n\nexport function serializeEnvironmentDescriptionMap(descriptionMap: ReadonlyMap<string, IEnvironmentVariableCollectionDescription> | undefined): ISerializableEnvironmentDescriptionMap {\n\treturn descriptionMap ? [...descriptionMap.entries()] : [];\n}\n\nexport function deserializeEnvironmentVariableCollection(\n\tserializedCollection: ISerializableEnvironmentVariableCollection\n): Map<string, IEnvironmentVariableMutator> {\n\treturn new Map<string, IEnvironmentVariableMutator>(serializedCollection);\n}\n\nexport function deserializeEnvironmentDescriptionMap(\n\tserializableEnvironmentDescription: ISerializableEnvironmentDescriptionMap | undefined\n): Map<string, IEnvironmentVariableCollectionDescription> {\n\treturn new Map<string, IEnvironmentVariableCollectionDescription>(serializableEnvironmentDescription ?? []);\n}\n\nexport function serializeEnvironmentVariableCollections(collections: ReadonlyMap<string, IEnvironmentVariableCollection>): ISerializableEnvironmentVariableCollections {\n\treturn Array.from(collections.entries()).map(e => {\n\t\treturn [e[0], serializeEnvironmentVariableCollection(e[1].map), serializeEnvironmentDescriptionMap(e[1].descriptionMap)];\n\t});\n}\n\nexport function deserializeEnvironmentVariableCollections(\n\tserializedCollection: ISerializableEnvironmentVariableCollections\n): Map<string, IEnvironmentVariableCollection> {\n\treturn new Map<string, IEnvironmentVariableCollection>(serializedCollection.map(e => {\n\t\treturn [e[0], { map: deserializeEnvironmentVariableCollection(e[1]), descriptionMap: deserializeEnvironmentDescriptionMap(e[2]) }];\n\t}));\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IProcessEnvironment, isWindows } from '../../../base/common/platform.js';\nimport { EnvironmentVariableMutatorType, EnvironmentVariableScope, IEnvironmentVariableCollection, IExtensionOwnedEnvironmentDescriptionMutator, IExtensionOwnedEnvironmentVariableMutator, IMergedEnvironmentVariableCollection, IMergedEnvironmentVariableCollectionDiff } from './environmentVariable.js';\n\ntype VariableResolver = (str: string) => Promise<string>;\n\nconst mutatorTypeToLabelMap: Map<EnvironmentVariableMutatorType, string> = new Map([\n\t[EnvironmentVariableMutatorType.Append, 'APPEND'],\n\t[EnvironmentVariableMutatorType.Prepend, 'PREPEND'],\n\t[EnvironmentVariableMutatorType.Replace, 'REPLACE']\n]);\n\nexport class MergedEnvironmentVariableCollection implements IMergedEnvironmentVariableCollection {\n\tprivate readonly map: Map<string, IExtensionOwnedEnvironmentVariableMutator[]> = new Map();\n\tprivate readonly descriptionMap: Map<string, IExtensionOwnedEnvironmentDescriptionMutator[]> = new Map();\n\n\tconstructor(\n\t\treadonly collections: ReadonlyMap<string, IEnvironmentVariableCollection>,\n\t) {\n\t\tcollections.forEach((collection, extensionIdentifier) => {\n\t\t\tthis.populateDescriptionMap(collection, extensionIdentifier);\n\t\t\tconst it = collection.map.entries();\n\t\t\tlet next = it.next();\n\t\t\twhile (!next.done) {\n\t\t\t\tconst mutator = next.value[1];\n\t\t\t\tconst key = next.value[0];\n\t\t\t\tlet entry = this.map.get(key);\n\t\t\t\tif (!entry) {\n\t\t\t\t\tentry = [];\n\t\t\t\t\tthis.map.set(key, entry);\n\t\t\t\t}\n\n\t\t\t\t// If the first item in the entry is replace ignore any other entries as they would\n\t\t\t\t// just get replaced by this one.\n\t\t\t\tif (entry.length > 0 && entry[0].type === EnvironmentVariableMutatorType.Replace) {\n\t\t\t\t\tnext = it.next();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst extensionMutator = {\n\t\t\t\t\textensionIdentifier,\n\t\t\t\t\tvalue: mutator.value,\n\t\t\t\t\ttype: mutator.type,\n\t\t\t\t\tscope: mutator.scope,\n\t\t\t\t\tvariable: mutator.variable,\n\t\t\t\t\toptions: mutator.options\n\t\t\t\t};\n\t\t\t\tif (!extensionMutator.scope) {\n\t\t\t\t\tdelete extensionMutator.scope; // Convenient for tests\n\t\t\t\t}\n\t\t\t\t// Mutators get applied in the reverse order than they are created\n\t\t\t\tentry.unshift(extensionMutator);\n\n\t\t\t\tnext = it.next();\n\t\t\t}\n\t\t});\n\t}\n\n\tasync applyToProcessEnvironment(env: IProcessEnvironment, scope: EnvironmentVariableScope | undefined, variableResolver?: VariableResolver): Promise<void> {\n\t\tlet lowerToActualVariableNames: { [lowerKey: string]: string | undefined } | undefined;\n\t\tif (isWindows) {\n\t\t\tlowerToActualVariableNames = {};\n\t\t\tObject.keys(env).forEach(e => lowerToActualVariableNames![e.toLowerCase()] = e);\n\t\t}\n\t\tfor (const [variable, mutators] of this.getVariableMap(scope)) {\n\t\t\tconst actualVariable = isWindows ? lowerToActualVariableNames![variable.toLowerCase()] || variable : variable;\n\t\t\tfor (const mutator of mutators) {\n\t\t\t\tconst value = variableResolver ? await variableResolver(mutator.value) : mutator.value;\n\t\t\t\t// Default: true\n\t\t\t\tif (mutator.options?.applyAtProcessCreation ?? true) {\n\t\t\t\t\tswitch (mutator.type) {\n\t\t\t\t\t\tcase EnvironmentVariableMutatorType.Append:\n\t\t\t\t\t\t\tenv[actualVariable] = (env[actualVariable] || '') + value;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase EnvironmentVariableMutatorType.Prepend:\n\t\t\t\t\t\t\tenv[actualVariable] = value + (env[actualVariable] || '');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase EnvironmentVariableMutatorType.Replace:\n\t\t\t\t\t\t\tenv[actualVariable] = value;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Default: false\n\t\t\t\tif (mutator.options?.applyAtShellIntegration ?? false) {\n\t\t\t\t\tconst key = `VSCODE_ENV_${mutatorTypeToLabelMap.get(mutator.type)!}`;\n\t\t\t\t\tenv[key] = (env[key] ? env[key] + ':' : '') + variable + '=' + this._encodeColons(value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _encodeColons(value: string): string {\n\t\treturn value.replaceAll(':', '\\\\x3a');\n\t}\n\n\tdiff(other: IMergedEnvironmentVariableCollection, scope: EnvironmentVariableScope | undefined): IMergedEnvironmentVariableCollectionDiff | undefined {\n\t\tconst added: Map<string, IExtensionOwnedEnvironmentVariableMutator[]> = new Map();\n\t\tconst changed: Map<string, IExtensionOwnedEnvironmentVariableMutator[]> = new Map();\n\t\tconst removed: Map<string, IExtensionOwnedEnvironmentVariableMutator[]> = new Map();\n\n\t\t// Find added\n\t\tother.getVariableMap(scope).forEach((otherMutators, variable) => {\n\t\t\tconst currentMutators = this.getVariableMap(scope).get(variable);\n\t\t\tconst result = getMissingMutatorsFromArray(otherMutators, currentMutators);\n\t\t\tif (result) {\n\t\t\t\tadded.set(variable, result);\n\t\t\t}\n\t\t});\n\n\t\t// Find removed\n\t\tthis.getVariableMap(scope).forEach((currentMutators, variable) => {\n\t\t\tconst otherMutators = other.getVariableMap(scope).get(variable);\n\t\t\tconst result = getMissingMutatorsFromArray(currentMutators, otherMutators);\n\t\t\tif (result) {\n\t\t\t\tremoved.set(variable, result);\n\t\t\t}\n\t\t});\n\n\t\t// Find changed\n\t\tthis.getVariableMap(scope).forEach((currentMutators, variable) => {\n\t\t\tconst otherMutators = other.getVariableMap(scope).get(variable);\n\t\t\tconst result = getChangedMutatorsFromArray(currentMutators, otherMutators);\n\t\t\tif (result) {\n\t\t\t\tchanged.set(variable, result);\n\t\t\t}\n\t\t});\n\n\t\tif (added.size === 0 && changed.size === 0 && removed.size === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn { added, changed, removed };\n\t}\n\n\tgetVariableMap(scope: EnvironmentVariableScope | undefined): Map<string, IExtensionOwnedEnvironmentVariableMutator[]> {\n\t\tconst result = new Map<string, IExtensionOwnedEnvironmentVariableMutator[]>();\n\t\tfor (const mutators of this.map.values()) {\n\t\t\tconst filteredMutators = mutators.filter(m => filterScope(m, scope));\n\t\t\tif (filteredMutators.length > 0) {\n\t\t\t\t// All of these mutators are for the same variable because they are in the same scope, hence choose anyone to form a key.\n\t\t\t\tresult.set(filteredMutators[0].variable, filteredMutators);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tgetDescriptionMap(scope: EnvironmentVariableScope | undefined): Map<string, string | undefined> {\n\t\tconst result = new Map<string, string | undefined>();\n\t\tfor (const mutators of this.descriptionMap.values()) {\n\t\t\tconst filteredMutators = mutators.filter(m => filterScope(m, scope, true));\n\t\t\tfor (const mutator of filteredMutators) {\n\t\t\t\tresult.set(mutator.extensionIdentifier, mutator.description);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate populateDescriptionMap(collection: IEnvironmentVariableCollection, extensionIdentifier: string): void {\n\t\tif (!collection.descriptionMap) {\n\t\t\treturn;\n\t\t}\n\t\tconst it = collection.descriptionMap.entries();\n\t\tlet next = it.next();\n\t\twhile (!next.done) {\n\t\t\tconst mutator = next.value[1];\n\t\t\tconst key = next.value[0];\n\t\t\tlet entry = this.descriptionMap.get(key);\n\t\t\tif (!entry) {\n\t\t\t\tentry = [];\n\t\t\t\tthis.descriptionMap.set(key, entry);\n\t\t\t}\n\t\t\tconst extensionMutator = {\n\t\t\t\textensionIdentifier,\n\t\t\t\tscope: mutator.scope,\n\t\t\t\tdescription: mutator.description\n\t\t\t};\n\t\t\tif (!extensionMutator.scope) {\n\t\t\t\tdelete extensionMutator.scope; // Convenient for tests\n\t\t\t}\n\t\t\tentry.push(extensionMutator);\n\n\t\t\tnext = it.next();\n\t\t}\n\n\t}\n}\n\n/**\n * Returns whether a mutator matches with the scope provided.\n * @param mutator Mutator to filter\n * @param scope Scope to be used for querying\n * @param strictFilter If true, mutators with global scope is not returned when querying for workspace scope.\n * i.e whether mutator scope should always exactly match with query scope.\n */\nfunction filterScope(\n\tmutator: IExtensionOwnedEnvironmentVariableMutator | IExtensionOwnedEnvironmentDescriptionMutator,\n\tscope: EnvironmentVariableScope | undefined,\n\tstrictFilter = false\n): boolean {\n\tif (!mutator.scope) {\n\t\tif (strictFilter) {\n\t\t\treturn scope === mutator.scope;\n\t\t}\n\t\treturn true;\n\t}\n\t// If a mutator is scoped to a workspace folder, only apply it if the workspace\n\t// folder matches.\n\tif (mutator.scope.workspaceFolder && scope?.workspaceFolder && mutator.scope.workspaceFolder.index === scope.workspaceFolder.index) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nfunction getMissingMutatorsFromArray(\n\tcurrent: IExtensionOwnedEnvironmentVariableMutator[],\n\tother: IExtensionOwnedEnvironmentVariableMutator[] | undefined\n): IExtensionOwnedEnvironmentVariableMutator[] | undefined {\n\t// If it doesn't exist, all are removed\n\tif (!other) {\n\t\treturn current;\n\t}\n\n\t// Create a map to help\n\tconst otherMutatorExtensions = new Set<string>();\n\tother.forEach(m => otherMutatorExtensions.add(m.extensionIdentifier));\n\n\t// Find entries removed from other\n\tconst result: IExtensionOwnedEnvironmentVariableMutator[] = [];\n\tcurrent.forEach(mutator => {\n\t\tif (!otherMutatorExtensions.has(mutator.extensionIdentifier)) {\n\t\t\tresult.push(mutator);\n\t\t}\n\t});\n\n\treturn result.length === 0 ? undefined : result;\n}\n\nfunction getChangedMutatorsFromArray(\n\tcurrent: IExtensionOwnedEnvironmentVariableMutator[],\n\tother: IExtensionOwnedEnvironmentVariableMutator[] | undefined\n): IExtensionOwnedEnvironmentVariableMutator[] | undefined {\n\t// If it doesn't exist, none are changed (they are removed)\n\tif (!other) {\n\t\treturn undefined;\n\t}\n\n\t// Create a map to help\n\tconst otherMutatorExtensions = new Map<string, IExtensionOwnedEnvironmentVariableMutator>();\n\tother.forEach(m => otherMutatorExtensions.set(m.extensionIdentifier, m));\n\n\t// Find entries that exist in both but are not equal\n\tconst result: IExtensionOwnedEnvironmentVariableMutator[] = [];\n\tcurrent.forEach(mutator => {\n\t\tconst otherMutator = otherMutatorExtensions.get(mutator.extensionIdentifier);\n\t\tif (otherMutator && (mutator.type !== otherMutator.type || mutator.value !== otherMutator.value || mutator.scope?.workspaceFolder?.index !== otherMutator.scope?.workspaceFolder?.index)) {\n\t\t\t// Return the new result, not the old one\n\t\t\tresult.push(otherMutator);\n\t\t}\n\t});\n\n\treturn result.length === 0 ? undefined : result;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as os from 'os';\nimport { FileAccess } from '../../../base/common/network.js';\nimport * as path from '../../../base/common/path.js';\nimport { IProcessEnvironment, isMacintosh, isWindows } from '../../../base/common/platform.js';\nimport * as process from '../../../base/common/process.js';\nimport { format } from '../../../base/common/strings.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { IShellLaunchConfig, ITerminalEnvironment, ITerminalProcessOptions, ShellIntegrationInjectionFailureReason } from '../common/terminal.js';\nimport { EnvironmentVariableMutatorType } from '../common/environmentVariable.js';\nimport { deserializeEnvironmentVariableCollections } from '../common/environmentVariableShared.js';\nimport { MergedEnvironmentVariableCollection } from '../common/environmentVariableCollection.js';\nimport { chmod, realpathSync, mkdirSync } from 'fs';\nimport { promisify } from 'util';\n\nexport function getWindowsBuildNumber(): number {\n\tconst osVersion = (/(\\d+)\\.(\\d+)\\.(\\d+)/g).exec(os.release());\n\tlet buildNumber: number = 0;\n\tif (osVersion && osVersion.length === 4) {\n\t\tbuildNumber = parseInt(osVersion[3]);\n\t}\n\treturn buildNumber;\n}\n\nexport interface IShellIntegrationConfigInjection {\n\treadonly type: 'injection';\n\t/**\n\t * A new set of arguments to use.\n\t */\n\treadonly newArgs: string[] | undefined;\n\t/**\n\t * An optional environment to mixing to the real environment.\n\t */\n\treadonly envMixin?: IProcessEnvironment;\n\t/**\n\t * An optional array of files to copy from `source` to `dest`.\n\t */\n\treadonly filesToCopy?: {\n\t\tsource: string;\n\t\tdest: string;\n\t}[];\n}\n\nexport interface IShellIntegrationInjectionFailure {\n\treadonly type: 'failure';\n\treadonly reason: ShellIntegrationInjectionFailureReason;\n}\n\n/**\n * For a given shell launch config, returns arguments to replace and an optional environment to\n * mixin to the SLC's environment to enable shell integration. This must be run within the context\n * that creates the process to ensure accuracy. Returns undefined if shell integration cannot be\n * enabled.\n */\nexport async function getShellIntegrationInjection(\n\tshellLaunchConfig: IShellLaunchConfig,\n\toptions: ITerminalProcessOptions,\n\tenv: ITerminalEnvironment | undefined,\n\tlogService: ILogService,\n\tproductService: IProductService,\n\tskipStickyBit: boolean = false\n): Promise<IShellIntegrationConfigInjection | IShellIntegrationInjectionFailure> {\n\t// The global setting is disabled\n\tif (!options.shellIntegration.enabled) {\n\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.InjectionSettingDisabled };\n\t}\n\t// There is no executable (so there's no way to determine how to inject)\n\tif (!shellLaunchConfig.executable) {\n\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.NoExecutable };\n\t}\n\t// It's a feature terminal (tasks, debug), unless it's explicitly being forced\n\tif (shellLaunchConfig.isFeatureTerminal && !shellLaunchConfig.forceShellIntegration) {\n\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.FeatureTerminal };\n\t}\n\t// The ignoreShellIntegration flag is passed (eg. relaunching without shell integration)\n\tif (shellLaunchConfig.ignoreShellIntegration) {\n\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.IgnoreShellIntegrationFlag };\n\t}\n\t// Shell integration doesn't work with winpty\n\tif (isWindows && (!options.windowsEnableConpty || getWindowsBuildNumber() < 18309)) {\n\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.Winpty };\n\t}\n\n\tconst originalArgs = shellLaunchConfig.args;\n\tconst shell = process.platform === 'win32' ? path.basename(shellLaunchConfig.executable).toLowerCase() : path.basename(shellLaunchConfig.executable);\n\tconst appRoot = path.dirname(FileAccess.asFileUri('').fsPath);\n\tconst type = 'injection';\n\tlet newArgs: string[] | undefined;\n\tconst envMixin: IProcessEnvironment = {\n\t\t'VSCODE_INJECTION': '1'\n\t};\n\n\tif (options.shellIntegration.nonce) {\n\t\tenvMixin['VSCODE_NONCE'] = options.shellIntegration.nonce;\n\t}\n\t// Temporarily pass list of hardcoded env vars for shell env api\n\tconst scopedDownShellEnvs = ['PATH', 'VIRTUAL_ENV', 'HOME', 'SHELL', 'PWD'];\n\tif (shellLaunchConfig.shellIntegrationEnvironmentReporting) {\n\t\tif (isWindows) {\n\t\t\tconst enableWindowsEnvReporting = options.windowsUseConptyDll || options.windowsEnableConpty && getWindowsBuildNumber() >= 22631 && shell !== 'bash.exe';\n\t\t\tif (enableWindowsEnvReporting) {\n\t\t\t\tenvMixin['VSCODE_SHELL_ENV_REPORTING'] = scopedDownShellEnvs.join(',');\n\t\t\t}\n\t\t} else {\n\t\t\tenvMixin['VSCODE_SHELL_ENV_REPORTING'] = scopedDownShellEnvs.join(',');\n\t\t}\n\t}\n\t// Windows\n\tif (isWindows) {\n\t\tif (shell === 'pwsh.exe' || shell === 'powershell.exe') {\n\t\t\tif (!originalArgs || arePwshImpliedArgs(originalArgs)) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.WindowsPwsh);\n\t\t\t} else if (arePwshLoginArgs(originalArgs)) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.WindowsPwshLogin);\n\t\t\t}\n\t\t\tif (!newArgs) {\n\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedArgs };\n\t\t\t}\n\t\t\tnewArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array\n\t\t\tnewArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot, '');\n\t\t\tenvMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0';\n\t\t\tif (options.shellIntegration.suggestEnabled) {\n\t\t\t\tenvMixin['VSCODE_SUGGEST'] = '1';\n\t\t\t}\n\t\t\treturn { type, newArgs, envMixin };\n\t\t} else if (shell === 'bash.exe') {\n\t\t\tif (!originalArgs || originalArgs.length === 0) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.Bash);\n\t\t\t} else if (areZshBashFishLoginArgs(originalArgs)) {\n\t\t\t\tenvMixin['VSCODE_SHELL_LOGIN'] = '1';\n\t\t\t\taddEnvMixinPathPrefix(options, envMixin, shell);\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.Bash);\n\t\t\t}\n\t\t\tif (!newArgs) {\n\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedArgs };\n\t\t\t}\n\t\t\tnewArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array\n\t\t\tnewArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot);\n\t\t\tenvMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0';\n\t\t\treturn { type, newArgs, envMixin };\n\t\t}\n\t\tlogService.warn(`Shell integration cannot be enabled for executable \"${shellLaunchConfig.executable}\" and args`, shellLaunchConfig.args);\n\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedShell };\n\t}\n\n\t// Linux & macOS\n\tswitch (shell) {\n\t\tcase 'bash': {\n\t\t\tif (!originalArgs || originalArgs.length === 0) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.Bash);\n\t\t\t} else if (areZshBashFishLoginArgs(originalArgs)) {\n\t\t\t\tenvMixin['VSCODE_SHELL_LOGIN'] = '1';\n\t\t\t\taddEnvMixinPathPrefix(options, envMixin, shell);\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.Bash);\n\t\t\t}\n\t\t\tif (!newArgs) {\n\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedArgs };\n\t\t\t}\n\t\t\tnewArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array\n\t\t\tnewArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot);\n\t\t\tenvMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0';\n\t\t\treturn { type, newArgs, envMixin };\n\t\t}\n\t\tcase 'fish': {\n\t\t\tif (!originalArgs || originalArgs.length === 0) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.Fish);\n\t\t\t} else if (areZshBashFishLoginArgs(originalArgs)) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.FishLogin);\n\t\t\t} else if (originalArgs === shellIntegrationArgs.get(ShellIntegrationExecutable.Fish) || originalArgs === shellIntegrationArgs.get(ShellIntegrationExecutable.FishLogin)) {\n\t\t\t\tnewArgs = originalArgs;\n\t\t\t}\n\t\t\tif (!newArgs) {\n\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedArgs };\n\t\t\t}\n\n\t\t\t// On fish, '$fish_user_paths' is always prepended to the PATH, for both login and non-login shells, so we need\n\t\t\t// to apply the path prefix fix always, not only for login shells (see #232291)\n\t\t\taddEnvMixinPathPrefix(options, envMixin, shell);\n\n\t\t\tnewArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array\n\t\t\tnewArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot);\n\t\t\treturn { type, newArgs, envMixin };\n\t\t}\n\t\tcase 'pwsh': {\n\t\t\tif (!originalArgs || arePwshImpliedArgs(originalArgs)) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.Pwsh);\n\t\t\t} else if (arePwshLoginArgs(originalArgs)) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.PwshLogin);\n\t\t\t}\n\t\t\tif (!newArgs) {\n\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedArgs };\n\t\t\t}\n\t\t\tif (options.shellIntegration.suggestEnabled) {\n\t\t\t\tenvMixin['VSCODE_SUGGEST'] = '1';\n\t\t\t}\n\t\t\tnewArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array\n\t\t\tnewArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot, '');\n\t\t\tenvMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0';\n\t\t\treturn { type, newArgs, envMixin };\n\t\t}\n\t\tcase 'zsh': {\n\t\t\tif (!originalArgs || originalArgs.length === 0) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.Zsh);\n\t\t\t} else if (areZshBashFishLoginArgs(originalArgs)) {\n\t\t\t\tnewArgs = shellIntegrationArgs.get(ShellIntegrationExecutable.ZshLogin);\n\t\t\t\taddEnvMixinPathPrefix(options, envMixin, shell);\n\t\t\t} else if (originalArgs === shellIntegrationArgs.get(ShellIntegrationExecutable.Zsh) || originalArgs === shellIntegrationArgs.get(ShellIntegrationExecutable.ZshLogin)) {\n\t\t\t\tnewArgs = originalArgs;\n\t\t\t}\n\t\t\tif (!newArgs) {\n\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedArgs };\n\t\t\t}\n\t\t\tnewArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array\n\t\t\tnewArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot);\n\n\t\t\t// Move .zshrc into $ZDOTDIR as the way to activate the script\n\t\t\tlet username: string;\n\t\t\ttry {\n\t\t\t\tusername = os.userInfo().username;\n\t\t\t} catch {\n\t\t\t\tusername = 'unknown';\n\t\t\t}\n\n\t\t\t// Resolve the actual tmp directory so we can set the sticky bit\n\t\t\tconst realTmpDir = realpathSync(os.tmpdir());\n\t\t\tconst zdotdir = path.join(realTmpDir, `${username}-${productService.applicationName}-zsh`);\n\n\t\t\t// Set directory permissions using octal notation:\n\t\t\t// - 0o1700:\n\t\t\t// - Sticky bit is set, preventing non-owners from deleting or renaming files within this directory (1)\n\t\t\t// - Owner has full read (4), write (2), execute (1) permissions\n\t\t\t// - Group has no permissions (0)\n\t\t\t// - Others have no permissions (0)\n\t\t\tif (!skipStickyBit) {\n\t\t\t\t// skip for tests\n\t\t\t\ttry {\n\t\t\t\t\tconst chmodAsync = promisify(chmod);\n\t\t\t\t\tawait chmodAsync(zdotdir, 0o1700);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tif (err.message.includes('ENOENT')) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tmkdirSync(zdotdir);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tlogService.error(`Failed to create zdotdir at ${zdotdir}: ${err}`);\n\t\t\t\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.FailedToCreateTmpDir };\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst chmodAsync = promisify(chmod);\n\t\t\t\t\t\t\tawait chmodAsync(zdotdir, 0o1700);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tlogService.error(`Failed to set sticky bit on ${zdotdir}: ${err}`);\n\t\t\t\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.FailedToSetStickyBit };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlogService.error(`Failed to set sticky bit on ${zdotdir}: ${err}`);\n\t\t\t\t\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.FailedToSetStickyBit };\n\t\t\t\t}\n\t\t\t}\n\t\t\tenvMixin['ZDOTDIR'] = zdotdir;\n\t\t\tconst userZdotdir = env?.ZDOTDIR ?? os.homedir() ?? `~`;\n\t\t\tenvMixin['USER_ZDOTDIR'] = userZdotdir;\n\t\t\tconst filesToCopy: IShellIntegrationConfigInjection['filesToCopy'] = [];\n\t\t\tfilesToCopy.push({\n\t\t\t\tsource: path.join(appRoot, 'out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-rc.zsh'),\n\t\t\t\tdest: path.join(zdotdir, '.zshrc')\n\t\t\t});\n\t\t\tfilesToCopy.push({\n\t\t\t\tsource: path.join(appRoot, 'out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-profile.zsh'),\n\t\t\t\tdest: path.join(zdotdir, '.zprofile')\n\t\t\t});\n\t\t\tfilesToCopy.push({\n\t\t\t\tsource: path.join(appRoot, 'out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-env.zsh'),\n\t\t\t\tdest: path.join(zdotdir, '.zshenv')\n\t\t\t});\n\t\t\tfilesToCopy.push({\n\t\t\t\tsource: path.join(appRoot, 'out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-login.zsh'),\n\t\t\t\tdest: path.join(zdotdir, '.zlogin')\n\t\t\t});\n\t\t\treturn { type, newArgs, envMixin, filesToCopy };\n\t\t}\n\t}\n\tlogService.warn(`Shell integration cannot be enabled for executable \"${shellLaunchConfig.executable}\" and args`, shellLaunchConfig.args);\n\treturn { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedShell };\n}\n\n/**\n * There are a few situations where some directories are added to the beginning of the PATH.\n * 1. On macOS when the profile calls path_helper.\n * 2. For fish terminals, which always prepend \"$fish_user_paths\" to the PATH.\n *\n * This causes significant problems for the environment variable\n * collection API as the custom paths added to the end will now be somewhere in the middle of\n * the PATH. To combat this, VSCODE_PATH_PREFIX is used to re-apply any prefix after the profile\n * has run. This will cause duplication in the PATH but should fix the issue.\n *\n * See #99878 for more information.\n */\nfunction addEnvMixinPathPrefix(options: ITerminalProcessOptions, envMixin: IProcessEnvironment, shell: string): void {\n\tif ((isMacintosh || shell === 'fish') && options.environmentVariableCollections) {\n\t\t// Deserialize and merge\n\t\tconst deserialized = deserializeEnvironmentVariableCollections(options.environmentVariableCollections);\n\t\tconst merged = new MergedEnvironmentVariableCollection(deserialized);\n\n\t\t// Get all prepend PATH entries\n\t\tconst pathEntry = merged.getVariableMap({ workspaceFolder: options.workspaceFolder }).get('PATH');\n\t\tconst prependToPath: string[] = [];\n\t\tif (pathEntry) {\n\t\t\tfor (const mutator of pathEntry) {\n\t\t\t\tif (mutator.type === EnvironmentVariableMutatorType.Prepend) {\n\t\t\t\t\tprependToPath.push(mutator.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add to the environment mixin to be applied in the shell integration script\n\t\tif (prependToPath.length > 0) {\n\t\t\tenvMixin['VSCODE_PATH_PREFIX'] = prependToPath.join('');\n\t\t}\n\t}\n}\n\nenum ShellIntegrationExecutable {\n\tWindowsPwsh = 'windows-pwsh',\n\tWindowsPwshLogin = 'windows-pwsh-login',\n\tPwsh = 'pwsh',\n\tPwshLogin = 'pwsh-login',\n\tZsh = 'zsh',\n\tZshLogin = 'zsh-login',\n\tBash = 'bash',\n\tFish = 'fish',\n\tFishLogin = 'fish-login',\n}\n\nconst shellIntegrationArgs: Map<ShellIntegrationExecutable, string[]> = new Map();\n// The try catch swallows execution policy errors in the case of the archive distributable\nshellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ['-noexit', '-command', 'try { . \\\"{0}\\\\out\\\\vs\\\\workbench\\\\contrib\\\\terminal\\\\common\\\\scripts\\\\shellIntegration.ps1\\\" } catch {}{1}']);\nshellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ['-l', '-noexit', '-command', 'try { . \\\"{0}\\\\out\\\\vs\\\\workbench\\\\contrib\\\\terminal\\\\common\\\\scripts\\\\shellIntegration.ps1\\\" } catch {}{1}']);\nshellIntegrationArgs.set(ShellIntegrationExecutable.Pwsh, ['-noexit', '-command', '. \"{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1\"{1}']);\nshellIntegrationArgs.set(ShellIntegrationExecutable.PwshLogin, ['-l', '-noexit', '-command', '. \"{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1\"']);\nshellIntegrationArgs.set(ShellIntegrationExecutable.Zsh, ['-i']);\nshellIntegrationArgs.set(ShellIntegrationExecutable.ZshLogin, ['-il']);\nshellIntegrationArgs.set(ShellIntegrationExecutable.Bash, ['--init-file', '{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh']);\nshellIntegrationArgs.set(ShellIntegrationExecutable.Fish, ['--init-command', 'source \"{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish\"']);\nshellIntegrationArgs.set(ShellIntegrationExecutable.FishLogin, ['-l', '--init-command', 'source \"{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish\"']);\nconst pwshLoginArgs = ['-login', '-l'];\nconst shLoginArgs = ['--login', '-l'];\nconst shInteractiveArgs = ['-i', '--interactive'];\nconst pwshImpliedArgs = ['-nol', '-nologo'];\n\nfunction arePwshLoginArgs(originalArgs: string | string[]): boolean {\n\tif (typeof originalArgs === 'string') {\n\t\treturn pwshLoginArgs.includes(originalArgs.toLowerCase());\n\t} else {\n\t\treturn originalArgs.length === 1 && pwshLoginArgs.includes(originalArgs[0].toLowerCase()) ||\n\t\t\t(originalArgs.length === 2 &&\n\t\t\t\t(((pwshLoginArgs.includes(originalArgs[0].toLowerCase())) || pwshLoginArgs.includes(originalArgs[1].toLowerCase())))\n\t\t\t\t&& ((pwshImpliedArgs.includes(originalArgs[0].toLowerCase())) || pwshImpliedArgs.includes(originalArgs[1].toLowerCase())));\n\t}\n}\n\nfunction arePwshImpliedArgs(originalArgs: string | string[]): boolean {\n\tif (typeof originalArgs === 'string') {\n\t\treturn pwshImpliedArgs.includes(originalArgs.toLowerCase());\n\t} else {\n\t\treturn originalArgs.length === 0 || originalArgs?.length === 1 && pwshImpliedArgs.includes(originalArgs[0].toLowerCase());\n\t}\n}\n\nfunction areZshBashFishLoginArgs(originalArgs: string | string[]): boolean {\n\tif (typeof originalArgs !== 'string') {\n\t\toriginalArgs = originalArgs.filter(arg => !shInteractiveArgs.includes(arg.toLowerCase()));\n\t}\n\treturn originalArgs === 'string' && shLoginArgs.includes(originalArgs.toLowerCase())\n\t\t|| typeof originalArgs !== 'string' && originalArgs.length === 1 && shLoginArgs.includes(originalArgs[0].toLowerCase());\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as fs from 'fs';\nimport * as cp from 'child_process';\nimport { Codicon } from '../../../base/common/codicons.js';\nimport { basename, delimiter, normalize, dirname, resolve } from '../../../base/common/path.js';\nimport { isLinux, isWindows } from '../../../base/common/platform.js';\nimport { findExecutable } from '../../../base/node/processes.js';\nimport { isString } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport * as pfs from '../../../base/node/pfs.js';\nimport { enumeratePowerShellInstallations } from '../../../base/node/powershell.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { ITerminalEnvironment, ITerminalExecutable, ITerminalProfile, ITerminalProfileSource, ITerminalUnsafePath, ProfileSource, TerminalIcon, TerminalSettingId } from '../common/terminal.js';\nimport { getWindowsBuildNumber } from './terminalEnvironment.js';\nimport { ThemeIcon } from '../../../base/common/themables.js';\n\nconst enum Constants {\n\tUnixShellsPath = '/etc/shells'\n}\n\nlet profileSources: Map<string, IPotentialTerminalProfile> | undefined;\nlet logIfWslNotInstalled: boolean = true;\n\nexport function detectAvailableProfiles(\n\tprofiles: unknown,\n\tdefaultProfile: unknown,\n\tincludeDetectedProfiles: boolean,\n\tconfigurationService: IConfigurationService,\n\tshellEnv: typeof process.env = process.env,\n\tfsProvider?: IFsProvider,\n\tlogService?: ILogService,\n\tvariableResolver?: (text: string[]) => Promise<string[]>,\n\ttestPwshSourcePaths?: string[]\n): Promise<ITerminalProfile[]> {\n\tfsProvider = fsProvider || {\n\t\texistsFile: pfs.SymlinkSupport.existsFile,\n\t\treadFile: fs.promises.readFile\n\t};\n\tif (isWindows) {\n\t\treturn detectAvailableWindowsProfiles(\n\t\t\tincludeDetectedProfiles,\n\t\t\tfsProvider,\n\t\t\tshellEnv,\n\t\t\tlogService,\n\t\t\tconfigurationService.getValue(TerminalSettingId.UseWslProfiles) !== false,\n\t\t\tprofiles && typeof profiles === 'object' ? { ...profiles } : configurationService.getValue<{ [key: string]: IUnresolvedTerminalProfile }>(TerminalSettingId.ProfilesWindows),\n\t\t\ttypeof defaultProfile === 'string' ? defaultProfile : configurationService.getValue<string>(TerminalSettingId.DefaultProfileWindows),\n\t\t\ttestPwshSourcePaths,\n\t\t\tvariableResolver\n\t\t);\n\t}\n\treturn detectAvailableUnixProfiles(\n\t\tfsProvider,\n\t\tlogService,\n\t\tincludeDetectedProfiles,\n\t\tprofiles && typeof profiles === 'object' ? { ...profiles } : configurationService.getValue<{ [key: string]: IUnresolvedTerminalProfile }>(isLinux ? TerminalSettingId.ProfilesLinux : TerminalSettingId.ProfilesMacOs),\n\t\ttypeof defaultProfile === 'string' ? defaultProfile : configurationService.getValue<string>(isLinux ? TerminalSettingId.DefaultProfileLinux : TerminalSettingId.DefaultProfileMacOs),\n\t\ttestPwshSourcePaths,\n\t\tvariableResolver,\n\t\tshellEnv\n\t);\n}\n\nasync function detectAvailableWindowsProfiles(\n\tincludeDetectedProfiles: boolean,\n\tfsProvider: IFsProvider,\n\tshellEnv: typeof process.env,\n\tlogService?: ILogService,\n\tuseWslProfiles?: boolean,\n\tconfigProfiles?: { [key: string]: IUnresolvedTerminalProfile },\n\tdefaultProfileName?: string,\n\ttestPwshSourcePaths?: string[],\n\tvariableResolver?: (text: string[]) => Promise<string[]>\n): Promise<ITerminalProfile[]> {\n\t// Determine the correct System32 path. We want to point to Sysnative\n\t// when the 32-bit version of VS Code is running on a 64-bit machine.\n\t// The reason for this is because PowerShell's important PSReadline\n\t// module doesn't work if this is not the case. See #27915.\n\tconst is32ProcessOn64Windows = process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432');\n\tconst system32Path = `${process.env['windir']}\\\\${is32ProcessOn64Windows ? 'Sysnative' : 'System32'}`;\n\n\tconst useWSLexe = getWindowsBuildNumber() >= 22000;\n\n\tawait initializeWindowsProfiles(testPwshSourcePaths);\n\n\tconst detectedProfiles: Map<string, IUnresolvedTerminalProfile> = new Map();\n\n\t// Add auto detected profiles\n\tif (includeDetectedProfiles) {\n\t\tdetectedProfiles.set('PowerShell', {\n\t\t\tsource: ProfileSource.Pwsh,\n\t\t\ticon: Codicon.terminalPowershell,\n\t\t\tisAutoDetected: true\n\t\t});\n\t\tdetectedProfiles.set('Windows PowerShell', {\n\t\t\tpath: `${system32Path}\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`,\n\t\t\ticon: Codicon.terminalPowershell,\n\t\t\tisAutoDetected: true\n\t\t});\n\t\tdetectedProfiles.set('Git Bash', {\n\t\t\tsource: ProfileSource.GitBash,\n\t\t\tisAutoDetected: true\n\t\t});\n\t\tdetectedProfiles.set('Command Prompt', {\n\t\t\tpath: `${system32Path}\\\\cmd.exe`,\n\t\t\ticon: Codicon.terminalCmd,\n\t\t\tisAutoDetected: true\n\t\t});\n\t\tdetectedProfiles.set('Cygwin', {\n\t\t\tpath: [\n\t\t\t\t{ path: `${process.env['HOMEDRIVE']}\\\\cygwin64\\\\bin\\\\bash.exe`, isUnsafe: true },\n\t\t\t\t{ path: `${process.env['HOMEDRIVE']}\\\\cygwin\\\\bin\\\\bash.exe`, isUnsafe: true }\n\t\t\t],\n\t\t\targs: ['--login'],\n\t\t\tisAutoDetected: true\n\t\t});\n\t\tdetectedProfiles.set('bash (MSYS2)', {\n\t\t\tpath: [\n\t\t\t\t{ path: `${process.env['HOMEDRIVE']}\\\\msys64\\\\usr\\\\bin\\\\bash.exe`, isUnsafe: true },\n\t\t\t],\n\t\t\targs: ['--login', '-i'],\n\t\t\t// CHERE_INVOKING retains current working directory\n\t\t\tenv: { CHERE_INVOKING: '1' },\n\t\t\ticon: Codicon.terminalBash,\n\t\t\tisAutoDetected: true\n\t\t});\n\t\tconst cmderPath = `${process.env['CMDER_ROOT'] || `${process.env['HOMEDRIVE']}\\\\cmder`}\\\\vendor\\\\bin\\\\vscode_init.cmd`;\n\t\tdetectedProfiles.set('Cmder', {\n\t\t\tpath: `${system32Path}\\\\cmd.exe`,\n\t\t\targs: ['/K', cmderPath],\n\t\t\t// The path is safe if it was derived from CMDER_ROOT\n\t\t\trequiresPath: process.env['CMDER_ROOT'] ? cmderPath : { path: cmderPath, isUnsafe: true },\n\t\t\tisAutoDetected: true\n\t\t});\n\t}\n\n\tapplyConfigProfilesToMap(configProfiles, detectedProfiles);\n\n\tconst resultProfiles: ITerminalProfile[] = await transformToTerminalProfiles(detectedProfiles.entries(), defaultProfileName, fsProvider, shellEnv, logService, variableResolver);\n\n\tif (includeDetectedProfiles && useWslProfiles) {\n\t\ttry {\n\t\t\tconst result = await getWslProfiles(`${system32Path}\\\\${useWSLexe ? 'wsl' : 'bash'}.exe`, defaultProfileName);\n\t\t\tfor (const wslProfile of result) {\n\t\t\t\tif (!configProfiles || !(wslProfile.profileName in configProfiles)) {\n\t\t\t\t\tresultProfiles.push(wslProfile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (logIfWslNotInstalled) {\n\t\t\t\tlogService?.trace('WSL is not installed, so could not detect WSL profiles');\n\t\t\t\tlogIfWslNotInstalled = false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resultProfiles;\n}\n\nasync function transformToTerminalProfiles(\n\tentries: IterableIterator<[string, IUnresolvedTerminalProfile]>,\n\tdefaultProfileName: string | undefined,\n\tfsProvider: IFsProvider,\n\tshellEnv: typeof process.env = process.env,\n\tlogService?: ILogService,\n\tvariableResolver?: (text: string[]) => Promise<string[]>,\n): Promise<ITerminalProfile[]> {\n\tconst promises: Promise<ITerminalProfile | undefined>[] = [];\n\tfor (const [profileName, profile] of entries) {\n\t\tpromises.push(getValidatedProfile(profileName, profile, defaultProfileName, fsProvider, shellEnv, logService, variableResolver));\n\t}\n\treturn (await Promise.all(promises)).filter(e => !!e) as ITerminalProfile[];\n}\n\nasync function getValidatedProfile(\n\tprofileName: string,\n\tprofile: IUnresolvedTerminalProfile,\n\tdefaultProfileName: string | undefined,\n\tfsProvider: IFsProvider,\n\tshellEnv: typeof process.env = process.env,\n\tlogService?: ILogService,\n\tvariableResolver?: (text: string[]) => Promise<string[]>\n): Promise<ITerminalProfile | undefined> {\n\tif (profile === null) {\n\t\treturn undefined;\n\t}\n\tlet originalPaths: (string | ITerminalUnsafePath)[];\n\tlet args: string[] | string | undefined;\n\tlet icon: ThemeIcon | URI | { light: URI; dark: URI } | undefined = undefined;\n\t// use calculated values if path is not specified\n\tif ('source' in profile && !('path' in profile)) {\n\t\tconst source = profileSources?.get(profile.source);\n\t\tif (!source) {\n\t\t\treturn undefined;\n\t\t}\n\t\toriginalPaths = source.paths;\n\n\t\t// if there are configured args, override the default ones\n\t\targs = profile.args || source.args;\n\t\tif (profile.icon) {\n\t\t\ticon = validateIcon(profile.icon);\n\t\t} else if (source.icon) {\n\t\t\ticon = source.icon;\n\t\t}\n\t} else {\n\t\toriginalPaths = Array.isArray(profile.path) ? profile.path : [profile.path];\n\t\targs = isWindows ? profile.args : Array.isArray(profile.args) ? profile.args : undefined;\n\t\ticon = validateIcon(profile.icon);\n\t}\n\n\tlet paths: (string | ITerminalUnsafePath)[];\n\tif (variableResolver) {\n\t\t// Convert to string[] for resolve\n\t\tconst mapped = originalPaths.map(e => typeof e === 'string' ? e : e.path);\n\n\t\tconst resolved = await variableResolver(mapped);\n\t\t// Convert resolved back to (T | string)[]\n\t\tpaths = new Array(originalPaths.length);\n\t\tfor (let i = 0; i < originalPaths.length; i++) {\n\t\t\tif (typeof originalPaths[i] === 'string') {\n\t\t\t\tpaths[i] = resolved[i];\n\t\t\t} else {\n\t\t\t\tpaths[i] = {\n\t\t\t\t\tpath: resolved[i],\n\t\t\t\t\tisUnsafe: true\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t} else {\n\t\tpaths = originalPaths.slice();\n\t}\n\n\tlet requiresUnsafePath: string | undefined;\n\tif (profile.requiresPath) {\n\t\t// Validate requiresPath exists\n\t\tlet actualRequiredPath: string;\n\t\tif (isString(profile.requiresPath)) {\n\t\t\tactualRequiredPath = profile.requiresPath;\n\t\t} else {\n\t\t\tactualRequiredPath = profile.requiresPath.path;\n\t\t\tif (profile.requiresPath.isUnsafe) {\n\t\t\t\trequiresUnsafePath = actualRequiredPath;\n\t\t\t}\n\t\t}\n\t\tconst result = await fsProvider.existsFile(actualRequiredPath);\n\t\tif (!result) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst validatedProfile = await validateProfilePaths(profileName, defaultProfileName, paths, fsProvider, shellEnv, args, profile.env, profile.overrideName, profile.isAutoDetected, requiresUnsafePath);\n\tif (!validatedProfile) {\n\t\tlogService?.debug('Terminal profile not validated', profileName, originalPaths);\n\t\treturn undefined;\n\t}\n\n\tvalidatedProfile.isAutoDetected = profile.isAutoDetected;\n\tvalidatedProfile.icon = icon;\n\tvalidatedProfile.color = profile.color;\n\treturn validatedProfile;\n}\n\nfunction validateIcon(icon: string | TerminalIcon | undefined): TerminalIcon | undefined {\n\tif (typeof icon === 'string') {\n\t\treturn { id: icon };\n\t}\n\treturn icon;\n}\n\nasync function initializeWindowsProfiles(testPwshSourcePaths?: string[]): Promise<void> {\n\tif (profileSources && !testPwshSourcePaths) {\n\t\treturn;\n\t}\n\n\tconst [gitBashPaths, pwshPaths] = await Promise.all([getGitBashPaths(), testPwshSourcePaths || getPowershellPaths()]);\n\n\tprofileSources = new Map();\n\tprofileSources.set(\n\t\tProfileSource.GitBash, {\n\t\tprofileName: 'Git Bash',\n\t\tpaths: gitBashPaths,\n\t\targs: ['--login', '-i']\n\t});\n\tprofileSources.set(ProfileSource.Pwsh, {\n\t\tprofileName: 'PowerShell',\n\t\tpaths: pwshPaths,\n\t\ticon: Codicon.terminalPowershell\n\t});\n}\n\nasync function getGitBashPaths(): Promise<string[]> {\n\tconst gitDirs: Set<string> = new Set();\n\n\t// Look for git.exe on the PATH and use that if found. git.exe is located at\n\t// `<installdir>/cmd/git.exe`. This is not an unsafe location because the git executable is\n\t// located on the PATH which is only controlled by the user/admin.\n\tconst gitExePath = await findExecutable('git.exe');\n\tif (gitExePath) {\n\t\tconst gitExeDir = dirname(gitExePath);\n\t\tgitDirs.add(resolve(gitExeDir, '../..'));\n\t}\n\tfunction addTruthy<T>(set: Set<T>, value: T | undefined): void {\n\t\tif (value) {\n\t\t\tset.add(value);\n\t\t}\n\t}\n\n\t// Add common git install locations\n\taddTruthy(gitDirs, process.env['ProgramW6432']);\n\taddTruthy(gitDirs, process.env['ProgramFiles']);\n\taddTruthy(gitDirs, process.env['ProgramFiles(X86)']);\n\taddTruthy(gitDirs, `${process.env['LocalAppData']}\\\\Program`);\n\n\tconst gitBashPaths: string[] = [];\n\tfor (const gitDir of gitDirs) {\n\t\tgitBashPaths.push(\n\t\t\t`${gitDir}\\\\Git\\\\bin\\\\bash.exe`,\n\t\t\t`${gitDir}\\\\Git\\\\usr\\\\bin\\\\bash.exe`,\n\t\t\t`${gitDir}\\\\usr\\\\bin\\\\bash.exe` // using Git for Windows SDK\n\t\t);\n\t}\n\n\t// Add special installs that don't follow the standard directory structure\n\tgitBashPaths.push(`${process.env['UserProfile']}\\\\scoop\\\\apps\\\\git\\\\current\\\\bin\\\\bash.exe`);\n\tgitBashPaths.push(`${process.env['UserProfile']}\\\\scoop\\\\apps\\\\git-with-openssh\\\\current\\\\bin\\\\bash.exe`);\n\n\treturn gitBashPaths;\n}\n\nasync function getPowershellPaths(): Promise<string[]> {\n\tconst paths: string[] = [];\n\t// Add all of the different kinds of PowerShells\n\tfor await (const pwshExe of enumeratePowerShellInstallations()) {\n\t\tpaths.push(pwshExe.exePath);\n\t}\n\treturn paths;\n}\n\nasync function getWslProfiles(wslPath: string, defaultProfileName: string | undefined): Promise<ITerminalProfile[]> {\n\tconst profiles: ITerminalProfile[] = [];\n\tconst distroOutput = await new Promise<string>((resolve, reject) => {\n\t\t// wsl.exe output is encoded in utf16le (ie. A -> 0x4100)\n\t\tcp.exec('wsl.exe -l -q', { encoding: 'utf16le', timeout: 1000 }, (err, stdout) => {\n\t\t\tif (err) {\n\t\t\t\treturn reject('Problem occurred when getting wsl distros');\n\t\t\t}\n\t\t\tresolve(stdout);\n\t\t});\n\t});\n\tif (!distroOutput) {\n\t\treturn [];\n\t}\n\tconst regex = new RegExp(/[\\r?\\n]/);\n\tconst distroNames = distroOutput.split(regex).filter(t => t.trim().length > 0 && t !== '');\n\tfor (const distroName of distroNames) {\n\t\t// Skip empty lines\n\t\tif (distroName === '') {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// docker-desktop and docker-desktop-data are treated as implementation details of\n\t\t// Docker Desktop for Windows and therefore not exposed\n\t\tif (distroName.startsWith('docker-desktop')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Create the profile, adding the icon depending on the distro\n\t\tconst profileName = `${distroName} (WSL)`;\n\t\tconst profile: ITerminalProfile = {\n\t\t\tprofileName,\n\t\t\tpath: wslPath,\n\t\t\targs: [`-d`, `${distroName}`],\n\t\t\tisDefault: profileName === defaultProfileName,\n\t\t\ticon: getWslIcon(distroName),\n\t\t\tisAutoDetected: false\n\t\t};\n\t\t// Add the profile\n\t\tprofiles.push(profile);\n\t}\n\treturn profiles;\n}\n\nfunction getWslIcon(distroName: string): ThemeIcon {\n\tif (distroName.includes('Ubuntu')) {\n\t\treturn Codicon.terminalUbuntu;\n\t} else if (distroName.includes('Debian')) {\n\t\treturn Codicon.terminalDebian;\n\t} else {\n\t\treturn Codicon.terminalLinux;\n\t}\n}\n\nasync function detectAvailableUnixProfiles(\n\tfsProvider: IFsProvider,\n\tlogService?: ILogService,\n\tincludeDetectedProfiles?: boolean,\n\tconfigProfiles?: { [key: string]: IUnresolvedTerminalProfile },\n\tdefaultProfileName?: string,\n\ttestPaths?: string[],\n\tvariableResolver?: (text: string[]) => Promise<string[]>,\n\tshellEnv?: typeof process.env\n): Promise<ITerminalProfile[]> {\n\tconst detectedProfiles: Map<string, IUnresolvedTerminalProfile> = new Map();\n\n\t// Add non-quick launch profiles\n\tif (includeDetectedProfiles && await fsProvider.existsFile(Constants.UnixShellsPath)) {\n\t\tconst contents = (await fsProvider.readFile(Constants.UnixShellsPath)).toString();\n\t\tconst profiles = (\n\t\t\t(testPaths || contents.split('\\n'))\n\t\t\t\t.map(e => {\n\t\t\t\t\tconst index = e.indexOf('#');\n\t\t\t\t\treturn index === -1 ? e : e.substring(0, index);\n\t\t\t\t})\n\t\t\t\t.filter(e => e.trim().length > 0)\n\t\t);\n\t\tconst counts: Map<string, number> = new Map();\n\t\tfor (const profile of profiles) {\n\t\t\tlet profileName = basename(profile);\n\t\t\tlet count = counts.get(profileName) || 0;\n\t\t\tcount++;\n\t\t\tif (count > 1) {\n\t\t\t\tprofileName = `${profileName} (${count})`;\n\t\t\t}\n\t\t\tcounts.set(profileName, count);\n\t\t\tdetectedProfiles.set(profileName, { path: profile, isAutoDetected: true });\n\t\t}\n\t}\n\n\tapplyConfigProfilesToMap(configProfiles, detectedProfiles);\n\n\treturn await transformToTerminalProfiles(detectedProfiles.entries(), defaultProfileName, fsProvider, shellEnv, logService, variableResolver);\n}\n\nfunction applyConfigProfilesToMap(configProfiles: { [key: string]: IUnresolvedTerminalProfile } | undefined, profilesMap: Map<string, IUnresolvedTerminalProfile>) {\n\tif (!configProfiles) {\n\t\treturn;\n\t}\n\tfor (const [profileName, value] of Object.entries(configProfiles)) {\n\t\tif (value === null || typeof value !== 'object' || (!('path' in value) && !('source' in value))) {\n\t\t\tprofilesMap.delete(profileName);\n\t\t} else {\n\t\t\tvalue.icon = value.icon || profilesMap.get(profileName)?.icon;\n\t\t\tprofilesMap.set(profileName, value);\n\t\t}\n\t}\n}\n\nasync function validateProfilePaths(profileName: string, defaultProfileName: string | undefined, potentialPaths: (string | ITerminalUnsafePath)[], fsProvider: IFsProvider, shellEnv: typeof process.env, args?: string[] | string, env?: ITerminalEnvironment, overrideName?: boolean, isAutoDetected?: boolean, requiresUnsafePath?: string): Promise<ITerminalProfile | undefined> {\n\tif (potentialPaths.length === 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\tconst path = potentialPaths.shift()!;\n\tif (path === '') {\n\t\treturn validateProfilePaths(profileName, defaultProfileName, potentialPaths, fsProvider, shellEnv, args, env, overrideName, isAutoDetected);\n\t}\n\tconst isUnsafePath = typeof path !== 'string' && path.isUnsafe;\n\tconst actualPath = typeof path === 'string' ? path : path.path;\n\n\tconst profile: ITerminalProfile = {\n\t\tprofileName,\n\t\tpath: actualPath,\n\t\targs,\n\t\tenv,\n\t\toverrideName,\n\t\tisAutoDetected,\n\t\tisDefault: profileName === defaultProfileName,\n\t\tisUnsafePath,\n\t\trequiresUnsafePath\n\t};\n\n\t// For non-absolute paths, check if it's available on $PATH\n\tif (basename(actualPath) === actualPath) {\n\t\t// The executable isn't an absolute path, try find it on the PATH\n\t\tconst envPaths: string[] | undefined = shellEnv.PATH ? shellEnv.PATH.split(delimiter) : undefined;\n\t\tconst executable = await findExecutable(actualPath, undefined, envPaths, undefined, fsProvider.existsFile);\n\t\tif (!executable) {\n\t\t\treturn validateProfilePaths(profileName, defaultProfileName, potentialPaths, fsProvider, shellEnv, args);\n\t\t}\n\t\tprofile.path = executable;\n\t\tprofile.isFromPath = true;\n\t\treturn profile;\n\t}\n\n\tconst result = await fsProvider.existsFile(normalize(actualPath));\n\tif (result) {\n\t\treturn profile;\n\t}\n\n\treturn validateProfilePaths(profileName, defaultProfileName, potentialPaths, fsProvider, shellEnv, args, env, overrideName, isAutoDetected);\n}\n\nexport interface IFsProvider {\n\texistsFile(path: string): Promise<boolean>;\n\treadFile(path: string): Promise<Buffer>;\n}\n\ninterface IPotentialTerminalProfile {\n\tprofileName: string;\n\tpaths: string[];\n\targs?: string[];\n\ticon?: ThemeIcon | URI | { light: URI; dark: URI };\n}\n\nexport type IUnresolvedTerminalProfile = ITerminalExecutable | ITerminalProfileSource | null;\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { IProcessEnvironment, OS, OperatingSystem, isWindows } from '../../../base/common/platform.js';\nimport { ProxyChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { ILogService, ILoggerService, LogLevel } from '../../log/common/log.js';\nimport { RemoteLoggerChannelClient } from '../../log/common/logIpc.js';\nimport { getResolvedShellEnv } from '../../shell/node/shellEnv.js';\nimport { IPtyHostProcessReplayEvent } from '../common/capabilities/capabilities.js';\nimport { RequestStore } from '../common/requestStore.js';\nimport { HeartbeatConstants, IHeartbeatService, IProcessDataEvent, IProcessProperty, IProcessPropertyMap, IProcessReadyEvent, IPtyHostLatencyMeasurement, IPtyHostService, IPtyService, IRequestResolveVariablesEvent, ISerializedTerminalState, IShellLaunchConfig, ITerminalLaunchError, ITerminalProcessOptions, ITerminalProfile, ITerminalsLayoutInfo, ProcessPropertyType, TerminalIcon, TerminalIpcChannels, TerminalSettingId, TitleEventSource } from '../common/terminal.js';\nimport { registerTerminalPlatformConfiguration } from '../common/terminalPlatformConfiguration.js';\nimport { IGetTerminalLayoutInfoArgs, IProcessDetails, ISetTerminalLayoutInfoArgs } from '../common/terminalProcess.js';\nimport { IPtyHostConnection, IPtyHostStarter } from './ptyHost.js';\nimport { detectAvailableProfiles } from './terminalProfiles.js';\nimport * as performance from '../../../base/common/performance.js';\nimport { getSystemShell } from '../../../base/node/shell.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\n\nenum Constants {\n\tMaxRestarts = 5\n}\n\n/**\n * This service implements IPtyService by launching a pty host process, forwarding messages to and\n * from the pty host process and manages the connection.\n */\nexport class PtyHostService extends Disposable implements IPtyHostService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate __connection?: IPtyHostConnection;\n\t// ProxyChannel is not used here because events get lost when forwarding across multiple proxies\n\tprivate __proxy?: IPtyService;\n\n\tprivate get _connection(): IPtyHostConnection {\n\t\tthis._ensurePtyHost();\n\t\treturn this.__connection!;\n\t}\n\tprivate get _proxy(): IPtyService {\n\t\tthis._ensurePtyHost();\n\t\treturn this.__proxy!;\n\t}\n\t/**\n\t * Get the proxy if it exists, otherwise undefined. This is used when calls are not needed to be\n\t * passed through to the pty host if it has not yet been spawned.\n\t */\n\tprivate get _optionalProxy(): IPtyService | undefined {\n\t\treturn this.__proxy;\n\t}\n\n\tprivate _ensurePtyHost() {\n\t\tif (!this.__connection) {\n\t\t\tthis._startPtyHost();\n\t\t}\n\t}\n\n\tprivate readonly _resolveVariablesRequestStore: RequestStore<string[], { workspaceId: string; originalText: string[] }>;\n\tprivate _wasQuitRequested = false;\n\tprivate _restartCount = 0;\n\tprivate _isResponsive = true;\n\tprivate _heartbeatFirstTimeout?: Timeout;\n\tprivate _heartbeatSecondTimeout?: Timeout;\n\n\tprivate readonly _onPtyHostExit = this._register(new Emitter<number>());\n\treadonly onPtyHostExit = this._onPtyHostExit.event;\n\tprivate readonly _onPtyHostStart = this._register(new Emitter<void>());\n\treadonly onPtyHostStart = this._onPtyHostStart.event;\n\tprivate readonly _onPtyHostUnresponsive = this._register(new Emitter<void>());\n\treadonly onPtyHostUnresponsive = this._onPtyHostUnresponsive.event;\n\tprivate readonly _onPtyHostResponsive = this._register(new Emitter<void>());\n\treadonly onPtyHostResponsive = this._onPtyHostResponsive.event;\n\tprivate readonly _onPtyHostRequestResolveVariables = this._register(new Emitter<IRequestResolveVariablesEvent>());\n\treadonly onPtyHostRequestResolveVariables = this._onPtyHostRequestResolveVariables.event;\n\n\tprivate readonly _onProcessData = this._register(new Emitter<{ id: number; event: IProcessDataEvent | string }>());\n\treadonly onProcessData = this._onProcessData.event;\n\tprivate readonly _onProcessReady = this._register(new Emitter<{ id: number; event: IProcessReadyEvent }>());\n\treadonly onProcessReady = this._onProcessReady.event;\n\tprivate readonly _onProcessReplay = this._register(new Emitter<{ id: number; event: IPtyHostProcessReplayEvent }>());\n\treadonly onProcessReplay = this._onProcessReplay.event;\n\tprivate readonly _onProcessOrphanQuestion = this._register(new Emitter<{ id: number }>());\n\treadonly onProcessOrphanQuestion = this._onProcessOrphanQuestion.event;\n\tprivate readonly _onDidRequestDetach = this._register(new Emitter<{ requestId: number; workspaceId: string; instanceId: number }>());\n\treadonly onDidRequestDetach = this._onDidRequestDetach.event;\n\tprivate readonly _onDidChangeProperty = this._register(new Emitter<{ id: number; property: IProcessProperty<any> }>());\n\treadonly onDidChangeProperty = this._onDidChangeProperty.event;\n\tprivate readonly _onProcessExit = this._register(new Emitter<{ id: number; event: number | undefined }>());\n\treadonly onProcessExit = this._onProcessExit.event;\n\n\tconstructor(\n\t\tprivate readonly _ptyHostStarter: IPtyHostStarter,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@ILoggerService private readonly _loggerService: ILoggerService,\n\t) {\n\t\tsuper();\n\n\t\t// Platform configuration is required on the process running the pty host (shared process or\n\t\t// remote server).\n\t\tregisterTerminalPlatformConfiguration();\n\n\t\tthis._register(this._ptyHostStarter);\n\t\tthis._register(toDisposable(() => this._disposePtyHost()));\n\n\t\tthis._resolveVariablesRequestStore = this._register(new RequestStore(undefined, this._logService));\n\t\tthis._register(this._resolveVariablesRequestStore.onCreateRequest(this._onPtyHostRequestResolveVariables.fire, this._onPtyHostRequestResolveVariables));\n\n\t\t// Start the pty host when a window requests a connection, if the starter has that capability.\n\t\tif (this._ptyHostStarter.onRequestConnection) {\n\t\t\tthis._register(Event.once(this._ptyHostStarter.onRequestConnection)(() => this._ensurePtyHost()));\n\t\t}\n\n\t\tif (this._ptyHostStarter.onWillShutdown) {\n\t\t\tthis._register(this._ptyHostStarter.onWillShutdown(() => this._wasQuitRequested = true));\n\t\t}\n\t}\n\n\tprivate get _ignoreProcessNames(): string[] {\n\t\treturn this._configurationService.getValue<string[]>(TerminalSettingId.IgnoreProcessNames);\n\t}\n\n\tprivate async _refreshIgnoreProcessNames(): Promise<void> {\n\t\treturn this._optionalProxy?.refreshIgnoreProcessNames?.(this._ignoreProcessNames);\n\t}\n\n\tprivate async _resolveShellEnv(): Promise<typeof process.env> {\n\t\tif (isWindows) {\n\t\t\treturn process.env;\n\t\t}\n\n\t\ttry {\n\t\t\treturn await getResolvedShellEnv(this._configurationService, this._logService, { _: [] }, process.env);\n\t\t} catch (error) {\n\t\t\tthis._logService.error('ptyHost was unable to resolve shell environment', error);\n\n\t\t\treturn {};\n\t\t}\n\t}\n\n\tprivate _startPtyHost(): [IPtyHostConnection, IPtyService] {\n\t\tconst connection = this._ptyHostStarter.start();\n\t\tconst client = connection.client;\n\n\t\t// Log a full stack trace which will tell the exact reason the pty host is starting up\n\t\tif (this._logService.getLevel() === LogLevel.Trace) {\n\t\t\tthis._logService.trace('PtyHostService#_startPtyHost', new Error().stack?.replace(/^Error/, ''));\n\t\t}\n\n\t\t// Setup heartbeat service and trigger a heartbeat immediately to reset the timeouts\n\t\tconst heartbeatService = ProxyChannel.toService<IHeartbeatService>(client.getChannel(TerminalIpcChannels.Heartbeat));\n\t\theartbeatService.onBeat(() => this._handleHeartbeat());\n\t\tthis._handleHeartbeat(true);\n\n\t\t// Handle exit\n\t\tthis._register(connection.onDidProcessExit(e => {\n\t\t\tthis._onPtyHostExit.fire(e.code);\n\t\t\tif (!this._wasQuitRequested && !this._store.isDisposed) {\n\t\t\t\tif (this._restartCount <= Constants.MaxRestarts) {\n\t\t\t\t\tthis._logService.error(`ptyHost terminated unexpectedly with code ${e.code}`);\n\t\t\t\t\tthis._restartCount++;\n\t\t\t\t\tthis.restartPtyHost();\n\t\t\t\t} else {\n\t\t\t\t\tthis._logService.error(`ptyHost terminated unexpectedly with code ${e.code}, giving up`);\n\t\t\t\t}\n\t\t\t}\n\t\t}));\n\n\t\t// Create proxy and forward events\n\t\tconst proxy = ProxyChannel.toService<IPtyService>(client.getChannel(TerminalIpcChannels.PtyHost));\n\t\tthis._register(proxy.onProcessData(e => this._onProcessData.fire(e)));\n\t\tthis._register(proxy.onProcessReady(e => this._onProcessReady.fire(e)));\n\t\tthis._register(proxy.onProcessExit(e => this._onProcessExit.fire(e)));\n\t\tthis._register(proxy.onDidChangeProperty(e => this._onDidChangeProperty.fire(e)));\n\t\tthis._register(proxy.onProcessReplay(e => this._onProcessReplay.fire(e)));\n\t\tthis._register(proxy.onProcessOrphanQuestion(e => this._onProcessOrphanQuestion.fire(e)));\n\t\tthis._register(proxy.onDidRequestDetach(e => this._onDidRequestDetach.fire(e)));\n\n\t\tthis._register(new RemoteLoggerChannelClient(this._loggerService, client.getChannel(TerminalIpcChannels.Logger)));\n\n\t\tthis.__connection = connection;\n\t\tthis.__proxy = proxy;\n\n\t\tthis._onPtyHostStart.fire();\n\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(async e => {\n\t\t\tif (e.affectsConfiguration(TerminalSettingId.IgnoreProcessNames)) {\n\t\t\t\tawait this._refreshIgnoreProcessNames();\n\t\t\t}\n\t\t}));\n\t\tthis._refreshIgnoreProcessNames();\n\n\t\treturn [connection, proxy];\n\t}\n\n\tasync createProcess(\n\t\tshellLaunchConfig: IShellLaunchConfig,\n\t\tcwd: string,\n\t\tcols: number,\n\t\trows: number,\n\t\tunicodeVersion: '6' | '11',\n\t\tenv: IProcessEnvironment,\n\t\texecutableEnv: IProcessEnvironment,\n\t\toptions: ITerminalProcessOptions,\n\t\tshouldPersist: boolean,\n\t\tworkspaceId: string,\n\t\tworkspaceName: string\n\t): Promise<number> {\n\t\tconst timeout = setTimeout(() => this._handleUnresponsiveCreateProcess(), HeartbeatConstants.CreateProcessTimeout);\n\t\tconst id = await this._proxy.createProcess(shellLaunchConfig, cwd, cols, rows, unicodeVersion, env, executableEnv, options, shouldPersist, workspaceId, workspaceName);\n\t\tclearTimeout(timeout);\n\t\treturn id;\n\t}\n\tupdateTitle(id: number, title: string, titleSource: TitleEventSource): Promise<void> {\n\t\treturn this._proxy.updateTitle(id, title, titleSource);\n\t}\n\tupdateIcon(id: number, userInitiated: boolean, icon: TerminalIcon, color?: string): Promise<void> {\n\t\treturn this._proxy.updateIcon(id, userInitiated, icon, color);\n\t}\n\tattachToProcess(id: number): Promise<void> {\n\t\treturn this._proxy.attachToProcess(id);\n\t}\n\tdetachFromProcess(id: number, forcePersist?: boolean): Promise<void> {\n\t\treturn this._proxy.detachFromProcess(id, forcePersist);\n\t}\n\tshutdownAll(): Promise<void> {\n\t\treturn this._proxy.shutdownAll();\n\t}\n\tlistProcesses(): Promise<IProcessDetails[]> {\n\t\treturn this._proxy.listProcesses();\n\t}\n\tasync getPerformanceMarks(): Promise<performance.PerformanceMark[]> {\n\t\treturn this._optionalProxy?.getPerformanceMarks() ?? [];\n\t}\n\tasync reduceConnectionGraceTime(): Promise<void> {\n\t\treturn this._optionalProxy?.reduceConnectionGraceTime();\n\t}\n\tstart(id: number): Promise<ITerminalLaunchError | { injectedArgs: string[] } | undefined> {\n\t\treturn this._proxy.start(id);\n\t}\n\tshutdown(id: number, immediate: boolean): Promise<void> {\n\t\treturn this._proxy.shutdown(id, immediate);\n\t}\n\tinput(id: number, data: string): Promise<void> {\n\t\treturn this._proxy.input(id, data);\n\t}\n\tsendSignal(id: number, signal: string): Promise<void> {\n\t\treturn this._proxy.sendSignal(id, signal);\n\t}\n\tprocessBinary(id: number, data: string): Promise<void> {\n\t\treturn this._proxy.processBinary(id, data);\n\t}\n\tresize(id: number, cols: number, rows: number): Promise<void> {\n\t\treturn this._proxy.resize(id, cols, rows);\n\t}\n\tclearBuffer(id: number): Promise<void> {\n\t\treturn this._proxy.clearBuffer(id);\n\t}\n\tacknowledgeDataEvent(id: number, charCount: number): Promise<void> {\n\t\treturn this._proxy.acknowledgeDataEvent(id, charCount);\n\t}\n\tsetUnicodeVersion(id: number, version: '6' | '11'): Promise<void> {\n\t\treturn this._proxy.setUnicodeVersion(id, version);\n\t}\n\tgetInitialCwd(id: number): Promise<string> {\n\t\treturn this._proxy.getInitialCwd(id);\n\t}\n\tgetCwd(id: number): Promise<string> {\n\t\treturn this._proxy.getCwd(id);\n\t}\n\tasync getLatency(): Promise<IPtyHostLatencyMeasurement[]> {\n\t\tconst sw = new StopWatch();\n\t\tconst results = await this._proxy.getLatency();\n\t\tsw.stop();\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: 'ptyhostservice<->ptyhost',\n\t\t\t\tlatency: sw.elapsed()\n\t\t\t},\n\t\t\t...results\n\t\t];\n\t}\n\torphanQuestionReply(id: number): Promise<void> {\n\t\treturn this._proxy.orphanQuestionReply(id);\n\t}\n\n\tinstallAutoReply(match: string, reply: string): Promise<void> {\n\t\treturn this._proxy.installAutoReply(match, reply);\n\t}\n\tuninstallAllAutoReplies(): Promise<void> {\n\t\treturn this._proxy.uninstallAllAutoReplies();\n\t}\n\n\tgetDefaultSystemShell(osOverride?: OperatingSystem): Promise<string> {\n\t\treturn this._optionalProxy?.getDefaultSystemShell(osOverride) ?? getSystemShell(osOverride ?? OS, process.env);\n\t}\n\tasync getProfiles(workspaceId: string, profiles: unknown, defaultProfile: unknown, includeDetectedProfiles: boolean = false): Promise<ITerminalProfile[]> {\n\t\tconst shellEnv = await this._resolveShellEnv();\n\t\treturn detectAvailableProfiles(profiles, defaultProfile, includeDetectedProfiles, this._configurationService, shellEnv, undefined, this._logService, this._resolveVariables.bind(this, workspaceId));\n\t}\n\tasync getEnvironment(): Promise<IProcessEnvironment> {\n\t\t// If the pty host is yet to be launched, just return the environment of this process as it\n\t\t// is essentially the same when used to evaluate terminal profiles.\n\t\tif (!this.__proxy) {\n\t\t\treturn { ...process.env };\n\t\t}\n\t\treturn this._proxy.getEnvironment();\n\t}\n\tgetWslPath(original: string, direction: 'unix-to-win' | 'win-to-unix'): Promise<string> {\n\t\treturn this._proxy.getWslPath(original, direction);\n\t}\n\n\tgetRevivedPtyNewId(workspaceId: string, id: number): Promise<number | undefined> {\n\t\treturn this._proxy.getRevivedPtyNewId(workspaceId, id);\n\t}\n\n\tsetTerminalLayoutInfo(args: ISetTerminalLayoutInfoArgs): Promise<void> {\n\t\treturn this._proxy.setTerminalLayoutInfo(args);\n\t}\n\tasync getTerminalLayoutInfo(args: IGetTerminalLayoutInfoArgs): Promise<ITerminalsLayoutInfo | undefined> {\n\t\t// This is optional as we want reconnect requests to go through only if the pty host exists.\n\t\t// Revive is handled specially as reviveTerminalProcesses is guaranteed to be called before\n\t\t// the request for layout info.\n\t\treturn this._optionalProxy?.getTerminalLayoutInfo(args);\n\t}\n\n\tasync requestDetachInstance(workspaceId: string, instanceId: number): Promise<IProcessDetails | undefined> {\n\t\treturn this._proxy.requestDetachInstance(workspaceId, instanceId);\n\t}\n\n\tasync acceptDetachInstanceReply(requestId: number, persistentProcessId: number): Promise<void> {\n\t\treturn this._proxy.acceptDetachInstanceReply(requestId, persistentProcessId);\n\t}\n\n\tasync freePortKillProcess(port: string): Promise<{ port: string; processId: string }> {\n\t\tif (!this._proxy.freePortKillProcess) {\n\t\t\tthrow new Error('freePortKillProcess does not exist on the pty proxy');\n\t\t}\n\t\treturn this._proxy.freePortKillProcess(port);\n\t}\n\n\tasync serializeTerminalState(ids: number[]): Promise<string> {\n\t\treturn this._proxy.serializeTerminalState(ids);\n\t}\n\n\tasync reviveTerminalProcesses(workspaceId: string, state: ISerializedTerminalState[], dateTimeFormatLocate: string) {\n\t\treturn this._proxy.reviveTerminalProcesses(workspaceId, state, dateTimeFormatLocate);\n\t}\n\n\tasync refreshProperty<T extends ProcessPropertyType>(id: number, property: T): Promise<IProcessPropertyMap[T]> {\n\t\treturn this._proxy.refreshProperty(id, property);\n\n\t}\n\tasync updateProperty<T extends ProcessPropertyType>(id: number, property: T, value: IProcessPropertyMap[T]): Promise<void> {\n\t\treturn this._proxy.updateProperty(id, property, value);\n\t}\n\n\tasync restartPtyHost(): Promise<void> {\n\t\tthis._disposePtyHost();\n\t\tthis._isResponsive = true;\n\t\tthis._startPtyHost();\n\t}\n\n\tprivate _disposePtyHost(): void {\n\t\tthis._proxy.shutdownAll();\n\t\tthis._connection.store.dispose();\n\t}\n\n\tprivate _handleHeartbeat(isConnecting?: boolean) {\n\t\tthis._clearHeartbeatTimeouts();\n\t\tthis._heartbeatFirstTimeout = setTimeout(() => this._handleHeartbeatFirstTimeout(), isConnecting ? HeartbeatConstants.ConnectingBeatInterval : (HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier));\n\t\tif (!this._isResponsive) {\n\t\t\tthis._isResponsive = true;\n\t\t\tthis._onPtyHostResponsive.fire();\n\t\t}\n\t}\n\n\tprivate _handleHeartbeatFirstTimeout() {\n\t\tthis._logService.warn(`No ptyHost heartbeat after ${HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier / 1000} seconds`);\n\t\tthis._heartbeatFirstTimeout = undefined;\n\t\tthis._heartbeatSecondTimeout = setTimeout(() => this._handleHeartbeatSecondTimeout(), HeartbeatConstants.BeatInterval * HeartbeatConstants.SecondWaitMultiplier);\n\t}\n\n\tprivate _handleHeartbeatSecondTimeout() {\n\t\tthis._logService.error(`No ptyHost heartbeat after ${(HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier + HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier) / 1000} seconds`);\n\t\tthis._heartbeatSecondTimeout = undefined;\n\t\tif (this._isResponsive) {\n\t\t\tthis._isResponsive = false;\n\t\t\tthis._onPtyHostUnresponsive.fire();\n\t\t}\n\t}\n\n\tprivate _handleUnresponsiveCreateProcess() {\n\t\tthis._clearHeartbeatTimeouts();\n\t\tthis._logService.error(`No ptyHost response to createProcess after ${HeartbeatConstants.CreateProcessTimeout / 1000} seconds`);\n\t\tif (this._isResponsive) {\n\t\t\tthis._isResponsive = false;\n\t\t\tthis._onPtyHostUnresponsive.fire();\n\t\t}\n\t}\n\n\tprivate _clearHeartbeatTimeouts() {\n\t\tif (this._heartbeatFirstTimeout) {\n\t\t\tclearTimeout(this._heartbeatFirstTimeout);\n\t\t\tthis._heartbeatFirstTimeout = undefined;\n\t\t}\n\t\tif (this._heartbeatSecondTimeout) {\n\t\t\tclearTimeout(this._heartbeatSecondTimeout);\n\t\t\tthis._heartbeatSecondTimeout = undefined;\n\t\t}\n\t}\n\n\tprivate _resolveVariables(workspaceId: string, text: string[]): Promise<string[]> {\n\t\treturn this._resolveVariablesRequestStore.createRequest({ workspaceId, originalText: text });\n\t}\n\tasync acceptPtyHostResolvedVariables(requestId: number, resolved: string[]) {\n\t\tthis._resolveVariablesRequestStore.acceptReply(requestId, resolved);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { UriParts, IRawURITransformer, URITransformer, IURITransformer } from '../../../base/common/uriIpc.js';\n\n/**\n * ```\n * --------------------------------\n * |    UI SIDE    |  AGENT SIDE  |\n * |---------------|--------------|\n * | vscode-remote | file         |\n * | file          | vscode-local |\n * --------------------------------\n * ```\n */\nfunction createRawURITransformer(remoteAuthority: string): IRawURITransformer {\n\treturn {\n\t\ttransformIncoming: (uri: UriParts): UriParts => {\n\t\t\tif (uri.scheme === 'vscode-remote') {\n\t\t\t\treturn { scheme: 'file', path: uri.path, query: uri.query, fragment: uri.fragment };\n\t\t\t}\n\t\t\tif (uri.scheme === 'file') {\n\t\t\t\treturn { scheme: 'vscode-local', path: uri.path, query: uri.query, fragment: uri.fragment };\n\t\t\t}\n\t\t\treturn uri;\n\t\t},\n\t\ttransformOutgoing: (uri: UriParts): UriParts => {\n\t\t\tif (uri.scheme === 'file') {\n\t\t\t\treturn { scheme: 'vscode-remote', authority: remoteAuthority, path: uri.path, query: uri.query, fragment: uri.fragment };\n\t\t\t}\n\t\t\tif (uri.scheme === 'vscode-local') {\n\t\t\t\treturn { scheme: 'file', path: uri.path, query: uri.query, fragment: uri.fragment };\n\t\t\t}\n\t\t\treturn uri;\n\t\t},\n\t\ttransformOutgoingScheme: (scheme: string): string => {\n\t\t\tif (scheme === 'file') {\n\t\t\t\treturn 'vscode-remote';\n\t\t\t} else if (scheme === 'vscode-local') {\n\t\t\t\treturn 'file';\n\t\t\t}\n\t\t\treturn scheme;\n\t\t}\n\t};\n}\n\nexport function createURITransformer(remoteAuthority: string): IURITransformer {\n\treturn new URITransformer(createRawURITransformer(remoteAuthority));\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { exec } from 'child_process';\nimport { totalmem } from 'os';\nimport { FileAccess } from '../common/network.js';\nimport { ProcessItem } from '../common/processes.js';\nimport { isWindows } from '../common/platform.js';\n\nexport function listProcesses(rootPid: number): Promise<ProcessItem> {\n\n\treturn new Promise((resolve, reject) => {\n\n\t\tlet rootItem: ProcessItem | undefined;\n\t\tconst map = new Map<number, ProcessItem>();\n\t\tconst totalMemory = totalmem();\n\n\t\tfunction addToTree(pid: number, ppid: number, cmd: string, load: number, mem: number) {\n\n\t\t\tconst parent = map.get(ppid);\n\t\t\tif (pid === rootPid || parent) {\n\n\t\t\t\tconst item: ProcessItem = {\n\t\t\t\t\tname: findName(cmd),\n\t\t\t\t\tcmd,\n\t\t\t\t\tpid,\n\t\t\t\t\tppid,\n\t\t\t\t\tload,\n\t\t\t\t\tmem: isWindows ? mem : (totalMemory * (mem / 100))\n\t\t\t\t};\n\t\t\t\tmap.set(pid, item);\n\n\t\t\t\tif (pid === rootPid) {\n\t\t\t\t\trootItem = item;\n\t\t\t\t}\n\n\t\t\t\tif (parent) {\n\t\t\t\t\tif (!parent.children) {\n\t\t\t\t\t\tparent.children = [];\n\t\t\t\t\t}\n\t\t\t\t\tparent.children.push(item);\n\t\t\t\t\tif (parent.children.length > 1) {\n\t\t\t\t\t\tparent.children = parent.children.sort((a, b) => a.pid - b.pid);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction findName(cmd: string): string {\n\n\t\t\tconst UTILITY_NETWORK_HINT = /--utility-sub-type=network/i;\n\t\t\tconst WINDOWS_CRASH_REPORTER = /--crashes-directory/i;\n\t\t\tconst WINPTY = /\\\\pipe\\\\winpty-control/i;\n\t\t\tconst CONPTY = /conhost\\.exe.+--headless/i;\n\t\t\tconst TYPE = /--type=([a-zA-Z-]+)/;\n\n\t\t\t// find windows crash reporter\n\t\t\tif (WINDOWS_CRASH_REPORTER.exec(cmd)) {\n\t\t\t\treturn 'electron-crash-reporter';\n\t\t\t}\n\n\t\t\t// find winpty process\n\t\t\tif (WINPTY.exec(cmd)) {\n\t\t\t\treturn 'winpty-agent';\n\t\t\t}\n\n\t\t\t// find conpty process\n\t\t\tif (CONPTY.exec(cmd)) {\n\t\t\t\treturn 'conpty-agent';\n\t\t\t}\n\n\t\t\t// find \"--type=xxxx\"\n\t\t\tlet matches = TYPE.exec(cmd);\n\t\t\tif (matches && matches.length === 2) {\n\t\t\t\tif (matches[1] === 'renderer') {\n\t\t\t\t\treturn `window`;\n\t\t\t\t} else if (matches[1] === 'utility') {\n\t\t\t\t\tif (UTILITY_NETWORK_HINT.exec(cmd)) {\n\t\t\t\t\t\treturn 'utility-network-service';\n\t\t\t\t\t}\n\n\t\t\t\t\treturn 'utility-process';\n\t\t\t\t} else if (matches[1] === 'extensionHost') {\n\t\t\t\t\treturn 'extension-host'; // normalize remote extension host type\n\t\t\t\t}\n\t\t\t\treturn matches[1];\n\t\t\t}\n\n\t\t\t// find all xxxx.js\n\t\t\tconst JS = /[a-zA-Z-]+\\.js/g;\n\t\t\tlet result = '';\n\t\t\tdo {\n\t\t\t\tmatches = JS.exec(cmd);\n\t\t\t\tif (matches) {\n\t\t\t\t\tresult += matches + ' ';\n\t\t\t\t}\n\t\t\t} while (matches);\n\n\t\t\tif (result) {\n\t\t\t\tif (cmd.indexOf('node ') < 0 && cmd.indexOf('node.exe') < 0) {\n\t\t\t\t\treturn `electron-nodejs (${result})`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn cmd;\n\t\t}\n\n\t\tif (process.platform === 'win32') {\n\n\t\t\tconst cleanUNCPrefix = (value: string): string => {\n\t\t\t\tif (value.indexOf('\\\\\\\\?\\\\') === 0) {\n\t\t\t\t\treturn value.substring(4);\n\t\t\t\t} else if (value.indexOf('\\\\??\\\\') === 0) {\n\t\t\t\t\treturn value.substring(4);\n\t\t\t\t} else if (value.indexOf('\"\\\\\\\\?\\\\') === 0) {\n\t\t\t\t\treturn '\"' + value.substring(5);\n\t\t\t\t} else if (value.indexOf('\"\\\\??\\\\') === 0) {\n\t\t\t\t\treturn '\"' + value.substring(5);\n\t\t\t\t} else {\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t(import('@vscode/windows-process-tree')).then(windowsProcessTree => {\n\t\t\t\twindowsProcessTree.getProcessList(rootPid, (processList) => {\n\t\t\t\t\tif (!processList) {\n\t\t\t\t\t\treject(new Error(`Root process ${rootPid} not found`));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\twindowsProcessTree.getProcessCpuUsage(processList, (completeProcessList) => {\n\t\t\t\t\t\tconst processItems: Map<number, ProcessItem> = new Map();\n\t\t\t\t\t\tcompleteProcessList.forEach(process => {\n\t\t\t\t\t\t\tconst commandLine = cleanUNCPrefix(process.commandLine || '');\n\t\t\t\t\t\t\tprocessItems.set(process.pid, {\n\t\t\t\t\t\t\t\tname: findName(commandLine),\n\t\t\t\t\t\t\t\tcmd: commandLine,\n\t\t\t\t\t\t\t\tpid: process.pid,\n\t\t\t\t\t\t\t\tppid: process.ppid,\n\t\t\t\t\t\t\t\tload: process.cpu || 0,\n\t\t\t\t\t\t\t\tmem: process.memory || 0\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\trootItem = processItems.get(rootPid);\n\t\t\t\t\t\tif (rootItem) {\n\t\t\t\t\t\t\tprocessItems.forEach(item => {\n\t\t\t\t\t\t\t\tconst parent = processItems.get(item.ppid);\n\t\t\t\t\t\t\t\tif (parent) {\n\t\t\t\t\t\t\t\t\tif (!parent.children) {\n\t\t\t\t\t\t\t\t\t\tparent.children = [];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tparent.children.push(item);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tprocessItems.forEach(item => {\n\t\t\t\t\t\t\t\tif (item.children) {\n\t\t\t\t\t\t\t\t\titem.children = item.children.sort((a, b) => a.pid - b.pid);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tresolve(rootItem);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treject(new Error(`Root process ${rootPid} not found`));\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}, windowsProcessTree.ProcessDataFlag.CommandLine | windowsProcessTree.ProcessDataFlag.Memory);\n\t\t\t});\n\t\t} else {\t// OS X & Linux\n\t\t\tfunction calculateLinuxCpuUsage() {\n\t\t\t\t// Flatten rootItem to get a list of all VSCode processes\n\t\t\t\tlet processes = [rootItem];\n\t\t\t\tconst pids: number[] = [];\n\t\t\t\twhile (processes.length) {\n\t\t\t\t\tconst process = processes.shift();\n\t\t\t\t\tif (process) {\n\t\t\t\t\t\tpids.push(process.pid);\n\t\t\t\t\t\tif (process.children) {\n\t\t\t\t\t\t\tprocesses = processes.concat(process.children);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// The cpu usage value reported on Linux is the average over the process lifetime,\n\t\t\t\t// recalculate the usage over a one second interval\n\t\t\t\t// JSON.stringify is needed to escape spaces, https://github.com/nodejs/node/issues/6803\n\t\t\t\tlet cmd = JSON.stringify(FileAccess.asFileUri('vs/base/node/cpuUsage.sh').fsPath);\n\t\t\t\tcmd += ' ' + pids.join(' ');\n\n\t\t\t\texec(cmd, {}, (err, stdout, stderr) => {\n\t\t\t\t\tif (err || stderr) {\n\t\t\t\t\t\treject(err || new Error(stderr.toString()));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst cpuUsage = stdout.toString().split('\\n');\n\t\t\t\t\t\tfor (let i = 0; i < pids.length; i++) {\n\t\t\t\t\t\t\tconst processInfo = map.get(pids[i])!;\n\t\t\t\t\t\t\tprocessInfo.load = parseFloat(cpuUsage[i]);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!rootItem) {\n\t\t\t\t\t\t\treject(new Error(`Root process ${rootPid} not found`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve(rootItem);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\texec('which ps', {}, (err, stdout, stderr) => {\n\t\t\t\tif (err || stderr) {\n\t\t\t\t\tif (process.platform !== 'linux') {\n\t\t\t\t\t\treject(err || new Error(stderr.toString()));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst cmd = JSON.stringify(FileAccess.asFileUri('vs/base/node/ps.sh').fsPath);\n\t\t\t\t\t\texec(cmd, {}, (err, stdout, stderr) => {\n\t\t\t\t\t\t\tif (err || stderr) {\n\t\t\t\t\t\t\t\treject(err || new Error(stderr.toString()));\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tparsePsOutput(stdout, addToTree);\n\t\t\t\t\t\t\t\tcalculateLinuxCpuUsage();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst ps = stdout.toString().trim();\n\t\t\t\t\tconst args = '-ax -o pid=,ppid=,pcpu=,pmem=,command=';\n\n\t\t\t\t\t// Set numeric locale to ensure '.' is used as the decimal separator\n\t\t\t\t\texec(`${ps} ${args}`, { maxBuffer: 1000 * 1024, env: { LC_NUMERIC: 'en_US.UTF-8' } }, (err, stdout, stderr) => {\n\t\t\t\t\t\t// Silently ignoring the screen size is bogus error. See https://github.com/microsoft/vscode/issues/98590\n\t\t\t\t\t\tif (err || (stderr && !stderr.includes('screen size is bogus'))) {\n\t\t\t\t\t\t\treject(err || new Error(stderr.toString()));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tparsePsOutput(stdout, addToTree);\n\n\t\t\t\t\t\t\tif (process.platform === 'linux') {\n\t\t\t\t\t\t\t\tcalculateLinuxCpuUsage();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (!rootItem) {\n\t\t\t\t\t\t\t\t\treject(new Error(`Root process ${rootPid} not found`));\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tresolve(rootItem);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}\n\nfunction parsePsOutput(stdout: string, addToTree: (pid: number, ppid: number, cmd: string, load: number, mem: number) => void): void {\n\tconst PID_CMD = /^\\s*([0-9]+)\\s+([0-9]+)\\s+([0-9]+\\.[0-9]+)\\s+([0-9]+\\.[0-9]+)\\s+(.+)$/;\n\tconst lines = stdout.toString().split('\\n');\n\tfor (const line of lines) {\n\t\tconst matches = PID_CMD.exec(line.trim());\n\t\tif (matches && matches.length === 6) {\n\t\t\taddToTree(parseInt(matches[1]), parseInt(matches[2]), matches[5], parseFloat(matches[3]), parseFloat(matches[4]));\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { ProcessItem } from '../../../base/common/processes.js';\nimport { UriComponents } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { IWorkspace } from '../../workspace/common/workspace.js';\n\nexport const ID = 'diagnosticsService';\nexport const IDiagnosticsService = createDecorator<IDiagnosticsService>(ID);\n\nexport interface IDiagnosticsService {\n\treadonly _serviceBrand: undefined;\n\n\tgetPerformanceInfo(mainProcessInfo: IMainProcessDiagnostics, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<PerformanceInfo>;\n\tgetSystemInfo(mainProcessInfo: IMainProcessDiagnostics, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<SystemInfo>;\n\tgetDiagnostics(mainProcessInfo: IMainProcessDiagnostics, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<string>;\n\tgetWorkspaceFileExtensions(workspace: IWorkspace): Promise<{ extensions: string[] }>;\n\treportWorkspaceStats(workspace: IWorkspaceInformation): Promise<void>;\n}\n\nexport interface IMachineInfo {\n\tos: string;\n\tcpus?: string;\n\tmemory: string;\n\tvmHint: string;\n\tlinuxEnv?: ILinuxEnv;\n}\n\nexport interface ILinuxEnv {\n\tdesktopSession?: string;\n\txdgSessionDesktop?: string;\n\txdgCurrentDesktop?: string;\n\txdgSessionType?: string;\n}\n\nexport interface IDiagnosticInfo {\n\tmachineInfo: IMachineInfo;\n\tworkspaceMetadata?: IStringDictionary<WorkspaceStats>;\n\tprocesses?: ProcessItem;\n}\nexport interface SystemInfo extends IMachineInfo {\n\tprocessArgs: string;\n\tgpuStatus: any;\n\tscreenReader: string;\n\tremoteData: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[];\n\tload?: string;\n}\n\nexport interface IRemoteDiagnosticInfo extends IDiagnosticInfo {\n\thostName: string;\n\tlatency?: {\n\t\tcurrent: number;\n\t\taverage: number;\n\t};\n}\n\nexport interface IRemoteDiagnosticError {\n\thostName: string;\n\terrorMessage: string;\n}\n\nexport interface IDiagnosticInfoOptions {\n\tincludeProcesses?: boolean;\n\tfolders?: UriComponents[];\n}\n\nexport interface WorkspaceStatItem {\n\tname: string;\n\tcount: number;\n}\n\nexport interface WorkspaceStats {\n\tfileTypes: WorkspaceStatItem[];\n\tconfigFiles: WorkspaceStatItem[];\n\tfileCount: number;\n\tmaxFilesReached: boolean;\n\tlaunchConfigFiles: WorkspaceStatItem[];\n\ttotalScanTime: number;\n\ttotalReaddirCount: number;\n}\n\nexport interface PerformanceInfo {\n\tprocessInfo?: string;\n\tworkspaceInfo?: string;\n}\n\nexport interface IWorkspaceInformation extends IWorkspace {\n\ttelemetryId: string | undefined;\n\trendererSessionId: string;\n}\n\nexport function isRemoteDiagnosticError(x: unknown): x is IRemoteDiagnosticError {\n\tconst candidate = x as IRemoteDiagnosticError | undefined;\n\treturn !!candidate?.hostName && !!candidate?.errorMessage;\n}\n\nexport class NullDiagnosticsService implements IDiagnosticsService {\n\t_serviceBrand: undefined;\n\n\tasync getPerformanceInfo(mainProcessInfo: IMainProcessDiagnostics, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<PerformanceInfo> {\n\t\treturn {};\n\t}\n\n\tasync getSystemInfo(mainProcessInfo: IMainProcessDiagnostics, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<SystemInfo> {\n\t\treturn {\n\t\t\tprocessArgs: 'nullProcessArgs',\n\t\t\tgpuStatus: 'nullGpuStatus',\n\t\t\tscreenReader: 'nullScreenReader',\n\t\t\tremoteData: [],\n\t\t\tos: 'nullOs',\n\t\t\tmemory: 'nullMemory',\n\t\t\tvmHint: 'nullVmHint',\n\t\t};\n\t}\n\n\tasync getDiagnostics(mainProcessInfo: IMainProcessDiagnostics, remoteInfo: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<string> {\n\t\treturn '';\n\t}\n\n\tasync getWorkspaceFileExtensions(workspace: IWorkspace): Promise<{ extensions: string[] }> {\n\t\treturn { extensions: [] };\n\t}\n\n\tasync reportWorkspaceStats(workspace: IWorkspaceInformation): Promise<void> { }\n\n}\n\nexport interface IWindowDiagnostics {\n\treadonly id: number;\n\treadonly pid: number;\n\treadonly title: string;\n\treadonly folderURIs: UriComponents[];\n\treadonly remoteAuthority?: string;\n}\n\nexport interface IProcessDiagnostics {\n\treadonly pid: number;\n\treadonly name: string;\n}\n\nexport interface IMainProcessDiagnostics {\n\treadonly mainPID: number;\n\treadonly mainArguments: string[]; // All arguments after argv[0], the exec path\n\treadonly windows: IWindowDiagnostics[];\n\treadonly pidToNames: IProcessDiagnostics[];\n\treadonly screenReader: boolean;\n\treadonly gpuFeatureStatus: any;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as fs from 'fs';\nimport * as osLib from 'os';\nimport { Promises } from '../../../base/common/async.js';\nimport { getNodeType, parse, ParseError } from '../../../base/common/json.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { basename, join } from '../../../base/common/path.js';\nimport { isLinux, isWindows } from '../../../base/common/platform.js';\nimport { ProcessItem } from '../../../base/common/processes.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { virtualMachineHint } from '../../../base/node/id.js';\nimport { IDirent, Promises as pfs } from '../../../base/node/pfs.js';\nimport { listProcesses } from '../../../base/node/ps.js';\nimport { IDiagnosticsService, IMachineInfo, IMainProcessDiagnostics, IRemoteDiagnosticError, IRemoteDiagnosticInfo, isRemoteDiagnosticError, IWorkspaceInformation, PerformanceInfo, SystemInfo, WorkspaceStatItem, WorkspaceStats } from '../common/diagnostics.js';\nimport { ByteSize } from '../../files/common/files.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { ITelemetryService } from '../../telemetry/common/telemetry.js';\nimport { IWorkspace } from '../../workspace/common/workspace.js';\n\ninterface ConfigFilePatterns {\n\ttag: string;\n\tfilePattern: RegExp;\n\trelativePathPattern?: RegExp;\n}\n\nconst workspaceStatsCache = new Map<string, Promise<WorkspaceStats>>();\nexport async function collectWorkspaceStats(folder: string, filter: string[]): Promise<WorkspaceStats> {\n\tconst cacheKey = `${folder}::${filter.join(':')}`;\n\tconst cached = workspaceStatsCache.get(cacheKey);\n\tif (cached) {\n\t\treturn cached;\n\t}\n\n\tconst configFilePatterns: ConfigFilePatterns[] = [\n\t\t{ tag: 'grunt.js', filePattern: /^gruntfile\\.js$/i },\n\t\t{ tag: 'gulp.js', filePattern: /^gulpfile\\.js$/i },\n\t\t{ tag: 'tsconfig.json', filePattern: /^tsconfig\\.json$/i },\n\t\t{ tag: 'package.json', filePattern: /^package\\.json$/i },\n\t\t{ tag: 'jsconfig.json', filePattern: /^jsconfig\\.json$/i },\n\t\t{ tag: 'tslint.json', filePattern: /^tslint\\.json$/i },\n\t\t{ tag: 'eslint.json', filePattern: /^eslint\\.json$/i },\n\t\t{ tag: 'tasks.json', filePattern: /^tasks\\.json$/i },\n\t\t{ tag: 'launch.json', filePattern: /^launch\\.json$/i },\n\t\t{ tag: 'mcp.json', filePattern: /^mcp\\.json$/i },\n\t\t{ tag: 'settings.json', filePattern: /^settings\\.json$/i },\n\t\t{ tag: 'webpack.config.js', filePattern: /^webpack\\.config\\.js$/i },\n\t\t{ tag: 'project.json', filePattern: /^project\\.json$/i },\n\t\t{ tag: 'makefile', filePattern: /^makefile$/i },\n\t\t{ tag: 'sln', filePattern: /^.+\\.sln$/i },\n\t\t{ tag: 'csproj', filePattern: /^.+\\.csproj$/i },\n\t\t{ tag: 'cmake', filePattern: /^.+\\.cmake$/i },\n\t\t{ tag: 'github-actions', filePattern: /^.+\\.ya?ml$/i, relativePathPattern: /^\\.github(?:\\/|\\\\)workflows$/i },\n\t\t{ tag: 'devcontainer.json', filePattern: /^devcontainer\\.json$/i },\n\t\t{ tag: 'dockerfile', filePattern: /^(dockerfile|docker\\-compose\\.ya?ml)$/i },\n\t\t{ tag: 'cursorrules', filePattern: /^\\.cursorrules$/i },\n\t];\n\n\tconst fileTypes = new Map<string, number>();\n\tconst configFiles = new Map<string, number>();\n\n\tconst MAX_FILES = 20000;\n\n\tfunction collect(root: string, dir: string, filter: string[], token: { count: number; maxReached: boolean; readdirCount: number }): Promise<void> {\n\t\tconst relativePath = dir.substring(root.length + 1);\n\n\t\treturn Promises.withAsyncBody(async resolve => {\n\t\t\tlet files: IDirent[];\n\n\t\t\ttoken.readdirCount++;\n\t\t\ttry {\n\t\t\t\tfiles = await pfs.readdir(dir, { withFileTypes: true });\n\t\t\t} catch (error) {\n\t\t\t\t// Ignore folders that can't be read\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (token.count >= MAX_FILES) {\n\t\t\t\ttoken.count += files.length;\n\t\t\t\ttoken.maxReached = true;\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet pending = files.length;\n\t\t\tif (pending === 0) {\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet filesToRead = files;\n\t\t\tif (token.count + files.length > MAX_FILES) {\n\t\t\t\ttoken.maxReached = true;\n\t\t\t\tpending = MAX_FILES - token.count;\n\t\t\t\tfilesToRead = files.slice(0, pending);\n\t\t\t}\n\n\t\t\ttoken.count += files.length;\n\n\t\t\tfor (const file of filesToRead) {\n\t\t\t\tif (file.isDirectory()) {\n\t\t\t\t\tif (!filter.includes(file.name)) {\n\t\t\t\t\t\tawait collect(root, join(dir, file.name), filter, token);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (--pending === 0) {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst index = file.name.lastIndexOf('.');\n\t\t\t\t\tif (index >= 0) {\n\t\t\t\t\t\tconst fileType = file.name.substring(index + 1);\n\t\t\t\t\t\tif (fileType) {\n\t\t\t\t\t\t\tfileTypes.set(fileType, (fileTypes.get(fileType) ?? 0) + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const configFile of configFilePatterns) {\n\t\t\t\t\t\tif (configFile.relativePathPattern?.test(relativePath) !== false && configFile.filePattern.test(file.name)) {\n\t\t\t\t\t\t\tconfigFiles.set(configFile.tag, (configFiles.get(configFile.tag) ?? 0) + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (--pending === 0) {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tconst statsPromise = Promises.withAsyncBody<WorkspaceStats>(async (resolve) => {\n\t\tconst token: { count: number; maxReached: boolean; readdirCount: number } = { count: 0, maxReached: false, readdirCount: 0 };\n\t\tconst sw = new StopWatch(true);\n\t\tawait collect(folder, folder, filter, token);\n\t\tconst launchConfigs = await collectLaunchConfigs(folder);\n\t\tresolve({\n\t\t\tconfigFiles: asSortedItems(configFiles),\n\t\t\tfileTypes: asSortedItems(fileTypes),\n\t\t\tfileCount: token.count,\n\t\t\tmaxFilesReached: token.maxReached,\n\t\t\tlaunchConfigFiles: launchConfigs,\n\t\t\ttotalScanTime: sw.elapsed(),\n\t\t\ttotalReaddirCount: token.readdirCount\n\t\t});\n\t});\n\n\tworkspaceStatsCache.set(cacheKey, statsPromise);\n\treturn statsPromise;\n}\n\nfunction asSortedItems(items: Map<string, number>): WorkspaceStatItem[] {\n\treturn Array.from(items.entries(), ([name, count]) => ({ name: name, count: count }))\n\t\t.sort((a, b) => b.count - a.count);\n}\n\nexport function getMachineInfo(): IMachineInfo {\n\n\tconst machineInfo: IMachineInfo = {\n\t\tos: `${osLib.type()} ${osLib.arch()} ${osLib.release()}`,\n\t\tmemory: `${(osLib.totalmem() / ByteSize.GB).toFixed(2)}GB (${(osLib.freemem() / ByteSize.GB).toFixed(2)}GB free)`,\n\t\tvmHint: `${Math.round((virtualMachineHint.value() * 100))}%`,\n\t};\n\n\tconst cpus = osLib.cpus();\n\tif (cpus && cpus.length > 0) {\n\t\tmachineInfo.cpus = `${cpus[0].model} (${cpus.length} x ${cpus[0].speed})`;\n\t}\n\n\treturn machineInfo;\n}\n\nexport async function collectLaunchConfigs(folder: string): Promise<WorkspaceStatItem[]> {\n\ttry {\n\t\tconst launchConfigs = new Map<string, number>();\n\t\tconst launchConfig = join(folder, '.vscode', 'launch.json');\n\n\t\tconst contents = await fs.promises.readFile(launchConfig);\n\n\t\tconst errors: ParseError[] = [];\n\t\tconst json = parse(contents.toString(), errors);\n\t\tif (errors.length) {\n\t\t\tconsole.log(`Unable to parse ${launchConfig}`);\n\t\t\treturn [];\n\t\t}\n\n\t\tif (getNodeType(json) === 'object' && json['configurations']) {\n\t\t\tfor (const each of json['configurations']) {\n\t\t\t\tconst type = each['type'];\n\t\t\t\tif (type) {\n\t\t\t\t\tif (launchConfigs.has(type)) {\n\t\t\t\t\t\tlaunchConfigs.set(type, launchConfigs.get(type)! + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlaunchConfigs.set(type, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn asSortedItems(launchConfigs);\n\t} catch (error) {\n\t\treturn [];\n\t}\n}\n\nexport class DiagnosticsService implements IDiagnosticsService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tconstructor(\n\t\t@ITelemetryService private readonly telemetryService: ITelemetryService,\n\t\t@IProductService private readonly productService: IProductService\n\t) { }\n\n\tprivate formatMachineInfo(info: IMachineInfo): string {\n\t\tconst output: string[] = [];\n\t\toutput.push(`OS Version:       ${info.os}`);\n\t\toutput.push(`CPUs:             ${info.cpus}`);\n\t\toutput.push(`Memory (System):  ${info.memory}`);\n\t\toutput.push(`VM:               ${info.vmHint}`);\n\n\t\treturn output.join('\\n');\n\t}\n\n\tprivate formatEnvironment(info: IMainProcessDiagnostics): string {\n\t\tconst output: string[] = [];\n\t\toutput.push(`Version:          ${this.productService.nameShort} ${this.productService.version} (${this.productService.commit || 'Commit unknown'}, ${this.productService.date || 'Date unknown'})`);\n\t\toutput.push(`OS Version:       ${osLib.type()} ${osLib.arch()} ${osLib.release()}`);\n\t\tconst cpus = osLib.cpus();\n\t\tif (cpus && cpus.length > 0) {\n\t\t\toutput.push(`CPUs:             ${cpus[0].model} (${cpus.length} x ${cpus[0].speed})`);\n\t\t}\n\t\toutput.push(`Memory (System):  ${(osLib.totalmem() / ByteSize.GB).toFixed(2)}GB (${(osLib.freemem() / ByteSize.GB).toFixed(2)}GB free)`);\n\t\tif (!isWindows) {\n\t\t\toutput.push(`Load (avg):       ${osLib.loadavg().map(l => Math.round(l)).join(', ')}`); // only provided on Linux/macOS\n\t\t}\n\t\toutput.push(`VM:               ${Math.round((virtualMachineHint.value() * 100))}%`);\n\t\toutput.push(`Screen Reader:    ${info.screenReader ? 'yes' : 'no'}`);\n\t\toutput.push(`Process Argv:     ${info.mainArguments.join(' ')}`);\n\t\toutput.push(`GPU Status:       ${this.expandGPUFeatures(info.gpuFeatureStatus)}`);\n\n\t\treturn output.join('\\n');\n\t}\n\n\tpublic async getPerformanceInfo(info: IMainProcessDiagnostics, remoteData: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<PerformanceInfo> {\n\t\treturn Promise.all([listProcesses(info.mainPID), this.formatWorkspaceMetadata(info)]).then(async result => {\n\t\t\tlet [rootProcess, workspaceInfo] = result;\n\t\t\tlet processInfo = this.formatProcessList(info, rootProcess);\n\n\t\t\tremoteData.forEach(diagnostics => {\n\t\t\t\tif (isRemoteDiagnosticError(diagnostics)) {\n\t\t\t\t\tprocessInfo += `\\n${diagnostics.errorMessage}`;\n\t\t\t\t\tworkspaceInfo += `\\n${diagnostics.errorMessage}`;\n\t\t\t\t} else {\n\t\t\t\t\tprocessInfo += `\\n\\nRemote: ${diagnostics.hostName}`;\n\t\t\t\t\tif (diagnostics.processes) {\n\t\t\t\t\t\tprocessInfo += `\\n${this.formatProcessList(info, diagnostics.processes)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (diagnostics.workspaceMetadata) {\n\t\t\t\t\t\tworkspaceInfo += `\\n|  Remote: ${diagnostics.hostName}`;\n\t\t\t\t\t\tfor (const folder of Object.keys(diagnostics.workspaceMetadata)) {\n\t\t\t\t\t\t\tconst metadata = diagnostics.workspaceMetadata[folder];\n\n\t\t\t\t\t\t\tlet countMessage = `${metadata.fileCount} files`;\n\t\t\t\t\t\t\tif (metadata.maxFilesReached) {\n\t\t\t\t\t\t\t\tcountMessage = `more than ${countMessage}`;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tworkspaceInfo += `|    Folder (${folder}): ${countMessage}`;\n\t\t\t\t\t\t\tworkspaceInfo += this.formatWorkspaceStats(metadata);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tprocessInfo,\n\t\t\t\tworkspaceInfo\n\t\t\t};\n\t\t});\n\t}\n\n\tpublic async getSystemInfo(info: IMainProcessDiagnostics, remoteData: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<SystemInfo> {\n\t\tconst { memory, vmHint, os, cpus } = getMachineInfo();\n\t\tconst systemInfo: SystemInfo = {\n\t\t\tos,\n\t\t\tmemory,\n\t\t\tcpus,\n\t\t\tvmHint,\n\t\t\tprocessArgs: `${info.mainArguments.join(' ')}`,\n\t\t\tgpuStatus: info.gpuFeatureStatus,\n\t\t\tscreenReader: `${info.screenReader ? 'yes' : 'no'}`,\n\t\t\tremoteData\n\t\t};\n\n\t\tif (!isWindows) {\n\t\t\tsystemInfo.load = `${osLib.loadavg().map(l => Math.round(l)).join(', ')}`;\n\t\t}\n\n\t\tif (isLinux) {\n\t\t\tsystemInfo.linuxEnv = {\n\t\t\t\tdesktopSession: process.env['DESKTOP_SESSION'],\n\t\t\t\txdgSessionDesktop: process.env['XDG_SESSION_DESKTOP'],\n\t\t\t\txdgCurrentDesktop: process.env['XDG_CURRENT_DESKTOP'],\n\t\t\t\txdgSessionType: process.env['XDG_SESSION_TYPE']\n\t\t\t};\n\t\t}\n\n\t\treturn Promise.resolve(systemInfo);\n\t}\n\n\tpublic async getDiagnostics(info: IMainProcessDiagnostics, remoteDiagnostics: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<string> {\n\t\tconst output: string[] = [];\n\t\treturn listProcesses(info.mainPID).then(async rootProcess => {\n\n\t\t\t// Environment Info\n\t\t\toutput.push('');\n\t\t\toutput.push(this.formatEnvironment(info));\n\n\t\t\t// Process List\n\t\t\toutput.push('');\n\t\t\toutput.push(this.formatProcessList(info, rootProcess));\n\n\t\t\t// Workspace Stats\n\t\t\tif (info.windows.some(window => window.folderURIs && window.folderURIs.length > 0 && !window.remoteAuthority)) {\n\t\t\t\toutput.push('');\n\t\t\t\toutput.push('Workspace Stats: ');\n\t\t\t\toutput.push(await this.formatWorkspaceMetadata(info));\n\t\t\t}\n\n\t\t\tremoteDiagnostics.forEach(diagnostics => {\n\t\t\t\tif (isRemoteDiagnosticError(diagnostics)) {\n\t\t\t\t\toutput.push(`\\n${diagnostics.errorMessage}`);\n\t\t\t\t} else {\n\t\t\t\t\toutput.push('\\n\\n');\n\t\t\t\t\toutput.push(`Remote:           ${diagnostics.hostName}`);\n\t\t\t\t\toutput.push(this.formatMachineInfo(diagnostics.machineInfo));\n\n\t\t\t\t\tif (diagnostics.processes) {\n\t\t\t\t\t\toutput.push(this.formatProcessList(info, diagnostics.processes));\n\t\t\t\t\t}\n\n\t\t\t\t\tif (diagnostics.workspaceMetadata) {\n\t\t\t\t\t\tfor (const folder of Object.keys(diagnostics.workspaceMetadata)) {\n\t\t\t\t\t\t\tconst metadata = diagnostics.workspaceMetadata[folder];\n\n\t\t\t\t\t\t\tlet countMessage = `${metadata.fileCount} files`;\n\t\t\t\t\t\t\tif (metadata.maxFilesReached) {\n\t\t\t\t\t\t\t\tcountMessage = `more than ${countMessage}`;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\toutput.push(`Folder (${folder}): ${countMessage}`);\n\t\t\t\t\t\t\toutput.push(this.formatWorkspaceStats(metadata));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\toutput.push('');\n\t\t\toutput.push('');\n\n\t\t\treturn output.join('\\n');\n\t\t});\n\t}\n\n\tprivate formatWorkspaceStats(workspaceStats: WorkspaceStats): string {\n\t\tconst output: string[] = [];\n\t\tconst lineLength = 60;\n\t\tlet col = 0;\n\n\t\tconst appendAndWrap = (name: string, count: number) => {\n\t\t\tconst item = ` ${name}(${count})`;\n\n\t\t\tif (col + item.length > lineLength) {\n\t\t\t\toutput.push(line);\n\t\t\t\tline = '|                 ';\n\t\t\t\tcol = line.length;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcol += item.length;\n\t\t\t}\n\t\t\tline += item;\n\t\t};\n\n\t\t// File Types\n\t\tlet line = '|      File types:';\n\t\tconst maxShown = 10;\n\t\tconst max = workspaceStats.fileTypes.length > maxShown ? maxShown : workspaceStats.fileTypes.length;\n\t\tfor (let i = 0; i < max; i++) {\n\t\t\tconst item = workspaceStats.fileTypes[i];\n\t\t\tappendAndWrap(item.name, item.count);\n\t\t}\n\t\toutput.push(line);\n\n\t\t// Conf Files\n\t\tif (workspaceStats.configFiles.length >= 0) {\n\t\t\tline = '|      Conf files:';\n\t\t\tcol = 0;\n\t\t\tworkspaceStats.configFiles.forEach((item) => {\n\t\t\t\tappendAndWrap(item.name, item.count);\n\t\t\t});\n\t\t\toutput.push(line);\n\t\t}\n\n\t\tif (workspaceStats.launchConfigFiles.length > 0) {\n\t\t\tlet line = '|      Launch Configs:';\n\t\t\tworkspaceStats.launchConfigFiles.forEach(each => {\n\t\t\t\tconst item = each.count > 1 ? ` ${each.name}(${each.count})` : ` ${each.name}`;\n\t\t\t\tline += item;\n\t\t\t});\n\t\t\toutput.push(line);\n\t\t}\n\t\treturn output.join('\\n');\n\t}\n\n\tprivate expandGPUFeatures(gpuFeatures: any): string {\n\t\tconst longestFeatureName = Math.max(...Object.keys(gpuFeatures).map(feature => feature.length));\n\t\t// Make columns aligned by adding spaces after feature name\n\t\treturn Object.keys(gpuFeatures).map(feature => `${feature}:  ${' '.repeat(longestFeatureName - feature.length)}  ${gpuFeatures[feature]}`).join('\\n                  ');\n\t}\n\n\tprivate formatWorkspaceMetadata(info: IMainProcessDiagnostics): Promise<string> {\n\t\tconst output: string[] = [];\n\t\tconst workspaceStatPromises: Promise<void>[] = [];\n\n\t\tinfo.windows.forEach(window => {\n\t\t\tif (window.folderURIs.length === 0 || !!window.remoteAuthority) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\toutput.push(`|  Window (${window.title})`);\n\n\t\t\twindow.folderURIs.forEach(uriComponents => {\n\t\t\t\tconst folderUri = URI.revive(uriComponents);\n\t\t\t\tif (folderUri.scheme === Schemas.file) {\n\t\t\t\t\tconst folder = folderUri.fsPath;\n\t\t\t\t\tworkspaceStatPromises.push(collectWorkspaceStats(folder, ['node_modules', '.git']).then(stats => {\n\t\t\t\t\t\tlet countMessage = `${stats.fileCount} files`;\n\t\t\t\t\t\tif (stats.maxFilesReached) {\n\t\t\t\t\t\t\tcountMessage = `more than ${countMessage}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\toutput.push(`|    Folder (${basename(folder)}): ${countMessage}`);\n\t\t\t\t\t\toutput.push(this.formatWorkspaceStats(stats));\n\n\t\t\t\t\t}).catch(error => {\n\t\t\t\t\t\toutput.push(`|      Error: Unable to collect workspace stats for folder ${folder} (${error.toString()})`);\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\toutput.push(`|    Folder (${folderUri.toString()}): Workspace stats not available.`);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn Promise.all(workspaceStatPromises)\n\t\t\t.then(_ => output.join('\\n'))\n\t\t\t.catch(e => `Unable to collect workspace stats: ${e}`);\n\t}\n\n\tprivate formatProcessList(info: IMainProcessDiagnostics, rootProcess: ProcessItem): string {\n\t\tconst mapProcessToName = new Map<number, string>();\n\t\tinfo.windows.forEach(window => mapProcessToName.set(window.pid, `window [${window.id}] (${window.title})`));\n\t\tinfo.pidToNames.forEach(({ pid, name }) => mapProcessToName.set(pid, name));\n\n\t\tconst output: string[] = [];\n\n\t\toutput.push('CPU %\\tMem MB\\t   PID\\tProcess');\n\n\t\tif (rootProcess) {\n\t\t\tthis.formatProcessItem(info.mainPID, mapProcessToName, output, rootProcess, 0);\n\t\t}\n\n\t\treturn output.join('\\n');\n\t}\n\n\tprivate formatProcessItem(mainPid: number, mapProcessToName: Map<number, string>, output: string[], item: ProcessItem, indent: number): void {\n\t\tconst isRoot = (indent === 0);\n\n\t\t// Format name with indent\n\t\tlet name: string;\n\t\tif (isRoot) {\n\t\t\tname = item.pid === mainPid ? this.productService.applicationName : 'remote-server';\n\t\t} else {\n\t\t\tif (mapProcessToName.has(item.pid)) {\n\t\t\t\tname = mapProcessToName.get(item.pid)!;\n\t\t\t} else {\n\t\t\t\tname = `${'  '.repeat(indent)} ${item.name}`;\n\t\t\t}\n\t\t}\n\n\t\tconst memory = process.platform === 'win32' ? item.mem : (osLib.totalmem() * (item.mem / 100));\n\t\toutput.push(`${item.load.toFixed(0).padStart(5, ' ')}\\t${(memory / ByteSize.MB).toFixed(0).padStart(6, ' ')}\\t${item.pid.toFixed(0).padStart(6, ' ')}\\t${name}`);\n\n\t\t// Recurse into children if any\n\t\tif (Array.isArray(item.children)) {\n\t\t\titem.children.forEach(child => this.formatProcessItem(mainPid, mapProcessToName, output, child, indent + 1));\n\t\t}\n\t}\n\n\tpublic async getWorkspaceFileExtensions(workspace: IWorkspace): Promise<{ extensions: string[] }> {\n\t\tconst items = new Set<string>();\n\t\tfor (const { uri } of workspace.folders) {\n\t\t\tconst folderUri = URI.revive(uri);\n\t\t\tif (folderUri.scheme !== Schemas.file) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst folder = folderUri.fsPath;\n\t\t\ttry {\n\t\t\t\tconst stats = await collectWorkspaceStats(folder, ['node_modules', '.git']);\n\t\t\t\tstats.fileTypes.forEach(item => items.add(item.name));\n\t\t\t} catch { }\n\t\t}\n\t\treturn { extensions: [...items] };\n\t}\n\n\tpublic async reportWorkspaceStats(workspace: IWorkspaceInformation): Promise<void> {\n\t\tfor (const { uri } of workspace.folders) {\n\t\t\tconst folderUri = URI.revive(uri);\n\t\t\tif (folderUri.scheme !== Schemas.file) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst folder = folderUri.fsPath;\n\t\t\ttry {\n\t\t\t\tconst stats = await collectWorkspaceStats(folder, ['node_modules', '.git']);\n\t\t\t\ttype WorkspaceStatsClassification = {\n\t\t\t\t\towner: 'lramos15';\n\t\t\t\t\tcomment: 'Metadata related to the workspace';\n\t\t\t\t\t'workspace.id': { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'A UUID given to a workspace to identify it.' };\n\t\t\t\t\trendererSessionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The ID of the session' };\n\t\t\t\t};\n\t\t\t\ttype WorkspaceStatsEvent = {\n\t\t\t\t\t'workspace.id': string | undefined;\n\t\t\t\t\trendererSessionId: string;\n\t\t\t\t};\n\t\t\t\tthis.telemetryService.publicLog2<WorkspaceStatsEvent, WorkspaceStatsClassification>('workspace.stats', {\n\t\t\t\t\t'workspace.id': workspace.telemetryId,\n\t\t\t\t\trendererSessionId: workspace.rendererSessionId\n\t\t\t\t});\n\t\t\t\ttype WorkspaceStatsFileClassification = {\n\t\t\t\t\towner: 'lramos15';\n\t\t\t\t\tcomment: 'Helps us gain insights into what type of files are being used in a workspace';\n\t\t\t\t\trendererSessionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The ID of the session.' };\n\t\t\t\t\ttype: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of file' };\n\t\t\t\t\tcount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How many types of that file are present' };\n\t\t\t\t};\n\t\t\t\ttype WorkspaceStatsFileEvent = {\n\t\t\t\t\trendererSessionId: string;\n\t\t\t\t\ttype: string;\n\t\t\t\t\tcount: number;\n\t\t\t\t};\n\t\t\t\tstats.fileTypes.forEach(e => {\n\t\t\t\t\tthis.telemetryService.publicLog2<WorkspaceStatsFileEvent, WorkspaceStatsFileClassification>('workspace.stats.file', {\n\t\t\t\t\t\trendererSessionId: workspace.rendererSessionId,\n\t\t\t\t\t\ttype: e.name,\n\t\t\t\t\t\tcount: e.count\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tstats.launchConfigFiles.forEach(e => {\n\t\t\t\t\tthis.telemetryService.publicLog2<WorkspaceStatsFileEvent, WorkspaceStatsFileClassification>('workspace.stats.launchConfigFile', {\n\t\t\t\t\t\trendererSessionId: workspace.rendererSessionId,\n\t\t\t\t\t\ttype: e.name,\n\t\t\t\t\t\tcount: e.count\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tstats.configFiles.forEach(e => {\n\t\t\t\t\tthis.telemetryService.publicLog2<WorkspaceStatsFileEvent, WorkspaceStatsFileClassification>('workspace.stats.configFiles', {\n\t\t\t\t\t\trendererSessionId: workspace.rendererSessionId,\n\t\t\t\t\t\ttype: e.name,\n\t\t\t\t\t\tcount: e.count\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\t// Workspace stats metadata\n\t\t\t\ttype WorkspaceStatsMetadataClassification = {\n\t\t\t\t\towner: 'jrieken';\n\t\t\t\t\tcomment: 'Metadata about workspace metadata collection';\n\t\t\t\t\tduration: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'How did it take to make workspace stats' };\n\t\t\t\t\treachedLimit: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Did making workspace stats reach its limits' };\n\t\t\t\t\tfileCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'How many files did workspace stats discover' };\n\t\t\t\t\treaddirCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'How many readdir call were needed' };\n\t\t\t\t};\n\t\t\t\ttype WorkspaceStatsMetadata = {\n\t\t\t\t\tduration: number;\n\t\t\t\t\treachedLimit: boolean;\n\t\t\t\t\tfileCount: number;\n\t\t\t\t\treaddirCount: number;\n\t\t\t\t};\n\t\t\t\tthis.telemetryService.publicLog2<WorkspaceStatsMetadata, WorkspaceStatsMetadataClassification>('workspace.stats.metadata', { duration: stats.totalScanTime, reachedLimit: stats.maxFilesReached, fileCount: stats.fileCount, readdirCount: stats.totalReaddirCount });\n\t\t\t} catch {\n\t\t\t\t// Report nothing if collecting metadata fails.\n\t\t\t}\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../base/common/event.js';\nimport * as platform from '../../base/common/platform.js';\nimport * as performance from '../../base/common/performance.js';\nimport { URI } from '../../base/common/uri.js';\nimport { createURITransformer } from '../../workbench/api/node/uriTransformer.js';\nimport { IRemoteAgentEnvironmentDTO, IGetEnvironmentDataArguments, IGetExtensionHostExitInfoArguments } from '../../workbench/services/remote/common/remoteAgentEnvironmentChannel.js';\nimport { IServerEnvironmentService } from './serverEnvironmentService.js';\nimport { IServerChannel } from '../../base/parts/ipc/common/ipc.js';\nimport { transformOutgoingURIs } from '../../base/common/uriIpc.js';\nimport { listProcesses } from '../../base/node/ps.js';\nimport { getMachineInfo, collectWorkspaceStats } from '../../platform/diagnostics/node/diagnosticsService.js';\nimport { IDiagnosticInfoOptions, IDiagnosticInfo } from '../../platform/diagnostics/common/diagnostics.js';\nimport { basename } from '../../base/common/path.js';\nimport { ProcessItem } from '../../base/common/processes.js';\nimport { ServerConnectionToken, ServerConnectionTokenType } from './serverConnectionToken.js';\nimport { IExtensionHostStatusService } from './extensionHostStatusService.js';\nimport { IUserDataProfilesService } from '../../platform/userDataProfile/common/userDataProfile.js';\nimport { joinPath } from '../../base/common/resources.js';\n\nexport class RemoteAgentEnvironmentChannel implements IServerChannel {\n\n\tprivate static _namePool = 1;\n\n\tconstructor(\n\t\tprivate readonly _connectionToken: ServerConnectionToken,\n\t\tprivate readonly _environmentService: IServerEnvironmentService,\n\t\tprivate readonly _userDataProfilesService: IUserDataProfilesService,\n\t\tprivate readonly _extensionHostStatusService: IExtensionHostStatusService,\n\t) {\n\t}\n\n\tasync call(_: any, command: string, arg?: any): Promise<any> {\n\t\tswitch (command) {\n\n\t\t\tcase 'getEnvironmentData': {\n\t\t\t\tconst args = <IGetEnvironmentDataArguments>arg;\n\t\t\t\tconst uriTransformer = createURITransformer(args.remoteAuthority);\n\n\t\t\t\tlet environmentData = await this._getEnvironmentData(args.profile);\n\t\t\t\tenvironmentData = transformOutgoingURIs(environmentData, uriTransformer);\n\n\t\t\t\treturn environmentData;\n\t\t\t}\n\n\t\t\tcase 'getExtensionHostExitInfo': {\n\t\t\t\tconst args = <IGetExtensionHostExitInfoArguments>arg;\n\t\t\t\treturn this._extensionHostStatusService.getExitInfo(args.reconnectionToken);\n\t\t\t}\n\n\t\t\tcase 'getDiagnosticInfo': {\n\t\t\t\tconst options = <IDiagnosticInfoOptions>arg;\n\t\t\t\tconst diagnosticInfo: IDiagnosticInfo = {\n\t\t\t\t\tmachineInfo: getMachineInfo()\n\t\t\t\t};\n\n\t\t\t\tconst processesPromise: Promise<ProcessItem | void> = options.includeProcesses ? listProcesses(process.pid) : Promise.resolve();\n\n\t\t\t\tlet workspaceMetadataPromises: Promise<void>[] = [];\n\t\t\t\tconst workspaceMetadata: { [key: string]: any } = {};\n\t\t\t\tif (options.folders) {\n\t\t\t\t\t// only incoming paths are transformed, so remote authority is unneeded.\n\t\t\t\t\tconst uriTransformer = createURITransformer('');\n\t\t\t\t\tconst folderPaths = options.folders\n\t\t\t\t\t\t.map(folder => URI.revive(uriTransformer.transformIncoming(folder)))\n\t\t\t\t\t\t.filter(uri => uri.scheme === 'file');\n\n\t\t\t\t\tworkspaceMetadataPromises = folderPaths.map(folder => {\n\t\t\t\t\t\treturn collectWorkspaceStats(folder.fsPath, ['node_modules', '.git'])\n\t\t\t\t\t\t\t.then(stats => {\n\t\t\t\t\t\t\t\tworkspaceMetadata[basename(folder.fsPath)] = stats;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn Promise.all([processesPromise, ...workspaceMetadataPromises]).then(([processes, _]) => {\n\t\t\t\t\tdiagnosticInfo.processes = processes || undefined;\n\t\t\t\t\tdiagnosticInfo.workspaceMetadata = options.folders ? workspaceMetadata : undefined;\n\t\t\t\t\treturn diagnosticInfo;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(`IPC Command ${command} not found`);\n\t}\n\n\tlisten(_: any, event: string, arg: any): Event<any> {\n\t\tthrow new Error('Not supported');\n\t}\n\n\tprivate async _getEnvironmentData(profile?: string): Promise<IRemoteAgentEnvironmentDTO> {\n\t\tif (profile && !this._userDataProfilesService.profiles.some(p => p.id === profile)) {\n\t\t\tawait this._userDataProfilesService.createProfile(profile, profile);\n\t\t}\n\t\ttype ProcessWithGlibc = NodeJS.Process & {\n\t\t\tglibcVersion?: string;\n\t\t};\n\t\tlet isUnsupportedGlibc = false;\n\t\tif (process.platform === 'linux') {\n\t\t\tconst glibcVersion = (process as ProcessWithGlibc).glibcVersion;\n\t\t\tconst minorVersion = glibcVersion ? parseInt(glibcVersion.split('.')[1]) : 28;\n\t\t\tisUnsupportedGlibc = (minorVersion <= 27) || !!process.env['VSCODE_SERVER_CUSTOM_GLIBC_LINKER'];\n\t\t}\n\t\treturn {\n\t\t\tpid: process.pid,\n\t\t\tconnectionToken: (this._connectionToken.type !== ServerConnectionTokenType.None ? this._connectionToken.value : ''),\n\t\t\tappRoot: URI.file(this._environmentService.appRoot),\n\t\t\tsettingsPath: this._environmentService.machineSettingsResource,\n\t\t\tmcpResource: this._environmentService.mcpResource,\n\t\t\tlogsPath: this._environmentService.logsHome,\n\t\t\textensionHostLogsPath: joinPath(this._environmentService.logsHome, `exthost${RemoteAgentEnvironmentChannel._namePool++}`),\n\t\t\tglobalStorageHome: this._userDataProfilesService.defaultProfile.globalStorageHome,\n\t\t\tworkspaceStorageHome: this._environmentService.workspaceStorageHome,\n\t\t\tlocalHistoryHome: this._environmentService.localHistoryHome,\n\t\t\tuserHome: this._environmentService.userHome,\n\t\t\tos: platform.OS,\n\t\t\tarch: process.arch,\n\t\t\tmarks: performance.getMarks(),\n\t\t\tuseHostProxy: !!this._environmentService.args['use-host-proxy'],\n\t\t\tprofiles: {\n\t\t\t\thome: this._userDataProfilesService.profilesHome,\n\t\t\t\tall: [...this._userDataProfilesService.profiles].map(profile => ({ ...profile }))\n\t\t\t},\n\t\t\tisUnsupportedGlibc\n\t\t};\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { DiskFileSystemProvider } from './diskFileSystemProvider.js';\nimport { Disposable, dispose, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IURITransformer } from '../../../base/common/uriIpc.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { ReadableStreamEventPayload, listenStream } from '../../../base/common/stream.js';\nimport { IStat, IFileReadStreamOptions, IFileWriteOptions, IFileOpenOptions, IFileDeleteOptions, IFileOverwriteOptions, IFileChange, IWatchOptions, FileType, IFileAtomicReadOptions } from '../common/files.js';\nimport { CancellationTokenSource } from '../../../base/common/cancellation.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { IRecursiveWatcherOptions } from '../common/watcher.js';\n\nexport interface ISessionFileWatcher extends IDisposable {\n\twatch(req: number, resource: URI, opts: IWatchOptions): IDisposable;\n}\n\n/**\n * A server implementation for a IPC based file system provider client.\n */\nexport abstract class AbstractDiskFileSystemProviderChannel<T> extends Disposable implements IServerChannel<T> {\n\n\tconstructor(\n\t\tprotected readonly provider: DiskFileSystemProvider,\n\t\tprotected readonly logService: ILogService\n\t) {\n\t\tsuper();\n\t}\n\n\tcall(ctx: T, command: string, arg?: any): Promise<any> {\n\t\tconst uriTransformer = this.getUriTransformer(ctx);\n\n\t\tswitch (command) {\n\t\t\tcase 'stat': return this.stat(uriTransformer, arg[0]);\n\t\t\tcase 'realpath': return this.realpath(uriTransformer, arg[0]);\n\t\t\tcase 'readdir': return this.readdir(uriTransformer, arg[0]);\n\t\t\tcase 'open': return this.open(uriTransformer, arg[0], arg[1]);\n\t\t\tcase 'close': return this.close(arg[0]);\n\t\t\tcase 'read': return this.read(arg[0], arg[1], arg[2]);\n\t\t\tcase 'readFile': return this.readFile(uriTransformer, arg[0], arg[1]);\n\t\t\tcase 'write': return this.write(arg[0], arg[1], arg[2], arg[3], arg[4]);\n\t\t\tcase 'writeFile': return this.writeFile(uriTransformer, arg[0], arg[1], arg[2]);\n\t\t\tcase 'rename': return this.rename(uriTransformer, arg[0], arg[1], arg[2]);\n\t\t\tcase 'copy': return this.copy(uriTransformer, arg[0], arg[1], arg[2]);\n\t\t\tcase 'cloneFile': return this.cloneFile(uriTransformer, arg[0], arg[1]);\n\t\t\tcase 'mkdir': return this.mkdir(uriTransformer, arg[0]);\n\t\t\tcase 'delete': return this.delete(uriTransformer, arg[0], arg[1]);\n\t\t\tcase 'watch': return this.watch(uriTransformer, arg[0], arg[1], arg[2], arg[3]);\n\t\t\tcase 'unwatch': return this.unwatch(arg[0], arg[1]);\n\t\t}\n\n\t\tthrow new Error(`IPC Command ${command} not found`);\n\t}\n\n\tlisten(ctx: T, event: string, arg: any): Event<any> {\n\t\tconst uriTransformer = this.getUriTransformer(ctx);\n\n\t\tswitch (event) {\n\t\t\tcase 'fileChange': return this.onFileChange(uriTransformer, arg[0]);\n\t\t\tcase 'readFileStream': return this.onReadFileStream(uriTransformer, arg[0], arg[1]);\n\t\t}\n\n\t\tthrow new Error(`Unknown event ${event}`);\n\t}\n\n\tprotected abstract getUriTransformer(ctx: T): IURITransformer;\n\n\tprotected abstract transformIncoming(uriTransformer: IURITransformer, _resource: UriComponents, supportVSCodeResource?: boolean): URI;\n\n\t//#region File Metadata Resolving\n\n\tprivate stat(uriTransformer: IURITransformer, _resource: UriComponents): Promise<IStat> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource, true);\n\n\t\treturn this.provider.stat(resource);\n\t}\n\n\tprivate realpath(uriTransformer: IURITransformer, _resource: UriComponents): Promise<string> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource, true);\n\n\t\treturn this.provider.realpath(resource);\n\t}\n\n\tprivate readdir(uriTransformer: IURITransformer, _resource: UriComponents): Promise<[string, FileType][]> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource);\n\n\t\treturn this.provider.readdir(resource);\n\t}\n\n\t//#endregion\n\n\t//#region File Reading/Writing\n\n\tprivate async readFile(uriTransformer: IURITransformer, _resource: UriComponents, opts?: IFileAtomicReadOptions): Promise<VSBuffer> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource, true);\n\t\tthis.logService.trace(`File action: readFile ${resource.path}`);\n\t\tconst buffer = await this.provider.readFile(resource, opts);\n\n\t\treturn VSBuffer.wrap(buffer);\n\t}\n\n\tprivate onReadFileStream(uriTransformer: IURITransformer, _resource: URI, opts: IFileReadStreamOptions): Event<ReadableStreamEventPayload<VSBuffer>> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource, true);\n\t\tconst cts = new CancellationTokenSource();\n\n\t\tconst emitter = new Emitter<ReadableStreamEventPayload<VSBuffer>>({\n\t\t\tonDidRemoveLastListener: () => {\n\n\t\t\t\t// Ensure to cancel the read operation when there is no more\n\t\t\t\t// listener on the other side to prevent unneeded work.\n\t\t\t\tcts.cancel();\n\t\t\t}\n\t\t});\n\n\t\tthis.logService.trace(`File action: readFileStream ${resource.path}`);\n\t\tconst fileStream = this.provider.readFileStream(resource, opts, cts.token);\n\t\tlistenStream(fileStream, {\n\t\t\tonData: chunk => emitter.fire(VSBuffer.wrap(chunk)),\n\t\t\tonError: error => emitter.fire(error),\n\t\t\tonEnd: () => {\n\n\t\t\t\t// Forward event\n\t\t\t\temitter.fire('end');\n\n\t\t\t\t// Cleanup\n\t\t\t\temitter.dispose();\n\t\t\t\tcts.dispose();\n\t\t\t}\n\t\t});\n\n\t\treturn emitter.event;\n\t}\n\n\tprivate writeFile(uriTransformer: IURITransformer, _resource: UriComponents, content: VSBuffer, opts: IFileWriteOptions): Promise<void> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource);\n\t\tthis.logService.trace(`File action: writeFile ${resource.path}`);\n\t\treturn this.provider.writeFile(resource, content.buffer, opts);\n\t}\n\n\tprivate open(uriTransformer: IURITransformer, _resource: UriComponents, opts: IFileOpenOptions): Promise<number> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource, true);\n\n\t\treturn this.provider.open(resource, opts);\n\t}\n\n\tprivate close(fd: number): Promise<void> {\n\t\treturn this.provider.close(fd);\n\t}\n\n\tprivate async read(fd: number, pos: number, length: number): Promise<[VSBuffer, number]> {\n\t\tconst buffer = VSBuffer.alloc(length);\n\t\tconst bufferOffset = 0; // offset is 0 because we create a buffer to read into for each call\n\t\tconst bytesRead = await this.provider.read(fd, pos, buffer.buffer, bufferOffset, length);\n\n\t\treturn [buffer, bytesRead];\n\t}\n\n\tprivate write(fd: number, pos: number, data: VSBuffer, offset: number, length: number): Promise<number> {\n\t\treturn this.provider.write(fd, pos, data.buffer, offset, length);\n\t}\n\n\t//#endregion\n\n\t//#region Move/Copy/Delete/Create Folder\n\n\tprivate mkdir(uriTransformer: IURITransformer, _resource: UriComponents): Promise<void> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource);\n\n\t\treturn this.provider.mkdir(resource);\n\t}\n\n\tprotected delete(uriTransformer: IURITransformer, _resource: UriComponents, opts: IFileDeleteOptions): Promise<void> {\n\t\tconst resource = this.transformIncoming(uriTransformer, _resource);\n\n\t\treturn this.provider.delete(resource, opts);\n\t}\n\n\tprivate rename(uriTransformer: IURITransformer, _source: UriComponents, _target: UriComponents, opts: IFileOverwriteOptions): Promise<void> {\n\t\tconst source = this.transformIncoming(uriTransformer, _source);\n\t\tconst target = this.transformIncoming(uriTransformer, _target);\n\n\t\treturn this.provider.rename(source, target, opts);\n\t}\n\n\tprivate copy(uriTransformer: IURITransformer, _source: UriComponents, _target: UriComponents, opts: IFileOverwriteOptions): Promise<void> {\n\t\tconst source = this.transformIncoming(uriTransformer, _source);\n\t\tconst target = this.transformIncoming(uriTransformer, _target);\n\n\t\treturn this.provider.copy(source, target, opts);\n\t}\n\n\t//#endregion\n\n\t//#region Clone File\n\n\tprivate cloneFile(uriTransformer: IURITransformer, _source: UriComponents, _target: UriComponents): Promise<void> {\n\t\tconst source = this.transformIncoming(uriTransformer, _source);\n\t\tconst target = this.transformIncoming(uriTransformer, _target);\n\n\t\treturn this.provider.cloneFile(source, target);\n\t}\n\n\t//#endregion\n\n\t//#region File Watching\n\n\tprivate readonly sessionToWatcher = new Map<string /* session ID */, ISessionFileWatcher>();\n\tprivate readonly watchRequests = new Map<string /* session ID + request ID */, IDisposable>();\n\n\tprivate onFileChange(uriTransformer: IURITransformer, sessionId: string): Event<IFileChange[] | string> {\n\n\t\t// We want a specific emitter for the given session so that events\n\t\t// from the one session do not end up on the other session. As such\n\t\t// we create a `SessionFileWatcher` and a `Emitter` for that session.\n\n\t\tconst emitter = new Emitter<IFileChange[] | string>({\n\t\t\tonWillAddFirstListener: () => {\n\t\t\t\tthis.sessionToWatcher.set(sessionId, this.createSessionFileWatcher(uriTransformer, emitter));\n\t\t\t},\n\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\tdispose(this.sessionToWatcher.get(sessionId));\n\t\t\t\tthis.sessionToWatcher.delete(sessionId);\n\t\t\t}\n\t\t});\n\n\t\treturn emitter.event;\n\t}\n\n\tprivate async watch(uriTransformer: IURITransformer, sessionId: string, req: number, _resource: UriComponents, opts: IWatchOptions): Promise<void> {\n\t\tconst watcher = this.sessionToWatcher.get(sessionId);\n\t\tif (watcher) {\n\t\t\tconst resource = this.transformIncoming(uriTransformer, _resource);\n\t\t\tconst disposable = watcher.watch(req, resource, opts);\n\t\t\tthis.watchRequests.set(sessionId + req, disposable);\n\t\t}\n\t}\n\n\tprivate async unwatch(sessionId: string, req: number): Promise<void> {\n\t\tconst id = sessionId + req;\n\t\tconst disposable = this.watchRequests.get(id);\n\t\tif (disposable) {\n\t\t\tdispose(disposable);\n\t\t\tthis.watchRequests.delete(id);\n\t\t}\n\t}\n\n\tprotected abstract createSessionFileWatcher(uriTransformer: IURITransformer, emitter: Emitter<IFileChange[] | string>): ISessionFileWatcher;\n\n\t//#endregion\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\n\t\tfor (const [, disposable] of this.watchRequests) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t\tthis.watchRequests.clear();\n\n\t\tfor (const [, disposable] of this.sessionToWatcher) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t\tthis.sessionToWatcher.clear();\n\t}\n}\n\nexport abstract class AbstractSessionFileWatcher extends Disposable implements ISessionFileWatcher {\n\n\tprivate readonly watcherRequests = new Map<number, IDisposable>();\n\n\t// To ensure we use one file watcher per session, we keep a\n\t// disk file system provider instantiated for this session.\n\t// The provider is cheap and only stateful when file watching\n\t// starts.\n\t//\n\t// This is important because we want to ensure that we only\n\t// forward events from the watched paths for this session and\n\t// not other clients that asked to watch other paths.\n\tprivate readonly fileWatcher: DiskFileSystemProvider;\n\n\tconstructor(\n\t\tprivate readonly uriTransformer: IURITransformer,\n\t\tsessionEmitter: Emitter<IFileChange[] | string>,\n\t\tlogService: ILogService,\n\t\tprivate readonly environmentService: IEnvironmentService\n\t) {\n\t\tsuper();\n\n\t\tthis.fileWatcher = this._register(new DiskFileSystemProvider(logService));\n\n\t\tthis.registerListeners(sessionEmitter);\n\t}\n\n\tprivate registerListeners(sessionEmitter: Emitter<IFileChange[] | string>): void {\n\t\tconst localChangeEmitter = this._register(new Emitter<readonly IFileChange[]>());\n\n\t\tthis._register(localChangeEmitter.event((events) => {\n\t\t\tsessionEmitter.fire(\n\t\t\t\tevents.map(e => ({\n\t\t\t\t\tresource: this.uriTransformer.transformOutgoingURI(e.resource),\n\t\t\t\t\ttype: e.type,\n\t\t\t\t\tcId: e.cId\n\t\t\t\t}))\n\t\t\t);\n\t\t}));\n\n\t\tthis._register(this.fileWatcher.onDidChangeFile(events => localChangeEmitter.fire(events)));\n\t\tthis._register(this.fileWatcher.onDidWatchError(error => sessionEmitter.fire(error)));\n\t}\n\n\tprotected getRecursiveWatcherOptions(environmentService: IEnvironmentService): IRecursiveWatcherOptions | undefined {\n\t\treturn undefined; // subclasses can override\n\t}\n\n\tprotected getExtraExcludes(environmentService: IEnvironmentService): string[] | undefined {\n\t\treturn undefined; // subclasses can override\n\t}\n\n\twatch(req: number, resource: URI, opts: IWatchOptions): IDisposable {\n\t\tconst extraExcludes = this.getExtraExcludes(this.environmentService);\n\t\tif (Array.isArray(extraExcludes)) {\n\t\t\topts.excludes = [...opts.excludes, ...extraExcludes];\n\t\t}\n\n\t\tthis.watcherRequests.set(req, this.fileWatcher.watch(resource, opts));\n\n\t\treturn toDisposable(() => {\n\t\t\tdispose(this.watcherRequests.get(req));\n\t\t\tthis.watcherRequests.delete(req);\n\t\t});\n\t}\n\n\toverride dispose(): void {\n\t\tfor (const [, disposable] of this.watcherRequests) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t\tthis.watcherRequests.clear();\n\n\t\tsuper.dispose();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter } from '../../base/common/event.js';\nimport { URI, UriComponents } from '../../base/common/uri.js';\nimport { IURITransformer } from '../../base/common/uriIpc.js';\nimport { IFileChange } from '../../platform/files/common/files.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { createURITransformer } from '../../workbench/api/node/uriTransformer.js';\nimport { RemoteAgentConnectionContext } from '../../platform/remote/common/remoteAgentEnvironment.js';\nimport { DiskFileSystemProvider } from '../../platform/files/node/diskFileSystemProvider.js';\nimport { posix, delimiter } from '../../base/common/path.js';\nimport { IServerEnvironmentService } from './serverEnvironmentService.js';\nimport { AbstractDiskFileSystemProviderChannel, AbstractSessionFileWatcher, ISessionFileWatcher } from '../../platform/files/node/diskFileSystemProviderServer.js';\nimport { IRecursiveWatcherOptions } from '../../platform/files/common/watcher.js';\nimport { IConfigurationService } from '../../platform/configuration/common/configuration.js';\n\nexport class RemoteAgentFileSystemProviderChannel extends AbstractDiskFileSystemProviderChannel<RemoteAgentConnectionContext> {\n\n\tprivate readonly uriTransformerCache = new Map<string, IURITransformer>();\n\n\tconstructor(\n\t\tlogService: ILogService,\n\t\tprivate readonly environmentService: IServerEnvironmentService,\n\t\tprivate readonly configurationService: IConfigurationService\n\t) {\n\t\tsuper(new DiskFileSystemProvider(logService), logService);\n\n\t\tthis._register(this.provider);\n\t}\n\n\tprotected override getUriTransformer(ctx: RemoteAgentConnectionContext): IURITransformer {\n\t\tlet transformer = this.uriTransformerCache.get(ctx.remoteAuthority);\n\t\tif (!transformer) {\n\t\t\ttransformer = createURITransformer(ctx.remoteAuthority);\n\t\t\tthis.uriTransformerCache.set(ctx.remoteAuthority, transformer);\n\t\t}\n\n\t\treturn transformer;\n\t}\n\n\tprotected override transformIncoming(uriTransformer: IURITransformer, _resource: UriComponents, supportVSCodeResource = false): URI {\n\t\tif (supportVSCodeResource && _resource.path === '/vscode-resource' && _resource.query) {\n\t\t\tconst requestResourcePath = JSON.parse(_resource.query).requestResourcePath;\n\n\t\t\treturn URI.from({ scheme: 'file', path: requestResourcePath });\n\t\t}\n\n\t\treturn URI.revive(uriTransformer.transformIncoming(_resource));\n\t}\n\n\t//#region File Watching\n\n\tprotected createSessionFileWatcher(uriTransformer: IURITransformer, emitter: Emitter<IFileChange[] | string>): ISessionFileWatcher {\n\t\treturn new SessionFileWatcher(uriTransformer, emitter, this.logService, this.environmentService, this.configurationService);\n\t}\n\n\t//#endregion\n}\n\nclass SessionFileWatcher extends AbstractSessionFileWatcher {\n\n\tconstructor(\n\t\turiTransformer: IURITransformer,\n\t\tsessionEmitter: Emitter<IFileChange[] | string>,\n\t\tlogService: ILogService,\n\t\tenvironmentService: IServerEnvironmentService,\n\t\tconfigurationService: IConfigurationService\n\t) {\n\t\tsuper(uriTransformer, sessionEmitter, logService, environmentService);\n\t}\n\n\tprotected override getRecursiveWatcherOptions(environmentService: IServerEnvironmentService): IRecursiveWatcherOptions | undefined {\n\t\tconst fileWatcherPolling = environmentService.args['file-watcher-polling'];\n\t\tif (fileWatcherPolling) {\n\t\t\tconst segments = fileWatcherPolling.split(delimiter);\n\t\t\tconst pollingInterval = Number(segments[0]);\n\t\t\tif (pollingInterval > 0) {\n\t\t\t\tconst usePolling = segments.length > 1 ? segments.slice(1) : true;\n\t\t\t\treturn { usePolling, pollingInterval };\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tprotected override getExtraExcludes(environmentService: IServerEnvironmentService): string[] | undefined {\n\t\tif (environmentService.extensionsPath) {\n\t\t\t// when opening the $HOME folder, we end up watching the extension folder\n\t\t\t// so simply exclude watching the extensions folder\n\t\t\treturn [posix.join(environmentService.extensionsPath, '**')];\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { TelemetryLevel } from './telemetry.js';\nimport { ITelemetryAppender } from './telemetryUtils.js';\nimport { IServerTelemetryService } from './serverTelemetryService.js';\n\nexport class ServerTelemetryChannel extends Disposable implements IServerChannel {\n\tconstructor(\n\t\tprivate readonly telemetryService: IServerTelemetryService,\n\t\tprivate readonly telemetryAppender: ITelemetryAppender | null\n\t) {\n\t\tsuper();\n\t}\n\n\n\tasync call(_: any, command: string, arg?: any): Promise<any> {\n\t\tswitch (command) {\n\t\t\tcase 'updateTelemetryLevel': {\n\t\t\t\tconst { telemetryLevel } = arg;\n\t\t\t\treturn this.telemetryService.updateInjectedTelemetryLevel(telemetryLevel);\n\t\t\t}\n\n\t\t\tcase 'logTelemetry': {\n\t\t\t\tconst { eventName, data } = arg;\n\t\t\t\t// Logging is done directly to the appender instead of through the telemetry service\n\t\t\t\t// as the data sent from the client has already had common properties added to it and\n\t\t\t\t// has already been sent to the telemetry output channel\n\t\t\t\tif (this.telemetryAppender) {\n\t\t\t\t\treturn this.telemetryAppender.log(eventName, data);\n\t\t\t\t}\n\n\t\t\t\treturn Promise.resolve();\n\t\t\t}\n\n\t\t\tcase 'flushTelemetry': {\n\t\t\t\tif (this.telemetryAppender) {\n\t\t\t\t\treturn this.telemetryAppender.flush();\n\t\t\t\t}\n\n\t\t\t\treturn Promise.resolve();\n\t\t\t}\n\n\t\t\tcase 'ping': {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// Command we cannot handle so we throw an error\n\t\tthrow new Error(`IPC Command ${command} not found`);\n\t}\n\n\tlisten(_: any, event: string, arg: any): Event<any> {\n\t\tthrow new Error('Not supported');\n\t}\n\n\t/**\n\t * Disposing the channel also disables the telemetryService as there is\n\t * no longer a way to control it\n\t */\n\tpublic override dispose(): void {\n\t\tthis.telemetryService.updateInjectedTelemetryLevel(TelemetryLevel.NONE);\n\t\tsuper.dispose();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { DisposableStore } from '../../../base/common/lifecycle.js';\nimport { mixin } from '../../../base/common/objects.js';\nimport { isWeb } from '../../../base/common/platform.js';\nimport { escapeRegExpCharacters } from '../../../base/common/strings.js';\nimport { localize } from '../../../nls.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { ConfigurationScope, Extensions, IConfigurationRegistry } from '../../configuration/common/configurationRegistry.js';\nimport product from '../../product/common/product.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport { ClassifiedEvent, IGDPRProperty, OmitMetadata, StrictPropertyCheck } from './gdprTypings.js';\nimport { ITelemetryData, ITelemetryService, TelemetryConfiguration, TelemetryLevel, TELEMETRY_CRASH_REPORTER_SETTING_ID, TELEMETRY_OLD_SETTING_ID, TELEMETRY_SECTION_ID, TELEMETRY_SETTING_ID, ICommonProperties } from './telemetry.js';\nimport { cleanData, getTelemetryLevel, ITelemetryAppender } from './telemetryUtils.js';\n\nexport interface ITelemetryServiceConfig {\n\tappenders: ITelemetryAppender[];\n\tsendErrorTelemetry?: boolean;\n\tcommonProperties?: ICommonProperties;\n\tpiiPaths?: string[];\n}\n\nexport class TelemetryService implements ITelemetryService {\n\n\tstatic readonly IDLE_START_EVENT_NAME = 'UserIdleStart';\n\tstatic readonly IDLE_STOP_EVENT_NAME = 'UserIdleStop';\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\treadonly sessionId: string;\n\treadonly machineId: string;\n\treadonly sqmId: string;\n\treadonly devDeviceId: string;\n\treadonly firstSessionDate: string;\n\treadonly msftInternal: boolean | undefined;\n\n\tprivate _appenders: ITelemetryAppender[];\n\tprivate _commonProperties: ICommonProperties;\n\tprivate _experimentProperties: { [name: string]: string } = {};\n\tprivate _piiPaths: string[];\n\tprivate _telemetryLevel: TelemetryLevel;\n\tprivate _sendErrorTelemetry: boolean;\n\n\tprivate readonly _disposables = new DisposableStore();\n\tprivate _cleanupPatterns: RegExp[] = [];\n\n\tconstructor(\n\t\tconfig: ITelemetryServiceConfig,\n\t\t@IConfigurationService private _configurationService: IConfigurationService,\n\t\t@IProductService private _productService: IProductService\n\t) {\n\t\tthis._appenders = config.appenders;\n\t\tthis._commonProperties = config.commonProperties ?? Object.create(null);\n\n\t\tthis.sessionId = this._commonProperties['sessionID'] as string;\n\t\tthis.machineId = this._commonProperties['common.machineId'] as string;\n\t\tthis.sqmId = this._commonProperties['common.sqmId'] as string;\n\t\tthis.devDeviceId = this._commonProperties['common.devDeviceId'] as string;\n\t\tthis.firstSessionDate = this._commonProperties['common.firstSessionDate'] as string;\n\t\tthis.msftInternal = this._commonProperties['common.msftInternal'] as boolean | undefined;\n\n\t\tthis._piiPaths = config.piiPaths || [];\n\t\tthis._telemetryLevel = TelemetryLevel.USAGE;\n\t\tthis._sendErrorTelemetry = !!config.sendErrorTelemetry;\n\n\t\t// static cleanup pattern for: `vscode-file:///DANGEROUS/PATH/resources/app/Useful/Information`\n\t\tthis._cleanupPatterns = [/(vscode-)?file:\\/\\/\\/.*?\\/resources\\/app\\//gi];\n\n\t\tfor (const piiPath of this._piiPaths) {\n\t\t\tthis._cleanupPatterns.push(new RegExp(escapeRegExpCharacters(piiPath), 'gi'));\n\n\t\t\tif (piiPath.indexOf('\\\\') >= 0) {\n\t\t\t\tthis._cleanupPatterns.push(new RegExp(escapeRegExpCharacters(piiPath.replace(/\\\\/g, '/')), 'gi'));\n\t\t\t}\n\t\t}\n\n\t\tthis._updateTelemetryLevel();\n\t\tthis._disposables.add(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\t// Check on the telemetry settings and update the state if changed\n\t\t\tconst affectsTelemetryConfig =\n\t\t\t\te.affectsConfiguration(TELEMETRY_SETTING_ID)\n\t\t\t\t|| e.affectsConfiguration(TELEMETRY_OLD_SETTING_ID)\n\t\t\t\t|| e.affectsConfiguration(TELEMETRY_CRASH_REPORTER_SETTING_ID);\n\t\t\tif (affectsTelemetryConfig) {\n\t\t\t\tthis._updateTelemetryLevel();\n\t\t\t}\n\t\t}));\n\t}\n\n\tsetExperimentProperty(name: string, value: string): void {\n\t\tthis._experimentProperties[name] = value;\n\t}\n\n\tprivate _updateTelemetryLevel(): void {\n\t\tlet level = getTelemetryLevel(this._configurationService);\n\t\tconst collectableTelemetry = this._productService.enabledTelemetryLevels;\n\t\t// Also ensure that error telemetry is respecting the product configuration for collectable telemetry\n\t\tif (collectableTelemetry) {\n\t\t\tthis._sendErrorTelemetry = this.sendErrorTelemetry ? collectableTelemetry.error : false;\n\t\t\t// Make sure the telemetry level from the service is the minimum of the config and product\n\t\t\tconst maxCollectableTelemetryLevel = collectableTelemetry.usage ? TelemetryLevel.USAGE : collectableTelemetry.error ? TelemetryLevel.ERROR : TelemetryLevel.NONE;\n\t\t\tlevel = Math.min(level, maxCollectableTelemetryLevel);\n\t\t}\n\n\t\tthis._telemetryLevel = level;\n\t}\n\n\tget sendErrorTelemetry(): boolean {\n\t\treturn this._sendErrorTelemetry;\n\t}\n\n\tget telemetryLevel(): TelemetryLevel {\n\t\treturn this._telemetryLevel;\n\t}\n\n\tdispose(): void {\n\t\tthis._disposables.dispose();\n\t}\n\n\tprivate _log(eventName: string, eventLevel: TelemetryLevel, data?: ITelemetryData) {\n\t\t// don't send events when the user is optout\n\t\tif (this._telemetryLevel < eventLevel) {\n\t\t\treturn;\n\t\t}\n\n\t\t// add experiment properties\n\t\tdata = mixin(data, this._experimentProperties);\n\n\t\t// remove all PII from data\n\t\tdata = cleanData(data as Record<string, any>, this._cleanupPatterns);\n\n\t\t// add common properties\n\t\tdata = mixin(data, this._commonProperties);\n\n\t\t// Log to the appenders of sufficient level\n\t\tthis._appenders.forEach(a => a.log(eventName, data));\n\t}\n\n\tpublicLog(eventName: string, data?: ITelemetryData) {\n\t\tthis._log(eventName, TelemetryLevel.USAGE, data);\n\t}\n\n\tpublicLog2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>) {\n\t\tthis.publicLog(eventName, data as ITelemetryData);\n\t}\n\n\tpublicLogError(errorEventName: string, data?: ITelemetryData) {\n\t\tif (!this._sendErrorTelemetry) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Send error event and anonymize paths\n\t\tthis._log(errorEventName, TelemetryLevel.ERROR, data);\n\t}\n\n\tpublicLogError2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>) {\n\t\tthis.publicLogError(eventName, data as ITelemetryData);\n\t}\n}\n\nfunction getTelemetryLevelSettingDescription(): string {\n\tconst telemetryText = localize('telemetry.telemetryLevelMd', \"Controls {0} telemetry, first-party extension telemetry, and participating third-party extension telemetry. Some third party extensions might not respect this setting. Consult the specific extension's documentation to be sure. Telemetry helps us better understand how {0} is performing, where improvements need to be made, and how features are being used.\", product.nameLong);\n\tconst externalLinksStatement = !product.privacyStatementUrl ?\n\t\tlocalize(\"telemetry.docsStatement\", \"Read more about the [data we collect]({0}).\", 'https://aka.ms/vscode-telemetry') :\n\t\tlocalize(\"telemetry.docsAndPrivacyStatement\", \"Read more about the [data we collect]({0}) and our [privacy statement]({1}).\", 'https://aka.ms/vscode-telemetry', product.privacyStatementUrl);\n\tconst restartString = !isWeb ? localize('telemetry.restart', 'A full restart of the application is necessary for crash reporting changes to take effect.') : '';\n\n\tconst crashReportsHeader = localize('telemetry.crashReports', \"Crash Reports\");\n\tconst errorsHeader = localize('telemetry.errors', \"Error Telemetry\");\n\tconst usageHeader = localize('telemetry.usage', \"Usage Data\");\n\n\tconst telemetryTableDescription = localize('telemetry.telemetryLevel.tableDescription', \"The following table outlines the data sent with each setting:\");\n\tconst telemetryTable = `\n|       | ${crashReportsHeader} | ${errorsHeader} | ${usageHeader} |\n|:------|:-------------:|:---------------:|:----------:|\n| all   |       ✓       |        ✓        |     ✓      |\n| error |       ✓       |        ✓        |     -      |\n| crash |       ✓       |        -        |     -      |\n| off   |       -       |        -        |     -      |\n`;\n\n\tconst deprecatedSettingNote = localize('telemetry.telemetryLevel.deprecated', \"****Note:*** If this setting is 'off', no telemetry will be sent regardless of other telemetry settings. If this setting is set to anything except 'off' and telemetry is disabled with deprecated settings, no telemetry will be sent.*\");\n\tconst telemetryDescription = `\n${telemetryText} ${externalLinksStatement} ${restartString}\n\n&nbsp;\n\n${telemetryTableDescription}\n${telemetryTable}\n\n&nbsp;\n\n${deprecatedSettingNote}\n`;\n\n\treturn telemetryDescription;\n}\n\nconst configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);\nconfigurationRegistry.registerConfiguration({\n\t'id': TELEMETRY_SECTION_ID,\n\t'order': 1,\n\t'type': 'object',\n\t'title': localize('telemetryConfigurationTitle', \"Telemetry\"),\n\t'properties': {\n\t\t[TELEMETRY_SETTING_ID]: {\n\t\t\t'type': 'string',\n\t\t\t'enum': [TelemetryConfiguration.ON, TelemetryConfiguration.ERROR, TelemetryConfiguration.CRASH, TelemetryConfiguration.OFF],\n\t\t\t'enumDescriptions': [\n\t\t\t\tlocalize('telemetry.telemetryLevel.default', \"Sends usage data, errors, and crash reports.\"),\n\t\t\t\tlocalize('telemetry.telemetryLevel.error', \"Sends general error telemetry and crash reports.\"),\n\t\t\t\tlocalize('telemetry.telemetryLevel.crash', \"Sends OS level crash reports.\"),\n\t\t\t\tlocalize('telemetry.telemetryLevel.off', \"Disables all product telemetry.\")\n\t\t\t],\n\t\t\t'markdownDescription': getTelemetryLevelSettingDescription(),\n\t\t\t'default': TelemetryConfiguration.ON,\n\t\t\t'restricted': true,\n\t\t\t'scope': ConfigurationScope.APPLICATION,\n\t\t\t'tags': ['usesOnlineServices', 'telemetry'],\n\t\t\t'policy': {\n\t\t\t\tname: 'TelemetryLevel',\n\t\t\t\tminimumVersion: '1.99',\n\t\t\t\tdescription: localize('telemetry.telemetryLevel.policyDescription', \"Controls the level of telemetry.\"),\n\t\t\t}\n\t\t},\n\t\t'telemetry.feedback.enabled': {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t\tdescription: localize('telemetry.feedback.enabled', \"Enable feedback mechanisms such as the issue reporter, surveys, and feedback options in features like Copilot Chat.\"),\n\t\t\tpolicy: {\n\t\t\t\tname: 'EnableFeedback',\n\t\t\t\tminimumVersion: '1.99',\n\t\t\t}\n\t\t},\n\t\t// Deprecated telemetry setting\n\t\t[TELEMETRY_OLD_SETTING_ID]: {\n\t\t\t'type': 'boolean',\n\t\t\t'markdownDescription':\n\t\t\t\t!product.privacyStatementUrl ?\n\t\t\t\t\tlocalize('telemetry.enableTelemetry', \"Enable diagnostic data to be collected. This helps us to better understand how {0} is performing and where improvements need to be made.\", product.nameLong) :\n\t\t\t\t\tlocalize('telemetry.enableTelemetryMd', \"Enable diagnostic data to be collected. This helps us to better understand how {0} is performing and where improvements need to be made. [Read more]({1}) about what we collect and our privacy statement.\", product.nameLong, product.privacyStatementUrl),\n\t\t\t'default': true,\n\t\t\t'restricted': true,\n\t\t\t'markdownDeprecationMessage': localize('enableTelemetryDeprecated', \"If this setting is false, no telemetry will be sent regardless of the new setting's value. Deprecated in favor of the {0} setting.\", `\\`#${TELEMETRY_SETTING_ID}#\\``),\n\t\t\t'scope': ConfigurationScope.APPLICATION,\n\t\t\t'tags': ['usesOnlineServices', 'telemetry']\n\t\t}\n\t},\n});\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { refineServiceDecorator } from '../../instantiation/common/instantiation.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { ClassifiedEvent, IGDPRProperty, OmitMetadata, StrictPropertyCheck } from './gdprTypings.js';\nimport { ITelemetryData, ITelemetryService, TelemetryLevel } from './telemetry.js';\nimport { ITelemetryServiceConfig, TelemetryService } from './telemetryService.js';\nimport { NullTelemetryServiceShape } from './telemetryUtils.js';\n\nexport interface IServerTelemetryService extends ITelemetryService {\n\tupdateInjectedTelemetryLevel(telemetryLevel: TelemetryLevel): Promise<void>;\n}\n\nexport class ServerTelemetryService extends TelemetryService implements IServerTelemetryService {\n\t// Because we cannot read the workspace config on the remote site\n\t// the ServerTelemetryService is responsible for knowing its telemetry level\n\t// this is done through IPC calls and initial value injections\n\tprivate _injectedTelemetryLevel: TelemetryLevel;\n\tconstructor(\n\t\tconfig: ITelemetryServiceConfig,\n\t\tinjectedTelemetryLevel: TelemetryLevel,\n\t\t@IConfigurationService _configurationService: IConfigurationService,\n\t\t@IProductService _productService: IProductService\n\t) {\n\t\tsuper(config, _configurationService, _productService);\n\t\tthis._injectedTelemetryLevel = injectedTelemetryLevel;\n\t}\n\n\toverride publicLog(eventName: string, data?: ITelemetryData) {\n\t\tif (this._injectedTelemetryLevel < TelemetryLevel.USAGE) {\n\t\t\treturn;\n\t\t}\n\t\treturn super.publicLog(eventName, data);\n\t}\n\n\toverride publicLog2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>) {\n\t\treturn this.publicLog(eventName, data as ITelemetryData | undefined);\n\t}\n\n\toverride publicLogError(errorEventName: string, data?: ITelemetryData) {\n\t\tif (this._injectedTelemetryLevel < TelemetryLevel.ERROR) {\n\t\t\treturn Promise.resolve(undefined);\n\t\t}\n\t\treturn super.publicLogError(errorEventName, data);\n\t}\n\n\toverride publicLogError2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>) {\n\t\treturn this.publicLogError(eventName, data as ITelemetryData | undefined);\n\t}\n\n\tasync updateInjectedTelemetryLevel(telemetryLevel: TelemetryLevel): Promise<void> {\n\t\tif (telemetryLevel === undefined) {\n\t\t\tthis._injectedTelemetryLevel = TelemetryLevel.NONE;\n\t\t\tthrow new Error('Telemetry level cannot be undefined. This will cause infinite looping!');\n\t\t}\n\t\t// We always take the most restrictive level because we don't want multiple clients to connect and send data when one client does not consent\n\t\tthis._injectedTelemetryLevel = this._injectedTelemetryLevel ? Math.min(this._injectedTelemetryLevel, telemetryLevel) : telemetryLevel;\n\t\tif (this._injectedTelemetryLevel === TelemetryLevel.NONE) {\n\t\t\tthis.dispose();\n\t\t}\n\t}\n}\n\nexport const ServerNullTelemetryService = new class extends NullTelemetryServiceShape implements IServerTelemetryService {\n\tasync updateInjectedTelemetryLevel(): Promise<void> { return; } // No-op, telemetry is already disabled\n};\n\nexport const IServerTelemetryService = refineServiceDecorator<ITelemetryService, IServerTelemetryService>(ITelemetryService);\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { extname } from './path.js';\n\nexport const Mimes = Object.freeze({\n\ttext: 'text/plain',\n\tbinary: 'application/octet-stream',\n\tunknown: 'application/unknown',\n\tmarkdown: 'text/markdown',\n\tlatex: 'text/latex',\n\turiList: 'text/uri-list',\n\thtml: 'text/html',\n});\n\ninterface MapExtToMediaMimes {\n\t[index: string]: string;\n}\n\nconst mapExtToTextMimes: MapExtToMediaMimes = {\n\t'.css': 'text/css',\n\t'.csv': 'text/csv',\n\t'.htm': 'text/html',\n\t'.html': 'text/html',\n\t'.ics': 'text/calendar',\n\t'.js': 'text/javascript',\n\t'.mjs': 'text/javascript',\n\t'.txt': 'text/plain',\n\t'.xml': 'text/xml'\n};\n\n// Known media mimes that we can handle\nconst mapExtToMediaMimes: MapExtToMediaMimes = {\n\t'.aac': 'audio/x-aac',\n\t'.avi': 'video/x-msvideo',\n\t'.bmp': 'image/bmp',\n\t'.flv': 'video/x-flv',\n\t'.gif': 'image/gif',\n\t'.ico': 'image/x-icon',\n\t'.jpe': 'image/jpg',\n\t'.jpeg': 'image/jpg',\n\t'.jpg': 'image/jpg',\n\t'.m1v': 'video/mpeg',\n\t'.m2a': 'audio/mpeg',\n\t'.m2v': 'video/mpeg',\n\t'.m3a': 'audio/mpeg',\n\t'.mid': 'audio/midi',\n\t'.midi': 'audio/midi',\n\t'.mk3d': 'video/x-matroska',\n\t'.mks': 'video/x-matroska',\n\t'.mkv': 'video/x-matroska',\n\t'.mov': 'video/quicktime',\n\t'.movie': 'video/x-sgi-movie',\n\t'.mp2': 'audio/mpeg',\n\t'.mp2a': 'audio/mpeg',\n\t'.mp3': 'audio/mpeg',\n\t'.mp4': 'video/mp4',\n\t'.mp4a': 'audio/mp4',\n\t'.mp4v': 'video/mp4',\n\t'.mpe': 'video/mpeg',\n\t'.mpeg': 'video/mpeg',\n\t'.mpg': 'video/mpeg',\n\t'.mpg4': 'video/mp4',\n\t'.mpga': 'audio/mpeg',\n\t'.oga': 'audio/ogg',\n\t'.ogg': 'audio/ogg',\n\t'.opus': 'audio/opus',\n\t'.ogv': 'video/ogg',\n\t'.png': 'image/png',\n\t'.psd': 'image/vnd.adobe.photoshop',\n\t'.qt': 'video/quicktime',\n\t'.spx': 'audio/ogg',\n\t'.svg': 'image/svg+xml',\n\t'.tga': 'image/x-tga',\n\t'.tif': 'image/tiff',\n\t'.tiff': 'image/tiff',\n\t'.wav': 'audio/x-wav',\n\t'.webm': 'video/webm',\n\t'.webp': 'image/webp',\n\t'.wma': 'audio/x-ms-wma',\n\t'.wmv': 'video/x-ms-wmv',\n\t'.woff': 'application/font-woff',\n};\n\nexport function getMediaOrTextMime(path: string): string | undefined {\n\tconst ext = extname(path);\n\tconst textMime = mapExtToTextMimes[ext.toLowerCase()];\n\tif (textMime !== undefined) {\n\t\treturn textMime;\n\t} else {\n\t\treturn getMediaMime(path);\n\t}\n}\n\nexport function getMediaMime(path: string): string | undefined {\n\tconst ext = extname(path);\n\treturn mapExtToMediaMimes[ext.toLowerCase()];\n}\n\nexport function getExtensionForMimeType(mimeType: string): string | undefined {\n\tfor (const extension in mapExtToMediaMimes) {\n\t\tif (mapExtToMediaMimes[extension] === mimeType) {\n\t\t\treturn extension;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nconst _simplePattern = /^(.+)\\/(.+?)(;.+)?$/;\n\nexport function normalizeMimeType(mimeType: string): string;\nexport function normalizeMimeType(mimeType: string, strict: true): string | undefined;\nexport function normalizeMimeType(mimeType: string, strict?: true): string | undefined {\n\n\tconst match = _simplePattern.exec(mimeType);\n\tif (!match) {\n\t\treturn strict\n\t\t\t? undefined\n\t\t\t: mimeType;\n\t}\n\t// https://datatracker.ietf.org/doc/html/rfc2045#section-5.1\n\t// media and subtype must ALWAYS be lowercase, parameter not\n\treturn `${match[1].toLowerCase()}/${match[2].toLowerCase()}${match[3] ?? ''}`;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ErrorNoTelemetry } from '../../../base/common/errors.js';\nimport { Event } from '../../../base/common/event.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const IRemoteAuthorityResolverService = createDecorator<IRemoteAuthorityResolverService>('remoteAuthorityResolverService');\n\nexport const enum RemoteConnectionType {\n\tWebSocket,\n\tManaged\n}\n\nexport class ManagedRemoteConnection {\n\tpublic readonly type = RemoteConnectionType.Managed;\n\n\tconstructor(\n\t\tpublic readonly id: number\n\t) { }\n\n\tpublic toString(): string {\n\t\treturn `Managed(${this.id})`;\n\t}\n}\n\nexport class WebSocketRemoteConnection {\n\tpublic readonly type = RemoteConnectionType.WebSocket;\n\n\tconstructor(\n\t\tpublic readonly host: string,\n\t\tpublic readonly port: number,\n\t) { }\n\n\tpublic toString(): string {\n\t\treturn `WebSocket(${this.host}:${this.port})`;\n\t}\n}\n\nexport type RemoteConnection = WebSocketRemoteConnection | ManagedRemoteConnection;\n\nexport type RemoteConnectionOfType<T extends RemoteConnectionType> = RemoteConnection & { type: T };\n\nexport interface ResolvedAuthority {\n\treadonly authority: string;\n\treadonly connectTo: RemoteConnection;\n\treadonly connectionToken: string | undefined;\n}\n\nexport interface ResolvedOptions {\n\treadonly extensionHostEnv?: { [key: string]: string | null };\n\treadonly isTrusted?: boolean;\n\treadonly authenticationSession?: { id: string; providerId: string };\n}\n\nexport interface TunnelDescription {\n\tremoteAddress: { port: number; host: string };\n\tlocalAddress: { port: number; host: string } | string;\n\tprivacy?: string;\n\tprotocol?: string;\n}\nexport interface TunnelPrivacy {\n\tthemeIcon: string;\n\tid: string;\n\tlabel: string;\n}\nexport interface TunnelInformation {\n\tenvironmentTunnels?: TunnelDescription[];\n\tfeatures?: {\n\t\televation: boolean;\n\t\tpublic?: boolean;\n\t\tprivacyOptions: TunnelPrivacy[];\n\t\tprotocol: boolean;\n\t};\n}\n\nexport interface ResolverResult {\n\tauthority: ResolvedAuthority;\n\toptions?: ResolvedOptions;\n\ttunnelInformation?: TunnelInformation;\n}\n\nexport interface IRemoteConnectionData {\n\tconnectTo: RemoteConnection;\n\tconnectionToken: string | undefined;\n}\n\nexport enum RemoteAuthorityResolverErrorCode {\n\tUnknown = 'Unknown',\n\tNotAvailable = 'NotAvailable',\n\tTemporarilyNotAvailable = 'TemporarilyNotAvailable',\n\tNoResolverFound = 'NoResolverFound',\n\tInvalidAuthority = 'InvalidAuthority'\n}\n\nexport class RemoteAuthorityResolverError extends ErrorNoTelemetry {\n\n\tpublic static isNotAvailable(err: any): boolean {\n\t\treturn (err instanceof RemoteAuthorityResolverError) && err._code === RemoteAuthorityResolverErrorCode.NotAvailable;\n\t}\n\n\tpublic static isTemporarilyNotAvailable(err: any): boolean {\n\t\treturn (err instanceof RemoteAuthorityResolverError) && err._code === RemoteAuthorityResolverErrorCode.TemporarilyNotAvailable;\n\t}\n\n\tpublic static isNoResolverFound(err: any): err is RemoteAuthorityResolverError {\n\t\treturn (err instanceof RemoteAuthorityResolverError) && err._code === RemoteAuthorityResolverErrorCode.NoResolverFound;\n\t}\n\n\tpublic static isInvalidAuthority(err: any): boolean {\n\t\treturn (err instanceof RemoteAuthorityResolverError) && err._code === RemoteAuthorityResolverErrorCode.InvalidAuthority;\n\t}\n\n\tpublic static isHandled(err: any): boolean {\n\t\treturn (err instanceof RemoteAuthorityResolverError) && err.isHandled;\n\t}\n\n\tpublic readonly _message: string | undefined;\n\tpublic readonly _code: RemoteAuthorityResolverErrorCode;\n\tpublic readonly _detail: unknown;\n\n\tpublic isHandled: boolean;\n\n\tconstructor(message?: string, code: RemoteAuthorityResolverErrorCode = RemoteAuthorityResolverErrorCode.Unknown, detail?: unknown) {\n\t\tsuper(message);\n\n\t\tthis._message = message;\n\t\tthis._code = code;\n\t\tthis._detail = detail;\n\n\t\tthis.isHandled = (code === RemoteAuthorityResolverErrorCode.NotAvailable) && detail === true;\n\n\t\t// workaround when extending builtin objects and when compiling to ES5, see:\n\t\t// https://github.com/microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n\t\tObject.setPrototypeOf(this, RemoteAuthorityResolverError.prototype);\n\t}\n}\n\nexport interface IRemoteAuthorityResolverService {\n\n\treadonly _serviceBrand: undefined;\n\n\treadonly onDidChangeConnectionData: Event<void>;\n\n\tresolveAuthority(authority: string): Promise<ResolverResult>;\n\tgetConnectionData(authority: string): IRemoteConnectionData | null;\n\t/**\n\t * Get the canonical URI for a `vscode-remote://` URI.\n\t *\n\t * **NOTE**: This can throw e.g. in cases where there is no resolver installed for the specific remote authority.\n\t *\n\t * @param uri The `vscode-remote://` URI\n\t */\n\tgetCanonicalURI(uri: URI): Promise<URI>;\n\n\t_clearResolvedAuthority(authority: string): void;\n\t_setResolvedAuthority(resolvedAuthority: ResolvedAuthority, resolvedOptions?: ResolvedOptions): void;\n\t_setResolvedAuthorityError(authority: string, err: any): void;\n\t_setAuthorityConnectionToken(authority: string, connectionToken: string): void;\n\t_setCanonicalURIProvider(provider: (uri: URI) => Promise<URI>): void;\n}\n\nexport function getRemoteAuthorityPrefix(remoteAuthority: string): string {\n\tconst plusIndex = remoteAuthority.indexOf('+');\n\tif (plusIndex === -1) {\n\t\treturn remoteAuthority;\n\t}\n\treturn remoteAuthority.substring(0, plusIndex);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer, decodeBase64, encodeBase64 } from '../../../../base/common/buffer.js';\nimport { ResourceMap } from '../../../../base/common/map.js';\nimport { Schemas } from '../../../../base/common/network.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';\nimport { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\n\nexport const INotebookDocumentService = createDecorator<INotebookDocumentService>('notebookDocumentService');\n\nexport interface INotebookDocument {\n\treadonly uri: URI;\n\tgetCellIndex(cellUri: URI): number | undefined;\n}\n\nconst _lengths = ['W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f'];\nconst _padRegexp = new RegExp(`^[${_lengths.join('')}]+`);\nconst _radix = 7;\nexport function parse(cell: URI): { notebook: URI; handle: number } | undefined {\n\tif (cell.scheme !== Schemas.vscodeNotebookCell) {\n\t\treturn undefined;\n\t}\n\n\tconst idx = cell.fragment.indexOf('s');\n\tif (idx < 0) {\n\t\treturn undefined;\n\t}\n\n\tconst handle = parseInt(cell.fragment.substring(0, idx).replace(_padRegexp, ''), _radix);\n\tconst _scheme = decodeBase64(cell.fragment.substring(idx + 1)).toString();\n\n\tif (isNaN(handle)) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\thandle,\n\t\tnotebook: cell.with({ scheme: _scheme, fragment: null })\n\t};\n}\n\nexport function generate(notebook: URI, handle: number): URI {\n\n\tconst s = handle.toString(_radix);\n\tconst p = s.length < _lengths.length ? _lengths[s.length - 1] : 'z';\n\n\tconst fragment = `${p}${s}s${encodeBase64(VSBuffer.fromString(notebook.scheme), true, true)}`;\n\treturn notebook.with({ scheme: Schemas.vscodeNotebookCell, fragment });\n}\n\nexport function parseMetadataUri(metadata: URI): URI | undefined {\n\tif (metadata.scheme !== Schemas.vscodeNotebookMetadata) {\n\t\treturn undefined;\n\t}\n\n\tconst _scheme = decodeBase64(metadata.fragment).toString();\n\n\treturn metadata.with({ scheme: _scheme, fragment: null });\n}\n\nexport function generateMetadataUri(notebook: URI): URI {\n\tconst fragment = `${encodeBase64(VSBuffer.fromString(notebook.scheme), true, true)}`;\n\treturn notebook.with({ scheme: Schemas.vscodeNotebookMetadata, fragment });\n}\n\nexport function extractCellOutputDetails(uri: URI): { notebook: URI; openIn: string; outputId?: string; cellFragment?: string; outputIndex?: number; cellHandle?: number; cellIndex?: number } | undefined {\n\tif (uri.scheme !== Schemas.vscodeNotebookCellOutput) {\n\t\treturn;\n\t}\n\n\tconst params = new URLSearchParams(uri.query);\n\tconst openIn = params.get('openIn');\n\tif (!openIn) {\n\t\treturn;\n\t}\n\tconst outputId = params.get('outputId') ?? undefined;\n\tconst parsedCell = parse(uri.with({ scheme: Schemas.vscodeNotebookCell, query: null }));\n\tconst outputIndex = params.get('outputIndex') ? parseInt(params.get('outputIndex') || '', 10) : undefined;\n\tconst notebookUri = parsedCell ? parsedCell.notebook : uri.with({\n\t\tscheme: params.get('notebookScheme') || Schemas.file,\n\t\tfragment: null,\n\t\tquery: null,\n\t});\n\tconst cellIndex = params.get('cellIndex') ? parseInt(params.get('cellIndex') || '', 10) : undefined;\n\n\treturn {\n\t\tnotebook: notebookUri,\n\t\topenIn: openIn,\n\t\toutputId: outputId,\n\t\toutputIndex: outputIndex,\n\t\tcellHandle: parsedCell?.handle,\n\t\tcellFragment: uri.fragment,\n\t\tcellIndex: cellIndex,\n\t};\n}\n\n\nexport interface INotebookDocumentService {\n\treadonly _serviceBrand: undefined;\n\n\tgetNotebook(uri: URI): INotebookDocument | undefined;\n\taddNotebookDocument(document: INotebookDocument): void;\n\tremoveNotebookDocument(document: INotebookDocument): void;\n}\n\nexport class NotebookDocumentWorkbenchService implements INotebookDocumentService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly _documents = new ResourceMap<INotebookDocument>();\n\n\tgetNotebook(uri: URI): INotebookDocument | undefined {\n\t\tif (uri.scheme === Schemas.vscodeNotebookCell) {\n\t\t\tconst cellUri = parse(uri);\n\t\t\tif (cellUri) {\n\t\t\t\tconst document = this._documents.get(cellUri.notebook);\n\t\t\t\tif (document) {\n\t\t\t\t\treturn document;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (uri.scheme === Schemas.vscodeNotebookCellOutput) {\n\t\t\tconst parsedData = extractCellOutputDetails(uri);\n\t\t\tif (parsedData) {\n\t\t\t\tconst document = this._documents.get(parsedData.notebook);\n\t\t\t\tif (document) {\n\t\t\t\t\treturn document;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this._documents.get(uri);\n\t}\n\n\taddNotebookDocument(document: INotebookDocument) {\n\t\tthis._documents.set(document.uri, document);\n\t}\n\n\tremoveNotebookDocument(document: INotebookDocument) {\n\t\tthis._documents.delete(document.uri);\n\t}\n\n}\n\nregisterSingleton(INotebookDocumentService, NotebookDocumentWorkbenchService, InstantiationType.Delayed);\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from '../../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { IDiffResult } from '../../../../base/common/diff/diff.js';\nimport { Event } from '../../../../base/common/event.js';\nimport * as glob from '../../../../base/common/glob.js';\nimport { IMarkdownString } from '../../../../base/common/htmlContent.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { Mimes } from '../../../../base/common/mime.js';\nimport { Schemas } from '../../../../base/common/network.js';\nimport { basename } from '../../../../base/common/path.js';\nimport { isWindows } from '../../../../base/common/platform.js';\nimport { ISplice } from '../../../../base/common/sequence.js';\nimport { ThemeColor } from '../../../../base/common/themables.js';\nimport { URI, UriComponents } from '../../../../base/common/uri.js';\nimport { Range } from '../../../../editor/common/core/range.js';\nimport * as editorCommon from '../../../../editor/common/editorCommon.js';\nimport { Command, WorkspaceEditMetadata } from '../../../../editor/common/languages.js';\nimport { IReadonlyTextBuffer, ITextModel } from '../../../../editor/common/model.js';\nimport { IAccessibilityInformation } from '../../../../platform/accessibility/common/accessibility.js';\nimport { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';\nimport { ExtensionIdentifier } from '../../../../platform/extensions/common/extensions.js';\nimport { IFileReadLimits } from '../../../../platform/files/common/files.js';\nimport { UndoRedoGroup } from '../../../../platform/undoRedo/common/undoRedo.js';\nimport { IRevertOptions, ISaveOptions, IUntypedEditorInput } from '../../../common/editor.js';\nimport { NotebookTextModel } from './model/notebookTextModel.js';\nimport { ICellExecutionError } from './notebookExecutionStateService.js';\nimport { INotebookTextModelLike } from './notebookKernelService.js';\nimport { ICellRange } from './notebookRange.js';\nimport { RegisteredEditorPriority } from '../../../services/editor/common/editorResolverService.js';\nimport { generateMetadataUri, generate as generateUri, extractCellOutputDetails, parseMetadataUri, parse as parseUri } from '../../../services/notebook/common/notebookDocumentService.js';\nimport { IWorkingCopyBackupMeta, IWorkingCopySaveEvent } from '../../../services/workingCopy/common/workingCopy.js';\nimport { SnapshotContext } from '../../../services/workingCopy/common/fileWorkingCopy.js';\n\nexport const NOTEBOOK_EDITOR_ID = 'workbench.editor.notebook';\nexport const NOTEBOOK_DIFF_EDITOR_ID = 'workbench.editor.notebookTextDiffEditor';\nexport const NOTEBOOK_MULTI_DIFF_EDITOR_ID = 'workbench.editor.notebookMultiTextDiffEditor';\nexport const INTERACTIVE_WINDOW_EDITOR_ID = 'workbench.editor.interactive';\nexport const REPL_EDITOR_ID = 'workbench.editor.repl';\nexport const NOTEBOOK_OUTPUT_EDITOR_ID = 'workbench.editor.notebookOutputEditor';\n\nexport const EXECUTE_REPL_COMMAND_ID = 'replNotebook.input.execute';\n\nexport enum CellKind {\n\tMarkup = 1,\n\tCode = 2\n}\n\nexport const NOTEBOOK_DISPLAY_ORDER: readonly string[] = [\n\t'application/json',\n\t'application/javascript',\n\t'text/html',\n\t'image/svg+xml',\n\tMimes.latex,\n\tMimes.markdown,\n\t'image/png',\n\t'image/jpeg',\n\tMimes.text\n];\n\nexport const ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER: readonly string[] = [\n\tMimes.latex,\n\tMimes.markdown,\n\t'application/json',\n\t'text/html',\n\t'image/svg+xml',\n\t'image/png',\n\t'image/jpeg',\n\tMimes.text,\n];\n\n/**\n * A mapping of extension IDs who contain renderers, to notebook ids who they\n * should be treated as the same in the renderer selection logic. This is used\n * to prefer the 1st party Jupyter renderers even though they're in a separate\n * extension, for instance. See #136247.\n */\nexport const RENDERER_EQUIVALENT_EXTENSIONS: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n\t['ms-toolsai.jupyter', new Set(['jupyter-notebook', 'interactive'])],\n\t['ms-toolsai.jupyter-renderers', new Set(['jupyter-notebook', 'interactive'])],\n]);\n\nexport const RENDERER_NOT_AVAILABLE = '_notAvailable';\n\nexport type ContributedNotebookRendererEntrypoint = string | { readonly extends: string; readonly path: string };\n\nexport enum NotebookRunState {\n\tRunning = 1,\n\tIdle = 2\n}\n\nexport type NotebookDocumentMetadata = Record<string, unknown>;\n\nexport enum NotebookCellExecutionState {\n\tUnconfirmed = 1,\n\tPending = 2,\n\tExecuting = 3\n}\nexport enum NotebookExecutionState {\n\tUnconfirmed = 1,\n\tPending = 2,\n\tExecuting = 3\n}\n\nexport interface INotebookCellPreviousExecutionResult {\n\texecutionOrder?: number;\n\tsuccess?: boolean;\n\tduration?: number;\n}\n\nexport interface NotebookCellMetadata {\n\t/**\n\t * custom metadata\n\t */\n\t[key: string]: unknown;\n}\n\nexport interface NotebookCellInternalMetadata {\n\t/**\n\t * Used only for diffing of Notebooks.\n\t * This is not persisted and generally useful only when diffing two notebooks.\n\t * Useful only after we've manually matched a few cells together so we know which cells are matching.\n\t */\n\tinternalId?: string;\n\texecutionId?: string;\n\texecutionOrder?: number;\n\tlastRunSuccess?: boolean;\n\trunStartTime?: number;\n\trunStartTimeAdjustment?: number;\n\trunEndTime?: number;\n\trenderDuration?: { [key: string]: number };\n\terror?: ICellExecutionError;\n}\n\nexport interface NotebookCellCollapseState {\n\tinputCollapsed?: boolean;\n\toutputCollapsed?: boolean;\n}\n\nexport interface NotebookCellDefaultCollapseConfig {\n\tcodeCell?: NotebookCellCollapseState;\n\tmarkupCell?: NotebookCellCollapseState;\n}\n\nexport type InteractiveWindowCollapseCodeCells = 'always' | 'never' | 'fromEditor';\n\nexport type TransientCellMetadata = { readonly [K in keyof NotebookCellMetadata]?: boolean };\nexport type CellContentMetadata = { readonly [K in keyof NotebookCellMetadata]?: boolean };\nexport type TransientDocumentMetadata = { readonly [K in keyof NotebookDocumentMetadata]?: boolean };\n\nexport interface TransientOptions {\n\treadonly transientOutputs: boolean;\n\treadonly transientCellMetadata: TransientCellMetadata;\n\treadonly transientDocumentMetadata: TransientDocumentMetadata;\n\treadonly cellContentMetadata: CellContentMetadata;\n}\n\n/** Note: enum values are used for sorting */\nexport const enum NotebookRendererMatch {\n\t/** Renderer has a hard dependency on an available kernel */\n\tWithHardKernelDependency = 0,\n\t/** Renderer works better with an available kernel */\n\tWithOptionalKernelDependency = 1,\n\t/** Renderer is kernel-agnostic */\n\tPure = 2,\n\t/** Renderer is for a different mimeType or has a hard dependency which is unsatisfied */\n\tNever = 3,\n}\n\n/**\n * Renderer messaging requirement. While this allows for 'optional' messaging,\n * VS Code effectively treats it the same as true right now. \"Partial\n * activation\" of extensions is a very tricky problem, which could allow\n * solving this. But for now, optional is mostly only honored for aznb.\n */\nexport const enum RendererMessagingSpec {\n\tAlways = 'always',\n\tNever = 'never',\n\tOptional = 'optional',\n}\n\nexport type NotebookRendererEntrypoint = { readonly extends: string | undefined; readonly path: URI };\n\nexport interface INotebookRendererInfo {\n\treadonly id: string;\n\treadonly displayName: string;\n\treadonly entrypoint: NotebookRendererEntrypoint;\n\treadonly extensionLocation: URI;\n\treadonly extensionId: ExtensionIdentifier;\n\treadonly messaging: RendererMessagingSpec;\n\n\treadonly mimeTypes: readonly string[];\n\n\treadonly isBuiltin: boolean;\n\n\tmatchesWithoutKernel(mimeType: string): NotebookRendererMatch;\n\tmatches(mimeType: string, kernelProvides: ReadonlyArray<string>): NotebookRendererMatch;\n}\n\nexport interface INotebookStaticPreloadInfo {\n\treadonly type: string;\n\treadonly entrypoint: URI;\n\treadonly extensionLocation: URI;\n\treadonly localResourceRoots: readonly URI[];\n}\n\nexport interface IOrderedMimeType {\n\tmimeType: string;\n\trendererId: string;\n\tisTrusted: boolean;\n}\n\nexport interface IOutputItemDto {\n\treadonly mime: string;\n\treadonly data: VSBuffer;\n}\n\nexport interface IOutputDto {\n\toutputs: IOutputItemDto[];\n\toutputId: string;\n\tmetadata?: Record<string, any>;\n}\n\nexport interface ICellOutput {\n\treadonly versionId: number;\n\toutputs: IOutputItemDto[];\n\tmetadata?: Record<string, any>;\n\toutputId: string;\n\t/**\n\t * Alternative output id that's reused when the output is updated.\n\t */\n\talternativeOutputId: string;\n\tonDidChangeData: Event<void>;\n\treplaceData(items: IOutputDto): void;\n\tappendData(items: IOutputItemDto[]): void;\n\tappendedSinceVersion(versionId: number, mime: string): VSBuffer | undefined;\n\tasDto(): IOutputDto;\n\tbumpVersion(): void;\n\tdispose(): void;\n}\n\nexport interface CellInternalMetadataChangedEvent {\n\treadonly lastRunSuccessChanged?: boolean;\n}\n\nexport interface INotebookDocumentMetadataTextModel {\n\t/**\n\t * Notebook Metadata Uri.\n\t */\n\treadonly uri: URI;\n\t/**\n\t * Triggered when the Notebook Metadata changes.\n\t */\n\treadonly onDidChange: Event<void>;\n\treadonly metadata: Readonly<NotebookDocumentMetadata>;\n\treadonly textBuffer: IReadonlyTextBuffer;\n\t/**\n\t * Text representation of the Notebook Metadata\n\t */\n\tgetValue(): string;\n\tgetHash(): string;\n}\n\nexport interface ICell {\n\treadonly uri: URI;\n\thandle: number;\n\tlanguage: string;\n\tcellKind: CellKind;\n\toutputs: ICellOutput[];\n\tmetadata: NotebookCellMetadata;\n\tinternalMetadata: NotebookCellInternalMetadata;\n\tgetHashValue(): number;\n\ttextBuffer: IReadonlyTextBuffer;\n\ttextModel?: ITextModel;\n\tonDidChangeTextModel: Event<void>;\n\tgetValue(): string;\n\tonDidChangeOutputs?: Event<NotebookCellOutputsSplice>;\n\tonDidChangeOutputItems?: Event<void>;\n\tonDidChangeLanguage: Event<string>;\n\tonDidChangeMetadata: Event<void>;\n\tonDidChangeInternalMetadata: Event<CellInternalMetadataChangedEvent>;\n}\n\nexport interface INotebookSnapshotOptions {\n\tcontext: SnapshotContext;\n\toutputSizeLimit: number;\n\ttransientOptions?: TransientOptions;\n}\n\nexport interface INotebookTextModel extends INotebookTextModelLike {\n\treadonly notebookType: string;\n\treadonly viewType: string;\n\tmetadata: NotebookDocumentMetadata;\n\treadonly transientOptions: TransientOptions;\n\treadonly uri: URI;\n\treadonly versionId: number;\n\treadonly length: number;\n\treadonly cells: readonly ICell[];\n\treset(cells: ICellDto2[], metadata: NotebookDocumentMetadata, transientOptions: TransientOptions): void;\n\tcreateSnapshot(options: INotebookSnapshotOptions): NotebookData;\n\trestoreSnapshot(snapshot: NotebookData, transientOptions?: TransientOptions): void;\n\tapplyEdits(rawEdits: ICellEditOperation[], synchronous: boolean, beginSelectionState: ISelectionState | undefined, endSelectionsComputer: () => ISelectionState | undefined, undoRedoGroup: UndoRedoGroup | undefined, computeUndoRedo?: boolean): boolean;\n\tonDidChangeContent: Event<NotebookTextModelChangedEvent>;\n\tonWillDispose: Event<void>;\n}\n\nexport type NotebookCellTextModelSplice<T> = [\n\tstart: number,\n\tdeleteCount: number,\n\tnewItems: T[]\n];\n\nexport type NotebookCellOutputsSplice = {\n\tstart: number /* start */;\n\tdeleteCount: number /* delete count */;\n\tnewOutputs: ICellOutput[];\n};\n\nexport interface IMainCellDto {\n\thandle: number;\n\turl: string;\n\tsource: string[];\n\teol: string;\n\tversionId: number;\n\tlanguage: string;\n\tcellKind: CellKind;\n\toutputs: IOutputDto[];\n\tmetadata?: NotebookCellMetadata;\n\tinternalMetadata?: NotebookCellInternalMetadata;\n}\n\nexport enum NotebookCellsChangeType {\n\tModelChange = 1,\n\tMove = 2,\n\tChangeCellLanguage = 5,\n\tInitialize = 6,\n\tChangeCellMetadata = 7,\n\tOutput = 8,\n\tOutputItem = 9,\n\tChangeCellContent = 10,\n\tChangeDocumentMetadata = 11,\n\tChangeCellInternalMetadata = 12,\n\tChangeCellMime = 13,\n\tUnknown = 100\n}\n\nexport interface NotebookCellsInitializeEvent<T> {\n\treadonly kind: NotebookCellsChangeType.Initialize;\n\treadonly changes: NotebookCellTextModelSplice<T>[];\n}\n\nexport interface NotebookCellContentChangeEvent {\n\treadonly kind: NotebookCellsChangeType.ChangeCellContent;\n\treadonly index: number;\n}\n\nexport interface NotebookCellsModelChangedEvent<T> {\n\treadonly kind: NotebookCellsChangeType.ModelChange;\n\treadonly changes: NotebookCellTextModelSplice<T>[];\n}\n\nexport interface NotebookCellsModelMoveEvent<T> {\n\treadonly kind: NotebookCellsChangeType.Move;\n\treadonly index: number;\n\treadonly length: number;\n\treadonly newIdx: number;\n\treadonly cells: T[];\n}\n\nexport interface NotebookOutputChangedEvent {\n\treadonly kind: NotebookCellsChangeType.Output;\n\treadonly index: number;\n\treadonly outputs: IOutputDto[];\n\treadonly append: boolean;\n}\n\nexport interface NotebookOutputItemChangedEvent {\n\treadonly kind: NotebookCellsChangeType.OutputItem;\n\treadonly index: number;\n\treadonly outputId: string;\n\treadonly outputItems: IOutputItemDto[];\n\treadonly append: boolean;\n}\n\nexport interface NotebookCellsChangeLanguageEvent {\n\treadonly kind: NotebookCellsChangeType.ChangeCellLanguage;\n\treadonly index: number;\n\treadonly language: string;\n}\n\nexport interface NotebookCellsChangeMimeEvent {\n\treadonly kind: NotebookCellsChangeType.ChangeCellMime;\n\treadonly index: number;\n\treadonly mime: string | undefined;\n}\n\nexport interface NotebookCellsChangeMetadataEvent {\n\treadonly kind: NotebookCellsChangeType.ChangeCellMetadata;\n\treadonly index: number;\n\treadonly metadata: NotebookCellMetadata;\n}\n\nexport interface NotebookCellsChangeInternalMetadataEvent {\n\treadonly kind: NotebookCellsChangeType.ChangeCellInternalMetadata;\n\treadonly index: number;\n\treadonly internalMetadata: NotebookCellInternalMetadata;\n}\n\nexport interface NotebookDocumentChangeMetadataEvent {\n\treadonly kind: NotebookCellsChangeType.ChangeDocumentMetadata;\n\treadonly metadata: NotebookDocumentMetadata;\n}\n\nexport interface NotebookDocumentUnknownChangeEvent {\n\treadonly kind: NotebookCellsChangeType.Unknown;\n}\n\nexport type NotebookRawContentEventDto = NotebookCellsInitializeEvent<IMainCellDto> | NotebookDocumentChangeMetadataEvent | NotebookCellContentChangeEvent | NotebookCellsModelChangedEvent<IMainCellDto> | NotebookCellsModelMoveEvent<IMainCellDto> | NotebookOutputChangedEvent | NotebookOutputItemChangedEvent | NotebookCellsChangeLanguageEvent | NotebookCellsChangeMimeEvent | NotebookCellsChangeMetadataEvent | NotebookCellsChangeInternalMetadataEvent | NotebookDocumentUnknownChangeEvent;\n\nexport type NotebookCellsChangedEventDto = {\n\treadonly rawEvents: NotebookRawContentEventDto[];\n\treadonly versionId: number;\n};\n\nexport type NotebookRawContentEvent = (NotebookCellsInitializeEvent<ICell> | NotebookDocumentChangeMetadataEvent | NotebookCellContentChangeEvent | NotebookCellsModelChangedEvent<ICell> | NotebookCellsModelMoveEvent<ICell> | NotebookOutputChangedEvent | NotebookOutputItemChangedEvent | NotebookCellsChangeLanguageEvent | NotebookCellsChangeMimeEvent | NotebookCellsChangeMetadataEvent | NotebookCellsChangeInternalMetadataEvent | NotebookDocumentUnknownChangeEvent) & { transient: boolean };\n\nexport enum SelectionStateType {\n\tHandle = 0,\n\tIndex = 1\n}\n\nexport interface ISelectionHandleState {\n\tkind: SelectionStateType.Handle;\n\tprimary: number | null;\n\tselections: number[];\n}\n\nexport interface ISelectionIndexState {\n\tkind: SelectionStateType.Index;\n\tfocus: ICellRange;\n\tselections: ICellRange[];\n}\n\nexport type ISelectionState = ISelectionHandleState | ISelectionIndexState;\n\nexport type NotebookTextModelChangedEvent = {\n\treadonly rawEvents: NotebookRawContentEvent[];\n\treadonly versionId: number;\n\treadonly synchronous: boolean | undefined;\n\treadonly endSelectionState: ISelectionState | undefined;\n};\n\nexport type NotebookTextModelWillAddRemoveEvent = {\n\treadonly rawEvent: NotebookCellsModelChangedEvent<ICell>;\n};\n\nexport const enum CellEditType {\n\tReplace = 1,\n\tOutput = 2,\n\tMetadata = 3,\n\tCellLanguage = 4,\n\tDocumentMetadata = 5,\n\tMove = 6,\n\tOutputItems = 7,\n\tPartialMetadata = 8,\n\tPartialInternalMetadata = 9,\n}\n\nexport interface ICellDto2 {\n\tsource: string;\n\tlanguage: string;\n\tmime: string | undefined;\n\tcellKind: CellKind;\n\toutputs: IOutputDto[];\n\tmetadata?: NotebookCellMetadata;\n\tinternalMetadata?: NotebookCellInternalMetadata;\n\tcollapseState?: NotebookCellCollapseState;\n}\n\nexport interface ICellReplaceEdit {\n\teditType: CellEditType.Replace;\n\tindex: number;\n\tcount: number;\n\tcells: ICellDto2[];\n}\n\nexport interface ICellOutputEdit {\n\teditType: CellEditType.Output;\n\tindex: number;\n\toutputs: IOutputDto[];\n\tappend?: boolean;\n}\n\nexport interface ICellOutputEditByHandle {\n\teditType: CellEditType.Output;\n\thandle: number;\n\toutputs: IOutputDto[];\n\tappend?: boolean;\n}\n\nexport interface ICellOutputItemEdit {\n\teditType: CellEditType.OutputItems;\n\toutputId: string;\n\titems: IOutputItemDto[];\n\tappend?: boolean;\n}\n\nexport interface ICellMetadataEdit {\n\teditType: CellEditType.Metadata;\n\tindex: number;\n\tmetadata: NotebookCellMetadata;\n}\n\n// These types are nullable because we need to use 'null' on the EH side so it is JSON-stringified\nexport type NullablePartialNotebookCellMetadata = {\n\t[Key in keyof Partial<NotebookCellMetadata>]: NotebookCellMetadata[Key] | null\n};\n\nexport interface ICellPartialMetadataEdit {\n\teditType: CellEditType.PartialMetadata;\n\tindex: number;\n\tmetadata: NullablePartialNotebookCellMetadata;\n}\n\nexport interface ICellPartialMetadataEditByHandle {\n\teditType: CellEditType.PartialMetadata;\n\thandle: number;\n\tmetadata: NullablePartialNotebookCellMetadata;\n}\n\nexport type NullablePartialNotebookCellInternalMetadata = {\n\t[Key in keyof Partial<NotebookCellInternalMetadata>]: NotebookCellInternalMetadata[Key] | null\n};\nexport interface ICellPartialInternalMetadataEdit {\n\teditType: CellEditType.PartialInternalMetadata;\n\tindex: number;\n\tinternalMetadata: NullablePartialNotebookCellInternalMetadata;\n}\n\nexport interface ICellPartialInternalMetadataEditByHandle {\n\teditType: CellEditType.PartialInternalMetadata;\n\thandle: number;\n\tinternalMetadata: NullablePartialNotebookCellInternalMetadata;\n}\n\nexport interface ICellLanguageEdit {\n\teditType: CellEditType.CellLanguage;\n\tindex: number;\n\tlanguage: string;\n}\n\nexport interface IDocumentMetadataEdit {\n\teditType: CellEditType.DocumentMetadata;\n\tmetadata: NotebookDocumentMetadata;\n}\n\nexport interface ICellMoveEdit {\n\teditType: CellEditType.Move;\n\tindex: number;\n\tlength: number;\n\tnewIdx: number;\n}\n\nexport type IImmediateCellEditOperation = ICellOutputEditByHandle | ICellPartialMetadataEditByHandle | ICellOutputItemEdit | ICellPartialInternalMetadataEdit | ICellPartialInternalMetadataEditByHandle | ICellPartialMetadataEdit;\nexport type ICellEditOperation = IImmediateCellEditOperation | ICellReplaceEdit | ICellOutputEdit | ICellMetadataEdit | ICellPartialMetadataEdit | ICellPartialInternalMetadataEdit | IDocumentMetadataEdit | ICellMoveEdit | ICellOutputItemEdit | ICellLanguageEdit;\n\n\nexport interface IWorkspaceNotebookCellEdit {\n\tmetadata?: WorkspaceEditMetadata;\n\tresource: URI;\n\tnotebookVersionId: number | undefined;\n\tcellEdit: ICellPartialMetadataEdit | IDocumentMetadataEdit | ICellReplaceEdit;\n}\n\nexport interface IWorkspaceNotebookCellEditDto {\n\tmetadata?: WorkspaceEditMetadata;\n\tresource: URI;\n\tnotebookVersionId: number | undefined;\n\tcellEdit: ICellPartialMetadataEdit | IDocumentMetadataEdit | ICellReplaceEdit;\n}\n\nexport interface NotebookData {\n\treadonly cells: ICellDto2[];\n\treadonly metadata: NotebookDocumentMetadata;\n}\n\n\nexport interface INotebookContributionData {\n\textension?: ExtensionIdentifier;\n\tproviderDisplayName: string;\n\tdisplayName: string;\n\tfilenamePattern: (string | glob.IRelativePattern | INotebookExclusiveDocumentFilter)[];\n\tpriority?: RegisteredEditorPriority;\n}\n\nexport namespace NotebookMetadataUri {\n\texport const scheme = Schemas.vscodeNotebookMetadata;\n\texport function generate(notebook: URI): URI {\n\t\treturn generateMetadataUri(notebook);\n\t}\n\texport function parse(metadata: URI): URI | undefined {\n\t\treturn parseMetadataUri(metadata);\n\t}\n}\n\nexport namespace CellUri {\n\texport const scheme = Schemas.vscodeNotebookCell;\n\texport function generate(notebook: URI, handle: number): URI {\n\t\treturn generateUri(notebook, handle);\n\t}\n\n\texport function parse(cell: URI): { notebook: URI; handle: number } | undefined {\n\t\treturn parseUri(cell);\n\t}\n\n\t/**\n\t * Generates a URI for a cell output in a notebook using the output ID.\n\t * Used when URI should be opened as text in the editor.\n\t */\n\texport function generateCellOutputUriWithId(notebook: URI, outputId?: string) {\n\t\treturn notebook.with({\n\t\t\tscheme: Schemas.vscodeNotebookCellOutput,\n\t\t\tquery: new URLSearchParams({\n\t\t\t\topenIn: 'editor',\n\t\t\t\toutputId: outputId ?? '',\n\t\t\t\tnotebookScheme: notebook.scheme !== Schemas.file ? notebook.scheme : '',\n\t\t\t}).toString()\n\t\t});\n\t}\n\t/**\n\t * Generates a URI for a cell output in a notebook using the output index.\n\t * Used when URI should be opened in notebook editor.\n\t */\n\texport function generateCellOutputUriWithIndex(notebook: URI, cellUri: URI, outputIndex: number): URI {\n\t\treturn notebook.with({\n\t\t\tscheme: Schemas.vscodeNotebookCellOutput,\n\t\t\tfragment: cellUri.fragment,\n\t\t\tquery: new URLSearchParams({\n\t\t\t\topenIn: 'notebook',\n\t\t\t\toutputIndex: String(outputIndex),\n\t\t\t}).toString()\n\t\t});\n\t}\n\n\texport function generateOutputEditorUri(notebook: URI, cellId: string, cellIndex: number, outputId: string, outputIndex: number): URI {\n\t\treturn notebook.with({\n\t\t\tscheme: Schemas.vscodeNotebookCellOutput,\n\t\t\tquery: new URLSearchParams({\n\t\t\t\topenIn: 'notebookOutputEditor',\n\t\t\t\tnotebook: notebook.toString(),\n\t\t\t\tcellIndex: String(cellIndex),\n\t\t\t\toutputId: outputId,\n\t\t\t\toutputIndex: String(outputIndex),\n\t\t\t}).toString()\n\t\t});\n\t}\n\n\texport function parseCellOutputUri(uri: URI): { notebook: URI; openIn: string; outputId?: string; cellFragment?: string; outputIndex?: number; cellHandle?: number; cellIndex?: number } | undefined {\n\t\treturn extractCellOutputDetails(uri);\n\t}\n\n\texport function generateCellPropertyUri(notebook: URI, handle: number, scheme: string): URI {\n\t\treturn CellUri.generate(notebook, handle).with({ scheme: scheme });\n\t}\n\n\texport function parseCellPropertyUri(uri: URI, propertyScheme: string) {\n\t\tif (uri.scheme !== propertyScheme) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn CellUri.parse(uri.with({ scheme: scheme }));\n\t}\n}\n\nconst normalizeSlashes = (str: string) => isWindows ? str.replace(/\\//g, '\\\\') : str;\n\ninterface IMimeTypeWithMatcher {\n\tpattern: string;\n\tmatches: glob.ParsedPattern;\n}\n\nexport class MimeTypeDisplayOrder {\n\tprivate readonly order: IMimeTypeWithMatcher[];\n\n\tconstructor(\n\t\tinitialValue: readonly string[] = [],\n\t\tprivate readonly defaultOrder = NOTEBOOK_DISPLAY_ORDER,\n\t) {\n\t\tthis.order = [...new Set(initialValue)].map(pattern => ({\n\t\t\tpattern,\n\t\t\tmatches: glob.parse(normalizeSlashes(pattern))\n\t\t}));\n\t}\n\n\t/**\n\t * Returns a sorted array of the input mimetypes.\n\t */\n\tpublic sort(mimetypes: Iterable<string>): string[] {\n\t\tconst remaining = new Map(Iterable.map(mimetypes, m => [m, normalizeSlashes(m)]));\n\t\tlet sorted: string[] = [];\n\n\t\tfor (const { matches } of this.order) {\n\t\t\tfor (const [original, normalized] of remaining) {\n\t\t\t\tif (matches(normalized)) {\n\t\t\t\t\tsorted.push(original);\n\t\t\t\t\tremaining.delete(original);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (remaining.size) {\n\t\t\tsorted = sorted.concat([...remaining.keys()].sort(\n\t\t\t\t(a, b) => this.defaultOrder.indexOf(a) - this.defaultOrder.indexOf(b),\n\t\t\t));\n\t\t}\n\n\t\treturn sorted;\n\t}\n\n\t/**\n\t * Records that the user selected the given mimetype over the other\n\t * possible mimetypes, prioritizing it for future reference.\n\t */\n\tpublic prioritize(chosenMimetype: string, otherMimetypes: readonly string[]) {\n\t\tconst chosenIndex = this.findIndex(chosenMimetype);\n\t\tif (chosenIndex === -1) {\n\t\t\t// always first, nothing more to do\n\t\t\tthis.order.unshift({ pattern: chosenMimetype, matches: glob.parse(normalizeSlashes(chosenMimetype)) });\n\t\t\treturn;\n\t\t}\n\n\t\t// Get the other mimetypes that are before the chosenMimetype. Then, move\n\t\t// them after it, retaining order.\n\t\tconst uniqueIndicies = new Set(otherMimetypes.map(m => this.findIndex(m, chosenIndex)));\n\t\tuniqueIndicies.delete(-1);\n\t\tconst otherIndices = Array.from(uniqueIndicies).sort();\n\t\tthis.order.splice(chosenIndex + 1, 0, ...otherIndices.map(i => this.order[i]));\n\n\t\tfor (let oi = otherIndices.length - 1; oi >= 0; oi--) {\n\t\t\tthis.order.splice(otherIndices[oi], 1);\n\t\t}\n\t}\n\n\t/**\n\t * Gets an array of in-order mimetype preferences.\n\t */\n\tpublic toArray() {\n\t\treturn this.order.map(o => o.pattern);\n\t}\n\n\tprivate findIndex(mimeType: string, maxIndex = this.order.length) {\n\t\tconst normalized = normalizeSlashes(mimeType);\n\t\tfor (let i = 0; i < maxIndex; i++) {\n\t\t\tif (this.order[i].matches(normalized)) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n}\n\ninterface IMutableSplice<T> extends ISplice<T> {\n\treadonly toInsert: T[];\n\tdeleteCount: number;\n}\n\nexport function diff<T>(before: T[], after: T[], contains: (a: T) => boolean, equal: (a: T, b: T) => boolean = (a: T, b: T) => a === b): ISplice<T>[] {\n\tconst result: IMutableSplice<T>[] = [];\n\n\tfunction pushSplice(start: number, deleteCount: number, toInsert: T[]): void {\n\t\tif (deleteCount === 0 && toInsert.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst latest = result[result.length - 1];\n\n\t\tif (latest && latest.start + latest.deleteCount === start) {\n\t\t\tlatest.deleteCount += deleteCount;\n\t\t\tlatest.toInsert.push(...toInsert);\n\t\t} else {\n\t\t\tresult.push({ start, deleteCount, toInsert });\n\t\t}\n\t}\n\n\tlet beforeIdx = 0;\n\tlet afterIdx = 0;\n\n\twhile (true) {\n\t\tif (beforeIdx === before.length) {\n\t\t\tpushSplice(beforeIdx, 0, after.slice(afterIdx));\n\t\t\tbreak;\n\t\t}\n\n\t\tif (afterIdx === after.length) {\n\t\t\tpushSplice(beforeIdx, before.length - beforeIdx, []);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst beforeElement = before[beforeIdx];\n\t\tconst afterElement = after[afterIdx];\n\n\t\tif (equal(beforeElement, afterElement)) {\n\t\t\t// equal\n\t\t\tbeforeIdx += 1;\n\t\t\tafterIdx += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (contains(afterElement)) {\n\t\t\t// `afterElement` exists before, which means some elements before `afterElement` are deleted\n\t\t\tpushSplice(beforeIdx, 1, []);\n\t\t\tbeforeIdx += 1;\n\t\t} else {\n\t\t\t// `afterElement` added\n\t\t\tpushSplice(beforeIdx, 0, [afterElement]);\n\t\t\tafterIdx += 1;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport interface ICellEditorViewState {\n\tselections: editorCommon.ICursorState[];\n}\n\nexport const NOTEBOOK_EDITOR_CURSOR_BOUNDARY = new RawContextKey<'none' | 'top' | 'bottom' | 'both'>('notebookEditorCursorAtBoundary', 'none');\n\nexport const NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY = new RawContextKey<'none' | 'start' | 'end' | 'both'>('notebookEditorCursorAtLineBoundary', 'none');\n\nexport interface INotebookLoadOptions {\n\t/**\n\t * Go to disk bypassing any cache of the model if any.\n\t */\n\tforceReadFromFile?: boolean;\n\t/**\n\t * If provided, the size of the file will be checked against the limits\n\t * and an error will be thrown if any limit is exceeded.\n\t */\n\treadonly limits?: IFileReadLimits;\n}\n\nexport type NotebookEditorModelCreationOptions = {\n\tlimits?: IFileReadLimits;\n\tscratchpad?: boolean;\n\tviewType?: string;\n};\n\nexport interface IResolvedNotebookEditorModel extends INotebookEditorModel {\n\tnotebook: NotebookTextModel;\n}\n\nexport interface INotebookEditorModel extends IDisposable {\n\treadonly onDidChangeDirty: Event<void>;\n\treadonly onDidSave: Event<IWorkingCopySaveEvent>;\n\treadonly onDidChangeOrphaned: Event<void>;\n\treadonly onDidChangeReadonly: Event<void>;\n\treadonly onDidRevertUntitled: Event<void>;\n\treadonly resource: URI;\n\treadonly viewType: string;\n\treadonly notebook: INotebookTextModel | undefined;\n\treadonly hasErrorState: boolean;\n\tisResolved(): boolean;\n\tisDirty(): boolean;\n\tisModified(): boolean;\n\tisReadonly(): boolean | IMarkdownString;\n\tisOrphaned(): boolean;\n\thasAssociatedFilePath(): boolean;\n\tload(options?: INotebookLoadOptions): Promise<IResolvedNotebookEditorModel>;\n\tsave(options?: ISaveOptions): Promise<boolean>;\n\tsaveAs(target: URI): Promise<IUntypedEditorInput | undefined>;\n\trevert(options?: IRevertOptions): Promise<void>;\n}\n\nexport interface INotebookDiffEditorModel extends IDisposable {\n\toriginal: { notebook: NotebookTextModel; resource: URI; viewType: string };\n\tmodified: { notebook: NotebookTextModel; resource: URI; viewType: string };\n}\n\nexport interface NotebookDocumentBackupData extends IWorkingCopyBackupMeta {\n\treadonly viewType: string;\n\treadonly backupId?: string;\n\treadonly mtime?: number;\n}\n\nexport enum NotebookEditorPriority {\n\tdefault = 'default',\n\toption = 'option',\n}\n\nexport interface INotebookFindOptions {\n\tregex?: boolean;\n\twholeWord?: boolean;\n\tcaseSensitive?: boolean;\n\twordSeparators?: string;\n\tincludeMarkupInput?: boolean;\n\tincludeMarkupPreview?: boolean;\n\tincludeCodeInput?: boolean;\n\tincludeOutput?: boolean;\n\tfindScope?: INotebookFindScope;\n}\n\nexport interface INotebookFindScope {\n\tfindScopeType: NotebookFindScopeType;\n\tselectedCellRanges?: ICellRange[];\n\tselectedTextRanges?: Range[];\n}\n\nexport enum NotebookFindScopeType {\n\tCells = 'cells',\n\tText = 'text',\n\tNone = 'none'\n}\n\nexport interface INotebookExclusiveDocumentFilter {\n\tinclude?: string | glob.IRelativePattern;\n\texclude?: string | glob.IRelativePattern;\n}\n\nexport interface INotebookDocumentFilter {\n\tviewType?: string | string[];\n\tfilenamePattern?: string | glob.IRelativePattern | INotebookExclusiveDocumentFilter;\n}\n\n//TODO@rebornix test\n\nexport function isDocumentExcludePattern(filenamePattern: string | glob.IRelativePattern | INotebookExclusiveDocumentFilter): filenamePattern is { include: string | glob.IRelativePattern; exclude: string | glob.IRelativePattern } {\n\tconst arg = filenamePattern as INotebookExclusiveDocumentFilter;\n\n\tif ((typeof arg.include === 'string' || glob.isRelativePattern(arg.include))\n\t\t&& (typeof arg.exclude === 'string' || glob.isRelativePattern(arg.exclude))) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\nexport function notebookDocumentFilterMatch(filter: INotebookDocumentFilter, viewType: string, resource: URI): boolean {\n\tif (Array.isArray(filter.viewType) && filter.viewType.indexOf(viewType) >= 0) {\n\t\treturn true;\n\t}\n\n\tif (filter.viewType === viewType) {\n\t\treturn true;\n\t}\n\n\tif (filter.filenamePattern) {\n\t\tconst filenamePattern = isDocumentExcludePattern(filter.filenamePattern) ? filter.filenamePattern.include : (filter.filenamePattern as string | glob.IRelativePattern);\n\t\tconst excludeFilenamePattern = isDocumentExcludePattern(filter.filenamePattern) ? filter.filenamePattern.exclude : undefined;\n\n\t\tif (glob.match(filenamePattern, basename(resource.fsPath).toLowerCase())) {\n\t\t\tif (excludeFilenamePattern) {\n\t\t\t\tif (glob.match(excludeFilenamePattern, basename(resource.fsPath).toLowerCase())) {\n\t\t\t\t\t// should exclude\n\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nexport interface INotebookCellStatusBarItemProvider {\n\tviewType: string;\n\tonDidChangeStatusBarItems?: Event<void>;\n\tprovideCellStatusBarItems(uri: URI, index: number, token: CancellationToken): Promise<INotebookCellStatusBarItemList | undefined>;\n}\n\n\nexport interface INotebookDiffResult {\n\tcellsDiff: IDiffResult;\n\tmetadataChanged: boolean;\n}\n\nexport interface INotebookCellStatusBarItem {\n\treadonly alignment: CellStatusbarAlignment;\n\treadonly priority?: number;\n\treadonly text: string;\n\treadonly color?: string | ThemeColor;\n\treadonly backgroundColor?: string | ThemeColor;\n\treadonly tooltip?: string | IMarkdownString;\n\treadonly command?: string | Command;\n\treadonly accessibilityInformation?: IAccessibilityInformation;\n\treadonly opacity?: string;\n\treadonly onlyShowWhenActive?: boolean;\n}\n\nexport interface INotebookCellStatusBarItemList {\n\titems: INotebookCellStatusBarItem[];\n\tdispose?(): void;\n}\n\nexport type ShowCellStatusBarType = 'hidden' | 'visible' | 'visibleAfterExecute';\nexport const NotebookSetting = {\n\tdisplayOrder: 'notebook.displayOrder',\n\tcellToolbarLocation: 'notebook.cellToolbarLocation',\n\tcellToolbarVisibility: 'notebook.cellToolbarVisibility',\n\tshowCellStatusBar: 'notebook.showCellStatusBar',\n\tcellExecutionTimeVerbosity: 'notebook.cellExecutionTimeVerbosity',\n\ttextDiffEditorPreview: 'notebook.diff.enablePreview',\n\tdiffOverviewRuler: 'notebook.diff.overviewRuler',\n\texperimentalInsertToolbarAlignment: 'notebook.experimental.insertToolbarAlignment',\n\tcompactView: 'notebook.compactView',\n\tfocusIndicator: 'notebook.cellFocusIndicator',\n\tinsertToolbarLocation: 'notebook.insertToolbarLocation',\n\tglobalToolbar: 'notebook.globalToolbar',\n\tstickyScrollEnabled: 'notebook.stickyScroll.enabled',\n\tstickyScrollMode: 'notebook.stickyScroll.mode',\n\tundoRedoPerCell: 'notebook.undoRedoPerCell',\n\tconsolidatedOutputButton: 'notebook.consolidatedOutputButton',\n\topenOutputInPreviewEditor: 'notebook.output.openInPreviewEditor.enabled',\n\tshowFoldingControls: 'notebook.showFoldingControls',\n\tdragAndDropEnabled: 'notebook.dragAndDropEnabled',\n\tcellEditorOptionsCustomizations: 'notebook.editorOptionsCustomizations',\n\tconsolidatedRunButton: 'notebook.consolidatedRunButton',\n\topenGettingStarted: 'notebook.experimental.openGettingStarted',\n\tglobalToolbarShowLabel: 'notebook.globalToolbarShowLabel',\n\tmarkupFontSize: 'notebook.markup.fontSize',\n\tmarkdownLineHeight: 'notebook.markdown.lineHeight',\n\tinteractiveWindowCollapseCodeCells: 'interactiveWindow.collapseCellInputCode',\n\toutputScrollingDeprecated: 'notebook.experimental.outputScrolling',\n\toutputScrolling: 'notebook.output.scrolling',\n\ttextOutputLineLimit: 'notebook.output.textLineLimit',\n\tLinkifyOutputFilePaths: 'notebook.output.linkifyFilePaths',\n\tminimalErrorRendering: 'notebook.output.minimalErrorRendering',\n\tformatOnSave: 'notebook.formatOnSave.enabled',\n\tinsertFinalNewline: 'notebook.insertFinalNewline',\n\tdefaultFormatter: 'notebook.defaultFormatter',\n\tformatOnCellExecution: 'notebook.formatOnCellExecution',\n\tcodeActionsOnSave: 'notebook.codeActionsOnSave',\n\toutputWordWrap: 'notebook.output.wordWrap',\n\toutputLineHeightDeprecated: 'notebook.outputLineHeight',\n\toutputLineHeight: 'notebook.output.lineHeight',\n\toutputFontSizeDeprecated: 'notebook.outputFontSize',\n\toutputFontSize: 'notebook.output.fontSize',\n\toutputFontFamilyDeprecated: 'notebook.outputFontFamily',\n\toutputFontFamily: 'notebook.output.fontFamily',\n\tfindFilters: 'notebook.find.filters',\n\tlogging: 'notebook.logging',\n\tconfirmDeleteRunningCell: 'notebook.confirmDeleteRunningCell',\n\tremoteSaving: 'notebook.experimental.remoteSave',\n\tgotoSymbolsAllSymbols: 'notebook.gotoSymbols.showAllSymbols',\n\toutlineShowMarkdownHeadersOnly: 'notebook.outline.showMarkdownHeadersOnly',\n\toutlineShowCodeCells: 'notebook.outline.showCodeCells',\n\toutlineShowCodeCellSymbols: 'notebook.outline.showCodeCellSymbols',\n\tbreadcrumbsShowCodeCells: 'notebook.breadcrumbs.showCodeCells',\n\tscrollToRevealCell: 'notebook.scrolling.revealNextCellOnExecute',\n\tcellChat: 'notebook.experimental.cellChat',\n\tcellGenerate: 'notebook.experimental.generate',\n\tnotebookVariablesView: 'notebook.variablesView',\n\tnotebookInlineValues: 'notebook.inlineValues',\n\tInteractiveWindowPromptToSave: 'interactiveWindow.promptToSaveOnClose',\n\tcellFailureDiagnostics: 'notebook.cellFailureDiagnostics',\n\toutputBackupSizeLimit: 'notebook.backup.sizeLimit',\n\tmultiCursor: 'notebook.multiCursor.enabled',\n\tmarkupFontFamily: 'notebook.markup.fontFamily',\n} as const;\n\nexport const enum CellStatusbarAlignment {\n\tLeft = 1,\n\tRight = 2\n}\n\nexport class NotebookWorkingCopyTypeIdentifier {\n\n\tprivate static _prefix = 'notebook/';\n\n\tstatic create(notebookType: string, viewType?: string): string {\n\t\treturn `${NotebookWorkingCopyTypeIdentifier._prefix}${notebookType}/${viewType ?? notebookType}`;\n\t}\n\n\tstatic parse(candidate: string): { notebookType: string; viewType: string } | undefined {\n\t\tif (candidate.startsWith(NotebookWorkingCopyTypeIdentifier._prefix)) {\n\t\t\tconst split = candidate.substring(NotebookWorkingCopyTypeIdentifier._prefix.length).split('/');\n\t\t\tif (split.length === 2) {\n\t\t\t\treturn { notebookType: split[0], viewType: split[1] };\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport interface NotebookExtensionDescription {\n\treadonly id: ExtensionIdentifier;\n\treadonly location: UriComponents | undefined;\n}\n\n/**\n * Whether the provided mime type is a text stream like `stdout`, `stderr`.\n */\nexport function isTextStreamMime(mimeType: string) {\n\treturn ['application/vnd.code.notebook.stdout', 'application/vnd.code.notebook.stderr'].includes(mimeType);\n}\n\n\nconst textDecoder = new TextDecoder();\n\n/**\n * Given a stream of individual stdout outputs, this function will return the compressed lines, escaping some of the common terminal escape codes.\n * E.g. some terminal escape codes would result in the previous line getting cleared, such if we had 3 lines and\n * last line contained such a code, then the result string would be just the first two lines.\n * @returns a single VSBuffer with the concatenated and compressed data, and whether any compression was done.\n */\nexport function compressOutputItemStreams(outputs: Uint8Array[]) {\n\tconst buffers: Uint8Array[] = [];\n\tlet startAppending = false;\n\n\t// Pick the first set of outputs with the same mime type.\n\tfor (const output of outputs) {\n\t\tif ((buffers.length === 0 || startAppending)) {\n\t\t\tbuffers.push(output);\n\t\t\tstartAppending = true;\n\t\t}\n\t}\n\n\tlet didCompression = compressStreamBuffer(buffers);\n\tconst concatenated = VSBuffer.concat(buffers.map(buffer => VSBuffer.wrap(buffer)));\n\tconst data = formatStreamText(concatenated);\n\tdidCompression = didCompression || data.byteLength !== concatenated.byteLength;\n\treturn { data, didCompression };\n}\n\nexport const MOVE_CURSOR_1_LINE_COMMAND = `${String.fromCharCode(27)}[A`;\nconst MOVE_CURSOR_1_LINE_COMMAND_BYTES = MOVE_CURSOR_1_LINE_COMMAND.split('').map(c => c.charCodeAt(0));\nconst LINE_FEED = 10;\nfunction compressStreamBuffer(streams: Uint8Array[]) {\n\tlet didCompress = false;\n\tstreams.forEach((stream, index) => {\n\t\tif (index === 0 || stream.length < MOVE_CURSOR_1_LINE_COMMAND.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst previousStream = streams[index - 1];\n\n\t\t// Remove the previous line if required.\n\t\tconst command = stream.subarray(0, MOVE_CURSOR_1_LINE_COMMAND.length);\n\t\tif (command[0] === MOVE_CURSOR_1_LINE_COMMAND_BYTES[0] && command[1] === MOVE_CURSOR_1_LINE_COMMAND_BYTES[1] && command[2] === MOVE_CURSOR_1_LINE_COMMAND_BYTES[2]) {\n\t\t\tconst lastIndexOfLineFeed = previousStream.lastIndexOf(LINE_FEED);\n\t\t\tif (lastIndexOfLineFeed === -1) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdidCompress = true;\n\t\t\tstreams[index - 1] = previousStream.subarray(0, lastIndexOfLineFeed);\n\t\t\tstreams[index] = stream.subarray(MOVE_CURSOR_1_LINE_COMMAND.length);\n\t\t}\n\t});\n\treturn didCompress;\n}\n\n\n\n/**\n * Took this from jupyter/notebook\n * https://github.com/jupyter/notebook/blob/b8b66332e2023e83d2ee04f83d8814f567e01a4e/notebook/static/base/js/utils.js\n * Remove characters that are overridden by backspace characters\n */\nfunction fixBackspace(txt: string) {\n\tlet tmp = txt;\n\tdo {\n\t\ttxt = tmp;\n\t\t// Cancel out anything-but-newline followed by backspace\n\t\ttmp = txt.replace(/[^\\n]\\x08/gm, '');\n\t} while (tmp.length < txt.length);\n\treturn txt;\n}\n\n/**\n * Remove chunks that should be overridden by the effect of carriage return characters\n * From https://github.com/jupyter/notebook/blob/master/notebook/static/base/js/utils.js\n */\nfunction fixCarriageReturn(txt: string) {\n\ttxt = txt.replace(/\\r+\\n/gm, '\\n'); // \\r followed by \\n --> newline\n\twhile (txt.search(/\\r[^$]/g) > -1) {\n\t\tconst base = txt.match(/^(.*)\\r+/m)![1];\n\t\tlet insert = txt.match(/\\r+(.*)$/m)![1];\n\t\tinsert = insert + base.slice(insert.length, base.length);\n\t\ttxt = txt.replace(/\\r+.*$/m, '\\r').replace(/^.*\\r/m, insert);\n\t}\n\treturn txt;\n}\n\nconst BACKSPACE_CHARACTER = '\\b'.charCodeAt(0);\nconst CARRIAGE_RETURN_CHARACTER = '\\r'.charCodeAt(0);\nfunction formatStreamText(buffer: VSBuffer): VSBuffer {\n\t// We have special handling for backspace and carriage return characters.\n\t// Don't unnecessary decode the bytes if we don't need to perform any processing.\n\tif (!buffer.buffer.includes(BACKSPACE_CHARACTER) && !buffer.buffer.includes(CARRIAGE_RETURN_CHARACTER)) {\n\t\treturn buffer;\n\t}\n\t// Do the same thing jupyter is doing\n\treturn VSBuffer.fromString(fixCarriageReturn(fixBackspace(textDecoder.decode(buffer.buffer))));\n}\n\nexport interface INotebookKernelSourceAction {\n\treadonly label: string;\n\treadonly description?: string;\n\treadonly detail?: string;\n\treadonly command?: string | Command;\n\treadonly documentation?: UriComponents | string;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/* eslint-disable local/code-no-native-private */\n\nimport type * as vscode from 'vscode';\nimport { asArray, coalesceInPlace, equals } from '../../../base/common/arrays.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { illegalArgument, SerializedError } from '../../../base/common/errors.js';\nimport { IRelativePattern } from '../../../base/common/glob.js';\nimport { MarkdownString as BaseMarkdownString, MarkdownStringTrustedOptions } from '../../../base/common/htmlContent.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { MarshalledId } from '../../../base/common/marshallingIds.js';\nimport { Mimes, normalizeMimeType } from '../../../base/common/mime.js';\nimport { nextCharLength } from '../../../base/common/strings.js';\nimport { isNumber, isObject, isString, isStringArray } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { TextEditorSelectionSource } from '../../../platform/editor/common/editor.js';\nimport { ExtensionIdentifier, IExtensionDescription } from '../../../platform/extensions/common/extensions.js';\nimport { FileSystemProviderErrorCode, markAsFileSystemProviderError } from '../../../platform/files/common/files.js';\nimport { RemoteAuthorityResolverErrorCode } from '../../../platform/remote/common/remoteAuthorityResolver.js';\nimport { CellEditType, ICellMetadataEdit, IDocumentMetadataEdit, isTextStreamMime } from '../../contrib/notebook/common/notebookCommon.js';\nimport { IRelativePatternDto } from './extHost.protocol.js';\n\n/**\n * @deprecated\n *\n * This utility ensures that old JS code that uses functions for classes still works. Existing usages cannot be removed\n * but new ones must not be added\n * */\nfunction es5ClassCompat(target: Function): any {\n\tconst interceptFunctions = {\n\t\tapply: function (...args: any[]): any {\n\t\t\tif (args.length === 0) {\n\t\t\t\treturn Reflect.construct(target, []);\n\t\t\t} else {\n\t\t\t\tconst argsList = args.length === 1 ? [] : args[1];\n\t\t\t\treturn Reflect.construct(target, argsList, args[0].constructor);\n\t\t\t}\n\t\t},\n\t\tcall: function (...args: any[]): any {\n\t\t\tif (args.length === 0) {\n\t\t\t\treturn Reflect.construct(target, []);\n\t\t\t} else {\n\t\t\t\tconst [thisArg, ...restArgs] = args;\n\t\t\t\treturn Reflect.construct(target, restArgs, thisArg.constructor);\n\t\t\t}\n\t\t}\n\t};\n\treturn Object.assign(target, interceptFunctions);\n}\n\nexport enum TerminalOutputAnchor {\n\tTop = 0,\n\tBottom = 1\n}\n\nexport enum TerminalQuickFixType {\n\tTerminalCommand = 0,\n\tOpener = 1,\n\tCommand = 3\n}\n\n@es5ClassCompat\nexport class Disposable {\n\n\tstatic from(...inDisposables: { dispose(): any }[]): Disposable {\n\t\tlet disposables: ReadonlyArray<{ dispose(): any }> | undefined = inDisposables;\n\t\treturn new Disposable(function () {\n\t\t\tif (disposables) {\n\t\t\t\tfor (const disposable of disposables) {\n\t\t\t\t\tif (disposable && typeof disposable.dispose === 'function') {\n\t\t\t\t\t\tdisposable.dispose();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisposables = undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t#callOnDispose?: () => any;\n\n\tconstructor(callOnDispose: () => any) {\n\t\tthis.#callOnDispose = callOnDispose;\n\t}\n\n\tdispose(): any {\n\t\tif (typeof this.#callOnDispose === 'function') {\n\t\t\tthis.#callOnDispose();\n\t\t\tthis.#callOnDispose = undefined;\n\t\t}\n\t}\n}\n\n@es5ClassCompat\nexport class Position {\n\n\tstatic Min(...positions: Position[]): Position {\n\t\tif (positions.length === 0) {\n\t\t\tthrow new TypeError();\n\t\t}\n\t\tlet result = positions[0];\n\t\tfor (let i = 1; i < positions.length; i++) {\n\t\t\tconst p = positions[i];\n\t\t\tif (p.isBefore(result)) {\n\t\t\t\tresult = p;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic Max(...positions: Position[]): Position {\n\t\tif (positions.length === 0) {\n\t\t\tthrow new TypeError();\n\t\t}\n\t\tlet result = positions[0];\n\t\tfor (let i = 1; i < positions.length; i++) {\n\t\t\tconst p = positions[i];\n\t\t\tif (p.isAfter(result)) {\n\t\t\t\tresult = p;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic isPosition(other: any): other is Position {\n\t\tif (!other) {\n\t\t\treturn false;\n\t\t}\n\t\tif (other instanceof Position) {\n\t\t\treturn true;\n\t\t}\n\t\tconst { line, character } = <Position>other;\n\t\tif (typeof line === 'number' && typeof character === 'number') {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tstatic of(obj: vscode.Position): Position {\n\t\tif (obj instanceof Position) {\n\t\t\treturn obj;\n\t\t} else if (this.isPosition(obj)) {\n\t\t\treturn new Position(obj.line, obj.character);\n\t\t}\n\t\tthrow new Error('Invalid argument, is NOT a position-like object');\n\t}\n\n\tprivate _line: number;\n\tprivate _character: number;\n\n\tget line(): number {\n\t\treturn this._line;\n\t}\n\n\tget character(): number {\n\t\treturn this._character;\n\t}\n\n\tconstructor(line: number, character: number) {\n\t\tif (line < 0) {\n\t\t\tthrow illegalArgument('line must be non-negative');\n\t\t}\n\t\tif (character < 0) {\n\t\t\tthrow illegalArgument('character must be non-negative');\n\t\t}\n\t\tthis._line = line;\n\t\tthis._character = character;\n\t}\n\n\tisBefore(other: Position): boolean {\n\t\tif (this._line < other._line) {\n\t\t\treturn true;\n\t\t}\n\t\tif (other._line < this._line) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this._character < other._character;\n\t}\n\n\tisBeforeOrEqual(other: Position): boolean {\n\t\tif (this._line < other._line) {\n\t\t\treturn true;\n\t\t}\n\t\tif (other._line < this._line) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this._character <= other._character;\n\t}\n\n\tisAfter(other: Position): boolean {\n\t\treturn !this.isBeforeOrEqual(other);\n\t}\n\n\tisAfterOrEqual(other: Position): boolean {\n\t\treturn !this.isBefore(other);\n\t}\n\n\tisEqual(other: Position): boolean {\n\t\treturn this._line === other._line && this._character === other._character;\n\t}\n\n\tcompareTo(other: Position): number {\n\t\tif (this._line < other._line) {\n\t\t\treturn -1;\n\t\t} else if (this._line > other.line) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\t// equal line\n\t\t\tif (this._character < other._character) {\n\t\t\t\treturn -1;\n\t\t\t} else if (this._character > other._character) {\n\t\t\t\treturn 1;\n\t\t\t} else {\n\t\t\t\t// equal line and character\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\ttranslate(change: { lineDelta?: number; characterDelta?: number }): Position;\n\ttranslate(lineDelta?: number, characterDelta?: number): Position;\n\ttranslate(lineDeltaOrChange: number | undefined | { lineDelta?: number; characterDelta?: number }, characterDelta: number = 0): Position {\n\n\t\tif (lineDeltaOrChange === null || characterDelta === null) {\n\t\t\tthrow illegalArgument();\n\t\t}\n\n\t\tlet lineDelta: number;\n\t\tif (typeof lineDeltaOrChange === 'undefined') {\n\t\t\tlineDelta = 0;\n\t\t} else if (typeof lineDeltaOrChange === 'number') {\n\t\t\tlineDelta = lineDeltaOrChange;\n\t\t} else {\n\t\t\tlineDelta = typeof lineDeltaOrChange.lineDelta === 'number' ? lineDeltaOrChange.lineDelta : 0;\n\t\t\tcharacterDelta = typeof lineDeltaOrChange.characterDelta === 'number' ? lineDeltaOrChange.characterDelta : 0;\n\t\t}\n\n\t\tif (lineDelta === 0 && characterDelta === 0) {\n\t\t\treturn this;\n\t\t}\n\t\treturn new Position(this.line + lineDelta, this.character + characterDelta);\n\t}\n\n\twith(change: { line?: number; character?: number }): Position;\n\twith(line?: number, character?: number): Position;\n\twith(lineOrChange: number | undefined | { line?: number; character?: number }, character: number = this.character): Position {\n\n\t\tif (lineOrChange === null || character === null) {\n\t\t\tthrow illegalArgument();\n\t\t}\n\n\t\tlet line: number;\n\t\tif (typeof lineOrChange === 'undefined') {\n\t\t\tline = this.line;\n\n\t\t} else if (typeof lineOrChange === 'number') {\n\t\t\tline = lineOrChange;\n\n\t\t} else {\n\t\t\tline = typeof lineOrChange.line === 'number' ? lineOrChange.line : this.line;\n\t\t\tcharacter = typeof lineOrChange.character === 'number' ? lineOrChange.character : this.character;\n\t\t}\n\n\t\tif (line === this.line && character === this.character) {\n\t\t\treturn this;\n\t\t}\n\t\treturn new Position(line, character);\n\t}\n\n\ttoJSON(): any {\n\t\treturn { line: this.line, character: this.character };\n\t}\n\n\t[Symbol.for('debug.description')]() {\n\t\treturn `(${this.line}:${this.character})`;\n\t}\n}\n\n@es5ClassCompat\nexport class Range {\n\n\tstatic isRange(thing: any): thing is vscode.Range {\n\t\tif (thing instanceof Range) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn Position.isPosition((<Range>thing).start)\n\t\t\t&& Position.isPosition((<Range>thing.end));\n\t}\n\n\tstatic of(obj: vscode.Range): Range {\n\t\tif (obj instanceof Range) {\n\t\t\treturn obj;\n\t\t}\n\t\tif (this.isRange(obj)) {\n\t\t\treturn new Range(obj.start, obj.end);\n\t\t}\n\t\tthrow new Error('Invalid argument, is NOT a range-like object');\n\t}\n\n\tprotected _start: Position;\n\tprotected _end: Position;\n\n\tget start(): Position {\n\t\treturn this._start;\n\t}\n\n\tget end(): Position {\n\t\treturn this._end;\n\t}\n\n\tconstructor(start: vscode.Position, end: vscode.Position);\n\tconstructor(start: Position, end: Position);\n\tconstructor(startLine: number, startColumn: number, endLine: number, endColumn: number);\n\tconstructor(startLineOrStart: number | Position | vscode.Position, startColumnOrEnd: number | Position | vscode.Position, endLine?: number, endColumn?: number) {\n\t\tlet start: Position | undefined;\n\t\tlet end: Position | undefined;\n\n\t\tif (typeof startLineOrStart === 'number' && typeof startColumnOrEnd === 'number' && typeof endLine === 'number' && typeof endColumn === 'number') {\n\t\t\tstart = new Position(startLineOrStart, startColumnOrEnd);\n\t\t\tend = new Position(endLine, endColumn);\n\t\t} else if (Position.isPosition(startLineOrStart) && Position.isPosition(startColumnOrEnd)) {\n\t\t\tstart = Position.of(startLineOrStart);\n\t\t\tend = Position.of(startColumnOrEnd);\n\t\t}\n\n\t\tif (!start || !end) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\n\t\tif (start.isBefore(end)) {\n\t\t\tthis._start = start;\n\t\t\tthis._end = end;\n\t\t} else {\n\t\t\tthis._start = end;\n\t\t\tthis._end = start;\n\t\t}\n\t}\n\n\tcontains(positionOrRange: Position | Range): boolean {\n\t\tif (Range.isRange(positionOrRange)) {\n\t\t\treturn this.contains(positionOrRange.start)\n\t\t\t\t&& this.contains(positionOrRange.end);\n\n\t\t} else if (Position.isPosition(positionOrRange)) {\n\t\t\tif (Position.of(positionOrRange).isBefore(this._start)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (this._end.isBefore(positionOrRange)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tisEqual(other: Range): boolean {\n\t\treturn this._start.isEqual(other._start) && this._end.isEqual(other._end);\n\t}\n\n\tintersection(other: Range): Range | undefined {\n\t\tconst start = Position.Max(other.start, this._start);\n\t\tconst end = Position.Min(other.end, this._end);\n\t\tif (start.isAfter(end)) {\n\t\t\t// this happens when there is no overlap:\n\t\t\t// |-----|\n\t\t\t//          |----|\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new Range(start, end);\n\t}\n\n\tunion(other: Range): Range {\n\t\tif (this.contains(other)) {\n\t\t\treturn this;\n\t\t} else if (other.contains(this)) {\n\t\t\treturn other;\n\t\t}\n\t\tconst start = Position.Min(other.start, this._start);\n\t\tconst end = Position.Max(other.end, this.end);\n\t\treturn new Range(start, end);\n\t}\n\n\tget isEmpty(): boolean {\n\t\treturn this._start.isEqual(this._end);\n\t}\n\n\tget isSingleLine(): boolean {\n\t\treturn this._start.line === this._end.line;\n\t}\n\n\twith(change: { start?: Position; end?: Position }): Range;\n\twith(start?: Position, end?: Position): Range;\n\twith(startOrChange: Position | undefined | { start?: Position; end?: Position }, end: Position = this.end): Range {\n\n\t\tif (startOrChange === null || end === null) {\n\t\t\tthrow illegalArgument();\n\t\t}\n\n\t\tlet start: Position;\n\t\tif (!startOrChange) {\n\t\t\tstart = this.start;\n\n\t\t} else if (Position.isPosition(startOrChange)) {\n\t\t\tstart = startOrChange;\n\n\t\t} else {\n\t\t\tstart = startOrChange.start || this.start;\n\t\t\tend = startOrChange.end || this.end;\n\t\t}\n\n\t\tif (start.isEqual(this._start) && end.isEqual(this.end)) {\n\t\t\treturn this;\n\t\t}\n\t\treturn new Range(start, end);\n\t}\n\n\ttoJSON(): any {\n\t\treturn [this.start, this.end];\n\t}\n\n\t[Symbol.for('debug.description')]() {\n\t\treturn getDebugDescriptionOfRange(this);\n\t}\n}\n\n@es5ClassCompat\nexport class Selection extends Range {\n\n\tstatic isSelection(thing: any): thing is Selection {\n\t\tif (thing instanceof Selection) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn Range.isRange(thing)\n\t\t\t&& Position.isPosition((<Selection>thing).anchor)\n\t\t\t&& Position.isPosition((<Selection>thing).active)\n\t\t\t&& typeof (<Selection>thing).isReversed === 'boolean';\n\t}\n\n\tprivate _anchor: Position;\n\n\tpublic get anchor(): Position {\n\t\treturn this._anchor;\n\t}\n\n\tprivate _active: Position;\n\n\tpublic get active(): Position {\n\t\treturn this._active;\n\t}\n\n\tconstructor(anchor: Position, active: Position);\n\tconstructor(anchorLine: number, anchorColumn: number, activeLine: number, activeColumn: number);\n\tconstructor(anchorLineOrAnchor: number | Position, anchorColumnOrActive: number | Position, activeLine?: number, activeColumn?: number) {\n\t\tlet anchor: Position | undefined;\n\t\tlet active: Position | undefined;\n\n\t\tif (typeof anchorLineOrAnchor === 'number' && typeof anchorColumnOrActive === 'number' && typeof activeLine === 'number' && typeof activeColumn === 'number') {\n\t\t\tanchor = new Position(anchorLineOrAnchor, anchorColumnOrActive);\n\t\t\tactive = new Position(activeLine, activeColumn);\n\t\t} else if (Position.isPosition(anchorLineOrAnchor) && Position.isPosition(anchorColumnOrActive)) {\n\t\t\tanchor = Position.of(anchorLineOrAnchor);\n\t\t\tactive = Position.of(anchorColumnOrActive);\n\t\t}\n\n\t\tif (!anchor || !active) {\n\t\t\tthrow new Error('Invalid arguments');\n\t\t}\n\n\t\tsuper(anchor, active);\n\n\t\tthis._anchor = anchor;\n\t\tthis._active = active;\n\t}\n\n\tget isReversed(): boolean {\n\t\treturn this._anchor === this._end;\n\t}\n\n\toverride toJSON() {\n\t\treturn {\n\t\t\tstart: this.start,\n\t\t\tend: this.end,\n\t\t\tactive: this.active,\n\t\t\tanchor: this.anchor\n\t\t};\n\t}\n\n\n\t[Symbol.for('debug.description')]() {\n\t\treturn getDebugDescriptionOfSelection(this);\n\t}\n}\n\nexport function getDebugDescriptionOfRange(range: vscode.Range): string {\n\treturn range.isEmpty\n\t\t? `[${range.start.line}:${range.start.character})`\n\t\t: `[${range.start.line}:${range.start.character} -> ${range.end.line}:${range.end.character})`;\n}\n\nexport function getDebugDescriptionOfSelection(selection: vscode.Selection): string {\n\tlet rangeStr = getDebugDescriptionOfRange(selection);\n\tif (!selection.isEmpty) {\n\t\tif (selection.active.isEqual(selection.start)) {\n\t\t\trangeStr = `|${rangeStr}`;\n\t\t} else {\n\t\t\trangeStr = `${rangeStr}|`;\n\t\t}\n\t}\n\treturn rangeStr;\n}\n\nconst validateConnectionToken = (connectionToken: string) => {\n\tif (typeof connectionToken !== 'string' || connectionToken.length === 0 || !/^[0-9A-Za-z_\\-]+$/.test(connectionToken)) {\n\t\tthrow illegalArgument('connectionToken');\n\t}\n};\n\n\nexport class ResolvedAuthority {\n\tpublic static isResolvedAuthority(resolvedAuthority: any): resolvedAuthority is ResolvedAuthority {\n\t\treturn resolvedAuthority\n\t\t\t&& typeof resolvedAuthority === 'object'\n\t\t\t&& typeof resolvedAuthority.host === 'string'\n\t\t\t&& typeof resolvedAuthority.port === 'number'\n\t\t\t&& (resolvedAuthority.connectionToken === undefined || typeof resolvedAuthority.connectionToken === 'string');\n\t}\n\n\treadonly host: string;\n\treadonly port: number;\n\treadonly connectionToken: string | undefined;\n\n\tconstructor(host: string, port: number, connectionToken?: string) {\n\t\tif (typeof host !== 'string' || host.length === 0) {\n\t\t\tthrow illegalArgument('host');\n\t\t}\n\t\tif (typeof port !== 'number' || port === 0 || Math.round(port) !== port) {\n\t\t\tthrow illegalArgument('port');\n\t\t}\n\t\tif (typeof connectionToken !== 'undefined') {\n\t\t\tvalidateConnectionToken(connectionToken);\n\t\t}\n\t\tthis.host = host;\n\t\tthis.port = Math.round(port);\n\t\tthis.connectionToken = connectionToken;\n\t}\n}\n\n\nexport class ManagedResolvedAuthority {\n\n\tpublic static isManagedResolvedAuthority(resolvedAuthority: any): resolvedAuthority is ManagedResolvedAuthority {\n\t\treturn resolvedAuthority\n\t\t\t&& typeof resolvedAuthority === 'object'\n\t\t\t&& typeof resolvedAuthority.makeConnection === 'function'\n\t\t\t&& (resolvedAuthority.connectionToken === undefined || typeof resolvedAuthority.connectionToken === 'string');\n\t}\n\n\tconstructor(public readonly makeConnection: () => Thenable<vscode.ManagedMessagePassing>, public readonly connectionToken?: string) {\n\t\tif (typeof connectionToken !== 'undefined') {\n\t\t\tvalidateConnectionToken(connectionToken);\n\t\t}\n\t}\n}\n\nexport class RemoteAuthorityResolverError extends Error {\n\n\tstatic NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError {\n\t\treturn new RemoteAuthorityResolverError(message, RemoteAuthorityResolverErrorCode.NotAvailable, handled);\n\t}\n\n\tstatic TemporarilyNotAvailable(message?: string): RemoteAuthorityResolverError {\n\t\treturn new RemoteAuthorityResolverError(message, RemoteAuthorityResolverErrorCode.TemporarilyNotAvailable);\n\t}\n\n\tpublic readonly _message: string | undefined;\n\tpublic readonly _code: RemoteAuthorityResolverErrorCode;\n\tpublic readonly _detail: unknown;\n\n\tconstructor(message?: string, code: RemoteAuthorityResolverErrorCode = RemoteAuthorityResolverErrorCode.Unknown, detail?: unknown) {\n\t\tsuper(message);\n\n\t\tthis._message = message;\n\t\tthis._code = code;\n\t\tthis._detail = detail;\n\n\t\t// workaround when extending builtin objects and when compiling to ES5, see:\n\t\t// https://github.com/microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n\t\tObject.setPrototypeOf(this, RemoteAuthorityResolverError.prototype);\n\t}\n}\n\nexport enum EndOfLine {\n\tLF = 1,\n\tCRLF = 2\n}\n\nexport enum EnvironmentVariableMutatorType {\n\tReplace = 1,\n\tAppend = 2,\n\tPrepend = 3\n}\n\n@es5ClassCompat\nexport class TextEdit {\n\n\tstatic isTextEdit(thing: any): thing is TextEdit {\n\t\tif (thing instanceof TextEdit) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn Range.isRange((<TextEdit>thing))\n\t\t\t&& typeof (<TextEdit>thing).newText === 'string';\n\t}\n\n\tstatic replace(range: Range, newText: string): TextEdit {\n\t\treturn new TextEdit(range, newText);\n\t}\n\n\tstatic insert(position: Position, newText: string): TextEdit {\n\t\treturn TextEdit.replace(new Range(position, position), newText);\n\t}\n\n\tstatic delete(range: Range): TextEdit {\n\t\treturn TextEdit.replace(range, '');\n\t}\n\n\tstatic setEndOfLine(eol: EndOfLine): TextEdit {\n\t\tconst ret = new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), '');\n\t\tret.newEol = eol;\n\t\treturn ret;\n\t}\n\n\tprotected _range: Range;\n\tprotected _newText: string | null;\n\tprotected _newEol?: EndOfLine;\n\n\tget range(): Range {\n\t\treturn this._range;\n\t}\n\n\tset range(value: Range) {\n\t\tif (value && !Range.isRange(value)) {\n\t\t\tthrow illegalArgument('range');\n\t\t}\n\t\tthis._range = value;\n\t}\n\n\tget newText(): string {\n\t\treturn this._newText || '';\n\t}\n\n\tset newText(value: string) {\n\t\tif (value && typeof value !== 'string') {\n\t\t\tthrow illegalArgument('newText');\n\t\t}\n\t\tthis._newText = value;\n\t}\n\n\tget newEol(): EndOfLine | undefined {\n\t\treturn this._newEol;\n\t}\n\n\tset newEol(value: EndOfLine | undefined) {\n\t\tif (value && typeof value !== 'number') {\n\t\t\tthrow illegalArgument('newEol');\n\t\t}\n\t\tthis._newEol = value;\n\t}\n\n\tconstructor(range: Range, newText: string | null) {\n\t\tthis._range = range;\n\t\tthis._newText = newText;\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\trange: this.range,\n\t\t\tnewText: this.newText,\n\t\t\tnewEol: this._newEol\n\t\t};\n\t}\n}\n\n@es5ClassCompat\nexport class NotebookEdit implements vscode.NotebookEdit {\n\n\tstatic isNotebookCellEdit(thing: any): thing is NotebookEdit {\n\t\tif (thing instanceof NotebookEdit) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn NotebookRange.isNotebookRange((<NotebookEdit>thing))\n\t\t\t&& Array.isArray((<NotebookEdit>thing).newCells);\n\t}\n\n\tstatic replaceCells(range: NotebookRange, newCells: NotebookCellData[]): NotebookEdit {\n\t\treturn new NotebookEdit(range, newCells);\n\t}\n\n\tstatic insertCells(index: number, newCells: vscode.NotebookCellData[]): vscode.NotebookEdit {\n\t\treturn new NotebookEdit(new NotebookRange(index, index), newCells);\n\t}\n\n\tstatic deleteCells(range: NotebookRange): NotebookEdit {\n\t\treturn new NotebookEdit(range, []);\n\t}\n\n\tstatic updateCellMetadata(index: number, newMetadata: { [key: string]: any }): NotebookEdit {\n\t\tconst edit = new NotebookEdit(new NotebookRange(index, index), []);\n\t\tedit.newCellMetadata = newMetadata;\n\t\treturn edit;\n\t}\n\n\tstatic updateNotebookMetadata(newMetadata: { [key: string]: any }): NotebookEdit {\n\t\tconst edit = new NotebookEdit(new NotebookRange(0, 0), []);\n\t\tedit.newNotebookMetadata = newMetadata;\n\t\treturn edit;\n\t}\n\n\trange: NotebookRange;\n\tnewCells: NotebookCellData[];\n\tnewCellMetadata?: { [key: string]: any };\n\tnewNotebookMetadata?: { [key: string]: any };\n\n\tconstructor(range: NotebookRange, newCells: NotebookCellData[]) {\n\t\tthis.range = range;\n\t\tthis.newCells = newCells;\n\t}\n}\n\nexport class SnippetTextEdit implements vscode.SnippetTextEdit {\n\n\tstatic isSnippetTextEdit(thing: any): thing is SnippetTextEdit {\n\t\tif (thing instanceof SnippetTextEdit) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn Range.isRange((<SnippetTextEdit>thing).range)\n\t\t\t&& SnippetString.isSnippetString((<SnippetTextEdit>thing).snippet);\n\t}\n\n\tstatic replace(range: Range, snippet: SnippetString): SnippetTextEdit {\n\t\treturn new SnippetTextEdit(range, snippet);\n\t}\n\n\tstatic insert(position: Position, snippet: SnippetString): SnippetTextEdit {\n\t\treturn SnippetTextEdit.replace(new Range(position, position), snippet);\n\t}\n\n\trange: Range;\n\n\tsnippet: SnippetString;\n\n\tkeepWhitespace?: boolean;\n\n\tconstructor(range: Range, snippet: SnippetString) {\n\t\tthis.range = range;\n\t\tthis.snippet = snippet;\n\t}\n}\n\nexport interface IFileOperationOptions {\n\treadonly overwrite?: boolean;\n\treadonly ignoreIfExists?: boolean;\n\treadonly ignoreIfNotExists?: boolean;\n\treadonly recursive?: boolean;\n\treadonly contents?: Uint8Array | vscode.DataTransferFile;\n}\n\nexport const enum FileEditType {\n\tFile = 1,\n\tText = 2,\n\tCell = 3,\n\tCellReplace = 5,\n\tSnippet = 6,\n}\n\nexport interface IFileOperation {\n\treadonly _type: FileEditType.File;\n\treadonly from?: URI;\n\treadonly to?: URI;\n\treadonly options?: IFileOperationOptions;\n\treadonly metadata?: vscode.WorkspaceEditEntryMetadata;\n}\n\nexport interface IFileTextEdit {\n\treadonly _type: FileEditType.Text;\n\treadonly uri: URI;\n\treadonly edit: TextEdit;\n\treadonly metadata?: vscode.WorkspaceEditEntryMetadata;\n}\n\nexport interface IFileSnippetTextEdit {\n\treadonly _type: FileEditType.Snippet;\n\treadonly uri: URI;\n\treadonly range: vscode.Range;\n\treadonly edit: vscode.SnippetString;\n\treadonly metadata?: vscode.WorkspaceEditEntryMetadata;\n\treadonly keepWhitespace?: boolean;\n}\n\nexport interface IFileCellEdit {\n\treadonly _type: FileEditType.Cell;\n\treadonly uri: URI;\n\treadonly edit?: ICellMetadataEdit | IDocumentMetadataEdit;\n\treadonly metadata?: vscode.WorkspaceEditEntryMetadata;\n}\n\nexport interface ICellEdit {\n\treadonly _type: FileEditType.CellReplace;\n\treadonly metadata?: vscode.WorkspaceEditEntryMetadata;\n\treadonly uri: URI;\n\treadonly index: number;\n\treadonly count: number;\n\treadonly cells: vscode.NotebookCellData[];\n}\n\n\ntype WorkspaceEditEntry = IFileOperation | IFileTextEdit | IFileSnippetTextEdit | IFileCellEdit | ICellEdit;\n\n@es5ClassCompat\nexport class WorkspaceEdit implements vscode.WorkspaceEdit {\n\n\tprivate readonly _edits: WorkspaceEditEntry[] = [];\n\n\n\t_allEntries(): ReadonlyArray<WorkspaceEditEntry> {\n\t\treturn this._edits;\n\t}\n\n\t// --- file\n\n\trenameFile(from: vscode.Uri, to: vscode.Uri, options?: { readonly overwrite?: boolean; readonly ignoreIfExists?: boolean }, metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tthis._edits.push({ _type: FileEditType.File, from, to, options, metadata });\n\t}\n\n\tcreateFile(uri: vscode.Uri, options?: { readonly overwrite?: boolean; readonly ignoreIfExists?: boolean; readonly contents?: Uint8Array | vscode.DataTransferFile }, metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tthis._edits.push({ _type: FileEditType.File, from: undefined, to: uri, options, metadata });\n\t}\n\n\tdeleteFile(uri: vscode.Uri, options?: { readonly recursive?: boolean; readonly ignoreIfNotExists?: boolean }, metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tthis._edits.push({ _type: FileEditType.File, from: uri, to: undefined, options, metadata });\n\t}\n\n\t// --- notebook\n\n\tprivate replaceNotebookMetadata(uri: URI, value: Record<string, any>, metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tthis._edits.push({ _type: FileEditType.Cell, metadata, uri, edit: { editType: CellEditType.DocumentMetadata, metadata: value } });\n\t}\n\n\tprivate replaceNotebookCells(uri: URI, startOrRange: vscode.NotebookRange, cellData: vscode.NotebookCellData[], metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tconst start = startOrRange.start;\n\t\tconst end = startOrRange.end;\n\n\t\tif (start !== end || cellData.length > 0) {\n\t\t\tthis._edits.push({ _type: FileEditType.CellReplace, uri, index: start, count: end - start, cells: cellData, metadata });\n\t\t}\n\t}\n\n\tprivate replaceNotebookCellMetadata(uri: URI, index: number, cellMetadata: Record<string, any>, metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tthis._edits.push({ _type: FileEditType.Cell, metadata, uri, edit: { editType: CellEditType.Metadata, index, metadata: cellMetadata } });\n\t}\n\n\t// --- text\n\n\treplace(uri: URI, range: Range, newText: string, metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tthis._edits.push({ _type: FileEditType.Text, uri, edit: new TextEdit(range, newText), metadata });\n\t}\n\n\tinsert(resource: URI, position: Position, newText: string, metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tthis.replace(resource, new Range(position, position), newText, metadata);\n\t}\n\n\tdelete(resource: URI, range: Range, metadata?: vscode.WorkspaceEditEntryMetadata): void {\n\t\tthis.replace(resource, range, '', metadata);\n\t}\n\n\t// --- text (Maplike)\n\n\thas(uri: URI): boolean {\n\t\treturn this._edits.some(edit => edit._type === FileEditType.Text && edit.uri.toString() === uri.toString());\n\t}\n\n\tset(uri: URI, edits: ReadonlyArray<TextEdit | SnippetTextEdit>): void;\n\tset(uri: URI, edits: ReadonlyArray<[TextEdit | SnippetTextEdit, vscode.WorkspaceEditEntryMetadata | undefined]>): void;\n\tset(uri: URI, edits: readonly NotebookEdit[]): void;\n\tset(uri: URI, edits: ReadonlyArray<[NotebookEdit, vscode.WorkspaceEditEntryMetadata | undefined]>): void;\n\n\tset(uri: URI, edits: null | undefined | ReadonlyArray<TextEdit | SnippetTextEdit | NotebookEdit | [NotebookEdit, vscode.WorkspaceEditEntryMetadata | undefined] | [TextEdit | SnippetTextEdit, vscode.WorkspaceEditEntryMetadata | undefined]>): void {\n\t\tif (!edits) {\n\t\t\t// remove all text, snippet, or notebook edits for `uri`\n\t\t\tfor (let i = 0; i < this._edits.length; i++) {\n\t\t\t\tconst element = this._edits[i];\n\t\t\t\tswitch (element._type) {\n\t\t\t\t\tcase FileEditType.Text:\n\t\t\t\t\tcase FileEditType.Snippet:\n\t\t\t\t\tcase FileEditType.Cell:\n\t\t\t\t\tcase FileEditType.CellReplace:\n\t\t\t\t\t\tif (element.uri.toString() === uri.toString()) {\n\t\t\t\t\t\t\tthis._edits[i] = undefined!; // will be coalesced down below\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcoalesceInPlace(this._edits);\n\t\t} else {\n\t\t\t// append edit to the end\n\t\t\tfor (const editOrTuple of edits) {\n\t\t\t\tif (!editOrTuple) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tlet edit: TextEdit | SnippetTextEdit | NotebookEdit;\n\t\t\t\tlet metadata: vscode.WorkspaceEditEntryMetadata | undefined;\n\t\t\t\tif (Array.isArray(editOrTuple)) {\n\t\t\t\t\tedit = editOrTuple[0];\n\t\t\t\t\tmetadata = editOrTuple[1];\n\t\t\t\t} else {\n\t\t\t\t\tedit = editOrTuple;\n\t\t\t\t}\n\t\t\t\tif (NotebookEdit.isNotebookCellEdit(edit)) {\n\t\t\t\t\tif (edit.newCellMetadata) {\n\t\t\t\t\t\tthis.replaceNotebookCellMetadata(uri, edit.range.start, edit.newCellMetadata, metadata);\n\t\t\t\t\t} else if (edit.newNotebookMetadata) {\n\t\t\t\t\t\tthis.replaceNotebookMetadata(uri, edit.newNotebookMetadata, metadata);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.replaceNotebookCells(uri, edit.range, edit.newCells, metadata);\n\t\t\t\t\t}\n\t\t\t\t} else if (SnippetTextEdit.isSnippetTextEdit(edit)) {\n\t\t\t\t\tthis._edits.push({ _type: FileEditType.Snippet, uri, range: edit.range, edit: edit.snippet, metadata, keepWhitespace: edit.keepWhitespace });\n\n\t\t\t\t} else {\n\t\t\t\t\tthis._edits.push({ _type: FileEditType.Text, uri, edit, metadata });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tget(uri: URI): TextEdit[] {\n\t\tconst res: TextEdit[] = [];\n\t\tfor (const candidate of this._edits) {\n\t\t\tif (candidate._type === FileEditType.Text && candidate.uri.toString() === uri.toString()) {\n\t\t\t\tres.push(candidate.edit);\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tentries(): [URI, TextEdit[]][] {\n\t\tconst textEdits = new ResourceMap<[URI, TextEdit[]]>();\n\t\tfor (const candidate of this._edits) {\n\t\t\tif (candidate._type === FileEditType.Text) {\n\t\t\t\tlet textEdit = textEdits.get(candidate.uri);\n\t\t\t\tif (!textEdit) {\n\t\t\t\t\ttextEdit = [candidate.uri, []];\n\t\t\t\t\ttextEdits.set(candidate.uri, textEdit);\n\t\t\t\t}\n\t\t\t\ttextEdit[1].push(candidate.edit);\n\t\t\t}\n\t\t}\n\t\treturn [...textEdits.values()];\n\t}\n\n\tget size(): number {\n\t\treturn this.entries().length;\n\t}\n\n\ttoJSON(): any {\n\t\treturn this.entries();\n\t}\n}\n\n@es5ClassCompat\nexport class SnippetString {\n\n\tstatic isSnippetString(thing: any): thing is SnippetString {\n\t\tif (thing instanceof SnippetString) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (<SnippetString>thing).value === 'string';\n\t}\n\n\tprivate static _escape(value: string): string {\n\t\treturn value.replace(/\\$|}|\\\\/g, '\\\\$&');\n\t}\n\n\tprivate _tabstop: number = 1;\n\n\tvalue: string;\n\n\tconstructor(value?: string) {\n\t\tthis.value = value || '';\n\t}\n\n\tappendText(string: string): SnippetString {\n\t\tthis.value += SnippetString._escape(string);\n\t\treturn this;\n\t}\n\n\tappendTabstop(number: number = this._tabstop++): SnippetString {\n\t\tthis.value += '$';\n\t\tthis.value += number;\n\t\treturn this;\n\t}\n\n\tappendPlaceholder(value: string | ((snippet: SnippetString) => any), number: number = this._tabstop++): SnippetString {\n\n\t\tif (typeof value === 'function') {\n\t\t\tconst nested = new SnippetString();\n\t\t\tnested._tabstop = this._tabstop;\n\t\t\tvalue(nested);\n\t\t\tthis._tabstop = nested._tabstop;\n\t\t\tvalue = nested.value;\n\t\t} else {\n\t\t\tvalue = SnippetString._escape(value);\n\t\t}\n\n\t\tthis.value += '${';\n\t\tthis.value += number;\n\t\tthis.value += ':';\n\t\tthis.value += value;\n\t\tthis.value += '}';\n\n\t\treturn this;\n\t}\n\n\tappendChoice(values: string[], number: number = this._tabstop++): SnippetString {\n\t\tconst value = values.map(s => s.replaceAll(/[|\\\\,]/g, '\\\\$&')).join(',');\n\n\t\tthis.value += '${';\n\t\tthis.value += number;\n\t\tthis.value += '|';\n\t\tthis.value += value;\n\t\tthis.value += '|}';\n\n\t\treturn this;\n\t}\n\n\tappendVariable(name: string, defaultValue?: string | ((snippet: SnippetString) => any)): SnippetString {\n\n\t\tif (typeof defaultValue === 'function') {\n\t\t\tconst nested = new SnippetString();\n\t\t\tnested._tabstop = this._tabstop;\n\t\t\tdefaultValue(nested);\n\t\t\tthis._tabstop = nested._tabstop;\n\t\t\tdefaultValue = nested.value;\n\n\t\t} else if (typeof defaultValue === 'string') {\n\t\t\tdefaultValue = defaultValue.replace(/\\$|}/g, '\\\\$&'); // CodeQL [SM02383] I do not want to escape backslashes here\n\t\t}\n\n\t\tthis.value += '${';\n\t\tthis.value += name;\n\t\tif (defaultValue) {\n\t\t\tthis.value += ':';\n\t\t\tthis.value += defaultValue;\n\t\t}\n\t\tthis.value += '}';\n\n\n\t\treturn this;\n\t}\n}\n\nexport enum DiagnosticTag {\n\tUnnecessary = 1,\n\tDeprecated = 2\n}\n\nexport enum DiagnosticSeverity {\n\tHint = 3,\n\tInformation = 2,\n\tWarning = 1,\n\tError = 0\n}\n\n@es5ClassCompat\nexport class Location {\n\n\tstatic isLocation(thing: any): thing is vscode.Location {\n\t\tif (thing instanceof Location) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn Range.isRange((<Location>thing).range)\n\t\t\t&& URI.isUri((<Location>thing).uri);\n\t}\n\n\turi: URI;\n\trange!: Range;\n\n\tconstructor(uri: URI, rangeOrPosition: Range | Position) {\n\t\tthis.uri = uri;\n\n\t\tif (!rangeOrPosition) {\n\t\t\t//that's OK\n\t\t} else if (Range.isRange(rangeOrPosition)) {\n\t\t\tthis.range = Range.of(rangeOrPosition);\n\t\t} else if (Position.isPosition(rangeOrPosition)) {\n\t\t\tthis.range = new Range(rangeOrPosition, rangeOrPosition);\n\t\t} else {\n\t\t\tthrow new Error('Illegal argument');\n\t\t}\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\turi: this.uri,\n\t\t\trange: this.range\n\t\t};\n\t}\n}\n\n@es5ClassCompat\nexport class DiagnosticRelatedInformation {\n\n\tstatic is(thing: any): thing is DiagnosticRelatedInformation {\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (<DiagnosticRelatedInformation>thing).message === 'string'\n\t\t\t&& (<DiagnosticRelatedInformation>thing).location\n\t\t\t&& Range.isRange((<DiagnosticRelatedInformation>thing).location.range)\n\t\t\t&& URI.isUri((<DiagnosticRelatedInformation>thing).location.uri);\n\t}\n\n\tlocation: Location;\n\tmessage: string;\n\n\tconstructor(location: Location, message: string) {\n\t\tthis.location = location;\n\t\tthis.message = message;\n\t}\n\n\tstatic isEqual(a: DiagnosticRelatedInformation, b: DiagnosticRelatedInformation): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.message === b.message\n\t\t\t&& a.location.range.isEqual(b.location.range)\n\t\t\t&& a.location.uri.toString() === b.location.uri.toString();\n\t}\n}\n\n@es5ClassCompat\nexport class Diagnostic {\n\n\trange: Range;\n\tmessage: string;\n\tseverity: DiagnosticSeverity;\n\tsource?: string;\n\tcode?: string | number;\n\trelatedInformation?: DiagnosticRelatedInformation[];\n\ttags?: DiagnosticTag[];\n\n\tconstructor(range: Range, message: string, severity: DiagnosticSeverity = DiagnosticSeverity.Error) {\n\t\tif (!Range.isRange(range)) {\n\t\t\tthrow new TypeError('range must be set');\n\t\t}\n\t\tif (!message) {\n\t\t\tthrow new TypeError('message must be set');\n\t\t}\n\t\tthis.range = range;\n\t\tthis.message = message;\n\t\tthis.severity = severity;\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\tseverity: DiagnosticSeverity[this.severity],\n\t\t\tmessage: this.message,\n\t\t\trange: this.range,\n\t\t\tsource: this.source,\n\t\t\tcode: this.code,\n\t\t};\n\t}\n\n\tstatic isEqual(a: Diagnostic | undefined, b: Diagnostic | undefined): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.message === b.message\n\t\t\t&& a.severity === b.severity\n\t\t\t&& a.code === b.code\n\t\t\t&& a.severity === b.severity\n\t\t\t&& a.source === b.source\n\t\t\t&& a.range.isEqual(b.range)\n\t\t\t&& equals(a.tags, b.tags)\n\t\t\t&& equals(a.relatedInformation, b.relatedInformation, DiagnosticRelatedInformation.isEqual);\n\t}\n}\n\n@es5ClassCompat\nexport class Hover {\n\n\tpublic contents: (vscode.MarkdownString | vscode.MarkedString)[];\n\tpublic range: Range | undefined;\n\n\tconstructor(\n\t\tcontents: vscode.MarkdownString | vscode.MarkedString | (vscode.MarkdownString | vscode.MarkedString)[],\n\t\trange?: Range\n\t) {\n\t\tif (!contents) {\n\t\t\tthrow new Error('Illegal argument, contents must be defined');\n\t\t}\n\t\tif (Array.isArray(contents)) {\n\t\t\tthis.contents = contents;\n\t\t} else {\n\t\t\tthis.contents = [contents];\n\t\t}\n\t\tthis.range = range;\n\t}\n}\n\n@es5ClassCompat\nexport class VerboseHover extends Hover {\n\n\tpublic canIncreaseVerbosity: boolean | undefined;\n\tpublic canDecreaseVerbosity: boolean | undefined;\n\n\tconstructor(\n\t\tcontents: vscode.MarkdownString | vscode.MarkedString | (vscode.MarkdownString | vscode.MarkedString)[],\n\t\trange?: Range,\n\t\tcanIncreaseVerbosity?: boolean,\n\t\tcanDecreaseVerbosity?: boolean,\n\t) {\n\t\tsuper(contents, range);\n\t\tthis.canIncreaseVerbosity = canIncreaseVerbosity;\n\t\tthis.canDecreaseVerbosity = canDecreaseVerbosity;\n\t}\n}\n\nexport enum HoverVerbosityAction {\n\tIncrease = 0,\n\tDecrease = 1\n}\n\nexport enum DocumentHighlightKind {\n\tText = 0,\n\tRead = 1,\n\tWrite = 2\n}\n\n@es5ClassCompat\nexport class DocumentHighlight {\n\n\trange: Range;\n\tkind: DocumentHighlightKind;\n\n\tconstructor(range: Range, kind: DocumentHighlightKind = DocumentHighlightKind.Text) {\n\t\tthis.range = range;\n\t\tthis.kind = kind;\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\trange: this.range,\n\t\t\tkind: DocumentHighlightKind[this.kind]\n\t\t};\n\t}\n}\n\n@es5ClassCompat\nexport class MultiDocumentHighlight {\n\n\turi: URI;\n\thighlights: DocumentHighlight[];\n\n\tconstructor(uri: URI, highlights: DocumentHighlight[]) {\n\t\tthis.uri = uri;\n\t\tthis.highlights = highlights;\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\turi: this.uri,\n\t\t\thighlights: this.highlights.map(h => h.toJSON())\n\t\t};\n\t}\n}\n\nexport enum SymbolKind {\n\tFile = 0,\n\tModule = 1,\n\tNamespace = 2,\n\tPackage = 3,\n\tClass = 4,\n\tMethod = 5,\n\tProperty = 6,\n\tField = 7,\n\tConstructor = 8,\n\tEnum = 9,\n\tInterface = 10,\n\tFunction = 11,\n\tVariable = 12,\n\tConstant = 13,\n\tString = 14,\n\tNumber = 15,\n\tBoolean = 16,\n\tArray = 17,\n\tObject = 18,\n\tKey = 19,\n\tNull = 20,\n\tEnumMember = 21,\n\tStruct = 22,\n\tEvent = 23,\n\tOperator = 24,\n\tTypeParameter = 25\n}\n\nexport enum SymbolTag {\n\tDeprecated = 1,\n}\n\n@es5ClassCompat\nexport class SymbolInformation {\n\n\tstatic validate(candidate: SymbolInformation): void {\n\t\tif (!candidate.name) {\n\t\t\tthrow new Error('name must not be falsy');\n\t\t}\n\t}\n\n\tname: string;\n\tlocation!: Location;\n\tkind: SymbolKind;\n\ttags?: SymbolTag[];\n\tcontainerName: string | undefined;\n\n\tconstructor(name: string, kind: SymbolKind, containerName: string | undefined, location: Location);\n\tconstructor(name: string, kind: SymbolKind, range: Range, uri?: URI, containerName?: string);\n\tconstructor(name: string, kind: SymbolKind, rangeOrContainer: string | undefined | Range, locationOrUri?: Location | URI, containerName?: string) {\n\t\tthis.name = name;\n\t\tthis.kind = kind;\n\t\tthis.containerName = containerName;\n\n\t\tif (typeof rangeOrContainer === 'string') {\n\t\t\tthis.containerName = rangeOrContainer;\n\t\t}\n\n\t\tif (locationOrUri instanceof Location) {\n\t\t\tthis.location = locationOrUri;\n\t\t} else if (rangeOrContainer instanceof Range) {\n\t\t\tthis.location = new Location(locationOrUri!, rangeOrContainer);\n\t\t}\n\n\t\tSymbolInformation.validate(this);\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tkind: SymbolKind[this.kind],\n\t\t\tlocation: this.location,\n\t\t\tcontainerName: this.containerName\n\t\t};\n\t}\n}\n\n@es5ClassCompat\nexport class DocumentSymbol {\n\n\tstatic validate(candidate: DocumentSymbol): void {\n\t\tif (!candidate.name) {\n\t\t\tthrow new Error('name must not be falsy');\n\t\t}\n\t\tif (!candidate.range.contains(candidate.selectionRange)) {\n\t\t\tthrow new Error('selectionRange must be contained in fullRange');\n\t\t}\n\t\tcandidate.children?.forEach(DocumentSymbol.validate);\n\t}\n\n\tname: string;\n\tdetail: string;\n\tkind: SymbolKind;\n\ttags?: SymbolTag[];\n\trange: Range;\n\tselectionRange: Range;\n\tchildren: DocumentSymbol[];\n\n\tconstructor(name: string, detail: string, kind: SymbolKind, range: Range, selectionRange: Range) {\n\t\tthis.name = name;\n\t\tthis.detail = detail;\n\t\tthis.kind = kind;\n\t\tthis.range = range;\n\t\tthis.selectionRange = selectionRange;\n\t\tthis.children = [];\n\n\t\tDocumentSymbol.validate(this);\n\t}\n}\n\n\nexport enum CodeActionTriggerKind {\n\tInvoke = 1,\n\tAutomatic = 2,\n}\n\n@es5ClassCompat\nexport class CodeAction {\n\ttitle: string;\n\n\tcommand?: vscode.Command;\n\n\tedit?: WorkspaceEdit;\n\n\tdiagnostics?: Diagnostic[];\n\n\tkind?: CodeActionKind;\n\n\tisPreferred?: boolean;\n\n\tconstructor(title: string, kind?: CodeActionKind) {\n\t\tthis.title = title;\n\t\tthis.kind = kind;\n\t}\n}\n\n@es5ClassCompat\nexport class CodeActionKind {\n\tprivate static readonly sep = '.';\n\n\tpublic static Empty: CodeActionKind;\n\tpublic static QuickFix: CodeActionKind;\n\tpublic static Refactor: CodeActionKind;\n\tpublic static RefactorExtract: CodeActionKind;\n\tpublic static RefactorInline: CodeActionKind;\n\tpublic static RefactorMove: CodeActionKind;\n\tpublic static RefactorRewrite: CodeActionKind;\n\tpublic static Source: CodeActionKind;\n\tpublic static SourceOrganizeImports: CodeActionKind;\n\tpublic static SourceFixAll: CodeActionKind;\n\tpublic static Notebook: CodeActionKind;\n\n\tconstructor(\n\t\tpublic readonly value: string\n\t) { }\n\n\tpublic append(parts: string): CodeActionKind {\n\t\treturn new CodeActionKind(this.value ? this.value + CodeActionKind.sep + parts : parts);\n\t}\n\n\tpublic intersects(other: CodeActionKind): boolean {\n\t\treturn this.contains(other) || other.contains(this);\n\t}\n\n\tpublic contains(other: CodeActionKind): boolean {\n\t\treturn this.value === other.value || other.value.startsWith(this.value + CodeActionKind.sep);\n\t}\n}\n\nCodeActionKind.Empty = new CodeActionKind('');\nCodeActionKind.QuickFix = CodeActionKind.Empty.append('quickfix');\nCodeActionKind.Refactor = CodeActionKind.Empty.append('refactor');\nCodeActionKind.RefactorExtract = CodeActionKind.Refactor.append('extract');\nCodeActionKind.RefactorInline = CodeActionKind.Refactor.append('inline');\nCodeActionKind.RefactorMove = CodeActionKind.Refactor.append('move');\nCodeActionKind.RefactorRewrite = CodeActionKind.Refactor.append('rewrite');\nCodeActionKind.Source = CodeActionKind.Empty.append('source');\nCodeActionKind.SourceOrganizeImports = CodeActionKind.Source.append('organizeImports');\nCodeActionKind.SourceFixAll = CodeActionKind.Source.append('fixAll');\nCodeActionKind.Notebook = CodeActionKind.Empty.append('notebook');\n\n@es5ClassCompat\nexport class SelectionRange {\n\n\trange: Range;\n\tparent?: SelectionRange;\n\n\tconstructor(range: Range, parent?: SelectionRange) {\n\t\tthis.range = range;\n\t\tthis.parent = parent;\n\n\t\tif (parent && !parent.range.contains(this.range)) {\n\t\t\tthrow new Error('Invalid argument: parent must contain this range');\n\t\t}\n\t}\n}\n\nexport class CallHierarchyItem {\n\n\t_sessionId?: string;\n\t_itemId?: string;\n\n\tkind: SymbolKind;\n\ttags?: SymbolTag[];\n\tname: string;\n\tdetail?: string;\n\turi: URI;\n\trange: Range;\n\tselectionRange: Range;\n\n\tconstructor(kind: SymbolKind, name: string, detail: string, uri: URI, range: Range, selectionRange: Range) {\n\t\tthis.kind = kind;\n\t\tthis.name = name;\n\t\tthis.detail = detail;\n\t\tthis.uri = uri;\n\t\tthis.range = range;\n\t\tthis.selectionRange = selectionRange;\n\t}\n}\n\nexport class CallHierarchyIncomingCall {\n\n\tfrom: vscode.CallHierarchyItem;\n\tfromRanges: vscode.Range[];\n\n\tconstructor(item: vscode.CallHierarchyItem, fromRanges: vscode.Range[]) {\n\t\tthis.fromRanges = fromRanges;\n\t\tthis.from = item;\n\t}\n}\nexport class CallHierarchyOutgoingCall {\n\n\tto: vscode.CallHierarchyItem;\n\tfromRanges: vscode.Range[];\n\n\tconstructor(item: vscode.CallHierarchyItem, fromRanges: vscode.Range[]) {\n\t\tthis.fromRanges = fromRanges;\n\t\tthis.to = item;\n\t}\n}\n\nexport enum LanguageStatusSeverity {\n\tInformation = 0,\n\tWarning = 1,\n\tError = 2\n}\n\n\n@es5ClassCompat\nexport class CodeLens {\n\n\trange: Range;\n\n\tcommand: vscode.Command | undefined;\n\n\tconstructor(range: Range, command?: vscode.Command) {\n\t\tthis.range = range;\n\t\tthis.command = command;\n\t}\n\n\tget isResolved(): boolean {\n\t\treturn !!this.command;\n\t}\n}\n\n@es5ClassCompat\nexport class MarkdownString implements vscode.MarkdownString {\n\n\treadonly #delegate: BaseMarkdownString;\n\n\tstatic isMarkdownString(thing: any): thing is vscode.MarkdownString {\n\t\tif (thing instanceof MarkdownString) {\n\t\t\treturn true;\n\t\t}\n\t\treturn thing && thing.appendCodeblock && thing.appendMarkdown && thing.appendText && (thing.value !== undefined);\n\t}\n\n\tconstructor(value?: string, supportThemeIcons: boolean = false) {\n\t\tthis.#delegate = new BaseMarkdownString(value, { supportThemeIcons });\n\t}\n\n\tget value(): string {\n\t\treturn this.#delegate.value;\n\t}\n\tset value(value: string) {\n\t\tthis.#delegate.value = value;\n\t}\n\n\tget isTrusted(): boolean | MarkdownStringTrustedOptions | undefined {\n\t\treturn this.#delegate.isTrusted;\n\t}\n\n\tset isTrusted(value: boolean | MarkdownStringTrustedOptions | undefined) {\n\t\tthis.#delegate.isTrusted = value;\n\t}\n\n\tget supportThemeIcons(): boolean | undefined {\n\t\treturn this.#delegate.supportThemeIcons;\n\t}\n\n\tset supportThemeIcons(value: boolean | undefined) {\n\t\tthis.#delegate.supportThemeIcons = value;\n\t}\n\n\tget supportHtml(): boolean | undefined {\n\t\treturn this.#delegate.supportHtml;\n\t}\n\n\tset supportHtml(value: boolean | undefined) {\n\t\tthis.#delegate.supportHtml = value;\n\t}\n\n\tget baseUri(): vscode.Uri | undefined {\n\t\treturn this.#delegate.baseUri;\n\t}\n\n\tset baseUri(value: vscode.Uri | undefined) {\n\t\tthis.#delegate.baseUri = value;\n\t}\n\n\tappendText(value: string): vscode.MarkdownString {\n\t\tthis.#delegate.appendText(value);\n\t\treturn this;\n\t}\n\n\tappendMarkdown(value: string): vscode.MarkdownString {\n\t\tthis.#delegate.appendMarkdown(value);\n\t\treturn this;\n\t}\n\n\tappendCodeblock(value: string, language?: string): vscode.MarkdownString {\n\t\tthis.#delegate.appendCodeblock(language ?? '', value);\n\t\treturn this;\n\t}\n}\n\n@es5ClassCompat\nexport class ParameterInformation {\n\n\tlabel: string | [number, number];\n\tdocumentation?: string | vscode.MarkdownString;\n\n\tconstructor(label: string | [number, number], documentation?: string | vscode.MarkdownString) {\n\t\tthis.label = label;\n\t\tthis.documentation = documentation;\n\t}\n}\n\n@es5ClassCompat\nexport class SignatureInformation {\n\n\tlabel: string;\n\tdocumentation?: string | vscode.MarkdownString;\n\tparameters: ParameterInformation[];\n\tactiveParameter?: number;\n\n\tconstructor(label: string, documentation?: string | vscode.MarkdownString) {\n\t\tthis.label = label;\n\t\tthis.documentation = documentation;\n\t\tthis.parameters = [];\n\t}\n}\n\n@es5ClassCompat\nexport class SignatureHelp {\n\n\tsignatures: SignatureInformation[];\n\tactiveSignature: number = 0;\n\tactiveParameter: number = 0;\n\n\tconstructor() {\n\t\tthis.signatures = [];\n\t}\n}\n\nexport enum SignatureHelpTriggerKind {\n\tInvoke = 1,\n\tTriggerCharacter = 2,\n\tContentChange = 3,\n}\n\n\nexport enum InlayHintKind {\n\tType = 1,\n\tParameter = 2,\n}\n\n@es5ClassCompat\nexport class InlayHintLabelPart {\n\n\tvalue: string;\n\ttooltip?: string | vscode.MarkdownString;\n\tlocation?: Location;\n\tcommand?: vscode.Command;\n\n\tconstructor(value: string) {\n\t\tthis.value = value;\n\t}\n}\n\n@es5ClassCompat\nexport class InlayHint implements vscode.InlayHint {\n\n\tlabel: string | InlayHintLabelPart[];\n\ttooltip?: string | vscode.MarkdownString;\n\tposition: Position;\n\ttextEdits?: TextEdit[];\n\tkind?: vscode.InlayHintKind;\n\tpaddingLeft?: boolean;\n\tpaddingRight?: boolean;\n\n\tconstructor(position: Position, label: string | InlayHintLabelPart[], kind?: vscode.InlayHintKind) {\n\t\tthis.position = position;\n\t\tthis.label = label;\n\t\tthis.kind = kind;\n\t}\n}\n\nexport enum CompletionTriggerKind {\n\tInvoke = 0,\n\tTriggerCharacter = 1,\n\tTriggerForIncompleteCompletions = 2\n}\n\nexport interface CompletionContext {\n\treadonly triggerKind: CompletionTriggerKind;\n\treadonly triggerCharacter: string | undefined;\n}\n\nexport enum CompletionItemKind {\n\tText = 0,\n\tMethod = 1,\n\tFunction = 2,\n\tConstructor = 3,\n\tField = 4,\n\tVariable = 5,\n\tClass = 6,\n\tInterface = 7,\n\tModule = 8,\n\tProperty = 9,\n\tUnit = 10,\n\tValue = 11,\n\tEnum = 12,\n\tKeyword = 13,\n\tSnippet = 14,\n\tColor = 15,\n\tFile = 16,\n\tReference = 17,\n\tFolder = 18,\n\tEnumMember = 19,\n\tConstant = 20,\n\tStruct = 21,\n\tEvent = 22,\n\tOperator = 23,\n\tTypeParameter = 24,\n\tUser = 25,\n\tIssue = 26\n}\n\nexport enum CompletionItemTag {\n\tDeprecated = 1,\n}\n\nexport interface CompletionItemLabel {\n\tlabel: string;\n\tdetail?: string;\n\tdescription?: string;\n}\n\n@es5ClassCompat\nexport class CompletionItem implements vscode.CompletionItem {\n\n\tlabel: string | CompletionItemLabel;\n\tkind?: CompletionItemKind;\n\ttags?: CompletionItemTag[];\n\tdetail?: string;\n\tdocumentation?: string | vscode.MarkdownString;\n\tsortText?: string;\n\tfilterText?: string;\n\tpreselect?: boolean;\n\tinsertText?: string | SnippetString;\n\tkeepWhitespace?: boolean;\n\trange?: Range | { inserting: Range; replacing: Range };\n\tcommitCharacters?: string[];\n\ttextEdit?: TextEdit;\n\tadditionalTextEdits?: TextEdit[];\n\tcommand?: vscode.Command;\n\n\tconstructor(label: string | CompletionItemLabel, kind?: CompletionItemKind) {\n\t\tthis.label = label;\n\t\tthis.kind = kind;\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\tlabel: this.label,\n\t\t\tkind: this.kind && CompletionItemKind[this.kind],\n\t\t\tdetail: this.detail,\n\t\t\tdocumentation: this.documentation,\n\t\t\tsortText: this.sortText,\n\t\t\tfilterText: this.filterText,\n\t\t\tpreselect: this.preselect,\n\t\t\tinsertText: this.insertText,\n\t\t\ttextEdit: this.textEdit\n\t\t};\n\t}\n}\n\n@es5ClassCompat\nexport class CompletionList {\n\n\tisIncomplete?: boolean;\n\titems: vscode.CompletionItem[];\n\n\tconstructor(items: vscode.CompletionItem[] = [], isIncomplete: boolean = false) {\n\t\tthis.items = items;\n\t\tthis.isIncomplete = isIncomplete;\n\t}\n}\n\n@es5ClassCompat\nexport class InlineSuggestion implements vscode.InlineCompletionItem {\n\n\tfilterText?: string;\n\tinsertText: string;\n\trange?: Range;\n\tcommand?: vscode.Command;\n\n\tconstructor(insertText: string, range?: Range, command?: vscode.Command) {\n\t\tthis.insertText = insertText;\n\t\tthis.range = range;\n\t\tthis.command = command;\n\t}\n}\n\n@es5ClassCompat\nexport class InlineSuggestionList implements vscode.InlineCompletionList {\n\titems: vscode.InlineCompletionItem[];\n\n\tcommands: (vscode.Command | { command: vscode.Command; icon: vscode.ThemeIcon })[] | undefined = undefined;\n\n\tsuppressSuggestions: boolean | undefined = undefined;\n\n\tconstructor(items: vscode.InlineCompletionItem[]) {\n\t\tthis.items = items;\n\t}\n}\n\nexport interface PartialAcceptInfo {\n\tkind: PartialAcceptTriggerKind;\n\tacceptedLength: number;\n}\n\nexport enum PartialAcceptTriggerKind {\n\tUnknown = 0,\n\tWord = 1,\n\tLine = 2,\n\tSuggest = 3,\n}\n\nexport enum InlineCompletionEndOfLifeReasonKind {\n\tAccepted = 0,\n\tRejected = 1,\n\tIgnored = 2,\n}\n\nexport enum ViewColumn {\n\tActive = -1,\n\tBeside = -2,\n\tOne = 1,\n\tTwo = 2,\n\tThree = 3,\n\tFour = 4,\n\tFive = 5,\n\tSix = 6,\n\tSeven = 7,\n\tEight = 8,\n\tNine = 9\n}\n\nexport enum StatusBarAlignment {\n\tLeft = 1,\n\tRight = 2\n}\n\nexport function asStatusBarItemIdentifier(extension: ExtensionIdentifier, id: string): string {\n\treturn `${ExtensionIdentifier.toKey(extension)}.${id}`;\n}\n\nexport enum TextEditorLineNumbersStyle {\n\tOff = 0,\n\tOn = 1,\n\tRelative = 2,\n\tInterval = 3\n}\n\nexport enum TextDocumentSaveReason {\n\tManual = 1,\n\tAfterDelay = 2,\n\tFocusOut = 3\n}\n\nexport enum TextEditorRevealType {\n\tDefault = 0,\n\tInCenter = 1,\n\tInCenterIfOutsideViewport = 2,\n\tAtTop = 3\n}\n\nexport enum TextEditorSelectionChangeKind {\n\tKeyboard = 1,\n\tMouse = 2,\n\tCommand = 3\n}\n\nexport enum TextEditorChangeKind {\n\tAddition = 1,\n\tDeletion = 2,\n\tModification = 3\n}\n\nexport enum TextDocumentChangeReason {\n\tUndo = 1,\n\tRedo = 2,\n}\n\n/**\n * These values match very carefully the values of `TrackedRangeStickiness`\n */\nexport enum DecorationRangeBehavior {\n\t/**\n\t * TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges\n\t */\n\tOpenOpen = 0,\n\t/**\n\t * TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges\n\t */\n\tClosedClosed = 1,\n\t/**\n\t * TrackedRangeStickiness.GrowsOnlyWhenTypingBefore\n\t */\n\tOpenClosed = 2,\n\t/**\n\t * TrackedRangeStickiness.GrowsOnlyWhenTypingAfter\n\t */\n\tClosedOpen = 3\n}\n\nexport namespace TextEditorSelectionChangeKind {\n\texport function fromValue(s: TextEditorSelectionSource | string | undefined) {\n\t\tswitch (s) {\n\t\t\tcase 'keyboard': return TextEditorSelectionChangeKind.Keyboard;\n\t\t\tcase 'mouse': return TextEditorSelectionChangeKind.Mouse;\n\t\t\tcase TextEditorSelectionSource.PROGRAMMATIC:\n\t\t\tcase TextEditorSelectionSource.JUMP:\n\t\t\tcase TextEditorSelectionSource.NAVIGATION:\n\t\t\t\treturn TextEditorSelectionChangeKind.Command;\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport enum SyntaxTokenType {\n\tOther = 0,\n\tComment = 1,\n\tString = 2,\n\tRegEx = 3\n}\nexport namespace SyntaxTokenType {\n\texport function toString(v: SyntaxTokenType | unknown): 'other' | 'comment' | 'string' | 'regex' {\n\t\tswitch (v) {\n\t\t\tcase SyntaxTokenType.Other: return 'other';\n\t\t\tcase SyntaxTokenType.Comment: return 'comment';\n\t\t\tcase SyntaxTokenType.String: return 'string';\n\t\t\tcase SyntaxTokenType.RegEx: return 'regex';\n\t\t}\n\t\treturn 'other';\n\t}\n}\n\n@es5ClassCompat\nexport class DocumentLink {\n\n\trange: Range;\n\n\ttarget?: URI;\n\n\ttooltip?: string;\n\n\tconstructor(range: Range, target: URI | undefined) {\n\t\tif (target && !(URI.isUri(target))) {\n\t\t\tthrow illegalArgument('target');\n\t\t}\n\t\tif (!Range.isRange(range) || range.isEmpty) {\n\t\t\tthrow illegalArgument('range');\n\t\t}\n\t\tthis.range = range;\n\t\tthis.target = target;\n\t}\n}\n\n@es5ClassCompat\nexport class Color {\n\treadonly red: number;\n\treadonly green: number;\n\treadonly blue: number;\n\treadonly alpha: number;\n\n\tconstructor(red: number, green: number, blue: number, alpha: number) {\n\t\tthis.red = red;\n\t\tthis.green = green;\n\t\tthis.blue = blue;\n\t\tthis.alpha = alpha;\n\t}\n}\n\nexport type IColorFormat = string | { opaque: string; transparent: string };\n\n@es5ClassCompat\nexport class ColorInformation {\n\trange: Range;\n\n\tcolor: Color;\n\n\tconstructor(range: Range, color: Color) {\n\t\tif (color && !(color instanceof Color)) {\n\t\t\tthrow illegalArgument('color');\n\t\t}\n\t\tif (!Range.isRange(range) || range.isEmpty) {\n\t\t\tthrow illegalArgument('range');\n\t\t}\n\t\tthis.range = range;\n\t\tthis.color = color;\n\t}\n}\n\n@es5ClassCompat\nexport class ColorPresentation {\n\tlabel: string;\n\ttextEdit?: TextEdit;\n\tadditionalTextEdits?: TextEdit[];\n\n\tconstructor(label: string) {\n\t\tif (!label || typeof label !== 'string') {\n\t\t\tthrow illegalArgument('label');\n\t\t}\n\t\tthis.label = label;\n\t}\n}\n\nexport enum ColorFormat {\n\tRGB = 0,\n\tHEX = 1,\n\tHSL = 2\n}\n\nexport enum SourceControlInputBoxValidationType {\n\tError = 0,\n\tWarning = 1,\n\tInformation = 2\n}\n\nexport enum TerminalExitReason {\n\tUnknown = 0,\n\tShutdown = 1,\n\tProcess = 2,\n\tUser = 3,\n\tExtension = 4\n}\n\nexport enum TerminalShellExecutionCommandLineConfidence {\n\tLow = 0,\n\tMedium = 1,\n\tHigh = 2\n}\n\nexport enum TerminalShellType {\n\tSh = 1,\n\tBash = 2,\n\tFish = 3,\n\tCsh = 4,\n\tKsh = 5,\n\tZsh = 6,\n\tCommandPrompt = 7,\n\tGitBash = 8,\n\tPowerShell = 9,\n\tPython = 10,\n\tJulia = 11,\n\tNuShell = 12,\n\tNode = 13\n}\n\nexport class TerminalLink implements vscode.TerminalLink {\n\tconstructor(\n\t\tpublic startIndex: number,\n\t\tpublic length: number,\n\t\tpublic tooltip?: string\n\t) {\n\t\tif (typeof startIndex !== 'number' || startIndex < 0) {\n\t\t\tthrow illegalArgument('startIndex');\n\t\t}\n\t\tif (typeof length !== 'number' || length < 1) {\n\t\t\tthrow illegalArgument('length');\n\t\t}\n\t\tif (tooltip !== undefined && typeof tooltip !== 'string') {\n\t\t\tthrow illegalArgument('tooltip');\n\t\t}\n\t}\n}\n\nexport class TerminalQuickFixOpener {\n\turi: vscode.Uri;\n\tconstructor(uri: vscode.Uri) {\n\t\tthis.uri = uri;\n\t}\n}\n\nexport class TerminalQuickFixCommand {\n\tterminalCommand: string;\n\tconstructor(terminalCommand: string) {\n\t\tthis.terminalCommand = terminalCommand;\n\t}\n}\n\nexport enum TerminalLocation {\n\tPanel = 1,\n\tEditor = 2,\n}\n\nexport class TerminalProfile implements vscode.TerminalProfile {\n\tconstructor(\n\t\tpublic options: vscode.TerminalOptions | vscode.ExtensionTerminalOptions\n\t) {\n\t\tif (typeof options !== 'object') {\n\t\t\tthrow illegalArgument('options');\n\t\t}\n\t}\n}\n\nexport enum TerminalCompletionItemKind {\n\tFile = 0,\n\tFolder = 1,\n\tMethod = 2,\n\tAlias = 3,\n\tArgument = 4,\n\tOption = 5,\n\tOptionValue = 6,\n\tFlag = 7,\n\tSymbolicLinkFile = 8,\n\tSymbolicLinkFolder = 9\n}\n\nexport class TerminalCompletionItem implements vscode.TerminalCompletionItem {\n\tlabel: string | CompletionItemLabel;\n\ticon?: ThemeIcon | undefined;\n\tdetail?: string | undefined;\n\tdocumentation?: string | vscode.MarkdownString | undefined;\n\tisFile?: boolean | undefined;\n\tisDirectory?: boolean | undefined;\n\tisKeyword?: boolean | undefined;\n\treplacementIndex: number;\n\treplacementLength: number;\n\n\tconstructor(label: string | CompletionItemLabel, icon?: ThemeIcon, detail?: string, documentation?: string | vscode.MarkdownString, isFile?: boolean, isDirectory?: boolean, isKeyword?: boolean, replacementIndex?: number, replacementLength?: number) {\n\t\tthis.label = label;\n\t\tthis.icon = icon;\n\t\tthis.detail = detail;\n\t\tthis.documentation = documentation;\n\t\tthis.isFile = isFile;\n\t\tthis.isDirectory = isDirectory;\n\t\tthis.isKeyword = isKeyword;\n\t\tthis.replacementIndex = replacementIndex ?? 0;\n\t\tthis.replacementLength = replacementLength ?? 0;\n\t}\n}\n\n/**\n * Represents a collection of {@link CompletionItem completion items} to be presented\n * in the editor.\n */\nexport class TerminalCompletionList<T extends TerminalCompletionItem = TerminalCompletionItem> {\n\n\t/**\n\t * Resources should be shown in the completions list\n\t */\n\tresourceRequestConfig?: TerminalResourceRequestConfig;\n\n\t/**\n\t * The completion items.\n\t */\n\titems: T[];\n\n\t/**\n\t * Creates a new completion list.\n\t *\n\t * @param items The completion items.\n\t * @param isIncomplete The list is not complete.\n\t */\n\tconstructor(items?: T[], resourceRequestConfig?: TerminalResourceRequestConfig) {\n\t\tthis.items = items ?? [];\n\t\tthis.resourceRequestConfig = resourceRequestConfig;\n\t}\n}\n\nexport interface TerminalResourceRequestConfig {\n\tfilesRequested?: boolean;\n\tfoldersRequested?: boolean;\n\tfileExtensions?: string[];\n\tcwd?: vscode.Uri;\n}\n\nexport enum TaskRevealKind {\n\tAlways = 1,\n\n\tSilent = 2,\n\n\tNever = 3\n}\n\nexport enum TaskEventKind {\n\t/** Indicates a task's properties or configuration have changed */\n\tChanged = 'changed',\n\n\t/** Indicates a task has begun executing */\n\tProcessStarted = 'processStarted',\n\n\t/** Indicates a task process has completed */\n\tProcessEnded = 'processEnded',\n\n\t/** Indicates a task was terminated, either by user action or by the system */\n\tTerminated = 'terminated',\n\n\t/** Indicates a task has started running */\n\tStart = 'start',\n\n\t/** Indicates a task has acquired all needed input/variables to execute */\n\tAcquiredInput = 'acquiredInput',\n\n\t/** Indicates a dependent task has started */\n\tDependsOnStarted = 'dependsOnStarted',\n\n\t/** Indicates a task is actively running/processing */\n\tActive = 'active',\n\n\t/** Indicates a task is paused/waiting but not complete */\n\tInactive = 'inactive',\n\n\t/** Indicates a task has completed fully */\n\tEnd = 'end',\n\n\t/** Indicates the task's problem matcher has started */\n\tProblemMatcherStarted = 'problemMatcherStarted',\n\n\t/** Indicates the task's problem matcher has ended without errors */\n\tProblemMatcherEnded = 'problemMatcherEnded',\n\n\t/** Indicates the task's problem matcher has ended with errors */\n\tProblemMatcherFoundErrors = 'problemMatcherFoundErrors'\n}\n\n\nexport enum TaskPanelKind {\n\tShared = 1,\n\n\tDedicated = 2,\n\n\tNew = 3\n}\n\n@es5ClassCompat\nexport class TaskGroup implements vscode.TaskGroup {\n\n\tisDefault: boolean | undefined;\n\tprivate _id: string;\n\n\tpublic static Clean: TaskGroup = new TaskGroup('clean', 'Clean');\n\n\tpublic static Build: TaskGroup = new TaskGroup('build', 'Build');\n\n\tpublic static Rebuild: TaskGroup = new TaskGroup('rebuild', 'Rebuild');\n\n\tpublic static Test: TaskGroup = new TaskGroup('test', 'Test');\n\n\tpublic static from(value: string) {\n\t\tswitch (value) {\n\t\t\tcase 'clean':\n\t\t\t\treturn TaskGroup.Clean;\n\t\t\tcase 'build':\n\t\t\t\treturn TaskGroup.Build;\n\t\t\tcase 'rebuild':\n\t\t\t\treturn TaskGroup.Rebuild;\n\t\t\tcase 'test':\n\t\t\t\treturn TaskGroup.Test;\n\t\t\tdefault:\n\t\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tconstructor(id: string, public readonly label: string) {\n\t\tif (typeof id !== 'string') {\n\t\t\tthrow illegalArgument('name');\n\t\t}\n\t\tif (typeof label !== 'string') {\n\t\t\tthrow illegalArgument('name');\n\t\t}\n\t\tthis._id = id;\n\t}\n\n\tget id(): string {\n\t\treturn this._id;\n\t}\n}\n\nfunction computeTaskExecutionId(values: string[]): string {\n\tlet id: string = '';\n\tfor (let i = 0; i < values.length; i++) {\n\t\tid += values[i].replace(/,/g, ',,') + ',';\n\t}\n\treturn id;\n}\n\n@es5ClassCompat\nexport class ProcessExecution implements vscode.ProcessExecution {\n\n\tprivate _process: string;\n\tprivate _args: string[];\n\tprivate _options: vscode.ProcessExecutionOptions | undefined;\n\n\tconstructor(process: string, options?: vscode.ProcessExecutionOptions);\n\tconstructor(process: string, args: string[], options?: vscode.ProcessExecutionOptions);\n\tconstructor(process: string, varg1?: string[] | vscode.ProcessExecutionOptions, varg2?: vscode.ProcessExecutionOptions) {\n\t\tif (typeof process !== 'string') {\n\t\t\tthrow illegalArgument('process');\n\t\t}\n\t\tthis._args = [];\n\t\tthis._process = process;\n\t\tif (varg1 !== undefined) {\n\t\t\tif (Array.isArray(varg1)) {\n\t\t\t\tthis._args = varg1;\n\t\t\t\tthis._options = varg2;\n\t\t\t} else {\n\t\t\t\tthis._options = varg1;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tget process(): string {\n\t\treturn this._process;\n\t}\n\n\tset process(value: string) {\n\t\tif (typeof value !== 'string') {\n\t\t\tthrow illegalArgument('process');\n\t\t}\n\t\tthis._process = value;\n\t}\n\n\tget args(): string[] {\n\t\treturn this._args;\n\t}\n\n\tset args(value: string[]) {\n\t\tif (!Array.isArray(value)) {\n\t\t\tvalue = [];\n\t\t}\n\t\tthis._args = value;\n\t}\n\n\tget options(): vscode.ProcessExecutionOptions | undefined {\n\t\treturn this._options;\n\t}\n\n\tset options(value: vscode.ProcessExecutionOptions | undefined) {\n\t\tthis._options = value;\n\t}\n\n\tpublic computeId(): string {\n\t\tconst props: string[] = [];\n\t\tprops.push('process');\n\t\tif (this._process !== undefined) {\n\t\t\tprops.push(this._process);\n\t\t}\n\t\tif (this._args && this._args.length > 0) {\n\t\t\tfor (const arg of this._args) {\n\t\t\t\tprops.push(arg);\n\t\t\t}\n\t\t}\n\t\treturn computeTaskExecutionId(props);\n\t}\n}\n\n@es5ClassCompat\nexport class ShellExecution implements vscode.ShellExecution {\n\n\tprivate _commandLine: string | undefined;\n\tprivate _command: string | vscode.ShellQuotedString | undefined;\n\tprivate _args: (string | vscode.ShellQuotedString)[] = [];\n\tprivate _options: vscode.ShellExecutionOptions | undefined;\n\n\tconstructor(commandLine: string, options?: vscode.ShellExecutionOptions);\n\tconstructor(command: string | vscode.ShellQuotedString, args: (string | vscode.ShellQuotedString)[], options?: vscode.ShellExecutionOptions);\n\tconstructor(arg0: string | vscode.ShellQuotedString, arg1?: vscode.ShellExecutionOptions | (string | vscode.ShellQuotedString)[], arg2?: vscode.ShellExecutionOptions) {\n\t\tif (Array.isArray(arg1)) {\n\t\t\tif (!arg0) {\n\t\t\t\tthrow illegalArgument('command can\\'t be undefined or null');\n\t\t\t}\n\t\t\tif (typeof arg0 !== 'string' && typeof arg0.value !== 'string') {\n\t\t\t\tthrow illegalArgument('command');\n\t\t\t}\n\t\t\tthis._command = arg0;\n\t\t\tif (arg1) {\n\t\t\t\tthis._args = arg1;\n\t\t\t}\n\t\t\tthis._options = arg2;\n\t\t} else {\n\t\t\tif (typeof arg0 !== 'string') {\n\t\t\t\tthrow illegalArgument('commandLine');\n\t\t\t}\n\t\t\tthis._commandLine = arg0;\n\t\t\tthis._options = arg1;\n\t\t}\n\t}\n\n\tget commandLine(): string | undefined {\n\t\treturn this._commandLine;\n\t}\n\n\tset commandLine(value: string | undefined) {\n\t\tif (typeof value !== 'string') {\n\t\t\tthrow illegalArgument('commandLine');\n\t\t}\n\t\tthis._commandLine = value;\n\t}\n\n\tget command(): string | vscode.ShellQuotedString {\n\t\treturn this._command ? this._command : '';\n\t}\n\n\tset command(value: string | vscode.ShellQuotedString) {\n\t\tif (typeof value !== 'string' && typeof value.value !== 'string') {\n\t\t\tthrow illegalArgument('command');\n\t\t}\n\t\tthis._command = value;\n\t}\n\n\tget args(): (string | vscode.ShellQuotedString)[] {\n\t\treturn this._args;\n\t}\n\n\tset args(value: (string | vscode.ShellQuotedString)[] | undefined) {\n\t\tthis._args = value || [];\n\t}\n\n\tget options(): vscode.ShellExecutionOptions | undefined {\n\t\treturn this._options;\n\t}\n\n\tset options(value: vscode.ShellExecutionOptions | undefined) {\n\t\tthis._options = value;\n\t}\n\n\tpublic computeId(): string {\n\t\tconst props: string[] = [];\n\t\tprops.push('shell');\n\t\tif (this._commandLine !== undefined) {\n\t\t\tprops.push(this._commandLine);\n\t\t}\n\t\tif (this._command !== undefined) {\n\t\t\tprops.push(typeof this._command === 'string' ? this._command : this._command.value);\n\t\t}\n\t\tif (this._args && this._args.length > 0) {\n\t\t\tfor (const arg of this._args) {\n\t\t\t\tprops.push(typeof arg === 'string' ? arg : arg.value);\n\t\t\t}\n\t\t}\n\t\treturn computeTaskExecutionId(props);\n\t}\n}\n\nexport enum ShellQuoting {\n\tEscape = 1,\n\tStrong = 2,\n\tWeak = 3\n}\n\nexport enum TaskScope {\n\tGlobal = 1,\n\tWorkspace = 2\n}\n\nexport class CustomExecution implements vscode.CustomExecution {\n\tprivate _callback: (resolvedDefinition: vscode.TaskDefinition) => Thenable<vscode.Pseudoterminal>;\n\tconstructor(callback: (resolvedDefinition: vscode.TaskDefinition) => Thenable<vscode.Pseudoterminal>) {\n\t\tthis._callback = callback;\n\t}\n\tpublic computeId(): string {\n\t\treturn 'customExecution' + generateUuid();\n\t}\n\n\tpublic set callback(value: (resolvedDefinition: vscode.TaskDefinition) => Thenable<vscode.Pseudoterminal>) {\n\t\tthis._callback = value;\n\t}\n\n\tpublic get callback(): ((resolvedDefinition: vscode.TaskDefinition) => Thenable<vscode.Pseudoterminal>) {\n\t\treturn this._callback;\n\t}\n}\n\n@es5ClassCompat\nexport class Task implements vscode.Task {\n\n\tprivate static ExtensionCallbackType: string = 'customExecution';\n\tprivate static ProcessType: string = 'process';\n\tprivate static ShellType: string = 'shell';\n\tprivate static EmptyType: string = '$empty';\n\n\tprivate __id: string | undefined;\n\tprivate __deprecated: boolean = false;\n\n\tprivate _definition: vscode.TaskDefinition;\n\tprivate _scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined;\n\tprivate _name: string;\n\tprivate _execution: ProcessExecution | ShellExecution | CustomExecution | undefined;\n\tprivate _problemMatchers: string[];\n\tprivate _hasDefinedMatchers: boolean;\n\tprivate _isBackground: boolean;\n\tprivate _source: string;\n\tprivate _group: TaskGroup | undefined;\n\tprivate _presentationOptions: vscode.TaskPresentationOptions;\n\tprivate _runOptions: vscode.RunOptions;\n\tprivate _detail: string | undefined;\n\n\tconstructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);\n\tconstructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);\n\tconstructor(definition: vscode.TaskDefinition, arg2: string | (vscode.TaskScope.Global | vscode.TaskScope.Workspace) | vscode.WorkspaceFolder, arg3: any, arg4?: any, arg5?: any, arg6?: any) {\n\t\tthis._definition = this.definition = definition;\n\t\tlet problemMatchers: string | string[];\n\t\tif (typeof arg2 === 'string') {\n\t\t\tthis._name = this.name = arg2;\n\t\t\tthis._source = this.source = arg3;\n\t\t\tthis.execution = arg4;\n\t\t\tproblemMatchers = arg5;\n\t\t\tthis.__deprecated = true;\n\t\t} else if (arg2 === TaskScope.Global || arg2 === TaskScope.Workspace) {\n\t\t\tthis.target = arg2;\n\t\t\tthis._name = this.name = arg3;\n\t\t\tthis._source = this.source = arg4;\n\t\t\tthis.execution = arg5;\n\t\t\tproblemMatchers = arg6;\n\t\t} else {\n\t\t\tthis.target = arg2;\n\t\t\tthis._name = this.name = arg3;\n\t\t\tthis._source = this.source = arg4;\n\t\t\tthis.execution = arg5;\n\t\t\tproblemMatchers = arg6;\n\t\t}\n\t\tif (typeof problemMatchers === 'string') {\n\t\t\tthis._problemMatchers = [problemMatchers];\n\t\t\tthis._hasDefinedMatchers = true;\n\t\t} else if (Array.isArray(problemMatchers)) {\n\t\t\tthis._problemMatchers = problemMatchers;\n\t\t\tthis._hasDefinedMatchers = true;\n\t\t} else {\n\t\t\tthis._problemMatchers = [];\n\t\t\tthis._hasDefinedMatchers = false;\n\t\t}\n\t\tthis._isBackground = false;\n\t\tthis._presentationOptions = Object.create(null);\n\t\tthis._runOptions = Object.create(null);\n\t}\n\n\tget _id(): string | undefined {\n\t\treturn this.__id;\n\t}\n\n\tset _id(value: string | undefined) {\n\t\tthis.__id = value;\n\t}\n\n\tget _deprecated(): boolean {\n\t\treturn this.__deprecated;\n\t}\n\n\tprivate clear(): void {\n\t\tif (this.__id === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tthis.__id = undefined;\n\t\tthis._scope = undefined;\n\t\tthis.computeDefinitionBasedOnExecution();\n\t}\n\n\tprivate computeDefinitionBasedOnExecution(): void {\n\t\tif (this._execution instanceof ProcessExecution) {\n\t\t\tthis._definition = {\n\t\t\t\ttype: Task.ProcessType,\n\t\t\t\tid: this._execution.computeId()\n\t\t\t};\n\t\t} else if (this._execution instanceof ShellExecution) {\n\t\t\tthis._definition = {\n\t\t\t\ttype: Task.ShellType,\n\t\t\t\tid: this._execution.computeId()\n\t\t\t};\n\t\t} else if (this._execution instanceof CustomExecution) {\n\t\t\tthis._definition = {\n\t\t\t\ttype: Task.ExtensionCallbackType,\n\t\t\t\tid: this._execution.computeId()\n\t\t\t};\n\t\t} else {\n\t\t\tthis._definition = {\n\t\t\t\ttype: Task.EmptyType,\n\t\t\t\tid: generateUuid()\n\t\t\t};\n\t\t}\n\t}\n\n\tget definition(): vscode.TaskDefinition {\n\t\treturn this._definition;\n\t}\n\n\tset definition(value: vscode.TaskDefinition) {\n\t\tif (value === undefined || value === null) {\n\t\t\tthrow illegalArgument('Kind can\\'t be undefined or null');\n\t\t}\n\t\tthis.clear();\n\t\tthis._definition = value;\n\t}\n\n\tget scope(): vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined {\n\t\treturn this._scope;\n\t}\n\n\tset target(value: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder) {\n\t\tthis.clear();\n\t\tthis._scope = value;\n\t}\n\n\tget name(): string {\n\t\treturn this._name;\n\t}\n\n\tset name(value: string) {\n\t\tif (typeof value !== 'string') {\n\t\t\tthrow illegalArgument('name');\n\t\t}\n\t\tthis.clear();\n\t\tthis._name = value;\n\t}\n\n\tget execution(): ProcessExecution | ShellExecution | CustomExecution | undefined {\n\t\treturn this._execution;\n\t}\n\n\tset execution(value: ProcessExecution | ShellExecution | CustomExecution | undefined) {\n\t\tif (value === null) {\n\t\t\tvalue = undefined;\n\t\t}\n\t\tthis.clear();\n\t\tthis._execution = value;\n\t\tconst type = this._definition.type;\n\t\tif (Task.EmptyType === type || Task.ProcessType === type || Task.ShellType === type || Task.ExtensionCallbackType === type) {\n\t\t\tthis.computeDefinitionBasedOnExecution();\n\t\t}\n\t}\n\n\tget problemMatchers(): string[] {\n\t\treturn this._problemMatchers;\n\t}\n\n\tset problemMatchers(value: string[]) {\n\t\tif (!Array.isArray(value)) {\n\t\t\tthis.clear();\n\t\t\tthis._problemMatchers = [];\n\t\t\tthis._hasDefinedMatchers = false;\n\t\t\treturn;\n\t\t} else {\n\t\t\tthis.clear();\n\t\t\tthis._problemMatchers = value;\n\t\t\tthis._hasDefinedMatchers = true;\n\t\t}\n\t}\n\n\tget hasDefinedMatchers(): boolean {\n\t\treturn this._hasDefinedMatchers;\n\t}\n\n\tget isBackground(): boolean {\n\t\treturn this._isBackground;\n\t}\n\n\tset isBackground(value: boolean) {\n\t\tif (value !== true && value !== false) {\n\t\t\tvalue = false;\n\t\t}\n\t\tthis.clear();\n\t\tthis._isBackground = value;\n\t}\n\n\tget source(): string {\n\t\treturn this._source;\n\t}\n\n\tset source(value: string) {\n\t\tif (typeof value !== 'string' || value.length === 0) {\n\t\t\tthrow illegalArgument('source must be a string of length > 0');\n\t\t}\n\t\tthis.clear();\n\t\tthis._source = value;\n\t}\n\n\tget group(): TaskGroup | undefined {\n\t\treturn this._group;\n\t}\n\n\tset group(value: TaskGroup | undefined) {\n\t\tif (value === null) {\n\t\t\tvalue = undefined;\n\t\t}\n\t\tthis.clear();\n\t\tthis._group = value;\n\t}\n\n\tget detail(): string | undefined {\n\t\treturn this._detail;\n\t}\n\n\tset detail(value: string | undefined) {\n\t\tif (value === null) {\n\t\t\tvalue = undefined;\n\t\t}\n\t\tthis._detail = value;\n\t}\n\n\tget presentationOptions(): vscode.TaskPresentationOptions {\n\t\treturn this._presentationOptions;\n\t}\n\n\tset presentationOptions(value: vscode.TaskPresentationOptions) {\n\t\tif (value === null || value === undefined) {\n\t\t\tvalue = Object.create(null);\n\t\t}\n\t\tthis.clear();\n\t\tthis._presentationOptions = value;\n\t}\n\n\tget runOptions(): vscode.RunOptions {\n\t\treturn this._runOptions;\n\t}\n\n\tset runOptions(value: vscode.RunOptions) {\n\t\tif (value === null || value === undefined) {\n\t\t\tvalue = Object.create(null);\n\t\t}\n\t\tthis.clear();\n\t\tthis._runOptions = value;\n\t}\n}\n\n\nexport enum ProgressLocation {\n\tSourceControl = 1,\n\tWindow = 10,\n\tNotification = 15\n}\n\nexport namespace ViewBadge {\n\texport function isViewBadge(thing: any): thing is vscode.ViewBadge {\n\t\tconst viewBadgeThing = thing as vscode.ViewBadge;\n\n\t\tif (!isNumber(viewBadgeThing.value)) {\n\t\t\tconsole.log('INVALID view badge, invalid value', viewBadgeThing.value);\n\t\t\treturn false;\n\t\t}\n\t\tif (viewBadgeThing.tooltip && !isString(viewBadgeThing.tooltip)) {\n\t\t\tconsole.log('INVALID view badge, invalid tooltip', viewBadgeThing.tooltip);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\n\n@es5ClassCompat\nexport class TreeItem {\n\n\tlabel?: string | vscode.TreeItemLabel;\n\tresourceUri?: URI;\n\ticonPath?: string | URI | { light: string | URI; dark: string | URI } | ThemeIcon;\n\tcommand?: vscode.Command;\n\tcontextValue?: string;\n\ttooltip?: string | vscode.MarkdownString;\n\tcheckboxState?: vscode.TreeItemCheckboxState;\n\n\tstatic isTreeItem(thing: any, extension: IExtensionDescription): thing is TreeItem {\n\t\tconst treeItemThing = thing as vscode.TreeItem;\n\n\t\tif (treeItemThing.checkboxState !== undefined) {\n\t\t\tconst checkbox = isNumber(treeItemThing.checkboxState) ? treeItemThing.checkboxState :\n\t\t\t\tisObject(treeItemThing.checkboxState) && isNumber(treeItemThing.checkboxState.state) ? treeItemThing.checkboxState.state : undefined;\n\t\t\tconst tooltip = !isNumber(treeItemThing.checkboxState) && isObject(treeItemThing.checkboxState) ? treeItemThing.checkboxState.tooltip : undefined;\n\t\t\tif (checkbox === undefined || (checkbox !== TreeItemCheckboxState.Checked && checkbox !== TreeItemCheckboxState.Unchecked) || (tooltip !== undefined && !isString(tooltip))) {\n\t\t\t\tconsole.log('INVALID tree item, invalid checkboxState', treeItemThing.checkboxState);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif (thing instanceof TreeItem) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (treeItemThing.label !== undefined && !isString(treeItemThing.label) && !(treeItemThing.label?.label)) {\n\t\t\tconsole.log('INVALID tree item, invalid label', treeItemThing.label);\n\t\t\treturn false;\n\t\t}\n\t\tif ((treeItemThing.id !== undefined) && !isString(treeItemThing.id)) {\n\t\t\tconsole.log('INVALID tree item, invalid id', treeItemThing.id);\n\t\t\treturn false;\n\t\t}\n\t\tif ((treeItemThing.iconPath !== undefined) && !isString(treeItemThing.iconPath) && !URI.isUri(treeItemThing.iconPath) && (!treeItemThing.iconPath || !isString((treeItemThing.iconPath as vscode.ThemeIcon).id))) {\n\t\t\tconst asLightAndDarkThing = treeItemThing.iconPath as { light: string | URI; dark: string | URI } | null;\n\t\t\tif (!asLightAndDarkThing || (!isString(asLightAndDarkThing.light) && !URI.isUri(asLightAndDarkThing.light) && !isString(asLightAndDarkThing.dark) && !URI.isUri(asLightAndDarkThing.dark))) {\n\t\t\t\tconsole.log('INVALID tree item, invalid iconPath', treeItemThing.iconPath);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif ((treeItemThing.description !== undefined) && !isString(treeItemThing.description) && (typeof treeItemThing.description !== 'boolean')) {\n\t\t\tconsole.log('INVALID tree item, invalid description', treeItemThing.description);\n\t\t\treturn false;\n\t\t}\n\t\tif ((treeItemThing.resourceUri !== undefined) && !URI.isUri(treeItemThing.resourceUri)) {\n\t\t\tconsole.log('INVALID tree item, invalid resourceUri', treeItemThing.resourceUri);\n\t\t\treturn false;\n\t\t}\n\t\tif ((treeItemThing.tooltip !== undefined) && !isString(treeItemThing.tooltip) && !(treeItemThing.tooltip instanceof MarkdownString)) {\n\t\t\tconsole.log('INVALID tree item, invalid tooltip', treeItemThing.tooltip);\n\t\t\treturn false;\n\t\t}\n\t\tif ((treeItemThing.command !== undefined) && !treeItemThing.command.command) {\n\t\t\tconsole.log('INVALID tree item, invalid command', treeItemThing.command);\n\t\t\treturn false;\n\t\t}\n\t\tif ((treeItemThing.collapsibleState !== undefined) && (treeItemThing.collapsibleState < TreeItemCollapsibleState.None) && (treeItemThing.collapsibleState > TreeItemCollapsibleState.Expanded)) {\n\t\t\tconsole.log('INVALID tree item, invalid collapsibleState', treeItemThing.collapsibleState);\n\t\t\treturn false;\n\t\t}\n\t\tif ((treeItemThing.contextValue !== undefined) && !isString(treeItemThing.contextValue)) {\n\t\t\tconsole.log('INVALID tree item, invalid contextValue', treeItemThing.contextValue);\n\t\t\treturn false;\n\t\t}\n\t\tif ((treeItemThing.accessibilityInformation !== undefined) && !treeItemThing.accessibilityInformation?.label) {\n\t\t\tconsole.log('INVALID tree item, invalid accessibilityInformation', treeItemThing.accessibilityInformation);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tconstructor(label: string | vscode.TreeItemLabel, collapsibleState?: vscode.TreeItemCollapsibleState);\n\tconstructor(resourceUri: URI, collapsibleState?: vscode.TreeItemCollapsibleState);\n\tconstructor(arg1: string | vscode.TreeItemLabel | URI, public collapsibleState: vscode.TreeItemCollapsibleState = TreeItemCollapsibleState.None) {\n\t\tif (URI.isUri(arg1)) {\n\t\t\tthis.resourceUri = arg1;\n\t\t} else {\n\t\t\tthis.label = arg1;\n\t\t}\n\t}\n\n}\n\nexport enum TreeItemCollapsibleState {\n\tNone = 0,\n\tCollapsed = 1,\n\tExpanded = 2\n}\n\nexport enum TreeItemCheckboxState {\n\tUnchecked = 0,\n\tChecked = 1\n}\n\n@es5ClassCompat\nexport class DataTransferItem implements vscode.DataTransferItem {\n\n\tasync asString(): Promise<string> {\n\t\treturn typeof this.value === 'string' ? this.value : JSON.stringify(this.value);\n\t}\n\n\tasFile(): undefined | vscode.DataTransferFile {\n\t\treturn undefined;\n\t}\n\n\tconstructor(\n\t\tpublic readonly value: any,\n\t) { }\n}\n\n/**\n * A data transfer item that has been created by VS Code instead of by a extension.\n *\n * Intentionally not exported to extensions.\n */\nexport class InternalDataTransferItem extends DataTransferItem { }\n\n/**\n * A data transfer item for a file.\n *\n * Intentionally not exported to extensions as only we can create these.\n */\nexport class InternalFileDataTransferItem extends InternalDataTransferItem {\n\n\treadonly #file: vscode.DataTransferFile;\n\n\tconstructor(file: vscode.DataTransferFile) {\n\t\tsuper('');\n\t\tthis.#file = file;\n\t}\n\n\toverride asFile() {\n\t\treturn this.#file;\n\t}\n}\n\n/**\n * Intentionally not exported to extensions\n */\nexport class DataTransferFile implements vscode.DataTransferFile {\n\n\tpublic readonly name: string;\n\tpublic readonly uri: vscode.Uri | undefined;\n\n\tpublic readonly _itemId: string;\n\tprivate readonly _getData: () => Promise<Uint8Array>;\n\n\tconstructor(name: string, uri: vscode.Uri | undefined, itemId: string, getData: () => Promise<Uint8Array>) {\n\t\tthis.name = name;\n\t\tthis.uri = uri;\n\t\tthis._itemId = itemId;\n\t\tthis._getData = getData;\n\t}\n\n\tdata(): Promise<Uint8Array> {\n\t\treturn this._getData();\n\t}\n}\n\n@es5ClassCompat\nexport class DataTransfer implements vscode.DataTransfer {\n\t#items = new Map<string, vscode.DataTransferItem[]>();\n\n\tconstructor(init?: Iterable<readonly [string, vscode.DataTransferItem]>) {\n\t\tfor (const [mime, item] of init ?? []) {\n\t\t\tconst existing = this.#items.get(this.#normalizeMime(mime));\n\t\t\tif (existing) {\n\t\t\t\texisting.push(item);\n\t\t\t} else {\n\t\t\t\tthis.#items.set(this.#normalizeMime(mime), [item]);\n\t\t\t}\n\t\t}\n\t}\n\n\tget(mimeType: string): vscode.DataTransferItem | undefined {\n\t\treturn this.#items.get(this.#normalizeMime(mimeType))?.[0];\n\t}\n\n\tset(mimeType: string, value: vscode.DataTransferItem): void {\n\t\t// This intentionally overwrites all entries for a given mimetype.\n\t\t// This is similar to how the DOM DataTransfer type works\n\t\tthis.#items.set(this.#normalizeMime(mimeType), [value]);\n\t}\n\n\tforEach(callbackfn: (value: vscode.DataTransferItem, key: string, dataTransfer: DataTransfer) => void, thisArg?: unknown): void {\n\t\tfor (const [mime, items] of this.#items) {\n\t\t\tfor (const item of items) {\n\t\t\t\tcallbackfn.call(thisArg, item, mime, this);\n\t\t\t}\n\t\t}\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[mimeType: string, item: vscode.DataTransferItem]> {\n\t\tfor (const [mime, items] of this.#items) {\n\t\t\tfor (const item of items) {\n\t\t\t\tyield [mime, item];\n\t\t\t}\n\t\t}\n\t}\n\n\t#normalizeMime(mimeType: string): string {\n\t\treturn mimeType.toLowerCase();\n\t}\n}\n\n@es5ClassCompat\nexport class DocumentDropEdit {\n\ttitle?: string;\n\n\tid: string | undefined;\n\n\tinsertText: string | SnippetString;\n\n\tadditionalEdit?: WorkspaceEdit;\n\n\tkind?: DocumentDropOrPasteEditKind;\n\n\tconstructor(insertText: string | SnippetString, title?: string, kind?: DocumentDropOrPasteEditKind) {\n\t\tthis.insertText = insertText;\n\t\tthis.title = title;\n\t\tthis.kind = kind;\n\t}\n}\n\nexport enum DocumentPasteTriggerKind {\n\tAutomatic = 0,\n\tPasteAs = 1,\n}\n\nexport class DocumentDropOrPasteEditKind {\n\tstatic Empty: DocumentDropOrPasteEditKind;\n\tstatic Text: DocumentDropOrPasteEditKind;\n\tstatic TextUpdateImports: DocumentDropOrPasteEditKind;\n\n\tprivate static sep = '.';\n\n\tconstructor(\n\t\tpublic readonly value: string\n\t) { }\n\n\tpublic append(...parts: string[]): DocumentDropOrPasteEditKind {\n\t\treturn new DocumentDropOrPasteEditKind((this.value ? [this.value, ...parts] : parts).join(DocumentDropOrPasteEditKind.sep));\n\t}\n\n\tpublic intersects(other: DocumentDropOrPasteEditKind): boolean {\n\t\treturn this.contains(other) || other.contains(this);\n\t}\n\n\tpublic contains(other: DocumentDropOrPasteEditKind): boolean {\n\t\treturn this.value === other.value || other.value.startsWith(this.value + DocumentDropOrPasteEditKind.sep);\n\t}\n}\nDocumentDropOrPasteEditKind.Empty = new DocumentDropOrPasteEditKind('');\nDocumentDropOrPasteEditKind.Text = new DocumentDropOrPasteEditKind('text');\nDocumentDropOrPasteEditKind.TextUpdateImports = DocumentDropOrPasteEditKind.Text.append('updateImports');\n\nexport class DocumentPasteEdit {\n\n\ttitle: string;\n\tinsertText: string | SnippetString;\n\tadditionalEdit?: WorkspaceEdit;\n\tkind: DocumentDropOrPasteEditKind;\n\n\tconstructor(insertText: string | SnippetString, title: string, kind: DocumentDropOrPasteEditKind) {\n\t\tthis.title = title;\n\t\tthis.insertText = insertText;\n\t\tthis.kind = kind;\n\t}\n}\n\n@es5ClassCompat\nexport class ThemeIcon {\n\n\tstatic File: ThemeIcon;\n\tstatic Folder: ThemeIcon;\n\n\treadonly id: string;\n\treadonly color?: ThemeColor;\n\n\tconstructor(id: string, color?: ThemeColor) {\n\t\tthis.id = id;\n\t\tthis.color = color;\n\t}\n\n\tstatic isThemeIcon(thing: any) {\n\t\tif (typeof thing.id !== 'string') {\n\t\t\tconsole.log('INVALID ThemeIcon, invalid id', thing.id);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\nThemeIcon.File = new ThemeIcon('file');\nThemeIcon.Folder = new ThemeIcon('folder');\n\n\n@es5ClassCompat\nexport class ThemeColor {\n\tid: string;\n\tconstructor(id: string) {\n\t\tthis.id = id;\n\t}\n}\n\nexport enum ConfigurationTarget {\n\tGlobal = 1,\n\n\tWorkspace = 2,\n\n\tWorkspaceFolder = 3\n}\n\n@es5ClassCompat\nexport class RelativePattern implements IRelativePattern {\n\n\tpattern: string;\n\n\tprivate _base!: string;\n\tget base(): string {\n\t\treturn this._base;\n\t}\n\tset base(base: string) {\n\t\tthis._base = base;\n\t\tthis._baseUri = URI.file(base);\n\t}\n\n\tprivate _baseUri!: URI;\n\tget baseUri(): URI {\n\t\treturn this._baseUri;\n\t}\n\tset baseUri(baseUri: URI) {\n\t\tthis._baseUri = baseUri;\n\t\tthis._base = baseUri.fsPath;\n\t}\n\n\tconstructor(base: vscode.WorkspaceFolder | URI | string, pattern: string) {\n\t\tif (typeof base !== 'string') {\n\t\t\tif (!base || !URI.isUri(base) && !URI.isUri(base.uri)) {\n\t\t\t\tthrow illegalArgument('base');\n\t\t\t}\n\t\t}\n\n\t\tif (typeof pattern !== 'string') {\n\t\t\tthrow illegalArgument('pattern');\n\t\t}\n\n\t\tif (typeof base === 'string') {\n\t\t\tthis.baseUri = URI.file(base);\n\t\t} else if (URI.isUri(base)) {\n\t\t\tthis.baseUri = base;\n\t\t} else {\n\t\t\tthis.baseUri = base.uri;\n\t\t}\n\n\t\tthis.pattern = pattern;\n\t}\n\n\ttoJSON(): IRelativePatternDto {\n\t\treturn {\n\t\t\tpattern: this.pattern,\n\t\t\tbase: this.base,\n\t\t\tbaseUri: this.baseUri.toJSON()\n\t\t};\n\t}\n}\n\nconst breakpointIds = new WeakMap<Breakpoint, string>();\n\n/**\n * We want to be able to construct Breakpoints internally that have a particular id, but we don't want extensions to be\n * able to do this with the exposed Breakpoint classes in extension API.\n * We also want \"instanceof\" to work with debug.breakpoints and the exposed breakpoint classes.\n * And private members will be renamed in the built js, so casting to any and setting a private member is not safe.\n * So, we store internal breakpoint IDs in a WeakMap. This function must be called after constructing a Breakpoint\n * with a known id.\n */\nexport function setBreakpointId(bp: Breakpoint, id: string) {\n\tbreakpointIds.set(bp, id);\n}\n\n@es5ClassCompat\nexport class Breakpoint {\n\n\tprivate _id: string | undefined;\n\n\treadonly enabled: boolean;\n\treadonly condition?: string;\n\treadonly hitCondition?: string;\n\treadonly logMessage?: string;\n\treadonly mode?: string;\n\n\tprotected constructor(enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string, mode?: string) {\n\t\tthis.enabled = typeof enabled === 'boolean' ? enabled : true;\n\t\tif (typeof condition === 'string') {\n\t\t\tthis.condition = condition;\n\t\t}\n\t\tif (typeof hitCondition === 'string') {\n\t\t\tthis.hitCondition = hitCondition;\n\t\t}\n\t\tif (typeof logMessage === 'string') {\n\t\t\tthis.logMessage = logMessage;\n\t\t}\n\t\tif (typeof mode === 'string') {\n\t\t\tthis.mode = mode;\n\t\t}\n\t}\n\n\tget id(): string {\n\t\tif (!this._id) {\n\t\t\tthis._id = breakpointIds.get(this) ?? generateUuid();\n\t\t}\n\t\treturn this._id;\n\t}\n}\n\n@es5ClassCompat\nexport class SourceBreakpoint extends Breakpoint {\n\treadonly location: Location;\n\n\tconstructor(location: Location, enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string, mode?: string) {\n\t\tsuper(enabled, condition, hitCondition, logMessage, mode);\n\t\tif (location === null) {\n\t\t\tthrow illegalArgument('location');\n\t\t}\n\t\tthis.location = location;\n\t}\n}\n\n@es5ClassCompat\nexport class FunctionBreakpoint extends Breakpoint {\n\treadonly functionName: string;\n\n\tconstructor(functionName: string, enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string, mode?: string) {\n\t\tsuper(enabled, condition, hitCondition, logMessage, mode);\n\t\tthis.functionName = functionName;\n\t}\n}\n\n@es5ClassCompat\nexport class DataBreakpoint extends Breakpoint {\n\treadonly label: string;\n\treadonly dataId: string;\n\treadonly canPersist: boolean;\n\n\tconstructor(label: string, dataId: string, canPersist: boolean, enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string, mode?: string) {\n\t\tsuper(enabled, condition, hitCondition, logMessage, mode);\n\t\tif (!dataId) {\n\t\t\tthrow illegalArgument('dataId');\n\t\t}\n\t\tthis.label = label;\n\t\tthis.dataId = dataId;\n\t\tthis.canPersist = canPersist;\n\t}\n}\n\n@es5ClassCompat\nexport class DebugAdapterExecutable implements vscode.DebugAdapterExecutable {\n\treadonly command: string;\n\treadonly args: string[];\n\treadonly options?: vscode.DebugAdapterExecutableOptions;\n\n\tconstructor(command: string, args: string[], options?: vscode.DebugAdapterExecutableOptions) {\n\t\tthis.command = command;\n\t\tthis.args = args || [];\n\t\tthis.options = options;\n\t}\n}\n\n@es5ClassCompat\nexport class DebugAdapterServer implements vscode.DebugAdapterServer {\n\treadonly port: number;\n\treadonly host?: string;\n\n\tconstructor(port: number, host?: string) {\n\t\tthis.port = port;\n\t\tthis.host = host;\n\t}\n}\n\n@es5ClassCompat\nexport class DebugAdapterNamedPipeServer implements vscode.DebugAdapterNamedPipeServer {\n\tconstructor(public readonly path: string) {\n\t}\n}\n\n@es5ClassCompat\nexport class DebugAdapterInlineImplementation implements vscode.DebugAdapterInlineImplementation {\n\treadonly implementation: vscode.DebugAdapter;\n\n\tconstructor(impl: vscode.DebugAdapter) {\n\t\tthis.implementation = impl;\n\t}\n}\n\n\nexport class DebugStackFrame implements vscode.DebugStackFrame {\n\tconstructor(\n\t\tpublic readonly session: vscode.DebugSession,\n\t\treadonly threadId: number,\n\t\treadonly frameId: number) { }\n}\n\nexport class DebugThread implements vscode.DebugThread {\n\tconstructor(\n\t\tpublic readonly session: vscode.DebugSession,\n\t\treadonly threadId: number) { }\n}\n\n\n@es5ClassCompat\nexport class EvaluatableExpression implements vscode.EvaluatableExpression {\n\treadonly range: vscode.Range;\n\treadonly expression?: string;\n\n\tconstructor(range: vscode.Range, expression?: string) {\n\t\tthis.range = range;\n\t\tthis.expression = expression;\n\t}\n}\n\nexport enum InlineCompletionTriggerKind {\n\tInvoke = 0,\n\tAutomatic = 1,\n}\n\nexport enum InlineCompletionsDisposeReasonKind {\n\tOther = 0,\n\tEmpty = 1,\n\tTokenCancellation = 2,\n\tLostRace = 3,\n\tNotTaken = 4,\n}\n\n@es5ClassCompat\nexport class InlineValueText implements vscode.InlineValueText {\n\treadonly range: Range;\n\treadonly text: string;\n\n\tconstructor(range: Range, text: string) {\n\t\tthis.range = range;\n\t\tthis.text = text;\n\t}\n}\n\n@es5ClassCompat\nexport class InlineValueVariableLookup implements vscode.InlineValueVariableLookup {\n\treadonly range: Range;\n\treadonly variableName?: string;\n\treadonly caseSensitiveLookup: boolean;\n\n\tconstructor(range: Range, variableName?: string, caseSensitiveLookup: boolean = true) {\n\t\tthis.range = range;\n\t\tthis.variableName = variableName;\n\t\tthis.caseSensitiveLookup = caseSensitiveLookup;\n\t}\n}\n\n@es5ClassCompat\nexport class InlineValueEvaluatableExpression implements vscode.InlineValueEvaluatableExpression {\n\treadonly range: Range;\n\treadonly expression?: string;\n\n\tconstructor(range: Range, expression?: string) {\n\t\tthis.range = range;\n\t\tthis.expression = expression;\n\t}\n}\n\n@es5ClassCompat\nexport class InlineValueContext implements vscode.InlineValueContext {\n\n\treadonly frameId: number;\n\treadonly stoppedLocation: vscode.Range;\n\n\tconstructor(frameId: number, range: vscode.Range) {\n\t\tthis.frameId = frameId;\n\t\tthis.stoppedLocation = range;\n\t}\n}\n\nexport enum NewSymbolNameTag {\n\tAIGenerated = 1\n}\n\nexport enum NewSymbolNameTriggerKind {\n\tInvoke = 0,\n\tAutomatic = 1,\n}\n\nexport class NewSymbolName implements vscode.NewSymbolName {\n\treadonly newSymbolName: string;\n\treadonly tags?: readonly vscode.NewSymbolNameTag[] | undefined;\n\n\tconstructor(\n\t\tnewSymbolName: string,\n\t\ttags?: readonly NewSymbolNameTag[]\n\t) {\n\t\tthis.newSymbolName = newSymbolName;\n\t\tthis.tags = tags;\n\t}\n}\n\n//#region file api\n\nexport enum FileChangeType {\n\tChanged = 1,\n\tCreated = 2,\n\tDeleted = 3,\n}\n\n@es5ClassCompat\nexport class FileSystemError extends Error {\n\n\tstatic FileExists(messageOrUri?: string | URI): FileSystemError {\n\t\treturn new FileSystemError(messageOrUri, FileSystemProviderErrorCode.FileExists, FileSystemError.FileExists);\n\t}\n\tstatic FileNotFound(messageOrUri?: string | URI): FileSystemError {\n\t\treturn new FileSystemError(messageOrUri, FileSystemProviderErrorCode.FileNotFound, FileSystemError.FileNotFound);\n\t}\n\tstatic FileNotADirectory(messageOrUri?: string | URI): FileSystemError {\n\t\treturn new FileSystemError(messageOrUri, FileSystemProviderErrorCode.FileNotADirectory, FileSystemError.FileNotADirectory);\n\t}\n\tstatic FileIsADirectory(messageOrUri?: string | URI): FileSystemError {\n\t\treturn new FileSystemError(messageOrUri, FileSystemProviderErrorCode.FileIsADirectory, FileSystemError.FileIsADirectory);\n\t}\n\tstatic NoPermissions(messageOrUri?: string | URI): FileSystemError {\n\t\treturn new FileSystemError(messageOrUri, FileSystemProviderErrorCode.NoPermissions, FileSystemError.NoPermissions);\n\t}\n\tstatic Unavailable(messageOrUri?: string | URI): FileSystemError {\n\t\treturn new FileSystemError(messageOrUri, FileSystemProviderErrorCode.Unavailable, FileSystemError.Unavailable);\n\t}\n\n\treadonly code: string;\n\n\tconstructor(uriOrMessage?: string | URI, code: FileSystemProviderErrorCode = FileSystemProviderErrorCode.Unknown, terminator?: Function) {\n\t\tsuper(URI.isUri(uriOrMessage) ? uriOrMessage.toString(true) : uriOrMessage);\n\n\t\tthis.code = terminator?.name ?? 'Unknown';\n\n\t\t// mark the error as file system provider error so that\n\t\t// we can extract the error code on the receiving side\n\t\tmarkAsFileSystemProviderError(this, code);\n\n\t\t// workaround when extending builtin objects and when compiling to ES5, see:\n\t\t// https://github.com/microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n\t\tObject.setPrototypeOf(this, FileSystemError.prototype);\n\n\t\tif (typeof Error.captureStackTrace === 'function' && typeof terminator === 'function') {\n\t\t\t// nice stack traces\n\t\t\tError.captureStackTrace(this, terminator);\n\t\t}\n\t}\n}\n\n//#endregion\n\n//#region folding api\n\n@es5ClassCompat\nexport class FoldingRange {\n\n\tstart: number;\n\n\tend: number;\n\n\tkind?: FoldingRangeKind;\n\n\tconstructor(start: number, end: number, kind?: FoldingRangeKind) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t\tthis.kind = kind;\n\t}\n}\n\nexport enum FoldingRangeKind {\n\tComment = 1,\n\tImports = 2,\n\tRegion = 3\n}\n\n//#endregion\n\n//#region Comment\nexport enum CommentThreadCollapsibleState {\n\t/**\n\t * Determines an item is collapsed\n\t */\n\tCollapsed = 0,\n\t/**\n\t * Determines an item is expanded\n\t */\n\tExpanded = 1\n}\n\nexport enum CommentMode {\n\tEditing = 0,\n\tPreview = 1\n}\n\nexport enum CommentState {\n\tPublished = 0,\n\tDraft = 1\n}\n\nexport enum CommentThreadState {\n\tUnresolved = 0,\n\tResolved = 1\n}\n\nexport enum CommentThreadApplicability {\n\tCurrent = 0,\n\tOutdated = 1\n}\n\nexport enum CommentThreadFocus {\n\tReply = 1,\n\tComment = 2\n}\n\n//#endregion\n\n//#region Semantic Coloring\n\nexport class SemanticTokensLegend {\n\tpublic readonly tokenTypes: string[];\n\tpublic readonly tokenModifiers: string[];\n\n\tconstructor(tokenTypes: string[], tokenModifiers: string[] = []) {\n\t\tthis.tokenTypes = tokenTypes;\n\t\tthis.tokenModifiers = tokenModifiers;\n\t}\n}\n\nfunction isStrArrayOrUndefined(arg: any): arg is string[] | undefined {\n\treturn ((typeof arg === 'undefined') || isStringArray(arg));\n}\n\nexport class SemanticTokensBuilder {\n\n\tprivate _prevLine: number;\n\tprivate _prevChar: number;\n\tprivate _dataIsSortedAndDeltaEncoded: boolean;\n\tprivate _data: number[];\n\tprivate _dataLen: number;\n\tprivate _tokenTypeStrToInt: Map<string, number>;\n\tprivate _tokenModifierStrToInt: Map<string, number>;\n\tprivate _hasLegend: boolean;\n\n\tconstructor(legend?: vscode.SemanticTokensLegend) {\n\t\tthis._prevLine = 0;\n\t\tthis._prevChar = 0;\n\t\tthis._dataIsSortedAndDeltaEncoded = true;\n\t\tthis._data = [];\n\t\tthis._dataLen = 0;\n\t\tthis._tokenTypeStrToInt = new Map<string, number>();\n\t\tthis._tokenModifierStrToInt = new Map<string, number>();\n\t\tthis._hasLegend = false;\n\t\tif (legend) {\n\t\t\tthis._hasLegend = true;\n\t\t\tfor (let i = 0, len = legend.tokenTypes.length; i < len; i++) {\n\t\t\t\tthis._tokenTypeStrToInt.set(legend.tokenTypes[i], i);\n\t\t\t}\n\t\t\tfor (let i = 0, len = legend.tokenModifiers.length; i < len; i++) {\n\t\t\t\tthis._tokenModifierStrToInt.set(legend.tokenModifiers[i], i);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic push(line: number, char: number, length: number, tokenType: number, tokenModifiers?: number): void;\n\tpublic push(range: Range, tokenType: string, tokenModifiers?: string[]): void;\n\tpublic push(arg0: any, arg1: any, arg2: any, arg3?: any, arg4?: any): void {\n\t\tif (typeof arg0 === 'number' && typeof arg1 === 'number' && typeof arg2 === 'number' && typeof arg3 === 'number' && (typeof arg4 === 'number' || typeof arg4 === 'undefined')) {\n\t\t\tif (typeof arg4 === 'undefined') {\n\t\t\t\targ4 = 0;\n\t\t\t}\n\t\t\t// 1st overload\n\t\t\treturn this._pushEncoded(arg0, arg1, arg2, arg3, arg4);\n\t\t}\n\t\tif (Range.isRange(arg0) && typeof arg1 === 'string' && isStrArrayOrUndefined(arg2)) {\n\t\t\t// 2nd overload\n\t\t\treturn this._push(arg0, arg1, arg2);\n\t\t}\n\t\tthrow illegalArgument();\n\t}\n\n\tprivate _push(range: vscode.Range, tokenType: string, tokenModifiers?: string[]): void {\n\t\tif (!this._hasLegend) {\n\t\t\tthrow new Error('Legend must be provided in constructor');\n\t\t}\n\t\tif (range.start.line !== range.end.line) {\n\t\t\tthrow new Error('`range` cannot span multiple lines');\n\t\t}\n\t\tif (!this._tokenTypeStrToInt.has(tokenType)) {\n\t\t\tthrow new Error('`tokenType` is not in the provided legend');\n\t\t}\n\t\tconst line = range.start.line;\n\t\tconst char = range.start.character;\n\t\tconst length = range.end.character - range.start.character;\n\t\tconst nTokenType = this._tokenTypeStrToInt.get(tokenType)!;\n\t\tlet nTokenModifiers = 0;\n\t\tif (tokenModifiers) {\n\t\t\tfor (const tokenModifier of tokenModifiers) {\n\t\t\t\tif (!this._tokenModifierStrToInt.has(tokenModifier)) {\n\t\t\t\t\tthrow new Error('`tokenModifier` is not in the provided legend');\n\t\t\t\t}\n\t\t\t\tconst nTokenModifier = this._tokenModifierStrToInt.get(tokenModifier)!;\n\t\t\t\tnTokenModifiers |= (1 << nTokenModifier) >>> 0;\n\t\t\t}\n\t\t}\n\t\tthis._pushEncoded(line, char, length, nTokenType, nTokenModifiers);\n\t}\n\n\tprivate _pushEncoded(line: number, char: number, length: number, tokenType: number, tokenModifiers: number): void {\n\t\tif (this._dataIsSortedAndDeltaEncoded && (line < this._prevLine || (line === this._prevLine && char < this._prevChar))) {\n\t\t\t// push calls were ordered and are no longer ordered\n\t\t\tthis._dataIsSortedAndDeltaEncoded = false;\n\n\t\t\t// Remove delta encoding from data\n\t\t\tconst tokenCount = (this._data.length / 5) | 0;\n\t\t\tlet prevLine = 0;\n\t\t\tlet prevChar = 0;\n\t\t\tfor (let i = 0; i < tokenCount; i++) {\n\t\t\t\tlet line = this._data[5 * i];\n\t\t\t\tlet char = this._data[5 * i + 1];\n\n\t\t\t\tif (line === 0) {\n\t\t\t\t\t// on the same line as previous token\n\t\t\t\t\tline = prevLine;\n\t\t\t\t\tchar += prevChar;\n\t\t\t\t} else {\n\t\t\t\t\t// on a different line than previous token\n\t\t\t\t\tline += prevLine;\n\t\t\t\t}\n\n\t\t\t\tthis._data[5 * i] = line;\n\t\t\t\tthis._data[5 * i + 1] = char;\n\n\t\t\t\tprevLine = line;\n\t\t\t\tprevChar = char;\n\t\t\t}\n\t\t}\n\n\t\tlet pushLine = line;\n\t\tlet pushChar = char;\n\t\tif (this._dataIsSortedAndDeltaEncoded && this._dataLen > 0) {\n\t\t\tpushLine -= this._prevLine;\n\t\t\tif (pushLine === 0) {\n\t\t\t\tpushChar -= this._prevChar;\n\t\t\t}\n\t\t}\n\n\t\tthis._data[this._dataLen++] = pushLine;\n\t\tthis._data[this._dataLen++] = pushChar;\n\t\tthis._data[this._dataLen++] = length;\n\t\tthis._data[this._dataLen++] = tokenType;\n\t\tthis._data[this._dataLen++] = tokenModifiers;\n\n\t\tthis._prevLine = line;\n\t\tthis._prevChar = char;\n\t}\n\n\tprivate static _sortAndDeltaEncode(data: number[]): Uint32Array {\n\t\tconst pos: number[] = [];\n\t\tconst tokenCount = (data.length / 5) | 0;\n\t\tfor (let i = 0; i < tokenCount; i++) {\n\t\t\tpos[i] = i;\n\t\t}\n\t\tpos.sort((a, b) => {\n\t\t\tconst aLine = data[5 * a];\n\t\t\tconst bLine = data[5 * b];\n\t\t\tif (aLine === bLine) {\n\t\t\t\tconst aChar = data[5 * a + 1];\n\t\t\t\tconst bChar = data[5 * b + 1];\n\t\t\t\treturn aChar - bChar;\n\t\t\t}\n\t\t\treturn aLine - bLine;\n\t\t});\n\t\tconst result = new Uint32Array(data.length);\n\t\tlet prevLine = 0;\n\t\tlet prevChar = 0;\n\t\tfor (let i = 0; i < tokenCount; i++) {\n\t\t\tconst srcOffset = 5 * pos[i];\n\t\t\tconst line = data[srcOffset + 0];\n\t\t\tconst char = data[srcOffset + 1];\n\t\t\tconst length = data[srcOffset + 2];\n\t\t\tconst tokenType = data[srcOffset + 3];\n\t\t\tconst tokenModifiers = data[srcOffset + 4];\n\n\t\t\tconst pushLine = line - prevLine;\n\t\t\tconst pushChar = (pushLine === 0 ? char - prevChar : char);\n\n\t\t\tconst dstOffset = 5 * i;\n\t\t\tresult[dstOffset + 0] = pushLine;\n\t\t\tresult[dstOffset + 1] = pushChar;\n\t\t\tresult[dstOffset + 2] = length;\n\t\t\tresult[dstOffset + 3] = tokenType;\n\t\t\tresult[dstOffset + 4] = tokenModifiers;\n\n\t\t\tprevLine = line;\n\t\t\tprevChar = char;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic build(resultId?: string): SemanticTokens {\n\t\tif (!this._dataIsSortedAndDeltaEncoded) {\n\t\t\treturn new SemanticTokens(SemanticTokensBuilder._sortAndDeltaEncode(this._data), resultId);\n\t\t}\n\t\treturn new SemanticTokens(new Uint32Array(this._data), resultId);\n\t}\n}\n\nexport class SemanticTokens {\n\treadonly resultId: string | undefined;\n\treadonly data: Uint32Array;\n\n\tconstructor(data: Uint32Array, resultId?: string) {\n\t\tthis.resultId = resultId;\n\t\tthis.data = data;\n\t}\n}\n\nexport class SemanticTokensEdit {\n\treadonly start: number;\n\treadonly deleteCount: number;\n\treadonly data: Uint32Array | undefined;\n\n\tconstructor(start: number, deleteCount: number, data?: Uint32Array) {\n\t\tthis.start = start;\n\t\tthis.deleteCount = deleteCount;\n\t\tthis.data = data;\n\t}\n}\n\nexport class SemanticTokensEdits {\n\treadonly resultId: string | undefined;\n\treadonly edits: SemanticTokensEdit[];\n\n\tconstructor(edits: SemanticTokensEdit[], resultId?: string) {\n\t\tthis.resultId = resultId;\n\t\tthis.edits = edits;\n\t}\n}\n\n//#endregion\n\n//#region debug\nexport enum DebugConsoleMode {\n\t/**\n\t * Debug session should have a separate debug console.\n\t */\n\tSeparate = 0,\n\n\t/**\n\t * Debug session should share debug console with its parent session.\n\t * This value has no effect for sessions which do not have a parent session.\n\t */\n\tMergeWithParent = 1\n}\n\nexport class DebugVisualization {\n\ticonPath?: URI | { light: URI; dark: URI } | ThemeIcon;\n\tvisualization?: vscode.Command | vscode.TreeDataProvider<unknown>;\n\n\tconstructor(public name: string) { }\n}\n\n//#endregion\n\nexport enum QuickInputButtonLocation {\n\tTitle = 1,\n\tInline = 2\n}\n\n@es5ClassCompat\nexport class QuickInputButtons {\n\n\tstatic readonly Back: vscode.QuickInputButton = { iconPath: new ThemeIcon('arrow-left') };\n\n\tprivate constructor() { }\n}\n\nexport enum QuickPickItemKind {\n\tSeparator = -1,\n\tDefault = 0,\n}\n\nexport enum InputBoxValidationSeverity {\n\tInfo = 1,\n\tWarning = 2,\n\tError = 3\n}\n\nexport enum ExtensionKind {\n\tUI = 1,\n\tWorkspace = 2\n}\n\nexport class FileDecoration {\n\n\tstatic validate(d: FileDecoration): boolean {\n\t\tif (typeof d.badge === 'string') {\n\t\t\tlet len = nextCharLength(d.badge, 0);\n\t\t\tif (len < d.badge.length) {\n\t\t\t\tlen += nextCharLength(d.badge, len);\n\t\t\t}\n\t\t\tif (d.badge.length > len) {\n\t\t\t\tthrow new Error(`The 'badge'-property must be undefined or a short character`);\n\t\t\t}\n\t\t} else if (d.badge) {\n\t\t\tif (!ThemeIcon.isThemeIcon(d.badge)) {\n\t\t\t\tthrow new Error(`The 'badge'-property is not a valid ThemeIcon`);\n\t\t\t}\n\t\t}\n\t\tif (!d.color && !d.badge && !d.tooltip) {\n\t\t\tthrow new Error(`The decoration is empty`);\n\t\t}\n\t\treturn true;\n\t}\n\n\tbadge?: string | vscode.ThemeIcon;\n\ttooltip?: string;\n\tcolor?: vscode.ThemeColor;\n\tpropagate?: boolean;\n\n\tconstructor(badge?: string | ThemeIcon, tooltip?: string, color?: ThemeColor) {\n\t\tthis.badge = badge;\n\t\tthis.tooltip = tooltip;\n\t\tthis.color = color;\n\t}\n}\n\n//#region Theming\n\n@es5ClassCompat\nexport class ColorTheme implements vscode.ColorTheme {\n\tconstructor(public readonly kind: ColorThemeKind) {\n\t}\n}\n\nexport enum ColorThemeKind {\n\tLight = 1,\n\tDark = 2,\n\tHighContrast = 3,\n\tHighContrastLight = 4\n}\n\n//#endregion Theming\n\n//#region Notebook\n\nexport class NotebookRange {\n\tstatic isNotebookRange(thing: any): thing is vscode.NotebookRange {\n\t\tif (thing instanceof NotebookRange) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (<NotebookRange>thing).start === 'number'\n\t\t\t&& typeof (<NotebookRange>thing).end === 'number';\n\t}\n\n\tprivate _start: number;\n\tprivate _end: number;\n\n\tget start() {\n\t\treturn this._start;\n\t}\n\n\tget end() {\n\t\treturn this._end;\n\t}\n\n\tget isEmpty(): boolean {\n\t\treturn this._start === this._end;\n\t}\n\n\tconstructor(start: number, end: number) {\n\t\tif (start < 0) {\n\t\t\tthrow illegalArgument('start must be positive');\n\t\t}\n\t\tif (end < 0) {\n\t\t\tthrow illegalArgument('end must be positive');\n\t\t}\n\t\tif (start <= end) {\n\t\t\tthis._start = start;\n\t\t\tthis._end = end;\n\t\t} else {\n\t\t\tthis._start = end;\n\t\t\tthis._end = start;\n\t\t}\n\t}\n\n\twith(change: { start?: number; end?: number }): NotebookRange {\n\t\tlet start = this._start;\n\t\tlet end = this._end;\n\n\t\tif (change.start !== undefined) {\n\t\t\tstart = change.start;\n\t\t}\n\t\tif (change.end !== undefined) {\n\t\t\tend = change.end;\n\t\t}\n\t\tif (start === this._start && end === this._end) {\n\t\t\treturn this;\n\t\t}\n\t\treturn new NotebookRange(start, end);\n\t}\n}\n\nexport class NotebookCellData {\n\n\tstatic validate(data: NotebookCellData): void {\n\t\tif (typeof data.kind !== 'number') {\n\t\t\tthrow new Error('NotebookCellData MUST have \\'kind\\' property');\n\t\t}\n\t\tif (typeof data.value !== 'string') {\n\t\t\tthrow new Error('NotebookCellData MUST have \\'value\\' property');\n\t\t}\n\t\tif (typeof data.languageId !== 'string') {\n\t\t\tthrow new Error('NotebookCellData MUST have \\'languageId\\' property');\n\t\t}\n\t}\n\n\tstatic isNotebookCellDataArray(value: unknown): value is vscode.NotebookCellData[] {\n\t\treturn Array.isArray(value) && (<unknown[]>value).every(elem => NotebookCellData.isNotebookCellData(elem));\n\t}\n\n\tstatic isNotebookCellData(value: unknown): value is vscode.NotebookCellData {\n\t\t// return value instanceof NotebookCellData;\n\t\treturn true;\n\t}\n\n\tkind: NotebookCellKind;\n\tvalue: string;\n\tlanguageId: string;\n\tmime?: string;\n\toutputs?: vscode.NotebookCellOutput[];\n\tmetadata?: Record<string, any>;\n\texecutionSummary?: vscode.NotebookCellExecutionSummary;\n\n\tconstructor(kind: NotebookCellKind, value: string, languageId: string, mime?: string, outputs?: vscode.NotebookCellOutput[], metadata?: Record<string, any>, executionSummary?: vscode.NotebookCellExecutionSummary) {\n\t\tthis.kind = kind;\n\t\tthis.value = value;\n\t\tthis.languageId = languageId;\n\t\tthis.mime = mime;\n\t\tthis.outputs = outputs ?? [];\n\t\tthis.metadata = metadata;\n\t\tthis.executionSummary = executionSummary;\n\n\t\tNotebookCellData.validate(this);\n\t}\n}\n\nexport class NotebookData {\n\n\tcells: NotebookCellData[];\n\tmetadata?: { [key: string]: any };\n\n\tconstructor(cells: NotebookCellData[]) {\n\t\tthis.cells = cells;\n\t}\n}\n\n\nexport class NotebookCellOutputItem {\n\n\tstatic isNotebookCellOutputItem(obj: unknown): obj is vscode.NotebookCellOutputItem {\n\t\tif (obj instanceof NotebookCellOutputItem) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!obj) {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (<vscode.NotebookCellOutputItem>obj).mime === 'string'\n\t\t\t&& (<vscode.NotebookCellOutputItem>obj).data instanceof Uint8Array;\n\t}\n\n\tstatic error(err: Error | { name: string; message?: string; stack?: string }): NotebookCellOutputItem {\n\t\tconst obj = {\n\t\t\tname: err.name,\n\t\t\tmessage: err.message,\n\t\t\tstack: err.stack\n\t\t};\n\t\treturn NotebookCellOutputItem.json(obj, 'application/vnd.code.notebook.error');\n\t}\n\n\tstatic stdout(value: string): NotebookCellOutputItem {\n\t\treturn NotebookCellOutputItem.text(value, 'application/vnd.code.notebook.stdout');\n\t}\n\n\tstatic stderr(value: string): NotebookCellOutputItem {\n\t\treturn NotebookCellOutputItem.text(value, 'application/vnd.code.notebook.stderr');\n\t}\n\n\tstatic bytes(value: Uint8Array, mime: string = 'application/octet-stream'): NotebookCellOutputItem {\n\t\treturn new NotebookCellOutputItem(value, mime);\n\t}\n\n\tstatic #encoder = new TextEncoder();\n\n\tstatic text(value: string, mime: string = Mimes.text): NotebookCellOutputItem {\n\t\tconst bytes = NotebookCellOutputItem.#encoder.encode(String(value));\n\t\treturn new NotebookCellOutputItem(bytes, mime);\n\t}\n\n\tstatic json(value: any, mime: string = 'text/x-json'): NotebookCellOutputItem {\n\t\tconst rawStr = JSON.stringify(value, undefined, '\\t');\n\t\treturn NotebookCellOutputItem.text(rawStr, mime);\n\t}\n\n\tconstructor(\n\t\tpublic data: Uint8Array,\n\t\tpublic mime: string,\n\t) {\n\t\tconst mimeNormalized = normalizeMimeType(mime, true);\n\t\tif (!mimeNormalized) {\n\t\t\tthrow new Error(`INVALID mime type: ${mime}. Must be in the format \"type/subtype[;optionalparameter]\"`);\n\t\t}\n\t\tthis.mime = mimeNormalized;\n\t}\n}\n\nexport class NotebookCellOutput {\n\n\tstatic isNotebookCellOutput(candidate: any): candidate is vscode.NotebookCellOutput {\n\t\tif (candidate instanceof NotebookCellOutput) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!candidate || typeof candidate !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (<NotebookCellOutput>candidate).id === 'string' && Array.isArray((<NotebookCellOutput>candidate).items);\n\t}\n\n\tstatic ensureUniqueMimeTypes(items: NotebookCellOutputItem[], warn: boolean = false): NotebookCellOutputItem[] {\n\t\tconst seen = new Set<string>();\n\t\tconst removeIdx = new Set<number>();\n\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\tconst item = items[i];\n\t\t\tconst normalMime = normalizeMimeType(item.mime);\n\t\t\t// We can have multiple text stream mime types in the same output.\n\t\t\tif (!seen.has(normalMime) || isTextStreamMime(normalMime)) {\n\t\t\t\tseen.add(normalMime);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// duplicated mime types... first has won\n\t\t\tremoveIdx.add(i);\n\t\t\tif (warn) {\n\t\t\t\tconsole.warn(`DUPLICATED mime type '${item.mime}' will be dropped`);\n\t\t\t}\n\t\t}\n\t\tif (removeIdx.size === 0) {\n\t\t\treturn items;\n\t\t}\n\t\treturn items.filter((_item, index) => !removeIdx.has(index));\n\t}\n\n\tid: string;\n\titems: NotebookCellOutputItem[];\n\tmetadata?: Record<string, any>;\n\n\tconstructor(\n\t\titems: NotebookCellOutputItem[],\n\t\tidOrMetadata?: string | Record<string, any>,\n\t\tmetadata?: Record<string, any>\n\t) {\n\t\tthis.items = NotebookCellOutput.ensureUniqueMimeTypes(items, true);\n\t\tif (typeof idOrMetadata === 'string') {\n\t\t\tthis.id = idOrMetadata;\n\t\t\tthis.metadata = metadata;\n\t\t} else {\n\t\t\tthis.id = generateUuid();\n\t\t\tthis.metadata = idOrMetadata ?? metadata;\n\t\t}\n\t}\n}\n\nexport class CellErrorStackFrame {\n\t/**\n\t * @param label The name of the stack frame\n\t * @param file The file URI of the stack frame\n\t * @param position The position of the stack frame within the file\n\t */\n\tconstructor(\n\t\tpublic label: string,\n\t\tpublic uri?: vscode.Uri,\n\t\tpublic position?: Position,\n\t) { }\n}\n\nexport enum NotebookCellKind {\n\tMarkup = 1,\n\tCode = 2\n}\n\nexport enum NotebookCellExecutionState {\n\tIdle = 1,\n\tPending = 2,\n\tExecuting = 3,\n}\n\nexport enum NotebookCellStatusBarAlignment {\n\tLeft = 1,\n\tRight = 2\n}\n\nexport enum NotebookEditorRevealType {\n\tDefault = 0,\n\tInCenter = 1,\n\tInCenterIfOutsideViewport = 2,\n\tAtTop = 3\n}\n\nexport class NotebookCellStatusBarItem {\n\tconstructor(\n\t\tpublic text: string,\n\t\tpublic alignment: NotebookCellStatusBarAlignment) { }\n}\n\n\nexport enum NotebookControllerAffinity {\n\tDefault = 1,\n\tPreferred = 2\n}\n\nexport enum NotebookControllerAffinity2 {\n\tDefault = 1,\n\tPreferred = 2,\n\tHidden = -1\n}\n\nexport class NotebookRendererScript {\n\n\tpublic provides: readonly string[];\n\n\tconstructor(\n\t\tpublic uri: vscode.Uri,\n\t\tprovides: string | readonly string[] = []\n\t) {\n\t\tthis.provides = asArray(provides);\n\t}\n}\n\nexport class NotebookKernelSourceAction {\n\tdescription?: string;\n\tdetail?: string;\n\tcommand?: vscode.Command;\n\tconstructor(\n\t\tpublic label: string\n\t) { }\n}\n\nexport enum NotebookVariablesRequestKind {\n\tNamed = 1,\n\tIndexed = 2\n}\n\n//#endregion\n\n//#region Timeline\n\n@es5ClassCompat\nexport class TimelineItem implements vscode.TimelineItem {\n\tconstructor(public label: string, public timestamp: number) { }\n}\n\n//#endregion Timeline\n\n//#region ExtensionContext\n\nexport enum ExtensionMode {\n\t/**\n\t * The extension is installed normally (for example, from the marketplace\n\t * or VSIX) in VS Code.\n\t */\n\tProduction = 1,\n\n\t/**\n\t * The extension is running from an `--extensionDevelopmentPath` provided\n\t * when launching VS Code.\n\t */\n\tDevelopment = 2,\n\n\t/**\n\t * The extension is running from an `--extensionDevelopmentPath` and\n\t * the extension host is running unit tests.\n\t */\n\tTest = 3,\n}\n\nexport enum ExtensionRuntime {\n\t/**\n\t * The extension is running in a NodeJS extension host. Runtime access to NodeJS APIs is available.\n\t */\n\tNode = 1,\n\t/**\n\t * The extension is running in a Webworker extension host. Runtime access is limited to Webworker APIs.\n\t */\n\tWebworker = 2\n}\n\n//#endregion ExtensionContext\n\nexport enum StandardTokenType {\n\tOther = 0,\n\tComment = 1,\n\tString = 2,\n\tRegEx = 3\n}\n\n\nexport class LinkedEditingRanges {\n\tconstructor(public readonly ranges: Range[], public readonly wordPattern?: RegExp) {\n\t}\n}\n\n//#region ports\nexport class PortAttributes {\n\tprivate _autoForwardAction: PortAutoForwardAction;\n\n\tconstructor(autoForwardAction: PortAutoForwardAction) {\n\t\tthis._autoForwardAction = autoForwardAction;\n\t}\n\n\tget autoForwardAction(): PortAutoForwardAction {\n\t\treturn this._autoForwardAction;\n\t}\n}\n//#endregion ports\n\n//#region Testing\nexport enum TestResultState {\n\tQueued = 1,\n\tRunning = 2,\n\tPassed = 3,\n\tFailed = 4,\n\tSkipped = 5,\n\tErrored = 6\n}\n\nexport enum TestRunProfileKind {\n\tRun = 1,\n\tDebug = 2,\n\tCoverage = 3,\n}\n\nexport class TestRunProfileBase {\n\tconstructor(\n\t\tpublic readonly controllerId: string,\n\t\tpublic readonly profileId: number,\n\t\tpublic readonly kind: vscode.TestRunProfileKind,\n\t) { }\n}\n\n@es5ClassCompat\nexport class TestRunRequest implements vscode.TestRunRequest {\n\tconstructor(\n\t\tpublic readonly include: vscode.TestItem[] | undefined = undefined,\n\t\tpublic readonly exclude: vscode.TestItem[] | undefined = undefined,\n\t\tpublic readonly profile: vscode.TestRunProfile | undefined = undefined,\n\t\tpublic readonly continuous = false,\n\t\tpublic readonly preserveFocus = true,\n\t) { }\n}\n\n@es5ClassCompat\nexport class TestMessage implements vscode.TestMessage {\n\tpublic expectedOutput?: string;\n\tpublic actualOutput?: string;\n\tpublic location?: vscode.Location;\n\tpublic contextValue?: string;\n\n\t/** proposed: */\n\tpublic stackTrace?: TestMessageStackFrame[];\n\n\tpublic static diff(message: string | vscode.MarkdownString, expected: string, actual: string) {\n\t\tconst msg = new TestMessage(message);\n\t\tmsg.expectedOutput = expected;\n\t\tmsg.actualOutput = actual;\n\t\treturn msg;\n\t}\n\n\tconstructor(public message: string | vscode.MarkdownString) { }\n}\n\n@es5ClassCompat\nexport class TestTag implements vscode.TestTag {\n\tconstructor(public readonly id: string) { }\n}\n\nexport class TestMessageStackFrame {\n\t/**\n\t * @param label The name of the stack frame\n\t * @param file The file URI of the stack frame\n\t * @param position The position of the stack frame within the file\n\t */\n\tconstructor(\n\t\tpublic label: string,\n\t\tpublic uri?: vscode.Uri,\n\t\tpublic position?: Position,\n\t) { }\n}\n\n//#endregion\n\n//#region Test Coverage\nexport class TestCoverageCount implements vscode.TestCoverageCount {\n\tconstructor(public covered: number, public total: number) {\n\t\tvalidateTestCoverageCount(this);\n\t}\n}\n\nexport function validateTestCoverageCount(cc?: vscode.TestCoverageCount) {\n\tif (!cc) {\n\t\treturn;\n\t}\n\n\tif (cc.covered > cc.total) {\n\t\tthrow new Error(`The total number of covered items (${cc.covered}) cannot be greater than the total (${cc.total})`);\n\t}\n\n\tif (cc.total < 0) {\n\t\tthrow new Error(`The number of covered items (${cc.total}) cannot be negative`);\n\t}\n}\n\nexport class FileCoverage implements vscode.FileCoverage {\n\tpublic static fromDetails(uri: vscode.Uri, details: vscode.FileCoverageDetail[]): vscode.FileCoverage {\n\t\tconst statements = new TestCoverageCount(0, 0);\n\t\tconst branches = new TestCoverageCount(0, 0);\n\t\tconst decl = new TestCoverageCount(0, 0);\n\n\t\tfor (const detail of details) {\n\t\t\tif ('branches' in detail) {\n\t\t\t\tstatements.total += 1;\n\t\t\t\tstatements.covered += detail.executed ? 1 : 0;\n\n\t\t\t\tfor (const branch of detail.branches) {\n\t\t\t\t\tbranches.total += 1;\n\t\t\t\t\tbranches.covered += branch.executed ? 1 : 0;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdecl.total += 1;\n\t\t\t\tdecl.covered += detail.executed ? 1 : 0;\n\t\t\t}\n\t\t}\n\n\t\tconst coverage = new FileCoverage(\n\t\t\turi,\n\t\t\tstatements,\n\t\t\tbranches.total > 0 ? branches : undefined,\n\t\t\tdecl.total > 0 ? decl : undefined,\n\t\t);\n\n\t\tcoverage.detailedCoverage = details;\n\n\t\treturn coverage;\n\t}\n\n\tdetailedCoverage?: vscode.FileCoverageDetail[];\n\n\tconstructor(\n\t\tpublic readonly uri: vscode.Uri,\n\t\tpublic statementCoverage: vscode.TestCoverageCount,\n\t\tpublic branchCoverage?: vscode.TestCoverageCount,\n\t\tpublic declarationCoverage?: vscode.TestCoverageCount,\n\t\tpublic includesTests: vscode.TestItem[] = [],\n\t) {\n\t}\n}\n\nexport class StatementCoverage implements vscode.StatementCoverage {\n\t// back compat until finalization:\n\tget executionCount() { return +this.executed; }\n\tset executionCount(n: number) { this.executed = n; }\n\n\tconstructor(\n\t\tpublic executed: number | boolean,\n\t\tpublic location: Position | Range,\n\t\tpublic branches: vscode.BranchCoverage[] = [],\n\t) { }\n}\n\nexport class BranchCoverage implements vscode.BranchCoverage {\n\t// back compat until finalization:\n\tget executionCount() { return +this.executed; }\n\tset executionCount(n: number) { this.executed = n; }\n\n\tconstructor(\n\t\tpublic executed: number | boolean,\n\t\tpublic location: Position | Range,\n\t\tpublic label?: string,\n\t) { }\n}\n\nexport class DeclarationCoverage implements vscode.DeclarationCoverage {\n\t// back compat until finalization:\n\tget executionCount() { return +this.executed; }\n\tset executionCount(n: number) { this.executed = n; }\n\n\tconstructor(\n\t\tpublic readonly name: string,\n\t\tpublic executed: number | boolean,\n\t\tpublic location: Position | Range,\n\t) { }\n}\n//#endregion\n\nexport enum ExternalUriOpenerPriority {\n\tNone = 0,\n\tOption = 1,\n\tDefault = 2,\n\tPreferred = 3,\n}\n\nexport enum WorkspaceTrustState {\n\tUntrusted = 0,\n\tTrusted = 1,\n\tUnspecified = 2\n}\n\nexport enum PortAutoForwardAction {\n\tNotify = 1,\n\tOpenBrowser = 2,\n\tOpenPreview = 3,\n\tSilent = 4,\n\tIgnore = 5,\n\tOpenBrowserOnce = 6\n}\n\nexport class TypeHierarchyItem {\n\t_sessionId?: string;\n\t_itemId?: string;\n\n\tkind: SymbolKind;\n\ttags?: SymbolTag[];\n\tname: string;\n\tdetail?: string;\n\turi: URI;\n\trange: Range;\n\tselectionRange: Range;\n\n\tconstructor(kind: SymbolKind, name: string, detail: string, uri: URI, range: Range, selectionRange: Range) {\n\t\tthis.kind = kind;\n\t\tthis.name = name;\n\t\tthis.detail = detail;\n\t\tthis.uri = uri;\n\t\tthis.range = range;\n\t\tthis.selectionRange = selectionRange;\n\t}\n}\n\n//#region Tab Inputs\n\nexport class TextTabInput {\n\tconstructor(readonly uri: URI) { }\n}\n\nexport class TextDiffTabInput {\n\tconstructor(readonly original: URI, readonly modified: URI) { }\n}\n\nexport class TextMergeTabInput {\n\tconstructor(readonly base: URI, readonly input1: URI, readonly input2: URI, readonly result: URI) { }\n}\n\nexport class CustomEditorTabInput {\n\tconstructor(readonly uri: URI, readonly viewType: string) { }\n}\n\nexport class WebviewEditorTabInput {\n\tconstructor(readonly viewType: string) { }\n}\n\nexport class NotebookEditorTabInput {\n\tconstructor(readonly uri: URI, readonly notebookType: string) { }\n}\n\nexport class NotebookDiffEditorTabInput {\n\tconstructor(readonly original: URI, readonly modified: URI, readonly notebookType: string) { }\n}\n\nexport class TerminalEditorTabInput {\n\tconstructor() { }\n}\nexport class InteractiveWindowInput {\n\tconstructor(readonly uri: URI, readonly inputBoxUri: URI) { }\n}\n\nexport class ChatEditorTabInput {\n\tconstructor() { }\n}\n\nexport class TextMultiDiffTabInput {\n\tconstructor(readonly textDiffs: TextDiffTabInput[]) { }\n}\n//#endregion\n\n//#region Chat\n\nexport enum InteractiveSessionVoteDirection {\n\tDown = 0,\n\tUp = 1\n}\n\nexport enum ChatCopyKind {\n\tAction = 1,\n\tToolbar = 2\n}\n\nexport enum ChatVariableLevel {\n\tShort = 1,\n\tMedium = 2,\n\tFull = 3\n}\n\nexport class ChatCompletionItem implements vscode.ChatCompletionItem {\n\tid: string;\n\tlabel: string | CompletionItemLabel;\n\tfullName?: string | undefined;\n\ticon?: vscode.ThemeIcon;\n\tinsertText?: string;\n\tvalues: vscode.ChatVariableValue[];\n\tdetail?: string;\n\tdocumentation?: string | MarkdownString;\n\tcommand?: vscode.Command;\n\n\tconstructor(id: string, label: string | CompletionItemLabel, values: vscode.ChatVariableValue[]) {\n\t\tthis.id = id;\n\t\tthis.label = label;\n\t\tthis.values = values;\n\t}\n}\n\nexport enum ChatEditingSessionActionOutcome {\n\tAccepted = 1,\n\tRejected = 2,\n\tSaved = 3\n}\n\nexport enum ChatRequestEditedFileEventKind {\n\tKeep = 1,\n\tUndo = 2,\n\tUserModification = 3,\n}\n\n//#endregion\n\n//#region Interactive Editor\n\nexport enum InteractiveEditorResponseFeedbackKind {\n\tUnhelpful = 0,\n\tHelpful = 1,\n\tUndone = 2,\n\tAccepted = 3,\n\tBug = 4\n}\n\nexport enum ChatResultFeedbackKind {\n\tUnhelpful = 0,\n\tHelpful = 1,\n}\n\nexport class ChatResponseMarkdownPart {\n\tvalue: vscode.MarkdownString;\n\tconstructor(value: string | vscode.MarkdownString) {\n\t\tif (typeof value !== 'string' && value.isTrusted === true) {\n\t\t\tthrow new Error('The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.');\n\t\t}\n\n\t\tthis.value = typeof value === 'string' ? new MarkdownString(value) : value;\n\t}\n}\n\n/**\n * TODO if 'vulnerabilities' is finalized, this should be merged with the base ChatResponseMarkdownPart. I just don't see how to do that while keeping\n * vulnerabilities in a seperate API proposal in a clean way.\n */\nexport class ChatResponseMarkdownWithVulnerabilitiesPart {\n\tvalue: vscode.MarkdownString;\n\tvulnerabilities: vscode.ChatVulnerability[];\n\tconstructor(value: string | vscode.MarkdownString, vulnerabilities: vscode.ChatVulnerability[]) {\n\t\tif (typeof value !== 'string' && value.isTrusted === true) {\n\t\t\tthrow new Error('The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.');\n\t\t}\n\n\t\tthis.value = typeof value === 'string' ? new MarkdownString(value) : value;\n\t\tthis.vulnerabilities = vulnerabilities;\n\t}\n}\n\nexport class ChatResponseConfirmationPart {\n\ttitle: string;\n\tmessage: string;\n\tdata: any;\n\tbuttons?: string[];\n\n\tconstructor(title: string, message: string, data: any, buttons?: string[]) {\n\t\tthis.title = title;\n\t\tthis.message = message;\n\t\tthis.data = data;\n\t\tthis.buttons = buttons;\n\t}\n}\n\nexport class ChatResponseFileTreePart {\n\tvalue: vscode.ChatResponseFileTree[];\n\tbaseUri: vscode.Uri;\n\tconstructor(value: vscode.ChatResponseFileTree[], baseUri: vscode.Uri) {\n\t\tthis.value = value;\n\t\tthis.baseUri = baseUri;\n\t}\n}\n\nexport class ChatResponseAnchorPart implements vscode.ChatResponseAnchorPart {\n\tvalue: vscode.Uri | vscode.Location;\n\ttitle?: string;\n\n\tvalue2: vscode.Uri | vscode.Location | vscode.SymbolInformation;\n\tresolve?(token: vscode.CancellationToken): Thenable<void>;\n\n\tconstructor(value: vscode.Uri | vscode.Location | vscode.SymbolInformation, title?: string) {\n\t\tthis.value = value as any;\n\t\tthis.value2 = value;\n\t\tthis.title = title;\n\t}\n}\n\nexport class ChatResponseProgressPart {\n\tvalue: string;\n\tconstructor(value: string) {\n\t\tthis.value = value;\n\t}\n}\n\nexport class ChatResponseProgressPart2 {\n\tvalue: string;\n\ttask?: (progress: vscode.Progress<vscode.ChatResponseWarningPart>) => Thenable<string | void>;\n\tconstructor(value: string, task?: (progress: vscode.Progress<vscode.ChatResponseWarningPart>) => Thenable<string | void>) {\n\t\tthis.value = value;\n\t\tthis.task = task;\n\t}\n}\n\nexport class ChatResponseWarningPart {\n\tvalue: vscode.MarkdownString;\n\tconstructor(value: string | vscode.MarkdownString) {\n\t\tif (typeof value !== 'string' && value.isTrusted === true) {\n\t\t\tthrow new Error('The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.');\n\t\t}\n\n\t\tthis.value = typeof value === 'string' ? new MarkdownString(value) : value;\n\t}\n}\n\nexport class ChatResponseCommandButtonPart {\n\tvalue: vscode.Command;\n\tconstructor(value: vscode.Command) {\n\t\tthis.value = value;\n\t}\n}\n\nexport class ChatResponseReferencePart {\n\tvalue: vscode.Uri | vscode.Location | { variableName: string; value?: vscode.Uri | vscode.Location } | string;\n\ticonPath?: vscode.Uri | vscode.ThemeIcon | { light: vscode.Uri; dark: vscode.Uri };\n\toptions?: { status?: { description: string; kind: vscode.ChatResponseReferencePartStatusKind } };\n\tconstructor(value: vscode.Uri | vscode.Location | { variableName: string; value?: vscode.Uri | vscode.Location } | string, iconPath?: vscode.Uri | vscode.ThemeIcon | { light: vscode.Uri; dark: vscode.Uri }, options?: { status?: { description: string; kind: vscode.ChatResponseReferencePartStatusKind } }) {\n\t\tthis.value = value;\n\t\tthis.iconPath = iconPath;\n\t\tthis.options = options;\n\t}\n}\n\nexport class ChatResponseCodeblockUriPart {\n\tisEdit?: boolean;\n\tvalue: vscode.Uri;\n\tconstructor(value: vscode.Uri, isEdit?: boolean) {\n\t\tthis.value = value;\n\t\tthis.isEdit = isEdit;\n\t}\n}\n\nexport class ChatResponseCodeCitationPart {\n\tvalue: vscode.Uri;\n\tlicense: string;\n\tsnippet: string;\n\tconstructor(value: vscode.Uri, license: string, snippet: string) {\n\t\tthis.value = value;\n\t\tthis.license = license;\n\t\tthis.snippet = snippet;\n\t}\n}\n\nexport class ChatResponseMovePart {\n\tconstructor(\n\t\tpublic readonly uri: vscode.Uri,\n\t\tpublic readonly range: vscode.Range,\n\t) {\n\t}\n}\n\nexport class ChatResponseExtensionsPart {\n\tconstructor(\n\t\tpublic readonly extensions: string[],\n\t) {\n\t}\n}\n\nexport class ChatResponseTextEditPart implements vscode.ChatResponseTextEditPart {\n\turi: vscode.Uri;\n\tedits: vscode.TextEdit[];\n\tisDone?: boolean;\n\tconstructor(uri: vscode.Uri, editsOrDone: vscode.TextEdit | vscode.TextEdit[] | true) {\n\t\tthis.uri = uri;\n\t\tif (editsOrDone === true) {\n\t\t\tthis.isDone = true;\n\t\t\tthis.edits = [];\n\t\t} else {\n\t\t\tthis.edits = Array.isArray(editsOrDone) ? editsOrDone : [editsOrDone];\n\t\t}\n\t}\n}\n\nexport class ChatResponseNotebookEditPart implements vscode.ChatResponseNotebookEditPart {\n\turi: vscode.Uri;\n\tedits: vscode.NotebookEdit[];\n\tisDone?: boolean;\n\tconstructor(uri: vscode.Uri, editsOrDone: vscode.NotebookEdit | vscode.NotebookEdit[] | true) {\n\t\tthis.uri = uri;\n\t\tif (editsOrDone === true) {\n\t\t\tthis.isDone = true;\n\t\t\tthis.edits = [];\n\t\t} else {\n\t\t\tthis.edits = Array.isArray(editsOrDone) ? editsOrDone : [editsOrDone];\n\n\t\t}\n\t}\n}\n\nexport class ChatPrepareToolInvocationPart {\n\ttoolName: string;\n\t/**\n\t * @param toolName The name of the tool being prepared for invocation.\n\t */\n\tconstructor(toolName: string) {\n\t\tthis.toolName = toolName;\n\t}\n}\n\nexport class ChatRequestTurn implements vscode.ChatRequestTurn2 {\n\tconstructor(\n\t\treadonly prompt: string,\n\t\treadonly command: string | undefined,\n\t\treadonly references: vscode.ChatPromptReference[],\n\t\treadonly participant: string,\n\t\treadonly toolReferences: vscode.ChatLanguageModelToolReference[],\n\t\treadonly editedFileEvents?: vscode.ChatRequestEditedFileEvent[]\n\t) { }\n}\n\nexport class ChatResponseTurn implements vscode.ChatResponseTurn {\n\n\tconstructor(\n\t\treadonly response: ReadonlyArray<ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>,\n\t\treadonly result: vscode.ChatResult,\n\t\treadonly participant: string,\n\t\treadonly command?: string\n\t) { }\n}\n\nexport enum ChatLocation {\n\tPanel = 1,\n\tTerminal = 2,\n\tNotebook = 3,\n\tEditor = 4,\n}\n\nexport enum ChatResponseReferencePartStatusKind {\n\tComplete = 1,\n\tPartial = 2,\n\tOmitted = 3\n}\n\nexport class ChatRequestEditorData implements vscode.ChatRequestEditorData {\n\tconstructor(\n\t\treadonly document: vscode.TextDocument,\n\t\treadonly selection: vscode.Selection,\n\t\treadonly wholeRange: vscode.Range,\n\t) { }\n}\n\nexport class ChatRequestNotebookData implements vscode.ChatRequestNotebookData {\n\tconstructor(\n\t\treadonly cell: vscode.TextDocument\n\t) { }\n}\n\nexport class ChatReferenceBinaryData implements vscode.ChatReferenceBinaryData {\n\tmimeType: string;\n\tdata: () => Thenable<Uint8Array>;\n\treference?: vscode.Uri;\n\tconstructor(mimeType: string, data: () => Thenable<Uint8Array>, reference?: vscode.Uri) {\n\t\tthis.mimeType = mimeType;\n\t\tthis.data = data;\n\t\tthis.reference = reference;\n\t}\n}\n\nexport class ChatReferenceDiagnostic implements vscode.ChatReferenceDiagnostic {\n\tconstructor(public readonly diagnostics: [vscode.Uri, vscode.Diagnostic[]][]) { }\n}\n\nexport enum LanguageModelChatMessageRole {\n\tUser = 1,\n\tAssistant = 2,\n\tSystem = 3\n}\n\nexport class LanguageModelToolResultPart implements vscode.LanguageModelToolResultPart {\n\n\tcallId: string;\n\tcontent: (LanguageModelTextPart | LanguageModelPromptTsxPart | unknown)[];\n\tisError: boolean;\n\n\tconstructor(callId: string, content: (LanguageModelTextPart | LanguageModelPromptTsxPart | unknown)[], isError?: boolean) {\n\t\tthis.callId = callId;\n\t\tthis.content = content;\n\t\tthis.isError = isError ?? false;\n\t}\n}\n\nexport class LanguageModelToolResultPart2 implements vscode.LanguageModelToolResultPart2 {\n\n\tcallId: string;\n\tcontent: (LanguageModelTextPart | LanguageModelPromptTsxPart | LanguageModelDataPart | unknown)[];\n\tisError: boolean;\n\n\tconstructor(callId: string, content: (LanguageModelTextPart | LanguageModelPromptTsxPart | LanguageModelDataPart | unknown)[], isError?: boolean) {\n\t\tthis.callId = callId;\n\t\tthis.content = content;\n\t\tthis.isError = isError ?? false;\n\t}\n}\n\nexport class PreparedTerminalToolInvocation {\n\tconstructor(\n\t\tpublic readonly command: string,\n\t\tpublic readonly language: string,\n\t\tpublic readonly confirmationMessages?: vscode.LanguageModelToolConfirmationMessages,\n\t\tpublic readonly presentation?: 'hidden'\n\t) { }\n}\n\nexport enum ChatErrorLevel {\n\tInfo = 0,\n\tWarning = 1,\n\tError = 2\n}\n\nexport class LanguageModelChatMessage implements vscode.LanguageModelChatMessage {\n\n\tstatic User(content: string | (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart)[], name?: string): LanguageModelChatMessage {\n\t\treturn new LanguageModelChatMessage(LanguageModelChatMessageRole.User, content, name);\n\t}\n\n\tstatic Assistant(content: string | (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart)[], name?: string): LanguageModelChatMessage {\n\t\treturn new LanguageModelChatMessage(LanguageModelChatMessageRole.Assistant, content, name);\n\t}\n\n\trole: vscode.LanguageModelChatMessageRole;\n\n\tprivate _content: (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart)[] = [];\n\n\tset content(value: string | (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart)[]) {\n\t\tif (typeof value === 'string') {\n\t\t\t// we changed this and still support setting content with a string property. this keep the API runtime stable\n\t\t\t// despite the breaking change in the type definition.\n\t\t\tthis._content = [new LanguageModelTextPart(value)];\n\t\t} else {\n\t\t\tthis._content = value;\n\t\t}\n\t}\n\n\tget content(): (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart)[] {\n\t\treturn this._content;\n\t}\n\n\tname: string | undefined;\n\n\tconstructor(role: vscode.LanguageModelChatMessageRole, content: string | (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart)[], name?: string) {\n\t\tthis.role = role;\n\t\tthis.content = content;\n\t\tthis.name = name;\n\t}\n}\n\nexport class LanguageModelChatMessage2 implements vscode.LanguageModelChatMessage2 {\n\n\tstatic User(content: string | (LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart)[], name?: string): LanguageModelChatMessage2 {\n\t\treturn new LanguageModelChatMessage2(LanguageModelChatMessageRole.User, content, name);\n\t}\n\n\tstatic Assistant(content: string | (LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart)[], name?: string): LanguageModelChatMessage2 {\n\t\treturn new LanguageModelChatMessage2(LanguageModelChatMessageRole.Assistant, content, name);\n\t}\n\n\trole: vscode.LanguageModelChatMessageRole;\n\n\tprivate _content: (LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart)[] = [];\n\n\tset content(value: string | (LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart)[]) {\n\t\tif (typeof value === 'string') {\n\t\t\t// we changed this and still support setting content with a string property. this keep the API runtime stable\n\t\t\t// despite the breaking change in the type definition.\n\t\t\tthis._content = [new LanguageModelTextPart(value)];\n\t\t} else {\n\t\t\tthis._content = value;\n\t\t}\n\t}\n\n\tget content(): (LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart)[] {\n\t\treturn this._content;\n\t}\n\n\t// Temp to avoid breaking changes\n\tset content2(value: (string | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart)[] | undefined) {\n\t\tif (value) {\n\t\t\tthis.content = value.map(part => {\n\t\t\t\tif (typeof part === 'string') {\n\t\t\t\t\treturn new LanguageModelTextPart(part);\n\t\t\t\t}\n\t\t\t\treturn part;\n\t\t\t});\n\t\t}\n\t}\n\n\tget content2(): (string | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart)[] | undefined {\n\t\treturn this.content.map(part => {\n\t\t\tif (part instanceof LanguageModelTextPart) {\n\t\t\t\treturn part.value;\n\t\t\t}\n\t\t\treturn part;\n\t\t});\n\t}\n\n\tname: string | undefined;\n\n\tconstructor(role: vscode.LanguageModelChatMessageRole, content: string | (LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart)[], name?: string) {\n\t\tthis.role = role;\n\t\tthis.content = content;\n\t\tthis.name = name;\n\t}\n}\n\n\nexport class LanguageModelToolCallPart implements vscode.LanguageModelToolCallPart {\n\tcallId: string;\n\tname: string;\n\tinput: any;\n\n\tconstructor(callId: string, name: string, input: any) {\n\t\tthis.callId = callId;\n\t\tthis.name = name;\n\n\t\tthis.input = input;\n\t}\n}\n\nexport class LanguageModelTextPart implements vscode.LanguageModelTextPart {\n\tvalue: string;\n\n\tconstructor(value: string) {\n\t\tthis.value = value;\n\t}\n\n\ttoJSON() {\n\t\treturn {\n\t\t\t$mid: MarshalledId.LanguageModelTextPart,\n\t\t\tvalue: this.value,\n\t\t};\n\t}\n}\n\nexport class LanguageModelDataPart implements vscode.LanguageModelDataPart {\n\tmimeType: string;\n\tdata: Uint8Array<ArrayBufferLike>;\n\n\tconstructor(data: Uint8Array<ArrayBufferLike>, mimeType: string) {\n\t\tthis.mimeType = mimeType;\n\t\tthis.data = data;\n\t}\n\n\tstatic image(data: Uint8Array<ArrayBufferLike>, mimeType: ChatImageMimeType): vscode.LanguageModelDataPart {\n\t\treturn new LanguageModelDataPart(data, mimeType as string);\n\t}\n\n\tstatic json(value: object, mime: string = 'text/x-json'): vscode.LanguageModelDataPart {\n\t\tconst rawStr = JSON.stringify(value, undefined, '\\t');\n\t\treturn new LanguageModelDataPart(VSBuffer.fromString(rawStr).buffer, mime);\n\t}\n\n\tstatic text(value: string, mime: string = Mimes.text): vscode.LanguageModelDataPart {\n\t\treturn new LanguageModelDataPart(VSBuffer.fromString(value).buffer, mime);\n\t}\n\n\ttoJSON() {\n\t\treturn {\n\t\t\t$mid: MarshalledId.LanguageModelDataPart,\n\t\t\tmimeType: this.mimeType,\n\t\t\tdata: this.data,\n\t\t};\n\t}\n}\n\nexport enum ChatImageMimeType {\n\tPNG = 'image/png',\n\tJPEG = 'image/jpeg',\n\tGIF = 'image/gif',\n\tWEBP = 'image/webp',\n\tBMP = 'image/bmp',\n}\n\n\nexport class LanguageModelPromptTsxPart {\n\tvalue: unknown;\n\n\tconstructor(value: unknown) {\n\t\tthis.value = value;\n\t}\n\n\ttoJSON() {\n\t\treturn {\n\t\t\t$mid: MarshalledId.LanguageModelPromptTsxPart,\n\t\t\tvalue: this.value,\n\t\t};\n\t}\n}\n\n/**\n * @deprecated\n */\nexport class LanguageModelChatSystemMessage {\n\tcontent: string;\n\tconstructor(content: string) {\n\t\tthis.content = content;\n\t}\n}\n\n\n/**\n * @deprecated\n */\nexport class LanguageModelChatUserMessage {\n\tcontent: string;\n\tname: string | undefined;\n\n\tconstructor(content: string, name?: string) {\n\t\tthis.content = content;\n\t\tthis.name = name;\n\t}\n}\n\n/**\n * @deprecated\n */\nexport class LanguageModelChatAssistantMessage {\n\tcontent: string;\n\tname?: string;\n\n\tconstructor(content: string, name?: string) {\n\t\tthis.content = content;\n\t\tthis.name = name;\n\t}\n}\n\nexport class LanguageModelError extends Error {\n\n\tstatic readonly #name = 'LanguageModelError';\n\n\tstatic NotFound(message?: string): LanguageModelError {\n\t\treturn new LanguageModelError(message, LanguageModelError.NotFound.name);\n\t}\n\n\tstatic NoPermissions(message?: string): LanguageModelError {\n\t\treturn new LanguageModelError(message, LanguageModelError.NoPermissions.name);\n\t}\n\n\tstatic Blocked(message?: string): LanguageModelError {\n\t\treturn new LanguageModelError(message, LanguageModelError.Blocked.name);\n\t}\n\n\tstatic tryDeserialize(data: SerializedError): LanguageModelError | undefined {\n\t\tif (data.name !== LanguageModelError.#name) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new LanguageModelError(data.message, data.code, data.cause);\n\t}\n\n\treadonly code: string;\n\n\tconstructor(message?: string, code?: string, cause?: Error) {\n\t\tsuper(message, { cause });\n\t\tthis.name = LanguageModelError.#name;\n\t\tthis.code = code ?? '';\n\t}\n\n}\n\nexport class LanguageModelToolResult {\n\tconstructor(public content: (LanguageModelTextPart | LanguageModelPromptTsxPart)[]) { }\n\n\ttoJSON() {\n\t\treturn {\n\t\t\t$mid: MarshalledId.LanguageModelToolResult,\n\t\t\tcontent: this.content,\n\t\t};\n\t}\n}\n\nexport class LanguageModelToolResult2 {\n\tconstructor(public content: (LanguageModelTextPart | LanguageModelPromptTsxPart | LanguageModelDataPart)[]) { }\n\n\ttoJSON() {\n\t\treturn {\n\t\t\t$mid: MarshalledId.LanguageModelToolResult,\n\t\t\tcontent: this.content,\n\t\t};\n\t}\n}\n\nexport class ExtendedLanguageModelToolResult extends LanguageModelToolResult {\n}\n\nexport enum LanguageModelChatToolMode {\n\tAuto = 1,\n\tRequired = 2\n}\n\n//#endregion\n\n//#region ai\n\nexport enum RelatedInformationType {\n\tSymbolInformation = 1,\n\tCommandInformation = 2,\n\tSearchInformation = 3,\n\tSettingInformation = 4\n}\n\nexport enum SettingsSearchResultKind {\n\tEMBEDDED = 1,\n\tLLM_RANKED = 2,\n\tCANCELED = 3,\n}\n\n//#endregion\n\n//#region Speech\n\nexport enum SpeechToTextStatus {\n\tStarted = 1,\n\tRecognizing = 2,\n\tRecognized = 3,\n\tStopped = 4,\n\tError = 5\n}\n\nexport enum TextToSpeechStatus {\n\tStarted = 1,\n\tStopped = 2,\n\tError = 3\n}\n\nexport enum KeywordRecognitionStatus {\n\tRecognized = 1,\n\tStopped = 2\n}\n\n//#endregion\n\n//#region MC\nexport class McpStdioServerDefinition implements vscode.McpStdioServerDefinition {\n\tcwd?: URI;\n\n\tconstructor(\n\t\tpublic label: string,\n\t\tpublic command: string,\n\t\tpublic args: string[],\n\t\tpublic env: Record<string, string | number | null> = {},\n\t\tpublic version?: string,\n\t) { }\n}\n\nexport class McpHttpServerDefinition implements vscode.McpHttpServerDefinition {\n\tconstructor(\n\t\tpublic label: string,\n\t\tpublic uri: URI,\n\t\tpublic headers: Record<string, string> = {},\n\t\tpublic version?: string,\n\t) { }\n}\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { distinct } from './arrays.js';\nimport { Iterable } from './iterator.js';\nimport { URI } from './uri.js';\nimport { generateUuid } from './uuid.js';\n\nexport interface IDataTransferFile {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly uri?: URI;\n\tdata(): Promise<Uint8Array>;\n}\n\nexport interface IDataTransferItem {\n\tid?: string;\n\tasString(): Thenable<string>;\n\tasFile(): IDataTransferFile | undefined;\n\tvalue: unknown;\n}\n\nexport function createStringDataTransferItem(stringOrPromise: string | Promise<string>, id?: string): IDataTransferItem {\n\treturn {\n\t\tid,\n\t\tasString: async () => stringOrPromise,\n\t\tasFile: () => undefined,\n\t\tvalue: typeof stringOrPromise === 'string' ? stringOrPromise : undefined,\n\t};\n}\n\nexport function createFileDataTransferItem(fileName: string, uri: URI | undefined, data: () => Promise<Uint8Array>, id?: string): IDataTransferItem {\n\tconst file = { id: generateUuid(), name: fileName, uri, data };\n\treturn {\n\t\tid,\n\t\tasString: async () => '',\n\t\tasFile: () => file,\n\t\tvalue: undefined,\n\t};\n}\n\nexport interface IReadonlyVSDataTransfer extends Iterable<readonly [string, IDataTransferItem]> {\n\t/**\n\t * Get the total number of entries in this data transfer.\n\t */\n\tget size(): number;\n\n\t/**\n\t * Check if this data transfer contains data for `mimeType`.\n\t *\n\t * This uses exact matching and does not support wildcards.\n\t */\n\thas(mimeType: string): boolean;\n\n\t/**\n\t * Check if this data transfer contains data matching `pattern`.\n\t *\n\t * This allows matching for wildcards, such as `image/*`.\n\t *\n\t * Use the special `files` mime type to match any file in the data transfer.\n\t */\n\tmatches(pattern: string): boolean;\n\n\t/**\n\t * Retrieve the first entry for `mimeType`.\n\t *\n\t * Note that if you want to find all entries for a given mime type, use {@link IReadonlyVSDataTransfer.entries} instead.\n\t */\n\tget(mimeType: string): IDataTransferItem | undefined;\n}\n\nexport class VSDataTransfer implements IReadonlyVSDataTransfer {\n\n\tprivate readonly _entries = new Map<string, IDataTransferItem[]>();\n\n\tpublic get size(): number {\n\t\tlet size = 0;\n\t\tfor (const _ of this._entries) {\n\t\t\tsize++;\n\t\t}\n\t\treturn size;\n\t}\n\n\tpublic has(mimeType: string): boolean {\n\t\treturn this._entries.has(this.toKey(mimeType));\n\t}\n\n\tpublic matches(pattern: string): boolean {\n\t\tconst mimes = [...this._entries.keys()];\n\t\tif (Iterable.some(this, ([_, item]) => item.asFile())) {\n\t\t\tmimes.push('files');\n\t\t}\n\n\t\treturn matchesMimeType_normalized(normalizeMimeType(pattern), mimes);\n\t}\n\n\tpublic get(mimeType: string): IDataTransferItem | undefined {\n\t\treturn this._entries.get(this.toKey(mimeType))?.[0];\n\t}\n\n\t/**\n\t * Add a new entry to this data transfer.\n\t *\n\t * This does not replace existing entries for `mimeType`.\n\t */\n\tpublic append(mimeType: string, value: IDataTransferItem): void {\n\t\tconst existing = this._entries.get(mimeType);\n\t\tif (existing) {\n\t\t\texisting.push(value);\n\t\t} else {\n\t\t\tthis._entries.set(this.toKey(mimeType), [value]);\n\t\t}\n\t}\n\n\t/**\n\t * Set the entry for a given mime type.\n\t *\n\t * This replaces all existing entries for `mimeType`.\n\t */\n\tpublic replace(mimeType: string, value: IDataTransferItem): void {\n\t\tthis._entries.set(this.toKey(mimeType), [value]);\n\t}\n\n\t/**\n\t * Remove all entries for `mimeType`.\n\t */\n\tpublic delete(mimeType: string) {\n\t\tthis._entries.delete(this.toKey(mimeType));\n\t}\n\n\t/**\n\t * Iterate over all `[mime, item]` pairs in this data transfer.\n\t *\n\t * There may be multiple entries for each mime type.\n\t */\n\tpublic *[Symbol.iterator](): IterableIterator<readonly [string, IDataTransferItem]> {\n\t\tfor (const [mine, items] of this._entries) {\n\t\t\tfor (const item of items) {\n\t\t\t\tyield [mine, item];\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate toKey(mimeType: string): string {\n\t\treturn normalizeMimeType(mimeType);\n\t}\n}\n\nfunction normalizeMimeType(mimeType: string): string {\n\treturn mimeType.toLowerCase();\n}\n\nexport function matchesMimeType(pattern: string, mimeTypes: readonly string[]): boolean {\n\treturn matchesMimeType_normalized(\n\t\tnormalizeMimeType(pattern),\n\t\tmimeTypes.map(normalizeMimeType));\n}\n\nfunction matchesMimeType_normalized(normalizedPattern: string, normalizedMimeTypes: readonly string[]): boolean {\n\t// Anything wildcard\n\tif (normalizedPattern === '*/*') {\n\t\treturn normalizedMimeTypes.length > 0;\n\t}\n\n\t// Exact match\n\tif (normalizedMimeTypes.includes(normalizedPattern)) {\n\t\treturn true;\n\t}\n\n\t// Wildcard, such as `image/*`\n\tconst wildcard = normalizedPattern.match(/^([a-z]+)\\/([a-z]+|\\*)$/i);\n\tif (!wildcard) {\n\t\treturn false;\n\t}\n\n\tconst [_, type, subtype] = wildcard;\n\tif (subtype === '*') {\n\t\treturn normalizedMimeTypes.some(mime => mime.startsWith(type + '/'));\n\t}\n\n\treturn false;\n}\n\n\nexport const UriList = Object.freeze({\n\t// http://amundsen.com/hypermedia/urilist/\n\tcreate: (entries: ReadonlyArray<string | URI>): string => {\n\t\treturn distinct(entries.map(x => x.toString())).join('\\r\\n');\n\t},\n\tsplit: (str: string): string[] => {\n\t\treturn str.split('\\r\\n');\n\t},\n\tparse: (str: string): string[] => {\n\t\treturn UriList.split(str).filter(value => !value.startsWith('#'));\n\t}\n});\n","/**\n * marked v14.0.0 - a markdown parser\n * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)\n * https://github.com/markedjs/marked\n */\n\n/**\n * DO NOT EDIT THIS FILE\n * The code in this file is generated from files in ./src/\n */\n\n/**\n * Gets the original marked default options.\n */\nfunction _getDefaults() {\n    return {\n        async: false,\n        breaks: false,\n        extensions: null,\n        gfm: true,\n        hooks: null,\n        pedantic: false,\n        renderer: null,\n        silent: false,\n        tokenizer: null,\n        walkTokens: null,\n    };\n}\nlet _defaults = _getDefaults();\nfunction changeDefaults(newDefaults) {\n    _defaults = newDefaults;\n}\n\n/**\n * Helpers\n */\nconst escapeTest = /[&<>\"']/;\nconst escapeReplace = new RegExp(escapeTest.source, 'g');\nconst escapeTestNoEncode = /[<>\"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/;\nconst escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');\nconst escapeReplacements = {\n    '&': '&amp;',\n    '<': '&lt;',\n    '>': '&gt;',\n    '\"': '&quot;',\n    \"'\": '&#39;',\n};\nconst getEscapeReplacement = (ch) => escapeReplacements[ch];\nfunction escape$1(html, encode) {\n    if (encode) {\n        if (escapeTest.test(html)) {\n            return html.replace(escapeReplace, getEscapeReplacement);\n        }\n    }\n    else {\n        if (escapeTestNoEncode.test(html)) {\n            return html.replace(escapeReplaceNoEncode, getEscapeReplacement);\n        }\n    }\n    return html;\n}\nconst caret = /(^|[^\\[])\\^/g;\nfunction edit(regex, opt) {\n    let source = typeof regex === 'string' ? regex : regex.source;\n    opt = opt || '';\n    const obj = {\n        replace: (name, val) => {\n            let valSource = typeof val === 'string' ? val : val.source;\n            valSource = valSource.replace(caret, '$1');\n            source = source.replace(name, valSource);\n            return obj;\n        },\n        getRegex: () => {\n            return new RegExp(source, opt);\n        },\n    };\n    return obj;\n}\nfunction cleanUrl(href) {\n    try {\n        href = encodeURI(href).replace(/%25/g, '%');\n    }\n    catch {\n        return null;\n    }\n    return href;\n}\nconst noopTest = { exec: () => null };\nfunction splitCells(tableRow, count) {\n    // ensure that every cell-delimiting pipe has a space\n    // before it to distinguish it from an escaped pipe\n    const row = tableRow.replace(/\\|/g, (match, offset, str) => {\n        let escaped = false;\n        let curr = offset;\n        while (--curr >= 0 && str[curr] === '\\\\')\n            escaped = !escaped;\n        if (escaped) {\n            // odd number of slashes means | is escaped\n            // so we leave it alone\n            return '|';\n        }\n        else {\n            // add space before unescaped |\n            return ' |';\n        }\n    }), cells = row.split(/ \\|/);\n    let i = 0;\n    // First/last cell in a row cannot be empty if it has no leading/trailing pipe\n    if (!cells[0].trim()) {\n        cells.shift();\n    }\n    if (cells.length > 0 && !cells[cells.length - 1].trim()) {\n        cells.pop();\n    }\n    if (count) {\n        if (cells.length > count) {\n            cells.splice(count);\n        }\n        else {\n            while (cells.length < count)\n                cells.push('');\n        }\n    }\n    for (; i < cells.length; i++) {\n        // leading or trailing whitespace is ignored per the gfm spec\n        cells[i] = cells[i].trim().replace(/\\\\\\|/g, '|');\n    }\n    return cells;\n}\n/**\n * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').\n * /c*$/ is vulnerable to REDOS.\n *\n * @param str\n * @param c\n * @param invert Remove suffix of non-c chars instead. Default falsey.\n */\nfunction rtrim(str, c, invert) {\n    const l = str.length;\n    if (l === 0) {\n        return '';\n    }\n    // Length of suffix matching the invert condition.\n    let suffLen = 0;\n    // Step left until we fail to match the invert condition.\n    while (suffLen < l) {\n        const currChar = str.charAt(l - suffLen - 1);\n        if (currChar === c && !invert) {\n            suffLen++;\n        }\n        else if (currChar !== c && invert) {\n            suffLen++;\n        }\n        else {\n            break;\n        }\n    }\n    return str.slice(0, l - suffLen);\n}\nfunction findClosingBracket(str, b) {\n    if (str.indexOf(b[1]) === -1) {\n        return -1;\n    }\n    let level = 0;\n    for (let i = 0; i < str.length; i++) {\n        if (str[i] === '\\\\') {\n            i++;\n        }\n        else if (str[i] === b[0]) {\n            level++;\n        }\n        else if (str[i] === b[1]) {\n            level--;\n            if (level < 0) {\n                return i;\n            }\n        }\n    }\n    return -1;\n}\n\nfunction outputLink(cap, link, raw, lexer) {\n    const href = link.href;\n    const title = link.title ? escape$1(link.title) : null;\n    const text = cap[1].replace(/\\\\([\\[\\]])/g, '$1');\n    if (cap[0].charAt(0) !== '!') {\n        lexer.state.inLink = true;\n        const token = {\n            type: 'link',\n            raw,\n            href,\n            title,\n            text,\n            tokens: lexer.inlineTokens(text),\n        };\n        lexer.state.inLink = false;\n        return token;\n    }\n    return {\n        type: 'image',\n        raw,\n        href,\n        title,\n        text: escape$1(text),\n    };\n}\nfunction indentCodeCompensation(raw, text) {\n    const matchIndentToCode = raw.match(/^(\\s+)(?:```)/);\n    if (matchIndentToCode === null) {\n        return text;\n    }\n    const indentToCode = matchIndentToCode[1];\n    return text\n        .split('\\n')\n        .map(node => {\n        const matchIndentInNode = node.match(/^\\s+/);\n        if (matchIndentInNode === null) {\n            return node;\n        }\n        const [indentInNode] = matchIndentInNode;\n        if (indentInNode.length >= indentToCode.length) {\n            return node.slice(indentToCode.length);\n        }\n        return node;\n    })\n        .join('\\n');\n}\n/**\n * Tokenizer\n */\nclass _Tokenizer {\n    options;\n    rules; // set by the lexer\n    lexer; // set by the lexer\n    constructor(options) {\n        this.options = options || _defaults;\n    }\n    space(src) {\n        const cap = this.rules.block.newline.exec(src);\n        if (cap && cap[0].length > 0) {\n            return {\n                type: 'space',\n                raw: cap[0],\n            };\n        }\n    }\n    code(src) {\n        const cap = this.rules.block.code.exec(src);\n        if (cap) {\n            const text = cap[0].replace(/^ {1,4}/gm, '');\n            return {\n                type: 'code',\n                raw: cap[0],\n                codeBlockStyle: 'indented',\n                text: !this.options.pedantic\n                    ? rtrim(text, '\\n')\n                    : text,\n            };\n        }\n    }\n    fences(src) {\n        const cap = this.rules.block.fences.exec(src);\n        if (cap) {\n            const raw = cap[0];\n            const text = indentCodeCompensation(raw, cap[3] || '');\n            return {\n                type: 'code',\n                raw,\n                lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2],\n                text,\n            };\n        }\n    }\n    heading(src) {\n        const cap = this.rules.block.heading.exec(src);\n        if (cap) {\n            let text = cap[2].trim();\n            // remove trailing #s\n            if (/#$/.test(text)) {\n                const trimmed = rtrim(text, '#');\n                if (this.options.pedantic) {\n                    text = trimmed.trim();\n                }\n                else if (!trimmed || / $/.test(trimmed)) {\n                    // CommonMark requires space before trailing #s\n                    text = trimmed.trim();\n                }\n            }\n            return {\n                type: 'heading',\n                raw: cap[0],\n                depth: cap[1].length,\n                text,\n                tokens: this.lexer.inline(text),\n            };\n        }\n    }\n    hr(src) {\n        const cap = this.rules.block.hr.exec(src);\n        if (cap) {\n            return {\n                type: 'hr',\n                raw: rtrim(cap[0], '\\n'),\n            };\n        }\n    }\n    blockquote(src) {\n        const cap = this.rules.block.blockquote.exec(src);\n        if (cap) {\n            let lines = rtrim(cap[0], '\\n').split('\\n');\n            let raw = '';\n            let text = '';\n            const tokens = [];\n            while (lines.length > 0) {\n                let inBlockquote = false;\n                const currentLines = [];\n                let i;\n                for (i = 0; i < lines.length; i++) {\n                    // get lines up to a continuation\n                    if (/^ {0,3}>/.test(lines[i])) {\n                        currentLines.push(lines[i]);\n                        inBlockquote = true;\n                    }\n                    else if (!inBlockquote) {\n                        currentLines.push(lines[i]);\n                    }\n                    else {\n                        break;\n                    }\n                }\n                lines = lines.slice(i);\n                const currentRaw = currentLines.join('\\n');\n                const currentText = currentRaw\n                    // precede setext continuation with 4 spaces so it isn't a setext\n                    .replace(/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g, '\\n    $1')\n                    .replace(/^ {0,3}>[ \\t]?/gm, '');\n                raw = raw ? `${raw}\\n${currentRaw}` : currentRaw;\n                text = text ? `${text}\\n${currentText}` : currentText;\n                // parse blockquote lines as top level tokens\n                // merge paragraphs if this is a continuation\n                const top = this.lexer.state.top;\n                this.lexer.state.top = true;\n                this.lexer.blockTokens(currentText, tokens, true);\n                this.lexer.state.top = top;\n                // if there is no continuation then we are done\n                if (lines.length === 0) {\n                    break;\n                }\n                const lastToken = tokens[tokens.length - 1];\n                if (lastToken?.type === 'code') {\n                    // blockquote continuation cannot be preceded by a code block\n                    break;\n                }\n                else if (lastToken?.type === 'blockquote') {\n                    // include continuation in nested blockquote\n                    const oldToken = lastToken;\n                    const newText = oldToken.raw + '\\n' + lines.join('\\n');\n                    const newToken = this.blockquote(newText);\n                    tokens[tokens.length - 1] = newToken;\n                    raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;\n                    text = text.substring(0, text.length - oldToken.text.length) + newToken.text;\n                    break;\n                }\n                else if (lastToken?.type === 'list') {\n                    // include continuation in nested list\n                    const oldToken = lastToken;\n                    const newText = oldToken.raw + '\\n' + lines.join('\\n');\n                    const newToken = this.list(newText);\n                    tokens[tokens.length - 1] = newToken;\n                    raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;\n                    text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;\n                    lines = newText.substring(tokens[tokens.length - 1].raw.length).split('\\n');\n                    continue;\n                }\n            }\n            return {\n                type: 'blockquote',\n                raw,\n                tokens,\n                text,\n            };\n        }\n    }\n    list(src) {\n        let cap = this.rules.block.list.exec(src);\n        if (cap) {\n            let bull = cap[1].trim();\n            const isordered = bull.length > 1;\n            const list = {\n                type: 'list',\n                raw: '',\n                ordered: isordered,\n                start: isordered ? +bull.slice(0, -1) : '',\n                loose: false,\n                items: [],\n            };\n            bull = isordered ? `\\\\d{1,9}\\\\${bull.slice(-1)}` : `\\\\${bull}`;\n            if (this.options.pedantic) {\n                bull = isordered ? bull : '[*+-]';\n            }\n            // Get next list item\n            const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\\t ][^\\\\n]*)?(?:\\\\n|$))`);\n            let endsWithBlankLine = false;\n            // Check if current bullet point can start a new List Item\n            while (src) {\n                let endEarly = false;\n                let raw = '';\n                let itemContents = '';\n                if (!(cap = itemRegex.exec(src))) {\n                    break;\n                }\n                if (this.rules.block.hr.test(src)) { // End list if bullet was actually HR (possibly move into itemRegex?)\n                    break;\n                }\n                raw = cap[0];\n                src = src.substring(raw.length);\n                let line = cap[2].split('\\n', 1)[0].replace(/^\\t+/, (t) => ' '.repeat(3 * t.length));\n                let nextLine = src.split('\\n', 1)[0];\n                let blankLine = !line.trim();\n                let indent = 0;\n                if (this.options.pedantic) {\n                    indent = 2;\n                    itemContents = line.trimStart();\n                }\n                else if (blankLine) {\n                    indent = cap[1].length + 1;\n                }\n                else {\n                    indent = cap[2].search(/[^ ]/); // Find first non-space char\n                    indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent\n                    itemContents = line.slice(indent);\n                    indent += cap[1].length;\n                }\n                if (blankLine && /^ *$/.test(nextLine)) { // Items begin with at most one blank line\n                    raw += nextLine + '\\n';\n                    src = src.substring(nextLine.length + 1);\n                    endEarly = true;\n                }\n                if (!endEarly) {\n                    const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ \\t][^\\\\n]*)?(?:\\\\n|$))`);\n                    const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\\\* *){3,})(?:\\\\n+|$)`);\n                    const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\\`\\`\\`|~~~)`);\n                    const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);\n                    // Check if following lines should be included in List Item\n                    while (src) {\n                        const rawLine = src.split('\\n', 1)[0];\n                        nextLine = rawLine;\n                        // Re-align to follow commonmark nesting rules\n                        if (this.options.pedantic) {\n                            nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, '  ');\n                        }\n                        // End list item if found code fences\n                        if (fencesBeginRegex.test(nextLine)) {\n                            break;\n                        }\n                        // End list item if found start of new heading\n                        if (headingBeginRegex.test(nextLine)) {\n                            break;\n                        }\n                        // End list item if found start of new bullet\n                        if (nextBulletRegex.test(nextLine)) {\n                            break;\n                        }\n                        // Horizontal rule found\n                        if (hrRegex.test(src)) {\n                            break;\n                        }\n                        if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) { // Dedent if possible\n                            itemContents += '\\n' + nextLine.slice(indent);\n                        }\n                        else {\n                            // not enough indentation\n                            if (blankLine) {\n                                break;\n                            }\n                            // paragraph continuation unless last line was a different block level element\n                            if (line.search(/[^ ]/) >= 4) { // indented code block\n                                break;\n                            }\n                            if (fencesBeginRegex.test(line)) {\n                                break;\n                            }\n                            if (headingBeginRegex.test(line)) {\n                                break;\n                            }\n                            if (hrRegex.test(line)) {\n                                break;\n                            }\n                            itemContents += '\\n' + nextLine;\n                        }\n                        if (!blankLine && !nextLine.trim()) { // Check if current line is blank\n                            blankLine = true;\n                        }\n                        raw += rawLine + '\\n';\n                        src = src.substring(rawLine.length + 1);\n                        line = nextLine.slice(indent);\n                    }\n                }\n                if (!list.loose) {\n                    // If the previous item ended with a blank line, the list is loose\n                    if (endsWithBlankLine) {\n                        list.loose = true;\n                    }\n                    else if (/\\n *\\n *$/.test(raw)) {\n                        endsWithBlankLine = true;\n                    }\n                }\n                let istask = null;\n                let ischecked;\n                // Check for task list items\n                if (this.options.gfm) {\n                    istask = /^\\[[ xX]\\] /.exec(itemContents);\n                    if (istask) {\n                        ischecked = istask[0] !== '[ ] ';\n                        itemContents = itemContents.replace(/^\\[[ xX]\\] +/, '');\n                    }\n                }\n                list.items.push({\n                    type: 'list_item',\n                    raw,\n                    task: !!istask,\n                    checked: ischecked,\n                    loose: false,\n                    text: itemContents,\n                    tokens: [],\n                });\n                list.raw += raw;\n            }\n            // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic\n            list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd();\n            list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd();\n            list.raw = list.raw.trimEnd();\n            // Item child tokens handled here at end because we needed to have the final item to trim it first\n            for (let i = 0; i < list.items.length; i++) {\n                this.lexer.state.top = false;\n                list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);\n                if (!list.loose) {\n                    // Check if list should be loose\n                    const spacers = list.items[i].tokens.filter(t => t.type === 'space');\n                    const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\\n.*\\n/.test(t.raw));\n                    list.loose = hasMultipleLineBreaks;\n                }\n            }\n            // Set all items to loose if list is loose\n            if (list.loose) {\n                for (let i = 0; i < list.items.length; i++) {\n                    list.items[i].loose = true;\n                }\n            }\n            return list;\n        }\n    }\n    html(src) {\n        const cap = this.rules.block.html.exec(src);\n        if (cap) {\n            const token = {\n                type: 'html',\n                block: true,\n                raw: cap[0],\n                pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',\n                text: cap[0],\n            };\n            return token;\n        }\n    }\n    def(src) {\n        const cap = this.rules.block.def.exec(src);\n        if (cap) {\n            const tag = cap[1].toLowerCase().replace(/\\s+/g, ' ');\n            const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline.anyPunctuation, '$1') : '';\n            const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, '$1') : cap[3];\n            return {\n                type: 'def',\n                tag,\n                raw: cap[0],\n                href,\n                title,\n            };\n        }\n    }\n    table(src) {\n        const cap = this.rules.block.table.exec(src);\n        if (!cap) {\n            return;\n        }\n        if (!/[:|]/.test(cap[2])) {\n            // delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading\n            return;\n        }\n        const headers = splitCells(cap[1]);\n        const aligns = cap[2].replace(/^\\||\\| *$/g, '').split('|');\n        const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\\n[ \\t]*$/, '').split('\\n') : [];\n        const item = {\n            type: 'table',\n            raw: cap[0],\n            header: [],\n            align: [],\n            rows: [],\n        };\n        if (headers.length !== aligns.length) {\n            // header and align columns must be equal, rows can be different.\n            return;\n        }\n        for (const align of aligns) {\n            if (/^ *-+: *$/.test(align)) {\n                item.align.push('right');\n            }\n            else if (/^ *:-+: *$/.test(align)) {\n                item.align.push('center');\n            }\n            else if (/^ *:-+ *$/.test(align)) {\n                item.align.push('left');\n            }\n            else {\n                item.align.push(null);\n            }\n        }\n        for (let i = 0; i < headers.length; i++) {\n            item.header.push({\n                text: headers[i],\n                tokens: this.lexer.inline(headers[i]),\n                header: true,\n                align: item.align[i],\n            });\n        }\n        for (const row of rows) {\n            item.rows.push(splitCells(row, item.header.length).map((cell, i) => {\n                return {\n                    text: cell,\n                    tokens: this.lexer.inline(cell),\n                    header: false,\n                    align: item.align[i],\n                };\n            }));\n        }\n        return item;\n    }\n    lheading(src) {\n        const cap = this.rules.block.lheading.exec(src);\n        if (cap) {\n            return {\n                type: 'heading',\n                raw: cap[0],\n                depth: cap[2].charAt(0) === '=' ? 1 : 2,\n                text: cap[1],\n                tokens: this.lexer.inline(cap[1]),\n            };\n        }\n    }\n    paragraph(src) {\n        const cap = this.rules.block.paragraph.exec(src);\n        if (cap) {\n            const text = cap[1].charAt(cap[1].length - 1) === '\\n'\n                ? cap[1].slice(0, -1)\n                : cap[1];\n            return {\n                type: 'paragraph',\n                raw: cap[0],\n                text,\n                tokens: this.lexer.inline(text),\n            };\n        }\n    }\n    text(src) {\n        const cap = this.rules.block.text.exec(src);\n        if (cap) {\n            return {\n                type: 'text',\n                raw: cap[0],\n                text: cap[0],\n                tokens: this.lexer.inline(cap[0]),\n            };\n        }\n    }\n    escape(src) {\n        const cap = this.rules.inline.escape.exec(src);\n        if (cap) {\n            return {\n                type: 'escape',\n                raw: cap[0],\n                text: escape$1(cap[1]),\n            };\n        }\n    }\n    tag(src) {\n        const cap = this.rules.inline.tag.exec(src);\n        if (cap) {\n            if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {\n                this.lexer.state.inLink = true;\n            }\n            else if (this.lexer.state.inLink && /^<\\/a>/i.test(cap[0])) {\n                this.lexer.state.inLink = false;\n            }\n            if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\\s|>)/i.test(cap[0])) {\n                this.lexer.state.inRawBlock = true;\n            }\n            else if (this.lexer.state.inRawBlock && /^<\\/(pre|code|kbd|script)(\\s|>)/i.test(cap[0])) {\n                this.lexer.state.inRawBlock = false;\n            }\n            return {\n                type: 'html',\n                raw: cap[0],\n                inLink: this.lexer.state.inLink,\n                inRawBlock: this.lexer.state.inRawBlock,\n                block: false,\n                text: cap[0],\n            };\n        }\n    }\n    link(src) {\n        const cap = this.rules.inline.link.exec(src);\n        if (cap) {\n            const trimmedUrl = cap[2].trim();\n            if (!this.options.pedantic && /^</.test(trimmedUrl)) {\n                // commonmark requires matching angle brackets\n                if (!(/>$/.test(trimmedUrl))) {\n                    return;\n                }\n                // ending angle bracket cannot be escaped\n                const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\\\');\n                if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {\n                    return;\n                }\n            }\n            else {\n                // find closing parenthesis\n                const lastParenIndex = findClosingBracket(cap[2], '()');\n                if (lastParenIndex > -1) {\n                    const start = cap[0].indexOf('!') === 0 ? 5 : 4;\n                    const linkLen = start + cap[1].length + lastParenIndex;\n                    cap[2] = cap[2].substring(0, lastParenIndex);\n                    cap[0] = cap[0].substring(0, linkLen).trim();\n                    cap[3] = '';\n                }\n            }\n            let href = cap[2];\n            let title = '';\n            if (this.options.pedantic) {\n                // split pedantic href and title\n                const link = /^([^'\"]*[^\\s])\\s+(['\"])(.*)\\2/.exec(href);\n                if (link) {\n                    href = link[1];\n                    title = link[3];\n                }\n            }\n            else {\n                title = cap[3] ? cap[3].slice(1, -1) : '';\n            }\n            href = href.trim();\n            if (/^</.test(href)) {\n                if (this.options.pedantic && !(/>$/.test(trimmedUrl))) {\n                    // pedantic allows starting angle bracket without ending angle bracket\n                    href = href.slice(1);\n                }\n                else {\n                    href = href.slice(1, -1);\n                }\n            }\n            return outputLink(cap, {\n                href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,\n                title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title,\n            }, cap[0], this.lexer);\n        }\n    }\n    reflink(src, links) {\n        let cap;\n        if ((cap = this.rules.inline.reflink.exec(src))\n            || (cap = this.rules.inline.nolink.exec(src))) {\n            const linkString = (cap[2] || cap[1]).replace(/\\s+/g, ' ');\n            const link = links[linkString.toLowerCase()];\n            if (!link) {\n                const text = cap[0].charAt(0);\n                return {\n                    type: 'text',\n                    raw: text,\n                    text,\n                };\n            }\n            return outputLink(cap, link, cap[0], this.lexer);\n        }\n    }\n    emStrong(src, maskedSrc, prevChar = '') {\n        let match = this.rules.inline.emStrongLDelim.exec(src);\n        if (!match)\n            return;\n        // _ can't be between two alphanumerics. \\p{L}\\p{N} includes non-english alphabet/numbers as well\n        if (match[3] && prevChar.match(/[\\p{L}\\p{N}]/u))\n            return;\n        const nextChar = match[1] || match[2] || '';\n        if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {\n            // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)\n            const lLength = [...match[0]].length - 1;\n            let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;\n            const endReg = match[0][0] === '*' ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;\n            endReg.lastIndex = 0;\n            // Clip maskedSrc to same section of string as src (move to lexer?)\n            maskedSrc = maskedSrc.slice(-1 * src.length + lLength);\n            while ((match = endReg.exec(maskedSrc)) != null) {\n                rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];\n                if (!rDelim)\n                    continue; // skip single * in __abc*abc__\n                rLength = [...rDelim].length;\n                if (match[3] || match[4]) { // found another Left Delim\n                    delimTotal += rLength;\n                    continue;\n                }\n                else if (match[5] || match[6]) { // either Left or Right Delim\n                    if (lLength % 3 && !((lLength + rLength) % 3)) {\n                        midDelimTotal += rLength;\n                        continue; // CommonMark Emphasis Rules 9-10\n                    }\n                }\n                delimTotal -= rLength;\n                if (delimTotal > 0)\n                    continue; // Haven't found enough closing delimiters\n                // Remove extra characters. *a*** -> *a*\n                rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);\n                // char length can be >1 for unicode characters;\n                const lastCharLength = [...match[0]][0].length;\n                const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);\n                // Create `em` if smallest delimiter has odd char count. *a***\n                if (Math.min(lLength, rLength) % 2) {\n                    const text = raw.slice(1, -1);\n                    return {\n                        type: 'em',\n                        raw,\n                        text,\n                        tokens: this.lexer.inlineTokens(text),\n                    };\n                }\n                // Create 'strong' if smallest delimiter has even char count. **a***\n                const text = raw.slice(2, -2);\n                return {\n                    type: 'strong',\n                    raw,\n                    text,\n                    tokens: this.lexer.inlineTokens(text),\n                };\n            }\n        }\n    }\n    codespan(src) {\n        const cap = this.rules.inline.code.exec(src);\n        if (cap) {\n            let text = cap[2].replace(/\\n/g, ' ');\n            const hasNonSpaceChars = /[^ ]/.test(text);\n            const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);\n            if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {\n                text = text.substring(1, text.length - 1);\n            }\n            text = escape$1(text, true);\n            return {\n                type: 'codespan',\n                raw: cap[0],\n                text,\n            };\n        }\n    }\n    br(src) {\n        const cap = this.rules.inline.br.exec(src);\n        if (cap) {\n            return {\n                type: 'br',\n                raw: cap[0],\n            };\n        }\n    }\n    del(src) {\n        const cap = this.rules.inline.del.exec(src);\n        if (cap) {\n            return {\n                type: 'del',\n                raw: cap[0],\n                text: cap[2],\n                tokens: this.lexer.inlineTokens(cap[2]),\n            };\n        }\n    }\n    autolink(src) {\n        const cap = this.rules.inline.autolink.exec(src);\n        if (cap) {\n            let text, href;\n            if (cap[2] === '@') {\n                text = escape$1(cap[1]);\n                href = 'mailto:' + text;\n            }\n            else {\n                text = escape$1(cap[1]);\n                href = text;\n            }\n            return {\n                type: 'link',\n                raw: cap[0],\n                text,\n                href,\n                tokens: [\n                    {\n                        type: 'text',\n                        raw: text,\n                        text,\n                    },\n                ],\n            };\n        }\n    }\n    url(src) {\n        let cap;\n        if (cap = this.rules.inline.url.exec(src)) {\n            let text, href;\n            if (cap[2] === '@') {\n                text = escape$1(cap[0]);\n                href = 'mailto:' + text;\n            }\n            else {\n                // do extended autolink path validation\n                let prevCapZero;\n                do {\n                    prevCapZero = cap[0];\n                    cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? '';\n                } while (prevCapZero !== cap[0]);\n                text = escape$1(cap[0]);\n                if (cap[1] === 'www.') {\n                    href = 'http://' + cap[0];\n                }\n                else {\n                    href = cap[0];\n                }\n            }\n            return {\n                type: 'link',\n                raw: cap[0],\n                text,\n                href,\n                tokens: [\n                    {\n                        type: 'text',\n                        raw: text,\n                        text,\n                    },\n                ],\n            };\n        }\n    }\n    inlineText(src) {\n        const cap = this.rules.inline.text.exec(src);\n        if (cap) {\n            let text;\n            if (this.lexer.state.inRawBlock) {\n                text = cap[0];\n            }\n            else {\n                text = escape$1(cap[0]);\n            }\n            return {\n                type: 'text',\n                raw: cap[0],\n                text,\n            };\n        }\n    }\n}\n\n/**\n * Block-Level Grammar\n */\nconst newline = /^(?: *(?:\\n|$))+/;\nconst blockCode = /^( {4}[^\\n]+(?:\\n(?: *(?:\\n|$))*)?)+/;\nconst fences = /^ {0,3}(`{3,}(?=[^`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~`]* *(?=\\n|$)|$)/;\nconst hr = /^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/;\nconst heading = /^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/;\nconst bullet = /(?:[*+-]|\\d{1,9}[.)])/;\nconst lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\\n(?!\\s*?\\n|bull |blockCode|fences|blockquote|heading|html))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/)\n    .replace(/bull/g, bullet) // lists can interrupt\n    .replace(/blockCode/g, / {4}/) // indented code blocks can interrupt\n    .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt\n    .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt\n    .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt\n    .replace(/html/g, / {0,3}<[^\\n>]+>\\n/) // block html can interrupt\n    .getRegex();\nconst _paragraph = /^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\\n)[^\\n]+)*)/;\nconst blockText = /^[^\\n]+/;\nconst _blockLabel = /(?!\\s*\\])(?:\\\\.|[^\\[\\]\\\\])+/;\nconst def = edit(/^ {0,3}\\[(label)\\]: *(?:\\n *)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n *)?| *\\n *)(title))? *(?:\\n+|$)/)\n    .replace('label', _blockLabel)\n    .replace('title', /(?:\"(?:\\\\\"?|[^\"\\\\])*\"|'[^'\\n]*(?:\\n[^'\\n]+)*\\n?'|\\([^()]*\\))/)\n    .getRegex();\nconst list = edit(/^( {0,3}bull)([ \\t][^\\n]+?)?(?:\\n|$)/)\n    .replace(/bull/g, bullet)\n    .getRegex();\nconst _tag = 'address|article|aside|base|basefont|blockquote|body|caption'\n    + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'\n    + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'\n    + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'\n    + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'\n    + '|tr|track|ul';\nconst _comment = /<!--(?:-?>|[\\s\\S]*?(?:-->|$))/;\nconst html = edit('^ {0,3}(?:' // optional indentation\n    + '<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:</\\\\1>[^\\\\n]*\\\\n+|$)' // (1)\n    + '|comment[^\\\\n]*(\\\\n+|$)' // (2)\n    + '|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>\\\\n*|$)' // (3)\n    + '|<![A-Z][\\\\s\\\\S]*?(?:>\\\\n*|$)' // (4)\n    + '|<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?(?:\\\\]\\\\]>\\\\n*|$)' // (5)\n    + '|</?(tag)(?: +|\\\\n|/?>)[\\\\s\\\\S]*?(?:(?:\\\\n *)+\\\\n|$)' // (6)\n    + '|<(?!script|pre|style|textarea)([a-z][\\\\w-]*)(?:attribute)*? */?>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n *)+\\\\n|$)' // (7) open tag\n    + '|</(?!script|pre|style|textarea)[a-z][\\\\w-]*\\\\s*>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n *)+\\\\n|$)' // (7) closing tag\n    + ')', 'i')\n    .replace('comment', _comment)\n    .replace('tag', _tag)\n    .replace('attribute', / +[a-zA-Z:_][\\w.:-]*(?: *= *\"[^\"\\n]*\"| *= *'[^'\\n]*'| *= *[^\\s\"'=<>`]+)?/)\n    .getRegex();\nconst paragraph = edit(_paragraph)\n    .replace('hr', hr)\n    .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n    .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs\n    .replace('|table', '')\n    .replace('blockquote', ' {0,3}>')\n    .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n    .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n    .replace('html', '</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n    .replace('tag', _tag) // pars can be interrupted by type (6) html blocks\n    .getRegex();\nconst blockquote = edit(/^( {0,3}> ?(paragraph|[^\\n]*)(?:\\n|$))+/)\n    .replace('paragraph', paragraph)\n    .getRegex();\n/**\n * Normal Block Grammar\n */\nconst blockNormal = {\n    blockquote,\n    code: blockCode,\n    def,\n    fences,\n    heading,\n    hr,\n    html,\n    lheading,\n    list,\n    newline,\n    paragraph,\n    table: noopTest,\n    text: blockText,\n};\n/**\n * GFM Block Grammar\n */\nconst gfmTable = edit('^ *([^\\\\n ].*)\\\\n' // Header\n    + ' {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)' // Align\n    + '(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)') // Cells\n    .replace('hr', hr)\n    .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n    .replace('blockquote', ' {0,3}>')\n    .replace('code', ' {4}[^\\\\n]')\n    .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n    .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n    .replace('html', '</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n    .replace('tag', _tag) // tables can be interrupted by type (6) html blocks\n    .getRegex();\nconst blockGfm = {\n    ...blockNormal,\n    table: gfmTable,\n    paragraph: edit(_paragraph)\n        .replace('hr', hr)\n        .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n        .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs\n        .replace('table', gfmTable) // interrupt paragraphs with table\n        .replace('blockquote', ' {0,3}>')\n        .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n        .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n        .replace('html', '</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n        .replace('tag', _tag) // pars can be interrupted by type (6) html blocks\n        .getRegex(),\n};\n/**\n * Pedantic grammar (original John Gruber's loose markdown specification)\n */\nconst blockPedantic = {\n    ...blockNormal,\n    html: edit('^ *(?:comment *(?:\\\\n|\\\\s*$)'\n        + '|<(tag)[\\\\s\\\\S]+?</\\\\1> *(?:\\\\n{2,}|\\\\s*$)' // closed tag\n        + '|<tag(?:\"[^\"]*\"|\\'[^\\']*\\'|\\\\s[^\\'\"/>\\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))')\n        .replace('comment', _comment)\n        .replace(/tag/g, '(?!(?:'\n        + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'\n        + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'\n        + '\\\\b)\\\\w+(?!:|[^\\\\w\\\\s@]*@)\\\\b')\n        .getRegex(),\n    def: /^ *\\[([^\\]]+)\\]: *<?([^\\s>]+)>?(?: +([\"(][^\\n]+[\")]))? *(?:\\n+|$)/,\n    heading: /^(#{1,6})(.*)(?:\\n+|$)/,\n    fences: noopTest, // fences not supported\n    lheading: /^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,\n    paragraph: edit(_paragraph)\n        .replace('hr', hr)\n        .replace('heading', ' *#{1,6} *[^\\n]')\n        .replace('lheading', lheading)\n        .replace('|table', '')\n        .replace('blockquote', ' {0,3}>')\n        .replace('|fences', '')\n        .replace('|list', '')\n        .replace('|html', '')\n        .replace('|tag', '')\n        .getRegex(),\n};\n/**\n * Inline-Level Grammar\n */\nconst escape = /^\\\\([!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~])/;\nconst inlineCode = /^(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/;\nconst br = /^( {2,}|\\\\)\\n(?!\\s*$)/;\nconst inlineText = /^(`+|[^`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*_]|\\b_|$)|[^ ](?= {2,}\\n)))/;\n// list of unicode punctuation marks, plus any missing characters from CommonMark spec\nconst _punctuation = '\\\\p{P}\\\\p{S}';\nconst punctuation = edit(/^((?![*_])[\\spunctuation])/, 'u')\n    .replace(/punctuation/g, _punctuation).getRegex();\n// sequences em should skip over [title](link), `code`, <html>\nconst blockSkip = /\\[[^[\\]]*?\\]\\([^\\(\\)]*?\\)|`[^`]*?`|<[^<>]*?>/g;\nconst emStrongLDelim = edit(/^(?:\\*+(?:((?!\\*)[punct])|[^\\s*]))|^_+(?:((?!_)[punct])|([^\\s_]))/, 'u')\n    .replace(/punct/g, _punctuation)\n    .getRegex();\nconst emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)' // Skip orphan inside strong\n    + '|[^*]+(?=[^*])' // Consume to delim\n    + '|(?!\\\\*)[punct](\\\\*+)(?=[\\\\s]|$)' // (1) #*** can only be a Right Delimiter\n    + '|[^punct\\\\s](\\\\*+)(?!\\\\*)(?=[punct\\\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter\n    + '|(?!\\\\*)[punct\\\\s](\\\\*+)(?=[^punct\\\\s])' // (3) #***a, ***a can only be Left Delimiter\n    + '|[\\\\s](\\\\*+)(?!\\\\*)(?=[punct])' // (4) ***# can only be Left Delimiter\n    + '|(?!\\\\*)[punct](\\\\*+)(?!\\\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter\n    + '|[^punct\\\\s](\\\\*+)(?=[^punct\\\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter\n    .replace(/punct/g, _punctuation)\n    .getRegex();\n// (6) Not allowed for _\nconst emStrongRDelimUnd = edit('^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)' // Skip orphan inside strong\n    + '|[^_]+(?=[^_])' // Consume to delim\n    + '|(?!_)[punct](_+)(?=[\\\\s]|$)' // (1) #___ can only be a Right Delimiter\n    + '|[^punct\\\\s](_+)(?!_)(?=[punct\\\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter\n    + '|(?!_)[punct\\\\s](_+)(?=[^punct\\\\s])' // (3) #___a, ___a can only be Left Delimiter\n    + '|[\\\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter\n    + '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter\n    .replace(/punct/g, _punctuation)\n    .getRegex();\nconst anyPunctuation = edit(/\\\\([punct])/, 'gu')\n    .replace(/punct/g, _punctuation)\n    .getRegex();\nconst autolink = edit(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/)\n    .replace('scheme', /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/)\n    .replace('email', /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/)\n    .getRegex();\nconst _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex();\nconst tag = edit('^comment'\n    + '|^</[a-zA-Z][\\\\w:-]*\\\\s*>' // self-closing tag\n    + '|^<[a-zA-Z][\\\\w-]*(?:attribute)*?\\\\s*/?>' // open tag\n    + '|^<\\\\?[\\\\s\\\\S]*?\\\\?>' // processing instruction, e.g. <?php ?>\n    + '|^<![a-zA-Z]+\\\\s[\\\\s\\\\S]*?>' // declaration, e.g. <!DOCTYPE html>\n    + '|^<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>') // CDATA section\n    .replace('comment', _inlineComment)\n    .replace('attribute', /\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*\"[^\"]*\"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s\"'=<>`]+)?/)\n    .getRegex();\nconst _inlineLabel = /(?:\\[(?:\\\\.|[^\\[\\]\\\\])*\\]|\\\\.|`[^`]*`|[^\\[\\]\\\\`])*?/;\nconst link = edit(/^!?\\[(label)\\]\\(\\s*(href)(?:\\s+(title))?\\s*\\)/)\n    .replace('label', _inlineLabel)\n    .replace('href', /<(?:\\\\.|[^\\n<>\\\\])+>|[^\\s\\x00-\\x1f]*/)\n    .replace('title', /\"(?:\\\\\"?|[^\"\\\\])*\"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/)\n    .getRegex();\nconst reflink = edit(/^!?\\[(label)\\]\\[(ref)\\]/)\n    .replace('label', _inlineLabel)\n    .replace('ref', _blockLabel)\n    .getRegex();\nconst nolink = edit(/^!?\\[(ref)\\](?:\\[\\])?/)\n    .replace('ref', _blockLabel)\n    .getRegex();\nconst reflinkSearch = edit('reflink|nolink(?!\\\\()', 'g')\n    .replace('reflink', reflink)\n    .replace('nolink', nolink)\n    .getRegex();\n/**\n * Normal Inline Grammar\n */\nconst inlineNormal = {\n    _backpedal: noopTest, // only used for GFM url\n    anyPunctuation,\n    autolink,\n    blockSkip,\n    br,\n    code: inlineCode,\n    del: noopTest,\n    emStrongLDelim,\n    emStrongRDelimAst,\n    emStrongRDelimUnd,\n    escape,\n    link,\n    nolink,\n    punctuation,\n    reflink,\n    reflinkSearch,\n    tag,\n    text: inlineText,\n    url: noopTest,\n};\n/**\n * Pedantic Inline Grammar\n */\nconst inlinePedantic = {\n    ...inlineNormal,\n    link: edit(/^!?\\[(label)\\]\\((.*?)\\)/)\n        .replace('label', _inlineLabel)\n        .getRegex(),\n    reflink: edit(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/)\n        .replace('label', _inlineLabel)\n        .getRegex(),\n};\n/**\n * GFM Inline Grammar\n */\nconst inlineGfm = {\n    ...inlineNormal,\n    escape: edit(escape).replace('])', '~|])').getRegex(),\n    url: edit(/^((?:ftp|https?):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/, 'i')\n        .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)\n        .getRegex(),\n    _backpedal: /(?:[^?!.,:;*_'\"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'\"~)]+(?!$))+/,\n    del: /^(~~?)(?=[^\\s~])([\\s\\S]*?[^\\s~])\\1(?=[^~]|$)/,\n    text: /^([`~]+|[^`~])(?:(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*~_]|\\b_|https?:\\/\\/|ftp:\\/\\/|www\\.|$)|[^ ](?= {2,}\\n)|[^a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-](?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@)))/,\n};\n/**\n * GFM + Line Breaks Inline Grammar\n */\nconst inlineBreaks = {\n    ...inlineGfm,\n    br: edit(br).replace('{2,}', '*').getRegex(),\n    text: edit(inlineGfm.text)\n        .replace('\\\\b_', '\\\\b_| {2,}\\\\n')\n        .replace(/\\{2,\\}/g, '*')\n        .getRegex(),\n};\n/**\n * exports\n */\nconst block = {\n    normal: blockNormal,\n    gfm: blockGfm,\n    pedantic: blockPedantic,\n};\nconst inline = {\n    normal: inlineNormal,\n    gfm: inlineGfm,\n    breaks: inlineBreaks,\n    pedantic: inlinePedantic,\n};\n\n/**\n * Block Lexer\n */\nclass _Lexer {\n    tokens;\n    options;\n    state;\n    tokenizer;\n    inlineQueue;\n    constructor(options) {\n        // TokenList cannot be created in one go\n        this.tokens = [];\n        this.tokens.links = Object.create(null);\n        this.options = options || _defaults;\n        this.options.tokenizer = this.options.tokenizer || new _Tokenizer();\n        this.tokenizer = this.options.tokenizer;\n        this.tokenizer.options = this.options;\n        this.tokenizer.lexer = this;\n        this.inlineQueue = [];\n        this.state = {\n            inLink: false,\n            inRawBlock: false,\n            top: true,\n        };\n        const rules = {\n            block: block.normal,\n            inline: inline.normal,\n        };\n        if (this.options.pedantic) {\n            rules.block = block.pedantic;\n            rules.inline = inline.pedantic;\n        }\n        else if (this.options.gfm) {\n            rules.block = block.gfm;\n            if (this.options.breaks) {\n                rules.inline = inline.breaks;\n            }\n            else {\n                rules.inline = inline.gfm;\n            }\n        }\n        this.tokenizer.rules = rules;\n    }\n    /**\n     * Expose Rules\n     */\n    static get rules() {\n        return {\n            block,\n            inline,\n        };\n    }\n    /**\n     * Static Lex Method\n     */\n    static lex(src, options) {\n        const lexer = new _Lexer(options);\n        return lexer.lex(src);\n    }\n    /**\n     * Static Lex Inline Method\n     */\n    static lexInline(src, options) {\n        const lexer = new _Lexer(options);\n        return lexer.inlineTokens(src);\n    }\n    /**\n     * Preprocessing\n     */\n    lex(src) {\n        src = src\n            .replace(/\\r\\n|\\r/g, '\\n');\n        this.blockTokens(src, this.tokens);\n        for (let i = 0; i < this.inlineQueue.length; i++) {\n            const next = this.inlineQueue[i];\n            this.inlineTokens(next.src, next.tokens);\n        }\n        this.inlineQueue = [];\n        return this.tokens;\n    }\n    blockTokens(src, tokens = [], lastParagraphClipped = false) {\n        if (this.options.pedantic) {\n            src = src.replace(/\\t/g, '    ').replace(/^ +$/gm, '');\n        }\n        else {\n            src = src.replace(/^( *)(\\t+)/gm, (_, leading, tabs) => {\n                return leading + '    '.repeat(tabs.length);\n            });\n        }\n        let token;\n        let lastToken;\n        let cutSrc;\n        while (src) {\n            if (this.options.extensions\n                && this.options.extensions.block\n                && this.options.extensions.block.some((extTokenizer) => {\n                    if (token = extTokenizer.call({ lexer: this }, src, tokens)) {\n                        src = src.substring(token.raw.length);\n                        tokens.push(token);\n                        return true;\n                    }\n                    return false;\n                })) {\n                continue;\n            }\n            // newline\n            if (token = this.tokenizer.space(src)) {\n                src = src.substring(token.raw.length);\n                if (token.raw.length === 1 && tokens.length > 0) {\n                    // if there's a single \\n as a spacer, it's terminating the last line,\n                    // so move it there so that we don't get unnecessary paragraph tags\n                    tokens[tokens.length - 1].raw += '\\n';\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            // code\n            if (token = this.tokenizer.code(src)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                // An indented code block cannot interrupt a paragraph.\n                if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {\n                    lastToken.raw += '\\n' + token.raw;\n                    lastToken.text += '\\n' + token.text;\n                    this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            // fences\n            if (token = this.tokenizer.fences(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // heading\n            if (token = this.tokenizer.heading(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // hr\n            if (token = this.tokenizer.hr(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // blockquote\n            if (token = this.tokenizer.blockquote(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // list\n            if (token = this.tokenizer.list(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // html\n            if (token = this.tokenizer.html(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // def\n            if (token = this.tokenizer.def(src)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {\n                    lastToken.raw += '\\n' + token.raw;\n                    lastToken.text += '\\n' + token.raw;\n                    this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n                }\n                else if (!this.tokens.links[token.tag]) {\n                    this.tokens.links[token.tag] = {\n                        href: token.href,\n                        title: token.title,\n                    };\n                }\n                continue;\n            }\n            // table (gfm)\n            if (token = this.tokenizer.table(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // lheading\n            if (token = this.tokenizer.lheading(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // top-level paragraph\n            // prevent paragraph consuming extensions by clipping 'src' to extension start\n            cutSrc = src;\n            if (this.options.extensions && this.options.extensions.startBlock) {\n                let startIndex = Infinity;\n                const tempSrc = src.slice(1);\n                let tempStart;\n                this.options.extensions.startBlock.forEach((getStartIndex) => {\n                    tempStart = getStartIndex.call({ lexer: this }, tempSrc);\n                    if (typeof tempStart === 'number' && tempStart >= 0) {\n                        startIndex = Math.min(startIndex, tempStart);\n                    }\n                });\n                if (startIndex < Infinity && startIndex >= 0) {\n                    cutSrc = src.substring(0, startIndex + 1);\n                }\n            }\n            if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {\n                lastToken = tokens[tokens.length - 1];\n                if (lastParagraphClipped && lastToken?.type === 'paragraph') {\n                    lastToken.raw += '\\n' + token.raw;\n                    lastToken.text += '\\n' + token.text;\n                    this.inlineQueue.pop();\n                    this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                lastParagraphClipped = (cutSrc.length !== src.length);\n                src = src.substring(token.raw.length);\n                continue;\n            }\n            // text\n            if (token = this.tokenizer.text(src)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && lastToken.type === 'text') {\n                    lastToken.raw += '\\n' + token.raw;\n                    lastToken.text += '\\n' + token.text;\n                    this.inlineQueue.pop();\n                    this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            if (src) {\n                const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);\n                if (this.options.silent) {\n                    console.error(errMsg);\n                    break;\n                }\n                else {\n                    throw new Error(errMsg);\n                }\n            }\n        }\n        this.state.top = true;\n        return tokens;\n    }\n    inline(src, tokens = []) {\n        this.inlineQueue.push({ src, tokens });\n        return tokens;\n    }\n    /**\n     * Lexing/Compiling\n     */\n    inlineTokens(src, tokens = []) {\n        let token, lastToken, cutSrc;\n        // String with links masked to avoid interference with em and strong\n        let maskedSrc = src;\n        let match;\n        let keepPrevChar, prevChar;\n        // Mask out reflinks\n        if (this.tokens.links) {\n            const links = Object.keys(this.tokens.links);\n            if (links.length > 0) {\n                while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {\n                    if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {\n                        maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);\n                    }\n                }\n            }\n        }\n        // Mask out other blocks\n        while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {\n            maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);\n        }\n        // Mask out escaped characters\n        while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {\n            maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);\n        }\n        while (src) {\n            if (!keepPrevChar) {\n                prevChar = '';\n            }\n            keepPrevChar = false;\n            // extensions\n            if (this.options.extensions\n                && this.options.extensions.inline\n                && this.options.extensions.inline.some((extTokenizer) => {\n                    if (token = extTokenizer.call({ lexer: this }, src, tokens)) {\n                        src = src.substring(token.raw.length);\n                        tokens.push(token);\n                        return true;\n                    }\n                    return false;\n                })) {\n                continue;\n            }\n            // escape\n            if (token = this.tokenizer.escape(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // tag\n            if (token = this.tokenizer.tag(src)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && token.type === 'text' && lastToken.type === 'text') {\n                    lastToken.raw += token.raw;\n                    lastToken.text += token.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            // link\n            if (token = this.tokenizer.link(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // reflink, nolink\n            if (token = this.tokenizer.reflink(src, this.tokens.links)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && token.type === 'text' && lastToken.type === 'text') {\n                    lastToken.raw += token.raw;\n                    lastToken.text += token.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            // em & strong\n            if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // code\n            if (token = this.tokenizer.codespan(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // br\n            if (token = this.tokenizer.br(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // del (gfm)\n            if (token = this.tokenizer.del(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // autolink\n            if (token = this.tokenizer.autolink(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // url (gfm)\n            if (!this.state.inLink && (token = this.tokenizer.url(src))) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // text\n            // prevent inlineText consuming extensions by clipping 'src' to extension start\n            cutSrc = src;\n            if (this.options.extensions && this.options.extensions.startInline) {\n                let startIndex = Infinity;\n                const tempSrc = src.slice(1);\n                let tempStart;\n                this.options.extensions.startInline.forEach((getStartIndex) => {\n                    tempStart = getStartIndex.call({ lexer: this }, tempSrc);\n                    if (typeof tempStart === 'number' && tempStart >= 0) {\n                        startIndex = Math.min(startIndex, tempStart);\n                    }\n                });\n                if (startIndex < Infinity && startIndex >= 0) {\n                    cutSrc = src.substring(0, startIndex + 1);\n                }\n            }\n            if (token = this.tokenizer.inlineText(cutSrc)) {\n                src = src.substring(token.raw.length);\n                if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started\n                    prevChar = token.raw.slice(-1);\n                }\n                keepPrevChar = true;\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && lastToken.type === 'text') {\n                    lastToken.raw += token.raw;\n                    lastToken.text += token.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            if (src) {\n                const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);\n                if (this.options.silent) {\n                    console.error(errMsg);\n                    break;\n                }\n                else {\n                    throw new Error(errMsg);\n                }\n            }\n        }\n        return tokens;\n    }\n}\n\n/**\n * Renderer\n */\nclass _Renderer {\n    options;\n    parser; // set by the parser\n    constructor(options) {\n        this.options = options || _defaults;\n    }\n    space(token) {\n        return '';\n    }\n    code({ text, lang, escaped }) {\n        const langString = (lang || '').match(/^\\S*/)?.[0];\n        const code = text.replace(/\\n$/, '') + '\\n';\n        if (!langString) {\n            return '<pre><code>'\n                + (escaped ? code : escape$1(code, true))\n                + '</code></pre>\\n';\n        }\n        return '<pre><code class=\"language-'\n            + escape$1(langString)\n            + '\">'\n            + (escaped ? code : escape$1(code, true))\n            + '</code></pre>\\n';\n    }\n    blockquote({ tokens }) {\n        const body = this.parser.parse(tokens);\n        return `<blockquote>\\n${body}</blockquote>\\n`;\n    }\n    html({ text }) {\n        return text;\n    }\n    heading({ tokens, depth }) {\n        return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>\\n`;\n    }\n    hr(token) {\n        return '<hr>\\n';\n    }\n    list(token) {\n        const ordered = token.ordered;\n        const start = token.start;\n        let body = '';\n        for (let j = 0; j < token.items.length; j++) {\n            const item = token.items[j];\n            body += this.listitem(item);\n        }\n        const type = ordered ? 'ol' : 'ul';\n        const startAttr = (ordered && start !== 1) ? (' start=\"' + start + '\"') : '';\n        return '<' + type + startAttr + '>\\n' + body + '</' + type + '>\\n';\n    }\n    listitem(item) {\n        let itemBody = '';\n        if (item.task) {\n            const checkbox = this.checkbox({ checked: !!item.checked });\n            if (item.loose) {\n                if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {\n                    item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;\n                    if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {\n                        item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;\n                    }\n                }\n                else {\n                    item.tokens.unshift({\n                        type: 'text',\n                        raw: checkbox + ' ',\n                        text: checkbox + ' ',\n                    });\n                }\n            }\n            else {\n                itemBody += checkbox + ' ';\n            }\n        }\n        itemBody += this.parser.parse(item.tokens, !!item.loose);\n        return `<li>${itemBody}</li>\\n`;\n    }\n    checkbox({ checked }) {\n        return '<input '\n            + (checked ? 'checked=\"\" ' : '')\n            + 'disabled=\"\" type=\"checkbox\">';\n    }\n    paragraph({ tokens }) {\n        return `<p>${this.parser.parseInline(tokens)}</p>\\n`;\n    }\n    table(token) {\n        let header = '';\n        // header\n        let cell = '';\n        for (let j = 0; j < token.header.length; j++) {\n            cell += this.tablecell(token.header[j]);\n        }\n        header += this.tablerow({ text: cell });\n        let body = '';\n        for (let j = 0; j < token.rows.length; j++) {\n            const row = token.rows[j];\n            cell = '';\n            for (let k = 0; k < row.length; k++) {\n                cell += this.tablecell(row[k]);\n            }\n            body += this.tablerow({ text: cell });\n        }\n        if (body)\n            body = `<tbody>${body}</tbody>`;\n        return '<table>\\n'\n            + '<thead>\\n'\n            + header\n            + '</thead>\\n'\n            + body\n            + '</table>\\n';\n    }\n    tablerow({ text }) {\n        return `<tr>\\n${text}</tr>\\n`;\n    }\n    tablecell(token) {\n        const content = this.parser.parseInline(token.tokens);\n        const type = token.header ? 'th' : 'td';\n        const tag = token.align\n            ? `<${type} align=\"${token.align}\">`\n            : `<${type}>`;\n        return tag + content + `</${type}>\\n`;\n    }\n    /**\n     * span level renderer\n     */\n    strong({ tokens }) {\n        return `<strong>${this.parser.parseInline(tokens)}</strong>`;\n    }\n    em({ tokens }) {\n        return `<em>${this.parser.parseInline(tokens)}</em>`;\n    }\n    codespan({ text }) {\n        return `<code>${text}</code>`;\n    }\n    br(token) {\n        return '<br>';\n    }\n    del({ tokens }) {\n        return `<del>${this.parser.parseInline(tokens)}</del>`;\n    }\n    link({ href, title, tokens }) {\n        const text = this.parser.parseInline(tokens);\n        const cleanHref = cleanUrl(href);\n        if (cleanHref === null) {\n            return text;\n        }\n        href = cleanHref;\n        let out = '<a href=\"' + href + '\"';\n        if (title) {\n            out += ' title=\"' + title + '\"';\n        }\n        out += '>' + text + '</a>';\n        return out;\n    }\n    image({ href, title, text }) {\n        const cleanHref = cleanUrl(href);\n        if (cleanHref === null) {\n            return text;\n        }\n        href = cleanHref;\n        let out = `<img src=\"${href}\" alt=\"${text}\"`;\n        if (title) {\n            out += ` title=\"${title}\"`;\n        }\n        out += '>';\n        return out;\n    }\n    text(token) {\n        return 'tokens' in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;\n    }\n}\n\n/**\n * TextRenderer\n * returns only the textual part of the token\n */\nclass _TextRenderer {\n    // no need for block level renderers\n    strong({ text }) {\n        return text;\n    }\n    em({ text }) {\n        return text;\n    }\n    codespan({ text }) {\n        return text;\n    }\n    del({ text }) {\n        return text;\n    }\n    html({ text }) {\n        return text;\n    }\n    text({ text }) {\n        return text;\n    }\n    link({ text }) {\n        return '' + text;\n    }\n    image({ text }) {\n        return '' + text;\n    }\n    br() {\n        return '';\n    }\n}\n\n/**\n * Parsing & Compiling\n */\nclass _Parser {\n    options;\n    renderer;\n    textRenderer;\n    constructor(options) {\n        this.options = options || _defaults;\n        this.options.renderer = this.options.renderer || new _Renderer();\n        this.renderer = this.options.renderer;\n        this.renderer.options = this.options;\n        this.renderer.parser = this;\n        this.textRenderer = new _TextRenderer();\n    }\n    /**\n     * Static Parse Method\n     */\n    static parse(tokens, options) {\n        const parser = new _Parser(options);\n        return parser.parse(tokens);\n    }\n    /**\n     * Static Parse Inline Method\n     */\n    static parseInline(tokens, options) {\n        const parser = new _Parser(options);\n        return parser.parseInline(tokens);\n    }\n    /**\n     * Parse Loop\n     */\n    parse(tokens, top = true) {\n        let out = '';\n        for (let i = 0; i < tokens.length; i++) {\n            const anyToken = tokens[i];\n            // Run any renderer extensions\n            if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {\n                const genericToken = anyToken;\n                const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);\n                if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(genericToken.type)) {\n                    out += ret || '';\n                    continue;\n                }\n            }\n            const token = anyToken;\n            switch (token.type) {\n                case 'space': {\n                    out += this.renderer.space(token);\n                    continue;\n                }\n                case 'hr': {\n                    out += this.renderer.hr(token);\n                    continue;\n                }\n                case 'heading': {\n                    out += this.renderer.heading(token);\n                    continue;\n                }\n                case 'code': {\n                    out += this.renderer.code(token);\n                    continue;\n                }\n                case 'table': {\n                    out += this.renderer.table(token);\n                    continue;\n                }\n                case 'blockquote': {\n                    out += this.renderer.blockquote(token);\n                    continue;\n                }\n                case 'list': {\n                    out += this.renderer.list(token);\n                    continue;\n                }\n                case 'html': {\n                    out += this.renderer.html(token);\n                    continue;\n                }\n                case 'paragraph': {\n                    out += this.renderer.paragraph(token);\n                    continue;\n                }\n                case 'text': {\n                    let textToken = token;\n                    let body = this.renderer.text(textToken);\n                    while (i + 1 < tokens.length && tokens[i + 1].type === 'text') {\n                        textToken = tokens[++i];\n                        body += '\\n' + this.renderer.text(textToken);\n                    }\n                    if (top) {\n                        out += this.renderer.paragraph({\n                            type: 'paragraph',\n                            raw: body,\n                            text: body,\n                            tokens: [{ type: 'text', raw: body, text: body }],\n                        });\n                    }\n                    else {\n                        out += body;\n                    }\n                    continue;\n                }\n                default: {\n                    const errMsg = 'Token with \"' + token.type + '\" type was not found.';\n                    if (this.options.silent) {\n                        console.error(errMsg);\n                        return '';\n                    }\n                    else {\n                        throw new Error(errMsg);\n                    }\n                }\n            }\n        }\n        return out;\n    }\n    /**\n     * Parse Inline Tokens\n     */\n    parseInline(tokens, renderer) {\n        renderer = renderer || this.renderer;\n        let out = '';\n        for (let i = 0; i < tokens.length; i++) {\n            const anyToken = tokens[i];\n            // Run any renderer extensions\n            if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {\n                const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);\n                if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(anyToken.type)) {\n                    out += ret || '';\n                    continue;\n                }\n            }\n            const token = anyToken;\n            switch (token.type) {\n                case 'escape': {\n                    out += renderer.text(token);\n                    break;\n                }\n                case 'html': {\n                    out += renderer.html(token);\n                    break;\n                }\n                case 'link': {\n                    out += renderer.link(token);\n                    break;\n                }\n                case 'image': {\n                    out += renderer.image(token);\n                    break;\n                }\n                case 'strong': {\n                    out += renderer.strong(token);\n                    break;\n                }\n                case 'em': {\n                    out += renderer.em(token);\n                    break;\n                }\n                case 'codespan': {\n                    out += renderer.codespan(token);\n                    break;\n                }\n                case 'br': {\n                    out += renderer.br(token);\n                    break;\n                }\n                case 'del': {\n                    out += renderer.del(token);\n                    break;\n                }\n                case 'text': {\n                    out += renderer.text(token);\n                    break;\n                }\n                default: {\n                    const errMsg = 'Token with \"' + token.type + '\" type was not found.';\n                    if (this.options.silent) {\n                        console.error(errMsg);\n                        return '';\n                    }\n                    else {\n                        throw new Error(errMsg);\n                    }\n                }\n            }\n        }\n        return out;\n    }\n}\n\nclass _Hooks {\n    options;\n    constructor(options) {\n        this.options = options || _defaults;\n    }\n    static passThroughHooks = new Set([\n        'preprocess',\n        'postprocess',\n        'processAllTokens',\n    ]);\n    /**\n     * Process markdown before marked\n     */\n    preprocess(markdown) {\n        return markdown;\n    }\n    /**\n     * Process HTML after marked is finished\n     */\n    postprocess(html) {\n        return html;\n    }\n    /**\n     * Process all tokens before walk tokens\n     */\n    processAllTokens(tokens) {\n        return tokens;\n    }\n}\n\nclass Marked {\n    defaults = _getDefaults();\n    options = this.setOptions;\n    parse = this.parseMarkdown(_Lexer.lex, _Parser.parse);\n    parseInline = this.parseMarkdown(_Lexer.lexInline, _Parser.parseInline);\n    Parser = _Parser;\n    Renderer = _Renderer;\n    TextRenderer = _TextRenderer;\n    Lexer = _Lexer;\n    Tokenizer = _Tokenizer;\n    Hooks = _Hooks;\n    constructor(...args) {\n        this.use(...args);\n    }\n    /**\n     * Run callback for every token\n     */\n    walkTokens(tokens, callback) {\n        let values = [];\n        for (const token of tokens) {\n            values = values.concat(callback.call(this, token));\n            switch (token.type) {\n                case 'table': {\n                    const tableToken = token;\n                    for (const cell of tableToken.header) {\n                        values = values.concat(this.walkTokens(cell.tokens, callback));\n                    }\n                    for (const row of tableToken.rows) {\n                        for (const cell of row) {\n                            values = values.concat(this.walkTokens(cell.tokens, callback));\n                        }\n                    }\n                    break;\n                }\n                case 'list': {\n                    const listToken = token;\n                    values = values.concat(this.walkTokens(listToken.items, callback));\n                    break;\n                }\n                default: {\n                    const genericToken = token;\n                    if (this.defaults.extensions?.childTokens?.[genericToken.type]) {\n                        this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {\n                            const tokens = genericToken[childTokens].flat(Infinity);\n                            values = values.concat(this.walkTokens(tokens, callback));\n                        });\n                    }\n                    else if (genericToken.tokens) {\n                        values = values.concat(this.walkTokens(genericToken.tokens, callback));\n                    }\n                }\n            }\n        }\n        return values;\n    }\n    use(...args) {\n        const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };\n        args.forEach((pack) => {\n            // copy options to new object\n            const opts = { ...pack };\n            // set async to true if it was set to true before\n            opts.async = this.defaults.async || opts.async || false;\n            // ==-- Parse \"addon\" extensions --== //\n            if (pack.extensions) {\n                pack.extensions.forEach((ext) => {\n                    if (!ext.name) {\n                        throw new Error('extension name required');\n                    }\n                    if ('renderer' in ext) { // Renderer extensions\n                        const prevRenderer = extensions.renderers[ext.name];\n                        if (prevRenderer) {\n                            // Replace extension with func to run new extension but fall back if false\n                            extensions.renderers[ext.name] = function (...args) {\n                                let ret = ext.renderer.apply(this, args);\n                                if (ret === false) {\n                                    ret = prevRenderer.apply(this, args);\n                                }\n                                return ret;\n                            };\n                        }\n                        else {\n                            extensions.renderers[ext.name] = ext.renderer;\n                        }\n                    }\n                    if ('tokenizer' in ext) { // Tokenizer Extensions\n                        if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) {\n                            throw new Error(\"extension level must be 'block' or 'inline'\");\n                        }\n                        const extLevel = extensions[ext.level];\n                        if (extLevel) {\n                            extLevel.unshift(ext.tokenizer);\n                        }\n                        else {\n                            extensions[ext.level] = [ext.tokenizer];\n                        }\n                        if (ext.start) { // Function to check for start of token\n                            if (ext.level === 'block') {\n                                if (extensions.startBlock) {\n                                    extensions.startBlock.push(ext.start);\n                                }\n                                else {\n                                    extensions.startBlock = [ext.start];\n                                }\n                            }\n                            else if (ext.level === 'inline') {\n                                if (extensions.startInline) {\n                                    extensions.startInline.push(ext.start);\n                                }\n                                else {\n                                    extensions.startInline = [ext.start];\n                                }\n                            }\n                        }\n                    }\n                    if ('childTokens' in ext && ext.childTokens) { // Child tokens to be visited by walkTokens\n                        extensions.childTokens[ext.name] = ext.childTokens;\n                    }\n                });\n                opts.extensions = extensions;\n            }\n            // ==-- Parse \"overwrite\" extensions --== //\n            if (pack.renderer) {\n                const renderer = this.defaults.renderer || new _Renderer(this.defaults);\n                for (const prop in pack.renderer) {\n                    if (!(prop in renderer)) {\n                        throw new Error(`renderer '${prop}' does not exist`);\n                    }\n                    if (['options', 'parser'].includes(prop)) {\n                        // ignore options property\n                        continue;\n                    }\n                    const rendererProp = prop;\n                    const rendererFunc = pack.renderer[rendererProp];\n                    const prevRenderer = renderer[rendererProp];\n                    // Replace renderer with func to run extension, but fall back if false\n                    renderer[rendererProp] = (...args) => {\n                        let ret = rendererFunc.apply(renderer, args);\n                        if (ret === false) {\n                            ret = prevRenderer.apply(renderer, args);\n                        }\n                        return ret || '';\n                    };\n                }\n                opts.renderer = renderer;\n            }\n            if (pack.tokenizer) {\n                const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);\n                for (const prop in pack.tokenizer) {\n                    if (!(prop in tokenizer)) {\n                        throw new Error(`tokenizer '${prop}' does not exist`);\n                    }\n                    if (['options', 'rules', 'lexer'].includes(prop)) {\n                        // ignore options, rules, and lexer properties\n                        continue;\n                    }\n                    const tokenizerProp = prop;\n                    const tokenizerFunc = pack.tokenizer[tokenizerProp];\n                    const prevTokenizer = tokenizer[tokenizerProp];\n                    // Replace tokenizer with func to run extension, but fall back if false\n                    // @ts-expect-error cannot type tokenizer function dynamically\n                    tokenizer[tokenizerProp] = (...args) => {\n                        let ret = tokenizerFunc.apply(tokenizer, args);\n                        if (ret === false) {\n                            ret = prevTokenizer.apply(tokenizer, args);\n                        }\n                        return ret;\n                    };\n                }\n                opts.tokenizer = tokenizer;\n            }\n            // ==-- Parse Hooks extensions --== //\n            if (pack.hooks) {\n                const hooks = this.defaults.hooks || new _Hooks();\n                for (const prop in pack.hooks) {\n                    if (!(prop in hooks)) {\n                        throw new Error(`hook '${prop}' does not exist`);\n                    }\n                    if (prop === 'options') {\n                        // ignore options property\n                        continue;\n                    }\n                    const hooksProp = prop;\n                    const hooksFunc = pack.hooks[hooksProp];\n                    const prevHook = hooks[hooksProp];\n                    if (_Hooks.passThroughHooks.has(prop)) {\n                        // @ts-expect-error cannot type hook function dynamically\n                        hooks[hooksProp] = (arg) => {\n                            if (this.defaults.async) {\n                                return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => {\n                                    return prevHook.call(hooks, ret);\n                                });\n                            }\n                            const ret = hooksFunc.call(hooks, arg);\n                            return prevHook.call(hooks, ret);\n                        };\n                    }\n                    else {\n                        // @ts-expect-error cannot type hook function dynamically\n                        hooks[hooksProp] = (...args) => {\n                            let ret = hooksFunc.apply(hooks, args);\n                            if (ret === false) {\n                                ret = prevHook.apply(hooks, args);\n                            }\n                            return ret;\n                        };\n                    }\n                }\n                opts.hooks = hooks;\n            }\n            // ==-- Parse WalkTokens extensions --== //\n            if (pack.walkTokens) {\n                const walkTokens = this.defaults.walkTokens;\n                const packWalktokens = pack.walkTokens;\n                opts.walkTokens = function (token) {\n                    let values = [];\n                    values.push(packWalktokens.call(this, token));\n                    if (walkTokens) {\n                        values = values.concat(walkTokens.call(this, token));\n                    }\n                    return values;\n                };\n            }\n            this.defaults = { ...this.defaults, ...opts };\n        });\n        return this;\n    }\n    setOptions(opt) {\n        this.defaults = { ...this.defaults, ...opt };\n        return this;\n    }\n    lexer(src, options) {\n        return _Lexer.lex(src, options ?? this.defaults);\n    }\n    parser(tokens, options) {\n        return _Parser.parse(tokens, options ?? this.defaults);\n    }\n    parseMarkdown(lexer, parser) {\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any\n        const parse = (src, options) => {\n            const origOpt = { ...options };\n            const opt = { ...this.defaults, ...origOpt };\n            const throwError = this.onError(!!opt.silent, !!opt.async);\n            // throw error if an extension set async to true but parse was called with async: false\n            if (this.defaults.async === true && origOpt.async === false) {\n                return throwError(new Error('marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.'));\n            }\n            // throw error in case of non string input\n            if (typeof src === 'undefined' || src === null) {\n                return throwError(new Error('marked(): input parameter is undefined or null'));\n            }\n            if (typeof src !== 'string') {\n                return throwError(new Error('marked(): input parameter is of type '\n                    + Object.prototype.toString.call(src) + ', string expected'));\n            }\n            if (opt.hooks) {\n                opt.hooks.options = opt;\n            }\n            if (opt.async) {\n                return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src)\n                    .then(src => lexer(src, opt))\n                    .then(tokens => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens)\n                    .then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens)\n                    .then(tokens => parser(tokens, opt))\n                    .then(html => opt.hooks ? opt.hooks.postprocess(html) : html)\n                    .catch(throwError);\n            }\n            try {\n                if (opt.hooks) {\n                    src = opt.hooks.preprocess(src);\n                }\n                let tokens = lexer(src, opt);\n                if (opt.hooks) {\n                    tokens = opt.hooks.processAllTokens(tokens);\n                }\n                if (opt.walkTokens) {\n                    this.walkTokens(tokens, opt.walkTokens);\n                }\n                let html = parser(tokens, opt);\n                if (opt.hooks) {\n                    html = opt.hooks.postprocess(html);\n                }\n                return html;\n            }\n            catch (e) {\n                return throwError(e);\n            }\n        };\n        return parse;\n    }\n    onError(silent, async) {\n        return (e) => {\n            e.message += '\\nPlease report this to https://github.com/markedjs/marked.';\n            if (silent) {\n                const msg = '<p>An error occurred:</p><pre>'\n                    + escape$1(e.message + '', true)\n                    + '</pre>';\n                if (async) {\n                    return Promise.resolve(msg);\n                }\n                return msg;\n            }\n            if (async) {\n                return Promise.reject(e);\n            }\n            throw e;\n        };\n    }\n}\n\nconst markedInstance = new Marked();\nfunction marked(src, opt) {\n    return markedInstance.parse(src, opt);\n}\n/**\n * Sets the default options.\n *\n * @param options Hash of options\n */\nmarked.options =\n    marked.setOptions = function (options) {\n        markedInstance.setOptions(options);\n        marked.defaults = markedInstance.defaults;\n        changeDefaults(marked.defaults);\n        return marked;\n    };\n/**\n * Gets the original marked default options.\n */\nmarked.getDefaults = _getDefaults;\nmarked.defaults = _defaults;\n/**\n * Use Extension\n */\nmarked.use = function (...args) {\n    markedInstance.use(...args);\n    marked.defaults = markedInstance.defaults;\n    changeDefaults(marked.defaults);\n    return marked;\n};\n/**\n * Run callback for every token\n */\nmarked.walkTokens = function (tokens, callback) {\n    return markedInstance.walkTokens(tokens, callback);\n};\n/**\n * Compiles markdown to HTML without enclosing `p` tag.\n *\n * @param src String of markdown source to be compiled\n * @param options Hash of options\n * @return String of compiled HTML\n */\nmarked.parseInline = markedInstance.parseInline;\n/**\n * Expose\n */\nmarked.Parser = _Parser;\nmarked.parser = _Parser.parse;\nmarked.Renderer = _Renderer;\nmarked.TextRenderer = _TextRenderer;\nmarked.Lexer = _Lexer;\nmarked.lexer = _Lexer.lex;\nmarked.Tokenizer = _Tokenizer;\nmarked.Hooks = _Hooks;\nmarked.parse = marked;\nconst options = marked.options;\nconst setOptions = marked.setOptions;\nconst use = marked.use;\nconst walkTokens = marked.walkTokens;\nconst parseInline = marked.parseInline;\nconst parse = marked;\nconst parser = _Parser.parse;\nconst lexer = _Lexer.lex;\n\nexport { _Hooks as Hooks, _Lexer as Lexer, Marked, _Parser as Parser, _Renderer as Renderer, _TextRenderer as TextRenderer, _Tokenizer as Tokenizer, _defaults as defaults, _getDefaults as getDefaults, lexer, marked, options, parse, parseInline, parser, setOptions, use, walkTokens };\n//# sourceMappingURL=marked.esm.js.map\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Iterable } from './iterator.js';\n\nconst unset = Symbol('unset');\n\nexport interface IPrefixTreeNode<T> {\n\t/** Possible children of the node. */\n\tchildren?: ReadonlyMap<string, Node<T>>;\n\n\t/** The value if data exists for this node in the tree. Mutable. */\n\tvalue: T | undefined;\n}\n\n/**\n * A simple prefix tree implementation where a value is stored based on\n * well-defined prefix segments.\n */\nexport class WellDefinedPrefixTree<V> {\n\tpublic readonly root = new Node<V>();\n\tprivate _size = 0;\n\n\t/** Tree size, not including the root. */\n\tpublic get size() {\n\t\treturn this._size;\n\t}\n\n\t/** Gets the top-level nodes of the tree */\n\tpublic get nodes(): Iterable<IPrefixTreeNode<V>> {\n\t\treturn this.root.children?.values() || Iterable.empty();\n\t}\n\n\t/** Gets the top-level nodes of the tree */\n\tpublic get entries(): Iterable<[string, IPrefixTreeNode<V>]> {\n\t\treturn this.root.children?.entries() || Iterable.empty();\n\t}\n\n\t/**\n\t * Inserts a new value in the prefix tree.\n\t * @param onNode - called for each node as we descend to the insertion point,\n\t * including the insertion point itself.\n\t */\n\tinsert(key: Iterable<string>, value: V, onNode?: (n: IPrefixTreeNode<V>) => void): void {\n\t\tthis.opNode(key, n => n._value = value, onNode);\n\t}\n\n\t/** Mutates a value in the prefix tree. */\n\tmutate(key: Iterable<string>, mutate: (value?: V) => V): void {\n\t\tthis.opNode(key, n => n._value = mutate(n._value === unset ? undefined : n._value));\n\t}\n\n\t/** Mutates nodes along the path in the prefix tree. */\n\tmutatePath(key: Iterable<string>, mutate: (node: IPrefixTreeNode<V>) => void): void {\n\t\tthis.opNode(key, () => { }, n => mutate(n));\n\t}\n\n\t/** Deletes a node from the prefix tree, returning the value it contained. */\n\tdelete(key: Iterable<string>): V | undefined {\n\t\tconst path = this.getPathToKey(key);\n\t\tif (!path) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = path.length - 1;\n\t\tconst value = path[i].node._value;\n\t\tif (value === unset) {\n\t\t\treturn; // not actually a real node\n\t\t}\n\n\t\tthis._size--;\n\t\tpath[i].node._value = unset;\n\n\t\tfor (; i > 0; i--) {\n\t\t\tconst { node, part } = path[i];\n\t\t\tif (node.children?.size || node._value !== unset) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tpath[i - 1].node.children!.delete(part);\n\t\t}\n\n\t\treturn value;\n\t}\n\n\t/** Deletes a subtree from the prefix tree, returning the values they contained. */\n\t*deleteRecursive(key: Iterable<string>): Iterable<V> {\n\t\tconst path = this.getPathToKey(key);\n\t\tif (!path) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst subtree = path[path.length - 1].node;\n\n\t\t// important: run the deletion before we start to yield results, so that\n\t\t// it still runs even if the caller doesn't consumer the iterator\n\t\tfor (let i = path.length - 1; i > 0; i--) {\n\t\t\tconst parent = path[i - 1];\n\t\t\tparent.node.children!.delete(path[i].part);\n\t\t\tif (parent.node.children!.size > 0 || parent.node._value !== unset) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfor (const node of bfsIterate(subtree)) {\n\t\t\tif (node._value !== unset) {\n\t\t\t\tthis._size--;\n\t\t\t\tyield node._value;\n\t\t\t}\n\t\t}\n\n\t\t// special case for the root note\n\t\tif (subtree === this.root) {\n\t\t\tthis.root._value = unset;\n\t\t\tthis.root.children = undefined;\n\t\t}\n\t}\n\n\t/** Gets a value from the tree. */\n\tfind(key: Iterable<string>): V | undefined {\n\t\tlet node = this.root;\n\t\tfor (const segment of key) {\n\t\t\tconst next = node.children?.get(segment);\n\t\t\tif (!next) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tnode = next;\n\t\t}\n\n\t\treturn node._value === unset ? undefined : node._value;\n\t}\n\n\t/** Gets whether the tree has the key, or a parent of the key, already inserted. */\n\thasKeyOrParent(key: Iterable<string>): boolean {\n\t\tlet node = this.root;\n\t\tfor (const segment of key) {\n\t\t\tconst next = node.children?.get(segment);\n\t\t\tif (!next) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (next._value !== unset) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tnode = next;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/** Gets whether the tree has the given key or any children. */\n\thasKeyOrChildren(key: Iterable<string>): boolean {\n\t\tlet node = this.root;\n\t\tfor (const segment of key) {\n\t\t\tconst next = node.children?.get(segment);\n\t\t\tif (!next) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tnode = next;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/** Gets whether the tree has the given key. */\n\thasKey(key: Iterable<string>): boolean {\n\t\tlet node = this.root;\n\t\tfor (const segment of key) {\n\t\t\tconst next = node.children?.get(segment);\n\t\t\tif (!next) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tnode = next;\n\t\t}\n\n\t\treturn node._value !== unset;\n\t}\n\n\tprivate getPathToKey(key: Iterable<string>) {\n\t\tconst path = [{ part: '', node: this.root }];\n\t\tlet i = 0;\n\t\tfor (const part of key) {\n\t\t\tconst node = path[i].node.children?.get(part);\n\t\t\tif (!node) {\n\t\t\t\treturn; // node not in tree\n\t\t\t}\n\n\t\t\tpath.push({ part, node });\n\t\t\ti++;\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tprivate opNode(key: Iterable<string>, fn: (node: Node<V>) => void, onDescend?: (node: Node<V>) => void): void {\n\t\tlet node = this.root;\n\t\tfor (const part of key) {\n\t\t\tif (!node.children) {\n\t\t\t\tconst next = new Node<V>();\n\t\t\t\tnode.children = new Map([[part, next]]);\n\t\t\t\tnode = next;\n\t\t\t} else if (!node.children.has(part)) {\n\t\t\t\tconst next = new Node<V>();\n\t\t\t\tnode.children.set(part, next);\n\t\t\t\tnode = next;\n\t\t\t} else {\n\t\t\t\tnode = node.children.get(part)!;\n\t\t\t}\n\t\t\tonDescend?.(node);\n\t\t}\n\n\t\tconst sizeBefore = node._value === unset ? 0 : 1;\n\t\tfn(node);\n\t\tconst sizeAfter = node._value === unset ? 0 : 1;\n\t\tthis._size += sizeAfter - sizeBefore;\n\t}\n\n\t/** Returns an iterable of the tree values in no defined order. */\n\t*values() {\n\t\tfor (const { _value } of bfsIterate(this.root)) {\n\t\t\tif (_value !== unset) {\n\t\t\t\tyield _value;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction* bfsIterate<T>(root: Node<T>): Iterable<Node<T>> {\n\tconst stack = [root];\n\twhile (stack.length > 0) {\n\t\tconst node = stack.pop()!;\n\t\tyield node;\n\n\t\tif (node.children) {\n\t\t\tfor (const child of node.children.values()) {\n\t\t\t\tstack.push(child);\n\t\t\t}\n\t\t}\n\t}\n}\n\nclass Node<T> implements IPrefixTreeNode<T> {\n\tpublic children?: Map<string, Node<T>>;\n\n\tpublic get value() {\n\t\treturn this._value === unset ? undefined : this._value;\n\t}\n\n\tpublic set value(value: T | undefined) {\n\t\tthis._value = value === undefined ? unset : value;\n\t}\n\n\tpublic _value: T | typeof unset = unset;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * A position in the editor. This interface is suitable for serialization.\n */\nexport interface IPosition {\n\t/**\n\t * line number (starts at 1)\n\t */\n\treadonly lineNumber: number;\n\t/**\n\t * column (the first character in a line is between column 1 and column 2)\n\t */\n\treadonly column: number;\n}\n\n/**\n * A position in the editor.\n */\nexport class Position {\n\t/**\n\t * line number (starts at 1)\n\t */\n\tpublic readonly lineNumber: number;\n\t/**\n\t * column (the first character in a line is between column 1 and column 2)\n\t */\n\tpublic readonly column: number;\n\n\tconstructor(lineNumber: number, column: number) {\n\t\tthis.lineNumber = lineNumber;\n\t\tthis.column = column;\n\t}\n\n\t/**\n\t * Create a new position from this position.\n\t *\n\t * @param newLineNumber new line number\n\t * @param newColumn new column\n\t */\n\twith(newLineNumber: number = this.lineNumber, newColumn: number = this.column): Position {\n\t\tif (newLineNumber === this.lineNumber && newColumn === this.column) {\n\t\t\treturn this;\n\t\t} else {\n\t\t\treturn new Position(newLineNumber, newColumn);\n\t\t}\n\t}\n\n\t/**\n\t * Derive a new position from this position.\n\t *\n\t * @param deltaLineNumber line number delta\n\t * @param deltaColumn column delta\n\t */\n\tdelta(deltaLineNumber: number = 0, deltaColumn: number = 0): Position {\n\t\treturn this.with(Math.max(1, this.lineNumber + deltaLineNumber), Math.max(1, this.column + deltaColumn));\n\t}\n\n\t/**\n\t * Test if this position equals other position\n\t */\n\tpublic equals(other: IPosition): boolean {\n\t\treturn Position.equals(this, other);\n\t}\n\n\t/**\n\t * Test if position `a` equals position `b`\n\t */\n\tpublic static equals(a: IPosition | null, b: IPosition | null): boolean {\n\t\tif (!a && !b) {\n\t\t\treturn true;\n\t\t}\n\t\treturn (\n\t\t\t!!a &&\n\t\t\t!!b &&\n\t\t\ta.lineNumber === b.lineNumber &&\n\t\t\ta.column === b.column\n\t\t);\n\t}\n\n\t/**\n\t * Test if this position is before other position.\n\t * If the two positions are equal, the result will be false.\n\t */\n\tpublic isBefore(other: IPosition): boolean {\n\t\treturn Position.isBefore(this, other);\n\t}\n\n\t/**\n\t * Test if position `a` is before position `b`.\n\t * If the two positions are equal, the result will be false.\n\t */\n\tpublic static isBefore(a: IPosition, b: IPosition): boolean {\n\t\tif (a.lineNumber < b.lineNumber) {\n\t\t\treturn true;\n\t\t}\n\t\tif (b.lineNumber < a.lineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.column < b.column;\n\t}\n\n\t/**\n\t * Test if this position is before other position.\n\t * If the two positions are equal, the result will be true.\n\t */\n\tpublic isBeforeOrEqual(other: IPosition): boolean {\n\t\treturn Position.isBeforeOrEqual(this, other);\n\t}\n\n\t/**\n\t * Test if position `a` is before position `b`.\n\t * If the two positions are equal, the result will be true.\n\t */\n\tpublic static isBeforeOrEqual(a: IPosition, b: IPosition): boolean {\n\t\tif (a.lineNumber < b.lineNumber) {\n\t\t\treturn true;\n\t\t}\n\t\tif (b.lineNumber < a.lineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.column <= b.column;\n\t}\n\n\t/**\n\t * A function that compares positions, useful for sorting\n\t */\n\tpublic static compare(a: IPosition, b: IPosition): number {\n\t\tconst aLineNumber = a.lineNumber | 0;\n\t\tconst bLineNumber = b.lineNumber | 0;\n\n\t\tif (aLineNumber === bLineNumber) {\n\t\t\tconst aColumn = a.column | 0;\n\t\t\tconst bColumn = b.column | 0;\n\t\t\treturn aColumn - bColumn;\n\t\t}\n\n\t\treturn aLineNumber - bLineNumber;\n\t}\n\n\t/**\n\t * Clone this position.\n\t */\n\tpublic clone(): Position {\n\t\treturn new Position(this.lineNumber, this.column);\n\t}\n\n\t/**\n\t * Convert to a human-readable representation.\n\t */\n\tpublic toString(): string {\n\t\treturn '(' + this.lineNumber + ',' + this.column + ')';\n\t}\n\n\t// ---\n\n\t/**\n\t * Create a `Position` from an `IPosition`.\n\t */\n\tpublic static lift(pos: IPosition): Position {\n\t\treturn new Position(pos.lineNumber, pos.column);\n\t}\n\n\t/**\n\t * Test if `obj` is an `IPosition`.\n\t */\n\tpublic static isIPosition(obj: any): obj is IPosition {\n\t\treturn (\n\t\t\tobj\n\t\t\t&& (typeof obj.lineNumber === 'number')\n\t\t\t&& (typeof obj.column === 'number')\n\t\t);\n\t}\n\n\tpublic toJSON(): IPosition {\n\t\treturn {\n\t\t\tlineNumber: this.lineNumber,\n\t\t\tcolumn: this.column\n\t\t};\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IPosition, Position } from './position.js';\n\n/**\n * A range in the editor. This interface is suitable for serialization.\n */\nexport interface IRange {\n\t/**\n\t * Line number on which the range starts (starts at 1).\n\t */\n\treadonly startLineNumber: number;\n\t/**\n\t * Column on which the range starts in line `startLineNumber` (starts at 1).\n\t */\n\treadonly startColumn: number;\n\t/**\n\t * Line number on which the range ends.\n\t */\n\treadonly endLineNumber: number;\n\t/**\n\t * Column on which the range ends in line `endLineNumber`.\n\t */\n\treadonly endColumn: number;\n}\n\n/**\n * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)\n */\nexport class Range {\n\n\t/**\n\t * Line number on which the range starts (starts at 1).\n\t */\n\tpublic readonly startLineNumber: number;\n\t/**\n\t * Column on which the range starts in line `startLineNumber` (starts at 1).\n\t */\n\tpublic readonly startColumn: number;\n\t/**\n\t * Line number on which the range ends.\n\t */\n\tpublic readonly endLineNumber: number;\n\t/**\n\t * Column on which the range ends in line `endLineNumber`.\n\t */\n\tpublic readonly endColumn: number;\n\n\tconstructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number) {\n\t\tif ((startLineNumber > endLineNumber) || (startLineNumber === endLineNumber && startColumn > endColumn)) {\n\t\t\tthis.startLineNumber = endLineNumber;\n\t\t\tthis.startColumn = endColumn;\n\t\t\tthis.endLineNumber = startLineNumber;\n\t\t\tthis.endColumn = startColumn;\n\t\t} else {\n\t\t\tthis.startLineNumber = startLineNumber;\n\t\t\tthis.startColumn = startColumn;\n\t\t\tthis.endLineNumber = endLineNumber;\n\t\t\tthis.endColumn = endColumn;\n\t\t}\n\t}\n\n\t/**\n\t * Test if this range is empty.\n\t */\n\tpublic isEmpty(): boolean {\n\t\treturn Range.isEmpty(this);\n\t}\n\n\t/**\n\t * Test if `range` is empty.\n\t */\n\tpublic static isEmpty(range: IRange): boolean {\n\t\treturn (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn);\n\t}\n\n\t/**\n\t * Test if position is in this range. If the position is at the edges, will return true.\n\t */\n\tpublic containsPosition(position: IPosition): boolean {\n\t\treturn Range.containsPosition(this, position);\n\t}\n\n\t/**\n\t * Test if `position` is in `range`. If the position is at the edges, will return true.\n\t */\n\tpublic static containsPosition(range: IRange, position: IPosition): boolean {\n\t\tif (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {\n\t\t\treturn false;\n\t\t}\n\t\tif (position.lineNumber === range.endLineNumber && position.column > range.endColumn) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Test if `position` is in `range`. If the position is at the edges, will return false.\n\t * @internal\n\t */\n\tpublic static strictContainsPosition(range: IRange, position: IPosition): boolean {\n\t\tif (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (position.lineNumber === range.startLineNumber && position.column <= range.startColumn) {\n\t\t\treturn false;\n\t\t}\n\t\tif (position.lineNumber === range.endLineNumber && position.column >= range.endColumn) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Test if range is in this range. If the range is equal to this range, will return true.\n\t */\n\tpublic containsRange(range: IRange): boolean {\n\t\treturn Range.containsRange(this, range);\n\t}\n\n\t/**\n\t * Test if `otherRange` is in `range`. If the ranges are equal, will return true.\n\t */\n\tpublic static containsRange(range: IRange, otherRange: IRange): boolean {\n\t\tif (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) {\n\t\t\treturn false;\n\t\t}\n\t\tif (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.endColumn) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.\n\t */\n\tpublic strictContainsRange(range: IRange): boolean {\n\t\treturn Range.strictContainsRange(this, range);\n\t}\n\n\t/**\n\t * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.\n\t */\n\tpublic static strictContainsRange(range: IRange, otherRange: IRange): boolean {\n\t\tif (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) {\n\t\t\treturn false;\n\t\t}\n\t\tif (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.endColumn) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * A reunion of the two ranges.\n\t * The smallest position will be used as the start point, and the largest one as the end point.\n\t */\n\tpublic plusRange(range: IRange): Range {\n\t\treturn Range.plusRange(this, range);\n\t}\n\n\t/**\n\t * A reunion of the two ranges.\n\t * The smallest position will be used as the start point, and the largest one as the end point.\n\t */\n\tpublic static plusRange(a: IRange, b: IRange): Range {\n\t\tlet startLineNumber: number;\n\t\tlet startColumn: number;\n\t\tlet endLineNumber: number;\n\t\tlet endColumn: number;\n\n\t\tif (b.startLineNumber < a.startLineNumber) {\n\t\t\tstartLineNumber = b.startLineNumber;\n\t\t\tstartColumn = b.startColumn;\n\t\t} else if (b.startLineNumber === a.startLineNumber) {\n\t\t\tstartLineNumber = b.startLineNumber;\n\t\t\tstartColumn = Math.min(b.startColumn, a.startColumn);\n\t\t} else {\n\t\t\tstartLineNumber = a.startLineNumber;\n\t\t\tstartColumn = a.startColumn;\n\t\t}\n\n\t\tif (b.endLineNumber > a.endLineNumber) {\n\t\t\tendLineNumber = b.endLineNumber;\n\t\t\tendColumn = b.endColumn;\n\t\t} else if (b.endLineNumber === a.endLineNumber) {\n\t\t\tendLineNumber = b.endLineNumber;\n\t\t\tendColumn = Math.max(b.endColumn, a.endColumn);\n\t\t} else {\n\t\t\tendLineNumber = a.endLineNumber;\n\t\t\tendColumn = a.endColumn;\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\t/**\n\t * A intersection of the two ranges.\n\t */\n\tpublic intersectRanges(range: IRange): Range | null {\n\t\treturn Range.intersectRanges(this, range);\n\t}\n\n\t/**\n\t * A intersection of the two ranges.\n\t */\n\tpublic static intersectRanges(a: IRange, b: IRange): Range | null {\n\t\tlet resultStartLineNumber = a.startLineNumber;\n\t\tlet resultStartColumn = a.startColumn;\n\t\tlet resultEndLineNumber = a.endLineNumber;\n\t\tlet resultEndColumn = a.endColumn;\n\t\tconst otherStartLineNumber = b.startLineNumber;\n\t\tconst otherStartColumn = b.startColumn;\n\t\tconst otherEndLineNumber = b.endLineNumber;\n\t\tconst otherEndColumn = b.endColumn;\n\n\t\tif (resultStartLineNumber < otherStartLineNumber) {\n\t\t\tresultStartLineNumber = otherStartLineNumber;\n\t\t\tresultStartColumn = otherStartColumn;\n\t\t} else if (resultStartLineNumber === otherStartLineNumber) {\n\t\t\tresultStartColumn = Math.max(resultStartColumn, otherStartColumn);\n\t\t}\n\n\t\tif (resultEndLineNumber > otherEndLineNumber) {\n\t\t\tresultEndLineNumber = otherEndLineNumber;\n\t\t\tresultEndColumn = otherEndColumn;\n\t\t} else if (resultEndLineNumber === otherEndLineNumber) {\n\t\t\tresultEndColumn = Math.min(resultEndColumn, otherEndColumn);\n\t\t}\n\n\t\t// Check if selection is now empty\n\t\tif (resultStartLineNumber > resultEndLineNumber) {\n\t\t\treturn null;\n\t\t}\n\t\tif (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new Range(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn);\n\t}\n\n\t/**\n\t * Test if this range equals other.\n\t */\n\tpublic equalsRange(other: IRange | null | undefined): boolean {\n\t\treturn Range.equalsRange(this, other);\n\t}\n\n\t/**\n\t * Test if range `a` equals `b`.\n\t */\n\tpublic static equalsRange(a: IRange | null | undefined, b: IRange | null | undefined): boolean {\n\t\tif (!a && !b) {\n\t\t\treturn true;\n\t\t}\n\t\treturn (\n\t\t\t!!a &&\n\t\t\t!!b &&\n\t\t\ta.startLineNumber === b.startLineNumber &&\n\t\t\ta.startColumn === b.startColumn &&\n\t\t\ta.endLineNumber === b.endLineNumber &&\n\t\t\ta.endColumn === b.endColumn\n\t\t);\n\t}\n\n\t/**\n\t * Return the end position (which will be after or equal to the start position)\n\t */\n\tpublic getEndPosition(): Position {\n\t\treturn Range.getEndPosition(this);\n\t}\n\n\t/**\n\t * Return the end position (which will be after or equal to the start position)\n\t */\n\tpublic static getEndPosition(range: IRange): Position {\n\t\treturn new Position(range.endLineNumber, range.endColumn);\n\t}\n\n\t/**\n\t * Return the start position (which will be before or equal to the end position)\n\t */\n\tpublic getStartPosition(): Position {\n\t\treturn Range.getStartPosition(this);\n\t}\n\n\t/**\n\t * Return the start position (which will be before or equal to the end position)\n\t */\n\tpublic static getStartPosition(range: IRange): Position {\n\t\treturn new Position(range.startLineNumber, range.startColumn);\n\t}\n\n\t/**\n\t * Transform to a user presentable string representation.\n\t */\n\tpublic toString(): string {\n\t\treturn '[' + this.startLineNumber + ',' + this.startColumn + ' -> ' + this.endLineNumber + ',' + this.endColumn + ']';\n\t}\n\n\t/**\n\t * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.\n\t */\n\tpublic setEndPosition(endLineNumber: number, endColumn: number): Range {\n\t\treturn new Range(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\n\t}\n\n\t/**\n\t * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.\n\t */\n\tpublic setStartPosition(startLineNumber: number, startColumn: number): Range {\n\t\treturn new Range(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\n\t}\n\n\t/**\n\t * Create a new empty range using this range's start position.\n\t */\n\tpublic collapseToStart(): Range {\n\t\treturn Range.collapseToStart(this);\n\t}\n\n\t/**\n\t * Create a new empty range using this range's start position.\n\t */\n\tpublic static collapseToStart(range: IRange): Range {\n\t\treturn new Range(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn);\n\t}\n\n\t/**\n\t * Create a new empty range using this range's end position.\n\t */\n\tpublic collapseToEnd(): Range {\n\t\treturn Range.collapseToEnd(this);\n\t}\n\n\t/**\n\t * Create a new empty range using this range's end position.\n\t */\n\tpublic static collapseToEnd(range: IRange): Range {\n\t\treturn new Range(range.endLineNumber, range.endColumn, range.endLineNumber, range.endColumn);\n\t}\n\n\t/**\n\t * Moves the range by the given amount of lines.\n\t */\n\tpublic delta(lineCount: number): Range {\n\t\treturn new Range(this.startLineNumber + lineCount, this.startColumn, this.endLineNumber + lineCount, this.endColumn);\n\t}\n\n\tpublic isSingleLine(): boolean {\n\t\treturn this.startLineNumber === this.endLineNumber;\n\t}\n\n\t// ---\n\n\tpublic static fromPositions(start: IPosition, end: IPosition = start): Range {\n\t\treturn new Range(start.lineNumber, start.column, end.lineNumber, end.column);\n\t}\n\n\t/**\n\t * Create a `Range` from an `IRange`.\n\t */\n\tpublic static lift(range: undefined | null): null;\n\tpublic static lift(range: IRange): Range;\n\tpublic static lift(range: IRange | undefined | null): Range | null;\n\tpublic static lift(range: IRange | undefined | null): Range | null {\n\t\tif (!range) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t}\n\n\t/**\n\t * Test if `obj` is an `IRange`.\n\t */\n\tpublic static isIRange(obj: any): obj is IRange {\n\t\treturn (\n\t\t\tobj\n\t\t\t&& (typeof obj.startLineNumber === 'number')\n\t\t\t&& (typeof obj.startColumn === 'number')\n\t\t\t&& (typeof obj.endLineNumber === 'number')\n\t\t\t&& (typeof obj.endColumn === 'number')\n\t\t);\n\t}\n\n\t/**\n\t * Test if the two ranges are touching in any way.\n\t */\n\tpublic static areIntersectingOrTouching(a: IRange, b: IRange): boolean {\n\t\t// Check if `a` is before `b`\n\t\tif (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn < b.startColumn)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check if `b` is before `a`\n\t\tif (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn < a.startColumn)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// These ranges must intersect\n\t\treturn true;\n\t}\n\n\t/**\n\t * Test if the two ranges are intersecting. If the ranges are touching it returns true.\n\t */\n\tpublic static areIntersecting(a: IRange, b: IRange): boolean {\n\t\t// Check if `a` is before `b`\n\t\tif (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn <= b.startColumn)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check if `b` is before `a`\n\t\tif (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn <= a.startColumn)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// These ranges must intersect\n\t\treturn true;\n\t}\n\n\t/**\n\t * Test if the two ranges are intersecting, but not touching at all.\n\t */\n\tpublic static areOnlyIntersecting(a: IRange, b: IRange): boolean {\n\t\t// Check if `a` is before `b`\n\t\tif (a.endLineNumber < (b.startLineNumber - 1) || (a.endLineNumber === b.startLineNumber && a.endColumn < (b.startColumn - 1))) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check if `b` is before `a`\n\t\tif (b.endLineNumber < (a.startLineNumber - 1) || (b.endLineNumber === a.startLineNumber && b.endColumn < (a.startColumn - 1))) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// These ranges must intersect\n\t\treturn true;\n\t}\n\n\t/**\n\t * A function that compares ranges, useful for sorting ranges\n\t * It will first compare ranges on the startPosition and then on the endPosition\n\t */\n\tpublic static compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number {\n\t\tif (a && b) {\n\t\t\tconst aStartLineNumber = a.startLineNumber | 0;\n\t\t\tconst bStartLineNumber = b.startLineNumber | 0;\n\n\t\t\tif (aStartLineNumber === bStartLineNumber) {\n\t\t\t\tconst aStartColumn = a.startColumn | 0;\n\t\t\t\tconst bStartColumn = b.startColumn | 0;\n\n\t\t\t\tif (aStartColumn === bStartColumn) {\n\t\t\t\t\tconst aEndLineNumber = a.endLineNumber | 0;\n\t\t\t\t\tconst bEndLineNumber = b.endLineNumber | 0;\n\n\t\t\t\t\tif (aEndLineNumber === bEndLineNumber) {\n\t\t\t\t\t\tconst aEndColumn = a.endColumn | 0;\n\t\t\t\t\t\tconst bEndColumn = b.endColumn | 0;\n\t\t\t\t\t\treturn aEndColumn - bEndColumn;\n\t\t\t\t\t}\n\t\t\t\t\treturn aEndLineNumber - bEndLineNumber;\n\t\t\t\t}\n\t\t\t\treturn aStartColumn - bStartColumn;\n\t\t\t}\n\t\t\treturn aStartLineNumber - bStartLineNumber;\n\t\t}\n\t\tconst aExists = (a ? 1 : 0);\n\t\tconst bExists = (b ? 1 : 0);\n\t\treturn aExists - bExists;\n\t}\n\n\t/**\n\t * A function that compares ranges, useful for sorting ranges\n\t * It will first compare ranges on the endPosition and then on the startPosition\n\t */\n\tpublic static compareRangesUsingEnds(a: IRange, b: IRange): number {\n\t\tif (a.endLineNumber === b.endLineNumber) {\n\t\t\tif (a.endColumn === b.endColumn) {\n\t\t\t\tif (a.startLineNumber === b.startLineNumber) {\n\t\t\t\t\treturn a.startColumn - b.startColumn;\n\t\t\t\t}\n\t\t\t\treturn a.startLineNumber - b.startLineNumber;\n\t\t\t}\n\t\t\treturn a.endColumn - b.endColumn;\n\t\t}\n\t\treturn a.endLineNumber - b.endLineNumber;\n\t}\n\n\t/**\n\t * Test if the range spans multiple lines.\n\t */\n\tpublic static spansMultipleLines(range: IRange): boolean {\n\t\treturn range.endLineNumber > range.startLineNumber;\n\t}\n\n\tpublic toJSON(): IRange {\n\t\treturn this;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Position } from './position.js';\nimport { IRange, Range } from './range.js';\n\n/**\n * A single edit operation, that acts as a simple replace.\n * i.e. Replace text at `range` with `text` in model.\n */\nexport interface ISingleEditOperation {\n\t/**\n\t * The range to replace. This can be empty to emulate a simple insert.\n\t */\n\trange: IRange;\n\t/**\n\t * The text to replace with. This can be null to emulate a simple delete.\n\t */\n\ttext: string | null;\n\t/**\n\t * This indicates that this operation has \"insert\" semantics.\n\t * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved.\n\t */\n\tforceMoveMarkers?: boolean;\n}\n\nexport class EditOperation {\n\n\tpublic static insert(position: Position, text: string): ISingleEditOperation {\n\t\treturn {\n\t\t\trange: new Range(position.lineNumber, position.column, position.lineNumber, position.column),\n\t\t\ttext: text,\n\t\t\tforceMoveMarkers: true\n\t\t};\n\t}\n\n\tpublic static delete(range: Range): ISingleEditOperation {\n\t\treturn {\n\t\t\trange: range,\n\t\t\ttext: null\n\t\t};\n\t}\n\n\tpublic static replace(range: Range, text: string | null): ISingleEditOperation {\n\t\treturn {\n\t\t\trange: range,\n\t\t\ttext: text\n\t\t};\n\t}\n\n\tpublic static replaceMove(range: Range, text: string | null): ISingleEditOperation {\n\t\treturn {\n\t\t\trange: range,\n\t\t\ttext: text,\n\t\t\tforceMoveMarkers: true\n\t\t};\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Color } from '../../base/common/color.js';\nimport { Emitter, Event } from '../../base/common/event.js';\nimport { Disposable, IDisposable, toDisposable } from '../../base/common/lifecycle.js';\nimport { ITokenizationRegistry, ITokenizationSupportChangedEvent, ILazyTokenizationSupport } from './languages.js';\nimport { ColorId } from './encodedTokenAttributes.js';\n\nexport class TokenizationRegistry<TSupport> implements ITokenizationRegistry<TSupport> {\n\n\tprivate readonly _tokenizationSupports = new Map<string, TSupport>();\n\tprivate readonly _factories = new Map<string, TokenizationSupportFactoryData<TSupport>>();\n\n\tprivate readonly _onDidChange = new Emitter<ITokenizationSupportChangedEvent>();\n\tpublic readonly onDidChange: Event<ITokenizationSupportChangedEvent> = this._onDidChange.event;\n\n\tprivate _colorMap: Color[] | null;\n\n\tconstructor() {\n\t\tthis._colorMap = null;\n\t}\n\n\tpublic handleChange(languageIds: string[]): void {\n\t\tthis._onDidChange.fire({\n\t\t\tchangedLanguages: languageIds,\n\t\t\tchangedColorMap: false\n\t\t});\n\t}\n\n\tpublic register(languageId: string, support: TSupport): IDisposable {\n\t\tthis._tokenizationSupports.set(languageId, support);\n\t\tthis.handleChange([languageId]);\n\t\treturn toDisposable(() => {\n\t\t\tif (this._tokenizationSupports.get(languageId) !== support) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._tokenizationSupports.delete(languageId);\n\t\t\tthis.handleChange([languageId]);\n\t\t});\n\t}\n\n\tpublic get(languageId: string): TSupport | null {\n\t\treturn this._tokenizationSupports.get(languageId) || null;\n\t}\n\n\tpublic registerFactory(languageId: string, factory: ILazyTokenizationSupport<TSupport>): IDisposable {\n\t\tthis._factories.get(languageId)?.dispose();\n\t\tconst myData = new TokenizationSupportFactoryData(this, languageId, factory);\n\t\tthis._factories.set(languageId, myData);\n\t\treturn toDisposable(() => {\n\t\t\tconst v = this._factories.get(languageId);\n\t\t\tif (!v || v !== myData) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._factories.delete(languageId);\n\t\t\tv.dispose();\n\t\t});\n\t}\n\n\tpublic async getOrCreate(languageId: string): Promise<TSupport | null> {\n\t\t// check first if the support is already set\n\t\tconst tokenizationSupport = this.get(languageId);\n\t\tif (tokenizationSupport) {\n\t\t\treturn tokenizationSupport;\n\t\t}\n\n\t\tconst factory = this._factories.get(languageId);\n\t\tif (!factory || factory.isResolved) {\n\t\t\t// no factory or factory.resolve already finished\n\t\t\treturn null;\n\t\t}\n\n\t\tawait factory.resolve();\n\n\t\treturn this.get(languageId);\n\t}\n\n\tpublic isResolved(languageId: string): boolean {\n\t\tconst tokenizationSupport = this.get(languageId);\n\t\tif (tokenizationSupport) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst factory = this._factories.get(languageId);\n\t\tif (!factory || factory.isResolved) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic setColorMap(colorMap: Color[]): void {\n\t\tthis._colorMap = colorMap;\n\t\tthis._onDidChange.fire({\n\t\t\tchangedLanguages: Array.from(this._tokenizationSupports.keys()),\n\t\t\tchangedColorMap: true\n\t\t});\n\t}\n\n\tpublic getColorMap(): Color[] | null {\n\t\treturn this._colorMap;\n\t}\n\n\tpublic getDefaultBackground(): Color | null {\n\t\tif (this._colorMap && this._colorMap.length > ColorId.DefaultBackground) {\n\t\t\treturn this._colorMap[ColorId.DefaultBackground];\n\t\t}\n\t\treturn null;\n\t}\n}\n\nclass TokenizationSupportFactoryData<TSupport> extends Disposable {\n\n\tprivate _isDisposed: boolean = false;\n\tprivate _resolvePromise: Promise<void> | null = null;\n\tprivate _isResolved: boolean = false;\n\n\tpublic get isResolved(): boolean {\n\t\treturn this._isResolved;\n\t}\n\n\tconstructor(\n\t\tprivate readonly _registry: TokenizationRegistry<TSupport>,\n\t\tprivate readonly _languageId: string,\n\t\tprivate readonly _factory: ILazyTokenizationSupport<TSupport>,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._isDisposed = true;\n\t\tsuper.dispose();\n\t}\n\n\tpublic async resolve(): Promise<void> {\n\t\tif (!this._resolvePromise) {\n\t\t\tthis._resolvePromise = this._create();\n\t\t}\n\t\treturn this._resolvePromise;\n\t}\n\n\tprivate async _create(): Promise<void> {\n\t\tconst value = await this._factory.tokenizationSupport;\n\t\tthis._isResolved = true;\n\t\tif (value && !this._isDisposed) {\n\t\t\tthis._register(this._registry.register(this._languageId, value));\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from '../../base/common/buffer.js';\nimport { CancellationToken } from '../../base/common/cancellation.js';\nimport { Codicon } from '../../base/common/codicons.js';\nimport { Color } from '../../base/common/color.js';\nimport { IReadonlyVSDataTransfer } from '../../base/common/dataTransfer.js';\nimport { Event } from '../../base/common/event.js';\nimport { HierarchicalKind } from '../../base/common/hierarchicalKind.js';\nimport { IMarkdownString } from '../../base/common/htmlContent.js';\nimport { IDisposable } from '../../base/common/lifecycle.js';\nimport { ThemeIcon } from '../../base/common/themables.js';\nimport { URI, UriComponents } from '../../base/common/uri.js';\nimport { EditOperation, ISingleEditOperation } from './core/editOperation.js';\nimport { IPosition, Position } from './core/position.js';\nimport { IRange, Range } from './core/range.js';\nimport { Selection } from './core/selection.js';\nimport { LanguageId } from './encodedTokenAttributes.js';\nimport { LanguageSelector } from './languageSelector.js';\nimport * as model from './model.js';\nimport { TokenizationRegistry as TokenizationRegistryImpl } from './tokenizationRegistry.js';\nimport { ContiguousMultilineTokens } from './tokens/contiguousMultilineTokens.js';\nimport { localize } from '../../nls.js';\nimport { ExtensionIdentifier } from '../../platform/extensions/common/extensions.js';\nimport { IMarkerData } from '../../platform/markers/common/markers.js';\n\n/**\n * @internal\n */\nexport interface ILanguageIdCodec {\n\tencodeLanguageId(languageId: string): LanguageId;\n\tdecodeLanguageId(languageId: LanguageId): string;\n}\n\nexport class Token {\n\t_tokenBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly offset: number,\n\t\tpublic readonly type: string,\n\t\tpublic readonly language: string,\n\t) {\n\t}\n\n\tpublic toString(): string {\n\t\treturn '(' + this.offset + ', ' + this.type + ')';\n\t}\n}\n\n/**\n * @internal\n */\nexport class TokenizationResult {\n\t_tokenizationResultBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly tokens: Token[],\n\t\tpublic readonly endState: IState,\n\t) {\n\t}\n}\n\n/**\n * @internal\n */\nexport class EncodedTokenizationResult {\n\t_encodedTokenizationResultBrand: void = undefined;\n\n\tconstructor(\n\t\t/**\n\t\t * The tokens in binary format. Each token occupies two array indices. For token i:\n\t\t *  - at offset 2*i => startIndex\n\t\t *  - at offset 2*i + 1 => metadata\n\t\t *\n\t\t */\n\t\tpublic readonly tokens: Uint32Array,\n\t\tpublic readonly endState: IState,\n\t) {\n\t}\n}\n\nexport interface SyntaxNode {\n\tstartIndex: number;\n\tendIndex: number;\n\tstartPosition: IPosition;\n\tendPosition: IPosition;\n}\n\nexport interface QueryCapture {\n\tname: string;\n\ttext?: string;\n\tnode: SyntaxNode;\n\tencodedLanguageId: number;\n}\n\n/**\n * @internal\n */\nexport interface ITokenizationSupport {\n\t/**\n\t * If true, the background tokenizer will only be used to verify tokens against the default background tokenizer.\n\t * Used for debugging.\n\t */\n\treadonly backgroundTokenizerShouldOnlyVerifyTokens?: boolean;\n\n\tgetInitialState(): IState;\n\n\ttokenize(line: string, hasEOL: boolean, state: IState): TokenizationResult;\n\n\ttokenizeEncoded(line: string, hasEOL: boolean, state: IState): EncodedTokenizationResult;\n\n\t/**\n\t * Can be/return undefined if default background tokenization should be used.\n\t */\n\tcreateBackgroundTokenizer?(textModel: model.ITextModel, store: IBackgroundTokenizationStore): IBackgroundTokenizer | undefined;\n}\n\n/**\n * @internal\n */\nexport interface IBackgroundTokenizer extends IDisposable {\n\t/**\n\t * Instructs the background tokenizer to set the tokens for the given range again.\n\t *\n\t * This might be necessary if the renderer overwrote those tokens with heuristically computed ones for some viewport,\n\t * when the change does not even propagate to that viewport.\n\t */\n\trequestTokens(startLineNumber: number, endLineNumberExclusive: number): void;\n\n\treportMismatchingTokens?(lineNumber: number): void;\n}\n\n/**\n * @internal\n */\nexport interface IBackgroundTokenizationStore {\n\tsetTokens(tokens: ContiguousMultilineTokens[]): void;\n\n\tsetEndState(lineNumber: number, state: IState): void;\n\n\t/**\n\t * Should be called to indicate that the background tokenization has finished for now.\n\t * (This triggers bracket pair colorization to re-parse the bracket pairs with token information)\n\t */\n\tbackgroundTokenizationFinished(): void;\n}\n\n/**\n * The state of the tokenizer between two lines.\n * It is useful to store flags such as in multiline comment, etc.\n * The model will clone the previous line's state and pass it in to tokenize the next line.\n */\nexport interface IState {\n\tclone(): IState;\n\tequals(other: IState): boolean;\n}\n\n/**\n * A provider result represents the values a provider, like the {@link HoverProvider},\n * may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves\n * to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a\n * thenable.\n */\nexport type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;\n\n/**\n * A hover represents additional information for a symbol or word. Hovers are\n * rendered in a tooltip-like widget.\n */\nexport interface Hover {\n\t/**\n\t * The contents of this hover.\n\t */\n\tcontents: IMarkdownString[];\n\n\t/**\n\t * The range to which this hover applies. When missing, the\n\t * editor will use the range at the current position or the\n\t * current position itself.\n\t */\n\trange?: IRange;\n\n\t/**\n\t * Can increase the verbosity of the hover\n\t */\n\tcanIncreaseVerbosity?: boolean;\n\n\t/**\n\t * Can decrease the verbosity of the hover\n\t */\n\tcanDecreaseVerbosity?: boolean;\n}\n\n/**\n * The hover provider interface defines the contract between extensions and\n * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature.\n */\nexport interface HoverProvider<THover = Hover> {\n\t/**\n\t * Provide a hover for the given position, context and document. Multiple hovers at the same\n\t * position will be merged by the editor. A hover can have a range which defaults\n\t * to the word range at the position when omitted.\n\t */\n\tprovideHover(model: model.ITextModel, position: Position, token: CancellationToken, context?: HoverContext<THover>): ProviderResult<THover>;\n}\n\nexport interface HoverContext<THover = Hover> {\n\t/**\n\t * Hover verbosity request\n\t */\n\tverbosityRequest?: HoverVerbosityRequest<THover>;\n}\n\nexport interface HoverVerbosityRequest<THover = Hover> {\n\t/**\n\t * The delta by which to increase/decrease the hover verbosity level\n\t */\n\tverbosityDelta: number;\n\t/**\n\t * The previous hover for the same position\n\t */\n\tpreviousHover: THover;\n}\n\nexport enum HoverVerbosityAction {\n\t/**\n\t * Increase the verbosity of the hover\n\t */\n\tIncrease,\n\t/**\n\t * Decrease the verbosity of the hover\n\t */\n\tDecrease\n}\n\n/**\n * An evaluatable expression represents additional information for an expression in a document. Evaluatable expressions are\n * evaluated by a debugger or runtime and their result is rendered in a tooltip-like widget.\n * @internal\n */\nexport interface EvaluatableExpression {\n\t/**\n\t * The range to which this expression applies.\n\t */\n\trange: IRange;\n\t/**\n\t * This expression overrides the expression extracted from the range.\n\t */\n\texpression?: string;\n}\n\n\n/**\n * The evaluatable expression provider interface defines the contract between extensions and\n * the debug hover.\n * @internal\n */\nexport interface EvaluatableExpressionProvider {\n\t/**\n\t * Provide a hover for the given position and document. Multiple hovers at the same\n\t * position will be merged by the editor. A hover can have a range which defaults\n\t * to the word range at the position when omitted.\n\t */\n\tprovideEvaluatableExpression(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<EvaluatableExpression>;\n}\n\n/**\n * A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.\n * @internal\n */\nexport interface InlineValueContext {\n\tframeId: number;\n\tstoppedLocation: Range;\n}\n\n/**\n * Provide inline value as text.\n * @internal\n */\nexport interface InlineValueText {\n\ttype: 'text';\n\trange: IRange;\n\ttext: string;\n}\n\n/**\n * Provide inline value through a variable lookup.\n * @internal\n */\nexport interface InlineValueVariableLookup {\n\ttype: 'variable';\n\trange: IRange;\n\tvariableName?: string;\n\tcaseSensitiveLookup: boolean;\n}\n\n/**\n * Provide inline value through an expression evaluation.\n * @internal\n */\nexport interface InlineValueExpression {\n\ttype: 'expression';\n\trange: IRange;\n\texpression?: string;\n}\n\n/**\n * Inline value information can be provided by different means:\n * - directly as a text value (class InlineValueText).\n * - as a name to use for a variable lookup (class InlineValueVariableLookup)\n * - as an evaluatable expression (class InlineValueEvaluatableExpression)\n * The InlineValue types combines all inline value types into one type.\n * @internal\n */\nexport type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueExpression;\n\n/**\n * The inline values provider interface defines the contract between extensions and\n * the debugger's inline values feature.\n * @internal\n */\nexport interface InlineValuesProvider {\n\t/**\n\t */\n\tonDidChangeInlineValues?: Event<void> | undefined;\n\t/**\n\t * Provide the \"inline values\" for the given range and document. Multiple hovers at the same\n\t * position will be merged by the editor. A hover can have a range which defaults\n\t * to the word range at the position when omitted.\n\t */\n\tprovideInlineValues(model: model.ITextModel, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]>;\n}\n\nexport const enum CompletionItemKind {\n\tMethod,\n\tFunction,\n\tConstructor,\n\tField,\n\tVariable,\n\tClass,\n\tStruct,\n\tInterface,\n\tModule,\n\tProperty,\n\tEvent,\n\tOperator,\n\tUnit,\n\tValue,\n\tConstant,\n\tEnum,\n\tEnumMember,\n\tKeyword,\n\tText,\n\tColor,\n\tFile,\n\tReference,\n\tCustomcolor,\n\tFolder,\n\tTypeParameter,\n\tUser,\n\tIssue,\n\tTool,\n\tSnippet, // <- highest value (used for compare!)\n}\n\n/**\n * @internal\n */\nexport namespace CompletionItemKinds {\n\n\tconst byKind = new Map<CompletionItemKind, ThemeIcon>();\n\tbyKind.set(CompletionItemKind.Method, Codicon.symbolMethod);\n\tbyKind.set(CompletionItemKind.Function, Codicon.symbolFunction);\n\tbyKind.set(CompletionItemKind.Constructor, Codicon.symbolConstructor);\n\tbyKind.set(CompletionItemKind.Field, Codicon.symbolField);\n\tbyKind.set(CompletionItemKind.Variable, Codicon.symbolVariable);\n\tbyKind.set(CompletionItemKind.Class, Codicon.symbolClass);\n\tbyKind.set(CompletionItemKind.Struct, Codicon.symbolStruct);\n\tbyKind.set(CompletionItemKind.Interface, Codicon.symbolInterface);\n\tbyKind.set(CompletionItemKind.Module, Codicon.symbolModule);\n\tbyKind.set(CompletionItemKind.Property, Codicon.symbolProperty);\n\tbyKind.set(CompletionItemKind.Event, Codicon.symbolEvent);\n\tbyKind.set(CompletionItemKind.Operator, Codicon.symbolOperator);\n\tbyKind.set(CompletionItemKind.Unit, Codicon.symbolUnit);\n\tbyKind.set(CompletionItemKind.Value, Codicon.symbolValue);\n\tbyKind.set(CompletionItemKind.Enum, Codicon.symbolEnum);\n\tbyKind.set(CompletionItemKind.Constant, Codicon.symbolConstant);\n\tbyKind.set(CompletionItemKind.Enum, Codicon.symbolEnum);\n\tbyKind.set(CompletionItemKind.EnumMember, Codicon.symbolEnumMember);\n\tbyKind.set(CompletionItemKind.Keyword, Codicon.symbolKeyword);\n\tbyKind.set(CompletionItemKind.Snippet, Codicon.symbolSnippet);\n\tbyKind.set(CompletionItemKind.Text, Codicon.symbolText);\n\tbyKind.set(CompletionItemKind.Color, Codicon.symbolColor);\n\tbyKind.set(CompletionItemKind.File, Codicon.symbolFile);\n\tbyKind.set(CompletionItemKind.Reference, Codicon.symbolReference);\n\tbyKind.set(CompletionItemKind.Customcolor, Codicon.symbolCustomColor);\n\tbyKind.set(CompletionItemKind.Folder, Codicon.symbolFolder);\n\tbyKind.set(CompletionItemKind.TypeParameter, Codicon.symbolTypeParameter);\n\tbyKind.set(CompletionItemKind.User, Codicon.account);\n\tbyKind.set(CompletionItemKind.Issue, Codicon.issues);\n\tbyKind.set(CompletionItemKind.Tool, Codicon.tools);\n\n\t/**\n\t * @internal\n\t */\n\texport function toIcon(kind: CompletionItemKind): ThemeIcon {\n\t\tlet codicon = byKind.get(kind);\n\t\tif (!codicon) {\n\t\t\tconsole.info('No codicon found for CompletionItemKind ' + kind);\n\t\t\tcodicon = Codicon.symbolProperty;\n\t\t}\n\t\treturn codicon;\n\t}\n\n\t/**\n\t * @internal\n\t */\n\texport function toLabel(kind: CompletionItemKind): string {\n\t\tswitch (kind) {\n\t\t\tcase CompletionItemKind.Method: return localize('suggestWidget.kind.method', 'Method');\n\t\t\tcase CompletionItemKind.Function: return localize('suggestWidget.kind.function', 'Function');\n\t\t\tcase CompletionItemKind.Constructor: return localize('suggestWidget.kind.constructor', 'Constructor');\n\t\t\tcase CompletionItemKind.Field: return localize('suggestWidget.kind.field', 'Field');\n\t\t\tcase CompletionItemKind.Variable: return localize('suggestWidget.kind.variable', 'Variable');\n\t\t\tcase CompletionItemKind.Class: return localize('suggestWidget.kind.class', 'Class');\n\t\t\tcase CompletionItemKind.Struct: return localize('suggestWidget.kind.struct', 'Struct');\n\t\t\tcase CompletionItemKind.Interface: return localize('suggestWidget.kind.interface', 'Interface');\n\t\t\tcase CompletionItemKind.Module: return localize('suggestWidget.kind.module', 'Module');\n\t\t\tcase CompletionItemKind.Property: return localize('suggestWidget.kind.property', 'Property');\n\t\t\tcase CompletionItemKind.Event: return localize('suggestWidget.kind.event', 'Event');\n\t\t\tcase CompletionItemKind.Operator: return localize('suggestWidget.kind.operator', 'Operator');\n\t\t\tcase CompletionItemKind.Unit: return localize('suggestWidget.kind.unit', 'Unit');\n\t\t\tcase CompletionItemKind.Value: return localize('suggestWidget.kind.value', 'Value');\n\t\t\tcase CompletionItemKind.Constant: return localize('suggestWidget.kind.constant', 'Constant');\n\t\t\tcase CompletionItemKind.Enum: return localize('suggestWidget.kind.enum', 'Enum');\n\t\t\tcase CompletionItemKind.EnumMember: return localize('suggestWidget.kind.enumMember', 'Enum Member');\n\t\t\tcase CompletionItemKind.Keyword: return localize('suggestWidget.kind.keyword', 'Keyword');\n\t\t\tcase CompletionItemKind.Text: return localize('suggestWidget.kind.text', 'Text');\n\t\t\tcase CompletionItemKind.Color: return localize('suggestWidget.kind.color', 'Color');\n\t\t\tcase CompletionItemKind.File: return localize('suggestWidget.kind.file', 'File');\n\t\t\tcase CompletionItemKind.Reference: return localize('suggestWidget.kind.reference', 'Reference');\n\t\t\tcase CompletionItemKind.Customcolor: return localize('suggestWidget.kind.customcolor', 'Custom Color');\n\t\t\tcase CompletionItemKind.Folder: return localize('suggestWidget.kind.folder', 'Folder');\n\t\t\tcase CompletionItemKind.TypeParameter: return localize('suggestWidget.kind.typeParameter', 'Type Parameter');\n\t\t\tcase CompletionItemKind.User: return localize('suggestWidget.kind.user', 'User');\n\t\t\tcase CompletionItemKind.Issue: return localize('suggestWidget.kind.issue', 'Issue');\n\t\t\tcase CompletionItemKind.Tool: return localize('suggestWidget.kind.tool', 'Tool');\n\t\t\tcase CompletionItemKind.Snippet: return localize('suggestWidget.kind.snippet', 'Snippet');\n\t\t\tdefault: return '';\n\t\t}\n\t}\n\n\tconst data = new Map<string, CompletionItemKind>();\n\tdata.set('method', CompletionItemKind.Method);\n\tdata.set('function', CompletionItemKind.Function);\n\tdata.set('constructor', <any>CompletionItemKind.Constructor);\n\tdata.set('field', CompletionItemKind.Field);\n\tdata.set('variable', CompletionItemKind.Variable);\n\tdata.set('class', CompletionItemKind.Class);\n\tdata.set('struct', CompletionItemKind.Struct);\n\tdata.set('interface', CompletionItemKind.Interface);\n\tdata.set('module', CompletionItemKind.Module);\n\tdata.set('property', CompletionItemKind.Property);\n\tdata.set('event', CompletionItemKind.Event);\n\tdata.set('operator', CompletionItemKind.Operator);\n\tdata.set('unit', CompletionItemKind.Unit);\n\tdata.set('value', CompletionItemKind.Value);\n\tdata.set('constant', CompletionItemKind.Constant);\n\tdata.set('enum', CompletionItemKind.Enum);\n\tdata.set('enum-member', CompletionItemKind.EnumMember);\n\tdata.set('enumMember', CompletionItemKind.EnumMember);\n\tdata.set('keyword', CompletionItemKind.Keyword);\n\tdata.set('snippet', CompletionItemKind.Snippet);\n\tdata.set('text', CompletionItemKind.Text);\n\tdata.set('color', CompletionItemKind.Color);\n\tdata.set('file', CompletionItemKind.File);\n\tdata.set('reference', CompletionItemKind.Reference);\n\tdata.set('customcolor', CompletionItemKind.Customcolor);\n\tdata.set('folder', CompletionItemKind.Folder);\n\tdata.set('type-parameter', CompletionItemKind.TypeParameter);\n\tdata.set('typeParameter', CompletionItemKind.TypeParameter);\n\tdata.set('account', CompletionItemKind.User);\n\tdata.set('issue', CompletionItemKind.Issue);\n\tdata.set('tool', CompletionItemKind.Tool);\n\n\t/**\n\t * @internal\n\t */\n\texport function fromString(value: string): CompletionItemKind;\n\t/**\n\t * @internal\n\t */\n\texport function fromString(value: string, strict: true): CompletionItemKind | undefined;\n\t/**\n\t * @internal\n\t */\n\texport function fromString(value: string, strict?: boolean): CompletionItemKind | undefined {\n\t\tlet res = data.get(value);\n\t\tif (typeof res === 'undefined' && !strict) {\n\t\t\tres = CompletionItemKind.Property;\n\t\t}\n\t\treturn res;\n\t}\n}\n\nexport interface CompletionItemLabel {\n\tlabel: string;\n\tdetail?: string;\n\tdescription?: string;\n}\n\nexport const enum CompletionItemTag {\n\tDeprecated = 1\n}\n\nexport const enum CompletionItemInsertTextRule {\n\tNone = 0,\n\n\t/**\n\t * Adjust whitespace/indentation of multiline insert texts to\n\t * match the current line indentation.\n\t */\n\tKeepWhitespace = 0b001,\n\n\t/**\n\t * `insertText` is a snippet.\n\t */\n\tInsertAsSnippet = 0b100,\n}\n\nexport interface CompletionItemRanges {\n\tinsert: IRange;\n\treplace: IRange;\n}\n\n/**\n * A completion item represents a text snippet that is\n * proposed to complete text that is being typed.\n */\nexport interface CompletionItem {\n\t/**\n\t * The label of this completion item. By default\n\t * this is also the text that is inserted when selecting\n\t * this completion.\n\t */\n\tlabel: string | CompletionItemLabel;\n\t/**\n\t * The kind of this completion item. Based on the kind\n\t * an icon is chosen by the editor.\n\t */\n\tkind: CompletionItemKind;\n\t/**\n\t * A modifier to the `kind` which affect how the item\n\t * is rendered, e.g. Deprecated is rendered with a strikeout\n\t */\n\ttags?: ReadonlyArray<CompletionItemTag>;\n\t/**\n\t * A human-readable string with additional information\n\t * about this item, like type or symbol information.\n\t */\n\tdetail?: string;\n\t/**\n\t * A human-readable string that represents a doc-comment.\n\t */\n\tdocumentation?: string | IMarkdownString;\n\t/**\n\t * A string that should be used when comparing this item\n\t * with other items. When `falsy` the {@link CompletionItem.label label}\n\t * is used.\n\t */\n\tsortText?: string;\n\t/**\n\t * A string that should be used when filtering a set of\n\t * completion items. When `falsy` the {@link CompletionItem.label label}\n\t * is used.\n\t */\n\tfilterText?: string;\n\t/**\n\t * Select this item when showing. *Note* that only one completion item can be selected and\n\t * that the editor decides which item that is. The rule is that the *first* item of those\n\t * that match best is selected.\n\t */\n\tpreselect?: boolean;\n\t/**\n\t * A string or snippet that should be inserted in a document when selecting\n\t * this completion.\n\t */\n\tinsertText: string;\n\t/**\n\t * Additional rules (as bitmask) that should be applied when inserting\n\t * this completion.\n\t */\n\tinsertTextRules?: CompletionItemInsertTextRule;\n\t/**\n\t * A range of text that should be replaced by this completion item.\n\t *\n\t * *Note:* The range must be a {@link Range.isSingleLine single line} and it must\n\t * {@link Range.contains contain} the position at which completion has been {@link CompletionItemProvider.provideCompletionItems requested}.\n\t */\n\trange: IRange | CompletionItemRanges;\n\t/**\n\t * An optional set of characters that when pressed while this completion is active will accept it first and\n\t * then type that character. *Note* that all commit characters should have `length=1` and that superfluous\n\t * characters will be ignored.\n\t */\n\tcommitCharacters?: string[];\n\t/**\n\t * An optional array of additional text edits that are applied when\n\t * selecting this completion. Edits must not overlap with the main edit\n\t * nor with themselves.\n\t */\n\tadditionalTextEdits?: ISingleEditOperation[];\n\t/**\n\t * A command that should be run upon acceptance of this item.\n\t */\n\tcommand?: Command;\n\t/**\n\t * A command that should be run upon acceptance of this item.\n\t */\n\taction?: Command;\n\t/**\n\t * @internal\n\t */\n\textensionId?: ExtensionIdentifier;\n\n\t/**\n\t * @internal\n\t */\n\t_id?: [number, number];\n}\n\nexport interface CompletionList {\n\tsuggestions: CompletionItem[];\n\tincomplete?: boolean;\n\tdispose?(): void;\n\n\t/**\n\t * @internal\n\t */\n\tduration?: number;\n}\n\n/**\n * Info provided on partial acceptance.\n */\nexport interface PartialAcceptInfo {\n\tkind: PartialAcceptTriggerKind;\n\tacceptedLength: number;\n}\n\n/**\n * How a partial acceptance was triggered.\n */\nexport const enum PartialAcceptTriggerKind {\n\tWord = 0,\n\tLine = 1,\n\tSuggest = 2,\n}\n\n/**\n * How a suggest provider was triggered.\n */\nexport const enum CompletionTriggerKind {\n\tInvoke = 0,\n\tTriggerCharacter = 1,\n\tTriggerForIncompleteCompletions = 2\n}\n/**\n * Contains additional information about the context in which\n * {@link CompletionItemProvider.provideCompletionItems completion provider} is triggered.\n */\nexport interface CompletionContext {\n\t/**\n\t * How the completion was triggered.\n\t */\n\ttriggerKind: CompletionTriggerKind;\n\t/**\n\t * Character that triggered the completion item provider.\n\t *\n\t * `undefined` if provider was not triggered by a character.\n\t */\n\ttriggerCharacter?: string;\n}\n/**\n * The completion item provider interface defines the contract between extensions and\n * the [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense).\n *\n * When computing *complete* completion items is expensive, providers can optionally implement\n * the `resolveCompletionItem`-function. In that case it is enough to return completion\n * items with a {@link CompletionItem.label label} from the\n * {@link CompletionItemProvider.provideCompletionItems provideCompletionItems}-function. Subsequently,\n * when a completion item is shown in the UI and gains focus this provider is asked to resolve\n * the item, like adding {@link CompletionItem.documentation doc-comment} or {@link CompletionItem.detail details}.\n */\nexport interface CompletionItemProvider {\n\n\t/**\n\t * Used to identify completions in the (debug) UI and telemetry. This isn't the extension identifier because extensions\n\t * often contribute multiple completion item providers.\n\t *\n\t * @internal\n\t */\n\t_debugDisplayName: string;\n\n\ttriggerCharacters?: string[];\n\t/**\n\t * Provide completion items for the given position and document.\n\t */\n\tprovideCompletionItems(model: model.ITextModel, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionList>;\n\n\t/**\n\t * Given a completion item fill in more data, like {@link CompletionItem.documentation doc-comment}\n\t * or {@link CompletionItem.detail details}.\n\t *\n\t * The editor will only resolve a completion item once.\n\t */\n\tresolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;\n}\n\n/**\n * How an {@link InlineCompletionsProvider inline completion provider} was triggered.\n */\nexport enum InlineCompletionTriggerKind {\n\t/**\n\t * Completion was triggered automatically while editing.\n\t * It is sufficient to return a single completion item in this case.\n\t */\n\tAutomatic = 0,\n\n\t/**\n\t * Completion was triggered explicitly by a user gesture.\n\t * Return multiple completion items to enable cycling through them.\n\t */\n\tExplicit = 1,\n}\n\nexport interface InlineCompletionContext {\n\n\t/**\n\t * How the completion was triggered.\n\t */\n\treadonly triggerKind: InlineCompletionTriggerKind;\n\treadonly selectedSuggestionInfo: SelectedSuggestionInfo | undefined;\n\t/**\n\t * @experimental\n\t * @internal\n\t*/\n\treadonly userPrompt?: string | undefined;\n\t/**\n\t * @experimental\n\t * @internal\n\t*/\n\treadonly requestUuid: string;\n\n\treadonly includeInlineEdits: boolean;\n\treadonly includeInlineCompletions: boolean;\n}\n\nexport class SelectedSuggestionInfo {\n\tconstructor(\n\t\tpublic readonly range: IRange,\n\t\tpublic readonly text: string,\n\t\tpublic readonly completionKind: CompletionItemKind,\n\t\tpublic readonly isSnippetText: boolean,\n\t) {\n\t}\n\n\tpublic equals(other: SelectedSuggestionInfo) {\n\t\treturn Range.lift(this.range).equalsRange(other.range)\n\t\t\t&& this.text === other.text\n\t\t\t&& this.completionKind === other.completionKind\n\t\t\t&& this.isSnippetText === other.isSnippetText;\n\t}\n}\n\nexport interface InlineCompletion {\n\t/**\n\t * The text to insert.\n\t * If the text contains a line break, the range must end at the end of a line.\n\t * If existing text should be replaced, the existing text must be a prefix of the text to insert.\n\t *\n\t * The text can also be a snippet. In that case, a preview with default parameters is shown.\n\t * When accepting the suggestion, the full snippet is inserted.\n\t*/\n\treadonly insertText: string | { snippet: string };\n\n\t/**\n\t * A text that is used to decide if this inline completion should be shown.\n\t * An inline completion is shown if the text to replace is a subword of the filter text.\n\t */\n\treadonly filterText?: string;\n\n\t/**\n\t * An optional array of additional text edits that are applied when\n\t * selecting this completion. Edits must not overlap with the main edit\n\t * nor with themselves.\n\t */\n\treadonly additionalTextEdits?: ISingleEditOperation[];\n\n\t/**\n\t * The range to replace.\n\t * Must begin and end on the same line.\n\t*/\n\treadonly range?: IRange;\n\n\treadonly command?: Command;\n\n\treadonly action?: Command;\n\n\t/**\n\t * Is called the first time an inline completion is shown.\n\t * @deprecated. Use `onDidShow` of the provider instead.\n\t*/\n\treadonly shownCommand?: Command;\n\n\t/**\n\t * If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.\n\t * Defaults to `false`.\n\t*/\n\treadonly completeBracketPairs?: boolean;\n\n\treadonly isInlineEdit?: boolean;\n\treadonly showInlineEditMenu?: boolean;\n\n\treadonly showRange?: IRange;\n\n\treadonly warning?: InlineCompletionWarning;\n\n\treadonly displayLocation?: InlineCompletionDisplayLocation;\n}\n\nexport interface InlineCompletionWarning {\n\tmessage: IMarkdownString | string;\n\ticon?: IconPath;\n}\n\nexport interface InlineCompletionDisplayLocation {\n\trange: IRange;\n\tlabel: string;\n}\n\n/**\n * TODO: add `| URI | { light: URI; dark: URI }`.\n*/\nexport type IconPath = ThemeIcon;\n\nexport interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {\n\treadonly items: readonly TItem[];\n\t/**\n\t * A list of commands associated with the inline completions of this list.\n\t */\n\treadonly commands?: InlineCompletionCommand[];\n\n\treadonly suppressSuggestions?: boolean | undefined;\n\n\t/**\n\t * When set and the user types a suggestion without derivating from it, the inline suggestion is not updated.\n\t */\n\treadonly enableForwardStability?: boolean | undefined;\n}\n\nexport type InlineCompletionCommand = { command: Command; icon?: ThemeIcon };\n\nexport type InlineCompletionProviderGroupId = string;\n\nexport interface InlineCompletionsProvider<T extends InlineCompletions = InlineCompletions> {\n\tprovideInlineCompletions(model: model.ITextModel, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<T>;\n\n\t/**\n\t * Will be called when an item is shown.\n\t * @param updatedInsertText Is useful to understand bracket completion.\n\t*/\n\thandleItemDidShow?(completions: T, item: T['items'][number], updatedInsertText: string): void;\n\n\t/**\n\t * Will be called when an item is partially accepted. TODO: also handle full acceptance here!\n\t * @param acceptedCharacters Deprecated. Use `info.acceptedCharacters` instead.\n\t */\n\thandlePartialAccept?(completions: T, item: T['items'][number], acceptedCharacters: number, info: PartialAcceptInfo): void;\n\n\t/**\n\t * @deprecated Use `handleEndOfLifetime` instead.\n\t*/\n\thandleRejection?(completions: T, item: T['items'][number]): void;\n\n\t/**\n\t * Is called when an inline completion item is no longer being used.\n\t * Provides a reason of why it is not used anymore.\n\t*/\n\thandleEndOfLifetime?(completions: T, item: T['items'][number], reason: InlineCompletionEndOfLifeReason<T['items'][number]>, lifetimeSummary: LifetimeSummary): void;\n\n\t/**\n\t * Will be called when a completions list is no longer in use and can be garbage-collected.\n\t*/\n\tdisposeInlineCompletions(completions: T, reason: InlineCompletionsDisposeReason): void;\n\n\tonDidChangeInlineCompletions?: Event<void>;\n\n\t/**\n\t * Only used for {@link yieldsToGroupIds}.\n\t * Multiple providers can have the same group id.\n\t */\n\tgroupId?: InlineCompletionProviderGroupId;\n\n\t/**\n\t * Returns a list of preferred provider {@link groupId}s.\n\t * The current provider is only requested for completions if no provider with a preferred group id returned a result.\n\t */\n\tyieldsToGroupIds?: InlineCompletionProviderGroupId[];\n\n\tdisplayName?: string;\n\n\tdebounceDelayMs?: number;\n\n\ttoString?(): string;\n}\n\nexport type InlineCompletionsDisposeReason = { kind: 'lostRace' | 'tokenCancellation' | 'other' | 'empty' | 'notTaken' };\n\nexport enum InlineCompletionEndOfLifeReasonKind {\n\tAccepted = 0,\n\tRejected = 1,\n\tIgnored = 2,\n}\n\nexport type InlineCompletionEndOfLifeReason<TInlineCompletion = InlineCompletion> = {\n\tkind: InlineCompletionEndOfLifeReasonKind.Accepted; // User did an explicit action to accept\n} | {\n\tkind: InlineCompletionEndOfLifeReasonKind.Rejected; // User did an explicit action to reject\n} | {\n\tkind: InlineCompletionEndOfLifeReasonKind.Ignored;\n\tsupersededBy?: TInlineCompletion;\n\tuserTypingDisagreed: boolean;\n};\n\nexport type LifetimeSummary = {\n\trequestUuid: string;\n\tpartiallyAccepted: number;\n\tshown: boolean;\n\tshownDuration: number;\n\tshownDurationUncollapsed: number;\n\ttimeUntilShown: number | undefined;\n\teditorType: string;\n\tviewKind: string | undefined;\n\terror: string | undefined;\n\tlanguageId: string;\n\trequestReason: string;\n\tcursorColumnDistance?: number;\n\tcursorLineDistance?: number;\n\tlineCountOriginal?: number;\n\tlineCountModified?: number;\n\tcharacterCountOriginal?: number;\n\tcharacterCountModified?: number;\n\tdisjointReplacements?: number;\n\tsameShapeReplacements?: boolean;\n};\n\nexport interface CodeAction {\n\ttitle: string;\n\tcommand?: Command;\n\tedit?: WorkspaceEdit;\n\tdiagnostics?: IMarkerData[];\n\tkind?: string;\n\tisPreferred?: boolean;\n\tisAI?: boolean;\n\tdisabled?: string;\n\tranges?: IRange[];\n}\n\nexport const enum CodeActionTriggerType {\n\tInvoke = 1,\n\tAuto = 2,\n}\n\n/**\n * @internal\n */\nexport interface CodeActionContext {\n\tonly?: string;\n\ttrigger: CodeActionTriggerType;\n}\n\nexport interface CodeActionList extends IDisposable {\n\treadonly actions: ReadonlyArray<CodeAction>;\n}\n\n/**\n * The code action interface defines the contract between extensions and\n * the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.\n * @internal\n */\nexport interface CodeActionProvider {\n\n\tdisplayName?: string;\n\n\textensionId?: string;\n\n\t/**\n\t * Provide commands for the given document and range.\n\t */\n\tprovideCodeActions(model: model.ITextModel, range: Range | Selection, context: CodeActionContext, token: CancellationToken): ProviderResult<CodeActionList>;\n\n\t/**\n\t * Given a code action fill in the edit. Will only invoked when missing.\n\t */\n\tresolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult<CodeAction>;\n\n\t/**\n\t * Optional list of CodeActionKinds that this provider returns.\n\t */\n\treadonly providedCodeActionKinds?: ReadonlyArray<string>;\n\n\treadonly documentation?: ReadonlyArray<{ readonly kind: string; readonly command: Command }>;\n\n\t/**\n\t * @internal\n\t */\n\t_getAdditionalMenuItems?(context: CodeActionContext, actions: readonly CodeAction[]): Command[];\n}\n\n/**\n * @internal\n */\nexport interface DocumentPasteEdit {\n\treadonly title: string;\n\treadonly kind: HierarchicalKind;\n\treadonly handledMimeType?: string;\n\tyieldTo?: readonly DropYieldTo[];\n\tinsertText: string | { readonly snippet: string };\n\tadditionalEdit?: WorkspaceEdit;\n}\n\n/**\n * @internal\n */\nexport enum DocumentPasteTriggerKind {\n\tAutomatic = 0,\n\tPasteAs = 1,\n}\n\n/**\n * @internal\n */\nexport interface DocumentPasteContext {\n\treadonly only?: HierarchicalKind;\n\treadonly triggerKind: DocumentPasteTriggerKind;\n}\n\n/**\n * @internal\n */\nexport interface DocumentPasteEditsSession {\n\tedits: readonly DocumentPasteEdit[];\n\tdispose(): void;\n}\n\n/**\n * @internal\n */\nexport interface DocumentPasteEditProvider {\n\treadonly id?: string;\n\treadonly copyMimeTypes: readonly string[];\n\treadonly pasteMimeTypes: readonly string[];\n\treadonly providedPasteEditKinds: readonly HierarchicalKind[];\n\n\tprepareDocumentPaste?(model: model.ITextModel, ranges: readonly IRange[], dataTransfer: IReadonlyVSDataTransfer, token: CancellationToken): Promise<undefined | IReadonlyVSDataTransfer>;\n\n\tprovideDocumentPasteEdits?(model: model.ITextModel, ranges: readonly IRange[], dataTransfer: IReadonlyVSDataTransfer, context: DocumentPasteContext, token: CancellationToken): Promise<DocumentPasteEditsSession | undefined>;\n\n\tresolveDocumentPasteEdit?(edit: DocumentPasteEdit, token: CancellationToken): Promise<DocumentPasteEdit>;\n}\n\n/**\n * Represents a parameter of a callable-signature. A parameter can\n * have a label and a doc-comment.\n */\nexport interface ParameterInformation {\n\t/**\n\t * The label of this signature. Will be shown in\n\t * the UI.\n\t */\n\tlabel: string | [number, number];\n\t/**\n\t * The human-readable doc-comment of this signature. Will be shown\n\t * in the UI but can be omitted.\n\t */\n\tdocumentation?: string | IMarkdownString;\n}\n/**\n * Represents the signature of something callable. A signature\n * can have a label, like a function-name, a doc-comment, and\n * a set of parameters.\n */\nexport interface SignatureInformation {\n\t/**\n\t * The label of this signature. Will be shown in\n\t * the UI.\n\t */\n\tlabel: string;\n\t/**\n\t * The human-readable doc-comment of this signature. Will be shown\n\t * in the UI but can be omitted.\n\t */\n\tdocumentation?: string | IMarkdownString;\n\t/**\n\t * The parameters of this signature.\n\t */\n\tparameters: ParameterInformation[];\n\t/**\n\t * Index of the active parameter.\n\t *\n\t * If provided, this is used in place of `SignatureHelp.activeSignature`.\n\t */\n\tactiveParameter?: number;\n}\n/**\n * Signature help represents the signature of something\n * callable. There can be multiple signatures but only one\n * active and only one active parameter.\n */\nexport interface SignatureHelp {\n\t/**\n\t * One or more signatures.\n\t */\n\tsignatures: SignatureInformation[];\n\t/**\n\t * The active signature.\n\t */\n\tactiveSignature: number;\n\t/**\n\t * The active parameter of the active signature.\n\t */\n\tactiveParameter: number;\n}\n\nexport interface SignatureHelpResult extends IDisposable {\n\tvalue: SignatureHelp;\n}\n\nexport enum SignatureHelpTriggerKind {\n\tInvoke = 1,\n\tTriggerCharacter = 2,\n\tContentChange = 3,\n}\n\nexport interface SignatureHelpContext {\n\treadonly triggerKind: SignatureHelpTriggerKind;\n\treadonly triggerCharacter?: string;\n\treadonly isRetrigger: boolean;\n\treadonly activeSignatureHelp?: SignatureHelp;\n}\n\n/**\n * The signature help provider interface defines the contract between extensions and\n * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.\n */\nexport interface SignatureHelpProvider {\n\n\treadonly signatureHelpTriggerCharacters?: ReadonlyArray<string>;\n\treadonly signatureHelpRetriggerCharacters?: ReadonlyArray<string>;\n\n\t/**\n\t * Provide help for the signature at the given position and document.\n\t */\n\tprovideSignatureHelp(model: model.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelpResult>;\n}\n\n/**\n * A document highlight kind.\n */\nexport enum DocumentHighlightKind {\n\t/**\n\t * A textual occurrence.\n\t */\n\tText,\n\t/**\n\t * Read-access of a symbol, like reading a variable.\n\t */\n\tRead,\n\t/**\n\t * Write-access of a symbol, like writing to a variable.\n\t */\n\tWrite\n}\n/**\n * A document highlight is a range inside a text document which deserves\n * special attention. Usually a document highlight is visualized by changing\n * the background color of its range.\n */\nexport interface DocumentHighlight {\n\t/**\n\t * The range this highlight applies to.\n\t */\n\trange: IRange;\n\t/**\n\t * The highlight kind, default is {@link DocumentHighlightKind.Text text}.\n\t */\n\tkind?: DocumentHighlightKind;\n}\n\n/**\n * Represents a set of document highlights for a specific URI.\n */\nexport interface MultiDocumentHighlight {\n\t/**\n\t * The URI of the document that the highlights belong to.\n\t */\n\turi: URI;\n\n\t/**\n\t * The set of highlights for the document.\n\t */\n\thighlights: DocumentHighlight[];\n}\n\n/**\n * The document highlight provider interface defines the contract between extensions and\n * the word-highlight-feature.\n */\nexport interface DocumentHighlightProvider {\n\t/**\n\t * Provide a set of document highlights, like all occurrences of a variable or\n\t * all exit-points of a function.\n\t */\n\tprovideDocumentHighlights(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;\n}\n\n/**\n * A provider that can provide document highlights across multiple documents.\n */\nexport interface MultiDocumentHighlightProvider {\n\treadonly selector: LanguageSelector;\n\n\t/**\n\t * Provide a Map of URI --> document highlights, like all occurrences of a variable or\n\t * all exit-points of a function.\n\t *\n\t * Used in cases such as split view, notebooks, etc. where there can be multiple documents\n\t * with shared symbols.\n\t *\n\t * @param primaryModel The primary text model.\n\t * @param position The position at which to provide document highlights.\n\t * @param otherModels The other text models to search for document highlights.\n\t * @param token A cancellation token.\n\t * @returns A map of URI to document highlights.\n\t */\n\tprovideMultiDocumentHighlights(primaryModel: model.ITextModel, position: Position, otherModels: model.ITextModel[], token: CancellationToken): ProviderResult<Map<URI, DocumentHighlight[]>>;\n}\n\n/**\n * The linked editing range provider interface defines the contract between extensions and\n * the linked editing feature.\n */\nexport interface LinkedEditingRangeProvider {\n\n\t/**\n\t * Provide a list of ranges that can be edited together.\n\t */\n\tprovideLinkedEditingRanges(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;\n}\n\n/**\n * Represents a list of ranges that can be edited together along with a word pattern to describe valid contents.\n */\nexport interface LinkedEditingRanges {\n\t/**\n\t * A list of ranges that can be edited together. The ranges must have\n\t * identical length and text content. The ranges cannot overlap\n\t */\n\tranges: IRange[];\n\n\t/**\n\t * An optional word pattern that describes valid contents for the given ranges.\n\t * If no pattern is provided, the language configuration's word pattern will be used.\n\t */\n\twordPattern?: RegExp;\n}\n\n/**\n * Value-object that contains additional information when\n * requesting references.\n */\nexport interface ReferenceContext {\n\t/**\n\t * Include the declaration of the current symbol.\n\t */\n\tincludeDeclaration: boolean;\n}\n/**\n * The reference provider interface defines the contract between extensions and\n * the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature.\n */\nexport interface ReferenceProvider {\n\t/**\n\t * Provide a set of project-wide references for the given position and document.\n\t */\n\tprovideReferences(model: model.ITextModel, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;\n}\n\n/**\n * Represents a location inside a resource, such as a line\n * inside a text file.\n */\nexport interface Location {\n\t/**\n\t * The resource identifier of this location.\n\t */\n\turi: URI;\n\t/**\n\t * The document range of this locations.\n\t */\n\trange: IRange;\n}\n\nexport interface LocationLink {\n\t/**\n\t * A range to select where this link originates from.\n\t */\n\toriginSelectionRange?: IRange;\n\n\t/**\n\t * The target uri this link points to.\n\t */\n\turi: URI;\n\n\t/**\n\t * The full range this link points to.\n\t */\n\trange: IRange;\n\n\t/**\n\t * A range to select this link points to. Must be contained\n\t * in `LocationLink.range`.\n\t */\n\ttargetSelectionRange?: IRange;\n}\n\n/**\n * @internal\n */\nexport function isLocationLink(thing: any): thing is LocationLink {\n\treturn thing\n\t\t&& URI.isUri((thing as LocationLink).uri)\n\t\t&& Range.isIRange((thing as LocationLink).range)\n\t\t&& (Range.isIRange((thing as LocationLink).originSelectionRange) || Range.isIRange((thing as LocationLink).targetSelectionRange));\n}\n\n/**\n * @internal\n */\nexport function isLocation(thing: any): thing is Location {\n\treturn thing\n\t\t&& URI.isUri((thing as Location).uri)\n\t\t&& Range.isIRange((thing as Location).range);\n}\n\n\nexport type Definition = Location | Location[] | LocationLink[];\n\n/**\n * The definition provider interface defines the contract between extensions and\n * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)\n * and peek definition features.\n */\nexport interface DefinitionProvider {\n\t/**\n\t * Provide the definition of the symbol at the given position and document.\n\t */\n\tprovideDefinition(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;\n}\n\n/**\n * The definition provider interface defines the contract between extensions and\n * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)\n * and peek definition features.\n */\nexport interface DeclarationProvider {\n\t/**\n\t * Provide the declaration of the symbol at the given position and document.\n\t */\n\tprovideDeclaration(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;\n}\n\n/**\n * The implementation provider interface defines the contract between extensions and\n * the go to implementation feature.\n */\nexport interface ImplementationProvider {\n\t/**\n\t * Provide the implementation of the symbol at the given position and document.\n\t */\n\tprovideImplementation(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;\n}\n\n/**\n * The type definition provider interface defines the contract between extensions and\n * the go to type definition feature.\n */\nexport interface TypeDefinitionProvider {\n\t/**\n\t * Provide the type definition of the symbol at the given position and document.\n\t */\n\tprovideTypeDefinition(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;\n}\n\n/**\n * A symbol kind.\n */\nexport const enum SymbolKind {\n\tFile = 0,\n\tModule = 1,\n\tNamespace = 2,\n\tPackage = 3,\n\tClass = 4,\n\tMethod = 5,\n\tProperty = 6,\n\tField = 7,\n\tConstructor = 8,\n\tEnum = 9,\n\tInterface = 10,\n\tFunction = 11,\n\tVariable = 12,\n\tConstant = 13,\n\tString = 14,\n\tNumber = 15,\n\tBoolean = 16,\n\tArray = 17,\n\tObject = 18,\n\tKey = 19,\n\tNull = 20,\n\tEnumMember = 21,\n\tStruct = 22,\n\tEvent = 23,\n\tOperator = 24,\n\tTypeParameter = 25\n}\n\n/**\n * @internal\n */\nexport const symbolKindNames: { [symbol: number]: string } = {\n\t[SymbolKind.Array]: localize('Array', \"array\"),\n\t[SymbolKind.Boolean]: localize('Boolean', \"boolean\"),\n\t[SymbolKind.Class]: localize('Class', \"class\"),\n\t[SymbolKind.Constant]: localize('Constant', \"constant\"),\n\t[SymbolKind.Constructor]: localize('Constructor', \"constructor\"),\n\t[SymbolKind.Enum]: localize('Enum', \"enumeration\"),\n\t[SymbolKind.EnumMember]: localize('EnumMember', \"enumeration member\"),\n\t[SymbolKind.Event]: localize('Event', \"event\"),\n\t[SymbolKind.Field]: localize('Field', \"field\"),\n\t[SymbolKind.File]: localize('File', \"file\"),\n\t[SymbolKind.Function]: localize('Function', \"function\"),\n\t[SymbolKind.Interface]: localize('Interface', \"interface\"),\n\t[SymbolKind.Key]: localize('Key', \"key\"),\n\t[SymbolKind.Method]: localize('Method', \"method\"),\n\t[SymbolKind.Module]: localize('Module', \"module\"),\n\t[SymbolKind.Namespace]: localize('Namespace', \"namespace\"),\n\t[SymbolKind.Null]: localize('Null', \"null\"),\n\t[SymbolKind.Number]: localize('Number', \"number\"),\n\t[SymbolKind.Object]: localize('Object', \"object\"),\n\t[SymbolKind.Operator]: localize('Operator', \"operator\"),\n\t[SymbolKind.Package]: localize('Package', \"package\"),\n\t[SymbolKind.Property]: localize('Property', \"property\"),\n\t[SymbolKind.String]: localize('String', \"string\"),\n\t[SymbolKind.Struct]: localize('Struct', \"struct\"),\n\t[SymbolKind.TypeParameter]: localize('TypeParameter', \"type parameter\"),\n\t[SymbolKind.Variable]: localize('Variable', \"variable\"),\n};\n\n/**\n * @internal\n */\nexport function getAriaLabelForSymbol(symbolName: string, kind: SymbolKind): string {\n\treturn localize('symbolAriaLabel', '{0} ({1})', symbolName, symbolKindNames[kind]);\n}\n\nexport const enum SymbolTag {\n\tDeprecated = 1,\n}\n\n/**\n * @internal\n */\nexport namespace SymbolKinds {\n\n\tconst byKind = new Map<SymbolKind, ThemeIcon>();\n\tbyKind.set(SymbolKind.File, Codicon.symbolFile);\n\tbyKind.set(SymbolKind.Module, Codicon.symbolModule);\n\tbyKind.set(SymbolKind.Namespace, Codicon.symbolNamespace);\n\tbyKind.set(SymbolKind.Package, Codicon.symbolPackage);\n\tbyKind.set(SymbolKind.Class, Codicon.symbolClass);\n\tbyKind.set(SymbolKind.Method, Codicon.symbolMethod);\n\tbyKind.set(SymbolKind.Property, Codicon.symbolProperty);\n\tbyKind.set(SymbolKind.Field, Codicon.symbolField);\n\tbyKind.set(SymbolKind.Constructor, Codicon.symbolConstructor);\n\tbyKind.set(SymbolKind.Enum, Codicon.symbolEnum);\n\tbyKind.set(SymbolKind.Interface, Codicon.symbolInterface);\n\tbyKind.set(SymbolKind.Function, Codicon.symbolFunction);\n\tbyKind.set(SymbolKind.Variable, Codicon.symbolVariable);\n\tbyKind.set(SymbolKind.Constant, Codicon.symbolConstant);\n\tbyKind.set(SymbolKind.String, Codicon.symbolString);\n\tbyKind.set(SymbolKind.Number, Codicon.symbolNumber);\n\tbyKind.set(SymbolKind.Boolean, Codicon.symbolBoolean);\n\tbyKind.set(SymbolKind.Array, Codicon.symbolArray);\n\tbyKind.set(SymbolKind.Object, Codicon.symbolObject);\n\tbyKind.set(SymbolKind.Key, Codicon.symbolKey);\n\tbyKind.set(SymbolKind.Null, Codicon.symbolNull);\n\tbyKind.set(SymbolKind.EnumMember, Codicon.symbolEnumMember);\n\tbyKind.set(SymbolKind.Struct, Codicon.symbolStruct);\n\tbyKind.set(SymbolKind.Event, Codicon.symbolEvent);\n\tbyKind.set(SymbolKind.Operator, Codicon.symbolOperator);\n\tbyKind.set(SymbolKind.TypeParameter, Codicon.symbolTypeParameter);\n\t/**\n\t * @internal\n\t */\n\texport function toIcon(kind: SymbolKind): ThemeIcon {\n\t\tlet icon = byKind.get(kind);\n\t\tif (!icon) {\n\t\t\tconsole.info('No codicon found for SymbolKind ' + kind);\n\t\t\ticon = Codicon.symbolProperty;\n\t\t}\n\t\treturn icon;\n\t}\n\n\tconst byCompletionKind = new Map<SymbolKind, CompletionItemKind>();\n\tbyCompletionKind.set(SymbolKind.File, CompletionItemKind.File);\n\tbyCompletionKind.set(SymbolKind.Module, CompletionItemKind.Module);\n\tbyCompletionKind.set(SymbolKind.Namespace, CompletionItemKind.Module);\n\tbyCompletionKind.set(SymbolKind.Package, CompletionItemKind.Module);\n\tbyCompletionKind.set(SymbolKind.Class, CompletionItemKind.Class);\n\tbyCompletionKind.set(SymbolKind.Method, CompletionItemKind.Method);\n\tbyCompletionKind.set(SymbolKind.Property, CompletionItemKind.Property);\n\tbyCompletionKind.set(SymbolKind.Field, CompletionItemKind.Field);\n\tbyCompletionKind.set(SymbolKind.Constructor, CompletionItemKind.Constructor);\n\tbyCompletionKind.set(SymbolKind.Enum, CompletionItemKind.Enum);\n\tbyCompletionKind.set(SymbolKind.Interface, CompletionItemKind.Interface);\n\tbyCompletionKind.set(SymbolKind.Function, CompletionItemKind.Function);\n\tbyCompletionKind.set(SymbolKind.Variable, CompletionItemKind.Variable);\n\tbyCompletionKind.set(SymbolKind.Constant, CompletionItemKind.Constant);\n\tbyCompletionKind.set(SymbolKind.String, CompletionItemKind.Text);\n\tbyCompletionKind.set(SymbolKind.Number, CompletionItemKind.Value);\n\tbyCompletionKind.set(SymbolKind.Boolean, CompletionItemKind.Value);\n\tbyCompletionKind.set(SymbolKind.Array, CompletionItemKind.Value);\n\tbyCompletionKind.set(SymbolKind.Object, CompletionItemKind.Value);\n\tbyCompletionKind.set(SymbolKind.Key, CompletionItemKind.Keyword);\n\tbyCompletionKind.set(SymbolKind.Null, CompletionItemKind.Value);\n\tbyCompletionKind.set(SymbolKind.EnumMember, CompletionItemKind.EnumMember);\n\tbyCompletionKind.set(SymbolKind.Struct, CompletionItemKind.Struct);\n\tbyCompletionKind.set(SymbolKind.Event, CompletionItemKind.Event);\n\tbyCompletionKind.set(SymbolKind.Operator, CompletionItemKind.Operator);\n\tbyCompletionKind.set(SymbolKind.TypeParameter, CompletionItemKind.TypeParameter);\n\t/**\n\t * @internal\n\t */\n\texport function toCompletionKind(kind: SymbolKind): CompletionItemKind {\n\t\tlet completionKind = byCompletionKind.get(kind);\n\t\tif (completionKind === undefined) {\n\t\t\tconsole.info('No completion kind found for SymbolKind ' + kind);\n\t\t\tcompletionKind = CompletionItemKind.File;\n\t\t}\n\t\treturn completionKind;\n\t}\n}\n\nexport interface DocumentSymbol {\n\tname: string;\n\tdetail: string;\n\tkind: SymbolKind;\n\ttags: ReadonlyArray<SymbolTag>;\n\tcontainerName?: string;\n\trange: IRange;\n\tselectionRange: IRange;\n\tchildren?: DocumentSymbol[];\n}\n\n/**\n * The document symbol provider interface defines the contract between extensions and\n * the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-symbol)-feature.\n */\nexport interface DocumentSymbolProvider {\n\n\tdisplayName?: string;\n\n\t/**\n\t * Provide symbol information for the given document.\n\t */\n\tprovideDocumentSymbols(model: model.ITextModel, token: CancellationToken): ProviderResult<DocumentSymbol[]>;\n}\n\nexport interface TextEdit {\n\trange: IRange;\n\ttext: string;\n\teol?: model.EndOfLineSequence;\n}\n\n/** @internal */\nexport abstract class TextEdit {\n\tstatic asEditOperation(edit: TextEdit): ISingleEditOperation {\n\t\tconst range = Range.lift(edit.range);\n\t\treturn range.isEmpty()\n\t\t\t? EditOperation.insert(range.getStartPosition(), edit.text) // moves marker\n\t\t\t: EditOperation.replace(range, edit.text);\n\t}\n\tstatic isTextEdit(thing: any): thing is TextEdit {\n\t\tconst possibleTextEdit = thing as TextEdit;\n\t\treturn typeof possibleTextEdit.text === 'string' && Range.isIRange(possibleTextEdit.range);\n\t}\n}\n\n/**\n * Interface used to format a model\n */\nexport interface FormattingOptions {\n\t/**\n\t * Size of a tab in spaces.\n\t */\n\ttabSize: number;\n\t/**\n\t * Prefer spaces over tabs.\n\t */\n\tinsertSpaces: boolean;\n}\n/**\n * The document formatting provider interface defines the contract between extensions and\n * the formatting-feature.\n */\nexport interface DocumentFormattingEditProvider {\n\n\t/**\n\t * @internal\n\t */\n\treadonly extensionId?: ExtensionIdentifier;\n\n\treadonly displayName?: string;\n\n\t/**\n\t * Provide formatting edits for a whole document.\n\t */\n\tprovideDocumentFormattingEdits(model: model.ITextModel, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;\n}\n/**\n * The document formatting provider interface defines the contract between extensions and\n * the formatting-feature.\n */\nexport interface DocumentRangeFormattingEditProvider {\n\t/**\n\t * @internal\n\t */\n\treadonly extensionId?: ExtensionIdentifier;\n\n\treadonly displayName?: string;\n\n\t/**\n\t * Provide formatting edits for a range in a document.\n\t *\n\t * The given range is a hint and providers can decide to format a smaller\n\t * or larger range. Often this is done by adjusting the start and end\n\t * of the range to full syntax nodes.\n\t */\n\tprovideDocumentRangeFormattingEdits(model: model.ITextModel, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;\n\n\tprovideDocumentRangesFormattingEdits?(model: model.ITextModel, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;\n}\n/**\n * The document formatting provider interface defines the contract between extensions and\n * the formatting-feature.\n */\nexport interface OnTypeFormattingEditProvider {\n\n\n\t/**\n\t * @internal\n\t */\n\treadonly extensionId?: ExtensionIdentifier;\n\n\tautoFormatTriggerCharacters: string[];\n\n\t/**\n\t * Provide formatting edits after a character has been typed.\n\t *\n\t * The given position and character should hint to the provider\n\t * what range the position to expand to, like find the matching `{`\n\t * when `}` has been entered.\n\t */\n\tprovideOnTypeFormattingEdits(model: model.ITextModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;\n}\n\n/**\n * @internal\n */\nexport interface IInplaceReplaceSupportResult {\n\tvalue: string;\n\trange: IRange;\n}\n\n/**\n * A link inside the editor.\n */\nexport interface ILink {\n\trange: IRange;\n\turl?: URI | string;\n\ttooltip?: string;\n}\n\nexport interface ILinksList {\n\tlinks: ILink[];\n\tdispose?(): void;\n}\n/**\n * A provider of links.\n */\nexport interface LinkProvider {\n\tprovideLinks(model: model.ITextModel, token: CancellationToken): ProviderResult<ILinksList>;\n\tresolveLink?: (link: ILink, token: CancellationToken) => ProviderResult<ILink>;\n}\n\n/**\n * A color in RGBA format.\n */\nexport interface IColor {\n\n\t/**\n\t * The red component in the range [0-1].\n\t */\n\treadonly red: number;\n\n\t/**\n\t * The green component in the range [0-1].\n\t */\n\treadonly green: number;\n\n\t/**\n\t * The blue component in the range [0-1].\n\t */\n\treadonly blue: number;\n\n\t/**\n\t * The alpha component in the range [0-1].\n\t */\n\treadonly alpha: number;\n}\n\n/**\n * String representations for a color\n */\nexport interface IColorPresentation {\n\t/**\n\t * The label of this color presentation. It will be shown on the color\n\t * picker header. By default this is also the text that is inserted when selecting\n\t * this color presentation.\n\t */\n\tlabel: string;\n\t/**\n\t * An {@link TextEdit edit} which is applied to a document when selecting\n\t * this presentation for the color.\n\t */\n\ttextEdit?: TextEdit;\n\t/**\n\t * An optional array of additional {@link TextEdit text edits} that are applied when\n\t * selecting this color presentation.\n\t */\n\tadditionalTextEdits?: TextEdit[];\n}\n\n/**\n * A color range is a range in a text model which represents a color.\n */\nexport interface IColorInformation {\n\n\t/**\n\t * The range within the model.\n\t */\n\trange: IRange;\n\n\t/**\n\t * The color represented in this range.\n\t */\n\tcolor: IColor;\n}\n\n/**\n * A provider of colors for editor models.\n */\nexport interface DocumentColorProvider {\n\t/**\n\t * Provides the color ranges for a specific model.\n\t */\n\tprovideDocumentColors(model: model.ITextModel, token: CancellationToken): ProviderResult<IColorInformation[]>;\n\t/**\n\t * Provide the string representations for a color.\n\t */\n\tprovideColorPresentations(model: model.ITextModel, colorInfo: IColorInformation, token: CancellationToken): ProviderResult<IColorPresentation[]>;\n}\n\nexport interface SelectionRange {\n\trange: IRange;\n}\n\nexport interface SelectionRangeProvider {\n\t/**\n\t * Provide ranges that should be selected from the given position.\n\t */\n\tprovideSelectionRanges(model: model.ITextModel, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[][]>;\n}\n\nexport interface FoldingContext {\n}\n/**\n * A provider of folding ranges for editor models.\n */\nexport interface FoldingRangeProvider {\n\n\t/**\n\t * @internal\n\t */\n\treadonly id?: string;\n\n\t/**\n\t * An optional event to signal that the folding ranges from this provider have changed.\n\t */\n\tonDidChange?: Event<this>;\n\n\t/**\n\t * Provides the folding ranges for a specific model.\n\t */\n\tprovideFoldingRanges(model: model.ITextModel, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;\n}\n\nexport interface FoldingRange {\n\n\t/**\n\t * The one-based start line of the range to fold. The folded area starts after the line's last character.\n\t */\n\tstart: number;\n\n\t/**\n\t * The one-based end line of the range to fold. The folded area ends with the line's last character.\n\t */\n\tend: number;\n\n\t/**\n\t * Describes the {@link FoldingRangeKind Kind} of the folding range such as {@link FoldingRangeKind.Comment Comment} or\n\t * {@link FoldingRangeKind.Region Region}. The kind is used to categorize folding ranges and used by commands\n\t * like 'Fold all comments'. See\n\t * {@link FoldingRangeKind} for an enumeration of standardized kinds.\n\t */\n\tkind?: FoldingRangeKind;\n}\nexport class FoldingRangeKind {\n\t/**\n\t * Kind for folding range representing a comment. The value of the kind is 'comment'.\n\t */\n\tstatic readonly Comment = new FoldingRangeKind('comment');\n\t/**\n\t * Kind for folding range representing a import. The value of the kind is 'imports'.\n\t */\n\tstatic readonly Imports = new FoldingRangeKind('imports');\n\t/**\n\t * Kind for folding range representing regions (for example marked by `#region`, `#endregion`).\n\t * The value of the kind is 'region'.\n\t */\n\tstatic readonly Region = new FoldingRangeKind('region');\n\n\t/**\n\t * Returns a {@link FoldingRangeKind} for the given value.\n\t *\n\t * @param value of the kind.\n\t */\n\tstatic fromValue(value: string) {\n\t\tswitch (value) {\n\t\t\tcase 'comment': return FoldingRangeKind.Comment;\n\t\t\tcase 'imports': return FoldingRangeKind.Imports;\n\t\t\tcase 'region': return FoldingRangeKind.Region;\n\t\t}\n\t\treturn new FoldingRangeKind(value);\n\t}\n\n\t/**\n\t * Creates a new {@link FoldingRangeKind}.\n\t *\n\t * @param value of the kind.\n\t */\n\tpublic constructor(public value: string) {\n\t}\n}\n\n\nexport interface WorkspaceEditMetadata {\n\tneedsConfirmation: boolean;\n\tlabel: string;\n\tdescription?: string;\n\t/**\n\t * @internal\n\t */\n\ticonPath?: ThemeIcon | URI | { light: URI; dark: URI };\n}\n\nexport interface WorkspaceFileEditOptions {\n\toverwrite?: boolean;\n\tignoreIfNotExists?: boolean;\n\tignoreIfExists?: boolean;\n\trecursive?: boolean;\n\tcopy?: boolean;\n\tfolder?: boolean;\n\tskipTrashBin?: boolean;\n\tmaxSize?: number;\n\n\t/**\n\t * @internal\n\t */\n\tcontents?: Promise<VSBuffer>;\n}\n\nexport interface IWorkspaceFileEdit {\n\toldResource?: URI;\n\tnewResource?: URI;\n\toptions?: WorkspaceFileEditOptions;\n\tmetadata?: WorkspaceEditMetadata;\n}\n\nexport interface IWorkspaceTextEdit {\n\tresource: URI;\n\ttextEdit: TextEdit & { insertAsSnippet?: boolean; keepWhitespace?: boolean };\n\tversionId: number | undefined;\n\tmetadata?: WorkspaceEditMetadata;\n}\n\nexport interface WorkspaceEdit {\n\tedits: Array<IWorkspaceTextEdit | IWorkspaceFileEdit | ICustomEdit>;\n}\n\nexport interface ICustomEdit {\n\treadonly resource: URI;\n\treadonly metadata?: WorkspaceEditMetadata;\n\tundo(): Promise<void> | void;\n\tredo(): Promise<void> | void;\n}\n\nexport interface Rejection {\n\trejectReason?: string;\n}\nexport interface RenameLocation {\n\trange: IRange;\n\ttext: string;\n}\n\nexport interface RenameProvider {\n\tprovideRenameEdits(model: model.ITextModel, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit & Rejection>;\n\tresolveRenameLocation?(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<RenameLocation & Rejection>;\n}\n\nexport enum NewSymbolNameTag {\n\tAIGenerated = 1\n}\n\nexport enum NewSymbolNameTriggerKind {\n\tInvoke = 0,\n\tAutomatic = 1,\n}\n\nexport interface NewSymbolName {\n\treadonly newSymbolName: string;\n\treadonly tags?: readonly NewSymbolNameTag[];\n}\n\nexport interface NewSymbolNamesProvider {\n\tsupportsAutomaticNewSymbolNamesTriggerKind?: Promise<boolean | undefined>;\n\tprovideNewSymbolNames(model: model.ITextModel, range: IRange, triggerKind: NewSymbolNameTriggerKind, token: CancellationToken): ProviderResult<NewSymbolName[]>;\n}\n\nexport interface Command {\n\tid: string;\n\ttitle: string;\n\ttooltip?: string;\n\targuments?: any[];\n}\n\n/**\n * @internal\n */\nexport namespace Command {\n\n\t/**\n\t * @internal\n\t */\n\texport function is(obj: any): obj is Command {\n\t\tif (!obj || typeof obj !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (<Command>obj).id === 'string' &&\n\t\t\ttypeof (<Command>obj).title === 'string';\n\t}\n}\n\n/**\n * @internal\n */\nexport interface CommentThreadTemplate {\n\tcontrollerHandle: number;\n\tlabel: string;\n\tacceptInputCommand?: Command;\n\tadditionalCommands?: Command[];\n\tdeleteCommand?: Command;\n}\n\n/**\n * @internal\n */\nexport interface CommentInfo<T = IRange> {\n\textensionId?: string;\n\tthreads: CommentThread<T>[];\n\tpendingCommentThreads?: PendingCommentThread[];\n\tcommentingRanges: CommentingRanges;\n}\n\n\n/**\n * @internal\n */\nexport interface CommentingRangeResourceHint {\n\tschemes: readonly string[];\n}\n\n/**\n * @internal\n */\nexport enum CommentThreadCollapsibleState {\n\t/**\n\t * Determines an item is collapsed\n\t */\n\tCollapsed = 0,\n\t/**\n\t * Determines an item is expanded\n\t */\n\tExpanded = 1\n}\n\n/**\n * @internal\n */\nexport enum CommentThreadState {\n\tUnresolved = 0,\n\tResolved = 1\n}\n\n/**\n * @internal\n */\nexport enum CommentThreadApplicability {\n\tCurrent = 0,\n\tOutdated = 1\n}\n\n/**\n * @internal\n */\nexport interface CommentWidget {\n\tcommentThread: CommentThread;\n\tcomment?: Comment;\n\tinput: string;\n\tonDidChangeInput: Event<string>;\n}\n\n/**\n * @internal\n */\nexport interface CommentInput {\n\tvalue: string;\n\turi: URI;\n}\n\nexport interface CommentThreadRevealOptions {\n\tpreserveFocus: boolean;\n\tfocusReply: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CommentThread<T = IRange> {\n\tisDocumentCommentThread(): this is CommentThread<IRange>;\n\tcommentThreadHandle: number;\n\tcontrollerHandle: number;\n\textensionId?: string;\n\tthreadId: string;\n\tresource: string | null;\n\trange: T | undefined;\n\tlabel: string | undefined;\n\tcontextValue: string | undefined;\n\tcomments: ReadonlyArray<Comment> | undefined;\n\tonDidChangeComments: Event<readonly Comment[] | undefined>;\n\tcollapsibleState?: CommentThreadCollapsibleState;\n\tinitialCollapsibleState?: CommentThreadCollapsibleState;\n\tonDidChangeInitialCollapsibleState: Event<CommentThreadCollapsibleState | undefined>;\n\tstate?: CommentThreadState;\n\tapplicability?: CommentThreadApplicability;\n\tcanReply: boolean | CommentAuthorInformation;\n\tinput?: CommentInput;\n\tonDidChangeInput: Event<CommentInput | undefined>;\n\tonDidChangeLabel: Event<string | undefined>;\n\tonDidChangeCollapsibleState: Event<CommentThreadCollapsibleState | undefined>;\n\tonDidChangeState: Event<CommentThreadState | undefined>;\n\tonDidChangeCanReply: Event<boolean>;\n\tisDisposed: boolean;\n\tisTemplate: boolean;\n}\n\n/**\n * @internal\n */\nexport interface AddedCommentThread<T = IRange> extends CommentThread<T> {\n\teditorId?: string;\n}\n\n/**\n * @internal\n */\n\nexport interface CommentingRanges {\n\treadonly resource: URI;\n\tranges: IRange[];\n\tfileComments: boolean;\n}\n\nexport interface CommentAuthorInformation {\n\tname: string;\n\ticonPath?: UriComponents;\n\n}\n\n/**\n * @internal\n */\nexport interface CommentReaction {\n\treadonly label?: string;\n\treadonly iconPath?: UriComponents;\n\treadonly count?: number;\n\treadonly hasReacted?: boolean;\n\treadonly canEdit?: boolean;\n\treadonly reactors?: readonly string[];\n}\n\n/**\n * @internal\n */\nexport interface CommentOptions {\n\t/**\n\t * An optional string to show on the comment input box when it's collapsed.\n\t */\n\tprompt?: string;\n\n\t/**\n\t * An optional string to show as placeholder in the comment input box when it's focused.\n\t */\n\tplaceHolder?: string;\n}\n\n/**\n * @internal\n */\nexport enum CommentMode {\n\tEditing = 0,\n\tPreview = 1\n}\n\n/**\n * @internal\n */\nexport enum CommentState {\n\tPublished = 0,\n\tDraft = 1\n}\n\n/**\n * @internal\n */\nexport interface Comment {\n\treadonly uniqueIdInThread: number;\n\treadonly body: string | IMarkdownString;\n\treadonly userName: string;\n\treadonly userIconPath?: UriComponents;\n\treadonly contextValue?: string;\n\treadonly commentReactions?: CommentReaction[];\n\treadonly label?: string;\n\treadonly mode?: CommentMode;\n\treadonly timestamp?: string;\n}\n\nexport interface PendingCommentThread {\n\trange: IRange | undefined;\n\turi: URI;\n\tuniqueOwner: string;\n\tisReply: boolean;\n\tcomment: PendingComment;\n}\n\nexport interface PendingComment {\n\tbody: string;\n\tcursor: IPosition;\n}\n\n/**\n * @internal\n */\nexport interface CommentThreadChangedEvent<T> {\n\t/**\n\t * Pending comment threads.\n\t */\n\treadonly pending: PendingCommentThread[];\n\n\t/**\n\t * Added comment threads.\n\t */\n\treadonly added: AddedCommentThread<T>[];\n\n\t/**\n\t * Removed comment threads.\n\t */\n\treadonly removed: CommentThread<T>[];\n\n\t/**\n\t * Changed comment threads.\n\t */\n\treadonly changed: CommentThread<T>[];\n}\n\nexport interface CodeLens {\n\trange: IRange;\n\tid?: string;\n\tcommand?: Command;\n}\n\nexport interface CodeLensList {\n\tlenses: CodeLens[];\n\tdispose?(): void;\n}\n\nexport interface CodeLensProvider {\n\tonDidChange?: Event<this>;\n\tprovideCodeLenses(model: model.ITextModel, token: CancellationToken): ProviderResult<CodeLensList>;\n\tresolveCodeLens?(model: model.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;\n}\n\n\nexport enum InlayHintKind {\n\tType = 1,\n\tParameter = 2,\n}\n\nexport interface InlayHintLabelPart {\n\tlabel: string;\n\ttooltip?: string | IMarkdownString;\n\t// collapsible?: boolean;\n\tcommand?: Command;\n\tlocation?: Location;\n}\n\nexport interface InlayHint {\n\tlabel: string | InlayHintLabelPart[];\n\ttooltip?: string | IMarkdownString;\n\ttextEdits?: TextEdit[];\n\tposition: IPosition;\n\tkind?: InlayHintKind;\n\tpaddingLeft?: boolean;\n\tpaddingRight?: boolean;\n}\n\nexport interface InlayHintList {\n\thints: InlayHint[];\n\tdispose(): void;\n}\n\nexport interface InlayHintsProvider {\n\tdisplayName?: string;\n\tonDidChangeInlayHints?: Event<void>;\n\tprovideInlayHints(model: model.ITextModel, range: Range, token: CancellationToken): ProviderResult<InlayHintList>;\n\tresolveInlayHint?(hint: InlayHint, token: CancellationToken): ProviderResult<InlayHint>;\n}\n\nexport interface SemanticTokensLegend {\n\treadonly tokenTypes: string[];\n\treadonly tokenModifiers: string[];\n}\n\nexport interface SemanticTokens {\n\treadonly resultId?: string;\n\treadonly data: Uint32Array;\n}\n\nexport interface SemanticTokensEdit {\n\treadonly start: number;\n\treadonly deleteCount: number;\n\treadonly data?: Uint32Array;\n}\n\nexport interface SemanticTokensEdits {\n\treadonly resultId?: string;\n\treadonly edits: SemanticTokensEdit[];\n}\n\nexport interface DocumentSemanticTokensProvider {\n\tonDidChange?: Event<void>;\n\tgetLegend(): SemanticTokensLegend;\n\tprovideDocumentSemanticTokens(model: model.ITextModel, lastResultId: string | null, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensEdits>;\n\treleaseDocumentSemanticTokens(resultId: string | undefined): void;\n}\n\nexport interface DocumentRangeSemanticTokensProvider {\n\tgetLegend(): SemanticTokensLegend;\n\tprovideDocumentRangeSemanticTokens(model: model.ITextModel, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;\n}\n\n/**\n * @internal\n */\nexport interface ITokenizationSupportChangedEvent {\n\tchangedLanguages: string[];\n\tchangedColorMap: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ILazyTokenizationSupport<TSupport> {\n\tget tokenizationSupport(): Promise<TSupport | null>;\n}\n\n/**\n * @internal\n */\nexport class LazyTokenizationSupport<TSupport = ITokenizationSupport> implements IDisposable, ILazyTokenizationSupport<TSupport> {\n\tprivate _tokenizationSupport: Promise<TSupport & IDisposable | null> | null = null;\n\n\tconstructor(private readonly createSupport: () => Promise<TSupport & IDisposable | null>) {\n\t}\n\n\tdispose(): void {\n\t\tif (this._tokenizationSupport) {\n\t\t\tthis._tokenizationSupport.then((support) => {\n\t\t\t\tif (support) {\n\t\t\t\t\tsupport.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tget tokenizationSupport(): Promise<TSupport | null> {\n\t\tif (!this._tokenizationSupport) {\n\t\t\tthis._tokenizationSupport = this.createSupport();\n\t\t}\n\t\treturn this._tokenizationSupport;\n\t}\n}\n\n/**\n * @internal\n */\nexport interface ITokenizationRegistry<TSupport> {\n\n\t/**\n\t * An event triggered when:\n\t *  - a tokenization support is registered, unregistered or changed.\n\t *  - the color map is changed.\n\t */\n\tonDidChange: Event<ITokenizationSupportChangedEvent>;\n\n\t/**\n\t * Fire a change event for a language.\n\t * This is useful for languages that embed other languages.\n\t */\n\thandleChange(languageIds: string[]): void;\n\n\t/**\n\t * Register a tokenization support.\n\t */\n\tregister(languageId: string, support: TSupport): IDisposable;\n\n\t/**\n\t * Register a tokenization support factory.\n\t */\n\tregisterFactory(languageId: string, factory: ILazyTokenizationSupport<TSupport>): IDisposable;\n\n\t/**\n\t * Get or create the tokenization support for a language.\n\t * Returns `null` if not found.\n\t */\n\tgetOrCreate(languageId: string): Promise<TSupport | null>;\n\n\t/**\n\t * Get the tokenization support for a language.\n\t * Returns `null` if not found.\n\t */\n\tget(languageId: string): TSupport | null;\n\n\t/**\n\t * Returns false if a factory is still pending.\n\t */\n\tisResolved(languageId: string): boolean;\n\n\t/**\n\t * Set the new color map that all tokens will use in their ColorId binary encoded bits for foreground and background.\n\t */\n\tsetColorMap(colorMap: Color[]): void;\n\n\tgetColorMap(): Color[] | null;\n\n\tgetDefaultBackground(): Color | null;\n}\n\n/**\n * @internal\n */\nexport const TokenizationRegistry: ITokenizationRegistry<ITokenizationSupport> = new TokenizationRegistryImpl();\n\n/**\n * @internal\n */\nexport enum ExternalUriOpenerPriority {\n\tNone = 0,\n\tOption = 1,\n\tDefault = 2,\n\tPreferred = 3,\n}\n\n/**\n * @internal\n */\nexport type DropYieldTo = { readonly kind: HierarchicalKind } | { readonly mimeType: string };\n\n/**\n * @internal\n */\nexport interface DocumentDropEdit {\n\treadonly title: string;\n\treadonly kind: HierarchicalKind | undefined;\n\treadonly handledMimeType?: string;\n\treadonly yieldTo?: readonly DropYieldTo[];\n\tinsertText: string | { readonly snippet: string };\n\tadditionalEdit?: WorkspaceEdit;\n}\n\n/**\n * @internal\n */\nexport interface DocumentDropEditsSession {\n\tedits: readonly DocumentDropEdit[];\n\tdispose(): void;\n}\n\n/**\n * @internal\n */\nexport interface DocumentDropEditProvider {\n\treadonly id?: string;\n\treadonly dropMimeTypes?: readonly string[];\n\treadonly providedDropEditKinds?: readonly HierarchicalKind[];\n\n\tprovideDocumentDropEdits(model: model.ITextModel, position: IPosition, dataTransfer: IReadonlyVSDataTransfer, token: CancellationToken): ProviderResult<DocumentDropEditsSession>;\n\tresolveDocumentDropEdit?(edit: DocumentDropEdit, token: CancellationToken): Promise<DocumentDropEdit>;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { IDisposable } from '../../../base/common/lifecycle.js';\nimport Severity from '../../../base/common/severity.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport interface IMarkerReadOptions {\n\towner?: string;\n\tresource?: URI;\n\tseverities?: number;\n\ttake?: number;\n\tignoreResourceFilters?: boolean;\n}\n\nexport interface IMarkerService {\n\treadonly _serviceBrand: undefined;\n\n\tgetStatistics(): MarkerStatistics;\n\n\tchangeOne(owner: string, resource: URI, markers: IMarkerData[]): void;\n\n\tchangeAll(owner: string, data: IResourceMarker[]): void;\n\n\tremove(owner: string, resources: URI[]): void;\n\n\tread(filter?: IMarkerReadOptions): IMarker[];\n\n\tinstallResourceFilter(resource: URI, reason: string): IDisposable;\n\n\treadonly onMarkerChanged: Event<readonly URI[]>;\n}\n\n/**\n *\n */\nexport interface IRelatedInformation {\n\tresource: URI;\n\tmessage: string;\n\tstartLineNumber: number;\n\tstartColumn: number;\n\tendLineNumber: number;\n\tendColumn: number;\n}\n\nexport const enum MarkerTag {\n\tUnnecessary = 1,\n\tDeprecated = 2\n}\n\nexport enum MarkerSeverity {\n\tHint = 1,\n\tInfo = 2,\n\tWarning = 4,\n\tError = 8,\n}\n\nexport namespace MarkerSeverity {\n\n\texport function compare(a: MarkerSeverity, b: MarkerSeverity): number {\n\t\treturn b - a;\n\t}\n\n\tconst _displayStrings: { [value: number]: string } = Object.create(null);\n\t_displayStrings[MarkerSeverity.Error] = localize('sev.error', \"Error\");\n\t_displayStrings[MarkerSeverity.Warning] = localize('sev.warning', \"Warning\");\n\t_displayStrings[MarkerSeverity.Info] = localize('sev.info', \"Info\");\n\n\texport function toString(a: MarkerSeverity): string {\n\t\treturn _displayStrings[a] || '';\n\t}\n\n\tconst _displayStringsPlural: { [value: number]: string } = Object.create(null);\n\t_displayStringsPlural[MarkerSeverity.Error] = localize('sev.errors', \"Errors\");\n\t_displayStringsPlural[MarkerSeverity.Warning] = localize('sev.warnings', \"Warnings\");\n\t_displayStringsPlural[MarkerSeverity.Info] = localize('sev.infos', \"Infos\");\n\n\texport function toStringPlural(a: MarkerSeverity): string {\n\t\treturn _displayStringsPlural[a] || '';\n\t}\n\n\texport function fromSeverity(severity: Severity): MarkerSeverity {\n\t\tswitch (severity) {\n\t\t\tcase Severity.Error: return MarkerSeverity.Error;\n\t\t\tcase Severity.Warning: return MarkerSeverity.Warning;\n\t\t\tcase Severity.Info: return MarkerSeverity.Info;\n\t\t\tcase Severity.Ignore: return MarkerSeverity.Hint;\n\t\t}\n\t}\n\n\texport function toSeverity(severity: MarkerSeverity): Severity {\n\t\tswitch (severity) {\n\t\t\tcase MarkerSeverity.Error: return Severity.Error;\n\t\t\tcase MarkerSeverity.Warning: return Severity.Warning;\n\t\t\tcase MarkerSeverity.Info: return Severity.Info;\n\t\t\tcase MarkerSeverity.Hint: return Severity.Ignore;\n\t\t}\n\t}\n}\n\n/**\n * A structure defining a problem/warning/etc.\n */\nexport interface IMarkerData {\n\tcode?: string | { value: string; target: URI };\n\tseverity: MarkerSeverity;\n\tmessage: string;\n\tsource?: string;\n\tstartLineNumber: number;\n\tstartColumn: number;\n\tendLineNumber: number;\n\tendColumn: number;\n\tmodelVersionId?: number;\n\trelatedInformation?: IRelatedInformation[];\n\ttags?: MarkerTag[];\n\torigin?: string | undefined;\n}\n\nexport interface IResourceMarker {\n\tresource: URI;\n\tmarker: IMarkerData;\n}\n\nexport interface IMarker {\n\towner: string;\n\tresource: URI;\n\tseverity: MarkerSeverity;\n\tcode?: string | { value: string; target: URI };\n\tmessage: string;\n\tsource?: string;\n\tstartLineNumber: number;\n\tstartColumn: number;\n\tendLineNumber: number;\n\tendColumn: number;\n\tmodelVersionId?: number;\n\trelatedInformation?: IRelatedInformation[];\n\ttags?: MarkerTag[];\n\torigin?: string | undefined;\n}\n\nexport interface MarkerStatistics {\n\terrors: number;\n\twarnings: number;\n\tinfos: number;\n\tunknowns: number;\n}\n\nexport namespace IMarkerData {\n\tconst emptyString = '';\n\texport function makeKey(markerData: IMarkerData): string {\n\t\treturn makeKeyOptionalMessage(markerData, true);\n\t}\n\n\texport function makeKeyOptionalMessage(markerData: IMarkerData, useMessage: boolean): string {\n\t\tconst result: string[] = [emptyString];\n\t\tif (markerData.source) {\n\t\t\tresult.push(markerData.source.replace('¦', '\\\\¦'));\n\t\t} else {\n\t\t\tresult.push(emptyString);\n\t\t}\n\t\tif (markerData.code) {\n\t\t\tif (typeof markerData.code === 'string') {\n\t\t\t\tresult.push(markerData.code.replace('¦', '\\\\¦'));\n\t\t\t} else {\n\t\t\t\tresult.push(markerData.code.value.replace('¦', '\\\\¦'));\n\t\t\t}\n\t\t} else {\n\t\t\tresult.push(emptyString);\n\t\t}\n\t\tif (markerData.severity !== undefined && markerData.severity !== null) {\n\t\t\tresult.push(MarkerSeverity.toString(markerData.severity));\n\t\t} else {\n\t\t\tresult.push(emptyString);\n\t\t}\n\n\t\t// Modifed to not include the message as part of the marker key to work around\n\t\t// https://github.com/microsoft/vscode/issues/77475\n\t\tif (markerData.message && useMessage) {\n\t\t\tresult.push(markerData.message.replace('¦', '\\\\¦'));\n\t\t} else {\n\t\t\tresult.push(emptyString);\n\t\t}\n\t\tif (markerData.startLineNumber !== undefined && markerData.startLineNumber !== null) {\n\t\t\tresult.push(markerData.startLineNumber.toString());\n\t\t} else {\n\t\t\tresult.push(emptyString);\n\t\t}\n\t\tif (markerData.startColumn !== undefined && markerData.startColumn !== null) {\n\t\t\tresult.push(markerData.startColumn.toString());\n\t\t} else {\n\t\t\tresult.push(emptyString);\n\t\t}\n\t\tif (markerData.endLineNumber !== undefined && markerData.endLineNumber !== null) {\n\t\t\tresult.push(markerData.endLineNumber.toString());\n\t\t} else {\n\t\t\tresult.push(emptyString);\n\t\t}\n\t\tif (markerData.endColumn !== undefined && markerData.endColumn !== null) {\n\t\t\tresult.push(markerData.endColumn.toString());\n\t\t} else {\n\t\t\tresult.push(emptyString);\n\t\t}\n\t\tresult.push(emptyString);\n\t\treturn result.join('¦');\n\t}\n}\n\nexport const IMarkerService = createDecorator<IMarkerService>('markerService');\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from './event.js';\nimport { Disposable, IDisposable } from './lifecycle.js';\nimport * as nls from '../../nls.js';\n\nexport interface ITelemetryData {\n\treadonly from?: string;\n\treadonly target?: string;\n\t[key: string]: unknown;\n}\n\nexport type WorkbenchActionExecutedClassification = {\n\tid: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier of the action that was run.' };\n\tfrom: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The name of the component the action was run from.' };\n\tdetail?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Optional details about how the action was run, e.g which keybinding was used.' };\n\towner: 'isidorn';\n\tcomment: 'Provides insight into actions that are executed within the workbench.';\n};\n\nexport type WorkbenchActionExecutedEvent = {\n\tid: string;\n\tfrom: string;\n\tdetail?: string;\n};\n\nexport interface IAction {\n\treadonly id: string;\n\tlabel: string;\n\ttooltip: string;\n\tclass: string | undefined;\n\tenabled: boolean;\n\tchecked?: boolean;\n\trun(...args: unknown[]): unknown;\n}\n\nexport interface IActionRunner extends IDisposable {\n\treadonly onDidRun: Event<IRunEvent>;\n\treadonly onWillRun: Event<IRunEvent>;\n\n\trun(action: IAction, context?: unknown): unknown;\n}\n\nexport interface IActionChangeEvent {\n\treadonly label?: string;\n\treadonly tooltip?: string;\n\treadonly class?: string;\n\treadonly enabled?: boolean;\n\treadonly checked?: boolean;\n}\n\nexport class Action extends Disposable implements IAction {\n\n\tprotected _onDidChange = this._register(new Emitter<IActionChangeEvent>());\n\treadonly onDidChange = this._onDidChange.event;\n\n\tprotected readonly _id: string;\n\tprotected _label: string;\n\tprotected _tooltip: string | undefined;\n\tprotected _cssClass: string | undefined;\n\tprotected _enabled: boolean = true;\n\tprotected _checked?: boolean;\n\tprotected readonly _actionCallback?: (event?: unknown) => unknown;\n\n\tconstructor(id: string, label: string = '', cssClass: string = '', enabled: boolean = true, actionCallback?: (event?: unknown) => unknown) {\n\t\tsuper();\n\t\tthis._id = id;\n\t\tthis._label = label;\n\t\tthis._cssClass = cssClass;\n\t\tthis._enabled = enabled;\n\t\tthis._actionCallback = actionCallback;\n\t}\n\n\tget id(): string {\n\t\treturn this._id;\n\t}\n\n\tget label(): string {\n\t\treturn this._label;\n\t}\n\n\tset label(value: string) {\n\t\tthis._setLabel(value);\n\t}\n\n\tprivate _setLabel(value: string): void {\n\t\tif (this._label !== value) {\n\t\t\tthis._label = value;\n\t\t\tthis._onDidChange.fire({ label: value });\n\t\t}\n\t}\n\n\tget tooltip(): string {\n\t\treturn this._tooltip || '';\n\t}\n\n\tset tooltip(value: string) {\n\t\tthis._setTooltip(value);\n\t}\n\n\tprotected _setTooltip(value: string): void {\n\t\tif (this._tooltip !== value) {\n\t\t\tthis._tooltip = value;\n\t\t\tthis._onDidChange.fire({ tooltip: value });\n\t\t}\n\t}\n\n\tget class(): string | undefined {\n\t\treturn this._cssClass;\n\t}\n\n\tset class(value: string | undefined) {\n\t\tthis._setClass(value);\n\t}\n\n\tprotected _setClass(value: string | undefined): void {\n\t\tif (this._cssClass !== value) {\n\t\t\tthis._cssClass = value;\n\t\t\tthis._onDidChange.fire({ class: value });\n\t\t}\n\t}\n\n\tget enabled(): boolean {\n\t\treturn this._enabled;\n\t}\n\n\tset enabled(value: boolean) {\n\t\tthis._setEnabled(value);\n\t}\n\n\tprotected _setEnabled(value: boolean): void {\n\t\tif (this._enabled !== value) {\n\t\t\tthis._enabled = value;\n\t\t\tthis._onDidChange.fire({ enabled: value });\n\t\t}\n\t}\n\n\tget checked(): boolean | undefined {\n\t\treturn this._checked;\n\t}\n\n\tset checked(value: boolean | undefined) {\n\t\tthis._setChecked(value);\n\t}\n\n\tprotected _setChecked(value: boolean | undefined): void {\n\t\tif (this._checked !== value) {\n\t\t\tthis._checked = value;\n\t\t\tthis._onDidChange.fire({ checked: value });\n\t\t}\n\t}\n\n\tasync run(event?: unknown, data?: ITelemetryData): Promise<void> {\n\t\tif (this._actionCallback) {\n\t\t\tawait this._actionCallback(event);\n\t\t}\n\t}\n}\n\nexport interface IRunEvent {\n\treadonly action: IAction;\n\treadonly error?: Error;\n}\n\nexport class ActionRunner extends Disposable implements IActionRunner {\n\n\tprivate readonly _onWillRun = this._register(new Emitter<IRunEvent>());\n\treadonly onWillRun = this._onWillRun.event;\n\n\tprivate readonly _onDidRun = this._register(new Emitter<IRunEvent>());\n\treadonly onDidRun = this._onDidRun.event;\n\n\tasync run(action: IAction, context?: unknown): Promise<void> {\n\t\tif (!action.enabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._onWillRun.fire({ action });\n\n\t\tlet error: Error | undefined = undefined;\n\t\ttry {\n\t\t\tawait this.runAction(action, context);\n\t\t} catch (e) {\n\t\t\terror = e;\n\t\t}\n\n\t\tthis._onDidRun.fire({ action, error });\n\t}\n\n\tprotected async runAction(action: IAction, context?: unknown): Promise<void> {\n\t\tawait action.run(context);\n\t}\n}\n\nexport class Separator implements IAction {\n\n\t/**\n\t * Joins all non-empty lists of actions with separators.\n\t */\n\tpublic static join(...actionLists: readonly IAction[][]) {\n\t\tlet out: IAction[] = [];\n\t\tfor (const list of actionLists) {\n\t\t\tif (!list.length) {\n\t\t\t\t// skip\n\t\t\t} else if (out.length) {\n\t\t\t\tout = [...out, new Separator(), ...list];\n\t\t\t} else {\n\t\t\t\tout = list;\n\t\t\t}\n\t\t}\n\n\t\treturn out;\n\t}\n\n\tstatic readonly ID = 'vs.actions.separator';\n\n\treadonly id: string = Separator.ID;\n\n\treadonly label: string = '';\n\treadonly tooltip: string = '';\n\treadonly class: string = 'separator';\n\treadonly enabled: boolean = false;\n\treadonly checked: boolean = false;\n\tasync run() { }\n}\n\nexport class SubmenuAction implements IAction {\n\n\treadonly id: string;\n\treadonly label: string;\n\treadonly class: string | undefined;\n\treadonly tooltip: string = '';\n\treadonly enabled: boolean = true;\n\treadonly checked: undefined = undefined;\n\n\tprivate readonly _actions: readonly IAction[];\n\tget actions(): readonly IAction[] { return this._actions; }\n\n\tconstructor(id: string, label: string, actions: readonly IAction[], cssClass?: string) {\n\t\tthis.id = id;\n\t\tthis.label = label;\n\t\tthis.class = cssClass;\n\t\tthis._actions = actions;\n\t}\n\n\tasync run(): Promise<void> { }\n}\n\nexport class EmptySubmenuAction extends Action {\n\n\tstatic readonly ID = 'vs.actions.empty';\n\n\tconstructor() {\n\t\tsuper(EmptySubmenuAction.ID, nls.localize('submenu.empty', '(empty)'), undefined, false);\n\t}\n}\n\nexport function toAction(props: { id: string; label: string; tooltip?: string; enabled?: boolean; checked?: boolean; class?: string; run: Function }): IAction {\n\treturn {\n\t\tid: props.id,\n\t\tlabel: props.label,\n\t\ttooltip: props.tooltip ?? props.label,\n\t\tclass: props.class,\n\t\tenabled: props.enabled ?? true,\n\t\tchecked: props.checked,\n\t\trun: async (...args: unknown[]) => props.run(...args),\n\t};\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { localize } from '../../nls.js';\nimport { Event } from '../../base/common/event.js';\nimport { DeepRequiredNonNullable, assertReturnsDefined } from '../../base/common/types.js';\nimport { URI } from '../../base/common/uri.js';\nimport { Disposable, IDisposable, toDisposable } from '../../base/common/lifecycle.js';\nimport { ICodeEditorViewState, IDiffEditor, IDiffEditorViewState, IEditor, IEditorViewState } from '../../editor/common/editorCommon.js';\nimport { IEditorOptions, IResourceEditorInput, ITextResourceEditorInput, IBaseTextResourceEditorInput, IBaseUntypedEditorInput, ITextEditorOptions } from '../../platform/editor/common/editor.js';\nimport type { EditorInput } from './editor/editorInput.js';\nimport { IInstantiationService, IConstructorSignature, ServicesAccessor, BrandedService } from '../../platform/instantiation/common/instantiation.js';\nimport { IContextKeyService } from '../../platform/contextkey/common/contextkey.js';\nimport { Registry } from '../../platform/registry/common/platform.js';\nimport { IEncodingSupport, ILanguageSupport } from '../services/textfile/common/textfiles.js';\nimport { IEditorGroup } from '../services/editor/common/editorGroupsService.js';\nimport { ICompositeControl, IComposite } from './composite.js';\nimport { FileType, IFileReadLimits, IFileService } from '../../platform/files/common/files.js';\nimport { IPathData } from '../../platform/window/common/window.js';\nimport { IExtUri } from '../../base/common/resources.js';\nimport { Schemas } from '../../base/common/network.js';\nimport { IEditorService } from '../services/editor/common/editorService.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { IErrorWithActions, createErrorWithActions, isErrorWithActions } from '../../base/common/errorMessage.js';\nimport { IAction, toAction } from '../../base/common/actions.js';\nimport Severity from '../../base/common/severity.js';\nimport { IPreferencesService } from '../services/preferences/common/preferences.js';\nimport { IReadonlyEditorGroupModel } from './editor/editorGroupModel.js';\n\n// Static values for editor contributions\nexport const EditorExtensions = {\n\tEditorPane: 'workbench.contributions.editors',\n\tEditorFactory: 'workbench.contributions.editor.inputFactories'\n};\n\n// Static information regarding the text editor\nexport const DEFAULT_EDITOR_ASSOCIATION = {\n\tid: 'default',\n\tdisplayName: localize('promptOpenWith.defaultEditor.displayName', \"Text Editor\"),\n\tproviderDisplayName: localize('builtinProviderDisplayName', \"Built-in\")\n};\n\n/**\n * Side by side editor id.\n */\nexport const SIDE_BY_SIDE_EDITOR_ID = 'workbench.editor.sidebysideEditor';\n\n/**\n * Text diff editor id.\n */\nexport const TEXT_DIFF_EDITOR_ID = 'workbench.editors.textDiffEditor';\n\n/**\n * Binary diff editor id.\n */\nexport const BINARY_DIFF_EDITOR_ID = 'workbench.editors.binaryResourceDiffEditor';\n\nexport interface IEditorDescriptor<T extends IEditorPane> {\n\n\t/**\n\t * The unique type identifier of the editor. All instances\n\t * of the same `IEditorPane` should have the same type\n\t * identifier.\n\t */\n\treadonly typeId: string;\n\n\t/**\n\t * The display name of the editor.\n\t */\n\treadonly name: string;\n\n\t/**\n\t * Instantiates the editor pane using the provided services.\n\t */\n\tinstantiate(instantiationService: IInstantiationService, group: IEditorGroup): T;\n\n\t/**\n\t * Whether the descriptor is for the provided editor pane.\n\t */\n\tdescribes(editorPane: T): boolean;\n}\n\n/**\n * The editor pane is the container for workbench editors.\n */\nexport interface IEditorPane extends IComposite {\n\n\t/**\n\t * An event to notify when the `IEditorControl` in this\n\t * editor pane changes.\n\t *\n\t * This can be used for editor panes that are a compound\n\t * of multiple editor controls to signal that the active\n\t * editor control has changed when the user clicks around.\n\t */\n\treadonly onDidChangeControl: Event<void>;\n\n\t/**\n\t * An optional event to notify when the selection inside the editor\n\t * pane changed in case the editor has a selection concept.\n\t *\n\t * For example, in a text editor pane, the selection changes whenever\n\t * the cursor is set to a new location.\n\t */\n\treadonly onDidChangeSelection?: Event<IEditorPaneSelectionChangeEvent>;\n\n\t/**\n\t * An optional event to notify when the editor inside the pane scrolled\n\t */\n\treadonly onDidChangeScroll?: Event<void>;\n\n\t/**\n\t * The assigned input of this editor.\n\t */\n\treadonly input: EditorInput | undefined;\n\n\t/**\n\t * The assigned options of the editor.\n\t */\n\treadonly options: IEditorOptions | undefined;\n\n\t/**\n\t * The assigned group this editor is showing in.\n\t */\n\treadonly group: IEditorGroup;\n\n\t/**\n\t * The minimum width of this editor.\n\t */\n\treadonly minimumWidth: number;\n\n\t/**\n\t * The maximum width of this editor.\n\t */\n\treadonly maximumWidth: number;\n\n\t/**\n\t * The minimum height of this editor.\n\t */\n\treadonly minimumHeight: number;\n\n\t/**\n\t * The maximum height of this editor.\n\t */\n\treadonly maximumHeight: number;\n\n\t/**\n\t * An event to notify whenever minimum/maximum width/height changes.\n\t */\n\treadonly onDidChangeSizeConstraints: Event<{ width: number; height: number } | undefined>;\n\n\t/**\n\t * The context key service for this editor. Should be overridden by\n\t * editors that have their own ScopedContextKeyService\n\t */\n\treadonly scopedContextKeyService: IContextKeyService | undefined;\n\n\t/**\n\t * Returns the underlying control of this editor. Callers need to cast\n\t * the control to a specific instance as needed, e.g. by using the\n\t * `isCodeEditor` helper method to access the text code editor.\n\t *\n\t * Use the `onDidChangeControl` event to track whenever the control\n\t * changes.\n\t */\n\tgetControl(): IEditorControl | undefined;\n\n\t/**\n\t * Returns the current view state of the editor if any.\n\t *\n\t * This method is optional to override for the editor pane\n\t * and should only be overridden when the pane can deal with\n\t * `IEditorOptions.viewState` to be applied when opening.\n\t */\n\tgetViewState(): object | undefined;\n\n\t/**\n\t * An optional method to return the current selection in\n\t * the editor pane in case the editor pane has a selection\n\t * concept.\n\t *\n\t * Clients of this method will typically react to the\n\t * `onDidChangeSelection` event to receive the current\n\t * selection as needed.\n\t */\n\tgetSelection?(): IEditorPaneSelection | undefined;\n\n\t/**\n\t * An optional method to return the current scroll position\n\t * of an editor inside the pane.\n\t *\n\t * Clients of this method will typically react to the\n\t * `onDidChangeScroll` event to receive the current\n\t * scroll position as needed.\n\t */\n\tgetScrollPosition?(): IEditorPaneScrollPosition;\n\n\t/**\n\t * An optional method to set the current scroll position\n\t * of an editor inside the pane.\n\t */\n\tsetScrollPosition?(scrollPosition: IEditorPaneScrollPosition): void;\n\n\t/**\n\t * Finds out if this editor is visible or not.\n\t */\n\tisVisible(): boolean;\n}\n\nexport interface IEditorPaneSelectionChangeEvent {\n\n\t/**\n\t * More details for how the selection was made.\n\t */\n\treason: EditorPaneSelectionChangeReason;\n}\n\nexport const enum EditorPaneSelectionChangeReason {\n\n\t/**\n\t * The selection was changed as a result of a programmatic\n\t * method invocation.\n\t *\n\t * For a text editor pane, this for example can be a selection\n\t * being restored from previous view state automatically.\n\t */\n\tPROGRAMMATIC = 1,\n\n\t/**\n\t * The selection was changed by the user.\n\t *\n\t * This typically means the user changed the selection\n\t * with mouse or keyboard.\n\t */\n\tUSER,\n\n\t/**\n\t * The selection was changed as a result of editing in\n\t * the editor pane.\n\t *\n\t * For a text editor pane, this for example can be typing\n\t * in the text of the editor pane.\n\t */\n\tEDIT,\n\n\t/**\n\t * The selection was changed as a result of a navigation\n\t * action.\n\t *\n\t * For a text editor pane, this for example can be a result\n\t * of selecting an entry from a text outline view.\n\t */\n\tNAVIGATION,\n\n\t/**\n\t * The selection was changed as a result of a jump action\n\t * from within the editor pane.\n\t *\n\t * For a text editor pane, this for example can be a result\n\t * of invoking \"Go to definition\" from a symbol.\n\t */\n\tJUMP\n}\n\nexport interface IEditorPaneSelection {\n\n\t/**\n\t * Asks to compare this selection to another selection.\n\t */\n\tcompare(otherSelection: IEditorPaneSelection): EditorPaneSelectionCompareResult;\n\n\t/**\n\t * Asks to massage the provided `options` in a way\n\t * that the selection can be restored when the editor\n\t * is opened again.\n\t *\n\t * For a text editor this means to apply the selected\n\t * line and column as text editor options.\n\t */\n\trestore(options: IEditorOptions): IEditorOptions;\n\n\t/**\n\t * Only used for logging to print more info about the selection.\n\t */\n\tlog?(): string;\n}\n\nexport const enum EditorPaneSelectionCompareResult {\n\n\t/**\n\t * The selections are identical.\n\t */\n\tIDENTICAL = 1,\n\n\t/**\n\t * The selections are similar.\n\t *\n\t * For a text editor this can mean that the one\n\t * selection is in close proximity to the other\n\t * selection.\n\t *\n\t * Upstream clients may decide in this case to\n\t * not treat the selection different from the\n\t * previous one because it is not distinct enough.\n\t */\n\tSIMILAR = 2,\n\n\t/**\n\t * The selections are entirely different.\n\t */\n\tDIFFERENT = 3\n}\n\nexport interface IEditorPaneWithSelection extends IEditorPane {\n\n\treadonly onDidChangeSelection: Event<IEditorPaneSelectionChangeEvent>;\n\n\tgetSelection(): IEditorPaneSelection | undefined;\n}\n\nexport function isEditorPaneWithSelection(editorPane: IEditorPane | undefined): editorPane is IEditorPaneWithSelection {\n\tconst candidate = editorPane as IEditorPaneWithSelection | undefined;\n\n\treturn !!candidate && typeof candidate.getSelection === 'function' && !!candidate.onDidChangeSelection;\n}\n\nexport interface IEditorPaneWithScrolling extends IEditorPane {\n\n\treadonly onDidChangeScroll: Event<void>;\n\n\tgetScrollPosition(): IEditorPaneScrollPosition;\n\n\tsetScrollPosition(position: IEditorPaneScrollPosition): void;\n}\n\nexport function isEditorPaneWithScrolling(editorPane: IEditorPane | undefined): editorPane is IEditorPaneWithScrolling {\n\tconst candidate = editorPane as IEditorPaneWithScrolling | undefined;\n\n\treturn !!candidate && typeof candidate.getScrollPosition === 'function' && typeof candidate.setScrollPosition === 'function' && !!candidate.onDidChangeScroll;\n}\n\n/**\n * Scroll position of a pane\n */\nexport interface IEditorPaneScrollPosition {\n\treadonly scrollTop: number;\n\treadonly scrollLeft?: number;\n}\n\n/**\n * Try to retrieve the view state for the editor pane that\n * has the provided editor input opened, if at all.\n *\n * This method will return `undefined` if the editor input\n * is not visible in any of the opened editor panes.\n */\nexport function findViewStateForEditor(input: EditorInput, group: GroupIdentifier, editorService: IEditorService): object | undefined {\n\tfor (const editorPane of editorService.visibleEditorPanes) {\n\t\tif (editorPane.group.id === group && input.matches(editorPane.input)) {\n\t\t\treturn editorPane.getViewState();\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Overrides `IEditorPane` where `input` and `group` are known to be set.\n */\nexport interface IVisibleEditorPane extends IEditorPane {\n\treadonly input: EditorInput;\n}\n\n/**\n * The text editor pane is the container for workbench text editors.\n */\nexport interface ITextEditorPane extends IEditorPane {\n\n\t/**\n\t * Returns the underlying text editor widget of this editor.\n\t */\n\tgetControl(): IEditor | undefined;\n}\n\n/**\n * The text editor pane is the container for workbench text diff editors.\n */\nexport interface ITextDiffEditorPane extends IEditorPane {\n\n\t/**\n\t * Returns the underlying text diff editor widget of this editor.\n\t */\n\tgetControl(): IDiffEditor | undefined;\n}\n\n/**\n * Marker interface for the control inside an editor pane. Callers\n * have to cast the control to work with it, e.g. via methods\n * such as `isCodeEditor(control)`.\n */\nexport interface IEditorControl extends ICompositeControl { }\n\nexport interface IFileEditorFactory {\n\n\t/**\n\t * The type identifier of the file editor.\n\t */\n\ttypeId: string;\n\n\t/**\n\t * Creates new editor capable of showing files.\n\t */\n\tcreateFileEditor(resource: URI, preferredResource: URI | undefined, preferredName: string | undefined, preferredDescription: string | undefined, preferredEncoding: string | undefined, preferredLanguageId: string | undefined, preferredContents: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;\n\n\t/**\n\t * Check if the provided object is a file editor.\n\t */\n\tisFileEditor(obj: unknown): obj is IFileEditorInput;\n}\n\nexport interface IEditorFactoryRegistry {\n\n\t/**\n\t * Registers the file editor factory to use for file editors.\n\t */\n\tregisterFileEditorFactory(factory: IFileEditorFactory): void;\n\n\t/**\n\t * Returns the file editor factory to use for file editors.\n\t */\n\tgetFileEditorFactory(): IFileEditorFactory;\n\n\t/**\n\t * Registers a editor serializer for the given editor to the registry.\n\t * An editor serializer is capable of serializing and deserializing editor\n\t * from string data.\n\t *\n\t * @param editorTypeId the type identifier of the editor\n\t * @param serializer the editor serializer for serialization/deserialization\n\t */\n\tregisterEditorSerializer<Services extends BrandedService[]>(editorTypeId: string, ctor: { new(...Services: Services): IEditorSerializer }): IDisposable;\n\n\t/**\n\t * Returns the editor serializer for the given editor.\n\t */\n\tgetEditorSerializer(editor: EditorInput): IEditorSerializer | undefined;\n\tgetEditorSerializer(editorTypeId: string): IEditorSerializer | undefined;\n\n\t/**\n\t * Starts the registry by providing the required services.\n\t */\n\tstart(accessor: ServicesAccessor): void;\n}\n\nexport interface IEditorSerializer {\n\n\t/**\n\t * Determines whether the given editor can be serialized by the serializer.\n\t */\n\tcanSerialize(editor: EditorInput): boolean;\n\n\t/**\n\t * Returns a string representation of the provided editor that contains enough information\n\t * to deserialize back to the original editor from the deserialize() method.\n\t */\n\tserialize(editor: EditorInput): string | undefined;\n\n\t/**\n\t * Returns an editor from the provided serialized form of the editor. This form matches\n\t * the value returned from the serialize() method.\n\t */\n\tdeserialize(instantiationService: IInstantiationService, serializedEditor: string): EditorInput | undefined;\n}\n\nexport interface IUntitledTextResourceEditorInput extends IBaseTextResourceEditorInput {\n\n\t/**\n\t * Optional resource for the untitled editor. Depending on the value, the editor:\n\t * - should get a unique name if `undefined` (for example `Untitled-1`)\n\t * - should use the resource directly if the scheme is `untitled:`\n\t * - should change the scheme to `untitled:` otherwise and assume an associated path\n\t *\n\t * Untitled editors with associated path behave slightly different from other untitled\n\t * editors:\n\t * - they are dirty right when opening\n\t * - they will not ask for a file path when saving but use the associated path\n\t */\n\treadonly resource: URI | undefined;\n}\n\n/**\n * A resource side by side editor input shows 2 editors side by side but\n * without highlighting any differences.\n *\n * Note: both sides will be resolved as editor individually. As such, it is\n * possible to show 2 different editors side by side.\n *\n * @see {@link IResourceDiffEditorInput} for a variant that compares 2 editors.\n */\nexport interface IResourceSideBySideEditorInput extends IBaseUntypedEditorInput {\n\n\t/**\n\t * The right hand side editor to open inside a side-by-side editor.\n\t */\n\treadonly primary: Omit<IResourceEditorInput, 'options'> | Omit<ITextResourceEditorInput, 'options'> | Omit<IUntitledTextResourceEditorInput, 'options'>;\n\n\t/**\n\t * The left hand side editor to open inside a side-by-side editor.\n\t */\n\treadonly secondary: Omit<IResourceEditorInput, 'options'> | Omit<ITextResourceEditorInput, 'options'> | Omit<IUntitledTextResourceEditorInput, 'options'>;\n}\n\n/**\n * A resource diff editor input compares 2 editors side by side\n * highlighting the differences.\n *\n * Note: both sides must be resolvable to the same editor, or\n * a text based presentation will be used as fallback.\n */\nexport interface IResourceDiffEditorInput extends IBaseUntypedEditorInput {\n\n\t/**\n\t * The left hand side editor to open inside a diff editor.\n\t */\n\treadonly original: Omit<IResourceEditorInput, 'options'> | Omit<ITextResourceEditorInput, 'options'> | Omit<IUntitledTextResourceEditorInput, 'options'>;\n\n\t/**\n\t * The right hand side editor to open inside a diff editor.\n\t */\n\treadonly modified: Omit<IResourceEditorInput, 'options'> | Omit<ITextResourceEditorInput, 'options'> | Omit<IUntitledTextResourceEditorInput, 'options'>;\n}\n\nexport interface ITextResourceDiffEditorInput extends IBaseTextResourceEditorInput {\n\n\t/**\n\t * The left hand side text editor to open inside a diff editor.\n\t */\n\treadonly original: Omit<ITextResourceEditorInput, 'options'> | Omit<IUntitledTextResourceEditorInput, 'options'>;\n\n\t/**\n\t * The right hand side text editor to open inside a diff editor.\n\t */\n\treadonly modified: Omit<ITextResourceEditorInput, 'options'> | Omit<IUntitledTextResourceEditorInput, 'options'>;\n}\n\n/**\n * A resource list diff editor input compares multiple resources side by side\n * highlighting the differences.\n */\nexport interface IResourceMultiDiffEditorInput extends IBaseUntypedEditorInput {\n\t/**\n\t * A unique identifier of this multi diff editor input.\n\t * If a second multi diff editor with the same uri is opened, the existing one is revealed instead (even if the resources list is different!).\n\t */\n\treadonly multiDiffSource?: URI;\n\n\t/**\n\t * The list of resources to compare.\n\t * If not set, the resources are dynamically derived from the {@link multiDiffSource}.\n\t */\n\treadonly resources?: IMultiDiffEditorResource[];\n\n\t/**\n\t * Whether the editor should be serialized and stored for subsequent sessions.\n\t */\n\treadonly isTransient?: boolean;\n}\n\nexport interface IMultiDiffEditorResource extends IResourceDiffEditorInput {\n\treadonly goToFileResource?: URI;\n}\nexport type IResourceMergeEditorInputSide = (Omit<IResourceEditorInput, 'options'> | Omit<ITextResourceEditorInput, 'options'>) & { detail?: string };\n\n/**\n * A resource merge editor input compares multiple editors\n * highlighting the differences for merging.\n *\n * Note: all sides must be resolvable to the same editor, or\n * a text based presentation will be used as fallback.\n */\nexport interface IResourceMergeEditorInput extends IBaseUntypedEditorInput {\n\n\t/**\n\t * The one changed version of the file.\n\t */\n\treadonly input1: IResourceMergeEditorInputSide;\n\n\t/**\n\t * The second changed version of the file.\n\t */\n\treadonly input2: IResourceMergeEditorInputSide;\n\n\t/**\n\t * The base common ancestor of the file to merge.\n\t */\n\treadonly base: Omit<IResourceEditorInput, 'options'> | Omit<ITextResourceEditorInput, 'options'>;\n\n\t/**\n\t * The resulting output of the merge.\n\t */\n\treadonly result: Omit<IResourceEditorInput, 'options'> | Omit<ITextResourceEditorInput, 'options'>;\n}\n\nexport function isResourceEditorInput(editor: unknown): editor is IResourceEditorInput {\n\tif (isEditorInput(editor)) {\n\t\treturn false; // make sure to not accidentally match on typed editor inputs\n\t}\n\n\tconst candidate = editor as IResourceEditorInput | undefined;\n\n\treturn URI.isUri(candidate?.resource);\n}\n\nexport function isResourceDiffEditorInput(editor: unknown): editor is IResourceDiffEditorInput {\n\tif (isEditorInput(editor)) {\n\t\treturn false; // make sure to not accidentally match on typed editor inputs\n\t}\n\n\tconst candidate = editor as IResourceDiffEditorInput | undefined;\n\n\treturn candidate?.original !== undefined && candidate.modified !== undefined;\n}\n\nexport function isResourceMultiDiffEditorInput(editor: unknown): editor is IResourceMultiDiffEditorInput {\n\tif (isEditorInput(editor)) {\n\t\treturn false; // make sure to not accidentally match on typed editor inputs\n\t}\n\n\tconst candidate = editor as IResourceMultiDiffEditorInput | undefined;\n\tif (!candidate) {\n\t\treturn false;\n\t}\n\tif (candidate.resources && !Array.isArray(candidate.resources)) {\n\t\treturn false;\n\t}\n\n\treturn !!candidate.resources || !!candidate.multiDiffSource;\n}\n\nexport function isResourceSideBySideEditorInput(editor: unknown): editor is IResourceSideBySideEditorInput {\n\tif (isEditorInput(editor)) {\n\t\treturn false; // make sure to not accidentally match on typed editor inputs\n\t}\n\n\tif (isResourceDiffEditorInput(editor)) {\n\t\treturn false; // make sure to not accidentally match on diff editors\n\t}\n\n\tconst candidate = editor as IResourceSideBySideEditorInput | undefined;\n\n\treturn candidate?.primary !== undefined && candidate.secondary !== undefined;\n}\n\nexport function isUntitledResourceEditorInput(editor: unknown): editor is IUntitledTextResourceEditorInput {\n\tif (isEditorInput(editor)) {\n\t\treturn false; // make sure to not accidentally match on typed editor inputs\n\t}\n\n\tconst candidate = editor as IUntitledTextResourceEditorInput | undefined;\n\tif (!candidate) {\n\t\treturn false;\n\t}\n\n\treturn candidate.resource === undefined || candidate.resource.scheme === Schemas.untitled || candidate.forceUntitled === true;\n}\n\nexport function isResourceMergeEditorInput(editor: unknown): editor is IResourceMergeEditorInput {\n\tif (isEditorInput(editor)) {\n\t\treturn false; // make sure to not accidentally match on typed editor inputs\n\t}\n\n\tconst candidate = editor as IResourceMergeEditorInput | undefined;\n\n\treturn URI.isUri(candidate?.base?.resource) && URI.isUri(candidate?.input1?.resource) && URI.isUri(candidate?.input2?.resource) && URI.isUri(candidate?.result?.resource);\n}\n\nexport const enum Verbosity {\n\tSHORT,\n\tMEDIUM,\n\tLONG\n}\n\nexport const enum SaveReason {\n\n\t/**\n\t * Explicit user gesture.\n\t */\n\tEXPLICIT = 1,\n\n\t/**\n\t * Auto save after a timeout.\n\t */\n\tAUTO = 2,\n\n\t/**\n\t * Auto save after editor focus change.\n\t */\n\tFOCUS_CHANGE = 3,\n\n\t/**\n\t * Auto save after window change.\n\t */\n\tWINDOW_CHANGE = 4\n}\n\nexport type SaveSource = string;\n\ninterface ISaveSourceDescriptor {\n\tsource: SaveSource;\n\tlabel: string;\n}\n\nclass SaveSourceFactory {\n\n\tprivate readonly mapIdToSaveSource = new Map<SaveSource, ISaveSourceDescriptor>();\n\n\t/**\n\t * Registers a `SaveSource` with an identifier and label\n\t * to the registry so that it can be used in save operations.\n\t */\n\tregisterSource(id: string, label: string): SaveSource {\n\t\tlet sourceDescriptor = this.mapIdToSaveSource.get(id);\n\t\tif (!sourceDescriptor) {\n\t\t\tsourceDescriptor = { source: id, label };\n\t\t\tthis.mapIdToSaveSource.set(id, sourceDescriptor);\n\t\t}\n\n\t\treturn sourceDescriptor.source;\n\t}\n\n\tgetSourceLabel(source: SaveSource): string {\n\t\treturn this.mapIdToSaveSource.get(source)?.label ?? source;\n\t}\n}\n\nexport const SaveSourceRegistry = new SaveSourceFactory();\n\nexport interface ISaveOptions {\n\n\t/**\n\t * An indicator how the save operation was triggered.\n\t */\n\treason?: SaveReason;\n\n\t/**\n\t * An indicator about the source of the save operation.\n\t *\n\t * Must use `SaveSourceRegistry.registerSource()` to obtain.\n\t */\n\treadonly source?: SaveSource;\n\n\t/**\n\t * Forces to save the contents of the working copy\n\t * again even if the working copy is not dirty.\n\t */\n\treadonly force?: boolean;\n\n\t/**\n\t * Instructs the save operation to skip any save participants.\n\t */\n\treadonly skipSaveParticipants?: boolean;\n\n\t/**\n\t * A hint as to which file systems should be available for saving.\n\t */\n\treadonly availableFileSystems?: string[];\n}\n\nexport interface IRevertOptions {\n\n\t/**\n\t * Forces to load the contents of the working copy\n\t * again even if the working copy is not dirty.\n\t */\n\treadonly force?: boolean;\n\n\t/**\n\t * A soft revert will clear dirty state of a working copy\n\t * but will not attempt to load it from its persisted state.\n\t *\n\t * This option may be used in scenarios where an editor is\n\t * closed and where we do not require to load the contents.\n\t */\n\treadonly soft?: boolean;\n}\n\nexport interface IMoveResult {\n\teditor: EditorInput | IUntypedEditorInput;\n\toptions?: IEditorOptions;\n}\n\nexport const enum EditorInputCapabilities {\n\n\t/**\n\t * Signals no specific capability for the input.\n\t */\n\tNone = 0,\n\n\t/**\n\t * Signals that the input is readonly.\n\t */\n\tReadonly = 1 << 1,\n\n\t/**\n\t * Signals that the input is untitled.\n\t */\n\tUntitled = 1 << 2,\n\n\t/**\n\t * Signals that the input can only be shown in one group\n\t * and not be split into multiple groups.\n\t */\n\tSingleton = 1 << 3,\n\n\t/**\n\t * Signals that the input requires workspace trust.\n\t */\n\tRequiresTrust = 1 << 4,\n\n\t/**\n\t * Signals that the editor can split into 2 in the same\n\t * editor group.\n\t */\n\tCanSplitInGroup = 1 << 5,\n\n\t/**\n\t * Signals that the editor wants its description to be\n\t * visible when presented to the user. By default, a UI\n\t * component may decide to hide the description portion\n\t * for brevity.\n\t */\n\tForceDescription = 1 << 6,\n\n\t/**\n\t * Signals that the editor supports dropping into the\n\t * editor by holding shift.\n\t */\n\tCanDropIntoEditor = 1 << 7,\n\n\t/**\n\t * Signals that the editor is composed of multiple editors\n\t * within.\n\t */\n\tMultipleEditors = 1 << 8,\n\n\t/**\n\t * Signals that the editor cannot be in a dirty state\n\t * and may still have unsaved changes\n\t */\n\tScratchpad = 1 << 9\n}\n\nexport type IUntypedEditorInput = IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput | IResourceDiffEditorInput | IResourceMultiDiffEditorInput | IResourceSideBySideEditorInput | IResourceMergeEditorInput;\n\nexport abstract class AbstractEditorInput extends Disposable {\n\t// Marker class for implementing `isEditorInput`\n}\n\nexport function isEditorInput(editor: unknown): editor is EditorInput {\n\treturn editor instanceof AbstractEditorInput;\n}\n\nexport interface EditorInputWithPreferredResource {\n\n\t/**\n\t * An editor may provide an additional preferred resource alongside\n\t * the `resource` property. While the `resource` property serves as\n\t * unique identifier of the editor that should be used whenever we\n\t * compare to other editors, the `preferredResource` should be used\n\t * in places where e.g. the resource is shown to the user.\n\t *\n\t * For example: on Windows and macOS, the same URI with different\n\t * casing may point to the same file. The editor may chose to\n\t * \"normalize\" the URIs so that only one editor opens for different\n\t * URIs. But when displaying the editor label to the user, the\n\t * preferred URI should be used.\n\t *\n\t * Not all editors have a `preferredResource`. The `EditorResourceAccessor`\n\t * utility can be used to always get the right resource without having\n\t * to do instanceof checks.\n\t */\n\treadonly preferredResource: URI;\n}\n\nfunction isEditorInputWithPreferredResource(editor: unknown): editor is EditorInputWithPreferredResource {\n\tconst candidate = editor as EditorInputWithPreferredResource | undefined;\n\n\treturn URI.isUri(candidate?.preferredResource);\n}\n\nexport interface ISideBySideEditorInput extends EditorInput {\n\n\t/**\n\t * The primary editor input is shown on the right hand side.\n\t */\n\tprimary: EditorInput;\n\n\t/**\n\t * The secondary editor input is shown on the left hand side.\n\t */\n\tsecondary: EditorInput;\n}\n\nexport function isSideBySideEditorInput(editor: unknown): editor is ISideBySideEditorInput {\n\tconst candidate = editor as ISideBySideEditorInput | undefined;\n\n\treturn isEditorInput(candidate?.primary) && isEditorInput(candidate?.secondary);\n}\n\nexport interface IDiffEditorInput extends EditorInput {\n\n\t/**\n\t * The modified (primary) editor input is shown on the right hand side.\n\t */\n\tmodified: EditorInput;\n\n\t/**\n\t * The original (secondary) editor input is shown on the left hand side.\n\t */\n\toriginal: EditorInput;\n}\n\nexport function isDiffEditorInput(editor: unknown): editor is IDiffEditorInput {\n\tconst candidate = editor as IDiffEditorInput | undefined;\n\n\treturn isEditorInput(candidate?.modified) && isEditorInput(candidate?.original);\n}\n\nexport interface IUntypedFileEditorInput extends ITextResourceEditorInput {\n\n\t/**\n\t * A marker to create a `IFileEditorInput` from this untyped input.\n\t */\n\tforceFile: true;\n}\n\n/**\n * This is a tagging interface to declare an editor input being capable of dealing with files. It is only used in the editor registry\n * to register this kind of input to the platform.\n */\nexport interface IFileEditorInput extends EditorInput, IEncodingSupport, ILanguageSupport, EditorInputWithPreferredResource {\n\n\t/**\n\t * Gets the resource this file input is about. This will always be the\n\t * canonical form of the resource, so it may differ from the original\n\t * resource that was provided to create the input. Use `preferredResource`\n\t * for the form as it was created.\n\t */\n\treadonly resource: URI;\n\n\t/**\n\t * Sets the preferred resource to use for this file input.\n\t */\n\tsetPreferredResource(preferredResource: URI): void;\n\n\t/**\n\t * Sets the preferred name to use for this file input.\n\t *\n\t * Note: for certain file schemes the input may decide to ignore this\n\t * name and use our standard naming. Specifically for schemes we own,\n\t * we do not let others override the name.\n\t */\n\tsetPreferredName(name: string): void;\n\n\t/**\n\t * Sets the preferred description to use for this file input.\n\t *\n\t * Note: for certain file schemes the input may decide to ignore this\n\t * description and use our standard naming. Specifically for schemes we own,\n\t * we do not let others override the description.\n\t */\n\tsetPreferredDescription(description: string): void;\n\n\t/**\n\t * Sets the preferred encoding to use for this file input.\n\t */\n\tsetPreferredEncoding(encoding: string): void;\n\n\t/**\n\t * Sets the preferred language id to use for this file input.\n\t */\n\tsetPreferredLanguageId(languageId: string): void;\n\n\t/**\n\t * Sets the preferred contents to use for this file input.\n\t */\n\tsetPreferredContents(contents: string): void;\n\n\t/**\n\t * Forces this file input to open as binary instead of text.\n\t */\n\tsetForceOpenAsBinary(): void;\n\n\t/**\n\t * Figure out if the file input has been resolved or not.\n\t */\n\tisResolved(): boolean;\n}\n\nexport interface IFileLimitedEditorInputOptions extends IEditorOptions {\n\n\t/**\n\t * If provided, the size of the file will be checked against the limits\n\t * and an error will be thrown if any limit is exceeded.\n\t */\n\treadonly limits?: IFileReadLimits;\n}\n\nexport interface IFileEditorInputOptions extends ITextEditorOptions, IFileLimitedEditorInputOptions { }\n\nexport function createTooLargeFileError(group: IEditorGroup, input: EditorInput, options: IEditorOptions | undefined, message: string, preferencesService: IPreferencesService): Error {\n\treturn createEditorOpenError(message, [\n\t\ttoAction({\n\t\t\tid: 'workbench.action.openLargeFile', label: localize('openLargeFile', \"Open Anyway\"), run: () => {\n\t\t\t\tconst fileEditorOptions: IFileEditorInputOptions = {\n\t\t\t\t\t...options,\n\t\t\t\t\tlimits: {\n\t\t\t\t\t\tsize: Number.MAX_VALUE\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tgroup.openEditor(input, fileEditorOptions);\n\t\t\t}\n\t\t}),\n\t\ttoAction({\n\t\t\tid: 'workbench.action.configureEditorLargeFileConfirmation', label: localize('configureEditorLargeFileConfirmation', \"Configure Limit\"), run: () => {\n\t\t\t\treturn preferencesService.openUserSettings({ query: 'workbench.editorLargeFileConfirmation' });\n\t\t\t}\n\t\t}),\n\t], {\n\t\tforceMessage: true,\n\t\tforceSeverity: Severity.Warning\n\t});\n}\n\nexport interface EditorInputWithOptions {\n\teditor: EditorInput;\n\toptions?: IEditorOptions;\n}\n\nexport interface EditorInputWithOptionsAndGroup extends EditorInputWithOptions {\n\tgroup: IEditorGroup;\n}\n\nexport function isEditorInputWithOptions(editor: unknown): editor is EditorInputWithOptions {\n\tconst candidate = editor as EditorInputWithOptions | undefined;\n\n\treturn isEditorInput(candidate?.editor);\n}\n\nexport function isEditorInputWithOptionsAndGroup(editor: unknown): editor is EditorInputWithOptionsAndGroup {\n\tconst candidate = editor as EditorInputWithOptionsAndGroup | undefined;\n\n\treturn isEditorInputWithOptions(editor) && candidate?.group !== undefined;\n}\n\n/**\n * Context passed into `EditorPane#setInput` to give additional\n * context information around why the editor was opened.\n */\nexport interface IEditorOpenContext {\n\n\t/**\n\t * An indicator if the editor input is new for the group the editor is in.\n\t * An editor is new for a group if it was not part of the group before and\n\t * otherwise was already opened in the group and just became the active editor.\n\t *\n\t * This hint can e.g. be used to decide whether to restore view state or not.\n\t */\n\tnewInGroup?: boolean;\n}\n\nexport interface IEditorIdentifier {\n\tgroupId: GroupIdentifier;\n\teditor: EditorInput;\n}\n\nexport function isEditorIdentifier(identifier: unknown): identifier is IEditorIdentifier {\n\tconst candidate = identifier as IEditorIdentifier | undefined;\n\n\treturn typeof candidate?.groupId === 'number' && isEditorInput(candidate.editor);\n}\n\n/**\n * The editor commands context is used for editor commands (e.g. in the editor title)\n * and we must ensure that the context is serializable because it potentially travels\n * to the extension host!\n */\nexport interface IEditorCommandsContext {\n\tgroupId: GroupIdentifier;\n\teditorIndex?: number;\n\n\tpreserveFocus?: boolean;\n}\n\nexport function isEditorCommandsContext(context: unknown): context is IEditorCommandsContext {\n\tconst candidate = context as IEditorCommandsContext | undefined;\n\n\treturn typeof candidate?.groupId === 'number';\n}\n\n/**\n * More information around why an editor was closed in the model.\n */\nexport enum EditorCloseContext {\n\n\t/**\n\t * No specific context for closing (e.g. explicit user gesture).\n\t */\n\tUNKNOWN,\n\n\t/**\n\t * The editor closed because it was replaced with another editor.\n\t * This can either happen via explicit replace call or when an\n\t * editor is in preview mode and another editor opens.\n\t */\n\tREPLACE,\n\n\t/**\n\t * The editor closed as a result of moving it to another group.\n\t */\n\tMOVE,\n\n\t/**\n\t * The editor closed because another editor turned into preview\n\t * and this used to be the preview editor before.\n\t */\n\tUNPIN\n}\n\nexport interface IEditorCloseEvent extends IEditorIdentifier {\n\n\t/**\n\t * More information around why the editor was closed.\n\t */\n\treadonly context: EditorCloseContext;\n\n\t/**\n\t * The index of the editor before closing.\n\t */\n\treadonly index: number;\n\n\t/**\n\t * Whether the editor was sticky or not.\n\t */\n\treadonly sticky: boolean;\n}\n\nexport interface IActiveEditorChangeEvent {\n\n\t/**\n\t * The new active editor or `undefined` if the group is empty.\n\t */\n\teditor: EditorInput | undefined;\n}\n\nexport interface IEditorWillMoveEvent extends IEditorIdentifier {\n\n\t/**\n\t * The target group of the move operation.\n\t */\n\treadonly target: GroupIdentifier;\n}\n\nexport interface IEditorWillOpenEvent extends IEditorIdentifier { }\n\nexport interface IWillInstantiateEditorPaneEvent {\n\n\t/**\n\t * @see {@link IEditorDescriptor.typeId}\n\t */\n\treadonly typeId: string;\n}\n\nexport type GroupIdentifier = number;\n\nexport const enum GroupModelChangeKind {\n\n\t/* Group Changes */\n\tGROUP_ACTIVE,\n\tGROUP_INDEX,\n\tGROUP_LABEL,\n\tGROUP_LOCKED,\n\n\t/* Editors Change */\n\tEDITORS_SELECTION,\n\n\t/* Editor Changes */\n\tEDITOR_OPEN,\n\tEDITOR_CLOSE,\n\tEDITOR_MOVE,\n\tEDITOR_ACTIVE,\n\tEDITOR_LABEL,\n\tEDITOR_CAPABILITIES,\n\tEDITOR_PIN,\n\tEDITOR_TRANSIENT,\n\tEDITOR_STICKY,\n\tEDITOR_DIRTY,\n\tEDITOR_WILL_DISPOSE\n}\n\nexport interface IWorkbenchEditorConfiguration {\n\tworkbench?: {\n\t\teditor?: IEditorPartConfiguration;\n\t\ticonTheme?: string;\n\t};\n}\n\ninterface IEditorPartLimitConfiguration {\n\tenabled?: boolean;\n\texcludeDirty?: boolean;\n\tvalue?: number;\n\tperEditorGroup?: boolean;\n}\n\nexport interface IEditorPartLimitOptions extends Required<IEditorPartLimitConfiguration> { }\n\ninterface IEditorPartDecorationsConfiguration {\n\tbadges?: boolean;\n\tcolors?: boolean;\n}\n\nexport interface IEditorPartDecorationOptions extends Required<IEditorPartDecorationsConfiguration> { }\n\ninterface IEditorPartConfiguration {\n\tshowTabs?: 'multiple' | 'single' | 'none';\n\twrapTabs?: boolean;\n\tscrollToSwitchTabs?: boolean;\n\thighlightModifiedTabs?: boolean;\n\ttabActionLocation?: 'left' | 'right';\n\ttabActionCloseVisibility?: boolean;\n\ttabActionUnpinVisibility?: boolean;\n\talwaysShowEditorActions?: boolean;\n\ttabSizing?: 'fit' | 'shrink' | 'fixed';\n\ttabSizingFixedMinWidth?: number;\n\ttabSizingFixedMaxWidth?: number;\n\tpinnedTabSizing?: 'normal' | 'compact' | 'shrink';\n\tpinnedTabsOnSeparateRow?: boolean;\n\ttabHeight?: 'default' | 'compact';\n\tpreventPinnedEditorClose?: PreventPinnedEditorClose;\n\ttitleScrollbarSizing?: 'default' | 'large';\n\tfocusRecentEditorAfterClose?: boolean;\n\tshowIcons?: boolean;\n\tenablePreview?: boolean;\n\tenablePreviewFromQuickOpen?: boolean;\n\tenablePreviewFromCodeNavigation?: boolean;\n\tcloseOnFileDelete?: boolean;\n\topenPositioning?: 'left' | 'right' | 'first' | 'last';\n\topenSideBySideDirection?: 'right' | 'down';\n\tcloseEmptyGroups?: boolean;\n\tautoLockGroups?: Set<string>;\n\trevealIfOpen?: boolean;\n\tmouseBackForwardToNavigate?: boolean;\n\tlabelFormat?: 'default' | 'short' | 'medium' | 'long';\n\trestoreViewState?: boolean;\n\tsplitInGroupLayout?: 'vertical' | 'horizontal';\n\tsplitSizing?: 'auto' | 'split' | 'distribute';\n\tsplitOnDragAndDrop?: boolean;\n\tdragToOpenWindow?: boolean;\n\tcenteredLayoutFixedWidth?: boolean;\n\tdoubleClickTabToToggleEditorGroupSizes?: 'maximize' | 'expand' | 'off';\n\teditorActionsLocation?: 'default' | 'titleBar' | 'hidden';\n\tlimit?: IEditorPartLimitConfiguration;\n\tdecorations?: IEditorPartDecorationsConfiguration;\n}\n\nexport interface IEditorPartOptions extends DeepRequiredNonNullable<IEditorPartConfiguration> {\n\thasIcons: boolean;\n}\n\nexport interface IEditorPartOptionsChangeEvent {\n\toldPartOptions: IEditorPartOptions;\n\tnewPartOptions: IEditorPartOptions;\n}\n\nexport enum SideBySideEditor {\n\tPRIMARY = 1,\n\tSECONDARY = 2,\n\tBOTH = 3,\n\tANY = 4\n}\n\nexport interface IFindEditorOptions {\n\n\t/**\n\t * Whether to consider any or both side by side editor as matching.\n\t * By default, side by side editors will not be considered\n\t * as matching, even if the editor is opened in one of the sides.\n\t */\n\tsupportSideBySide?: SideBySideEditor.PRIMARY | SideBySideEditor.SECONDARY | SideBySideEditor.ANY;\n\n\t/**\n\t * The order in which to consider editors for finding.\n\t */\n\torder?: EditorsOrder;\n}\n\nexport interface IMatchEditorOptions {\n\n\t/**\n\t * Whether to consider a side by side editor as matching.\n\t * By default, side by side editors will not be considered\n\t * as matching, even if the editor is opened in one of the sides.\n\t */\n\tsupportSideBySide?: SideBySideEditor.ANY | SideBySideEditor.BOTH;\n\n\t/**\n\t * Only consider an editor to match when the\n\t * `candidate === editor` but not when\n\t * `candidate.matches(editor)`.\n\t */\n\tstrictEquals?: boolean;\n}\n\nexport interface IEditorResourceAccessorOptions {\n\n\t/**\n\t * Allows to access the `resource(s)` of side by side editors. If not\n\t * specified, a `resource` for a side by side editor will always be\n\t * `undefined`.\n\t */\n\tsupportSideBySide?: SideBySideEditor;\n\n\t/**\n\t * Allows to filter the scheme to consider. A resource scheme that does\n\t * not match a filter will not be considered.\n\t */\n\tfilterByScheme?: string | string[];\n}\n\nclass EditorResourceAccessorImpl {\n\n\t/**\n\t * The original URI of an editor is the URI that was used originally to open\n\t * the editor and should be used whenever the URI is presented to the user,\n\t * e.g. as a label together with utility methods such as `ResourceLabel` or\n\t * `ILabelService` that can turn this original URI into the best form for\n\t * presenting.\n\t *\n\t * In contrast, the canonical URI (#getCanonicalUri) may be different and should\n\t * be used whenever the URI is used to e.g. compare with other editors or when\n\t * caching certain data based on the URI.\n\t *\n\t * For example: on Windows and macOS, the same file URI with different casing may\n\t * point to the same file. The editor may chose to \"normalize\" the URI into a canonical\n\t * form so that only one editor opens for same file URIs with different casing. As\n\t * such, the original URI and the canonical URI can be different.\n\t */\n\tgetOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null): URI | undefined;\n\tgetOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options: IEditorResourceAccessorOptions & { supportSideBySide?: SideBySideEditor.PRIMARY | SideBySideEditor.SECONDARY | SideBySideEditor.ANY }): URI | undefined;\n\tgetOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options: IEditorResourceAccessorOptions & { supportSideBySide: SideBySideEditor.BOTH }): URI | { primary?: URI; secondary?: URI } | undefined;\n\tgetOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options?: IEditorResourceAccessorOptions): URI | { primary?: URI; secondary?: URI } | undefined;\n\tgetOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options?: IEditorResourceAccessorOptions): URI | { primary?: URI; secondary?: URI } | undefined {\n\t\tif (!editor) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Merge editors are handled with `merged` result editor\n\t\tif (isResourceMergeEditorInput(editor)) {\n\t\t\treturn EditorResourceAccessor.getOriginalUri(editor.result, options);\n\t\t}\n\n\t\t// Optionally support side-by-side editors\n\t\tif (options?.supportSideBySide) {\n\t\t\tconst { primary, secondary } = this.getSideEditors(editor);\n\t\t\tif (primary && secondary) {\n\t\t\t\tif (options?.supportSideBySide === SideBySideEditor.BOTH) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tprimary: this.getOriginalUri(primary, { filterByScheme: options.filterByScheme }),\n\t\t\t\t\t\tsecondary: this.getOriginalUri(secondary, { filterByScheme: options.filterByScheme })\n\t\t\t\t\t};\n\t\t\t\t} else if (options?.supportSideBySide === SideBySideEditor.ANY) {\n\t\t\t\t\treturn this.getOriginalUri(primary, { filterByScheme: options.filterByScheme }) ?? this.getOriginalUri(secondary, { filterByScheme: options.filterByScheme });\n\t\t\t\t}\n\n\t\t\t\teditor = options.supportSideBySide === SideBySideEditor.PRIMARY ? primary : secondary;\n\t\t\t}\n\t\t}\n\n\t\tif (isResourceDiffEditorInput(editor) || isResourceMultiDiffEditorInput(editor) || isResourceSideBySideEditorInput(editor) || isResourceMergeEditorInput(editor)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Original URI is the `preferredResource` of an editor if any\n\t\tconst originalResource = isEditorInputWithPreferredResource(editor) ? editor.preferredResource : editor.resource;\n\t\tif (!originalResource || !options || !options.filterByScheme) {\n\t\t\treturn originalResource;\n\t\t}\n\n\t\treturn this.filterUri(originalResource, options.filterByScheme);\n\t}\n\n\tprivate getSideEditors(editor: EditorInput | IUntypedEditorInput): { primary: EditorInput | IUntypedEditorInput | undefined; secondary: EditorInput | IUntypedEditorInput | undefined } {\n\t\tif (isSideBySideEditorInput(editor) || isResourceSideBySideEditorInput(editor)) {\n\t\t\treturn { primary: editor.primary, secondary: editor.secondary };\n\t\t}\n\n\t\tif (isDiffEditorInput(editor) || isResourceDiffEditorInput(editor)) {\n\t\t\treturn { primary: editor.modified, secondary: editor.original };\n\t\t}\n\n\t\treturn { primary: undefined, secondary: undefined };\n\t}\n\n\t/**\n\t * The canonical URI of an editor is the true unique identifier of the editor\n\t * and should be used whenever the URI is used e.g. to compare with other\n\t * editors or when caching certain data based on the URI.\n\t *\n\t * In contrast, the original URI (#getOriginalUri) may be different and should\n\t * be used whenever the URI is presented to the user, e.g. as a label.\n\t *\n\t * For example: on Windows and macOS, the same file URI with different casing may\n\t * point to the same file. The editor may chose to \"normalize\" the URI into a canonical\n\t * form so that only one editor opens for same file URIs with different casing. As\n\t * such, the original URI and the canonical URI can be different.\n\t */\n\tgetCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null): URI | undefined;\n\tgetCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options: IEditorResourceAccessorOptions & { supportSideBySide?: SideBySideEditor.PRIMARY | SideBySideEditor.SECONDARY | SideBySideEditor.ANY }): URI | undefined;\n\tgetCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options: IEditorResourceAccessorOptions & { supportSideBySide: SideBySideEditor.BOTH }): URI | { primary?: URI; secondary?: URI } | undefined;\n\tgetCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options?: IEditorResourceAccessorOptions): URI | { primary?: URI; secondary?: URI } | undefined;\n\tgetCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options?: IEditorResourceAccessorOptions): URI | { primary?: URI; secondary?: URI } | undefined {\n\t\tif (!editor) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Merge editors are handled with `merged` result editor\n\t\tif (isResourceMergeEditorInput(editor)) {\n\t\t\treturn EditorResourceAccessor.getCanonicalUri(editor.result, options);\n\t\t}\n\n\t\t// Optionally support side-by-side editors\n\t\tif (options?.supportSideBySide) {\n\t\t\tconst { primary, secondary } = this.getSideEditors(editor);\n\t\t\tif (primary && secondary) {\n\t\t\t\tif (options?.supportSideBySide === SideBySideEditor.BOTH) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tprimary: this.getCanonicalUri(primary, { filterByScheme: options.filterByScheme }),\n\t\t\t\t\t\tsecondary: this.getCanonicalUri(secondary, { filterByScheme: options.filterByScheme })\n\t\t\t\t\t};\n\t\t\t\t} else if (options?.supportSideBySide === SideBySideEditor.ANY) {\n\t\t\t\t\treturn this.getCanonicalUri(primary, { filterByScheme: options.filterByScheme }) ?? this.getCanonicalUri(secondary, { filterByScheme: options.filterByScheme });\n\t\t\t\t}\n\n\t\t\t\teditor = options.supportSideBySide === SideBySideEditor.PRIMARY ? primary : secondary;\n\t\t\t}\n\t\t}\n\n\t\tif (isResourceDiffEditorInput(editor) || isResourceMultiDiffEditorInput(editor) || isResourceSideBySideEditorInput(editor) || isResourceMergeEditorInput(editor)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Canonical URI is the `resource` of an editor\n\t\tconst canonicalResource = editor.resource;\n\t\tif (!canonicalResource || !options || !options.filterByScheme) {\n\t\t\treturn canonicalResource;\n\t\t}\n\n\t\treturn this.filterUri(canonicalResource, options.filterByScheme);\n\t}\n\n\tprivate filterUri(resource: URI, filter: string | string[]): URI | undefined {\n\n\t\t// Multiple scheme filter\n\t\tif (Array.isArray(filter)) {\n\t\t\tif (filter.some(scheme => resource.scheme === scheme)) {\n\t\t\t\treturn resource;\n\t\t\t}\n\t\t}\n\n\t\t// Single scheme filter\n\t\telse {\n\t\t\tif (filter === resource.scheme) {\n\t\t\t\treturn resource;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n\nexport type PreventPinnedEditorClose = 'keyboardAndMouse' | 'keyboard' | 'mouse' | 'never' | undefined;\n\nexport enum EditorCloseMethod {\n\tUNKNOWN,\n\tKEYBOARD,\n\tMOUSE\n}\n\nexport function preventEditorClose(group: IEditorGroup | IReadonlyEditorGroupModel, editor: EditorInput, method: EditorCloseMethod, configuration: IEditorPartConfiguration): boolean {\n\tif (!group.isSticky(editor)) {\n\t\treturn false; // only interested in sticky editors\n\t}\n\n\tswitch (configuration.preventPinnedEditorClose) {\n\t\tcase 'keyboardAndMouse': return method === EditorCloseMethod.MOUSE || method === EditorCloseMethod.KEYBOARD;\n\t\tcase 'mouse': return method === EditorCloseMethod.MOUSE;\n\t\tcase 'keyboard': return method === EditorCloseMethod.KEYBOARD;\n\t}\n\n\treturn false;\n}\n\nexport const EditorResourceAccessor = new EditorResourceAccessorImpl();\n\nexport const enum CloseDirection {\n\tLEFT,\n\tRIGHT\n}\n\nexport interface IEditorMemento<T> {\n\n\tsaveEditorState(group: IEditorGroup, resource: URI, state: T): void;\n\tsaveEditorState(group: IEditorGroup, editor: EditorInput, state: T): void;\n\n\tloadEditorState(group: IEditorGroup, resource: URI): T | undefined;\n\tloadEditorState(group: IEditorGroup, editor: EditorInput): T | undefined;\n\n\tclearEditorState(resource: URI, group?: IEditorGroup): void;\n\tclearEditorState(editor: EditorInput, group?: IEditorGroup): void;\n\n\tclearEditorStateOnDispose(resource: URI, editor: EditorInput): void;\n\n\tmoveEditorState(source: URI, target: URI, comparer: IExtUri): void;\n}\n\nclass EditorFactoryRegistry implements IEditorFactoryRegistry {\n\tprivate instantiationService: IInstantiationService | undefined;\n\n\tprivate fileEditorFactory: IFileEditorFactory | undefined;\n\n\tprivate readonly editorSerializerConstructors = new Map<string /* Type ID */, IConstructorSignature<IEditorSerializer>>();\n\tprivate readonly editorSerializerInstances = new Map<string /* Type ID */, IEditorSerializer>();\n\n\tstart(accessor: ServicesAccessor): void {\n\t\tconst instantiationService = this.instantiationService = accessor.get(IInstantiationService);\n\n\t\tfor (const [key, ctor] of this.editorSerializerConstructors) {\n\t\t\tthis.createEditorSerializer(key, ctor, instantiationService);\n\t\t}\n\n\t\tthis.editorSerializerConstructors.clear();\n\t}\n\n\tprivate createEditorSerializer(editorTypeId: string, ctor: IConstructorSignature<IEditorSerializer>, instantiationService: IInstantiationService): void {\n\t\tconst instance = instantiationService.createInstance(ctor);\n\t\tthis.editorSerializerInstances.set(editorTypeId, instance);\n\t}\n\n\tregisterFileEditorFactory(factory: IFileEditorFactory): void {\n\t\tif (this.fileEditorFactory) {\n\t\t\tthrow new Error('Can only register one file editor factory.');\n\t\t}\n\n\t\tthis.fileEditorFactory = factory;\n\t}\n\n\tgetFileEditorFactory(): IFileEditorFactory {\n\t\treturn assertReturnsDefined(this.fileEditorFactory);\n\t}\n\n\tregisterEditorSerializer(editorTypeId: string, ctor: IConstructorSignature<IEditorSerializer>): IDisposable {\n\t\tif (this.editorSerializerConstructors.has(editorTypeId) || this.editorSerializerInstances.has(editorTypeId)) {\n\t\t\tthrow new Error(`A editor serializer with type ID '${editorTypeId}' was already registered.`);\n\t\t}\n\n\t\tif (!this.instantiationService) {\n\t\t\tthis.editorSerializerConstructors.set(editorTypeId, ctor);\n\t\t} else {\n\t\t\tthis.createEditorSerializer(editorTypeId, ctor, this.instantiationService);\n\t\t}\n\n\t\treturn toDisposable(() => {\n\t\t\tthis.editorSerializerConstructors.delete(editorTypeId);\n\t\t\tthis.editorSerializerInstances.delete(editorTypeId);\n\t\t});\n\t}\n\n\tgetEditorSerializer(editor: EditorInput): IEditorSerializer | undefined;\n\tgetEditorSerializer(editorTypeId: string): IEditorSerializer | undefined;\n\tgetEditorSerializer(arg1: string | EditorInput): IEditorSerializer | undefined {\n\t\treturn this.editorSerializerInstances.get(typeof arg1 === 'string' ? arg1 : arg1.typeId);\n\t}\n}\n\nRegistry.add(EditorExtensions.EditorFactory, new EditorFactoryRegistry());\n\nexport async function pathsToEditors(paths: IPathData[] | undefined, fileService: IFileService, logService: ILogService): Promise<ReadonlyArray<IResourceEditorInput | IUntitledTextResourceEditorInput | undefined>> {\n\tif (!paths || !paths.length) {\n\t\treturn [];\n\t}\n\n\treturn await Promise.all(paths.map(async path => {\n\t\tconst resource = URI.revive(path.fileUri);\n\t\tif (!resource) {\n\t\t\tlogService.info('Cannot resolve the path because it is not valid.', path);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst canHandleResource = await fileService.canHandleResource(resource);\n\t\tif (!canHandleResource) {\n\t\t\tlogService.info('Cannot resolve the path because it cannot be handled', path);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tlet exists = path.exists;\n\t\tlet type = path.type;\n\t\tif (typeof exists !== 'boolean' || typeof type !== 'number') {\n\t\t\ttry {\n\t\t\t\ttype = (await fileService.stat(resource)).isDirectory ? FileType.Directory : FileType.Unknown;\n\t\t\t\texists = true;\n\t\t\t} catch (error) {\n\t\t\t\tlogService.error(error);\n\t\t\t\texists = false;\n\t\t\t}\n\t\t}\n\n\t\tif (!exists && path.openOnlyIfExists) {\n\t\t\tlogService.info('Cannot resolve the path because it does not exist', path);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (type === FileType.Directory) {\n\t\t\tlogService.info('Cannot resolve the path because it is a directory', path);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst options: IEditorOptions = {\n\t\t\t...path.options,\n\t\t\tpinned: true\n\t\t};\n\n\t\tif (!exists) {\n\t\t\treturn { resource, options, forceUntitled: true };\n\t\t}\n\n\t\treturn { resource, options };\n\t}));\n}\n\nexport const enum EditorsOrder {\n\n\t/**\n\t * Editors sorted by most recent activity (most recent active first)\n\t */\n\tMOST_RECENTLY_ACTIVE,\n\n\t/**\n\t * Editors sorted by sequential order\n\t */\n\tSEQUENTIAL\n}\n\nexport function isTextEditorViewState(candidate: unknown): candidate is IEditorViewState {\n\tconst viewState = candidate as IEditorViewState | undefined;\n\tif (!viewState) {\n\t\treturn false;\n\t}\n\n\tconst diffEditorViewState = viewState as IDiffEditorViewState;\n\tif (diffEditorViewState.modified) {\n\t\treturn isTextEditorViewState(diffEditorViewState.modified);\n\t}\n\n\tconst codeEditorViewState = viewState as ICodeEditorViewState;\n\n\treturn !!(codeEditorViewState.contributionsState && codeEditorViewState.viewState && Array.isArray(codeEditorViewState.cursorState));\n}\n\nexport interface IEditorOpenErrorOptions {\n\n\t/**\n\t * If set to true, the message will be taken\n\t * from the error message entirely and not be\n\t * composed with more text.\n\t */\n\tforceMessage?: boolean;\n\n\t/**\n\t * If set, will override the severity of the error.\n\t */\n\tforceSeverity?: Severity;\n\n\t/**\n\t * If set to true, the error may be shown in a dialog\n\t * to the user if the editor opening was triggered by\n\t * user action. Otherwise and by default, the error will\n\t * be shown as place holder in the editor area.\n\t */\n\tallowDialog?: boolean;\n}\n\nexport interface IEditorOpenError extends IErrorWithActions, IEditorOpenErrorOptions { }\n\nexport function isEditorOpenError(obj: unknown): obj is IEditorOpenError {\n\treturn isErrorWithActions(obj);\n}\n\nexport function createEditorOpenError(messageOrError: string | Error, actions: IAction[], options?: IEditorOpenErrorOptions): IEditorOpenError {\n\tconst error: IEditorOpenError = createErrorWithActions(messageOrError, actions);\n\n\terror.forceMessage = options?.forceMessage;\n\terror.forceSeverity = options?.forceSeverity;\n\terror.allowDialog = options?.allowDialog;\n\n\treturn error;\n}\n\nexport interface IToolbarActions {\n\treadonly primary: IAction[];\n\treadonly secondary: IAction[];\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Codicon } from '../../../../base/common/codicons.js';\nimport { basename } from '../../../../base/common/resources.js';\nimport { ThemeIcon } from '../../../../base/common/themables.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { IRange } from '../../../../editor/common/core/range.js';\nimport { IOffsetRange } from '../../../../editor/common/core/ranges/offsetRange.js';\nimport { isLocation, Location, SymbolKind } from '../../../../editor/common/languages.js';\nimport { localize } from '../../../../nls.js';\nimport { MarkerSeverity, IMarker } from '../../../../platform/markers/common/markers.js';\nimport { ISCMHistoryItem } from '../../scm/common/history.js';\nimport { IChatContentReference } from './chatService.js';\nimport { IChatRequestVariableValue } from './chatVariables.js';\n\n\ninterface IBaseChatRequestVariableEntry {\n\treadonly id: string;\n\treadonly fullName?: string;\n\treadonly icon?: ThemeIcon;\n\treadonly name: string;\n\treadonly modelDescription?: string;\n\n\t/**\n\t * The offset-range in the prompt. This means this entry has been explicitly typed out\n\t * by the user.\n\t */\n\treadonly range?: IOffsetRange;\n\treadonly value: IChatRequestVariableValue;\n\treadonly references?: IChatContentReference[];\n\n\tomittedState?: OmittedState;\n}\n\nexport interface IGenericChatRequestVariableEntry extends IBaseChatRequestVariableEntry {\n\tkind: 'generic';\n}\n\nexport interface IChatRequestDirectoryEntry extends IBaseChatRequestVariableEntry {\n\tkind: 'directory';\n}\n\nexport interface IChatRequestFileEntry extends IBaseChatRequestVariableEntry {\n\tkind: 'file';\n}\n\nexport const enum OmittedState {\n\tNotOmitted,\n\tPartial,\n\tFull,\n}\n\nexport interface IChatRequestToolEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'tool';\n}\n\nexport interface IChatRequestToolSetEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'toolset';\n\treadonly value: IChatRequestToolEntry[];\n}\n\nexport interface IChatRequestImplicitVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'implicit';\n\treadonly isFile: true;\n\treadonly value: URI | Location | undefined;\n\treadonly isSelection: boolean;\n\tenabled: boolean;\n}\n\nexport interface IChatRequestPasteVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'paste';\n\treadonly code: string;\n\treadonly language: string;\n\treadonly pastedLines: string;\n\n\t// This is only used for old serialized data and should be removed once we no longer support it\n\treadonly fileName: string;\n\n\t// This is only undefined on old serialized data\n\treadonly copiedFrom: {\n\t\treadonly uri: URI;\n\t\treadonly range: IRange;\n\t} | undefined;\n}\n\nexport interface ISymbolVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'symbol';\n\treadonly value: Location;\n\treadonly symbolKind: SymbolKind;\n}\n\nexport interface ICommandResultVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'command';\n}\n\nexport interface IImageVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'image';\n\treadonly isPasted?: boolean;\n\treadonly isURL?: boolean;\n\treadonly mimeType?: string;\n}\n\nexport interface INotebookOutputVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'notebookOutput';\n\treadonly outputIndex?: number;\n\treadonly mimeType?: string;\n}\n\nexport interface IDiagnosticVariableEntryFilterData {\n\treadonly owner?: string;\n\treadonly problemMessage?: string;\n\treadonly filterUri?: URI;\n\treadonly filterSeverity?: MarkerSeverity;\n\treadonly filterRange?: IRange;\n}\n\n\n\nexport namespace IDiagnosticVariableEntryFilterData {\n\texport const icon = Codicon.error;\n\n\texport function fromMarker(marker: IMarker): IDiagnosticVariableEntryFilterData {\n\t\treturn {\n\t\t\tfilterUri: marker.resource,\n\t\t\towner: marker.owner,\n\t\t\tproblemMessage: marker.message,\n\t\t\tfilterRange: { startLineNumber: marker.startLineNumber, endLineNumber: marker.endLineNumber, startColumn: marker.startColumn, endColumn: marker.endColumn }\n\t\t};\n\t}\n\n\texport function toEntry(data: IDiagnosticVariableEntryFilterData): IDiagnosticVariableEntry {\n\t\treturn {\n\t\t\tid: id(data),\n\t\t\tname: label(data),\n\t\t\ticon,\n\t\t\tvalue: data,\n\t\t\tkind: 'diagnostic',\n\t\t\t...data,\n\t\t};\n\t}\n\n\texport function id(data: IDiagnosticVariableEntryFilterData) {\n\t\treturn [data.filterUri, data.owner, data.filterSeverity, data.filterRange?.startLineNumber].join(':');\n\t}\n\n\texport function label(data: IDiagnosticVariableEntryFilterData) {\n\t\tconst enum TrimThreshold {\n\t\t\tMaxChars = 30,\n\t\t\tMaxSpaceLookback = 10,\n\t\t}\n\t\tif (data.problemMessage) {\n\t\t\tif (data.problemMessage.length < TrimThreshold.MaxChars) {\n\t\t\t\treturn data.problemMessage;\n\t\t\t}\n\n\t\t\t// Trim the message, on a space if it would not lose too much\n\t\t\t// data (MaxSpaceLookback) or just blindly otherwise.\n\t\t\tconst lastSpace = data.problemMessage.lastIndexOf(' ', TrimThreshold.MaxChars);\n\t\t\tif (lastSpace === -1 || lastSpace + TrimThreshold.MaxSpaceLookback < TrimThreshold.MaxChars) {\n\t\t\t\treturn data.problemMessage.substring(0, TrimThreshold.MaxChars) + '…';\n\t\t\t}\n\t\t\treturn data.problemMessage.substring(0, lastSpace) + '…';\n\t\t}\n\t\tlet labelStr = localize('chat.attachment.problems.all', \"All Problems\");\n\t\tif (data.filterUri) {\n\t\t\tlabelStr = localize('chat.attachment.problems.inFile', \"Problems in {0}\", basename(data.filterUri));\n\t\t}\n\n\t\treturn labelStr;\n\t}\n}\n\nexport interface IDiagnosticVariableEntry extends IBaseChatRequestVariableEntry, IDiagnosticVariableEntryFilterData {\n\treadonly kind: 'diagnostic';\n}\n\nexport interface IElementVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'element';\n}\n\nexport interface IPromptFileVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'promptFile';\n\treadonly value: URI;\n\treadonly isRoot: boolean;\n\treadonly originLabel?: string;\n\treadonly modelDescription: string;\n\treadonly automaticallyAdded: boolean;\n}\n\nexport interface IPromptTextVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'promptText';\n\treadonly value: string;\n\treadonly settingId?: string;\n\treadonly modelDescription: string;\n\treadonly automaticallyAdded: boolean;\n}\n\nexport interface ISCMHistoryItemVariableEntry extends IBaseChatRequestVariableEntry {\n\treadonly kind: 'scmHistoryItem';\n\treadonly value: URI;\n\treadonly historyItem: ISCMHistoryItem;\n}\n\nexport type IChatRequestVariableEntry = IGenericChatRequestVariableEntry | IChatRequestImplicitVariableEntry | IChatRequestPasteVariableEntry\n\t| ISymbolVariableEntry | ICommandResultVariableEntry | IDiagnosticVariableEntry | IImageVariableEntry\n\t| IChatRequestToolEntry | IChatRequestToolSetEntry\n\t| IChatRequestDirectoryEntry | IChatRequestFileEntry | INotebookOutputVariableEntry | IElementVariableEntry\n\t| IPromptFileVariableEntry | IPromptTextVariableEntry | ISCMHistoryItemVariableEntry;\n\n\nexport namespace IChatRequestVariableEntry {\n\n\t/**\n\t * Returns URI of the passed variant entry. Return undefined if not found.\n\t */\n\texport function toUri(entry: IChatRequestVariableEntry): URI | undefined {\n\t\treturn URI.isUri(entry.value)\n\t\t\t? entry.value\n\t\t\t: isLocation(entry.value)\n\t\t\t\t? entry.value.uri\n\t\t\t\t: undefined;\n\t}\n}\n\n\nexport function isImplicitVariableEntry(obj: IChatRequestVariableEntry): obj is IChatRequestImplicitVariableEntry {\n\treturn obj.kind === 'implicit';\n}\n\nexport function isPasteVariableEntry(obj: IChatRequestVariableEntry): obj is IChatRequestPasteVariableEntry {\n\treturn obj.kind === 'paste';\n}\n\nexport function isImageVariableEntry(obj: IChatRequestVariableEntry): obj is IImageVariableEntry {\n\treturn obj.kind === 'image';\n}\n\nexport function isNotebookOutputVariableEntry(obj: IChatRequestVariableEntry): obj is INotebookOutputVariableEntry {\n\treturn obj.kind === 'notebookOutput';\n}\n\nexport function isElementVariableEntry(obj: IChatRequestVariableEntry): obj is IElementVariableEntry {\n\treturn obj.kind === 'element';\n}\n\nexport function isDiagnosticsVariableEntry(obj: IChatRequestVariableEntry): obj is IDiagnosticVariableEntry {\n\treturn obj.kind === 'diagnostic';\n}\n\nexport function isChatRequestFileEntry(obj: IChatRequestVariableEntry): obj is IChatRequestFileEntry {\n\treturn obj.kind === 'file';\n}\n\nexport function isPromptFileVariableEntry(obj: IChatRequestVariableEntry): obj is IPromptFileVariableEntry {\n\treturn obj.kind === 'promptFile';\n}\n\nexport function isPromptTextVariableEntry(obj: IChatRequestVariableEntry): obj is IPromptTextVariableEntry {\n\treturn obj.kind === 'promptText';\n}\n\nexport function isChatRequestVariableEntry(obj: unknown): obj is IChatRequestVariableEntry {\n\tconst entry = obj as IChatRequestVariableEntry;\n\treturn typeof entry === 'object' &&\n\t\tentry !== null &&\n\t\ttypeof entry.id === 'string' &&\n\t\ttypeof entry.name === 'string';\n}\n\nexport function isSCMHistoryItemVariableEntry(obj: IChatRequestVariableEntry): obj is ISCMHistoryItemVariableEntry {\n\treturn obj.kind === 'scmHistoryItem';\n}\n\nexport enum PromptFileVariableKind {\n\tInstruction = 'vscode.prompt.instructions.root',\n\tInstructionReference = `vscode.prompt.instructions`,\n\tPromptFile = 'vscode.prompt.file'\n}\n\n/**\n * Utility to convert a {@link uri} to a chat variable entry.\n * The `id` of the chat variable can be one of the following:\n *\n * - `vscode.prompt.instructions__<URI>`: for all non-root prompt instructions references\n * - `vscode.prompt.instructions.root__<URI>`: for *root* prompt instructions references\n * - `vscode.prompt.file__<URI>`: for prompt file references\n *\n * @param uri A resource URI that points to a prompt instructions file.\n * @param kind The kind of the prompt file variable entry.\n */\nexport function toPromptFileVariableEntry(uri: URI, kind: PromptFileVariableKind, originLabel?: string, automaticallyAdded = false): IPromptFileVariableEntry {\n\t//  `id` for all `prompt files` starts with the well-defined part that the copilot extension(or other chatbot) can rely on\n\treturn {\n\t\tid: `${kind}__${uri.toString()}`,\n\t\tname: `prompt:${basename(uri)}`,\n\t\tvalue: uri,\n\t\tkind: 'promptFile',\n\t\tmodelDescription: 'Prompt instructions file',\n\t\tisRoot: kind !== PromptFileVariableKind.InstructionReference,\n\t\toriginLabel,\n\t\tautomaticallyAdded\n\t};\n}\n\nexport function toPromptTextVariableEntry(content: string, settingId?: string, automaticallyAdded = false): IPromptTextVariableEntry {\n\treturn {\n\t\tid: `vscode.prompt.instructions.text${settingId ? `.${settingId}` : ''}`,\n\t\tname: `prompt:text`,\n\t\tvalue: content,\n\t\tsettingId,\n\t\tkind: 'promptText',\n\t\tmodelDescription: 'Prompt instructions text',\n\t\tautomaticallyAdded\n\t};\n}\n\nexport function toFileVariableEntry(uri: URI, range?: IRange): IChatRequestFileEntry {\n\treturn {\n\t\tkind: 'file',\n\t\tvalue: range ? { uri, range } : uri,\n\t\tid: uri.toString() + (range?.toString() ?? ''),\n\t\tname: basename(uri),\n\t};\n}\n\nexport class ChatRequestVariableSet {\n\tprivate _ids = new Set<string>();\n\tprivate _entries: IChatRequestVariableEntry[] = [];\n\n\tconstructor(entries?: IChatRequestVariableEntry[]) {\n\t\tif (entries) {\n\t\t\tthis.add(...entries);\n\t\t}\n\t}\n\n\tpublic add(...entry: IChatRequestVariableEntry[]): void {\n\t\tfor (const e of entry) {\n\t\t\tif (!this._ids.has(e.id)) {\n\t\t\t\tthis._ids.add(e.id);\n\t\t\t\tthis._entries.push(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic insertFirst(entry: IChatRequestVariableEntry): void {\n\t\tif (!this._ids.has(entry.id)) {\n\t\t\tthis._ids.add(entry.id);\n\t\t\tthis._entries.unshift(entry);\n\t\t}\n\t}\n\n\tpublic remove(entry: IChatRequestVariableEntry): void {\n\t\tthis._ids.delete(entry.id);\n\t\tthis._entries = this._entries.filter(e => e.id !== entry.id);\n\t}\n\n\tpublic has(entry: IChatRequestVariableEntry): boolean {\n\t\treturn this._ids.has(entry.id);\n\t}\n\n\tpublic asArray(): IChatRequestVariableEntry[] {\n\t\treturn this._entries.slice(0); // return a copy\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport const enum TestIdPathParts {\n\t/** Delimiter for path parts in test IDs */\n\tDelimiter = '\\0',\n}\n\n/**\n * Enum for describing relative positions of tests. Similar to\n * `node.compareDocumentPosition` in the DOM.\n */\nexport const enum TestPosition {\n\t/** a === b */\n\tIsSame,\n\t/** Neither a nor b are a child of one another. They may share a common parent, though. */\n\tDisconnected,\n\t/** b is a child of a */\n\tIsChild,\n\t/** b is a parent of a */\n\tIsParent,\n}\n\ntype TestItemLike = { id: string; parent?: TestItemLike; _isRoot?: boolean };\n\n/**\n * The test ID is a stringifiable client that\n */\nexport class TestId {\n\tprivate stringifed?: string;\n\n\t/**\n\t * Creates a test ID from an ext host test item.\n\t */\n\tpublic static fromExtHostTestItem(item: TestItemLike, rootId: string, parent = item.parent) {\n\t\tif (item._isRoot) {\n\t\t\treturn new TestId([rootId]);\n\t\t}\n\n\t\tconst path = [item.id];\n\t\tfor (let i = parent; i && i.id !== rootId; i = i.parent) {\n\t\t\tpath.push(i.id);\n\t\t}\n\t\tpath.push(rootId);\n\n\t\treturn new TestId(path.reverse());\n\t}\n\n\t/**\n\t * Cheaply ets whether the ID refers to the root .\n\t */\n\tpublic static isRoot(idString: string) {\n\t\treturn !idString.includes(TestIdPathParts.Delimiter);\n\t}\n\n\t/**\n\t * Cheaply gets whether the ID refers to the root .\n\t */\n\tpublic static root(idString: string) {\n\t\tconst idx = idString.indexOf(TestIdPathParts.Delimiter);\n\t\treturn idx === -1 ? idString : idString.slice(0, idx);\n\t}\n\n\t/**\n\t * Creates a test ID from a serialized TestId instance.\n\t */\n\tpublic static fromString(idString: string) {\n\t\treturn new TestId(idString.split(TestIdPathParts.Delimiter));\n\t}\n\n\t/**\n\t * Gets the ID resulting from adding b to the base ID.\n\t */\n\tpublic static join(base: TestId, b: string) {\n\t\treturn new TestId([...base.path, b]);\n\t}\n\n\t/**\n\t * Splits a test ID into its parts.\n\t */\n\tpublic static split(idString: string) {\n\t\treturn idString.split(TestIdPathParts.Delimiter);\n\t}\n\n\t/**\n\t * Gets the string ID resulting from adding b to the base ID.\n\t */\n\tpublic static joinToString(base: string | TestId, b: string) {\n\t\treturn base.toString() + TestIdPathParts.Delimiter + b;\n\t}\n\n\t/**\n\t * Cheaply gets the parent ID of a test identified with the string.\n\t */\n\tpublic static parentId(idString: string) {\n\t\tconst idx = idString.lastIndexOf(TestIdPathParts.Delimiter);\n\t\treturn idx === -1 ? undefined : idString.slice(0, idx);\n\t}\n\n\t/**\n\t * Cheaply gets the local ID of a test identified with the string.\n\t */\n\tpublic static localId(idString: string) {\n\t\tconst idx = idString.lastIndexOf(TestIdPathParts.Delimiter);\n\t\treturn idx === -1 ? idString : idString.slice(idx + TestIdPathParts.Delimiter.length);\n\t}\n\n\t/**\n\t * Gets whether maybeChild is a child of maybeParent.\n\t * todo@connor4312: review usages of this to see if using the WellDefinedPrefixTree is better\n\t */\n\tpublic static isChild(maybeParent: string, maybeChild: string) {\n\t\treturn maybeChild[maybeParent.length] === TestIdPathParts.Delimiter && maybeChild.startsWith(maybeParent);\n\t}\n\n\t/**\n\t * Compares the position of the two ID strings.\n\t * todo@connor4312: review usages of this to see if using the WellDefinedPrefixTree is better\n\t */\n\tpublic static compare(a: string, b: string) {\n\t\tif (a === b) {\n\t\t\treturn TestPosition.IsSame;\n\t\t}\n\n\t\tif (TestId.isChild(a, b)) {\n\t\t\treturn TestPosition.IsChild;\n\t\t}\n\n\t\tif (TestId.isChild(b, a)) {\n\t\t\treturn TestPosition.IsParent;\n\t\t}\n\n\t\treturn TestPosition.Disconnected;\n\t}\n\n\tpublic static getLengthOfCommonPrefix(length: number, getId: (i: number) => TestId): number {\n\t\tif (length === 0) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tlet commonPrefix = 0;\n\t\twhile (commonPrefix < length - 1) {\n\t\t\tfor (let i = 1; i < length; i++) {\n\t\t\t\tconst a = getId(i - 1);\n\t\t\t\tconst b = getId(i);\n\t\t\t\tif (a.path[commonPrefix] !== b.path[commonPrefix]) {\n\t\t\t\t\treturn commonPrefix;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcommonPrefix++;\n\t\t}\n\n\t\treturn commonPrefix;\n\t}\n\n\tconstructor(\n\t\tpublic readonly path: readonly string[],\n\t\tprivate readonly viewEnd = path.length,\n\t) {\n\t\tif (path.length === 0 || viewEnd < 1) {\n\t\t\tthrow new Error('cannot create test with empty path');\n\t\t}\n\t}\n\n\t/**\n\t * Gets the ID of the parent test.\n\t */\n\tpublic get rootId(): TestId {\n\t\treturn new TestId(this.path, 1);\n\t}\n\n\t/**\n\t * Gets the ID of the parent test.\n\t */\n\tpublic get parentId(): TestId | undefined {\n\t\treturn this.viewEnd > 1 ? new TestId(this.path, this.viewEnd - 1) : undefined;\n\t}\n\n\t/**\n\t * Gets the local ID of the current full test ID.\n\t */\n\tpublic get localId() {\n\t\treturn this.path[this.viewEnd - 1];\n\t}\n\n\t/**\n\t * Gets whether this ID refers to the root.\n\t */\n\tpublic get controllerId() {\n\t\treturn this.path[0];\n\t}\n\n\t/**\n\t * Gets whether this ID refers to the root.\n\t */\n\tpublic get isRoot() {\n\t\treturn this.viewEnd === 1;\n\t}\n\n\t/**\n\t * Returns an iterable that yields IDs of all parent items down to and\n\t * including the current item.\n\t */\n\tpublic *idsFromRoot() {\n\t\tfor (let i = 1; i <= this.viewEnd; i++) {\n\t\t\tyield new TestId(this.path, i);\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable that yields IDs of the current item up to the root\n\t * item.\n\t */\n\tpublic *idsToRoot() {\n\t\tfor (let i = this.viewEnd; i > 0; i--) {\n\t\t\tyield new TestId(this.path, i);\n\t\t}\n\t}\n\n\t/**\n\t * Compares the other test ID with this one.\n\t */\n\tpublic compare(other: TestId | string) {\n\t\tif (typeof other === 'string') {\n\t\t\treturn TestId.compare(this.toString(), other);\n\t\t}\n\n\t\tfor (let i = 0; i < other.viewEnd && i < this.viewEnd; i++) {\n\t\t\tif (other.path[i] !== this.path[i]) {\n\t\t\t\treturn TestPosition.Disconnected;\n\t\t\t}\n\t\t}\n\n\t\tif (other.viewEnd > this.viewEnd) {\n\t\t\treturn TestPosition.IsChild;\n\t\t}\n\n\t\tif (other.viewEnd < this.viewEnd) {\n\t\t\treturn TestPosition.IsParent;\n\t\t}\n\n\t\treturn TestPosition.IsSame;\n\t}\n\n\t/**\n\t * Serializes the ID.\n\t */\n\tpublic toJSON() {\n\t\treturn this.toString();\n\t}\n\n\t/**\n\t * Serializes the ID to a string.\n\t */\n\tpublic toString() {\n\t\tif (!this.stringifed) {\n\t\t\tthis.stringifed = this.path[0];\n\t\t\tfor (let i = 1; i < this.viewEnd; i++) {\n\t\t\t\tthis.stringifed += TestIdPathParts.Delimiter;\n\t\t\t\tthis.stringifed += this.path[i];\n\t\t\t}\n\t\t}\n\n\t\treturn this.stringifed;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IMarkdownString } from '../../../../base/common/htmlContent.js';\nimport { MarshalledId } from '../../../../base/common/marshallingIds.js';\nimport { URI, UriComponents } from '../../../../base/common/uri.js';\nimport { IPosition, Position } from '../../../../editor/common/core/position.js';\nimport { IRange, Range } from '../../../../editor/common/core/range.js';\nimport { localize } from '../../../../nls.js';\nimport { TestId } from './testId.js';\n\nexport const enum TestResultState {\n\tUnset = 0,\n\tQueued = 1,\n\tRunning = 2,\n\tPassed = 3,\n\tFailed = 4,\n\tSkipped = 5,\n\tErrored = 6\n}\n\nexport const testResultStateToContextValues: { [K in TestResultState]: string } = {\n\t[TestResultState.Unset]: 'unset',\n\t[TestResultState.Queued]: 'queued',\n\t[TestResultState.Running]: 'running',\n\t[TestResultState.Passed]: 'passed',\n\t[TestResultState.Failed]: 'failed',\n\t[TestResultState.Skipped]: 'skipped',\n\t[TestResultState.Errored]: 'errored',\n};\n\n/** note: keep in sync with TestRunProfileKind in vscode.d.ts */\nexport const enum ExtTestRunProfileKind {\n\tRun = 1,\n\tDebug = 2,\n\tCoverage = 3,\n}\n\nexport const enum TestControllerCapability {\n\tRefresh = 1 << 1,\n\tCodeRelatedToTest = 1 << 2,\n\tTestRelatedToCode = 1 << 3,\n}\n\nexport const enum TestRunProfileBitset {\n\tRun = 1 << 1,\n\tDebug = 1 << 2,\n\tCoverage = 1 << 3,\n\tHasNonDefaultProfile = 1 << 4,\n\tHasConfigurable = 1 << 5,\n\tSupportsContinuousRun = 1 << 6,\n}\n\nexport const testProfileBitset = {\n\t[TestRunProfileBitset.Run]: localize('testing.runProfileBitset.run', 'Run'),\n\t[TestRunProfileBitset.Debug]: localize('testing.runProfileBitset.debug', 'Debug'),\n\t[TestRunProfileBitset.Coverage]: localize('testing.runProfileBitset.coverage', 'Coverage'),\n};\n\n/**\n * List of all test run profile bitset values.\n */\nexport const testRunProfileBitsetList = [\n\tTestRunProfileBitset.Run,\n\tTestRunProfileBitset.Debug,\n\tTestRunProfileBitset.Coverage,\n\tTestRunProfileBitset.HasNonDefaultProfile,\n\tTestRunProfileBitset.HasConfigurable,\n\tTestRunProfileBitset.SupportsContinuousRun,\n];\n\n/**\n * DTO for a controller's run profiles.\n */\nexport interface ITestRunProfile {\n\tcontrollerId: string;\n\tprofileId: number;\n\tlabel: string;\n\tgroup: TestRunProfileBitset;\n\tisDefault: boolean;\n\ttag: string | null;\n\thasConfigurationHandler: boolean;\n\tsupportsContinuousRun: boolean;\n}\n\nexport interface ITestRunProfileReference {\n\tcontrollerId: string;\n\tprofileId: number;\n\tgroup: TestRunProfileBitset;\n}\n\n/**\n * A fully-resolved request to run tests, passsed between the main thread\n * and extension host.\n */\nexport interface ResolvedTestRunRequest {\n\tgroup: TestRunProfileBitset;\n\ttargets: {\n\t\ttestIds: string[];\n\t\tcontrollerId: string;\n\t\tprofileId: number;\n\t}[];\n\texclude?: string[];\n\t/** Whether this is a continuous test run */\n\tcontinuous?: boolean;\n\t/** Whether this was trigged by a user action in UI. Default=true */\n\tpreserveFocus?: boolean;\n}\n\n/**\n * Request to the main thread to run a set of tests.\n */\nexport interface ExtensionRunTestsRequest {\n\tid: string;\n\tinclude: string[];\n\texclude: string[];\n\tcontrollerId: string;\n\tprofile?: { group: TestRunProfileBitset; id: number };\n\tpersist: boolean;\n\tpreserveFocus: boolean;\n\t/** Whether this is a result of a continuous test run request */\n\tcontinuous: boolean;\n}\n\n/**\n * Request parameters a controller run handler. This is different than\n * {@link IStartControllerTests}. The latter is used to ask for one or more test\n * runs tracked directly by the renderer.\n *\n * This alone can be used to start an autorun, without a specific associated runId.\n */\nexport interface ICallProfileRunHandler {\n\tcontrollerId: string;\n\tprofileId: number;\n\texcludeExtIds: string[];\n\ttestIds: string[];\n}\n\nexport const isStartControllerTests = (t: ICallProfileRunHandler | IStartControllerTests): t is IStartControllerTests => ('runId' as keyof IStartControllerTests) in t;\n\n/**\n * Request from the main thread to run tests for a single controller.\n */\nexport interface IStartControllerTests extends ICallProfileRunHandler {\n\trunId: string;\n}\n\nexport interface IStartControllerTestsResult {\n\terror?: string;\n}\n\n/**\n * Location with a fully-instantiated Range and URI.\n */\nexport interface IRichLocation {\n\trange: Range;\n\turi: URI;\n}\n\n/** Subset of the IUriIdentityService */\nexport interface ITestUriCanonicalizer {\n\t/** @link import('vs/platform/uriIdentity/common/uriIdentity').IUriIdentityService */\n\tasCanonicalUri(uri: URI): URI;\n}\n\nexport namespace IRichLocation {\n\texport interface Serialize {\n\t\trange: IRange;\n\t\turi: UriComponents;\n\t}\n\n\texport const serialize = (location: Readonly<IRichLocation>): Serialize => ({\n\t\trange: location.range.toJSON(),\n\t\turi: location.uri.toJSON(),\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, location: Serialize): IRichLocation => ({\n\t\trange: Range.lift(location.range),\n\t\turi: uriIdentity.asCanonicalUri(URI.revive(location.uri)),\n\t});\n}\n\nexport const enum TestMessageType {\n\tError,\n\tOutput\n}\n\nexport interface ITestMessageStackFrame {\n\tlabel: string;\n\turi: URI | undefined;\n\tposition: Position | undefined;\n}\n\nexport namespace ITestMessageStackFrame {\n\texport interface Serialized {\n\t\tlabel: string;\n\t\turi: UriComponents | undefined;\n\t\tposition: IPosition | undefined;\n\t}\n\n\texport const serialize = (stack: Readonly<ITestMessageStackFrame>): Serialized => ({\n\t\tlabel: stack.label,\n\t\turi: stack.uri?.toJSON(),\n\t\tposition: stack.position?.toJSON(),\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, stack: Serialized): ITestMessageStackFrame => ({\n\t\tlabel: stack.label,\n\t\turi: stack.uri ? uriIdentity.asCanonicalUri(URI.revive(stack.uri)) : undefined,\n\t\tposition: stack.position ? Position.lift(stack.position) : undefined,\n\t});\n}\n\nexport interface ITestErrorMessage {\n\tmessage: string | IMarkdownString;\n\ttype: TestMessageType.Error;\n\texpected: string | undefined;\n\tactual: string | undefined;\n\tcontextValue: string | undefined;\n\tlocation: IRichLocation | undefined;\n\tstackTrace: undefined | ITestMessageStackFrame[];\n}\n\nexport namespace ITestErrorMessage {\n\texport interface Serialized {\n\t\tmessage: string | IMarkdownString;\n\t\ttype: TestMessageType.Error;\n\t\texpected: string | undefined;\n\t\tactual: string | undefined;\n\t\tcontextValue: string | undefined;\n\t\tlocation: IRichLocation.Serialize | undefined;\n\t\tstackTrace: undefined | ITestMessageStackFrame.Serialized[];\n\t}\n\n\texport const serialize = (message: Readonly<ITestErrorMessage>): Serialized => ({\n\t\tmessage: message.message,\n\t\ttype: TestMessageType.Error,\n\t\texpected: message.expected,\n\t\tactual: message.actual,\n\t\tcontextValue: message.contextValue,\n\t\tlocation: message.location && IRichLocation.serialize(message.location),\n\t\tstackTrace: message.stackTrace?.map(ITestMessageStackFrame.serialize),\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, message: Serialized): ITestErrorMessage => ({\n\t\tmessage: message.message,\n\t\ttype: TestMessageType.Error,\n\t\texpected: message.expected,\n\t\tactual: message.actual,\n\t\tcontextValue: message.contextValue,\n\t\tlocation: message.location && IRichLocation.deserialize(uriIdentity, message.location),\n\t\tstackTrace: message.stackTrace && message.stackTrace.map(s => ITestMessageStackFrame.deserialize(uriIdentity, s)),\n\t});\n}\n\nexport interface ITestOutputMessage {\n\tmessage: string;\n\ttype: TestMessageType.Output;\n\toffset: number;\n\tlength: number;\n\tmarker?: number;\n\tlocation: IRichLocation | undefined;\n}\n\n/**\n * Gets the TTY marker ID for either starting or ending\n * an ITestOutputMessage.marker of the given ID.\n */\nexport const getMarkId = (marker: number, start: boolean) => `${start ? 's' : 'e'}${marker}`;\n\nexport namespace ITestOutputMessage {\n\texport interface Serialized {\n\t\tmessage: string;\n\t\toffset: number;\n\t\tlength: number;\n\t\ttype: TestMessageType.Output;\n\t\tlocation: IRichLocation.Serialize | undefined;\n\t}\n\n\texport const serialize = (message: Readonly<ITestOutputMessage>): Serialized => ({\n\t\tmessage: message.message,\n\t\ttype: TestMessageType.Output,\n\t\toffset: message.offset,\n\t\tlength: message.length,\n\t\tlocation: message.location && IRichLocation.serialize(message.location),\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, message: Serialized): ITestOutputMessage => ({\n\t\tmessage: message.message,\n\t\ttype: TestMessageType.Output,\n\t\toffset: message.offset,\n\t\tlength: message.length,\n\t\tlocation: message.location && IRichLocation.deserialize(uriIdentity, message.location),\n\t});\n}\n\nexport type ITestMessage = ITestErrorMessage | ITestOutputMessage;\n\nexport namespace ITestMessage {\n\texport type Serialized = ITestErrorMessage.Serialized | ITestOutputMessage.Serialized;\n\n\texport const serialize = (message: Readonly<ITestMessage>): Serialized =>\n\t\tmessage.type === TestMessageType.Error ? ITestErrorMessage.serialize(message) : ITestOutputMessage.serialize(message);\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, message: Serialized): ITestMessage =>\n\t\tmessage.type === TestMessageType.Error ? ITestErrorMessage.deserialize(uriIdentity, message) : ITestOutputMessage.deserialize(uriIdentity, message);\n\n\texport const isDiffable = (message: ITestMessage): message is ITestErrorMessage & { actual: string; expected: string } =>\n\t\tmessage.type === TestMessageType.Error && message.actual !== undefined && message.expected !== undefined;\n}\n\nexport interface ITestTaskState {\n\tstate: TestResultState;\n\tduration: number | undefined;\n\tmessages: ITestMessage[];\n}\n\nexport namespace ITestTaskState {\n\texport interface Serialized {\n\t\tstate: TestResultState;\n\t\tduration: number | undefined;\n\t\tmessages: ITestMessage.Serialized[];\n\t}\n\n\texport const serializeWithoutMessages = (state: ITestTaskState): Serialized => ({\n\t\tstate: state.state,\n\t\tduration: state.duration,\n\t\tmessages: [],\n\t});\n\n\texport const serialize = (state: Readonly<ITestTaskState>): Serialized => ({\n\t\tstate: state.state,\n\t\tduration: state.duration,\n\t\tmessages: state.messages.map(ITestMessage.serialize),\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, state: Serialized): ITestTaskState => ({\n\t\tstate: state.state,\n\t\tduration: state.duration,\n\t\tmessages: state.messages.map(m => ITestMessage.deserialize(uriIdentity, m)),\n\t});\n}\n\nexport interface ITestRunTask {\n\tid: string;\n\tname: string;\n\trunning: boolean;\n\tctrlId: string;\n}\n\nexport interface ITestTag {\n\treadonly id: string;\n}\n\nconst testTagDelimiter = '\\0';\n\nexport const namespaceTestTag =\n\t(ctrlId: string, tagId: string) => ctrlId + testTagDelimiter + tagId;\n\nexport const denamespaceTestTag = (namespaced: string) => {\n\tconst index = namespaced.indexOf(testTagDelimiter);\n\treturn { ctrlId: namespaced.slice(0, index), tagId: namespaced.slice(index + 1) };\n};\n\nexport interface ITestTagDisplayInfo {\n\tid: string;\n}\n\n/**\n * The TestItem from .d.ts, as a plain object without children.\n */\nexport interface ITestItem {\n\t/** ID of the test given by the test controller */\n\textId: string;\n\tlabel: string;\n\ttags: string[];\n\tbusy: boolean;\n\tchildren?: never;\n\turi: URI | undefined;\n\trange: Range | null;\n\tdescription: string | null;\n\terror: string | IMarkdownString | null;\n\tsortText: string | null;\n}\n\nexport namespace ITestItem {\n\texport interface Serialized {\n\t\textId: string;\n\t\tlabel: string;\n\t\ttags: string[];\n\t\tbusy: boolean;\n\t\tchildren?: never;\n\t\turi: UriComponents | undefined;\n\t\trange: IRange | null;\n\t\tdescription: string | null;\n\t\terror: string | IMarkdownString | null;\n\t\tsortText: string | null;\n\t}\n\n\texport const serialize = (item: Readonly<ITestItem>): Serialized => ({\n\t\textId: item.extId,\n\t\tlabel: item.label,\n\t\ttags: item.tags,\n\t\tbusy: item.busy,\n\t\tchildren: undefined,\n\t\turi: item.uri?.toJSON(),\n\t\trange: item.range?.toJSON() || null,\n\t\tdescription: item.description,\n\t\terror: item.error,\n\t\tsortText: item.sortText\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, serialized: Serialized): ITestItem => ({\n\t\textId: serialized.extId,\n\t\tlabel: serialized.label,\n\t\ttags: serialized.tags,\n\t\tbusy: serialized.busy,\n\t\tchildren: undefined,\n\t\turi: serialized.uri ? uriIdentity.asCanonicalUri(URI.revive(serialized.uri)) : undefined,\n\t\trange: serialized.range ? Range.lift(serialized.range) : null,\n\t\tdescription: serialized.description,\n\t\terror: serialized.error,\n\t\tsortText: serialized.sortText\n\t});\n}\n\nexport const enum TestItemExpandState {\n\tNotExpandable,\n\tExpandable,\n\tBusyExpanding,\n\tExpanded,\n}\n\n/**\n * TestItem-like shape, but with an ID and children as strings.\n */\nexport interface InternalTestItem {\n\t/** Controller ID from whence this test came */\n\tcontrollerId: string;\n\t/** Expandability state */\n\texpand: TestItemExpandState;\n\t/** Raw test item properties */\n\titem: ITestItem;\n}\n\nexport namespace InternalTestItem {\n\texport interface Serialized {\n\t\texpand: TestItemExpandState;\n\t\titem: ITestItem.Serialized;\n\t}\n\n\texport const serialize = (item: Readonly<InternalTestItem>): Serialized => ({\n\t\texpand: item.expand,\n\t\titem: ITestItem.serialize(item.item)\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, serialized: Serialized): InternalTestItem => ({\n\t\t// the `controllerId` is derived from the test.item.extId. It's redundant\n\t\t// in the non-serialized InternalTestItem too, but there just because it's\n\t\t// checked against in many hot paths.\n\t\tcontrollerId: TestId.root(serialized.item.extId),\n\t\texpand: serialized.expand,\n\t\titem: ITestItem.deserialize(uriIdentity, serialized.item)\n\t});\n}\n\n/**\n * A partial update made to an existing InternalTestItem.\n */\nexport interface ITestItemUpdate {\n\textId: string;\n\texpand?: TestItemExpandState;\n\titem?: Partial<ITestItem>;\n}\n\nexport namespace ITestItemUpdate {\n\texport interface Serialized {\n\t\textId: string;\n\t\texpand?: TestItemExpandState;\n\t\titem?: Partial<ITestItem.Serialized>;\n\t}\n\n\texport const serialize = (u: Readonly<ITestItemUpdate>): Serialized => {\n\t\tlet item: Partial<ITestItem.Serialized> | undefined;\n\t\tif (u.item) {\n\t\t\titem = {};\n\t\t\tif (u.item.label !== undefined) { item.label = u.item.label; }\n\t\t\tif (u.item.tags !== undefined) { item.tags = u.item.tags; }\n\t\t\tif (u.item.busy !== undefined) { item.busy = u.item.busy; }\n\t\t\tif (u.item.uri !== undefined) { item.uri = u.item.uri?.toJSON(); }\n\t\t\tif (u.item.range !== undefined) { item.range = u.item.range?.toJSON(); }\n\t\t\tif (u.item.description !== undefined) { item.description = u.item.description; }\n\t\t\tif (u.item.error !== undefined) { item.error = u.item.error; }\n\t\t\tif (u.item.sortText !== undefined) { item.sortText = u.item.sortText; }\n\t\t}\n\n\t\treturn { extId: u.extId, expand: u.expand, item };\n\t};\n\n\texport const deserialize = (u: Serialized): ITestItemUpdate => {\n\t\tlet item: Partial<ITestItem> | undefined;\n\t\tif (u.item) {\n\t\t\titem = {};\n\t\t\tif (u.item.label !== undefined) { item.label = u.item.label; }\n\t\t\tif (u.item.tags !== undefined) { item.tags = u.item.tags; }\n\t\t\tif (u.item.busy !== undefined) { item.busy = u.item.busy; }\n\t\t\tif (u.item.range !== undefined) { item.range = u.item.range ? Range.lift(u.item.range) : null; }\n\t\t\tif (u.item.description !== undefined) { item.description = u.item.description; }\n\t\t\tif (u.item.error !== undefined) { item.error = u.item.error; }\n\t\t\tif (u.item.sortText !== undefined) { item.sortText = u.item.sortText; }\n\t\t}\n\n\t\treturn { extId: u.extId, expand: u.expand, item };\n\t};\n\n}\n\nexport const applyTestItemUpdate = (internal: InternalTestItem | ITestItemUpdate, patch: ITestItemUpdate) => {\n\tif (patch.expand !== undefined) {\n\t\tinternal.expand = patch.expand;\n\t}\n\tif (patch.item !== undefined) {\n\t\tinternal.item = internal.item ? Object.assign(internal.item, patch.item) : patch.item;\n\t}\n};\n\n/** Request to an ext host to get followup messages for a test failure. */\nexport interface TestMessageFollowupRequest {\n\tresultId: string;\n\textId: string;\n\ttaskIndex: number;\n\tmessageIndex: number;\n}\n\n/** Request to an ext host to get followup messages for a test failure. */\nexport interface TestMessageFollowupResponse {\n\tid: number;\n\ttitle: string;\n}\n\n/**\n * Test result item used in the main thread.\n */\nexport interface TestResultItem extends InternalTestItem {\n\t/** State of this test in various tasks */\n\ttasks: ITestTaskState[];\n\t/** State of this test as a computation of its tasks */\n\townComputedState: TestResultState;\n\t/** Computed state based on children */\n\tcomputedState: TestResultState;\n\t/** Max duration of the item's tasks (if run directly) */\n\townDuration?: number;\n\t/** Whether this test item is outdated */\n\tretired?: boolean;\n}\n\nexport namespace TestResultItem {\n\t/**\n\t * Serialized version of the TestResultItem. Note that 'retired' is not\n\t * included since all hydrated items are automatically retired.\n\t */\n\texport interface Serialized extends InternalTestItem.Serialized {\n\t\ttasks: ITestTaskState.Serialized[];\n\t\townComputedState: TestResultState;\n\t\tcomputedState: TestResultState;\n\t}\n\n\texport const serializeWithoutMessages = (original: TestResultItem): Serialized => ({\n\t\t...InternalTestItem.serialize(original),\n\t\townComputedState: original.ownComputedState,\n\t\tcomputedState: original.computedState,\n\t\ttasks: original.tasks.map(ITestTaskState.serializeWithoutMessages),\n\t});\n\n\texport const serialize = (original: Readonly<TestResultItem>): Serialized => ({\n\t\t...InternalTestItem.serialize(original),\n\t\townComputedState: original.ownComputedState,\n\t\tcomputedState: original.computedState,\n\t\ttasks: original.tasks.map(ITestTaskState.serialize),\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, serialized: Serialized): TestResultItem => ({\n\t\t...InternalTestItem.deserialize(uriIdentity, serialized),\n\t\townComputedState: serialized.ownComputedState,\n\t\tcomputedState: serialized.computedState,\n\t\ttasks: serialized.tasks.map(m => ITestTaskState.deserialize(uriIdentity, m)),\n\t\tretired: true,\n\t});\n}\n\nexport interface ISerializedTestResults {\n\t/** ID of these test results */\n\tid: string;\n\t/** Time the results were compelted */\n\tcompletedAt: number;\n\t/** Subset of test result items */\n\titems: TestResultItem.Serialized[];\n\t/** Tasks involved in the run. */\n\ttasks: { id: string; name: string | undefined; ctrlId: string; hasCoverage: boolean }[];\n\t/** Human-readable name of the test run. */\n\tname: string;\n\t/** Test trigger informaton */\n\trequest: ResolvedTestRunRequest;\n}\n\nexport interface ITestCoverage {\n\tfiles: IFileCoverage[];\n}\n\nexport interface ICoverageCount {\n\tcovered: number;\n\ttotal: number;\n}\n\nexport namespace ICoverageCount {\n\texport const empty = (): ICoverageCount => ({ covered: 0, total: 0 });\n\texport const sum = (target: ICoverageCount, src: Readonly<ICoverageCount>) => {\n\t\ttarget.covered += src.covered;\n\t\ttarget.total += src.total;\n\t};\n}\n\nexport interface IFileCoverage {\n\tid: string;\n\turi: URI;\n\ttestIds?: string[];\n\tstatement: ICoverageCount;\n\tbranch?: ICoverageCount;\n\tdeclaration?: ICoverageCount;\n}\n\nexport namespace IFileCoverage {\n\texport interface Serialized {\n\t\tid: string;\n\t\turi: UriComponents;\n\t\ttestIds: string[] | undefined;\n\t\tstatement: ICoverageCount;\n\t\tbranch?: ICoverageCount;\n\t\tdeclaration?: ICoverageCount;\n\t}\n\n\texport const serialize = (original: Readonly<IFileCoverage>): Serialized => ({\n\t\tid: original.id,\n\t\tstatement: original.statement,\n\t\tbranch: original.branch,\n\t\tdeclaration: original.declaration,\n\t\ttestIds: original.testIds,\n\t\turi: original.uri.toJSON(),\n\t});\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, serialized: Serialized): IFileCoverage => ({\n\t\tid: serialized.id,\n\t\tstatement: serialized.statement,\n\t\tbranch: serialized.branch,\n\t\tdeclaration: serialized.declaration,\n\t\ttestIds: serialized.testIds,\n\t\turi: uriIdentity.asCanonicalUri(URI.revive(serialized.uri)),\n\t});\n\n\texport const empty = (id: string, uri: URI): IFileCoverage => ({\n\t\tid,\n\t\turi,\n\t\tstatement: ICoverageCount.empty(),\n\t});\n}\n\nfunction serializeThingWithLocation<T extends { location?: Range | Position }>(serialized: T): T & { location?: IRange | IPosition } {\n\treturn {\n\t\t...serialized,\n\t\tlocation: serialized.location?.toJSON(),\n\t};\n}\n\nfunction deserializeThingWithLocation<T extends { location?: IRange | IPosition }>(serialized: T): T & { location?: Range | Position } {\n\tserialized.location = serialized.location ? (Position.isIPosition(serialized.location) ? Position.lift(serialized.location) : Range.lift(serialized.location)) : undefined;\n\treturn serialized as T & { location?: Range | Position };\n}\n\n/** Number of recent runs in which coverage reports should be retained. */\nexport const KEEP_N_LAST_COVERAGE_REPORTS = 3;\n\nexport const enum DetailType {\n\tDeclaration,\n\tStatement,\n\tBranch,\n}\n\nexport type CoverageDetails = IDeclarationCoverage | IStatementCoverage;\n\nexport namespace CoverageDetails {\n\texport type Serialized = IDeclarationCoverage.Serialized | IStatementCoverage.Serialized;\n\n\texport const serialize = (original: Readonly<CoverageDetails>): Serialized =>\n\t\toriginal.type === DetailType.Declaration ? IDeclarationCoverage.serialize(original) : IStatementCoverage.serialize(original);\n\n\texport const deserialize = (serialized: Serialized): CoverageDetails =>\n\t\tserialized.type === DetailType.Declaration ? IDeclarationCoverage.deserialize(serialized) : IStatementCoverage.deserialize(serialized);\n}\n\nexport interface IBranchCoverage {\n\tcount: number | boolean;\n\tlabel?: string;\n\tlocation?: Range | Position;\n}\n\nexport namespace IBranchCoverage {\n\texport interface Serialized {\n\t\tcount: number | boolean;\n\t\tlabel?: string;\n\t\tlocation?: IRange | IPosition;\n\t}\n\n\texport const serialize: (original: IBranchCoverage) => Serialized = serializeThingWithLocation;\n\texport const deserialize: (original: Serialized) => IBranchCoverage = deserializeThingWithLocation;\n}\n\nexport interface IDeclarationCoverage {\n\ttype: DetailType.Declaration;\n\tname: string;\n\tcount: number | boolean;\n\tlocation: Range | Position;\n}\n\nexport namespace IDeclarationCoverage {\n\texport interface Serialized {\n\t\ttype: DetailType.Declaration;\n\t\tname: string;\n\t\tcount: number | boolean;\n\t\tlocation: IRange | IPosition;\n\t}\n\n\texport const serialize: (original: IDeclarationCoverage) => Serialized = serializeThingWithLocation;\n\texport const deserialize: (original: Serialized) => IDeclarationCoverage = deserializeThingWithLocation;\n}\n\nexport interface IStatementCoverage {\n\ttype: DetailType.Statement;\n\tcount: number | boolean;\n\tlocation: Range | Position;\n\tbranches?: IBranchCoverage[];\n}\n\nexport namespace IStatementCoverage {\n\texport interface Serialized {\n\t\ttype: DetailType.Statement;\n\t\tcount: number | boolean;\n\t\tlocation: IRange | IPosition;\n\t\tbranches?: IBranchCoverage.Serialized[];\n\t}\n\n\texport const serialize = (original: Readonly<IStatementCoverage>): Serialized => ({\n\t\t...serializeThingWithLocation(original),\n\t\tbranches: original.branches?.map(IBranchCoverage.serialize),\n\t});\n\n\texport const deserialize = (serialized: Serialized): IStatementCoverage => ({\n\t\t...deserializeThingWithLocation(serialized),\n\t\tbranches: serialized.branches?.map(IBranchCoverage.deserialize),\n\t});\n}\n\nexport const enum TestDiffOpType {\n\t/** Adds a new test (with children) */\n\tAdd,\n\t/** Shallow-updates an existing test */\n\tUpdate,\n\t/** Ranges of some tests in a document were synced, so it should be considered up-to-date */\n\tDocumentSynced,\n\t/** Removes a test (and all its children) */\n\tRemove,\n\t/** Changes the number of controllers who are yet to publish their collection roots. */\n\tIncrementPendingExtHosts,\n\t/** Retires a test/result */\n\tRetire,\n\t/** Add a new test tag */\n\tAddTag,\n\t/** Remove a test tag */\n\tRemoveTag,\n}\n\nexport type TestsDiffOp =\n\t| { op: TestDiffOpType.Add; item: InternalTestItem }\n\t| { op: TestDiffOpType.Update; item: ITestItemUpdate }\n\t| { op: TestDiffOpType.Remove; itemId: string }\n\t| { op: TestDiffOpType.Retire; itemId: string }\n\t| { op: TestDiffOpType.IncrementPendingExtHosts; amount: number }\n\t| { op: TestDiffOpType.AddTag; tag: ITestTagDisplayInfo }\n\t| { op: TestDiffOpType.RemoveTag; id: string }\n\t| { op: TestDiffOpType.DocumentSynced; uri: URI; docv?: number };\n\nexport namespace TestsDiffOp {\n\texport type Serialized =\n\t\t| { op: TestDiffOpType.Add; item: InternalTestItem.Serialized }\n\t\t| { op: TestDiffOpType.Update; item: ITestItemUpdate.Serialized }\n\t\t| { op: TestDiffOpType.Remove; itemId: string }\n\t\t| { op: TestDiffOpType.Retire; itemId: string }\n\t\t| { op: TestDiffOpType.IncrementPendingExtHosts; amount: number }\n\t\t| { op: TestDiffOpType.AddTag; tag: ITestTagDisplayInfo }\n\t\t| { op: TestDiffOpType.RemoveTag; id: string }\n\t\t| { op: TestDiffOpType.DocumentSynced; uri: UriComponents; docv?: number };\n\n\texport const deserialize = (uriIdentity: ITestUriCanonicalizer, u: Serialized): TestsDiffOp => {\n\t\tif (u.op === TestDiffOpType.Add) {\n\t\t\treturn { op: u.op, item: InternalTestItem.deserialize(uriIdentity, u.item) };\n\t\t} else if (u.op === TestDiffOpType.Update) {\n\t\t\treturn { op: u.op, item: ITestItemUpdate.deserialize(u.item) };\n\t\t} else if (u.op === TestDiffOpType.DocumentSynced) {\n\t\t\treturn { op: u.op, uri: uriIdentity.asCanonicalUri(URI.revive(u.uri)), docv: u.docv };\n\t\t} else {\n\t\t\treturn u;\n\t\t}\n\t};\n\n\texport const serialize = (u: Readonly<TestsDiffOp>): Serialized => {\n\t\tif (u.op === TestDiffOpType.Add) {\n\t\t\treturn { op: u.op, item: InternalTestItem.serialize(u.item) };\n\t\t} else if (u.op === TestDiffOpType.Update) {\n\t\t\treturn { op: u.op, item: ITestItemUpdate.serialize(u.item) };\n\t\t} else {\n\t\t\treturn u;\n\t\t}\n\t};\n}\n\n/**\n * Context for actions taken in the test explorer view.\n */\nexport interface ITestItemContext {\n\t/** Marshalling marker */\n\t$mid: MarshalledId.TestItemContext;\n\t/** Tests and parents from the root to the current items */\n\ttests: InternalTestItem.Serialized[];\n}\n\n/**\n * Context for actions taken in the test explorer view.\n */\nexport interface ITestMessageMenuArgs {\n\t/** Marshalling marker */\n\t$mid: MarshalledId.TestMessageMenuArgs;\n\t/** Tests ext ID */\n\ttest: InternalTestItem.Serialized;\n\t/** Serialized test message */\n\tmessage: ITestMessage.Serialized;\n}\n\n/**\n * Request from the ext host or main thread to indicate that tests have\n * changed. It's assumed that any item upserted *must* have its children\n * previously also upserted, or upserted as part of the same operation.\n * Children that no longer exist in an upserted item will be removed.\n */\nexport type TestsDiff = TestsDiffOp[];\n\n/**\n * @private\n */\nexport interface IncrementalTestCollectionItem extends InternalTestItem {\n\tchildren: Set<string>;\n}\n\n/**\n * The IncrementalChangeCollector is used in the IncrementalTestCollection\n * and called with diff changes as they're applied. This is used in the\n * ext host to create a cohesive change event from a diff.\n */\nexport interface IncrementalChangeCollector<T> {\n\t/**\n\t * A node was added.\n\t */\n\tadd?(node: T): void;\n\n\t/**\n\t * A node in the collection was updated.\n\t */\n\tupdate?(node: T): void;\n\n\t/**\n\t * A node was removed.\n\t */\n\tremove?(node: T, isNestedOperation: boolean): void;\n\n\t/**\n\t * Called when the diff has been applied.\n\t */\n\tcomplete?(): void;\n}\n\n/**\n * Maintains tests in this extension host sent from the main thread.\n */\nexport abstract class AbstractIncrementalTestCollection<T extends IncrementalTestCollectionItem> {\n\tprivate readonly _tags = new Map<string, ITestTagDisplayInfo>();\n\n\t/**\n\t * Map of item IDs to test item objects.\n\t */\n\tprotected readonly items = new Map<string, T>();\n\n\t/**\n\t * ID of test root items.\n\t */\n\tprotected readonly roots = new Set<T>();\n\n\t/**\n\t * Number of 'busy' controllers.\n\t */\n\tprotected busyControllerCount = 0;\n\n\t/**\n\t * Number of pending roots.\n\t */\n\tprotected pendingRootCount = 0;\n\n\t/**\n\t * Known test tags.\n\t */\n\tpublic readonly tags: ReadonlyMap<string, ITestTagDisplayInfo> = this._tags;\n\n\tconstructor(private readonly uriIdentity: ITestUriCanonicalizer) { }\n\n\t/**\n\t * Applies the diff to the collection.\n\t */\n\tpublic apply(diff: TestsDiff) {\n\t\tconst changes = this.createChangeCollector();\n\n\t\tfor (const op of diff) {\n\t\t\tswitch (op.op) {\n\t\t\t\tcase TestDiffOpType.Add:\n\t\t\t\t\tthis.add(InternalTestItem.deserialize(this.uriIdentity, op.item), changes);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase TestDiffOpType.Update:\n\t\t\t\t\tthis.update(ITestItemUpdate.deserialize(op.item), changes);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase TestDiffOpType.Remove:\n\t\t\t\t\tthis.remove(op.itemId, changes);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase TestDiffOpType.Retire:\n\t\t\t\t\tthis.retireTest(op.itemId);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase TestDiffOpType.IncrementPendingExtHosts:\n\t\t\t\t\tthis.updatePendingRoots(op.amount);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase TestDiffOpType.AddTag:\n\t\t\t\t\tthis._tags.set(op.tag.id, op.tag);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase TestDiffOpType.RemoveTag:\n\t\t\t\t\tthis._tags.delete(op.id);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tchanges.complete?.();\n\t}\n\n\tprotected add(item: InternalTestItem, changes: IncrementalChangeCollector<T>\n\t) {\n\t\tconst parentId = TestId.parentId(item.item.extId)?.toString();\n\t\tlet created: T;\n\t\tif (!parentId) {\n\t\t\tcreated = this.createItem(item);\n\t\t\tthis.roots.add(created);\n\t\t\tthis.items.set(item.item.extId, created);\n\t\t} else if (this.items.has(parentId)) {\n\t\t\tconst parent = this.items.get(parentId)!;\n\t\t\tparent.children.add(item.item.extId);\n\t\t\tcreated = this.createItem(item, parent);\n\t\t\tthis.items.set(item.item.extId, created);\n\t\t} else {\n\t\t\tconsole.error(`Test with unknown parent ID: ${JSON.stringify(item)}`);\n\t\t\treturn;\n\t\t}\n\n\t\tchanges.add?.(created);\n\t\tif (item.expand === TestItemExpandState.BusyExpanding) {\n\t\t\tthis.busyControllerCount++;\n\t\t}\n\n\t\treturn created;\n\t}\n\n\tprotected update(patch: ITestItemUpdate, changes: IncrementalChangeCollector<T>\n\t) {\n\t\tconst existing = this.items.get(patch.extId);\n\t\tif (!existing) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (patch.expand !== undefined) {\n\t\t\tif (existing.expand === TestItemExpandState.BusyExpanding) {\n\t\t\t\tthis.busyControllerCount--;\n\t\t\t}\n\t\t\tif (patch.expand === TestItemExpandState.BusyExpanding) {\n\t\t\t\tthis.busyControllerCount++;\n\t\t\t}\n\t\t}\n\n\t\tapplyTestItemUpdate(existing, patch);\n\t\tchanges.update?.(existing);\n\t\treturn existing;\n\t}\n\n\tprotected remove(itemId: string, changes: IncrementalChangeCollector<T>) {\n\t\tconst toRemove = this.items.get(itemId);\n\t\tif (!toRemove) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst parentId = TestId.parentId(toRemove.item.extId)?.toString();\n\t\tif (parentId) {\n\t\t\tconst parent = this.items.get(parentId)!;\n\t\t\tparent.children.delete(toRemove.item.extId);\n\t\t} else {\n\t\t\tthis.roots.delete(toRemove);\n\t\t}\n\n\t\tconst queue: Iterable<string>[] = [[itemId]];\n\t\twhile (queue.length) {\n\t\t\tfor (const itemId of queue.pop()!) {\n\t\t\t\tconst existing = this.items.get(itemId);\n\t\t\t\tif (existing) {\n\t\t\t\t\tqueue.push(existing.children);\n\t\t\t\t\tthis.items.delete(itemId);\n\t\t\t\t\tchanges.remove?.(existing, existing !== toRemove);\n\n\t\t\t\t\tif (existing.expand === TestItemExpandState.BusyExpanding) {\n\t\t\t\t\t\tthis.busyControllerCount--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Called when the extension signals a test result should be retired.\n\t */\n\tprotected retireTest(testId: string) {\n\t\t// no-op\n\t}\n\n\t/**\n\t * Updates the number of test root sources who are yet to report. When\n\t * the total pending test roots reaches 0, the roots for all controllers\n\t * will exist in the collection.\n\t */\n\tpublic updatePendingRoots(delta: number) {\n\t\tthis.pendingRootCount += delta;\n\t}\n\n\t/**\n\t * Called before a diff is applied to create a new change collector.\n\t */\n\tprotected createChangeCollector(): IncrementalChangeCollector<T> {\n\t\treturn {};\n\t}\n\n\t/**\n\t * Creates a new item for the collection from the internal test item.\n\t */\n\tprotected abstract createItem(internal: InternalTestItem, parent?: T): T;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../../base/common/event.js';\nimport { IInstantiationService, createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IEditorPane, GroupIdentifier, EditorInputWithOptions, CloseDirection, IEditorPartOptions, IEditorPartOptionsChangeEvent, EditorsOrder, IVisibleEditorPane, IEditorCloseEvent, IUntypedEditorInput, isEditorInput, IEditorWillMoveEvent, IMatchEditorOptions, IActiveEditorChangeEvent, IFindEditorOptions, IToolbarActions } from '../../../common/editor.js';\nimport { EditorInput } from '../../../common/editor/editorInput.js';\nimport { IEditorOptions } from '../../../../platform/editor/common/editor.js';\nimport { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';\nimport { IDimension } from '../../../../editor/common/core/2d/dimension.js';\nimport { DisposableStore, IDisposable } from '../../../../base/common/lifecycle.js';\nimport { ContextKeyValue, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { IGroupModelChangeEvent } from '../../../common/editor/editorGroupModel.js';\nimport { IRectangle } from '../../../../platform/window/common/window.js';\nimport { IMenuChangeEvent, MenuId } from '../../../../platform/actions/common/actions.js';\nimport { DeepPartial } from '../../../../base/common/types.js';\n\nexport const IEditorGroupsService = createDecorator<IEditorGroupsService>('editorGroupsService');\n\nexport const enum GroupDirection {\n\tUP,\n\tDOWN,\n\tLEFT,\n\tRIGHT\n}\n\nexport const enum GroupOrientation {\n\tHORIZONTAL,\n\tVERTICAL\n}\n\nexport const enum GroupLocation {\n\tFIRST,\n\tLAST,\n\tNEXT,\n\tPREVIOUS\n}\n\nexport interface IFindGroupScope {\n\treadonly direction?: GroupDirection;\n\treadonly location?: GroupLocation;\n}\n\nexport const enum GroupsArrangement {\n\t/**\n\t * Make the current active group consume the entire\n\t * editor area.\n\t */\n\tMAXIMIZE,\n\n\t/**\n\t * Make the current active group consume the maximum\n\t * amount of space possible.\n\t */\n\tEXPAND,\n\n\t/**\n\t * Size all groups evenly.\n\t */\n\tEVEN\n}\n\nexport interface GroupLayoutArgument {\n\n\t/**\n\t * Only applies when there are multiple groups\n\t * arranged next to each other in a row or column.\n\t * If provided, their sum must be 1 to be applied\n\t * per row or column.\n\t */\n\treadonly size?: number;\n\n\t/**\n\t * Editor groups  will be laid out orthogonal to the\n\t * parent orientation.\n\t */\n\treadonly groups?: GroupLayoutArgument[];\n}\n\nexport interface EditorGroupLayout {\n\n\t/**\n\t * The initial orientation of the editor groups at the root.\n\t */\n\treadonly orientation: GroupOrientation;\n\n\t/**\n\t * The editor groups at the root of the layout.\n\t */\n\treadonly groups: GroupLayoutArgument[];\n}\n\nexport const enum MergeGroupMode {\n\tCOPY_EDITORS,\n\tMOVE_EDITORS\n}\n\nexport interface IMergeGroupOptions {\n\tmode?: MergeGroupMode;\n\treadonly index?: number;\n\n\t/**\n\t * Set this to prevent editors already present in the\n\t * target group from moving to a different index as\n\t * they are in the source group.\n\t */\n\treadonly preserveExistingIndex?: boolean;\n}\n\nexport interface ICloseEditorOptions {\n\treadonly preserveFocus?: boolean;\n}\n\nexport type ICloseEditorsFilter = {\n\treadonly except?: EditorInput;\n\treadonly direction?: CloseDirection;\n\treadonly savedOnly?: boolean;\n\treadonly excludeSticky?: boolean;\n};\n\nexport interface ICloseAllEditorsOptions {\n\treadonly excludeSticky?: boolean;\n\treadonly excludeConfirming?: boolean;\n}\n\nexport interface IEditorReplacement {\n\treadonly editor: EditorInput;\n\treadonly replacement: EditorInput;\n\treadonly options?: IEditorOptions;\n\n\t/**\n\t * Skips asking the user for confirmation and doesn't\n\t * save the document. Only use this if you really need to!\n\t */\n\treadonly forceReplaceDirty?: boolean;\n}\n\nexport function isEditorReplacement(replacement: unknown): replacement is IEditorReplacement {\n\tconst candidate = replacement as IEditorReplacement | undefined;\n\n\treturn isEditorInput(candidate?.editor) && isEditorInput(candidate?.replacement);\n}\n\nexport const enum GroupsOrder {\n\n\t/**\n\t * Groups sorted by creation order (oldest one first)\n\t */\n\tCREATION_TIME,\n\n\t/**\n\t * Groups sorted by most recent activity (most recent active first)\n\t */\n\tMOST_RECENTLY_ACTIVE,\n\n\t/**\n\t * Groups sorted by grid widget order\n\t */\n\tGRID_APPEARANCE\n}\n\nexport interface IEditorSideGroup {\n\n\t/**\n\t * Open an editor in this group.\n\t *\n\t * @returns a promise that resolves around an IEditor instance unless\n\t * the call failed, or the editor was not opened as active editor.\n\t */\n\topenEditor(editor: EditorInput, options?: IEditorOptions): Promise<IEditorPane | undefined>;\n}\n\nexport interface IEditorDropTargetDelegate {\n\n\t/**\n\t * A helper to figure out if the drop target contains the provided group.\n\t */\n\tcontainsGroup?(groupView: IEditorGroup): boolean;\n}\n\n/**\n * The basic primitive to work with editor groups. This interface is both implemented\n * by editor part component as well as the editor groups service that operates across\n * all opened editor parts.\n */\nexport interface IEditorGroupsContainer {\n\n\t/**\n\t * An event for when the active editor group changes. The active editor\n\t * group is the default location for new editors to open.\n\t */\n\treadonly onDidChangeActiveGroup: Event<IEditorGroup>;\n\n\t/**\n\t * An event for when a new group was added.\n\t */\n\treadonly onDidAddGroup: Event<IEditorGroup>;\n\n\t/**\n\t * An event for when a group was removed.\n\t */\n\treadonly onDidRemoveGroup: Event<IEditorGroup>;\n\n\t/**\n\t * An event for when a group was moved.\n\t */\n\treadonly onDidMoveGroup: Event<IEditorGroup>;\n\n\t/**\n\t * An event for when a group gets activated.\n\t */\n\treadonly onDidActivateGroup: Event<IEditorGroup>;\n\n\t/**\n\t * An event for when the index of a group changes.\n\t */\n\treadonly onDidChangeGroupIndex: Event<IEditorGroup>;\n\n\t/**\n\t * An event for when the locked state of a group changes.\n\t */\n\treadonly onDidChangeGroupLocked: Event<IEditorGroup>;\n\n\t/**\n\t * An event for when the maximized state of a group changes.\n\t */\n\treadonly onDidChangeGroupMaximized: Event<boolean>;\n\n\t/**\n\t * An event that notifies when container options change.\n\t */\n\treadonly onDidChangeEditorPartOptions: Event<IEditorPartOptionsChangeEvent>;\n\n\t/**\n\t * A property that indicates when groups have been created\n\t * and are ready to be used in the container.\n\t */\n\treadonly isReady: boolean;\n\n\t/**\n\t * A promise that resolves when groups have been created\n\t * and are ready to be used in the container.\n\t *\n\t * Await this promise to safely work on the editor groups model\n\t * (for example, install editor group listeners).\n\t *\n\t * Use the `whenRestored` property to await visible editors\n\t * having fully resolved.\n\t */\n\treadonly whenReady: Promise<void>;\n\n\t/**\n\t * A promise that resolves when groups have been restored in\n\t * the container.\n\t *\n\t * For groups with active editor, the promise will resolve\n\t * when the visible editor has finished to resolve.\n\t *\n\t * Use the `whenReady` property to not await editors to\n\t * resolve.\n\t */\n\treadonly whenRestored: Promise<void>;\n\n\t/**\n\t * Find out if the container has UI state to restore\n\t * from a previous session.\n\t */\n\treadonly hasRestorableState: boolean;\n\n\t/**\n\t * An active group is the default location for new editors to open.\n\t */\n\treadonly activeGroup: IEditorGroup;\n\n\t/**\n\t * A side group allows a subset of methods on a group that is either\n\t * created to the side or picked if already there.\n\t */\n\treadonly sideGroup: IEditorSideGroup;\n\n\t/**\n\t * All groups that are currently visible in the container in the order\n\t * of their creation (oldest first).\n\t */\n\treadonly groups: readonly IEditorGroup[];\n\n\t/**\n\t * The number of editor groups that are currently opened in the\n\t * container.\n\t */\n\treadonly count: number;\n\n\t/**\n\t * The current layout orientation of the root group.\n\t */\n\treadonly orientation: GroupOrientation;\n\n\t/**\n\t * Access the options of the container.\n\t */\n\treadonly partOptions: IEditorPartOptions;\n\n\t/**\n\t * Enforce container options temporarily.\n\t */\n\tenforcePartOptions(options: DeepPartial<IEditorPartOptions>): IDisposable;\n\n\t/**\n\t * Get all groups that are currently visible in the container.\n\t *\n\t * @param order the order of the editors to use\n\t */\n\tgetGroups(order: GroupsOrder): readonly IEditorGroup[];\n\n\t/**\n\t * Allows to convert a group identifier to a group.\n\t */\n\tgetGroup(identifier: GroupIdentifier): IEditorGroup | undefined;\n\n\t/**\n\t * Set a group as active. An active group is the default location for new editors to open.\n\t */\n\tactivateGroup(group: IEditorGroup | GroupIdentifier): IEditorGroup;\n\n\t/**\n\t * Returns the size of a group.\n\t */\n\tgetSize(group: IEditorGroup | GroupIdentifier): { width: number; height: number };\n\n\t/**\n\t * Sets the size of a group.\n\t */\n\tsetSize(group: IEditorGroup | GroupIdentifier, size: { width: number; height: number }): void;\n\n\t/**\n\t * Arrange all groups in the container according to the provided arrangement.\n\t */\n\tarrangeGroups(arrangement: GroupsArrangement, target?: IEditorGroup | GroupIdentifier): void;\n\n\t/**\n\t * Toggles the target goup size to maximize/unmaximize.\n\t */\n\ttoggleMaximizeGroup(group?: IEditorGroup | GroupIdentifier): void;\n\n\t/**\n\t * Toggles the target goup size to expand/distribute even.\n\t */\n\ttoggleExpandGroup(group?: IEditorGroup | GroupIdentifier): void;\n\n\t/**\n\t * Applies the provided layout by either moving existing groups or creating new groups.\n\t */\n\tapplyLayout(layout: EditorGroupLayout): void;\n\n\t/**\n\t * Returns an editor layout of the container.\n\t */\n\tgetLayout(): EditorGroupLayout;\n\n\t/**\n\t * Sets the orientation of the root group to be either vertical or horizontal.\n\t */\n\tsetGroupOrientation(orientation: GroupOrientation): void;\n\n\t/**\n\t * Find a group in a specific scope:\n\t * * `GroupLocation.FIRST`: the first group\n\t * * `GroupLocation.LAST`: the last group\n\t * * `GroupLocation.NEXT`: the next group from either the active one or `source`\n\t * * `GroupLocation.PREVIOUS`: the previous group from either the active one or `source`\n\t * * `GroupDirection.UP`: the next group above the active one or `source`\n\t * * `GroupDirection.DOWN`: the next group below the active one or `source`\n\t * * `GroupDirection.LEFT`: the next group to the left of the active one or `source`\n\t * * `GroupDirection.RIGHT`: the next group to the right of the active one or `source`\n\t *\n\t * @param scope the scope of the group to search in\n\t * @param source optional source to search from\n\t * @param wrap optionally wrap around if reaching the edge of groups\n\t */\n\tfindGroup(scope: IFindGroupScope, source?: IEditorGroup | GroupIdentifier, wrap?: boolean): IEditorGroup | undefined;\n\n\t/**\n\t * Add a new group to the container. A new group is added by splitting a provided one in\n\t * one of the four directions.\n\t *\n\t * @param location the group from which to split to add a new group\n\t * @param direction the direction of where to split to\n\t */\n\taddGroup(location: IEditorGroup | GroupIdentifier, direction: GroupDirection): IEditorGroup;\n\n\t/**\n\t * Remove a group from the container.\n\t */\n\tremoveGroup(group: IEditorGroup | GroupIdentifier): void;\n\n\t/**\n\t * Move a group to a new group in the container.\n\t *\n\t * @param group the group to move\n\t * @param location the group from which to split to add the moved group\n\t * @param direction the direction of where to split to\n\t */\n\tmoveGroup(group: IEditorGroup | GroupIdentifier, location: IEditorGroup | GroupIdentifier, direction: GroupDirection): IEditorGroup;\n\n\t/**\n\t * Merge the editors of a group into a target group. By default, all editors will\n\t * move and the source group will close. This behaviour can be configured via the\n\t * `IMergeGroupOptions` options.\n\t *\n\t * @param group the group to merge\n\t * @param target the target group to merge into\n\t * @param options controls how the merge should be performed. by default all editors\n\t * will be moved over to the target and the source group will close. Configure to\n\t * `MOVE_EDITORS_KEEP_GROUP` to prevent the source group from closing. Set to\n\t * `COPY_EDITORS` to copy the editors into the target instead of moding them.\n\t *\n\t * @returns if merging was successful\n\t */\n\tmergeGroup(group: IEditorGroup | GroupIdentifier, target: IEditorGroup | GroupIdentifier, options?: IMergeGroupOptions): boolean;\n\n\t/**\n\t * Merge all editor groups into the target one.\n\t *\n\t * @returns if merging was successful\n\t */\n\tmergeAllGroups(target: IEditorGroup | GroupIdentifier): boolean;\n\n\t/**\n\t * Copy a group to a new group in the container.\n\t *\n\t * @param group the group to copy\n\t * @param location the group from which to split to add the copied group\n\t * @param direction the direction of where to split to\n\t */\n\tcopyGroup(group: IEditorGroup | GroupIdentifier, location: IEditorGroup | GroupIdentifier, direction: GroupDirection): IEditorGroup;\n\n\t/**\n\t * Allows to register a drag and drop target for editors\n\t * on the provided `container`.\n\t */\n\tcreateEditorDropTarget(container: unknown /* HTMLElement */, delegate: IEditorDropTargetDelegate): IDisposable;\n}\n\n/**\n * An editor part is a viewer of editor groups. There can be multiple editor\n * parts opened in multiple windows.\n */\nexport interface IEditorPart extends IEditorGroupsContainer {\n\n\t/**\n\t * An event for when the editor part is layed out.\n\t */\n\treadonly onDidLayout: Event<IDimension>;\n\n\t/**\n\t * An event for when the editor part is scrolled.\n\t */\n\treadonly onDidScroll: Event<void>;\n\n\t/**\n\t * An event for when the editor part is disposed.\n\t */\n\treadonly onWillDispose: Event<void>;\n\n\t/**\n\t * The identifier of the window the editor part is contained in.\n\t */\n\treadonly windowId: number;\n\n\t/**\n\t * The size of the editor part.\n\t */\n\treadonly contentDimension: IDimension;\n\n\t/**\n\t * Find out if an editor group is currently maximized.\n\t */\n\thasMaximizedGroup(): boolean;\n\n\t/**\n\t * Enable or disable centered editor layout.\n\t */\n\tcenterLayout(active: boolean): void;\n\n\t/**\n\t * Find out if the editor layout is currently centered.\n\t */\n\tisLayoutCentered(): boolean;\n}\n\nexport interface IAuxiliaryEditorPart extends IEditorPart {\n\n\t/**\n\t * Close this auxiliary editor part after moving all\n\t * editors of all groups back to the main editor part.\n\t *\n\t * @returns `false` if an editor could not be moved back.\n\t */\n\tclose(): boolean;\n}\n\nexport interface IEditorWorkingSet {\n\treadonly id: string;\n\treadonly name: string;\n}\n\nexport interface IEditorWorkingSetOptions {\n\treadonly preserveFocus?: boolean;\n}\n\nexport interface IEditorGroupContextKeyProvider<T extends ContextKeyValue> {\n\n\t/**\n\t * The context key that needs to be set for each editor group context and the global context.\n\t */\n\treadonly contextKey: RawContextKey<T>;\n\n\t/**\n\t * Retrieves the context key value for the given editor group.\n\t */\n\treadonly getGroupContextKeyValue: (group: IEditorGroup) => T;\n\n\t/**\n\t * An event that is fired when there was a change leading to the context key value to be re-evaluated.\n\t */\n\treadonly onDidChange?: Event<void>;\n}\n\n/**\n * The main service to interact with editor groups across all opened editor parts.\n */\nexport interface IEditorGroupsService extends IEditorGroupsContainer {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * An event for when a new auxiliary editor part is created.\n\t */\n\treadonly onDidCreateAuxiliaryEditorPart: Event<IAuxiliaryEditorPart>;\n\n\t/**\n\t * Provides access to the main window editor part.\n\t */\n\treadonly mainPart: IEditorPart;\n\n\t/**\n\t * Provides access to all editor parts.\n\t */\n\treadonly parts: ReadonlyArray<IEditorPart>;\n\n\t/**\n\t * Get the editor part that contains the group with the provided identifier.\n\t */\n\tgetPart(group: IEditorGroup | GroupIdentifier): IEditorPart;\n\n\t/**\n\t * Get the editor part that is rooted in the provided container.\n\t */\n\tgetPart(container: unknown /* HTMLElement */): IEditorPart;\n\n\t/**\n\t * Opens a new window with a full editor part instantiated\n\t * in there at the optional position and size on screen.\n\t */\n\tcreateAuxiliaryEditorPart(options?: { bounds?: Partial<IRectangle>; compact?: boolean; alwaysOnTop?: boolean }): Promise<IAuxiliaryEditorPart>;\n\n\t/**\n\t * Returns the instantiation service that is scoped to the\n\t * provided editor part. Use this method when building UI\n\t * that contributes to auxiliary editor parts to ensure the\n\t * UI is scoped to that part.\n\t */\n\tgetScopedInstantiationService(part: IEditorPart): IInstantiationService;\n\n\t/**\n\t * Save a new editor working set from the currently opened\n\t * editors and group layout.\n\t */\n\tsaveWorkingSet(name: string): IEditorWorkingSet;\n\n\t/**\n\t * Returns all known editor working sets.\n\t */\n\tgetWorkingSets(): IEditorWorkingSet[];\n\n\t/**\n\t * Applies the working set. Use `empty` to apply an empty working set.\n\t *\n\t * @returns `true` when the working set as applied.\n\t */\n\tapplyWorkingSet(workingSet: IEditorWorkingSet | 'empty', options?: IEditorWorkingSetOptions): Promise<boolean>;\n\n\t/**\n\t * Deletes a working set.\n\t */\n\tdeleteWorkingSet(workingSet: IEditorWorkingSet): void;\n\n\t/**\n\t * Registers a context key provider. This provider sets a context key for each scoped editor group context and the global context.\n\t *\n\t * @param provider - The context key provider to be registered.\n\t * @returns - A disposable object to unregister the provider.\n\t */\n\tregisterContextKeyProvider<T extends ContextKeyValue>(provider: IEditorGroupContextKeyProvider<T>): IDisposable;\n}\n\nexport const enum OpenEditorContext {\n\tNEW_EDITOR = 1,\n\tMOVE_EDITOR = 2,\n\tCOPY_EDITOR = 3\n}\n\nexport interface IActiveEditorActions {\n\treadonly actions: IToolbarActions;\n\treadonly onDidChange: Event<IMenuChangeEvent | void>;\n}\n\nexport interface IEditorGroup {\n\n\t/**\n\t * An event which fires whenever the underlying group model changes.\n\t */\n\treadonly onDidModelChange: Event<IGroupModelChangeEvent>;\n\n\t/**\n\t * An event that is fired when the group gets disposed.\n\t */\n\treadonly onWillDispose: Event<void>;\n\n\t/**\n\t * An event that is fired when the active editor in the group changed.\n\t */\n\treadonly onDidActiveEditorChange: Event<IActiveEditorChangeEvent>;\n\n\t/**\n\t * An event that is fired when an editor is about to close.\n\t */\n\treadonly onWillCloseEditor: Event<IEditorCloseEvent>;\n\n\t/**\n\t * An event that is fired when an editor is closed.\n\t */\n\treadonly onDidCloseEditor: Event<IEditorCloseEvent>;\n\n\t/**\n\t * An event that is fired when an editor is about to move to\n\t * a different group.\n\t */\n\treadonly onWillMoveEditor: Event<IEditorWillMoveEvent>;\n\n\t/**\n\t * A unique identifier of this group that remains identical even if the\n\t * group is moved to different locations.\n\t */\n\treadonly id: GroupIdentifier;\n\n\t/**\n\t * The identifier of the window this editor group is part of.\n\t */\n\treadonly windowId: number;\n\n\t/**\n\t * A number that indicates the position of this group in the visual\n\t * order of groups from left to right and top to bottom. The lowest\n\t * index will likely be top-left while the largest index in most\n\t * cases should be bottom-right, but that depends on the grid.\n\t */\n\treadonly index: number;\n\n\t/**\n\t * A human readable label for the group. This label can change depending\n\t * on the layout of all editor groups. Clients should listen on the\n\t * `onDidGroupModelChange` event to react to that.\n\t */\n\treadonly label: string;\n\n\t/**\n\t * A human readable label for the group to be used by screen readers.\n\t */\n\treadonly ariaLabel: string;\n\n\t/**\n\t * The active editor pane is the currently visible editor pane of the group.\n\t */\n\treadonly activeEditorPane: IVisibleEditorPane | undefined;\n\n\t/**\n\t * The active editor is the currently visible editor of the group\n\t * within the current active editor pane.\n\t */\n\treadonly activeEditor: EditorInput | null;\n\n\t/**\n\t * All selected editor in this group in sequential order.\n\t * The active editor is always part of the selection.\n\t */\n\treadonly selectedEditors: EditorInput[];\n\n\t/**\n\t * The editor in the group that is in preview mode if any. There can\n\t * only ever be one editor in preview mode.\n\t */\n\treadonly previewEditor: EditorInput | null;\n\n\t/**\n\t * The number of opened editors in this group.\n\t */\n\treadonly count: number;\n\n\t/**\n\t * Whether the group has editors or not.\n\t */\n\treadonly isEmpty: boolean;\n\n\t/**\n\t * Whether this editor group is locked or not. Locked editor groups\n\t * will only be considered for editors to open in when the group is\n\t * explicitly provided for the editor.\n\t *\n\t * Note: editor group locking only applies when more than one group\n\t * is opened.\n\t */\n\treadonly isLocked: boolean;\n\n\t/**\n\t * The number of sticky editors in this group.\n\t */\n\treadonly stickyCount: number;\n\n\t/**\n\t * All opened editors in the group in sequential order of their appearance.\n\t */\n\treadonly editors: readonly EditorInput[];\n\n\t/**\n\t * The scoped context key service for this group.\n\t */\n\treadonly scopedContextKeyService: IContextKeyService;\n\n\t/**\n\t * Get all editors that are currently opened in the group.\n\t *\n\t * @param order the order of the editors to use\n\t * @param options options to select only specific editors as instructed\n\t */\n\tgetEditors(order: EditorsOrder, options?: { excludeSticky?: boolean }): readonly EditorInput[];\n\n\t/**\n\t * Finds all editors for the given resource that are currently\n\t * opened in the group. This method will return an entry for\n\t * each editor that reports a `resource` that matches the\n\t * provided one.\n\t *\n\t * @param resource the resource of the editor to find\n\t * @param options whether to support side by side editors or not\n\t */\n\tfindEditors(resource: URI, options?: IFindEditorOptions): readonly EditorInput[];\n\n\t/**\n\t * Returns the editor at a specific index of the group.\n\t */\n\tgetEditorByIndex(index: number): EditorInput | undefined;\n\n\t/**\n\t * Returns the index of the editor in the group or -1 if not opened.\n\t */\n\tgetIndexOfEditor(editor: EditorInput): number;\n\n\t/**\n\t * Whether the editor is the first in the group.\n\t */\n\tisFirst(editor: EditorInput): boolean;\n\n\t/**\n\t * Whether the editor is the last in the group.\n\t */\n\tisLast(editor: EditorInput): boolean;\n\n\t/**\n\t * Open an editor in this group.\n\t *\n\t * @returns a promise that resolves around an IEditor instance unless\n\t * the call failed, or the editor was not opened as active editor.\n\t */\n\topenEditor(editor: EditorInput, options?: IEditorOptions): Promise<IEditorPane | undefined>;\n\n\t/**\n\t * Opens editors in this group.\n\t *\n\t * @returns a promise that resolves around an IEditor instance unless\n\t * the call failed, or the editor was not opened as active editor. Since\n\t * a group can only ever have one active editor, even if many editors are\n\t * opened, the result will only be one editor.\n\t */\n\topenEditors(editors: EditorInputWithOptions[]): Promise<IEditorPane | undefined>;\n\n\t/**\n\t * Find out if the provided editor is pinned in the group.\n\t */\n\tisPinned(editorOrIndex: EditorInput | number): boolean;\n\n\t/**\n\t * Find out if the provided editor or index of editor is sticky in the group.\n\t */\n\tisSticky(editorOrIndex: EditorInput | number): boolean;\n\n\t/**\n\t * Find out if the provided editor or index of editor is transient in the group.\n\t */\n\tisTransient(editorOrIndex: EditorInput | number): boolean;\n\n\t/**\n\t * Find out if the provided editor is active in the group.\n\t */\n\tisActive(editor: EditorInput | IUntypedEditorInput): boolean;\n\n\t/**\n\t * Whether the editor is selected in the group.\n\t */\n\tisSelected(editor: EditorInput): boolean;\n\n\t/**\n\t * Set a new selection for this group. This will replace the current\n\t * selection with the new selection.\n\t *\n\t * @param activeSelectedEditor the editor to set as active selected editor\n\t * @param inactiveSelectedEditors the inactive editors to set as selected\n\t */\n\tsetSelection(activeSelectedEditor: EditorInput, inactiveSelectedEditors: EditorInput[]): Promise<void>;\n\n\t/**\n\t * Find out if a certain editor is included in the group.\n\t *\n\t * @param candidate the editor to find\n\t * @param options fine tune how to match editors\n\t */\n\tcontains(candidate: EditorInput | IUntypedEditorInput, options?: IMatchEditorOptions): boolean;\n\n\t/**\n\t * Move an editor from this group either within this group or to another group.\n\t *\n\t * @returns whether the editor was moved or not.\n\t */\n\tmoveEditor(editor: EditorInput, target: IEditorGroup, options?: IEditorOptions): boolean;\n\n\t/**\n\t * Move editors from this group either within this group or to another group.\n\t *\n\t * @returns whether all editors were moved or not.\n\t */\n\tmoveEditors(editors: EditorInputWithOptions[], target: IEditorGroup): boolean;\n\n\t/**\n\t * Copy an editor from this group to another group.\n\t *\n\t * Note: It is currently not supported to show the same editor more than once in the same group.\n\t */\n\tcopyEditor(editor: EditorInput, target: IEditorGroup, options?: IEditorOptions): void;\n\n\t/**\n\t * Copy editors from this group to another group.\n\t *\n\t * Note: It is currently not supported to show the same editor more than once in the same group.\n\t */\n\tcopyEditors(editors: EditorInputWithOptions[], target: IEditorGroup): void;\n\n\t/**\n\t * Close an editor from the group. This may trigger a confirmation dialog if\n\t * the editor is dirty and thus returns a promise as value.\n\t *\n\t * @param editor the editor to close, or the currently active editor\n\t * if unspecified.\n\t *\n\t * @returns a promise when the editor is closed or not. If `true`, the editor\n\t * is closed and if `false` there was a veto closing the editor, e.g. when it\n\t * is dirty.\n\t */\n\tcloseEditor(editor?: EditorInput, options?: ICloseEditorOptions): Promise<boolean>;\n\n\t/**\n\t * Closes specific editors in this group. This may trigger a confirmation dialog if\n\t * there are dirty editors and thus returns a promise as value.\n\t *\n\t * @returns a promise whether the editors were closed or not. If `true`, the editors\n\t * were closed and if `false` there was a veto closing the editors, e.g. when one\n\t * is dirty.\n\t */\n\tcloseEditors(editors: EditorInput[] | ICloseEditorsFilter, options?: ICloseEditorOptions): Promise<boolean>;\n\n\t/**\n\t * Closes all editors from the group. This may trigger a confirmation dialog if\n\t * there are dirty editors and thus returns a promise as value.\n\t *\n\t * @returns a promise if confirmation is needed when all editors are closed.\n\t */\n\tcloseAllEditors(options: { excludeConfirming: true }): boolean;\n\tcloseAllEditors(options?: ICloseAllEditorsOptions): Promise<boolean>;\n\n\t/**\n\t * Replaces editors in this group with the provided replacement.\n\t *\n\t * @param editors the editors to replace\n\t *\n\t * @returns a promise that is resolved when the replaced active\n\t * editor (if any) has finished loading.\n\t */\n\treplaceEditors(editors: IEditorReplacement[]): Promise<void>;\n\n\t/**\n\t * Set an editor to be pinned. A pinned editor is not replaced\n\t * when another editor opens at the same location.\n\t *\n\t * @param editor the editor to pin, or the currently active editor\n\t * if unspecified.\n\t */\n\tpinEditor(editor?: EditorInput): void;\n\n\t/**\n\t * Set an editor to be sticky. A sticky editor is showing in the beginning\n\t * of the tab stripe and will not be impacted by close operations.\n\t *\n\t * @param editor the editor to make sticky, or the currently active editor\n\t * if unspecified.\n\t */\n\tstickEditor(editor?: EditorInput): void;\n\n\t/**\n\t * Set an editor to be non-sticky and thus moves back to a location after\n\t * sticky editors and can be closed normally.\n\t *\n\t * @param editor the editor to make unsticky, or the currently active editor\n\t * if unspecified.\n\t */\n\tunstickEditor(editor?: EditorInput): void;\n\n\t/**\n\t * Whether this editor group should be locked or not.\n\t *\n\t * See {@linkcode IEditorGroup.isLocked `isLocked`}\n\t */\n\tlock(locked: boolean): void;\n\n\t/**\n\t * Move keyboard focus into the group.\n\t */\n\tfocus(): void;\n\n\t/**\n\t * Create the editor actions for the current active editor.\n\t */\n\tcreateEditorActions(disposables: DisposableStore, menuId?: MenuId): IActiveEditorActions;\n}\n\nexport function isEditorGroup(obj: unknown): obj is IEditorGroup {\n\tconst group = obj as IEditorGroup | undefined;\n\n\treturn !!group && typeof group.id === 'number' && Array.isArray(group.editors);\n}\n\n//#region Editor Group Helpers\n\nexport function preferredSideBySideGroupDirection(configurationService: IConfigurationService): GroupDirection.DOWN | GroupDirection.RIGHT {\n\tconst openSideBySideDirection = configurationService.getValue('workbench.editor.openSideBySideDirection');\n\n\tif (openSideBySideDirection === 'down') {\n\t\treturn GroupDirection.DOWN;\n\t}\n\n\treturn GroupDirection.RIGHT;\n}\n\n//#endregion\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IResourceEditorInput, IEditorOptions, IResourceEditorInputIdentifier, ITextResourceEditorInput } from '../../../../platform/editor/common/editor.js';\nimport { IEditorPane, GroupIdentifier, IUntitledTextResourceEditorInput, IResourceDiffEditorInput, ITextDiffEditorPane, IEditorIdentifier, ISaveOptions, IRevertOptions, EditorsOrder, IVisibleEditorPane, IEditorCloseEvent, IUntypedEditorInput, IFindEditorOptions, IEditorWillOpenEvent, ITextResourceDiffEditorInput } from '../../../common/editor.js';\nimport { EditorInput } from '../../../common/editor/editorInput.js';\nimport { Event } from '../../../../base/common/event.js';\nimport { IEditor, IDiffEditor } from '../../../../editor/common/editorCommon.js';\nimport { ICloseEditorOptions, IEditorGroup, IEditorGroupsContainer, isEditorGroup } from './editorGroupsService.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { IGroupModelChangeEvent } from '../../../common/editor/editorGroupModel.js';\nimport { DisposableStore } from '../../../../base/common/lifecycle.js';\n\nexport const IEditorService = createDecorator<IEditorService>('editorService');\n\n/**\n * Open an editor in the currently active group.\n */\nexport const ACTIVE_GROUP = -1;\nexport type ACTIVE_GROUP_TYPE = typeof ACTIVE_GROUP;\n\n/**\n * Open an editor to the side of the active group.\n */\nexport const SIDE_GROUP = -2;\nexport type SIDE_GROUP_TYPE = typeof SIDE_GROUP;\n\n/**\n * Open an editor in a new auxiliary window.\n */\nexport const AUX_WINDOW_GROUP = -3;\nexport type AUX_WINDOW_GROUP_TYPE = typeof AUX_WINDOW_GROUP;\n\nexport type PreferredGroup = IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | AUX_WINDOW_GROUP_TYPE;\n\nexport function isPreferredGroup(obj: unknown): obj is PreferredGroup {\n\tconst candidate = obj as PreferredGroup | undefined;\n\n\treturn typeof obj === 'number' || isEditorGroup(candidate);\n}\n\nexport interface ISaveEditorsOptions extends ISaveOptions {\n\n\t/**\n\t * If true, will ask for a location of the editor to save to.\n\t */\n\treadonly saveAs?: boolean;\n}\n\nexport interface ISaveEditorsResult {\n\n\t/**\n\t * Whether the save operation was successful.\n\t */\n\treadonly success: boolean;\n\n\t/**\n\t * Resulting editors after the save operation.\n\t */\n\treadonly editors: Array<EditorInput | IUntypedEditorInput>;\n}\n\nexport interface IUntypedEditorReplacement {\n\n\t/**\n\t * The editor to replace.\n\t */\n\treadonly editor: EditorInput;\n\n\t/**\n\t * The replacement for the editor.\n\t */\n\treadonly replacement: IUntypedEditorInput;\n\n\t/**\n\t * Skips asking the user for confirmation and doesn't\n\t * save the document. Only use this if you really need to!\n\t*/\n\tforceReplaceDirty?: boolean;\n}\n\nexport interface IBaseSaveRevertAllEditorOptions {\n\n\t/**\n\t * Whether to include untitled editors as well.\n\t */\n\treadonly includeUntitled?: {\n\n\t\t/**\n\t\t * Whether to include scratchpad editors.\n\t\t * Scratchpads are not included if not specified.\n\t\t */\n\t\treadonly includeScratchpad: boolean;\n\n\t} | boolean;\n\n\t/**\n\t * Whether to exclude sticky editors.\n\t */\n\treadonly excludeSticky?: boolean;\n}\n\nexport interface ISaveAllEditorsOptions extends ISaveEditorsOptions, IBaseSaveRevertAllEditorOptions { }\n\nexport interface IRevertAllEditorsOptions extends IRevertOptions, IBaseSaveRevertAllEditorOptions { }\n\nexport interface IOpenEditorsOptions {\n\n\t/**\n\t * Whether to validate trust when opening editors\n\t * that are potentially not inside the workspace.\n\t */\n\treadonly validateTrust?: boolean;\n}\n\nexport interface IEditorsChangeEvent {\n\t/**\n\t * The group which had the editor change\n\t */\n\tgroupId: GroupIdentifier;\n\t/*\n\t * The event fired from the model\n\t */\n\tevent: IGroupModelChangeEvent;\n}\n\nexport interface IEditorService {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Emitted when the currently active editor changes.\n\t *\n\t * @see {@link IEditorService.activeEditorPane}\n\t */\n\treadonly onDidActiveEditorChange: Event<void>;\n\n\t/**\n\t * Emitted when any of the current visible editors changes.\n\t *\n\t * @see {@link IEditorService.visibleEditorPanes}\n\t */\n\treadonly onDidVisibleEditorsChange: Event<void>;\n\n\t/**\n\t * An aggregated event for any change to any editor across\n\t * all groups.\n\t */\n\treadonly onDidEditorsChange: Event<IEditorsChangeEvent>;\n\n\t/**\n\t * Emitted when an editor is about to open.\n\t */\n\treadonly onWillOpenEditor: Event<IEditorWillOpenEvent>;\n\n\t/**\n\t * Emitted when an editor is closed.\n\t */\n\treadonly onDidCloseEditor: Event<IEditorCloseEvent>;\n\n\t/**\n\t * The currently active editor pane or `undefined` if none. The editor pane is\n\t * the workbench container for editors of any kind.\n\t *\n\t * @see {@link IEditorService.activeEditor} for access to the active editor input\n\t */\n\treadonly activeEditorPane: IVisibleEditorPane | undefined;\n\n\t/**\n\t * The currently active editor or `undefined` if none. An editor is active when it is\n\t * located in the currently active editor group. It will be `undefined` if the active\n\t * editor group has no editors open.\n\t */\n\treadonly activeEditor: EditorInput | undefined;\n\n\t/**\n\t * The currently active text editor control or `undefined` if there is currently no active\n\t * editor or the active editor widget is neither a text nor a diff editor.\n\t *\n\t * @see {@link IEditorService.activeEditor}\n\t */\n\treadonly activeTextEditorControl: IEditor | IDiffEditor | undefined;\n\n\t/**\n\t * The currently active text editor language id or `undefined` if there is currently no active\n\t * editor or the active editor control is neither a text nor a diff editor. If the active\n\t * editor is a diff editor, the modified side's language id will be taken.\n\t */\n\treadonly activeTextEditorLanguageId: string | undefined;\n\n\t/**\n\t * All editor panes that are currently visible across all editor groups.\n\t *\n\t * @see {@link IEditorService.visibleEditors} for access to the visible editor inputs\n\t */\n\treadonly visibleEditorPanes: readonly IVisibleEditorPane[];\n\n\t/**\n\t * All editors that are currently visible. An editor is visible when it is opened in an\n\t * editor group and active in that group. Multiple editor groups can be opened at the same time.\n\t */\n\treadonly visibleEditors: readonly EditorInput[];\n\n\t/**\n\t * All text editor widgets that are currently visible across all editor groups. A text editor\n\t * widget is either a text or a diff editor.\n\t *\n\t * This property supports side-by-side editors as well, by returning both sides if they are\n\t * text editor widgets.\n\t */\n\treadonly visibleTextEditorControls: readonly (IEditor | IDiffEditor)[];\n\n\t/**\n\t * All text editor widgets that are currently visible across all editor groups. A text editor\n\t * widget is either a text or a diff editor.\n\t *\n\t * This property supports side-by-side editors as well, by returning both sides if they are\n\t * text editor widgets.\n\t *\n\t * @param order the order of the editors to use\n\t */\n\tgetVisibleTextEditorControls(order: EditorsOrder): readonly (IEditor | IDiffEditor)[];\n\n\t/**\n\t * All editors that are opened across all editor groups in sequential order\n\t * of appearance.\n\t *\n\t * This includes active as well as inactive editors in each editor group.\n\t */\n\treadonly editors: readonly EditorInput[];\n\n\t/**\n\t * The total number of editors that are opened either inactive or active.\n\t */\n\treadonly count: number;\n\n\t/**\n\t * All editors that are opened across all editor groups with their group\n\t * identifier.\n\t *\n\t * @param order the order of the editors to use\n\t * @param options whether to exclude sticky editors or not\n\t */\n\tgetEditors(order: EditorsOrder, options?: { excludeSticky?: boolean }): readonly IEditorIdentifier[];\n\n\t/**\n\t * Open an editor in an editor group.\n\t *\n\t * @param editor the editor to open\n\t * @param options the options to use for the editor\n\t * @param group the target group. If unspecified, the editor will open in the currently\n\t * active group. Use `SIDE_GROUP` to open the editor in a new editor group to the side\n\t * of the currently active group.\n\t *\n\t * @returns the editor that opened or `undefined` if the operation failed or the editor was not\n\t * opened to be active.\n\t */\n\topenEditor(editor: IResourceEditorInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | AUX_WINDOW_GROUP_TYPE): Promise<IEditorPane | undefined>;\n\topenEditor(editor: ITextResourceEditorInput | IUntitledTextResourceEditorInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | AUX_WINDOW_GROUP_TYPE): Promise<IEditorPane | undefined>;\n\topenEditor(editor: ITextResourceDiffEditorInput | IResourceDiffEditorInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | AUX_WINDOW_GROUP_TYPE): Promise<ITextDiffEditorPane | undefined>;\n\topenEditor(editor: IUntypedEditorInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | AUX_WINDOW_GROUP_TYPE): Promise<IEditorPane | undefined>;\n\n\t/**\n\t * @deprecated using this method is a sign that your editor has not adopted the editor\n\t * resolver yet. Please use `IEditorResolverService.registerEditor` to make your editor\n\t * known to the workbench and then use untyped editor inputs for opening:\n\t *\n\t * ```ts\n\t * editorService.openEditor({ resource });\n\t * ```\n\t *\n\t * If you already have an `EditorInput` in hand and must use it for opening, use `group.openEditor`\n\t * instead, via `IEditorGroupsService`.\n\t */\n\topenEditor(editor: EditorInput, options?: IEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | AUX_WINDOW_GROUP_TYPE): Promise<IEditorPane | undefined>;\n\n\t/**\n\t * Open editors in an editor group.\n\t *\n\t * @param editors the editors to open with associated options\n\t * @param group the target group. If unspecified, the editor will open in the currently\n\t * active group. Use `SIDE_GROUP` to open the editor in a new editor group to the side\n\t * of the currently active group.\n\t *\n\t * @returns the editors that opened. The array can be empty or have less elements for editors\n\t * that failed to open or were instructed to open as inactive.\n\t */\n\topenEditors(editors: IUntypedEditorInput[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | AUX_WINDOW_GROUP_TYPE, options?: IOpenEditorsOptions): Promise<readonly IEditorPane[]>;\n\n\t/**\n\t * Replaces editors in an editor group with the provided replacement.\n\t *\n\t * @param replacements the editors to replace\n\t * @param group the editor group\n\t *\n\t * @returns a promise that is resolved when the replaced active\n\t * editor (if any) has finished loading.\n\t */\n\treplaceEditors(replacements: IUntypedEditorReplacement[], group: IEditorGroup | GroupIdentifier): Promise<void>;\n\n\t/**\n\t * Find out if the provided editor is opened in any editor group.\n\t *\n\t * Note: An editor can be opened but not actively visible.\n\t *\n\t * Note: This method will return `true` if a side by side editor\n\t * is opened where the `primary` editor matches too.\n\t */\n\tisOpened(editor: IResourceEditorInputIdentifier): boolean;\n\n\t/**\n\t * Find out if the provided editor is visible in any editor group.\n\t */\n\tisVisible(editor: EditorInput): boolean;\n\n\t/**\n\t * Close an editor in a specific editor group.\n\t */\n\tcloseEditor(editor: IEditorIdentifier, options?: ICloseEditorOptions): Promise<void>;\n\n\t/**\n\t * Close multiple editors in specific editor groups.\n\t */\n\tcloseEditors(editors: readonly IEditorIdentifier[], options?: ICloseEditorOptions): Promise<void>;\n\n\t/**\n\t * This method will return an entry for each editor that reports\n\t * a `resource` that matches the provided one in the group or\n\t * across all groups.\n\t *\n\t * It is possible that multiple editors are returned in case the\n\t * same resource is opened in different editors. To find the specific\n\t * editor, use the `IResourceEditorInputIdentifier` as input.\n\t */\n\tfindEditors(resource: URI, options?: IFindEditorOptions): readonly IEditorIdentifier[];\n\tfindEditors(editor: IResourceEditorInputIdentifier, options?: IFindEditorOptions): readonly IEditorIdentifier[];\n\n\t/**\n\t * Save the provided list of editors.\n\t */\n\tsave(editors: IEditorIdentifier | readonly IEditorIdentifier[], options?: ISaveEditorsOptions): Promise<ISaveEditorsResult>;\n\n\t/**\n\t * Save all editors.\n\t */\n\tsaveAll(options?: ISaveAllEditorsOptions): Promise<ISaveEditorsResult>;\n\n\t/**\n\t * Reverts the provided list of editors.\n\t *\n\t * @returns `true` if all editors reverted and `false` otherwise.\n\t */\n\trevert(editors: IEditorIdentifier | readonly IEditorIdentifier[], options?: IRevertOptions): Promise<boolean>;\n\n\t/**\n\t * Reverts all editors.\n\t *\n\t * @returns `true` if all editors reverted and `false` otherwise.\n\t */\n\trevertAll(options?: IRevertAllEditorsOptions): Promise<boolean>;\n\n\t/**\n\t * Create a scoped editor service that only operates on the provided\n\t * editor group container. Use `main` to create a scoped editor service\n\t * to the main editor group container of the main window.\n\t */\n\tcreateScoped(editorGroupsContainer: IEditorGroupsContainer, disposables: DisposableStore): IEditorService;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { onUnexpectedError } from '../../../base/common/errors.js';\nimport { ExtensionIdentifier, IExtensionDescription } from '../../extensions/common/extensions.js';\n\nexport interface IActivationEventsGenerator<T> {\n\t(contributions: T[], result: { push(item: string): void }): void;\n}\n\nexport class ImplicitActivationEventsImpl {\n\n\tprivate readonly _generators = new Map<string, IActivationEventsGenerator<any>>();\n\tprivate readonly _cache = new WeakMap<IExtensionDescription, string[]>();\n\n\tpublic register<T>(extensionPointName: string, generator: IActivationEventsGenerator<T>): void {\n\t\tthis._generators.set(extensionPointName, generator);\n\t}\n\n\t/**\n\t * This can run correctly only on the renderer process because that is the only place\n\t * where all extension points and all implicit activation events generators are known.\n\t */\n\tpublic readActivationEvents(extensionDescription: IExtensionDescription): string[] {\n\t\tif (!this._cache.has(extensionDescription)) {\n\t\t\tthis._cache.set(extensionDescription, this._readActivationEvents(extensionDescription));\n\t\t}\n\t\treturn this._cache.get(extensionDescription)!;\n\t}\n\n\t/**\n\t * This can run correctly only on the renderer process because that is the only place\n\t * where all extension points and all implicit activation events generators are known.\n\t */\n\tpublic createActivationEventsMap(extensionDescriptions: IExtensionDescription[]): { [extensionId: string]: string[] } {\n\t\tconst result: { [extensionId: string]: string[] } = Object.create(null);\n\t\tfor (const extensionDescription of extensionDescriptions) {\n\t\t\tconst activationEvents = this.readActivationEvents(extensionDescription);\n\t\t\tif (activationEvents.length > 0) {\n\t\t\t\tresult[ExtensionIdentifier.toKey(extensionDescription.identifier)] = activationEvents;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate _readActivationEvents(desc: IExtensionDescription): string[] {\n\t\tif (typeof desc.main === 'undefined' && typeof desc.browser === 'undefined') {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst activationEvents: string[] = (Array.isArray(desc.activationEvents) ? desc.activationEvents.slice(0) : []);\n\n\t\tfor (let i = 0; i < activationEvents.length; i++) {\n\t\t\t// TODO@joao: there's no easy way to contribute this\n\t\t\tif (activationEvents[i] === 'onUri') {\n\t\t\t\tactivationEvents[i] = `onUri:${ExtensionIdentifier.toKey(desc.identifier)}`;\n\t\t\t}\n\t\t}\n\n\t\tif (!desc.contributes) {\n\t\t\t// no implicit activation events\n\t\t\treturn activationEvents;\n\t\t}\n\n\t\tfor (const extPointName in desc.contributes) {\n\t\t\tconst generator = this._generators.get(extPointName);\n\t\t\tif (!generator) {\n\t\t\t\t// There's no generator for this extension point\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst contrib = (desc.contributes as any)[extPointName];\n\t\t\tconst contribArr = Array.isArray(contrib) ? contrib : [contrib];\n\t\t\ttry {\n\t\t\t\tgenerator(contribArr, activationEvents);\n\t\t\t} catch (err) {\n\t\t\t\tonUnexpectedError(err);\n\t\t\t}\n\t\t}\n\n\t\treturn activationEvents;\n\t}\n}\n\nexport const ImplicitActivationEvents: ImplicitActivationEventsImpl = new ImplicitActivationEventsImpl();\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../../base/common/event.js';\nimport Severity from '../../../../base/common/severity.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { IMessagePassingProtocol } from '../../../../base/parts/ipc/common/ipc.js';\nimport { getExtensionId, getGalleryExtensionId } from '../../../../platform/extensionManagement/common/extensionManagementUtil.js';\nimport { ImplicitActivationEvents } from '../../../../platform/extensionManagement/common/implicitActivationEvents.js';\nimport { ExtensionIdentifier, ExtensionIdentifierMap, ExtensionIdentifierSet, ExtensionType, IExtension, IExtensionContributions, IExtensionDescription, TargetPlatform } from '../../../../platform/extensions/common/extensions.js';\nimport { ApiProposalName } from '../../../../platform/extensions/common/extensionsApiProposals.js';\nimport { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IV8Profile } from '../../../../platform/profiling/common/profiling.js';\nimport { ExtensionHostKind } from './extensionHostKind.js';\nimport { IExtensionDescriptionDelta, IExtensionDescriptionSnapshot } from './extensionHostProtocol.js';\nimport { ExtensionRunningLocation } from './extensionRunningLocation.js';\nimport { IExtensionPoint } from './extensionsRegistry.js';\n\nexport const nullExtensionDescription = Object.freeze<IExtensionDescription>({\n\tidentifier: new ExtensionIdentifier('nullExtensionDescription'),\n\tname: 'Null Extension Description',\n\tversion: '0.0.0',\n\tpublisher: 'vscode',\n\tengines: { vscode: '' },\n\textensionLocation: URI.parse('void:location'),\n\tisBuiltin: false,\n\ttargetPlatform: TargetPlatform.UNDEFINED,\n\tisUserBuiltin: false,\n\tisUnderDevelopment: false,\n\tpreRelease: false,\n});\n\nexport type WebWorkerExtHostConfigValue = boolean | 'auto';\nexport const webWorkerExtHostConfig = 'extensions.webWorker';\n\nexport const IExtensionService = createDecorator<IExtensionService>('extensionService');\n\nexport interface IMessage {\n\ttype: Severity;\n\tmessage: string;\n\textensionId: ExtensionIdentifier;\n\textensionPointId: string;\n}\n\nexport interface IExtensionsStatus {\n\tid: ExtensionIdentifier;\n\tmessages: IMessage[];\n\tactivationStarted: boolean;\n\tactivationTimes: ActivationTimes | undefined;\n\truntimeErrors: Error[];\n\trunningLocation: ExtensionRunningLocation | null;\n}\n\nexport class MissingExtensionDependency {\n\tconstructor(readonly dependency: string) { }\n}\n\n/**\n * e.g.\n * ```\n * {\n *    startTime: 1511954813493000,\n *    endTime: 1511954835590000,\n *    deltas: [ 100, 1500, 123456, 1500, 100000 ],\n *    ids: [ 'idle', 'self', 'extension1', 'self', 'idle' ]\n * }\n * ```\n */\nexport interface IExtensionHostProfile {\n\t/**\n\t * Profiling start timestamp in microseconds.\n\t */\n\tstartTime: number;\n\t/**\n\t * Profiling end timestamp in microseconds.\n\t */\n\tendTime: number;\n\t/**\n\t * Duration of segment in microseconds.\n\t */\n\tdeltas: number[];\n\t/**\n\t * Segment identifier: extension id or one of the four known strings.\n\t */\n\tids: ProfileSegmentId[];\n\n\t/**\n\t * Get the information as a .cpuprofile.\n\t */\n\tdata: IV8Profile;\n\n\t/**\n\t * Get the aggregated time per segmentId\n\t */\n\tgetAggregatedTimes(): Map<ProfileSegmentId, number>;\n}\n\nexport const enum ExtensionHostStartup {\n\t/**\n\t * The extension host should be launched immediately and doesn't require a `$startExtensionHost` call.\n\t */\n\tEagerAutoStart = 1,\n\t/**\n\t * The extension host should be launched immediately and needs a `$startExtensionHost` call.\n\t */\n\tEagerManualStart = 2,\n\t/**\n\t * The extension host should be launched lazily and only when it has extensions it needs to host. It needs a `$startExtensionHost` call.\n\t */\n\tLazy = 3,\n}\n\nexport interface IExtensionHost {\n\treadonly pid: number | null;\n\treadonly runningLocation: ExtensionRunningLocation;\n\treadonly remoteAuthority: string | null;\n\treadonly startup: ExtensionHostStartup;\n\t/**\n\t * A collection of extensions which includes information about which\n\t * extension will execute or is executing on this extension host.\n\t * **NOTE**: this will reflect extensions correctly only after `start()` resolves.\n\t */\n\treadonly extensions: ExtensionHostExtensions | null;\n\treadonly onExit: Event<[number, string | null]>;\n\n\tstart(): Promise<IMessagePassingProtocol>;\n\tgetInspectPort(): { port: number; host: string } | undefined;\n\tenableInspectPort(): Promise<boolean>;\n\tdisconnect?(): Promise<void>;\n\tdispose(): void;\n}\n\nexport class ExtensionHostExtensions {\n\tprivate _versionId: number;\n\tprivate _allExtensions: IExtensionDescription[];\n\tprivate _myExtensions: ExtensionIdentifier[];\n\tprivate _myActivationEvents: Set<string> | null;\n\n\tpublic get versionId(): number {\n\t\treturn this._versionId;\n\t}\n\n\tpublic get allExtensions(): IExtensionDescription[] {\n\t\treturn this._allExtensions;\n\t}\n\n\tpublic get myExtensions(): ExtensionIdentifier[] {\n\t\treturn this._myExtensions;\n\t}\n\n\tconstructor(versionId: number, allExtensions: readonly IExtensionDescription[], myExtensions: ExtensionIdentifier[]) {\n\t\tthis._versionId = versionId;\n\t\tthis._allExtensions = allExtensions.slice(0);\n\t\tthis._myExtensions = myExtensions.slice(0);\n\t\tthis._myActivationEvents = null;\n\t}\n\n\ttoSnapshot(): IExtensionDescriptionSnapshot {\n\t\treturn {\n\t\t\tversionId: this._versionId,\n\t\t\tallExtensions: this._allExtensions,\n\t\t\tmyExtensions: this._myExtensions,\n\t\t\tactivationEvents: ImplicitActivationEvents.createActivationEventsMap(this._allExtensions)\n\t\t};\n\t}\n\n\tpublic set(versionId: number, allExtensions: IExtensionDescription[], myExtensions: ExtensionIdentifier[]): IExtensionDescriptionDelta {\n\t\tif (this._versionId > versionId) {\n\t\t\tthrow new Error(`ExtensionHostExtensions: invalid versionId ${versionId} (current: ${this._versionId})`);\n\t\t}\n\t\tconst toRemove: ExtensionIdentifier[] = [];\n\t\tconst toAdd: IExtensionDescription[] = [];\n\t\tconst myToRemove: ExtensionIdentifier[] = [];\n\t\tconst myToAdd: ExtensionIdentifier[] = [];\n\n\t\tconst oldExtensionsMap = extensionDescriptionArrayToMap(this._allExtensions);\n\t\tconst newExtensionsMap = extensionDescriptionArrayToMap(allExtensions);\n\t\tconst extensionsAreTheSame = (a: IExtensionDescription, b: IExtensionDescription) => {\n\t\t\treturn (\n\t\t\t\t(a.extensionLocation.toString() === b.extensionLocation.toString())\n\t\t\t\t|| (a.isBuiltin === b.isBuiltin)\n\t\t\t\t|| (a.isUserBuiltin === b.isUserBuiltin)\n\t\t\t\t|| (a.isUnderDevelopment === b.isUnderDevelopment)\n\t\t\t);\n\t\t};\n\n\t\tfor (const oldExtension of this._allExtensions) {\n\t\t\tconst newExtension = newExtensionsMap.get(oldExtension.identifier);\n\t\t\tif (!newExtension) {\n\t\t\t\ttoRemove.push(oldExtension.identifier);\n\t\t\t\toldExtensionsMap.delete(oldExtension.identifier);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!extensionsAreTheSame(oldExtension, newExtension)) {\n\t\t\t\t// The new extension is different than the old one\n\t\t\t\t// (e.g. maybe it executes in a different location)\n\t\t\t\ttoRemove.push(oldExtension.identifier);\n\t\t\t\toldExtensionsMap.delete(oldExtension.identifier);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tfor (const newExtension of allExtensions) {\n\t\t\tconst oldExtension = oldExtensionsMap.get(newExtension.identifier);\n\t\t\tif (!oldExtension) {\n\t\t\t\ttoAdd.push(newExtension);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!extensionsAreTheSame(oldExtension, newExtension)) {\n\t\t\t\t// The new extension is different than the old one\n\t\t\t\t// (e.g. maybe it executes in a different location)\n\t\t\t\ttoRemove.push(oldExtension.identifier);\n\t\t\t\toldExtensionsMap.delete(oldExtension.identifier);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tconst myOldExtensionsSet = new ExtensionIdentifierSet(this._myExtensions);\n\t\tconst myNewExtensionsSet = new ExtensionIdentifierSet(myExtensions);\n\t\tfor (const oldExtensionId of this._myExtensions) {\n\t\t\tif (!myNewExtensionsSet.has(oldExtensionId)) {\n\t\t\t\tmyToRemove.push(oldExtensionId);\n\t\t\t}\n\t\t}\n\t\tfor (const newExtensionId of myExtensions) {\n\t\t\tif (!myOldExtensionsSet.has(newExtensionId)) {\n\t\t\t\tmyToAdd.push(newExtensionId);\n\t\t\t}\n\t\t}\n\n\t\tconst addActivationEvents = ImplicitActivationEvents.createActivationEventsMap(toAdd);\n\t\tconst delta = { versionId, toRemove, toAdd, addActivationEvents, myToRemove, myToAdd };\n\t\tthis.delta(delta);\n\t\treturn delta;\n\t}\n\n\tpublic delta(extensionsDelta: IExtensionDescriptionDelta): IExtensionDescriptionDelta | null {\n\t\tif (this._versionId >= extensionsDelta.versionId) {\n\t\t\t// ignore older deltas\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { toRemove, toAdd, myToRemove, myToAdd } = extensionsDelta;\n\t\t// First handle removals\n\t\tconst toRemoveSet = new ExtensionIdentifierSet(toRemove);\n\t\tconst myToRemoveSet = new ExtensionIdentifierSet(myToRemove);\n\t\tfor (let i = 0; i < this._allExtensions.length; i++) {\n\t\t\tif (toRemoveSet.has(this._allExtensions[i].identifier)) {\n\t\t\t\tthis._allExtensions.splice(i, 1);\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t\tfor (let i = 0; i < this._myExtensions.length; i++) {\n\t\t\tif (myToRemoveSet.has(this._myExtensions[i])) {\n\t\t\t\tthis._myExtensions.splice(i, 1);\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t\t// Then handle additions\n\t\tfor (const extension of toAdd) {\n\t\t\tthis._allExtensions.push(extension);\n\t\t}\n\t\tfor (const extensionId of myToAdd) {\n\t\t\tthis._myExtensions.push(extensionId);\n\t\t}\n\n\t\t// clear cached activation events\n\t\tthis._myActivationEvents = null;\n\n\t\treturn extensionsDelta;\n\t}\n\n\tpublic containsExtension(extensionId: ExtensionIdentifier): boolean {\n\t\tfor (const myExtensionId of this._myExtensions) {\n\t\t\tif (ExtensionIdentifier.equals(myExtensionId, extensionId)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic containsActivationEvent(activationEvent: string): boolean {\n\t\tif (!this._myActivationEvents) {\n\t\t\tthis._myActivationEvents = this._readMyActivationEvents();\n\t\t}\n\t\treturn this._myActivationEvents.has(activationEvent);\n\t}\n\n\tprivate _readMyActivationEvents(): Set<string> {\n\t\tconst result = new Set<string>();\n\n\t\tfor (const extensionDescription of this._allExtensions) {\n\t\t\tif (!this.containsExtension(extensionDescription.identifier)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst activationEvents = ImplicitActivationEvents.readActivationEvents(extensionDescription);\n\t\t\tfor (const activationEvent of activationEvents) {\n\t\t\t\tresult.add(activationEvent);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\nfunction extensionDescriptionArrayToMap(extensions: IExtensionDescription[]): ExtensionIdentifierMap<IExtensionDescription> {\n\tconst result = new ExtensionIdentifierMap<IExtensionDescription>();\n\tfor (const extension of extensions) {\n\t\tresult.set(extension.identifier, extension);\n\t}\n\treturn result;\n}\n\nexport function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): boolean {\n\treturn true\n}\n\nexport function checkProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): void {\n\tif (!isProposedApiEnabled(extension, proposal)) {\n\t\tthrow new Error(`Extension '${extension.identifier.value}' CANNOT use API proposal: ${proposal}.\\nIts package.json#enabledApiProposals-property declares: ${extension.enabledApiProposals?.join(', ') ?? '[]'} but NOT ${proposal}.\\n The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ${extension.identifier.value}`);\n\t}\n}\n\n\n/**\n * Extension id or one of the four known program states.\n */\nexport type ProfileSegmentId = string | 'idle' | 'program' | 'gc' | 'self';\n\nexport interface ExtensionActivationReason {\n\treadonly startup: boolean;\n\treadonly extensionId: ExtensionIdentifier;\n\treadonly activationEvent: string;\n}\n\nexport class ActivationTimes {\n\tconstructor(\n\t\tpublic readonly codeLoadingTime: number,\n\t\tpublic readonly activateCallTime: number,\n\t\tpublic readonly activateResolvedTime: number,\n\t\tpublic readonly activationReason: ExtensionActivationReason\n\t) {\n\t}\n}\n\nexport class ExtensionPointContribution<T> {\n\treadonly description: IExtensionDescription;\n\treadonly value: T;\n\n\tconstructor(description: IExtensionDescription, value: T) {\n\t\tthis.description = description;\n\t\tthis.value = value;\n\t}\n}\n\nexport interface IWillActivateEvent {\n\treadonly event: string;\n\treadonly activation: Promise<void>;\n}\n\nexport interface IResponsiveStateChangeEvent {\n\textensionHostKind: ExtensionHostKind;\n\tisResponsive: boolean;\n\t/**\n\t * Return the inspect port or `0`. `0` means inspection is not possible.\n\t */\n\tgetInspectListener(tryEnableInspector: boolean): Promise<{ port: number; host: string } | undefined>;\n}\n\nexport const enum ActivationKind {\n\tNormal = 0,\n\tImmediate = 1\n}\n\nexport interface WillStopExtensionHostsEvent {\n\n\t/**\n\t * A human readable reason for stopping the extension hosts\n\t * that e.g. can be shown in a confirmation dialog to the\n\t * user.\n\t */\n\treadonly reason: string;\n\n\t/**\n\t * A flag to indicate if the operation was triggered automatically\n\t */\n\treadonly auto: boolean;\n\n\t/**\n\t * Allows to veto the stopping of extension hosts. The veto can be a long running\n\t * operation.\n\t *\n\t * @param reason a human readable reason for vetoing the extension host stop in case\n\t * where the resolved `value: true`.\n\t */\n\tveto(value: boolean | Promise<boolean>, reason: string): void;\n}\n\nexport interface IExtensionService {\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * An event emitted when extensions are registered after their extension points got handled.\n\t *\n\t * This event will also fire on startup to signal the installed extensions.\n\t *\n\t * @returns the extensions that got registered\n\t */\n\tonDidRegisterExtensions: Event<void>;\n\n\t/**\n\t * @event\n\t * Fired when extensions status changes.\n\t * The event contains the ids of the extensions that have changed.\n\t */\n\tonDidChangeExtensionsStatus: Event<ExtensionIdentifier[]>;\n\n\t/**\n\t * Fired when the available extensions change (i.e. when extensions are added or removed).\n\t */\n\tonDidChangeExtensions: Event<{ readonly added: readonly IExtensionDescription[]; readonly removed: readonly IExtensionDescription[] }>;\n\n\t/**\n\t * All registered extensions.\n\t * - List will be empty initially during workbench startup and will be filled with extensions as they are registered\n\t * - Listen to `onDidChangeExtensions` event for any changes to the extensions list. It will change as extensions get registered or de-reigstered.\n\t * - Listen to `onDidRegisterExtensions` event or wait for `whenInstalledExtensionsRegistered` promise to get the initial list of registered extensions.\n\t */\n\treadonly extensions: readonly IExtensionDescription[];\n\n\t/**\n\t * An event that is fired when activation happens.\n\t */\n\tonWillActivateByEvent: Event<IWillActivateEvent>;\n\n\t/**\n\t * An event that is fired when an extension host changes its\n\t * responsive-state.\n\t */\n\tonDidChangeResponsiveChange: Event<IResponsiveStateChangeEvent>;\n\n\t/**\n\t * Fired before stop of extension hosts happens. Allows listeners to veto against the\n\t * stop to prevent it from happening.\n\t */\n\tonWillStop: Event<WillStopExtensionHostsEvent>;\n\n\t/**\n\t * Send an activation event and activate interested extensions.\n\t *\n\t * This will wait for the normal startup of the extension host(s).\n\t *\n\t * In extraordinary circumstances, if the activation event needs to activate\n\t * one or more extensions before the normal startup is finished, then you can use\n\t * `ActivationKind.Immediate`. Please do not use this flag unless really necessary\n\t * and you understand all consequences.\n\t */\n\tactivateByEvent(activationEvent: string, activationKind?: ActivationKind): Promise<void>;\n\n\t/**\n\t * Send an activation ID and activate interested extensions.\n\t *\n\t */\n\tactivateById(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void>;\n\n\t/**\n\t * Determine if `activateByEvent(activationEvent)` has resolved already.\n\t *\n\t * i.e. the activation event is finished and all interested extensions are already active.\n\t */\n\tactivationEventIsDone(activationEvent: string): boolean;\n\n\t/**\n\t * An promise that resolves when the installed extensions are registered after\n\t * their extension points got handled.\n\t */\n\twhenInstalledExtensionsRegistered(): Promise<boolean>;\n\n\t/**\n\t * Return a specific extension\n\t * @param id An extension id\n\t */\n\tgetExtension(id: string): Promise<IExtensionDescription | undefined>;\n\n\t/**\n\t * Returns `true` if the given extension can be added. Otherwise `false`.\n\t * @param extension An extension\n\t */\n\tcanAddExtension(extension: IExtensionDescription): boolean;\n\n\t/**\n\t * Returns `true` if the given extension can be removed. Otherwise `false`.\n\t * @param extension An extension\n\t */\n\tcanRemoveExtension(extension: IExtensionDescription): boolean;\n\n\t/**\n\t * Read all contributions to an extension point.\n\t */\n\treadExtensionPointContributions<T extends IExtensionContributions[keyof IExtensionContributions]>(extPoint: IExtensionPoint<T>): Promise<ExtensionPointContribution<T>[]>;\n\n\t/**\n\t * Get information about extensions status.\n\t */\n\tgetExtensionsStatus(): { [id: string]: IExtensionsStatus };\n\n\t/**\n\t * Return the inspect ports (if inspection is possible) for extension hosts of kind `extensionHostKind`.\n\t */\n\tgetInspectPorts(extensionHostKind: ExtensionHostKind, tryEnableInspector: boolean): Promise<{ port: number; host: string }[]>;\n\n\t/**\n\t * Stops the extension hosts.\n\t *\n\t * @param reason a human readable reason for stopping the extension hosts. This maybe\n\t * can be presented to the user when showing dialogs.\n\t *\n\t * @param auto indicates if the operation was triggered by an automatic action\n\t *\n\t * @returns a promise that resolves to `true` if the extension hosts were stopped, `false`\n\t * if the operation was vetoed by listeners of the `onWillStop` event.\n\t */\n\tstopExtensionHosts(reason: string, auto?: boolean): Promise<boolean>;\n\n\t/**\n\t * Starts the extension hosts. If updates are provided, the extension hosts are started with the given updates.\n\t */\n\tstartExtensionHosts(updates?: { readonly toAdd: readonly IExtension[]; readonly toRemove: readonly string[] }): Promise<void>;\n\n\t/**\n\t * Modify the environment of the remote extension host\n\t * @param env New properties for the remote extension host\n\t */\n\tsetRemoteEnvironment(env: { [key: string]: string | null }): Promise<void>;\n}\n\nexport interface IInternalExtensionService {\n\t_activateById(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void>;\n\t_onWillActivateExtension(extensionId: ExtensionIdentifier): void;\n\t_onDidActivateExtension(extensionId: ExtensionIdentifier, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number, activationReason: ExtensionActivationReason): void;\n\t_onDidActivateExtensionError(extensionId: ExtensionIdentifier, error: Error): void;\n\t_onExtensionRuntimeError(extensionId: ExtensionIdentifier, err: Error): void;\n}\n\nexport interface ProfileSession {\n\tstop(): Promise<IExtensionHostProfile>;\n}\n\nexport function toExtension(extensionDescription: IExtensionDescription): IExtension {\n\treturn {\n\t\ttype: extensionDescription.isBuiltin ? ExtensionType.System : ExtensionType.User,\n\t\tisBuiltin: extensionDescription.isBuiltin || extensionDescription.isUserBuiltin,\n\t\tidentifier: { id: getGalleryExtensionId(extensionDescription.publisher, extensionDescription.name), uuid: extensionDescription.uuid },\n\t\tmanifest: extensionDescription,\n\t\tlocation: extensionDescription.extensionLocation,\n\t\ttargetPlatform: extensionDescription.targetPlatform,\n\t\tvalidations: [],\n\t\tisValid: true,\n\t\tpreRelease: extensionDescription.preRelease,\n\t\tpublisherDisplayName: extensionDescription.publisherDisplayName,\n\t};\n}\n\nexport function toExtensionDescription(extension: IExtension, isUnderDevelopment?: boolean): IExtensionDescription {\n\tconst id = getExtensionId(extension.manifest.publisher, extension.manifest.name);\n\treturn {\n\t\tid,\n\t\tidentifier: new ExtensionIdentifier(id),\n\t\tisBuiltin: extension.type === ExtensionType.System,\n\t\tisUserBuiltin: extension.type === ExtensionType.User && extension.isBuiltin,\n\t\tisUnderDevelopment: !!isUnderDevelopment,\n\t\textensionLocation: extension.location,\n\t\tuuid: extension.identifier.uuid,\n\t\ttargetPlatform: extension.targetPlatform,\n\t\tpublisherDisplayName: extension.publisherDisplayName,\n\t\tpreRelease: extension.preRelease,\n\t\t...extension.manifest\n\t};\n}\n\n\nexport class NullExtensionService implements IExtensionService {\n\tdeclare readonly _serviceBrand: undefined;\n\tonDidRegisterExtensions: Event<void> = Event.None;\n\tonDidChangeExtensionsStatus: Event<ExtensionIdentifier[]> = Event.None;\n\tonDidChangeExtensions = Event.None;\n\tonWillActivateByEvent: Event<IWillActivateEvent> = Event.None;\n\tonDidChangeResponsiveChange: Event<IResponsiveStateChangeEvent> = Event.None;\n\tonWillStop: Event<WillStopExtensionHostsEvent> = Event.None;\n\treadonly extensions = [];\n\tactivateByEvent(_activationEvent: string): Promise<void> { return Promise.resolve(undefined); }\n\tactivateById(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void> { return Promise.resolve(undefined); }\n\tactivationEventIsDone(_activationEvent: string): boolean { return false; }\n\twhenInstalledExtensionsRegistered(): Promise<boolean> { return Promise.resolve(true); }\n\tgetExtension() { return Promise.resolve(undefined); }\n\treadExtensionPointContributions<T>(_extPoint: IExtensionPoint<T>): Promise<ExtensionPointContribution<T>[]> { return Promise.resolve(Object.create(null)); }\n\tgetExtensionsStatus(): { [id: string]: IExtensionsStatus } { return Object.create(null); }\n\tgetInspectPorts(_extensionHostKind: ExtensionHostKind, _tryEnableInspector: boolean): Promise<{ port: number; host: string }[]> { return Promise.resolve([]); }\n\tasync stopExtensionHosts(): Promise<boolean> { return true; }\n\tasync startExtensionHosts(): Promise<void> { }\n\tasync setRemoteEnvironment(_env: { [key: string]: string | null }): Promise<void> { }\n\tcanAddExtension(): boolean { return false; }\n\tcanRemoveExtension(): boolean { return false; }\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { VSBuffer } from '../../../../base/common/buffer.js';\nimport type { CancellationToken } from '../../../../base/common/cancellation.js';\n\nexport interface IRPCProtocol {\n\t/**\n\t * Returns a proxy to an object addressable/named in the extension host process or in the renderer process.\n\t */\n\tgetProxy<T>(identifier: ProxyIdentifier<T>): Proxied<T>;\n\n\t/**\n\t * Register manually created instance.\n\t */\n\tset<T, R extends T>(identifier: ProxyIdentifier<T>, instance: R): R;\n\n\t/**\n\t * Assert these identifiers are already registered via `.set`.\n\t */\n\tassertRegistered(identifiers: ProxyIdentifier<any>[]): void;\n\n\t/**\n\t * Wait for the write buffer (if applicable) to become empty.\n\t */\n\tdrain(): Promise<void>;\n\n\tdispose(): void;\n}\n\nexport class ProxyIdentifier<T> {\n\tpublic static count = 0;\n\t_proxyIdentifierBrand: void = undefined;\n\n\tpublic readonly sid: string;\n\tpublic readonly nid: number;\n\n\tconstructor(sid: string) {\n\t\tthis.sid = sid;\n\t\tthis.nid = (++ProxyIdentifier.count);\n\t}\n}\n\nconst identifiers: ProxyIdentifier<any>[] = [];\n\nexport function createProxyIdentifier<T>(identifier: string): ProxyIdentifier<T> {\n\tconst result = new ProxyIdentifier<T>(identifier);\n\tidentifiers[result.nid] = result;\n\treturn result;\n}\n\n/**\n * Mapped-type that replaces all JSONable-types with their toJSON-result type\n */\nexport type Dto<T> = T extends { toJSON(): infer U }\n\t? U\n\t: T extends VSBuffer // VSBuffer is understood by rpc-logic\n\t? T\n\t: T extends CancellationToken // CancellationToken is understood by rpc-logic\n\t? T\n\t: T extends Function // functions are dropped during JSON-stringify\n\t? never\n\t: T extends object // recurse\n\t? { [k in keyof T]: Dto<T[k]>; }\n\t: T;\n\nexport type Proxied<T> = { [K in keyof T]: T[K] extends (...args: infer A) => infer R\n\t? (...args: { [K in keyof A]: Dto<A[K]> }) => Promise<Dto<Awaited<R>>>\n\t: never\n};\n\nexport function getStringIdentifierForProxy(nid: number): string {\n\treturn identifiers[nid].sid;\n}\n\n/**\n * Marks the object as containing buffers that should be serialized more efficiently.\n */\nexport class SerializableObjectWithBuffers<T> {\n\tconstructor(\n\t\tpublic readonly value: T\n\t) { }\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Barrier, isThenable, RunOnceScheduler } from '../../../../base/common/async.js';\nimport { Emitter } from '../../../../base/common/event.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { assertNever } from '../../../../base/common/assert.js';\nimport { applyTestItemUpdate, ITestItem, ITestTag, namespaceTestTag, TestDiffOpType, TestItemExpandState, TestsDiff, TestsDiffOp } from './testTypes.js';\nimport { TestId } from './testId.js';\nimport { URI } from '../../../../base/common/uri.js';\n\n/**\n * @private\n */\ninterface CollectionItem<T> {\n\treadonly fullId: TestId;\n\tactual: T;\n\texpand: TestItemExpandState;\n\t/**\n\t * Number of levels of items below this one that are expanded. May be infinite.\n\t */\n\texpandLevels?: number;\n\tresolveBarrier?: Barrier;\n}\n\nexport const enum TestItemEventOp {\n\tUpsert,\n\tSetTags,\n\tUpdateCanResolveChildren,\n\tRemoveChild,\n\tSetProp,\n\tBulk,\n\tDocumentSynced,\n}\n\nexport interface ITestItemUpsertChild {\n\top: TestItemEventOp.Upsert;\n\titem: ITestItemLike;\n}\n\nexport interface ITestItemUpdateCanResolveChildren {\n\top: TestItemEventOp.UpdateCanResolveChildren;\n\tstate: boolean;\n}\n\nexport interface ITestItemSetTags {\n\top: TestItemEventOp.SetTags;\n\tnew: ITestTag[];\n\told: ITestTag[];\n}\n\nexport interface ITestItemRemoveChild {\n\top: TestItemEventOp.RemoveChild;\n\tid: string;\n}\n\nexport interface ITestItemSetProp {\n\top: TestItemEventOp.SetProp;\n\tupdate: Partial<ITestItem>;\n}\nexport interface ITestItemBulkReplace {\n\top: TestItemEventOp.Bulk;\n\tops: (ITestItemUpsertChild | ITestItemRemoveChild)[];\n}\n\nexport interface ITestItemDocumentSynced {\n\top: TestItemEventOp.DocumentSynced;\n}\n\nexport type ExtHostTestItemEvent =\n\t| ITestItemSetTags\n\t| ITestItemUpsertChild\n\t| ITestItemRemoveChild\n\t| ITestItemUpdateCanResolveChildren\n\t| ITestItemSetProp\n\t| ITestItemBulkReplace\n\t| ITestItemDocumentSynced;\n\nexport interface ITestItemApi<T> {\n\tcontrollerId: string;\n\tparent?: T;\n\tlistener?: (evt: ExtHostTestItemEvent) => void;\n}\n\nexport interface ITestItemCollectionOptions<T> {\n\t/** Controller ID to use to prefix these test items. */\n\tcontrollerId: string;\n\n\t/** Gets the document version at the given URI, if it's open */\n\tgetDocumentVersion(uri: URI | undefined): number | undefined;\n\n\t/** Gets API for the given test item, used to listen for events and set parents. */\n\tgetApiFor(item: T): ITestItemApi<T>;\n\n\t/** Converts the full test item to the common interface. */\n\ttoITestItem(item: T): ITestItem;\n\n\t/** Gets children for the item. */\n\tgetChildren(item: T): ITestChildrenLike<T>;\n\n\t/** Root to use for the new test collection. */\n\troot: T;\n}\n\nconst strictEqualComparator = <T>(a: T, b: T) => a === b;\nconst diffableProps: { [K in keyof ITestItem]?: (a: ITestItem[K], b: ITestItem[K]) => boolean } = {\n\trange: (a, b) => {\n\t\tif (a === b) { return true; }\n\t\tif (!a || !b) { return false; }\n\t\treturn a.equalsRange(b);\n\t},\n\tbusy: strictEqualComparator,\n\tlabel: strictEqualComparator,\n\tdescription: strictEqualComparator,\n\terror: strictEqualComparator,\n\tsortText: strictEqualComparator,\n\ttags: (a, b) => {\n\t\tif (a.length !== b.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (a.some(t1 => !b.includes(t1))) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n};\n\nconst diffableEntries = Object.entries(diffableProps) as readonly [keyof ITestItem, (a: any, b: any) => boolean][];\n\nconst diffTestItems = (a: ITestItem, b: ITestItem) => {\n\tlet output: Record<string, unknown> | undefined;\n\tfor (const [key, cmp] of diffableEntries) {\n\t\tif (!cmp(a[key], b[key])) {\n\t\t\tif (output) {\n\t\t\t\toutput[key] = b[key];\n\t\t\t} else {\n\t\t\t\toutput = { [key]: b[key] };\n\t\t\t}\n\t\t}\n\t}\n\n\treturn output as Partial<ITestItem> | undefined;\n};\n\nexport interface ITestChildrenLike<T> extends Iterable<[string, T]> {\n\tget(id: string): T | undefined;\n\tdelete(id: string): void;\n}\n\nexport interface ITestItemLike {\n\tid: string;\n\ttags: readonly ITestTag[];\n\turi?: URI;\n\tcanResolveChildren: boolean;\n}\n\n/**\n * Maintains a collection of test items for a single controller.\n */\nexport class TestItemCollection<T extends ITestItemLike> extends Disposable {\n\tprivate readonly debounceSendDiff = this._register(new RunOnceScheduler(() => this.flushDiff(), 200));\n\tprivate readonly diffOpEmitter = this._register(new Emitter<TestsDiff>());\n\tprivate _resolveHandler?: (item: T | undefined) => Promise<void> | void;\n\n\tpublic get root() {\n\t\treturn this.options.root;\n\t}\n\n\tpublic readonly tree = new Map</* full test id */string, CollectionItem<T>>();\n\tprivate readonly tags = new Map<string, { label?: string; refCount: number }>();\n\n\tprotected diff: TestsDiff = [];\n\n\tconstructor(private readonly options: ITestItemCollectionOptions<T>) {\n\t\tsuper();\n\t\tthis.root.canResolveChildren = true;\n\t\tthis.upsertItem(this.root, undefined);\n\t}\n\n\t/**\n\t * Handler used for expanding test items.\n\t */\n\tpublic set resolveHandler(handler: undefined | ((item: T | undefined) => void)) {\n\t\tthis._resolveHandler = handler;\n\t\tfor (const test of this.tree.values()) {\n\t\t\tthis.updateExpandability(test);\n\t\t}\n\t}\n\n\tpublic get resolveHandler() {\n\t\treturn this._resolveHandler;\n\t}\n\n\t/**\n\t * Fires when an operation happens that should result in a diff.\n\t */\n\tpublic readonly onDidGenerateDiff = this.diffOpEmitter.event;\n\n\t/**\n\t * Gets a diff of all changes that have been made, and clears the diff queue.\n\t */\n\tpublic collectDiff() {\n\t\tconst diff = this.diff;\n\t\tthis.diff = [];\n\t\treturn diff;\n\t}\n\n\t/**\n\t * Pushes a new diff entry onto the collected diff list.\n\t */\n\tpublic pushDiff(diff: TestsDiffOp) {\n\t\tswitch (diff.op) {\n\t\t\tcase TestDiffOpType.DocumentSynced: {\n\t\t\t\tfor (const existing of this.diff) {\n\t\t\t\t\tif (existing.op === TestDiffOpType.DocumentSynced && existing.uri === diff.uri) {\n\t\t\t\t\t\texisting.docv = diff.docv;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TestDiffOpType.Update: {\n\t\t\t\t// Try to merge updates, since they're invoked per-property\n\t\t\t\tconst last = this.diff[this.diff.length - 1];\n\t\t\t\tif (last) {\n\t\t\t\t\tif (last.op === TestDiffOpType.Update && last.item.extId === diff.item.extId) {\n\t\t\t\t\t\tapplyTestItemUpdate(last.item, diff.item);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (last.op === TestDiffOpType.Add && last.item.item.extId === diff.item.extId) {\n\t\t\t\t\t\tapplyTestItemUpdate(last.item, diff.item);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis.diff.push(diff);\n\n\t\tif (!this.debounceSendDiff.isScheduled()) {\n\t\t\tthis.debounceSendDiff.schedule();\n\t\t}\n\t}\n\n\t/**\n\t * Expands the test and the given number of `levels` of children. If levels\n\t * is < 0, then all children will be expanded. If it's 0, then only this\n\t * item will be expanded.\n\t */\n\tpublic expand(testId: string, levels: number): Promise<void> | void {\n\t\tconst internal = this.tree.get(testId);\n\t\tif (!internal) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (internal.expandLevels === undefined || levels > internal.expandLevels) {\n\t\t\tinternal.expandLevels = levels;\n\t\t}\n\n\t\t// try to avoid awaiting things if the provider returns synchronously in\n\t\t// order to keep everything in a single diff and DOM update.\n\t\tif (internal.expand === TestItemExpandState.Expandable) {\n\t\t\tconst r = this.resolveChildren(internal);\n\t\t\treturn !r.isOpen()\n\t\t\t\t? r.wait().then(() => this.expandChildren(internal, levels - 1))\n\t\t\t\t: this.expandChildren(internal, levels - 1);\n\t\t} else if (internal.expand === TestItemExpandState.Expanded) {\n\t\t\treturn internal.resolveBarrier?.isOpen() === false\n\t\t\t\t? internal.resolveBarrier.wait().then(() => this.expandChildren(internal, levels - 1))\n\t\t\t\t: this.expandChildren(internal, levels - 1);\n\t\t}\n\t}\n\n\tpublic override dispose() {\n\t\tfor (const item of this.tree.values()) {\n\t\t\tthis.options.getApiFor(item.actual).listener = undefined;\n\t\t}\n\n\t\tthis.tree.clear();\n\t\tthis.diff = [];\n\t\tsuper.dispose();\n\t}\n\n\tprivate onTestItemEvent(internal: CollectionItem<T>, evt: ExtHostTestItemEvent) {\n\t\tswitch (evt.op) {\n\t\t\tcase TestItemEventOp.RemoveChild:\n\t\t\t\tthis.removeItem(TestId.joinToString(internal.fullId, evt.id));\n\t\t\t\tbreak;\n\n\t\t\tcase TestItemEventOp.Upsert:\n\t\t\t\tthis.upsertItem(evt.item as T, internal);\n\t\t\t\tbreak;\n\n\t\t\tcase TestItemEventOp.Bulk:\n\t\t\t\tfor (const op of evt.ops) {\n\t\t\t\t\tthis.onTestItemEvent(internal, op);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase TestItemEventOp.SetTags:\n\t\t\t\tthis.diffTagRefs(evt.new, evt.old, internal.fullId.toString());\n\t\t\t\tbreak;\n\n\t\t\tcase TestItemEventOp.UpdateCanResolveChildren:\n\t\t\t\tthis.updateExpandability(internal);\n\t\t\t\tbreak;\n\n\t\t\tcase TestItemEventOp.SetProp:\n\t\t\t\tthis.pushDiff({\n\t\t\t\t\top: TestDiffOpType.Update,\n\t\t\t\t\titem: {\n\t\t\t\t\t\textId: internal.fullId.toString(),\n\t\t\t\t\t\titem: evt.update,\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase TestItemEventOp.DocumentSynced:\n\t\t\t\tthis.documentSynced(internal.actual.uri);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tassertNever(evt);\n\t\t}\n\t}\n\n\tprivate documentSynced(uri: URI | undefined) {\n\t\tif (uri) {\n\t\t\tthis.pushDiff({\n\t\t\t\top: TestDiffOpType.DocumentSynced,\n\t\t\t\turi,\n\t\t\t\tdocv: this.options.getDocumentVersion(uri)\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate upsertItem(actual: T, parent: CollectionItem<T> | undefined): void {\n\t\tconst fullId = TestId.fromExtHostTestItem(actual, this.root.id, parent?.actual);\n\n\t\t// If this test item exists elsewhere in the tree already (exists at an\n\t\t// old ID with an existing parent), remove that old item.\n\t\tconst privateApi = this.options.getApiFor(actual);\n\t\tif (privateApi.parent && privateApi.parent !== parent?.actual) {\n\t\t\tthis.options.getChildren(privateApi.parent).delete(actual.id);\n\t\t}\n\n\t\tlet internal = this.tree.get(fullId.toString());\n\t\t// Case 1: a brand new item\n\t\tif (!internal) {\n\t\t\tinternal = {\n\t\t\t\tfullId,\n\t\t\t\tactual,\n\t\t\t\texpandLevels: parent?.expandLevels /* intentionally undefined or 0 */ ? parent.expandLevels - 1 : undefined,\n\t\t\t\texpand: TestItemExpandState.NotExpandable, // updated by `connectItemAndChildren`\n\t\t\t};\n\n\t\t\tactual.tags.forEach(this.incrementTagRefs, this);\n\t\t\tthis.tree.set(internal.fullId.toString(), internal);\n\t\t\tthis.setItemParent(actual, parent);\n\t\t\tthis.pushDiff({\n\t\t\t\top: TestDiffOpType.Add,\n\t\t\t\titem: {\n\t\t\t\t\tcontrollerId: this.options.controllerId,\n\t\t\t\t\texpand: internal.expand,\n\t\t\t\t\titem: this.options.toITestItem(actual),\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tthis.connectItemAndChildren(actual, internal, parent);\n\t\t\treturn;\n\t\t}\n\n\t\t// Case 2: re-insertion of an existing item, no-op\n\t\tif (internal.actual === actual) {\n\t\t\tthis.connectItem(actual, internal, parent); // re-connect in case the parent changed\n\t\t\treturn; // no-op\n\t\t}\n\n\t\t// Case 3: upsert of an existing item by ID, with a new instance\n\t\tif (internal.actual.uri?.toString() !== actual.uri?.toString()) {\n\t\t\t// If the item has a new URI, re-insert it; we don't support updating\n\t\t\t// URIs on existing test items.\n\t\t\tthis.removeItem(fullId.toString());\n\t\t\treturn this.upsertItem(actual, parent);\n\t\t}\n\t\tconst oldChildren = this.options.getChildren(internal.actual);\n\t\tconst oldActual = internal.actual;\n\t\tconst update = diffTestItems(this.options.toITestItem(oldActual), this.options.toITestItem(actual));\n\t\tthis.options.getApiFor(oldActual).listener = undefined;\n\n\t\tinternal.actual = actual;\n\t\tinternal.resolveBarrier = undefined;\n\t\tinternal.expand = TestItemExpandState.NotExpandable; // updated by `connectItemAndChildren`\n\n\t\tif (update) {\n\t\t\t// tags are handled in a special way\n\t\t\tif (update.hasOwnProperty('tags')) {\n\t\t\t\tthis.diffTagRefs(actual.tags, oldActual.tags, fullId.toString());\n\t\t\t\tdelete update.tags;\n\t\t\t}\n\t\t\tthis.onTestItemEvent(internal, { op: TestItemEventOp.SetProp, update });\n\t\t}\n\n\t\tthis.connectItemAndChildren(actual, internal, parent);\n\n\t\t// Remove any orphaned children.\n\t\tfor (const [_, child] of oldChildren) {\n\t\t\tif (!this.options.getChildren(actual).get(child.id)) {\n\t\t\t\tthis.removeItem(TestId.joinToString(fullId, child.id));\n\t\t\t}\n\t\t}\n\n\t\t// Re-expand the element if it was previous expanded (#207574)\n\t\tconst expandLevels = internal.expandLevels;\n\t\tif (expandLevels !== undefined) {\n\t\t\t// Wait until a microtask to allow the extension to finish setting up\n\t\t\t// properties of the element and children before we ask it to expand.\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (internal.expand === TestItemExpandState.Expandable) {\n\t\t\t\t\tinternal.expandLevels = undefined;\n\t\t\t\t\tthis.expand(fullId.toString(), expandLevels);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// Mark ranges in the document as synced (#161320)\n\t\tthis.documentSynced(internal.actual.uri);\n\t}\n\n\tprivate diffTagRefs(newTags: readonly ITestTag[], oldTags: readonly ITestTag[], extId: string) {\n\t\tconst toDelete = new Set(oldTags.map(t => t.id));\n\t\tfor (const tag of newTags) {\n\t\t\tif (!toDelete.delete(tag.id)) {\n\t\t\t\tthis.incrementTagRefs(tag);\n\t\t\t}\n\t\t}\n\n\t\tthis.pushDiff({\n\t\t\top: TestDiffOpType.Update,\n\t\t\titem: { extId, item: { tags: newTags.map(v => namespaceTestTag(this.options.controllerId, v.id)) } }\n\t\t});\n\n\t\ttoDelete.forEach(this.decrementTagRefs, this);\n\t}\n\n\tprivate incrementTagRefs(tag: ITestTag) {\n\t\tconst existing = this.tags.get(tag.id);\n\t\tif (existing) {\n\t\t\texisting.refCount++;\n\t\t} else {\n\t\t\tthis.tags.set(tag.id, { refCount: 1 });\n\t\t\tthis.pushDiff({\n\t\t\t\top: TestDiffOpType.AddTag, tag: {\n\t\t\t\t\tid: namespaceTestTag(this.options.controllerId, tag.id),\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate decrementTagRefs(tagId: string) {\n\t\tconst existing = this.tags.get(tagId);\n\t\tif (existing && !--existing.refCount) {\n\t\t\tthis.tags.delete(tagId);\n\t\t\tthis.pushDiff({ op: TestDiffOpType.RemoveTag, id: namespaceTestTag(this.options.controllerId, tagId) });\n\t\t}\n\t}\n\n\tprivate setItemParent(actual: T, parent: CollectionItem<T> | undefined) {\n\t\tthis.options.getApiFor(actual).parent = parent && parent.actual !== this.root ? parent.actual : undefined;\n\t}\n\n\tprivate connectItem(actual: T, internal: CollectionItem<T>, parent: CollectionItem<T> | undefined) {\n\t\tthis.setItemParent(actual, parent);\n\t\tconst api = this.options.getApiFor(actual);\n\t\tapi.parent = parent?.actual;\n\t\tapi.listener = evt => this.onTestItemEvent(internal, evt);\n\t\tthis.updateExpandability(internal);\n\t}\n\n\tprivate connectItemAndChildren(actual: T, internal: CollectionItem<T>, parent: CollectionItem<T> | undefined) {\n\t\tthis.connectItem(actual, internal, parent);\n\n\t\t// Discover any existing children that might have already been added\n\t\tfor (const [_, child] of this.options.getChildren(actual)) {\n\t\t\tthis.upsertItem(child, internal);\n\t\t}\n\t}\n\n\t/**\n\t * Updates the `expand` state of the item. Should be called whenever the\n\t * resolved state of the item changes. Can automatically expand the item\n\t * if requested by a consumer.\n\t */\n\tprivate updateExpandability(internal: CollectionItem<T>) {\n\t\tlet newState: TestItemExpandState;\n\t\tif (!this._resolveHandler) {\n\t\t\tnewState = TestItemExpandState.NotExpandable;\n\t\t} else if (internal.resolveBarrier) {\n\t\t\tnewState = internal.resolveBarrier.isOpen()\n\t\t\t\t? TestItemExpandState.Expanded\n\t\t\t\t: TestItemExpandState.BusyExpanding;\n\t\t} else {\n\t\t\tnewState = internal.actual.canResolveChildren\n\t\t\t\t? TestItemExpandState.Expandable\n\t\t\t\t: TestItemExpandState.NotExpandable;\n\t\t}\n\n\t\tif (newState === internal.expand) {\n\t\t\treturn;\n\t\t}\n\n\t\tinternal.expand = newState;\n\t\tthis.pushDiff({ op: TestDiffOpType.Update, item: { extId: internal.fullId.toString(), expand: newState } });\n\n\t\tif (newState === TestItemExpandState.Expandable && internal.expandLevels !== undefined) {\n\t\t\tthis.resolveChildren(internal);\n\t\t}\n\t}\n\n\t/**\n\t * Expands all children of the item, \"levels\" deep. If levels is 0, only\n\t * the children will be expanded. If it's 1, the children and their children\n\t * will be expanded. If it's <0, it's a no-op.\n\t */\n\tprivate expandChildren(internal: CollectionItem<T>, levels: number): Promise<void> | void {\n\t\tif (levels < 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst expandRequests: Promise<void>[] = [];\n\t\tfor (const [_, child] of this.options.getChildren(internal.actual)) {\n\t\t\tconst promise = this.expand(TestId.joinToString(internal.fullId, child.id), levels);\n\t\t\tif (isThenable(promise)) {\n\t\t\t\texpandRequests.push(promise);\n\t\t\t}\n\t\t}\n\n\t\tif (expandRequests.length) {\n\t\t\treturn Promise.all(expandRequests).then(() => { });\n\t\t}\n\t}\n\n\t/**\n\t * Calls `discoverChildren` on the item, refreshing all its tests.\n\t */\n\tprivate resolveChildren(internal: CollectionItem<T>) {\n\t\tif (internal.resolveBarrier) {\n\t\t\treturn internal.resolveBarrier;\n\t\t}\n\n\t\tif (!this._resolveHandler) {\n\t\t\tconst b = new Barrier();\n\t\t\tb.open();\n\t\t\treturn b;\n\t\t}\n\n\t\tinternal.expand = TestItemExpandState.BusyExpanding;\n\t\tthis.pushExpandStateUpdate(internal);\n\n\t\tconst barrier = internal.resolveBarrier = new Barrier();\n\t\tconst applyError = (err: Error) => {\n\t\t\tconsole.error(`Unhandled error in resolveHandler of test controller \"${this.options.controllerId}\"`, err);\n\t\t};\n\n\t\tlet r: Thenable<void> | undefined | void;\n\t\ttry {\n\t\t\tr = this._resolveHandler(internal.actual === this.root ? undefined : internal.actual);\n\t\t} catch (err) {\n\t\t\tapplyError(err);\n\t\t}\n\n\t\tif (isThenable(r)) {\n\t\t\tr.catch(applyError).then(() => {\n\t\t\t\tbarrier.open();\n\t\t\t\tthis.updateExpandability(internal);\n\t\t\t});\n\t\t} else {\n\t\t\tbarrier.open();\n\t\t\tthis.updateExpandability(internal);\n\t\t}\n\n\t\treturn internal.resolveBarrier;\n\t}\n\n\tprivate pushExpandStateUpdate(internal: CollectionItem<T>) {\n\t\tthis.pushDiff({ op: TestDiffOpType.Update, item: { extId: internal.fullId.toString(), expand: internal.expand } });\n\t}\n\n\tprivate removeItem(childId: string) {\n\t\tconst childItem = this.tree.get(childId);\n\t\tif (!childItem) {\n\t\t\tthrow new Error('attempting to remove non-existent child');\n\t\t}\n\n\t\tthis.pushDiff({ op: TestDiffOpType.Remove, itemId: childId });\n\n\t\tconst queue: (CollectionItem<T> | undefined)[] = [childItem];\n\t\twhile (queue.length) {\n\t\t\tconst item = queue.pop();\n\t\t\tif (!item) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthis.options.getApiFor(item.actual).listener = undefined;\n\n\t\t\tfor (const tag of item.actual.tags) {\n\t\t\t\tthis.decrementTagRefs(tag.id);\n\t\t\t}\n\n\t\t\tthis.tree.delete(item.fullId.toString());\n\t\t\tfor (const [_, child] of this.options.getChildren(item.actual)) {\n\t\t\t\tqueue.push(this.tree.get(TestId.joinToString(item.fullId, child.id)));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Immediately emits any pending diffs on the collection.\n\t */\n\tpublic flushDiff() {\n\t\tconst diff = this.collectDiff();\n\t\tif (diff.length) {\n\t\t\tthis.diffOpEmitter.fire(diff);\n\t\t}\n\t}\n}\n\n/** Implementation of vscode.TestItemCollection */\nexport interface ITestItemChildren<T extends ITestItemLike> extends Iterable<[string, T]> {\n\treadonly size: number;\n\treplace(items: readonly T[]): void;\n\tforEach(callback: (item: T, collection: this) => unknown, thisArg?: unknown): void;\n\tadd(item: T): void;\n\tdelete(itemId: string): void;\n\tget(itemId: string): T | undefined;\n\n\ttoJSON(): readonly T[];\n}\n\nexport class DuplicateTestItemError extends Error {\n\tconstructor(id: string) {\n\t\tsuper(`Attempted to insert a duplicate test item ID ${id}`);\n\t}\n}\n\nexport class InvalidTestItemError extends Error {\n\tconstructor(id: string) {\n\t\tsuper(`TestItem with ID \"${id}\" is invalid. Make sure to create it from the createTestItem method.`);\n\t}\n}\n\nexport class MixedTestItemController extends Error {\n\tconstructor(id: string, ctrlA: string, ctrlB: string) {\n\t\tsuper(`TestItem with ID \"${id}\" is from controller \"${ctrlA}\" and cannot be added as a child of an item from controller \"${ctrlB}\".`);\n\t}\n}\n\nexport const createTestItemChildren = <T extends ITestItemLike>(api: ITestItemApi<T>, getApi: (item: T) => ITestItemApi<T>, checkCtor: Function): ITestItemChildren<T> => {\n\tlet mapped = new Map<string, T>();\n\n\treturn {\n\t\t/** @inheritdoc */\n\t\tget size() {\n\t\t\treturn mapped.size;\n\t\t},\n\n\t\t/** @inheritdoc */\n\t\tforEach(callback: (item: T, collection: ITestItemChildren<T>) => unknown, thisArg?: unknown) {\n\t\t\tfor (const item of mapped.values()) {\n\t\t\t\tcallback.call(thisArg, item, this);\n\t\t\t}\n\t\t},\n\n\t\t/** @inheritdoc */\n\t\t[Symbol.iterator](): IterableIterator<[string, T]> {\n\t\t\treturn mapped.entries();\n\t\t},\n\n\t\t/** @inheritdoc */\n\t\treplace(items: Iterable<T>) {\n\t\t\tconst newMapped = new Map<string, T>();\n\t\t\tconst toDelete = new Set(mapped.keys());\n\t\t\tconst bulk: ITestItemBulkReplace = { op: TestItemEventOp.Bulk, ops: [] };\n\n\t\t\tfor (const item of items) {\n\t\t\t\tif (!(item instanceof checkCtor)) {\n\t\t\t\t\tthrow new InvalidTestItemError((item as ITestItemLike).id);\n\t\t\t\t}\n\n\t\t\t\tconst itemController = getApi(item).controllerId;\n\t\t\t\tif (itemController !== api.controllerId) {\n\t\t\t\t\tthrow new MixedTestItemController(item.id, itemController, api.controllerId);\n\t\t\t\t}\n\n\t\t\t\tif (newMapped.has(item.id)) {\n\t\t\t\t\tthrow new DuplicateTestItemError(item.id);\n\t\t\t\t}\n\n\t\t\t\tnewMapped.set(item.id, item);\n\t\t\t\ttoDelete.delete(item.id);\n\t\t\t\tbulk.ops.push({ op: TestItemEventOp.Upsert, item });\n\t\t\t}\n\n\t\t\tfor (const id of toDelete.keys()) {\n\t\t\t\tbulk.ops.push({ op: TestItemEventOp.RemoveChild, id });\n\t\t\t}\n\n\t\t\tapi.listener?.(bulk);\n\n\t\t\t// important mutations come after firing, so if an error happens no\n\t\t\t// changes will be \"saved\":\n\t\t\tmapped = newMapped;\n\t\t},\n\n\n\t\t/** @inheritdoc */\n\t\tadd(item: T) {\n\t\t\tif (!(item instanceof checkCtor)) {\n\t\t\t\tthrow new InvalidTestItemError((item as ITestItemLike).id);\n\t\t\t}\n\n\t\t\tmapped.set(item.id, item);\n\t\t\tapi.listener?.({ op: TestItemEventOp.Upsert, item });\n\t\t},\n\n\t\t/** @inheritdoc */\n\t\tdelete(id: string) {\n\t\t\tif (mapped.delete(id)) {\n\t\t\t\tapi.listener?.({ op: TestItemEventOp.RemoveChild, id });\n\t\t\t}\n\t\t},\n\n\t\t/** @inheritdoc */\n\t\tget(itemId: string) {\n\t\t\treturn mapped.get(itemId);\n\t\t},\n\n\t\t/** JSON serialization function. */\n\t\ttoJSON() {\n\t\t\treturn Array.from(mapped.values());\n\t\t},\n\t};\n};\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ExtHostTestItemEvent, InvalidTestItemError } from '../../contrib/testing/common/testItemCollection.js';\nimport * as vscode from 'vscode';\n\nexport interface IExtHostTestItemApi {\n\tcontrollerId: string;\n\tparent?: vscode.TestItem;\n\tlistener?: (evt: ExtHostTestItemEvent) => void;\n}\n\nconst eventPrivateApis = new WeakMap<vscode.TestItem, IExtHostTestItemApi>();\n\nexport const createPrivateApiFor = (impl: vscode.TestItem, controllerId: string) => {\n\tconst api: IExtHostTestItemApi = { controllerId };\n\teventPrivateApis.set(impl, api);\n\treturn api;\n};\n\n/**\n * Gets the private API for a test item implementation. This implementation\n * is a managed object, but we keep a weakmap to avoid exposing any of the\n * internals to extensions.\n */\nexport const getPrivateApiFor = (impl: vscode.TestItem) => {\n\tconst api = eventPrivateApis.get(impl);\n\tif (!api) {\n\t\tthrow new InvalidTestItemError(impl?.id || '<unknown>');\n\t}\n\n\treturn api;\n};\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport enum ChatConfiguration {\n\tUseFileStorage = 'chat.useFileStorage',\n\tAgentEnabled = 'chat.agent.enabled',\n\tEdits2Enabled = 'chat.edits2.enabled',\n\tExtensionToolsEnabled = 'chat.extensionTools.enabled',\n\tEditRequests = 'chat.editRequests',\n}\n\n/**\n * The \"kind\" of the chat mode- \"Agent\" for custom modes.\n */\nexport enum ChatModeKind {\n\tAsk = 'ask',\n\tEdit = 'edit',\n\tAgent = 'agent'\n}\n\nexport function validateChatMode(mode: unknown): ChatModeKind | undefined {\n\tswitch (mode) {\n\t\tcase ChatModeKind.Ask:\n\t\tcase ChatModeKind.Edit:\n\t\tcase ChatModeKind.Agent:\n\t\t\treturn mode as ChatModeKind;\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nexport function isChatMode(mode: unknown): mode is ChatModeKind {\n\treturn !!validateChatMode(mode);\n}\n\nexport type RawChatParticipantLocation = 'panel' | 'terminal' | 'notebook' | 'editing-session';\n\nexport enum ChatAgentLocation {\n\tPanel = 'panel',\n\tTerminal = 'terminal',\n\tNotebook = 'notebook',\n\tEditor = 'editor',\n}\n\nexport namespace ChatAgentLocation {\n\texport function fromRaw(value: RawChatParticipantLocation | string): ChatAgentLocation {\n\t\tswitch (value) {\n\t\t\tcase 'panel': return ChatAgentLocation.Panel;\n\t\t\tcase 'terminal': return ChatAgentLocation.Terminal;\n\t\t\tcase 'notebook': return ChatAgentLocation.Notebook;\n\t\t\tcase 'editor': return ChatAgentLocation.Editor;\n\t\t}\n\t\treturn ChatAgentLocation.Panel;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { Event } from '../../../../base/common/event.js';\nimport { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\n\nexport const IAiSettingsSearchService = createDecorator<IAiSettingsSearchService>('IAiSettingsSearchService');\n\nexport enum AiSettingsSearchResultKind {\n\tEMBEDDED = 1,\n\tLLM_RANKED = 2,\n\tCANCELED = 3,\n}\n\nexport interface AiSettingsSearchResult {\n\tquery: string;\n\tkind: AiSettingsSearchResultKind;\n\tsettings: string[];\n}\n\nexport interface AiSettingsSearchProviderOptions {\n\tlimit: number;\n\tembeddingsOnly: boolean;\n}\n\nexport interface IAiSettingsSearchService {\n\treadonly _serviceBrand: undefined;\n\treadonly onProviderRegistered: Event<void>;\n\n\t// Called from the Settings editor\n\tisEnabled(): boolean;\n\tstartSearch(query: string, embeddingsOnly: boolean, token: CancellationToken): void;\n\tgetEmbeddingsResults(query: string, token: CancellationToken): Promise<string[] | null>;\n\tgetLLMRankedResults(query: string, token: CancellationToken): Promise<string[] | null>;\n\n\t// Called from the main thread\n\tregisterSettingsSearchProvider(provider: IAiSettingsSearchProvider): IDisposable;\n\thandleSearchResult(results: AiSettingsSearchResult): void;\n}\n\nexport interface IAiSettingsSearchProvider {\n\tsearchSettings(query: string, option: AiSettingsSearchProviderOptions, token: CancellationToken): void;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { RunOnceScheduler } from '../../../base/common/async.js';\nimport { Codicon } from '../../../base/common/codicons.js';\nimport { getCodiconFontCharacters } from '../../../base/common/codiconsUtil.js';\nimport { ThemeIcon, IconIdentifier } from '../../../base/common/themables.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { IJSONSchema, IJSONSchemaMap } from '../../../base/common/jsonSchema.js';\nimport { isString } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { Extensions as JSONExtensions, IJSONContributionRegistry } from '../../jsonschemas/common/jsonContributionRegistry.js';\nimport * as platform from '../../registry/common/platform.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\n\n//  ------ API types\n\n\n// icon registry\nexport const Extensions = {\n\tIconContribution: 'base.contributions.icons'\n};\n\nexport type IconDefaults = ThemeIcon | IconDefinition;\n\nexport interface IconDefinition {\n\treadonly font?: IconFontContribution; // undefined for the default font (codicon)\n\treadonly fontCharacter: string;\n}\n\n\nexport interface IconContribution {\n\treadonly id: string;\n\tdescription: string | undefined;\n\treadonly deprecationMessage?: string;\n\treadonly defaults: IconDefaults;\n}\n\nexport namespace IconContribution {\n\texport function getDefinition(contribution: IconContribution, registry: IIconRegistry): IconDefinition | undefined {\n\t\tlet definition = contribution.defaults;\n\t\twhile (ThemeIcon.isThemeIcon(definition)) {\n\t\t\tconst c = iconRegistry.getIcon(definition.id);\n\t\t\tif (!c) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tdefinition = c.defaults;\n\t\t}\n\t\treturn definition;\n\t}\n}\n\nexport interface IconFontContribution {\n\treadonly id: string;\n\treadonly definition: IconFontDefinition;\n}\n\nexport interface IconFontDefinition {\n\treadonly weight?: string;\n\treadonly style?: string;\n\treadonly src: IconFontSource[];\n}\n\nexport namespace IconFontDefinition {\n\texport function toJSONObject(iconFont: IconFontDefinition): any {\n\t\treturn {\n\t\t\tweight: iconFont.weight,\n\t\t\tstyle: iconFont.style,\n\t\t\tsrc: iconFont.src.map(s => ({ format: s.format, location: s.location.toString() }))\n\t\t};\n\t}\n\texport function fromJSONObject(json: any): IconFontDefinition | undefined {\n\t\tconst stringOrUndef = (s: any) => isString(s) ? s : undefined;\n\t\tif (json && Array.isArray(json.src) && json.src.every((s: any) => isString(s.format) && isString(s.location))) {\n\t\t\treturn {\n\t\t\t\tweight: stringOrUndef(json.weight),\n\t\t\t\tstyle: stringOrUndef(json.style),\n\t\t\t\tsrc: json.src.map((s: any) => ({ format: s.format, location: URI.parse(s.location) }))\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\n\nexport interface IconFontSource {\n\treadonly location: URI;\n\treadonly format: string;\n}\n\nexport interface IIconRegistry {\n\n\treadonly onDidChange: Event<void>;\n\n\t/**\n\t * Register a icon to the registry.\n\t * @param id The icon id\n\t * @param defaults The default values\n\t * @param description The description\n\t */\n\tregisterIcon(id: IconIdentifier, defaults: IconDefaults, description?: string): ThemeIcon;\n\n\t/**\n\t * Deregister a icon from the registry.\n\t */\n\tderegisterIcon(id: IconIdentifier): void;\n\n\t/**\n\t * Get all icon contributions\n\t */\n\tgetIcons(): IconContribution[];\n\n\t/**\n\t * Get the icon for the given id\n\t */\n\tgetIcon(id: IconIdentifier): IconContribution | undefined;\n\n\t/**\n\t * JSON schema for an object to assign icon values to one of the icon contributions.\n\t */\n\tgetIconSchema(): IJSONSchema;\n\n\t/**\n\t * JSON schema to for a reference to a icon contribution.\n\t */\n\tgetIconReferenceSchema(): IJSONSchema;\n\n\t/**\n\t * Register a icon font to the registry.\n\t * @param id The icon font id\n\t * @param definition The icon font definition\n\t */\n\tregisterIconFont(id: string, definition: IconFontDefinition): IconFontDefinition;\n\n\t/**\n\t * Deregister an icon font to the registry.\n\t */\n\tderegisterIconFont(id: string): void;\n\n\t/**\n\t * Get the icon font for the given id\n\t */\n\tgetIconFont(id: string): IconFontDefinition | undefined;\n}\n\n// regexes for validation of font properties\n\nexport const fontIdRegex = /^([\\w_-]+)$/;\nexport const fontStyleRegex = /^(normal|italic|(oblique[ \\w\\s-]+))$/;\nexport const fontWeightRegex = /^(normal|bold|lighter|bolder|(\\d{0-1000}))$/;\nexport const fontSizeRegex = /^([\\w_.%+-]+)$/;\nexport const fontFormatRegex = /^woff|woff2|truetype|opentype|embedded-opentype|svg$/;\nexport const fontColorRegex = /^#[0-9a-fA-F]{0,6}$/;\n\nexport const fontIdErrorMessage = localize('schema.fontId.formatError', 'The font ID must only contain letters, numbers, underscores and dashes.');\n\nclass IconRegistry extends Disposable implements IIconRegistry {\n\n\tprivate readonly _onDidChange = this._register(new Emitter<void>());\n\treadonly onDidChange: Event<void> = this._onDidChange.event;\n\n\tprivate iconsById: { [key: string]: IconContribution };\n\tprivate iconSchema: IJSONSchema & { properties: IJSONSchemaMap } = {\n\t\tdefinitions: {\n\t\t\ticons: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tfontId: { type: 'string', description: localize('iconDefinition.fontId', 'The id of the font to use. If not set, the font that is defined first is used.'), pattern: fontIdRegex.source, patternErrorMessage: fontIdErrorMessage },\n\t\t\t\t\tfontCharacter: { type: 'string', description: localize('iconDefinition.fontCharacter', 'The font character associated with the icon definition.') }\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tdefaultSnippets: [{ body: { fontCharacter: '\\\\\\\\e030' } }]\n\t\t\t}\n\t\t},\n\t\ttype: 'object',\n\t\tproperties: {}\n\t};\n\tprivate iconReferenceSchema: IJSONSchema & { enum: string[]; enumDescriptions: string[] } = { type: 'string', pattern: `^${ThemeIcon.iconNameExpression}$`, enum: [], enumDescriptions: [] };\n\n\tprivate iconFontsById: { [key: string]: IconFontDefinition };\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.iconsById = {};\n\t\tthis.iconFontsById = {};\n\t}\n\n\tpublic registerIcon(id: string, defaults: IconDefaults, description?: string, deprecationMessage?: string): ThemeIcon {\n\t\tconst existing = this.iconsById[id];\n\t\tif (existing) {\n\t\t\tif (description && !existing.description) {\n\t\t\t\texisting.description = description;\n\t\t\t\tthis.iconSchema.properties[id].markdownDescription = `${description} $(${id})`;\n\t\t\t\tconst enumIndex = this.iconReferenceSchema.enum.indexOf(id);\n\t\t\t\tif (enumIndex !== -1) {\n\t\t\t\t\tthis.iconReferenceSchema.enumDescriptions[enumIndex] = description;\n\t\t\t\t}\n\t\t\t\tthis._onDidChange.fire();\n\t\t\t}\n\t\t\treturn existing;\n\t\t}\n\t\tconst iconContribution: IconContribution = { id, description, defaults, deprecationMessage };\n\t\tthis.iconsById[id] = iconContribution;\n\t\tconst propertySchema: IJSONSchema = { $ref: '#/definitions/icons' };\n\t\tif (deprecationMessage) {\n\t\t\tpropertySchema.deprecationMessage = deprecationMessage;\n\t\t}\n\t\tif (description) {\n\t\t\tpropertySchema.markdownDescription = `${description}: $(${id})`;\n\t\t}\n\t\tthis.iconSchema.properties[id] = propertySchema;\n\t\tthis.iconReferenceSchema.enum.push(id);\n\t\tthis.iconReferenceSchema.enumDescriptions.push(description || '');\n\n\t\tthis._onDidChange.fire();\n\t\treturn { id };\n\t}\n\n\n\tpublic deregisterIcon(id: string): void {\n\t\tdelete this.iconsById[id];\n\t\tdelete this.iconSchema.properties[id];\n\t\tconst index = this.iconReferenceSchema.enum.indexOf(id);\n\t\tif (index !== -1) {\n\t\t\tthis.iconReferenceSchema.enum.splice(index, 1);\n\t\t\tthis.iconReferenceSchema.enumDescriptions.splice(index, 1);\n\t\t}\n\t\tthis._onDidChange.fire();\n\t}\n\n\tpublic getIcons(): IconContribution[] {\n\t\treturn Object.keys(this.iconsById).map(id => this.iconsById[id]);\n\t}\n\n\tpublic getIcon(id: string): IconContribution | undefined {\n\t\treturn this.iconsById[id];\n\t}\n\n\tpublic getIconSchema(): IJSONSchema {\n\t\treturn this.iconSchema;\n\t}\n\n\tpublic getIconReferenceSchema(): IJSONSchema {\n\t\treturn this.iconReferenceSchema;\n\t}\n\n\tpublic registerIconFont(id: string, definition: IconFontDefinition): IconFontDefinition {\n\t\tconst existing = this.iconFontsById[id];\n\t\tif (existing) {\n\t\t\treturn existing;\n\t\t}\n\t\tthis.iconFontsById[id] = definition;\n\t\tthis._onDidChange.fire();\n\t\treturn definition;\n\t}\n\n\tpublic deregisterIconFont(id: string): void {\n\t\tdelete this.iconFontsById[id];\n\t}\n\n\tpublic getIconFont(id: string): IconFontDefinition | undefined {\n\t\treturn this.iconFontsById[id];\n\t}\n\n\tpublic override toString() {\n\t\tconst sorter = (i1: IconContribution, i2: IconContribution) => {\n\t\t\treturn i1.id.localeCompare(i2.id);\n\t\t};\n\t\tconst classNames = (i: IconContribution) => {\n\t\t\twhile (ThemeIcon.isThemeIcon(i.defaults)) {\n\t\t\t\ti = this.iconsById[i.defaults.id];\n\t\t\t}\n\t\t\treturn `codicon codicon-${i ? i.id : ''}`;\n\t\t};\n\n\t\tconst reference = [];\n\n\t\treference.push(`| preview     | identifier                        | default codicon ID                | description`);\n\t\treference.push(`| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |`);\n\t\tconst contributions = Object.keys(this.iconsById).map(key => this.iconsById[key]);\n\n\t\tfor (const i of contributions.filter(i => !!i.description).sort(sorter)) {\n\t\t\treference.push(`|<i class=\"${classNames(i)}\"></i>|${i.id}|${ThemeIcon.isThemeIcon(i.defaults) ? i.defaults.id : i.id}|${i.description || ''}|`);\n\t\t}\n\n\t\treference.push(`| preview     | identifier                        `);\n\t\treference.push(`| ----------- | --------------------------------- |`);\n\n\t\tfor (const i of contributions.filter(i => !ThemeIcon.isThemeIcon(i.defaults)).sort(sorter)) {\n\t\t\treference.push(`|<i class=\"${classNames(i)}\"></i>|${i.id}|`);\n\n\t\t}\n\n\t\treturn reference.join('\\n');\n\t}\n\n}\n\nconst iconRegistry = new IconRegistry();\nplatform.Registry.add(Extensions.IconContribution, iconRegistry);\n\nexport function registerIcon(id: string, defaults: IconDefaults, description: string, deprecationMessage?: string): ThemeIcon {\n\treturn iconRegistry.registerIcon(id, defaults, description, deprecationMessage);\n}\n\nexport function getIconRegistry(): IIconRegistry {\n\treturn iconRegistry;\n}\n\nfunction initialize() {\n\tconst codiconFontCharacters = getCodiconFontCharacters();\n\tfor (const icon in codiconFontCharacters) {\n\t\tconst fontCharacter = '\\\\' + codiconFontCharacters[icon].toString(16);\n\t\ticonRegistry.registerIcon(icon, { fontCharacter });\n\t}\n}\ninitialize();\n\nexport const iconsSchemaId = 'vscode://schemas/icons';\n\nconst schemaRegistry = platform.Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);\nschemaRegistry.registerSchema(iconsSchemaId, iconRegistry.getIconSchema());\n\nconst delayer = new RunOnceScheduler(() => schemaRegistry.notifySchemaChanged(iconsSchemaId), 200);\niconRegistry.onDidChange(() => {\n\tif (!delayer.isScheduled()) {\n\t\tdelayer.schedule();\n\t}\n});\n\n//setTimeout(_ => console.log(iconRegistry.toString()), 5000);\n\n\n// common icons\n\nexport const widgetClose = registerIcon('widget-close', Codicon.close, localize('widgetClose', 'Icon for the close action in widgets.'));\n\nexport const gotoPreviousLocation = registerIcon('goto-previous-location', Codicon.arrowUp, localize('previousChangeIcon', 'Icon for goto previous editor location.'));\nexport const gotoNextLocation = registerIcon('goto-next-location', Codicon.arrowDown, localize('nextChangeIcon', 'Icon for goto next editor location.'));\n\nexport const syncing = ThemeIcon.modify(Codicon.sync, 'spin');\nexport const spinningLoading = ThemeIcon.modify(Codicon.loading, 'spin');\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/* eslint-disable local/code-no-unexternalized-strings */\n\n//#region proposals\n/**\n * MCP protocol proposals.\n * - Proposals here MUST have an MCP PR linked to them\n * - Proposals here are subject to change and SHALL be removed when\n *   the upstream MCP PR is merged or closed.\n */\nexport namespace MCP {\n\n\t// Nothing, yet\n\n}\n\n//#endregion\n\n/**\n * Schema updated from the Model Context Protocol repository at\n * https://github.com/modelcontextprotocol/specification/tree/main/schema\n *\n * ⚠️ Do not edit within `namespace` manually except to update schema versions ⚠️\n */\nexport namespace MCP {\n\t/**\n\t * Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.\n\t */\n\texport type JSONRPCMessage =\n\t\t| JSONRPCRequest\n\t\t| JSONRPCNotification\n\t\t| JSONRPCResponse\n\t\t| JSONRPCError;\n\n\texport const LATEST_PROTOCOL_VERSION = \"2025-06-18\";\n\texport const JSONRPC_VERSION = \"2.0\";\n\n\t/**\n\t * A progress token, used to associate progress notifications with the original request.\n\t */\n\texport type ProgressToken = string | number;\n\n\t/**\n\t * An opaque token used to represent a cursor for pagination.\n\t */\n\texport type Cursor = string;\n\n\texport interface Request {\n\t\tmethod: string;\n\t\tparams?: {\n\t\t\t/**\n\t\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t\t */\n\t\t\t_meta?: {\n\t\t\t\t/**\n\t\t\t\t * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\n\t\t\t\t */\n\t\t\t\tprogressToken?: ProgressToken;\n\t\t\t\t[key: string]: unknown;\n\t\t\t};\n\t\t\t[key: string]: unknown;\n\t\t};\n\t}\n\n\texport interface Notification {\n\t\tmethod: string;\n\t\tparams?: {\n\t\t\t/**\n\t\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t\t */\n\t\t\t_meta?: { [key: string]: unknown };\n\t\t\t[key: string]: unknown;\n\t\t};\n\t}\n\n\texport interface Result {\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t\t[key: string]: unknown;\n\t}\n\n\t/**\n\t * A uniquely identifying ID for a request in JSON-RPC.\n\t */\n\texport type RequestId = string | number;\n\n\t/**\n\t * A request that expects a response.\n\t */\n\texport interface JSONRPCRequest extends Request {\n\t\tjsonrpc: typeof JSONRPC_VERSION;\n\t\tid: RequestId;\n\t}\n\n\t/**\n\t * A notification which does not expect a response.\n\t */\n\texport interface JSONRPCNotification extends Notification {\n\t\tjsonrpc: typeof JSONRPC_VERSION;\n\t}\n\n\t/**\n\t * A successful (non-error) response to a request.\n\t */\n\texport interface JSONRPCResponse {\n\t\tjsonrpc: typeof JSONRPC_VERSION;\n\t\tid: RequestId;\n\t\tresult: Result;\n\t}\n\n\t// Standard JSON-RPC error codes\n\texport const PARSE_ERROR = -32700;\n\texport const INVALID_REQUEST = -32600;\n\texport const METHOD_NOT_FOUND = -32601;\n\texport const INVALID_PARAMS = -32602;\n\texport const INTERNAL_ERROR = -32603;\n\n\t/**\n\t * A response to a request that indicates an error occurred.\n\t */\n\texport interface JSONRPCError {\n\t\tjsonrpc: typeof JSONRPC_VERSION;\n\t\tid: RequestId;\n\t\terror: {\n\t\t\t/**\n\t\t\t * The error type that occurred.\n\t\t\t */\n\t\t\tcode: number;\n\t\t\t/**\n\t\t\t * A short description of the error. The message SHOULD be limited to a concise single sentence.\n\t\t\t */\n\t\t\tmessage: string;\n\t\t\t/**\n\t\t\t * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).\n\t\t\t */\n\t\t\tdata?: unknown;\n\t\t};\n\t}\n\n\t/* Empty result */\n\t/**\n\t * A response that indicates success but carries no data.\n\t */\n\texport type EmptyResult = Result;\n\n\t/* Cancellation */\n\t/**\n\t * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n\t *\n\t * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n\t *\n\t * This notification indicates that the result will be unused, so any associated processing SHOULD cease.\n\t *\n\t * A client MUST NOT attempt to cancel its `initialize` request.\n\t */\n\texport interface CancelledNotification extends Notification {\n\t\tmethod: \"notifications/cancelled\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The ID of the request to cancel.\n\t\t\t *\n\t\t\t * This MUST correspond to the ID of a request previously issued in the same direction.\n\t\t\t */\n\t\t\trequestId: RequestId;\n\n\t\t\t/**\n\t\t\t * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.\n\t\t\t */\n\t\t\treason?: string;\n\t\t};\n\t}\n\n\t/* Initialization */\n\t/**\n\t * This request is sent from the client to the server when it first connects, asking it to begin initialization.\n\t */\n\texport interface InitializeRequest extends Request {\n\t\tmethod: \"initialize\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.\n\t\t\t */\n\t\t\tprotocolVersion: string;\n\t\t\tcapabilities: ClientCapabilities;\n\t\t\tclientInfo: Implementation;\n\t\t};\n\t}\n\n\t/**\n\t * After receiving an initialize request from the client, the server sends this response.\n\t */\n\texport interface InitializeResult extends Result {\n\t\t/**\n\t\t * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.\n\t\t */\n\t\tprotocolVersion: string;\n\t\tcapabilities: ServerCapabilities;\n\t\tserverInfo: Implementation;\n\n\t\t/**\n\t\t * Instructions describing how to use the server and its features.\n\t\t *\n\t\t * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \"hint\" to the model. For example, this information MAY be added to the system prompt.\n\t\t */\n\t\tinstructions?: string;\n\t}\n\n\t/**\n\t * This notification is sent from the client to the server after initialization has finished.\n\t */\n\texport interface InitializedNotification extends Notification {\n\t\tmethod: \"notifications/initialized\";\n\t}\n\n\t/**\n\t * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.\n\t */\n\texport interface ClientCapabilities {\n\t\t/**\n\t\t * Experimental, non-standard capabilities that the client supports.\n\t\t */\n\t\texperimental?: { [key: string]: object };\n\t\t/**\n\t\t * Present if the client supports listing roots.\n\t\t */\n\t\troots?: {\n\t\t\t/**\n\t\t\t * Whether the client supports notifications for changes to the roots list.\n\t\t\t */\n\t\t\tlistChanged?: boolean;\n\t\t};\n\t\t/**\n\t\t * Present if the client supports sampling from an LLM.\n\t\t */\n\t\tsampling?: object;\n\t\t/**\n\t\t * Present if the client supports elicitation from the server.\n\t\t */\n\t\telicitation?: object;\n\t}\n\n\t/**\n\t * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.\n\t */\n\texport interface ServerCapabilities {\n\t\t/**\n\t\t * Experimental, non-standard capabilities that the server supports.\n\t\t */\n\t\texperimental?: { [key: string]: object };\n\t\t/**\n\t\t * Present if the server supports sending log messages to the client.\n\t\t */\n\t\tlogging?: object;\n\t\t/**\n\t\t * Present if the server supports argument autocompletion suggestions.\n\t\t */\n\t\tcompletions?: object;\n\t\t/**\n\t\t * Present if the server offers any prompt templates.\n\t\t */\n\t\tprompts?: {\n\t\t\t/**\n\t\t\t * Whether this server supports notifications for changes to the prompt list.\n\t\t\t */\n\t\t\tlistChanged?: boolean;\n\t\t};\n\t\t/**\n\t\t * Present if the server offers any resources to read.\n\t\t */\n\t\tresources?: {\n\t\t\t/**\n\t\t\t * Whether this server supports subscribing to resource updates.\n\t\t\t */\n\t\t\tsubscribe?: boolean;\n\t\t\t/**\n\t\t\t * Whether this server supports notifications for changes to the resource list.\n\t\t\t */\n\t\t\tlistChanged?: boolean;\n\t\t};\n\t\t/**\n\t\t * Present if the server offers any tools to call.\n\t\t */\n\t\ttools?: {\n\t\t\t/**\n\t\t\t * Whether this server supports notifications for changes to the tool list.\n\t\t\t */\n\t\t\tlistChanged?: boolean;\n\t\t};\n\t}\n\n\t/**\n\t * Base interface for metadata with name (identifier) and title (display name) properties.\n\t */\n\texport interface BaseMetadata {\n\t\t/**\n\t\t * Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).\n\t\t */\n\t\tname: string;\n\n\t\t/**\n\t\t * Intended for UI and end-user contexts - optimized to be human-readable and easily understood,\n\t\t * even by those unfamiliar with domain-specific terminology.\n\t\t *\n\t\t * If not provided, the name should be used for display (except for Tool,\n\t\t * where `annotations.title` should be given precedence over using `name`,\n\t\t * if present).\n\t\t */\n\t\ttitle?: string;\n\t}\n\n\t/**\n\t * Describes the name and version of an MCP implementation, with an optional title for UI representation.\n\t */\n\texport interface Implementation extends BaseMetadata {\n\t\tversion: string;\n\t}\n\n\t/* Ping */\n\t/**\n\t * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.\n\t */\n\texport interface PingRequest extends Request {\n\t\tmethod: \"ping\";\n\t}\n\n\t/* Progress notifications */\n\t/**\n\t * An out-of-band notification used to inform the receiver of a progress update for a long-running request.\n\t */\n\texport interface ProgressNotification extends Notification {\n\t\tmethod: \"notifications/progress\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.\n\t\t\t */\n\t\t\tprogressToken: ProgressToken;\n\t\t\t/**\n\t\t\t * The progress thus far. This should increase every time progress is made, even if the total is unknown.\n\t\t\t *\n\t\t\t * @TJS-type number\n\t\t\t */\n\t\t\tprogress: number;\n\t\t\t/**\n\t\t\t * Total number of items to process (or total progress required), if known.\n\t\t\t *\n\t\t\t * @TJS-type number\n\t\t\t */\n\t\t\ttotal?: number;\n\t\t\t/**\n\t\t\t * An optional message describing the current progress.\n\t\t\t */\n\t\t\tmessage?: string;\n\t\t};\n\t}\n\n\t/* Pagination */\n\texport interface PaginatedRequest extends Request {\n\t\tparams?: {\n\t\t\t/**\n\t\t\t * An opaque token representing the current pagination position.\n\t\t\t * If provided, the server should return results starting after this cursor.\n\t\t\t */\n\t\t\tcursor?: Cursor;\n\t\t};\n\t}\n\n\texport interface PaginatedResult extends Result {\n\t\t/**\n\t\t * An opaque token representing the pagination position after the last returned result.\n\t\t * If present, there may be more results available.\n\t\t */\n\t\tnextCursor?: Cursor;\n\t}\n\n\t/* Resources */\n\t/**\n\t * Sent from the client to request a list of resources the server has.\n\t */\n\texport interface ListResourcesRequest extends PaginatedRequest {\n\t\tmethod: \"resources/list\";\n\t}\n\n\t/**\n\t * The server's response to a resources/list request from the client.\n\t */\n\texport interface ListResourcesResult extends PaginatedResult {\n\t\tresources: Resource[];\n\t}\n\n\t/**\n\t * Sent from the client to request a list of resource templates the server has.\n\t */\n\texport interface ListResourceTemplatesRequest extends PaginatedRequest {\n\t\tmethod: \"resources/templates/list\";\n\t}\n\n\t/**\n\t * The server's response to a resources/templates/list request from the client.\n\t */\n\texport interface ListResourceTemplatesResult extends PaginatedResult {\n\t\tresourceTemplates: ResourceTemplate[];\n\t}\n\n\t/**\n\t * Sent from the client to the server, to read a specific resource URI.\n\t */\n\texport interface ReadResourceRequest extends Request {\n\t\tmethod: \"resources/read\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.\n\t\t\t *\n\t\t\t * @format uri\n\t\t\t */\n\t\t\turi: string;\n\t\t};\n\t}\n\n\t/**\n\t * The server's response to a resources/read request from the client.\n\t */\n\texport interface ReadResourceResult extends Result {\n\t\tcontents: (TextResourceContents | BlobResourceContents)[];\n\t}\n\n\t/**\n\t * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.\n\t */\n\texport interface ResourceListChangedNotification extends Notification {\n\t\tmethod: \"notifications/resources/list_changed\";\n\t}\n\n\t/**\n\t * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.\n\t */\n\texport interface SubscribeRequest extends Request {\n\t\tmethod: \"resources/subscribe\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.\n\t\t\t *\n\t\t\t * @format uri\n\t\t\t */\n\t\t\turi: string;\n\t\t};\n\t}\n\n\t/**\n\t * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.\n\t */\n\texport interface UnsubscribeRequest extends Request {\n\t\tmethod: \"resources/unsubscribe\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The URI of the resource to unsubscribe from.\n\t\t\t *\n\t\t\t * @format uri\n\t\t\t */\n\t\t\turi: string;\n\t\t};\n\t}\n\n\t/**\n\t * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.\n\t */\n\texport interface ResourceUpdatedNotification extends Notification {\n\t\tmethod: \"notifications/resources/updated\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.\n\t\t\t *\n\t\t\t * @format uri\n\t\t\t */\n\t\t\turi: string;\n\t\t};\n\t}\n\n\t/**\n\t * A known resource that the server is capable of reading.\n\t */\n\texport interface Resource extends BaseMetadata {\n\t\t/**\n\t\t * The URI of this resource.\n\t\t *\n\t\t * @format uri\n\t\t */\n\t\turi: string;\n\n\t\t/**\n\t\t * A description of what this resource represents.\n\t\t *\n\t\t * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.\n\t\t */\n\t\tdescription?: string;\n\n\t\t/**\n\t\t * The MIME type of this resource, if known.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\t\t *\n\t\t * This can be used by Hosts to display file sizes and estimate context window usage.\n\t\t */\n\t\tsize?: number;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * A template description for resources available on the server.\n\t */\n\texport interface ResourceTemplate extends BaseMetadata {\n\t\t/**\n\t\t * A URI template (according to RFC 6570) that can be used to construct resource URIs.\n\t\t *\n\t\t * @format uri-template\n\t\t */\n\t\turiTemplate: string;\n\n\t\t/**\n\t\t * A description of what this template is for.\n\t\t *\n\t\t * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.\n\t\t */\n\t\tdescription?: string;\n\n\t\t/**\n\t\t * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * The contents of a specific resource or sub-resource.\n\t */\n\texport interface ResourceContents {\n\t\t/**\n\t\t * The URI of this resource.\n\t\t *\n\t\t * @format uri\n\t\t */\n\t\turi: string;\n\t\t/**\n\t\t * The MIME type of this resource, if known.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\texport interface TextResourceContents extends ResourceContents {\n\t\t/**\n\t\t * The text of the item. This must only be set if the item can actually be represented as text (not binary data).\n\t\t */\n\t\ttext: string;\n\t}\n\n\texport interface BlobResourceContents extends ResourceContents {\n\t\t/**\n\t\t * A base64-encoded string representing the binary data of the item.\n\t\t *\n\t\t * @format byte\n\t\t */\n\t\tblob: string;\n\t}\n\n\t/* Prompts */\n\t/**\n\t * Sent from the client to request a list of prompts and prompt templates the server has.\n\t */\n\texport interface ListPromptsRequest extends PaginatedRequest {\n\t\tmethod: \"prompts/list\";\n\t}\n\n\t/**\n\t * The server's response to a prompts/list request from the client.\n\t */\n\texport interface ListPromptsResult extends PaginatedResult {\n\t\tprompts: Prompt[];\n\t}\n\n\t/**\n\t * Used by the client to get a prompt provided by the server.\n\t */\n\texport interface GetPromptRequest extends Request {\n\t\tmethod: \"prompts/get\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The name of the prompt or prompt template.\n\t\t\t */\n\t\t\tname: string;\n\t\t\t/**\n\t\t\t * Arguments to use for templating the prompt.\n\t\t\t */\n\t\t\targuments?: { [key: string]: string };\n\t\t};\n\t}\n\n\t/**\n\t * The server's response to a prompts/get request from the client.\n\t */\n\texport interface GetPromptResult extends Result {\n\t\t/**\n\t\t * An optional description for the prompt.\n\t\t */\n\t\tdescription?: string;\n\t\tmessages: PromptMessage[];\n\t}\n\n\t/**\n\t * A prompt or prompt template that the server offers.\n\t */\n\texport interface Prompt extends BaseMetadata {\n\t\t/**\n\t\t * An optional description of what this prompt provides\n\t\t */\n\t\tdescription?: string;\n\t\t/**\n\t\t * A list of arguments to use for templating the prompt.\n\t\t */\n\t\targuments?: PromptArgument[];\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * Describes an argument that a prompt can accept.\n\t */\n\texport interface PromptArgument extends BaseMetadata {\n\t\t/**\n\t\t * A human-readable description of the argument.\n\t\t */\n\t\tdescription?: string;\n\t\t/**\n\t\t * Whether this argument must be provided.\n\t\t */\n\t\trequired?: boolean;\n\t}\n\n\t/**\n\t * The sender or recipient of messages and data in a conversation.\n\t */\n\texport type Role = \"user\" | \"assistant\";\n\n\t/**\n\t * Describes a message returned as part of a prompt.\n\t *\n\t * This is similar to `SamplingMessage`, but also supports the embedding of\n\t * resources from the MCP server.\n\t */\n\texport interface PromptMessage {\n\t\trole: Role;\n\t\tcontent: ContentBlock;\n\t}\n\n\t/**\n\t * A resource that the server is capable of reading, included in a prompt or tool call result.\n\t *\n\t * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.\n\t */\n\texport interface ResourceLink extends Resource {\n\t\ttype: \"resource_link\";\n\t}\n\n\t/**\n\t * The contents of a resource, embedded into a prompt or tool call result.\n\t *\n\t * It is up to the client how best to render embedded resources for the benefit\n\t * of the LLM and/or the user.\n\t */\n\texport interface EmbeddedResource {\n\t\ttype: \"resource\";\n\t\tresource: TextResourceContents | BlobResourceContents;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\t/**\n\t * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.\n\t */\n\texport interface PromptListChangedNotification extends Notification {\n\t\tmethod: \"notifications/prompts/list_changed\";\n\t}\n\n\t/* Tools */\n\t/**\n\t * Sent from the client to request a list of tools the server has.\n\t */\n\texport interface ListToolsRequest extends PaginatedRequest {\n\t\tmethod: \"tools/list\";\n\t}\n\n\t/**\n\t * The server's response to a tools/list request from the client.\n\t */\n\texport interface ListToolsResult extends PaginatedResult {\n\t\ttools: Tool[];\n\t}\n\n\t/**\n\t * The server's response to a tool call.\n\t */\n\texport interface CallToolResult extends Result {\n\t\t/**\n\t\t * A list of content objects that represent the unstructured result of the tool call.\n\t\t */\n\t\tcontent: ContentBlock[];\n\n\t\t/**\n\t\t * An optional JSON object that represents the structured result of the tool call.\n\t\t */\n\t\tstructuredContent?: { [key: string]: unknown };\n\n\t\t/**\n\t\t * Whether the tool call ended in an error.\n\t\t *\n\t\t * If not set, this is assumed to be false (the call was successful).\n\t\t *\n\t\t * Any errors that originate from the tool SHOULD be reported inside the result\n\t\t * object, with `isError` set to true, _not_ as an MCP protocol-level error\n\t\t * response. Otherwise, the LLM would not be able to see that an error occurred\n\t\t * and self-correct.\n\t\t *\n\t\t * However, any errors in _finding_ the tool, an error indicating that the\n\t\t * server does not support tool calls, or any other exceptional conditions,\n\t\t * should be reported as an MCP error response.\n\t\t */\n\t\tisError?: boolean;\n\t}\n\n\t/**\n\t * Used by the client to invoke a tool provided by the server.\n\t */\n\texport interface CallToolRequest extends Request {\n\t\tmethod: \"tools/call\";\n\t\tparams: {\n\t\t\tname: string;\n\t\t\targuments?: { [key: string]: unknown };\n\t\t};\n\t}\n\n\t/**\n\t * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.\n\t */\n\texport interface ToolListChangedNotification extends Notification {\n\t\tmethod: \"notifications/tools/list_changed\";\n\t}\n\n\t/**\n\t * Additional properties describing a Tool to clients.\n\t *\n\t * NOTE: all properties in ToolAnnotations are **hints**.\n\t * They are not guaranteed to provide a faithful description of\n\t * tool behavior (including descriptive properties like `title`).\n\t *\n\t * Clients should never make tool use decisions based on ToolAnnotations\n\t * received from untrusted servers.\n\t */\n\texport interface ToolAnnotations {\n\t\t/**\n\t\t * A human-readable title for the tool.\n\t\t */\n\t\ttitle?: string;\n\n\t\t/**\n\t\t * If true, the tool does not modify its environment.\n\t\t *\n\t\t * Default: false\n\t\t */\n\t\treadOnlyHint?: boolean;\n\n\t\t/**\n\t\t * If true, the tool may perform destructive updates to its environment.\n\t\t * If false, the tool performs only additive updates.\n\t\t *\n\t\t * (This property is meaningful only when `readOnlyHint == false`)\n\t\t *\n\t\t * Default: true\n\t\t */\n\t\tdestructiveHint?: boolean;\n\n\t\t/**\n\t\t * If true, calling the tool repeatedly with the same arguments\n\t\t * will have no additional effect on the its environment.\n\t\t *\n\t\t * (This property is meaningful only when `readOnlyHint == false`)\n\t\t *\n\t\t * Default: false\n\t\t */\n\t\tidempotentHint?: boolean;\n\n\t\t/**\n\t\t * If true, this tool may interact with an \"open world\" of external\n\t\t * entities. If false, the tool's domain of interaction is closed.\n\t\t * For example, the world of a web search tool is open, whereas that\n\t\t * of a memory tool is not.\n\t\t *\n\t\t * Default: true\n\t\t */\n\t\topenWorldHint?: boolean;\n\t}\n\n\t/**\n\t * Definition for a tool the client can call.\n\t */\n\texport interface Tool extends BaseMetadata {\n\t\t/**\n\t\t * A human-readable description of the tool.\n\t\t *\n\t\t * This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a \"hint\" to the model.\n\t\t */\n\t\tdescription?: string;\n\n\t\t/**\n\t\t * A JSON Schema object defining the expected parameters for the tool.\n\t\t */\n\t\tinputSchema: {\n\t\t\ttype: \"object\";\n\t\t\tproperties?: { [key: string]: object };\n\t\t\trequired?: string[];\n\t\t};\n\n\t\t/**\n\t\t * An optional JSON Schema object defining the structure of the tool's output returned in\n\t\t * the structuredContent field of a CallToolResult.\n\t\t */\n\t\toutputSchema?: {\n\t\t\ttype: \"object\";\n\t\t\tproperties?: { [key: string]: object };\n\t\t\trequired?: string[];\n\t\t};\n\n\t\t/**\n\t\t * Optional additional tool information.\n\t\t *\n\t\t * Display name precedence order is: title, annotations.title, then name.\n\t\t */\n\t\tannotations?: ToolAnnotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/* Logging */\n\t/**\n\t * A request from the client to the server, to enable or adjust logging.\n\t */\n\texport interface SetLevelRequest extends Request {\n\t\tmethod: \"logging/setLevel\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.\n\t\t\t */\n\t\t\tlevel: LoggingLevel;\n\t\t};\n\t}\n\n\t/**\n\t * Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.\n\t */\n\texport interface LoggingMessageNotification extends Notification {\n\t\tmethod: \"notifications/message\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The severity of this log message.\n\t\t\t */\n\t\t\tlevel: LoggingLevel;\n\t\t\t/**\n\t\t\t * An optional name of the logger issuing this message.\n\t\t\t */\n\t\t\tlogger?: string;\n\t\t\t/**\n\t\t\t * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.\n\t\t\t */\n\t\t\tdata: unknown;\n\t\t};\n\t}\n\n\t/**\n\t * The severity of a log message.\n\t *\n\t * These map to syslog message severities, as specified in RFC-5424:\n\t * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1\n\t */\n\texport type LoggingLevel =\n\t\t| \"debug\"\n\t\t| \"info\"\n\t\t| \"notice\"\n\t\t| \"warning\"\n\t\t| \"error\"\n\t\t| \"critical\"\n\t\t| \"alert\"\n\t\t| \"emergency\";\n\n\t/* Sampling */\n\t/**\n\t * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.\n\t */\n\texport interface CreateMessageRequest extends Request {\n\t\tmethod: \"sampling/createMessage\";\n\t\tparams: {\n\t\t\tmessages: SamplingMessage[];\n\t\t\t/**\n\t\t\t * The server's preferences for which model to select. The client MAY ignore these preferences.\n\t\t\t */\n\t\t\tmodelPreferences?: ModelPreferences;\n\t\t\t/**\n\t\t\t * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.\n\t\t\t */\n\t\t\tsystemPrompt?: string;\n\t\t\t/**\n\t\t\t * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.\n\t\t\t */\n\t\t\tincludeContext?: \"none\" | \"thisServer\" | \"allServers\";\n\t\t\t/**\n\t\t\t * @TJS-type number\n\t\t\t */\n\t\t\ttemperature?: number;\n\t\t\t/**\n\t\t\t * The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.\n\t\t\t */\n\t\t\tmaxTokens: number;\n\t\t\tstopSequences?: string[];\n\t\t\t/**\n\t\t\t * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.\n\t\t\t */\n\t\t\tmetadata?: object;\n\t\t};\n\t}\n\n\t/**\n\t * The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.\n\t */\n\texport interface CreateMessageResult extends Result, SamplingMessage {\n\t\t/**\n\t\t * The name of the model that generated the message.\n\t\t */\n\t\tmodel: string;\n\t\t/**\n\t\t * The reason why sampling stopped, if known.\n\t\t */\n\t\tstopReason?: \"endTurn\" | \"stopSequence\" | \"maxTokens\" | string;\n\t}\n\n\t/**\n\t * Describes a message issued to or received from an LLM API.\n\t */\n\texport interface SamplingMessage {\n\t\trole: Role;\n\t\tcontent: TextContent | ImageContent | AudioContent;\n\t}\n\n\t/**\n\t * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed\n\t */\n\texport interface Annotations {\n\t\t/**\n\t\t * Describes who the intended customer of this object or data is.\n\t\t *\n\t\t * It can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`).\n\t\t */\n\t\taudience?: Role[];\n\n\t\t/**\n\t\t * Describes how important this data is for operating the server.\n\t\t *\n\t\t * A value of 1 means \"most important,\" and indicates that the data is\n\t\t * effectively required, while 0 means \"least important,\" and indicates that\n\t\t * the data is entirely optional.\n\t\t *\n\t\t * @TJS-type number\n\t\t * @minimum 0\n\t\t * @maximum 1\n\t\t */\n\t\tpriority?: number;\n\n\t\t/**\n\t\t * The moment the resource was last modified, as an ISO 8601 formatted string.\n\t\t *\n\t\t * Should be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").\n\t\t *\n\t\t * Examples: last activity timestamp in an open file, timestamp when the resource\n\t\t * was attached, etc.\n\t\t */\n\t\tlastModified?: string;\n\t}\n\n\t/**  */\n\texport type ContentBlock =\n\t\t| TextContent\n\t\t| ImageContent\n\t\t| AudioContent\n\t\t| ResourceLink\n\t\t| EmbeddedResource;\n\n\t/**\n\t * Text provided to or from an LLM.\n\t */\n\texport interface TextContent {\n\t\ttype: \"text\";\n\n\t\t/**\n\t\t * The text content of the message.\n\t\t */\n\t\ttext: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * An image provided to or from an LLM.\n\t */\n\texport interface ImageContent {\n\t\ttype: \"image\";\n\n\t\t/**\n\t\t * The base64-encoded image data.\n\t\t *\n\t\t * @format byte\n\t\t */\n\t\tdata: string;\n\n\t\t/**\n\t\t * The MIME type of the image. Different providers may support different image types.\n\t\t */\n\t\tmimeType: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * Audio provided to or from an LLM.\n\t */\n\texport interface AudioContent {\n\t\ttype: \"audio\";\n\n\t\t/**\n\t\t * The base64-encoded audio data.\n\t\t *\n\t\t * @format byte\n\t\t */\n\t\tdata: string;\n\n\t\t/**\n\t\t * The MIME type of the audio. Different providers may support different audio types.\n\t\t */\n\t\tmimeType: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * The server's preferences for model selection, requested of the client during sampling.\n\t *\n\t * Because LLMs can vary along multiple dimensions, choosing the \"best\" model is\n\t * rarely straightforward.  Different models excel in different areas-some are\n\t * faster but less capable, others are more capable but more expensive, and so\n\t * on. This interface allows servers to express their priorities across multiple\n\t * dimensions to help clients make an appropriate selection for their use case.\n\t *\n\t * These preferences are always advisory. The client MAY ignore them. It is also\n\t * up to the client to decide how to interpret these preferences and how to\n\t * balance them against other considerations.\n\t */\n\texport interface ModelPreferences {\n\t\t/**\n\t\t * Optional hints to use for model selection.\n\t\t *\n\t\t * If multiple hints are specified, the client MUST evaluate them in order\n\t\t * (such that the first match is taken).\n\t\t *\n\t\t * The client SHOULD prioritize these hints over the numeric priorities, but\n\t\t * MAY still use the priorities to select from ambiguous matches.\n\t\t */\n\t\thints?: ModelHint[];\n\n\t\t/**\n\t\t * How much to prioritize cost when selecting a model. A value of 0 means cost\n\t\t * is not important, while a value of 1 means cost is the most important\n\t\t * factor.\n\t\t *\n\t\t * @TJS-type number\n\t\t * @minimum 0\n\t\t * @maximum 1\n\t\t */\n\t\tcostPriority?: number;\n\n\t\t/**\n\t\t * How much to prioritize sampling speed (latency) when selecting a model. A\n\t\t * value of 0 means speed is not important, while a value of 1 means speed is\n\t\t * the most important factor.\n\t\t *\n\t\t * @TJS-type number\n\t\t * @minimum 0\n\t\t * @maximum 1\n\t\t */\n\t\tspeedPriority?: number;\n\n\t\t/**\n\t\t * How much to prioritize intelligence and capabilities when selecting a\n\t\t * model. A value of 0 means intelligence is not important, while a value of 1\n\t\t * means intelligence is the most important factor.\n\t\t *\n\t\t * @TJS-type number\n\t\t * @minimum 0\n\t\t * @maximum 1\n\t\t */\n\t\tintelligencePriority?: number;\n\t}\n\n\t/**\n\t * Hints to use for model selection.\n\t *\n\t * Keys not declared here are currently left unspecified by the spec and are up\n\t * to the client to interpret.\n\t */\n\texport interface ModelHint {\n\t\t/**\n\t\t * A hint for a model name.\n\t\t *\n\t\t * The client SHOULD treat this as a substring of a model name; for example:\n\t\t *  - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\n\t\t *  - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\n\t\t *  - `claude` should match any Claude model\n\t\t *\n\t\t * The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n\t\t *  - `gemini-1.5-flash` could match `claude-3-haiku-20240307`\n\t\t */\n\t\tname?: string;\n\t}\n\n\t/* Autocomplete */\n\t/**\n\t * A request from the client to the server, to ask for completion options.\n\t */\n\texport interface CompleteRequest extends Request {\n\t\tmethod: \"completion/complete\";\n\t\tparams: {\n\t\t\tref: PromptReference | ResourceTemplateReference;\n\t\t\t/**\n\t\t\t * The argument's information\n\t\t\t */\n\t\t\targument: {\n\t\t\t\t/**\n\t\t\t\t * The name of the argument\n\t\t\t\t */\n\t\t\t\tname: string;\n\t\t\t\t/**\n\t\t\t\t * The value of the argument to use for completion matching.\n\t\t\t\t */\n\t\t\t\tvalue: string;\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Additional, optional context for completions\n\t\t\t */\n\t\t\tcontext?: {\n\t\t\t\t/**\n\t\t\t\t * Previously-resolved variables in a URI template or prompt.\n\t\t\t\t */\n\t\t\t\targuments?: { [key: string]: string };\n\t\t\t};\n\t\t};\n\t}\n\n\t/**\n\t * The server's response to a completion/complete request\n\t */\n\texport interface CompleteResult extends Result {\n\t\tcompletion: {\n\t\t\t/**\n\t\t\t * An array of completion values. Must not exceed 100 items.\n\t\t\t */\n\t\t\tvalues: string[];\n\t\t\t/**\n\t\t\t * The total number of completion options available. This can exceed the number of values actually sent in the response.\n\t\t\t */\n\t\t\ttotal?: number;\n\t\t\t/**\n\t\t\t * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.\n\t\t\t */\n\t\t\thasMore?: boolean;\n\t\t};\n\t}\n\n\t/**\n\t * A reference to a resource or resource template definition.\n\t */\n\texport interface ResourceTemplateReference {\n\t\ttype: \"ref/resource\";\n\t\t/**\n\t\t * The URI or URI template of the resource.\n\t\t *\n\t\t * @format uri-template\n\t\t */\n\t\turi: string;\n\t}\n\n\t/**\n\t * Identifies a prompt.\n\t */\n\texport interface PromptReference extends BaseMetadata {\n\t\ttype: \"ref/prompt\";\n\t}\n\n\t/* Roots */\n\t/**\n\t * Sent from the server to request a list of root URIs from the client. Roots allow\n\t * servers to ask for specific directories or files to operate on. A common example\n\t * for roots is providing a set of repositories or directories a server should operate\n\t * on.\n\t *\n\t * This request is typically used when the server needs to understand the file system\n\t * structure or access specific locations that the client has permission to read from.\n\t */\n\texport interface ListRootsRequest extends Request {\n\t\tmethod: \"roots/list\";\n\t}\n\n\t/**\n\t * The client's response to a roots/list request from the server.\n\t * This result contains an array of Root objects, each representing a root directory\n\t * or file that the server can operate on.\n\t */\n\texport interface ListRootsResult extends Result {\n\t\troots: Root[];\n\t}\n\n\t/**\n\t * Represents a root directory or file that the server can operate on.\n\t */\n\texport interface Root {\n\t\t/**\n\t\t * The URI identifying the root. This *must* start with file:// for now.\n\t\t * This restriction may be relaxed in future versions of the protocol to allow\n\t\t * other URI schemes.\n\t\t *\n\t\t * @format uri\n\t\t */\n\t\turi: string;\n\t\t/**\n\t\t * An optional name for the root. This can be used to provide a human-readable\n\t\t * identifier for the root, which may be useful for display purposes or for\n\t\t * referencing the root in other parts of the application.\n\t\t */\n\t\tname?: string;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * A notification from the client to the server, informing it that the list of roots has changed.\n\t * This notification should be sent whenever the client adds, removes, or modifies any root.\n\t * The server should then request an updated list of roots using the ListRootsRequest.\n\t */\n\texport interface RootsListChangedNotification extends Notification {\n\t\tmethod: \"notifications/roots/list_changed\";\n\t}\n\n\t/**\n\t * A request from the server to elicit additional information from the user via the client.\n\t */\n\texport interface ElicitRequest extends Request {\n\t\tmethod: \"elicitation/create\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The message to present to the user.\n\t\t\t */\n\t\t\tmessage: string;\n\t\t\t/**\n\t\t\t * A restricted subset of JSON Schema.\n\t\t\t * Only top-level properties are allowed, without nesting.\n\t\t\t */\n\t\t\trequestedSchema: {\n\t\t\t\ttype: \"object\";\n\t\t\t\tproperties: {\n\t\t\t\t\t[key: string]: PrimitiveSchemaDefinition;\n\t\t\t\t};\n\t\t\t\trequired?: string[];\n\t\t\t};\n\t\t};\n\t}\n\n\t/**\n\t * Restricted schema definitions that only allow primitive types\n\t * without nested objects or arrays.\n\t */\n\texport type PrimitiveSchemaDefinition =\n\t\t| StringSchema\n\t\t| NumberSchema\n\t\t| BooleanSchema\n\t\t| EnumSchema;\n\n\texport interface StringSchema {\n\t\ttype: \"string\";\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tminLength?: number;\n\t\tmaxLength?: number;\n\t\tformat?: \"email\" | \"uri\" | \"date\" | \"date-time\";\n\t}\n\n\texport interface NumberSchema {\n\t\ttype: \"number\" | \"integer\";\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tminimum?: number;\n\t\tmaximum?: number;\n\t}\n\n\texport interface BooleanSchema {\n\t\ttype: \"boolean\";\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tdefault?: boolean;\n\t}\n\n\texport interface EnumSchema {\n\t\ttype: \"string\";\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tenum: string[];\n\t\tenumNames?: string[]; // Display names for enum values\n\t}\n\n\t/**\n\t * The client's response to an elicitation request.\n\t */\n\texport interface ElicitResult extends Result {\n\t\t/**\n\t\t * The user action in response to the elicitation.\n\t\t * - \"accept\": User submitted the form/confirmed the action\n\t\t * - \"decline\": User explicitly declined the action\n\t\t * - \"cancel\": User dismissed without making an explicit choice\n\t\t */\n\t\taction: \"accept\" | \"decline\" | \"cancel\";\n\n\t\t/**\n\t\t * The submitted form data, only present when action is \"accept\".\n\t\t * Contains values matching the requested schema.\n\t\t */\n\t\tcontent?: { [key: string]: string | number | boolean };\n\t}\n\n\t/* Client messages */\n\texport type ClientRequest =\n\t\t| PingRequest\n\t\t| InitializeRequest\n\t\t| CompleteRequest\n\t\t| SetLevelRequest\n\t\t| GetPromptRequest\n\t\t| ListPromptsRequest\n\t\t| ListResourcesRequest\n\t\t| ListResourceTemplatesRequest\n\t\t| ReadResourceRequest\n\t\t| SubscribeRequest\n\t\t| UnsubscribeRequest\n\t\t| CallToolRequest\n\t\t| ListToolsRequest;\n\n\texport type ClientNotification =\n\t\t| CancelledNotification\n\t\t| ProgressNotification\n\t\t| InitializedNotification\n\t\t| RootsListChangedNotification;\n\n\texport type ClientResult =\n\t\t| EmptyResult\n\t\t| CreateMessageResult\n\t\t| ListRootsResult\n\t\t| ElicitResult;\n\n\t/* Server messages */\n\texport type ServerRequest =\n\t\t| PingRequest\n\t\t| CreateMessageRequest\n\t\t| ListRootsRequest\n\t\t| ElicitRequest;\n\n\texport type ServerNotification =\n\t\t| CancelledNotification\n\t\t| ProgressNotification\n\t\t| LoggingMessageNotification\n\t\t| ResourceUpdatedNotification\n\t\t| ResourceListChangedNotification\n\t\t| ToolListChangedNotification\n\t\t| PromptListChangedNotification;\n\n\texport type ServerResult =\n\t\t| EmptyResult\n\t\t| InitializeResult\n\t\t| CompleteResult\n\t\t| GetPromptResult\n\t\t| ListPromptsResult\n\t\t| ListResourceTemplatesResult\n\t\t| ListResourcesResult\n\t\t| ReadResourceResult\n\t\t| CallToolResult\n\t\t| ListToolsResult;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/* eslint-disable local/code-no-unexternalized-strings */\n\n//#region proposals\n/**\n * MCP protocol proposals.\n * - Proposals here MUST have an MCP PR linked to them\n * - Proposals here are subject to change and SHALL be removed when\n *   the upstream MCP PR is merged or closed.\n */\nexport namespace MCP {\n\n\t// Nothing, yet\n\n}\n\n//#endregion\n\n/**\n * Schema updated from the Model Context Protocol repository at\n * https://github.com/modelcontextprotocol/specification/tree/main/schema\n *\n * ⚠️ Do not edit within `namespace` manually except to update schema versions ⚠️\n */\nexport namespace MCP {\n\t/**\n\t * Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.\n\t */\n\texport type JSONRPCMessage =\n\t\t| JSONRPCRequest\n\t\t| JSONRPCNotification\n\t\t| JSONRPCResponse\n\t\t| JSONRPCError;\n\n\texport const LATEST_PROTOCOL_VERSION = \"2025-06-18\";\n\texport const JSONRPC_VERSION = \"2.0\";\n\n\t/**\n\t * A progress token, used to associate progress notifications with the original request.\n\t */\n\texport type ProgressToken = string | number;\n\n\t/**\n\t * An opaque token used to represent a cursor for pagination.\n\t */\n\texport type Cursor = string;\n\n\texport interface Request {\n\t\tmethod: string;\n\t\tparams?: {\n\t\t\t/**\n\t\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t\t */\n\t\t\t_meta?: {\n\t\t\t\t/**\n\t\t\t\t * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\n\t\t\t\t */\n\t\t\t\tprogressToken?: ProgressToken;\n\t\t\t\t[key: string]: unknown;\n\t\t\t};\n\t\t\t[key: string]: unknown;\n\t\t};\n\t}\n\n\texport interface Notification {\n\t\tmethod: string;\n\t\tparams?: {\n\t\t\t/**\n\t\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t\t */\n\t\t\t_meta?: { [key: string]: unknown };\n\t\t\t[key: string]: unknown;\n\t\t};\n\t}\n\n\texport interface Result {\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t\t[key: string]: unknown;\n\t}\n\n\t/**\n\t * A uniquely identifying ID for a request in JSON-RPC.\n\t */\n\texport type RequestId = string | number;\n\n\t/**\n\t * A request that expects a response.\n\t */\n\texport interface JSONRPCRequest extends Request {\n\t\tjsonrpc: typeof JSONRPC_VERSION;\n\t\tid: RequestId;\n\t}\n\n\t/**\n\t * A notification which does not expect a response.\n\t */\n\texport interface JSONRPCNotification extends Notification {\n\t\tjsonrpc: typeof JSONRPC_VERSION;\n\t}\n\n\t/**\n\t * A successful (non-error) response to a request.\n\t */\n\texport interface JSONRPCResponse {\n\t\tjsonrpc: typeof JSONRPC_VERSION;\n\t\tid: RequestId;\n\t\tresult: Result;\n\t}\n\n\t// Standard JSON-RPC error codes\n\texport const PARSE_ERROR = -32700;\n\texport const INVALID_REQUEST = -32600;\n\texport const METHOD_NOT_FOUND = -32601;\n\texport const INVALID_PARAMS = -32602;\n\texport const INTERNAL_ERROR = -32603;\n\n\t/**\n\t * A response to a request that indicates an error occurred.\n\t */\n\texport interface JSONRPCError {\n\t\tjsonrpc: typeof JSONRPC_VERSION;\n\t\tid: RequestId;\n\t\terror: {\n\t\t\t/**\n\t\t\t * The error type that occurred.\n\t\t\t */\n\t\t\tcode: number;\n\t\t\t/**\n\t\t\t * A short description of the error. The message SHOULD be limited to a concise single sentence.\n\t\t\t */\n\t\t\tmessage: string;\n\t\t\t/**\n\t\t\t * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).\n\t\t\t */\n\t\t\tdata?: unknown;\n\t\t};\n\t}\n\n\t/* Empty result */\n\t/**\n\t * A response that indicates success but carries no data.\n\t */\n\texport type EmptyResult = Result;\n\n\t/* Cancellation */\n\t/**\n\t * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n\t *\n\t * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n\t *\n\t * This notification indicates that the result will be unused, so any associated processing SHOULD cease.\n\t *\n\t * A client MUST NOT attempt to cancel its `initialize` request.\n\t */\n\texport interface CancelledNotification extends Notification {\n\t\tmethod: \"notifications/cancelled\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The ID of the request to cancel.\n\t\t\t *\n\t\t\t * This MUST correspond to the ID of a request previously issued in the same direction.\n\t\t\t */\n\t\t\trequestId: RequestId;\n\n\t\t\t/**\n\t\t\t * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.\n\t\t\t */\n\t\t\treason?: string;\n\t\t};\n\t}\n\n\t/* Initialization */\n\t/**\n\t * This request is sent from the client to the server when it first connects, asking it to begin initialization.\n\t */\n\texport interface InitializeRequest extends Request {\n\t\tmethod: \"initialize\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.\n\t\t\t */\n\t\t\tprotocolVersion: string;\n\t\t\tcapabilities: ClientCapabilities;\n\t\t\tclientInfo: Implementation;\n\t\t};\n\t}\n\n\t/**\n\t * After receiving an initialize request from the client, the server sends this response.\n\t */\n\texport interface InitializeResult extends Result {\n\t\t/**\n\t\t * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.\n\t\t */\n\t\tprotocolVersion: string;\n\t\tcapabilities: ServerCapabilities;\n\t\tserverInfo: Implementation;\n\n\t\t/**\n\t\t * Instructions describing how to use the server and its features.\n\t\t *\n\t\t * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \"hint\" to the model. For example, this information MAY be added to the system prompt.\n\t\t */\n\t\tinstructions?: string;\n\t}\n\n\t/**\n\t * This notification is sent from the client to the server after initialization has finished.\n\t */\n\texport interface InitializedNotification extends Notification {\n\t\tmethod: \"notifications/initialized\";\n\t}\n\n\t/**\n\t * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.\n\t */\n\texport interface ClientCapabilities {\n\t\t/**\n\t\t * Experimental, non-standard capabilities that the client supports.\n\t\t */\n\t\texperimental?: { [key: string]: object };\n\t\t/**\n\t\t * Present if the client supports listing roots.\n\t\t */\n\t\troots?: {\n\t\t\t/**\n\t\t\t * Whether the client supports notifications for changes to the roots list.\n\t\t\t */\n\t\t\tlistChanged?: boolean;\n\t\t};\n\t\t/**\n\t\t * Present if the client supports sampling from an LLM.\n\t\t */\n\t\tsampling?: object;\n\t\t/**\n\t\t * Present if the client supports elicitation from the server.\n\t\t */\n\t\telicitation?: object;\n\t}\n\n\t/**\n\t * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.\n\t */\n\texport interface ServerCapabilities {\n\t\t/**\n\t\t * Experimental, non-standard capabilities that the server supports.\n\t\t */\n\t\texperimental?: { [key: string]: object };\n\t\t/**\n\t\t * Present if the server supports sending log messages to the client.\n\t\t */\n\t\tlogging?: object;\n\t\t/**\n\t\t * Present if the server supports argument autocompletion suggestions.\n\t\t */\n\t\tcompletions?: object;\n\t\t/**\n\t\t * Present if the server offers any prompt templates.\n\t\t */\n\t\tprompts?: {\n\t\t\t/**\n\t\t\t * Whether this server supports notifications for changes to the prompt list.\n\t\t\t */\n\t\t\tlistChanged?: boolean;\n\t\t};\n\t\t/**\n\t\t * Present if the server offers any resources to read.\n\t\t */\n\t\tresources?: {\n\t\t\t/**\n\t\t\t * Whether this server supports subscribing to resource updates.\n\t\t\t */\n\t\t\tsubscribe?: boolean;\n\t\t\t/**\n\t\t\t * Whether this server supports notifications for changes to the resource list.\n\t\t\t */\n\t\t\tlistChanged?: boolean;\n\t\t};\n\t\t/**\n\t\t * Present if the server offers any tools to call.\n\t\t */\n\t\ttools?: {\n\t\t\t/**\n\t\t\t * Whether this server supports notifications for changes to the tool list.\n\t\t\t */\n\t\t\tlistChanged?: boolean;\n\t\t};\n\t}\n\n\t/**\n\t * Base interface for metadata with name (identifier) and title (display name) properties.\n\t */\n\texport interface BaseMetadata {\n\t\t/**\n\t\t * Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).\n\t\t */\n\t\tname: string;\n\n\t\t/**\n\t\t * Intended for UI and end-user contexts - optimized to be human-readable and easily understood,\n\t\t * even by those unfamiliar with domain-specific terminology.\n\t\t *\n\t\t * If not provided, the name should be used for display (except for Tool,\n\t\t * where `annotations.title` should be given precedence over using `name`,\n\t\t * if present).\n\t\t */\n\t\ttitle?: string;\n\t}\n\n\t/**\n\t * Describes the name and version of an MCP implementation, with an optional title for UI representation.\n\t */\n\texport interface Implementation extends BaseMetadata {\n\t\tversion: string;\n\t}\n\n\t/* Ping */\n\t/**\n\t * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.\n\t */\n\texport interface PingRequest extends Request {\n\t\tmethod: \"ping\";\n\t}\n\n\t/* Progress notifications */\n\t/**\n\t * An out-of-band notification used to inform the receiver of a progress update for a long-running request.\n\t */\n\texport interface ProgressNotification extends Notification {\n\t\tmethod: \"notifications/progress\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.\n\t\t\t */\n\t\t\tprogressToken: ProgressToken;\n\t\t\t/**\n\t\t\t * The progress thus far. This should increase every time progress is made, even if the total is unknown.\n\t\t\t *\n\t\t\t * @TJS-type number\n\t\t\t */\n\t\t\tprogress: number;\n\t\t\t/**\n\t\t\t * Total number of items to process (or total progress required), if known.\n\t\t\t *\n\t\t\t * @TJS-type number\n\t\t\t */\n\t\t\ttotal?: number;\n\t\t\t/**\n\t\t\t * An optional message describing the current progress.\n\t\t\t */\n\t\t\tmessage?: string;\n\t\t};\n\t}\n\n\t/* Pagination */\n\texport interface PaginatedRequest extends Request {\n\t\tparams?: {\n\t\t\t/**\n\t\t\t * An opaque token representing the current pagination position.\n\t\t\t * If provided, the server should return results starting after this cursor.\n\t\t\t */\n\t\t\tcursor?: Cursor;\n\t\t};\n\t}\n\n\texport interface PaginatedResult extends Result {\n\t\t/**\n\t\t * An opaque token representing the pagination position after the last returned result.\n\t\t * If present, there may be more results available.\n\t\t */\n\t\tnextCursor?: Cursor;\n\t}\n\n\t/* Resources */\n\t/**\n\t * Sent from the client to request a list of resources the server has.\n\t */\n\texport interface ListResourcesRequest extends PaginatedRequest {\n\t\tmethod: \"resources/list\";\n\t}\n\n\t/**\n\t * The server's response to a resources/list request from the client.\n\t */\n\texport interface ListResourcesResult extends PaginatedResult {\n\t\tresources: Resource[];\n\t}\n\n\t/**\n\t * Sent from the client to request a list of resource templates the server has.\n\t */\n\texport interface ListResourceTemplatesRequest extends PaginatedRequest {\n\t\tmethod: \"resources/templates/list\";\n\t}\n\n\t/**\n\t * The server's response to a resources/templates/list request from the client.\n\t */\n\texport interface ListResourceTemplatesResult extends PaginatedResult {\n\t\tresourceTemplates: ResourceTemplate[];\n\t}\n\n\t/**\n\t * Sent from the client to the server, to read a specific resource URI.\n\t */\n\texport interface ReadResourceRequest extends Request {\n\t\tmethod: \"resources/read\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.\n\t\t\t *\n\t\t\t * @format uri\n\t\t\t */\n\t\t\turi: string;\n\t\t};\n\t}\n\n\t/**\n\t * The server's response to a resources/read request from the client.\n\t */\n\texport interface ReadResourceResult extends Result {\n\t\tcontents: (TextResourceContents | BlobResourceContents)[];\n\t}\n\n\t/**\n\t * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.\n\t */\n\texport interface ResourceListChangedNotification extends Notification {\n\t\tmethod: \"notifications/resources/list_changed\";\n\t}\n\n\t/**\n\t * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.\n\t */\n\texport interface SubscribeRequest extends Request {\n\t\tmethod: \"resources/subscribe\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.\n\t\t\t *\n\t\t\t * @format uri\n\t\t\t */\n\t\t\turi: string;\n\t\t};\n\t}\n\n\t/**\n\t * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.\n\t */\n\texport interface UnsubscribeRequest extends Request {\n\t\tmethod: \"resources/unsubscribe\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The URI of the resource to unsubscribe from.\n\t\t\t *\n\t\t\t * @format uri\n\t\t\t */\n\t\t\turi: string;\n\t\t};\n\t}\n\n\t/**\n\t * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.\n\t */\n\texport interface ResourceUpdatedNotification extends Notification {\n\t\tmethod: \"notifications/resources/updated\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.\n\t\t\t *\n\t\t\t * @format uri\n\t\t\t */\n\t\t\turi: string;\n\t\t};\n\t}\n\n\t/**\n\t * A known resource that the server is capable of reading.\n\t */\n\texport interface Resource extends BaseMetadata {\n\t\t/**\n\t\t * The URI of this resource.\n\t\t *\n\t\t * @format uri\n\t\t */\n\t\turi: string;\n\n\t\t/**\n\t\t * A description of what this resource represents.\n\t\t *\n\t\t * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.\n\t\t */\n\t\tdescription?: string;\n\n\t\t/**\n\t\t * The MIME type of this resource, if known.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\t\t *\n\t\t * This can be used by Hosts to display file sizes and estimate context window usage.\n\t\t */\n\t\tsize?: number;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * A template description for resources available on the server.\n\t */\n\texport interface ResourceTemplate extends BaseMetadata {\n\t\t/**\n\t\t * A URI template (according to RFC 6570) that can be used to construct resource URIs.\n\t\t *\n\t\t * @format uri-template\n\t\t */\n\t\turiTemplate: string;\n\n\t\t/**\n\t\t * A description of what this template is for.\n\t\t *\n\t\t * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.\n\t\t */\n\t\tdescription?: string;\n\n\t\t/**\n\t\t * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * The contents of a specific resource or sub-resource.\n\t */\n\texport interface ResourceContents {\n\t\t/**\n\t\t * The URI of this resource.\n\t\t *\n\t\t * @format uri\n\t\t */\n\t\turi: string;\n\t\t/**\n\t\t * The MIME type of this resource, if known.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\texport interface TextResourceContents extends ResourceContents {\n\t\t/**\n\t\t * The text of the item. This must only be set if the item can actually be represented as text (not binary data).\n\t\t */\n\t\ttext: string;\n\t}\n\n\texport interface BlobResourceContents extends ResourceContents {\n\t\t/**\n\t\t * A base64-encoded string representing the binary data of the item.\n\t\t *\n\t\t * @format byte\n\t\t */\n\t\tblob: string;\n\t}\n\n\t/* Prompts */\n\t/**\n\t * Sent from the client to request a list of prompts and prompt templates the server has.\n\t */\n\texport interface ListPromptsRequest extends PaginatedRequest {\n\t\tmethod: \"prompts/list\";\n\t}\n\n\t/**\n\t * The server's response to a prompts/list request from the client.\n\t */\n\texport interface ListPromptsResult extends PaginatedResult {\n\t\tprompts: Prompt[];\n\t}\n\n\t/**\n\t * Used by the client to get a prompt provided by the server.\n\t */\n\texport interface GetPromptRequest extends Request {\n\t\tmethod: \"prompts/get\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The name of the prompt or prompt template.\n\t\t\t */\n\t\t\tname: string;\n\t\t\t/**\n\t\t\t * Arguments to use for templating the prompt.\n\t\t\t */\n\t\t\targuments?: { [key: string]: string };\n\t\t};\n\t}\n\n\t/**\n\t * The server's response to a prompts/get request from the client.\n\t */\n\texport interface GetPromptResult extends Result {\n\t\t/**\n\t\t * An optional description for the prompt.\n\t\t */\n\t\tdescription?: string;\n\t\tmessages: PromptMessage[];\n\t}\n\n\t/**\n\t * A prompt or prompt template that the server offers.\n\t */\n\texport interface Prompt extends BaseMetadata {\n\t\t/**\n\t\t * An optional description of what this prompt provides\n\t\t */\n\t\tdescription?: string;\n\t\t/**\n\t\t * A list of arguments to use for templating the prompt.\n\t\t */\n\t\targuments?: PromptArgument[];\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * Describes an argument that a prompt can accept.\n\t */\n\texport interface PromptArgument extends BaseMetadata {\n\t\t/**\n\t\t * A human-readable description of the argument.\n\t\t */\n\t\tdescription?: string;\n\t\t/**\n\t\t * Whether this argument must be provided.\n\t\t */\n\t\trequired?: boolean;\n\t}\n\n\t/**\n\t * The sender or recipient of messages and data in a conversation.\n\t */\n\texport type Role = \"user\" | \"assistant\";\n\n\t/**\n\t * Describes a message returned as part of a prompt.\n\t *\n\t * This is similar to `SamplingMessage`, but also supports the embedding of\n\t * resources from the MCP server.\n\t */\n\texport interface PromptMessage {\n\t\trole: Role;\n\t\tcontent: ContentBlock;\n\t}\n\n\t/**\n\t * A resource that the server is capable of reading, included in a prompt or tool call result.\n\t *\n\t * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.\n\t */\n\texport interface ResourceLink extends Resource {\n\t\ttype: \"resource_link\";\n\t}\n\n\t/**\n\t * The contents of a resource, embedded into a prompt or tool call result.\n\t *\n\t * It is up to the client how best to render embedded resources for the benefit\n\t * of the LLM and/or the user.\n\t */\n\texport interface EmbeddedResource {\n\t\ttype: \"resource\";\n\t\tresource: TextResourceContents | BlobResourceContents;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\t/**\n\t * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.\n\t */\n\texport interface PromptListChangedNotification extends Notification {\n\t\tmethod: \"notifications/prompts/list_changed\";\n\t}\n\n\t/* Tools */\n\t/**\n\t * Sent from the client to request a list of tools the server has.\n\t */\n\texport interface ListToolsRequest extends PaginatedRequest {\n\t\tmethod: \"tools/list\";\n\t}\n\n\t/**\n\t * The server's response to a tools/list request from the client.\n\t */\n\texport interface ListToolsResult extends PaginatedResult {\n\t\ttools: Tool[];\n\t}\n\n\t/**\n\t * The server's response to a tool call.\n\t */\n\texport interface CallToolResult extends Result {\n\t\t/**\n\t\t * A list of content objects that represent the unstructured result of the tool call.\n\t\t */\n\t\tcontent: ContentBlock[];\n\n\t\t/**\n\t\t * An optional JSON object that represents the structured result of the tool call.\n\t\t */\n\t\tstructuredContent?: { [key: string]: unknown };\n\n\t\t/**\n\t\t * Whether the tool call ended in an error.\n\t\t *\n\t\t * If not set, this is assumed to be false (the call was successful).\n\t\t *\n\t\t * Any errors that originate from the tool SHOULD be reported inside the result\n\t\t * object, with `isError` set to true, _not_ as an MCP protocol-level error\n\t\t * response. Otherwise, the LLM would not be able to see that an error occurred\n\t\t * and self-correct.\n\t\t *\n\t\t * However, any errors in _finding_ the tool, an error indicating that the\n\t\t * server does not support tool calls, or any other exceptional conditions,\n\t\t * should be reported as an MCP error response.\n\t\t */\n\t\tisError?: boolean;\n\t}\n\n\t/**\n\t * Used by the client to invoke a tool provided by the server.\n\t */\n\texport interface CallToolRequest extends Request {\n\t\tmethod: \"tools/call\";\n\t\tparams: {\n\t\t\tname: string;\n\t\t\targuments?: { [key: string]: unknown };\n\t\t};\n\t}\n\n\t/**\n\t * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.\n\t */\n\texport interface ToolListChangedNotification extends Notification {\n\t\tmethod: \"notifications/tools/list_changed\";\n\t}\n\n\t/**\n\t * Additional properties describing a Tool to clients.\n\t *\n\t * NOTE: all properties in ToolAnnotations are **hints**.\n\t * They are not guaranteed to provide a faithful description of\n\t * tool behavior (including descriptive properties like `title`).\n\t *\n\t * Clients should never make tool use decisions based on ToolAnnotations\n\t * received from untrusted servers.\n\t */\n\texport interface ToolAnnotations {\n\t\t/**\n\t\t * A human-readable title for the tool.\n\t\t */\n\t\ttitle?: string;\n\n\t\t/**\n\t\t * If true, the tool does not modify its environment.\n\t\t *\n\t\t * Default: false\n\t\t */\n\t\treadOnlyHint?: boolean;\n\n\t\t/**\n\t\t * If true, the tool may perform destructive updates to its environment.\n\t\t * If false, the tool performs only additive updates.\n\t\t *\n\t\t * (This property is meaningful only when `readOnlyHint == false`)\n\t\t *\n\t\t * Default: true\n\t\t */\n\t\tdestructiveHint?: boolean;\n\n\t\t/**\n\t\t * If true, calling the tool repeatedly with the same arguments\n\t\t * will have no additional effect on the its environment.\n\t\t *\n\t\t * (This property is meaningful only when `readOnlyHint == false`)\n\t\t *\n\t\t * Default: false\n\t\t */\n\t\tidempotentHint?: boolean;\n\n\t\t/**\n\t\t * If true, this tool may interact with an \"open world\" of external\n\t\t * entities. If false, the tool's domain of interaction is closed.\n\t\t * For example, the world of a web search tool is open, whereas that\n\t\t * of a memory tool is not.\n\t\t *\n\t\t * Default: true\n\t\t */\n\t\topenWorldHint?: boolean;\n\t}\n\n\t/**\n\t * Definition for a tool the client can call.\n\t */\n\texport interface Tool extends BaseMetadata {\n\t\t/**\n\t\t * A human-readable description of the tool.\n\t\t *\n\t\t * This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a \"hint\" to the model.\n\t\t */\n\t\tdescription?: string;\n\n\t\t/**\n\t\t * A JSON Schema object defining the expected parameters for the tool.\n\t\t */\n\t\tinputSchema: {\n\t\t\ttype: \"object\";\n\t\t\tproperties?: { [key: string]: object };\n\t\t\trequired?: string[];\n\t\t};\n\n\t\t/**\n\t\t * An optional JSON Schema object defining the structure of the tool's output returned in\n\t\t * the structuredContent field of a CallToolResult.\n\t\t */\n\t\toutputSchema?: {\n\t\t\ttype: \"object\";\n\t\t\tproperties?: { [key: string]: object };\n\t\t\trequired?: string[];\n\t\t};\n\n\t\t/**\n\t\t * Optional additional tool information.\n\t\t *\n\t\t * Display name precedence order is: title, annotations.title, then name.\n\t\t */\n\t\tannotations?: ToolAnnotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/* Logging */\n\t/**\n\t * A request from the client to the server, to enable or adjust logging.\n\t */\n\texport interface SetLevelRequest extends Request {\n\t\tmethod: \"logging/setLevel\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.\n\t\t\t */\n\t\t\tlevel: LoggingLevel;\n\t\t};\n\t}\n\n\t/**\n\t * Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.\n\t */\n\texport interface LoggingMessageNotification extends Notification {\n\t\tmethod: \"notifications/message\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The severity of this log message.\n\t\t\t */\n\t\t\tlevel: LoggingLevel;\n\t\t\t/**\n\t\t\t * An optional name of the logger issuing this message.\n\t\t\t */\n\t\t\tlogger?: string;\n\t\t\t/**\n\t\t\t * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.\n\t\t\t */\n\t\t\tdata: unknown;\n\t\t};\n\t}\n\n\t/**\n\t * The severity of a log message.\n\t *\n\t * These map to syslog message severities, as specified in RFC-5424:\n\t * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1\n\t */\n\texport type LoggingLevel =\n\t\t| \"debug\"\n\t\t| \"info\"\n\t\t| \"notice\"\n\t\t| \"warning\"\n\t\t| \"error\"\n\t\t| \"critical\"\n\t\t| \"alert\"\n\t\t| \"emergency\";\n\n\t/* Sampling */\n\t/**\n\t * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.\n\t */\n\texport interface CreateMessageRequest extends Request {\n\t\tmethod: \"sampling/createMessage\";\n\t\tparams: {\n\t\t\tmessages: SamplingMessage[];\n\t\t\t/**\n\t\t\t * The server's preferences for which model to select. The client MAY ignore these preferences.\n\t\t\t */\n\t\t\tmodelPreferences?: ModelPreferences;\n\t\t\t/**\n\t\t\t * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.\n\t\t\t */\n\t\t\tsystemPrompt?: string;\n\t\t\t/**\n\t\t\t * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.\n\t\t\t */\n\t\t\tincludeContext?: \"none\" | \"thisServer\" | \"allServers\";\n\t\t\t/**\n\t\t\t * @TJS-type number\n\t\t\t */\n\t\t\ttemperature?: number;\n\t\t\t/**\n\t\t\t * The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.\n\t\t\t */\n\t\t\tmaxTokens: number;\n\t\t\tstopSequences?: string[];\n\t\t\t/**\n\t\t\t * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.\n\t\t\t */\n\t\t\tmetadata?: object;\n\t\t};\n\t}\n\n\t/**\n\t * The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.\n\t */\n\texport interface CreateMessageResult extends Result, SamplingMessage {\n\t\t/**\n\t\t * The name of the model that generated the message.\n\t\t */\n\t\tmodel: string;\n\t\t/**\n\t\t * The reason why sampling stopped, if known.\n\t\t */\n\t\tstopReason?: \"endTurn\" | \"stopSequence\" | \"maxTokens\" | string;\n\t}\n\n\t/**\n\t * Describes a message issued to or received from an LLM API.\n\t */\n\texport interface SamplingMessage {\n\t\trole: Role;\n\t\tcontent: TextContent | ImageContent | AudioContent;\n\t}\n\n\t/**\n\t * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed\n\t */\n\texport interface Annotations {\n\t\t/**\n\t\t * Describes who the intended customer of this object or data is.\n\t\t *\n\t\t * It can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`).\n\t\t */\n\t\taudience?: Role[];\n\n\t\t/**\n\t\t * Describes how important this data is for operating the server.\n\t\t *\n\t\t * A value of 1 means \"most important,\" and indicates that the data is\n\t\t * effectively required, while 0 means \"least important,\" and indicates that\n\t\t * the data is entirely optional.\n\t\t *\n\t\t * @TJS-type number\n\t\t * @minimum 0\n\t\t * @maximum 1\n\t\t */\n\t\tpriority?: number;\n\n\t\t/**\n\t\t * The moment the resource was last modified, as an ISO 8601 formatted string.\n\t\t *\n\t\t * Should be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").\n\t\t *\n\t\t * Examples: last activity timestamp in an open file, timestamp when the resource\n\t\t * was attached, etc.\n\t\t */\n\t\tlastModified?: string;\n\t}\n\n\t/**  */\n\texport type ContentBlock =\n\t\t| TextContent\n\t\t| ImageContent\n\t\t| AudioContent\n\t\t| ResourceLink\n\t\t| EmbeddedResource;\n\n\t/**\n\t * Text provided to or from an LLM.\n\t */\n\texport interface TextContent {\n\t\ttype: \"text\";\n\n\t\t/**\n\t\t * The text content of the message.\n\t\t */\n\t\ttext: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * An image provided to or from an LLM.\n\t */\n\texport interface ImageContent {\n\t\ttype: \"image\";\n\n\t\t/**\n\t\t * The base64-encoded image data.\n\t\t *\n\t\t * @format byte\n\t\t */\n\t\tdata: string;\n\n\t\t/**\n\t\t * The MIME type of the image. Different providers may support different image types.\n\t\t */\n\t\tmimeType: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * Audio provided to or from an LLM.\n\t */\n\texport interface AudioContent {\n\t\ttype: \"audio\";\n\n\t\t/**\n\t\t * The base64-encoded audio data.\n\t\t *\n\t\t * @format byte\n\t\t */\n\t\tdata: string;\n\n\t\t/**\n\t\t * The MIME type of the audio. Different providers may support different audio types.\n\t\t */\n\t\tmimeType: string;\n\n\t\t/**\n\t\t * Optional annotations for the client.\n\t\t */\n\t\tannotations?: Annotations;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * The server's preferences for model selection, requested of the client during sampling.\n\t *\n\t * Because LLMs can vary along multiple dimensions, choosing the \"best\" model is\n\t * rarely straightforward.  Different models excel in different areas-some are\n\t * faster but less capable, others are more capable but more expensive, and so\n\t * on. This interface allows servers to express their priorities across multiple\n\t * dimensions to help clients make an appropriate selection for their use case.\n\t *\n\t * These preferences are always advisory. The client MAY ignore them. It is also\n\t * up to the client to decide how to interpret these preferences and how to\n\t * balance them against other considerations.\n\t */\n\texport interface ModelPreferences {\n\t\t/**\n\t\t * Optional hints to use for model selection.\n\t\t *\n\t\t * If multiple hints are specified, the client MUST evaluate them in order\n\t\t * (such that the first match is taken).\n\t\t *\n\t\t * The client SHOULD prioritize these hints over the numeric priorities, but\n\t\t * MAY still use the priorities to select from ambiguous matches.\n\t\t */\n\t\thints?: ModelHint[];\n\n\t\t/**\n\t\t * How much to prioritize cost when selecting a model. A value of 0 means cost\n\t\t * is not important, while a value of 1 means cost is the most important\n\t\t * factor.\n\t\t *\n\t\t * @TJS-type number\n\t\t * @minimum 0\n\t\t * @maximum 1\n\t\t */\n\t\tcostPriority?: number;\n\n\t\t/**\n\t\t * How much to prioritize sampling speed (latency) when selecting a model. A\n\t\t * value of 0 means speed is not important, while a value of 1 means speed is\n\t\t * the most important factor.\n\t\t *\n\t\t * @TJS-type number\n\t\t * @minimum 0\n\t\t * @maximum 1\n\t\t */\n\t\tspeedPriority?: number;\n\n\t\t/**\n\t\t * How much to prioritize intelligence and capabilities when selecting a\n\t\t * model. A value of 0 means intelligence is not important, while a value of 1\n\t\t * means intelligence is the most important factor.\n\t\t *\n\t\t * @TJS-type number\n\t\t * @minimum 0\n\t\t * @maximum 1\n\t\t */\n\t\tintelligencePriority?: number;\n\t}\n\n\t/**\n\t * Hints to use for model selection.\n\t *\n\t * Keys not declared here are currently left unspecified by the spec and are up\n\t * to the client to interpret.\n\t */\n\texport interface ModelHint {\n\t\t/**\n\t\t * A hint for a model name.\n\t\t *\n\t\t * The client SHOULD treat this as a substring of a model name; for example:\n\t\t *  - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\n\t\t *  - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\n\t\t *  - `claude` should match any Claude model\n\t\t *\n\t\t * The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n\t\t *  - `gemini-1.5-flash` could match `claude-3-haiku-20240307`\n\t\t */\n\t\tname?: string;\n\t}\n\n\t/* Autocomplete */\n\t/**\n\t * A request from the client to the server, to ask for completion options.\n\t */\n\texport interface CompleteRequest extends Request {\n\t\tmethod: \"completion/complete\";\n\t\tparams: {\n\t\t\tref: PromptReference | ResourceTemplateReference;\n\t\t\t/**\n\t\t\t * The argument's information\n\t\t\t */\n\t\t\targument: {\n\t\t\t\t/**\n\t\t\t\t * The name of the argument\n\t\t\t\t */\n\t\t\t\tname: string;\n\t\t\t\t/**\n\t\t\t\t * The value of the argument to use for completion matching.\n\t\t\t\t */\n\t\t\t\tvalue: string;\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Additional, optional context for completions\n\t\t\t */\n\t\t\tcontext?: {\n\t\t\t\t/**\n\t\t\t\t * Previously-resolved variables in a URI template or prompt.\n\t\t\t\t */\n\t\t\t\targuments?: { [key: string]: string };\n\t\t\t};\n\t\t};\n\t}\n\n\t/**\n\t * The server's response to a completion/complete request\n\t */\n\texport interface CompleteResult extends Result {\n\t\tcompletion: {\n\t\t\t/**\n\t\t\t * An array of completion values. Must not exceed 100 items.\n\t\t\t */\n\t\t\tvalues: string[];\n\t\t\t/**\n\t\t\t * The total number of completion options available. This can exceed the number of values actually sent in the response.\n\t\t\t */\n\t\t\ttotal?: number;\n\t\t\t/**\n\t\t\t * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.\n\t\t\t */\n\t\t\thasMore?: boolean;\n\t\t};\n\t}\n\n\t/**\n\t * A reference to a resource or resource template definition.\n\t */\n\texport interface ResourceTemplateReference {\n\t\ttype: \"ref/resource\";\n\t\t/**\n\t\t * The URI or URI template of the resource.\n\t\t *\n\t\t * @format uri-template\n\t\t */\n\t\turi: string;\n\t}\n\n\t/**\n\t * Identifies a prompt.\n\t */\n\texport interface PromptReference extends BaseMetadata {\n\t\ttype: \"ref/prompt\";\n\t}\n\n\t/* Roots */\n\t/**\n\t * Sent from the server to request a list of root URIs from the client. Roots allow\n\t * servers to ask for specific directories or files to operate on. A common example\n\t * for roots is providing a set of repositories or directories a server should operate\n\t * on.\n\t *\n\t * This request is typically used when the server needs to understand the file system\n\t * structure or access specific locations that the client has permission to read from.\n\t */\n\texport interface ListRootsRequest extends Request {\n\t\tmethod: \"roots/list\";\n\t}\n\n\t/**\n\t * The client's response to a roots/list request from the server.\n\t * This result contains an array of Root objects, each representing a root directory\n\t * or file that the server can operate on.\n\t */\n\texport interface ListRootsResult extends Result {\n\t\troots: Root[];\n\t}\n\n\t/**\n\t * Represents a root directory or file that the server can operate on.\n\t */\n\texport interface Root {\n\t\t/**\n\t\t * The URI identifying the root. This *must* start with file:// for now.\n\t\t * This restriction may be relaxed in future versions of the protocol to allow\n\t\t * other URI schemes.\n\t\t *\n\t\t * @format uri\n\t\t */\n\t\turi: string;\n\t\t/**\n\t\t * An optional name for the root. This can be used to provide a human-readable\n\t\t * identifier for the root, which may be useful for display purposes or for\n\t\t * referencing the root in other parts of the application.\n\t\t */\n\t\tname?: string;\n\n\t\t/**\n\t\t * See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.\n\t\t */\n\t\t_meta?: { [key: string]: unknown };\n\t}\n\n\t/**\n\t * A notification from the client to the server, informing it that the list of roots has changed.\n\t * This notification should be sent whenever the client adds, removes, or modifies any root.\n\t * The server should then request an updated list of roots using the ListRootsRequest.\n\t */\n\texport interface RootsListChangedNotification extends Notification {\n\t\tmethod: \"notifications/roots/list_changed\";\n\t}\n\n\t/**\n\t * A request from the server to elicit additional information from the user via the client.\n\t */\n\texport interface ElicitRequest extends Request {\n\t\tmethod: \"elicitation/create\";\n\t\tparams: {\n\t\t\t/**\n\t\t\t * The message to present to the user.\n\t\t\t */\n\t\t\tmessage: string;\n\t\t\t/**\n\t\t\t * A restricted subset of JSON Schema.\n\t\t\t * Only top-level properties are allowed, without nesting.\n\t\t\t */\n\t\t\trequestedSchema: {\n\t\t\t\ttype: \"object\";\n\t\t\t\tproperties: {\n\t\t\t\t\t[key: string]: PrimitiveSchemaDefinition;\n\t\t\t\t};\n\t\t\t\trequired?: string[];\n\t\t\t};\n\t\t};\n\t}\n\n\t/**\n\t * Restricted schema definitions that only allow primitive types\n\t * without nested objects or arrays.\n\t */\n\texport type PrimitiveSchemaDefinition =\n\t\t| StringSchema\n\t\t| NumberSchema\n\t\t| BooleanSchema\n\t\t| EnumSchema;\n\n\texport interface StringSchema {\n\t\ttype: \"string\";\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tminLength?: number;\n\t\tmaxLength?: number;\n\t\tformat?: \"email\" | \"uri\" | \"date\" | \"date-time\";\n\t}\n\n\texport interface NumberSchema {\n\t\ttype: \"number\" | \"integer\";\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tminimum?: number;\n\t\tmaximum?: number;\n\t}\n\n\texport interface BooleanSchema {\n\t\ttype: \"boolean\";\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tdefault?: boolean;\n\t}\n\n\texport interface EnumSchema {\n\t\ttype: \"string\";\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tenum: string[];\n\t\tenumNames?: string[]; // Display names for enum values\n\t}\n\n\t/**\n\t * The client's response to an elicitation request.\n\t */\n\texport interface ElicitResult extends Result {\n\t\t/**\n\t\t * The user action in response to the elicitation.\n\t\t * - \"accept\": User submitted the form/confirmed the action\n\t\t * - \"decline\": User explicitly declined the action\n\t\t * - \"cancel\": User dismissed without making an explicit choice\n\t\t */\n\t\taction: \"accept\" | \"decline\" | \"cancel\";\n\n\t\t/**\n\t\t * The submitted form data, only present when action is \"accept\".\n\t\t * Contains values matching the requested schema.\n\t\t */\n\t\tcontent?: { [key: string]: string | number | boolean };\n\t}\n\n\t/* Client messages */\n\texport type ClientRequest =\n\t\t| PingRequest\n\t\t| InitializeRequest\n\t\t| CompleteRequest\n\t\t| SetLevelRequest\n\t\t| GetPromptRequest\n\t\t| ListPromptsRequest\n\t\t| ListResourcesRequest\n\t\t| ListResourceTemplatesRequest\n\t\t| ReadResourceRequest\n\t\t| SubscribeRequest\n\t\t| UnsubscribeRequest\n\t\t| CallToolRequest\n\t\t| ListToolsRequest;\n\n\texport type ClientNotification =\n\t\t| CancelledNotification\n\t\t| ProgressNotification\n\t\t| InitializedNotification\n\t\t| RootsListChangedNotification;\n\n\texport type ClientResult =\n\t\t| EmptyResult\n\t\t| CreateMessageResult\n\t\t| ListRootsResult\n\t\t| ElicitResult;\n\n\t/* Server messages */\n\texport type ServerRequest =\n\t\t| PingRequest\n\t\t| CreateMessageRequest\n\t\t| ListRootsRequest\n\t\t| ElicitRequest;\n\n\texport type ServerNotification =\n\t\t| CancelledNotification\n\t\t| ProgressNotification\n\t\t| LoggingMessageNotification\n\t\t| ResourceUpdatedNotification\n\t\t| ResourceListChangedNotification\n\t\t| ToolListChangedNotification\n\t\t| PromptListChangedNotification;\n\n\texport type ServerResult =\n\t\t| EmptyResult\n\t\t| InitializeResult\n\t\t| CompleteResult\n\t\t| GetPromptResult\n\t\t| ListPromptsResult\n\t\t| ListResourceTemplatesResult\n\t\t| ListResourcesResult\n\t\t| ReadResourceResult\n\t\t| CallToolResult\n\t\t| ListToolsResult;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { equals as arraysEqual } from '../../../../base/common/arrays.js';\nimport { assertNever } from '../../../../base/common/assert.js';\nimport { decodeHex, encodeHex, VSBuffer } from '../../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { Codicon } from '../../../../base/common/codicons.js';\nimport { Event } from '../../../../base/common/event.js';\nimport { Disposable, IDisposable } from '../../../../base/common/lifecycle.js';\nimport { equals as objectsEqual } from '../../../../base/common/objects.js';\nimport { IObservable } from '../../../../base/common/observable.js';\nimport { URI, UriComponents } from '../../../../base/common/uri.js';\nimport { Location } from '../../../../editor/common/languages.js';\nimport { localize } from '../../../../nls.js';\nimport { ConfigurationTarget } from '../../../../platform/configuration/common/configuration.js';\nimport { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IEditorOptions } from '../../../../platform/editor/common/editor.js';\nimport { ExtensionIdentifier } from '../../../../platform/extensions/common/extensions.js';\nimport { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IInstallableMcpServer as IInstallableMcpServer, IGalleryMcpServer, IQueryOptions, IMcpServerManifest } from '../../../../platform/mcp/common/mcpManagement.js';\nimport { IMcpDevModeConfig, IMcpServerConfiguration } from '../../../../platform/mcp/common/mcpPlatformTypes.js';\nimport { StorageScope } from '../../../../platform/storage/common/storage.js';\nimport { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';\nimport { IWorkspaceFolder, IWorkspaceFolderData } from '../../../../platform/workspace/common/workspace.js';\nimport { IWorkbenchLocalMcpServer, IWorkbencMcpServerInstallOptions } from '../../../services/mcp/common/mcpWorkbenchManagementService.js';\nimport { ToolProgress } from '../../chat/common/languageModelToolsService.js';\nimport { IMcpServerSamplingConfiguration } from './mcpConfiguration.js';\nimport { McpServerRequestHandler } from './mcpServerRequestHandler.js';\nimport { MCP } from './modelContextProtocol.js';\nimport { UriTemplate } from './uriTemplate.js';\n\nexport const extensionMcpCollectionPrefix = 'ext.';\n\nexport function extensionPrefixedIdentifier(identifier: ExtensionIdentifier, id: string): string {\n\treturn ExtensionIdentifier.toKey(identifier) + '/' + id;\n}\n\n/**\n * An McpCollection contains McpServers. There may be multiple collections for\n * different locations servers are discovered.\n */\nexport interface McpCollectionDefinition {\n\t/** Origin authority from which this collection was discovered. */\n\treadonly remoteAuthority: string | null;\n\t/** Globally-unique, stable ID for this definition */\n\treadonly id: string;\n\t/** Human-readable label for the definition */\n\treadonly label: string;\n\t/** Definitions this collection contains. */\n\treadonly serverDefinitions: IObservable<readonly McpServerDefinition[]>;\n\t/** If 'false', consent is required before any MCP servers in this collection are automatically launched. */\n\treadonly isTrustedByDefault: boolean;\n\t/** Scope where associated collection info should be stored. */\n\treadonly scope: StorageScope;\n\t/** Configuration target where configuration related to this server should be stored. */\n\treadonly configTarget: ConfigurationTarget;\n\n\t/** Resolves a server definition. If present, always called before a server starts. */\n\tresolveServerLanch?(definition: McpServerDefinition): Promise<McpServerLaunch | undefined>;\n\n\t/** For lazy-loaded collections only: */\n\treadonly lazy?: {\n\t\t/** True if `serverDefinitions` were loaded from the cache */\n\t\tisCached: boolean;\n\t\t/** Triggers a load of the real server definition, which should be pushed to the IMcpRegistry. If not this definition will be removed. */\n\t\tload(): Promise<void>;\n\t\t/** Called after `load()` if the extension is not found. */\n\t\tremoved?(): void;\n\t};\n\n\treadonly presentation?: {\n\t\t/** Sort order of the collection. */\n\t\treadonly order?: number;\n\t\t/** Place where this collection is configured, used in workspace trust prompts and \"show config\" */\n\t\treadonly origin?: URI;\n\t};\n}\n\nexport const enum McpCollectionSortOrder {\n\tWorkspaceFolder = 0,\n\tWorkspace = 100,\n\tUser = 200,\n\tExtension = 300,\n\tFilesystem = 400,\n\n\tRemoteBoost = -50,\n}\n\nexport namespace McpCollectionDefinition {\n\texport interface FromExtHost {\n\t\treadonly id: string;\n\t\treadonly label: string;\n\t\treadonly isTrustedByDefault: boolean;\n\t\treadonly scope: StorageScope;\n\t\treadonly canResolveLaunch: boolean;\n\t\treadonly extensionId: string;\n\t\treadonly configTarget: ConfigurationTarget;\n\t}\n\n\texport function equals(a: McpCollectionDefinition, b: McpCollectionDefinition): boolean {\n\t\treturn a.id === b.id\n\t\t\t&& a.remoteAuthority === b.remoteAuthority\n\t\t\t&& a.label === b.label\n\t\t\t&& a.isTrustedByDefault === b.isTrustedByDefault;\n\t}\n}\n\nexport interface McpServerDefinition {\n\t/** Globally-unique, stable ID for this definition */\n\treadonly id: string;\n\t/** Human-readable label for the definition */\n\treadonly label: string;\n\t/** Descriptor defining how the configuration should be launched. */\n\treadonly launch: McpServerLaunch;\n\t/** Explicit roots. If undefined, all workspace folders. */\n\treadonly roots?: URI[] | undefined;\n\t/** If set, allows configuration variables to be resolved in the {@link launch} with the given context */\n\treadonly variableReplacement?: McpServerDefinitionVariableReplacement;\n\t/** Nonce used for caching the server. Changing the nonce will indicate that tools need to be refreshed. */\n\treadonly cacheNonce?: string;\n\t/** Dev mode configuration for the server */\n\treadonly devMode?: IMcpDevModeConfig;\n\n\treadonly presentation?: {\n\t\t/** Sort order of the definition. */\n\t\treadonly order?: number;\n\t\t/** Place where this server is configured, used in workspace trust prompts and \"show config\" */\n\t\treadonly origin?: Location;\n\t};\n}\n\nexport namespace McpServerDefinition {\n\texport interface Serialized {\n\t\treadonly id: string;\n\t\treadonly label: string;\n\t\treadonly cacheNonce?: string;\n\t\treadonly launch: McpServerLaunch.Serialized;\n\t\treadonly variableReplacement?: McpServerDefinitionVariableReplacement.Serialized;\n\t}\n\n\texport function toSerialized(def: McpServerDefinition): McpServerDefinition.Serialized {\n\t\treturn def;\n\t}\n\n\texport function fromSerialized(def: McpServerDefinition.Serialized): McpServerDefinition {\n\t\treturn {\n\t\t\tid: def.id,\n\t\t\tlabel: def.label,\n\t\t\tcacheNonce: def.cacheNonce,\n\t\t\tlaunch: McpServerLaunch.fromSerialized(def.launch),\n\t\t\tvariableReplacement: def.variableReplacement ? McpServerDefinitionVariableReplacement.fromSerialized(def.variableReplacement) : undefined,\n\t\t};\n\t}\n\n\texport function equals(a: McpServerDefinition, b: McpServerDefinition): boolean {\n\t\treturn a.id === b.id\n\t\t\t&& a.label === b.label\n\t\t\t&& arraysEqual(a.roots, b.roots, (a, b) => a.toString() === b.toString())\n\t\t\t&& objectsEqual(a.launch, b.launch)\n\t\t\t&& objectsEqual(a.presentation, b.presentation)\n\t\t\t&& objectsEqual(a.variableReplacement, b.variableReplacement)\n\t\t\t&& objectsEqual(a.devMode, b.devMode);\n\t}\n}\n\n\nexport interface McpServerDefinitionVariableReplacement {\n\tsection?: string; // e.g. 'mcp'\n\tfolder?: IWorkspaceFolderData;\n\ttarget: ConfigurationTarget;\n}\n\nexport namespace McpServerDefinitionVariableReplacement {\n\texport interface Serialized {\n\t\ttarget: ConfigurationTarget;\n\t\tsection?: string;\n\t\tfolder?: { name: string; index: number; uri: UriComponents };\n\t}\n\n\texport function toSerialized(def: McpServerDefinitionVariableReplacement): McpServerDefinitionVariableReplacement.Serialized {\n\t\treturn def;\n\t}\n\n\texport function fromSerialized(def: McpServerDefinitionVariableReplacement.Serialized): McpServerDefinitionVariableReplacement {\n\t\treturn {\n\t\t\tsection: def.section,\n\t\t\tfolder: def.folder ? { ...def.folder, uri: URI.revive(def.folder.uri) } : undefined,\n\t\t\ttarget: def.target,\n\t\t};\n\t}\n}\n\nexport interface IMcpService {\n\t_serviceBrand: undefined;\n\treadonly servers: IObservable<readonly IMcpServer[]>;\n\n\t/** Resets the cached tools. */\n\tresetCaches(): void;\n\n\t/** Set if there are extensions that register MCP servers that have never been activated. */\n\treadonly lazyCollectionState: IObservable<LazyCollectionState>;\n\t/** Activatese extensions and runs their MCP servers. */\n\tactivateCollections(): Promise<void>;\n}\n\nexport const enum LazyCollectionState {\n\tHasUnknown,\n\tLoadingUnknown,\n\tAllKnown,\n}\n\nexport const IMcpService = createDecorator<IMcpService>('IMcpService');\n\nexport interface McpCollectionReference {\n\tid: string;\n\tlabel: string;\n\tpresentation?: McpCollectionDefinition['presentation'];\n}\n\nexport interface McpDefinitionReference {\n\tid: string;\n\tlabel: string;\n}\n\nexport interface IMcpServerStartOpts {\n\tisFromInteraction?: boolean;\n\tdebug?: boolean;\n}\n\nexport interface IMcpServer extends IDisposable {\n\treadonly collection: McpCollectionReference;\n\treadonly definition: McpDefinitionReference;\n\treadonly connection: IObservable<IMcpServerConnection | undefined>;\n\treadonly connectionState: IObservable<McpConnectionState>;\n\n\t/**\n\t * Full definition as it exists in the MCP registry. Unlike the references\n\t * in `collection` and `definition`, this may change over time.\n\t */\n\treadDefinitions(): IObservable<{ server: McpServerDefinition | undefined; collection: McpCollectionDefinition | undefined }>;\n\n\t/**\n\t * Reflects the MCP server trust state. True if trusted, false if untrusted,\n\t * undefined if consent is required but not indicated.\n\t */\n\treadonly trusted: IObservable<boolean | undefined>;\n\n\tshowOutput(): void;\n\t/**\n\t * Starts the server and returns its resulting state. One of:\n\t * - Running, if all good\n\t * - Error, if the server failed to start\n\t * - Stopped, if the server was disposed or the user cancelled the launch\n\t */\n\tstart(opts?: IMcpServerStartOpts): Promise<McpConnectionState>;\n\tstop(): Promise<void>;\n\n\treadonly cacheState: IObservable<McpServerCacheState>;\n\treadonly tools: IObservable<readonly IMcpTool[]>;\n\treadonly prompts: IObservable<readonly IMcpPrompt[]>;\n\treadonly capabilities: IObservable<McpCapability | undefined>;\n\n\t/**\n\t * Lists all resources on the server.\n\t */\n\tresources(token?: CancellationToken): AsyncIterable<IMcpResource[]>;\n\n\t/**\n\t * List resource templates on the server.\n\t */\n\tresourceTemplates(token?: CancellationToken): Promise<IMcpResourceTemplate[]>;\n}\n\n/**\n * A representation of an MCP resource. The `uri` is namespaced to VS Code and\n * can be used in filesystem APIs.\n */\nexport interface IMcpResource {\n\t/** Identifier for the file in VS Code and operable with filesystem API */\n\treadonly uri: URI;\n\t/** Identifier of the file as given from the MCP server. */\n\treadonly mcpUri: string;\n\treadonly name: string;\n\treadonly title?: string;\n\treadonly description?: string;\n\treadonly mimeType?: string;\n\treadonly sizeInBytes?: number;\n}\n\nexport interface IMcpResourceTemplate {\n\treadonly name: string;\n\treadonly title?: string;\n\treadonly description?: string;\n\treadonly mimeType?: string;\n\treadonly template: UriTemplate;\n\n\t/** Gets string completions for the given template part. */\n\tcomplete(templatePart: string, prefix: string, alreadyResolved: Record<string, string | string[]>, token: CancellationToken): Promise<string[]>;\n\n\t/** Gets the resolved URI from template parts. */\n\tresolveURI(vars: Record<string, unknown>): URI;\n}\n\nexport const isMcpResourceTemplate = (obj: IMcpResource | IMcpResourceTemplate): obj is IMcpResourceTemplate => {\n\treturn (obj as IMcpResourceTemplate).template !== undefined;\n};\nexport const isMcpResource = (obj: IMcpResource | IMcpResourceTemplate): obj is IMcpResource => {\n\treturn (obj as IMcpResource).mcpUri !== undefined;\n};\n\nexport const enum McpServerCacheState {\n\t/** Tools have not been read before */\n\tUnknown,\n\t/** Tools were read from the cache */\n\tCached,\n\t/** Tools were read from the cache or live, but they may be outdated. */\n\tOutdated,\n\t/** Tools are refreshing for the first time */\n\tRefreshingFromUnknown,\n\t/** Tools are refreshing and the current tools are cached */\n\tRefreshingFromCached,\n\t/** Tool state is live, server is connected */\n\tLive,\n}\n\nexport interface IMcpPrompt {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly title?: string;\n\treadonly description?: string;\n\treadonly arguments: readonly MCP.PromptArgument[];\n\n\t/** Gets string completions for the given prompt part. */\n\tcomplete(argument: string, prefix: string, alreadyResolved: Record<string, string>, token: CancellationToken): Promise<string[]>;\n\n\tresolve(args: Record<string, string | undefined>, token?: CancellationToken): Promise<IMcpPromptMessage[]>;\n}\n\nexport const mcpPromptReplaceSpecialChars = (s: string) => s.replace(/[^a-z0-9_.-]/gi, '_');\n\nexport const mcpPromptPrefix = (definition: McpDefinitionReference) =>\n\t`/mcp.` + mcpPromptReplaceSpecialChars(definition.label);\n\nexport interface IMcpPromptMessage extends MCP.PromptMessage { }\n\nexport interface IMcpToolCallContext {\n\tchatSessionId?: string;\n\tchatRequestId?: string;\n}\n\nexport interface IMcpTool {\n\n\treadonly id: string;\n\t/** Name for #referencing in chat */\n\treadonly referenceName: string;\n\n\treadonly definition: MCP.Tool;\n\n\t/**\n\t * Calls a tool\n\t * @throws {@link MpcResponseError} if the tool fails to execute\n\t * @throws {@link McpConnectionFailedError} if the connection to the server fails\n\t */\n\tcall(params: Record<string, unknown>, context?: IMcpToolCallContext, token?: CancellationToken): Promise<MCP.CallToolResult>;\n\n\t/**\n\t * Identical to {@link call}, but reports progress.\n\t */\n\tcallWithProgress(params: Record<string, unknown>, progress: ToolProgress, context?: IMcpToolCallContext, token?: CancellationToken): Promise<MCP.CallToolResult>;\n}\n\nexport const enum McpServerTransportType {\n\t/** A command-line MCP server communicating over standard in/out */\n\tStdio = 1 << 0,\n\t/** An MCP server that uses Server-Sent Events */\n\tHTTP = 1 << 1,\n}\n\n/**\n * MCP server launched on the command line which communicated over stdio.\n * https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#stdio\n */\nexport interface McpServerTransportStdio {\n\treadonly type: McpServerTransportType.Stdio;\n\treadonly cwd: string | undefined;\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly env: Record<string, string | number | null>;\n\treadonly envFile: string | undefined;\n}\n\n/**\n * MCP server launched on the command line which communicated over SSE or Streamable HTTP.\n * https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#http-with-sse\n * https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http\n */\nexport interface McpServerTransportHTTP {\n\treadonly type: McpServerTransportType.HTTP;\n\treadonly uri: URI;\n\treadonly headers: [string, string][];\n}\n\nexport type McpServerLaunch =\n\t| McpServerTransportStdio\n\t| McpServerTransportHTTP;\n\nexport namespace McpServerLaunch {\n\texport type Serialized =\n\t\t| { type: McpServerTransportType.HTTP; uri: UriComponents; headers: [string, string][] }\n\t\t| { type: McpServerTransportType.Stdio; cwd: string | undefined; command: string; args: readonly string[]; env: Record<string, string | number | null>; envFile: string | undefined };\n\n\texport function toSerialized(launch: McpServerLaunch): McpServerLaunch.Serialized {\n\t\treturn launch;\n\t}\n\n\texport function fromSerialized(launch: McpServerLaunch.Serialized): McpServerLaunch {\n\t\tswitch (launch.type) {\n\t\t\tcase McpServerTransportType.HTTP:\n\t\t\t\treturn { type: launch.type, uri: URI.revive(launch.uri), headers: launch.headers };\n\t\t\tcase McpServerTransportType.Stdio:\n\t\t\t\treturn {\n\t\t\t\t\ttype: launch.type,\n\t\t\t\t\tcwd: launch.cwd,\n\t\t\t\t\tcommand: launch.command,\n\t\t\t\t\targs: launch.args,\n\t\t\t\t\tenv: launch.env,\n\t\t\t\t\tenvFile: launch.envFile,\n\t\t\t\t};\n\t\t}\n\t}\n}\n\n/**\n * An instance that manages a connection to an MCP server. It can be started,\n * stopped, and restarted. Once started and in a running state, it will\n * eventually build a {@link IMcpServerConnection.handler}.\n */\nexport interface IMcpServerConnection extends IDisposable {\n\treadonly definition: McpServerDefinition;\n\treadonly state: IObservable<McpConnectionState>;\n\treadonly handler: IObservable<McpServerRequestHandler | undefined>;\n\n\t/**\n\t * Resolved launch definition. Might not match the `definition.launch` due to\n\t * resolution logic in extension-provided MCPs.\n\t */\n\treadonly launchDefinition: McpServerLaunch;\n\n\t/**\n\t * Starts the server if it's stopped. Returns a promise that resolves once\n\t * server exits a 'starting' state.\n\t */\n\tstart(methods: IMcpClientMethods): Promise<McpConnectionState>;\n\n\t/**\n\t * Stops the server.\n\t */\n\tstop(): Promise<void>;\n}\n\n/** Client methods whose implementations are passed through the server connection. */\nexport interface IMcpClientMethods {\n\t/** Handler for `sampling/createMessage` */\n\tcreateMessageRequestHandler?(req: MCP.CreateMessageRequest['params']): Promise<MCP.CreateMessageResult>;\n\t/** Handler for `elicitation/create` */\n\telicitationRequestHandler?(req: MCP.ElicitRequest['params']): Promise<MCP.ElicitResult>;\n}\n\n/**\n * McpConnectionState is the state of the underlying connection and is\n * communicated e.g. from the extension host to the renderer.\n */\nexport namespace McpConnectionState {\n\texport const enum Kind {\n\t\tStopped,\n\t\tStarting,\n\t\tRunning,\n\t\tError,\n\t}\n\n\texport const toString = (s: McpConnectionState): string => {\n\t\tswitch (s.state) {\n\t\t\tcase Kind.Stopped:\n\t\t\t\treturn localize('mcpstate.stopped', 'Stopped');\n\t\t\tcase Kind.Starting:\n\t\t\t\treturn localize('mcpstate.starting', 'Starting');\n\t\t\tcase Kind.Running:\n\t\t\t\treturn localize('mcpstate.running', 'Running');\n\t\t\tcase Kind.Error:\n\t\t\t\treturn localize('mcpstate.error', 'Error {0}', s.message);\n\t\t\tdefault:\n\t\t\t\tassertNever(s);\n\t\t}\n\t};\n\n\texport const toKindString = (s: McpConnectionState.Kind): string => {\n\t\tswitch (s) {\n\t\t\tcase Kind.Stopped:\n\t\t\t\treturn 'stopped';\n\t\t\tcase Kind.Starting:\n\t\t\t\treturn 'starting';\n\t\t\tcase Kind.Running:\n\t\t\t\treturn 'running';\n\t\t\tcase Kind.Error:\n\t\t\t\treturn 'error';\n\t\t\tdefault:\n\t\t\t\tassertNever(s);\n\t\t}\n\t};\n\n\t/** Returns if the MCP state is one where starting a new server is valid */\n\texport const canBeStarted = (s: Kind) => s === Kind.Error || s === Kind.Stopped;\n\n\t/** Gets whether the state is a running state. */\n\texport const isRunning = (s: McpConnectionState) => !canBeStarted(s.state);\n\n\texport interface Stopped {\n\t\treadonly state: Kind.Stopped;\n\t}\n\n\texport interface Starting {\n\t\treadonly state: Kind.Starting;\n\t}\n\n\texport interface Running {\n\t\treadonly state: Kind.Running;\n\t}\n\n\texport interface Error {\n\t\treadonly state: Kind.Error;\n\t\treadonly code?: string;\n\t\treadonly shouldRetry?: boolean;\n\t\treadonly message: string;\n\t}\n}\n\nexport type McpConnectionState =\n\t| McpConnectionState.Stopped\n\t| McpConnectionState.Starting\n\t| McpConnectionState.Running\n\t| McpConnectionState.Error;\n\nexport class MpcResponseError extends Error {\n\tconstructor(message: string, public readonly code: number, public readonly data: unknown) {\n\t\tsuper(`MPC ${code}: ${message}`);\n\t}\n}\n\nexport class McpConnectionFailedError extends Error { }\n\nexport interface IMcpConfigPath {\n\tid: string;\n\tkey: 'userLocalValue' | 'userRemoteValue' | 'workspaceValue' | 'workspaceFolderValue';\n\tlabel: string;\n\tscope: StorageScope;\n\ttarget: ConfigurationTarget;\n\torder: number;\n\tremoteAuthority?: string;\n\turi: URI | undefined;\n\tsection?: string[];\n\tworkspaceFolder?: IWorkspaceFolder;\n}\n\nexport interface IMcpServerContainer extends IDisposable {\n\tmcpServer: IWorkbenchMcpServer | null;\n\tupdate(): void;\n}\n\nexport interface IMcpServerEditorOptions extends IEditorOptions {\n\ttab?: McpServerEditorTab;\n\tsideByside?: boolean;\n}\n\nexport const enum McpServerInstallState {\n\tInstalling,\n\tInstalled,\n\tUninstalling,\n\tUninstalled\n}\n\nexport const enum McpServerEditorTab {\n\tReadme = 'readme',\n\tManifest = 'manifest',\n\tConfiguration = 'configuration',\n}\n\nexport interface IWorkbenchMcpServer {\n\treadonly gallery: IGalleryMcpServer | undefined;\n\treadonly local: IWorkbenchLocalMcpServer | undefined;\n\treadonly installable: IInstallableMcpServer | undefined;\n\treadonly installState: McpServerInstallState;\n\treadonly id: string;\n\treadonly name: string;\n\treadonly label: string;\n\treadonly description: string;\n\treadonly icon?: {\n\t\treadonly dark: string;\n\t\treadonly light: string;\n\t};\n\treadonly codicon?: string;\n\treadonly publisherUrl?: string;\n\treadonly publisherDisplayName?: string;\n\treadonly installCount?: number;\n\treadonly ratingCount?: number;\n\treadonly rating?: number;\n\treadonly url?: string;\n\treadonly repository?: string;\n\treadonly config?: IMcpServerConfiguration | undefined;\n\treadonly readmeUrl?: URI;\n\tgetReadme(token: CancellationToken): Promise<string>;\n\tgetManifest(token: CancellationToken): Promise<IMcpServerManifest>;\n}\n\nexport const IMcpWorkbenchService = createDecorator<IMcpWorkbenchService>('IMcpWorkbenchService');\nexport interface IMcpWorkbenchService {\n\treadonly _serviceBrand: undefined;\n\treadonly onChange: Event<IWorkbenchMcpServer | undefined>;\n\treadonly onReset: Event<void>;\n\treadonly local: readonly IWorkbenchMcpServer[];\n\tqueryLocal(): Promise<IWorkbenchMcpServer[]>;\n\tqueryGallery(options?: IQueryOptions, token?: CancellationToken): Promise<IWorkbenchMcpServer[]>;\n\tinstall(server: IWorkbenchMcpServer, installOptions?: IWorkbencMcpServerInstallOptions): Promise<IWorkbenchMcpServer>;\n\tuninstall(mcpServer: IWorkbenchMcpServer): Promise<void>;\n\tgetMcpConfigPath(arg: IWorkbenchLocalMcpServer): IMcpConfigPath | undefined;\n\tgetMcpConfigPath(arg: URI): Promise<IMcpConfigPath | undefined>;\n\topen(extension: IWorkbenchMcpServer | string, options?: IMcpServerEditorOptions): Promise<void>;\n}\n\nexport class McpServerContainers extends Disposable {\n\tconstructor(\n\t\tprivate readonly containers: IMcpServerContainer[],\n\t\t@IMcpWorkbenchService mcpWorkbenchService: IMcpWorkbenchService\n\t) {\n\t\tsuper();\n\t\tthis._register(mcpWorkbenchService.onChange(this.update, this));\n\t}\n\n\tset mcpServer(extension: IWorkbenchMcpServer | null) {\n\t\tthis.containers.forEach(c => c.mcpServer = extension);\n\t}\n\n\tupdate(server: IWorkbenchMcpServer | undefined): void {\n\t\tfor (const container of this.containers) {\n\t\t\tif (server && container.mcpServer) {\n\t\t\t\tif (server.name === container.mcpServer.name) {\n\t\t\t\t\tcontainer.mcpServer = server;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcontainer.update();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport const McpServersGalleryEnabledContext = new RawContextKey<boolean>('mcpServersGalleryEnabled', false);\nexport const HasInstalledMcpServersContext = new RawContextKey<boolean>('hasInstalledMcpServers', true);\nexport const InstalledMcpServersViewId = 'workbench.views.mcp.installed';\nexport const mcpServerIcon = registerIcon('mcp-server', Codicon.mcp, localize('mcpServer', 'Icon used for the MCP server.'));\n\nexport namespace McpResourceURI {\n\texport const scheme = 'mcp-resource';\n\n\t// Random placeholder for empty authorities, otherwise they're represente as\n\t// `scheme//path/here` in the URI which would get normalized to `scheme/path/here`.\n\tconst emptyAuthorityPlaceholder = 'dylo78gyp'; // chosen by a fair dice roll. Guaranteed to be random.\n\n\texport function fromServer(def: McpDefinitionReference, resourceURI: URI | string): URI {\n\t\tif (typeof resourceURI === 'string') {\n\t\t\tresourceURI = URI.parse(resourceURI);\n\t\t}\n\t\treturn resourceURI.with({\n\t\t\tscheme,\n\t\t\tauthority: encodeHex(VSBuffer.fromString(def.id)),\n\t\t\tpath: ['', resourceURI.scheme, resourceURI.authority || emptyAuthorityPlaceholder].join('/') + resourceURI.path,\n\t\t});\n\t}\n\n\texport function toServer(uri: URI | string): { definitionId: string; resourceURL: URL } {\n\t\tif (typeof uri === 'string') {\n\t\t\turi = URI.parse(uri);\n\t\t}\n\t\tif (uri.scheme !== scheme) {\n\t\t\tthrow new Error(`Invalid MCP resource URI: ${uri.toString()}`);\n\t\t}\n\t\tconst parts = uri.path.split('/');\n\t\tif (parts.length < 3) {\n\t\t\tthrow new Error(`Invalid MCP resource URI: ${uri.toString()}`);\n\t\t}\n\t\tconst [, serverScheme, authority, ...path] = parts;\n\n\t\t// URI cannot correctly stringify empty authorities (#250905) so we use URL instead to construct\n\t\tconst url = new URL(`${serverScheme}://${authority.toLowerCase() === emptyAuthorityPlaceholder ? '' : authority}`);\n\t\turl.pathname = path.length ? ('/' + path.join('/')) : '';\n\t\turl.search = uri.query;\n\t\turl.hash = uri.fragment;\n\n\t\treturn {\n\t\t\tdefinitionId: decodeHex(uri.authority).toString(),\n\t\t\tresourceURL: url,\n\t\t};\n\t}\n\n}\n\n/** Warning: this enum is cached in `mcpServer.ts` and all changes MUST only be additive. */\nexport const enum McpCapability {\n\tLogging = 1 << 0,\n\tCompletions = 1 << 1,\n\tPrompts = 1 << 2,\n\tPromptsListChanged = 1 << 3,\n\tResources = 1 << 4,\n\tResourcesSubscribe = 1 << 5,\n\tResourcesListChanged = 1 << 6,\n\tTools = 1 << 7,\n\tToolsListChanged = 1 << 8,\n}\n\nexport interface ISamplingOptions {\n\tserver: IMcpServer;\n\tisDuringToolCall: boolean;\n\tparams: MCP.CreateMessageRequest['params'];\n}\n\nexport interface ISamplingResult {\n\tsample: MCP.CreateMessageResult;\n}\n\nexport interface IMcpSamplingService {\n\t_serviceBrand: undefined;\n\n\tsample(opts: ISamplingOptions): Promise<ISamplingResult>;\n\n\t/** Whether MCP sampling logs are available for this server */\n\thasLogs(server: IMcpServer): boolean;\n\t/** Gets a text report of the MCP server's sampling usage */\n\tgetLogText(server: IMcpServer): string;\n\n\tgetConfig(server: IMcpServer): IMcpServerSamplingConfiguration;\n\tupdateConfig(server: IMcpServer, mutate: (r: IMcpServerSamplingConfiguration) => unknown): Promise<IMcpServerSamplingConfiguration>;\n}\n\nexport const IMcpSamplingService = createDecorator<IMcpSamplingService>('IMcpServerSampling');\n\nexport class McpError extends Error {\n\tpublic static methodNotFound(method: string) {\n\t\treturn new McpError(MCP.METHOD_NOT_FOUND, `Method not found: ${method}`);\n\t}\n\n\tpublic static notAllowed() {\n\t\treturn new McpError(-32000, 'The user has denied permission to call this method.');\n\t}\n\n\tpublic static unknown(e: Error) {\n\t\tconst mcpError = new McpError(MCP.INTERNAL_ERROR, `Unknown error: ${e.stack}`);\n\t\tmcpError.cause = e;\n\t\treturn mcpError;\n\t}\n\n\tconstructor(\n\t\tpublic readonly code: number,\n\t\tmessage: string,\n\t\tpublic readonly data?: unknown\n\t) {\n\t\tsuper(message);\n\t}\n}\n\nexport const enum McpToolName {\n\tPrefix = 'mcp_',\n\tMaxPrefixLen = 18,\n\tMaxLength = 64,\n}\n\n\nexport interface IMcpElicitationService {\n\t_serviceBrand: undefined;\n\n\t/**\n\t * Elicits a response from the user. The `context` is optional and can be used\n\t * to provide additional information about the request.\n\t *\n\t * @param context Context for the elicitation, e.g. chat session ID.\n\t * @param elicitation Request to elicit a response.\n\t * @returns A promise that resolves to an {@link ElicitationResult}.\n\t */\n\telicit(server: IMcpServer, context: IMcpToolCallContext | undefined, elicitation: MCP.ElicitRequest['params'], token: CancellationToken): Promise<MCP.ElicitResult>;\n}\n\nexport const IMcpElicitationService = createDecorator<IMcpElicitationService>('IMcpElicitationService');\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type * as vscode from 'vscode';\nimport { asArray, coalesce, isNonEmptyArray } from '../../../base/common/arrays.js';\nimport { VSBuffer, encodeBase64 } from '../../../base/common/buffer.js';\nimport { IDataTransferFile, IDataTransferItem, UriList } from '../../../base/common/dataTransfer.js';\nimport { createSingleCallFunction } from '../../../base/common/functional.js';\nimport * as htmlContent from '../../../base/common/htmlContent.js';\nimport { DisposableStore } from '../../../base/common/lifecycle.js';\nimport { ResourceMap, ResourceSet } from '../../../base/common/map.js';\nimport * as marked from '../../../base/common/marked/marked.js';\nimport { parse, revive } from '../../../base/common/marshalling.js';\nimport { MarshalledId } from '../../../base/common/marshallingIds.js';\nimport { Mimes } from '../../../base/common/mime.js';\nimport { cloneAndChange } from '../../../base/common/objects.js';\nimport { IPrefixTreeNode, WellDefinedPrefixTree } from '../../../base/common/prefixTree.js';\nimport { basename } from '../../../base/common/resources.js';\nimport { ThemeIcon } from '../../../base/common/themables.js';\nimport { isDefined, isEmptyObject, isNumber, isString, isUndefinedOrNull } from '../../../base/common/types.js';\nimport { URI, UriComponents, isUriComponents } from '../../../base/common/uri.js';\nimport { IURITransformer } from '../../../base/common/uriIpc.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { RenderLineNumbersType } from '../../../editor/common/config/editorOptions.js';\nimport { IPosition } from '../../../editor/common/core/position.js';\nimport * as editorRange from '../../../editor/common/core/range.js';\nimport { ISelection } from '../../../editor/common/core/selection.js';\nimport { IContentDecorationRenderOptions, IDecorationOptions, IDecorationRenderOptions, IThemeDecorationRenderOptions } from '../../../editor/common/editorCommon.js';\nimport * as encodedTokenAttributes from '../../../editor/common/encodedTokenAttributes.js';\nimport * as languageSelector from '../../../editor/common/languageSelector.js';\nimport * as languages from '../../../editor/common/languages.js';\nimport { EndOfLineSequence, TrackedRangeStickiness } from '../../../editor/common/model.js';\nimport { ITextEditorOptions } from '../../../platform/editor/common/editor.js';\nimport { IExtensionDescription, IRelaxedExtensionDescription } from '../../../platform/extensions/common/extensions.js';\nimport { IMarkerData, IRelatedInformation, MarkerSeverity, MarkerTag } from '../../../platform/markers/common/markers.js';\nimport { ProgressLocation as MainProgressLocation } from '../../../platform/progress/common/progress.js';\nimport { DEFAULT_EDITOR_ASSOCIATION, SaveReason } from '../../common/editor.js';\nimport { IViewBadge } from '../../common/views.js';\nimport { IChatAgentRequest, IChatAgentResult } from '../../contrib/chat/common/chatAgents.js';\nimport { IChatRequestDraft } from '../../contrib/chat/common/chatEditingService.js';\nimport { IChatRequestVariableEntry, isImageVariableEntry } from '../../contrib/chat/common/chatVariableEntries.js';\nimport { IChatAgentMarkdownContentWithVulnerability, IChatCodeCitation, IChatCommandButton, IChatConfirmation, IChatContentInlineReference, IChatContentReference, IChatExtensionsContent, IChatFollowup, IChatMarkdownContent, IChatMoveMessage, IChatPrepareToolInvocationPart, IChatProgressMessage, IChatResponseCodeblockUriPart, IChatTaskDto, IChatTaskResult, IChatTextEdit, IChatTreeData, IChatUserActionEvent, IChatWarningMessage } from '../../contrib/chat/common/chatService.js';\nimport { IToolData, IToolResult } from '../../contrib/chat/common/languageModelToolsService.js';\nimport * as chatProvider from '../../contrib/chat/common/languageModels.js';\nimport { IChatMessageDataPart, IChatResponseDataPart, IChatResponsePromptTsxPart, IChatResponseTextPart } from '../../contrib/chat/common/languageModels.js';\nimport { DebugTreeItemCollapsibleState, IDebugVisualizationTreeItem } from '../../contrib/debug/common/debug.js';\nimport * as notebooks from '../../contrib/notebook/common/notebookCommon.js';\nimport { CellEditType } from '../../contrib/notebook/common/notebookCommon.js';\nimport { ICellRange } from '../../contrib/notebook/common/notebookRange.js';\nimport * as search from '../../contrib/search/common/search.js';\nimport { TestId } from '../../contrib/testing/common/testId.js';\nimport { CoverageDetails, DetailType, ICoverageCount, IFileCoverage, ISerializedTestResults, ITestErrorMessage, ITestItem, ITestRunProfileReference, ITestTag, TestMessageType, TestResultItem, TestRunProfileBitset, denamespaceTestTag, namespaceTestTag } from '../../contrib/testing/common/testTypes.js';\nimport { EditorGroupColumn } from '../../services/editor/common/editorGroupColumn.js';\nimport { ACTIVE_GROUP, SIDE_GROUP } from '../../services/editor/common/editorService.js';\nimport { checkProposedApiEnabled, isProposedApiEnabled } from '../../services/extensions/common/extensions.js';\nimport { Dto, SerializableObjectWithBuffers } from '../../services/extensions/common/proxyIdentifier.js';\nimport * as extHostProtocol from './extHost.protocol.js';\nimport { CommandsConverter } from './extHostCommands.js';\nimport { getPrivateApiFor } from './extHostTestingPrivateApi.js';\nimport * as types from './extHostTypes.js';\nimport { LanguageModelDataPart, LanguageModelPromptTsxPart, LanguageModelTextPart } from './extHostTypes.js';\nimport { ChatAgentLocation } from '../../contrib/chat/common/constants.js';\nimport { AiSettingsSearchResult, AiSettingsSearchResultKind } from '../../services/aiSettingsSearch/common/aiSettingsSearch.js';\nimport { McpServerLaunch, McpServerTransportType } from '../../contrib/mcp/common/mcpTypes.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\n\nexport namespace Command {\n\n\texport interface ICommandsConverter {\n\t\tfromInternal(command: extHostProtocol.ICommandDto): vscode.Command | undefined;\n\t\ttoInternal(command: vscode.Command | undefined, disposables: DisposableStore): extHostProtocol.ICommandDto | undefined;\n\t}\n}\n\nexport interface PositionLike {\n\tline: number;\n\tcharacter: number;\n}\n\nexport interface RangeLike {\n\tstart: PositionLike;\n\tend: PositionLike;\n}\n\nexport interface SelectionLike extends RangeLike {\n\tanchor: PositionLike;\n\tactive: PositionLike;\n}\nexport namespace Selection {\n\n\texport function to(selection: ISelection): types.Selection {\n\t\tconst { selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn } = selection;\n\t\tconst start = new types.Position(selectionStartLineNumber - 1, selectionStartColumn - 1);\n\t\tconst end = new types.Position(positionLineNumber - 1, positionColumn - 1);\n\t\treturn new types.Selection(start, end);\n\t}\n\n\texport function from(selection: SelectionLike): ISelection {\n\t\tconst { anchor, active } = selection;\n\t\treturn {\n\t\t\tselectionStartLineNumber: anchor.line + 1,\n\t\t\tselectionStartColumn: anchor.character + 1,\n\t\t\tpositionLineNumber: active.line + 1,\n\t\t\tpositionColumn: active.character + 1\n\t\t};\n\t}\n}\nexport namespace Range {\n\n\texport function from(range: undefined): undefined;\n\texport function from(range: RangeLike): editorRange.IRange;\n\texport function from(range: RangeLike | undefined): editorRange.IRange | undefined;\n\texport function from(range: RangeLike | undefined): editorRange.IRange | undefined {\n\t\tif (!range) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst { start, end } = range;\n\t\treturn {\n\t\t\tstartLineNumber: start.line + 1,\n\t\t\tstartColumn: start.character + 1,\n\t\t\tendLineNumber: end.line + 1,\n\t\t\tendColumn: end.character + 1\n\t\t};\n\t}\n\n\texport function to(range: undefined): types.Range;\n\texport function to(range: editorRange.IRange): types.Range;\n\texport function to(range: editorRange.IRange | undefined): types.Range | undefined;\n\texport function to(range: editorRange.IRange | undefined): types.Range | undefined {\n\t\tif (!range) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst { startLineNumber, startColumn, endLineNumber, endColumn } = range;\n\t\treturn new types.Range(startLineNumber - 1, startColumn - 1, endLineNumber - 1, endColumn - 1);\n\t}\n}\n\nexport namespace Location {\n\n\texport function from(location: vscode.Location): Dto<languages.Location> {\n\t\treturn {\n\t\t\turi: location.uri,\n\t\t\trange: Range.from(location.range)\n\t\t};\n\t}\n\n\texport function to(location: Dto<languages.Location>): vscode.Location {\n\t\treturn new types.Location(URI.revive(location.uri), Range.to(location.range));\n\t}\n}\n\nexport namespace TokenType {\n\texport function to(type: encodedTokenAttributes.StandardTokenType): types.StandardTokenType {\n\t\tswitch (type) {\n\t\t\tcase encodedTokenAttributes.StandardTokenType.Comment: return types.StandardTokenType.Comment;\n\t\t\tcase encodedTokenAttributes.StandardTokenType.Other: return types.StandardTokenType.Other;\n\t\t\tcase encodedTokenAttributes.StandardTokenType.RegEx: return types.StandardTokenType.RegEx;\n\t\t\tcase encodedTokenAttributes.StandardTokenType.String: return types.StandardTokenType.String;\n\t\t}\n\t}\n}\n\nexport namespace Position {\n\texport function to(position: IPosition): types.Position {\n\t\treturn new types.Position(position.lineNumber - 1, position.column - 1);\n\t}\n\texport function from(position: types.Position | vscode.Position): IPosition {\n\t\treturn { lineNumber: position.line + 1, column: position.character + 1 };\n\t}\n}\n\nexport namespace DocumentSelector {\n\n\texport function from(value: vscode.DocumentSelector, uriTransformer?: IURITransformer, extension?: IExtensionDescription): extHostProtocol.IDocumentFilterDto[] {\n\t\treturn coalesce(asArray(value).map(sel => _doTransformDocumentSelector(sel, uriTransformer, extension)));\n\t}\n\n\tfunction _doTransformDocumentSelector(selector: string | vscode.DocumentFilter, uriTransformer: IURITransformer | undefined, extension: IExtensionDescription | undefined): extHostProtocol.IDocumentFilterDto | undefined {\n\t\tif (typeof selector === 'string') {\n\t\t\treturn {\n\t\t\t\t$serialized: true,\n\t\t\t\tlanguage: selector,\n\t\t\t\tisBuiltin: extension?.isBuiltin,\n\t\t\t};\n\t\t}\n\n\t\tif (selector) {\n\t\t\treturn {\n\t\t\t\t$serialized: true,\n\t\t\t\tlanguage: selector.language,\n\t\t\t\tscheme: _transformScheme(selector.scheme, uriTransformer),\n\t\t\t\tpattern: GlobPattern.from(selector.pattern) ?? undefined,\n\t\t\t\texclusive: selector.exclusive,\n\t\t\t\tnotebookType: selector.notebookType,\n\t\t\t\tisBuiltin: extension?.isBuiltin\n\t\t\t};\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tfunction _transformScheme(scheme: string | undefined, uriTransformer: IURITransformer | undefined): string | undefined {\n\t\tif (uriTransformer && typeof scheme === 'string') {\n\t\t\treturn uriTransformer.transformOutgoingScheme(scheme);\n\t\t}\n\t\treturn scheme;\n\t}\n}\n\nexport namespace DiagnosticTag {\n\texport function from(value: vscode.DiagnosticTag): MarkerTag | undefined {\n\t\tswitch (value) {\n\t\t\tcase types.DiagnosticTag.Unnecessary:\n\t\t\t\treturn MarkerTag.Unnecessary;\n\t\t\tcase types.DiagnosticTag.Deprecated:\n\t\t\t\treturn MarkerTag.Deprecated;\n\t\t}\n\t\treturn undefined;\n\t}\n\texport function to(value: MarkerTag): vscode.DiagnosticTag | undefined {\n\t\tswitch (value) {\n\t\t\tcase MarkerTag.Unnecessary:\n\t\t\t\treturn types.DiagnosticTag.Unnecessary;\n\t\t\tcase MarkerTag.Deprecated:\n\t\t\t\treturn types.DiagnosticTag.Deprecated;\n\t\t\tdefault:\n\t\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\nexport namespace Diagnostic {\n\texport function from(value: vscode.Diagnostic): IMarkerData {\n\t\tlet code: string | { value: string; target: URI } | undefined;\n\n\t\tif (value.code) {\n\t\t\tif (isString(value.code) || isNumber(value.code)) {\n\t\t\t\tcode = String(value.code);\n\t\t\t} else {\n\t\t\t\tcode = {\n\t\t\t\t\tvalue: String(value.code.value),\n\t\t\t\t\ttarget: value.code.target,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t...Range.from(value.range),\n\t\t\tmessage: value.message,\n\t\t\tsource: value.source,\n\t\t\tcode,\n\t\t\tseverity: DiagnosticSeverity.from(value.severity),\n\t\t\trelatedInformation: value.relatedInformation && value.relatedInformation.map(DiagnosticRelatedInformation.from),\n\t\t\ttags: Array.isArray(value.tags) ? coalesce(value.tags.map(DiagnosticTag.from)) : undefined,\n\t\t};\n\t}\n\n\texport function to(value: IMarkerData): vscode.Diagnostic {\n\t\tconst res = new types.Diagnostic(Range.to(value), value.message, DiagnosticSeverity.to(value.severity));\n\t\tres.source = value.source;\n\t\tres.code = isString(value.code) ? value.code : value.code?.value;\n\t\tres.relatedInformation = value.relatedInformation && value.relatedInformation.map(DiagnosticRelatedInformation.to);\n\t\tres.tags = value.tags && coalesce(value.tags.map(DiagnosticTag.to));\n\t\treturn res;\n\t}\n}\n\nexport namespace DiagnosticRelatedInformation {\n\texport function from(value: vscode.DiagnosticRelatedInformation): IRelatedInformation {\n\t\treturn {\n\t\t\t...Range.from(value.location.range),\n\t\t\tmessage: value.message,\n\t\t\tresource: value.location.uri\n\t\t};\n\t}\n\texport function to(value: IRelatedInformation): types.DiagnosticRelatedInformation {\n\t\treturn new types.DiagnosticRelatedInformation(new types.Location(value.resource, Range.to(value)), value.message);\n\t}\n}\nexport namespace DiagnosticSeverity {\n\n\texport function from(value: number): MarkerSeverity {\n\t\tswitch (value) {\n\t\t\tcase types.DiagnosticSeverity.Error:\n\t\t\t\treturn MarkerSeverity.Error;\n\t\t\tcase types.DiagnosticSeverity.Warning:\n\t\t\t\treturn MarkerSeverity.Warning;\n\t\t\tcase types.DiagnosticSeverity.Information:\n\t\t\t\treturn MarkerSeverity.Info;\n\t\t\tcase types.DiagnosticSeverity.Hint:\n\t\t\t\treturn MarkerSeverity.Hint;\n\t\t}\n\t\treturn MarkerSeverity.Error;\n\t}\n\n\texport function to(value: MarkerSeverity): types.DiagnosticSeverity {\n\t\tswitch (value) {\n\t\t\tcase MarkerSeverity.Info:\n\t\t\t\treturn types.DiagnosticSeverity.Information;\n\t\t\tcase MarkerSeverity.Warning:\n\t\t\t\treturn types.DiagnosticSeverity.Warning;\n\t\t\tcase MarkerSeverity.Error:\n\t\t\t\treturn types.DiagnosticSeverity.Error;\n\t\t\tcase MarkerSeverity.Hint:\n\t\t\t\treturn types.DiagnosticSeverity.Hint;\n\t\t\tdefault:\n\t\t\t\treturn types.DiagnosticSeverity.Error;\n\t\t}\n\t}\n}\n\nexport namespace ViewColumn {\n\texport function from(column?: vscode.ViewColumn): EditorGroupColumn {\n\t\tif (typeof column === 'number' && column >= types.ViewColumn.One) {\n\t\t\treturn column - 1; // adjust zero index (ViewColumn.ONE => 0)\n\t\t}\n\n\t\tif (column === types.ViewColumn.Beside) {\n\t\t\treturn SIDE_GROUP;\n\t\t}\n\n\t\treturn ACTIVE_GROUP; // default is always the active group\n\t}\n\n\texport function to(position: EditorGroupColumn): vscode.ViewColumn {\n\t\tif (typeof position === 'number' && position >= 0) {\n\t\t\treturn position + 1; // adjust to index (ViewColumn.ONE => 1)\n\t\t}\n\n\t\tthrow new Error(`invalid 'EditorGroupColumn'`);\n\t}\n}\n\nfunction isDecorationOptions(something: any): something is vscode.DecorationOptions {\n\treturn (typeof something.range !== 'undefined');\n}\n\nexport function isDecorationOptionsArr(something: vscode.Range[] | vscode.DecorationOptions[]): something is vscode.DecorationOptions[] {\n\tif (something.length === 0) {\n\t\treturn true;\n\t}\n\treturn isDecorationOptions(something[0]) ? true : false;\n}\n\nexport namespace MarkdownString {\n\n\texport function fromMany(markup: (vscode.MarkdownString | vscode.MarkedString)[]): htmlContent.IMarkdownString[] {\n\t\treturn markup.map(MarkdownString.from);\n\t}\n\n\tinterface Codeblock {\n\t\tlanguage: string;\n\t\tvalue: string;\n\t}\n\n\tfunction isCodeblock(thing: any): thing is Codeblock {\n\t\treturn thing && typeof thing === 'object'\n\t\t\t&& typeof (<Codeblock>thing).language === 'string'\n\t\t\t&& typeof (<Codeblock>thing).value === 'string';\n\t}\n\n\texport function from(markup: vscode.MarkdownString | vscode.MarkedString): htmlContent.IMarkdownString {\n\t\tlet res: htmlContent.IMarkdownString;\n\t\tif (isCodeblock(markup)) {\n\t\t\tconst { language, value } = markup;\n\t\t\tres = { value: '```' + language + '\\n' + value + '\\n```\\n' };\n\t\t} else if (types.MarkdownString.isMarkdownString(markup)) {\n\t\t\tres = { value: markup.value, isTrusted: markup.isTrusted, supportThemeIcons: markup.supportThemeIcons, supportHtml: markup.supportHtml, baseUri: markup.baseUri };\n\t\t} else if (typeof markup === 'string') {\n\t\t\tres = { value: markup };\n\t\t} else {\n\t\t\tres = { value: '' };\n\t\t}\n\n\t\t// extract uris into a separate object\n\t\tconst resUris: { [href: string]: UriComponents } = Object.create(null);\n\t\tres.uris = resUris;\n\n\t\tconst collectUri = ({ href }: { href: string }): string => {\n\t\t\ttry {\n\t\t\t\tlet uri = URI.parse(href, true);\n\t\t\t\turi = uri.with({ query: _uriMassage(uri.query, resUris) });\n\t\t\t\tresUris[href] = uri;\n\t\t\t} catch (e) {\n\t\t\t\t// ignore\n\t\t\t}\n\t\t\treturn '';\n\t\t};\n\n\t\tmarked.marked.walkTokens(marked.marked.lexer(res.value), token => {\n\t\t\tif (token.type === 'link') {\n\t\t\t\tcollectUri({ href: token.href });\n\t\t\t} else if (token.type === 'image') {\n\t\t\t\tif (typeof token.href === 'string') {\n\t\t\t\t\tcollectUri(htmlContent.parseHrefAndDimensions(token.href));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn res;\n\t}\n\n\tfunction _uriMassage(part: string, bucket: { [n: string]: UriComponents }): string {\n\t\tif (!part) {\n\t\t\treturn part;\n\t\t}\n\t\tlet data: unknown;\n\t\ttry {\n\t\t\tdata = parse(part);\n\t\t} catch (e) {\n\t\t\t// ignore\n\t\t}\n\t\tif (!data) {\n\t\t\treturn part;\n\t\t}\n\t\tlet changed = false;\n\t\tdata = cloneAndChange(data, value => {\n\t\t\tif (URI.isUri(value)) {\n\t\t\t\tconst key = `__uri_${Math.random().toString(16).slice(2, 8)}`;\n\t\t\t\tbucket[key] = value;\n\t\t\t\tchanged = true;\n\t\t\t\treturn key;\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\n\t\tif (!changed) {\n\t\t\treturn part;\n\t\t}\n\n\t\treturn JSON.stringify(data);\n\t}\n\n\texport function to(value: htmlContent.IMarkdownString): vscode.MarkdownString {\n\t\tconst result = new types.MarkdownString(value.value, value.supportThemeIcons);\n\t\tresult.isTrusted = value.isTrusted;\n\t\tresult.supportHtml = value.supportHtml;\n\t\tresult.baseUri = value.baseUri ? URI.from(value.baseUri) : undefined;\n\t\treturn result;\n\t}\n\n\texport function fromStrict(value: string | vscode.MarkdownString | undefined | null): undefined | string | htmlContent.IMarkdownString {\n\t\tif (!value) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn typeof value === 'string' ? value : MarkdownString.from(value);\n\t}\n}\n\nexport function fromRangeOrRangeWithMessage(ranges: vscode.Range[] | vscode.DecorationOptions[]): IDecorationOptions[] {\n\tif (isDecorationOptionsArr(ranges)) {\n\t\treturn ranges.map((r): IDecorationOptions => {\n\t\t\treturn {\n\t\t\t\trange: Range.from(r.range),\n\t\t\t\thoverMessage: Array.isArray(r.hoverMessage)\n\t\t\t\t\t? MarkdownString.fromMany(r.hoverMessage)\n\t\t\t\t\t: (r.hoverMessage ? MarkdownString.from(r.hoverMessage) : undefined),\n\t\t\t\trenderOptions: <any> /* URI vs Uri */r.renderOptions\n\t\t\t};\n\t\t});\n\t} else {\n\t\treturn ranges.map((r): IDecorationOptions => {\n\t\t\treturn {\n\t\t\t\trange: Range.from(r)\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport function pathOrURIToURI(value: string | URI): URI {\n\tif (typeof value === 'undefined') {\n\t\treturn value;\n\t}\n\tif (typeof value === 'string') {\n\t\treturn URI.file(value);\n\t} else {\n\t\treturn value;\n\t}\n}\n\nexport namespace ThemableDecorationAttachmentRenderOptions {\n\texport function from(options: vscode.ThemableDecorationAttachmentRenderOptions): IContentDecorationRenderOptions {\n\t\tif (typeof options === 'undefined') {\n\t\t\treturn options;\n\t\t}\n\t\treturn {\n\t\t\tcontentText: options.contentText,\n\t\t\tcontentIconPath: options.contentIconPath ? pathOrURIToURI(options.contentIconPath) : undefined,\n\t\t\tborder: options.border,\n\t\t\tborderColor: <string | types.ThemeColor>options.borderColor,\n\t\t\tfontStyle: options.fontStyle,\n\t\t\tfontWeight: options.fontWeight,\n\t\t\ttextDecoration: options.textDecoration,\n\t\t\tcolor: <string | types.ThemeColor>options.color,\n\t\t\tbackgroundColor: <string | types.ThemeColor>options.backgroundColor,\n\t\t\tmargin: options.margin,\n\t\t\twidth: options.width,\n\t\t\theight: options.height,\n\t\t};\n\t}\n}\n\nexport namespace ThemableDecorationRenderOptions {\n\texport function from(options: vscode.ThemableDecorationRenderOptions): IThemeDecorationRenderOptions {\n\t\tif (typeof options === 'undefined') {\n\t\t\treturn options;\n\t\t}\n\t\treturn {\n\t\t\tbackgroundColor: <string | types.ThemeColor>options.backgroundColor,\n\t\t\toutline: options.outline,\n\t\t\toutlineColor: <string | types.ThemeColor>options.outlineColor,\n\t\t\toutlineStyle: options.outlineStyle,\n\t\t\toutlineWidth: options.outlineWidth,\n\t\t\tborder: options.border,\n\t\t\tborderColor: <string | types.ThemeColor>options.borderColor,\n\t\t\tborderRadius: options.borderRadius,\n\t\t\tborderSpacing: options.borderSpacing,\n\t\t\tborderStyle: options.borderStyle,\n\t\t\tborderWidth: options.borderWidth,\n\t\t\tfontStyle: options.fontStyle,\n\t\t\tfontWeight: options.fontWeight,\n\t\t\ttextDecoration: options.textDecoration,\n\t\t\tcursor: options.cursor,\n\t\t\tcolor: <string | types.ThemeColor>options.color,\n\t\t\topacity: options.opacity,\n\t\t\tletterSpacing: options.letterSpacing,\n\t\t\tgutterIconPath: options.gutterIconPath ? pathOrURIToURI(options.gutterIconPath) : undefined,\n\t\t\tgutterIconSize: options.gutterIconSize,\n\t\t\toverviewRulerColor: <string | types.ThemeColor>options.overviewRulerColor,\n\t\t\tbefore: options.before ? ThemableDecorationAttachmentRenderOptions.from(options.before) : undefined,\n\t\t\tafter: options.after ? ThemableDecorationAttachmentRenderOptions.from(options.after) : undefined,\n\t\t};\n\t}\n}\n\nexport namespace DecorationRangeBehavior {\n\texport function from(value: types.DecorationRangeBehavior): TrackedRangeStickiness {\n\t\tif (typeof value === 'undefined') {\n\t\t\treturn value;\n\t\t}\n\t\tswitch (value) {\n\t\t\tcase types.DecorationRangeBehavior.OpenOpen:\n\t\t\t\treturn TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges;\n\t\t\tcase types.DecorationRangeBehavior.ClosedClosed:\n\t\t\t\treturn TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;\n\t\t\tcase types.DecorationRangeBehavior.OpenClosed:\n\t\t\t\treturn TrackedRangeStickiness.GrowsOnlyWhenTypingBefore;\n\t\t\tcase types.DecorationRangeBehavior.ClosedOpen:\n\t\t\t\treturn TrackedRangeStickiness.GrowsOnlyWhenTypingAfter;\n\t\t}\n\t}\n}\n\nexport namespace DecorationRenderOptions {\n\texport function from(options: vscode.DecorationRenderOptions): IDecorationRenderOptions {\n\t\treturn {\n\t\t\tisWholeLine: options.isWholeLine,\n\t\t\trangeBehavior: options.rangeBehavior ? DecorationRangeBehavior.from(options.rangeBehavior) : undefined,\n\t\t\toverviewRulerLane: options.overviewRulerLane,\n\t\t\tlight: options.light ? ThemableDecorationRenderOptions.from(options.light) : undefined,\n\t\t\tdark: options.dark ? ThemableDecorationRenderOptions.from(options.dark) : undefined,\n\n\t\t\tbackgroundColor: <string | types.ThemeColor>options.backgroundColor,\n\t\t\toutline: options.outline,\n\t\t\toutlineColor: <string | types.ThemeColor>options.outlineColor,\n\t\t\toutlineStyle: options.outlineStyle,\n\t\t\toutlineWidth: options.outlineWidth,\n\t\t\tborder: options.border,\n\t\t\tborderColor: <string | types.ThemeColor>options.borderColor,\n\t\t\tborderRadius: options.borderRadius,\n\t\t\tborderSpacing: options.borderSpacing,\n\t\t\tborderStyle: options.borderStyle,\n\t\t\tborderWidth: options.borderWidth,\n\t\t\tfontStyle: options.fontStyle,\n\t\t\tfontWeight: options.fontWeight,\n\t\t\ttextDecoration: options.textDecoration,\n\t\t\tcursor: options.cursor,\n\t\t\tcolor: <string | types.ThemeColor>options.color,\n\t\t\topacity: options.opacity,\n\t\t\tletterSpacing: options.letterSpacing,\n\t\t\tgutterIconPath: options.gutterIconPath ? pathOrURIToURI(options.gutterIconPath) : undefined,\n\t\t\tgutterIconSize: options.gutterIconSize,\n\t\t\toverviewRulerColor: <string | types.ThemeColor>options.overviewRulerColor,\n\t\t\tbefore: options.before ? ThemableDecorationAttachmentRenderOptions.from(options.before) : undefined,\n\t\t\tafter: options.after ? ThemableDecorationAttachmentRenderOptions.from(options.after) : undefined,\n\t\t};\n\t}\n}\n\nexport namespace TextEdit {\n\n\texport function from(edit: vscode.TextEdit): languages.TextEdit {\n\t\treturn {\n\t\t\ttext: edit.newText,\n\t\t\teol: edit.newEol && EndOfLine.from(edit.newEol),\n\t\t\trange: Range.from(edit.range)\n\t\t};\n\t}\n\n\texport function to(edit: languages.TextEdit): types.TextEdit {\n\t\tconst result = new types.TextEdit(Range.to(edit.range), edit.text);\n\t\tresult.newEol = (typeof edit.eol === 'undefined' ? undefined : EndOfLine.to(edit.eol))!;\n\t\treturn result;\n\t}\n}\n\nexport namespace WorkspaceEdit {\n\n\texport interface IVersionInformationProvider {\n\t\tgetTextDocumentVersion(uri: URI): number | undefined;\n\t\tgetNotebookDocumentVersion(uri: URI): number | undefined;\n\t}\n\n\texport function from(value: vscode.WorkspaceEdit, versionInfo?: IVersionInformationProvider): extHostProtocol.IWorkspaceEditDto {\n\t\tconst result: extHostProtocol.IWorkspaceEditDto = {\n\t\t\tedits: []\n\t\t};\n\n\t\tif (value instanceof types.WorkspaceEdit) {\n\n\t\t\t// collect all files that are to be created so that their version\n\t\t\t// information (in case they exist as text model already) can be ignored\n\t\t\tconst toCreate = new ResourceSet();\n\t\t\tfor (const entry of value._allEntries()) {\n\t\t\t\tif (entry._type === types.FileEditType.File && URI.isUri(entry.to) && entry.from === undefined) {\n\t\t\t\t\ttoCreate.add(entry.to);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const entry of value._allEntries()) {\n\n\t\t\t\tif (entry._type === types.FileEditType.File) {\n\t\t\t\t\tlet contents: { type: 'base64'; value: string } | { type: 'dataTransferItem'; id: string } | undefined;\n\t\t\t\t\tif (entry.options?.contents) {\n\t\t\t\t\t\tif (ArrayBuffer.isView(entry.options.contents)) {\n\t\t\t\t\t\t\tcontents = { type: 'base64', value: encodeBase64(VSBuffer.wrap(entry.options.contents)) };\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcontents = { type: 'dataTransferItem', id: (entry.options.contents as types.DataTransferFile)._itemId };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// file operation\n\t\t\t\t\tresult.edits.push({\n\t\t\t\t\t\toldResource: entry.from,\n\t\t\t\t\t\tnewResource: entry.to,\n\t\t\t\t\t\toptions: { ...entry.options, contents },\n\t\t\t\t\t\tmetadata: entry.metadata\n\t\t\t\t\t});\n\n\t\t\t\t} else if (entry._type === types.FileEditType.Text) {\n\t\t\t\t\t// text edits\n\t\t\t\t\tresult.edits.push({\n\t\t\t\t\t\tresource: entry.uri,\n\t\t\t\t\t\ttextEdit: TextEdit.from(entry.edit),\n\t\t\t\t\t\tversionId: !toCreate.has(entry.uri) ? versionInfo?.getTextDocumentVersion(entry.uri) : undefined,\n\t\t\t\t\t\tmetadata: entry.metadata\n\t\t\t\t\t});\n\t\t\t\t} else if (entry._type === types.FileEditType.Snippet) {\n\t\t\t\t\tresult.edits.push({\n\t\t\t\t\t\tresource: entry.uri,\n\t\t\t\t\t\ttextEdit: {\n\t\t\t\t\t\t\trange: Range.from(entry.range),\n\t\t\t\t\t\t\ttext: entry.edit.value,\n\t\t\t\t\t\t\tinsertAsSnippet: true,\n\t\t\t\t\t\t\tkeepWhitespace: entry.keepWhitespace\n\t\t\t\t\t\t},\n\t\t\t\t\t\tversionId: !toCreate.has(entry.uri) ? versionInfo?.getTextDocumentVersion(entry.uri) : undefined,\n\t\t\t\t\t\tmetadata: entry.metadata\n\t\t\t\t\t});\n\n\t\t\t\t} else if (entry._type === types.FileEditType.Cell) {\n\t\t\t\t\t// cell edit\n\t\t\t\t\tresult.edits.push({\n\t\t\t\t\t\tmetadata: entry.metadata,\n\t\t\t\t\t\tresource: entry.uri,\n\t\t\t\t\t\tcellEdit: entry.edit,\n\t\t\t\t\t\tnotebookVersionId: versionInfo?.getNotebookDocumentVersion(entry.uri)\n\t\t\t\t\t});\n\n\t\t\t\t} else if (entry._type === types.FileEditType.CellReplace) {\n\t\t\t\t\t// cell replace\n\t\t\t\t\tresult.edits.push({\n\t\t\t\t\t\tmetadata: entry.metadata,\n\t\t\t\t\t\tresource: entry.uri,\n\t\t\t\t\t\tnotebookVersionId: versionInfo?.getNotebookDocumentVersion(entry.uri),\n\t\t\t\t\t\tcellEdit: {\n\t\t\t\t\t\t\teditType: notebooks.CellEditType.Replace,\n\t\t\t\t\t\t\tindex: entry.index,\n\t\t\t\t\t\t\tcount: entry.count,\n\t\t\t\t\t\t\tcells: entry.cells.map(NotebookCellData.from)\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\texport function to(value: extHostProtocol.IWorkspaceEditDto) {\n\t\tconst result = new types.WorkspaceEdit();\n\t\tconst edits = new ResourceMap<(types.TextEdit | types.SnippetTextEdit)[]>();\n\t\tfor (const edit of value.edits) {\n\t\t\tif ((<extHostProtocol.IWorkspaceTextEditDto>edit).textEdit) {\n\n\t\t\t\tconst item = <extHostProtocol.IWorkspaceTextEditDto>edit;\n\t\t\t\tconst uri = URI.revive(item.resource);\n\t\t\t\tconst range = Range.to(item.textEdit.range);\n\t\t\t\tconst text = item.textEdit.text;\n\t\t\t\tconst isSnippet = item.textEdit.insertAsSnippet;\n\n\t\t\t\tlet editOrSnippetTest: types.TextEdit | types.SnippetTextEdit;\n\t\t\t\tif (isSnippet) {\n\t\t\t\t\teditOrSnippetTest = types.SnippetTextEdit.replace(range, new types.SnippetString(text));\n\t\t\t\t} else {\n\t\t\t\t\teditOrSnippetTest = types.TextEdit.replace(range, text);\n\t\t\t\t}\n\n\t\t\t\tconst array = edits.get(uri);\n\t\t\t\tif (!array) {\n\t\t\t\t\tedits.set(uri, [editOrSnippetTest]);\n\t\t\t\t} else {\n\t\t\t\t\tarray.push(editOrSnippetTest);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tresult.renameFile(\n\t\t\t\t\tURI.revive((<extHostProtocol.IWorkspaceFileEditDto>edit).oldResource!),\n\t\t\t\t\tURI.revive((<extHostProtocol.IWorkspaceFileEditDto>edit).newResource!),\n\t\t\t\t\t(<extHostProtocol.IWorkspaceFileEditDto>edit).options\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [uri, array] of edits) {\n\t\t\tresult.set(uri, array);\n\t\t}\n\t\treturn result;\n\t}\n}\n\n\nexport namespace SymbolKind {\n\n\tconst _fromMapping: { [kind: number]: languages.SymbolKind } = Object.create(null);\n\t_fromMapping[types.SymbolKind.File] = languages.SymbolKind.File;\n\t_fromMapping[types.SymbolKind.Module] = languages.SymbolKind.Module;\n\t_fromMapping[types.SymbolKind.Namespace] = languages.SymbolKind.Namespace;\n\t_fromMapping[types.SymbolKind.Package] = languages.SymbolKind.Package;\n\t_fromMapping[types.SymbolKind.Class] = languages.SymbolKind.Class;\n\t_fromMapping[types.SymbolKind.Method] = languages.SymbolKind.Method;\n\t_fromMapping[types.SymbolKind.Property] = languages.SymbolKind.Property;\n\t_fromMapping[types.SymbolKind.Field] = languages.SymbolKind.Field;\n\t_fromMapping[types.SymbolKind.Constructor] = languages.SymbolKind.Constructor;\n\t_fromMapping[types.SymbolKind.Enum] = languages.SymbolKind.Enum;\n\t_fromMapping[types.SymbolKind.Interface] = languages.SymbolKind.Interface;\n\t_fromMapping[types.SymbolKind.Function] = languages.SymbolKind.Function;\n\t_fromMapping[types.SymbolKind.Variable] = languages.SymbolKind.Variable;\n\t_fromMapping[types.SymbolKind.Constant] = languages.SymbolKind.Constant;\n\t_fromMapping[types.SymbolKind.String] = languages.SymbolKind.String;\n\t_fromMapping[types.SymbolKind.Number] = languages.SymbolKind.Number;\n\t_fromMapping[types.SymbolKind.Boolean] = languages.SymbolKind.Boolean;\n\t_fromMapping[types.SymbolKind.Array] = languages.SymbolKind.Array;\n\t_fromMapping[types.SymbolKind.Object] = languages.SymbolKind.Object;\n\t_fromMapping[types.SymbolKind.Key] = languages.SymbolKind.Key;\n\t_fromMapping[types.SymbolKind.Null] = languages.SymbolKind.Null;\n\t_fromMapping[types.SymbolKind.EnumMember] = languages.SymbolKind.EnumMember;\n\t_fromMapping[types.SymbolKind.Struct] = languages.SymbolKind.Struct;\n\t_fromMapping[types.SymbolKind.Event] = languages.SymbolKind.Event;\n\t_fromMapping[types.SymbolKind.Operator] = languages.SymbolKind.Operator;\n\t_fromMapping[types.SymbolKind.TypeParameter] = languages.SymbolKind.TypeParameter;\n\n\texport function from(kind: vscode.SymbolKind): languages.SymbolKind {\n\t\treturn typeof _fromMapping[kind] === 'number' ? _fromMapping[kind] : languages.SymbolKind.Property;\n\t}\n\n\texport function to(kind: languages.SymbolKind): vscode.SymbolKind {\n\t\tfor (const k in _fromMapping) {\n\t\t\tif (_fromMapping[k] === kind) {\n\t\t\t\treturn Number(k);\n\t\t\t}\n\t\t}\n\t\treturn types.SymbolKind.Property;\n\t}\n}\n\nexport namespace SymbolTag {\n\n\texport function from(kind: types.SymbolTag): languages.SymbolTag {\n\t\tswitch (kind) {\n\t\t\tcase types.SymbolTag.Deprecated: return languages.SymbolTag.Deprecated;\n\t\t}\n\t}\n\n\texport function to(kind: languages.SymbolTag): types.SymbolTag {\n\t\tswitch (kind) {\n\t\t\tcase languages.SymbolTag.Deprecated: return types.SymbolTag.Deprecated;\n\t\t}\n\t}\n}\n\nexport namespace WorkspaceSymbol {\n\texport function from(info: vscode.SymbolInformation): search.IWorkspaceSymbol {\n\t\treturn {\n\t\t\tname: info.name,\n\t\t\tkind: SymbolKind.from(info.kind),\n\t\t\ttags: info.tags && info.tags.map(SymbolTag.from),\n\t\t\tcontainerName: info.containerName,\n\t\t\tlocation: location.from(info.location)\n\t\t};\n\t}\n\texport function to(info: search.IWorkspaceSymbol): types.SymbolInformation {\n\t\tconst result = new types.SymbolInformation(\n\t\t\tinfo.name,\n\t\t\tSymbolKind.to(info.kind),\n\t\t\tinfo.containerName,\n\t\t\tlocation.to(info.location)\n\t\t);\n\t\tresult.tags = info.tags && info.tags.map(SymbolTag.to);\n\t\treturn result;\n\t}\n}\n\nexport namespace DocumentSymbol {\n\texport function from(info: vscode.DocumentSymbol): languages.DocumentSymbol {\n\t\tconst result: languages.DocumentSymbol = {\n\t\t\tname: info.name || '!!MISSING: name!!',\n\t\t\tdetail: info.detail,\n\t\t\trange: Range.from(info.range),\n\t\t\tselectionRange: Range.from(info.selectionRange),\n\t\t\tkind: SymbolKind.from(info.kind),\n\t\t\ttags: info.tags?.map(SymbolTag.from) ?? []\n\t\t};\n\t\tif (info.children) {\n\t\t\tresult.children = info.children.map(from);\n\t\t}\n\t\treturn result;\n\t}\n\texport function to(info: languages.DocumentSymbol): vscode.DocumentSymbol {\n\t\tconst result = new types.DocumentSymbol(\n\t\t\tinfo.name,\n\t\t\tinfo.detail,\n\t\t\tSymbolKind.to(info.kind),\n\t\t\tRange.to(info.range),\n\t\t\tRange.to(info.selectionRange),\n\t\t);\n\t\tif (isNonEmptyArray(info.tags)) {\n\t\t\tresult.tags = info.tags.map(SymbolTag.to);\n\t\t}\n\t\tif (info.children) {\n\t\t\tresult.children = info.children.map(to) as any;\n\t\t}\n\t\treturn result;\n\t}\n}\n\nexport namespace CallHierarchyItem {\n\n\texport function to(item: extHostProtocol.ICallHierarchyItemDto): types.CallHierarchyItem {\n\t\tconst result = new types.CallHierarchyItem(\n\t\t\tSymbolKind.to(item.kind),\n\t\t\titem.name,\n\t\t\titem.detail || '',\n\t\t\tURI.revive(item.uri),\n\t\t\tRange.to(item.range),\n\t\t\tRange.to(item.selectionRange)\n\t\t);\n\n\t\tresult._sessionId = item._sessionId;\n\t\tresult._itemId = item._itemId;\n\n\t\treturn result;\n\t}\n\n\texport function from(item: vscode.CallHierarchyItem, sessionId?: string, itemId?: string): extHostProtocol.ICallHierarchyItemDto {\n\n\t\tsessionId = sessionId ?? (<types.CallHierarchyItem>item)._sessionId;\n\t\titemId = itemId ?? (<types.CallHierarchyItem>item)._itemId;\n\n\t\tif (sessionId === undefined || itemId === undefined) {\n\t\t\tthrow new Error('invalid item');\n\t\t}\n\n\t\treturn {\n\t\t\t_sessionId: sessionId,\n\t\t\t_itemId: itemId,\n\t\t\tname: item.name,\n\t\t\tdetail: item.detail,\n\t\t\tkind: SymbolKind.from(item.kind),\n\t\t\turi: item.uri,\n\t\t\trange: Range.from(item.range),\n\t\t\tselectionRange: Range.from(item.selectionRange),\n\t\t\ttags: item.tags?.map(SymbolTag.from)\n\t\t};\n\t}\n}\n\nexport namespace CallHierarchyIncomingCall {\n\n\texport function to(item: extHostProtocol.IIncomingCallDto): types.CallHierarchyIncomingCall {\n\t\treturn new types.CallHierarchyIncomingCall(\n\t\t\tCallHierarchyItem.to(item.from),\n\t\t\titem.fromRanges.map(r => Range.to(r))\n\t\t);\n\t}\n}\n\nexport namespace CallHierarchyOutgoingCall {\n\n\texport function to(item: extHostProtocol.IOutgoingCallDto): types.CallHierarchyOutgoingCall {\n\t\treturn new types.CallHierarchyOutgoingCall(\n\t\t\tCallHierarchyItem.to(item.to),\n\t\t\titem.fromRanges.map(r => Range.to(r))\n\t\t);\n\t}\n}\n\n\nexport namespace location {\n\texport function from(value: vscode.Location): languages.Location {\n\t\treturn {\n\t\t\trange: value.range && Range.from(value.range),\n\t\t\turi: value.uri\n\t\t};\n\t}\n\n\texport function to(value: extHostProtocol.ILocationDto): types.Location {\n\t\treturn new types.Location(URI.revive(value.uri), Range.to(value.range));\n\t}\n}\n\nexport namespace DefinitionLink {\n\texport function from(value: vscode.Location | vscode.DefinitionLink): languages.LocationLink {\n\t\tconst definitionLink = <vscode.DefinitionLink>value;\n\t\tconst location = <vscode.Location>value;\n\t\treturn {\n\t\t\toriginSelectionRange: definitionLink.originSelectionRange\n\t\t\t\t? Range.from(definitionLink.originSelectionRange)\n\t\t\t\t: undefined,\n\t\t\turi: definitionLink.targetUri ? definitionLink.targetUri : location.uri,\n\t\t\trange: Range.from(definitionLink.targetRange ? definitionLink.targetRange : location.range),\n\t\t\ttargetSelectionRange: definitionLink.targetSelectionRange\n\t\t\t\t? Range.from(definitionLink.targetSelectionRange)\n\t\t\t\t: undefined,\n\t\t};\n\t}\n\texport function to(value: extHostProtocol.ILocationLinkDto): vscode.LocationLink {\n\t\treturn {\n\t\t\ttargetUri: URI.revive(value.uri),\n\t\t\ttargetRange: Range.to(value.range),\n\t\t\ttargetSelectionRange: value.targetSelectionRange\n\t\t\t\t? Range.to(value.targetSelectionRange)\n\t\t\t\t: undefined,\n\t\t\toriginSelectionRange: value.originSelectionRange\n\t\t\t\t? Range.to(value.originSelectionRange)\n\t\t\t\t: undefined\n\t\t};\n\t}\n}\n\nexport namespace Hover {\n\texport function from(hover: vscode.VerboseHover): languages.Hover {\n\t\tconst convertedHover: languages.Hover = {\n\t\t\trange: Range.from(hover.range),\n\t\t\tcontents: MarkdownString.fromMany(hover.contents),\n\t\t\tcanIncreaseVerbosity: hover.canIncreaseVerbosity,\n\t\t\tcanDecreaseVerbosity: hover.canDecreaseVerbosity,\n\t\t};\n\t\treturn convertedHover;\n\t}\n\n\texport function to(info: languages.Hover): types.VerboseHover {\n\t\tconst contents = info.contents.map(MarkdownString.to);\n\t\tconst range = Range.to(info.range);\n\t\tconst canIncreaseVerbosity = info.canIncreaseVerbosity;\n\t\tconst canDecreaseVerbosity = info.canDecreaseVerbosity;\n\t\treturn new types.VerboseHover(contents, range, canIncreaseVerbosity, canDecreaseVerbosity);\n\t}\n}\n\nexport namespace EvaluatableExpression {\n\texport function from(expression: vscode.EvaluatableExpression): languages.EvaluatableExpression {\n\t\treturn {\n\t\t\trange: Range.from(expression.range),\n\t\t\texpression: expression.expression\n\t\t};\n\t}\n\n\texport function to(info: languages.EvaluatableExpression): types.EvaluatableExpression {\n\t\treturn new types.EvaluatableExpression(Range.to(info.range), info.expression);\n\t}\n}\n\nexport namespace InlineValue {\n\texport function from(inlineValue: vscode.InlineValue): languages.InlineValue {\n\t\tif (inlineValue instanceof types.InlineValueText) {\n\t\t\treturn {\n\t\t\t\ttype: 'text',\n\t\t\t\trange: Range.from(inlineValue.range),\n\t\t\t\ttext: inlineValue.text\n\t\t\t} satisfies languages.InlineValueText;\n\t\t} else if (inlineValue instanceof types.InlineValueVariableLookup) {\n\t\t\treturn {\n\t\t\t\ttype: 'variable',\n\t\t\t\trange: Range.from(inlineValue.range),\n\t\t\t\tvariableName: inlineValue.variableName,\n\t\t\t\tcaseSensitiveLookup: inlineValue.caseSensitiveLookup\n\t\t\t} satisfies languages.InlineValueVariableLookup;\n\t\t} else if (inlineValue instanceof types.InlineValueEvaluatableExpression) {\n\t\t\treturn {\n\t\t\t\ttype: 'expression',\n\t\t\t\trange: Range.from(inlineValue.range),\n\t\t\t\texpression: inlineValue.expression\n\t\t\t} satisfies languages.InlineValueExpression;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown 'InlineValue' type`);\n\t\t}\n\t}\n\n\texport function to(inlineValue: languages.InlineValue): vscode.InlineValue {\n\t\tswitch (inlineValue.type) {\n\t\t\tcase 'text':\n\t\t\t\treturn {\n\t\t\t\t\trange: Range.to(inlineValue.range),\n\t\t\t\t\ttext: inlineValue.text\n\t\t\t\t} satisfies vscode.InlineValueText;\n\t\t\tcase 'variable':\n\t\t\t\treturn {\n\t\t\t\t\trange: Range.to(inlineValue.range),\n\t\t\t\t\tvariableName: inlineValue.variableName,\n\t\t\t\t\tcaseSensitiveLookup: inlineValue.caseSensitiveLookup\n\t\t\t\t} satisfies vscode.InlineValueVariableLookup;\n\t\t\tcase 'expression':\n\t\t\t\treturn {\n\t\t\t\t\trange: Range.to(inlineValue.range),\n\t\t\t\t\texpression: inlineValue.expression\n\t\t\t\t} satisfies vscode.InlineValueEvaluatableExpression;\n\t\t}\n\t}\n}\n\nexport namespace InlineValueContext {\n\texport function from(inlineValueContext: vscode.InlineValueContext): extHostProtocol.IInlineValueContextDto {\n\t\treturn {\n\t\t\tframeId: inlineValueContext.frameId,\n\t\t\tstoppedLocation: Range.from(inlineValueContext.stoppedLocation)\n\t\t};\n\t}\n\n\texport function to(inlineValueContext: extHostProtocol.IInlineValueContextDto): types.InlineValueContext {\n\t\treturn new types.InlineValueContext(inlineValueContext.frameId, Range.to(inlineValueContext.stoppedLocation));\n\t}\n}\n\nexport namespace DocumentHighlight {\n\texport function from(documentHighlight: vscode.DocumentHighlight): languages.DocumentHighlight {\n\t\treturn {\n\t\t\trange: Range.from(documentHighlight.range),\n\t\t\tkind: documentHighlight.kind\n\t\t};\n\t}\n\texport function to(occurrence: languages.DocumentHighlight): types.DocumentHighlight {\n\t\treturn new types.DocumentHighlight(Range.to(occurrence.range), occurrence.kind);\n\t}\n}\n\nexport namespace MultiDocumentHighlight {\n\texport function from(multiDocumentHighlight: vscode.MultiDocumentHighlight): languages.MultiDocumentHighlight {\n\t\treturn {\n\t\t\turi: multiDocumentHighlight.uri,\n\t\t\thighlights: multiDocumentHighlight.highlights.map(DocumentHighlight.from)\n\t\t};\n\t}\n\n\texport function to(multiDocumentHighlight: languages.MultiDocumentHighlight): types.MultiDocumentHighlight {\n\t\treturn new types.MultiDocumentHighlight(URI.revive(multiDocumentHighlight.uri), multiDocumentHighlight.highlights.map(DocumentHighlight.to));\n\t}\n}\n\nexport namespace CompletionTriggerKind {\n\texport function to(kind: languages.CompletionTriggerKind) {\n\t\tswitch (kind) {\n\t\t\tcase languages.CompletionTriggerKind.TriggerCharacter:\n\t\t\t\treturn types.CompletionTriggerKind.TriggerCharacter;\n\t\t\tcase languages.CompletionTriggerKind.TriggerForIncompleteCompletions:\n\t\t\t\treturn types.CompletionTriggerKind.TriggerForIncompleteCompletions;\n\t\t\tcase languages.CompletionTriggerKind.Invoke:\n\t\t\tdefault:\n\t\t\t\treturn types.CompletionTriggerKind.Invoke;\n\t\t}\n\t}\n}\n\nexport namespace CompletionContext {\n\texport function to(context: languages.CompletionContext): types.CompletionContext {\n\t\treturn {\n\t\t\ttriggerKind: CompletionTriggerKind.to(context.triggerKind),\n\t\t\ttriggerCharacter: context.triggerCharacter\n\t\t};\n\t}\n}\n\nexport namespace CompletionItemTag {\n\n\texport function from(kind: types.CompletionItemTag): languages.CompletionItemTag {\n\t\tswitch (kind) {\n\t\t\tcase types.CompletionItemTag.Deprecated: return languages.CompletionItemTag.Deprecated;\n\t\t}\n\t}\n\n\texport function to(kind: languages.CompletionItemTag): types.CompletionItemTag {\n\t\tswitch (kind) {\n\t\t\tcase languages.CompletionItemTag.Deprecated: return types.CompletionItemTag.Deprecated;\n\t\t}\n\t}\n}\n\nexport namespace CompletionCommand {\n\texport function from(c: vscode.Command | { command: vscode.Command; icon: vscode.ThemeIcon }, converter: CommandsConverter, disposables: DisposableStore): { command: extHostProtocol.ICommandDto; icon?: languages.IconPath } {\n\t\tif ('icon' in c && 'command' in c) {\n\t\t\treturn {\n\t\t\t\tcommand: converter.toInternal(c.command, disposables),\n\t\t\t\ticon: IconPath.fromThemeIcon(c.icon)\n\t\t\t};\n\t\t}\n\t\treturn { command: converter.toInternal(c, disposables) };\n\t}\n}\n\nexport namespace CompletionItemKind {\n\n\tconst _from = new Map<types.CompletionItemKind, languages.CompletionItemKind>([\n\t\t[types.CompletionItemKind.Method, languages.CompletionItemKind.Method],\n\t\t[types.CompletionItemKind.Function, languages.CompletionItemKind.Function],\n\t\t[types.CompletionItemKind.Constructor, languages.CompletionItemKind.Constructor],\n\t\t[types.CompletionItemKind.Field, languages.CompletionItemKind.Field],\n\t\t[types.CompletionItemKind.Variable, languages.CompletionItemKind.Variable],\n\t\t[types.CompletionItemKind.Class, languages.CompletionItemKind.Class],\n\t\t[types.CompletionItemKind.Interface, languages.CompletionItemKind.Interface],\n\t\t[types.CompletionItemKind.Struct, languages.CompletionItemKind.Struct],\n\t\t[types.CompletionItemKind.Module, languages.CompletionItemKind.Module],\n\t\t[types.CompletionItemKind.Property, languages.CompletionItemKind.Property],\n\t\t[types.CompletionItemKind.Unit, languages.CompletionItemKind.Unit],\n\t\t[types.CompletionItemKind.Value, languages.CompletionItemKind.Value],\n\t\t[types.CompletionItemKind.Constant, languages.CompletionItemKind.Constant],\n\t\t[types.CompletionItemKind.Enum, languages.CompletionItemKind.Enum],\n\t\t[types.CompletionItemKind.EnumMember, languages.CompletionItemKind.EnumMember],\n\t\t[types.CompletionItemKind.Keyword, languages.CompletionItemKind.Keyword],\n\t\t[types.CompletionItemKind.Snippet, languages.CompletionItemKind.Snippet],\n\t\t[types.CompletionItemKind.Text, languages.CompletionItemKind.Text],\n\t\t[types.CompletionItemKind.Color, languages.CompletionItemKind.Color],\n\t\t[types.CompletionItemKind.File, languages.CompletionItemKind.File],\n\t\t[types.CompletionItemKind.Reference, languages.CompletionItemKind.Reference],\n\t\t[types.CompletionItemKind.Folder, languages.CompletionItemKind.Folder],\n\t\t[types.CompletionItemKind.Event, languages.CompletionItemKind.Event],\n\t\t[types.CompletionItemKind.Operator, languages.CompletionItemKind.Operator],\n\t\t[types.CompletionItemKind.TypeParameter, languages.CompletionItemKind.TypeParameter],\n\t\t[types.CompletionItemKind.Issue, languages.CompletionItemKind.Issue],\n\t\t[types.CompletionItemKind.User, languages.CompletionItemKind.User],\n\t]);\n\n\texport function from(kind: types.CompletionItemKind): languages.CompletionItemKind {\n\t\treturn _from.get(kind) ?? languages.CompletionItemKind.Property;\n\t}\n\n\tconst _to = new Map<languages.CompletionItemKind, types.CompletionItemKind>([\n\t\t[languages.CompletionItemKind.Method, types.CompletionItemKind.Method],\n\t\t[languages.CompletionItemKind.Function, types.CompletionItemKind.Function],\n\t\t[languages.CompletionItemKind.Constructor, types.CompletionItemKind.Constructor],\n\t\t[languages.CompletionItemKind.Field, types.CompletionItemKind.Field],\n\t\t[languages.CompletionItemKind.Variable, types.CompletionItemKind.Variable],\n\t\t[languages.CompletionItemKind.Class, types.CompletionItemKind.Class],\n\t\t[languages.CompletionItemKind.Interface, types.CompletionItemKind.Interface],\n\t\t[languages.CompletionItemKind.Struct, types.CompletionItemKind.Struct],\n\t\t[languages.CompletionItemKind.Module, types.CompletionItemKind.Module],\n\t\t[languages.CompletionItemKind.Property, types.CompletionItemKind.Property],\n\t\t[languages.CompletionItemKind.Unit, types.CompletionItemKind.Unit],\n\t\t[languages.CompletionItemKind.Value, types.CompletionItemKind.Value],\n\t\t[languages.CompletionItemKind.Constant, types.CompletionItemKind.Constant],\n\t\t[languages.CompletionItemKind.Enum, types.CompletionItemKind.Enum],\n\t\t[languages.CompletionItemKind.EnumMember, types.CompletionItemKind.EnumMember],\n\t\t[languages.CompletionItemKind.Keyword, types.CompletionItemKind.Keyword],\n\t\t[languages.CompletionItemKind.Snippet, types.CompletionItemKind.Snippet],\n\t\t[languages.CompletionItemKind.Text, types.CompletionItemKind.Text],\n\t\t[languages.CompletionItemKind.Color, types.CompletionItemKind.Color],\n\t\t[languages.CompletionItemKind.File, types.CompletionItemKind.File],\n\t\t[languages.CompletionItemKind.Reference, types.CompletionItemKind.Reference],\n\t\t[languages.CompletionItemKind.Folder, types.CompletionItemKind.Folder],\n\t\t[languages.CompletionItemKind.Event, types.CompletionItemKind.Event],\n\t\t[languages.CompletionItemKind.Operator, types.CompletionItemKind.Operator],\n\t\t[languages.CompletionItemKind.TypeParameter, types.CompletionItemKind.TypeParameter],\n\t\t[languages.CompletionItemKind.User, types.CompletionItemKind.User],\n\t\t[languages.CompletionItemKind.Issue, types.CompletionItemKind.Issue],\n\t]);\n\n\texport function to(kind: languages.CompletionItemKind): types.CompletionItemKind {\n\t\treturn _to.get(kind) ?? types.CompletionItemKind.Property;\n\t}\n}\n\nexport namespace CompletionItem {\n\n\texport function to(suggestion: languages.CompletionItem, converter?: Command.ICommandsConverter): types.CompletionItem {\n\n\t\tconst result = new types.CompletionItem(suggestion.label);\n\t\tresult.insertText = suggestion.insertText;\n\t\tresult.kind = CompletionItemKind.to(suggestion.kind);\n\t\tresult.tags = suggestion.tags?.map(CompletionItemTag.to);\n\t\tresult.detail = suggestion.detail;\n\t\tresult.documentation = htmlContent.isMarkdownString(suggestion.documentation) ? MarkdownString.to(suggestion.documentation) : suggestion.documentation;\n\t\tresult.sortText = suggestion.sortText;\n\t\tresult.filterText = suggestion.filterText;\n\t\tresult.preselect = suggestion.preselect;\n\t\tresult.commitCharacters = suggestion.commitCharacters;\n\n\t\t// range\n\t\tif (editorRange.Range.isIRange(suggestion.range)) {\n\t\t\tresult.range = Range.to(suggestion.range);\n\t\t} else if (typeof suggestion.range === 'object') {\n\t\t\tresult.range = { inserting: Range.to(suggestion.range.insert), replacing: Range.to(suggestion.range.replace) };\n\t\t}\n\n\t\tresult.keepWhitespace = typeof suggestion.insertTextRules === 'undefined' ? false : Boolean(suggestion.insertTextRules & languages.CompletionItemInsertTextRule.KeepWhitespace);\n\t\t// 'insertText'-logic\n\t\tif (typeof suggestion.insertTextRules !== 'undefined' && suggestion.insertTextRules & languages.CompletionItemInsertTextRule.InsertAsSnippet) {\n\t\t\tresult.insertText = new types.SnippetString(suggestion.insertText);\n\t\t} else {\n\t\t\tresult.insertText = suggestion.insertText;\n\t\t\tresult.textEdit = result.range instanceof types.Range ? new types.TextEdit(result.range, result.insertText) : undefined;\n\t\t}\n\t\tif (suggestion.additionalTextEdits && suggestion.additionalTextEdits.length > 0) {\n\t\t\tresult.additionalTextEdits = suggestion.additionalTextEdits.map(e => TextEdit.to(e as languages.TextEdit));\n\t\t}\n\t\tresult.command = converter && suggestion.command ? converter.fromInternal(suggestion.command) : undefined;\n\n\t\treturn result;\n\t}\n}\n\nexport namespace ParameterInformation {\n\texport function from(info: types.ParameterInformation): languages.ParameterInformation {\n\t\tif (typeof info.label !== 'string' && !Array.isArray(info.label)) {\n\t\t\tthrow new TypeError('Invalid label');\n\t\t}\n\n\t\treturn {\n\t\t\tlabel: info.label,\n\t\t\tdocumentation: MarkdownString.fromStrict(info.documentation)\n\t\t};\n\t}\n\texport function to(info: languages.ParameterInformation): types.ParameterInformation {\n\t\treturn {\n\t\t\tlabel: info.label,\n\t\t\tdocumentation: htmlContent.isMarkdownString(info.documentation) ? MarkdownString.to(info.documentation) : info.documentation\n\t\t};\n\t}\n}\n\nexport namespace SignatureInformation {\n\n\texport function from(info: types.SignatureInformation): languages.SignatureInformation {\n\t\treturn {\n\t\t\tlabel: info.label,\n\t\t\tdocumentation: MarkdownString.fromStrict(info.documentation),\n\t\t\tparameters: Array.isArray(info.parameters) ? info.parameters.map(ParameterInformation.from) : [],\n\t\t\tactiveParameter: info.activeParameter,\n\t\t};\n\t}\n\n\texport function to(info: languages.SignatureInformation): types.SignatureInformation {\n\t\treturn {\n\t\t\tlabel: info.label,\n\t\t\tdocumentation: htmlContent.isMarkdownString(info.documentation) ? MarkdownString.to(info.documentation) : info.documentation,\n\t\t\tparameters: Array.isArray(info.parameters) ? info.parameters.map(ParameterInformation.to) : [],\n\t\t\tactiveParameter: info.activeParameter,\n\t\t};\n\t}\n}\n\nexport namespace SignatureHelp {\n\n\texport function from(help: types.SignatureHelp): languages.SignatureHelp {\n\t\treturn {\n\t\t\tactiveSignature: help.activeSignature,\n\t\t\tactiveParameter: help.activeParameter,\n\t\t\tsignatures: Array.isArray(help.signatures) ? help.signatures.map(SignatureInformation.from) : [],\n\t\t};\n\t}\n\n\texport function to(help: languages.SignatureHelp): types.SignatureHelp {\n\t\treturn {\n\t\t\tactiveSignature: help.activeSignature,\n\t\t\tactiveParameter: help.activeParameter,\n\t\t\tsignatures: Array.isArray(help.signatures) ? help.signatures.map(SignatureInformation.to) : [],\n\t\t};\n\t}\n}\n\nexport namespace InlayHint {\n\n\texport function to(converter: Command.ICommandsConverter, hint: languages.InlayHint): vscode.InlayHint {\n\t\tconst res = new types.InlayHint(\n\t\t\tPosition.to(hint.position),\n\t\t\ttypeof hint.label === 'string' ? hint.label : hint.label.map(InlayHintLabelPart.to.bind(undefined, converter)),\n\t\t\thint.kind && InlayHintKind.to(hint.kind)\n\t\t);\n\t\tres.textEdits = hint.textEdits && hint.textEdits.map(TextEdit.to);\n\t\tres.tooltip = htmlContent.isMarkdownString(hint.tooltip) ? MarkdownString.to(hint.tooltip) : hint.tooltip;\n\t\tres.paddingLeft = hint.paddingLeft;\n\t\tres.paddingRight = hint.paddingRight;\n\t\treturn res;\n\t}\n}\n\nexport namespace InlayHintLabelPart {\n\n\texport function to(converter: Command.ICommandsConverter, part: languages.InlayHintLabelPart): types.InlayHintLabelPart {\n\t\tconst result = new types.InlayHintLabelPart(part.label);\n\t\tresult.tooltip = htmlContent.isMarkdownString(part.tooltip)\n\t\t\t? MarkdownString.to(part.tooltip)\n\t\t\t: part.tooltip;\n\t\tif (languages.Command.is(part.command)) {\n\t\t\tresult.command = converter.fromInternal(part.command);\n\t\t}\n\t\tif (part.location) {\n\t\t\tresult.location = location.to(part.location);\n\t\t}\n\t\treturn result;\n\t}\n}\n\nexport namespace InlayHintKind {\n\texport function from(kind: vscode.InlayHintKind): languages.InlayHintKind {\n\t\treturn kind;\n\t}\n\texport function to(kind: languages.InlayHintKind): vscode.InlayHintKind {\n\t\treturn kind;\n\t}\n}\n\nexport namespace DocumentLink {\n\n\texport function from(link: vscode.DocumentLink): languages.ILink {\n\t\treturn {\n\t\t\trange: Range.from(link.range),\n\t\t\turl: link.target,\n\t\t\ttooltip: link.tooltip\n\t\t};\n\t}\n\n\texport function to(link: languages.ILink): vscode.DocumentLink {\n\t\tlet target: URI | undefined = undefined;\n\t\tif (link.url) {\n\t\t\ttry {\n\t\t\t\ttarget = typeof link.url === 'string' ? URI.parse(link.url, true) : URI.revive(link.url);\n\t\t\t} catch (err) {\n\t\t\t\t// ignore\n\t\t\t}\n\t\t}\n\t\tconst result = new types.DocumentLink(Range.to(link.range), target);\n\t\tresult.tooltip = link.tooltip;\n\t\treturn result;\n\t}\n}\n\nexport namespace ColorPresentation {\n\texport function to(colorPresentation: languages.IColorPresentation): types.ColorPresentation {\n\t\tconst cp = new types.ColorPresentation(colorPresentation.label);\n\t\tif (colorPresentation.textEdit) {\n\t\t\tcp.textEdit = TextEdit.to(colorPresentation.textEdit);\n\t\t}\n\t\tif (colorPresentation.additionalTextEdits) {\n\t\t\tcp.additionalTextEdits = colorPresentation.additionalTextEdits.map(value => TextEdit.to(value));\n\t\t}\n\t\treturn cp;\n\t}\n\n\texport function from(colorPresentation: vscode.ColorPresentation): languages.IColorPresentation {\n\t\treturn {\n\t\t\tlabel: colorPresentation.label,\n\t\t\ttextEdit: colorPresentation.textEdit ? TextEdit.from(colorPresentation.textEdit) : undefined,\n\t\t\tadditionalTextEdits: colorPresentation.additionalTextEdits ? colorPresentation.additionalTextEdits.map(value => TextEdit.from(value)) : undefined\n\t\t};\n\t}\n}\n\nexport namespace Color {\n\texport function to(c: [number, number, number, number]): types.Color {\n\t\treturn new types.Color(c[0], c[1], c[2], c[3]);\n\t}\n\texport function from(color: types.Color): [number, number, number, number] {\n\t\treturn [color.red, color.green, color.blue, color.alpha];\n\t}\n}\n\n\nexport namespace SelectionRange {\n\texport function from(obj: vscode.SelectionRange): languages.SelectionRange {\n\t\treturn { range: Range.from(obj.range) };\n\t}\n\n\texport function to(obj: languages.SelectionRange): vscode.SelectionRange {\n\t\treturn new types.SelectionRange(Range.to(obj.range));\n\t}\n}\n\nexport namespace TextDocumentSaveReason {\n\n\texport function to(reason: SaveReason): vscode.TextDocumentSaveReason {\n\t\tswitch (reason) {\n\t\t\tcase SaveReason.AUTO:\n\t\t\t\treturn types.TextDocumentSaveReason.AfterDelay;\n\t\t\tcase SaveReason.EXPLICIT:\n\t\t\t\treturn types.TextDocumentSaveReason.Manual;\n\t\t\tcase SaveReason.FOCUS_CHANGE:\n\t\t\tcase SaveReason.WINDOW_CHANGE:\n\t\t\t\treturn types.TextDocumentSaveReason.FocusOut;\n\t\t}\n\t}\n}\n\nexport namespace TextEditorLineNumbersStyle {\n\texport function from(style: vscode.TextEditorLineNumbersStyle): RenderLineNumbersType {\n\t\tswitch (style) {\n\t\t\tcase types.TextEditorLineNumbersStyle.Off:\n\t\t\t\treturn RenderLineNumbersType.Off;\n\t\t\tcase types.TextEditorLineNumbersStyle.Relative:\n\t\t\t\treturn RenderLineNumbersType.Relative;\n\t\t\tcase types.TextEditorLineNumbersStyle.Interval:\n\t\t\t\treturn RenderLineNumbersType.Interval;\n\t\t\tcase types.TextEditorLineNumbersStyle.On:\n\t\t\tdefault:\n\t\t\t\treturn RenderLineNumbersType.On;\n\t\t}\n\t}\n\texport function to(style: RenderLineNumbersType): vscode.TextEditorLineNumbersStyle {\n\t\tswitch (style) {\n\t\t\tcase RenderLineNumbersType.Off:\n\t\t\t\treturn types.TextEditorLineNumbersStyle.Off;\n\t\t\tcase RenderLineNumbersType.Relative:\n\t\t\t\treturn types.TextEditorLineNumbersStyle.Relative;\n\t\t\tcase RenderLineNumbersType.Interval:\n\t\t\t\treturn types.TextEditorLineNumbersStyle.Interval;\n\t\t\tcase RenderLineNumbersType.On:\n\t\t\tdefault:\n\t\t\t\treturn types.TextEditorLineNumbersStyle.On;\n\t\t}\n\t}\n}\n\nexport namespace EndOfLine {\n\n\texport function from(eol: vscode.EndOfLine): EndOfLineSequence | undefined {\n\t\tif (eol === types.EndOfLine.CRLF) {\n\t\t\treturn EndOfLineSequence.CRLF;\n\t\t} else if (eol === types.EndOfLine.LF) {\n\t\t\treturn EndOfLineSequence.LF;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\texport function to(eol: EndOfLineSequence): vscode.EndOfLine | undefined {\n\t\tif (eol === EndOfLineSequence.CRLF) {\n\t\t\treturn types.EndOfLine.CRLF;\n\t\t} else if (eol === EndOfLineSequence.LF) {\n\t\t\treturn types.EndOfLine.LF;\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport namespace ProgressLocation {\n\texport function from(loc: vscode.ProgressLocation | { viewId: string }): MainProgressLocation | string {\n\t\tif (typeof loc === 'object') {\n\t\t\treturn loc.viewId;\n\t\t}\n\n\t\tswitch (loc) {\n\t\t\tcase types.ProgressLocation.SourceControl: return MainProgressLocation.Scm;\n\t\t\tcase types.ProgressLocation.Window: return MainProgressLocation.Window;\n\t\t\tcase types.ProgressLocation.Notification: return MainProgressLocation.Notification;\n\t\t}\n\t\tthrow new Error(`Unknown 'ProgressLocation'`);\n\t}\n}\n\nexport namespace FoldingRange {\n\texport function from(r: vscode.FoldingRange): languages.FoldingRange {\n\t\tconst range: languages.FoldingRange = { start: r.start + 1, end: r.end + 1 };\n\t\tif (r.kind) {\n\t\t\trange.kind = FoldingRangeKind.from(r.kind);\n\t\t}\n\t\treturn range;\n\t}\n\texport function to(r: languages.FoldingRange): vscode.FoldingRange {\n\t\tconst range: vscode.FoldingRange = { start: r.start - 1, end: r.end - 1 };\n\t\tif (r.kind) {\n\t\t\trange.kind = FoldingRangeKind.to(r.kind);\n\t\t}\n\t\treturn range;\n\t}\n}\n\nexport namespace FoldingRangeKind {\n\texport function from(kind: vscode.FoldingRangeKind | undefined): languages.FoldingRangeKind | undefined {\n\t\tif (kind) {\n\t\t\tswitch (kind) {\n\t\t\t\tcase types.FoldingRangeKind.Comment:\n\t\t\t\t\treturn languages.FoldingRangeKind.Comment;\n\t\t\t\tcase types.FoldingRangeKind.Imports:\n\t\t\t\t\treturn languages.FoldingRangeKind.Imports;\n\t\t\t\tcase types.FoldingRangeKind.Region:\n\t\t\t\t\treturn languages.FoldingRangeKind.Region;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\texport function to(kind: languages.FoldingRangeKind | undefined): vscode.FoldingRangeKind | undefined {\n\t\tif (kind) {\n\t\t\tswitch (kind.value) {\n\t\t\t\tcase languages.FoldingRangeKind.Comment.value:\n\t\t\t\t\treturn types.FoldingRangeKind.Comment;\n\t\t\t\tcase languages.FoldingRangeKind.Imports.value:\n\t\t\t\t\treturn types.FoldingRangeKind.Imports;\n\t\t\t\tcase languages.FoldingRangeKind.Region.value:\n\t\t\t\t\treturn types.FoldingRangeKind.Region;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport interface TextEditorOpenOptions extends vscode.TextDocumentShowOptions {\n\tbackground?: boolean;\n\toverride?: boolean;\n}\n\nexport namespace TextEditorOpenOptions {\n\n\texport function from(options?: TextEditorOpenOptions): ITextEditorOptions | undefined {\n\t\tif (options) {\n\t\t\treturn {\n\t\t\t\tpinned: typeof options.preview === 'boolean' ? !options.preview : undefined,\n\t\t\t\tinactive: options.background,\n\t\t\t\tpreserveFocus: options.preserveFocus,\n\t\t\t\tselection: typeof options.selection === 'object' ? Range.from(options.selection) : undefined,\n\t\t\t\toverride: typeof options.override === 'boolean' ? DEFAULT_EDITOR_ASSOCIATION.id : undefined\n\t\t\t};\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n}\n\nexport namespace GlobPattern {\n\n\texport function from(pattern: vscode.GlobPattern): string | extHostProtocol.IRelativePatternDto;\n\texport function from(pattern: undefined): undefined;\n\texport function from(pattern: null): null;\n\texport function from(pattern: vscode.GlobPattern | undefined | null): string | extHostProtocol.IRelativePatternDto | undefined | null;\n\texport function from(pattern: vscode.GlobPattern | undefined | null): string | extHostProtocol.IRelativePatternDto | undefined | null {\n\t\tif (pattern instanceof types.RelativePattern) {\n\t\t\treturn pattern.toJSON();\n\t\t}\n\n\t\tif (typeof pattern === 'string') {\n\t\t\treturn pattern;\n\t\t}\n\n\t\t// This is slightly bogus because we declare this method to accept\n\t\t// `vscode.GlobPattern` which can be `vscode.RelativePattern` class,\n\t\t// but given we cannot enforce classes from our vscode.d.ts, we have\n\t\t// to probe for objects too\n\t\t// Refs: https://github.com/microsoft/vscode/issues/140771\n\t\tif (isRelativePatternShape(pattern) || isLegacyRelativePatternShape(pattern)) {\n\t\t\treturn new types.RelativePattern(pattern.baseUri ?? pattern.base, pattern.pattern).toJSON();\n\t\t}\n\n\t\treturn pattern; // preserve `undefined` and `null`\n\t}\n\n\tfunction isRelativePatternShape(obj: unknown): obj is { base: string; baseUri: URI; pattern: string } {\n\t\tconst rp = obj as { base: string; baseUri: URI; pattern: string } | undefined | null;\n\t\tif (!rp) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn URI.isUri(rp.baseUri) && typeof rp.pattern === 'string';\n\t}\n\n\tfunction isLegacyRelativePatternShape(obj: unknown): obj is { base: string; pattern: string } {\n\n\t\t// Before 1.64.x, `RelativePattern` did not have any `baseUri: Uri`\n\t\t// property. To preserve backwards compatibility with older extensions\n\t\t// we allow this old format when creating the `vscode.RelativePattern`.\n\n\t\tconst rp = obj as { base: string; pattern: string } | undefined | null;\n\t\tif (!rp) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn typeof rp.base === 'string' && typeof rp.pattern === 'string';\n\t}\n\n\texport function to(pattern: string | extHostProtocol.IRelativePatternDto): vscode.GlobPattern {\n\t\tif (typeof pattern === 'string') {\n\t\t\treturn pattern;\n\t\t}\n\n\t\treturn new types.RelativePattern(URI.revive(pattern.baseUri), pattern.pattern);\n\t}\n}\n\nexport namespace LanguageSelector {\n\n\texport function from(selector: undefined): undefined;\n\texport function from(selector: vscode.DocumentSelector): languageSelector.LanguageSelector;\n\texport function from(selector: vscode.DocumentSelector | undefined): languageSelector.LanguageSelector | undefined;\n\texport function from(selector: vscode.DocumentSelector | undefined): languageSelector.LanguageSelector | undefined {\n\t\tif (!selector) {\n\t\t\treturn undefined;\n\t\t} else if (Array.isArray(selector)) {\n\t\t\treturn <languageSelector.LanguageSelector>selector.map(from);\n\t\t} else if (typeof selector === 'string') {\n\t\t\treturn selector;\n\t\t} else {\n\t\t\tconst filter = selector as vscode.DocumentFilter; // TODO: microsoft/TypeScript#42768\n\t\t\treturn {\n\t\t\t\tlanguage: filter.language,\n\t\t\t\tscheme: filter.scheme,\n\t\t\t\tpattern: GlobPattern.from(filter.pattern) ?? undefined,\n\t\t\t\texclusive: filter.exclusive,\n\t\t\t\tnotebookType: filter.notebookType\n\t\t\t};\n\t\t}\n\t}\n}\n\nexport namespace NotebookRange {\n\n\texport function from(range: vscode.NotebookRange): ICellRange {\n\t\treturn { start: range.start, end: range.end };\n\t}\n\n\texport function to(range: ICellRange): types.NotebookRange {\n\t\treturn new types.NotebookRange(range.start, range.end);\n\t}\n}\n\nexport namespace NotebookCellExecutionSummary {\n\texport function to(data: notebooks.NotebookCellInternalMetadata): vscode.NotebookCellExecutionSummary {\n\t\treturn {\n\t\t\ttiming: typeof data.runStartTime === 'number' && typeof data.runEndTime === 'number' ? { startTime: data.runStartTime, endTime: data.runEndTime } : undefined,\n\t\t\texecutionOrder: data.executionOrder,\n\t\t\tsuccess: data.lastRunSuccess\n\t\t};\n\t}\n\n\texport function from(data: vscode.NotebookCellExecutionSummary): Partial<notebooks.NotebookCellInternalMetadata> {\n\t\treturn {\n\t\t\tlastRunSuccess: data.success,\n\t\t\trunStartTime: data.timing?.startTime,\n\t\t\trunEndTime: data.timing?.endTime,\n\t\t\texecutionOrder: data.executionOrder\n\t\t};\n\t}\n}\n\nexport namespace NotebookCellKind {\n\texport function from(data: vscode.NotebookCellKind): notebooks.CellKind {\n\t\tswitch (data) {\n\t\t\tcase types.NotebookCellKind.Markup:\n\t\t\t\treturn notebooks.CellKind.Markup;\n\t\t\tcase types.NotebookCellKind.Code:\n\t\t\tdefault:\n\t\t\t\treturn notebooks.CellKind.Code;\n\t\t}\n\t}\n\n\texport function to(data: notebooks.CellKind): vscode.NotebookCellKind {\n\t\tswitch (data) {\n\t\t\tcase notebooks.CellKind.Markup:\n\t\t\t\treturn types.NotebookCellKind.Markup;\n\t\t\tcase notebooks.CellKind.Code:\n\t\t\tdefault:\n\t\t\t\treturn types.NotebookCellKind.Code;\n\t\t}\n\t}\n}\n\nexport namespace NotebookData {\n\n\texport function from(data: vscode.NotebookData): extHostProtocol.NotebookDataDto {\n\t\tconst res: extHostProtocol.NotebookDataDto = {\n\t\t\tmetadata: data.metadata ?? Object.create(null),\n\t\t\tcells: [],\n\t\t};\n\t\tfor (const cell of data.cells) {\n\t\t\ttypes.NotebookCellData.validate(cell);\n\t\t\tres.cells.push(NotebookCellData.from(cell));\n\t\t}\n\t\treturn res;\n\t}\n\n\texport function to(data: extHostProtocol.NotebookDataDto): vscode.NotebookData {\n\t\tconst res = new types.NotebookData(\n\t\t\tdata.cells.map(NotebookCellData.to),\n\t\t);\n\t\tif (!isEmptyObject(data.metadata)) {\n\t\t\tres.metadata = data.metadata;\n\t\t}\n\t\treturn res;\n\t}\n}\n\nexport namespace NotebookCellData {\n\n\texport function from(data: vscode.NotebookCellData): extHostProtocol.NotebookCellDataDto {\n\t\treturn {\n\t\t\tcellKind: NotebookCellKind.from(data.kind),\n\t\t\tlanguage: data.languageId,\n\t\t\tmime: data.mime,\n\t\t\tsource: data.value,\n\t\t\tmetadata: data.metadata,\n\t\t\tinternalMetadata: NotebookCellExecutionSummary.from(data.executionSummary ?? {}),\n\t\t\toutputs: data.outputs ? data.outputs.map(NotebookCellOutput.from) : []\n\t\t};\n\t}\n\n\texport function to(data: extHostProtocol.NotebookCellDataDto): vscode.NotebookCellData {\n\t\treturn new types.NotebookCellData(\n\t\t\tNotebookCellKind.to(data.cellKind),\n\t\t\tdata.source,\n\t\t\tdata.language,\n\t\t\tdata.mime,\n\t\t\tdata.outputs ? data.outputs.map(NotebookCellOutput.to) : undefined,\n\t\t\tdata.metadata,\n\t\t\tdata.internalMetadata ? NotebookCellExecutionSummary.to(data.internalMetadata) : undefined\n\t\t);\n\t}\n}\n\nexport namespace NotebookCellOutputItem {\n\texport function from(item: types.NotebookCellOutputItem): extHostProtocol.NotebookOutputItemDto {\n\t\treturn {\n\t\t\tmime: item.mime,\n\t\t\tvalueBytes: VSBuffer.wrap(item.data),\n\t\t};\n\t}\n\n\texport function to(item: extHostProtocol.NotebookOutputItemDto): types.NotebookCellOutputItem {\n\t\treturn new types.NotebookCellOutputItem(item.valueBytes.buffer, item.mime);\n\t}\n}\n\nexport namespace NotebookCellOutput {\n\texport function from(output: vscode.NotebookCellOutput): extHostProtocol.NotebookOutputDto {\n\t\treturn {\n\t\t\toutputId: output.id,\n\t\t\titems: output.items.map(NotebookCellOutputItem.from),\n\t\t\tmetadata: output.metadata\n\t\t};\n\t}\n\n\texport function to(output: extHostProtocol.NotebookOutputDto): vscode.NotebookCellOutput {\n\t\tconst items = output.items.map(NotebookCellOutputItem.to);\n\t\treturn new types.NotebookCellOutput(items, output.outputId, output.metadata);\n\t}\n}\n\n\nexport namespace NotebookExclusiveDocumentPattern {\n\texport function from(pattern: { include: vscode.GlobPattern | undefined; exclude: vscode.GlobPattern | undefined }): { include: string | extHostProtocol.IRelativePatternDto | undefined; exclude: string | extHostProtocol.IRelativePatternDto | undefined };\n\texport function from(pattern: vscode.GlobPattern): string | extHostProtocol.IRelativePatternDto;\n\texport function from(pattern: undefined): undefined;\n\texport function from(pattern: { include: vscode.GlobPattern | undefined | null; exclude: vscode.GlobPattern | undefined } | vscode.GlobPattern | undefined): string | extHostProtocol.IRelativePatternDto | { include: string | extHostProtocol.IRelativePatternDto | undefined; exclude: string | extHostProtocol.IRelativePatternDto | undefined } | undefined;\n\texport function from(pattern: { include: vscode.GlobPattern | undefined | null; exclude: vscode.GlobPattern | undefined } | vscode.GlobPattern | undefined): string | extHostProtocol.IRelativePatternDto | { include: string | extHostProtocol.IRelativePatternDto | undefined; exclude: string | extHostProtocol.IRelativePatternDto | undefined } | undefined {\n\t\tif (isExclusivePattern(pattern)) {\n\t\t\treturn {\n\t\t\t\tinclude: GlobPattern.from(pattern.include) ?? undefined,\n\t\t\t\texclude: GlobPattern.from(pattern.exclude) ?? undefined,\n\t\t\t};\n\t\t}\n\n\t\treturn GlobPattern.from(pattern) ?? undefined;\n\t}\n\n\texport function to(pattern: string | extHostProtocol.IRelativePatternDto | { include: string | extHostProtocol.IRelativePatternDto; exclude: string | extHostProtocol.IRelativePatternDto }): { include: vscode.GlobPattern; exclude: vscode.GlobPattern } | vscode.GlobPattern {\n\t\tif (isExclusivePattern(pattern)) {\n\t\t\treturn {\n\t\t\t\tinclude: GlobPattern.to(pattern.include),\n\t\t\t\texclude: GlobPattern.to(pattern.exclude)\n\t\t\t};\n\t\t}\n\n\t\treturn GlobPattern.to(pattern);\n\t}\n\n\tfunction isExclusivePattern<T>(obj: any): obj is { include?: T; exclude?: T } {\n\t\tconst ep = obj as { include?: T; exclude?: T } | undefined | null;\n\t\tif (!ep) {\n\t\t\treturn false;\n\t\t}\n\t\treturn !isUndefinedOrNull(ep.include) && !isUndefinedOrNull(ep.exclude);\n\t}\n}\n\nexport namespace NotebookStatusBarItem {\n\texport function from(item: vscode.NotebookCellStatusBarItem, commandsConverter: Command.ICommandsConverter, disposables: DisposableStore): notebooks.INotebookCellStatusBarItem {\n\t\tconst command = typeof item.command === 'string' ? { title: '', command: item.command } : item.command;\n\t\treturn {\n\t\t\talignment: item.alignment === types.NotebookCellStatusBarAlignment.Left ? notebooks.CellStatusbarAlignment.Left : notebooks.CellStatusbarAlignment.Right,\n\t\t\tcommand: commandsConverter.toInternal(command, disposables), // TODO@roblou\n\t\t\ttext: item.text,\n\t\t\ttooltip: item.tooltip,\n\t\t\taccessibilityInformation: item.accessibilityInformation,\n\t\t\tpriority: item.priority\n\t\t};\n\t}\n}\n\nexport namespace NotebookKernelSourceAction {\n\texport function from(item: vscode.NotebookKernelSourceAction, commandsConverter: Command.ICommandsConverter, disposables: DisposableStore): notebooks.INotebookKernelSourceAction {\n\t\tconst command = typeof item.command === 'string' ? { title: '', command: item.command } : item.command;\n\n\t\treturn {\n\t\t\tcommand: commandsConverter.toInternal(command, disposables),\n\t\t\tlabel: item.label,\n\t\t\tdescription: item.description,\n\t\t\tdetail: item.detail,\n\t\t\tdocumentation: item.documentation\n\t\t};\n\t}\n}\n\nexport namespace NotebookDocumentContentOptions {\n\texport function from(options: vscode.NotebookDocumentContentOptions | undefined): notebooks.TransientOptions {\n\t\treturn {\n\t\t\ttransientOutputs: options?.transientOutputs ?? false,\n\t\t\ttransientCellMetadata: options?.transientCellMetadata ?? {},\n\t\t\ttransientDocumentMetadata: options?.transientDocumentMetadata ?? {},\n\t\t\tcellContentMetadata: options?.cellContentMetadata ?? {}\n\t\t};\n\t}\n}\n\nexport namespace NotebookRendererScript {\n\texport function from(preload: vscode.NotebookRendererScript): { uri: UriComponents; provides: readonly string[] } {\n\t\treturn {\n\t\t\turi: preload.uri,\n\t\t\tprovides: preload.provides\n\t\t};\n\t}\n\n\texport function to(preload: { uri: UriComponents; provides: readonly string[] }): vscode.NotebookRendererScript {\n\t\treturn new types.NotebookRendererScript(URI.revive(preload.uri), preload.provides);\n\t}\n}\n\nexport namespace TestMessage {\n\texport function from(message: vscode.TestMessage): ITestErrorMessage.Serialized {\n\t\treturn {\n\t\t\tmessage: MarkdownString.fromStrict(message.message) || '',\n\t\t\ttype: TestMessageType.Error,\n\t\t\texpected: message.expectedOutput,\n\t\t\tactual: message.actualOutput,\n\t\t\tcontextValue: message.contextValue,\n\t\t\tlocation: message.location && ({ range: Range.from(message.location.range), uri: message.location.uri }),\n\t\t\tstackTrace: message.stackTrace?.map(s => ({\n\t\t\t\tlabel: s.label,\n\t\t\t\tposition: s.position && Position.from(s.position),\n\t\t\t\turi: s.uri && URI.revive(s.uri).toJSON(),\n\t\t\t})),\n\t\t};\n\t}\n\n\texport function to(item: ITestErrorMessage.Serialized): vscode.TestMessage {\n\t\tconst message = new types.TestMessage(typeof item.message === 'string' ? item.message : MarkdownString.to(item.message));\n\t\tmessage.actualOutput = item.actual;\n\t\tmessage.expectedOutput = item.expected;\n\t\tmessage.contextValue = item.contextValue;\n\t\tmessage.location = item.location ? location.to(item.location) : undefined;\n\t\treturn message;\n\t}\n}\n\nexport namespace TestTag {\n\texport const namespace = namespaceTestTag;\n\n\texport const denamespace = denamespaceTestTag;\n}\n\nexport namespace TestRunProfile {\n\texport function from(item: types.TestRunProfileBase): ITestRunProfileReference {\n\t\treturn {\n\t\t\tcontrollerId: item.controllerId,\n\t\t\tprofileId: item.profileId,\n\t\t\tgroup: TestRunProfileKind.from(item.kind),\n\t\t};\n\t}\n}\n\nexport namespace TestRunProfileKind {\n\tconst profileGroupToBitset: { [K in vscode.TestRunProfileKind]: TestRunProfileBitset } = {\n\t\t[types.TestRunProfileKind.Coverage]: TestRunProfileBitset.Coverage,\n\t\t[types.TestRunProfileKind.Debug]: TestRunProfileBitset.Debug,\n\t\t[types.TestRunProfileKind.Run]: TestRunProfileBitset.Run,\n\t};\n\n\texport function from(kind: types.TestRunProfileKind): TestRunProfileBitset {\n\t\treturn profileGroupToBitset.hasOwnProperty(kind) ? profileGroupToBitset[kind] : TestRunProfileBitset.Run;\n\t}\n}\n\nexport namespace TestItem {\n\texport type Raw = vscode.TestItem;\n\n\texport function from(item: vscode.TestItem): ITestItem {\n\t\tconst ctrlId = getPrivateApiFor(item).controllerId;\n\t\treturn {\n\t\t\textId: TestId.fromExtHostTestItem(item, ctrlId).toString(),\n\t\t\tlabel: item.label,\n\t\t\turi: URI.revive(item.uri),\n\t\t\tbusy: item.busy,\n\t\t\ttags: item.tags.map(t => TestTag.namespace(ctrlId, t.id)),\n\t\t\trange: editorRange.Range.lift(Range.from(item.range)),\n\t\t\tdescription: item.description || null,\n\t\t\tsortText: item.sortText || null,\n\t\t\terror: item.error ? (MarkdownString.fromStrict(item.error) || null) : null,\n\t\t};\n\t}\n\n\texport function toPlain(item: ITestItem.Serialized): vscode.TestItem {\n\t\treturn {\n\t\t\tparent: undefined,\n\t\t\terror: undefined,\n\t\t\tid: TestId.fromString(item.extId).localId,\n\t\t\tlabel: item.label,\n\t\t\turi: URI.revive(item.uri),\n\t\t\ttags: (item.tags || []).map(t => {\n\t\t\t\tconst { tagId } = TestTag.denamespace(t);\n\t\t\t\treturn new types.TestTag(tagId);\n\t\t\t}),\n\t\t\tchildren: {\n\t\t\t\tadd: () => { },\n\t\t\t\tdelete: () => { },\n\t\t\t\tforEach: () => { },\n\t\t\t\t*[Symbol.iterator]() { },\n\t\t\t\tget: () => undefined,\n\t\t\t\treplace: () => { },\n\t\t\t\tsize: 0,\n\t\t\t},\n\t\t\trange: Range.to(item.range || undefined),\n\t\t\tcanResolveChildren: false,\n\t\t\tbusy: item.busy,\n\t\t\tdescription: item.description || undefined,\n\t\t\tsortText: item.sortText || undefined,\n\t\t};\n\t}\n}\n\nexport namespace TestTag {\n\texport function from(tag: vscode.TestTag): ITestTag {\n\t\treturn { id: tag.id };\n\t}\n\n\texport function to(tag: ITestTag): vscode.TestTag {\n\t\treturn new types.TestTag(tag.id);\n\t}\n}\n\nexport namespace TestResults {\n\tconst convertTestResultItem = (node: IPrefixTreeNode<TestResultItem.Serialized>, parent?: vscode.TestResultSnapshot): vscode.TestResultSnapshot | undefined => {\n\t\tconst item = node.value;\n\t\tif (!item) {\n\t\t\treturn undefined; // should be unreachable\n\t\t}\n\n\t\tconst snapshot: vscode.TestResultSnapshot = ({\n\t\t\t...TestItem.toPlain(item.item),\n\t\t\tparent,\n\t\t\ttaskStates: item.tasks.map(t => ({\n\t\t\t\tstate: t.state as number as types.TestResultState,\n\t\t\t\tduration: t.duration,\n\t\t\t\tmessages: t.messages\n\t\t\t\t\t.filter((m): m is ITestErrorMessage.Serialized => m.type === TestMessageType.Error)\n\t\t\t\t\t.map(TestMessage.to),\n\t\t\t})),\n\t\t\tchildren: [],\n\t\t});\n\n\t\tif (node.children) {\n\t\t\tfor (const child of node.children.values()) {\n\t\t\t\tconst c = convertTestResultItem(child, snapshot);\n\t\t\t\tif (c) {\n\t\t\t\t\tsnapshot.children.push(c);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn snapshot;\n\t};\n\n\texport function to(serialized: ISerializedTestResults): vscode.TestRunResult {\n\t\tconst tree = new WellDefinedPrefixTree<TestResultItem.Serialized>();\n\t\tfor (const item of serialized.items) {\n\t\t\ttree.insert(TestId.fromString(item.item.extId).path, item);\n\t\t}\n\n\t\t// Get the first node with a value in each subtree of IDs.\n\t\tconst queue = [tree.nodes];\n\t\tconst roots: IPrefixTreeNode<TestResultItem.Serialized>[] = [];\n\t\twhile (queue.length) {\n\t\t\tfor (const node of queue.pop()!) {\n\t\t\t\tif (node.value) {\n\t\t\t\t\troots.push(node);\n\t\t\t\t} else if (node.children) {\n\t\t\t\t\tqueue.push(node.children.values());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcompletedAt: serialized.completedAt,\n\t\t\tresults: roots.map(r => convertTestResultItem(r)).filter(isDefined),\n\t\t};\n\t}\n}\n\nexport namespace TestCoverage {\n\tfunction fromCoverageCount(count: vscode.TestCoverageCount): ICoverageCount {\n\t\treturn { covered: count.covered, total: count.total };\n\t}\n\n\tfunction fromLocation(location: vscode.Range | vscode.Position) {\n\t\treturn 'line' in location ? Position.from(location) : Range.from(location);\n\t}\n\n\tfunction toLocation(location: IPosition | editorRange.IRange): types.Position | types.Range;\n\tfunction toLocation(location: IPosition | editorRange.IRange | undefined): types.Position | types.Range | undefined;\n\tfunction toLocation(location: IPosition | editorRange.IRange | undefined): types.Position | types.Range | undefined {\n\t\tif (!location) { return undefined; }\n\t\treturn 'endLineNumber' in location ? Range.to(location) : Position.to(location);\n\t}\n\n\texport function to(serialized: CoverageDetails.Serialized): vscode.FileCoverageDetail {\n\t\tif (serialized.type === DetailType.Statement) {\n\t\t\tconst branches: vscode.BranchCoverage[] = [];\n\t\t\tif (serialized.branches) {\n\t\t\t\tfor (const branch of serialized.branches) {\n\t\t\t\t\tbranches.push({\n\t\t\t\t\t\texecuted: branch.count,\n\t\t\t\t\t\tlocation: toLocation(branch.location),\n\t\t\t\t\t\tlabel: branch.label\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn new types.StatementCoverage(\n\t\t\t\tserialized.count,\n\t\t\t\ttoLocation(serialized.location),\n\t\t\t\tserialized.branches?.map(b => new types.BranchCoverage(\n\t\t\t\t\tb.count,\n\t\t\t\t\ttoLocation(b.location)!,\n\t\t\t\t\tb.label,\n\t\t\t\t))\n\t\t\t);\n\t\t} else {\n\t\t\treturn new types.DeclarationCoverage(\n\t\t\t\tserialized.name,\n\t\t\t\tserialized.count,\n\t\t\t\ttoLocation(serialized.location),\n\t\t\t);\n\t\t}\n\t}\n\n\texport function fromDetails(coverage: vscode.FileCoverageDetail): CoverageDetails.Serialized {\n\t\tif (typeof coverage.executed === 'number' && coverage.executed < 0) {\n\t\t\tthrow new Error(`Invalid coverage count ${coverage.executed}`);\n\t\t}\n\n\t\tif ('branches' in coverage) {\n\t\t\treturn {\n\t\t\t\tcount: coverage.executed,\n\t\t\t\tlocation: fromLocation(coverage.location),\n\t\t\t\ttype: DetailType.Statement,\n\t\t\t\tbranches: coverage.branches.length\n\t\t\t\t\t? coverage.branches.map(b => ({ count: b.executed, location: b.location && fromLocation(b.location), label: b.label }))\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\ttype: DetailType.Declaration,\n\t\t\t\tname: coverage.name,\n\t\t\t\tcount: coverage.executed,\n\t\t\t\tlocation: fromLocation(coverage.location),\n\t\t\t};\n\t\t}\n\t}\n\n\texport function fromFile(controllerId: string, id: string, coverage: vscode.FileCoverage): IFileCoverage.Serialized {\n\t\ttypes.validateTestCoverageCount(coverage.statementCoverage);\n\t\ttypes.validateTestCoverageCount(coverage.branchCoverage);\n\t\ttypes.validateTestCoverageCount(coverage.declarationCoverage);\n\n\t\treturn {\n\t\t\tid,\n\t\t\turi: coverage.uri,\n\t\t\tstatement: fromCoverageCount(coverage.statementCoverage),\n\t\t\tbranch: coverage.branchCoverage && fromCoverageCount(coverage.branchCoverage),\n\t\t\tdeclaration: coverage.declarationCoverage && fromCoverageCount(coverage.declarationCoverage),\n\t\t\ttestIds: coverage instanceof types.FileCoverage && coverage.includesTests.length ?\n\t\t\t\tcoverage.includesTests.map(t => TestId.fromExtHostTestItem(t, controllerId).toString()) : undefined,\n\t\t};\n\t}\n}\n\nexport namespace CodeActionTriggerKind {\n\n\texport function to(value: languages.CodeActionTriggerType): types.CodeActionTriggerKind {\n\t\tswitch (value) {\n\t\t\tcase languages.CodeActionTriggerType.Invoke:\n\t\t\t\treturn types.CodeActionTriggerKind.Invoke;\n\n\t\t\tcase languages.CodeActionTriggerType.Auto:\n\t\t\t\treturn types.CodeActionTriggerKind.Automatic;\n\t\t}\n\t}\n}\n\nexport namespace TypeHierarchyItem {\n\n\texport function to(item: extHostProtocol.ITypeHierarchyItemDto): types.TypeHierarchyItem {\n\t\tconst result = new types.TypeHierarchyItem(\n\t\t\tSymbolKind.to(item.kind),\n\t\t\titem.name,\n\t\t\titem.detail || '',\n\t\t\tURI.revive(item.uri),\n\t\t\tRange.to(item.range),\n\t\t\tRange.to(item.selectionRange)\n\t\t);\n\n\t\tresult._sessionId = item._sessionId;\n\t\tresult._itemId = item._itemId;\n\n\t\treturn result;\n\t}\n\n\texport function from(item: vscode.TypeHierarchyItem, sessionId?: string, itemId?: string): extHostProtocol.ITypeHierarchyItemDto {\n\n\t\tsessionId = sessionId ?? (<types.TypeHierarchyItem>item)._sessionId;\n\t\titemId = itemId ?? (<types.TypeHierarchyItem>item)._itemId;\n\n\t\tif (sessionId === undefined || itemId === undefined) {\n\t\t\tthrow new Error('invalid item');\n\t\t}\n\n\t\treturn {\n\t\t\t_sessionId: sessionId,\n\t\t\t_itemId: itemId,\n\t\t\tkind: SymbolKind.from(item.kind),\n\t\t\tname: item.name,\n\t\t\tdetail: item.detail ?? '',\n\t\t\turi: item.uri,\n\t\t\trange: Range.from(item.range),\n\t\t\tselectionRange: Range.from(item.selectionRange),\n\t\t\ttags: item.tags?.map(SymbolTag.from)\n\t\t};\n\t}\n}\n\nexport namespace ViewBadge {\n\texport function from(badge: vscode.ViewBadge | undefined): IViewBadge | undefined {\n\t\tif (!badge) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: badge.value,\n\t\t\ttooltip: badge.tooltip\n\t\t};\n\t}\n}\n\nexport namespace DataTransferItem {\n\texport function to(mime: string, item: extHostProtocol.DataTransferItemDTO, resolveFileData: (id: string) => Promise<Uint8Array>): types.DataTransferItem {\n\t\tconst file = item.fileData;\n\t\tif (file) {\n\t\t\treturn new types.InternalFileDataTransferItem(\n\t\t\t\tnew types.DataTransferFile(file.name, URI.revive(file.uri), file.id, createSingleCallFunction(() => resolveFileData(file.id))));\n\t\t}\n\n\t\tif (mime === Mimes.uriList && item.uriListData) {\n\t\t\treturn new types.InternalDataTransferItem(reviveUriList(item.uriListData));\n\t\t}\n\n\t\treturn new types.InternalDataTransferItem(item.asString);\n\t}\n\n\texport async function from(mime: string, item: vscode.DataTransferItem | IDataTransferItem, id: string = generateUuid()): Promise<extHostProtocol.DataTransferItemDTO> {\n\t\tconst stringValue = await item.asString();\n\n\t\tif (mime === Mimes.uriList) {\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tasString: stringValue,\n\t\t\t\tfileData: undefined,\n\t\t\t\turiListData: serializeUriList(stringValue),\n\t\t\t};\n\t\t}\n\n\t\tconst fileValue = item.asFile();\n\t\treturn {\n\t\t\tid,\n\t\t\tasString: stringValue,\n\t\t\tfileData: fileValue ? {\n\t\t\t\tname: fileValue.name,\n\t\t\t\turi: fileValue.uri,\n\t\t\t\tid: (fileValue as types.DataTransferFile)._itemId ?? (fileValue as IDataTransferFile).id,\n\t\t\t} : undefined,\n\t\t};\n\t}\n\n\tfunction serializeUriList(stringValue: string): ReadonlyArray<string | URI> {\n\t\treturn UriList.split(stringValue).map(part => {\n\t\t\tif (part.startsWith('#')) {\n\t\t\t\treturn part;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\treturn URI.parse(part);\n\t\t\t} catch {\n\t\t\t\t// noop\n\t\t\t}\n\n\t\t\treturn part;\n\t\t});\n\t}\n\n\tfunction reviveUriList(parts: ReadonlyArray<string | UriComponents>): string {\n\t\treturn UriList.create(parts.map(part => {\n\t\t\treturn typeof part === 'string' ? part : URI.revive(part);\n\t\t}));\n\t}\n}\n\nexport namespace DataTransfer {\n\texport function toDataTransfer(value: extHostProtocol.DataTransferDTO, resolveFileData: (itemId: string) => Promise<Uint8Array>): types.DataTransfer {\n\t\tconst init = value.items.map(([type, item]) => {\n\t\t\treturn [type, DataTransferItem.to(type, item, resolveFileData)] as const;\n\t\t});\n\t\treturn new types.DataTransfer(init);\n\t}\n\n\texport async function from(dataTransfer: vscode.DataTransfer): Promise<extHostProtocol.DataTransferDTO> {\n\t\tconst items = await Promise.all(Array.from(dataTransfer, async ([mime, value]) => {\n\t\t\treturn [mime, await DataTransferItem.from(mime, value)] as const;\n\t\t}));\n\n\t\treturn { items };\n\t}\n\n\texport async function fromList(dataTransfer: Iterable<readonly [string, IDataTransferItem]>): Promise<extHostProtocol.DataTransferDTO> {\n\t\tconst items = await Promise.all(Array.from(dataTransfer, async ([mime, value]) => {\n\t\t\treturn [mime, await DataTransferItem.from(mime, value, value.id)] as const;\n\t\t}));\n\n\t\treturn { items };\n\t}\n}\n\nexport namespace ChatFollowup {\n\texport function from(followup: vscode.ChatFollowup, request: IChatAgentRequest | undefined): IChatFollowup {\n\t\treturn {\n\t\t\tkind: 'reply',\n\t\t\tagentId: followup.participant ?? request?.agentId ?? '',\n\t\t\tsubCommand: followup.command ?? request?.command,\n\t\t\tmessage: followup.prompt,\n\t\t\ttitle: followup.label\n\t\t};\n\t}\n\n\texport function to(followup: IChatFollowup): vscode.ChatFollowup {\n\t\treturn {\n\t\t\tprompt: followup.message,\n\t\t\tlabel: followup.title,\n\t\t\tparticipant: followup.agentId,\n\t\t\tcommand: followup.subCommand,\n\t\t};\n\t}\n}\n\nexport namespace LanguageModelChatMessageRole {\n\texport function to(role: chatProvider.ChatMessageRole): vscode.LanguageModelChatMessageRole {\n\t\tswitch (role) {\n\t\t\tcase chatProvider.ChatMessageRole.System: return types.LanguageModelChatMessageRole.System;\n\t\t\tcase chatProvider.ChatMessageRole.User: return types.LanguageModelChatMessageRole.User;\n\t\t\tcase chatProvider.ChatMessageRole.Assistant: return types.LanguageModelChatMessageRole.Assistant;\n\t\t}\n\t}\n\n\texport function from(role: vscode.LanguageModelChatMessageRole): chatProvider.ChatMessageRole {\n\t\tswitch (role) {\n\t\t\tcase types.LanguageModelChatMessageRole.System: return chatProvider.ChatMessageRole.System;\n\t\t\tcase types.LanguageModelChatMessageRole.User: return chatProvider.ChatMessageRole.User;\n\t\t\tcase types.LanguageModelChatMessageRole.Assistant: return chatProvider.ChatMessageRole.Assistant;\n\t\t}\n\t\treturn chatProvider.ChatMessageRole.User;\n\t}\n}\n\nexport namespace LanguageModelChatMessage {\n\n\texport function to(message: chatProvider.IChatMessage): vscode.LanguageModelChatMessage {\n\t\tconst content = message.content.map(c => {\n\t\t\tif (c.type === 'text') {\n\t\t\t\treturn new LanguageModelTextPart(c.value);\n\t\t\t} else if (c.type === 'tool_result') {\n\t\t\t\tconst content: (LanguageModelTextPart | LanguageModelPromptTsxPart)[] = c.value.map(part => {\n\t\t\t\t\tif (part.type === 'text') {\n\t\t\t\t\t\treturn new types.LanguageModelTextPart(part.value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn new types.LanguageModelPromptTsxPart(part.value);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn new types.LanguageModelToolResultPart(c.toolCallId, content, c.isError);\n\t\t\t} else if (c.type === 'image_url') {\n\t\t\t\t// Non-stable types\n\t\t\t\treturn undefined;\n\t\t\t} else if (c.type === 'tool_use') {\n\t\t\t\treturn new types.LanguageModelToolCallPart(c.toolCallId, c.name, c.parameters);\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t}).filter(c => c !== undefined);\n\n\t\tconst role = LanguageModelChatMessageRole.to(message.role);\n\t\tconst result = new types.LanguageModelChatMessage(role, content, message.name);\n\t\treturn result;\n\t}\n\n\texport function from(message: vscode.LanguageModelChatMessage): chatProvider.IChatMessage {\n\n\t\tconst role = LanguageModelChatMessageRole.from(message.role);\n\t\tconst name = message.name;\n\n\t\tlet messageContent = message.content;\n\t\tif (typeof messageContent === 'string') {\n\t\t\tmessageContent = [new types.LanguageModelTextPart(messageContent)];\n\t\t}\n\n\t\tconst content = messageContent.map((c): chatProvider.IChatMessagePart => {\n\t\t\tif (c instanceof types.LanguageModelToolResultPart) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'tool_result',\n\t\t\t\t\ttoolCallId: c.callId,\n\t\t\t\t\tvalue: coalesce(c.content.map(part => {\n\t\t\t\t\t\tif (part instanceof types.LanguageModelTextPart) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\tvalue: part.value\n\t\t\t\t\t\t\t} satisfies IChatResponseTextPart;\n\t\t\t\t\t\t} else if (part instanceof types.LanguageModelPromptTsxPart) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\ttype: 'prompt_tsx',\n\t\t\t\t\t\t\t\tvalue: part.value,\n\t\t\t\t\t\t\t} satisfies IChatResponsePromptTsxPart;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Strip unknown parts\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t})),\n\t\t\t\t\tisError: c.isError\n\t\t\t\t};\n\t\t\t} else if (c instanceof types.LanguageModelToolCallPart) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'tool_use',\n\t\t\t\t\ttoolCallId: c.callId,\n\t\t\t\t\tname: c.name,\n\t\t\t\t\tparameters: c.input\n\t\t\t\t};\n\t\t\t} else if (c instanceof types.LanguageModelTextPart) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\tvalue: c.value\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tif (typeof c !== 'string') {\n\t\t\t\t\tthrow new Error('Unexpected chat message content type');\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\tvalue: c\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\trole,\n\t\t\tname,\n\t\t\tcontent\n\t\t};\n\t}\n}\n\nexport namespace LanguageModelChatMessage2 {\n\n\texport function to(message: chatProvider.IChatMessage): vscode.LanguageModelChatMessage2 {\n\t\tconst content = message.content.map(c => {\n\t\t\tif (c.type === 'text') {\n\t\t\t\treturn new LanguageModelTextPart(c.value);\n\t\t\t} else if (c.type === 'tool_result') {\n\t\t\t\tconst content: (LanguageModelTextPart | LanguageModelPromptTsxPart | LanguageModelDataPart)[] = c.value.map(part => {\n\t\t\t\t\tif (part.type === 'text') {\n\t\t\t\t\t\treturn new types.LanguageModelTextPart(part.value);\n\t\t\t\t\t} else if (part.type === 'data') {\n\t\t\t\t\t\treturn new types.LanguageModelDataPart(part.value.data.buffer, part.value.mimeType);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn new types.LanguageModelPromptTsxPart(part.value);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn new types.LanguageModelToolResultPart2(c.toolCallId, content, c.isError);\n\t\t\t} else if (c.type === 'image_url') {\n\t\t\t\treturn new types.LanguageModelDataPart(c.value.data.buffer, c.value.mimeType);\n\t\t\t} else if (c.type === 'data') {\n\t\t\t\treturn new types.LanguageModelDataPart(c.data.buffer, c.mimeType);\n\t\t\t} else {\n\t\t\t\treturn new types.LanguageModelToolCallPart(c.toolCallId, c.name, c.parameters);\n\t\t\t}\n\t\t});\n\t\tconst role = LanguageModelChatMessageRole.to(message.role);\n\t\tconst result = new types.LanguageModelChatMessage2(role, content, message.name);\n\t\treturn result;\n\t}\n\n\texport function from(message: vscode.LanguageModelChatMessage2): chatProvider.IChatMessage {\n\n\t\tconst role = LanguageModelChatMessageRole.from(message.role);\n\t\tconst name = message.name;\n\n\t\tlet messageContent = message.content;\n\t\tif (typeof messageContent === 'string') {\n\t\t\tmessageContent = [new types.LanguageModelTextPart(messageContent)];\n\t\t}\n\n\t\tconst content = messageContent.map((c): chatProvider.IChatMessagePart => {\n\t\t\tif ((c instanceof types.LanguageModelToolResultPart2) || (c instanceof types.LanguageModelToolResultPart)) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'tool_result',\n\t\t\t\t\ttoolCallId: c.callId,\n\t\t\t\t\tvalue: coalesce(c.content.map(part => {\n\t\t\t\t\t\tif (part instanceof types.LanguageModelTextPart) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\tvalue: part.value\n\t\t\t\t\t\t\t} satisfies IChatResponseTextPart;\n\t\t\t\t\t\t} else if (part instanceof types.LanguageModelPromptTsxPart) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\ttype: 'prompt_tsx',\n\t\t\t\t\t\t\t\tvalue: part.value,\n\t\t\t\t\t\t\t} satisfies IChatResponsePromptTsxPart;\n\t\t\t\t\t\t} else if (part instanceof types.LanguageModelDataPart) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\ttype: 'data',\n\t\t\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t\t\tmimeType: part.mimeType as chatProvider.ChatImageMimeType,\n\t\t\t\t\t\t\t\t\tdata: VSBuffer.wrap(part.data)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} satisfies IChatResponseDataPart;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Strip unknown parts\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t})),\n\t\t\t\t\tisError: c.isError\n\t\t\t\t};\n\t\t\t} else if (c instanceof types.LanguageModelDataPart) {\n\t\t\t\tif (isImageDataPart(c)) {\n\t\t\t\t\tconst value: chatProvider.IChatImageURLPart = {\n\t\t\t\t\t\tmimeType: c.mimeType as chatProvider.ChatImageMimeType,\n\t\t\t\t\t\tdata: VSBuffer.wrap(c.data),\n\t\t\t\t\t};\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 'image_url',\n\t\t\t\t\t\tvalue: value\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 'data',\n\t\t\t\t\t\tmimeType: c.mimeType,\n\t\t\t\t\t\tdata: VSBuffer.wrap(c.data),\n\t\t\t\t\t} satisfies IChatMessageDataPart;\n\t\t\t\t}\n\t\t\t} else if (c instanceof types.LanguageModelToolCallPart) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'tool_use',\n\t\t\t\t\ttoolCallId: c.callId,\n\t\t\t\t\tname: c.name,\n\t\t\t\t\tparameters: c.input\n\t\t\t\t};\n\t\t\t} else if (c instanceof types.LanguageModelTextPart) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\tvalue: c.value\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tif (typeof c !== 'string') {\n\t\t\t\t\tthrow new Error('Unexpected chat message content type llm 2');\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\tvalue: c\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\trole,\n\t\t\tname,\n\t\t\tcontent\n\t\t};\n\t}\n}\n\nfunction isImageDataPart(part: types.LanguageModelDataPart): boolean {\n\tswitch (part.mimeType) {\n\t\tcase types.ChatImageMimeType.PNG:\n\t\tcase types.ChatImageMimeType.JPEG:\n\t\tcase types.ChatImageMimeType.GIF:\n\t\tcase types.ChatImageMimeType.WEBP:\n\t\tcase types.ChatImageMimeType.BMP:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport namespace ChatResponseMarkdownPart {\n\texport function from(part: vscode.ChatResponseMarkdownPart): Dto<IChatMarkdownContent> {\n\t\treturn {\n\t\t\tkind: 'markdownContent',\n\t\t\tcontent: MarkdownString.from(part.value)\n\t\t};\n\t}\n\texport function to(part: Dto<IChatMarkdownContent>): vscode.ChatResponseMarkdownPart {\n\t\treturn new types.ChatResponseMarkdownPart(MarkdownString.to(part.content));\n\t}\n}\n\nexport namespace ChatResponseCodeblockUriPart {\n\texport function from(part: vscode.ChatResponseCodeblockUriPart): Dto<IChatResponseCodeblockUriPart> {\n\t\treturn {\n\t\t\tkind: 'codeblockUri',\n\t\t\turi: part.value,\n\t\t\tisEdit: part.isEdit,\n\t\t};\n\t}\n\texport function to(part: Dto<IChatResponseCodeblockUriPart>): vscode.ChatResponseCodeblockUriPart {\n\t\treturn new types.ChatResponseCodeblockUriPart(URI.revive(part.uri), part.isEdit);\n\t}\n}\n\nexport namespace ChatResponseMarkdownWithVulnerabilitiesPart {\n\texport function from(part: vscode.ChatResponseMarkdownWithVulnerabilitiesPart): Dto<IChatAgentMarkdownContentWithVulnerability> {\n\t\treturn {\n\t\t\tkind: 'markdownVuln',\n\t\t\tcontent: MarkdownString.from(part.value),\n\t\t\tvulnerabilities: part.vulnerabilities,\n\t\t};\n\t}\n\texport function to(part: Dto<IChatAgentMarkdownContentWithVulnerability>): vscode.ChatResponseMarkdownWithVulnerabilitiesPart {\n\t\treturn new types.ChatResponseMarkdownWithVulnerabilitiesPart(MarkdownString.to(part.content), part.vulnerabilities);\n\t}\n}\n\nexport namespace ChatResponseConfirmationPart {\n\texport function from(part: vscode.ChatResponseConfirmationPart): Dto<IChatConfirmation> {\n\t\treturn {\n\t\t\tkind: 'confirmation',\n\t\t\ttitle: part.title,\n\t\t\tmessage: part.message,\n\t\t\tdata: part.data,\n\t\t\tbuttons: part.buttons\n\t\t};\n\t}\n}\n\nexport namespace ChatResponseFilesPart {\n\texport function from(part: vscode.ChatResponseFileTreePart): IChatTreeData {\n\t\tconst { value, baseUri } = part;\n\t\tfunction convert(items: vscode.ChatResponseFileTree[], baseUri: URI): extHostProtocol.IChatResponseProgressFileTreeData[] {\n\t\t\treturn items.map(item => {\n\t\t\t\tconst myUri = URI.joinPath(baseUri, item.name);\n\t\t\t\treturn {\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t\turi: myUri,\n\t\t\t\t\tchildren: item.children && convert(item.children, myUri)\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t\treturn {\n\t\t\tkind: 'treeData',\n\t\t\ttreeData: {\n\t\t\t\tlabel: basename(baseUri),\n\t\t\t\turi: baseUri,\n\t\t\t\tchildren: convert(value, baseUri)\n\t\t\t}\n\t\t};\n\t}\n\texport function to(part: Dto<IChatTreeData>): vscode.ChatResponseFileTreePart {\n\t\tconst treeData = revive<extHostProtocol.IChatResponseProgressFileTreeData>(part.treeData);\n\t\tfunction convert(items: extHostProtocol.IChatResponseProgressFileTreeData[]): vscode.ChatResponseFileTree[] {\n\t\t\treturn items.map(item => {\n\t\t\t\treturn {\n\t\t\t\t\tname: item.label,\n\t\t\t\t\tchildren: item.children && convert(item.children)\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\n\t\tconst baseUri = treeData.uri;\n\t\tconst items = treeData.children ? convert(treeData.children) : [];\n\t\treturn new types.ChatResponseFileTreePart(items, baseUri);\n\t}\n}\n\nexport namespace ChatResponseAnchorPart {\n\texport function from(part: vscode.ChatResponseAnchorPart): Dto<IChatContentInlineReference> {\n\t\t// Work around type-narrowing confusion between vscode.Uri and URI\n\t\tconst isUri = (thing: unknown): thing is vscode.Uri => URI.isUri(thing);\n\t\tconst isSymbolInformation = (thing: object): thing is vscode.SymbolInformation => 'name' in thing;\n\n\t\treturn {\n\t\t\tkind: 'inlineReference',\n\t\t\tname: part.title,\n\t\t\tinlineReference: isUri(part.value)\n\t\t\t\t? part.value\n\t\t\t\t: isSymbolInformation(part.value)\n\t\t\t\t\t? WorkspaceSymbol.from(part.value)\n\t\t\t\t\t: Location.from(part.value)\n\t\t};\n\t}\n\n\texport function to(part: Dto<IChatContentInlineReference>): vscode.ChatResponseAnchorPart {\n\t\tconst value = revive<IChatContentInlineReference>(part);\n\t\treturn new types.ChatResponseAnchorPart(\n\t\t\tURI.isUri(value.inlineReference)\n\t\t\t\t? value.inlineReference\n\t\t\t\t: 'location' in value.inlineReference\n\t\t\t\t\t? WorkspaceSymbol.to(value.inlineReference) as vscode.SymbolInformation\n\t\t\t\t\t: Location.to(value.inlineReference),\n\t\t\tpart.name\n\t\t);\n\t}\n}\n\nexport namespace ChatResponseProgressPart {\n\texport function from(part: vscode.ChatResponseProgressPart): Dto<IChatProgressMessage> {\n\t\treturn {\n\t\t\tkind: 'progressMessage',\n\t\t\tcontent: MarkdownString.from(part.value)\n\t\t};\n\t}\n\texport function to(part: Dto<IChatProgressMessage>): vscode.ChatResponseProgressPart {\n\t\treturn new types.ChatResponseProgressPart(part.content.value);\n\t}\n}\n\nexport namespace ChatResponseWarningPart {\n\texport function from(part: vscode.ChatResponseWarningPart): Dto<IChatWarningMessage> {\n\t\treturn {\n\t\t\tkind: 'warning',\n\t\t\tcontent: MarkdownString.from(part.value)\n\t\t};\n\t}\n\texport function to(part: Dto<IChatWarningMessage>): vscode.ChatResponseWarningPart {\n\t\treturn new types.ChatResponseWarningPart(part.content.value);\n\t}\n}\n\nexport namespace ChatResponseExtensionsPart {\n\texport function from(part: vscode.ChatResponseExtensionsPart): Dto<IChatExtensionsContent> {\n\t\treturn {\n\t\t\tkind: 'extensions',\n\t\t\textensions: part.extensions\n\t\t};\n\t}\n}\n\nexport namespace ChatResponseMovePart {\n\texport function from(part: vscode.ChatResponseMovePart): Dto<IChatMoveMessage> {\n\t\treturn {\n\t\t\tkind: 'move',\n\t\t\turi: part.uri,\n\t\t\trange: Range.from(part.range),\n\t\t};\n\t}\n\texport function to(part: Dto<IChatMoveMessage>): vscode.ChatResponseMovePart {\n\t\treturn new types.ChatResponseMovePart(URI.revive(part.uri), Range.to(part.range));\n\t}\n}\n\nexport namespace ChatPrepareToolInvocationPart {\n\texport function from(part: vscode.ChatPrepareToolInvocationPart): IChatPrepareToolInvocationPart {\n\t\treturn {\n\t\t\tkind: 'prepareToolInvocation',\n\t\t\ttoolName: part.toolName,\n\t\t};\n\t}\n\n\texport function to(part: IChatPrepareToolInvocationPart): vscode.ChatPrepareToolInvocationPart {\n\t\treturn new types.ChatPrepareToolInvocationPart(part.toolName);\n\t}\n}\n\nexport namespace ChatTask {\n\texport function from(part: vscode.ChatResponseProgressPart2): IChatTaskDto {\n\t\treturn {\n\t\t\tkind: 'progressTask',\n\t\t\tcontent: MarkdownString.from(part.value),\n\t\t};\n\t}\n}\n\nexport namespace ChatTaskResult {\n\texport function from(part: string | void): Dto<IChatTaskResult> {\n\t\treturn {\n\t\t\tkind: 'progressTaskResult',\n\t\t\tcontent: typeof part === 'string' ? MarkdownString.from(part) : undefined\n\t\t};\n\t}\n}\n\nexport namespace ChatResponseCommandButtonPart {\n\texport function from(part: vscode.ChatResponseCommandButtonPart, commandsConverter: CommandsConverter, commandDisposables: DisposableStore): Dto<IChatCommandButton> {\n\t\t// If the command isn't in the converter, then this session may have been restored, and the command args don't exist anymore\n\t\tconst command = commandsConverter.toInternal(part.value, commandDisposables) ?? { command: part.value.command, title: part.value.title };\n\t\treturn {\n\t\t\tkind: 'command',\n\t\t\tcommand\n\t\t};\n\t}\n\texport function to(part: Dto<IChatCommandButton>, commandsConverter: CommandsConverter): vscode.ChatResponseCommandButtonPart {\n\t\t// If the command isn't in the converter, then this session may have been restored, and the command args don't exist anymore\n\t\treturn new types.ChatResponseCommandButtonPart(commandsConverter.fromInternal(part.command) ?? { command: part.command.id, title: part.command.title });\n\t}\n}\n\nexport namespace ChatResponseTextEditPart {\n\texport function from(part: vscode.ChatResponseTextEditPart): Dto<IChatTextEdit> {\n\t\treturn {\n\t\t\tkind: 'textEdit',\n\t\t\turi: part.uri,\n\t\t\tedits: part.edits.map(e => TextEdit.from(e)),\n\t\t\tdone: part.isDone\n\t\t};\n\t}\n\texport function to(part: Dto<IChatTextEdit>): vscode.ChatResponseTextEditPart {\n\t\tconst result = new types.ChatResponseTextEditPart(URI.revive(part.uri), part.edits.map(e => TextEdit.to(e)));\n\t\tresult.isDone = part.done;\n\t\treturn result;\n\t}\n\n}\n\nexport namespace NotebookEdit {\n\texport function from(edit: vscode.NotebookEdit): extHostProtocol.ICellEditOperationDto {\n\t\tif (edit.newCellMetadata) {\n\t\t\treturn {\n\t\t\t\teditType: CellEditType.Metadata,\n\t\t\t\tindex: edit.range.start,\n\t\t\t\tmetadata: edit.newCellMetadata\n\t\t\t};\n\t\t} else if (edit.newNotebookMetadata) {\n\t\t\treturn {\n\t\t\t\teditType: CellEditType.DocumentMetadata,\n\t\t\t\tmetadata: edit.newNotebookMetadata\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\teditType: CellEditType.Replace,\n\t\t\t\tindex: edit.range.start,\n\t\t\t\tcount: edit.range.end - edit.range.start,\n\t\t\t\tcells: edit.newCells.map(NotebookCellData.from)\n\t\t\t};\n\t\t}\n\t}\n}\n\n\nexport namespace ChatResponseNotebookEditPart {\n\texport function from(part: vscode.ChatResponseNotebookEditPart): extHostProtocol.IChatNotebookEditDto {\n\t\treturn {\n\t\t\tkind: 'notebookEdit',\n\t\t\turi: part.uri,\n\t\t\tedits: part.edits.map(NotebookEdit.from),\n\t\t\tdone: part.isDone\n\t\t};\n\t}\n}\n\nexport namespace ChatResponseReferencePart {\n\texport function from(part: types.ChatResponseReferencePart): Dto<IChatContentReference> {\n\t\tconst iconPath = ThemeIcon.isThemeIcon(part.iconPath) ? part.iconPath\n\t\t\t: URI.isUri(part.iconPath) ? { light: URI.revive(part.iconPath) }\n\t\t\t\t: (part.iconPath && 'light' in part.iconPath && 'dark' in part.iconPath && URI.isUri(part.iconPath.light) && URI.isUri(part.iconPath.dark) ? { light: URI.revive(part.iconPath.light), dark: URI.revive(part.iconPath.dark) }\n\t\t\t\t\t: undefined);\n\n\t\tif (typeof part.value === 'object' && 'variableName' in part.value) {\n\t\t\treturn {\n\t\t\t\tkind: 'reference',\n\t\t\t\treference: {\n\t\t\t\t\tvariableName: part.value.variableName,\n\t\t\t\t\tvalue: URI.isUri(part.value.value) || !part.value.value ?\n\t\t\t\t\t\tpart.value.value :\n\t\t\t\t\t\tLocation.from(part.value.value as vscode.Location)\n\t\t\t\t},\n\t\t\t\ticonPath,\n\t\t\t\toptions: part.options\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tkind: 'reference',\n\t\t\treference: URI.isUri(part.value) || typeof part.value === 'string' ?\n\t\t\t\tpart.value :\n\t\t\t\tLocation.from(<vscode.Location>part.value),\n\t\t\ticonPath,\n\t\t\toptions: part.options\n\t\t};\n\t}\n\texport function to(part: Dto<IChatContentReference>): vscode.ChatResponseReferencePart {\n\t\tconst value = revive<IChatContentReference>(part);\n\n\t\tconst mapValue = (value: URI | languages.Location): vscode.Uri | vscode.Location => URI.isUri(value) ?\n\t\t\tvalue :\n\t\t\tLocation.to(value);\n\n\t\treturn new types.ChatResponseReferencePart(\n\t\t\ttypeof value.reference === 'string' ? value.reference : 'variableName' in value.reference ? {\n\t\t\t\tvariableName: value.reference.variableName,\n\t\t\t\tvalue: value.reference.value && mapValue(value.reference.value)\n\t\t\t} :\n\t\t\t\tmapValue(value.reference)\n\t\t) as vscode.ChatResponseReferencePart; // 'value' is extended with variableName\n\t}\n}\n\nexport namespace ChatResponseCodeCitationPart {\n\texport function from(part: vscode.ChatResponseCodeCitationPart): Dto<IChatCodeCitation> {\n\t\treturn {\n\t\t\tkind: 'codeCitation',\n\t\t\tvalue: part.value,\n\t\t\tlicense: part.license,\n\t\t\tsnippet: part.snippet\n\t\t};\n\t}\n}\n\nexport namespace ChatResponsePart {\n\n\texport function from(part: vscode.ExtendedChatResponsePart, commandsConverter: CommandsConverter, commandDisposables: DisposableStore): extHostProtocol.IChatProgressDto {\n\t\tif (part instanceof types.ChatResponseMarkdownPart) {\n\t\t\treturn ChatResponseMarkdownPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseAnchorPart) {\n\t\t\treturn ChatResponseAnchorPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseReferencePart) {\n\t\t\treturn ChatResponseReferencePart.from(part);\n\t\t} else if (part instanceof types.ChatResponseProgressPart) {\n\t\t\treturn ChatResponseProgressPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseFileTreePart) {\n\t\t\treturn ChatResponseFilesPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseCommandButtonPart) {\n\t\t\treturn ChatResponseCommandButtonPart.from(part, commandsConverter, commandDisposables);\n\t\t} else if (part instanceof types.ChatResponseTextEditPart) {\n\t\t\treturn ChatResponseTextEditPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseNotebookEditPart) {\n\t\t\treturn ChatResponseNotebookEditPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseMarkdownWithVulnerabilitiesPart) {\n\t\t\treturn ChatResponseMarkdownWithVulnerabilitiesPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseCodeblockUriPart) {\n\t\t\treturn ChatResponseCodeblockUriPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseWarningPart) {\n\t\t\treturn ChatResponseWarningPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseConfirmationPart) {\n\t\t\treturn ChatResponseConfirmationPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseCodeCitationPart) {\n\t\t\treturn ChatResponseCodeCitationPart.from(part);\n\t\t} else if (part instanceof types.ChatResponseMovePart) {\n\t\t\treturn ChatResponseMovePart.from(part);\n\t\t} else if (part instanceof types.ChatResponseExtensionsPart) {\n\t\t\treturn ChatResponseExtensionsPart.from(part);\n\t\t} else if (part instanceof types.ChatPrepareToolInvocationPart) {\n\t\t\treturn ChatPrepareToolInvocationPart.from(part);\n\t\t}\n\n\t\treturn {\n\t\t\tkind: 'markdownContent',\n\t\t\tcontent: MarkdownString.from('')\n\t\t};\n\t}\n\n\texport function to(part: extHostProtocol.IChatProgressDto, commandsConverter: CommandsConverter): vscode.ChatResponsePart | undefined {\n\t\tswitch (part.kind) {\n\t\t\tcase 'reference': return ChatResponseReferencePart.to(part);\n\t\t\tcase 'markdownContent':\n\t\t\tcase 'inlineReference':\n\t\t\tcase 'progressMessage':\n\t\t\tcase 'treeData':\n\t\t\tcase 'command':\n\t\t\t\treturn toContent(part, commandsConverter);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\texport function toContent(part: extHostProtocol.IChatContentProgressDto, commandsConverter: CommandsConverter): vscode.ChatResponseMarkdownPart | vscode.ChatResponseFileTreePart | vscode.ChatResponseAnchorPart | vscode.ChatResponseCommandButtonPart | undefined {\n\t\tswitch (part.kind) {\n\t\t\tcase 'markdownContent': return ChatResponseMarkdownPart.to(part);\n\t\t\tcase 'inlineReference': return ChatResponseAnchorPart.to(part);\n\t\t\tcase 'progressMessage': return undefined;\n\t\t\tcase 'treeData': return ChatResponseFilesPart.to(part);\n\t\t\tcase 'command': return ChatResponseCommandButtonPart.to(part, commandsConverter);\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n\nexport namespace ChatAgentRequest {\n\texport function to(request: IChatAgentRequest, location2: vscode.ChatRequestEditorData | vscode.ChatRequestNotebookData | undefined, model: vscode.LanguageModelChat, diagnostics: readonly [vscode.Uri, readonly vscode.Diagnostic[]][], tools: Map<string, boolean>, extension: IRelaxedExtensionDescription, logService: ILogService): vscode.ChatRequest {\n\n\t\tconst toolReferences: typeof request.variables.variables = [];\n\t\tconst variableReferences: typeof request.variables.variables = [];\n\t\tfor (const v of request.variables.variables) {\n\t\t\tif (v.kind === 'tool') {\n\t\t\t\ttoolReferences.push(v);\n\t\t\t} else if (v.kind === 'toolset') {\n\t\t\t\ttoolReferences.push(...v.value);\n\t\t\t} else {\n\t\t\t\tvariableReferences.push(v);\n\t\t\t}\n\t\t}\n\n\t\tconst requestWithAllProps: vscode.ChatRequest = {\n\t\t\tid: request.requestId,\n\t\t\tprompt: request.message,\n\t\t\tcommand: request.command,\n\t\t\tattempt: request.attempt ?? 0,\n\t\t\tenableCommandDetection: request.enableCommandDetection ?? true,\n\t\t\tisParticipantDetected: request.isParticipantDetected ?? false,\n\t\t\treferences: variableReferences\n\t\t\t\t.map(v => ChatPromptReference.to(v, diagnostics, logService))\n\t\t\t\t.filter(isDefined),\n\t\t\ttoolReferences: toolReferences.map(ChatLanguageModelToolReference.to),\n\t\t\tlocation: ChatLocation.to(request.location),\n\t\t\tacceptedConfirmationData: request.acceptedConfirmationData,\n\t\t\trejectedConfirmationData: request.rejectedConfirmationData,\n\t\t\tlocation2,\n\t\t\ttoolInvocationToken: Object.freeze({ sessionId: request.sessionId }) as never,\n\t\t\ttools,\n\t\t\tmodel,\n\t\t\teditedFileEvents: request.editedFileEvents,\n\t\t\tmodeInstructions: request.modeInstructions,\n\t\t};\n\n\t\tif (!isProposedApiEnabled(extension, 'chatParticipantPrivate')) {\n\t\t\tdelete (requestWithAllProps as any).id;\n\t\t\tdelete (requestWithAllProps as any).attempt;\n\t\t\tdelete (requestWithAllProps as any).enableCommandDetection;\n\t\t\tdelete (requestWithAllProps as any).isParticipantDetected;\n\t\t\tdelete (requestWithAllProps as any).location;\n\t\t\tdelete (requestWithAllProps as any).location2;\n\t\t\tdelete (requestWithAllProps as any).editedFileEvents;\n\t\t}\n\n\t\tif (!isProposedApiEnabled(extension, 'chatParticipantAdditions')) {\n\t\t\tdelete requestWithAllProps.acceptedConfirmationData;\n\t\t\tdelete requestWithAllProps.rejectedConfirmationData;\n\t\t\tdelete (requestWithAllProps as any).tools;\n\t\t}\n\n\n\t\treturn requestWithAllProps;\n\t}\n}\n\nexport namespace ChatRequestDraft {\n\texport function to(request: IChatRequestDraft): vscode.ChatRequestDraft {\n\t\treturn {\n\t\t\tprompt: request.prompt,\n\t\t\tfiles: request.files.map((uri) => URI.revive(uri))\n\t\t};\n\t}\n}\n\nexport namespace ChatLocation {\n\texport function to(loc: ChatAgentLocation): types.ChatLocation {\n\t\tswitch (loc) {\n\t\t\tcase ChatAgentLocation.Notebook: return types.ChatLocation.Notebook;\n\t\t\tcase ChatAgentLocation.Terminal: return types.ChatLocation.Terminal;\n\t\t\tcase ChatAgentLocation.Panel: return types.ChatLocation.Panel;\n\t\t\tcase ChatAgentLocation.Editor: return types.ChatLocation.Editor;\n\t\t}\n\t}\n\n\texport function from(loc: types.ChatLocation): ChatAgentLocation {\n\t\tswitch (loc) {\n\t\t\tcase types.ChatLocation.Notebook: return ChatAgentLocation.Notebook;\n\t\t\tcase types.ChatLocation.Terminal: return ChatAgentLocation.Terminal;\n\t\t\tcase types.ChatLocation.Panel: return ChatAgentLocation.Panel;\n\t\t\tcase types.ChatLocation.Editor: return ChatAgentLocation.Editor;\n\t\t}\n\t}\n}\n\nexport namespace ChatPromptReference {\n\texport function to(variable: IChatRequestVariableEntry, diagnostics: readonly [vscode.Uri, readonly vscode.Diagnostic[]][], logService: ILogService): vscode.ChatPromptReference | undefined {\n\t\tlet value: vscode.ChatPromptReference['value'] = variable.value;\n\t\tif (!value) {\n\t\t\tlet varStr: string;\n\t\t\ttry {\n\t\t\t\tvarStr = JSON.stringify(variable);\n\t\t\t} catch {\n\t\t\t\tvarStr = `kind=${variable.kind}, id=${variable.id}, name=${variable.name}`;\n\t\t\t}\n\n\t\t\tlogService.error(`[ChatPromptReference] Ignoring invalid reference in variable: ${varStr}`);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (isUriComponents(value)) {\n\t\t\tvalue = URI.revive(value);\n\t\t} else if (value && typeof value === 'object' && 'uri' in value && 'range' in value && isUriComponents(value.uri)) {\n\t\t\tvalue = Location.to(revive(value));\n\t\t} else if (isImageVariableEntry(variable)) {\n\t\t\tconst ref = variable.references?.[0]?.reference;\n\t\t\tvalue = new types.ChatReferenceBinaryData(\n\t\t\t\tvariable.mimeType ?? 'image/png',\n\t\t\t\t() => Promise.resolve(new Uint8Array(Object.values(variable.value as number[]))),\n\t\t\t\tref && URI.isUri(ref) ? ref : undefined\n\t\t\t);\n\t\t} else if (variable.kind === 'diagnostic') {\n\t\t\tconst filterSeverity = variable.filterSeverity && DiagnosticSeverity.to(variable.filterSeverity);\n\t\t\tconst filterUri = variable.filterUri && URI.revive(variable.filterUri).toString();\n\t\t\tvalue = new types.ChatReferenceDiagnostic(diagnostics.map(([uri, d]): [vscode.Uri, vscode.Diagnostic[]] => {\n\t\t\t\tif (variable.filterUri && uri.toString() !== filterUri) {\n\t\t\t\t\treturn [uri, []];\n\t\t\t\t}\n\n\t\t\t\treturn [uri, d.filter(d => {\n\t\t\t\t\tif (filterSeverity && d.severity > filterSeverity) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (variable.filterRange && !editorRange.Range.areIntersectingOrTouching(variable.filterRange, Range.from(d.range))) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t})];\n\t\t\t}).filter(([, d]) => d.length > 0));\n\t\t}\n\n\t\treturn {\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\trange: variable.range && [variable.range.start, variable.range.endExclusive],\n\t\t\tvalue,\n\t\t\tmodelDescription: variable.modelDescription,\n\t\t};\n\t}\n}\n\nexport namespace ChatLanguageModelToolReference {\n\texport function to(variable: IChatRequestVariableEntry): vscode.ChatLanguageModelToolReference {\n\t\tconst value = variable.value;\n\t\tif (value) {\n\t\t\tthrow new Error('Invalid tool reference');\n\t\t}\n\n\t\treturn {\n\t\t\tname: variable.id,\n\t\t\trange: variable.range && [variable.range.start, variable.range.endExclusive],\n\t\t};\n\t}\n}\n\nexport namespace ChatAgentCompletionItem {\n\texport function from(item: vscode.ChatCompletionItem, commandsConverter: CommandsConverter, disposables: DisposableStore): extHostProtocol.IChatAgentCompletionItem {\n\t\treturn {\n\t\t\tid: item.id,\n\t\t\tlabel: item.label,\n\t\t\tfullName: item.fullName,\n\t\t\ticon: item.icon?.id,\n\t\t\tvalue: item.values[0].value,\n\t\t\tinsertText: item.insertText,\n\t\t\tdetail: item.detail,\n\t\t\tdocumentation: item.documentation,\n\t\t\tcommand: commandsConverter.toInternal(item.command, disposables),\n\t\t};\n\t}\n}\n\nexport namespace ChatAgentResult {\n\texport function to(result: IChatAgentResult): vscode.ChatResult {\n\t\treturn {\n\t\t\terrorDetails: result.errorDetails,\n\t\t\tmetadata: reviveMetadata(result.metadata),\n\t\t\tnextQuestion: result.nextQuestion,\n\t\t};\n\t}\n\texport function from(result: vscode.ChatResult): Dto<IChatAgentResult> {\n\t\treturn {\n\t\t\terrorDetails: result.errorDetails,\n\t\t\tmetadata: result.metadata,\n\t\t\tnextQuestion: result.nextQuestion,\n\t\t};\n\t}\n\n\tfunction reviveMetadata(metadata: IChatAgentResult['metadata']) {\n\t\treturn cloneAndChange(metadata, value => {\n\t\t\tif (value.$mid === MarshalledId.LanguageModelToolResult) {\n\t\t\t\treturn new types.LanguageModelToolResult(cloneAndChange(value.content, reviveMetadata));\n\t\t\t} else if (value.$mid === MarshalledId.LanguageModelTextPart) {\n\t\t\t\treturn new types.LanguageModelTextPart(value.value);\n\t\t\t} else if (value.$mid === MarshalledId.LanguageModelPromptTsxPart) {\n\t\t\t\treturn new types.LanguageModelPromptTsxPart(value.value);\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t});\n\t}\n}\n\nexport namespace ChatAgentUserActionEvent {\n\texport function to(result: IChatAgentResult, event: IChatUserActionEvent, commandsConverter: CommandsConverter): vscode.ChatUserActionEvent | undefined {\n\t\tif (event.action.kind === 'vote') {\n\t\t\t// Is the \"feedback\" type\n\t\t\treturn;\n\t\t}\n\n\t\tconst ehResult = ChatAgentResult.to(result);\n\t\tif (event.action.kind === 'command') {\n\t\t\tconst command = event.action.commandButton.command;\n\t\t\tconst commandButton = {\n\t\t\t\tcommand: commandsConverter.fromInternal(command) ?? { command: command.id, title: command.title },\n\t\t\t};\n\t\t\tconst commandAction: vscode.ChatCommandAction = { kind: 'command', commandButton };\n\t\t\treturn { action: commandAction, result: ehResult };\n\t\t} else if (event.action.kind === 'followUp') {\n\t\t\tconst followupAction: vscode.ChatFollowupAction = { kind: 'followUp', followup: ChatFollowup.to(event.action.followup) };\n\t\t\treturn { action: followupAction, result: ehResult };\n\t\t} else if (event.action.kind === 'inlineChat') {\n\t\t\treturn { action: { kind: 'editor', accepted: event.action.action === 'accepted' }, result: ehResult };\n\t\t} else if (event.action.kind === 'chatEditingSessionAction') {\n\n\t\t\tconst outcomes = new Map([\n\t\t\t\t['accepted', types.ChatEditingSessionActionOutcome.Accepted],\n\t\t\t\t['rejected', types.ChatEditingSessionActionOutcome.Rejected],\n\t\t\t\t['saved', types.ChatEditingSessionActionOutcome.Saved],\n\t\t\t]);\n\n\t\t\treturn {\n\t\t\t\taction: {\n\t\t\t\t\tkind: 'chatEditingSessionAction',\n\t\t\t\t\toutcome: outcomes.get(event.action.outcome) ?? types.ChatEditingSessionActionOutcome.Rejected,\n\t\t\t\t\turi: URI.revive(event.action.uri),\n\t\t\t\t\thasRemainingEdits: event.action.hasRemainingEdits\n\t\t\t\t}, result: ehResult\n\t\t\t};\n\t\t} else {\n\t\t\treturn { action: event.action, result: ehResult };\n\t\t}\n\t}\n}\n\nexport namespace TerminalQuickFix {\n\texport function from(quickFix: vscode.TerminalQuickFixTerminalCommand | vscode.TerminalQuickFixOpener | vscode.Command, converter: Command.ICommandsConverter, disposables: DisposableStore): extHostProtocol.ITerminalQuickFixTerminalCommandDto | extHostProtocol.ITerminalQuickFixOpenerDto | extHostProtocol.ICommandDto | undefined {\n\t\tif ('terminalCommand' in quickFix) {\n\t\t\treturn { terminalCommand: quickFix.terminalCommand, shouldExecute: quickFix.shouldExecute };\n\t\t}\n\t\tif ('uri' in quickFix) {\n\t\t\treturn { uri: quickFix.uri };\n\t\t}\n\t\treturn converter.toInternal(quickFix, disposables);\n\t}\n}\nexport namespace TerminalCompletionItemDto {\n\texport function from(item: vscode.TerminalCompletionItem): extHostProtocol.ITerminalCompletionItemDto {\n\t\treturn {\n\t\t\t...item,\n\t\t\tdocumentation: MarkdownString.fromStrict(item.documentation),\n\t\t};\n\t}\n}\n\nexport namespace TerminalCompletionList {\n\texport function from(completions: vscode.TerminalCompletionList | vscode.TerminalCompletionItem[], pathSeparator: string): extHostProtocol.TerminalCompletionListDto {\n\t\tif (Array.isArray(completions)) {\n\t\t\treturn {\n\t\t\t\titems: completions.map(i => TerminalCompletionItemDto.from(i)),\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\titems: completions.items.map(i => TerminalCompletionItemDto.from(i)),\n\t\t\tresourceRequestConfig: completions.resourceRequestConfig ? TerminalResourceRequestConfig.from(completions.resourceRequestConfig, pathSeparator) : undefined,\n\t\t};\n\t}\n}\n\nexport namespace TerminalResourceRequestConfig {\n\texport function from(resourceRequestConfig: vscode.TerminalResourceRequestConfig, pathSeparator: string): extHostProtocol.TerminalResourceRequestConfigDto {\n\t\treturn {\n\t\t\t...resourceRequestConfig,\n\t\t\tpathSeparator,\n\t\t\tcwd: resourceRequestConfig.cwd,\n\t\t};\n\t}\n}\n\nexport namespace PartialAcceptInfo {\n\texport function to(info: languages.PartialAcceptInfo): types.PartialAcceptInfo {\n\t\treturn {\n\t\t\tkind: PartialAcceptTriggerKind.to(info.kind),\n\t\t\tacceptedLength: info.acceptedLength,\n\t\t};\n\t}\n}\n\nexport namespace PartialAcceptTriggerKind {\n\texport function to(kind: languages.PartialAcceptTriggerKind): types.PartialAcceptTriggerKind {\n\t\tswitch (kind) {\n\t\t\tcase languages.PartialAcceptTriggerKind.Word:\n\t\t\t\treturn types.PartialAcceptTriggerKind.Word;\n\t\t\tcase languages.PartialAcceptTriggerKind.Line:\n\t\t\t\treturn types.PartialAcceptTriggerKind.Line;\n\t\t\tcase languages.PartialAcceptTriggerKind.Suggest:\n\t\t\t\treturn types.PartialAcceptTriggerKind.Suggest;\n\t\t\tdefault:\n\t\t\t\treturn types.PartialAcceptTriggerKind.Unknown;\n\t\t}\n\t}\n}\n\nexport namespace InlineCompletionEndOfLifeReason {\n\texport function to<T>(reason: languages.InlineCompletionEndOfLifeReason<T>, convertFn: (item: T) => vscode.InlineCompletionItem | undefined): vscode.InlineCompletionEndOfLifeReason {\n\t\tif (reason.kind === languages.InlineCompletionEndOfLifeReasonKind.Ignored) {\n\t\t\tconst supersededBy = reason.supersededBy ? convertFn(reason.supersededBy) : undefined;\n\t\t\treturn {\n\t\t\t\tkind: types.InlineCompletionEndOfLifeReasonKind.Ignored,\n\t\t\t\tsupersededBy: supersededBy,\n\t\t\t\tuserTypingDisagreed: reason.userTypingDisagreed,\n\t\t\t};\n\t\t} else if (reason.kind === languages.InlineCompletionEndOfLifeReasonKind.Accepted) {\n\t\t\treturn {\n\t\t\t\tkind: types.InlineCompletionEndOfLifeReasonKind.Accepted,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tkind: types.InlineCompletionEndOfLifeReasonKind.Rejected,\n\t\t};\n\t}\n}\n\nexport namespace DebugTreeItem {\n\texport function from(item: vscode.DebugTreeItem, id: number): IDebugVisualizationTreeItem {\n\t\treturn {\n\t\t\tid,\n\t\t\tlabel: item.label,\n\t\t\tdescription: item.description,\n\t\t\tcanEdit: item.canEdit,\n\t\t\tcollapsibleState: (item.collapsibleState || DebugTreeItemCollapsibleState.None) as DebugTreeItemCollapsibleState,\n\t\t\tcontextValue: item.contextValue,\n\t\t};\n\t}\n}\n\nexport namespace LanguageModelToolDescription {\n\texport function to(item: IToolData): vscode.LanguageModelToolInformation {\n\t\treturn {\n\t\t\t// Note- the reason this is a unique 'name' is just to avoid confusion with the toolCallId\n\t\t\tname: item.id,\n\t\t\tdescription: item.modelDescription,\n\t\t\tinputSchema: item.inputSchema,\n\t\t\ttags: item.tags ?? [],\n\t\t};\n\t}\n}\n\nexport namespace LanguageModelToolResult {\n\texport function to(result: IToolResult): vscode.LanguageModelToolResult {\n\t\treturn new types.LanguageModelToolResult(result.content.map(item => {\n\t\t\tif (item.kind === 'text') {\n\t\t\t\treturn new types.LanguageModelTextPart(item.value);\n\t\t\t} else {\n\t\t\t\treturn new types.LanguageModelPromptTsxPart(item.value);\n\t\t\t}\n\t\t}));\n\t}\n\n\texport function from(result: vscode.ExtendedLanguageModelToolResult, extension: IExtensionDescription): Dto<IToolResult> {\n\t\tif (result.toolResultMessage) {\n\t\t\tcheckProposedApiEnabled(extension, 'chatParticipantPrivate');\n\t\t}\n\n\t\treturn {\n\t\t\tcontent: result.content.map(item => {\n\t\t\t\tif (item instanceof types.LanguageModelTextPart) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkind: 'text',\n\t\t\t\t\t\tvalue: item.value\n\t\t\t\t\t};\n\t\t\t\t} else if (item instanceof types.LanguageModelPromptTsxPart) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkind: 'promptTsx',\n\t\t\t\t\t\tvalue: item.value,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('Unknown LanguageModelToolResult part type');\n\t\t\t\t}\n\t\t\t}),\n\t\t\ttoolResultMessage: MarkdownString.fromStrict(result.toolResultMessage),\n\t\t\ttoolResultDetails: result.toolResultDetails?.map(detail => URI.isUri(detail) ? detail : Location.from(detail as vscode.Location)),\n\t\t};\n\t}\n}\n\nexport namespace LanguageModelToolResult2 {\n\texport function to(result: IToolResult): vscode.LanguageModelToolResult2 {\n\t\treturn new types.LanguageModelToolResult2(result.content.map(item => {\n\t\t\tif (item.kind === 'text') {\n\t\t\t\treturn new types.LanguageModelTextPart(item.value);\n\t\t\t} else if (item.kind === 'data') {\n\t\t\t\tconst mimeType = Object.values(types.ChatImageMimeType).includes(item.value.mimeType as types.ChatImageMimeType) ? item.value.mimeType as types.ChatImageMimeType : undefined;\n\t\t\t\tif (!mimeType) {\n\t\t\t\t\tthrow new Error('Invalid MIME type');\n\t\t\t\t}\n\t\t\t\treturn new types.LanguageModelDataPart(item.value.data.buffer, mimeType);\n\t\t\t} else {\n\t\t\t\treturn new types.LanguageModelPromptTsxPart(item.value);\n\t\t\t}\n\t\t}));\n\t}\n\n\texport function from(result: vscode.ExtendedLanguageModelToolResult, extension: IExtensionDescription): Dto<IToolResult> | SerializableObjectWithBuffers<Dto<IToolResult>> {\n\t\tif (result.toolResultMessage) {\n\t\t\tcheckProposedApiEnabled(extension, 'chatParticipantPrivate');\n\t\t}\n\n\t\tlet hasBuffers = false;\n\t\tconst dto: Dto<IToolResult> = {\n\t\t\tcontent: result.content.map(item => {\n\t\t\t\tif (item instanceof types.LanguageModelTextPart) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkind: 'text',\n\t\t\t\t\t\tvalue: item.value\n\t\t\t\t\t};\n\t\t\t\t} else if (item instanceof types.LanguageModelPromptTsxPart) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkind: 'promptTsx',\n\t\t\t\t\t\tvalue: item.value,\n\t\t\t\t\t};\n\t\t\t\t} else if (item instanceof types.LanguageModelDataPart) {\n\t\t\t\t\thasBuffers = true;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkind: 'data',\n\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\tmimeType: item.mimeType,\n\t\t\t\t\t\t\tdata: VSBuffer.wrap(item.data)\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('Unknown LanguageModelToolResult part type');\n\t\t\t\t}\n\t\t\t}),\n\t\t\ttoolResultMessage: MarkdownString.fromStrict(result.toolResultMessage),\n\t\t\ttoolResultDetails: result.toolResultDetails?.map(detail => URI.isUri(detail) ? detail : Location.from(detail as vscode.Location)),\n\t\t};\n\n\t\treturn hasBuffers ? new SerializableObjectWithBuffers(dto) : dto;\n\t}\n}\n\nexport namespace IconPath {\n\texport function fromThemeIcon(iconPath: vscode.ThemeIcon): languages.IconPath {\n\t\treturn iconPath;\n\t}\n}\n\nexport namespace AiSettingsSearch {\n\texport function fromSettingsSearchResult(result: vscode.SettingsSearchResult): AiSettingsSearchResult {\n\t\treturn {\n\t\t\tquery: result.query,\n\t\t\tkind: fromSettingsSearchResultKind(result.kind),\n\t\t\tsettings: result.settings\n\t\t};\n\t}\n\n\tfunction fromSettingsSearchResultKind(kind: number): AiSettingsSearchResultKind {\n\t\tswitch (kind) {\n\t\t\tcase AiSettingsSearchResultKind.EMBEDDED:\n\t\t\t\treturn AiSettingsSearchResultKind.EMBEDDED;\n\t\t\tcase AiSettingsSearchResultKind.LLM_RANKED:\n\t\t\t\treturn AiSettingsSearchResultKind.LLM_RANKED;\n\t\t\tcase AiSettingsSearchResultKind.CANCELED:\n\t\t\t\treturn AiSettingsSearchResultKind.CANCELED;\n\t\t\tdefault:\n\t\t\t\tthrow new Error('Unknown AiSettingsSearchResultKind');\n\t\t}\n\t}\n}\n\nexport namespace McpServerDefinition {\n\tfunction isHttpConfig(candidate: vscode.McpServerDefinition): candidate is vscode.McpHttpServerDefinition {\n\t\treturn !!(candidate as vscode.McpHttpServerDefinition).uri;\n\t}\n\n\texport function from(item: vscode.McpServerDefinition): McpServerLaunch.Serialized {\n\t\treturn McpServerLaunch.toSerialized(\n\t\t\tisHttpConfig(item)\n\t\t\t\t? {\n\t\t\t\t\ttype: McpServerTransportType.HTTP,\n\t\t\t\t\turi: item.uri,\n\t\t\t\t\theaders: Object.entries(item.headers),\n\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\ttype: McpServerTransportType.Stdio,\n\t\t\t\t\tcwd: item.cwd?.fsPath,\n\t\t\t\t\targs: item.args,\n\t\t\t\t\tcommand: item.command,\n\t\t\t\t\tenv: item.env,\n\t\t\t\t\tenvFile: undefined,\n\t\t\t\t}\n\t\t);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { IRemoteConsoleLog } from '../../../base/common/console.js';\nimport { SerializedError } from '../../../base/common/errors.js';\nimport { IRelativePattern } from '../../../base/common/glob.js';\nimport { IMarkdownString } from '../../../base/common/htmlContent.js';\nimport { IJSONSchema } from '../../../base/common/jsonSchema.js';\nimport { IDisposable } from '../../../base/common/lifecycle.js';\nimport { IAuthorizationProtectedResourceMetadata, IAuthorizationServerMetadata, IAuthorizationTokenResponse } from '../../../base/common/oauth.js';\nimport * as performance from '../../../base/common/performance.js';\nimport Severity from '../../../base/common/severity.js';\nimport { ThemeColor, ThemeIcon } from '../../../base/common/themables.js';\nimport { URI, UriComponents, UriDto } from '../../../base/common/uri.js';\nimport { RenderLineNumbersType, TextEditorCursorStyle } from '../../../editor/common/config/editorOptions.js';\nimport { ISingleEditOperation } from '../../../editor/common/core/editOperation.js';\nimport { IPosition } from '../../../editor/common/core/position.js';\nimport { IRange } from '../../../editor/common/core/range.js';\nimport { ISelection, Selection } from '../../../editor/common/core/selection.js';\nimport { IChange } from '../../../editor/common/diff/legacyLinesDiffComputer.js';\nimport * as editorCommon from '../../../editor/common/editorCommon.js';\nimport { StandardTokenType } from '../../../editor/common/encodedTokenAttributes.js';\nimport * as languages from '../../../editor/common/languages.js';\nimport { CompletionItemLabel } from '../../../editor/common/languages.js';\nimport { CharacterPair, CommentRule, EnterAction } from '../../../editor/common/languages/languageConfiguration.js';\nimport { EndOfLineSequence } from '../../../editor/common/model.js';\nimport { ISerializedModelContentChangedEvent } from '../../../editor/common/textModelEvents.js';\nimport { IAccessibilityInformation } from '../../../platform/accessibility/common/accessibility.js';\nimport { ILocalizedString } from '../../../platform/action/common/action.js';\nimport { ConfigurationTarget, IConfigurationChange, IConfigurationData, IConfigurationOverrides } from '../../../platform/configuration/common/configuration.js';\nimport { ConfigurationScope } from '../../../platform/configuration/common/configurationRegistry.js';\nimport { IExtensionIdWithVersion } from '../../../platform/extensionManagement/common/extensionStorage.js';\nimport { ExtensionIdentifier, IExtensionDescription } from '../../../platform/extensions/common/extensions.js';\nimport * as files from '../../../platform/files/common/files.js';\nimport { ResourceLabelFormatter } from '../../../platform/label/common/label.js';\nimport { ILoggerOptions, ILoggerResource, LogLevel } from '../../../platform/log/common/log.js';\nimport { IMarkerData } from '../../../platform/markers/common/markers.js';\nimport { IProgressOptions, IProgressStep } from '../../../platform/progress/common/progress.js';\nimport * as quickInput from '../../../platform/quickinput/common/quickInput.js';\nimport { IRemoteConnectionData, TunnelDescription } from '../../../platform/remote/common/remoteAuthorityResolver.js';\nimport { AuthInfo, Credentials } from '../../../platform/request/common/request.js';\nimport { ClassifiedEvent, IGDPRProperty, OmitMetadata, StrictPropertyCheck } from '../../../platform/telemetry/common/gdprTypings.js';\nimport { TelemetryLevel } from '../../../platform/telemetry/common/telemetry.js';\nimport { ISerializableEnvironmentDescriptionMap, ISerializableEnvironmentVariableCollection } from '../../../platform/terminal/common/environmentVariable.js';\nimport { ICreateContributedTerminalProfileOptions, IProcessProperty, IProcessReadyWindowsPty, IShellLaunchConfigDto, ITerminalEnvironment, ITerminalLaunchError, ITerminalProfile, TerminalExitReason, TerminalLocation, TerminalShellType } from '../../../platform/terminal/common/terminal.js';\nimport { ProvidedPortAttributes, TunnelCreationOptions, TunnelOptions, TunnelPrivacyId, TunnelProviderFeatures } from '../../../platform/tunnel/common/tunnel.js';\nimport { EditSessionIdentityMatch } from '../../../platform/workspace/common/editSessions.js';\nimport { WorkspaceTrustRequestOptions } from '../../../platform/workspace/common/workspaceTrust.js';\nimport { SaveReason } from '../../common/editor.js';\nimport { IRevealOptions, ITreeItem, IViewBadge } from '../../common/views.js';\nimport { CallHierarchyItem } from '../../contrib/callHierarchy/common/callHierarchy.js';\nimport { IChatAgentMetadata, IChatAgentRequest, IChatAgentResult } from '../../contrib/chat/common/chatAgents.js';\nimport { ICodeMapperRequest, ICodeMapperResult } from '../../contrib/chat/common/chatCodeMapperService.js';\nimport { IChatRelatedFile, IChatRelatedFileProviderMetadata as IChatRelatedFilesProviderMetadata, IChatRequestDraft } from '../../contrib/chat/common/chatEditingService.js';\nimport { IChatProgressHistoryResponseContent } from '../../contrib/chat/common/chatModel.js';\nimport { IChatContentInlineReference, IChatFollowup, IChatNotebookEdit, IChatProgress, IChatResponseErrorDetails, IChatTask, IChatTaskDto, IChatUserActionEvent, IChatVoteAction } from '../../contrib/chat/common/chatService.js';\nimport { IChatRequestVariableValue } from '../../contrib/chat/common/chatVariables.js';\nimport { ChatAgentLocation } from '../../contrib/chat/common/constants.js';\nimport { IChatMessage, IChatResponseFragment, ILanguageModelChatMetadata, ILanguageModelChatSelector, ILanguageModelsChangeEvent } from '../../contrib/chat/common/languageModels.js';\nimport { IPreparedToolInvocation, IToolInvocation, IToolInvocationPreparationContext, IToolProgressStep, IToolResult } from '../../contrib/chat/common/languageModelToolsService.js';\nimport { DebugConfigurationProviderTriggerKind, IAdapterDescriptor, IConfig, IDebugSessionReplMode, IDebugTestRunReference, IDebugVisualization, IDebugVisualizationContext, IDebugVisualizationTreeItem, MainThreadDebugVisualization } from '../../contrib/debug/common/debug.js';\nimport { McpCollectionDefinition, McpConnectionState, McpServerDefinition, McpServerLaunch } from '../../contrib/mcp/common/mcpTypes.js';\nimport * as notebookCommon from '../../contrib/notebook/common/notebookCommon.js';\nimport { CellExecutionUpdateType } from '../../contrib/notebook/common/notebookExecutionService.js';\nimport { ICellExecutionComplete, ICellExecutionStateUpdate } from '../../contrib/notebook/common/notebookExecutionStateService.js';\nimport { ICellRange } from '../../contrib/notebook/common/notebookRange.js';\nimport { ISCMHistoryOptions } from '../../contrib/scm/common/history.js';\nimport { InputValidationType } from '../../contrib/scm/common/scm.js';\nimport { IWorkspaceSymbol, NotebookPriorityInfo } from '../../contrib/search/common/search.js';\nimport { IRawClosedNotebookFileMatch } from '../../contrib/search/common/searchNotebookHelpers.js';\nimport { IKeywordRecognitionEvent, ISpeechProviderMetadata, ISpeechToTextEvent, ITextToSpeechEvent } from '../../contrib/speech/common/speechService.js';\nimport { CoverageDetails, ExtensionRunTestsRequest, ICallProfileRunHandler, IFileCoverage, ISerializedTestResults, IStartControllerTests, ITestItem, ITestMessage, ITestRunProfile, ITestRunTask, ResolvedTestRunRequest, TestControllerCapability, TestMessageFollowupRequest, TestMessageFollowupResponse, TestResultState, TestsDiffOp } from '../../contrib/testing/common/testTypes.js';\nimport { Timeline, TimelineChangeEvent, TimelineOptions, TimelineProviderDescriptor } from '../../contrib/timeline/common/timeline.js';\nimport { TypeHierarchyItem } from '../../contrib/typeHierarchy/common/typeHierarchy.js';\nimport { RelatedInformationResult, RelatedInformationType } from '../../services/aiRelatedInformation/common/aiRelatedInformation.js';\nimport { AiSettingsSearchProviderOptions, AiSettingsSearchResult } from '../../services/aiSettingsSearch/common/aiSettingsSearch.js';\nimport { AuthenticationSession, AuthenticationSessionAccount, AuthenticationSessionsChangeEvent, IAuthenticationCreateSessionOptions, IAuthenticationGetSessionsOptions } from '../../services/authentication/common/authentication.js';\nimport { EditorGroupColumn } from '../../services/editor/common/editorGroupColumn.js';\nimport { IExtensionDescriptionDelta, IStaticWorkspaceData } from '../../services/extensions/common/extensionHostProtocol.js';\nimport { IResolveAuthorityResult } from '../../services/extensions/common/extensionHostProxy.js';\nimport { ActivationKind, ExtensionActivationReason, MissingExtensionDependency } from '../../services/extensions/common/extensions.js';\nimport { Dto, IRPCProtocol, SerializableObjectWithBuffers, createProxyIdentifier } from '../../services/extensions/common/proxyIdentifier.js';\nimport { ILanguageStatus } from '../../services/languageStatus/common/languageStatusService.js';\nimport { OutputChannelUpdateMode } from '../../services/output/common/output.js';\nimport { CandidatePort } from '../../services/remote/common/tunnelModel.js';\nimport { IFileQueryBuilderOptions, ITextQueryBuilderOptions } from '../../services/search/common/queryBuilder.js';\nimport * as search from '../../services/search/common/search.js';\nimport { AISearchKeyword, TextSearchCompleteMessage } from '../../services/search/common/searchExtTypes.js';\nimport { ISaveProfileResult } from '../../services/userDataProfile/common/userDataProfile.js';\nimport { TerminalShellExecutionCommandLineConfidence } from './extHostTypes.js';\nimport * as tasks from './shared/tasks.js';\n\nexport interface IWorkspaceData extends IStaticWorkspaceData {\n\tfolders: { uri: UriComponents; name: string; index: number }[];\n}\n\nexport interface IConfigurationInitData extends IConfigurationData {\n\tconfigurationScopes: [string, ConfigurationScope | undefined][];\n}\n\nexport interface IMainContext extends IRPCProtocol {\n}\n\n// --- main thread\n\nexport interface MainThreadClipboardShape extends IDisposable {\n\t$readText(): Promise<string>;\n\t$writeText(value: string): Promise<void>;\n}\n\nexport interface MainThreadCommandsShape extends IDisposable {\n\t$registerCommand(id: string): void;\n\t$unregisterCommand(id: string): void;\n\t$fireCommandActivationEvent(id: string): void;\n\t$executeCommand(id: string, args: any[] | SerializableObjectWithBuffers<any[]>, retry: boolean): Promise<unknown | undefined>;\n\t$getCommands(): Promise<string[]>;\n}\n\nexport interface CommentProviderFeatures {\n\treactionGroup?: languages.CommentReaction[];\n\treactionHandler?: boolean;\n\toptions?: languages.CommentOptions;\n}\n\nexport interface CommentChanges {\n\treadonly uniqueIdInThread: number;\n\treadonly body: string | IMarkdownString;\n\treadonly userName: string;\n\treadonly userIconPath?: UriComponents;\n\treadonly contextValue?: string;\n\treadonly commentReactions?: languages.CommentReaction[];\n\treadonly label?: string;\n\treadonly mode?: languages.CommentMode;\n\treadonly state?: languages.CommentState;\n\treadonly timestamp?: string;\n}\n\nexport type CommentThreadChanges<T = IRange> = Partial<{\n\trange: T | undefined;\n\tlabel: string;\n\tcontextValue: string | null;\n\tcomments: CommentChanges[];\n\tcollapseState: languages.CommentThreadCollapsibleState;\n\tcanReply: boolean | languages.CommentAuthorInformation;\n\tstate: languages.CommentThreadState;\n\tapplicability: languages.CommentThreadApplicability;\n\tisTemplate: boolean;\n}>;\n\nexport interface MainThreadCommentsShape extends IDisposable {\n\t$registerCommentController(handle: number, id: string, label: string, extensionId: string): void;\n\t$unregisterCommentController(handle: number): void;\n\t$updateCommentControllerFeatures(handle: number, features: CommentProviderFeatures): void;\n\t$createCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, range: IRange | ICellRange | undefined, comments: languages.Comment[], extensionId: ExtensionIdentifier, isTemplate: boolean, editorId?: string): languages.CommentThread<IRange | ICellRange> | undefined;\n\t$updateCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, changes: CommentThreadChanges): void;\n\t$deleteCommentThread(handle: number, commentThreadHandle: number): void;\n\t$updateCommentingRanges(handle: number, resourceHints?: languages.CommentingRangeResourceHint): void;\n\t$revealCommentThread(handle: number, commentThreadHandle: number, commentUniqueIdInThread: number, options: languages.CommentThreadRevealOptions): Promise<void>;\n\t$hideCommentThread(handle: number, commentThreadHandle: number): void;\n}\n\nexport interface AuthenticationForceNewSessionOptions {\n\tdetail?: string;\n\tsessionToRecreate?: AuthenticationSession;\n}\n\nexport interface AuthenticationInteractiveOptions {\n\tdetail?: string;\n\tlearnMore?: UriComponents;\n\tsessionToRecreate?: AuthenticationSession;\n}\n\nexport interface AuthenticationGetSessionOptions {\n\tclearSessionPreference?: boolean;\n\tcreateIfNone?: boolean | AuthenticationInteractiveOptions;\n\tforceNewSession?: boolean | AuthenticationInteractiveOptions;\n\tsilent?: boolean;\n\taccount?: AuthenticationSessionAccount;\n}\n\nexport interface MainThreadAuthenticationShape extends IDisposable {\n\t$registerAuthenticationProvider(id: string, label: string, supportsMultipleAccounts: boolean, supportedAuthorizationServers?: UriComponents[]): Promise<void>;\n\t$unregisterAuthenticationProvider(id: string): Promise<void>;\n\t$ensureProvider(id: string): Promise<void>;\n\t$sendDidChangeSessions(providerId: string, event: AuthenticationSessionsChangeEvent): Promise<void>;\n\t$getSession(providerId: string, scopes: readonly string[], extensionId: string, extensionName: string, options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;\n\t$getAccounts(providerId: string): Promise<ReadonlyArray<AuthenticationSessionAccount>>;\n\t$removeSession(providerId: string, sessionId: string): Promise<void>;\n\t$waitForUriHandler(expectedUri: UriComponents): Promise<UriComponents>;\n\t$showContinueNotification(message: string): Promise<boolean>;\n\t$showDeviceCodeModal(userCode: string, verificationUri: string): Promise<boolean>;\n\t$registerDynamicAuthenticationProvider(id: string, label: string, authorizationServer: UriComponents, clientId: string): Promise<void>;\n\t$setSessionsForDynamicAuthProvider(authProviderId: string, clientId: string, sessions: (IAuthorizationTokenResponse & { created_at: number })[]): Promise<void>;\n\t$sendDidChangeDynamicProviderInfo({ providerId, clientId, authorizationServer, label }: { providerId: string; clientId?: string; authorizationServer?: UriComponents; label?: string }): Promise<void>;\n}\n\nexport interface MainThreadSecretStateShape extends IDisposable {\n\t$getPassword(extensionId: string, key: string): Promise<string | undefined>;\n\t$setPassword(extensionId: string, key: string, value: string): Promise<void>;\n\t$deletePassword(extensionId: string, key: string): Promise<void>;\n}\n\nexport interface MainThreadConfigurationShape extends IDisposable {\n\t$updateConfigurationOption(target: ConfigurationTarget | null, key: string, value: unknown, overrides: IConfigurationOverrides | undefined, scopeToLanguage: boolean | undefined): Promise<void>;\n\t$removeConfigurationOption(target: ConfigurationTarget | null, key: string, overrides: IConfigurationOverrides | undefined, scopeToLanguage: boolean | undefined): Promise<void>;\n}\n\nexport interface MainThreadDiagnosticsShape extends IDisposable {\n\t$changeMany(owner: string, entries: [UriComponents, IMarkerData[] | undefined][]): void;\n\t$clear(owner: string): void;\n}\n\nexport interface MainThreadDialogOpenOptions {\n\tdefaultUri?: UriComponents;\n\topenLabel?: string;\n\tcanSelectFiles?: boolean;\n\tcanSelectFolders?: boolean;\n\tcanSelectMany?: boolean;\n\tfilters?: { [name: string]: string[] };\n\ttitle?: string;\n\tallowUIResources?: boolean;\n}\n\nexport interface MainThreadDialogSaveOptions {\n\tdefaultUri?: UriComponents;\n\tsaveLabel?: string;\n\tfilters?: { [name: string]: string[] };\n\ttitle?: string;\n}\n\nexport interface MainThreadDiaglogsShape extends IDisposable {\n\t$showOpenDialog(options?: MainThreadDialogOpenOptions): Promise<UriComponents[] | undefined>;\n\t$showSaveDialog(options?: MainThreadDialogSaveOptions): Promise<UriComponents | undefined>;\n}\n\nexport interface MainThreadDecorationsShape extends IDisposable {\n\t$registerDecorationProvider(handle: number, label: string): void;\n\t$unregisterDecorationProvider(handle: number): void;\n\t$onDidChange(handle: number, resources: UriComponents[] | null): void;\n}\n\nexport interface MainThreadDocumentContentProvidersShape extends IDisposable {\n\t$registerTextContentProvider(handle: number, scheme: string): void;\n\t$unregisterTextContentProvider(handle: number): void;\n\t$onVirtualDocumentChange(uri: UriComponents, value: string): Promise<void>;\n}\n\nexport interface MainThreadDocumentsShape extends IDisposable {\n\t$tryCreateDocument(options?: { language?: string; content?: string; encoding?: string }): Promise<UriComponents>;\n\t$tryOpenDocument(uri: UriComponents, options?: { encoding?: string }): Promise<UriComponents>;\n\t$trySaveDocument(uri: UriComponents): Promise<boolean>;\n}\n\nexport interface ITextEditorConfigurationUpdate {\n\ttabSize?: number | 'auto';\n\tindentSize?: number | 'tabSize';\n\tinsertSpaces?: boolean | 'auto';\n\tcursorStyle?: TextEditorCursorStyle;\n\tlineNumbers?: RenderLineNumbersType;\n}\n\nexport interface IResolvedTextEditorConfiguration {\n\ttabSize: number;\n\tindentSize: number;\n\toriginalIndentSize: number | 'tabSize';\n\tinsertSpaces: boolean;\n\tcursorStyle: TextEditorCursorStyle;\n\tlineNumbers: RenderLineNumbersType;\n}\n\nexport enum TextEditorRevealType {\n\tDefault = 0,\n\tInCenter = 1,\n\tInCenterIfOutsideViewport = 2,\n\tAtTop = 3\n}\n\nexport interface IUndoStopOptions {\n\tundoStopBefore: boolean;\n\tundoStopAfter: boolean;\n}\n\nexport interface IApplyEditsOptions extends IUndoStopOptions {\n\tsetEndOfLine?: EndOfLineSequence;\n}\n\nexport interface ISnippetOptions extends IUndoStopOptions {\n\tkeepWhitespace?: boolean;\n}\nexport interface ITextDocumentShowOptions {\n\tposition?: EditorGroupColumn;\n\tpreserveFocus?: boolean;\n\tpinned?: boolean;\n\tselection?: IRange;\n}\n\nexport interface MainThreadBulkEditsShape extends IDisposable {\n\t$tryApplyWorkspaceEdit(workspaceEditDto: SerializableObjectWithBuffers<IWorkspaceEditDto>, undoRedoGroupId?: number, respectAutoSaveConfig?: boolean): Promise<boolean>;\n}\n\nexport interface MainThreadTextEditorsShape extends IDisposable {\n\t$tryShowTextDocument(resource: UriComponents, options: ITextDocumentShowOptions): Promise<string | undefined>;\n\t$registerTextEditorDecorationType(extensionId: ExtensionIdentifier, key: string, options: editorCommon.IDecorationRenderOptions): void;\n\t$removeTextEditorDecorationType(key: string): void;\n\t$tryShowEditor(id: string, position: EditorGroupColumn): Promise<void>;\n\t$tryHideEditor(id: string): Promise<void>;\n\t$trySetOptions(id: string, options: ITextEditorConfigurationUpdate): Promise<void>;\n\t$trySetDecorations(id: string, key: string, ranges: editorCommon.IDecorationOptions[]): Promise<void>;\n\t$trySetDecorationsFast(id: string, key: string, ranges: number[]): Promise<void>;\n\t$tryRevealRange(id: string, range: IRange, revealType: TextEditorRevealType): Promise<void>;\n\t$trySetSelections(id: string, selections: ISelection[]): Promise<void>;\n\t$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], opts: IApplyEditsOptions): Promise<boolean>;\n\t$tryInsertSnippet(id: string, modelVersionId: number, template: string, selections: readonly IRange[], opts: IUndoStopOptions): Promise<boolean>;\n\t$getDiffInformation(id: string): Promise<IChange[]>;\n}\n\nexport interface MainThreadTreeViewsShape extends IDisposable {\n\t$registerTreeViewDataProvider(treeViewId: string, options: { showCollapseAll: boolean; canSelectMany: boolean; dropMimeTypes: readonly string[]; dragMimeTypes: readonly string[]; hasHandleDrag: boolean; hasHandleDrop: boolean; manuallyManageCheckboxes: boolean }): Promise<void>;\n\t$refresh(treeViewId: string, itemsToRefresh?: { [treeItemHandle: string]: ITreeItem }): Promise<void>;\n\t$reveal(treeViewId: string, itemInfo: { item: ITreeItem; parentChain: ITreeItem[] } | undefined, options: IRevealOptions): Promise<void>;\n\t$setMessage(treeViewId: string, message: string | IMarkdownString): void;\n\t$setTitle(treeViewId: string, title: string, description: string | undefined): void;\n\t$setBadge(treeViewId: string, badge: IViewBadge | undefined): void;\n\t$resolveDropFileData(destinationViewId: string, requestId: number, dataItemId: string): Promise<VSBuffer>;\n\t$disposeTree(treeViewId: string): Promise<void>;\n}\n\nexport interface MainThreadDownloadServiceShape extends IDisposable {\n\t$download(uri: UriComponents, to: UriComponents): Promise<void>;\n}\n\nexport interface MainThreadErrorsShape extends IDisposable {\n\t$onUnexpectedError(err: any | SerializedError): void;\n}\n\nexport interface MainThreadConsoleShape extends IDisposable {\n\t$logExtensionHostMessage(msg: IRemoteConsoleLog): void;\n}\n\nexport interface IRegExpDto {\n\tpattern: string;\n\tflags?: string;\n}\nexport interface IIndentationRuleDto {\n\tdecreaseIndentPattern: IRegExpDto;\n\tincreaseIndentPattern: IRegExpDto;\n\tindentNextLinePattern?: IRegExpDto;\n\tunIndentedLinePattern?: IRegExpDto;\n}\nexport interface IOnEnterRuleDto {\n\tbeforeText: IRegExpDto;\n\tafterText?: IRegExpDto;\n\tpreviousLineText?: IRegExpDto;\n\taction: EnterAction;\n}\nexport interface ILanguageConfigurationDto {\n\tcomments?: CommentRule;\n\tbrackets?: CharacterPair[];\n\twordPattern?: IRegExpDto;\n\tindentationRules?: IIndentationRuleDto;\n\tonEnterRules?: IOnEnterRuleDto[];\n\t__electricCharacterSupport?: {\n\t\tbrackets?: any;\n\t\tdocComment?: {\n\t\t\tscope: string;\n\t\t\topen: string;\n\t\t\tlineStart: string;\n\t\t\tclose?: string;\n\t\t};\n\t};\n\t__characterPairSupport?: {\n\t\tautoClosingPairs: {\n\t\t\topen: string;\n\t\t\tclose: string;\n\t\t\tnotIn?: string[];\n\t\t}[];\n\t};\n\tautoClosingPairs?: {\n\t\topen: string;\n\t\tclose: string;\n\t\tnotIn?: string[];\n\t}[];\n}\n\nexport type GlobPattern = string | IRelativePattern;\n\nexport interface IRelativePatternDto extends IRelativePattern {\n\tbaseUri: UriComponents;\n}\n\nexport interface IDocumentFilterDto {\n\t$serialized: true;\n\tlanguage?: string;\n\tscheme?: string;\n\tpattern?: string | IRelativePattern;\n\texclusive?: boolean;\n\tnotebookType?: string;\n\tisBuiltin?: boolean;\n}\n\nexport interface IShareableItemDto {\n\tresourceUri: UriComponents;\n\tselection?: IRange;\n}\n\nexport interface IDocumentContextItemDto {\n\treadonly uri: UriComponents;\n\treadonly version: number;\n\treadonly ranges: IRange[];\n}\n\nexport interface IConversationItemDto {\n\treadonly type: 'request' | 'response';\n\treadonly message: string;\n\treadonly references?: IDocumentContextItemDto[];\n}\n\nexport interface IMappedEditsContextDto {\n\tdocuments: IDocumentContextItemDto[][];\n\tconversation?: IConversationItemDto[];\n}\n\nexport interface ICodeBlockDto {\n\tcode: string;\n\tresource: UriComponents;\n}\n\nexport interface IMappedEditsRequestDto {\n\treadonly codeBlocks: ICodeBlockDto[];\n\treadonly conversation?: IConversationItemDto[];\n}\n\nexport interface IMappedEditsResultDto {\n\treadonly errorMessage?: string;\n}\n\nexport interface ISignatureHelpProviderMetadataDto {\n\treadonly triggerCharacters: readonly string[];\n\treadonly retriggerCharacters: readonly string[];\n}\n\nexport interface IdentifiableInlineCompletions extends languages.InlineCompletions<IdentifiableInlineCompletion> {\n\tpid: number;\n}\n\nexport interface IdentifiableInlineCompletion extends languages.InlineCompletion {\n\tidx: number;\n}\n\nexport interface MainThreadLanguageFeaturesShape extends IDisposable {\n\t$unregister(handle: number): void;\n\t$registerDocumentSymbolProvider(handle: number, selector: IDocumentFilterDto[], label: string): void;\n\t$registerCodeLensSupport(handle: number, selector: IDocumentFilterDto[], eventHandle: number | undefined): void;\n\t$emitCodeLensEvent(eventHandle: number, event?: any): void;\n\t$registerDefinitionSupport(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerDeclarationSupport(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerImplementationSupport(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerTypeDefinitionSupport(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerHoverProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerEvaluatableExpressionProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerInlineValuesProvider(handle: number, selector: IDocumentFilterDto[], eventHandle: number | undefined): void;\n\t$emitInlineValuesEvent(eventHandle: number, event?: any): void;\n\t$registerDocumentHighlightProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerMultiDocumentHighlightProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerLinkedEditingRangeProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerReferenceSupport(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerCodeActionSupport(handle: number, selector: IDocumentFilterDto[], metadata: ICodeActionProviderMetadataDto, displayName: string, extensionID: string, supportsResolve: boolean): void;\n\t$registerPasteEditProvider(handle: number, selector: IDocumentFilterDto[], metadata: IPasteEditProviderMetadataDto): void;\n\t$registerDocumentFormattingSupport(handle: number, selector: IDocumentFilterDto[], extensionId: ExtensionIdentifier, displayName: string): void;\n\t$registerRangeFormattingSupport(handle: number, selector: IDocumentFilterDto[], extensionId: ExtensionIdentifier, displayName: string, supportRanges: boolean): void;\n\t$registerOnTypeFormattingSupport(handle: number, selector: IDocumentFilterDto[], autoFormatTriggerCharacters: string[], extensionId: ExtensionIdentifier): void;\n\t$registerNavigateTypeSupport(handle: number, supportsResolve: boolean): void;\n\t$registerRenameSupport(handle: number, selector: IDocumentFilterDto[], supportsResolveInitialValues: boolean): void;\n\t$registerNewSymbolNamesProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerDocumentSemanticTokensProvider(handle: number, selector: IDocumentFilterDto[], legend: languages.SemanticTokensLegend, eventHandle: number | undefined): void;\n\t$emitDocumentSemanticTokensEvent(eventHandle: number): void;\n\t$registerDocumentRangeSemanticTokensProvider(handle: number, selector: IDocumentFilterDto[], legend: languages.SemanticTokensLegend): void;\n\t$registerCompletionsProvider(handle: number, selector: IDocumentFilterDto[], triggerCharacters: string[], supportsResolveDetails: boolean, extensionId: ExtensionIdentifier): void;\n\t$registerInlineCompletionsSupport(handle: number, selector: IDocumentFilterDto[], supportsHandleDidShowCompletionItem: boolean, extensionId: string, extensionVersion: string, yieldToId: string | undefined, yieldsToExtensionIds: string[], displayName: string | undefined, debounceDelayMs: number | undefined, eventHandle: number | undefined): void;\n\t$emitInlineCompletionsChange(handle: number): void;\n\t$registerSignatureHelpProvider(handle: number, selector: IDocumentFilterDto[], metadata: ISignatureHelpProviderMetadataDto): void;\n\t$registerInlayHintsProvider(handle: number, selector: IDocumentFilterDto[], supportsResolve: boolean, eventHandle: number | undefined, displayName: string | undefined): void;\n\t$emitInlayHintsEvent(eventHandle: number): void;\n\t$registerDocumentLinkProvider(handle: number, selector: IDocumentFilterDto[], supportsResolve: boolean): void;\n\t$registerDocumentColorProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerFoldingRangeProvider(handle: number, selector: IDocumentFilterDto[], extensionId: ExtensionIdentifier, eventHandle: number | undefined): void;\n\t$emitFoldingRangeEvent(eventHandle: number, event?: any): void;\n\t$registerSelectionRangeProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerCallHierarchyProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerTypeHierarchyProvider(handle: number, selector: IDocumentFilterDto[]): void;\n\t$registerDocumentOnDropEditProvider(handle: number, selector: IDocumentFilterDto[], metadata?: IDocumentDropEditProviderMetadata): void;\n\t$resolvePasteFileData(handle: number, requestId: number, dataId: string): Promise<VSBuffer>;\n\t$resolveDocumentOnDropFileData(handle: number, requestId: number, dataId: string): Promise<VSBuffer>;\n\t$setLanguageConfiguration(handle: number, languageId: string, configuration: ILanguageConfigurationDto): void;\n}\n\nexport interface MainThreadLanguagesShape extends IDisposable {\n\t$changeLanguage(resource: UriComponents, languageId: string): Promise<void>;\n\t$tokensAtPosition(resource: UriComponents, position: IPosition): Promise<undefined | { type: StandardTokenType; range: IRange }>;\n\t$setLanguageStatus(handle: number, status: ILanguageStatus): void;\n\t$removeLanguageStatus(handle: number): void;\n}\n\nexport interface MainThreadMessageOptions {\n\tsource?: { identifier: ExtensionIdentifier; label: string };\n\tmodal?: boolean;\n\tdetail?: string;\n\tuseCustom?: boolean;\n}\n\nexport interface MainThreadMessageServiceShape extends IDisposable {\n\t$showMessage(severity: Severity, message: string, options: MainThreadMessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number }[]): Promise<number | undefined>;\n}\n\nexport interface MainThreadOutputServiceShape extends IDisposable {\n\t$register(label: string, file: UriComponents, languageId: string | undefined, extensionId: string): Promise<string>;\n\t$update(channelId: string, mode: OutputChannelUpdateMode, till?: number): Promise<void>;\n\t$reveal(channelId: string, preserveFocus: boolean): Promise<void>;\n\t$close(channelId: string): Promise<void>;\n\t$dispose(channelId: string): Promise<void>;\n}\n\nexport interface MainThreadProgressShape extends IDisposable {\n\n\t$startProgress(handle: number, options: IProgressOptions, extensionId?: string): Promise<void>;\n\t$progressReport(handle: number, message: IProgressStep): void;\n\t$progressEnd(handle: number): void;\n}\n\n/**\n * A terminal that is created on the extension host side is temporarily assigned\n * a UUID by the extension host that created it. Once the renderer side has assigned\n * a real numeric id, the numeric id will be used.\n *\n * All other terminals (that are not created on the extension host side) always\n * use the numeric id.\n */\nexport type ExtHostTerminalIdentifier = number | string;\n\nexport interface TerminalLaunchConfig {\n\tname?: string;\n\tshellPath?: string;\n\tshellArgs?: string[] | string;\n\tcwd?: string | UriComponents;\n\tenv?: ITerminalEnvironment;\n\ticon?: URI | { light: URI; dark: URI } | ThemeIcon;\n\tcolor?: string;\n\tinitialText?: string;\n\twaitOnExit?: boolean;\n\tstrictEnv?: boolean;\n\thideFromUser?: boolean;\n\tisExtensionCustomPtyTerminal?: boolean;\n\tforceShellIntegration?: boolean;\n\tisFeatureTerminal?: boolean;\n\tisExtensionOwnedTerminal?: boolean;\n\tuseShellEnvironment?: boolean;\n\tlocation?: TerminalLocation | { viewColumn: number; preserveFocus?: boolean } | { parentTerminal: ExtHostTerminalIdentifier } | { splitActiveTerminal: boolean };\n\tisTransient?: boolean;\n}\n\n\nexport interface MainThreadTerminalServiceShape extends IDisposable {\n\t$createTerminal(extHostTerminalId: string, config: TerminalLaunchConfig): Promise<void>;\n\t$dispose(id: ExtHostTerminalIdentifier): void;\n\t$hide(id: ExtHostTerminalIdentifier): void;\n\t$sendText(id: ExtHostTerminalIdentifier, text: string, shouldExecute: boolean): void;\n\t$show(id: ExtHostTerminalIdentifier, preserveFocus: boolean): void;\n\t$registerProcessSupport(isSupported: boolean): void;\n\t$registerProfileProvider(id: string, extensionIdentifier: string): void;\n\t$unregisterProfileProvider(id: string): void;\n\t$registerCompletionProvider(id: string, extensionIdentifier: string, ...triggerCharacters: string[]): void;\n\t$unregisterCompletionProvider(id: string): void;\n\t$registerQuickFixProvider(id: string, extensionIdentifier: string): void;\n\t$unregisterQuickFixProvider(id: string): void;\n\t$setEnvironmentVariableCollection(extensionIdentifier: string, persistent: boolean, collection: ISerializableEnvironmentVariableCollection | undefined, descriptionMap: ISerializableEnvironmentDescriptionMap): void;\n\n\t// Optional event toggles\n\t$startSendingDataEvents(): void;\n\t$stopSendingDataEvents(): void;\n\t$startSendingCommandEvents(): void;\n\t$stopSendingCommandEvents(): void;\n\t$startLinkProvider(): void;\n\t$stopLinkProvider(): void;\n\n\t// Process\n\t$sendProcessData(terminalId: number, data: string): void;\n\t$sendProcessReady(terminalId: number, pid: number, cwd: string, windowsPty: IProcessReadyWindowsPty | undefined): void;\n\t$sendProcessProperty(terminalId: number, property: IProcessProperty<any>): void;\n\t$sendProcessExit(terminalId: number, exitCode: number | undefined): void;\n}\n\nexport interface MainThreadTerminalShellIntegrationShape extends IDisposable {\n\t$executeCommand(terminalId: number, commandLine: string): void;\n}\n\nexport type TransferQuickPickItemOrSeparator = TransferQuickPickItem | quickInput.IQuickPickSeparator;\nexport interface TransferQuickPickItem {\n\thandle: number;\n\n\t// shared properties from IQuickPickItem\n\ttype?: 'item';\n\tlabel: string;\n\ticonPath?: { light?: URI; dark: URI };\n\ticonClass?: string;\n\tdescription?: string;\n\tdetail?: string;\n\tpicked?: boolean;\n\talwaysShow?: boolean;\n\tbuttons?: TransferQuickInputButton[];\n}\n\nexport interface TransferQuickInputButton extends quickInput.IQuickInputButton {\n\thandle: number;\n}\n\nexport type TransferQuickInput = TransferQuickPick | TransferInputBox;\n\nexport interface BaseTransferQuickInput {\n\n\t[key: string]: any;\n\n\tid: number;\n\n\ttitle?: string;\n\n\ttype?: 'quickPick' | 'inputBox';\n\n\tenabled?: boolean;\n\n\tbusy?: boolean;\n\n\tvisible?: boolean;\n}\n\nexport interface TransferQuickPick extends BaseTransferQuickInput {\n\n\ttype?: 'quickPick';\n\n\tvalue?: string;\n\n\tplaceholder?: string;\n\n\tbuttons?: TransferQuickInputButton[];\n\n\titems?: TransferQuickPickItemOrSeparator[];\n\n\tactiveItems?: number[];\n\n\tselectedItems?: number[];\n\n\tcanSelectMany?: boolean;\n\n\tignoreFocusOut?: boolean;\n\n\tmatchOnDescription?: boolean;\n\n\tmatchOnDetail?: boolean;\n\n\tsortByLabel?: boolean;\n}\n\nexport interface TransferInputBox extends BaseTransferQuickInput {\n\n\ttype?: 'inputBox';\n\n\tvalue?: string;\n\n\tvalueSelection?: Readonly<[number, number]>;\n\n\tplaceholder?: string;\n\n\tpassword?: boolean;\n\n\tbuttons?: TransferQuickInputButton[];\n\n\tprompt?: string;\n\n\tvalidationMessage?: string;\n}\n\nexport interface IInputBoxOptions {\n\ttitle?: string;\n\tvalue?: string;\n\tvalueSelection?: Readonly<[number, number]>;\n\tprompt?: string;\n\tplaceHolder?: string;\n\tpassword?: boolean;\n\tignoreFocusOut?: boolean;\n}\n\nexport interface MainThreadQuickOpenShape extends IDisposable {\n\t$show(instance: number, options: quickInput.IPickOptions<TransferQuickPickItem>, token: CancellationToken): Promise<number | number[] | undefined>;\n\t$setItems(instance: number, items: TransferQuickPickItemOrSeparator[]): Promise<void>;\n\t$setError(instance: number, error: Error): Promise<void>;\n\t$input(options: IInputBoxOptions | undefined, validateInput: boolean, token: CancellationToken): Promise<string | undefined>;\n\t$createOrUpdate(params: TransferQuickInput): Promise<void>;\n\t$dispose(id: number): Promise<void>;\n}\n\nexport interface MainThreadStatusBarShape extends IDisposable {\n\t$setEntry(id: string, statusId: string, extensionId: string | undefined, statusName: string, text: string, tooltip: IMarkdownString | string | undefined, hasTooltipProvider: boolean, command: ICommandDto | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignLeft: boolean, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void;\n\t$disposeEntry(id: string): void;\n}\n\nexport type StatusBarItemDto = {\n\tentryId: string;\n\talignLeft: boolean;\n\tpriority?: number;\n\tname: string;\n\ttext: string;\n\ttooltip?: string;\n\tcommand?: string;\n\taccessibilityInformation?: IAccessibilityInformation;\n};\n\nexport interface ExtHostStatusBarShape {\n\t$acceptStaticEntries(added?: StatusBarItemDto[]): void;\n\t$provideTooltip(entryId: string, cancellation: CancellationToken): Promise<string | IMarkdownString | undefined>;\n}\n\nexport interface MainThreadStorageShape extends IDisposable {\n\t$initializeExtensionStorage(shared: boolean, extensionId: string): Promise<string | undefined>;\n\t$setValue(shared: boolean, extensionId: string, value: object): Promise<void>;\n\t$registerExtensionStorageKeysToSync(extension: IExtensionIdWithVersion, keys: string[]): void;\n}\n\nexport interface MainThreadTelemetryShape extends IDisposable {\n\t$publicLog(eventName: string, data?: any): void;\n\t$publicLog2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>): void;\n}\n\nexport interface MainThreadEditorInsetsShape extends IDisposable {\n\t$createEditorInset(handle: number, id: string, uri: UriComponents, line: number, height: number, options: IWebviewContentOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): Promise<void>;\n\t$disposeEditorInset(handle: number): void;\n\n\t$setHtml(handle: number, value: string): void;\n\t$setOptions(handle: number, options: IWebviewContentOptions): void;\n\t$postMessage(handle: number, value: any): Promise<boolean>;\n}\n\nexport interface ExtHostEditorInsetsShape {\n\t$onDidDispose(handle: number): void;\n\t$onDidReceiveMessage(handle: number, message: any): void;\n}\n\n//#region --- tabs model\n\nexport const enum TabInputKind {\n\tUnknownInput,\n\tTextInput,\n\tTextDiffInput,\n\tTextMergeInput,\n\tNotebookInput,\n\tNotebookDiffInput,\n\tCustomEditorInput,\n\tWebviewEditorInput,\n\tTerminalEditorInput,\n\tInteractiveEditorInput,\n\tChatEditorInput,\n\tMultiDiffEditorInput\n}\n\nexport const enum TabModelOperationKind {\n\tTAB_OPEN,\n\tTAB_CLOSE,\n\tTAB_UPDATE,\n\tTAB_MOVE\n}\n\nexport interface UnknownInputDto {\n\tkind: TabInputKind.UnknownInput;\n}\n\nexport interface TextInputDto {\n\tkind: TabInputKind.TextInput;\n\turi: UriComponents;\n}\n\nexport interface TextDiffInputDto {\n\tkind: TabInputKind.TextDiffInput;\n\toriginal: UriComponents;\n\tmodified: UriComponents;\n}\n\nexport interface TextMergeInputDto {\n\tkind: TabInputKind.TextMergeInput;\n\tbase: UriComponents;\n\tinput1: UriComponents;\n\tinput2: UriComponents;\n\tresult: UriComponents;\n}\n\nexport interface NotebookInputDto {\n\tkind: TabInputKind.NotebookInput;\n\tnotebookType: string;\n\turi: UriComponents;\n}\n\nexport interface NotebookDiffInputDto {\n\tkind: TabInputKind.NotebookDiffInput;\n\tnotebookType: string;\n\toriginal: UriComponents;\n\tmodified: UriComponents;\n}\n\nexport interface CustomInputDto {\n\tkind: TabInputKind.CustomEditorInput;\n\tviewType: string;\n\turi: UriComponents;\n}\n\nexport interface WebviewInputDto {\n\tkind: TabInputKind.WebviewEditorInput;\n\tviewType: string;\n}\n\nexport interface InteractiveEditorInputDto {\n\tkind: TabInputKind.InteractiveEditorInput;\n\turi: UriComponents;\n\tinputBoxUri: UriComponents;\n}\n\nexport interface ChatEditorInputDto {\n\tkind: TabInputKind.ChatEditorInput;\n}\n\nexport interface MultiDiffEditorInputDto {\n\tkind: TabInputKind.MultiDiffEditorInput;\n\tdiffEditors: TextDiffInputDto[];\n}\n\nexport interface TabInputDto {\n\tkind: TabInputKind.TerminalEditorInput;\n}\n\nexport type AnyInputDto = UnknownInputDto | TextInputDto | TextDiffInputDto | MultiDiffEditorInputDto | TextMergeInputDto | NotebookInputDto | NotebookDiffInputDto | CustomInputDto | WebviewInputDto | InteractiveEditorInputDto | ChatEditorInputDto | TabInputDto;\n\nexport interface MainThreadEditorTabsShape extends IDisposable {\n\t// manage tabs: move, close, rearrange etc\n\t$moveTab(tabId: string, index: number, viewColumn: EditorGroupColumn, preserveFocus?: boolean): void;\n\t$closeTab(tabIds: string[], preserveFocus?: boolean): Promise<boolean>;\n\t$closeGroup(groupIds: number[], preservceFocus?: boolean): Promise<boolean>;\n}\n\nexport interface IEditorTabGroupDto {\n\tisActive: boolean;\n\tviewColumn: EditorGroupColumn;\n\t// Decided not to go with simple index here due to opening and closing causing index shifts\n\t// This allows us to patch the model without having to do full rebuilds\n\ttabs: IEditorTabDto[];\n\tgroupId: number;\n}\n\nexport interface TabOperation {\n\treadonly kind: TabModelOperationKind.TAB_OPEN | TabModelOperationKind.TAB_CLOSE | TabModelOperationKind.TAB_UPDATE | TabModelOperationKind.TAB_MOVE;\n\t// TODO @lramos15 Possibly get rid of index for tab update, it's only needed for open and close\n\treadonly index: number;\n\treadonly tabDto: IEditorTabDto;\n\treadonly groupId: number;\n\treadonly oldIndex?: number;\n}\n\nexport interface IEditorTabDto {\n\tid: string;\n\tlabel: string;\n\tinput: AnyInputDto;\n\teditorId?: string;\n\tisActive: boolean;\n\tisPinned: boolean;\n\tisPreview: boolean;\n\tisDirty: boolean;\n}\n\nexport interface IExtHostEditorTabsShape {\n\t// Accepts a whole new model\n\t$acceptEditorTabModel(tabGroups: IEditorTabGroupDto[]): void;\n\t// Only when group property changes (not the tabs inside)\n\t$acceptTabGroupUpdate(groupDto: IEditorTabGroupDto): void;\n\t// When a tab is added, removed, or updated\n\t$acceptTabOperation(operation: TabOperation): void;\n}\n\n//#endregion\n\nexport type WebviewHandle = string;\n\nexport interface WebviewPanelShowOptions {\n\treadonly viewColumn?: EditorGroupColumn;\n\treadonly preserveFocus?: boolean;\n}\n\nexport interface WebviewExtensionDescription {\n\treadonly id: ExtensionIdentifier;\n\treadonly location: UriComponents;\n}\n\nexport enum WebviewEditorCapabilities {\n\tEditable,\n\tSupportsHotExit,\n}\n\nexport interface IWebviewPortMapping {\n\treadonly webviewPort: number;\n\treadonly extensionHostPort: number;\n}\n\nexport interface IWebviewContentOptions {\n\treadonly enableScripts?: boolean;\n\treadonly enableForms?: boolean;\n\treadonly enableCommandUris?: boolean | readonly string[];\n\treadonly localResourceRoots?: readonly UriComponents[];\n\treadonly portMapping?: readonly IWebviewPortMapping[];\n}\n\nexport interface IWebviewPanelOptions {\n\treadonly enableFindWidget?: boolean;\n\treadonly retainContextWhenHidden?: boolean;\n}\n\nexport interface CustomTextEditorCapabilities {\n\treadonly supportsMove?: boolean;\n}\n\nexport const enum WebviewMessageArrayBufferViewType {\n\tInt8Array = 1,\n\tUint8Array = 2,\n\tUint8ClampedArray = 3,\n\tInt16Array = 4,\n\tUint16Array = 5,\n\tInt32Array = 6,\n\tUint32Array = 7,\n\tFloat32Array = 8,\n\tFloat64Array = 9,\n\tBigInt64Array = 10,\n\tBigUint64Array = 11,\n}\n\nexport interface WebviewMessageArrayBufferReference {\n\treadonly $$vscode_array_buffer_reference$$: true;\n\n\treadonly index: number;\n\n\t/**\n\t * Tracks if the reference is to a view instead of directly to an ArrayBuffer.\n\t */\n\treadonly view?: {\n\t\treadonly type: WebviewMessageArrayBufferViewType;\n\t\treadonly byteLength: number;\n\t\treadonly byteOffset: number;\n\t};\n}\n\nexport interface MainThreadWebviewsShape extends IDisposable {\n\t$setHtml(handle: WebviewHandle, value: string): void;\n\t$setOptions(handle: WebviewHandle, options: IWebviewContentOptions): void;\n\t$postMessage(handle: WebviewHandle, value: string, ...buffers: VSBuffer[]): Promise<boolean>;\n}\n\nexport interface IWebviewIconPath {\n\treadonly light: UriComponents;\n\treadonly dark: UriComponents;\n}\n\nexport interface IWebviewInitData {\n\treadonly title: string;\n\treadonly webviewOptions: IWebviewContentOptions;\n\treadonly panelOptions: IWebviewPanelOptions;\n\treadonly serializeBuffersForPostMessage: boolean;\n}\n\nexport interface MainThreadWebviewPanelsShape extends IDisposable {\n\t$createWebviewPanel(\n\t\textension: WebviewExtensionDescription,\n\t\thandle: WebviewHandle,\n\t\tviewType: string,\n\t\tinitData: IWebviewInitData,\n\t\tshowOptions: WebviewPanelShowOptions,\n\t): void;\n\t$disposeWebview(handle: WebviewHandle): void;\n\t$reveal(handle: WebviewHandle, showOptions: WebviewPanelShowOptions): void;\n\t$setTitle(handle: WebviewHandle, value: string): void;\n\t$setIconPath(handle: WebviewHandle, value: IWebviewIconPath | undefined): void;\n\n\t$registerSerializer(viewType: string, options: { serializeBuffersForPostMessage: boolean }): void;\n\t$unregisterSerializer(viewType: string): void;\n}\n\nexport interface MainThreadCustomEditorsShape extends IDisposable {\n\t$registerTextEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: IWebviewPanelOptions, capabilities: CustomTextEditorCapabilities, serializeBuffersForPostMessage: boolean): void;\n\t$registerCustomEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: IWebviewPanelOptions, supportsMultipleEditorsPerDocument: boolean, serializeBuffersForPostMessage: boolean): void;\n\t$unregisterEditorProvider(viewType: string): void;\n\n\t$onDidEdit(resource: UriComponents, viewType: string, editId: number, label: string | undefined): void;\n\t$onContentChange(resource: UriComponents, viewType: string): void;\n}\n\nexport interface MainThreadWebviewViewsShape extends IDisposable {\n\t$registerWebviewViewProvider(extension: WebviewExtensionDescription, viewType: string, options: { retainContextWhenHidden?: boolean; serializeBuffersForPostMessage: boolean }): void;\n\t$unregisterWebviewViewProvider(viewType: string): void;\n\n\t$setWebviewViewTitle(handle: WebviewHandle, value: string | undefined): void;\n\t$setWebviewViewDescription(handle: WebviewHandle, value: string | undefined): void;\n\t$setWebviewViewBadge(handle: WebviewHandle, badge: IViewBadge | undefined): void;\n\n\t$show(handle: WebviewHandle, preserveFocus: boolean): void;\n}\n\nexport interface WebviewPanelViewStateData {\n\t[handle: string]: {\n\t\treadonly active: boolean;\n\t\treadonly visible: boolean;\n\t\treadonly position: EditorGroupColumn;\n\t};\n}\n\nexport interface ExtHostWebviewsShape {\n\t$onMessage(handle: WebviewHandle, jsonSerializedMessage: string, buffers: SerializableObjectWithBuffers<VSBuffer[]>): void;\n\t$onMissingCsp(handle: WebviewHandle, extensionId: string): void;\n}\n\nexport interface ExtHostWebviewPanelsShape {\n\t$onDidChangeWebviewPanelViewStates(newState: WebviewPanelViewStateData): void;\n\t$onDidDisposeWebviewPanel(handle: WebviewHandle): Promise<void>;\n\t$deserializeWebviewPanel(\n\t\tnewWebviewHandle: WebviewHandle,\n\t\tviewType: string,\n\t\tinitData: {\n\t\t\ttitle: string;\n\t\t\tstate: any;\n\t\t\twebviewOptions: IWebviewContentOptions;\n\t\t\tpanelOptions: IWebviewPanelOptions;\n\t\t\tactive: boolean;\n\t\t},\n\t\tposition: EditorGroupColumn,\n\t): Promise<void>;\n}\n\nexport interface ExtHostCustomEditorsShape {\n\t$resolveCustomEditor(\n\t\tresource: UriComponents,\n\t\tnewWebviewHandle: WebviewHandle,\n\t\tviewType: string,\n\t\tinitData: {\n\t\t\ttitle: string;\n\t\t\tcontentOptions: IWebviewContentOptions;\n\t\t\toptions: IWebviewPanelOptions;\n\t\t\tactive: boolean;\n\t\t},\n\t\tposition: EditorGroupColumn,\n\t\tcancellation: CancellationToken\n\t): Promise<void>;\n\t$createCustomDocument(resource: UriComponents, viewType: string, backupId: string | undefined, untitledDocumentData: VSBuffer | undefined, cancellation: CancellationToken): Promise<{ editable: boolean }>;\n\t$disposeCustomDocument(resource: UriComponents, viewType: string): Promise<void>;\n\n\t$undo(resource: UriComponents, viewType: string, editId: number, isDirty: boolean): Promise<void>;\n\t$redo(resource: UriComponents, viewType: string, editId: number, isDirty: boolean): Promise<void>;\n\t$revert(resource: UriComponents, viewType: string, cancellation: CancellationToken): Promise<void>;\n\t$disposeEdits(resourceComponents: UriComponents, viewType: string, editIds: number[]): void;\n\n\t$onSave(resource: UriComponents, viewType: string, cancellation: CancellationToken): Promise<void>;\n\t$onSaveAs(resource: UriComponents, viewType: string, targetResource: UriComponents, cancellation: CancellationToken): Promise<void>;\n\n\t$backup(resource: UriComponents, viewType: string, cancellation: CancellationToken): Promise<string>;\n\n\t$onMoveCustomEditor(handle: WebviewHandle, newResource: UriComponents, viewType: string): Promise<void>;\n}\n\nexport interface ExtHostWebviewViewsShape {\n\t$resolveWebviewView(webviewHandle: WebviewHandle, viewType: string, title: string | undefined, state: any, cancellation: CancellationToken): Promise<void>;\n\n\t$onDidChangeWebviewViewVisibility(webviewHandle: WebviewHandle, visible: boolean): void;\n\n\t$disposeWebviewView(webviewHandle: WebviewHandle): void;\n}\n\nexport interface MainThreadManagedSocketsShape extends IDisposable {\n\t$registerSocketFactory(socketFactoryId: number): Promise<void>;\n\t$unregisterSocketFactory(socketFactoryId: number): Promise<void>;\n\t$onDidManagedSocketHaveData(socketId: number, data: VSBuffer): void;\n\t$onDidManagedSocketClose(socketId: number, error: string | undefined): void;\n\t$onDidManagedSocketEnd(socketId: number): void;\n}\n\nexport interface ExtHostManagedSocketsShape {\n\t$openRemoteSocket(socketFactoryId: number): Promise<number>;\n\t$remoteSocketWrite(socketId: number, buffer: VSBuffer): void;\n\t$remoteSocketEnd(socketId: number): void;\n\t$remoteSocketDrain(socketId: number): Promise<void>;\n}\n\nexport enum CellOutputKind {\n\tText = 1,\n\tError = 2,\n\tRich = 3\n}\n\nexport enum NotebookEditorRevealType {\n\tDefault = 0,\n\tInCenter = 1,\n\tInCenterIfOutsideViewport = 2,\n\tAtTop = 3\n}\n\nexport interface INotebookDocumentShowOptions {\n\tposition?: EditorGroupColumn;\n\tpreserveFocus?: boolean;\n\tpinned?: boolean;\n\tselections?: ICellRange[];\n\tlabel?: string;\n}\n\nexport type INotebookCellStatusBarEntryDto = Dto<notebookCommon.INotebookCellStatusBarItem>;\n\nexport interface INotebookCellStatusBarListDto {\n\titems: INotebookCellStatusBarEntryDto[];\n\tcacheId: number;\n}\n\nexport interface MainThreadNotebookShape extends IDisposable {\n\t$registerNotebookSerializer(handle: number, extension: notebookCommon.NotebookExtensionDescription, viewType: string, options: notebookCommon.TransientOptions, registration: notebookCommon.INotebookContributionData | undefined): void;\n\t$unregisterNotebookSerializer(handle: number): void;\n\n\t$registerNotebookCellStatusBarItemProvider(handle: number, eventHandle: number | undefined, viewType: string): Promise<void>;\n\t$unregisterNotebookCellStatusBarItemProvider(handle: number, eventHandle: number | undefined): Promise<void>;\n\t$emitCellStatusBarEvent(eventHandle: number): void;\n}\n\nexport interface MainThreadNotebookEditorsShape extends IDisposable {\n\t$tryShowNotebookDocument(uriComponents: UriComponents, viewType: string, options: INotebookDocumentShowOptions): Promise<string>;\n\t$tryRevealRange(id: string, range: ICellRange, revealType: NotebookEditorRevealType): Promise<void>;\n\t$trySetSelections(id: string, range: ICellRange[]): void;\n}\n\nexport interface MainThreadNotebookDocumentsShape extends IDisposable {\n\t$tryCreateNotebook(options: { viewType: string; content?: NotebookDataDto }): Promise<UriComponents>;\n\t$tryOpenNotebook(uriComponents: UriComponents): Promise<UriComponents>;\n\t$trySaveNotebook(uri: UriComponents): Promise<boolean>;\n}\n\nexport interface INotebookKernelDto2 {\n\tid: string;\n\tnotebookType: string;\n\textensionId: ExtensionIdentifier;\n\textensionLocation: UriComponents;\n\tlabel: string;\n\tdetail?: string;\n\tdescription?: string;\n\tsupportedLanguages?: string[];\n\tsupportsInterrupt?: boolean;\n\tsupportsExecutionOrder?: boolean;\n\tpreloads?: { uri: UriComponents; provides: readonly string[] }[];\n\thasVariableProvider?: boolean;\n}\n\nexport interface INotebookProxyKernelDto {\n\tid: string;\n\tnotebookType: string;\n\textensionId: ExtensionIdentifier;\n\textensionLocation: UriComponents;\n\tlabel: string;\n\tdetail?: string;\n\tdescription?: string;\n\tkind?: string;\n}\n\nexport interface ICellExecuteOutputEditDto {\n\teditType: CellExecutionUpdateType.Output;\n\tcellHandle: number;\n\tappend?: boolean;\n\toutputs: NotebookOutputDto[];\n}\n\nexport interface ICellExecuteOutputItemEditDto {\n\teditType: CellExecutionUpdateType.OutputItems;\n\tappend?: boolean;\n\toutputId: string;\n\titems: NotebookOutputItemDto[];\n}\n\nexport interface ICellExecutionStateUpdateDto extends ICellExecutionStateUpdate {\n}\n\nexport interface ICellExecutionCompleteDto extends ICellExecutionComplete {\n}\n\nexport type ICellExecuteUpdateDto = ICellExecuteOutputEditDto | ICellExecuteOutputItemEditDto | ICellExecutionStateUpdateDto;\n\nexport interface VariablesResult {\n\tid: number;\n\tname: string;\n\tvalue: string;\n\ttype?: string;\n\tlanguage?: string;\n\texpression?: string;\n\thasNamedChildren: boolean;\n\tindexedChildrenCount: number;\n\textensionId: string;\n}\n\nexport interface MainThreadNotebookKernelsShape extends IDisposable {\n\t$postMessage(handle: number, editorId: string | undefined, message: any): Promise<boolean>;\n\t$addKernel(handle: number, data: INotebookKernelDto2): Promise<void>;\n\t$updateKernel(handle: number, data: Partial<INotebookKernelDto2>): void;\n\t$removeKernel(handle: number): void;\n\t$updateNotebookPriority(handle: number, uri: UriComponents, value: number | undefined): void;\n\n\t$createExecution(handle: number, controllerId: string, uri: UriComponents, cellHandle: number): void;\n\t$updateExecution(handle: number, data: SerializableObjectWithBuffers<ICellExecuteUpdateDto[]>): void;\n\t$completeExecution(handle: number, data: SerializableObjectWithBuffers<ICellExecutionCompleteDto>): void;\n\n\t$createNotebookExecution(handle: number, controllerId: string, uri: UriComponents): void;\n\t$beginNotebookExecution(handle: number,): void;\n\t$completeNotebookExecution(handle: number): void;\n\n\t$addKernelDetectionTask(handle: number, notebookType: string): Promise<void>;\n\t$removeKernelDetectionTask(handle: number): void;\n\n\t$addKernelSourceActionProvider(handle: number, eventHandle: number, notebookType: string): Promise<void>;\n\t$removeKernelSourceActionProvider(handle: number, eventHandle: number): void;\n\t$emitNotebookKernelSourceActionsChangeEvent(eventHandle: number): void;\n\t$receiveVariable(requestId: string, variable: VariablesResult): void;\n\t$variablesUpdated(notebookUri: UriComponents): void;\n}\n\nexport interface MainThreadNotebookRenderersShape extends IDisposable {\n\t$postMessage(editorId: string | undefined, rendererId: string, message: unknown): Promise<boolean>;\n}\n\nexport interface MainThreadInteractiveShape extends IDisposable {\n}\n\nexport interface MainThreadSpeechShape extends IDisposable {\n\t$registerProvider(handle: number, identifier: string, metadata: ISpeechProviderMetadata): void;\n\t$unregisterProvider(handle: number): void;\n\n\t$emitSpeechToTextEvent(session: number, event: ISpeechToTextEvent): void;\n\t$emitTextToSpeechEvent(session: number, event: ITextToSpeechEvent): void;\n\t$emitKeywordRecognitionEvent(session: number, event: IKeywordRecognitionEvent): void;\n}\n\nexport interface ExtHostSpeechShape {\n\t$createSpeechToTextSession(handle: number, session: number, language?: string): Promise<void>;\n\t$cancelSpeechToTextSession(session: number): Promise<void>;\n\n\t$createTextToSpeechSession(handle: number, session: number, language?: string): Promise<void>;\n\t$synthesizeSpeech(session: number, text: string): Promise<void>;\n\t$cancelTextToSpeechSession(session: number): Promise<void>;\n\n\t$createKeywordRecognitionSession(handle: number, session: number): Promise<void>;\n\t$cancelKeywordRecognitionSession(session: number): Promise<void>;\n}\n\nexport interface MainThreadLanguageModelsShape extends IDisposable {\n\t$registerLanguageModelProvider(handle: number, identifier: string, metadata: ILanguageModelChatMetadata): void;\n\t$unregisterProvider(handle: number): void;\n\t$tryStartChatRequest(extension: ExtensionIdentifier, provider: string, requestId: number, messages: SerializableObjectWithBuffers<IChatMessage[]>, options: {}, token: CancellationToken): Promise<void>;\n\t$reportResponsePart(requestId: number, chunk: IChatResponseFragment | IChatResponseFragment[]): Promise<void>;\n\t$reportResponseDone(requestId: number, error: SerializedError | undefined): Promise<void>;\n\t$selectChatModels(selector: ILanguageModelChatSelector): Promise<string[]>;\n\t$whenLanguageModelChatRequestMade(identifier: string, extension: ExtensionIdentifier, participant?: string, tokenCount?: number): void;\n\t$countTokens(provider: string, value: string | IChatMessage, token: CancellationToken): Promise<number>;\n\t$fileIsIgnored(uri: UriComponents, token: CancellationToken): Promise<boolean>;\n\t$registerFileIgnoreProvider(handle: number): void;\n\t$unregisterFileIgnoreProvider(handle: number): void;\n}\n\nexport interface ExtHostLanguageModelsShape {\n\t$acceptChatModelMetadata(data: ILanguageModelsChangeEvent): void;\n\t$updateModelAccesslist(data: { from: ExtensionIdentifier; to: ExtensionIdentifier; enabled: boolean }[]): void;\n\t$startChatRequest(handle: number, requestId: number, from: ExtensionIdentifier, messages: SerializableObjectWithBuffers<IChatMessage[]>, options: { [name: string]: any }, token: CancellationToken): Promise<void>;\n\t$acceptResponsePart(requestId: number, chunk: IChatResponseFragment | IChatResponseFragment[]): Promise<void>;\n\t$acceptResponseDone(requestId: number, error: SerializedError | undefined): Promise<void>;\n\t$provideTokenLength(handle: number, value: string | IChatMessage, token: CancellationToken): Promise<number>;\n\t$isFileIgnored(handle: number, uri: UriComponents, token: CancellationToken): Promise<boolean>;\n}\n\nexport interface MainThreadEmbeddingsShape extends IDisposable {\n\t$registerEmbeddingProvider(handle: number, identifier: string): void;\n\t$unregisterEmbeddingProvider(handle: number): void;\n\t$computeEmbeddings(embeddingsModel: string, input: string[], token: CancellationToken): Promise<({ values: number[] }[])>;\n}\n\nexport interface ExtHostEmbeddingsShape {\n\t$provideEmbeddings(handle: number, input: string[], token: CancellationToken): Promise<{ values: number[] }[]>;\n\t$acceptEmbeddingModels(models: string[]): void;\n}\n\nexport interface IExtensionChatAgentMetadata extends Dto<IChatAgentMetadata> {\n\thasFollowups?: boolean;\n}\n\nexport interface IDynamicChatAgentProps {\n\tname: string;\n\tpublisherName: string;\n\tdescription?: string;\n\tfullName?: string;\n}\n\nexport interface MainThreadChatAgentsShape2 extends IDisposable {\n\t$registerAgent(handle: number, extension: ExtensionIdentifier, id: string, metadata: IExtensionChatAgentMetadata, dynamicProps: IDynamicChatAgentProps | undefined): void;\n\t$registerChatParticipantDetectionProvider(handle: number): void;\n\t$unregisterChatParticipantDetectionProvider(handle: number): void;\n\t$registerRelatedFilesProvider(handle: number, metadata: IChatRelatedFilesProviderMetadata): void;\n\t$unregisterRelatedFilesProvider(handle: number): void;\n\t$registerAgentCompletionsProvider(handle: number, id: string, triggerCharacters: string[]): void;\n\t$unregisterAgentCompletionsProvider(handle: number, id: string): void;\n\t$updateAgent(handle: number, metadataUpdate: IExtensionChatAgentMetadata): void;\n\t$unregisterAgent(handle: number): void;\n\t$handleProgressChunk(requestId: string, chunks: (IChatProgressDto | [IChatProgressDto, number])[]): Promise<void>;\n\t$handleAnchorResolve(requestId: string, handle: string, anchor: Dto<IChatContentInlineReference>): void;\n\n\n\t$transferActiveChatSession(toWorkspace: UriComponents): void;\n}\n\nexport interface ICodeMapperTextEdit {\n\turi: URI;\n\tedits: languages.TextEdit[];\n}\n\nexport interface ICodeMapperNotebookEditDto {\n\turi: URI;\n\tedits: ICellEditOperationDto[];\n}\n\nexport type ICodeMapperProgressDto = Dto<ICodeMapperTextEdit> | Dto<ICodeMapperNotebookEditDto>;\n\nexport interface MainThreadCodeMapperShape extends IDisposable {\n\t$registerCodeMapperProvider(handle: number, displayName: string): void;\n\t$unregisterCodeMapperProvider(handle: number): void;\n\t$handleProgress(requestId: string, data: ICodeMapperProgressDto): Promise<void>;\n}\n\nexport interface IChatAgentCompletionItem {\n\tid: string;\n\tfullName?: string;\n\ticon?: string;\n\tinsertText?: string;\n\tlabel: string | languages.CompletionItemLabel;\n\tvalue: IChatRequestVariableValueDto;\n\tdetail?: string;\n\tdocumentation?: string | IMarkdownString;\n\tcommand?: ICommandDto;\n}\n\nexport type IChatContentProgressDto =\n\t| Dto<Exclude<IChatProgressHistoryResponseContent, IChatTask>>\n\t| IChatTaskDto;\n\nexport type IChatAgentHistoryEntryDto = {\n\trequest: IChatAgentRequest;\n\tresponse: ReadonlyArray<IChatContentProgressDto>;\n\tresult: IChatAgentResult;\n};\n\nexport interface ExtHostChatAgentsShape2 {\n\t$invokeAgent(handle: number, request: Dto<IChatAgentRequest>, context: { history: IChatAgentHistoryEntryDto[] }, token: CancellationToken): Promise<IChatAgentResult | undefined>;\n\t$setRequestPaused(handle: number, requestId: string, isPaused: boolean): void;\n\t$provideFollowups(request: Dto<IChatAgentRequest>, handle: number, result: IChatAgentResult, context: { history: IChatAgentHistoryEntryDto[] }, token: CancellationToken): Promise<IChatFollowup[]>;\n\t$acceptFeedback(handle: number, result: IChatAgentResult, voteAction: IChatVoteAction): void;\n\t$acceptAction(handle: number, result: IChatAgentResult, action: IChatUserActionEvent): void;\n\t$invokeCompletionProvider(handle: number, query: string, token: CancellationToken): Promise<IChatAgentCompletionItem[]>;\n\t$provideChatTitle(handle: number, context: IChatAgentHistoryEntryDto[], token: CancellationToken): Promise<string | undefined>;\n\t$provideChatSummary(handle: number, context: IChatAgentHistoryEntryDto[], token: CancellationToken): Promise<string | undefined>;\n\t$releaseSession(sessionId: string): void;\n\t$detectChatParticipant(handle: number, request: Dto<IChatAgentRequest>, context: { history: IChatAgentHistoryEntryDto[] }, options: { participants: IChatParticipantMetadata[]; location: ChatAgentLocation }, token: CancellationToken): Promise<IChatParticipantDetectionResult | null | undefined>;\n\t$provideRelatedFiles(handle: number, request: Dto<IChatRequestDraft>, token: CancellationToken): Promise<Dto<IChatRelatedFile>[] | undefined>;\n}\nexport interface IChatParticipantMetadata {\n\tparticipant: string;\n\tcommand?: string;\n\tdisambiguation: { category: string; description: string; examples: string[] }[];\n}\n\nexport interface IChatParticipantDetectionResult {\n\tparticipant: string;\n\tcommand?: string;\n}\n\nexport interface IToolDataDto {\n\tid: string;\n\ttoolReferenceName?: string;\n\ttags?: string[];\n\tdisplayName: string;\n\tuserDescription?: string;\n\tmodelDescription: string;\n\tinputSchema?: IJSONSchema;\n}\n\nexport interface MainThreadLanguageModelToolsShape extends IDisposable {\n\t$getTools(): Promise<Dto<IToolDataDto>[]>;\n\t$acceptToolProgress(callId: string, progress: IToolProgressStep): void;\n\t$invokeTool(dto: IToolInvocation, token?: CancellationToken): Promise<Dto<IToolResult> | SerializableObjectWithBuffers<Dto<IToolResult>>>;\n\t$countTokensForInvocation(callId: string, input: string, token: CancellationToken): Promise<number>;\n\t$registerTool(id: string): void;\n\t$unregisterTool(name: string): void;\n}\n\nexport type IChatRequestVariableValueDto = Dto<IChatRequestVariableValue>;\n\nexport interface ExtHostLanguageModelToolsShape {\n\t$onDidChangeTools(tools: IToolDataDto[]): void;\n\t$invokeTool(dto: IToolInvocation, token: CancellationToken): Promise<Dto<IToolResult> | SerializableObjectWithBuffers<Dto<IToolResult>>>;\n\t$countTokensForInvocation(callId: string, input: string, token: CancellationToken): Promise<number>;\n\n\t$prepareToolInvocation(toolId: string, context: IToolInvocationPreparationContext, token: CancellationToken): Promise<IPreparedToolInvocation | undefined>;\n}\n\nexport interface MainThreadUrlsShape extends IDisposable {\n\t$registerUriHandler(handle: number, extensionId: ExtensionIdentifier, extensionDisplayName: string): Promise<void>;\n\t$unregisterUriHandler(handle: number): Promise<void>;\n\t$createAppUri(uri: UriComponents): Promise<UriComponents>;\n}\n\nexport interface IChatDto {\n}\n\nexport interface IChatRequestDto {\n\tmessage: string;\n\tvariables?: Record<string, IChatRequestVariableValue[]>;\n}\n\nexport interface IChatResponseDto {\n\terrorDetails?: IChatResponseErrorDetails;\n\ttimings: {\n\t\tfirstProgress: number;\n\t\ttotalElapsed: number;\n\t};\n}\n\nexport interface IChatResponseProgressFileTreeData {\n\tlabel: string;\n\turi: URI;\n\tchildren?: IChatResponseProgressFileTreeData[];\n}\n\nexport type IDocumentContextDto = {\n\turi: UriComponents;\n\tversion: number;\n\tranges: IRange[];\n};\n\nexport type IChatProgressDto =\n\t| Dto<Exclude<IChatProgress, IChatTask | IChatNotebookEdit>>\n\t| IChatTaskDto\n\t| IChatNotebookEditDto;\n\nexport interface ExtHostUrlsShape {\n\t$handleExternalUri(handle: number, uri: UriComponents): Promise<void>;\n}\n\nexport interface MainThreadUriOpenersShape extends IDisposable {\n\t$registerUriOpener(id: string, schemes: readonly string[], extensionId: ExtensionIdentifier, label: string): Promise<void>;\n\t$unregisterUriOpener(id: string): Promise<void>;\n}\n\nexport interface ExtHostUriOpenersShape {\n\t$canOpenUri(id: string, uri: UriComponents, token: CancellationToken): Promise<languages.ExternalUriOpenerPriority>;\n\t$openUri(id: string, context: { resolvedUri: UriComponents; sourceUri: UriComponents }, token: CancellationToken): Promise<void>;\n}\n\nexport interface MainThreadProfileContentHandlersShape {\n\t$registerProfileContentHandler(id: string, name: string, description: string | undefined, extensionId: string): Promise<void>;\n\t$unregisterProfileContentHandler(id: string): Promise<void>;\n}\n\nexport interface ExtHostProfileContentHandlersShape {\n\t$saveProfile(id: string, name: string, content: string, token: CancellationToken): Promise<UriDto<ISaveProfileResult> | null>;\n\t$readProfile(id: string, idOrUri: string | UriComponents, token: CancellationToken): Promise<string | null>;\n}\n\nexport interface ITextSearchComplete {\n\tlimitHit?: boolean;\n\tmessage?: TextSearchCompleteMessage | TextSearchCompleteMessage[];\n}\n\nexport interface MainThreadWorkspaceShape extends IDisposable {\n\t$startFileSearch(includeFolder: UriComponents | null, options: IFileQueryBuilderOptions, token: CancellationToken): Promise<UriComponents[] | null>;\n\t$startTextSearch(query: search.IPatternInfo, folder: UriComponents | null, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete | null>;\n\t$checkExists(folders: readonly UriComponents[], includes: string[], token: CancellationToken): Promise<boolean>;\n\t$save(uri: UriComponents, options: { saveAs: boolean }): Promise<UriComponents | undefined>;\n\t$saveAll(includeUntitled?: boolean): Promise<boolean>;\n\t$updateWorkspaceFolders(extensionName: string, index: number, deleteCount: number, workspaceFoldersToAdd: { uri: UriComponents; name?: string }[]): Promise<void>;\n\t$resolveProxy(url: string): Promise<string | undefined>;\n\t$lookupAuthorization(authInfo: AuthInfo): Promise<Credentials | undefined>;\n\t$lookupKerberosAuthorization(url: string): Promise<string | undefined>;\n\t$loadCertificates(): Promise<string[]>;\n\t$requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Promise<boolean | undefined>;\n\t$registerEditSessionIdentityProvider(handle: number, scheme: string): void;\n\t$unregisterEditSessionIdentityProvider(handle: number): void;\n\t$registerCanonicalUriProvider(handle: number, scheme: string): void;\n\t$unregisterCanonicalUriProvider(handle: number): void;\n\t$resolveDecoding(resource: UriComponents | undefined, options?: { encoding?: string }): Promise<{ preferredEncoding: string; guessEncoding: boolean; candidateGuessEncodings: string[] }>;\n\t$validateDetectedEncoding(resource: UriComponents | undefined, detectedEncoding: string, options?: { encoding?: string }): Promise<string>;\n\t$resolveEncoding(resource: UriComponents | undefined, options?: { encoding?: string }): Promise<{ encoding: string; addBOM: boolean }>;\n}\n\nexport interface IFileChangeDto {\n\tresource: UriComponents;\n\ttype: files.FileChangeType;\n}\n\nexport interface MainThreadFileSystemShape extends IDisposable {\n\t$registerFileSystemProvider(handle: number, scheme: string, capabilities: files.FileSystemProviderCapabilities, readonlyMessage?: IMarkdownString): Promise<void>;\n\t$unregisterProvider(handle: number): void;\n\t$onFileSystemChange(handle: number, resource: IFileChangeDto[]): void;\n\n\t$stat(resource: UriComponents): Promise<files.IStat>;\n\t$readdir(resource: UriComponents): Promise<[string, files.FileType][]>;\n\t$readFile(resource: UriComponents): Promise<VSBuffer>;\n\t$writeFile(resource: UriComponents, content: VSBuffer): Promise<void>;\n\t$rename(resource: UriComponents, target: UriComponents, opts: files.IFileOverwriteOptions): Promise<void>;\n\t$copy(resource: UriComponents, target: UriComponents, opts: files.IFileOverwriteOptions): Promise<void>;\n\t$mkdir(resource: UriComponents): Promise<void>;\n\t$delete(resource: UriComponents, opts: files.IFileDeleteOptions): Promise<void>;\n\n\t$ensureActivation(scheme: string): Promise<void>;\n}\n\nexport interface MainThreadFileSystemEventServiceShape extends IDisposable {\n\t$watch(extensionId: string, session: number, resource: UriComponents, opts: files.IWatchOptions, correlate: boolean): void;\n\t$unwatch(session: number): void;\n}\n\nexport interface MainThreadLabelServiceShape extends IDisposable {\n\t$registerResourceLabelFormatter(handle: number, formatter: ResourceLabelFormatter): void;\n\t$unregisterResourceLabelFormatter(handle: number): void;\n}\n\nexport interface MainThreadSearchShape extends IDisposable {\n\t$registerFileSearchProvider(handle: number, scheme: string): void;\n\t$registerAITextSearchProvider(handle: number, scheme: string): void;\n\t$registerTextSearchProvider(handle: number, scheme: string): void;\n\t$unregisterProvider(handle: number): void;\n\t$handleFileMatch(handle: number, session: number, data: UriComponents[]): void;\n\t$handleTextMatch(handle: number, session: number, data: search.IRawFileMatch2[]): void;\n\t$handleKeywordResult(handle: number, session: number, data: AISearchKeyword): void;\n\t$handleTelemetry(eventName: string, data: any): void;\n}\n\nexport interface MainThreadShareShape extends IDisposable {\n\t$registerShareProvider(handle: number, selector: IDocumentFilterDto[], id: string, label: string, priority: number): void;\n\t$unregisterShareProvider(handle: number): void;\n}\n\nexport interface MainThreadTaskShape extends IDisposable {\n\t$createTaskId(task: tasks.ITaskDTO): Promise<string>;\n\t$registerTaskProvider(handle: number, type: string): Promise<void>;\n\t$unregisterTaskProvider(handle: number): Promise<void>;\n\t$fetchTasks(filter?: tasks.ITaskFilterDTO): Promise<tasks.ITaskDTO[]>;\n\t$getTaskExecution(value: tasks.ITaskHandleDTO | tasks.ITaskDTO): Promise<tasks.ITaskExecutionDTO>;\n\t$executeTask(task: tasks.ITaskHandleDTO | tasks.ITaskDTO): Promise<tasks.ITaskExecutionDTO>;\n\t$terminateTask(id: string): Promise<void>;\n\t$registerTaskSystem(scheme: string, info: tasks.ITaskSystemInfoDTO): void;\n\t$customExecutionComplete(id: string, result?: number): Promise<void>;\n\t$registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): Promise<void>;\n}\n\nexport interface MainThreadExtensionServiceShape extends IDisposable {\n\t$getExtension(extensionId: string): Promise<Dto<IExtensionDescription> | undefined>;\n\t$activateExtension(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void>;\n\t$onWillActivateExtension(extensionId: ExtensionIdentifier): Promise<void>;\n\t$onDidActivateExtension(extensionId: ExtensionIdentifier, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number, activationReason: ExtensionActivationReason): void;\n\t$onExtensionActivationError(extensionId: ExtensionIdentifier, error: SerializedError, missingExtensionDependency: MissingExtensionDependency | null): Promise<void>;\n\t$onExtensionRuntimeError(extensionId: ExtensionIdentifier, error: SerializedError): void;\n\t$setPerformanceMarks(marks: performance.PerformanceMark[]): Promise<void>;\n\t$asBrowserUri(uri: UriComponents): Promise<UriComponents>;\n}\n\nexport interface SCMProviderFeatures {\n\thasHistoryProvider?: boolean;\n\thasQuickDiffProvider?: boolean;\n\tquickDiffLabel?: string;\n\thasSecondaryQuickDiffProvider?: boolean;\n\tsecondaryQuickDiffLabel?: string;\n\tcount?: number;\n\tcommitTemplate?: string;\n\tacceptInputCommand?: languages.Command;\n\tactionButton?: SCMActionButtonDto | null;\n\tstatusBarCommands?: ICommandDto[];\n}\n\nexport interface SCMActionButtonDto {\n\tcommand: ICommandDto & { shortTitle?: string };\n\tsecondaryCommands?: ICommandDto[][];\n\tenabled: boolean;\n}\n\nexport interface SCMGroupFeatures {\n\thideWhenEmpty?: boolean;\n\tcontextValue?: string;\n}\n\nexport type SCMRawResource = [\n\tnumber /*handle*/,\n\tUriComponents /*resourceUri*/,\n\t[UriComponents | ThemeIcon | undefined, UriComponents | ThemeIcon | undefined] /*icons: light, dark*/,\n\tstring /*tooltip*/,\n\tboolean /*strike through*/,\n\tboolean /*faded*/,\n\tstring /*context value*/,\n\tICommandDto | undefined /*command*/,\n\tUriComponents | undefined /* multiFileDiffEditorOriginalUri */,\n\tUriComponents | undefined /* multiFileDiffEditorModifiedUri */,\n];\n\nexport type SCMRawResourceSplice = [\n\tnumber /* start */,\n\tnumber /* delete count */,\n\tSCMRawResource[]\n];\n\nexport type SCMRawResourceSplices = [\n\tnumber, /*handle*/\n\tSCMRawResourceSplice[]\n];\n\nexport interface SCMHistoryItemRefDto {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly revision?: string;\n\treadonly category?: string;\n\treadonly description?: string;\n\treadonly icon?: UriComponents | { light: UriComponents; dark: UriComponents } | ThemeIcon;\n}\n\nexport interface SCMHistoryItemRefsChangeEventDto {\n\treadonly added: readonly SCMHistoryItemRefDto[];\n\treadonly modified: readonly SCMHistoryItemRefDto[];\n\treadonly removed: readonly SCMHistoryItemRefDto[];\n\treadonly silent: boolean;\n}\n\nexport interface SCMHistoryItemDto {\n\treadonly id: string;\n\treadonly parentIds: string[];\n\treadonly subject: string;\n\treadonly message: string;\n\treadonly displayId?: string;\n\treadonly author?: string;\n\treadonly authorIcon?: UriComponents | { light: UriComponents; dark: UriComponents } | ThemeIcon;\n\treadonly authorEmail?: string;\n\treadonly timestamp?: number;\n\treadonly statistics?: {\n\t\treadonly files: number;\n\t\treadonly insertions: number;\n\t\treadonly deletions: number;\n\t};\n\treadonly references?: SCMHistoryItemRefDto[];\n}\n\nexport interface SCMHistoryItemChangeDto {\n\treadonly uri: UriComponents;\n\treadonly originalUri: UriComponents | undefined;\n\treadonly modifiedUri: UriComponents | undefined;\n}\n\nexport interface MainThreadSCMShape extends IDisposable {\n\t$registerSourceControl(handle: number, id: string, label: string, rootUri: UriComponents | undefined, inputBoxDocumentUri: UriComponents): Promise<void>;\n\t$updateSourceControl(handle: number, features: SCMProviderFeatures): Promise<void>;\n\t$unregisterSourceControl(handle: number): Promise<void>;\n\n\t$registerGroups(sourceControlHandle: number, groups: [number /*handle*/, string /*id*/, string /*label*/, SCMGroupFeatures, /* multiDiffEditorEnableViewChanges */ boolean][], splices: SCMRawResourceSplices[]): Promise<void>;\n\t$updateGroup(sourceControlHandle: number, handle: number, features: SCMGroupFeatures): Promise<void>;\n\t$updateGroupLabel(sourceControlHandle: number, handle: number, label: string): Promise<void>;\n\t$unregisterGroup(sourceControlHandle: number, handle: number): Promise<void>;\n\n\t$spliceResourceStates(sourceControlHandle: number, splices: SCMRawResourceSplices[]): Promise<void>;\n\n\t$setInputBoxValue(sourceControlHandle: number, value: string): Promise<void>;\n\t$setInputBoxPlaceholder(sourceControlHandle: number, placeholder: string): Promise<void>;\n\t$setInputBoxEnablement(sourceControlHandle: number, enabled: boolean): Promise<void>;\n\t$setInputBoxVisibility(sourceControlHandle: number, visible: boolean): Promise<void>;\n\t$showValidationMessage(sourceControlHandle: number, message: string | IMarkdownString, type: InputValidationType): Promise<void>;\n\t$setValidationProviderIsEnabled(sourceControlHandle: number, enabled: boolean): Promise<void>;\n\n\t$onDidChangeHistoryProviderCurrentHistoryItemRefs(sourceControlHandle: number, historyItemRef?: SCMHistoryItemRefDto, historyItemRemoteRef?: SCMHistoryItemRefDto, historyItemBaseRef?: SCMHistoryItemRefDto): Promise<void>;\n\t$onDidChangeHistoryProviderHistoryItemRefs(sourceControlHandle: number, historyItemRefs: SCMHistoryItemRefsChangeEventDto): Promise<void>;\n}\n\nexport interface MainThreadQuickDiffShape extends IDisposable {\n\t$registerQuickDiffProvider(handle: number, selector: IDocumentFilterDto[], id: string, label: string, rootUri: UriComponents | undefined): Promise<void>;\n\t$unregisterQuickDiffProvider(handle: number): Promise<void>;\n}\n\nexport type DebugSessionUUID = string;\n\nexport interface IDebugConfiguration {\n\ttype: string;\n\tname: string;\n\trequest: string;\n\t[key: string]: any;\n}\n\nexport interface IStartDebuggingOptions {\n\tparentSessionID?: DebugSessionUUID;\n\tlifecycleManagedByParent?: boolean;\n\trepl?: IDebugSessionReplMode;\n\tnoDebug?: boolean;\n\tcompact?: boolean;\n\tsuppressDebugToolbar?: boolean;\n\tsuppressDebugStatusbar?: boolean;\n\tsuppressDebugView?: boolean;\n\tsuppressSaveBeforeStart?: boolean;\n\ttestRun?: IDebugTestRunReference;\n}\n\nexport interface MainThreadDebugServiceShape extends IDisposable {\n\t$registerDebugTypes(debugTypes: string[]): void;\n\t$sessionCached(sessionID: string): void;\n\t$acceptDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;\n\t$acceptDAError(handle: number, name: string, message: string, stack: string | undefined): void;\n\t$acceptDAExit(handle: number, code: number | undefined, signal: string | undefined): void;\n\t$registerDebugConfigurationProvider(type: string, triggerKind: DebugConfigurationProviderTriggerKind, hasProvideMethod: boolean, hasResolveMethod: boolean, hasResolve2Method: boolean, handle: number): Promise<void>;\n\t$registerDebugAdapterDescriptorFactory(type: string, handle: number): Promise<void>;\n\t$unregisterDebugConfigurationProvider(handle: number): void;\n\t$unregisterDebugAdapterDescriptorFactory(handle: number): void;\n\t$startDebugging(folder: UriComponents | undefined, nameOrConfig: string | IDebugConfiguration, options: IStartDebuggingOptions): Promise<boolean>;\n\t$stopDebugging(sessionId: DebugSessionUUID | undefined): Promise<void>;\n\t$setDebugSessionName(id: DebugSessionUUID, name: string): void;\n\t$customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): Promise<any>;\n\t$getDebugProtocolBreakpoint(id: DebugSessionUUID, breakpoinId: string): Promise<DebugProtocol.Breakpoint | undefined>;\n\t$appendDebugConsole(value: string): void;\n\t$registerBreakpoints(breakpoints: Array<ISourceMultiBreakpointDto | IFunctionBreakpointDto | IDataBreakpointDto>): Promise<void>;\n\t$unregisterBreakpoints(breakpointIds: string[], functionBreakpointIds: string[], dataBreakpointIds: string[]): Promise<void>;\n\t$registerDebugVisualizer(extensionId: string, id: string): void;\n\t$unregisterDebugVisualizer(extensionId: string, id: string): void;\n\t$registerDebugVisualizerTree(treeId: string, canEdit: boolean): void;\n\t$unregisterDebugVisualizerTree(treeId: string): void;\n}\n\nexport interface IOpenUriOptions {\n\treadonly allowTunneling?: boolean;\n\treadonly allowContributedOpeners?: boolean | string;\n}\n\nexport interface MainThreadWindowShape extends IDisposable {\n\t$getInitialState(): Promise<{ isFocused: boolean; isActive: boolean }>;\n\t$openUri(uri: UriComponents, uriString: string | undefined, options: IOpenUriOptions): Promise<boolean>;\n\t$asExternalUri(uri: UriComponents, options: IOpenUriOptions): Promise<UriComponents>;\n}\n\nexport enum CandidatePortSource {\n\tNone = 0,\n\tProcess = 1,\n\tOutput = 2,\n\tHybrid = 3\n}\n\nexport interface PortAttributesSelector {\n\tportRange?: [number, number] | number;\n\tcommandPattern?: RegExp;\n}\n\nexport interface MainThreadTunnelServiceShape extends IDisposable {\n\t$openTunnel(tunnelOptions: TunnelOptions, source: string | undefined): Promise<TunnelDto | undefined>;\n\t$closeTunnel(remote: { host: string; port: number }): Promise<void>;\n\t$getTunnels(): Promise<TunnelDescription[]>;\n\t$setTunnelProvider(features: TunnelProviderFeatures | undefined, enablePortsView: boolean): Promise<void>;\n\t$setRemoteTunnelService(processId: number): Promise<void>;\n\t$setCandidateFilter(): Promise<void>;\n\t$onFoundNewCandidates(candidates: CandidatePort[]): Promise<void>;\n\t$setCandidatePortSource(source: CandidatePortSource): Promise<void>;\n\t$registerPortsAttributesProvider(selector: PortAttributesSelector, providerHandle: number): Promise<void>;\n\t$unregisterPortsAttributesProvider(providerHandle: number): Promise<void>;\n}\n\nexport interface MainThreadTimelineShape extends IDisposable {\n\t$registerTimelineProvider(provider: TimelineProviderDescriptor): void;\n\t$unregisterTimelineProvider(source: string): void;\n\t$emitTimelineChangeEvent(e: TimelineChangeEvent | undefined): void;\n}\n\nexport interface HoverWithId extends languages.Hover {\n\t/**\n\t * Id of the hover\n\t */\n\tid: number;\n}\n\n// -- extension host\n\nexport interface ICommandMetadataDto {\n\t/**\n\t * NOTE: Please use an ILocalizedString. string is in the type for backcompat for now.\n\t * A short summary of what the command does. This will be used in:\n\t * - API commands\n\t * - when showing keybindings that have no other UX\n\t * - when searching for commands in the Command Palette\n\t */\n\treadonly description: ILocalizedString | string;\n\treadonly args?: ReadonlyArray<{\n\t\treadonly name: string;\n\t\treadonly isOptional?: boolean;\n\t\treadonly description?: string;\n\t}>;\n\treadonly returns?: string;\n}\n\nexport interface ICodeMapperRequestDto extends Dto<ICodeMapperRequest> {\n\trequestId: string;\n}\n\nexport interface ExtHostCodeMapperShape {\n\t$mapCode(handle: number, request: ICodeMapperRequestDto, token: CancellationToken): Promise<ICodeMapperResult | null | undefined>;\n}\n\nexport interface ExtHostCommandsShape {\n\t$executeContributedCommand(id: string, ...args: any[]): Promise<unknown>;\n\t$getContributedCommandMetadata(): Promise<{ [id: string]: string | ICommandMetadataDto }>;\n}\n\nexport interface ExtHostConfigurationShape {\n\t$initializeConfiguration(data: IConfigurationInitData): void;\n\t$acceptConfigurationChanged(data: IConfigurationInitData, change: IConfigurationChange): void;\n}\n\nexport interface ExtHostDiagnosticsShape {\n\t$acceptMarkersChange(data: [UriComponents, IMarkerData[]][]): void;\n}\n\nexport interface ExtHostDocumentContentProvidersShape {\n\t$provideTextDocumentContent(handle: number, uri: UriComponents): Promise<string | null | undefined>;\n}\n\nexport interface IModelAddedData {\n\turi: UriComponents;\n\tversionId: number;\n\tlines: string[];\n\tEOL: string;\n\tlanguageId: string;\n\tisDirty: boolean;\n\tencoding: string;\n}\nexport interface ExtHostDocumentsShape {\n\t$acceptModelLanguageChanged(strURL: UriComponents, newLanguageId: string): void;\n\t$acceptModelSaved(strURL: UriComponents): void;\n\t$acceptDirtyStateChanged(strURL: UriComponents, isDirty: boolean): void;\n\t$acceptEncodingChanged(strURL: UriComponents, encoding: string): void;\n\t$acceptModelChanged(strURL: UriComponents, e: ISerializedModelContentChangedEvent, isDirty: boolean): void;\n}\n\nexport interface ExtHostDocumentSaveParticipantShape {\n\t$participateInSave(resource: UriComponents, reason: SaveReason): Promise<boolean[]>;\n}\n\nexport interface ITextEditorAddData {\n\tid: string;\n\tdocumentUri: UriComponents;\n\toptions: IResolvedTextEditorConfiguration;\n\tselections: ISelection[];\n\tvisibleRanges: IRange[];\n\teditorPosition: EditorGroupColumn | undefined;\n}\nexport interface ITextEditorPositionData {\n\t[id: string]: EditorGroupColumn;\n}\n\nexport type ITextEditorChange = [\n\toriginalStartLineNumber: number,\n\toriginalEndLineNumberExclusive: number,\n\tmodifiedStartLineNumber: number,\n\tmodifiedEndLineNumberExclusive: number\n];\n\nexport interface ITextEditorDiffInformation {\n\treadonly documentVersion: number;\n\treadonly original: UriComponents | undefined;\n\treadonly modified: UriComponents;\n\treadonly changes: readonly ITextEditorChange[];\n}\n\nexport interface IEditorPropertiesChangeData {\n\toptions: IResolvedTextEditorConfiguration | null;\n\tselections: ISelectionChangeEvent | null;\n\tvisibleRanges: IRange[] | null;\n}\nexport interface ISelectionChangeEvent {\n\tselections: Selection[];\n\tsource?: string;\n}\n\nexport interface ExtHostEditorsShape {\n\t$acceptEditorPropertiesChanged(id: string, props: IEditorPropertiesChangeData): void;\n\t$acceptEditorPositionData(data: ITextEditorPositionData): void;\n\t$acceptEditorDiffInformation(id: string, diffInformation: ITextEditorDiffInformation[] | undefined): void;\n}\n\nexport interface IDocumentsAndEditorsDelta {\n\tremovedDocuments?: UriComponents[];\n\taddedDocuments?: IModelAddedData[];\n\tremovedEditors?: string[];\n\taddedEditors?: ITextEditorAddData[];\n\tnewActiveEditor?: string | null;\n}\n\nexport interface ExtHostDocumentsAndEditorsShape {\n\t$acceptDocumentsAndEditorsDelta(delta: IDocumentsAndEditorsDelta): void;\n}\n\nexport interface IDataTransferFileDTO {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly uri?: UriComponents;\n}\n\nexport interface DataTransferItemDTO {\n\tid: string;\n\treadonly asString: string;\n\treadonly fileData: IDataTransferFileDTO | undefined;\n\treadonly uriListData?: ReadonlyArray<string | UriComponents>;\n}\n\nexport interface DataTransferDTO {\n\titems: Array<readonly [/* type */string, DataTransferItemDTO]>;\n}\n\nexport interface CheckboxUpdate {\n\ttreeItemHandle: string;\n\tnewState: boolean;\n}\n\nexport interface ExtHostTreeViewsShape {\n\t/**\n\t * To reduce what is sent on the wire:\n\t * w\n\t * \tx\n\t *  y\n\t *   z\n\t *\n\t * for [x,y] returns\n\t * [[1,z]], where the inner array is [original index, ...children]\n\t */\n\t$getChildren(treeViewId: string, treeItemHandles?: string[]): Promise<(number | ITreeItem)[][] | undefined>;\n\t$handleDrop(destinationViewId: string, requestId: number, treeDataTransfer: DataTransferDTO, targetHandle: string | undefined, token: CancellationToken, operationUuid?: string, sourceViewId?: string, sourceTreeItemHandles?: string[]): Promise<void>;\n\t$handleDrag(sourceViewId: string, sourceTreeItemHandles: string[], operationUuid: string, token: CancellationToken): Promise<DataTransferDTO | undefined>;\n\t$setExpanded(treeViewId: string, treeItemHandle: string, expanded: boolean): void;\n\t$setSelectionAndFocus(treeViewId: string, selectionHandles: string[], focusHandle: string): void;\n\t$setVisible(treeViewId: string, visible: boolean): void;\n\t$changeCheckboxState(treeViewId: string, checkboxUpdates: CheckboxUpdate[]): void;\n\t$hasResolve(treeViewId: string): Promise<boolean>;\n\t$resolve(treeViewId: string, treeItemHandle: string, token: CancellationToken): Promise<ITreeItem | undefined>;\n}\n\nexport interface ExtHostWorkspaceShape {\n\t$initializeWorkspace(workspace: IWorkspaceData | null, trusted: boolean): void;\n\t$acceptWorkspaceData(workspace: IWorkspaceData | null): void;\n\t$handleTextSearchResult(result: search.IRawFileMatch2, requestId: number): void;\n\t$onDidGrantWorkspaceTrust(): void;\n\t$getEditSessionIdentifier(folder: UriComponents, token: CancellationToken): Promise<string | undefined>;\n\t$provideEditSessionIdentityMatch(folder: UriComponents, identity1: string, identity2: string, token: CancellationToken): Promise<EditSessionIdentityMatch | undefined>;\n\t$onWillCreateEditSessionIdentity(folder: UriComponents, token: CancellationToken, timeout: number): Promise<void>;\n\t$provideCanonicalUri(uri: UriComponents, targetScheme: string, token: CancellationToken): Promise<UriComponents | undefined>;\n}\n\nexport interface ExtHostFileSystemInfoShape {\n\t$acceptProviderInfos(uri: UriComponents, capabilities: number | null): void;\n}\n\nexport interface ExtHostFileSystemShape {\n\t$stat(handle: number, resource: UriComponents): Promise<files.IStat>;\n\t$readdir(handle: number, resource: UriComponents): Promise<[string, files.FileType][]>;\n\t$readFile(handle: number, resource: UriComponents): Promise<VSBuffer>;\n\t$writeFile(handle: number, resource: UriComponents, content: VSBuffer, opts: files.IFileWriteOptions): Promise<void>;\n\t$rename(handle: number, resource: UriComponents, target: UriComponents, opts: files.IFileOverwriteOptions): Promise<void>;\n\t$copy(handle: number, resource: UriComponents, target: UriComponents, opts: files.IFileOverwriteOptions): Promise<void>;\n\t$mkdir(handle: number, resource: UriComponents): Promise<void>;\n\t$delete(handle: number, resource: UriComponents, opts: files.IFileDeleteOptions): Promise<void>;\n\t$watch(handle: number, session: number, resource: UriComponents, opts: files.IWatchOptions): void;\n\t$unwatch(handle: number, session: number): void;\n\t$open(handle: number, resource: UriComponents, opts: files.IFileOpenOptions): Promise<number>;\n\t$close(handle: number, fd: number): Promise<void>;\n\t$read(handle: number, fd: number, pos: number, length: number): Promise<VSBuffer>;\n\t$write(handle: number, fd: number, pos: number, data: VSBuffer): Promise<number>;\n}\n\nexport interface ExtHostLabelServiceShape {\n\t$registerResourceLabelFormatter(formatter: ResourceLabelFormatter): IDisposable;\n}\n\nexport interface ExtHostAuthenticationShape {\n\t$getSessions(id: string, scopes: string[] | undefined, options: IAuthenticationGetSessionsOptions): Promise<ReadonlyArray<AuthenticationSession>>;\n\t$createSession(id: string, scopes: string[], options: IAuthenticationCreateSessionOptions): Promise<AuthenticationSession>;\n\t$removeSession(id: string, sessionId: string): Promise<void>;\n\t$onDidChangeAuthenticationSessions(id: string, label: string, extensionIdFilter?: string[]): Promise<void>;\n\t$onDidUnregisterAuthenticationProvider(id: string): Promise<void>;\n\t$registerDynamicAuthProvider(authorizationServer: UriComponents, serverMetadata: IAuthorizationServerMetadata, resource?: IAuthorizationProtectedResourceMetadata, clientId?: string, initialTokens?: (IAuthorizationTokenResponse & { created_at: number })[]): Promise<string>;\n\t$onDidChangeDynamicAuthProviderTokens(authProviderId: string, clientId: string, tokens?: (IAuthorizationTokenResponse & { created_at: number })[]): Promise<void>;\n}\n\nexport interface ExtHostAiRelatedInformationShape {\n\t$provideAiRelatedInformation(handle: number, query: string, token: CancellationToken): Promise<RelatedInformationResult[]>;\n}\n\nexport interface MainThreadAiRelatedInformationShape {\n\t$getAiRelatedInformation(query: string, types: RelatedInformationType[]): Promise<RelatedInformationResult[]>;\n\t$registerAiRelatedInformationProvider(handle: number, type: RelatedInformationType): void;\n\t$unregisterAiRelatedInformationProvider(handle: number): void;\n}\n\nexport interface ExtHostAiSettingsSearchShape {\n\t$startSearch(handle: number, query: string, option: AiSettingsSearchProviderOptions, token: CancellationToken): Promise<void>;\n}\n\nexport interface MainThreadAiSettingsSearchShape {\n\t$registerAiSettingsSearchProvider(handle: number): void;\n\t$unregisterAiSettingsSearchProvider(handle: number): void;\n\t$handleSearchResult(handle: number, result: AiSettingsSearchResult): void;\n}\n\nexport interface ExtHostAiEmbeddingVectorShape {\n\t$provideAiEmbeddingVector(handle: number, strings: string[], token: CancellationToken): Promise<number[][]>;\n}\n\nexport interface MainThreadAiEmbeddingVectorShape {\n\t$registerAiEmbeddingVectorProvider(model: string, handle: number): void;\n\t$unregisterAiEmbeddingVectorProvider(handle: number): void;\n}\n\nexport interface ExtHostSecretStateShape {\n\t$onDidChangePassword(e: { extensionId: string; key: string }): Promise<void>;\n}\n\nexport interface ExtHostSearchShape {\n\t$enableExtensionHostSearch(): void;\n\t$getAIName(handle: number): Promise<string | undefined>;\n\t$provideFileSearchResults(handle: number, session: number, query: search.IRawQuery, token: CancellationToken): Promise<search.ISearchCompleteStats>;\n\t$provideAITextSearchResults(handle: number, session: number, query: search.IRawAITextQuery, token: CancellationToken): Promise<search.ISearchCompleteStats>;\n\t$provideTextSearchResults(handle: number, session: number, query: search.IRawTextQuery, token: CancellationToken): Promise<search.ISearchCompleteStats>;\n\t$clearCache(cacheKey: string): Promise<void>;\n}\n\nexport interface ExtHostExtensionServiceShape {\n\t$resolveAuthority(remoteAuthority: string, resolveAttempt: number): Promise<Dto<IResolveAuthorityResult>>;\n\t/**\n\t * Returns `null` if no resolver for `remoteAuthority` is found.\n\t */\n\t$getCanonicalURI(remoteAuthority: string, uri: UriComponents): Promise<UriComponents | null>;\n\t$startExtensionHost(extensionsDelta: IExtensionDescriptionDelta): Promise<void>;\n\t$extensionTestsExecute(): Promise<number>;\n\t$activateByEvent(activationEvent: string, activationKind: ActivationKind): Promise<void>;\n\t$activate(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<boolean>;\n\t$setRemoteEnvironment(env: { [key: string]: string | null }): Promise<void>;\n\t$updateRemoteConnectionData(connectionData: IRemoteConnectionData): Promise<void>;\n\n\t$deltaExtensions(extensionsDelta: IExtensionDescriptionDelta): Promise<void>;\n\n\t$test_latency(n: number): Promise<number>;\n\t$test_up(b: VSBuffer): Promise<number>;\n\t$test_down(size: number): Promise<VSBuffer>;\n}\n\nexport interface FileSystemEvents {\n\tsession?: number;\n\tcreated: UriComponents[];\n\tchanged: UriComponents[];\n\tdeleted: UriComponents[];\n}\n\nexport interface SourceTargetPair {\n\tsource?: UriComponents;\n\ttarget: UriComponents;\n}\n\nexport interface IWillRunFileOperationParticipation {\n\tedit: IWorkspaceEditDto;\n\textensionNames: string[];\n}\n\nexport interface ExtHostFileSystemEventServiceShape {\n\t$onFileEvent(events: FileSystemEvents): void;\n\t$onWillRunFileOperation(operation: files.FileOperation, files: readonly SourceTargetPair[], timeout: number, token: CancellationToken): Promise<IWillRunFileOperationParticipation | undefined>;\n\t$onDidRunFileOperation(operation: files.FileOperation, files: readonly SourceTargetPair[]): void;\n}\n\nexport interface ExtHostLanguagesShape {\n\t$acceptLanguageIds(ids: string[]): void;\n}\n\nexport interface ExtHostHeapServiceShape {\n\t$onGarbageCollection(ids: number[]): void;\n}\nexport interface IRawColorInfo {\n\tcolor: [number, number, number, number];\n\trange: IRange;\n}\n\nexport class IdObject {\n\t_id?: number;\n\tprivate static _n = 0;\n\tstatic mixin<T extends object>(object: T): T & IdObject {\n\t\t(<any>object)._id = IdObject._n++;\n\t\treturn <any>object;\n\t}\n}\n\nexport const enum ISuggestDataDtoField {\n\tlabel = 'a',\n\tkind = 'b',\n\tdetail = 'c',\n\tdocumentation = 'd',\n\tsortText = 'e',\n\tfilterText = 'f',\n\tpreselect = 'g',\n\tinsertText = 'h',\n\tinsertTextRules = 'i',\n\trange = 'j',\n\tcommitCharacters = 'k',\n\tadditionalTextEdits = 'l',\n\tkindModifier = 'm',\n\tcommandIdent = 'n',\n\tcommandId = 'o',\n\tcommandArguments = 'p',\n}\n\nexport interface ISuggestDataDto {\n\t[ISuggestDataDtoField.label]: string | languages.CompletionItemLabel;\n\t[ISuggestDataDtoField.kind]?: languages.CompletionItemKind;\n\t[ISuggestDataDtoField.detail]?: string;\n\t[ISuggestDataDtoField.documentation]?: string | IMarkdownString;\n\t[ISuggestDataDtoField.sortText]?: string;\n\t[ISuggestDataDtoField.filterText]?: string;\n\t[ISuggestDataDtoField.preselect]?: true;\n\t[ISuggestDataDtoField.insertText]?: string;\n\t[ISuggestDataDtoField.insertTextRules]?: languages.CompletionItemInsertTextRule;\n\t[ISuggestDataDtoField.range]?: IRange | { insert: IRange; replace: IRange };\n\t[ISuggestDataDtoField.commitCharacters]?: string;\n\t[ISuggestDataDtoField.additionalTextEdits]?: ISingleEditOperation[];\n\t[ISuggestDataDtoField.kindModifier]?: languages.CompletionItemTag[];\n\t// Command\n\t[ISuggestDataDtoField.commandIdent]?: string;\n\t[ISuggestDataDtoField.commandId]?: string;\n\t[ISuggestDataDtoField.commandArguments]?: any[];\n\t// not-standard\n\tx?: ChainedCacheId;\n}\n\nexport const enum ISuggestResultDtoField {\n\tdefaultRanges = 'a',\n\tcompletions = 'b',\n\tisIncomplete = 'c',\n\tduration = 'd',\n}\n\nexport interface ISuggestResultDto {\n\t[ISuggestResultDtoField.defaultRanges]: { insert: IRange; replace: IRange };\n\t[ISuggestResultDtoField.completions]: ISuggestDataDto[];\n\t[ISuggestResultDtoField.isIncomplete]: undefined | true;\n\t[ISuggestResultDtoField.duration]: number;\n\tx?: number;\n}\n\nexport interface ISignatureHelpDto {\n\tid: CacheId;\n\tsignatures: languages.SignatureInformation[];\n\tactiveSignature: number;\n\tactiveParameter: number;\n}\n\nexport interface ISignatureHelpContextDto {\n\treadonly triggerKind: languages.SignatureHelpTriggerKind;\n\treadonly triggerCharacter: string | undefined;\n\treadonly isRetrigger: boolean;\n\treadonly activeSignatureHelp: ISignatureHelpDto | undefined;\n}\n\nexport type IInlayHintDto = CachedSessionItem<Dto<languages.InlayHint>>;\n\nexport type IInlayHintsDto = CachedSession<{ hints: IInlayHintDto[] }>;\n\nexport type ILocationDto = Dto<languages.Location>;\nexport type ILocationLinkDto = Dto<languages.LocationLink>;\n\nexport type IWorkspaceSymbolDto = CachedSessionItem<Dto<IWorkspaceSymbol>>;\nexport type IWorkspaceSymbolsDto = CachedSession<{ symbols: IWorkspaceSymbolDto[] }>;\n\nexport interface IWorkspaceEditEntryMetadataDto {\n\tneedsConfirmation: boolean;\n\tlabel: string;\n\tdescription?: string;\n\ticonPath?: { id: string } | UriComponents | { light: UriComponents; dark: UriComponents };\n}\n\nexport interface IChatNotebookEditDto {\n\turi: URI;\n\tedits: ICellEditOperationDto[];\n\tkind: 'notebookEdit';\n\tdone?: boolean;\n}\n\nexport type ICellEditOperationDto =\n\tnotebookCommon.ICellMetadataEdit\n\t| notebookCommon.IDocumentMetadataEdit\n\t| {\n\t\teditType: notebookCommon.CellEditType.Replace;\n\t\tindex: number;\n\t\tcount: number;\n\t\tcells: NotebookCellDataDto[];\n\t};\n\nexport type IWorkspaceCellEditDto = Dto<Omit<notebookCommon.IWorkspaceNotebookCellEdit, 'cellEdit'>> & { cellEdit: ICellEditOperationDto };\n\nexport type IWorkspaceFileEditDto = Dto<\n\tOmit<languages.IWorkspaceFileEdit, 'options'> & {\n\t\toptions?: Omit<languages.WorkspaceFileEditOptions, 'contents'> & { contents?: { type: 'base64'; value: string } | { type: 'dataTransferItem'; id: string } };\n\t}>;\n\nexport type IWorkspaceTextEditDto = Dto<languages.IWorkspaceTextEdit>;\n\nexport interface IWorkspaceEditDto {\n\tedits: Array<IWorkspaceFileEditDto | IWorkspaceTextEditDto | IWorkspaceCellEditDto>;\n}\n\nexport type ICommandDto = { $ident?: string } & languages.Command;\n\nexport interface ICodeActionDto {\n\tcacheId?: ChainedCacheId;\n\ttitle: string;\n\tedit?: IWorkspaceEditDto;\n\tdiagnostics?: Dto<IMarkerData[]>;\n\tcommand?: ICommandDto;\n\tkind?: string;\n\tisPreferred?: boolean;\n\tisAI?: boolean;\n\tdisabled?: string;\n\tranges?: IRange[];\n}\n\nexport interface ICodeActionListDto {\n\tcacheId: CacheId;\n\tactions: ReadonlyArray<ICodeActionDto>;\n}\n\nexport interface ICodeActionProviderMetadataDto {\n\treadonly providedKinds?: readonly string[];\n\treadonly documentation?: ReadonlyArray<{ readonly kind: string; readonly command: ICommandDto }>;\n}\n\nexport type CacheId = number;\nexport type ChainedCacheId = [CacheId, CacheId];\n\ntype CachedSessionItem<T> = T & { cacheId?: ChainedCacheId };\ntype CachedSession<T> = T & { cacheId?: CacheId };\n\nexport type ILinksListDto = CachedSession<{ links: ILinkDto[] }>;\nexport type ILinkDto = CachedSessionItem<Dto<languages.ILink>>;\n\nexport type ICodeLensListDto = CachedSession<{ lenses: ICodeLensDto[] }>;\nexport type ICodeLensDto = CachedSessionItem<Dto<languages.CodeLens>>;\n\nexport type ICallHierarchyItemDto = Dto<CallHierarchyItem>;\n\nexport interface IIncomingCallDto {\n\tfrom: ICallHierarchyItemDto;\n\tfromRanges: IRange[];\n}\n\nexport interface IOutgoingCallDto {\n\tfromRanges: IRange[];\n\tto: ICallHierarchyItemDto;\n}\n\nexport interface ILanguageWordDefinitionDto {\n\tlanguageId: string;\n\tregexSource: string;\n\tregexFlags: string;\n}\n\nexport interface ILinkedEditingRangesDto {\n\tranges: IRange[];\n\twordPattern?: IRegExpDto;\n}\n\nexport interface IInlineValueContextDto {\n\tframeId: number;\n\tstoppedLocation: IRange;\n}\n\nexport type ITypeHierarchyItemDto = Dto<TypeHierarchyItem>;\n\nexport interface IPasteEditProviderMetadataDto {\n\treadonly supportsCopy: boolean;\n\treadonly supportsPaste: boolean;\n\treadonly supportsResolve: boolean;\n\n\treadonly providedPasteEditKinds?: readonly string[];\n\treadonly copyMimeTypes?: readonly string[];\n\treadonly pasteMimeTypes?: readonly string[];\n}\n\nexport interface IDocumentPasteContextDto {\n\treadonly only: string | undefined;\n\treadonly triggerKind: languages.DocumentPasteTriggerKind;\n}\n\nexport interface IPasteEditDto {\n\t_cacheId?: ChainedCacheId;\n\ttitle: string;\n\tkind: { value: string } | undefined;\n\tinsertText: string | { snippet: string };\n\tadditionalEdit?: IWorkspaceEditDto;\n\tyieldTo?: readonly string[];\n}\n\nexport interface IDocumentDropEditProviderMetadata {\n\treadonly supportsResolve: boolean;\n\n\treadonly dropMimeTypes: readonly string[];\n\treadonly providedDropKinds?: readonly string[];\n}\n\nexport interface IDocumentDropEditDto {\n\t_cacheId?: ChainedCacheId;\n\ttitle: string;\n\tkind: string | undefined;\n\tinsertText: string | { snippet: string };\n\tadditionalEdit?: IWorkspaceEditDto;\n\tyieldTo?: readonly string[];\n}\n\nexport interface ExtHostLanguageFeaturesShape {\n\t$provideDocumentSymbols(handle: number, resource: UriComponents, token: CancellationToken): Promise<languages.DocumentSymbol[] | undefined>;\n\t$provideCodeLenses(handle: number, resource: UriComponents, token: CancellationToken): Promise<ICodeLensListDto | undefined>;\n\t$resolveCodeLens(handle: number, symbol: ICodeLensDto, token: CancellationToken): Promise<ICodeLensDto | undefined>;\n\t$releaseCodeLenses(handle: number, id: number): void;\n\t$provideDefinition(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<ILocationLinkDto[]>;\n\t$provideDeclaration(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<ILocationLinkDto[]>;\n\t$provideImplementation(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<ILocationLinkDto[]>;\n\t$provideTypeDefinition(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<ILocationLinkDto[]>;\n\t$provideHover(handle: number, resource: UriComponents, position: IPosition, context: languages.HoverContext<{ id: number }> | undefined, token: CancellationToken): Promise<HoverWithId | undefined>;\n\t$releaseHover(handle: number, id: number): void;\n\t$provideEvaluatableExpression(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<languages.EvaluatableExpression | undefined>;\n\t$provideInlineValues(handle: number, resource: UriComponents, range: IRange, context: languages.InlineValueContext, token: CancellationToken): Promise<languages.InlineValue[] | undefined>;\n\t$provideDocumentHighlights(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<languages.DocumentHighlight[] | undefined>;\n\t$provideMultiDocumentHighlights(handle: number, resource: UriComponents, position: IPosition, otherModels: UriComponents[], token: CancellationToken): Promise<Dto<languages.MultiDocumentHighlight[]> | undefined>;\n\t$provideLinkedEditingRanges(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<ILinkedEditingRangesDto | undefined>;\n\t$provideReferences(handle: number, resource: UriComponents, position: IPosition, context: languages.ReferenceContext, token: CancellationToken): Promise<ILocationDto[] | undefined>;\n\t$provideCodeActions(handle: number, resource: UriComponents, rangeOrSelection: IRange | ISelection, context: languages.CodeActionContext, token: CancellationToken): Promise<ICodeActionListDto | undefined>;\n\t$resolveCodeAction(handle: number, id: ChainedCacheId, token: CancellationToken): Promise<{ edit?: IWorkspaceEditDto; command?: ICommandDto }>;\n\t$releaseCodeActions(handle: number, cacheId: number): void;\n\t$prepareDocumentPaste(handle: number, uri: UriComponents, ranges: readonly IRange[], dataTransfer: DataTransferDTO, token: CancellationToken): Promise<DataTransferDTO | undefined>;\n\t$providePasteEdits(handle: number, requestId: number, uri: UriComponents, ranges: IRange[], dataTransfer: DataTransferDTO, context: IDocumentPasteContextDto, token: CancellationToken): Promise<IPasteEditDto[] | undefined>;\n\t$resolvePasteEdit(handle: number, id: ChainedCacheId, token: CancellationToken): Promise<{ insertText?: string; additionalEdit?: IWorkspaceEditDto }>;\n\t$releasePasteEdits(handle: number, cacheId: number): void;\n\t$provideDocumentFormattingEdits(handle: number, resource: UriComponents, options: languages.FormattingOptions, token: CancellationToken): Promise<languages.TextEdit[] | undefined>;\n\t$provideDocumentRangeFormattingEdits(handle: number, resource: UriComponents, range: IRange, options: languages.FormattingOptions, token: CancellationToken): Promise<languages.TextEdit[] | undefined>;\n\t$provideDocumentRangesFormattingEdits(handle: number, resource: UriComponents, range: IRange[], options: languages.FormattingOptions, token: CancellationToken): Promise<languages.TextEdit[] | undefined>;\n\t$provideOnTypeFormattingEdits(handle: number, resource: UriComponents, position: IPosition, ch: string, options: languages.FormattingOptions, token: CancellationToken): Promise<languages.TextEdit[] | undefined>;\n\t$provideWorkspaceSymbols(handle: number, search: string, token: CancellationToken): Promise<IWorkspaceSymbolsDto>;\n\t$resolveWorkspaceSymbol(handle: number, symbol: IWorkspaceSymbolDto, token: CancellationToken): Promise<IWorkspaceSymbolDto | undefined>;\n\t$releaseWorkspaceSymbols(handle: number, id: number): void;\n\t$provideRenameEdits(handle: number, resource: UriComponents, position: IPosition, newName: string, token: CancellationToken): Promise<IWorkspaceEditDto & { rejectReason?: string } | undefined>;\n\t$resolveRenameLocation(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<languages.RenameLocation | undefined>;\n\t$supportsAutomaticNewSymbolNamesTriggerKind(handle: number): Promise<boolean | undefined>;\n\t$provideNewSymbolNames(handle: number, resource: UriComponents, range: IRange, triggerKind: languages.NewSymbolNameTriggerKind, token: CancellationToken): Promise<languages.NewSymbolName[] | undefined>;\n\t$provideDocumentSemanticTokens(handle: number, resource: UriComponents, previousResultId: number, token: CancellationToken): Promise<VSBuffer | null>;\n\t$releaseDocumentSemanticTokens(handle: number, semanticColoringResultId: number): void;\n\t$provideDocumentRangeSemanticTokens(handle: number, resource: UriComponents, range: IRange, token: CancellationToken): Promise<VSBuffer | null>;\n\t$provideCompletionItems(handle: number, resource: UriComponents, position: IPosition, context: languages.CompletionContext, token: CancellationToken): Promise<ISuggestResultDto | undefined>;\n\t$resolveCompletionItem(handle: number, id: ChainedCacheId, token: CancellationToken): Promise<ISuggestDataDto | undefined>;\n\t$releaseCompletionItems(handle: number, id: number): void;\n\t$provideInlineCompletions(handle: number, resource: UriComponents, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<IdentifiableInlineCompletions | undefined>;\n\t$handleInlineCompletionDidShow(handle: number, pid: number, idx: number, updatedInsertText: string): void;\n\t$handleInlineCompletionPartialAccept(handle: number, pid: number, idx: number, acceptedCharacters: number, info: languages.PartialAcceptInfo): void;\n\t$handleInlineCompletionEndOfLifetime(handle: number, pid: number, idx: number, reason: languages.InlineCompletionEndOfLifeReason<{ pid: number; idx: number }>): void;\n\t$handleInlineCompletionRejection(handle: number, pid: number, idx: number): void;\n\t$freeInlineCompletionsList(handle: number, pid: number, reason: languages.InlineCompletionsDisposeReason): void;\n\t$provideSignatureHelp(handle: number, resource: UriComponents, position: IPosition, context: languages.SignatureHelpContext, token: CancellationToken): Promise<ISignatureHelpDto | undefined>;\n\t$releaseSignatureHelp(handle: number, id: number): void;\n\t$provideInlayHints(handle: number, resource: UriComponents, range: IRange, token: CancellationToken): Promise<IInlayHintsDto | undefined>;\n\t$resolveInlayHint(handle: number, id: ChainedCacheId, token: CancellationToken): Promise<IInlayHintDto | undefined>;\n\t$releaseInlayHints(handle: number, id: number): void;\n\t$provideDocumentLinks(handle: number, resource: UriComponents, token: CancellationToken): Promise<ILinksListDto | undefined>;\n\t$resolveDocumentLink(handle: number, id: ChainedCacheId, token: CancellationToken): Promise<ILinkDto | undefined>;\n\t$releaseDocumentLinks(handle: number, id: number): void;\n\t$provideDocumentColors(handle: number, resource: UriComponents, token: CancellationToken): Promise<IRawColorInfo[]>;\n\t$provideColorPresentations(handle: number, resource: UriComponents, colorInfo: IRawColorInfo, token: CancellationToken): Promise<languages.IColorPresentation[] | undefined>;\n\t$provideFoldingRanges(handle: number, resource: UriComponents, context: languages.FoldingContext, token: CancellationToken): Promise<languages.FoldingRange[] | undefined>;\n\t$provideSelectionRanges(handle: number, resource: UriComponents, positions: IPosition[], token: CancellationToken): Promise<languages.SelectionRange[][]>;\n\t$prepareCallHierarchy(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<ICallHierarchyItemDto[] | undefined>;\n\t$provideCallHierarchyIncomingCalls(handle: number, sessionId: string, itemId: string, token: CancellationToken): Promise<IIncomingCallDto[] | undefined>;\n\t$provideCallHierarchyOutgoingCalls(handle: number, sessionId: string, itemId: string, token: CancellationToken): Promise<IOutgoingCallDto[] | undefined>;\n\t$releaseCallHierarchy(handle: number, sessionId: string): void;\n\t$setWordDefinitions(wordDefinitions: ILanguageWordDefinitionDto[]): void;\n\t$prepareTypeHierarchy(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<ITypeHierarchyItemDto[] | undefined>;\n\t$provideTypeHierarchySupertypes(handle: number, sessionId: string, itemId: string, token: CancellationToken): Promise<ITypeHierarchyItemDto[] | undefined>;\n\t$provideTypeHierarchySubtypes(handle: number, sessionId: string, itemId: string, token: CancellationToken): Promise<ITypeHierarchyItemDto[] | undefined>;\n\t$releaseTypeHierarchy(handle: number, sessionId: string): void;\n\t$provideDocumentOnDropEdits(handle: number, requestId: number, resource: UriComponents, position: IPosition, dataTransferDto: DataTransferDTO, token: CancellationToken): Promise<IDocumentDropEditDto[] | undefined>;\n\t$releaseDocumentOnDropEdits(handle: number, cacheId: number): void;\n}\n\nexport interface ExtHostQuickOpenShape {\n\t$onItemSelected(handle: number): void;\n\t$validateInput(input: string): Promise<string | { content: string; severity: Severity } | null | undefined>;\n\t$onDidChangeActive(sessionId: number, handles: number[]): void;\n\t$onDidChangeSelection(sessionId: number, handles: number[]): void;\n\t$onDidAccept(sessionId: number): void;\n\t$onDidChangeValue(sessionId: number, value: string): void;\n\t$onDidTriggerButton(sessionId: number, handle: number): void;\n\t$onDidTriggerItemButton(sessionId: number, itemHandle: number, buttonHandle: number): void;\n\t$onDidHide(sessionId: number): void;\n}\n\nexport interface ExtHostTelemetryShape {\n\t$initializeTelemetryLevel(level: TelemetryLevel, supportsTelemetry: boolean, productConfig?: { usage: boolean; error: boolean }): void;\n\t$onDidChangeTelemetryLevel(level: TelemetryLevel): void;\n}\n\nexport interface ITerminalLinkDto {\n\t/** The ID of the link to enable activation and disposal. */\n\tid: number;\n\t/** The startIndex of the link in the line. */\n\tstartIndex: number;\n\t/** The length of the link in the line. */\n\tlength: number;\n\t/** The descriptive label for what the link does when activated. */\n\tlabel?: string;\n}\n\nexport interface ITerminalDimensionsDto {\n\tcolumns: number;\n\trows: number;\n}\n\ntype SingleOrMany<T> = T[] | T;\n\nexport interface ITerminalQuickFixTerminalCommandDto {\n\tterminalCommand: string;\n\tshouldExecute?: boolean;\n}\n\nexport interface ITerminalQuickFixOpenerDto {\n\turi: UriComponents;\n}\n\nexport type TerminalQuickFix = ITerminalQuickFixTerminalCommandDto | ITerminalQuickFixOpenerDto | ICommandDto;\n\nexport interface TerminalCommandMatchResultDto {\n\tcommandLine: string;\n\tcommandLineMatch: RegExpMatchArray;\n\toutputMatch?: {\n\t\tregexMatch: RegExpMatchArray;\n\t\toutputLines: string[];\n\t};\n}\n\nexport interface ITerminalCommandDto {\n\tcommandLine: string | undefined;\n\tcwd: URI | string | undefined;\n\texitCode: number | undefined;\n\toutput: string | undefined;\n}\n\nexport interface ITerminalCompletionContextDto {\n\tcommandLine: string;\n\tcursorPosition: number;\n\tallowFallbackCompletions: boolean;\n}\n\nexport interface ITerminalCompletionItemDto {\n\tlabel: string | CompletionItemLabel;\n\tdetail?: string;\n\tdocumentation?: string | IMarkdownString;\n\ticon?: ThemeIcon | undefined;\n\tisFile?: boolean | undefined;\n\tisDirectory?: boolean | undefined;\n\tisKeyword?: boolean | undefined;\n\treplacementIndex: number;\n\treplacementLength: number;\n}\n\nexport interface ITerminalCompletionProvider {\n\tid: string;\n\tshellTypes?: TerminalShellType[];\n\tprovideCompletions(value: string, cursorPosition: number, token: CancellationToken): Promise<TerminalCompletionListDto<ITerminalCompletionItemDto> | undefined>;\n\ttriggerCharacters?: string[];\n\tisBuiltin?: boolean;\n}\n/**\n * Represents a collection of {@link CompletionItem completion items} to be presented\n * in the editor.\n */\nexport class TerminalCompletionListDto<T extends ITerminalCompletionItemDto = ITerminalCompletionItemDto> {\n\n\t/**\n\t * Resources should be shown in the completions list\n\t */\n\tresourceRequestConfig?: TerminalResourceRequestConfigDto;\n\n\t/**\n\t * The completion items.\n\t */\n\titems: T[];\n\n\t/**\n\t * Creates a new completion list.\n\t *\n\t * @param items The completion items.\n\t * @param isIncomplete The list is not complete.\n\t */\n\tconstructor(items?: T[], resourceRequestConfig?: TerminalResourceRequestConfigDto) {\n\t\tthis.items = items ?? [];\n\t\tthis.resourceRequestConfig = resourceRequestConfig;\n\t}\n}\n\nexport interface TerminalResourceRequestConfigDto {\n\tfilesRequested?: boolean;\n\tfoldersRequested?: boolean;\n\tfileExtensions?: string[];\n\tcwd?: UriComponents;\n\tpathSeparator: string;\n}\n\nexport interface ExtHostTerminalServiceShape {\n\t$acceptTerminalClosed(id: number, exitCode: number | undefined, exitReason: TerminalExitReason): void;\n\t$acceptTerminalOpened(id: number, extHostTerminalId: string | undefined, name: string, shellLaunchConfig: IShellLaunchConfigDto): void;\n\t$acceptActiveTerminalChanged(id: number | null): void;\n\t$acceptTerminalProcessId(id: number, processId: number): void;\n\t$acceptTerminalProcessData(id: number, data: string): void;\n\t$acceptDidExecuteCommand(id: number, command: ITerminalCommandDto): void;\n\t$acceptTerminalTitleChange(id: number, name: string): void;\n\t$acceptTerminalDimensions(id: number, cols: number, rows: number): void;\n\t$acceptTerminalMaximumDimensions(id: number, cols: number, rows: number): void;\n\t$acceptTerminalInteraction(id: number): void;\n\t$acceptTerminalSelection(id: number, selection: string | undefined): void;\n\t$acceptTerminalShellType(id: number, shellType: TerminalShellType | undefined): void;\n\t$startExtensionTerminal(id: number, initialDimensions: ITerminalDimensionsDto | undefined): Promise<ITerminalLaunchError | undefined>;\n\t$acceptProcessAckDataEvent(id: number, charCount: number): void;\n\t$acceptProcessInput(id: number, data: string): void;\n\t$acceptProcessResize(id: number, cols: number, rows: number): void;\n\t$acceptProcessShutdown(id: number, immediate: boolean): void;\n\t$acceptProcessRequestInitialCwd(id: number): void;\n\t$acceptProcessRequestCwd(id: number): void;\n\t$acceptProcessRequestLatency(id: number): Promise<number>;\n\t$provideLinks(id: number, line: string): Promise<ITerminalLinkDto[]>;\n\t$activateLink(id: number, linkId: number): void;\n\t$initEnvironmentVariableCollections(collections: [string, ISerializableEnvironmentVariableCollection][]): void;\n\t$acceptDefaultProfile(profile: ITerminalProfile, automationProfile: ITerminalProfile): void;\n\t$createContributedProfileTerminal(id: string, options: ICreateContributedTerminalProfileOptions): Promise<void>;\n\t$provideTerminalQuickFixes(id: string, matchResult: TerminalCommandMatchResultDto, token: CancellationToken): Promise<SingleOrMany<TerminalQuickFix> | undefined>;\n\t$provideTerminalCompletions(id: string, options: ITerminalCompletionContextDto, token: CancellationToken): Promise<TerminalCompletionListDto | undefined>;\n}\n\nexport interface ExtHostTerminalShellIntegrationShape {\n\t$shellIntegrationChange(instanceId: number): void;\n\t$shellExecutionStart(instanceId: number, commandLineValue: string, commandLineConfidence: TerminalShellExecutionCommandLineConfidence, isTrusted: boolean, cwd: string | undefined): void;\n\t$shellExecutionEnd(instanceId: number, commandLineValue: string, commandLineConfidence: TerminalShellExecutionCommandLineConfidence, isTrusted: boolean, exitCode: number | undefined): void;\n\t$shellExecutionData(instanceId: number, data: string): void;\n\t$shellEnvChange(instanceId: number, shellEnvKeys: string[], shellEnvValues: string[], isTrusted: boolean): void;\n\t$cwdChange(instanceId: number, cwd: string | undefined): void;\n\t$closeTerminal(instanceId: number): void;\n}\n\nexport interface ExtHostSCMShape {\n\t$provideOriginalResource(sourceControlHandle: number, uri: UriComponents, token: CancellationToken): Promise<UriComponents | null>;\n\t$provideSecondaryOriginalResource(sourceControlHandle: number, uri: UriComponents, token: CancellationToken): Promise<UriComponents | null>;\n\t$onInputBoxValueChange(sourceControlHandle: number, value: string): void;\n\t$executeResourceCommand(sourceControlHandle: number, groupHandle: number, handle: number, preserveFocus: boolean): Promise<void>;\n\t$validateInput(sourceControlHandle: number, value: string, cursorPosition: number): Promise<[string | IMarkdownString, number] | undefined>;\n\t$setSelectedSourceControl(selectedSourceControlHandle: number | undefined): Promise<void>;\n\t$provideHistoryItemRefs(sourceControlHandle: number, historyItemRefs: string[] | undefined, token: CancellationToken): Promise<SCMHistoryItemRefDto[] | undefined>;\n\t$provideHistoryItems(sourceControlHandle: number, options: ISCMHistoryOptions, token: CancellationToken): Promise<SCMHistoryItemDto[] | undefined>;\n\t$provideHistoryItemChanges(sourceControlHandle: number, historyItemId: string, historyItemParentId: string | undefined, token: CancellationToken): Promise<SCMHistoryItemChangeDto[] | undefined>;\n\t$resolveHistoryItemChatContext(sourceControlHandle: number, historyItemId: string, token: CancellationToken): Promise<string | undefined>;\n\t$resolveHistoryItemRefsCommonAncestor(sourceControlHandle: number, historyItemRefs: string[], token: CancellationToken): Promise<string | undefined>;\n}\n\nexport interface ExtHostQuickDiffShape {\n\t$provideOriginalResource(sourceControlHandle: number, uri: UriComponents, token: CancellationToken): Promise<UriComponents | null>;\n}\n\nexport interface ExtHostShareShape {\n\t$provideShare(handle: number, shareableItem: IShareableItemDto, token: CancellationToken): Promise<UriComponents | string | undefined>;\n}\n\nexport interface ExtHostTaskShape {\n\t$provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.ITaskSetDTO>;\n\t$resolveTask(handle: number, taskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined>;\n\t$onDidStartTask(execution: tasks.ITaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.ITaskDefinitionDTO): void;\n\t$onDidStartTaskProcess(value: tasks.ITaskProcessStartedDTO): void;\n\t$onDidEndTaskProcess(value: tasks.ITaskProcessEndedDTO): void;\n\t$OnDidEndTask(execution: tasks.ITaskExecutionDTO): void;\n\t$onDidStartTaskProblemMatchers(status: tasks.ITaskProblemMatcherStartedDto): void;\n\t$onDidEndTaskProblemMatchers(status: tasks.ITaskProblemMatcherEndedDto): void;\n\t$resolveVariables(workspaceFolder: UriComponents, toResolve: { process?: { name: string; cwd?: string }; variables: string[] }): Promise<{ process?: string; variables: { [key: string]: string } }>;\n\t$jsonTasksSupported(): Promise<boolean>;\n\t$findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;\n}\n\nexport interface IBreakpointDto {\n\ttype: string;\n\tid?: string;\n\tenabled: boolean;\n\tcondition?: string;\n\thitCondition?: string;\n\tlogMessage?: string;\n\tmode?: string;\n}\n\nexport interface IFunctionBreakpointDto extends IBreakpointDto {\n\ttype: 'function';\n\tfunctionName: string;\n\tmode?: string;\n}\n\nexport interface IDataBreakpointDto extends IBreakpointDto {\n\ttype: 'data';\n\tdataId: string;\n\tcanPersist: boolean;\n\tlabel: string;\n\taccessTypes?: DebugProtocol.DataBreakpointAccessType[];\n\taccessType: DebugProtocol.DataBreakpointAccessType;\n\tmode?: string;\n}\n\nexport interface ISourceBreakpointDto extends IBreakpointDto {\n\ttype: 'source';\n\turi: UriComponents;\n\tline: number;\n\tcharacter: number;\n}\n\nexport interface IBreakpointsDeltaDto {\n\tadded?: Array<ISourceBreakpointDto | IFunctionBreakpointDto | IDataBreakpointDto>;\n\tremoved?: string[];\n\tchanged?: Array<ISourceBreakpointDto | IFunctionBreakpointDto | IDataBreakpointDto>;\n}\n\nexport interface ISourceMultiBreakpointDto {\n\ttype: 'sourceMulti';\n\turi: UriComponents;\n\tlines: {\n\t\tid: string;\n\t\tenabled: boolean;\n\t\tcondition?: string;\n\t\thitCondition?: string;\n\t\tlogMessage?: string;\n\t\tline: number;\n\t\tcharacter: number;\n\t\tmode?: string;\n\t}[];\n}\n\nexport interface IDebugSessionFullDto {\n\tid: DebugSessionUUID;\n\ttype: string;\n\tname: string;\n\tparent: DebugSessionUUID | undefined;\n\tfolderUri: UriComponents | undefined;\n\tconfiguration: IConfig;\n}\n\nexport type IDebugSessionDto = IDebugSessionFullDto | DebugSessionUUID;\n\nexport interface IThreadFocusDto {\n\tkind: 'thread';\n\tsessionId: string;\n\tthreadId: number;\n}\n\nexport interface IStackFrameFocusDto {\n\tkind: 'stackFrame';\n\tsessionId: string;\n\tthreadId: number;\n\tframeId: number;\n}\n\n\nexport interface ExtHostDebugServiceShape {\n\t$substituteVariables(folder: UriComponents | undefined, config: IConfig): Promise<IConfig>;\n\t$runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, sessionId: string): Promise<number | undefined>;\n\t$startDASession(handle: number, session: IDebugSessionDto): Promise<void>;\n\t$stopDASession(handle: number): Promise<void>;\n\t$sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;\n\t$resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig, token: CancellationToken): Promise<IConfig | null | undefined>;\n\t$resolveDebugConfigurationWithSubstitutedVariables(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig, token: CancellationToken): Promise<IConfig | null | undefined>;\n\t$provideDebugConfigurations(handle: number, folder: UriComponents | undefined, token: CancellationToken): Promise<IConfig[]>;\n\t$provideDebugAdapter(handle: number, session: IDebugSessionDto): Promise<Dto<IAdapterDescriptor>>;\n\t$acceptDebugSessionStarted(session: IDebugSessionDto): void;\n\t$acceptDebugSessionTerminated(session: IDebugSessionDto): void;\n\t$acceptDebugSessionActiveChanged(session: IDebugSessionDto | undefined): void;\n\t$acceptDebugSessionCustomEvent(session: IDebugSessionDto, event: any): void;\n\t$acceptBreakpointsDelta(delta: IBreakpointsDeltaDto): void;\n\t$acceptDebugSessionNameChanged(session: IDebugSessionDto, name: string): void;\n\t$acceptStackFrameFocus(focus: IThreadFocusDto | IStackFrameFocusDto | undefined): void;\n\t$provideDebugVisualizers(extensionId: string, id: string, context: IDebugVisualizationContext, token: CancellationToken): Promise<IDebugVisualization.Serialized[]>;\n\t$resolveDebugVisualizer(id: number, token: CancellationToken): Promise<MainThreadDebugVisualization>;\n\t$executeDebugVisualizerCommand(id: number): Promise<void>;\n\t$disposeDebugVisualizers(ids: number[]): void;\n\t$getVisualizerTreeItem(treeId: string, element: IDebugVisualizationContext): Promise<IDebugVisualizationTreeItem.Serialized | undefined>;\n\t$getVisualizerTreeItemChildren(treeId: string, element: number): Promise<IDebugVisualizationTreeItem.Serialized[]>;\n\t$editVisualizerTreeItem(element: number, value: string): Promise<IDebugVisualizationTreeItem.Serialized | undefined>;\n\t$disposeVisualizedTree(element: number): void;\n}\n\n\nexport interface DecorationRequest {\n\treadonly id: number;\n\treadonly uri: UriComponents;\n}\n\nexport type DecorationData = [boolean, string, string | ThemeIcon, ThemeColor];\nexport type DecorationReply = { [id: number]: DecorationData };\n\nexport interface ExtHostDecorationsShape {\n\t$provideDecorations(handle: number, requests: DecorationRequest[], token: CancellationToken): Promise<DecorationReply>;\n}\n\nexport interface ExtHostWindowShape {\n\t$onDidChangeWindowFocus(value: boolean): void;\n\t$onDidChangeWindowActive(value: boolean): void;\n\t$onDidChangeActiveNativeWindowHandle(handle: string | undefined): void;\n}\n\nexport interface ExtHostLogLevelServiceShape {\n\t$setLogLevel(level: LogLevel, resource?: UriComponents): void;\n}\n\nexport interface MainThreadLoggerShape {\n\t$log(file: UriComponents, messages: [LogLevel, string][]): void;\n\t$flush(file: UriComponents): void;\n\t$createLogger(file: UriComponents, options?: ILoggerOptions): Promise<void>;\n\t$registerLogger(logger: UriDto<ILoggerResource>): Promise<void>;\n\t$deregisterLogger(resource: UriComponents): Promise<void>;\n\t$setVisibility(resource: UriComponents, visible: boolean): Promise<void>;\n}\n\nexport interface ExtHostOutputServiceShape {\n\t$setVisibleChannel(channelId: string | null): void;\n}\n\nexport interface ExtHostProgressShape {\n\t$acceptProgressCanceled(handle: number): void;\n}\n\nexport interface ExtHostCommentsShape {\n\t$createCommentThreadTemplate(commentControllerHandle: number, uriComponents: UriComponents, range: IRange | undefined, editorId?: string): Promise<void>;\n\t$updateCommentThreadTemplate(commentControllerHandle: number, threadHandle: number, range: IRange): Promise<void>;\n\t$updateCommentThread(commentControllerHandle: number, threadHandle: number, changes: CommentThreadChanges): Promise<void>;\n\t$deleteCommentThread(commentControllerHandle: number, commentThreadHandle: number): void;\n\t$provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise<{ ranges: IRange[]; fileComments: boolean } | undefined>;\n\t$toggleReaction(commentControllerHandle: number, threadHandle: number, uri: UriComponents, comment: languages.Comment, reaction: languages.CommentReaction): Promise<void>;\n\t$setActiveComment(controllerHandle: number, commentInfo: { commentThreadHandle: number; uniqueIdInThread?: number } | undefined): Promise<void>;\n}\n\nexport interface INotebookSelectionChangeEvent {\n\tselections: ICellRange[];\n}\n\nexport interface INotebookVisibleRangesEvent {\n\tranges: ICellRange[];\n}\n\nexport interface INotebookEditorPropertiesChangeData {\n\tvisibleRanges?: INotebookVisibleRangesEvent;\n\tselections?: INotebookSelectionChangeEvent;\n}\n\nexport interface INotebookDocumentPropertiesChangeData {\n\tmetadata?: notebookCommon.NotebookDocumentMetadata;\n}\n\nexport interface INotebookModelAddedData {\n\turi: UriComponents;\n\tversionId: number;\n\tcells: NotebookCellDto[];\n\tviewType: string;\n\tmetadata?: notebookCommon.NotebookDocumentMetadata;\n}\n\nexport interface INotebookEditorAddData {\n\tid: string;\n\tdocumentUri: UriComponents;\n\tselections: ICellRange[];\n\tvisibleRanges: ICellRange[];\n\tviewColumn?: number;\n\tviewType: string;\n}\n\nexport interface INotebookDocumentsAndEditorsDelta {\n\tremovedDocuments?: UriComponents[];\n\taddedDocuments?: INotebookModelAddedData[];\n\tremovedEditors?: string[];\n\taddedEditors?: INotebookEditorAddData[];\n\tnewActiveEditor?: string | null;\n\tvisibleEditors?: string[];\n}\n\nexport interface NotebookOutputItemDto {\n\treadonly mime: string;\n\treadonly valueBytes: VSBuffer;\n}\n\nexport interface NotebookOutputDto {\n\titems: NotebookOutputItemDto[];\n\toutputId: string;\n\tmetadata?: Record<string, any>;\n}\n\nexport interface NotebookCellDataDto {\n\tsource: string;\n\tlanguage: string;\n\tmime: string | undefined;\n\tcellKind: notebookCommon.CellKind;\n\toutputs: NotebookOutputDto[];\n\tmetadata?: notebookCommon.NotebookCellMetadata;\n\tinternalMetadata?: notebookCommon.NotebookCellInternalMetadata;\n}\n\nexport interface NotebookDataDto {\n\treadonly cells: NotebookCellDataDto[];\n\treadonly metadata: notebookCommon.NotebookDocumentMetadata;\n}\n\nexport interface NotebookCellDto {\n\thandle: number;\n\turi: UriComponents;\n\teol: string;\n\tsource: string[];\n\tlanguage: string;\n\tmime?: string;\n\tcellKind: notebookCommon.CellKind;\n\toutputs: NotebookOutputDto[];\n\tmetadata?: notebookCommon.NotebookCellMetadata;\n\tinternalMetadata?: notebookCommon.NotebookCellInternalMetadata;\n}\n\nexport type INotebookPartialFileStatsWithMetadata = Omit<files.IFileStatWithMetadata, 'resource' | 'children'>;\n\nexport interface ExtHostNotebookShape extends ExtHostNotebookDocumentsAndEditorsShape {\n\t$provideNotebookCellStatusBarItems(handle: number, uri: UriComponents, index: number, token: CancellationToken): Promise<INotebookCellStatusBarListDto | undefined>;\n\t$releaseNotebookCellStatusBarItems(id: number): void;\n\n\t$dataToNotebook(handle: number, data: VSBuffer, token: CancellationToken): Promise<SerializableObjectWithBuffers<NotebookDataDto>>;\n\t$notebookToData(handle: number, data: SerializableObjectWithBuffers<NotebookDataDto>, token: CancellationToken): Promise<VSBuffer>;\n\t$saveNotebook(handle: number, uri: UriComponents, versionId: number, options: files.IWriteFileOptions, token: CancellationToken): Promise<INotebookPartialFileStatsWithMetadata>;\n\n\t$searchInNotebooks(handle: number, textQuery: search.ITextQuery, viewTypeFileTargets: NotebookPriorityInfo[], otherViewTypeFileTargets: NotebookPriorityInfo[], token: CancellationToken): Promise<{ results: IRawClosedNotebookFileMatch[]; limitHit: boolean }>;\n}\n\nexport interface ExtHostNotebookDocumentSaveParticipantShape {\n\t$participateInSave(resource: UriComponents, reason: SaveReason, token: CancellationToken): Promise<boolean>;\n}\n\nexport interface ExtHostNotebookRenderersShape {\n\t$postRendererMessage(editorId: string, rendererId: string, message: unknown): void;\n}\n\nexport interface ExtHostNotebookDocumentsAndEditorsShape {\n\t$acceptDocumentAndEditorsDelta(delta: SerializableObjectWithBuffers<INotebookDocumentsAndEditorsDelta>): void;\n}\n\nexport type NotebookRawContentEventDto =\n\t// notebookCommon.NotebookCellsInitializeEvent<NotebookCellDto>\n\t| {\n\n\t\treadonly kind: notebookCommon.NotebookCellsChangeType.ModelChange;\n\t\treadonly changes: notebookCommon.NotebookCellTextModelSplice<NotebookCellDto>[];\n\t}\n\t| {\n\t\treadonly kind: notebookCommon.NotebookCellsChangeType.Move;\n\t\treadonly index: number;\n\t\treadonly length: number;\n\t\treadonly newIdx: number;\n\t}\n\t| {\n\t\treadonly kind: notebookCommon.NotebookCellsChangeType.Output;\n\t\treadonly index: number;\n\t\treadonly outputs: NotebookOutputDto[];\n\t}\n\t| {\n\t\treadonly kind: notebookCommon.NotebookCellsChangeType.OutputItem;\n\t\treadonly index: number;\n\t\treadonly outputId: string;\n\t\treadonly outputItems: NotebookOutputItemDto[];\n\t\treadonly append: boolean;\n\t}\n\t| notebookCommon.NotebookCellsChangeLanguageEvent\n\t| notebookCommon.NotebookCellsChangeMimeEvent\n\t| notebookCommon.NotebookCellsChangeMetadataEvent\n\t| notebookCommon.NotebookCellsChangeInternalMetadataEvent\n\t// | notebookCommon.NotebookDocumentChangeMetadataEvent\n\t| notebookCommon.NotebookCellContentChangeEvent\n\t// | notebookCommon.NotebookDocumentUnknownChangeEvent\n\t;\n\nexport type NotebookCellsChangedEventDto = {\n\treadonly rawEvents: NotebookRawContentEventDto[];\n\treadonly versionId: number;\n};\n\nexport interface ExtHostNotebookDocumentsShape {\n\t$acceptModelChanged(uriComponents: UriComponents, event: SerializableObjectWithBuffers<NotebookCellsChangedEventDto>, isDirty: boolean, newMetadata?: notebookCommon.NotebookDocumentMetadata): void;\n\t$acceptDirtyStateChanged(uriComponents: UriComponents, isDirty: boolean): void;\n\t$acceptModelSaved(uriComponents: UriComponents): void;\n}\n\nexport type INotebookEditorViewColumnInfo = Record<string, number>;\n\nexport interface ExtHostNotebookEditorsShape {\n\t$acceptEditorPropertiesChanged(id: string, data: INotebookEditorPropertiesChangeData): void;\n\t$acceptEditorViewColumns(data: INotebookEditorViewColumnInfo): void;\n}\n\nexport interface ExtHostNotebookKernelsShape {\n\t$acceptNotebookAssociation(handle: number, uri: UriComponents, value: boolean): void;\n\t$executeCells(handle: number, uri: UriComponents, handles: number[]): Promise<void>;\n\t$cancelCells(handle: number, uri: UriComponents, handles: number[]): Promise<void>;\n\t$acceptKernelMessageFromRenderer(handle: number, editorId: string, message: any): void;\n\t$provideKernelSourceActions(handle: number, token: CancellationToken): Promise<notebookCommon.INotebookKernelSourceAction[]>;\n\t$provideVariables(handle: number, requestId: string, notebookUri: UriComponents, parentId: number | undefined, kind: 'named' | 'indexed', start: number, token: CancellationToken): Promise<void>;\n}\n\nexport interface ExtHostInteractiveShape {\n\t$willAddInteractiveDocument(uri: UriComponents, eol: string, languageId: string, notebookUri: UriComponents): void;\n\t$willRemoveInteractiveDocument(uri: UriComponents, notebookUri: UriComponents): void;\n}\n\nexport interface ExtHostStorageShape {\n\t$acceptValue(shared: boolean, extensionId: string, value: string): void;\n}\n\nexport interface ExtHostThemingShape {\n\t$onColorThemeChange(themeType: string): void;\n}\n\nexport interface MainThreadThemingShape extends IDisposable {\n}\n\nexport interface MainThreadLocalizationShape extends IDisposable {\n\t$fetchBuiltInBundleUri(id: string, language: string): Promise<UriComponents | undefined>;\n\t$fetchBundleContents(uriComponents: UriComponents): Promise<string>;\n}\n\nexport interface TunnelDto {\n\tremoteAddress: { port: number; host: string };\n\tlocalAddress: { port: number; host: string } | string;\n\tpublic: boolean;\n\tprivacy: TunnelPrivacyId | string;\n\tprotocol: string | undefined;\n}\n\n\nexport interface ExtHostTunnelServiceShape {\n\t$forwardPort(tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions): Promise<TunnelDto | string | undefined>;\n\t$closeTunnel(remote: { host: string; port: number }, silent?: boolean): Promise<void>;\n\t$onDidTunnelsChange(): Promise<void>;\n\t$registerCandidateFinder(enable: boolean): Promise<void>;\n\t$applyCandidateFilter(candidates: CandidatePort[]): Promise<CandidatePort[]>;\n\t$providePortAttributes(handles: number[], ports: number[], pid: number | undefined, commandline: string | undefined, cancellationToken: CancellationToken): Promise<ProvidedPortAttributes[]>;\n}\n\nexport interface ExtHostTimelineShape {\n\t$getTimeline(source: string, uri: UriComponents, options: TimelineOptions, token: CancellationToken): Promise<Dto<Timeline> | undefined>;\n}\n\nexport const enum ExtHostTestingResource {\n\tWorkspace,\n\tTextDocument\n}\n\nexport interface ExtHostTestingShape {\n\t$runControllerTests(req: IStartControllerTests[], token: CancellationToken): Promise<{ error?: string }[]>;\n\t$startContinuousRun(req: ICallProfileRunHandler[], token: CancellationToken): Promise<{ error?: string }[]>;\n\t$cancelExtensionTestRun(runId: string | undefined, taskId: string | undefined): void;\n\t/** Handles a diff of tests, as a result of a subscribeToDiffs() call */\n\t$acceptDiff(diff: TestsDiffOp.Serialized[]): void;\n\t/** Expands a test item's children, by the given number of levels. */\n\t$expandTest(testId: string, levels: number): Promise<void>;\n\t/** Requests coverage details for a test run. Errors if not available. */\n\t$getCoverageDetails(coverageId: string, testId: string | undefined, token: CancellationToken): Promise<CoverageDetails.Serialized[]>;\n\t/** Disposes resources associated with a test run. */\n\t$disposeRun(runId: string): void;\n\t/** Configures a test run config. */\n\t$configureRunProfile(controllerId: string, configId: number): void;\n\t/** Asks the controller to refresh its tests */\n\t$refreshTests(controllerId: string, token: CancellationToken): Promise<void>;\n\t/** Ensures any pending test diffs are flushed */\n\t$syncTests(): Promise<void>;\n\t/** Sets the active test run profiles */\n\t$setDefaultRunProfiles(profiles: Record</* controller id */string, /* profile id */ number[]>): void;\n\t$getTestsRelatedToCode(uri: UriComponents, position: IPosition, token: CancellationToken): Promise<string[]>;\n\t$getCodeRelatedToTest(testId: string, token: CancellationToken): Promise<ILocationDto[]>;\n\n\t// --- test results:\n\n\t/** Publishes that a test run finished. */\n\t$publishTestResults(results: ISerializedTestResults[]): void;\n\t/** Requests followup actions for a test (failure) message */\n\t$provideTestFollowups(req: TestMessageFollowupRequest, token: CancellationToken): Promise<TestMessageFollowupResponse[]>;\n\t/** Actions a followup actions for a test (failure) message */\n\t$executeTestFollowup(id: number): Promise<void>;\n\t/** Disposes followup actions for a test (failure) message */\n\t$disposeTestFollowups(id: number[]): void;\n}\n\nexport interface ExtHostMcpShape {\n\t$resolveMcpLaunch(collectionId: string, label: string): Promise<McpServerLaunch.Serialized | undefined>;\n\t$startMcp(id: number, launch: McpServerLaunch.Serialized): void;\n\t$stopMcp(id: number): void;\n\t$sendMessage(id: number, message: string): void;\n\t$waitForInitialCollectionProviders(): Promise<void>;\n}\n\nexport interface MainThreadMcpShape {\n\t$onDidChangeState(id: number, state: McpConnectionState): void;\n\t$onDidPublishLog(id: number, level: LogLevel, log: string): void;\n\t$onDidReceiveMessage(id: number, message: string): void;\n\t$upsertMcpCollection(collection: McpCollectionDefinition.FromExtHost, servers: McpServerDefinition.Serialized[]): void;\n\t$deleteMcpCollection(collectionId: string): void;\n\t$getTokenFromServerMetadata(id: number, authorizationServer: UriComponents, serverMetadata: IAuthorizationServerMetadata, resourceMetadata: IAuthorizationProtectedResourceMetadata | undefined): Promise<string | undefined>;\n}\n\nexport interface ExtHostLocalizationShape {\n\tgetMessage(extensionId: string, details: IStringDetails): string;\n\tgetBundle(extensionId: string): { [key: string]: string } | undefined;\n\tgetBundleUri(extensionId: string): URI | undefined;\n\tinitializeLocalizedMessages(extension: IExtensionDescription): Promise<void>;\n}\n\nexport interface IStringDetails {\n\tmessage: string;\n\targs?: Record<string | number, any>;\n\tcomment?: string | string[];\n}\n\nexport interface ITestControllerPatch {\n\tlabel?: string;\n\tcapabilities?: TestControllerCapability;\n}\n\nexport interface MainThreadTestingShape {\n\t// --- test lifecycle:\n\n\t/** Registers that there's a test controller with the given ID */\n\t$registerTestController(controllerId: string, label: string, capability: TestControllerCapability): void;\n\t/** Updates the label of an existing test controller. */\n\t$updateController(controllerId: string, patch: ITestControllerPatch): void;\n\t/** Diposes of the test controller with the given ID */\n\t$unregisterTestController(controllerId: string): void;\n\t/** Requests tests published to VS Code. */\n\t$subscribeToDiffs(): void;\n\t/** Stops requesting tests published to VS Code. */\n\t$unsubscribeFromDiffs(): void;\n\t/** Publishes that new tests were available on the given source. */\n\t$publishDiff(controllerId: string, diff: TestsDiffOp.Serialized[]): void;\n\t/** Gets coverage details from a test result. */\n\t$getCoverageDetails(resultId: string, taskIndex: number, uri: UriComponents, token: CancellationToken): Promise<CoverageDetails.Serialized[]>;\n\n\t// --- test run configurations:\n\n\t/** Called when a new test run configuration is available */\n\t$publishTestRunProfile(config: ITestRunProfile): void;\n\t/** Updates an existing test run configuration */\n\t$updateTestRunConfig(controllerId: string, configId: number, update: Partial<ITestRunProfile>): void;\n\t/** Removes a previously-published test run config */\n\t$removeTestProfile(controllerId: string, configId: number): void;\n\n\n\t// --- test run handling:\n\n\t/** Request by an extension to run tests. */\n\t$runTests(req: ResolvedTestRunRequest, token: CancellationToken): Promise<string>;\n\t/**\n\t * Adds tests to the run. The tests are given in descending depth. The first\n\t * item will be a previously-known test, or a test root.\n\t */\n\t$addTestsToRun(controllerId: string, runId: string, tests: ITestItem.Serialized[]): void;\n\t/** Updates the state of a test run in the given run. */\n\t$updateTestStateInRun(runId: string, taskId: string, testId: string, state: TestResultState, duration?: number): void;\n\t/** Appends a message to a test in the run. */\n\t$appendTestMessagesInRun(runId: string, taskId: string, testId: string, messages: ITestMessage.Serialized[]): void;\n\t/** Appends raw output to the test run.. */\n\t$appendOutputToRun(runId: string, taskId: string, output: VSBuffer, location?: ILocationDto, testId?: string): void;\n\t/** Triggered when coverage is added to test results. */\n\t$appendCoverage(runId: string, taskId: string, coverage: IFileCoverage.Serialized): void;\n\t/** Signals a task in a test run started. */\n\t$startedTestRunTask(runId: string, task: ITestRunTask): void;\n\t/** Signals a task in a test run ended. */\n\t$finishedTestRunTask(runId: string, taskId: string): void;\n\t/** Start a new extension-provided test run. */\n\t$startedExtensionTestRun(req: ExtensionRunTestsRequest): void;\n\t/** Signals that an extension-provided test run finished. */\n\t$finishedExtensionTestRun(runId: string): void;\n\t/** Marks a test (or controller) as retired in all results. */\n\t$markTestRetired(testIds: string[] | undefined): void;\n}\n\nexport type ChatStatusItemDto = {\n\tid: string;\n\ttitle: string | { label: string; link: string };\n\tdescription: string;\n\tdetail: string | undefined;\n};\n\nexport interface MainThreadChatStatusShape {\n\t$setEntry(id: string, entry: ChatStatusItemDto): void;\n\t$disposeEntry(id: string): void;\n}\n\n// --- proxy identifiers\n\nexport const MainContext = {\n\tMainThreadAuthentication: createProxyIdentifier<MainThreadAuthenticationShape>('MainThreadAuthentication'),\n\tMainThreadBulkEdits: createProxyIdentifier<MainThreadBulkEditsShape>('MainThreadBulkEdits'),\n\tMainThreadLanguageModels: createProxyIdentifier<MainThreadLanguageModelsShape>('MainThreadLanguageModels'),\n\tMainThreadEmbeddings: createProxyIdentifier<MainThreadEmbeddingsShape>('MainThreadEmbeddings'),\n\tMainThreadChatAgents2: createProxyIdentifier<MainThreadChatAgentsShape2>('MainThreadChatAgents2'),\n\tMainThreadCodeMapper: createProxyIdentifier<MainThreadCodeMapperShape>('MainThreadCodeMapper'),\n\tMainThreadLanguageModelTools: createProxyIdentifier<MainThreadLanguageModelToolsShape>('MainThreadChatSkills'),\n\tMainThreadClipboard: createProxyIdentifier<MainThreadClipboardShape>('MainThreadClipboard'),\n\tMainThreadCommands: createProxyIdentifier<MainThreadCommandsShape>('MainThreadCommands'),\n\tMainThreadComments: createProxyIdentifier<MainThreadCommentsShape>('MainThreadComments'),\n\tMainThreadConfiguration: createProxyIdentifier<MainThreadConfigurationShape>('MainThreadConfiguration'),\n\tMainThreadConsole: createProxyIdentifier<MainThreadConsoleShape>('MainThreadConsole'),\n\tMainThreadDebugService: createProxyIdentifier<MainThreadDebugServiceShape>('MainThreadDebugService'),\n\tMainThreadDecorations: createProxyIdentifier<MainThreadDecorationsShape>('MainThreadDecorations'),\n\tMainThreadDiagnostics: createProxyIdentifier<MainThreadDiagnosticsShape>('MainThreadDiagnostics'),\n\tMainThreadDialogs: createProxyIdentifier<MainThreadDiaglogsShape>('MainThreadDiaglogs'),\n\tMainThreadDocuments: createProxyIdentifier<MainThreadDocumentsShape>('MainThreadDocuments'),\n\tMainThreadDocumentContentProviders: createProxyIdentifier<MainThreadDocumentContentProvidersShape>('MainThreadDocumentContentProviders'),\n\tMainThreadTextEditors: createProxyIdentifier<MainThreadTextEditorsShape>('MainThreadTextEditors'),\n\tMainThreadEditorInsets: createProxyIdentifier<MainThreadEditorInsetsShape>('MainThreadEditorInsets'),\n\tMainThreadEditorTabs: createProxyIdentifier<MainThreadEditorTabsShape>('MainThreadEditorTabs'),\n\tMainThreadErrors: createProxyIdentifier<MainThreadErrorsShape>('MainThreadErrors'),\n\tMainThreadTreeViews: createProxyIdentifier<MainThreadTreeViewsShape>('MainThreadTreeViews'),\n\tMainThreadDownloadService: createProxyIdentifier<MainThreadDownloadServiceShape>('MainThreadDownloadService'),\n\tMainThreadLanguageFeatures: createProxyIdentifier<MainThreadLanguageFeaturesShape>('MainThreadLanguageFeatures'),\n\tMainThreadLanguages: createProxyIdentifier<MainThreadLanguagesShape>('MainThreadLanguages'),\n\tMainThreadLogger: createProxyIdentifier<MainThreadLoggerShape>('MainThreadLogger'),\n\tMainThreadMessageService: createProxyIdentifier<MainThreadMessageServiceShape>('MainThreadMessageService'),\n\tMainThreadOutputService: createProxyIdentifier<MainThreadOutputServiceShape>('MainThreadOutputService'),\n\tMainThreadProgress: createProxyIdentifier<MainThreadProgressShape>('MainThreadProgress'),\n\tMainThreadQuickDiff: createProxyIdentifier<MainThreadQuickDiffShape>('MainThreadQuickDiff'),\n\tMainThreadQuickOpen: createProxyIdentifier<MainThreadQuickOpenShape>('MainThreadQuickOpen'),\n\tMainThreadStatusBar: createProxyIdentifier<MainThreadStatusBarShape>('MainThreadStatusBar'),\n\tMainThreadSecretState: createProxyIdentifier<MainThreadSecretStateShape>('MainThreadSecretState'),\n\tMainThreadStorage: createProxyIdentifier<MainThreadStorageShape>('MainThreadStorage'),\n\tMainThreadSpeech: createProxyIdentifier<MainThreadSpeechShape>('MainThreadSpeechProvider'),\n\tMainThreadTelemetry: createProxyIdentifier<MainThreadTelemetryShape>('MainThreadTelemetry'),\n\tMainThreadTerminalService: createProxyIdentifier<MainThreadTerminalServiceShape>('MainThreadTerminalService'),\n\tMainThreadTerminalShellIntegration: createProxyIdentifier<MainThreadTerminalShellIntegrationShape>('MainThreadTerminalShellIntegration'),\n\tMainThreadWebviews: createProxyIdentifier<MainThreadWebviewsShape>('MainThreadWebviews'),\n\tMainThreadWebviewPanels: createProxyIdentifier<MainThreadWebviewPanelsShape>('MainThreadWebviewPanels'),\n\tMainThreadWebviewViews: createProxyIdentifier<MainThreadWebviewViewsShape>('MainThreadWebviewViews'),\n\tMainThreadCustomEditors: createProxyIdentifier<MainThreadCustomEditorsShape>('MainThreadCustomEditors'),\n\tMainThreadUrls: createProxyIdentifier<MainThreadUrlsShape>('MainThreadUrls'),\n\tMainThreadUriOpeners: createProxyIdentifier<MainThreadUriOpenersShape>('MainThreadUriOpeners'),\n\tMainThreadProfileContentHandlers: createProxyIdentifier<MainThreadProfileContentHandlersShape>('MainThreadProfileContentHandlers'),\n\tMainThreadWorkspace: createProxyIdentifier<MainThreadWorkspaceShape>('MainThreadWorkspace'),\n\tMainThreadFileSystem: createProxyIdentifier<MainThreadFileSystemShape>('MainThreadFileSystem'),\n\tMainThreadFileSystemEventService: createProxyIdentifier<MainThreadFileSystemEventServiceShape>('MainThreadFileSystemEventService'),\n\tMainThreadExtensionService: createProxyIdentifier<MainThreadExtensionServiceShape>('MainThreadExtensionService'),\n\tMainThreadSCM: createProxyIdentifier<MainThreadSCMShape>('MainThreadSCM'),\n\tMainThreadSearch: createProxyIdentifier<MainThreadSearchShape>('MainThreadSearch'),\n\tMainThreadShare: createProxyIdentifier<MainThreadShareShape>('MainThreadShare'),\n\tMainThreadTask: createProxyIdentifier<MainThreadTaskShape>('MainThreadTask'),\n\tMainThreadWindow: createProxyIdentifier<MainThreadWindowShape>('MainThreadWindow'),\n\tMainThreadLabelService: createProxyIdentifier<MainThreadLabelServiceShape>('MainThreadLabelService'),\n\tMainThreadNotebook: createProxyIdentifier<MainThreadNotebookShape>('MainThreadNotebook'),\n\tMainThreadNotebookDocuments: createProxyIdentifier<MainThreadNotebookDocumentsShape>('MainThreadNotebookDocumentsShape'),\n\tMainThreadNotebookEditors: createProxyIdentifier<MainThreadNotebookEditorsShape>('MainThreadNotebookEditorsShape'),\n\tMainThreadNotebookKernels: createProxyIdentifier<MainThreadNotebookKernelsShape>('MainThreadNotebookKernels'),\n\tMainThreadNotebookRenderers: createProxyIdentifier<MainThreadNotebookRenderersShape>('MainThreadNotebookRenderers'),\n\tMainThreadInteractive: createProxyIdentifier<MainThreadInteractiveShape>('MainThreadInteractive'),\n\tMainThreadTheming: createProxyIdentifier<MainThreadThemingShape>('MainThreadTheming'),\n\tMainThreadTunnelService: createProxyIdentifier<MainThreadTunnelServiceShape>('MainThreadTunnelService'),\n\tMainThreadManagedSockets: createProxyIdentifier<MainThreadManagedSocketsShape>('MainThreadManagedSockets'),\n\tMainThreadTimeline: createProxyIdentifier<MainThreadTimelineShape>('MainThreadTimeline'),\n\tMainThreadTesting: createProxyIdentifier<MainThreadTestingShape>('MainThreadTesting'),\n\tMainThreadLocalization: createProxyIdentifier<MainThreadLocalizationShape>('MainThreadLocalizationShape'),\n\tMainThreadMcp: createProxyIdentifier<MainThreadMcpShape>('MainThreadMcpShape'),\n\tMainThreadAiRelatedInformation: createProxyIdentifier<MainThreadAiRelatedInformationShape>('MainThreadAiRelatedInformation'),\n\tMainThreadAiEmbeddingVector: createProxyIdentifier<MainThreadAiEmbeddingVectorShape>('MainThreadAiEmbeddingVector'),\n\tMainThreadChatStatus: createProxyIdentifier<MainThreadChatStatusShape>('MainThreadChatStatus'),\n\tMainThreadAiSettingsSearch: createProxyIdentifier<MainThreadAiSettingsSearchShape>('MainThreadAiSettingsSearch'),\n};\n\nexport const ExtHostContext = {\n\tExtHostCodeMapper: createProxyIdentifier<ExtHostCodeMapperShape>('ExtHostCodeMapper'),\n\tExtHostCommands: createProxyIdentifier<ExtHostCommandsShape>('ExtHostCommands'),\n\tExtHostConfiguration: createProxyIdentifier<ExtHostConfigurationShape>('ExtHostConfiguration'),\n\tExtHostDiagnostics: createProxyIdentifier<ExtHostDiagnosticsShape>('ExtHostDiagnostics'),\n\tExtHostDebugService: createProxyIdentifier<ExtHostDebugServiceShape>('ExtHostDebugService'),\n\tExtHostDecorations: createProxyIdentifier<ExtHostDecorationsShape>('ExtHostDecorations'),\n\tExtHostDocumentsAndEditors: createProxyIdentifier<ExtHostDocumentsAndEditorsShape>('ExtHostDocumentsAndEditors'),\n\tExtHostDocuments: createProxyIdentifier<ExtHostDocumentsShape>('ExtHostDocuments'),\n\tExtHostDocumentContentProviders: createProxyIdentifier<ExtHostDocumentContentProvidersShape>('ExtHostDocumentContentProviders'),\n\tExtHostDocumentSaveParticipant: createProxyIdentifier<ExtHostDocumentSaveParticipantShape>('ExtHostDocumentSaveParticipant'),\n\tExtHostEditors: createProxyIdentifier<ExtHostEditorsShape>('ExtHostEditors'),\n\tExtHostTreeViews: createProxyIdentifier<ExtHostTreeViewsShape>('ExtHostTreeViews'),\n\tExtHostFileSystem: createProxyIdentifier<ExtHostFileSystemShape>('ExtHostFileSystem'),\n\tExtHostFileSystemInfo: createProxyIdentifier<ExtHostFileSystemInfoShape>('ExtHostFileSystemInfo'),\n\tExtHostFileSystemEventService: createProxyIdentifier<ExtHostFileSystemEventServiceShape>('ExtHostFileSystemEventService'),\n\tExtHostLanguages: createProxyIdentifier<ExtHostLanguagesShape>('ExtHostLanguages'),\n\tExtHostLanguageFeatures: createProxyIdentifier<ExtHostLanguageFeaturesShape>('ExtHostLanguageFeatures'),\n\tExtHostQuickOpen: createProxyIdentifier<ExtHostQuickOpenShape>('ExtHostQuickOpen'),\n\tExtHostQuickDiff: createProxyIdentifier<ExtHostQuickDiffShape>('ExtHostQuickDiff'),\n\tExtHostStatusBar: createProxyIdentifier<ExtHostStatusBarShape>('ExtHostStatusBar'),\n\tExtHostShare: createProxyIdentifier<ExtHostShareShape>('ExtHostShare'),\n\tExtHostExtensionService: createProxyIdentifier<ExtHostExtensionServiceShape>('ExtHostExtensionService'),\n\tExtHostLogLevelServiceShape: createProxyIdentifier<ExtHostLogLevelServiceShape>('ExtHostLogLevelServiceShape'),\n\tExtHostTerminalService: createProxyIdentifier<ExtHostTerminalServiceShape>('ExtHostTerminalService'),\n\tExtHostTerminalShellIntegration: createProxyIdentifier<ExtHostTerminalShellIntegrationShape>('ExtHostTerminalShellIntegration'),\n\tExtHostSCM: createProxyIdentifier<ExtHostSCMShape>('ExtHostSCM'),\n\tExtHostSearch: createProxyIdentifier<ExtHostSearchShape>('ExtHostSearch'),\n\tExtHostTask: createProxyIdentifier<ExtHostTaskShape>('ExtHostTask'),\n\tExtHostWorkspace: createProxyIdentifier<ExtHostWorkspaceShape>('ExtHostWorkspace'),\n\tExtHostWindow: createProxyIdentifier<ExtHostWindowShape>('ExtHostWindow'),\n\tExtHostWebviews: createProxyIdentifier<ExtHostWebviewsShape>('ExtHostWebviews'),\n\tExtHostWebviewPanels: createProxyIdentifier<ExtHostWebviewPanelsShape>('ExtHostWebviewPanels'),\n\tExtHostCustomEditors: createProxyIdentifier<ExtHostCustomEditorsShape>('ExtHostCustomEditors'),\n\tExtHostWebviewViews: createProxyIdentifier<ExtHostWebviewViewsShape>('ExtHostWebviewViews'),\n\tExtHostEditorInsets: createProxyIdentifier<ExtHostEditorInsetsShape>('ExtHostEditorInsets'),\n\tExtHostEditorTabs: createProxyIdentifier<IExtHostEditorTabsShape>('ExtHostEditorTabs'),\n\tExtHostProgress: createProxyIdentifier<ExtHostProgressShape>('ExtHostProgress'),\n\tExtHostComments: createProxyIdentifier<ExtHostCommentsShape>('ExtHostComments'),\n\tExtHostSecretState: createProxyIdentifier<ExtHostSecretStateShape>('ExtHostSecretState'),\n\tExtHostStorage: createProxyIdentifier<ExtHostStorageShape>('ExtHostStorage'),\n\tExtHostUrls: createProxyIdentifier<ExtHostUrlsShape>('ExtHostUrls'),\n\tExtHostUriOpeners: createProxyIdentifier<ExtHostUriOpenersShape>('ExtHostUriOpeners'),\n\tExtHostProfileContentHandlers: createProxyIdentifier<ExtHostProfileContentHandlersShape>('ExtHostProfileContentHandlers'),\n\tExtHostOutputService: createProxyIdentifier<ExtHostOutputServiceShape>('ExtHostOutputService'),\n\tExtHostLabelService: createProxyIdentifier<ExtHostLabelServiceShape>('ExtHostLabelService'),\n\tExtHostNotebook: createProxyIdentifier<ExtHostNotebookShape>('ExtHostNotebook'),\n\tExtHostNotebookDocuments: createProxyIdentifier<ExtHostNotebookDocumentsShape>('ExtHostNotebookDocuments'),\n\tExtHostNotebookEditors: createProxyIdentifier<ExtHostNotebookEditorsShape>('ExtHostNotebookEditors'),\n\tExtHostNotebookKernels: createProxyIdentifier<ExtHostNotebookKernelsShape>('ExtHostNotebookKernels'),\n\tExtHostNotebookRenderers: createProxyIdentifier<ExtHostNotebookRenderersShape>('ExtHostNotebookRenderers'),\n\tExtHostNotebookDocumentSaveParticipant: createProxyIdentifier<ExtHostNotebookDocumentSaveParticipantShape>('ExtHostNotebookDocumentSaveParticipant'),\n\tExtHostInteractive: createProxyIdentifier<ExtHostInteractiveShape>('ExtHostInteractive'),\n\tExtHostChatAgents2: createProxyIdentifier<ExtHostChatAgentsShape2>('ExtHostChatAgents'),\n\tExtHostLanguageModelTools: createProxyIdentifier<ExtHostLanguageModelToolsShape>('ExtHostChatSkills'),\n\tExtHostChatProvider: createProxyIdentifier<ExtHostLanguageModelsShape>('ExtHostChatProvider'),\n\tExtHostSpeech: createProxyIdentifier<ExtHostSpeechShape>('ExtHostSpeech'),\n\tExtHostEmbeddings: createProxyIdentifier<ExtHostEmbeddingsShape>('ExtHostEmbeddings'),\n\tExtHostAiRelatedInformation: createProxyIdentifier<ExtHostAiRelatedInformationShape>('ExtHostAiRelatedInformation'),\n\tExtHostAiEmbeddingVector: createProxyIdentifier<ExtHostAiEmbeddingVectorShape>('ExtHostAiEmbeddingVector'),\n\tExtHostAiSettingsSearch: createProxyIdentifier<ExtHostAiSettingsSearchShape>('ExtHostAiSettingsSearch'),\n\tExtHostTheming: createProxyIdentifier<ExtHostThemingShape>('ExtHostTheming'),\n\tExtHostTunnelService: createProxyIdentifier<ExtHostTunnelServiceShape>('ExtHostTunnelService'),\n\tExtHostManagedSockets: createProxyIdentifier<ExtHostManagedSocketsShape>('ExtHostManagedSockets'),\n\tExtHostAuthentication: createProxyIdentifier<ExtHostAuthenticationShape>('ExtHostAuthentication'),\n\tExtHostTimeline: createProxyIdentifier<ExtHostTimelineShape>('ExtHostTimeline'),\n\tExtHostTesting: createProxyIdentifier<ExtHostTestingShape>('ExtHostTesting'),\n\tExtHostTelemetry: createProxyIdentifier<ExtHostTelemetryShape>('ExtHostTelemetry'),\n\tExtHostLocalization: createProxyIdentifier<ExtHostLocalizationShape>('ExtHostLocalization'),\n\tExtHostMcp: createProxyIdentifier<ExtHostMcpShape>('ExtHostMcp'),\n};\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ProxyIdentifier, IRPCProtocol, Proxied } from '../../services/extensions/common/proxyIdentifier.js';\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\n\nexport const IExtHostRpcService = createDecorator<IExtHostRpcService>('IExtHostRpcService');\n\nexport interface IExtHostRpcService extends IRPCProtocol {\n\treadonly _serviceBrand: undefined;\n}\n\nexport class ExtHostRpcService implements IExtHostRpcService {\n\treadonly _serviceBrand: undefined;\n\n\treadonly getProxy: <T>(identifier: ProxyIdentifier<T>) => Proxied<T>;\n\treadonly set: <T, R extends T> (identifier: ProxyIdentifier<T>, instance: R) => R;\n\treadonly dispose: () => void;\n\treadonly assertRegistered: (identifiers: ProxyIdentifier<any>[]) => void;\n\treadonly drain: () => Promise<void>;\n\n\tconstructor(rpcProtocol: IRPCProtocol) {\n\t\tthis.getProxy = rpcProtocol.getProxy.bind(rpcProtocol);\n\t\tthis.set = rpcProtocol.set.bind(rpcProtocol);\n\t\tthis.dispose = rpcProtocol.dispose.bind(rpcProtocol);\n\t\tthis.assertRegistered = rpcProtocol.assertRegistered.bind(rpcProtocol);\n\t\tthis.drain = rpcProtocol.drain.bind(rpcProtocol);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type * as vscode from 'vscode';\nimport { URI } from '../../../base/common/uri.js';\nimport * as editorRange from '../../../editor/common/core/range.js';\nimport { TestId, TestIdPathParts } from '../../contrib/testing/common/testId.js';\nimport { createTestItemChildren, ExtHostTestItemEvent, ITestChildrenLike, ITestItemApi, ITestItemChildren, TestItemCollection, TestItemEventOp } from '../../contrib/testing/common/testItemCollection.js';\nimport { denamespaceTestTag, ITestItem, ITestItemContext } from '../../contrib/testing/common/testTypes.js';\nimport { ExtHostDocumentsAndEditors } from './extHostDocumentsAndEditors.js';\nimport { createPrivateApiFor, getPrivateApiFor, IExtHostTestItemApi } from './extHostTestingPrivateApi.js';\nimport * as Convert from './extHostTypeConverters.js';\n\nconst testItemPropAccessor = <K extends keyof vscode.TestItem>(\n\tapi: IExtHostTestItemApi,\n\tdefaultValue: vscode.TestItem[K],\n\tequals: (a: vscode.TestItem[K], b: vscode.TestItem[K]) => boolean,\n\ttoUpdate: (newValue: vscode.TestItem[K], oldValue: vscode.TestItem[K]) => ExtHostTestItemEvent,\n) => {\n\tlet value = defaultValue;\n\treturn {\n\t\tenumerable: true,\n\t\tconfigurable: false,\n\t\tget() {\n\t\t\treturn value;\n\t\t},\n\t\tset(newValue: vscode.TestItem[K]) {\n\t\t\tif (!equals(value, newValue)) {\n\t\t\t\tconst oldValue = value;\n\t\t\t\tvalue = newValue;\n\t\t\t\tapi.listener?.(toUpdate(newValue, oldValue));\n\t\t\t}\n\t\t},\n\t};\n};\n\ntype WritableProps = Pick<vscode.TestItem, 'range' | 'label' | 'description' | 'sortText' | 'canResolveChildren' | 'busy' | 'error' | 'tags'>;\n\nconst strictEqualComparator = <T>(a: T, b: T) => a === b;\n\nconst propComparators: { [K in keyof Required<WritableProps>]: (a: vscode.TestItem[K], b: vscode.TestItem[K]) => boolean } = {\n\trange: (a, b) => {\n\t\tif (a === b) { return true; }\n\t\tif (!a || !b) { return false; }\n\t\treturn a.isEqual(b);\n\t},\n\tlabel: strictEqualComparator,\n\tdescription: strictEqualComparator,\n\tsortText: strictEqualComparator,\n\tbusy: strictEqualComparator,\n\terror: strictEqualComparator,\n\tcanResolveChildren: strictEqualComparator,\n\ttags: (a, b) => {\n\t\tif (a.length !== b.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (a.some(t1 => !b.find(t2 => t1.id === t2.id))) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n};\n\nconst evSetProps = <T>(fn: (newValue: T) => Partial<ITestItem>): (newValue: T) => ExtHostTestItemEvent =>\n\tv => ({ op: TestItemEventOp.SetProp, update: fn(v) });\n\nconst makePropDescriptors = (api: IExtHostTestItemApi, label: string): { [K in keyof Required<WritableProps>]: PropertyDescriptor } => ({\n\trange: (() => {\n\t\tlet value: vscode.Range | undefined;\n\t\tconst updateProps = evSetProps<vscode.Range | undefined>(r => ({ range: editorRange.Range.lift(Convert.Range.from(r)) }));\n\t\treturn {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget() {\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\tset(newValue: vscode.Range | undefined) {\n\t\t\t\tapi.listener?.({ op: TestItemEventOp.DocumentSynced });\n\t\t\t\tif (!propComparators.range(value, newValue)) {\n\t\t\t\t\tvalue = newValue;\n\t\t\t\t\tapi.listener?.(updateProps(newValue));\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t})(),\n\tlabel: testItemPropAccessor<'label'>(api, label, propComparators.label, evSetProps(label => ({ label }))),\n\tdescription: testItemPropAccessor<'description'>(api, undefined, propComparators.description, evSetProps(description => ({ description }))),\n\tsortText: testItemPropAccessor<'sortText'>(api, undefined, propComparators.sortText, evSetProps(sortText => ({ sortText }))),\n\tcanResolveChildren: testItemPropAccessor<'canResolveChildren'>(api, false, propComparators.canResolveChildren, state => ({\n\t\top: TestItemEventOp.UpdateCanResolveChildren,\n\t\tstate,\n\t})),\n\tbusy: testItemPropAccessor<'busy'>(api, false, propComparators.busy, evSetProps(busy => ({ busy }))),\n\terror: testItemPropAccessor<'error'>(api, undefined, propComparators.error, evSetProps(error => ({ error: Convert.MarkdownString.fromStrict(error) || null }))),\n\ttags: testItemPropAccessor<'tags'>(api, [], propComparators.tags, (current, previous) => ({\n\t\top: TestItemEventOp.SetTags,\n\t\tnew: current.map(Convert.TestTag.from),\n\t\told: previous.map(Convert.TestTag.from),\n\t})),\n});\n\nconst toItemFromPlain = (item: ITestItem.Serialized): TestItemImpl => {\n\tconst testId = TestId.fromString(item.extId);\n\tconst testItem = new TestItemImpl(testId.controllerId, testId.localId, item.label, URI.revive(item.uri) || undefined);\n\ttestItem.range = Convert.Range.to(item.range || undefined);\n\ttestItem.description = item.description || undefined;\n\ttestItem.sortText = item.sortText || undefined;\n\ttestItem.tags = item.tags.map(t => Convert.TestTag.to({ id: denamespaceTestTag(t).tagId }));\n\treturn testItem;\n};\n\nexport const toItemFromContext = (context: ITestItemContext): TestItemImpl => {\n\tlet node: TestItemImpl | undefined;\n\tfor (const test of context.tests) {\n\t\tconst next = toItemFromPlain(test.item);\n\t\tgetPrivateApiFor(next).parent = node;\n\t\tnode = next;\n\t}\n\n\treturn node!;\n};\n\nexport class TestItemImpl implements vscode.TestItem {\n\tpublic readonly id!: string;\n\tpublic readonly uri!: vscode.Uri | undefined;\n\tpublic readonly children!: ITestItemChildren<vscode.TestItem>;\n\tpublic readonly parent!: TestItemImpl | undefined;\n\n\tpublic range!: vscode.Range | undefined;\n\tpublic description!: string | undefined;\n\tpublic sortText!: string | undefined;\n\tpublic label!: string;\n\tpublic error!: string | vscode.MarkdownString;\n\tpublic busy!: boolean;\n\tpublic canResolveChildren!: boolean;\n\tpublic tags!: readonly vscode.TestTag[];\n\n\t/**\n\t * Note that data is deprecated and here for back-compat only\n\t */\n\tconstructor(controllerId: string, id: string, label: string, uri: vscode.Uri | undefined) {\n\t\tif (id.includes(TestIdPathParts.Delimiter)) {\n\t\t\tthrow new Error(`Test IDs may not include the ${JSON.stringify(id)} symbol`);\n\t\t}\n\n\t\tconst api = createPrivateApiFor(this, controllerId);\n\t\tObject.defineProperties(this, {\n\t\t\tid: {\n\t\t\t\tvalue: id,\n\t\t\t\tenumerable: true,\n\t\t\t\twritable: false,\n\t\t\t},\n\t\t\turi: {\n\t\t\t\tvalue: uri,\n\t\t\t\tenumerable: true,\n\t\t\t\twritable: false,\n\t\t\t},\n\t\t\tparent: {\n\t\t\t\tenumerable: false,\n\t\t\t\tget() {\n\t\t\t\t\treturn api.parent instanceof TestItemRootImpl ? undefined : api.parent;\n\t\t\t\t},\n\t\t\t},\n\t\t\tchildren: {\n\t\t\t\tvalue: createTestItemChildren(api, getPrivateApiFor, TestItemImpl),\n\t\t\t\tenumerable: true,\n\t\t\t\twritable: false,\n\t\t\t},\n\t\t\t...makePropDescriptors(api, label),\n\t\t});\n\t}\n}\n\nexport class TestItemRootImpl extends TestItemImpl {\n\tpublic readonly _isRoot = true;\n\n\tconstructor(controllerId: string, label: string) {\n\t\tsuper(controllerId, controllerId, label, undefined);\n\t}\n}\n\nexport class ExtHostTestItemCollection extends TestItemCollection<TestItemImpl> {\n\tconstructor(controllerId: string, controllerLabel: string, editors: ExtHostDocumentsAndEditors) {\n\t\tsuper({\n\t\t\tcontrollerId,\n\t\t\tgetDocumentVersion: uri => uri && editors.getDocument(uri)?.version,\n\t\t\tgetApiFor: getPrivateApiFor as (impl: TestItemImpl) => ITestItemApi<TestItemImpl>,\n\t\t\tgetChildren: (item) => item.children as ITestChildrenLike<TestItemImpl>,\n\t\t\troot: new TestItemRootImpl(controllerId, controllerLabel),\n\t\t\ttoITestItem: Convert.TestItem.from,\n\t\t});\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IExtensionHostInitData } from '../../services/extensions/common/extensionHostProtocol.js';\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\n\nexport const IExtHostInitDataService = createDecorator<IExtHostInitDataService>('IExtHostInitDataService');\n\nexport interface IExtHostInitDataService extends Readonly<IExtensionHostInitData> {\n\treadonly _serviceBrand: undefined;\n}\n\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from '../../../../base/common/buffer.js';\nimport { URI, UriComponents, UriDto } from '../../../../base/common/uri.js';\nimport { ExtensionIdentifier, IExtensionDescription } from '../../../../platform/extensions/common/extensions.js';\nimport { ILoggerResource, LogLevel } from '../../../../platform/log/common/log.js';\nimport { IRemoteConnectionData } from '../../../../platform/remote/common/remoteAuthorityResolver.js';\n\nexport interface IExtensionDescriptionSnapshot {\n\treadonly versionId: number;\n\treadonly allExtensions: IExtensionDescription[];\n\treadonly activationEvents: { [extensionId: string]: string[] };\n\treadonly myExtensions: ExtensionIdentifier[];\n}\n\nexport interface IExtensionDescriptionDelta {\n\treadonly versionId: number;\n\treadonly toRemove: ExtensionIdentifier[];\n\treadonly toAdd: IExtensionDescription[];\n\treadonly addActivationEvents: { [extensionId: string]: string[] };\n\treadonly myToRemove: ExtensionIdentifier[];\n\treadonly myToAdd: ExtensionIdentifier[];\n}\n\nexport interface IExtensionHostInitData {\n\tversion: string;\n\tquality: string | undefined;\n\tcommit?: string;\n\tdate?: string;\n\t/**\n\t * When set to `0`, no polling for the parent process still running will happen.\n\t */\n\tparentPid: number | 0;\n\tenvironment: IEnvironment;\n\tworkspace?: IStaticWorkspaceData | null;\n\textensions: IExtensionDescriptionSnapshot;\n\tnlsBaseUrl?: URI;\n\ttelemetryInfo: {\n\t\treadonly sessionId: string;\n\t\treadonly machineId: string;\n\t\treadonly sqmId: string;\n\t\treadonly devDeviceId: string;\n\t\treadonly firstSessionDate: string;\n\t\treadonly msftInternal?: boolean;\n\t};\n\tlogLevel: LogLevel;\n\tloggers: UriDto<ILoggerResource>[];\n\tlogsLocation: URI;\n\tautoStart: boolean;\n\tremote: { isRemote: boolean; authority: string | undefined; connectionData: IRemoteConnectionData | null };\n\tconsoleForward: { includeStack: boolean; logNative: boolean };\n\tuiKind: UIKind;\n\tmessagePorts?: ReadonlyMap<string, MessagePortLike>;\n\thandle?: string;\n}\n\nexport interface IEnvironment {\n\tisExtensionDevelopmentDebug: boolean;\n\tappName: string;\n\tappHost: string;\n\tappRoot?: URI;\n\tappLanguage: string;\n\tisExtensionTelemetryLoggingOnly: boolean;\n\tappUriScheme: string;\n\textensionDevelopmentLocationURI?: URI[];\n\textensionTestsLocationURI?: URI;\n\tglobalStorageHome: URI;\n\tworkspaceStorageHome: URI;\n\tuseHostProxy?: boolean;\n\tskipWorkspaceStorageLock?: boolean;\n\textensionLogLevel?: [string, string][];\n}\n\nexport interface IStaticWorkspaceData {\n\tid: string;\n\tname: string;\n\ttransient?: boolean;\n\tconfiguration?: UriComponents | null;\n\tisUntitled?: boolean | null;\n}\n\nexport interface MessagePortLike {\n\tpostMessage(message: any, transfer?: any[]): void;\n\taddEventListener(type: 'message', listener: (e: any) => unknown): void;\n\tremoveEventListener(type: 'message', listener: (e: any) => unknown): void;\n\tstart(): void;\n}\n\nexport enum UIKind {\n\tDesktop = 1,\n\tWeb = 2\n}\n\nexport const enum ExtensionHostExitCode {\n\t// nodejs uses codes 1-13 and exit codes >128 are signal exits\n\tVersionMismatch = 55,\n\tUnexpectedError = 81,\n}\n\nexport interface IExtHostReadyMessage {\n\ttype: 'VSCODE_EXTHOST_IPC_READY';\n}\n\nexport interface IExtHostSocketMessage {\n\ttype: 'VSCODE_EXTHOST_IPC_SOCKET';\n\tinitialDataChunk: string;\n\tskipWebSocketFrames: boolean;\n\tpermessageDeflate: boolean;\n\tinflateBytes: string;\n}\n\nexport interface IExtHostReduceGraceTimeMessage {\n\ttype: 'VSCODE_EXTHOST_IPC_REDUCE_GRACE_TIME';\n}\n\nexport const enum MessageType {\n\tInitialized,\n\tReady,\n\tTerminate\n}\n\nexport function createMessageOfType(type: MessageType): VSBuffer {\n\tconst result = VSBuffer.alloc(1);\n\n\tswitch (type) {\n\t\tcase MessageType.Initialized: result.writeUInt8(1, 0); break;\n\t\tcase MessageType.Ready: result.writeUInt8(2, 0); break;\n\t\tcase MessageType.Terminate: result.writeUInt8(3, 0); break;\n\t}\n\n\treturn result;\n}\n\nexport function isMessageOfType(message: VSBuffer, type: MessageType): boolean {\n\tif (message.byteLength !== 1) {\n\t\treturn false;\n\t}\n\n\tswitch (message.readUInt8(0)) {\n\t\tcase 1: return type === MessageType.Initialized;\n\t\tcase 2: return type === MessageType.Ready;\n\t\tcase 3: return type === MessageType.Terminate;\n\t\tdefault: return false;\n\t}\n}\n\nexport const enum NativeLogMarkers {\n\tStart = 'START_NATIVE_LOG',\n\tEnd = 'END_NATIVE_LOG',\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type * as vscode from 'vscode';\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nimport { Event, Emitter } from '../../../base/common/event.js';\nimport { ExtHostTelemetryShape } from './extHost.protocol.js';\nimport { ICommonProperties, TelemetryLevel } from '../../../platform/telemetry/common/telemetry.js';\nimport { ILogger, ILoggerService } from '../../../platform/log/common/log.js';\nimport { IExtHostInitDataService } from './extHostInitDataService.js';\nimport { ExtensionIdentifier, IExtensionDescription } from '../../../platform/extensions/common/extensions.js';\nimport { UIKind } from '../../services/extensions/common/extensionHostProtocol.js';\nimport { getRemoteName } from '../../../platform/remote/common/remoteHosts.js';\nimport { cleanData, cleanRemoteAuthority, TelemetryLogGroup } from '../../../platform/telemetry/common/telemetryUtils.js';\nimport { mixin } from '../../../base/common/objects.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { localize } from '../../../nls.js';\n\nexport class ExtHostTelemetry extends Disposable implements ExtHostTelemetryShape {\n\n\treadonly _serviceBrand: undefined;\n\n\tprivate readonly _onDidChangeTelemetryEnabled = this._register(new Emitter<boolean>());\n\treadonly onDidChangeTelemetryEnabled: Event<boolean> = this._onDidChangeTelemetryEnabled.event;\n\n\tprivate readonly _onDidChangeTelemetryConfiguration = this._register(new Emitter<vscode.TelemetryConfiguration>());\n\treadonly onDidChangeTelemetryConfiguration: Event<vscode.TelemetryConfiguration> = this._onDidChangeTelemetryConfiguration.event;\n\n\tprivate _productConfig: { usage: boolean; error: boolean } = { usage: true, error: true };\n\tprivate _level: TelemetryLevel = TelemetryLevel.NONE;\n\tprivate _oldTelemetryEnablement: boolean | undefined;\n\tprivate readonly _inLoggingOnlyMode: boolean = false;\n\tprivate readonly _outputLogger: ILogger;\n\tprivate readonly _telemetryLoggers = new Map<string, ExtHostTelemetryLogger[]>();\n\n\tconstructor(\n\t\tisWorker: boolean,\n\t\t@IExtHostInitDataService private readonly initData: IExtHostInitDataService,\n\t\t@ILoggerService loggerService: ILoggerService,\n\t) {\n\t\tsuper();\n\t\tthis._inLoggingOnlyMode = this.initData.environment.isExtensionTelemetryLoggingOnly;\n\t\tconst id = initData.remote.isRemote ? 'remoteExtHostTelemetry' : isWorker ? 'workerExtHostTelemetry' : 'extHostTelemetry';\n\t\tthis._outputLogger = this._register(loggerService.createLogger(id,\n\t\t\t{\n\t\t\t\tname: localize('extensionTelemetryLog', \"Extension Telemetry{0}\", this._inLoggingOnlyMode ? ' (Not Sent)' : ''),\n\t\t\t\thidden: true,\n\t\t\t\tgroup: TelemetryLogGroup,\n\t\t\t}));\n\t}\n\n\tgetTelemetryConfiguration(): boolean {\n\t\treturn this._level === TelemetryLevel.USAGE;\n\t}\n\n\tgetTelemetryDetails(): vscode.TelemetryConfiguration {\n\t\treturn {\n\t\t\tisCrashEnabled: this._level >= TelemetryLevel.CRASH,\n\t\t\tisErrorsEnabled: this._productConfig.error ? this._level >= TelemetryLevel.ERROR : false,\n\t\t\tisUsageEnabled: this._productConfig.usage ? this._level >= TelemetryLevel.USAGE : false\n\t\t};\n\t}\n\n\tinstantiateLogger(extension: IExtensionDescription, sender: vscode.TelemetrySender, options?: vscode.TelemetryLoggerOptions) {\n\t\tconst telemetryDetails = this.getTelemetryDetails();\n\t\tconst logger = new ExtHostTelemetryLogger(\n\t\t\tsender,\n\t\t\toptions,\n\t\t\textension,\n\t\t\tthis._outputLogger,\n\t\t\tthis._inLoggingOnlyMode,\n\t\t\tthis.getBuiltInCommonProperties(extension),\n\t\t\t{ isUsageEnabled: telemetryDetails.isUsageEnabled, isErrorsEnabled: telemetryDetails.isErrorsEnabled }\n\t\t);\n\t\tconst loggers = this._telemetryLoggers.get(extension.identifier.value) ?? [];\n\t\tthis._telemetryLoggers.set(extension.identifier.value, [...loggers, logger]);\n\t\treturn logger.apiTelemetryLogger;\n\t}\n\n\t$initializeTelemetryLevel(level: TelemetryLevel, supportsTelemetry: boolean, productConfig?: { usage: boolean; error: boolean }): void {\n\t\tthis._level = level;\n\t\tthis._productConfig = productConfig ?? { usage: true, error: true };\n\t}\n\n\tgetBuiltInCommonProperties(extension: IExtensionDescription): ICommonProperties {\n\t\tconst commonProperties: ICommonProperties = Object.create(null);\n\t\t// TODO @lramos15, does os info like node arch, platform version, etc exist here.\n\t\t// Or will first party extensions just mix this in\n\t\tcommonProperties['common.extname'] = `${extension.publisher}.${extension.name}`;\n\t\tcommonProperties['common.extversion'] = extension.version;\n\t\tcommonProperties['common.vscodemachineid'] = this.initData.telemetryInfo.machineId;\n\t\tcommonProperties['common.vscodesessionid'] = this.initData.telemetryInfo.sessionId;\n\t\tcommonProperties['common.vscodecommithash'] = this.initData.commit;\n\t\tcommonProperties['common.sqmid'] = this.initData.telemetryInfo.sqmId;\n\t\tcommonProperties['common.devDeviceId'] = this.initData.telemetryInfo.devDeviceId;\n\t\tcommonProperties['common.vscodeversion'] = this.initData.version;\n\t\tcommonProperties['common.vscodereleasedate'] = this.initData.date;\n\t\tcommonProperties['common.isnewappinstall'] = isNewAppInstall(this.initData.telemetryInfo.firstSessionDate);\n\t\tcommonProperties['common.product'] = this.initData.environment.appHost;\n\n\t\tswitch (this.initData.uiKind) {\n\t\t\tcase UIKind.Web:\n\t\t\t\tcommonProperties['common.uikind'] = 'web';\n\t\t\t\tbreak;\n\t\t\tcase UIKind.Desktop:\n\t\t\t\tcommonProperties['common.uikind'] = 'desktop';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcommonProperties['common.uikind'] = 'unknown';\n\t\t}\n\n\t\tcommonProperties['common.remotename'] = getRemoteName(cleanRemoteAuthority(this.initData.remote.authority));\n\n\t\treturn commonProperties;\n\t}\n\n\t$onDidChangeTelemetryLevel(level: TelemetryLevel): void {\n\t\tthis._oldTelemetryEnablement = this.getTelemetryConfiguration();\n\t\tthis._level = level;\n\t\tconst telemetryDetails = this.getTelemetryDetails();\n\t\t// Remove all disposed loggers\n\t\tthis._telemetryLoggers.forEach((loggers, key) => {\n\t\t\tconst newLoggers = loggers.filter(l => !l.isDisposed);\n\t\t\tif (newLoggers.length === 0) {\n\t\t\t\tthis._telemetryLoggers.delete(key);\n\t\t\t} else {\n\t\t\t\tthis._telemetryLoggers.set(key, newLoggers);\n\t\t\t}\n\t\t});\n\t\t// Loop through all loggers and update their level\n\t\tthis._telemetryLoggers.forEach(loggers => {\n\t\t\tfor (const logger of loggers) {\n\t\t\t\tlogger.updateTelemetryEnablements(telemetryDetails.isUsageEnabled, telemetryDetails.isErrorsEnabled);\n\t\t\t}\n\t\t});\n\n\t\tif (this._oldTelemetryEnablement !== this.getTelemetryConfiguration()) {\n\t\t\tthis._onDidChangeTelemetryEnabled.fire(this.getTelemetryConfiguration());\n\t\t}\n\t\tthis._onDidChangeTelemetryConfiguration.fire(this.getTelemetryDetails());\n\t}\n\n\tonExtensionError(extension: ExtensionIdentifier, error: Error): boolean {\n\t\tconst loggers = this._telemetryLoggers.get(extension.value);\n\t\tconst nonDisposedLoggers = loggers?.filter(l => !l.isDisposed);\n\t\tif (!nonDisposedLoggers) {\n\t\t\tthis._telemetryLoggers.delete(extension.value);\n\t\t\treturn false;\n\t\t}\n\t\tlet errorEmitted = false;\n\t\tfor (const logger of nonDisposedLoggers) {\n\t\t\tif (logger.ignoreUnhandledExtHostErrors) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlogger.logError(error);\n\t\t\terrorEmitted = true;\n\t\t}\n\t\treturn errorEmitted;\n\t}\n}\n\nexport class ExtHostTelemetryLogger {\n\n\tstatic validateSender(sender: vscode.TelemetrySender): void {\n\t\tif (typeof sender !== 'object') {\n\t\t\tthrow new TypeError('TelemetrySender argument is invalid');\n\t\t}\n\t\tif (typeof sender.sendEventData !== 'function') {\n\t\t\tthrow new TypeError('TelemetrySender.sendEventData must be a function');\n\t\t}\n\t\tif (typeof sender.sendErrorData !== 'function') {\n\t\t\tthrow new TypeError('TelemetrySender.sendErrorData must be a function');\n\t\t}\n\t\tif (typeof sender.flush !== 'undefined' && typeof sender.flush !== 'function') {\n\t\t\tthrow new TypeError('TelemetrySender.flush must be a function or undefined');\n\t\t}\n\t}\n\n\tprivate readonly _onDidChangeEnableStates = new Emitter<vscode.TelemetryLogger>();\n\tprivate readonly _ignoreBuiltinCommonProperties: boolean;\n\tprivate readonly _additionalCommonProperties: Record<string, any> | undefined;\n\tpublic readonly ignoreUnhandledExtHostErrors: boolean;\n\n\tprivate _telemetryEnablements: { isUsageEnabled: boolean; isErrorsEnabled: boolean };\n\tprivate _apiObject: vscode.TelemetryLogger | undefined;\n\tprivate _sender: vscode.TelemetrySender | undefined;\n\n\tconstructor(\n\t\tsender: vscode.TelemetrySender,\n\t\toptions: vscode.TelemetryLoggerOptions | undefined,\n\t\tprivate readonly _extension: IExtensionDescription,\n\t\tprivate readonly _logger: ILogger,\n\t\tprivate readonly _inLoggingOnlyMode: boolean,\n\t\tprivate readonly _commonProperties: Record<string, any>,\n\t\ttelemetryEnablements: { isUsageEnabled: boolean; isErrorsEnabled: boolean }\n\t) {\n\t\tthis.ignoreUnhandledExtHostErrors = options?.ignoreUnhandledErrors ?? false;\n\t\tthis._ignoreBuiltinCommonProperties = options?.ignoreBuiltInCommonProperties ?? false;\n\t\tthis._additionalCommonProperties = options?.additionalCommonProperties;\n\t\tthis._sender = sender;\n\t\tthis._telemetryEnablements = { isUsageEnabled: telemetryEnablements.isUsageEnabled, isErrorsEnabled: telemetryEnablements.isErrorsEnabled };\n\t}\n\n\tupdateTelemetryEnablements(isUsageEnabled: boolean, isErrorsEnabled: boolean): void {\n\t\tif (this._apiObject) {\n\t\t\tthis._telemetryEnablements = { isUsageEnabled, isErrorsEnabled };\n\t\t\tthis._onDidChangeEnableStates.fire(this._apiObject);\n\t\t}\n\t}\n\n\tmixInCommonPropsAndCleanData(data: Record<string, any>): Record<string, any> {\n\t\t// Some telemetry modules prefer to break properties and measurmements up\n\t\t// We mix common properties into the properties tab.\n\t\tlet updatedData = 'properties' in data ? (data.properties ?? {}) : data;\n\n\t\t// We don't clean measurements since they are just numbers\n\t\tupdatedData = cleanData(updatedData, []);\n\n\t\tif (this._additionalCommonProperties) {\n\t\t\tupdatedData = mixin(updatedData, this._additionalCommonProperties);\n\t\t}\n\n\t\tif (!this._ignoreBuiltinCommonProperties) {\n\t\t\tupdatedData = mixin(updatedData, this._commonProperties);\n\t\t}\n\n\t\tif ('properties' in data) {\n\t\t\tdata.properties = updatedData;\n\t\t} else {\n\t\t\tdata = updatedData;\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tprivate logEvent(eventName: string, data?: Record<string, any>): void {\n\t\t// No sender means likely disposed of, we should no-op\n\t\tif (!this._sender) {\n\t\t\treturn;\n\t\t}\n\t\t// If it's a built-in extension (vscode publisher) we don't prefix the publisher and only the ext name\n\t\tif (this._extension.publisher === 'vscode') {\n\t\t\teventName = this._extension.name + '/' + eventName;\n\t\t} else {\n\t\t\teventName = this._extension.identifier.value + '/' + eventName;\n\t\t}\n\t\tdata = this.mixInCommonPropsAndCleanData(data || {});\n\t\tif (!this._inLoggingOnlyMode) {\n\t\t\tthis._sender?.sendEventData(eventName, data);\n\t\t}\n\t\tthis._logger.trace(eventName, data);\n\t}\n\n\tlogUsage(eventName: string, data?: Record<string, any>): void {\n\t\tif (!this._telemetryEnablements.isUsageEnabled) {\n\t\t\treturn;\n\t\t}\n\t\tthis.logEvent(eventName, data);\n\t}\n\n\tlogError(eventNameOrException: Error | string, data?: Record<string, any>): void {\n\t\tif (!this._telemetryEnablements.isErrorsEnabled || !this._sender) {\n\t\t\treturn;\n\t\t}\n\t\tif (typeof eventNameOrException === 'string') {\n\t\t\tthis.logEvent(eventNameOrException, data);\n\t\t} else {\n\t\t\tconst errorData = {\n\t\t\t\tname: eventNameOrException.name,\n\t\t\t\tmessage: eventNameOrException.message,\n\t\t\t\tstack: eventNameOrException.stack,\n\t\t\t\tcause: eventNameOrException.cause\n\t\t\t};\n\t\t\tconst cleanedErrorData = cleanData(errorData, []);\n\t\t\t// Reconstruct the error object with the cleaned data\n\t\t\tconst cleanedError = new Error(cleanedErrorData.message, {\n\t\t\t\tcause: cleanedErrorData.cause\n\t\t\t});\n\t\t\tcleanedError.stack = cleanedErrorData.stack;\n\t\t\tcleanedError.name = cleanedErrorData.name;\n\t\t\tdata = this.mixInCommonPropsAndCleanData(data || {});\n\t\t\tif (!this._inLoggingOnlyMode) {\n\t\t\t\tthis._sender.sendErrorData(cleanedError, data);\n\t\t\t}\n\t\t\tthis._logger.trace('exception', data);\n\t\t}\n\t}\n\n\tget apiTelemetryLogger(): vscode.TelemetryLogger {\n\t\tif (!this._apiObject) {\n\t\t\tconst that = this;\n\t\t\tconst obj: vscode.TelemetryLogger = {\n\t\t\t\tlogUsage: that.logUsage.bind(that),\n\t\t\t\tget isUsageEnabled() {\n\t\t\t\t\treturn that._telemetryEnablements.isUsageEnabled;\n\t\t\t\t},\n\t\t\t\tget isErrorsEnabled() {\n\t\t\t\t\treturn that._telemetryEnablements.isErrorsEnabled;\n\t\t\t\t},\n\t\t\t\tlogError: that.logError.bind(that),\n\t\t\t\tdispose: that.dispose.bind(that),\n\t\t\t\tonDidChangeEnableStates: that._onDidChangeEnableStates.event.bind(that)\n\t\t\t};\n\t\t\tthis._apiObject = Object.freeze(obj);\n\t\t}\n\t\treturn this._apiObject;\n\t}\n\n\tget isDisposed(): boolean {\n\t\treturn !this._sender;\n\t}\n\n\tdispose(): void {\n\t\tif (this._sender?.flush) {\n\t\t\tlet tempSender: vscode.TelemetrySender | undefined = this._sender;\n\t\t\tthis._sender = undefined;\n\t\t\tPromise.resolve(tempSender.flush!()).then(tempSender = undefined);\n\t\t\tthis._apiObject = undefined;\n\t\t} else {\n\t\t\tthis._sender = undefined;\n\t\t}\n\t}\n}\n\nexport function isNewAppInstall(firstSessionDate: string): boolean {\n\tconst installAge = Date.now() - new Date(firstSessionDate).getTime();\n\treturn isNaN(installAge) ? false : installAge < 1000 * 60 * 60 * 24; // install age is less than a day\n}\n\nexport const IExtHostTelemetry = createDecorator<IExtHostTelemetry>('IExtHostTelemetry');\nexport interface IExtHostTelemetry extends ExtHostTelemetry, ExtHostTelemetryShape { }\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/* eslint-disable local/code-no-native-private */\n\nimport { validateConstraint } from '../../../base/common/types.js';\nimport { ICommandMetadata } from '../../../platform/commands/common/commands.js';\nimport * as extHostTypes from './extHostTypes.js';\nimport * as extHostTypeConverter from './extHostTypeConverters.js';\nimport { cloneAndChange } from '../../../base/common/objects.js';\nimport { MainContext, MainThreadCommandsShape, ExtHostCommandsShape, ICommandDto, ICommandMetadataDto, MainThreadTelemetryShape } from './extHost.protocol.js';\nimport { isNonEmptyArray } from '../../../base/common/arrays.js';\nimport * as languages from '../../../editor/common/languages.js';\nimport type * as vscode from 'vscode';\nimport { ILogService } from '../../../platform/log/common/log.js';\nimport { revive } from '../../../base/common/marshalling.js';\nimport { IRange, Range } from '../../../editor/common/core/range.js';\nimport { IPosition, Position } from '../../../editor/common/core/position.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { DisposableStore, toDisposable } from '../../../base/common/lifecycle.js';\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nimport { IExtHostRpcService } from './extHostRpcService.js';\nimport { ISelection } from '../../../editor/common/core/selection.js';\nimport { TestItemImpl } from './extHostTestItem.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { SerializableObjectWithBuffers } from '../../services/extensions/common/proxyIdentifier.js';\nimport { toErrorMessage } from '../../../base/common/errorMessage.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { IExtensionDescription } from '../../../platform/extensions/common/extensions.js';\nimport { TelemetryTrustedValue } from '../../../platform/telemetry/common/telemetryUtils.js';\nimport { IExtHostTelemetry } from './extHostTelemetry.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { isCancellationError } from '../../../base/common/errors.js';\n\ninterface CommandHandler {\n\tcallback: Function;\n\tthisArg: any;\n\tmetadata?: ICommandMetadata;\n\textension?: IExtensionDescription;\n}\n\nexport interface ArgumentProcessor {\n\tprocessArgument(arg: any, extension: IExtensionDescription | undefined): any;\n}\n\nexport class ExtHostCommands implements ExtHostCommandsShape {\n\n\treadonly _serviceBrand: undefined;\n\n\t#proxy: MainThreadCommandsShape;\n\n\tprivate readonly _commands = new Map<string, CommandHandler>();\n\tprivate readonly _apiCommands = new Map<string, ApiCommand>();\n\t#telemetry: MainThreadTelemetryShape;\n\n\tprivate readonly _logService: ILogService;\n\treadonly #extHostTelemetry: IExtHostTelemetry;\n\tprivate readonly _argumentProcessors: ArgumentProcessor[];\n\n\treadonly converter: CommandsConverter;\n\n\tconstructor(\n\t\t@IExtHostRpcService extHostRpc: IExtHostRpcService,\n\t\t@ILogService logService: ILogService,\n\t\t@IExtHostTelemetry extHostTelemetry: IExtHostTelemetry\n\t) {\n\t\tthis.#proxy = extHostRpc.getProxy(MainContext.MainThreadCommands);\n\t\tthis._logService = logService;\n\t\tthis.#extHostTelemetry = extHostTelemetry;\n\t\tthis.#telemetry = extHostRpc.getProxy(MainContext.MainThreadTelemetry);\n\t\tthis.converter = new CommandsConverter(\n\t\t\tthis,\n\t\t\tid => {\n\t\t\t\t// API commands that have no return type (void) can be\n\t\t\t\t// converted to their internal command and don't need\n\t\t\t\t// any indirection commands\n\t\t\t\tconst candidate = this._apiCommands.get(id);\n\t\t\t\treturn candidate?.result === ApiCommandResult.Void\n\t\t\t\t\t? candidate : undefined;\n\t\t\t},\n\t\t\tlogService\n\t\t);\n\t\tthis._argumentProcessors = [\n\t\t\t{\n\t\t\t\tprocessArgument(a) {\n\t\t\t\t\t// URI, Regex\n\t\t\t\t\treturn revive(a);\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\tprocessArgument(arg) {\n\t\t\t\t\treturn cloneAndChange(arg, function (obj) {\n\t\t\t\t\t\t// Reverse of https://github.com/microsoft/vscode/blob/1f28c5fc681f4c01226460b6d1c7e91b8acb4a5b/src/vs/workbench/api/node/extHostCommands.ts#L112-L127\n\t\t\t\t\t\tif (Range.isIRange(obj)) {\n\t\t\t\t\t\t\treturn extHostTypeConverter.Range.to(obj);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (Position.isIPosition(obj)) {\n\t\t\t\t\t\t\treturn extHostTypeConverter.Position.to(obj);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (Range.isIRange((obj as languages.Location).range) && URI.isUri((obj as languages.Location).uri)) {\n\t\t\t\t\t\t\treturn extHostTypeConverter.location.to(obj);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (obj instanceof VSBuffer) {\n\t\t\t\t\t\t\treturn obj.buffer.buffer;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!Array.isArray(obj)) {\n\t\t\t\t\t\t\treturn obj;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\t}\n\n\tregisterArgumentProcessor(processor: ArgumentProcessor): void {\n\t\tthis._argumentProcessors.push(processor);\n\t}\n\n\tregisterApiCommand(apiCommand: ApiCommand): extHostTypes.Disposable {\n\n\n\t\tconst registration = this.registerCommand(false, apiCommand.id, async (...apiArgs) => {\n\n\t\t\tconst internalArgs = apiCommand.args.map((arg, i) => {\n\t\t\t\tif (!arg.validate(apiArgs[i])) {\n\t\t\t\t\tthrow new Error(`Invalid argument '${arg.name}' when running '${apiCommand.id}', received: ${typeof apiArgs[i] === 'object' ? JSON.stringify(apiArgs[i], null, '\\t') : apiArgs[i]} `);\n\t\t\t\t}\n\t\t\t\treturn arg.convert(apiArgs[i]);\n\t\t\t});\n\n\t\t\tconst internalResult = await this.executeCommand(apiCommand.internalId, ...internalArgs);\n\t\t\treturn apiCommand.result.convert(internalResult, apiArgs, this.converter);\n\t\t}, undefined, {\n\t\t\tdescription: apiCommand.description,\n\t\t\targs: apiCommand.args,\n\t\t\treturns: apiCommand.result.description\n\t\t});\n\n\t\tthis._apiCommands.set(apiCommand.id, apiCommand);\n\n\t\treturn new extHostTypes.Disposable(() => {\n\t\t\tregistration.dispose();\n\t\t\tthis._apiCommands.delete(apiCommand.id);\n\t\t});\n\t}\n\n\tregisterCommand(global: boolean, id: string, callback: <T>(...args: any[]) => T | Thenable<T>, thisArg?: any, metadata?: ICommandMetadata, extension?: IExtensionDescription): extHostTypes.Disposable {\n\t\tthis._logService.trace('ExtHostCommands#registerCommand', id);\n\n\t\tif (!id.trim().length) {\n\t\t\tthrow new Error('invalid id');\n\t\t}\n\n\t\tif (this._commands.has(id)) {\n\t\t\tthrow new Error(`command '${id}' already exists`);\n\t\t}\n\n\t\tthis._commands.set(id, { callback, thisArg, metadata, extension });\n\t\tif (global) {\n\t\t\tthis.#proxy.$registerCommand(id);\n\t\t}\n\n\t\treturn new extHostTypes.Disposable(() => {\n\t\t\tif (this._commands.delete(id)) {\n\t\t\t\tif (global) {\n\t\t\t\t\tthis.#proxy.$unregisterCommand(id);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\texecuteCommand<T>(id: string, ...args: any[]): Promise<T> {\n\t\tthis._logService.trace('ExtHostCommands#executeCommand', id);\n\t\treturn this._doExecuteCommand(id, args, true);\n\t}\n\n\tprivate async _doExecuteCommand<T>(id: string, args: any[], retry: boolean): Promise<T> {\n\n\t\tif (this._commands.has(id)) {\n\t\t\t// - We stay inside the extension host and support\n\t\t\t// \t to pass any kind of parameters around.\n\t\t\t// - We still emit the corresponding activation event\n\t\t\t//   BUT we don't await that event\n\t\t\tthis.#proxy.$fireCommandActivationEvent(id);\n\t\t\treturn this._executeContributedCommand<T>(id, args, false);\n\n\t\t} else {\n\t\t\t// automagically convert some argument types\n\t\t\tlet hasBuffers = false;\n\t\t\tconst toArgs = cloneAndChange(args, function (value) {\n\t\t\t\tif (value instanceof extHostTypes.Position) {\n\t\t\t\t\treturn extHostTypeConverter.Position.from(value);\n\t\t\t\t} else if (value instanceof extHostTypes.Range) {\n\t\t\t\t\treturn extHostTypeConverter.Range.from(value);\n\t\t\t\t} else if (value instanceof extHostTypes.Location) {\n\t\t\t\t\treturn extHostTypeConverter.location.from(value);\n\t\t\t\t} else if (extHostTypes.NotebookRange.isNotebookRange(value)) {\n\t\t\t\t\treturn extHostTypeConverter.NotebookRange.from(value);\n\t\t\t\t} else if (value instanceof ArrayBuffer) {\n\t\t\t\t\thasBuffers = true;\n\t\t\t\t\treturn VSBuffer.wrap(new Uint8Array(value));\n\t\t\t\t} else if (value instanceof Uint8Array) {\n\t\t\t\t\thasBuffers = true;\n\t\t\t\t\treturn VSBuffer.wrap(value);\n\t\t\t\t} else if (value instanceof VSBuffer) {\n\t\t\t\t\thasBuffers = true;\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tconst result = await this.#proxy.$executeCommand(id, hasBuffers ? new SerializableObjectWithBuffers(toArgs) : toArgs, retry);\n\t\t\t\treturn revive<any>(result);\n\t\t\t} catch (e) {\n\t\t\t\t// Rerun the command when it wasn't known, had arguments, and when retry\n\t\t\t\t// is enabled. We do this because the command might be registered inside\n\t\t\t\t// the extension host now and can therefore accept the arguments as-is.\n\t\t\t\tif (e instanceof Error && e.message === '$executeCommand:retry') {\n\t\t\t\t\treturn this._doExecuteCommand(id, args, false);\n\t\t\t\t} else {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async _executeContributedCommand<T = unknown>(id: string, args: any[], annotateError: boolean): Promise<T> {\n\t\tconst command = this._commands.get(id);\n\t\tif (!command) {\n\t\t\tthrow new Error('Unknown command');\n\t\t}\n\t\tconst { callback, thisArg, metadata } = command;\n\t\tif (metadata?.args) {\n\t\t\tfor (let i = 0; i < metadata.args.length; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tvalidateConstraint(args[i], metadata.args[i].constraint);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthrow new Error(`Running the contributed command: '${id}' failed. Illegal argument '${metadata.args[i].name}' - ${metadata.args[i].description}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst stopWatch = StopWatch.create();\n\t\ttry {\n\t\t\treturn await callback.apply(thisArg, args);\n\t\t} catch (err) {\n\t\t\t// The indirection-command from the converter can fail when invoking the actual\n\t\t\t// command and in that case it is better to blame the correct command\n\t\t\tif (id === this.converter.delegatingCommandId) {\n\t\t\t\tconst actual = this.converter.getActualCommand(...args);\n\t\t\t\tif (actual) {\n\t\t\t\t\tid = actual.command;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!isCancellationError(err)) {\n\t\t\t\tthis._logService.error(err, id, command.extension?.identifier);\n\t\t\t}\n\n\t\t\tif (!annotateError) {\n\t\t\t\tthrow err;\n\t\t\t}\n\n\t\t\tif (command.extension?.identifier) {\n\t\t\t\tconst reported = this.#extHostTelemetry.onExtensionError(command.extension.identifier, err);\n\t\t\t\tthis._logService.trace('forwarded error to extension?', reported, command.extension?.identifier);\n\t\t\t}\n\n\t\t\tthrow new class CommandError extends Error {\n\t\t\t\treadonly id = id;\n\t\t\t\treadonly source = command!.extension?.displayName ?? command!.extension?.name;\n\t\t\t\tconstructor() {\n\t\t\t\t\tsuper(toErrorMessage(err));\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\tfinally {\n\t\t\tthis._reportTelemetry(command, id, stopWatch.elapsed());\n\t\t}\n\t}\n\n\tprivate _reportTelemetry(command: CommandHandler, id: string, duration: number) {\n\t\tif (!command.extension) {\n\t\t\treturn;\n\t\t}\n\t\tif (id.startsWith('code.copilot.logStructured')) {\n\t\t\t// This command is very active. See https://github.com/microsoft/vscode/issues/254153.\n\t\t\treturn;\n\t\t}\n\t\ttype ExtensionActionTelemetry = {\n\t\t\textensionId: string;\n\t\t\tid: TelemetryTrustedValue<string>;\n\t\t\tduration: number;\n\t\t};\n\t\ttype ExtensionActionTelemetryMeta = {\n\t\t\textensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The id of the extension handling the command, informing which extensions provide most-used functionality.' };\n\t\t\tid: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The id of the command, to understand which specific extension features are most popular.' };\n\t\t\tduration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration of the command execution, to detect performance issues' };\n\t\t\towner: 'digitarald';\n\t\t\tcomment: 'Used to gain insight on the most popular commands used from extensions';\n\t\t};\n\t\tthis.#telemetry.$publicLog2<ExtensionActionTelemetry, ExtensionActionTelemetryMeta>('Extension:ActionExecuted', {\n\t\t\textensionId: command.extension.identifier.value,\n\t\t\tid: new TelemetryTrustedValue(id),\n\t\t\tduration: duration,\n\t\t});\n\t}\n\n\t$executeContributedCommand(id: string, ...args: any[]): Promise<unknown> {\n\t\tthis._logService.trace('ExtHostCommands#$executeContributedCommand', id);\n\n\t\tconst cmdHandler = this._commands.get(id);\n\t\tif (!cmdHandler) {\n\t\t\treturn Promise.reject(new Error(`Contributed command '${id}' does not exist.`));\n\t\t} else {\n\t\t\targs = args.map(arg => this._argumentProcessors.reduce((r, p) => p.processArgument(r, cmdHandler.extension), arg));\n\t\t\treturn this._executeContributedCommand(id, args, true);\n\t\t}\n\t}\n\n\tgetCommands(filterUnderscoreCommands: boolean = false): Promise<string[]> {\n\t\tthis._logService.trace('ExtHostCommands#getCommands', filterUnderscoreCommands);\n\n\t\treturn this.#proxy.$getCommands().then(result => {\n\t\t\tif (filterUnderscoreCommands) {\n\t\t\t\tresult = result.filter(command => command[0] !== '_');\n\t\t\t}\n\t\t\treturn result;\n\t\t});\n\t}\n\n\t$getContributedCommandMetadata(): Promise<{ [id: string]: string | ICommandMetadataDto }> {\n\t\tconst result: { [id: string]: string | ICommandMetadata } = Object.create(null);\n\t\tfor (const [id, command] of this._commands) {\n\t\t\tconst { metadata } = command;\n\t\t\tif (metadata) {\n\t\t\t\tresult[id] = metadata;\n\t\t\t}\n\t\t}\n\t\treturn Promise.resolve(result);\n\t}\n}\n\nexport interface IExtHostCommands extends ExtHostCommands { }\nexport const IExtHostCommands = createDecorator<IExtHostCommands>('IExtHostCommands');\n\nexport class CommandsConverter implements extHostTypeConverter.Command.ICommandsConverter {\n\n\treadonly delegatingCommandId: string = `__vsc${generateUuid()}`;\n\tprivate readonly _cache = new Map<string, vscode.Command>();\n\tprivate _cachIdPool = 0;\n\n\t// --- conversion between internal and api commands\n\tconstructor(\n\t\tprivate readonly _commands: ExtHostCommands,\n\t\tprivate readonly _lookupApiCommand: (id: string) => ApiCommand | undefined,\n\t\tprivate readonly _logService: ILogService\n\t) {\n\t\tthis._commands.registerCommand(true, this.delegatingCommandId, this._executeConvertedCommand, this);\n\t}\n\n\ttoInternal(command: vscode.Command, disposables: DisposableStore): ICommandDto;\n\ttoInternal(command: vscode.Command | undefined, disposables: DisposableStore): ICommandDto | undefined;\n\ttoInternal(command: vscode.Command | undefined, disposables: DisposableStore): ICommandDto | undefined {\n\n\t\tif (!command) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst result: ICommandDto = {\n\t\t\t$ident: undefined,\n\t\t\tid: command.command,\n\t\t\ttitle: command.title,\n\t\t\ttooltip: command.tooltip\n\t\t};\n\n\t\tif (!command.command) {\n\t\t\t// falsy command id -> return converted command but don't attempt any\n\t\t\t// argument or API-command dance since this command won't run anyways\n\t\t\treturn result;\n\t\t}\n\n\t\tconst apiCommand = this._lookupApiCommand(command.command);\n\t\tif (apiCommand) {\n\t\t\t// API command with return-value can be converted inplace\n\t\t\tresult.id = apiCommand.internalId;\n\t\t\tresult.arguments = apiCommand.args.map((arg, i) => arg.convert(command.arguments && command.arguments[i]));\n\n\n\t\t} else if (isNonEmptyArray(command.arguments)) {\n\t\t\t// we have a contributed command with arguments. that\n\t\t\t// means we don't want to send the arguments around\n\n\t\t\tconst id = `${command.command} /${++this._cachIdPool}`;\n\t\t\tthis._cache.set(id, command);\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\tthis._cache.delete(id);\n\t\t\t\tthis._logService.trace('CommandsConverter#DISPOSE', id);\n\t\t\t}));\n\t\t\tresult.$ident = id;\n\n\t\t\tresult.id = this.delegatingCommandId;\n\t\t\tresult.arguments = [id];\n\n\t\t\tthis._logService.trace('CommandsConverter#CREATE', command.command, id);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tfromInternal(command: ICommandDto): vscode.Command | undefined {\n\n\t\tif (typeof command.$ident === 'string') {\n\t\t\treturn this._cache.get(command.$ident);\n\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tcommand: command.id,\n\t\t\t\ttitle: command.title,\n\t\t\t\targuments: command.arguments\n\t\t\t};\n\t\t}\n\t}\n\n\n\tgetActualCommand(...args: any[]): vscode.Command | undefined {\n\t\treturn this._cache.get(args[0]);\n\t}\n\n\tprivate _executeConvertedCommand<R>(...args: any[]): Promise<R> {\n\t\tconst actualCmd = this.getActualCommand(...args);\n\t\tthis._logService.trace('CommandsConverter#EXECUTE', args[0], actualCmd ? actualCmd.command : 'MISSING');\n\n\t\tif (!actualCmd) {\n\t\t\treturn Promise.reject(`Actual command not found, wanted to execute ${args[0]}`);\n\t\t}\n\t\treturn this._commands.executeCommand(actualCmd.command, ...(actualCmd.arguments || []));\n\t}\n\n}\n\n\nexport class ApiCommandArgument<V, O = V> {\n\n\tstatic readonly Uri = new ApiCommandArgument<URI>('uri', 'Uri of a text document', v => URI.isUri(v), v => v);\n\tstatic readonly Position = new ApiCommandArgument<extHostTypes.Position, IPosition>('position', 'A position in a text document', v => extHostTypes.Position.isPosition(v), extHostTypeConverter.Position.from);\n\tstatic readonly Range = new ApiCommandArgument<extHostTypes.Range, IRange>('range', 'A range in a text document', v => extHostTypes.Range.isRange(v), extHostTypeConverter.Range.from);\n\tstatic readonly Selection = new ApiCommandArgument<extHostTypes.Selection, ISelection>('selection', 'A selection in a text document', v => extHostTypes.Selection.isSelection(v), extHostTypeConverter.Selection.from);\n\tstatic readonly Number = new ApiCommandArgument<number>('number', '', v => typeof v === 'number', v => v);\n\tstatic readonly String = new ApiCommandArgument<string>('string', '', v => typeof v === 'string', v => v);\n\n\tstatic Arr<T, K = T>(element: ApiCommandArgument<T, K>) {\n\t\treturn new ApiCommandArgument(\n\t\t\t`${element.name}_array`,\n\t\t\t`Array of ${element.name}, ${element.description}`,\n\t\t\t(v: unknown) => Array.isArray(v) && v.every(e => element.validate(e)),\n\t\t\t(v: T[]) => v.map(e => element.convert(e))\n\t\t);\n\t}\n\n\tstatic readonly CallHierarchyItem = new ApiCommandArgument('item', 'A call hierarchy item', v => v instanceof extHostTypes.CallHierarchyItem, extHostTypeConverter.CallHierarchyItem.from);\n\tstatic readonly TypeHierarchyItem = new ApiCommandArgument('item', 'A type hierarchy item', v => v instanceof extHostTypes.TypeHierarchyItem, extHostTypeConverter.TypeHierarchyItem.from);\n\tstatic readonly TestItem = new ApiCommandArgument('testItem', 'A VS Code TestItem', v => v instanceof TestItemImpl, extHostTypeConverter.TestItem.from);\n\tstatic readonly TestProfile = new ApiCommandArgument('testProfile', 'A VS Code test profile', v => v instanceof extHostTypes.TestRunProfileBase, extHostTypeConverter.TestRunProfile.from);\n\n\tconstructor(\n\t\treadonly name: string,\n\t\treadonly description: string,\n\t\treadonly validate: (v: V) => boolean,\n\t\treadonly convert: (v: V) => O\n\t) { }\n\n\toptional(): ApiCommandArgument<V | undefined | null, O | undefined | null> {\n\t\treturn new ApiCommandArgument(\n\t\t\tthis.name, `(optional) ${this.description}`,\n\t\t\tvalue => value === undefined || value === null || this.validate(value),\n\t\t\tvalue => value === undefined ? undefined : value === null ? null : this.convert(value)\n\t\t);\n\t}\n\n\twith(name: string | undefined, description: string | undefined): ApiCommandArgument<V, O> {\n\t\treturn new ApiCommandArgument(name ?? this.name, description ?? this.description, this.validate, this.convert);\n\t}\n}\n\nexport class ApiCommandResult<V, O = V> {\n\n\tstatic readonly Void = new ApiCommandResult<void, void>('no result', v => v);\n\n\tconstructor(\n\t\treadonly description: string,\n\t\treadonly convert: (v: V, apiArgs: any[], cmdConverter: CommandsConverter) => O\n\t) { }\n}\n\nexport class ApiCommand {\n\n\tconstructor(\n\t\treadonly id: string,\n\t\treadonly internalId: string,\n\t\treadonly description: string,\n\t\treadonly args: ApiCommandArgument<any, any>[],\n\t\treadonly result: ApiCommandResult<any, any>\n\t) { }\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createRandomIPCHandle } from '../../../base/parts/ipc/node/ipc.net.js';\nimport * as http from 'http';\nimport * as fs from 'fs';\nimport { IExtHostCommands } from '../common/extHostCommands.js';\nimport { IWindowOpenable, IOpenWindowOptions } from '../../../platform/window/common/window.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\nimport { hasWorkspaceFileExtension } from '../../../platform/workspace/common/workspace.js';\n\nexport interface OpenCommandPipeArgs {\n\ttype: 'open';\n\tfileURIs?: string[];\n\tfolderURIs?: string[];\n\tforceNewWindow?: boolean;\n\tdiffMode?: boolean;\n\tmergeMode?: boolean;\n\taddMode?: boolean;\n\tremoveMode?: boolean;\n\tgotoLineMode?: boolean;\n\tforceReuseWindow?: boolean;\n\twaitMarkerFilePath?: string;\n\tremoteAuthority?: string | null;\n}\n\nexport interface OpenExternalCommandPipeArgs {\n\ttype: 'openExternal';\n\turis: string[];\n}\n\nexport interface StatusPipeArgs {\n\ttype: 'status';\n}\n\nexport interface ExtensionManagementPipeArgs {\n\ttype: 'extensionManagement';\n\tlist?: { showVersions?: boolean; category?: string };\n\tinstall?: string[];\n\tuninstall?: string[];\n\tforce?: boolean;\n}\n\nexport interface ClipboardPipeArgs {\n\ttype: 'clipboard';\n\tcontent: string;\n}\n\nexport type PipeCommand = OpenCommandPipeArgs | StatusPipeArgs | OpenExternalCommandPipeArgs | ExtensionManagementPipeArgs | ClipboardPipeArgs;\n\nexport interface ICommandsExecuter {\n\texecuteCommand<T>(id: string, ...args: any[]): Promise<T>;\n}\n\nexport class CLIServerBase {\n\tprivate readonly _server: http.Server;\n\n\tconstructor(\n\t\tprivate readonly _commands: ICommandsExecuter,\n\t\tprivate readonly logService: ILogService,\n\t\tprivate readonly _ipcHandlePath: string,\n\t) {\n\t\tthis._server = http.createServer((req, res) => this.onRequest(req, res));\n\t\tthis.setup().catch(err => {\n\t\t\tlogService.error(err);\n\t\t\treturn '';\n\t\t});\n\t}\n\n\tpublic get ipcHandlePath() {\n\t\treturn this._ipcHandlePath;\n\t}\n\n\tprivate async setup(): Promise<string> {\n\t\ttry {\n\t\t\tthis._server.listen(this.ipcHandlePath);\n\t\t\tthis._server.on('error', err => this.logService.error(err));\n\t\t} catch (err) {\n\t\t\tthis.logService.error('Could not start open from terminal server.');\n\t\t}\n\n\t\treturn this._ipcHandlePath;\n\t}\n\n\tprivate onRequest(req: http.IncomingMessage, res: http.ServerResponse): void {\n\t\tconst sendResponse = (statusCode: number, returnObj: string | undefined) => {\n\t\t\tres.writeHead(statusCode, { 'content-type': 'application/json' });\n\t\t\tres.end(JSON.stringify(returnObj || null), (err?: any) => err && this.logService.error(err)); // CodeQL [SM01524] Only the message portion of errors are passed in.\n\t\t};\n\n\t\tconst chunks: string[] = [];\n\t\treq.setEncoding('utf8');\n\t\treq.on('data', (d: string) => chunks.push(d));\n\t\treq.on('end', async () => {\n\t\t\ttry {\n\t\t\t\tconst data: PipeCommand | any = JSON.parse(chunks.join(''));\n\t\t\t\tlet returnObj: string | undefined;\n\t\t\t\tswitch (data.type) {\n\t\t\t\t\tcase 'open':\n\t\t\t\t\t\treturnObj = await this.open(data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'openExternal':\n\t\t\t\t\t\treturnObj = await this.openExternal(data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'status':\n\t\t\t\t\t\treturnObj = await this.getStatus(data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'extensionManagement':\n\t\t\t\t\t\treturnObj = await this.manageExtensions(data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'clipboard':\n\t\t\t\t\t\treturnObj = await this.clipboard(data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tsendResponse(404, `Unknown message type: ${data.type}`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tsendResponse(200, returnObj);\n\t\t\t} catch (e) {\n\t\t\t\tconst message = e instanceof Error ? e.message : JSON.stringify(e);\n\t\t\t\tsendResponse(500, message);\n\t\t\t\tthis.logService.error('Error while processing pipe request', e);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate async open(data: OpenCommandPipeArgs): Promise<undefined> {\n\t\tconst { fileURIs, folderURIs, forceNewWindow, diffMode, mergeMode, addMode, removeMode, forceReuseWindow, gotoLineMode, waitMarkerFilePath, remoteAuthority } = data;\n\t\tconst urisToOpen: IWindowOpenable[] = [];\n\t\tif (Array.isArray(folderURIs)) {\n\t\t\tfor (const s of folderURIs) {\n\t\t\t\ttry {\n\t\t\t\t\turisToOpen.push({ folderUri: URI.parse(s) });\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// ignore\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(fileURIs)) {\n\t\t\tfor (const s of fileURIs) {\n\t\t\t\ttry {\n\t\t\t\t\tif (hasWorkspaceFileExtension(s)) {\n\t\t\t\t\t\turisToOpen.push({ workspaceUri: URI.parse(s) });\n\t\t\t\t\t} else {\n\t\t\t\t\t\turisToOpen.push({ fileUri: URI.parse(s) });\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// ignore\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst waitMarkerFileURI = waitMarkerFilePath ? URI.file(waitMarkerFilePath) : undefined;\n\t\tconst preferNewWindow = !forceReuseWindow && !waitMarkerFileURI && !addMode && !removeMode;\n\t\tconst windowOpenArgs: IOpenWindowOptions = { forceNewWindow, diffMode, mergeMode, addMode, removeMode, gotoLineMode, forceReuseWindow, preferNewWindow, waitMarkerFileURI, remoteAuthority };\n\t\tthis._commands.executeCommand('_remoteCLI.windowOpen', urisToOpen, windowOpenArgs);\n\t}\n\n\tprivate async openExternal(data: OpenExternalCommandPipeArgs): Promise<undefined> {\n\t\tfor (const uriString of data.uris) {\n\t\t\tconst uri = URI.parse(uriString);\n\t\t\tconst urioOpen = uri.scheme === 'file' ? uri : uriString; // workaround for #112577\n\t\t\tawait this._commands.executeCommand('_remoteCLI.openExternal', urioOpen);\n\t\t}\n\t}\n\n\tprivate async manageExtensions(data: ExtensionManagementPipeArgs): Promise<string | undefined> {\n\t\tconst toExtOrVSIX = (inputs: string[] | undefined) => inputs?.map(input => /\\.vsix$/i.test(input) ? URI.parse(input) : input);\n\t\tconst commandArgs = {\n\t\t\tlist: data.list,\n\t\t\tinstall: toExtOrVSIX(data.install),\n\t\t\tuninstall: toExtOrVSIX(data.uninstall),\n\t\t\tforce: data.force\n\t\t};\n\t\treturn await this._commands.executeCommand<string | undefined>('_remoteCLI.manageExtensions', commandArgs);\n\t}\n\n\tprivate async getStatus(data: StatusPipeArgs): Promise<string | undefined> {\n\t\treturn await this._commands.executeCommand<string | undefined>('_remoteCLI.getSystemStatus');\n\t}\n\n\tprivate async clipboard(data: ClipboardPipeArgs): Promise<undefined> {\n\t\treturn await this._commands.executeCommand('_remoteCLI.setClipboard', data.content);\n\t}\n\n\tdispose(): void {\n\t\tthis._server.close();\n\n\t\tif (this._ipcHandlePath && process.platform !== 'win32' && fs.existsSync(this._ipcHandlePath)) {\n\t\t\tfs.unlinkSync(this._ipcHandlePath);\n\t\t}\n\t}\n}\n\nexport class CLIServer extends CLIServerBase {\n\tconstructor(\n\t\t@IExtHostCommands commands: IExtHostCommands,\n\t\t@ILogService logService: ILogService\n\t) {\n\t\tsuper(commands, logService, createRandomIPCHandle());\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { OperatingSystem, OS } from '../../../base/common/platform.js';\nimport type { IShellLaunchConfig } from './terminal.js';\n\n/**\n * Aggressively escape non-windows paths to prepare for being sent to a shell. This will do some\n * escaping inaccurately to be careful about possible script injection via the file path. For\n * example, we're trying to prevent this sort of attack: `/foo/file$(echo evil)`.\n */\nexport function escapeNonWindowsPath(path: string): string {\n\tlet newPath = path;\n\tif (newPath.includes('\\\\')) {\n\t\tnewPath = newPath.replace(/\\\\/g, '\\\\\\\\');\n\t}\n\tconst bannedChars = /[\\`\\$\\|\\&\\>\\~\\#\\!\\^\\*\\;\\<\\\"\\']/g;\n\tnewPath = newPath.replace(bannedChars, '');\n\treturn `'${newPath}'`;\n}\n\n/**\n * Collapses the user's home directory into `~` if it exists within the path, this gives a shorter\n * path that is more suitable within the context of a terminal.\n */\nexport function collapseTildePath(path: string | undefined, userHome: string | undefined, separator: string): string {\n\tif (!path) {\n\t\treturn '';\n\t}\n\tif (!userHome) {\n\t\treturn path;\n\t}\n\t// Trim the trailing separator from the end if it exists\n\tif (userHome.match(/[\\/\\\\]$/)) {\n\t\tuserHome = userHome.slice(0, userHome.length - 1);\n\t}\n\tconst normalizedPath = path.replace(/\\\\/g, '/').toLowerCase();\n\tconst normalizedUserHome = userHome.replace(/\\\\/g, '/').toLowerCase();\n\tif (!normalizedPath.includes(normalizedUserHome)) {\n\t\treturn path;\n\t}\n\treturn `~${separator}${path.slice(userHome.length + 1)}`;\n}\n\n/**\n * Sanitizes a cwd string, removing any wrapping quotes and making the Windows drive letter\n * uppercase.\n * @param cwd The directory to sanitize.\n */\nexport function sanitizeCwd(cwd: string): string {\n\t// Sanity check that the cwd is not wrapped in quotes (see #160109)\n\tif (cwd.match(/^['\"].*['\"]$/)) {\n\t\tcwd = cwd.substring(1, cwd.length - 1);\n\t}\n\t// Make the drive letter uppercase on Windows (see #9448)\n\tif (OS === OperatingSystem.Windows && cwd && cwd[1] === ':') {\n\t\treturn cwd[0].toUpperCase() + cwd.substring(1);\n\t}\n\treturn cwd;\n}\n\n/**\n * Determines whether the given shell launch config should use the environment variable collection.\n * @param slc The shell launch config to check.\n */\nexport function shouldUseEnvironmentVariableCollection(slc: IShellLaunchConfig): boolean {\n\treturn !slc.strictEnv;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * This module contains utility functions related to the environment, cwd and paths.\n */\n\nimport * as path from '../../../../base/common/path.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { IWorkspaceContextService, IWorkspaceFolder } from '../../../../platform/workspace/common/workspace.js';\nimport { IConfigurationResolverService } from '../../../services/configurationResolver/common/configurationResolver.js';\nimport { sanitizeProcessEnvironment } from '../../../../base/common/processes.js';\nimport { IShellLaunchConfig, ITerminalBackend, ITerminalEnvironment, TerminalShellType, WindowsShellType } from '../../../../platform/terminal/common/terminal.js';\nimport { IProcessEnvironment, isWindows, isMacintosh, language, OperatingSystem } from '../../../../base/common/platform.js';\nimport { escapeNonWindowsPath, sanitizeCwd } from '../../../../platform/terminal/common/terminalEnvironment.js';\nimport { isString } from '../../../../base/common/types.js';\nimport { IHistoryService } from '../../../services/history/common/history.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\n\nexport function mergeEnvironments(parent: IProcessEnvironment, other: ITerminalEnvironment | undefined): void {\n\tif (!other) {\n\t\treturn;\n\t}\n\n\t// On Windows apply the new values ignoring case, while still retaining\n\t// the case of the original key.\n\tif (isWindows) {\n\t\tfor (const configKey in other) {\n\t\t\tlet actualKey = configKey;\n\t\t\tfor (const envKey in parent) {\n\t\t\t\tif (configKey.toLowerCase() === envKey.toLowerCase()) {\n\t\t\t\t\tactualKey = envKey;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst value = other[configKey];\n\t\t\tif (value !== undefined) {\n\t\t\t\t_mergeEnvironmentValue(parent, actualKey, value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tObject.keys(other).forEach((key) => {\n\t\t\tconst value = other[key];\n\t\t\tif (value !== undefined) {\n\t\t\t\t_mergeEnvironmentValue(parent, key, value);\n\t\t\t}\n\t\t});\n\t}\n}\n\nfunction _mergeEnvironmentValue(env: ITerminalEnvironment, key: string, value: string | null): void {\n\tif (typeof value === 'string') {\n\t\tenv[key] = value;\n\t} else {\n\t\tdelete env[key];\n\t}\n}\n\nexport function addTerminalEnvironmentKeys(env: IProcessEnvironment, version: string | undefined, locale: string | undefined, detectLocale: 'auto' | 'off' | 'on'): void {\n\tenv['TERM_PROGRAM'] = 'vscode';\n\tif (version) {\n\t\tenv['TERM_PROGRAM_VERSION'] = version;\n\t}\n\tif (shouldSetLangEnvVariable(env, detectLocale)) {\n\t\tenv['LANG'] = getLangEnvVariable(locale);\n\t}\n\tenv['COLORTERM'] = 'truecolor';\n}\n\nfunction mergeNonNullKeys(env: IProcessEnvironment, other: ITerminalEnvironment | undefined) {\n\tif (!other) {\n\t\treturn;\n\t}\n\tfor (const key of Object.keys(other)) {\n\t\tconst value = other[key];\n\t\tif (value !== undefined && value !== null) {\n\t\t\tenv[key] = value;\n\t\t}\n\t}\n}\n\nasync function resolveConfigurationVariables(variableResolver: VariableResolver, env: ITerminalEnvironment): Promise<ITerminalEnvironment> {\n\tawait Promise.all(Object.entries(env).map(async ([key, value]) => {\n\t\tif (typeof value === 'string') {\n\t\t\ttry {\n\t\t\t\tenv[key] = await variableResolver(value);\n\t\t\t} catch (e) {\n\t\t\t\tenv[key] = value;\n\t\t\t}\n\t\t}\n\t}));\n\n\treturn env;\n}\n\nexport function shouldSetLangEnvVariable(env: IProcessEnvironment, detectLocale: 'auto' | 'off' | 'on'): boolean {\n\tif (detectLocale === 'on') {\n\t\treturn true;\n\t}\n\tif (detectLocale === 'auto') {\n\t\tconst lang = env['LANG'];\n\t\treturn !lang || (lang.search(/\\.UTF\\-8$/) === -1 && lang.search(/\\.utf8$/) === -1 && lang.search(/\\.euc.+/) === -1);\n\t}\n\treturn false; // 'off'\n}\n\nexport function getLangEnvVariable(locale?: string): string {\n\tconst parts = locale ? locale.split('-') : [];\n\tconst n = parts.length;\n\tif (n === 0) {\n\t\t// Fallback to en_US if the locale is unknown\n\t\treturn 'en_US.UTF-8';\n\t}\n\tif (n === 1) {\n\t\t// The local may only contain the language, not the variant, if this is the case guess the\n\t\t// variant such that it can be used as a valid $LANG variable. The language variant chosen\n\t\t// is the original and/or most prominent with help from\n\t\t// https://stackoverflow.com/a/2502675/1156119\n\t\t// The list of locales was generated by running `locale -a` on macOS\n\t\tconst languageVariants: { [key: string]: string } = {\n\t\t\taf: 'ZA',\n\t\t\tam: 'ET',\n\t\t\tbe: 'BY',\n\t\t\tbg: 'BG',\n\t\t\tca: 'ES',\n\t\t\tcs: 'CZ',\n\t\t\tda: 'DK',\n\t\t\t// de: 'AT',\n\t\t\t// de: 'CH',\n\t\t\tde: 'DE',\n\t\t\tel: 'GR',\n\t\t\t// en: 'AU',\n\t\t\t// en: 'CA',\n\t\t\t// en: 'GB',\n\t\t\t// en: 'IE',\n\t\t\t// en: 'NZ',\n\t\t\ten: 'US',\n\t\t\tes: 'ES',\n\t\t\tet: 'EE',\n\t\t\teu: 'ES',\n\t\t\tfi: 'FI',\n\t\t\t// fr: 'BE',\n\t\t\t// fr: 'CA',\n\t\t\t// fr: 'CH',\n\t\t\tfr: 'FR',\n\t\t\the: 'IL',\n\t\t\thr: 'HR',\n\t\t\thu: 'HU',\n\t\t\thy: 'AM',\n\t\t\tis: 'IS',\n\t\t\t// it: 'CH',\n\t\t\tit: 'IT',\n\t\t\tja: 'JP',\n\t\t\tkk: 'KZ',\n\t\t\tko: 'KR',\n\t\t\tlt: 'LT',\n\t\t\t// nl: 'BE',\n\t\t\tnl: 'NL',\n\t\t\tno: 'NO',\n\t\t\tpl: 'PL',\n\t\t\tpt: 'BR',\n\t\t\t// pt: 'PT',\n\t\t\tro: 'RO',\n\t\t\tru: 'RU',\n\t\t\tsk: 'SK',\n\t\t\tsl: 'SI',\n\t\t\tsr: 'YU',\n\t\t\tsv: 'SE',\n\t\t\ttr: 'TR',\n\t\t\tuk: 'UA',\n\t\t\tzh: 'CN',\n\t\t};\n\t\tif (parts[0] in languageVariants) {\n\t\t\tparts.push(languageVariants[parts[0]]);\n\t\t}\n\t} else {\n\t\t// Ensure the variant is uppercase to be a valid $LANG\n\t\tparts[1] = parts[1].toUpperCase();\n\t}\n\treturn parts.join('_') + '.UTF-8';\n}\n\nexport async function getCwd(\n\tshell: IShellLaunchConfig,\n\tuserHome: string | undefined,\n\tvariableResolver: VariableResolver | undefined,\n\troot: URI | undefined,\n\tcustomCwd: string | undefined,\n\tlogService?: ILogService\n): Promise<string> {\n\tif (shell.cwd) {\n\t\tconst unresolved = (typeof shell.cwd === 'object') ? shell.cwd.fsPath : shell.cwd;\n\t\tconst resolved = await _resolveCwd(unresolved, variableResolver);\n\t\treturn sanitizeCwd(resolved || unresolved);\n\t}\n\n\tlet cwd: string | undefined;\n\n\tif (!shell.ignoreConfigurationCwd && customCwd) {\n\t\tif (variableResolver) {\n\t\t\tcustomCwd = await _resolveCwd(customCwd, variableResolver, logService);\n\t\t}\n\t\tif (customCwd) {\n\t\t\tif (path.isAbsolute(customCwd)) {\n\t\t\t\tcwd = customCwd;\n\t\t\t} else if (root) {\n\t\t\t\tcwd = path.join(root.fsPath, customCwd);\n\t\t\t}\n\t\t}\n\t}\n\n\t// If there was no custom cwd or it was relative with no workspace\n\tif (!cwd) {\n\t\tcwd = root ? root.fsPath : userHome || '';\n\t}\n\n\treturn sanitizeCwd(cwd);\n}\n\nasync function _resolveCwd(cwd: string, variableResolver: VariableResolver | undefined, logService?: ILogService): Promise<string | undefined> {\n\tif (variableResolver) {\n\t\ttry {\n\t\t\treturn await variableResolver(cwd);\n\t\t} catch (e) {\n\t\t\tlogService?.error('Could not resolve terminal cwd', e);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\treturn cwd;\n}\n\nexport type VariableResolver = (str: string) => Promise<string>;\n\nexport function createVariableResolver(lastActiveWorkspace: IWorkspaceFolder | undefined, env: IProcessEnvironment, configurationResolverService: IConfigurationResolverService | undefined): VariableResolver | undefined {\n\tif (!configurationResolverService) {\n\t\treturn undefined;\n\t}\n\treturn (str) => configurationResolverService.resolveWithEnvironment(env, lastActiveWorkspace, str);\n}\n\nexport async function createTerminalEnvironment(\n\tshellLaunchConfig: IShellLaunchConfig,\n\tenvFromConfig: ITerminalEnvironment | undefined,\n\tvariableResolver: VariableResolver | undefined,\n\tversion: string | undefined,\n\tdetectLocale: 'auto' | 'off' | 'on',\n\tbaseEnv: IProcessEnvironment\n): Promise<IProcessEnvironment> {\n\t// Create a terminal environment based on settings, launch config and permissions\n\tconst env: IProcessEnvironment = {};\n\tif (shellLaunchConfig.strictEnv) {\n\t\t// strictEnv is true, only use the requested env (ignoring null entries)\n\t\tmergeNonNullKeys(env, shellLaunchConfig.env);\n\t} else {\n\t\t// Merge process env with the env from config and from shellLaunchConfig\n\t\tmergeNonNullKeys(env, baseEnv);\n\n\t\tconst allowedEnvFromConfig = { ...envFromConfig };\n\n\t\t// Resolve env vars from config and shell\n\t\tif (variableResolver) {\n\t\t\tif (allowedEnvFromConfig) {\n\t\t\t\tawait resolveConfigurationVariables(variableResolver, allowedEnvFromConfig);\n\t\t\t}\n\t\t\tif (shellLaunchConfig.env) {\n\t\t\t\tawait resolveConfigurationVariables(variableResolver, shellLaunchConfig.env);\n\t\t\t}\n\t\t}\n\n\t\t// Workaround for https://github.com/microsoft/vscode/issues/204005\n\t\t// We should restore the following environment variables when a user\n\t\t// launches the application using the CLI so that integrated terminal\n\t\t// can still inherit these variables.\n\t\t// We are not bypassing the restrictions implied in https://github.com/electron/electron/pull/40770\n\t\t// since this only affects integrated terminal and not the application itself.\n\t\tif (isMacintosh) {\n\t\t\t// Restore NODE_OPTIONS if it was set\n\t\t\tif (env['VSCODE_NODE_OPTIONS']) {\n\t\t\t\tenv['NODE_OPTIONS'] = env['VSCODE_NODE_OPTIONS'];\n\t\t\t\tdelete env['VSCODE_NODE_OPTIONS'];\n\t\t\t}\n\n\t\t\t// Restore NODE_REPL_EXTERNAL_MODULE if it was set\n\t\t\tif (env['VSCODE_NODE_REPL_EXTERNAL_MODULE']) {\n\t\t\t\tenv['NODE_REPL_EXTERNAL_MODULE'] = env['VSCODE_NODE_REPL_EXTERNAL_MODULE'];\n\t\t\t\tdelete env['VSCODE_NODE_REPL_EXTERNAL_MODULE'];\n\t\t\t}\n\t\t}\n\n\t\t// Sanitize the environment, removing any undesirable VS Code and Electron environment\n\t\t// variables\n\t\tsanitizeProcessEnvironment(env, 'VSCODE_IPC_HOOK_CLI', 'VSCODE_PROXY_URI');\n\n\t\t// Merge config (settings) and ShellLaunchConfig environments\n\t\tmergeEnvironments(env, allowedEnvFromConfig);\n\t\tmergeEnvironments(env, shellLaunchConfig.env);\n\n\t\t// Adding other env keys necessary to create the process\n\t\taddTerminalEnvironmentKeys(env, version, language, detectLocale);\n\t}\n\treturn env;\n}\n\n/**\n * Takes a path and returns the properly escaped path to send to a given shell. On Windows, this\n * included trying to prepare the path for WSL if needed.\n *\n * @param originalPath The path to be escaped and formatted.\n * @param executable The executable off the shellLaunchConfig.\n * @param title The terminal's title.\n * @param shellType The type of shell the path is being sent to.\n * @param backend The backend for the terminal.\n * @param isWindowsFrontend Whether the frontend is Windows, this is only exposed for injection via\n * tests.\n * @returns An escaped version of the path to be execuded in the terminal.\n */\nexport async function preparePathForShell(resource: string | URI, executable: string | undefined, title: string, shellType: TerminalShellType | undefined, backend: Pick<ITerminalBackend, 'getWslPath'> | undefined, os: OperatingSystem | undefined, isWindowsFrontend: boolean = isWindows): Promise<string> {\n\tlet originalPath: string;\n\tif (isString(resource)) {\n\t\toriginalPath = resource;\n\t} else {\n\t\toriginalPath = resource.fsPath;\n\t\t// Apply backend OS-specific formatting to the path since URI.fsPath uses the frontend's OS\n\t\tif (isWindowsFrontend && os !== OperatingSystem.Windows) {\n\t\t\toriginalPath = originalPath.replace(/\\\\/g, '\\/');\n\t\t} else if (!isWindowsFrontend && os === OperatingSystem.Windows) {\n\t\t\toriginalPath = originalPath.replace(/\\//g, '\\\\');\n\t\t}\n\t}\n\n\tif (!executable) {\n\t\treturn originalPath;\n\t}\n\n\tconst hasSpace = originalPath.includes(' ');\n\tconst hasParens = originalPath.includes('(') || originalPath.includes(')');\n\n\tconst pathBasename = path.basename(executable, '.exe');\n\tconst isPowerShell = pathBasename === 'pwsh' ||\n\t\ttitle === 'pwsh' ||\n\t\tpathBasename === 'powershell' ||\n\t\ttitle === 'powershell';\n\n\n\tif (isPowerShell && (hasSpace || originalPath.includes('\\''))) {\n\t\treturn `& '${originalPath.replace(/'/g, '\\'\\'')}'`;\n\t}\n\n\tif (hasParens && isPowerShell) {\n\t\treturn `& '${originalPath}'`;\n\t}\n\n\tif (os === OperatingSystem.Windows) {\n\t\t// 17063 is the build number where wsl path was introduced.\n\t\t// Update Windows uriPath to be executed in WSL.\n\t\tif (shellType !== undefined) {\n\t\t\tif (shellType === WindowsShellType.GitBash) {\n\t\t\t\treturn escapeNonWindowsPath(originalPath.replace(/\\\\/g, '/'));\n\t\t\t}\n\t\t\telse if (shellType === WindowsShellType.Wsl) {\n\t\t\t\treturn backend?.getWslPath(originalPath, 'win-to-unix') || originalPath;\n\t\t\t}\n\t\t\telse if (hasSpace) {\n\t\t\t\treturn `\"${originalPath}\"`;\n\t\t\t}\n\t\t\treturn originalPath;\n\t\t}\n\t\tconst lowerExecutable = executable.toLowerCase();\n\t\tif (lowerExecutable.includes('wsl') || (lowerExecutable.includes('bash.exe') && !lowerExecutable.toLowerCase().includes('git'))) {\n\t\t\treturn backend?.getWslPath(originalPath, 'win-to-unix') || originalPath;\n\t\t} else if (hasSpace) {\n\t\t\treturn `\"${originalPath}\"`;\n\t\t}\n\t\treturn originalPath;\n\t}\n\n\treturn escapeNonWindowsPath(originalPath);\n}\n\nexport function getWorkspaceForTerminal(cwd: URI | string | undefined, workspaceContextService: IWorkspaceContextService, historyService: IHistoryService): IWorkspaceFolder | undefined {\n\tconst cwdUri = typeof cwd === 'string' ? URI.parse(cwd) : cwd;\n\tlet workspaceFolder = cwdUri ? workspaceContextService.getWorkspaceFolder(cwdUri) ?? undefined : undefined;\n\tif (!workspaceFolder) {\n\t\t// fallback to last active workspace if cwd is not available or it is not in workspace\n\t\t// TOOD: last active workspace is known to be unreliable, we should remove this fallback eventually\n\t\tconst activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot();\n\t\tworkspaceFolder = activeWorkspaceRootUri ? workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri) ?? undefined : undefined;\n\t}\n\treturn workspaceFolder;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { hasDriveLetter, toSlashes } from './extpath.js';\nimport { posix, sep, win32 } from './path.js';\nimport { isMacintosh, isWindows, OperatingSystem, OS } from './platform.js';\nimport { extUri, extUriIgnorePathCase } from './resources.js';\nimport { rtrim, startsWithIgnoreCase } from './strings.js';\nimport { URI } from './uri.js';\n\nexport interface IPathLabelFormatting {\n\n\t/**\n\t * The OS the path label is from to produce a label\n\t * that matches OS expectations.\n\t */\n\treadonly os: OperatingSystem;\n\n\t/**\n\t * Whether to add a `~` when the path is in the\n\t * user home directory.\n\t *\n\t * Note: this only applies to Linux, macOS but not\n\t * Windows.\n\t */\n\treadonly tildify?: IUserHomeProvider;\n\n\t/**\n\t * Whether to convert to a relative path if the path\n\t * is within any of the opened workspace folders.\n\t */\n\treadonly relative?: IRelativePathProvider;\n}\n\nexport interface IRelativePathProvider {\n\n\t/**\n\t * Whether to not add a prefix when in multi-root workspace.\n\t */\n\treadonly noPrefix?: boolean;\n\n\tgetWorkspace(): { folders: { uri: URI; name?: string }[] };\n\tgetWorkspaceFolder(resource: URI): { uri: URI; name?: string } | null;\n}\n\nexport interface IUserHomeProvider {\n\tuserHome: URI;\n}\n\nexport function getPathLabel(resource: URI, formatting: IPathLabelFormatting): string {\n\tconst { os, tildify: tildifier, relative: relatifier } = formatting;\n\n\t// return early with a relative path if we can resolve one\n\tif (relatifier) {\n\t\tconst relativePath = getRelativePathLabel(resource, relatifier, os);\n\t\tif (typeof relativePath === 'string') {\n\t\t\treturn relativePath;\n\t\t}\n\t}\n\n\t// otherwise try to resolve a absolute path label and\n\t// apply target OS standard path separators if target\n\t// OS differs from actual OS we are running in\n\tlet absolutePath = resource.fsPath;\n\tif (os === OperatingSystem.Windows && !isWindows) {\n\t\tabsolutePath = absolutePath.replace(/\\//g, '\\\\');\n\t} else if (os !== OperatingSystem.Windows && isWindows) {\n\t\tabsolutePath = absolutePath.replace(/\\\\/g, '/');\n\t}\n\n\t// macOS/Linux: tildify with provided user home directory\n\tif (os !== OperatingSystem.Windows && tildifier?.userHome) {\n\t\tconst userHome = tildifier.userHome.fsPath;\n\n\t\t// This is a bit of a hack, but in order to figure out if the\n\t\t// resource is in the user home, we need to make sure to convert it\n\t\t// to a user home resource. We cannot assume that the resource is\n\t\t// already a user home resource.\n\t\tlet userHomeCandidate: string;\n\t\tif (resource.scheme !== tildifier.userHome.scheme && resource.path[0] === posix.sep && resource.path[1] !== posix.sep) {\n\t\t\tuserHomeCandidate = tildifier.userHome.with({ path: resource.path }).fsPath;\n\t\t} else {\n\t\t\tuserHomeCandidate = absolutePath;\n\t\t}\n\n\t\tabsolutePath = tildify(userHomeCandidate, userHome, os);\n\t}\n\n\t// normalize\n\tconst pathLib = os === OperatingSystem.Windows ? win32 : posix;\n\treturn pathLib.normalize(normalizeDriveLetter(absolutePath, os === OperatingSystem.Windows));\n}\n\nfunction getRelativePathLabel(resource: URI, relativePathProvider: IRelativePathProvider, os: OperatingSystem): string | undefined {\n\tconst pathLib = os === OperatingSystem.Windows ? win32 : posix;\n\tconst extUriLib = os === OperatingSystem.Linux ? extUri : extUriIgnorePathCase;\n\n\tconst workspace = relativePathProvider.getWorkspace();\n\tconst firstFolder = workspace.folders.at(0);\n\tif (!firstFolder) {\n\t\treturn undefined;\n\t}\n\n\t// This is a bit of a hack, but in order to figure out the folder\n\t// the resource belongs to, we need to make sure to convert it\n\t// to a workspace resource. We cannot assume that the resource is\n\t// already matching the workspace.\n\tif (resource.scheme !== firstFolder.uri.scheme && resource.path[0] === posix.sep && resource.path[1] !== posix.sep) {\n\t\tresource = firstFolder.uri.with({ path: resource.path });\n\t}\n\n\tconst folder = relativePathProvider.getWorkspaceFolder(resource);\n\tif (!folder) {\n\t\treturn undefined;\n\t}\n\n\tlet relativePathLabel: string | undefined = undefined;\n\tif (extUriLib.isEqual(folder.uri, resource)) {\n\t\trelativePathLabel = ''; // no label if paths are identical\n\t} else {\n\t\trelativePathLabel = extUriLib.relativePath(folder.uri, resource) ?? '';\n\t}\n\n\t// normalize\n\tif (relativePathLabel) {\n\t\trelativePathLabel = pathLib.normalize(relativePathLabel);\n\t}\n\n\t// always show root basename if there are multiple folders\n\tif (workspace.folders.length > 1 && !relativePathProvider.noPrefix) {\n\t\tconst rootName = folder.name ? folder.name : extUriLib.basenameOrAuthority(folder.uri);\n\t\trelativePathLabel = relativePathLabel ? `${rootName} • ${relativePathLabel}` : rootName;\n\t}\n\n\treturn relativePathLabel;\n}\n\nexport function normalizeDriveLetter(path: string, isWindowsOS: boolean = isWindows): string {\n\tif (hasDriveLetter(path, isWindowsOS)) {\n\t\treturn path.charAt(0).toUpperCase() + path.slice(1);\n\t}\n\n\treturn path;\n}\n\nlet normalizedUserHomeCached: { original: string; normalized: string } = Object.create(null);\nexport function tildify(path: string, userHome: string, os = OS): string {\n\tif (os === OperatingSystem.Windows || !path || !userHome) {\n\t\treturn path; // unsupported on Windows\n\t}\n\n\tlet normalizedUserHome = normalizedUserHomeCached.original === userHome ? normalizedUserHomeCached.normalized : undefined;\n\tif (!normalizedUserHome) {\n\t\tnormalizedUserHome = userHome;\n\t\tif (isWindows) {\n\t\t\tnormalizedUserHome = toSlashes(normalizedUserHome); // make sure that the path is POSIX normalized on Windows\n\t\t}\n\t\tnormalizedUserHome = `${rtrim(normalizedUserHome, posix.sep)}${posix.sep}`;\n\t\tnormalizedUserHomeCached = { original: userHome, normalized: normalizedUserHome };\n\t}\n\n\tlet normalizedPath = path;\n\tif (isWindows) {\n\t\tnormalizedPath = toSlashes(normalizedPath); // make sure that the path is POSIX normalized on Windows\n\t}\n\n\t// Linux: case sensitive, macOS: case insensitive\n\tif (os === OperatingSystem.Linux ? normalizedPath.startsWith(normalizedUserHome) : startsWithIgnoreCase(normalizedPath, normalizedUserHome)) {\n\t\treturn `~/${normalizedPath.substr(normalizedUserHome.length)}`;\n\t}\n\n\treturn path;\n}\n\nexport function untildify(path: string, userHome: string): string {\n\treturn path.replace(/^~($|\\/|\\\\)/, `${userHome}$1`);\n}\n\n/**\n * Shortens the paths but keeps them easy to distinguish.\n * Replaces not important parts with ellipsis.\n * Every shorten path matches only one original path and vice versa.\n *\n * Algorithm for shortening paths is as follows:\n * 1. For every path in list, find unique substring of that path.\n * 2. Unique substring along with ellipsis is shortened path of that path.\n * 3. To find unique substring of path, consider every segment of length from 1 to path.length of path from end of string\n *    and if present segment is not substring to any other paths then present segment is unique path,\n *    else check if it is not present as suffix of any other path and present segment is suffix of path itself,\n *    if it is true take present segment as unique path.\n * 4. Apply ellipsis to unique segment according to whether segment is present at start/in-between/end of path.\n *\n * Example 1\n * 1. consider 2 paths i.e. ['a\\\\b\\\\c\\\\d', 'a\\\\f\\\\b\\\\c\\\\d']\n * 2. find unique path of first path,\n * \ta. 'd' is present in path2 and is suffix of path2, hence not unique of present path.\n * \tb. 'c' is present in path2 and 'c' is not suffix of present path, similarly for 'b' and 'a' also.\n * \tc. 'd\\\\c' is suffix of path2.\n *  d. 'b\\\\c' is not suffix of present path.\n *  e. 'a\\\\b' is not present in path2, hence unique path is 'a\\\\b...'.\n * 3. for path2, 'f' is not present in path1 hence unique is '...\\\\f\\\\...'.\n *\n * Example 2\n * 1. consider 2 paths i.e. ['a\\\\b', 'a\\\\b\\\\c'].\n * \ta. Even if 'b' is present in path2, as 'b' is suffix of path1 and is not suffix of path2, unique path will be '...\\\\b'.\n * 2. for path2, 'c' is not present in path1 hence unique path is '..\\\\c'.\n */\nconst ellipsis = '\\u2026';\nconst unc = '\\\\\\\\';\nconst home = '~';\nexport function shorten(paths: string[], pathSeparator: string = sep): string[] {\n\tconst shortenedPaths: string[] = new Array(paths.length);\n\n\t// for every path\n\tlet match = false;\n\tfor (let pathIndex = 0; pathIndex < paths.length; pathIndex++) {\n\t\tconst originalPath = paths[pathIndex];\n\n\t\tif (originalPath === '') {\n\t\t\tshortenedPaths[pathIndex] = `.${pathSeparator}`;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!originalPath) {\n\t\t\tshortenedPaths[pathIndex] = originalPath;\n\t\t\tcontinue;\n\t\t}\n\n\t\tmatch = true;\n\n\t\t// trim for now and concatenate unc path (e.g. \\\\network) or root path (/etc, ~/etc) later\n\t\tlet prefix = '';\n\t\tlet trimmedPath = originalPath;\n\t\tif (trimmedPath.indexOf(unc) === 0) {\n\t\t\tprefix = trimmedPath.substr(0, trimmedPath.indexOf(unc) + unc.length);\n\t\t\ttrimmedPath = trimmedPath.substr(trimmedPath.indexOf(unc) + unc.length);\n\t\t} else if (trimmedPath.indexOf(pathSeparator) === 0) {\n\t\t\tprefix = trimmedPath.substr(0, trimmedPath.indexOf(pathSeparator) + pathSeparator.length);\n\t\t\ttrimmedPath = trimmedPath.substr(trimmedPath.indexOf(pathSeparator) + pathSeparator.length);\n\t\t} else if (trimmedPath.indexOf(home) === 0) {\n\t\t\tprefix = trimmedPath.substr(0, trimmedPath.indexOf(home) + home.length);\n\t\t\ttrimmedPath = trimmedPath.substr(trimmedPath.indexOf(home) + home.length);\n\t\t}\n\n\t\t// pick the first shortest subpath found\n\t\tconst segments: string[] = trimmedPath.split(pathSeparator);\n\t\tfor (let subpathLength = 1; match && subpathLength <= segments.length; subpathLength++) {\n\t\t\tfor (let start = segments.length - subpathLength; match && start >= 0; start--) {\n\t\t\t\tmatch = false;\n\t\t\t\tlet subpath = segments.slice(start, start + subpathLength).join(pathSeparator);\n\n\t\t\t\t// that is unique to any other path\n\t\t\t\tfor (let otherPathIndex = 0; !match && otherPathIndex < paths.length; otherPathIndex++) {\n\n\t\t\t\t\t// suffix subpath treated specially as we consider no match 'x' and 'x/...'\n\t\t\t\t\tif (otherPathIndex !== pathIndex && paths[otherPathIndex] && paths[otherPathIndex].indexOf(subpath) > -1) {\n\t\t\t\t\t\tconst isSubpathEnding: boolean = (start + subpathLength === segments.length);\n\n\t\t\t\t\t\t// Adding separator as prefix for subpath, such that 'endsWith(src, trgt)' considers subpath as directory name instead of plain string.\n\t\t\t\t\t\t// prefix is not added when either subpath is root directory or path[otherPathIndex] does not have multiple directories.\n\t\t\t\t\t\tconst subpathWithSep: string = (start > 0 && paths[otherPathIndex].indexOf(pathSeparator) > -1) ? pathSeparator + subpath : subpath;\n\t\t\t\t\t\tconst isOtherPathEnding: boolean = paths[otherPathIndex].endsWith(subpathWithSep);\n\n\t\t\t\t\t\tmatch = !isSubpathEnding || isOtherPathEnding;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// found unique subpath\n\t\t\t\tif (!match) {\n\t\t\t\t\tlet result = '';\n\n\t\t\t\t\t// preserve disk drive or root prefix\n\t\t\t\t\tif (segments[0].endsWith(':') || prefix !== '') {\n\t\t\t\t\t\tif (start === 1) {\n\t\t\t\t\t\t\t// extend subpath to include disk drive prefix\n\t\t\t\t\t\t\tstart = 0;\n\t\t\t\t\t\t\tsubpathLength++;\n\t\t\t\t\t\t\tsubpath = segments[0] + pathSeparator + subpath;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (start > 0) {\n\t\t\t\t\t\t\tresult = segments[0] + pathSeparator;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresult = prefix + result;\n\t\t\t\t\t}\n\n\t\t\t\t\t// add ellipsis at the beginning if needed\n\t\t\t\t\tif (start > 0) {\n\t\t\t\t\t\tresult = result + ellipsis + pathSeparator;\n\t\t\t\t\t}\n\n\t\t\t\t\tresult = result + subpath;\n\n\t\t\t\t\t// add ellipsis at the end if needed\n\t\t\t\t\tif (start + subpathLength < segments.length) {\n\t\t\t\t\t\tresult = result + pathSeparator + ellipsis;\n\t\t\t\t\t}\n\n\t\t\t\t\tshortenedPaths[pathIndex] = result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (match) {\n\t\t\tshortenedPaths[pathIndex] = originalPath; // use original path if no unique subpaths found\n\t\t}\n\t}\n\n\treturn shortenedPaths;\n}\n\nexport interface ISeparator {\n\tlabel: string;\n}\n\nenum Type {\n\tTEXT,\n\tVARIABLE,\n\tSEPARATOR\n}\n\ninterface ISegment {\n\tvalue: string;\n\ttype: Type;\n}\n\n/**\n * Helper to insert values for specific template variables into the string. E.g. \"this $(is) a $(template)\" can be\n * passed to this function together with an object that maps \"is\" and \"template\" to strings to have them replaced.\n * @param value string to which template is applied\n * @param values the values of the templates to use\n */\nexport function template(template: string, values: { [key: string]: string | ISeparator | undefined | null } = Object.create(null)): string {\n\tconst segments: ISegment[] = [];\n\n\tlet inVariable = false;\n\tlet curVal = '';\n\tfor (const char of template) {\n\t\t// Beginning of variable\n\t\tif (char === '$' || (inVariable && char === '{')) {\n\t\t\tif (curVal) {\n\t\t\t\tsegments.push({ value: curVal, type: Type.TEXT });\n\t\t\t}\n\n\t\t\tcurVal = '';\n\t\t\tinVariable = true;\n\t\t}\n\n\t\t// End of variable\n\t\telse if (char === '}' && inVariable) {\n\t\t\tconst resolved = values[curVal];\n\n\t\t\t// Variable\n\t\t\tif (typeof resolved === 'string') {\n\t\t\t\tif (resolved.length) {\n\t\t\t\t\tsegments.push({ value: resolved, type: Type.VARIABLE });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Separator\n\t\t\telse if (resolved) {\n\t\t\t\tconst prevSegment = segments[segments.length - 1];\n\t\t\t\tif (!prevSegment || prevSegment.type !== Type.SEPARATOR) {\n\t\t\t\t\tsegments.push({ value: resolved.label, type: Type.SEPARATOR }); // prevent duplicate separators\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcurVal = '';\n\t\t\tinVariable = false;\n\t\t}\n\n\t\t// Text or Variable Name\n\t\telse {\n\t\t\tcurVal += char;\n\t\t}\n\t}\n\n\t// Tail\n\tif (curVal && !inVariable) {\n\t\tsegments.push({ value: curVal, type: Type.TEXT });\n\t}\n\n\treturn segments.filter((segment, index) => {\n\n\t\t// Only keep separator if we have values to the left and right\n\t\tif (segment.type === Type.SEPARATOR) {\n\t\t\tconst left = segments[index - 1];\n\t\t\tconst right = segments[index + 1];\n\n\t\t\treturn [left, right].every(segment => segment && (segment.type === Type.VARIABLE || segment.type === Type.TEXT) && segment.value.length > 0);\n\t\t}\n\n\t\t// accept any TEXT and VARIABLE\n\t\treturn true;\n\t}).map(segment => segment.value).join('');\n}\n\n/**\n * Handles mnemonics for menu items. Depending on OS:\n * - Windows: Supported via & character (replace && with &)\n * -   Linux: Supported via & character (replace && with &)\n * -   macOS: Unsupported (replace && with empty string)\n */\nexport function mnemonicMenuLabel(label: string, forceDisableMnemonics?: boolean): string {\n\tif (isMacintosh || forceDisableMnemonics) {\n\t\treturn label.replace(/\\(&&\\w\\)|&&/g, '').replace(/&/g, isMacintosh ? '&' : '&&');\n\t}\n\n\treturn label.replace(/&&|&/g, m => m === '&' ? '&&' : '&');\n}\n\n/**\n * Handles mnemonics for buttons. Depending on OS:\n * - Windows: Supported via & character (replace && with & and & with && for escaping)\n * -   Linux: Supported via _ character (replace && with _)\n * -   macOS: Unsupported (replace && with empty string)\n * When forceDisableMnemonics is set, returns just the label without mnemonics.\n */\nexport function mnemonicButtonLabel(label: string, forceDisableMnemonics: true): string;\nexport function mnemonicButtonLabel(label: string, forceDisableMnemonics?: false): { readonly withMnemonic: string; readonly withoutMnemonic: string };\nexport function mnemonicButtonLabel(label: string, forceDisableMnemonics?: boolean): { readonly withMnemonic: string; readonly withoutMnemonic: string } | string {\n\tconst withoutMnemonic = label.replace(/\\(&&\\w\\)|&&/g, '');\n\n\tif (forceDisableMnemonics) {\n\t\treturn withoutMnemonic;\n\t}\n\tif (isMacintosh) {\n\t\treturn { withMnemonic: withoutMnemonic, withoutMnemonic };\n\t}\n\n\tlet withMnemonic: string;\n\tif (isWindows) {\n\t\twithMnemonic = label.replace(/&&|&/g, m => m === '&' ? '&&' : '&');\n\t} else {\n\t\twithMnemonic = label.replace(/&&/g, '_');\n\t}\n\treturn { withMnemonic, withoutMnemonic };\n}\n\nexport function unmnemonicLabel(label: string): string {\n\treturn label.replace(/&/g, '&&');\n}\n\n/**\n * Splits a recent label in name and parent path, supporting both '/' and '\\' and workspace suffixes.\n * If the location is remote, the remote name is included in the name part.\n */\nexport function splitRecentLabel(recentLabel: string): { name: string; parentPath: string } {\n\tif (recentLabel.endsWith(']')) {\n\t\t// label with workspace suffix\n\t\tconst lastIndexOfSquareBracket = recentLabel.lastIndexOf(' [', recentLabel.length - 2);\n\t\tif (lastIndexOfSquareBracket !== -1) {\n\t\t\tconst split = splitName(recentLabel.substring(0, lastIndexOfSquareBracket));\n\t\t\tconst remoteNameWithSpace = recentLabel.substring(lastIndexOfSquareBracket);\n\t\t\treturn { name: split.name + remoteNameWithSpace, parentPath: split.parentPath };\n\t\t}\n\t}\n\treturn splitName(recentLabel);\n}\n\nfunction splitName(fullPath: string): { name: string; parentPath: string } {\n\tconst p = fullPath.indexOf('/') !== -1 ? posix : win32;\n\tconst name = p.basename(fullPath);\n\tconst parentPath = p.dirname(fullPath);\n\tif (name.length) {\n\t\treturn { name, parentPath };\n\t}\n\t// only the root segment\n\treturn { name: parentPath, parentPath: '' };\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IStringDictionary } from '../../../../base/common/collections.js';\nimport { ErrorNoTelemetry } from '../../../../base/common/errors.js';\nimport { IProcessEnvironment } from '../../../../base/common/platform.js';\nimport { ConfigurationTarget } from '../../../../platform/configuration/common/configuration.js';\nimport { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IWorkspaceFolderData } from '../../../../platform/workspace/common/workspace.js';\nimport { ConfigurationResolverExpression } from './configurationResolverExpression.js';\n\nexport const IConfigurationResolverService = createDecorator<IConfigurationResolverService>('configurationResolverService');\n\nexport interface IConfigurationResolverService {\n\treadonly _serviceBrand: undefined;\n\n\t/** Variables the resolver is able to resolve. */\n\treadonly resolvableVariables: ReadonlySet<string>;\n\n\tresolveWithEnvironment(environment: IProcessEnvironment, folder: IWorkspaceFolderData | undefined, value: string): Promise<string>;\n\n\t/**\n\t * Recursively resolves all variables in the given config and returns a copy of it with substituted values.\n\t * Command variables are only substituted if a \"commandValueMapping\" dictionary is given and if it contains an entry for the command.\n\t */\n\tresolveAsync<T>(folder: IWorkspaceFolderData | undefined, config: T): Promise<T extends ConfigurationResolverExpression<infer R> ? R : T>;\n\n\t/**\n\t * Recursively resolves all variables (including commands and user input) in the given config and returns a copy of it with substituted values.\n\t * If a \"variables\" dictionary (with names -> command ids) is given, command variables are first mapped through it before being resolved.\n\t *\n\t * @param section For example, 'tasks' or 'debug'. Used for resolving inputs.\n\t * @param variables Aliases for commands.\n\t */\n\tresolveWithInteractionReplace(folder: IWorkspaceFolderData | undefined, config: unknown, section?: string, variables?: IStringDictionary<string>, target?: ConfigurationTarget): Promise<any>;\n\n\t/**\n\t * Similar to resolveWithInteractionReplace, except without the replace. Returns a map of variables and their resolution.\n\t * Keys in the map will be of the format input:variableName or command:variableName.\n\t */\n\tresolveWithInteraction(folder: IWorkspaceFolderData | undefined, config: unknown, section?: string, variables?: IStringDictionary<string>, target?: ConfigurationTarget): Promise<Map<string, string> | undefined>;\n\n\t/**\n\t * Contributes a variable that can be resolved later. Consumers that use resolveAny, resolveWithInteraction,\n\t * and resolveWithInteractionReplace will have contributed variables resolved.\n\t */\n\tcontributeVariable(variable: string, resolution: () => Promise<string | undefined>): void;\n}\n\ninterface PromptStringInputInfo {\n\tid: string;\n\ttype: 'promptString';\n\tdescription: string;\n\tdefault?: string;\n\tpassword?: boolean;\n}\n\ninterface PickStringInputInfo {\n\tid: string;\n\ttype: 'pickString';\n\tdescription: string;\n\toptions: (string | { value: string; label?: string })[];\n\tdefault?: string;\n}\n\ninterface CommandInputInfo {\n\tid: string;\n\ttype: 'command';\n\tcommand: string;\n\targs?: any;\n}\n\nexport type ConfiguredInput = PromptStringInputInfo | PickStringInputInfo | CommandInputInfo;\n\nexport enum VariableKind {\n\tUnknown = 'unknown',\n\n\tEnv = 'env',\n\tConfig = 'config',\n\tCommand = 'command',\n\tInput = 'input',\n\tExtensionInstallFolder = 'extensionInstallFolder',\n\n\tWorkspaceFolder = 'workspaceFolder',\n\tCwd = 'cwd',\n\tWorkspaceFolderBasename = 'workspaceFolderBasename',\n\tUserHome = 'userHome',\n\tLineNumber = 'lineNumber',\n\tColumnNumber = 'columnNumber',\n\tSelectedText = 'selectedText',\n\tFile = 'file',\n\tFileWorkspaceFolder = 'fileWorkspaceFolder',\n\tFileWorkspaceFolderBasename = 'fileWorkspaceFolderBasename',\n\tRelativeFile = 'relativeFile',\n\tRelativeFileDirname = 'relativeFileDirname',\n\tFileDirname = 'fileDirname',\n\tFileExtname = 'fileExtname',\n\tFileBasename = 'fileBasename',\n\tFileBasenameNoExtension = 'fileBasenameNoExtension',\n\tFileDirnameBasename = 'fileDirnameBasename',\n\tExecPath = 'execPath',\n\tExecInstallFolder = 'execInstallFolder',\n\tPathSeparator = 'pathSeparator',\n\tPathSeparatorAlias = '/'\n}\n\nexport const allVariableKinds = Object.values(VariableKind).filter((value): value is VariableKind => typeof value === 'string');\n\nexport class VariableError extends ErrorNoTelemetry {\n\tconstructor(public readonly variable: VariableKind, message?: string) {\n\t\tsuper(message);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { isLinux, isMacintosh, isWindows } from '../../../../base/common/platform.js';\nimport { ConfiguredInput } from './configurationResolver.js';\n\n/** A replacement found in the object, as ${name} or ${name:arg} */\nexport type Replacement = {\n\t/** ${name:arg} */\n\tid: string;\n\t/** The `name:arg` in ${name:arg} */\n\tinner: string;\n\t/** The `name` in ${name:arg} */\n\tname: string;\n\t/** The `arg` in ${name:arg} */\n\targ?: string;\n};\n\ninterface IConfigurationResolverExpression<T> {\n\t/**\n\t * Gets the replacements which have not yet been\n\t * resolved.\n\t */\n\tunresolved(): Iterable<Replacement>;\n\n\t/**\n\t * Gets the replacements which have been resolved.\n\t */\n\tresolved(): Iterable<[Replacement, IResolvedValue]>;\n\n\t/**\n\t * Resolves a replacement into the string value.\n\t * If the value is undefined, the original variable text will be preserved.\n\t */\n\tresolve(replacement: Replacement, data: string | IResolvedValue): void;\n\n\t/**\n\t * Returns the complete object. Any unresolved replacements are left intact.\n\t */\n\ttoObject(): T;\n}\n\ntype PropertyLocation = {\n\tobject: any;\n\tpropertyName: string | number;\n\treplaceKeyName?: boolean;\n};\n\nexport interface IResolvedValue {\n\tvalue: string | undefined;\n\n\t/** Present when the variable is resolved from an input field. */\n\tinput?: ConfiguredInput;\n}\n\ninterface IReplacementLocation {\n\treplacement: Replacement;\n\tlocations: PropertyLocation[];\n\tresolved?: IResolvedValue;\n}\n\nexport class ConfigurationResolverExpression<T> implements IConfigurationResolverExpression<T> {\n\tpublic static readonly VARIABLE_LHS = '${';\n\n\tprivate readonly locations = new Map<string, IReplacementLocation>();\n\tprivate root: T;\n\tprivate stringRoot: boolean;\n\t/**\n\t * Callbacks when a new replacement is made, so that nested resolutions from\n\t * `expr.unresolved()` can be fulfilled in the same iteration.\n\t */\n\tprivate newReplacementNotifiers = new Set<(r: Replacement) => void>();\n\n\tprivate constructor(object: T) {\n\t\t// If the input is a string, wrap it in an object so we can use the same logic\n\t\tif (typeof object === 'string') {\n\t\t\tthis.stringRoot = true;\n\t\t\tthis.root = { value: object } as any;\n\t\t} else {\n\t\t\tthis.stringRoot = false;\n\t\t\tthis.root = structuredClone(object);\n\t\t}\n\t}\n\n\t/**\n\t * Creates a new {@link ConfigurationResolverExpression} from an object.\n\t * Note that platform-specific keys (i.e. `windows`, `osx`, `linux`) are\n\t * applied during parsing.\n\t */\n\tpublic static parse<T>(object: T): ConfigurationResolverExpression<T> {\n\t\tif (object instanceof ConfigurationResolverExpression) {\n\t\t\treturn object;\n\t\t}\n\n\t\tconst expr = new ConfigurationResolverExpression<T>(object);\n\t\texpr.applyPlatformSpecificKeys();\n\t\texpr.parseObject(expr.root);\n\t\treturn expr;\n\t}\n\n\tprivate applyPlatformSpecificKeys() {\n\t\tconst config = this.root as any; // already cloned by ctor, safe to change\n\t\tconst key = isWindows ? 'windows' : isMacintosh ? 'osx' : isLinux ? 'linux' : undefined;\n\n\t\tif (key && config && typeof config === 'object' && config.hasOwnProperty(key)) {\n\t\t\tObject.keys(config[key]).forEach(k => config[k] = config[key][k]);\n\t\t}\n\n\t\tdelete config.windows;\n\t\tdelete config.osx;\n\t\tdelete config.linux;\n\t}\n\n\tprivate parseVariable(str: string, start: number): { replacement: Replacement; end: number } | undefined {\n\t\tif (str[start] !== '$' || str[start + 1] !== '{') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tlet end = start + 2;\n\t\tlet braceCount = 1;\n\t\twhile (end < str.length) {\n\t\t\tif (str[end] === '{') {\n\t\t\t\tbraceCount++;\n\t\t\t} else if (str[end] === '}') {\n\t\t\t\tbraceCount--;\n\t\t\t\tif (braceCount === 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tend++;\n\t\t}\n\n\t\tif (braceCount !== 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst id = str.slice(start, end + 1);\n\t\tconst inner = str.substring(start + 2, end);\n\t\tconst colonIdx = inner.indexOf(':');\n\t\tif (colonIdx === -1) {\n\t\t\treturn { replacement: { id, name: inner, inner }, end };\n\t\t}\n\n\t\treturn {\n\t\t\treplacement: {\n\t\t\t\tid,\n\t\t\t\tinner,\n\t\t\t\tname: inner.slice(0, colonIdx),\n\t\t\t\targ: inner.slice(colonIdx + 1)\n\t\t\t},\n\t\t\tend\n\t\t};\n\t}\n\n\tprivate parseObject(obj: any): void {\n\t\tif (typeof obj !== 'object' || obj === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (Array.isArray(obj)) {\n\t\t\tfor (let i = 0; i < obj.length; i++) {\n\t\t\t\tconst value = obj[i];\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\tthis.parseString(obj, i, value);\n\t\t\t\t} else {\n\t\t\t\t\tthis.parseObject(value);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const [key, value] of Object.entries(obj)) {\n\t\t\tthis.parseString(obj, key, key, true); // parse key\n\n\t\t\tif (typeof value === 'string') {\n\t\t\t\tthis.parseString(obj, key, value);\n\t\t\t} else {\n\t\t\t\tthis.parseObject(value);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate parseString(object: any, propertyName: string | number, value: string, replaceKeyName?: boolean, replacementPath?: string[]): void {\n\t\tlet pos = 0;\n\t\twhile (pos < value.length) {\n\t\t\tconst match = value.indexOf('${', pos);\n\t\t\tif (match === -1) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tconst parsed = this.parseVariable(value, match);\n\t\t\tif (parsed) {\n\t\t\t\tpos = parsed.end + 1;\n\t\t\t\tif (replacementPath?.includes(parsed.replacement.id)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst locations = this.locations.get(parsed.replacement.id) || { locations: [], replacement: parsed.replacement };\n\t\t\t\tconst newLocation: PropertyLocation = { object, propertyName, replaceKeyName };\n\t\t\t\tlocations.locations.push(newLocation);\n\t\t\t\tthis.locations.set(parsed.replacement.id, locations);\n\n\t\t\t\tif (locations.resolved) {\n\t\t\t\t\tthis._resolveAtLocation(parsed.replacement, newLocation, locations.resolved, replacementPath);\n\t\t\t\t} else {\n\t\t\t\t\tthis.newReplacementNotifiers.forEach(n => n(parsed.replacement));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpos = match + 2;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic *unresolved(): Iterable<Replacement> {\n\t\tconst newReplacements = new Map<string, Replacement>();\n\t\tconst notifier = (replacement: Replacement) => {\n\t\t\tnewReplacements.set(replacement.id, replacement);\n\t\t};\n\n\t\tfor (const location of this.locations.values()) {\n\t\t\tif (location.resolved === undefined) {\n\t\t\t\tnewReplacements.set(location.replacement.id, location.replacement);\n\t\t\t}\n\t\t}\n\n\t\tthis.newReplacementNotifiers.add(notifier);\n\n\t\twhile (true) {\n\t\t\tconst next = Iterable.first(newReplacements);\n\t\t\tif (!next) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst [key, value] = next;\n\t\t\tyield value;\n\t\t\tnewReplacements.delete(key);\n\t\t}\n\n\t\tthis.newReplacementNotifiers.delete(notifier);\n\t}\n\n\tpublic resolved(): Iterable<[Replacement, IResolvedValue]> {\n\t\treturn Iterable.map(Iterable.filter(this.locations.values(), l => !!l.resolved), l => [l.replacement, l.resolved!]);\n\t}\n\n\tpublic resolve(replacement: Replacement, data: string | IResolvedValue): void {\n\t\tif (typeof data !== 'object') {\n\t\t\tdata = { value: String(data) };\n\t\t}\n\n\t\tconst location = this.locations.get(replacement.id);\n\t\tif (!location) {\n\t\t\treturn;\n\t\t}\n\n\t\tlocation.resolved = data;\n\n\t\tif (data.value !== undefined) {\n\t\t\tfor (const l of location.locations || Iterable.empty()) {\n\t\t\t\tthis._resolveAtLocation(replacement, l, data);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _resolveAtLocation(replacement: Replacement, { replaceKeyName, propertyName, object }: PropertyLocation, data: IResolvedValue, path: string[] = []) {\n\t\tif (data.value === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// avoid recursive resolution, e.g. ${env:FOO} -> ${env:BAR}=${env:FOO}\n\t\tpath.push(replacement.id);\n\n\t\t// note: in nested `this.parseString`, parse only the new substring for any replacements, don't reparse the whole string\n\t\tif (replaceKeyName && typeof propertyName === 'string') {\n\t\t\tconst value = object[propertyName];\n\t\t\tconst newKey = propertyName.replaceAll(replacement.id, data.value);\n\t\t\tdelete object[propertyName];\n\t\t\tobject[newKey] = value;\n\t\t\tthis._renameKeyInLocations(object, propertyName, newKey);\n\t\t\tthis.parseString(object, newKey, data.value, true, path);\n\t\t} else {\n\t\t\tobject[propertyName] = object[propertyName].replaceAll(replacement.id, data.value);\n\t\t\tthis.parseString(object, propertyName, data.value, false, path);\n\t\t}\n\n\t\tpath.pop();\n\t}\n\n\tprivate _renameKeyInLocations(obj: object, oldKey: string, newKey: string) {\n\t\tfor (const location of this.locations.values()) {\n\t\t\tfor (const loc of location.locations) {\n\t\t\t\tif (loc.object === obj && loc.propertyName === oldKey) {\n\t\t\t\t\tloc.propertyName = newKey;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic toObject(): T {\n\t\t// If we wrapped a string, unwrap it\n\t\tif (this.stringRoot) {\n\t\t\treturn (this.root as any).value as T;\n\t\t}\n\n\t\treturn this.root;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IStringDictionary } from '../../../../base/common/collections.js';\nimport { normalizeDriveLetter } from '../../../../base/common/labels.js';\nimport * as paths from '../../../../base/common/path.js';\nimport { IProcessEnvironment, isWindows } from '../../../../base/common/platform.js';\nimport * as process from '../../../../base/common/process.js';\nimport * as types from '../../../../base/common/types.js';\nimport { URI as uri } from '../../../../base/common/uri.js';\nimport { localize } from '../../../../nls.js';\nimport { ILabelService } from '../../../../platform/label/common/label.js';\nimport { IWorkspaceFolderData } from '../../../../platform/workspace/common/workspace.js';\nimport { allVariableKinds, IConfigurationResolverService, VariableError, VariableKind } from './configurationResolver.js';\nimport { ConfigurationResolverExpression, IResolvedValue, Replacement } from './configurationResolverExpression.js';\n\ninterface IVariableResolveContext {\n\tgetFolderUri(folderName: string): uri | undefined;\n\tgetWorkspaceFolderCount(): number;\n\tgetConfigurationValue(folderUri: uri | undefined, section: string): string | undefined;\n\tgetAppRoot(): string | undefined;\n\tgetExecPath(): string | undefined;\n\tgetFilePath(): string | undefined;\n\tgetWorkspaceFolderPathForFile?(): string | undefined;\n\tgetSelectedText(): string | undefined;\n\tgetLineNumber(): string | undefined;\n\tgetColumnNumber(): string | undefined;\n\tgetExtension(id: string): Promise<{ readonly extensionLocation: uri } | undefined>;\n}\n\ntype Environment = { env: IProcessEnvironment | undefined; userHome: string | undefined };\n\nexport abstract class AbstractVariableResolverService implements IConfigurationResolverService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate _context: IVariableResolveContext;\n\tprivate _labelService?: ILabelService;\n\tprivate _envVariablesPromise?: Promise<IProcessEnvironment>;\n\tprivate _userHomePromise?: Promise<string>;\n\tprotected _contributedVariables: Map<string, () => Promise<string | undefined>> = new Map();\n\n\tpublic readonly resolvableVariables = new Set<string>(allVariableKinds);\n\n\tconstructor(_context: IVariableResolveContext, _labelService?: ILabelService, _userHomePromise?: Promise<string>, _envVariablesPromise?: Promise<IProcessEnvironment>) {\n\t\tthis._context = _context;\n\t\tthis._labelService = _labelService;\n\t\tthis._userHomePromise = _userHomePromise;\n\t\tif (_envVariablesPromise) {\n\t\t\tthis._envVariablesPromise = _envVariablesPromise.then(envVariables => {\n\t\t\t\treturn this.prepareEnv(envVariables);\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate prepareEnv(envVariables: IProcessEnvironment): IProcessEnvironment {\n\t\t// windows env variables are case insensitive\n\t\tif (isWindows) {\n\t\t\tconst ev: IProcessEnvironment = Object.create(null);\n\t\t\tObject.keys(envVariables).forEach(key => {\n\t\t\t\tev[key.toLowerCase()] = envVariables[key];\n\t\t\t});\n\t\t\treturn ev;\n\t\t}\n\t\treturn envVariables;\n\t}\n\n\tpublic async resolveWithEnvironment(environment: IProcessEnvironment, folder: IWorkspaceFolderData | undefined, value: string): Promise<string> {\n\t\tconst expr = ConfigurationResolverExpression.parse(value);\n\n\t\tfor (const replacement of expr.unresolved()) {\n\t\t\tconst resolvedValue = await this.evaluateSingleVariable(replacement, folder?.uri, environment);\n\t\t\tif (resolvedValue !== undefined) {\n\t\t\t\texpr.resolve(replacement, String(resolvedValue));\n\t\t\t}\n\t\t}\n\n\t\treturn expr.toObject();\n\t}\n\n\tpublic async resolveAsync<T>(folder: IWorkspaceFolderData | undefined, config: T): Promise<T extends ConfigurationResolverExpression<infer R> ? R : T> {\n\t\tconst expr = ConfigurationResolverExpression.parse(config);\n\n\t\tfor (const replacement of expr.unresolved()) {\n\t\t\tconst resolvedValue = await this.evaluateSingleVariable(replacement, folder?.uri);\n\t\t\tif (resolvedValue !== undefined) {\n\t\t\t\texpr.resolve(replacement, String(resolvedValue));\n\t\t\t}\n\t\t}\n\n\t\treturn expr.toObject() as any;\n\t}\n\n\tpublic resolveWithInteractionReplace(folder: IWorkspaceFolderData | undefined, config: any): Promise<any> {\n\t\tthrow new Error('resolveWithInteractionReplace not implemented.');\n\t}\n\n\tpublic resolveWithInteraction(folder: IWorkspaceFolderData | undefined, config: any): Promise<Map<string, string> | undefined> {\n\t\tthrow new Error('resolveWithInteraction not implemented.');\n\t}\n\n\tpublic contributeVariable(variable: string, resolution: () => Promise<string | undefined>): void {\n\t\tif (this._contributedVariables.has(variable)) {\n\t\t\tthrow new Error('Variable ' + variable + ' is contributed twice.');\n\t\t} else {\n\t\t\tthis.resolvableVariables.add(variable);\n\t\t\tthis._contributedVariables.set(variable, resolution);\n\t\t}\n\t}\n\n\tprivate fsPath(displayUri: uri): string {\n\t\treturn this._labelService ? this._labelService.getUriLabel(displayUri, { noPrefix: true }) : displayUri.fsPath;\n\t}\n\n\tprotected async evaluateSingleVariable(replacement: Replacement, folderUri: uri | undefined, processEnvironment?: IProcessEnvironment, commandValueMapping?: IStringDictionary<IResolvedValue>): Promise<IResolvedValue | string | undefined> {\n\n\n\t\tconst environment: Environment = {\n\t\t\tenv: (processEnvironment !== undefined) ? this.prepareEnv(processEnvironment) : await this._envVariablesPromise,\n\t\t\tuserHome: (processEnvironment !== undefined) ? undefined : await this._userHomePromise\n\t\t};\n\n\t\tconst { name: variable, arg: argument } = replacement;\n\n\t\t// common error handling for all variables that require an open editor\n\t\tconst getFilePath = (variableKind: VariableKind): string => {\n\t\t\tconst filePath = this._context.getFilePath();\n\t\t\tif (filePath) {\n\t\t\t\treturn normalizeDriveLetter(filePath);\n\t\t\t}\n\t\t\tthrow new VariableError(variableKind, (localize('canNotResolveFile', \"Variable {0} can not be resolved. Please open an editor.\", replacement.id)));\n\t\t};\n\n\t\t// common error handling for all variables that require an open editor\n\t\tconst getFolderPathForFile = (variableKind: VariableKind): string => {\n\t\t\tconst filePath = getFilePath(variableKind);\t\t// throws error if no editor open\n\t\t\tif (this._context.getWorkspaceFolderPathForFile) {\n\t\t\t\tconst folderPath = this._context.getWorkspaceFolderPathForFile();\n\t\t\t\tif (folderPath) {\n\t\t\t\t\treturn normalizeDriveLetter(folderPath);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow new VariableError(variableKind, localize('canNotResolveFolderForFile', \"Variable {0}: can not find workspace folder of '{1}'.\", replacement.id, paths.basename(filePath)));\n\t\t};\n\n\t\t// common error handling for all variables that require an open folder and accept a folder name argument\n\t\tconst getFolderUri = (variableKind: VariableKind): uri => {\n\t\t\tif (argument) {\n\t\t\t\tconst folder = this._context.getFolderUri(argument);\n\t\t\t\tif (folder) {\n\t\t\t\t\treturn folder;\n\t\t\t\t}\n\t\t\t\tthrow new VariableError(variableKind, localize('canNotFindFolder', \"Variable {0} can not be resolved. No such folder '{1}'.\", variableKind, argument));\n\t\t\t}\n\n\t\t\tif (folderUri) {\n\t\t\t\treturn folderUri;\n\t\t\t}\n\n\t\t\tif (this._context.getWorkspaceFolderCount() > 1) {\n\t\t\t\tthrow new VariableError(variableKind, localize('canNotResolveWorkspaceFolderMultiRoot', \"Variable {0} can not be resolved in a multi folder workspace. Scope this variable using ':' and a workspace folder name.\", variableKind));\n\t\t\t}\n\t\t\tthrow new VariableError(variableKind, localize('canNotResolveWorkspaceFolder', \"Variable {0} can not be resolved. Please open a folder.\", variableKind));\n\t\t};\n\n\t\tswitch (variable) {\n\t\t\tcase 'env':\n\t\t\t\tif (argument) {\n\t\t\t\t\tif (environment.env) {\n\t\t\t\t\t\tconst env = environment.env[isWindows ? argument.toLowerCase() : argument];\n\t\t\t\t\t\tif (types.isString(env)) {\n\t\t\t\t\t\t\treturn env;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn '';\n\t\t\t\t}\n\t\t\t\tthrow new VariableError(VariableKind.Env, localize('missingEnvVarName', \"Variable {0} can not be resolved because no environment variable name is given.\", replacement.id));\n\n\t\t\tcase 'config':\n\t\t\t\tif (argument) {\n\t\t\t\t\tconst config = this._context.getConfigurationValue(folderUri, argument);\n\t\t\t\t\tif (types.isUndefinedOrNull(config)) {\n\t\t\t\t\t\tthrow new VariableError(VariableKind.Config, localize('configNotFound', \"Variable {0} can not be resolved because setting '{1}' not found.\", replacement.id, argument));\n\t\t\t\t\t}\n\t\t\t\t\tif (types.isObject(config)) {\n\t\t\t\t\t\tthrow new VariableError(VariableKind.Config, localize('configNoString', \"Variable {0} can not be resolved because '{1}' is a structured value.\", replacement.id, argument));\n\t\t\t\t\t}\n\t\t\t\t\treturn config;\n\t\t\t\t}\n\t\t\t\tthrow new VariableError(VariableKind.Config, localize('missingConfigName', \"Variable {0} can not be resolved because no settings name is given.\", replacement.id));\n\n\t\t\tcase 'command':\n\t\t\t\treturn this.resolveFromMap(VariableKind.Command, replacement.id, argument, commandValueMapping, 'command');\n\n\t\t\tcase 'input':\n\t\t\t\treturn this.resolveFromMap(VariableKind.Input, replacement.id, argument, commandValueMapping, 'input');\n\n\t\t\tcase 'extensionInstallFolder':\n\t\t\t\tif (argument) {\n\t\t\t\t\tconst ext = await this._context.getExtension(argument);\n\t\t\t\t\tif (!ext) {\n\t\t\t\t\t\tthrow new VariableError(VariableKind.ExtensionInstallFolder, localize('extensionNotInstalled', \"Variable {0} can not be resolved because the extension {1} is not installed.\", replacement.id, argument));\n\t\t\t\t\t}\n\t\t\t\t\treturn this.fsPath(ext.extensionLocation);\n\t\t\t\t}\n\t\t\t\tthrow new VariableError(VariableKind.ExtensionInstallFolder, localize('missingExtensionName', \"Variable {0} can not be resolved because no extension name is given.\", replacement.id));\n\n\t\t\tdefault: {\n\t\t\t\tswitch (variable) {\n\t\t\t\t\tcase 'workspaceRoot':\n\t\t\t\t\tcase 'workspaceFolder': {\n\t\t\t\t\t\tconst uri = getFolderUri(VariableKind.WorkspaceFolder);\n\t\t\t\t\t\treturn uri ? normalizeDriveLetter(this.fsPath(uri)) : undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'cwd': {\n\t\t\t\t\t\tif (!folderUri && !argument) {\n\t\t\t\t\t\t\treturn process.cwd();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst uri = getFolderUri(VariableKind.Cwd);\n\t\t\t\t\t\treturn uri ? normalizeDriveLetter(this.fsPath(uri)) : undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'workspaceRootFolderName':\n\t\t\t\t\tcase 'workspaceFolderBasename': {\n\t\t\t\t\t\tconst uri = getFolderUri(VariableKind.WorkspaceFolderBasename);\n\t\t\t\t\t\treturn uri ? normalizeDriveLetter(paths.basename(this.fsPath(uri))) : undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'userHome':\n\t\t\t\t\t\tif (environment.userHome) {\n\t\t\t\t\t\t\treturn environment.userHome;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new VariableError(VariableKind.UserHome, localize('canNotResolveUserHome', \"Variable {0} can not be resolved. UserHome path is not defined\", replacement.id));\n\n\t\t\t\t\tcase 'lineNumber': {\n\t\t\t\t\t\tconst lineNumber = this._context.getLineNumber();\n\t\t\t\t\t\tif (lineNumber) {\n\t\t\t\t\t\t\treturn lineNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new VariableError(VariableKind.LineNumber, localize('canNotResolveLineNumber', \"Variable {0} can not be resolved. Make sure to have a line selected in the active editor.\", replacement.id));\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'columnNumber': {\n\t\t\t\t\t\tconst columnNumber = this._context.getColumnNumber();\n\t\t\t\t\t\tif (columnNumber) {\n\t\t\t\t\t\t\treturn columnNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new Error(localize('canNotResolveColumnNumber', \"Variable {0} can not be resolved. Make sure to have a column selected in the active editor.\", replacement.id));\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'selectedText': {\n\t\t\t\t\t\tconst selectedText = this._context.getSelectedText();\n\t\t\t\t\t\tif (selectedText) {\n\t\t\t\t\t\t\treturn selectedText;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new VariableError(VariableKind.SelectedText, localize('canNotResolveSelectedText', \"Variable {0} can not be resolved. Make sure to have some text selected in the active editor.\", replacement.id));\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'file':\n\t\t\t\t\t\treturn getFilePath(VariableKind.File);\n\n\t\t\t\t\tcase 'fileWorkspaceFolder':\n\t\t\t\t\t\treturn getFolderPathForFile(VariableKind.FileWorkspaceFolder);\n\n\t\t\t\t\tcase 'fileWorkspaceFolderBasename':\n\t\t\t\t\t\treturn paths.basename(getFolderPathForFile(VariableKind.FileWorkspaceFolderBasename));\n\n\t\t\t\t\tcase 'relativeFile':\n\t\t\t\t\t\tif (folderUri || argument) {\n\t\t\t\t\t\t\treturn paths.relative(this.fsPath(getFolderUri(VariableKind.RelativeFile)), getFilePath(VariableKind.RelativeFile));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn getFilePath(VariableKind.RelativeFile);\n\n\t\t\t\t\tcase 'relativeFileDirname': {\n\t\t\t\t\t\tconst dirname = paths.dirname(getFilePath(VariableKind.RelativeFileDirname));\n\t\t\t\t\t\tif (folderUri || argument) {\n\t\t\t\t\t\t\tconst relative = paths.relative(this.fsPath(getFolderUri(VariableKind.RelativeFileDirname)), dirname);\n\t\t\t\t\t\t\treturn relative.length === 0 ? '.' : relative;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn dirname;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'fileDirname':\n\t\t\t\t\t\treturn paths.dirname(getFilePath(VariableKind.FileDirname));\n\n\t\t\t\t\tcase 'fileExtname':\n\t\t\t\t\t\treturn paths.extname(getFilePath(VariableKind.FileExtname));\n\n\t\t\t\t\tcase 'fileBasename':\n\t\t\t\t\t\treturn paths.basename(getFilePath(VariableKind.FileBasename));\n\n\t\t\t\t\tcase 'fileBasenameNoExtension': {\n\t\t\t\t\t\tconst basename = paths.basename(getFilePath(VariableKind.FileBasenameNoExtension));\n\t\t\t\t\t\treturn (basename.slice(0, basename.length - paths.extname(basename).length));\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'fileDirnameBasename':\n\t\t\t\t\t\treturn paths.basename(paths.dirname(getFilePath(VariableKind.FileDirnameBasename)));\n\n\t\t\t\t\tcase 'execPath': {\n\t\t\t\t\t\tconst ep = this._context.getExecPath();\n\t\t\t\t\t\tif (ep) {\n\t\t\t\t\t\t\treturn ep;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn replacement.id;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'execInstallFolder': {\n\t\t\t\t\t\tconst ar = this._context.getAppRoot();\n\t\t\t\t\t\tif (ar) {\n\t\t\t\t\t\t\treturn ar;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn replacement.id;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'pathSeparator':\n\t\t\t\t\tcase '/':\n\t\t\t\t\t\treturn paths.sep;\n\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn this.resolveFromMap(VariableKind.Unknown, replacement.id, argument, commandValueMapping, undefined);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\treturn replacement.id;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate resolveFromMap(variableKind: VariableKind, match: string, argument: string | undefined, commandValueMapping: IStringDictionary<IResolvedValue> | undefined, prefix: string | undefined): string {\n\t\tif (argument && commandValueMapping) {\n\t\t\tconst v = (prefix === undefined) ? commandValueMapping[argument] : commandValueMapping[prefix + ':' + argument];\n\t\t\tif (typeof v === 'string') {\n\t\t\t\treturn v;\n\t\t\t}\n\t\t\tthrow new VariableError(variableKind, localize('noValueForCommand', \"Variable {0} can not be resolved because the command has no value.\", match));\n\t\t}\n\t\treturn match;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as os from 'os';\nimport { Emitter, Event } from '../../base/common/event.js';\nimport { cloneAndChange } from '../../base/common/objects.js';\nimport { Disposable } from '../../base/common/lifecycle.js';\nimport * as path from '../../base/common/path.js';\nimport * as platform from '../../base/common/platform.js';\nimport { URI } from '../../base/common/uri.js';\nimport { IURITransformer } from '../../base/common/uriIpc.js';\nimport { IServerChannel } from '../../base/parts/ipc/common/ipc.js';\nimport { createRandomIPCHandle } from '../../base/parts/ipc/node/ipc.net.js';\nimport { RemoteAgentConnectionContext } from '../../platform/remote/common/remoteAgentEnvironment.js';\nimport { IPtyHostService, IShellLaunchConfig, ITerminalProfile } from '../../platform/terminal/common/terminal.js';\nimport { IGetTerminalLayoutInfoArgs, ISetTerminalLayoutInfoArgs } from '../../platform/terminal/common/terminalProcess.js';\nimport { IWorkspaceFolder } from '../../platform/workspace/common/workspace.js';\nimport { createURITransformer } from '../../workbench/api/node/uriTransformer.js';\nimport { CLIServerBase, ICommandsExecuter } from '../../workbench/api/node/extHostCLIServer.js';\nimport { IEnvironmentVariableCollection } from '../../platform/terminal/common/environmentVariable.js';\nimport { MergedEnvironmentVariableCollection } from '../../platform/terminal/common/environmentVariableCollection.js';\nimport { deserializeEnvironmentDescriptionMap, deserializeEnvironmentVariableCollection } from '../../platform/terminal/common/environmentVariableShared.js';\nimport { ICreateTerminalProcessArguments, ICreateTerminalProcessResult, IWorkspaceFolderData, RemoteTerminalChannelEvent, RemoteTerminalChannelRequest } from '../../workbench/contrib/terminal/common/remote/terminal.js';\nimport * as terminalEnvironment from '../../workbench/contrib/terminal/common/terminalEnvironment.js';\nimport { AbstractVariableResolverService } from '../../workbench/services/configurationResolver/common/variableResolver.js';\nimport { buildUserEnvironment } from './extensionHostConnection.js';\nimport { IServerEnvironmentService } from './serverEnvironmentService.js';\nimport { IProductService } from '../../platform/product/common/productService.js';\nimport { IExtensionManagementService } from '../../platform/extensionManagement/common/extensionManagement.js';\nimport { IConfigurationService } from '../../platform/configuration/common/configuration.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { promiseWithResolvers } from '../../base/common/async.js';\nimport { shouldUseEnvironmentVariableCollection } from '../../platform/terminal/common/terminalEnvironment.js';\n\nclass CustomVariableResolver extends AbstractVariableResolverService {\n\tconstructor(\n\t\tenv: platform.IProcessEnvironment,\n\t\tworkspaceFolders: IWorkspaceFolder[],\n\t\tactiveFileResource: URI | undefined,\n\t\tresolvedVariables: { [name: string]: string },\n\t\textensionService: IExtensionManagementService,\n\t) {\n\t\tsuper({\n\t\t\tgetFolderUri: (folderName: string): URI | undefined => {\n\t\t\t\tconst found = workspaceFolders.filter(f => f.name === folderName);\n\t\t\t\tif (found && found.length > 0) {\n\t\t\t\t\treturn found[0].uri;\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t\tgetWorkspaceFolderCount: (): number => {\n\t\t\t\treturn workspaceFolders.length;\n\t\t\t},\n\t\t\tgetConfigurationValue: (folderUri: URI, section: string): string | undefined => {\n\t\t\t\treturn resolvedVariables[`config:${section}`];\n\t\t\t},\n\t\t\tgetExecPath: (): string | undefined => {\n\t\t\t\treturn env['VSCODE_EXEC_PATH'];\n\t\t\t},\n\t\t\tgetAppRoot: (): string | undefined => {\n\t\t\t\treturn env['VSCODE_CWD'];\n\t\t\t},\n\t\t\tgetFilePath: (): string | undefined => {\n\t\t\t\tif (activeFileResource) {\n\t\t\t\t\treturn path.normalize(activeFileResource.fsPath);\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t\tgetSelectedText: (): string | undefined => {\n\t\t\t\treturn resolvedVariables['selectedText'];\n\t\t\t},\n\t\t\tgetLineNumber: (): string | undefined => {\n\t\t\t\treturn resolvedVariables['lineNumber'];\n\t\t\t},\n\t\t\tgetColumnNumber: (): string | undefined => {\n\t\t\t\treturn resolvedVariables['columnNumber'];\n\t\t\t},\n\t\t\tgetExtension: async id => {\n\t\t\t\tconst installed = await extensionService.getInstalled();\n\t\t\t\tconst found = installed.find(e => e.identifier.id === id);\n\t\t\t\treturn found && { extensionLocation: found.location };\n\t\t\t},\n\t\t}, undefined, Promise.resolve(os.homedir()), Promise.resolve(env));\n\t}\n}\n\nexport class RemoteTerminalChannel extends Disposable implements IServerChannel<RemoteAgentConnectionContext> {\n\n\tprivate _lastReqId = 0;\n\tprivate readonly _pendingCommands = new Map<number, {\n\t\tresolve: (data: any) => void;\n\t\treject: (err: any) => void;\n\t\turiTransformer: IURITransformer;\n\t}>();\n\n\tprivate readonly _onExecuteCommand = this._register(new Emitter<{ reqId: number; persistentProcessId: number; commandId: string; commandArgs: any[] }>());\n\treadonly onExecuteCommand = this._onExecuteCommand.event;\n\n\tconstructor(\n\t\tprivate readonly _environmentService: IServerEnvironmentService,\n\t\tprivate readonly _logService: ILogService,\n\t\tprivate readonly _ptyHostService: IPtyHostService,\n\t\tprivate readonly _productService: IProductService,\n\t\tprivate readonly _extensionManagementService: IExtensionManagementService,\n\t\tprivate readonly _configurationService: IConfigurationService\n\t) {\n\t\tsuper();\n\t}\n\n\tasync call(ctx: RemoteAgentConnectionContext, command: RemoteTerminalChannelRequest, args?: any): Promise<any> {\n\t\tswitch (command) {\n\t\t\tcase RemoteTerminalChannelRequest.RestartPtyHost: return this._ptyHostService.restartPtyHost.apply(this._ptyHostService, args);\n\n\t\t\tcase RemoteTerminalChannelRequest.CreateProcess: {\n\t\t\t\tconst uriTransformer = createURITransformer(ctx.remoteAuthority);\n\t\t\t\treturn this._createProcess(uriTransformer, <ICreateTerminalProcessArguments>args);\n\t\t\t}\n\t\t\tcase RemoteTerminalChannelRequest.AttachToProcess: return this._ptyHostService.attachToProcess.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.DetachFromProcess: return this._ptyHostService.detachFromProcess.apply(this._ptyHostService, args);\n\n\t\t\tcase RemoteTerminalChannelRequest.ListProcesses: return this._ptyHostService.listProcesses.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.GetLatency: return this._ptyHostService.getLatency.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.GetPerformanceMarks: return this._ptyHostService.getPerformanceMarks.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.OrphanQuestionReply: return this._ptyHostService.orphanQuestionReply.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.AcceptPtyHostResolvedVariables: return this._ptyHostService.acceptPtyHostResolvedVariables.apply(this._ptyHostService, args);\n\n\t\t\tcase RemoteTerminalChannelRequest.Start: return this._ptyHostService.start.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.Input: return this._ptyHostService.input.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.SendSignal: return this._ptyHostService.sendSignal.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.AcknowledgeDataEvent: return this._ptyHostService.acknowledgeDataEvent.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.Shutdown: return this._ptyHostService.shutdown.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.Resize: return this._ptyHostService.resize.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.ClearBuffer: return this._ptyHostService.clearBuffer.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.GetInitialCwd: return this._ptyHostService.getInitialCwd.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.GetCwd: return this._ptyHostService.getCwd.apply(this._ptyHostService, args);\n\n\t\t\tcase RemoteTerminalChannelRequest.ProcessBinary: return this._ptyHostService.processBinary.apply(this._ptyHostService, args);\n\n\t\t\tcase RemoteTerminalChannelRequest.SendCommandResult: return this._sendCommandResult(args[0], args[1], args[2]);\n\t\t\tcase RemoteTerminalChannelRequest.InstallAutoReply: return this._ptyHostService.installAutoReply.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.UninstallAllAutoReplies: return this._ptyHostService.uninstallAllAutoReplies.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.GetDefaultSystemShell: return this._getDefaultSystemShell.apply(this, args);\n\t\t\tcase RemoteTerminalChannelRequest.GetProfiles: return this._getProfiles.apply(this, args);\n\t\t\tcase RemoteTerminalChannelRequest.GetEnvironment: return this._getEnvironment();\n\t\t\tcase RemoteTerminalChannelRequest.GetWslPath: return this._getWslPath(args[0], args[1]);\n\t\t\tcase RemoteTerminalChannelRequest.GetTerminalLayoutInfo: return this._ptyHostService.getTerminalLayoutInfo(<IGetTerminalLayoutInfoArgs>args);\n\t\t\tcase RemoteTerminalChannelRequest.SetTerminalLayoutInfo: return this._ptyHostService.setTerminalLayoutInfo(<ISetTerminalLayoutInfoArgs>args);\n\t\t\tcase RemoteTerminalChannelRequest.SerializeTerminalState: return this._ptyHostService.serializeTerminalState.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.ReviveTerminalProcesses: return this._ptyHostService.reviveTerminalProcesses.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.GetRevivedPtyNewId: return this._ptyHostService.getRevivedPtyNewId.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.SetUnicodeVersion: return this._ptyHostService.setUnicodeVersion.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.ReduceConnectionGraceTime: return this._reduceConnectionGraceTime();\n\t\t\tcase RemoteTerminalChannelRequest.UpdateIcon: return this._ptyHostService.updateIcon.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.UpdateTitle: return this._ptyHostService.updateTitle.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.UpdateProperty: return this._ptyHostService.updateProperty.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.RefreshProperty: return this._ptyHostService.refreshProperty.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.RequestDetachInstance: return this._ptyHostService.requestDetachInstance(args[0], args[1]);\n\t\t\tcase RemoteTerminalChannelRequest.AcceptDetachedInstance: return this._ptyHostService.acceptDetachInstanceReply(args[0], args[1]);\n\t\t\tcase RemoteTerminalChannelRequest.FreePortKillProcess: return this._ptyHostService.freePortKillProcess.apply(this._ptyHostService, args);\n\t\t\tcase RemoteTerminalChannelRequest.AcceptDetachInstanceReply: return this._ptyHostService.acceptDetachInstanceReply.apply(this._ptyHostService, args);\n\t\t}\n\n\t\t// @ts-expect-error Assert command is the `never` type to ensure all messages are handled\n\t\tthrow new Error(`IPC Command ${command} not found`);\n\t}\n\n\tlisten(_: any, event: RemoteTerminalChannelEvent, arg: any): Event<any> {\n\t\tswitch (event) {\n\t\t\tcase RemoteTerminalChannelEvent.OnPtyHostExitEvent: return this._ptyHostService.onPtyHostExit || Event.None;\n\t\t\tcase RemoteTerminalChannelEvent.OnPtyHostStartEvent: return this._ptyHostService.onPtyHostStart || Event.None;\n\t\t\tcase RemoteTerminalChannelEvent.OnPtyHostUnresponsiveEvent: return this._ptyHostService.onPtyHostUnresponsive || Event.None;\n\t\t\tcase RemoteTerminalChannelEvent.OnPtyHostResponsiveEvent: return this._ptyHostService.onPtyHostResponsive || Event.None;\n\t\t\tcase RemoteTerminalChannelEvent.OnPtyHostRequestResolveVariablesEvent: return this._ptyHostService.onPtyHostRequestResolveVariables || Event.None;\n\t\t\tcase RemoteTerminalChannelEvent.OnProcessDataEvent: return this._ptyHostService.onProcessData;\n\t\t\tcase RemoteTerminalChannelEvent.OnProcessReadyEvent: return this._ptyHostService.onProcessReady;\n\t\t\tcase RemoteTerminalChannelEvent.OnProcessExitEvent: return this._ptyHostService.onProcessExit;\n\t\t\tcase RemoteTerminalChannelEvent.OnProcessReplayEvent: return this._ptyHostService.onProcessReplay;\n\t\t\tcase RemoteTerminalChannelEvent.OnProcessOrphanQuestion: return this._ptyHostService.onProcessOrphanQuestion;\n\t\t\tcase RemoteTerminalChannelEvent.OnExecuteCommand: return this.onExecuteCommand;\n\t\t\tcase RemoteTerminalChannelEvent.OnDidRequestDetach: return this._ptyHostService.onDidRequestDetach || Event.None;\n\t\t\tcase RemoteTerminalChannelEvent.OnDidChangeProperty: return this._ptyHostService.onDidChangeProperty;\n\t\t}\n\n\t\t// @ts-expect-error Assert event is the `never` type to ensure all messages are handled\n\t\tthrow new Error(`IPC Command ${event} not found`);\n\t}\n\n\tprivate async _createProcess(uriTransformer: IURITransformer, args: ICreateTerminalProcessArguments): Promise<ICreateTerminalProcessResult> {\n\t\tconst shellLaunchConfig: IShellLaunchConfig = {\n\t\t\tname: args.shellLaunchConfig.name,\n\t\t\texecutable: args.shellLaunchConfig.executable,\n\t\t\targs: args.shellLaunchConfig.args,\n\t\t\tcwd: (\n\t\t\t\ttypeof args.shellLaunchConfig.cwd === 'string' || typeof args.shellLaunchConfig.cwd === 'undefined'\n\t\t\t\t\t? args.shellLaunchConfig.cwd\n\t\t\t\t\t: URI.revive(uriTransformer.transformIncoming(args.shellLaunchConfig.cwd))\n\t\t\t),\n\t\t\tenv: args.shellLaunchConfig.env,\n\t\t\tuseShellEnvironment: args.shellLaunchConfig.useShellEnvironment,\n\t\t\treconnectionProperties: args.shellLaunchConfig.reconnectionProperties,\n\t\t\ttype: args.shellLaunchConfig.type,\n\t\t\tisFeatureTerminal: args.shellLaunchConfig.isFeatureTerminal,\n\t\t\ttabActions: args.shellLaunchConfig.tabActions,\n\t\t\tshellIntegrationEnvironmentReporting: args.shellLaunchConfig.shellIntegrationEnvironmentReporting,\n\t\t};\n\n\n\t\tconst baseEnv = await buildUserEnvironment(args.resolverEnv, !!args.shellLaunchConfig.useShellEnvironment, platform.language, this._environmentService, this._logService, this._configurationService);\n\t\tthis._logService.trace('baseEnv', baseEnv);\n\n\t\tconst reviveWorkspaceFolder = (workspaceData: IWorkspaceFolderData): IWorkspaceFolder => {\n\t\t\treturn {\n\t\t\t\turi: URI.revive(uriTransformer.transformIncoming(workspaceData.uri)),\n\t\t\t\tname: workspaceData.name,\n\t\t\t\tindex: workspaceData.index,\n\t\t\t\ttoResource: () => {\n\t\t\t\t\tthrow new Error('Not implemented');\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t\tconst workspaceFolders = args.workspaceFolders.map(reviveWorkspaceFolder);\n\t\tconst activeWorkspaceFolder = args.activeWorkspaceFolder ? reviveWorkspaceFolder(args.activeWorkspaceFolder) : undefined;\n\t\tconst activeFileResource = args.activeFileResource ? URI.revive(uriTransformer.transformIncoming(args.activeFileResource)) : undefined;\n\t\tconst customVariableResolver = new CustomVariableResolver(baseEnv, workspaceFolders, activeFileResource, args.resolvedVariables, this._extensionManagementService);\n\t\tconst variableResolver = terminalEnvironment.createVariableResolver(activeWorkspaceFolder, process.env, customVariableResolver);\n\n\t\t// Get the initial cwd\n\t\tconst initialCwd = await terminalEnvironment.getCwd(shellLaunchConfig, os.homedir(), variableResolver, activeWorkspaceFolder?.uri, args.configuration['terminal.integrated.cwd'], this._logService);\n\t\tshellLaunchConfig.cwd = initialCwd;\n\n\t\tconst envPlatformKey = platform.isWindows ? 'terminal.integrated.env.windows' : (platform.isMacintosh ? 'terminal.integrated.env.osx' : 'terminal.integrated.env.linux');\n\t\tconst envFromConfig = args.configuration[envPlatformKey];\n\t\tconst env = await terminalEnvironment.createTerminalEnvironment(\n\t\t\tshellLaunchConfig,\n\t\t\tenvFromConfig,\n\t\t\tvariableResolver,\n\t\t\tthis._productService.version,\n\t\t\targs.configuration['terminal.integrated.detectLocale'],\n\t\t\tbaseEnv\n\t\t);\n\n\t\t// Apply extension environment variable collections to the environment\n\t\tif (shouldUseEnvironmentVariableCollection(shellLaunchConfig)) {\n\t\t\tconst entries: [string, IEnvironmentVariableCollection][] = [];\n\t\t\tfor (const [k, v, d] of args.envVariableCollections) {\n\t\t\t\tentries.push([k, { map: deserializeEnvironmentVariableCollection(v), descriptionMap: deserializeEnvironmentDescriptionMap(d) }]);\n\t\t\t}\n\t\t\tconst envVariableCollections = new Map<string, IEnvironmentVariableCollection>(entries);\n\t\t\tconst mergedCollection = new MergedEnvironmentVariableCollection(envVariableCollections);\n\t\t\tconst workspaceFolder = activeWorkspaceFolder ? activeWorkspaceFolder ?? undefined : undefined;\n\t\t\tawait mergedCollection.applyToProcessEnvironment(env, { workspaceFolder }, variableResolver);\n\t\t}\n\n\t\t// Fork the process and listen for messages\n\t\tthis._logService.debug(`Terminal process launching on remote agent`, { shellLaunchConfig, initialCwd, cols: args.cols, rows: args.rows, env });\n\n\t\t// Setup the CLI server to support forwarding commands run from the CLI\n\t\tconst ipcHandlePath = createRandomIPCHandle();\n\t\tenv.VSCODE_IPC_HOOK_CLI = ipcHandlePath;\n\n\t\tconst persistentProcessId = await this._ptyHostService.createProcess(shellLaunchConfig, initialCwd, args.cols, args.rows, args.unicodeVersion, env, baseEnv, args.options, args.shouldPersistTerminal, args.workspaceId, args.workspaceName);\n\t\tconst commandsExecuter: ICommandsExecuter = {\n\t\t\texecuteCommand: <T>(id: string, ...args: any[]): Promise<T> => this._executeCommand(persistentProcessId, id, args, uriTransformer)\n\t\t};\n\t\tconst cliServer = new CLIServerBase(commandsExecuter, this._logService, ipcHandlePath);\n\t\tthis._ptyHostService.onProcessExit(e => e.id === persistentProcessId && cliServer.dispose());\n\n\t\treturn {\n\t\t\tpersistentTerminalId: persistentProcessId,\n\t\t\tresolvedShellLaunchConfig: shellLaunchConfig\n\t\t};\n\t}\n\n\tprivate _executeCommand<T>(persistentProcessId: number, commandId: string, commandArgs: any[], uriTransformer: IURITransformer): Promise<T> {\n\t\tconst { resolve, reject, promise } = promiseWithResolvers<T>();\n\n\t\tconst reqId = ++this._lastReqId;\n\t\tthis._pendingCommands.set(reqId, { resolve, reject, uriTransformer });\n\n\t\tconst serializedCommandArgs = cloneAndChange(commandArgs, (obj) => {\n\t\t\tif (obj && obj.$mid === 1) {\n\t\t\t\t// this is UriComponents\n\t\t\t\treturn uriTransformer.transformOutgoing(obj);\n\t\t\t}\n\t\t\tif (obj && obj instanceof URI) {\n\t\t\t\treturn uriTransformer.transformOutgoingURI(obj);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t});\n\t\tthis._onExecuteCommand.fire({\n\t\t\treqId,\n\t\t\tpersistentProcessId,\n\t\t\tcommandId,\n\t\t\tcommandArgs: serializedCommandArgs\n\t\t});\n\n\t\treturn promise;\n\t}\n\n\tprivate _sendCommandResult(reqId: number, isError: boolean, serializedPayload: any): void {\n\t\tconst data = this._pendingCommands.get(reqId);\n\t\tif (!data) {\n\t\t\treturn;\n\t\t}\n\t\tthis._pendingCommands.delete(reqId);\n\t\tconst payload = cloneAndChange(serializedPayload, (obj) => {\n\t\t\tif (obj && obj.$mid === 1) {\n\t\t\t\t// this is UriComponents\n\t\t\t\treturn data.uriTransformer.transformIncoming(obj);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t});\n\t\tif (isError) {\n\t\t\tdata.reject(payload);\n\t\t} else {\n\t\t\tdata.resolve(payload);\n\t\t}\n\t}\n\n\tprivate _getDefaultSystemShell(osOverride?: platform.OperatingSystem): Promise<string> {\n\t\treturn this._ptyHostService.getDefaultSystemShell(osOverride);\n\t}\n\n\tprivate async _getProfiles(workspaceId: string, profiles: unknown, defaultProfile: unknown, includeDetectedProfiles?: boolean): Promise<ITerminalProfile[]> {\n\t\treturn this._ptyHostService.getProfiles(workspaceId, profiles, defaultProfile, includeDetectedProfiles) || [];\n\t}\n\n\tprivate _getEnvironment(): platform.IProcessEnvironment {\n\t\treturn { ...process.env };\n\t}\n\n\tprivate _getWslPath(original: string, direction: 'unix-to-win' | 'win-to-unix'): Promise<string> {\n\t\treturn this._ptyHostService.getWslPath(original, direction);\n\t}\n\n\n\tprivate _reduceConnectionGraceTime(): Promise<void> {\n\t\treturn this._ptyHostService.reduceConnectionGraceTime();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ConfigurationScope } from '../../../../platform/configuration/common/configurationRegistry.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';\nimport { refineServiceDecorator } from '../../../../platform/instantiation/common/instantiation.js';\nimport { Event } from '../../../../base/common/event.js';\nimport { ResourceMap } from '../../../../base/common/map.js';\nimport { IAnyWorkspaceIdentifier } from '../../../../platform/workspace/common/workspace.js';\n\nexport const FOLDER_CONFIG_FOLDER_NAME = '.vscode';\nexport const FOLDER_SETTINGS_NAME = 'settings';\nexport const FOLDER_SETTINGS_PATH = `${FOLDER_CONFIG_FOLDER_NAME}/${FOLDER_SETTINGS_NAME}.json`;\n\nexport const defaultSettingsSchemaId = 'vscode://schemas/settings/default';\nexport const userSettingsSchemaId = 'vscode://schemas/settings/user';\nexport const profileSettingsSchemaId = 'vscode://schemas/settings/profile';\nexport const machineSettingsSchemaId = 'vscode://schemas/settings/machine';\nexport const workspaceSettingsSchemaId = 'vscode://schemas/settings/workspace';\nexport const folderSettingsSchemaId = 'vscode://schemas/settings/folder';\nexport const launchSchemaId = 'vscode://schemas/launch';\nexport const tasksSchemaId = 'vscode://schemas/tasks';\nexport const mcpSchemaId = 'vscode://schemas/mcp';\n\nexport const APPLICATION_SCOPES = [ConfigurationScope.APPLICATION, ConfigurationScope.APPLICATION_MACHINE];\nexport const PROFILE_SCOPES = [ConfigurationScope.MACHINE, ConfigurationScope.WINDOW, ConfigurationScope.RESOURCE, ConfigurationScope.LANGUAGE_OVERRIDABLE, ConfigurationScope.MACHINE_OVERRIDABLE];\nexport const LOCAL_MACHINE_PROFILE_SCOPES = [ConfigurationScope.WINDOW, ConfigurationScope.RESOURCE, ConfigurationScope.LANGUAGE_OVERRIDABLE];\nexport const LOCAL_MACHINE_SCOPES = [ConfigurationScope.APPLICATION, ...LOCAL_MACHINE_PROFILE_SCOPES];\nexport const REMOTE_MACHINE_SCOPES = [ConfigurationScope.MACHINE, ConfigurationScope.APPLICATION_MACHINE, ConfigurationScope.WINDOW, ConfigurationScope.RESOURCE, ConfigurationScope.LANGUAGE_OVERRIDABLE, ConfigurationScope.MACHINE_OVERRIDABLE];\nexport const WORKSPACE_SCOPES = [ConfigurationScope.WINDOW, ConfigurationScope.RESOURCE, ConfigurationScope.LANGUAGE_OVERRIDABLE, ConfigurationScope.MACHINE_OVERRIDABLE];\nexport const FOLDER_SCOPES = [ConfigurationScope.RESOURCE, ConfigurationScope.LANGUAGE_OVERRIDABLE, ConfigurationScope.MACHINE_OVERRIDABLE];\n\nexport const TASKS_CONFIGURATION_KEY = 'tasks';\nexport const LAUNCH_CONFIGURATION_KEY = 'launch';\nexport const MCP_CONFIGURATION_KEY = 'mcp';\n\nexport const WORKSPACE_STANDALONE_CONFIGURATIONS = Object.create(null);\nWORKSPACE_STANDALONE_CONFIGURATIONS[TASKS_CONFIGURATION_KEY] = `${FOLDER_CONFIG_FOLDER_NAME}/${TASKS_CONFIGURATION_KEY}.json`;\nWORKSPACE_STANDALONE_CONFIGURATIONS[LAUNCH_CONFIGURATION_KEY] = `${FOLDER_CONFIG_FOLDER_NAME}/${LAUNCH_CONFIGURATION_KEY}.json`;\nWORKSPACE_STANDALONE_CONFIGURATIONS[MCP_CONFIGURATION_KEY] = `${FOLDER_CONFIG_FOLDER_NAME}/${MCP_CONFIGURATION_KEY}.json`;\nexport const USER_STANDALONE_CONFIGURATIONS = Object.create(null);\nUSER_STANDALONE_CONFIGURATIONS[TASKS_CONFIGURATION_KEY] = `${TASKS_CONFIGURATION_KEY}.json`;\nUSER_STANDALONE_CONFIGURATIONS[MCP_CONFIGURATION_KEY] = `${MCP_CONFIGURATION_KEY}.json`;\n\nexport type ConfigurationKey = { type: 'defaults' | 'user' | 'workspaces' | 'folder'; key: string };\n\nexport interface IConfigurationCache {\n\n\tneedsCaching(resource: URI): boolean;\n\tread(key: ConfigurationKey): Promise<string>;\n\twrite(key: ConfigurationKey, content: string): Promise<void>;\n\tremove(key: ConfigurationKey): Promise<void>;\n\n}\n\nexport type RestrictedSettings = {\n\tdefault: ReadonlyArray<string>;\n\tapplication?: ReadonlyArray<string>;\n\tuserLocal?: ReadonlyArray<string>;\n\tuserRemote?: ReadonlyArray<string>;\n\tworkspace?: ReadonlyArray<string>;\n\tworkspaceFolder?: ResourceMap<ReadonlyArray<string>>;\n};\n\nexport const IWorkbenchConfigurationService = refineServiceDecorator<IConfigurationService, IWorkbenchConfigurationService>(IConfigurationService);\nexport interface IWorkbenchConfigurationService extends IConfigurationService {\n\t/**\n\t * Restricted settings defined in each configuration target\n\t */\n\treadonly restrictedSettings: RestrictedSettings;\n\n\t/**\n\t * Event that triggers when the restricted settings changes\n\t */\n\treadonly onDidChangeRestrictedSettings: Event<RestrictedSettings>;\n\n\t/**\n\t * A promise that resolves when the remote configuration is loaded in a remote window.\n\t * The promise is resolved immediately if the window is not remote.\n\t */\n\twhenRemoteConfigurationLoaded(): Promise<void>;\n\n\t/**\n\t * Initialize configuration service for the given workspace\n\t * @param arg workspace Identifier\n\t */\n\tinitialize(arg: IAnyWorkspaceIdentifier): Promise<void>;\n\n\t/**\n\t * Returns true if the setting can be applied for all profiles otherwise false.\n\t * @param setting\n\t */\n\tisSettingAppliedForAllProfiles(setting: string): boolean;\n}\n\nexport const TASKS_DEFAULT = '{\\n\\t\\\"version\\\": \\\"2.0.0\\\",\\n\\t\\\"tasks\\\": []\\n}';\n\nexport const APPLY_ALL_PROFILES_SETTING = 'workbench.settings.applyToAllProfiles';\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { IDisposable } from '../../../base/common/lifecycle.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { IWorkspace, ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from '../../workspace/common/workspace.js';\n\nexport const ILabelService = createDecorator<ILabelService>('labelService');\n\nexport interface ILabelService {\n\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Gets the human readable label for a uri.\n\t * If `relative` is passed returns a label relative to the workspace root that the uri belongs to.\n\t * If `noPrefix` is passed does not tildify the label and also does not prepand the root name for relative labels in a multi root scenario.\n\t * If `separator` is passed, will use that over the defined path separator of the formatter.\n\t * If `appendWorkspaceSuffix` is passed, will append the name of the workspace to the label.\n\t */\n\tgetUriLabel(resource: URI, options?: { relative?: boolean; noPrefix?: boolean; separator?: '/' | '\\\\'; appendWorkspaceSuffix?: boolean }): string;\n\tgetUriBasenameLabel(resource: URI): string;\n\tgetWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | IWorkspace), options?: { verbose: Verbosity }): string;\n\tgetHostLabel(scheme: string, authority?: string): string;\n\tgetHostTooltip(scheme: string, authority?: string): string | undefined;\n\tgetSeparator(scheme: string, authority?: string): '/' | '\\\\';\n\n\tregisterFormatter(formatter: ResourceLabelFormatter): IDisposable;\n\tonDidChangeFormatters: Event<IFormatterChangeEvent>;\n\n\t/**\n\t * Registers a formatter that's cached for the machine beyond the lifecycle\n\t * of the current window. Disposing the formatter _will not_ remove it from\n\t * the cache.\n\t */\n\tregisterCachedFormatter(formatter: ResourceLabelFormatter): IDisposable;\n}\n\nexport const enum Verbosity {\n\tSHORT,\n\tMEDIUM,\n\tLONG\n}\n\nexport interface IFormatterChangeEvent {\n\tscheme: string;\n}\n\nexport interface ResourceLabelFormatter {\n\tscheme: string;\n\tauthority?: string;\n\tpriority?: boolean;\n\tformatting: ResourceLabelFormatting;\n}\n\nexport interface ResourceLabelFormatting {\n\tlabel: string; // myLabel:/${path}\n\tseparator: '/' | '\\\\' | '';\n\ttildify?: boolean;\n\tnormalizeDriveLetter?: boolean;\n\tworkspaceSuffix?: string;\n\tworkspaceTooltip?: string;\n\tauthorityPrefix?: string;\n\tstripPathStartingSeparator?: boolean;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\nimport { Event } from '../../../../base/common/event.js';\nimport { EnvironmentVariableScope, IEnvironmentVariableCollection, IMergedEnvironmentVariableCollection } from '../../../../platform/terminal/common/environmentVariable.js';\nimport { ITerminalStatus } from './terminal.js';\n\nexport const IEnvironmentVariableService = createDecorator<IEnvironmentVariableService>('environmentVariableService');\n\n/**\n * Tracks and persists environment variable collections as defined by extensions.\n */\nexport interface IEnvironmentVariableService {\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Gets a single collection constructed by merging all environment variable collections into\n\t * one.\n\t */\n\treadonly collections: ReadonlyMap<string, IEnvironmentVariableCollection>;\n\n\t/**\n\t * Gets a single collection constructed by merging all environment variable collections into\n\t * one.\n\t */\n\treadonly mergedCollection: IMergedEnvironmentVariableCollection;\n\n\t/**\n\t * An event that is fired when an extension's environment variable collection changes, the event\n\t * provides the new merged collection.\n\t */\n\tonDidChangeCollections: Event<IMergedEnvironmentVariableCollection>;\n\n\t/**\n\t * Sets an extension's environment variable collection.\n\t */\n\tset(extensionIdentifier: string, collection: IEnvironmentVariableCollection): void;\n\n\t/**\n\t * Deletes an extension's environment variable collection.\n\t */\n\tdelete(extensionIdentifier: string): void;\n}\n\nexport interface IEnvironmentVariableCollectionWithPersistence extends IEnvironmentVariableCollection {\n\treadonly persistent: boolean;\n}\n\nexport interface IEnvironmentVariableInfo {\n\treadonly requiresAction: boolean;\n\tgetStatus(scope: EnvironmentVariableScope | undefined): ITerminalStatus;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../../../base/common/event.js';\nimport { URI, UriComponents } from '../../../../../base/common/uri.js';\nimport { IChannel } from '../../../../../base/parts/ipc/common/ipc.js';\nimport { IWorkbenchConfigurationService } from '../../../../services/configuration/common/configuration.js';\nimport { IRemoteAuthorityResolverService } from '../../../../../platform/remote/common/remoteAuthorityResolver.js';\nimport { IWorkspaceContextService } from '../../../../../platform/workspace/common/workspace.js';\nimport { serializeEnvironmentDescriptionMap, serializeEnvironmentVariableCollection } from '../../../../../platform/terminal/common/environmentVariableShared.js';\nimport { IConfigurationResolverService } from '../../../../services/configurationResolver/common/configurationResolver.js';\nimport { SideBySideEditor, EditorResourceAccessor } from '../../../../common/editor.js';\nimport { IEditorService } from '../../../../services/editor/common/editorService.js';\nimport { Schemas } from '../../../../../base/common/network.js';\nimport { ILabelService } from '../../../../../platform/label/common/label.js';\nimport { IEnvironmentVariableService } from '../environmentVariable.js';\nimport { IProcessDataEvent, IRequestResolveVariablesEvent, IShellLaunchConfigDto, ITerminalLaunchError, ITerminalProfile, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalIcon, IProcessProperty, ProcessPropertyType, IProcessPropertyMap, TitleEventSource, ISerializedTerminalState, IPtyHostController, ITerminalProcessOptions, IProcessReadyEvent, ITerminalLogService, IPtyHostLatencyMeasurement } from '../../../../../platform/terminal/common/terminal.js';\nimport { IGetTerminalLayoutInfoArgs, IProcessDetails, ISetTerminalLayoutInfoArgs } from '../../../../../platform/terminal/common/terminalProcess.js';\nimport { IProcessEnvironment, OperatingSystem } from '../../../../../base/common/platform.js';\nimport { ICompleteTerminalConfiguration } from '../terminal.js';\nimport { IPtyHostProcessReplayEvent } from '../../../../../platform/terminal/common/capabilities/capabilities.js';\nimport { ISerializableEnvironmentDescriptionMap as ISerializableEnvironmentDescriptionMap, ISerializableEnvironmentVariableCollection } from '../../../../../platform/terminal/common/environmentVariable.js';\nimport type * as performance from '../../../../../base/common/performance.js';\nimport { RemoteTerminalChannelEvent, RemoteTerminalChannelRequest } from './terminal.js';\nimport { ConfigurationResolverExpression } from '../../../../services/configurationResolver/common/configurationResolverExpression.js';\n\nexport const REMOTE_TERMINAL_CHANNEL_NAME = 'remoteterminal';\n\nexport type ITerminalEnvironmentVariableCollections = [string, ISerializableEnvironmentVariableCollection, ISerializableEnvironmentDescriptionMap][];\n\nexport interface IWorkspaceFolderData {\n\turi: UriComponents;\n\tname: string;\n\tindex: number;\n}\n\nexport interface ICreateTerminalProcessArguments {\n\tconfiguration: ICompleteTerminalConfiguration;\n\tresolvedVariables: { [name: string]: string };\n\tenvVariableCollections: ITerminalEnvironmentVariableCollections;\n\tshellLaunchConfig: IShellLaunchConfigDto;\n\tworkspaceId: string;\n\tworkspaceName: string;\n\tworkspaceFolders: IWorkspaceFolderData[];\n\tactiveWorkspaceFolder: IWorkspaceFolderData | null;\n\tactiveFileResource: UriComponents | undefined;\n\tshouldPersistTerminal: boolean;\n\toptions: ITerminalProcessOptions;\n\tcols: number;\n\trows: number;\n\tunicodeVersion: '6' | '11';\n\tresolverEnv: { [key: string]: string | null } | undefined;\n}\n\nexport interface ICreateTerminalProcessResult {\n\tpersistentTerminalId: number;\n\tresolvedShellLaunchConfig: IShellLaunchConfigDto;\n}\n\nexport class RemoteTerminalChannelClient implements IPtyHostController {\n\tget onPtyHostExit(): Event<number> {\n\t\treturn this._channel.listen<number>(RemoteTerminalChannelEvent.OnPtyHostExitEvent);\n\t}\n\tget onPtyHostStart(): Event<void> {\n\t\treturn this._channel.listen<void>(RemoteTerminalChannelEvent.OnPtyHostStartEvent);\n\t}\n\tget onPtyHostUnresponsive(): Event<void> {\n\t\treturn this._channel.listen<void>(RemoteTerminalChannelEvent.OnPtyHostUnresponsiveEvent);\n\t}\n\tget onPtyHostResponsive(): Event<void> {\n\t\treturn this._channel.listen<void>(RemoteTerminalChannelEvent.OnPtyHostResponsiveEvent);\n\t}\n\tget onPtyHostRequestResolveVariables(): Event<IRequestResolveVariablesEvent> {\n\t\treturn this._channel.listen<IRequestResolveVariablesEvent>(RemoteTerminalChannelEvent.OnPtyHostRequestResolveVariablesEvent);\n\t}\n\tget onProcessData(): Event<{ id: number; event: IProcessDataEvent | string }> {\n\t\treturn this._channel.listen<{ id: number; event: IProcessDataEvent | string }>(RemoteTerminalChannelEvent.OnProcessDataEvent);\n\t}\n\tget onProcessExit(): Event<{ id: number; event: number | undefined }> {\n\t\treturn this._channel.listen<{ id: number; event: number | undefined }>(RemoteTerminalChannelEvent.OnProcessExitEvent);\n\t}\n\tget onProcessReady(): Event<{ id: number; event: IProcessReadyEvent }> {\n\t\treturn this._channel.listen<{ id: number; event: IProcessReadyEvent }>(RemoteTerminalChannelEvent.OnProcessReadyEvent);\n\t}\n\tget onProcessReplay(): Event<{ id: number; event: IPtyHostProcessReplayEvent }> {\n\t\treturn this._channel.listen<{ id: number; event: IPtyHostProcessReplayEvent }>(RemoteTerminalChannelEvent.OnProcessReplayEvent);\n\t}\n\tget onProcessOrphanQuestion(): Event<{ id: number }> {\n\t\treturn this._channel.listen<{ id: number }>(RemoteTerminalChannelEvent.OnProcessOrphanQuestion);\n\t}\n\tget onExecuteCommand(): Event<{ reqId: number; persistentProcessId: number; commandId: string; commandArgs: any[] }> {\n\t\treturn this._channel.listen<{ reqId: number; persistentProcessId: number; commandId: string; commandArgs: any[] }>(RemoteTerminalChannelEvent.OnExecuteCommand);\n\t}\n\tget onDidRequestDetach(): Event<{ requestId: number; workspaceId: string; instanceId: number }> {\n\t\treturn this._channel.listen<{ requestId: number; workspaceId: string; instanceId: number }>(RemoteTerminalChannelEvent.OnDidRequestDetach);\n\t}\n\tget onDidChangeProperty(): Event<{ id: number; property: IProcessProperty<any> }> {\n\t\treturn this._channel.listen<{ id: number; property: IProcessProperty<any> }>(RemoteTerminalChannelEvent.OnDidChangeProperty);\n\t}\n\n\tconstructor(\n\t\tprivate readonly _remoteAuthority: string,\n\t\tprivate readonly _channel: IChannel,\n\t\t@IWorkbenchConfigurationService private readonly _configurationService: IWorkbenchConfigurationService,\n\t\t@IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService,\n\t\t@IConfigurationResolverService private readonly _resolverService: IConfigurationResolverService,\n\t\t@IEnvironmentVariableService private readonly _environmentVariableService: IEnvironmentVariableService,\n\t\t@IRemoteAuthorityResolverService private readonly _remoteAuthorityResolverService: IRemoteAuthorityResolverService,\n\t\t@ITerminalLogService private readonly _logService: ITerminalLogService,\n\t\t@IEditorService private readonly _editorService: IEditorService,\n\t\t@ILabelService private readonly _labelService: ILabelService,\n\t) { }\n\n\trestartPtyHost(): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.RestartPtyHost, []);\n\t}\n\n\tasync createProcess(\n\t\tshellLaunchConfig: IShellLaunchConfigDto,\n\t\tconfiguration: ICompleteTerminalConfiguration,\n\t\tactiveWorkspaceRootUri: URI | undefined,\n\t\toptions: ITerminalProcessOptions,\n\t\tshouldPersistTerminal: boolean,\n\t\tcols: number,\n\t\trows: number,\n\t\tunicodeVersion: '6' | '11'\n\t): Promise<ICreateTerminalProcessResult> {\n\t\t// Be sure to first wait for the remote configuration\n\t\tawait this._configurationService.whenRemoteConfigurationLoaded();\n\n\t\t// We will use the resolver service to resolve all the variables in the config / launch config\n\t\t// But then we will keep only some variables, since the rest need to be resolved on the remote side\n\t\tconst resolvedVariables = Object.create(null);\n\t\tconst lastActiveWorkspace = activeWorkspaceRootUri ? this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri) ?? undefined : undefined;\n\t\tconst expr = ConfigurationResolverExpression.parse({ shellLaunchConfig, configuration });\n\t\ttry {\n\t\t\tawait this._resolverService.resolveAsync(lastActiveWorkspace, expr);\n\t\t} catch (err) {\n\t\t\tthis._logService.error(err);\n\t\t}\n\t\tfor (const [{ inner }, resolved] of expr.resolved()) {\n\t\t\tif (/^config:/.test(inner) || inner === 'selectedText' || inner === 'lineNumber') {\n\t\t\t\tresolvedVariables[inner] = resolved.value;\n\t\t\t}\n\t\t}\n\n\t\tconst envVariableCollections: ITerminalEnvironmentVariableCollections = [];\n\t\tfor (const [k, v] of this._environmentVariableService.collections.entries()) {\n\t\t\tenvVariableCollections.push([k, serializeEnvironmentVariableCollection(v.map), serializeEnvironmentDescriptionMap(v.descriptionMap)]);\n\t\t}\n\n\t\tconst resolverResult = await this._remoteAuthorityResolverService.resolveAuthority(this._remoteAuthority);\n\t\tconst resolverEnv = resolverResult.options && resolverResult.options.extensionHostEnv;\n\n\t\tconst workspace = this._workspaceContextService.getWorkspace();\n\t\tconst workspaceFolders = workspace.folders;\n\t\tconst activeWorkspaceFolder = activeWorkspaceRootUri ? this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri) : null;\n\n\t\tconst activeFileResource = EditorResourceAccessor.getOriginalUri(this._editorService.activeEditor, {\n\t\t\tsupportSideBySide: SideBySideEditor.PRIMARY,\n\t\t\tfilterByScheme: [Schemas.file, Schemas.vscodeUserData, Schemas.vscodeRemote]\n\t\t});\n\n\t\tconst args: ICreateTerminalProcessArguments = {\n\t\t\tconfiguration,\n\t\t\tresolvedVariables,\n\t\t\tenvVariableCollections,\n\t\t\tshellLaunchConfig,\n\t\t\tworkspaceId: workspace.id,\n\t\t\tworkspaceName: this._labelService.getWorkspaceLabel(workspace),\n\t\t\tworkspaceFolders,\n\t\t\tactiveWorkspaceFolder,\n\t\t\tactiveFileResource,\n\t\t\tshouldPersistTerminal,\n\t\t\toptions,\n\t\t\tcols,\n\t\t\trows,\n\t\t\tunicodeVersion,\n\t\t\tresolverEnv\n\t\t};\n\t\treturn await this._channel.call<ICreateTerminalProcessResult>(RemoteTerminalChannelRequest.CreateProcess, args);\n\t}\n\n\trequestDetachInstance(workspaceId: string, instanceId: number): Promise<IProcessDetails | undefined> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.RequestDetachInstance, [workspaceId, instanceId]);\n\t}\n\tacceptDetachInstanceReply(requestId: number, persistentProcessId: number): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.AcceptDetachInstanceReply, [requestId, persistentProcessId]);\n\t}\n\tattachToProcess(id: number): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.AttachToProcess, [id]);\n\t}\n\tdetachFromProcess(id: number, forcePersist?: boolean): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.DetachFromProcess, [id, forcePersist]);\n\t}\n\tlistProcesses(): Promise<IProcessDetails[]> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.ListProcesses);\n\t}\n\tgetLatency(): Promise<IPtyHostLatencyMeasurement[]> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetLatency);\n\t}\n\tgetPerformanceMarks(): Promise<performance.PerformanceMark[]> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetPerformanceMarks);\n\t}\n\treduceConnectionGraceTime(): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.ReduceConnectionGraceTime);\n\t}\n\tprocessBinary(id: number, data: string): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.ProcessBinary, [id, data]);\n\t}\n\tstart(id: number): Promise<ITerminalLaunchError | { injectedArgs: string[] } | undefined> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.Start, [id]);\n\t}\n\tinput(id: number, data: string): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.Input, [id, data]);\n\t}\n\tsendSignal(id: number, signal: string): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.SendSignal, [id, signal]);\n\t}\n\tacknowledgeDataEvent(id: number, charCount: number): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.AcknowledgeDataEvent, [id, charCount]);\n\t}\n\tsetUnicodeVersion(id: number, version: '6' | '11'): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.SetUnicodeVersion, [id, version]);\n\t}\n\tshutdown(id: number, immediate: boolean): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.Shutdown, [id, immediate]);\n\t}\n\tresize(id: number, cols: number, rows: number): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.Resize, [id, cols, rows]);\n\t}\n\tclearBuffer(id: number): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.ClearBuffer, [id]);\n\t}\n\tgetInitialCwd(id: number): Promise<string> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetInitialCwd, [id]);\n\t}\n\tgetCwd(id: number): Promise<string> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetCwd, [id]);\n\t}\n\torphanQuestionReply(id: number): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.OrphanQuestionReply, [id]);\n\t}\n\tsendCommandResult(reqId: number, isError: boolean, payload: any): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.SendCommandResult, [reqId, isError, payload]);\n\t}\n\tfreePortKillProcess(port: string): Promise<{ port: string; processId: string }> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.FreePortKillProcess, [port]);\n\t}\n\tgetDefaultSystemShell(osOverride?: OperatingSystem): Promise<string> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetDefaultSystemShell, [osOverride]);\n\t}\n\tgetProfiles(profiles: unknown, defaultProfile: unknown, includeDetectedProfiles?: boolean): Promise<ITerminalProfile[]> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetProfiles, [this._workspaceContextService.getWorkspace().id, profiles, defaultProfile, includeDetectedProfiles]);\n\t}\n\tacceptPtyHostResolvedVariables(requestId: number, resolved: string[]): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.AcceptPtyHostResolvedVariables, [requestId, resolved]);\n\t}\n\n\tgetEnvironment(): Promise<IProcessEnvironment> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetEnvironment);\n\t}\n\n\tgetWslPath(original: string, direction: 'unix-to-win' | 'win-to-unix'): Promise<string> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetWslPath, [original, direction]);\n\t}\n\n\tsetTerminalLayoutInfo(layout?: ITerminalsLayoutInfoById): Promise<void> {\n\t\tconst workspace = this._workspaceContextService.getWorkspace();\n\t\tconst args: ISetTerminalLayoutInfoArgs = {\n\t\t\tworkspaceId: workspace.id,\n\t\t\ttabs: layout ? layout.tabs : []\n\t\t};\n\t\treturn this._channel.call<void>(RemoteTerminalChannelRequest.SetTerminalLayoutInfo, args);\n\t}\n\n\tupdateTitle(id: number, title: string, titleSource: TitleEventSource): Promise<string> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.UpdateTitle, [id, title, titleSource]);\n\t}\n\n\tupdateIcon(id: number, userInitiated: boolean, icon: TerminalIcon, color?: string): Promise<string> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.UpdateIcon, [id, userInitiated, icon, color]);\n\t}\n\n\trefreshProperty<T extends ProcessPropertyType>(id: number, property: T): Promise<IProcessPropertyMap[T]> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.RefreshProperty, [id, property]);\n\t}\n\n\tupdateProperty<T extends ProcessPropertyType>(id: number, property: T, value: IProcessPropertyMap[T]): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.UpdateProperty, [id, property, value]);\n\t}\n\n\tgetTerminalLayoutInfo(): Promise<ITerminalsLayoutInfo | undefined> {\n\t\tconst workspace = this._workspaceContextService.getWorkspace();\n\t\tconst args: IGetTerminalLayoutInfoArgs = {\n\t\t\tworkspaceId: workspace.id,\n\t\t};\n\t\treturn this._channel.call<ITerminalsLayoutInfo>(RemoteTerminalChannelRequest.GetTerminalLayoutInfo, args);\n\t}\n\n\treviveTerminalProcesses(workspaceId: string, state: ISerializedTerminalState[], dateTimeFormatLocate: string): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.ReviveTerminalProcesses, [workspaceId, state, dateTimeFormatLocate]);\n\t}\n\n\tgetRevivedPtyNewId(id: number): Promise<number | undefined> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.GetRevivedPtyNewId, [id]);\n\t}\n\n\tserializeTerminalState(ids: number[]): Promise<string> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.SerializeTerminalState, [ids]);\n\t}\n\n\t// #region Pty service contribution RPC calls\n\n\tinstallAutoReply(match: string, reply: string): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.InstallAutoReply, [match, reply]);\n\t}\n\tuninstallAllAutoReplies(): Promise<void> {\n\t\treturn this._channel.call(RemoteTerminalChannelRequest.UninstallAllAutoReplies, []);\n\t}\n\n\t// #endregion\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { toErrorMessage } from '../../../base/common/errorMessage.js';\nimport { canceled } from '../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { newWriteableStream, ReadableStreamEventPayload, ReadableStreamEvents } from '../../../base/common/stream.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { generateUuid } from '../../../base/common/uuid.js';\nimport { IChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { createFileSystemProviderError, IFileAtomicReadOptions, IFileDeleteOptions, IFileOpenOptions, IFileOverwriteOptions, IFileReadStreamOptions, FileSystemProviderCapabilities, FileSystemProviderErrorCode, FileType, IFileWriteOptions, IFileChange, IFileSystemProviderWithFileAtomicReadCapability, IFileSystemProviderWithFileCloneCapability, IFileSystemProviderWithFileFolderCopyCapability, IFileSystemProviderWithFileReadStreamCapability, IFileSystemProviderWithFileReadWriteCapability, IFileSystemProviderWithOpenReadWriteCloseCapability, IStat, IWatchOptions, IFileSystemProviderError } from './files.js';\nimport { reviveFileChanges } from './watcher.js';\n\nexport const LOCAL_FILE_SYSTEM_CHANNEL_NAME = 'localFilesystem';\n\n/**\n * An implementation of a local disk file system provider\n * that is backed by a `IChannel` and thus implemented via\n * IPC on a different process.\n */\nexport class DiskFileSystemProviderClient extends Disposable implements\n\tIFileSystemProviderWithFileReadWriteCapability,\n\tIFileSystemProviderWithOpenReadWriteCloseCapability,\n\tIFileSystemProviderWithFileReadStreamCapability,\n\tIFileSystemProviderWithFileFolderCopyCapability,\n\tIFileSystemProviderWithFileAtomicReadCapability,\n\tIFileSystemProviderWithFileCloneCapability {\n\n\tconstructor(\n\t\tprivate readonly channel: IChannel,\n\t\tprivate readonly extraCapabilities: { trash?: boolean; pathCaseSensitive?: boolean }\n\t) {\n\t\tsuper();\n\n\t\tthis.registerFileChangeListeners();\n\t}\n\n\t//#region File Capabilities\n\n\treadonly onDidChangeCapabilities: Event<void> = Event.None;\n\n\tprivate _capabilities: FileSystemProviderCapabilities | undefined;\n\tget capabilities(): FileSystemProviderCapabilities {\n\t\tif (!this._capabilities) {\n\t\t\tthis._capabilities =\n\t\t\t\tFileSystemProviderCapabilities.FileReadWrite |\n\t\t\t\tFileSystemProviderCapabilities.FileOpenReadWriteClose |\n\t\t\t\tFileSystemProviderCapabilities.FileReadStream |\n\t\t\t\tFileSystemProviderCapabilities.FileFolderCopy |\n\t\t\t\tFileSystemProviderCapabilities.FileWriteUnlock |\n\t\t\t\tFileSystemProviderCapabilities.FileAtomicRead |\n\t\t\t\tFileSystemProviderCapabilities.FileAtomicWrite |\n\t\t\t\tFileSystemProviderCapabilities.FileAtomicDelete |\n\t\t\t\tFileSystemProviderCapabilities.FileClone |\n\t\t\t\tFileSystemProviderCapabilities.FileRealpath;\n\n\t\t\tif (this.extraCapabilities.pathCaseSensitive) {\n\t\t\t\tthis._capabilities |= FileSystemProviderCapabilities.PathCaseSensitive;\n\t\t\t}\n\n\t\t\tif (this.extraCapabilities.trash) {\n\t\t\t\tthis._capabilities |= FileSystemProviderCapabilities.Trash;\n\t\t\t}\n\t\t}\n\n\t\treturn this._capabilities;\n\t}\n\n\t//#endregion\n\n\t//#region File Metadata Resolving\n\n\tstat(resource: URI): Promise<IStat> {\n\t\treturn this.channel.call('stat', [resource]);\n\t}\n\n\trealpath(resource: URI): Promise<string> {\n\t\treturn this.channel.call('realpath', [resource]);\n\t}\n\n\treaddir(resource: URI): Promise<[string, FileType][]> {\n\t\treturn this.channel.call('readdir', [resource]);\n\t}\n\n\t//#endregion\n\n\t//#region File Reading/Writing\n\n\tasync readFile(resource: URI, opts?: IFileAtomicReadOptions): Promise<Uint8Array> {\n\t\tconst { buffer } = await this.channel.call('readFile', [resource, opts]) as VSBuffer;\n\n\t\treturn buffer;\n\t}\n\n\treadFileStream(resource: URI, opts: IFileReadStreamOptions, token: CancellationToken): ReadableStreamEvents<Uint8Array> {\n\t\tconst stream = newWriteableStream<Uint8Array>(data => VSBuffer.concat(data.map(data => VSBuffer.wrap(data))).buffer);\n\t\tconst disposables = new DisposableStore();\n\n\t\t// Reading as file stream goes through an event to the remote side\n\t\tdisposables.add(this.channel.listen<ReadableStreamEventPayload<VSBuffer>>('readFileStream', [resource, opts])(dataOrErrorOrEnd => {\n\n\t\t\t// data\n\t\t\tif (dataOrErrorOrEnd instanceof VSBuffer) {\n\t\t\t\tstream.write(dataOrErrorOrEnd.buffer);\n\t\t\t}\n\n\t\t\t// end or error\n\t\t\telse {\n\t\t\t\tif (dataOrErrorOrEnd === 'end') {\n\t\t\t\t\tstream.end();\n\t\t\t\t} else {\n\t\t\t\t\tlet error: Error;\n\n\t\t\t\t\t// Take Error as is if type matches\n\t\t\t\t\tif (dataOrErrorOrEnd instanceof Error) {\n\t\t\t\t\t\terror = dataOrErrorOrEnd;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Otherwise, try to deserialize into an error.\n\t\t\t\t\t// Since we communicate via IPC, we cannot be sure\n\t\t\t\t\t// that Error objects are properly serialized.\n\t\t\t\t\telse {\n\t\t\t\t\t\tconst errorCandidate = dataOrErrorOrEnd as IFileSystemProviderError;\n\n\t\t\t\t\t\terror = createFileSystemProviderError(errorCandidate.message ?? toErrorMessage(errorCandidate), errorCandidate.code ?? FileSystemProviderErrorCode.Unknown);\n\t\t\t\t\t}\n\n\t\t\t\t\tstream.error(error);\n\t\t\t\t\tstream.end();\n\t\t\t\t}\n\n\t\t\t\t// Signal to the remote side that we no longer listen\n\t\t\t\tdisposables.dispose();\n\t\t\t}\n\t\t}));\n\n\t\t// Support cancellation\n\t\tdisposables.add(token.onCancellationRequested(() => {\n\n\t\t\t// Ensure to end the stream properly with an error\n\t\t\t// to indicate the cancellation.\n\t\t\tstream.error(canceled());\n\t\t\tstream.end();\n\n\t\t\t// Ensure to dispose the listener upon cancellation. This will\n\t\t\t// bubble through the remote side as event and allows to stop\n\t\t\t// reading the file.\n\t\t\tdisposables.dispose();\n\t\t}));\n\n\t\treturn stream;\n\t}\n\n\twriteFile(resource: URI, content: Uint8Array, opts: IFileWriteOptions): Promise<void> {\n\t\treturn this.channel.call('writeFile', [resource, VSBuffer.wrap(content), opts]);\n\t}\n\n\topen(resource: URI, opts: IFileOpenOptions): Promise<number> {\n\t\treturn this.channel.call('open', [resource, opts]);\n\t}\n\n\tclose(fd: number): Promise<void> {\n\t\treturn this.channel.call('close', [fd]);\n\t}\n\n\tasync read(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {\n\t\tconst [bytes, bytesRead]: [VSBuffer, number] = await this.channel.call('read', [fd, pos, length]);\n\n\t\t// copy back the data that was written into the buffer on the remote\n\t\t// side. we need to do this because buffers are not referenced by\n\t\t// pointer, but only by value and as such cannot be directly written\n\t\t// to from the other process.\n\t\tdata.set(bytes.buffer.slice(0, bytesRead), offset);\n\n\t\treturn bytesRead;\n\t}\n\n\twrite(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {\n\t\treturn this.channel.call('write', [fd, pos, VSBuffer.wrap(data), offset, length]);\n\t}\n\n\t//#endregion\n\n\t//#region Move/Copy/Delete/Create Folder\n\n\tmkdir(resource: URI): Promise<void> {\n\t\treturn this.channel.call('mkdir', [resource]);\n\t}\n\n\tdelete(resource: URI, opts: IFileDeleteOptions): Promise<void> {\n\t\treturn this.channel.call('delete', [resource, opts]);\n\t}\n\n\trename(resource: URI, target: URI, opts: IFileOverwriteOptions): Promise<void> {\n\t\treturn this.channel.call('rename', [resource, target, opts]);\n\t}\n\n\tcopy(resource: URI, target: URI, opts: IFileOverwriteOptions): Promise<void> {\n\t\treturn this.channel.call('copy', [resource, target, opts]);\n\t}\n\n\t//#endregion\n\n\t//#region Clone File\n\n\tcloneFile(resource: URI, target: URI): Promise<void> {\n\t\treturn this.channel.call('cloneFile', [resource, target]);\n\t}\n\n\t//#endregion\n\n\t//#region File Watching\n\n\tprivate readonly _onDidChange = this._register(new Emitter<readonly IFileChange[]>());\n\treadonly onDidChangeFile = this._onDidChange.event;\n\n\tprivate readonly _onDidWatchError = this._register(new Emitter<string>());\n\treadonly onDidWatchError = this._onDidWatchError.event;\n\n\t// The contract for file watching via remote is to identify us\n\t// via a unique but readonly session ID. Since the remote is\n\t// managing potentially many watchers from different clients,\n\t// this helps the server to properly partition events to the right\n\t// clients.\n\tprivate readonly sessionId = generateUuid();\n\n\tprivate registerFileChangeListeners(): void {\n\n\t\t// The contract for file changes is that there is one listener\n\t\t// for both events and errors from the watcher. So we need to\n\t\t// unwrap the event from the remote and emit through the proper\n\t\t// emitter.\n\t\tthis._register(this.channel.listen<IFileChange[] | string>('fileChange', [this.sessionId])(eventsOrError => {\n\t\t\tif (Array.isArray(eventsOrError)) {\n\t\t\t\tconst events = eventsOrError;\n\t\t\t\tthis._onDidChange.fire(reviveFileChanges(events));\n\t\t\t} else {\n\t\t\t\tconst error = eventsOrError;\n\t\t\t\tthis._onDidWatchError.fire(error);\n\t\t\t}\n\t\t}));\n\t}\n\n\twatch(resource: URI, opts: IWatchOptions): IDisposable {\n\n\t\t// Generate a request UUID to correlate the watcher\n\t\t// back to us when we ask to dispose the watcher later.\n\t\tconst req = generateUuid();\n\n\t\tthis.channel.call('watch', [this.sessionId, req, resource, opts]);\n\n\t\treturn toDisposable(() => this.channel.call('unwatch', [this.sessionId, req]));\n\t}\n\n\t//#endregion\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { getErrorMessage } from '../../../../base/common/errors.js';\nimport { Disposable, DisposableStore, IDisposable } from '../../../../base/common/lifecycle.js';\nimport { Schemas } from '../../../../base/common/network.js';\nimport { OperatingSystem } from '../../../../base/common/platform.js';\nimport { IFileService } from '../../../../platform/files/common/files.js';\nimport { DiskFileSystemProviderClient } from '../../../../platform/files/common/diskFileSystemProviderClient.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { IRemoteAgentEnvironment } from '../../../../platform/remote/common/remoteAgentEnvironment.js';\nimport { IRemoteAgentConnection, IRemoteAgentService } from './remoteAgentService.js';\n\nexport const REMOTE_FILE_SYSTEM_CHANNEL_NAME = 'remoteFilesystem';\n\nexport class RemoteFileSystemProviderClient extends DiskFileSystemProviderClient {\n\n\tstatic register(remoteAgentService: IRemoteAgentService, fileService: IFileService, logService: ILogService): IDisposable {\n\t\tconst connection = remoteAgentService.getConnection();\n\t\tif (!connection) {\n\t\t\treturn Disposable.None;\n\t\t}\n\n\t\tconst disposables = new DisposableStore();\n\n\t\tconst environmentPromise = (async () => {\n\t\t\ttry {\n\t\t\t\tconst environment = await remoteAgentService.getRawEnvironment();\n\t\t\t\tif (environment) {\n\t\t\t\t\t// Register remote fsp even before it is asked to activate\n\t\t\t\t\t// because, some features (configuration) wait for its\n\t\t\t\t\t// registration before making fs calls.\n\t\t\t\t\tfileService.registerProvider(Schemas.vscodeRemote, disposables.add(new RemoteFileSystemProviderClient(environment, connection)));\n\t\t\t\t} else {\n\t\t\t\t\tlogService.error('Cannot register remote filesystem provider. Remote environment doesnot exist.');\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tlogService.error('Cannot register remote filesystem provider. Error while fetching remote environment.', getErrorMessage(error));\n\t\t\t}\n\t\t})();\n\n\t\tdisposables.add(fileService.onWillActivateFileSystemProvider(e => {\n\t\t\tif (e.scheme === Schemas.vscodeRemote) {\n\t\t\t\te.join(environmentPromise);\n\t\t\t}\n\t\t}));\n\n\t\treturn disposables;\n\t}\n\n\tprivate constructor(remoteAgentEnvironment: IRemoteAgentEnvironment, connection: IRemoteAgentConnection) {\n\t\tsuper(connection.getChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME), { pathCaseSensitive: remoteAgentEnvironment.os === OperatingSystem.Linux });\n\t}\n}\n","import { AppInsightsCore, IExtendedTelemetryItem, ITelemetryItem } from '@microsoft/1ds-core-js';\nimport * as https from 'https';\nimport * as http from 'http';\nimport * as os from 'os';\n\ninterface SystemInfo {\n\tmeasurements: Record<string, number | undefined>;\n\tproperties: Record<string, string | boolean | null | undefined>;\n}\n\nexport class TelemetryClient extends AppInsightsCore {\n\tprivate readonly systemInfo: SystemInfo = {\n\t\tmeasurements: {},\n\t\tproperties: {},\n\t};\n\n\tpublic constructor(\n\t\tprivate readonly endpoint: string,\n\t\tmachineId: string,\n\t\tisContainer: boolean | undefined) {\n\t\tsuper();\n\n\t\t// os.cpus() can take a very long time sometimes (personally I see 1-2\n\t\t// seconds in a Coder workspace).  This adds up significantly, especially\n\t\t// when many telemetry requests are sent during startup, which can cause\n\t\t// connection timeouts.  Try to cache as much as we can.\n\t\ttry {\n\t\t\tconst cpus = os.cpus();\n\t\t\tthis.systemInfo.measurements.cores = cpus.length;\n\t\t\tthis.systemInfo.properties['common.cpuModel'] = cpus[0].model;\n\t\t} catch (error) {}\n\n\t\ttry {\n\t\t\tthis.systemInfo.properties['common.shell'] = os.userInfo().shell;\n\t\t\tthis.systemInfo.properties['common.release'] = os.release();\n\t\t\tthis.systemInfo.properties['common.arch'] = os.arch();\n\t\t} catch (error) {}\n\n\t\tthis.systemInfo.properties['common.remoteMachineId'] = machineId;\n\t\tthis.systemInfo.properties['common.isContainer'] = isContainer;\n\t}\n\n\tpublic override track(item: IExtendedTelemetryItem | ITelemetryItem): void {\n\t\tconst options = item.baseData || {}\n\t\toptions.measurements = {\n\t\t\t...(options.measurements || {}),\n\t\t\t...this.systemInfo.measurements,\n\t\t}\n\t\toptions.properties = {\n\t\t\t...(options.properties || {}),\n\t\t\t...this.systemInfo.properties,\n\t\t}\n\n\t\ttry {\n\t\t\toptions.measurements.memoryFree = os.freemem();\n\t\t\toptions.measurements.memoryTotal = os.totalmem();\n\t\t} catch (error) {}\n\n\t\ttry {\n\t\t\tconst request = (/^http:/.test(this.endpoint) ? http : https).request(this.endpoint, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t},\n\t\t\t});\n\t\t\trequest.on('error', () => { /* We don't care. */ });\n\t\t\trequest.write(JSON.stringify(options));\n\t\t\trequest.end();\n\t\t} catch (error) {}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { AppResourcePath, FileAccess, nodeModulesAsarPath, nodeModulesPath, Schemas, VSCODE_AUTHORITY } from './base/common/network.js';\nimport * as platform from './base/common/platform.js';\nimport { IProductConfiguration } from './base/common/product.js';\nimport { URI } from './base/common/uri.js';\nimport { generateUuid } from './base/common/uuid.js';\n\nexport const canASAR = false; // TODO@esm: ASAR disabled in ESM\n\ndeclare const window: any;\ndeclare const document: any;\ndeclare const self: any;\ndeclare const globalThis: any;\n\nclass DefineCall {\n\tconstructor(\n\t\tpublic readonly id: string | null | undefined,\n\t\tpublic readonly dependencies: string[] | null | undefined,\n\t\tpublic readonly callback: any\n\t) { }\n}\n\nenum AMDModuleImporterState {\n\tUninitialized = 1,\n\tInitializedInternal,\n\tInitializedExternal\n}\n\nclass AMDModuleImporter {\n\tpublic static INSTANCE = new AMDModuleImporter();\n\n\tprivate readonly _isWebWorker = (typeof self === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope');\n\tprivate readonly _isRenderer = typeof document === 'object';\n\n\tprivate readonly _defineCalls: DefineCall[] = [];\n\tprivate _state = AMDModuleImporterState.Uninitialized;\n\tprivate _amdPolicy: Pick<TrustedTypePolicy<{\n\t\tcreateScriptURL(value: string): string;\n\t}>, 'name' | 'createScriptURL'> | undefined;\n\n\tconstructor() { }\n\n\tprivate _initialize(): void {\n\t\tif (this._state === AMDModuleImporterState.Uninitialized) {\n\t\t\tif (globalThis.define) {\n\t\t\t\tthis._state = AMDModuleImporterState.InitializedExternal;\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._state = AMDModuleImporterState.InitializedInternal;\n\n\t\tglobalThis.define = (id: any, dependencies: any, callback: any) => {\n\t\t\tif (typeof id !== 'string') {\n\t\t\t\tcallback = dependencies;\n\t\t\t\tdependencies = id;\n\t\t\t\tid = null;\n\t\t\t}\n\t\t\tif (typeof dependencies !== 'object' || !Array.isArray(dependencies)) {\n\t\t\t\tcallback = dependencies;\n\t\t\t\tdependencies = null;\n\t\t\t}\n\t\t\t// if (!dependencies) {\n\t\t\t// \tdependencies = ['require', 'exports', 'module'];\n\t\t\t// }\n\t\t\tthis._defineCalls.push(new DefineCall(id, dependencies, callback));\n\t\t};\n\n\t\tglobalThis.define.amd = true;\n\n\t\tif (this._isRenderer) {\n\t\t\tthis._amdPolicy = globalThis._VSCODE_WEB_PACKAGE_TTP ?? window.trustedTypes?.createPolicy('amdLoader', {\n\t\t\t\tcreateScriptURL(value: any) {\n\t\t\t\t\tif (value.startsWith(window.location.origin)) {\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t}\n\t\t\t\t\tif (value.startsWith(`${Schemas.vscodeFileResource}://${VSCODE_AUTHORITY}`)) {\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t}\n\t\t\t\t\tthrow new Error(`[trusted_script_src] Invalid script url: ${value}`);\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (this._isWebWorker) {\n\t\t\tthis._amdPolicy = globalThis._VSCODE_WEB_PACKAGE_TTP ?? globalThis.trustedTypes?.createPolicy('amdLoader', {\n\t\t\t\tcreateScriptURL(value: string) {\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic async load<T>(scriptSrc: string): Promise<T> {\n\t\tthis._initialize();\n\n\t\tif (this._state === AMDModuleImporterState.InitializedExternal) {\n\t\t\treturn new Promise<T>(resolve => {\n\t\t\t\tconst tmpModuleId = generateUuid();\n\t\t\t\tglobalThis.define(tmpModuleId, [scriptSrc], function (moduleResult: T) {\n\t\t\t\t\tresolve(moduleResult);\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tconst defineCall = await (this._isWebWorker ? this._workerLoadScript(scriptSrc) : this._isRenderer ? this._rendererLoadScript(scriptSrc) : this._nodeJSLoadScript(scriptSrc));\n\t\tif (!defineCall) {\n\t\t\tconsole.warn(`Did not receive a define call from script ${scriptSrc}`);\n\t\t\treturn <T>undefined;\n\t\t}\n\t\t// TODO@esm require, module\n\t\tconst exports = {};\n\t\tconst dependencyObjs: any[] = [];\n\t\tconst dependencyModules: string[] = [];\n\n\t\tif (Array.isArray(defineCall.dependencies)) {\n\n\t\t\tfor (const mod of defineCall.dependencies) {\n\t\t\t\tif (mod === 'exports') {\n\t\t\t\t\tdependencyObjs.push(exports);\n\t\t\t\t} else {\n\t\t\t\t\tdependencyModules.push(mod);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (dependencyModules.length > 0) {\n\t\t\tthrow new Error(`Cannot resolve dependencies for script ${scriptSrc}. The dependencies are: ${dependencyModules.join(', ')}`);\n\t\t}\n\t\tif (typeof defineCall.callback === 'function') {\n\t\t\treturn defineCall.callback(...dependencyObjs) ?? exports;\n\t\t} else {\n\t\t\treturn defineCall.callback;\n\t\t}\n\t}\n\n\tprivate _rendererLoadScript(scriptSrc: string): Promise<DefineCall | undefined> {\n\t\treturn new Promise<DefineCall | undefined>((resolve, reject) => {\n\t\t\tconst scriptElement = document.createElement('script');\n\t\t\tscriptElement.setAttribute('async', 'async');\n\t\t\tscriptElement.setAttribute('type', 'text/javascript');\n\n\t\t\tconst unbind = () => {\n\t\t\t\tscriptElement.removeEventListener('load', loadEventListener);\n\t\t\t\tscriptElement.removeEventListener('error', errorEventListener);\n\t\t\t};\n\n\t\t\tconst loadEventListener = (e: any) => {\n\t\t\t\tunbind();\n\t\t\t\tresolve(this._defineCalls.pop());\n\t\t\t};\n\n\t\t\tconst errorEventListener = (e: any) => {\n\t\t\t\tunbind();\n\t\t\t\treject(e);\n\t\t\t};\n\n\t\t\tscriptElement.addEventListener('load', loadEventListener);\n\t\t\tscriptElement.addEventListener('error', errorEventListener);\n\t\t\tif (this._amdPolicy) {\n\t\t\t\tscriptSrc = this._amdPolicy.createScriptURL(scriptSrc) as unknown as string;\n\t\t\t}\n\t\t\tscriptElement.setAttribute('src', scriptSrc);\n\t\t\twindow.document.getElementsByTagName('head')[0].appendChild(scriptElement);\n\t\t});\n\t}\n\n\tprivate async _workerLoadScript(scriptSrc: string): Promise<DefineCall | undefined> {\n\t\tif (this._amdPolicy) {\n\t\t\tscriptSrc = this._amdPolicy.createScriptURL(scriptSrc) as unknown as string;\n\t\t}\n\t\tawait import(scriptSrc);\n\t\treturn this._defineCalls.pop();\n\t}\n\n\tprivate async _nodeJSLoadScript(scriptSrc: string): Promise<DefineCall | undefined> {\n\t\ttry {\n\t\t\tconst fs = (await import(`${'fs'}`)).default;\n\t\t\tconst vm = (await import(`${'vm'}`)).default;\n\t\t\tconst module = (await import(`${'module'}`)).default;\n\n\t\t\tconst filePath = URI.parse(scriptSrc).fsPath;\n\t\t\tconst content = fs.readFileSync(filePath).toString();\n\t\t\tconst scriptSource = module.wrap(content.replace(/^#!.*/, ''));\n\t\t\tconst script = new vm.Script(scriptSource);\n\t\t\tconst compileWrapper = script.runInThisContext();\n\t\t\tcompileWrapper.apply();\n\t\t\treturn this._defineCalls.pop();\n\t\t} catch (error) {\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nconst cache = new Map<string, Promise<any>>();\n\n/**\n * Utility for importing an AMD node module. This util supports AMD and ESM contexts and should be used while the ESM adoption\n * is on its way.\n *\n * e.g. pass in `vscode-textmate/release/main.js`\n */\nexport async function importAMDNodeModule<T>(nodeModuleName: string, pathInsideNodeModule: string, isBuilt?: boolean): Promise<T> {\n\tif (isBuilt === undefined) {\n\t\tconst product = globalThis._VSCODE_PRODUCT_JSON as unknown as IProductConfiguration;\n\t\tisBuilt = Boolean((product ?? globalThis.vscode?.context?.configuration()?.product)?.commit);\n\t}\n\n\tconst nodeModulePath = pathInsideNodeModule ? `${nodeModuleName}/${pathInsideNodeModule}` : nodeModuleName;\n\tif (cache.has(nodeModulePath)) {\n\t\treturn cache.get(nodeModulePath)!;\n\t}\n\tlet scriptSrc: string;\n\tif (/^\\w[\\w\\d+.-]*:\\/\\//.test(nodeModulePath)) {\n\t\t// looks like a URL\n\t\t// bit of a special case for: src/vs/workbench/services/languageDetection/browser/languageDetectionWebWorker.ts\n\t\tscriptSrc = nodeModulePath;\n\t} else {\n\t\tconst useASAR = (canASAR && isBuilt && !platform.isWeb);\n\t\tconst actualNodeModulesPath = (useASAR ? nodeModulesAsarPath : nodeModulesPath);\n\t\tconst resourcePath: AppResourcePath = `${actualNodeModulesPath}/${nodeModulePath}`;\n\t\tscriptSrc = FileAccess.asBrowserUri(resourcePath).toString(true);\n\t}\n\tconst result = AMDModuleImporter.INSTANCE.load<T>(scriptSrc);\n\tcache.set(nodeModulePath, result);\n\treturn result;\n}\n\nexport function resolveAmdNodeModulePath(nodeModuleName: string, pathInsideNodeModule: string): string {\n\tconst product = globalThis._VSCODE_PRODUCT_JSON as unknown as IProductConfiguration;\n\tconst isBuilt = Boolean((product ?? globalThis.vscode?.context?.configuration()?.product)?.commit);\n\tconst useASAR = (canASAR && isBuilt && !platform.isWeb);\n\n\tconst nodeModulePath = `${nodeModuleName}/${pathInsideNodeModule}`;\n\tconst actualNodeModulesPath = (useASAR ? nodeModulesAsarPath : nodeModulesPath);\n\tconst resourcePath: AppResourcePath = `${actualNodeModulesPath}/${nodeModulePath}`;\n\treturn FileAccess.asBrowserUri(resourcePath).toString(true);\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { IExtendedConfiguration, IExtendedTelemetryItem, ITelemetryItem, ITelemetryUnloadState } from '@microsoft/1ds-core-js';\nimport type { IChannelConfiguration, IXHROverride, PostChannel } from '@microsoft/1ds-post-js';\nimport { importAMDNodeModule } from '../../../amdX.js';\nimport { onUnexpectedError } from '../../../base/common/errors.js';\nimport { mixin } from '../../../base/common/objects.js';\nimport { isWeb } from '../../../base/common/platform.js';\nimport { ITelemetryAppender, validateTelemetryData } from './telemetryUtils.js';\n\n// Interface type which is a subset of @microsoft/1ds-core-js AppInsightsCore.\n// Allows us to more easily build mock objects for testing as the interface is quite large and we only need a few properties.\nexport interface IAppInsightsCore {\n\tpluginVersionString: string;\n\ttrack(item: ITelemetryItem | IExtendedTelemetryItem): void;\n\tunload(isAsync: boolean, unloadComplete: (unloadState: ITelemetryUnloadState) => void): void;\n}\n\nconst endpointUrl = 'https://mobile.events.data.microsoft.com/OneCollector/1.0';\nconst endpointHealthUrl = 'https://mobile.events.data.microsoft.com/ping';\n\nasync function getClient(instrumentationKey: string, addInternalFlag?: boolean, xhrOverride?: IXHROverride): Promise<IAppInsightsCore> {\n\t// eslint-disable-next-line local/code-amd-node-module\n\tconst oneDs = isWeb ? await importAMDNodeModule<typeof import('@microsoft/1ds-core-js')>('@microsoft/1ds-core-js', 'bundle/ms.core.min.js') : await import('@microsoft/1ds-core-js');\n\t// eslint-disable-next-line local/code-amd-node-module\n\tconst postPlugin = isWeb ? await importAMDNodeModule<typeof import('@microsoft/1ds-post-js')>('@microsoft/1ds-post-js', 'bundle/ms.post.min.js') : await import('@microsoft/1ds-post-js');\n\n\tconst appInsightsCore = new oneDs.AppInsightsCore();\n\tconst collectorChannelPlugin: PostChannel = new postPlugin.PostChannel();\n\t// Configure the app insights core to send to collector++ and disable logging of debug info\n\tconst coreConfig: IExtendedConfiguration = {\n\t\tinstrumentationKey,\n\t\tendpointUrl,\n\t\tloggingLevelTelemetry: 0,\n\t\tloggingLevelConsole: 0,\n\t\tdisableCookiesUsage: true,\n\t\tdisableDbgExt: true,\n\t\tdisableInstrumentationKeyValidation: true,\n\t\tchannels: [[\n\t\t\tcollectorChannelPlugin\n\t\t]]\n\t};\n\n\tif (xhrOverride) {\n\t\tcoreConfig.extensionConfig = {};\n\t\t// Configure the channel to use a XHR Request override since it's not available in node\n\t\tconst channelConfig: IChannelConfiguration = {\n\t\t\talwaysUseXhrOverride: true,\n\t\t\tignoreMc1Ms0CookieProcessing: true,\n\t\t\thttpXHROverride: xhrOverride\n\t\t};\n\t\tcoreConfig.extensionConfig[collectorChannelPlugin.identifier] = channelConfig;\n\t}\n\n\tappInsightsCore.initialize(coreConfig, []);\n\n\tappInsightsCore.addTelemetryInitializer((envelope: any) => {\n\t\t// Opt the user out of 1DS data sharing\n\t\tenvelope['ext'] = envelope['ext'] ?? {};\n\t\tenvelope['ext']['web'] = envelope['ext']['web'] ?? {};\n\t\tenvelope['ext']['web']['consentDetails'] = '{\"GPC_DataSharingOptIn\":false}';\n\n\t\tif (addInternalFlag) {\n\t\t\tenvelope['ext']['utc'] = envelope['ext']['utc'] ?? {};\n\t\t\t// Sets it to be internal only based on Windows UTC flagging\n\t\t\tenvelope['ext']['utc']['flags'] = 0x0000811ECD;\n\t\t}\n\t});\n\n\treturn appInsightsCore;\n}\n\n// TODO @lramos15 maybe make more in line with src/vs/platform/telemetry/browser/appInsightsAppender.ts with caching support\nexport abstract class AbstractOneDataSystemAppender implements ITelemetryAppender {\n\n\tprotected _aiCoreOrKey: IAppInsightsCore | string | undefined;\n\tprivate _asyncAiCore: Promise<IAppInsightsCore> | null;\n\tprotected readonly endPointUrl = endpointUrl;\n\tprotected readonly endPointHealthUrl = endpointHealthUrl;\n\n\tconstructor(\n\t\tprivate readonly _isInternalTelemetry: boolean,\n\t\tprivate _eventPrefix: string,\n\t\tprivate _defaultData: { [key: string]: any } | null,\n\t\tiKeyOrClientFactory: string | (() => IAppInsightsCore), // allow factory function for testing\n\t\tprivate _xhrOverride?: IXHROverride\n\t) {\n\t\tif (!this._defaultData) {\n\t\t\tthis._defaultData = {};\n\t\t}\n\n\t\tif (typeof iKeyOrClientFactory === 'function') {\n\t\t\tthis._aiCoreOrKey = iKeyOrClientFactory();\n\t\t} else {\n\t\t\tthis._aiCoreOrKey = iKeyOrClientFactory;\n\t\t}\n\t\tthis._asyncAiCore = null;\n\t}\n\n\tprivate _withAIClient(callback: (aiCore: IAppInsightsCore) => void): void {\n\t\tif (!this._aiCoreOrKey) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof this._aiCoreOrKey !== 'string') {\n\t\t\tcallback(this._aiCoreOrKey);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._asyncAiCore) {\n\t\t\tthis._asyncAiCore = getClient(this._aiCoreOrKey, this._isInternalTelemetry, this._xhrOverride);\n\t\t}\n\n\t\tthis._asyncAiCore.then(\n\t\t\t(aiClient) => {\n\t\t\t\tcallback(aiClient);\n\t\t\t},\n\t\t\t(err) => {\n\t\t\t\tonUnexpectedError(err);\n\t\t\t\tconsole.error(err);\n\t\t\t}\n\t\t);\n\t}\n\n\tlog(eventName: string, data?: any): void {\n\t\tif (!this._aiCoreOrKey) {\n\t\t\treturn;\n\t\t}\n\t\tdata = mixin(data, this._defaultData);\n\t\tdata = validateTelemetryData(data);\n\t\tconst name = this._eventPrefix + '/' + eventName;\n\n\t\ttry {\n\t\t\tthis._withAIClient((aiClient) => {\n\t\t\t\taiClient.pluginVersionString = data?.properties.version ?? 'Unknown';\n\t\t\t\taiClient.track({\n\t\t\t\t\tname,\n\t\t\t\t\tbaseData: { name, properties: data?.properties, measurements: data?.measurements }\n\t\t\t\t});\n\t\t\t});\n\t\t} catch { }\n\t}\n\n\tflush(): Promise<void> {\n\t\tif (this._aiCoreOrKey) {\n\t\t\treturn new Promise(resolve => {\n\t\t\t\tthis._withAIClient((aiClient) => {\n\t\t\t\t\taiClient.unload(true, () => {\n\t\t\t\t\t\tthis._aiCoreOrKey = undefined;\n\t\t\t\t\t\tresolve(undefined);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t\treturn Promise.resolve(undefined);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { IPayloadData, IXHROverride } from '@microsoft/1ds-post-js';\nimport { streamToBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { IRequestOptions } from '../../../base/parts/request/common/request.js';\nimport { IRequestService } from '../../request/common/request.js';\nimport * as https from 'https';\nimport { AbstractOneDataSystemAppender, IAppInsightsCore } from '../common/1dsAppender.js';\n\ntype OnCompleteFunc = (status: number, headers: { [headerName: string]: string }, response?: string) => void;\n\ninterface IResponseData {\n\theaders: { [headerName: string]: string };\n\tstatusCode: number;\n\tresponseData: string;\n}\n\n/**\n * Completes a request to submit telemetry to the server utilizing the request service\n * @param options The options which will be used to make the request\n * @param requestService The request service\n * @returns An object containing the headers, statusCode, and responseData\n */\nasync function makeTelemetryRequest(options: IRequestOptions, requestService: IRequestService): Promise<IResponseData> {\n\tconst response = await requestService.request(options, CancellationToken.None);\n\tconst responseData = (await streamToBuffer(response.stream)).toString();\n\tconst statusCode = response.res.statusCode ?? 200;\n\tconst headers = response.res.headers as Record<string, any>;\n\treturn {\n\t\theaders,\n\t\tstatusCode,\n\t\tresponseData\n\t};\n}\n\n/**\n * Complete a request to submit telemetry to the server utilizing the https module. Only used when the request service is not available\n * @param options The options which will be used to make the request\n * @returns An object containing the headers, statusCode, and responseData\n */\nasync function makeLegacyTelemetryRequest(options: IRequestOptions): Promise<IResponseData> {\n\tconst httpsOptions = {\n\t\tmethod: options.type,\n\t\theaders: options.headers\n\t};\n\tconst responsePromise = new Promise<IResponseData>((resolve, reject) => {\n\t\tconst req = https.request(options.url ?? '', httpsOptions, res => {\n\t\t\tres.on('data', function (responseData) {\n\t\t\t\tresolve({\n\t\t\t\t\theaders: res.headers as Record<string, any>,\n\t\t\t\t\tstatusCode: res.statusCode ?? 200,\n\t\t\t\t\tresponseData: responseData.toString()\n\t\t\t\t});\n\t\t\t});\n\t\t\t// On response with error send status of 0 and a blank response to oncomplete so we can retry events\n\t\t\tres.on('error', function (err) {\n\t\t\t\treject(err);\n\t\t\t});\n\t\t});\n\t\treq.write(options.data, (err) => {\n\t\t\tif (err) {\n\t\t\t\treject(err);\n\t\t\t}\n\t\t});\n\t\treq.end();\n\t});\n\treturn responsePromise;\n}\n\nasync function sendPostAsync(requestService: IRequestService | undefined, payload: IPayloadData, oncomplete: OnCompleteFunc) {\n\tconst telemetryRequestData = typeof payload.data === 'string' ? payload.data : new TextDecoder().decode(payload.data);\n\tconst requestOptions: IRequestOptions = {\n\t\ttype: 'POST',\n\t\theaders: {\n\t\t\t...payload.headers,\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(payload.data).toString()\n\t\t},\n\t\turl: payload.urlString,\n\t\tdata: telemetryRequestData\n\t};\n\n\ttry {\n\t\tconst responseData = requestService ? await makeTelemetryRequest(requestOptions, requestService) : await makeLegacyTelemetryRequest(requestOptions);\n\t\toncomplete(responseData.statusCode, responseData.headers, responseData.responseData);\n\t} catch {\n\t\t// If it errors out, send status of 0 and a blank response to oncomplete so we can retry events\n\t\toncomplete(0, {});\n\t}\n}\n\n\nexport class OneDataSystemAppender extends AbstractOneDataSystemAppender {\n\n\tconstructor(\n\t\trequestService: IRequestService | undefined,\n\t\tisInternalTelemetry: boolean,\n\t\teventPrefix: string,\n\t\tdefaultData: { [key: string]: any } | null,\n\t\tiKeyOrClientFactory: string | (() => IAppInsightsCore), // allow factory function for testing\n\t) {\n\t\t// Override the way events get sent since node doesn't have XHTMLRequest\n\t\tconst customHttpXHROverride: IXHROverride = {\n\t\t\tsendPOST: (payload: IPayloadData, oncomplete: OnCompleteFunc) => {\n\t\t\t\t// Fire off the async request without awaiting it\n\t\t\t\tsendPostAsync(requestService, payload, oncomplete);\n\t\t\t}\n\t\t};\n\n\t\tsuper(isInternalTelemetry, eventPrefix, defaultData, iKeyOrClientFactory, customHttpXHROverride);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ExtensionIdentifierMap, IExtensionDescription } from '../../../../platform/extensions/common/extensions.js';\nimport { localize } from '../../../../nls.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport * as semver from '../../../../base/common/semver/semver.js';\nimport { Mutable } from '../../../../base/common/types.js';\n\n// TODO: @sandy081 merge this with deduping in extensionsScannerService.ts\nexport function dedupExtensions(system: IExtensionDescription[], user: IExtensionDescription[], workspace: IExtensionDescription[], development: IExtensionDescription[], logService: ILogService): IExtensionDescription[] {\n\tconst result = new ExtensionIdentifierMap<IExtensionDescription>();\n\tsystem.forEach((systemExtension) => {\n\t\tconst extension = result.get(systemExtension.identifier);\n\t\tif (extension) {\n\t\t\tlogService.warn(localize('overwritingExtension', \"Overwriting extension {0} with {1}.\", extension.extensionLocation.fsPath, systemExtension.extensionLocation.fsPath));\n\t\t}\n\t\tresult.set(systemExtension.identifier, systemExtension);\n\t});\n\tuser.forEach((userExtension) => {\n\t\tconst extension = result.get(userExtension.identifier);\n\t\tif (extension) {\n\t\t\tif (extension.isBuiltin) {\n\t\t\t\tif (semver.gte(extension.version, userExtension.version)) {\n\t\t\t\t\tlogService.warn(`Skipping extension ${userExtension.extensionLocation.path} in favour of the builtin extension ${extension.extensionLocation.path}.`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Overwriting a builtin extension inherits the `isBuiltin` property and it doesn't show a warning\n\t\t\t\t(<Mutable<IExtensionDescription>>userExtension).isBuiltin = true;\n\t\t\t} else {\n\t\t\t\tlogService.warn(localize('overwritingExtension', \"Overwriting extension {0} with {1}.\", extension.extensionLocation.fsPath, userExtension.extensionLocation.fsPath));\n\t\t\t}\n\t\t} else if (userExtension.isBuiltin) {\n\t\t\tlogService.warn(`Skipping obsolete builtin extension ${userExtension.extensionLocation.path}`);\n\t\t\treturn;\n\t\t}\n\t\tresult.set(userExtension.identifier, userExtension);\n\t});\n\tworkspace.forEach(workspaceExtension => {\n\t\tconst extension = result.get(workspaceExtension.identifier);\n\t\tif (extension) {\n\t\t\tlogService.warn(localize('overwritingWithWorkspaceExtension', \"Overwriting {0} with Workspace Extension {1}.\", extension.extensionLocation.fsPath, workspaceExtension.extensionLocation.fsPath));\n\t\t}\n\t\tresult.set(workspaceExtension.identifier, workspaceExtension);\n\t});\n\tdevelopment.forEach(developedExtension => {\n\t\tlogService.info(localize('extensionUnderDevelopment', \"Loading development extension at {0}\", developedExtension.extensionLocation.fsPath));\n\t\tconst extension = result.get(developedExtension.identifier);\n\t\tif (extension) {\n\t\t\tif (extension.isBuiltin) {\n\t\t\t\t// Overwriting a builtin extension inherits the `isBuiltin` property\n\t\t\t\t(<Mutable<IExtensionDescription>>developedExtension).isBuiltin = true;\n\t\t\t}\n\t\t}\n\t\tresult.set(developedExtension.identifier, developedExtension);\n\t});\n\treturn Array.from(result.values());\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { isAbsolute, join, resolve } from '../../base/common/path.js';\nimport * as platform from '../../base/common/platform.js';\nimport { cwd } from '../../base/common/process.js';\nimport { URI } from '../../base/common/uri.js';\nimport * as performance from '../../base/common/performance.js';\nimport { Event } from '../../base/common/event.js';\nimport { IURITransformer, transformOutgoingURIs } from '../../base/common/uriIpc.js';\nimport { IServerChannel } from '../../base/parts/ipc/common/ipc.js';\nimport { ContextKeyDefinedExpr, ContextKeyEqualsExpr, ContextKeyExpr, ContextKeyExpression, ContextKeyGreaterEqualsExpr, ContextKeyGreaterExpr, ContextKeyInExpr, ContextKeyNotEqualsExpr, ContextKeyNotExpr, ContextKeyNotInExpr, ContextKeyRegexExpr, ContextKeySmallerEqualsExpr, ContextKeySmallerExpr, ContextKeyValue, IContextKeyExprMapper } from '../../platform/contextkey/common/contextkey.js';\nimport { IExtensionGalleryService, IExtensionManagementService, InstallExtensionSummary, InstallOptions } from '../../platform/extensionManagement/common/extensionManagement.js';\nimport { ExtensionManagementCLI } from '../../platform/extensionManagement/common/extensionManagementCLI.js';\nimport { IExtensionsScannerService, toExtensionDescription } from '../../platform/extensionManagement/common/extensionsScannerService.js';\nimport { ExtensionType, IExtensionDescription } from '../../platform/extensions/common/extensions.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { IUserDataProfilesService } from '../../platform/userDataProfile/common/userDataProfile.js';\nimport { IServerEnvironmentService } from './serverEnvironmentService.js';\nimport { dedupExtensions } from '../../workbench/services/extensions/common/extensionsUtil.js';\nimport { Schemas } from '../../base/common/network.js';\nimport { IRemoteExtensionsScannerService } from '../../platform/remote/common/remoteExtensionsScanner.js';\nimport { ILanguagePackService } from '../../platform/languagePacks/common/languagePacks.js';\nimport { areSameExtensions } from '../../platform/extensionManagement/common/extensionManagementUtil.js';\n\nexport class RemoteExtensionsScannerService implements IRemoteExtensionsScannerService {\n\n\treadonly _serviceBrand: undefined;\n\n\tprivate readonly _whenBuiltinExtensionsReady = Promise.resolve<InstallExtensionSummary>({ failed: [] });\n\tprivate readonly _whenExtensionsReady = Promise.resolve<InstallExtensionSummary>({ failed: [] });\n\n\tconstructor(\n\t\tprivate readonly _extensionManagementCLI: ExtensionManagementCLI,\n\t\tenvironmentService: IServerEnvironmentService,\n\t\tprivate readonly _userDataProfilesService: IUserDataProfilesService,\n\t\tprivate readonly _extensionsScannerService: IExtensionsScannerService,\n\t\tprivate readonly _logService: ILogService,\n\t\tprivate readonly _extensionGalleryService: IExtensionGalleryService,\n\t\tprivate readonly _languagePackService: ILanguagePackService,\n\t\tprivate readonly _extensionManagementService: IExtensionManagementService,\n\t) {\n\t\tconst builtinExtensionsToInstall = environmentService.args['install-builtin-extension'];\n\t\tif (builtinExtensionsToInstall) {\n\t\t\t_logService.trace('Installing builtin extensions passed via args...');\n\t\t\tconst installOptions: InstallOptions = { isMachineScoped: !!environmentService.args['do-not-sync'], installPreReleaseVersion: !!environmentService.args['pre-release'] };\n\t\t\tperformance.mark('code/server/willInstallBuiltinExtensions');\n\t\t\tthis._whenExtensionsReady = this._whenBuiltinExtensionsReady = _extensionManagementCLI.installExtensions([], this._asExtensionIdOrVSIX(builtinExtensionsToInstall), installOptions, !!environmentService.args['force'])\n\t\t\t\t.then(() => {\n\t\t\t\t\tperformance.mark('code/server/didInstallBuiltinExtensions');\n\t\t\t\t\t_logService.trace('Finished installing builtin extensions');\n\t\t\t\t\treturn { failed: [] };\n\t\t\t\t}, error => {\n\t\t\t\t\t_logService.error(error);\n\t\t\t\t\treturn { failed: [] };\n\t\t\t\t});\n\t\t}\n\n\t\tconst extensionsToInstall = environmentService.args['install-extension'];\n\t\tif (extensionsToInstall) {\n\t\t\t_logService.trace('Installing extensions passed via args...');\n\t\t\tconst installOptions: InstallOptions = {\n\t\t\t\tisMachineScoped: !!environmentService.args['do-not-sync'],\n\t\t\t\tinstallPreReleaseVersion: !!environmentService.args['pre-release'],\n\t\t\t\tisApplicationScoped: true // extensions installed during server startup are available to all profiles\n\t\t\t};\n\t\t\tthis._whenExtensionsReady = this._whenBuiltinExtensionsReady\n\t\t\t\t.then(() => _extensionManagementCLI.installExtensions(this._asExtensionIdOrVSIX(extensionsToInstall), [], installOptions, !!environmentService.args['force']))\n\t\t\t\t.then(async () => {\n\t\t\t\t\t_logService.trace('Finished installing extensions');\n\t\t\t\t\treturn { failed: [] };\n\t\t\t\t}, async error => {\n\t\t\t\t\t_logService.error(error);\n\n\t\t\t\t\tconst failed: {\n\t\t\t\t\t\tid: string;\n\t\t\t\t\t\tinstallOptions: InstallOptions;\n\t\t\t\t\t}[] = [];\n\t\t\t\t\tconst alreadyInstalled = await this._extensionManagementService.getInstalled(ExtensionType.User);\n\n\t\t\t\t\tfor (const id of this._asExtensionIdOrVSIX(extensionsToInstall)) {\n\t\t\t\t\t\tif (typeof id === 'string') {\n\t\t\t\t\t\t\tif (!alreadyInstalled.some(e => areSameExtensions(e.identifier, { id }))) {\n\t\t\t\t\t\t\t\tfailed.push({ id, installOptions });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!failed.length) {\n\t\t\t\t\t\t_logService.trace(`No extensions to report as failed`);\n\t\t\t\t\t\treturn { failed: [] };\n\t\t\t\t\t}\n\n\t\t\t\t\t_logService.info(`Relaying the following extensions to install later: ${failed.map(f => f.id).join(', ')}`);\n\t\t\t\t\treturn { failed };\n\t\t\t\t});\n\t\t}\n\t}\n\n\tprivate _asExtensionIdOrVSIX(inputs: string[]): (string | URI)[] {\n\t\treturn inputs.map(input => /\\.vsix$/i.test(input) ? URI.file(isAbsolute(input) ? input : join(cwd(), input)) : input);\n\t}\n\n\twhenExtensionsReady(): Promise<InstallExtensionSummary> {\n\t\treturn this._whenExtensionsReady;\n\t}\n\n\tasync scanExtensions(\n\t\tlanguage?: string,\n\t\tprofileLocation?: URI,\n\t\tworkspaceExtensionLocations?: URI[],\n\t\textensionDevelopmentLocations?: URI[],\n\t\tlanguagePackId?: string\n\t): Promise<IExtensionDescription[]> {\n\t\tperformance.mark('code/server/willScanExtensions');\n\t\tthis._logService.trace(`Scanning extensions using UI language: ${language}`);\n\n\t\tawait this._whenBuiltinExtensionsReady;\n\n\t\tconst extensionDevelopmentPaths = extensionDevelopmentLocations ? extensionDevelopmentLocations.filter(url => url.scheme === Schemas.file).map(url => url.fsPath) : undefined;\n\t\tprofileLocation = profileLocation ?? this._userDataProfilesService.defaultProfile.extensionsResource;\n\n\t\tconst extensions = await this._scanExtensions(profileLocation, language ?? platform.language, workspaceExtensionLocations, extensionDevelopmentPaths, languagePackId);\n\n\t\tthis._logService.trace('Scanned Extensions', extensions);\n\t\tthis._massageWhenConditions(extensions);\n\n\t\tperformance.mark('code/server/didScanExtensions');\n\t\treturn extensions;\n\t}\n\n\tprivate async _scanExtensions(profileLocation: URI, language: string, workspaceInstalledExtensionLocations: URI[] | undefined, extensionDevelopmentPath: string[] | undefined, languagePackId: string | undefined): Promise<IExtensionDescription[]> {\n\t\tawait this._ensureLanguagePackIsInstalled(language, languagePackId);\n\n\t\tconst [builtinExtensions, installedExtensions, workspaceInstalledExtensions, developedExtensions] = await Promise.all([\n\t\t\tthis._scanBuiltinExtensions(language),\n\t\t\tthis._scanInstalledExtensions(profileLocation, language),\n\t\t\tthis._scanWorkspaceInstalledExtensions(language, workspaceInstalledExtensionLocations),\n\t\t\tthis._scanDevelopedExtensions(language, extensionDevelopmentPath)\n\t\t]);\n\n\t\treturn dedupExtensions(builtinExtensions, installedExtensions, workspaceInstalledExtensions, developedExtensions, this._logService);\n\t}\n\n\tprivate async _scanDevelopedExtensions(language: string, extensionDevelopmentPaths?: string[]): Promise<IExtensionDescription[]> {\n\t\tif (extensionDevelopmentPaths) {\n\t\t\treturn (await Promise.all(extensionDevelopmentPaths.map(extensionDevelopmentPath => this._extensionsScannerService.scanOneOrMultipleExtensions(URI.file(resolve(extensionDevelopmentPath)), ExtensionType.User, { language }))))\n\t\t\t\t.flat()\n\t\t\t\t.map(e => toExtensionDescription(e, true));\n\t\t}\n\t\treturn [];\n\t}\n\n\tprivate async _scanWorkspaceInstalledExtensions(language: string, workspaceInstalledExtensions?: URI[]): Promise<IExtensionDescription[]> {\n\t\tconst result: IExtensionDescription[] = [];\n\t\tif (workspaceInstalledExtensions?.length) {\n\t\t\tconst scannedExtensions = await Promise.all(workspaceInstalledExtensions.map(location => this._extensionsScannerService.scanExistingExtension(location, ExtensionType.User, { language })));\n\t\t\tfor (const scannedExtension of scannedExtensions) {\n\t\t\t\tif (scannedExtension) {\n\t\t\t\t\tresult.push(toExtensionDescription(scannedExtension, false));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate async _scanBuiltinExtensions(language: string): Promise<IExtensionDescription[]> {\n\t\tconst scannedExtensions = await this._extensionsScannerService.scanSystemExtensions({ language });\n\t\treturn scannedExtensions.map(e => toExtensionDescription(e, false));\n\t}\n\n\tprivate async _scanInstalledExtensions(profileLocation: URI, language: string): Promise<IExtensionDescription[]> {\n\t\tconst scannedExtensions = await this._extensionsScannerService.scanUserExtensions({ profileLocation, language, useCache: true });\n\t\treturn scannedExtensions.map(e => toExtensionDescription(e, false));\n\t}\n\n\tprivate async _ensureLanguagePackIsInstalled(language: string, languagePackId: string | undefined): Promise<void> {\n\t\tif (\n\t\t\t// No need to install language packs for the default language\n\t\t\tlanguage === platform.LANGUAGE_DEFAULT ||\n\t\t\t// The extension gallery service needs to be available\n\t\t\t!this._extensionGalleryService.isEnabled()\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst installed = await this._languagePackService.getInstalledLanguages();\n\t\t\tif (installed.find(p => p.id === language)) {\n\t\t\t\tthis._logService.trace(`Language Pack ${language} is already installed. Skipping language pack installation.`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t// We tried to see what is installed but failed. We can try installing anyway.\n\t\t\tthis._logService.error(err);\n\t\t}\n\n\t\tif (!languagePackId) {\n\t\t\tthis._logService.trace(`No language pack id provided for language ${language}. Skipping language pack installation.`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._logService.trace(`Language Pack ${languagePackId} for language ${language} is not installed. It will be installed now.`);\n\t\ttry {\n\t\t\tawait this._extensionManagementCLI.installExtensions([languagePackId], [], { isMachineScoped: true }, true);\n\t\t} catch (err) {\n\t\t\t// We tried to install the language pack but failed. We can continue without it thus using the default language.\n\t\t\tthis._logService.error(err);\n\t\t}\n\t}\n\n\tprivate _massageWhenConditions(extensions: IExtensionDescription[]): void {\n\t\t// Massage \"when\" conditions which mention `resourceScheme`\n\n\t\tinterface WhenUser { when?: string }\n\n\t\tinterface LocWhenUser { [loc: string]: WhenUser[] }\n\n\t\tconst _mapResourceSchemeValue = (value: string, isRegex: boolean): string => {\n\t\t\t// console.log(`_mapResourceSchemeValue: ${value}, ${isRegex}`);\n\t\t\treturn value.replace(/file/g, 'vscode-remote');\n\t\t};\n\n\t\tconst _mapResourceRegExpValue = (value: RegExp): RegExp => {\n\t\t\tlet flags = '';\n\t\t\tflags += value.global ? 'g' : '';\n\t\t\tflags += value.ignoreCase ? 'i' : '';\n\t\t\tflags += value.multiline ? 'm' : '';\n\t\t\treturn new RegExp(_mapResourceSchemeValue(value.source, true), flags);\n\t\t};\n\n\t\tconst _exprKeyMapper = new class implements IContextKeyExprMapper {\n\t\t\tmapDefined(key: string): ContextKeyExpression {\n\t\t\t\treturn ContextKeyDefinedExpr.create(key);\n\t\t\t}\n\t\t\tmapNot(key: string): ContextKeyExpression {\n\t\t\t\treturn ContextKeyNotExpr.create(key);\n\t\t\t}\n\t\t\tmapEquals(key: string, value: ContextKeyValue): ContextKeyExpression {\n\t\t\t\tif (key === 'resourceScheme' && typeof value === 'string') {\n\t\t\t\t\treturn ContextKeyEqualsExpr.create(key, _mapResourceSchemeValue(value, false));\n\t\t\t\t} else {\n\t\t\t\t\treturn ContextKeyEqualsExpr.create(key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapNotEquals(key: string, value: ContextKeyValue): ContextKeyExpression {\n\t\t\t\tif (key === 'resourceScheme' && typeof value === 'string') {\n\t\t\t\t\treturn ContextKeyNotEqualsExpr.create(key, _mapResourceSchemeValue(value, false));\n\t\t\t\t} else {\n\t\t\t\t\treturn ContextKeyNotEqualsExpr.create(key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapGreater(key: string, value: ContextKeyValue): ContextKeyExpression {\n\t\t\t\treturn ContextKeyGreaterExpr.create(key, value);\n\t\t\t}\n\t\t\tmapGreaterEquals(key: string, value: ContextKeyValue): ContextKeyExpression {\n\t\t\t\treturn ContextKeyGreaterEqualsExpr.create(key, value);\n\t\t\t}\n\t\t\tmapSmaller(key: string, value: ContextKeyValue): ContextKeyExpression {\n\t\t\t\treturn ContextKeySmallerExpr.create(key, value);\n\t\t\t}\n\t\t\tmapSmallerEquals(key: string, value: ContextKeyValue): ContextKeyExpression {\n\t\t\t\treturn ContextKeySmallerEqualsExpr.create(key, value);\n\t\t\t}\n\t\t\tmapRegex(key: string, regexp: RegExp | null): ContextKeyRegexExpr {\n\t\t\t\tif (key === 'resourceScheme' && regexp) {\n\t\t\t\t\treturn ContextKeyRegexExpr.create(key, _mapResourceRegExpValue(regexp));\n\t\t\t\t} else {\n\t\t\t\t\treturn ContextKeyRegexExpr.create(key, regexp);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapIn(key: string, valueKey: string): ContextKeyInExpr {\n\t\t\t\treturn ContextKeyInExpr.create(key, valueKey);\n\t\t\t}\n\t\t\tmapNotIn(key: string, valueKey: string): ContextKeyNotInExpr {\n\t\t\t\treturn ContextKeyNotInExpr.create(key, valueKey);\n\t\t\t}\n\t\t};\n\n\t\tconst _massageWhenUser = (element: WhenUser) => {\n\t\t\tif (!element || !element.when || !/resourceScheme/.test(element.when)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst expr = ContextKeyExpr.deserialize(element.when);\n\t\t\tif (!expr) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst massaged = expr.map(_exprKeyMapper);\n\t\t\telement.when = massaged.serialize();\n\t\t};\n\n\t\tconst _massageWhenUserArr = (elements: WhenUser[] | WhenUser) => {\n\t\t\tif (Array.isArray(elements)) {\n\t\t\t\tfor (const element of elements) {\n\t\t\t\t\t_massageWhenUser(element);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t_massageWhenUser(elements);\n\t\t\t}\n\t\t};\n\n\t\tconst _massageLocWhenUser = (target: LocWhenUser) => {\n\t\t\tfor (const loc in target) {\n\t\t\t\t_massageWhenUserArr(target[loc]);\n\t\t\t}\n\t\t};\n\n\t\textensions.forEach((extension) => {\n\t\t\tif (extension.contributes) {\n\t\t\t\tif (extension.contributes.menus) {\n\t\t\t\t\t_massageLocWhenUser(<LocWhenUser>extension.contributes.menus);\n\t\t\t\t}\n\t\t\t\tif (extension.contributes.keybindings) {\n\t\t\t\t\t_massageWhenUserArr(<WhenUser | WhenUser[]>extension.contributes.keybindings);\n\t\t\t\t}\n\t\t\t\tif (extension.contributes.views) {\n\t\t\t\t\t_massageLocWhenUser(<LocWhenUser>extension.contributes.views);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport class RemoteExtensionsScannerChannel implements IServerChannel {\n\n\tconstructor(private service: RemoteExtensionsScannerService, private getUriTransformer: (requestContext: any) => IURITransformer) { }\n\n\tlisten(context: any, event: string): Event<any> {\n\t\tthrow new Error('Invalid listen');\n\t}\n\n\tasync call(context: any, command: string, args?: any): Promise<any> {\n\t\tconst uriTransformer = this.getUriTransformer(context);\n\t\tswitch (command) {\n\t\t\tcase 'whenExtensionsReady': return await this.service.whenExtensionsReady();\n\n\t\t\tcase 'scanExtensions': {\n\t\t\t\tconst language = args[0];\n\t\t\t\tconst profileLocation = args[1] ? URI.revive(uriTransformer.transformIncoming(args[1])) : undefined;\n\t\t\t\tconst workspaceExtensionLocations = Array.isArray(args[2]) ? args[2].map(u => URI.revive(uriTransformer.transformIncoming(u))) : undefined;\n\t\t\t\tconst extensionDevelopmentPath = Array.isArray(args[3]) ? args[3].map(u => URI.revive(uriTransformer.transformIncoming(u))) : undefined;\n\t\t\t\tconst languagePackId: string | undefined = args[4];\n\t\t\t\tconst extensions = await this.service.scanExtensions(\n\t\t\t\t\tlanguage,\n\t\t\t\t\tprofileLocation,\n\t\t\t\t\tworkspaceExtensionLocations,\n\t\t\t\t\textensionDevelopmentPath,\n\t\t\t\t\tlanguagePackId\n\t\t\t\t);\n\t\t\t\treturn extensions.map(extension => transformOutgoingURIs(extension, uriTransformer));\n\t\t\t}\n\t\t}\n\t\tthrow new Error('Invalid call');\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { InstallExtensionSummary } from '../../extensionManagement/common/extensionManagement.js';\nimport { IExtensionDescription } from '../../extensions/common/extensions.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const IRemoteExtensionsScannerService = createDecorator<IRemoteExtensionsScannerService>('IRemoteExtensionsScannerService');\n\nexport const RemoteExtensionsScannerChannelName = 'remoteExtensionsScanner';\n\nexport interface IRemoteExtensionsScannerService {\n\treadonly _serviceBrand: undefined;\n\n\t/**\n\t * Returns a promise that resolves to an array of extension identifiers that failed to install\n\t */\n\twhenExtensionsReady(): Promise<InstallExtensionSummary>;\n\tscanExtensions(): Promise<IExtensionDescription[]>;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { URI, UriDto } from '../../../base/common/uri.js';\nimport { DidChangeProfilesEvent, IUserDataProfile, IUserDataProfileOptions, IUserDataProfilesService, IUserDataProfileUpdateOptions, reviveProfile } from './userDataProfile.js';\nimport { IAnyWorkspaceIdentifier } from '../../workspace/common/workspace.js';\nimport { IURITransformer, transformIncomingURIs, transformOutgoingURIs } from '../../../base/common/uriIpc.js';\n\nexport class RemoteUserDataProfilesServiceChannel implements IServerChannel {\n\n\tconstructor(\n\t\tprivate readonly service: IUserDataProfilesService,\n\t\tprivate readonly getUriTransformer: (requestContext: any) => IURITransformer\n\t) { }\n\n\tlisten(context: any, event: string): Event<any> {\n\t\tconst uriTransformer = this.getUriTransformer(context);\n\t\tswitch (event) {\n\t\t\tcase 'onDidChangeProfiles': return Event.map<DidChangeProfilesEvent, DidChangeProfilesEvent>(this.service.onDidChangeProfiles, e => {\n\t\t\t\treturn {\n\t\t\t\t\tall: e.all.map(p => transformOutgoingURIs({ ...p }, uriTransformer)),\n\t\t\t\t\tadded: e.added.map(p => transformOutgoingURIs({ ...p }, uriTransformer)),\n\t\t\t\t\tremoved: e.removed.map(p => transformOutgoingURIs({ ...p }, uriTransformer)),\n\t\t\t\t\tupdated: e.updated.map(p => transformOutgoingURIs({ ...p }, uriTransformer))\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t\tthrow new Error(`Invalid listen ${event}`);\n\t}\n\n\tasync call(context: any, command: string, args?: any): Promise<any> {\n\t\tconst uriTransformer = this.getUriTransformer(context);\n\t\tswitch (command) {\n\t\t\tcase 'createProfile': {\n\t\t\t\tconst profile = await this.service.createProfile(args[0], args[1], args[2]);\n\t\t\t\treturn transformOutgoingURIs({ ...profile }, uriTransformer);\n\t\t\t}\n\t\t\tcase 'updateProfile': {\n\t\t\t\tlet profile = reviveProfile(transformIncomingURIs(args[0], uriTransformer), this.service.profilesHome.scheme);\n\t\t\t\tprofile = await this.service.updateProfile(profile, args[1]);\n\t\t\t\treturn transformOutgoingURIs({ ...profile }, uriTransformer);\n\t\t\t}\n\t\t\tcase 'removeProfile': {\n\t\t\t\tconst profile = reviveProfile(transformIncomingURIs(args[0], uriTransformer), this.service.profilesHome.scheme);\n\t\t\t\treturn this.service.removeProfile(profile);\n\t\t\t}\n\t\t}\n\t\tthrow new Error(`Invalid call ${command}`);\n\t}\n}\n\nexport class UserDataProfilesService extends Disposable implements IUserDataProfilesService {\n\n\treadonly _serviceBrand: undefined;\n\n\tget defaultProfile(): IUserDataProfile { return this.profiles[0]; }\n\tprivate _profiles: IUserDataProfile[] = [];\n\tget profiles(): IUserDataProfile[] { return this._profiles; }\n\n\tprivate readonly _onDidChangeProfiles = this._register(new Emitter<DidChangeProfilesEvent>());\n\treadonly onDidChangeProfiles = this._onDidChangeProfiles.event;\n\n\treadonly onDidResetWorkspaces: Event<void>;\n\n\tconstructor(\n\t\tprofiles: readonly UriDto<IUserDataProfile>[],\n\t\treadonly profilesHome: URI,\n\t\tprivate readonly channel: IChannel,\n\t) {\n\t\tsuper();\n\t\tthis._profiles = profiles.map(profile => reviveProfile(profile, this.profilesHome.scheme));\n\t\tthis._register(this.channel.listen<DidChangeProfilesEvent>('onDidChangeProfiles')(e => {\n\t\t\tconst added = e.added.map(profile => reviveProfile(profile, this.profilesHome.scheme));\n\t\t\tconst removed = e.removed.map(profile => reviveProfile(profile, this.profilesHome.scheme));\n\t\t\tconst updated = e.updated.map(profile => reviveProfile(profile, this.profilesHome.scheme));\n\t\t\tthis._profiles = e.all.map(profile => reviveProfile(profile, this.profilesHome.scheme));\n\t\t\tthis._onDidChangeProfiles.fire({ added, removed, updated, all: this.profiles });\n\t\t}));\n\t\tthis.onDidResetWorkspaces = this.channel.listen<void>('onDidResetWorkspaces');\n\t}\n\n\tasync createNamedProfile(name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile> {\n\t\tconst result = await this.channel.call<UriDto<IUserDataProfile>>('createNamedProfile', [name, options, workspaceIdentifier]);\n\t\treturn reviveProfile(result, this.profilesHome.scheme);\n\t}\n\n\tasync createProfile(id: string, name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile> {\n\t\tconst result = await this.channel.call<UriDto<IUserDataProfile>>('createProfile', [id, name, options, workspaceIdentifier]);\n\t\treturn reviveProfile(result, this.profilesHome.scheme);\n\t}\n\n\tasync createTransientProfile(workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise<IUserDataProfile> {\n\t\tconst result = await this.channel.call<UriDto<IUserDataProfile>>('createTransientProfile', [workspaceIdentifier]);\n\t\treturn reviveProfile(result, this.profilesHome.scheme);\n\t}\n\n\tasync setProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, profile: IUserDataProfile): Promise<void> {\n\t\tawait this.channel.call<UriDto<IUserDataProfile>>('setProfileForWorkspace', [workspaceIdentifier, profile]);\n\t}\n\n\tremoveProfile(profile: IUserDataProfile): Promise<void> {\n\t\treturn this.channel.call('removeProfile', [profile]);\n\t}\n\n\tasync updateProfile(profile: IUserDataProfile, updateOptions: IUserDataProfileUpdateOptions): Promise<IUserDataProfile> {\n\t\tconst result = await this.channel.call<UriDto<IUserDataProfile>>('updateProfile', [profile, updateOptions]);\n\t\treturn reviveProfile(result, this.profilesHome.scheme);\n\t}\n\n\tresetWorkspaces(): Promise<void> {\n\t\treturn this.channel.call('resetWorkspaces');\n\t}\n\n\tcleanUp(): Promise<void> {\n\t\treturn this.channel.call('cleanUp');\n\t}\n\n\tcleanUpTransientProfiles(): Promise<void> {\n\t\treturn this.channel.call('cleanUpTransientProfiles');\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Disposable, DisposableStore } from '../../../base/common/lifecycle.js';\nimport { FileAccess, Schemas } from '../../../base/common/network.js';\nimport { Client, IIPCOptions } from '../../../base/parts/ipc/node/ipc.cp.js';\nimport { IEnvironmentService, INativeEnvironmentService } from '../../environment/common/environment.js';\nimport { parsePtyHostDebugPort } from '../../environment/node/environmentService.js';\nimport { IReconnectConstants } from '../common/terminal.js';\nimport { IPtyHostConnection, IPtyHostStarter } from './ptyHost.js';\n\nexport class NodePtyHostStarter extends Disposable implements IPtyHostStarter {\n\tconstructor(\n\t\tprivate readonly _reconnectConstants: IReconnectConstants,\n\t\t@IEnvironmentService private readonly _environmentService: INativeEnvironmentService\n\t) {\n\t\tsuper();\n\t}\n\n\tstart(): IPtyHostConnection {\n\t\tconst opts: IIPCOptions = {\n\t\t\tserverName: 'Pty Host',\n\t\t\targs: ['--type=ptyHost', '--logsPath', this._environmentService.logsHome.with({ scheme: Schemas.file }).fsPath],\n\t\t\tenv: {\n\t\t\t\tVSCODE_ESM_ENTRYPOINT: 'vs/platform/terminal/node/ptyHostMain',\n\t\t\t\tVSCODE_PIPE_LOGGING: 'true',\n\t\t\t\tVSCODE_VERBOSE_LOGGING: 'true', // transmit console logs from server to client,\n\t\t\t\tVSCODE_RECONNECT_GRACE_TIME: this._reconnectConstants.graceTime,\n\t\t\t\tVSCODE_RECONNECT_SHORT_GRACE_TIME: this._reconnectConstants.shortGraceTime,\n\t\t\t\tVSCODE_RECONNECT_SCROLLBACK: this._reconnectConstants.scrollback\n\t\t\t}\n\t\t};\n\n\t\tconst ptyHostDebug = parsePtyHostDebugPort(this._environmentService.args, this._environmentService.isBuilt);\n\t\tif (ptyHostDebug) {\n\t\t\tif (ptyHostDebug.break && ptyHostDebug.port) {\n\t\t\t\topts.debugBrk = ptyHostDebug.port;\n\t\t\t} else if (!ptyHostDebug.break && ptyHostDebug.port) {\n\t\t\t\topts.debug = ptyHostDebug.port;\n\t\t\t}\n\t\t}\n\n\t\tconst client = new Client(FileAccess.asFileUri('bootstrap-fork').fsPath, opts);\n\n\t\tconst store = new DisposableStore();\n\t\tstore.add(client);\n\n\t\treturn {\n\t\t\tclient,\n\t\t\tstore,\n\t\t\tonDidProcessExit: client.onDidProcessExit\n\t\t};\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { spawn } from 'child_process';\nimport { relative } from '../../../base/common/path.js';\nimport { FileAccess } from '../../../base/common/network.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { ILogService } from '../../log/common/log.js';\n\nexport const ICSSDevelopmentService = createDecorator<ICSSDevelopmentService>('ICSSDevelopmentService');\n\nexport interface ICSSDevelopmentService {\n\t_serviceBrand: undefined;\n\tisEnabled: boolean;\n\tgetCssModules(): Promise<string[]>;\n}\n\nexport class CSSDevelopmentService implements ICSSDevelopmentService {\n\n\tdeclare _serviceBrand: undefined;\n\n\tprivate _cssModules?: Promise<string[]>;\n\n\tconstructor(\n\t\t@IEnvironmentService private readonly envService: IEnvironmentService,\n\t\t@ILogService private readonly logService: ILogService\n\t) { }\n\n\tget isEnabled(): boolean {\n\t\treturn !this.envService.isBuilt;\n\t}\n\n\tgetCssModules(): Promise<string[]> {\n\t\tthis._cssModules ??= this.computeCssModules();\n\t\treturn this._cssModules;\n\t}\n\n\tprivate async computeCssModules(): Promise<string[]> {\n\t\tif (!this.isEnabled) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst rg = await import('@vscode/ripgrep');\n\t\treturn await new Promise<string[]>((resolve) => {\n\n\t\t\tconst sw = StopWatch.create();\n\n\t\t\tconst chunks: Buffer[] = [];\n\t\t\tconst basePath = FileAccess.asFileUri('').fsPath;\n\t\t\tconst process = spawn(rg.rgPath, ['-g', '**/*.css', '--files', '--no-ignore', basePath], {});\n\n\t\t\tprocess.stdout.on('data', data => {\n\t\t\t\tchunks.push(data);\n\t\t\t});\n\t\t\tprocess.on('error', err => {\n\t\t\t\tthis.logService.error('[CSS_DEV] FAILED to compute CSS data', err);\n\t\t\t\tresolve([]);\n\t\t\t});\n\t\t\tprocess.on('close', () => {\n\t\t\t\tconst data = Buffer.concat(chunks).toString('utf8');\n\t\t\t\tconst result = data.split('\\n').filter(Boolean).map(path => relative(basePath, path).replace(/\\\\/g, '/')).filter(Boolean).sort();\n\t\t\t\tif (result.some(path => path.indexOf('vs/') !== 0)) {\n\t\t\t\t\tthis.logService.error(`[CSS_DEV] Detected invalid paths in css modules, raw output: ${data}`);\n\t\t\t\t}\n\t\t\t\tresolve(result);\n\t\t\t\tthis.logService.info(`[CSS_DEV] DONE, ${result.length} css modules (${Math.round(sw.elapsed())}ms)`);\n\t\t\t});\n\t\t});\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { localize } from '../../../nls.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { ILogger, ILoggerService } from '../../log/common/log.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { ITelemetryAppender, TelemetryLogGroup, isLoggingOnly, telemetryLogId, validateTelemetryData } from './telemetryUtils.js';\n\nexport class TelemetryLogAppender extends Disposable implements ITelemetryAppender {\n\n\tprivate readonly logger: ILogger;\n\n\tconstructor(\n\t\tprivate readonly prefix: string,\n\t\tremote: boolean,\n\t\t@ILoggerService loggerService: ILoggerService,\n\t\t@IEnvironmentService environmentService: IEnvironmentService,\n\t\t@IProductService productService: IProductService,\n\t) {\n\t\tsuper();\n\n\t\tconst id = remote ? 'remoteTelemetry' : telemetryLogId;\n\t\tconst logger = loggerService.getLogger(id);\n\t\tif (logger) {\n\t\t\tthis.logger = this._register(logger);\n\t\t} else {\n\t\t\t// Not a perfect check, but a nice way to indicate if we only have logging enabled for debug purposes and nothing is actually being sent\n\t\t\tconst justLoggingAndNotSending = isLoggingOnly(productService, environmentService);\n\t\t\tconst logSuffix = justLoggingAndNotSending ? ' (Not Sent)' : '';\n\t\t\tthis.logger = this._register(loggerService.createLogger(id,\n\t\t\t\t{\n\t\t\t\t\tname: localize('telemetryLog', \"Telemetry{0}\", logSuffix),\n\t\t\t\t\tgroup: TelemetryLogGroup,\n\t\t\t\t\thidden: true\n\t\t\t\t}));\n\t\t}\n\t}\n\n\tflush(): Promise<void> {\n\t\treturn Promise.resolve();\n\t}\n\n\tlog(eventName: string, data: any): void {\n\t\tthis.logger.trace(`${this.prefix}telemetry/${eventName}`, validateTelemetryData(data));\n\t}\n}\n\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Platform } from '../../../base/common/platform.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\n\nexport const INativeMcpDiscoveryHelperService = createDecorator<INativeMcpDiscoveryHelperService>('INativeMcpDiscoveryHelperService');\n\nexport const NativeMcpDiscoveryHelperChannelName = 'NativeMcpDiscoveryHelper';\n\nexport interface INativeMcpDiscoveryData {\n\t// platform and homedir are duplicated by the remote/native environment, but here for convenience\n\tplatform: Platform;\n\thomedir: URI;\n\twinAppData?: URI;\n\txdgHome?: URI;\n}\n\nexport interface INativeMcpDiscoveryHelperService {\n\treadonly _serviceBrand: undefined;\n\n\tload(): Promise<INativeMcpDiscoveryData>;\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Event } from '../../../base/common/event.js';\nimport { IURITransformer, transformOutgoingURIs } from '../../../base/common/uriIpc.js';\nimport { IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { INativeMcpDiscoveryHelperService } from '../common/nativeMcpDiscoveryHelper.js';\n\nexport class NativeMcpDiscoveryHelperChannel implements IServerChannel {\n\n\tconstructor(\n\t\tprivate getUriTransformer: undefined | ((requestContext: any) => IURITransformer),\n\t\t@INativeMcpDiscoveryHelperService private nativeMcpDiscoveryHelperService: INativeMcpDiscoveryHelperService\n\t) { }\n\n\tlisten(context: any, event: string): Event<any> {\n\t\tthrow new Error('Invalid listen');\n\t}\n\n\tasync call(context: any, command: string, args?: any): Promise<any> {\n\t\tconst uriTransformer = this.getUriTransformer?.(context);\n\t\tswitch (command) {\n\t\t\tcase 'load': {\n\t\t\t\tconst result = await this.nativeMcpDiscoveryHelperService.load();\n\t\t\t\treturn uriTransformer ? transformOutgoingURIs(result, uriTransformer) : result;\n\t\t\t}\n\t\t}\n\t\tthrow new Error('Invalid call');\n\t}\n}\n\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { homedir } from 'os';\nimport { platform } from '../../../base/common/platform.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { INativeMcpDiscoveryData, INativeMcpDiscoveryHelperService } from '../common/nativeMcpDiscoveryHelper.js';\n\nexport class NativeMcpDiscoveryHelperService implements INativeMcpDiscoveryHelperService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tconstructor() { }\n\n\tload(): Promise<INativeMcpDiscoveryData> {\n\t\treturn Promise.resolve({\n\t\t\tplatform,\n\t\t\thomedir: URI.file(homedir()),\n\t\t\twinAppData: this.uriFromEnvVariable('APPDATA'),\n\t\t\txdgHome: this.uriFromEnvVariable('XDG_CONFIG_HOME'),\n\t\t});\n\t}\n\n\tprivate uriFromEnvVariable(varName: string) {\n\t\tconst envVar = process.env[varName];\n\t\tif (!envVar) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn URI.file(envVar);\n\t}\n}\n\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Barrier } from '../../../base/common/async.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { IPCServer } from '../../../base/parts/ipc/common/ipc.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { IExtensionGalleryManifest, IExtensionGalleryManifestService } from './extensionGalleryManifest.js';\nimport { ExtensionGalleryManifestService } from './extensionGalleryManifestService.js';\n\nexport class ExtensionGalleryManifestIPCService extends ExtensionGalleryManifestService implements IExtensionGalleryManifestService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate _onDidChangeExtensionGalleryManifest = this._register(new Emitter<IExtensionGalleryManifest | null>());\n\toverride readonly onDidChangeExtensionGalleryManifest = this._onDidChangeExtensionGalleryManifest.event;\n\n\tprivate extensionGalleryManifest: IExtensionGalleryManifest | null | undefined;\n\tprivate readonly barrier = new Barrier();\n\n\tconstructor(\n\t\tserver: IPCServer<any>,\n\t\t@IProductService productService: IProductService\n\t) {\n\t\tsuper(productService);\n\t\tserver.registerChannel('extensionGalleryManifest', {\n\t\t\tlisten: () => Event.None,\n\t\t\tcall: async (context: any, command: string, args?: any): Promise<any> => {\n\t\t\t\tswitch (command) {\n\t\t\t\t\tcase 'setExtensionGalleryManifest': return Promise.resolve(this.setExtensionGalleryManifest(args[0]));\n\t\t\t\t}\n\t\t\t\tthrow new Error('Invalid call');\n\t\t\t}\n\t\t});\n\t}\n\n\toverride async getExtensionGalleryManifest(): Promise<IExtensionGalleryManifest | null> {\n\t\tawait this.barrier.wait();\n\t\treturn this.extensionGalleryManifest ?? null;\n\t}\n\n\tprivate setExtensionGalleryManifest(manifest: IExtensionGalleryManifest | null): void {\n\t\tthis.extensionGalleryManifest = manifest;\n\t\tthis._onDidChangeExtensionGalleryManifest.fire(manifest);\n\t\tthis.barrier.open();\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { Event } from '../../../base/common/event.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { SortBy, SortOrder } from '../../extensionManagement/common/extensionManagement.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { IMcpServerConfiguration, IMcpServerVariable } from './mcpPlatformTypes.js';\n\nexport type InstallSource = 'gallery' | 'local';\n\nexport interface ILocalMcpServer {\n\treadonly name: string;\n\treadonly config: IMcpServerConfiguration;\n\treadonly version?: string;\n\treadonly mcpResource: URI;\n\treadonly location?: URI;\n\treadonly id?: string;\n\treadonly displayName?: string;\n\treadonly url?: string;\n\treadonly description?: string;\n\treadonly repositoryUrl?: string;\n\treadonly readmeUrl?: URI;\n\treadonly publisher?: string;\n\treadonly publisherDisplayName?: string;\n\treadonly icon?: {\n\t\treadonly dark: string;\n\t\treadonly light: string;\n\t};\n\treadonly codicon?: string;\n\treadonly manifest?: IMcpServerManifest;\n\treadonly source: InstallSource;\n}\n\nexport interface IMcpServerInput {\n\treadonly description?: string;\n\treadonly is_required?: boolean;\n\treadonly format?: 'string' | 'number' | 'boolean' | 'filepath';\n\treadonly value?: string;\n\treadonly is_secret?: boolean;\n\treadonly default?: string;\n\treadonly choices?: readonly string[];\n}\n\nexport interface IMcpServerVariableInput extends IMcpServerInput {\n\treadonly variables?: Record<string, IMcpServerInput>;\n}\n\nexport interface IMcpServerPositionalArgument extends IMcpServerVariableInput {\n\treadonly type: 'positional';\n\treadonly value_hint: string;\n\treadonly is_repeatable: boolean;\n}\n\nexport interface IMcpServerNamedArgument extends IMcpServerVariableInput {\n\treadonly type: 'named';\n\treadonly name: string;\n\treadonly is_repeatable: boolean;\n}\n\nexport interface IMcpServerKeyValueInput extends IMcpServerVariableInput {\n\treadonly name: string;\n\treadonly value: string;\n}\n\nexport type IMcpServerArgument = IMcpServerPositionalArgument | IMcpServerNamedArgument;\n\nexport const enum PackageType {\n\tNODE = 'npm',\n\tDOCKER = 'docker',\n\tPYTHON = 'pypi',\n\tREMOTE = 'remote',\n}\n\nexport interface IMcpServerPackage {\n\treadonly name: string;\n\treadonly version?: string;\n\treadonly registry_name: PackageType;\n\treadonly package_arguments?: readonly IMcpServerArgument[];\n\treadonly runtime_arguments?: readonly IMcpServerArgument[];\n\treadonly environment_variables?: ReadonlyArray<IMcpServerKeyValueInput>;\n}\n\nexport interface IMcpServerRemote {\n\treadonly url: string;\n\treadonly transport_type?: 'streamable' | 'sse';\n\treadonly headers?: ReadonlyArray<IMcpServerKeyValueInput>;\n}\n\nexport interface IMcpServerManifest {\n\treadonly packages?: readonly IMcpServerPackage[];\n\treadonly remotes?: readonly IMcpServerRemote[];\n}\n\nexport interface IGalleryMcpServer {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly displayName: string;\n\treadonly url?: string;\n\treadonly icon?: {\n\t\treadonly dark: string;\n\t\treadonly light: string;\n\t};\n\treadonly description: string;\n\treadonly version?: string;\n\treadonly lastUpdated?: number;\n\treadonly repositoryUrl?: string;\n\treadonly manifestUrl?: string;\n\treadonly manifest?: IMcpServerManifest;\n\treadonly packageTypes: readonly PackageType[];\n\treadonly readmeUrl?: string;\n\treadonly publisher: string;\n\treadonly publisherDisplayName?: string;\n\treadonly publisherDomain?: { link: string; verified: boolean };\n\treadonly codicon?: string;\n\treadonly licenseUrl?: string;\n\treadonly installCount?: number;\n\treadonly rating?: number;\n\treadonly ratingCount?: number;\n\treadonly categories?: readonly string[];\n\treadonly tags?: readonly string[];\n\treadonly releaseDate?: number;\n}\n\nexport interface IQueryOptions {\n\ttext?: string;\n\tsortBy?: SortBy;\n\tsortOrder?: SortOrder;\n}\n\nexport const IMcpGalleryService = createDecorator<IMcpGalleryService>('IMcpGalleryService');\nexport interface IMcpGalleryService {\n\treadonly _serviceBrand: undefined;\n\tisEnabled(): boolean;\n\tquery(options?: IQueryOptions, token?: CancellationToken): Promise<IGalleryMcpServer[]>;\n\tgetMcpServers(servers: string[]): Promise<IGalleryMcpServer[]>;\n\tgetManifest(extension: IGalleryMcpServer, token: CancellationToken): Promise<IMcpServerManifest>;\n\tgetReadme(extension: IGalleryMcpServer, token: CancellationToken): Promise<string>;\n}\n\nexport interface InstallMcpServerEvent {\n\treadonly name: string;\n\treadonly mcpResource: URI;\n\treadonly source?: IGalleryMcpServer;\n}\n\nexport interface InstallMcpServerResult {\n\treadonly name: string;\n\treadonly mcpResource: URI;\n\treadonly source?: IGalleryMcpServer;\n\treadonly local?: ILocalMcpServer;\n\treadonly error?: Error;\n}\n\nexport interface UninstallMcpServerEvent {\n\treadonly name: string;\n\treadonly mcpResource: URI;\n}\n\nexport interface DidUninstallMcpServerEvent {\n\treadonly name: string;\n\treadonly mcpResource: URI;\n\treadonly error?: string;\n}\n\nexport type InstallOptions = {\n\tpackageType?: PackageType;\n\tmcpResource?: URI;\n};\n\nexport type UninstallOptions = {\n\tmcpResource?: URI;\n};\n\nexport interface IInstallableMcpServer {\n\treadonly name: string;\n\treadonly config: IMcpServerConfiguration;\n\treadonly inputs?: IMcpServerVariable[];\n}\n\nexport const IMcpManagementService = createDecorator<IMcpManagementService>('IMcpManagementService');\nexport interface IMcpManagementService {\n\treadonly _serviceBrand: undefined;\n\treadonly onInstallMcpServer: Event<InstallMcpServerEvent>;\n\treadonly onDidInstallMcpServers: Event<readonly InstallMcpServerResult[]>;\n\treadonly onDidUpdateMcpServers: Event<readonly InstallMcpServerResult[]>;\n\treadonly onUninstallMcpServer: Event<UninstallMcpServerEvent>;\n\treadonly onDidUninstallMcpServer: Event<DidUninstallMcpServerEvent>;\n\tgetInstalled(mcpResource?: URI): Promise<ILocalMcpServer[]>;\n\tinstall(server: IInstallableMcpServer, options?: InstallOptions): Promise<ILocalMcpServer>;\n\tinstallFromGallery(server: IGalleryMcpServer, options?: InstallOptions): Promise<ILocalMcpServer>;\n\tupdateMetadata(local: ILocalMcpServer, server: IGalleryMcpServer, profileLocation?: URI): Promise<ILocalMcpServer>;\n\tuninstall(server: ILocalMcpServer, options?: UninstallOptions): Promise<void>;\n}\n\nexport const mcpGalleryServiceUrlConfig = 'chat.mcp.gallery.serviceUrl';\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { assertNever } from '../../../base/common/assert.js';\nimport { Queue } from '../../../base/common/async.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { IStringDictionary } from '../../../base/common/collections.js';\nimport { parse, ParseError } from '../../../base/common/json.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { Mutable } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { ConfigurationTarget, ConfigurationTargetToString } from '../../configuration/common/configuration.js';\nimport { FileOperationResult, IFileService, toFileOperationResult } from '../../files/common/files.js';\nimport { InstantiationType, registerSingleton } from '../../instantiation/common/extensions.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { IInstallableMcpServer } from './mcpManagement.js';\nimport { ICommonMcpServerConfiguration, IMcpServerConfiguration, IMcpServerVariable, IMcpStdioServerConfiguration, McpServerType } from './mcpPlatformTypes.js';\n\ninterface IScannedMcpServers {\n\tservers?: IStringDictionary<Mutable<IMcpServerConfiguration>>;\n\tinputs?: IMcpServerVariable[];\n}\n\ninterface IOldScannedMcpServer {\n\tid: string;\n\tname: string;\n\tversion?: string;\n\tgallery?: boolean;\n\tconfig: Mutable<IMcpServerConfiguration>;\n}\n\ninterface IScannedWorkspaceMcpServers {\n\tsettings?: {\n\t\tmcp?: IScannedMcpServers;\n\t};\n}\n\nexport type McpResourceTarget = ConfigurationTarget.USER | ConfigurationTarget.WORKSPACE | ConfigurationTarget.WORKSPACE_FOLDER;\n\nexport const IMcpResourceScannerService = createDecorator<IMcpResourceScannerService>('IMcpResourceScannerService');\nexport interface IMcpResourceScannerService {\n\treadonly _serviceBrand: undefined;\n\tscanMcpServers(mcpResource: URI, target?: McpResourceTarget): Promise<IScannedMcpServers>;\n\taddMcpServers(servers: IInstallableMcpServer[], mcpResource: URI, target?: McpResourceTarget): Promise<void>;\n\tremoveMcpServers(serverNames: string[], mcpResource: URI, target?: McpResourceTarget): Promise<void>;\n}\n\nexport class McpResourceScannerService extends Disposable implements IMcpResourceScannerService {\n\treadonly _serviceBrand: undefined;\n\n\tprivate readonly resourcesAccessQueueMap = new ResourceMap<Queue<IScannedMcpServers>>();\n\n\tconstructor(\n\t\t@IFileService private readonly fileService: IFileService,\n\t\t@IUriIdentityService protected readonly uriIdentityService: IUriIdentityService,\n\t) {\n\t\tsuper();\n\t}\n\n\tasync scanMcpServers(mcpResource: URI, target?: McpResourceTarget): Promise<IScannedMcpServers> {\n\t\treturn this.withProfileMcpServers(mcpResource, target);\n\t}\n\n\tasync addMcpServers(servers: IInstallableMcpServer[], mcpResource: URI, target?: McpResourceTarget): Promise<void> {\n\t\tawait this.withProfileMcpServers(mcpResource, target, scannedMcpServers => {\n\t\t\tlet updatedInputs = scannedMcpServers.inputs ?? [];\n\t\t\tconst existingServers = scannedMcpServers.servers ?? {};\n\t\t\tfor (const { name, config, inputs } of servers) {\n\t\t\t\texistingServers[name] = config;\n\t\t\t\tif (inputs) {\n\t\t\t\t\tconst existingInputIds = new Set(updatedInputs.map(input => input.id));\n\t\t\t\t\tconst newInputs = inputs.filter(input => !existingInputIds.has(input.id));\n\t\t\t\t\tupdatedInputs = [...updatedInputs, ...newInputs];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { servers: existingServers, inputs: updatedInputs };\n\t\t});\n\t}\n\n\tasync removeMcpServers(serverNames: string[], mcpResource: URI, target?: McpResourceTarget): Promise<void> {\n\t\tawait this.withProfileMcpServers(mcpResource, target, scannedMcpServers => {\n\t\t\tfor (const serverName of serverNames) {\n\t\t\t\tif (scannedMcpServers.servers?.[serverName]) {\n\t\t\t\t\tdelete scannedMcpServers.servers[serverName];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn scannedMcpServers;\n\t\t});\n\t}\n\n\tprivate async withProfileMcpServers(mcpResource: URI, target?: McpResourceTarget, updateFn?: (data: IScannedMcpServers) => IScannedMcpServers): Promise<IScannedMcpServers> {\n\t\treturn this.getResourceAccessQueue(mcpResource)\n\t\t\t.queue(async (): Promise<IScannedMcpServers> => {\n\t\t\t\ttarget = target ?? ConfigurationTarget.USER;\n\t\t\t\tlet scannedMcpServers: IScannedMcpServers = {};\n\t\t\t\ttry {\n\t\t\t\t\tconst content = await this.fileService.readFile(mcpResource);\n\t\t\t\t\tconst errors: ParseError[] = [];\n\t\t\t\t\tconst result = parse(content.value.toString(), errors, { allowTrailingComma: true, allowEmptyContent: true });\n\t\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\t\tthrow new Error('Failed to parse scanned MCP servers: ' + errors.join(', '));\n\t\t\t\t\t}\n\n\t\t\t\t\tif (target === ConfigurationTarget.USER) {\n\t\t\t\t\t\tscannedMcpServers = this.fromUserMcpServers(result);\n\t\t\t\t\t} else if (target === ConfigurationTarget.WORKSPACE_FOLDER) {\n\t\t\t\t\t\tscannedMcpServers = this.fromWorkspaceFolderMcpServers(result);\n\t\t\t\t\t} else if (target === ConfigurationTarget.WORKSPACE) {\n\t\t\t\t\t\tconst workspaceScannedMcpServers: IScannedWorkspaceMcpServers = result;\n\t\t\t\t\t\tif (workspaceScannedMcpServers.settings?.mcp) {\n\t\t\t\t\t\t\tscannedMcpServers = this.fromWorkspaceFolderMcpServers(workspaceScannedMcpServers.settings?.mcp);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (updateFn) {\n\t\t\t\t\tscannedMcpServers = updateFn(scannedMcpServers ?? {});\n\n\t\t\t\t\tif (target === ConfigurationTarget.USER) {\n\t\t\t\t\t\tawait this.writeScannedMcpServers(mcpResource, scannedMcpServers);\n\t\t\t\t\t} else if (target === ConfigurationTarget.WORKSPACE_FOLDER) {\n\t\t\t\t\t\tawait this.writeScannedMcpServersToWorkspaceFolder(mcpResource, scannedMcpServers);\n\t\t\t\t\t} else if (target === ConfigurationTarget.WORKSPACE) {\n\t\t\t\t\t\tawait this.writeScannedMcpServersToWorkspace(mcpResource, scannedMcpServers);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassertNever(target, `Invalid Target: ${ConfigurationTargetToString(target)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn scannedMcpServers;\n\t\t\t});\n\t}\n\n\tprivate async writeScannedMcpServers(mcpResource: URI, scannedMcpServers: IScannedMcpServers): Promise<void> {\n\t\tif ((scannedMcpServers.servers && Object.keys(scannedMcpServers.servers).length > 0) || (scannedMcpServers.inputs && scannedMcpServers.inputs.length > 0)) {\n\t\t\tawait this.fileService.writeFile(mcpResource, VSBuffer.fromString(JSON.stringify(scannedMcpServers, null, '\\t')));\n\t\t} else {\n\t\t\tawait this.fileService.del(mcpResource);\n\t\t}\n\t}\n\n\tprivate async writeScannedMcpServersToWorkspaceFolder(mcpResource: URI, scannedMcpServers: IScannedMcpServers): Promise<void> {\n\t\tawait this.fileService.writeFile(mcpResource, VSBuffer.fromString(JSON.stringify(scannedMcpServers, null, '\\t')));\n\t}\n\n\tprivate async writeScannedMcpServersToWorkspace(mcpResource: URI, scannedMcpServers: IScannedMcpServers): Promise<void> {\n\t\tlet scannedWorkspaceMcpServers: IScannedWorkspaceMcpServers | undefined;\n\t\ttry {\n\t\t\tconst content = await this.fileService.readFile(mcpResource);\n\t\t\tconst errors: ParseError[] = [];\n\t\t\tscannedWorkspaceMcpServers = parse(content.value.toString(), errors, { allowTrailingComma: true, allowEmptyContent: true }) as IScannedWorkspaceMcpServers;\n\t\t\tif (errors.length > 0) {\n\t\t\t\tthrow new Error('Failed to parse scanned MCP servers: ' + errors.join(', '));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tscannedWorkspaceMcpServers = { settings: {} };\n\t\t}\n\t\tif (!scannedWorkspaceMcpServers.settings) {\n\t\t\tscannedWorkspaceMcpServers.settings = {};\n\t\t}\n\t\tscannedWorkspaceMcpServers.settings.mcp = scannedMcpServers;\n\t\tawait this.fileService.writeFile(mcpResource, VSBuffer.fromString(JSON.stringify(scannedWorkspaceMcpServers, null, '\\t')));\n\t}\n\n\tprivate fromUserMcpServers(scannedMcpServers: IScannedMcpServers): IScannedMcpServers {\n\t\tconst userMcpServers: IScannedMcpServers = {\n\t\t\tinputs: scannedMcpServers.inputs\n\t\t};\n\t\tconst servers = Object.entries(scannedMcpServers.servers ?? {});\n\t\tif (servers.length > 0) {\n\t\t\tuserMcpServers.servers = {};\n\t\t\tfor (const [serverName, server] of servers) {\n\t\t\t\tuserMcpServers.servers[serverName] = this.sanitizeServer(server);\n\t\t\t}\n\t\t}\n\t\treturn userMcpServers;\n\t}\n\n\tprivate fromWorkspaceFolderMcpServers(scannedWorkspaceFolderMcpServers: IScannedMcpServers): IScannedMcpServers {\n\t\tconst scannedMcpServers: IScannedMcpServers = {\n\t\t\tinputs: scannedWorkspaceFolderMcpServers.inputs\n\t\t};\n\t\tconst servers = Object.entries(scannedWorkspaceFolderMcpServers.servers ?? {});\n\t\tif (servers.length > 0) {\n\t\t\tscannedMcpServers.servers = {};\n\t\t\tfor (const [serverName, config] of servers) {\n\t\t\t\tscannedMcpServers.servers[serverName] = this.sanitizeServer(config);\n\t\t\t}\n\t\t}\n\t\treturn scannedMcpServers;\n\t}\n\n\tprivate sanitizeServer(serverOrConfig: IOldScannedMcpServer | Mutable<IMcpServerConfiguration>): IMcpServerConfiguration {\n\t\tlet server: IMcpServerConfiguration;\n\t\tif ((<IOldScannedMcpServer>serverOrConfig).config) {\n\t\t\tconst oldScannedMcpServer = <IOldScannedMcpServer>serverOrConfig;\n\t\t\tserver = {\n\t\t\t\t...oldScannedMcpServer.config,\n\t\t\t\tversion: oldScannedMcpServer.version,\n\t\t\t\tgallery: oldScannedMcpServer.gallery\n\t\t\t};\n\t\t} else {\n\t\t\tserver = serverOrConfig as IMcpServerConfiguration;\n\t\t}\n\n\t\tif (server.type === undefined || (server.type !== McpServerType.REMOTE && server.type !== McpServerType.LOCAL)) {\n\t\t\t(<Mutable<ICommonMcpServerConfiguration>>server).type = (<IMcpStdioServerConfiguration>server).command ? McpServerType.LOCAL : McpServerType.REMOTE;\n\t\t}\n\n\t\treturn server;\n\t}\n\n\tprivate getResourceAccessQueue(file: URI): Queue<IScannedMcpServers> {\n\t\tlet resourceQueue = this.resourcesAccessQueueMap.get(file);\n\t\tif (!resourceQueue) {\n\t\t\tresourceQueue = new Queue<IScannedMcpServers>();\n\t\t\tthis.resourcesAccessQueueMap.set(file, resourceQueue);\n\t\t}\n\t\treturn resourceQueue;\n\t}\n}\n\nregisterSingleton(IMcpResourceScannerService, McpResourceScannerService, InstantiationType.Delayed);\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { RunOnceScheduler } from '../../../base/common/async.js';\nimport { VSBuffer } from '../../../base/common/buffer.js';\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable, DisposableStore, IDisposable } from '../../../base/common/lifecycle.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { equals } from '../../../base/common/objects.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { ConfigurationTarget } from '../../configuration/common/configuration.js';\nimport { IEnvironmentService } from '../../environment/common/environment.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { IInstantiationService } from '../../instantiation/common/instantiation.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';\nimport { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';\nimport { DidUninstallMcpServerEvent, IGalleryMcpServer, ILocalMcpServer, IMcpGalleryService, IMcpManagementService, IMcpServerInput, IMcpServerManifest, InstallMcpServerEvent, InstallMcpServerResult, PackageType, UninstallMcpServerEvent, InstallOptions, UninstallOptions, IInstallableMcpServer } from './mcpManagement.js';\nimport { IMcpServerVariable, McpServerVariableType, IMcpServerConfiguration, McpServerType } from './mcpPlatformTypes.js';\nimport { IMcpResourceScannerService, McpResourceTarget } from './mcpResourceScannerService.js';\n\nexport interface ILocalMcpServerInfo {\n\tname: string;\n\tversion?: string;\n\tid?: string;\n\tdisplayName?: string;\n\turl?: string;\n\tdescription?: string;\n\trepositoryUrl?: string;\n\tpublisher?: string;\n\tpublisherDisplayName?: string;\n\ticon?: {\n\t\tdark: string;\n\t\tlight: string;\n\t};\n\tcodicon?: string;\n\tmanifest?: IMcpServerManifest;\n\treadmeUrl?: URI;\n\tlocation?: URI;\n\tlicenseUrl?: string;\n}\n\nexport abstract class AbstractMcpResourceManagementService extends Disposable implements IMcpManagementService {\n\n\t_serviceBrand: undefined;\n\n\tprivate initializePromise: Promise<void> | undefined;\n\tprivate readonly reloadConfigurationScheduler: RunOnceScheduler;\n\tprivate local = new Map<string, ILocalMcpServer>();\n\n\tprotected readonly _onInstallMcpServer = this._register(new Emitter<InstallMcpServerEvent>());\n\treadonly onInstallMcpServer = this._onInstallMcpServer.event;\n\n\tprotected readonly _onDidInstallMcpServers = this._register(new Emitter<InstallMcpServerResult[]>());\n\tget onDidInstallMcpServers() { return this._onDidInstallMcpServers.event; }\n\n\tprotected readonly _onDidUpdateMcpServers = this._register(new Emitter<InstallMcpServerResult[]>());\n\tget onDidUpdateMcpServers() { return this._onDidUpdateMcpServers.event; }\n\n\tprotected readonly _onUninstallMcpServer = this._register(new Emitter<UninstallMcpServerEvent>());\n\tget onUninstallMcpServer() { return this._onUninstallMcpServer.event; }\n\n\tprotected _onDidUninstallMcpServer = this._register(new Emitter<DidUninstallMcpServerEvent>());\n\tget onDidUninstallMcpServer() { return this._onDidUninstallMcpServer.event; }\n\n\tconstructor(\n\t\tprotected readonly mcpResource: URI,\n\t\tprotected readonly target: McpResourceTarget,\n\t\t@IMcpGalleryService protected readonly mcpGalleryService: IMcpGalleryService,\n\t\t@IFileService protected readonly fileService: IFileService,\n\t\t@IUriIdentityService protected readonly uriIdentityService: IUriIdentityService,\n\t\t@ILogService protected readonly logService: ILogService,\n\t\t@IMcpResourceScannerService protected readonly mcpResourceScannerService: IMcpResourceScannerService,\n\t) {\n\t\tsuper();\n\t\tthis.reloadConfigurationScheduler = this._register(new RunOnceScheduler(() => this.updateLocal(), 50));\n\t}\n\n\tprivate initialize(): Promise<void> {\n\t\tif (!this.initializePromise) {\n\t\t\tthis.initializePromise = (async () => {\n\t\t\t\tthis.local = await this.populateLocalServers();\n\t\t\t\tthis.startWatching();\n\t\t\t})();\n\t\t}\n\t\treturn this.initializePromise;\n\t}\n\n\tprivate async populateLocalServers(): Promise<Map<string, ILocalMcpServer>> {\n\t\tthis.logService.trace('AbstractMcpResourceManagementService#populateLocalServers', this.mcpResource.toString());\n\t\tconst local = new Map<string, ILocalMcpServer>();\n\t\ttry {\n\t\t\tconst scannedMcpServers = await this.mcpResourceScannerService.scanMcpServers(this.mcpResource, this.target);\n\t\t\tif (scannedMcpServers.servers) {\n\t\t\t\tawait Promise.allSettled(Object.entries(scannedMcpServers.servers).map(async ([name, scannedServer]) => {\n\t\t\t\t\tconst server = await this.scanLocalServer(name, scannedServer);\n\t\t\t\t\tlocal.set(name, server);\n\t\t\t\t}));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logService.debug('Could not read user MCP servers:', error);\n\t\t\tthrow error;\n\t\t}\n\t\treturn local;\n\t}\n\n\tprivate startWatching(): void {\n\t\tthis._register(this.fileService.watch(this.mcpResource));\n\t\tthis._register(this.fileService.onDidFilesChange(e => {\n\t\t\tif (e.affects(this.mcpResource)) {\n\t\t\t\tthis.reloadConfigurationScheduler.schedule();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprotected async updateLocal(): Promise<void> {\n\t\ttry {\n\t\t\tconst current = await this.populateLocalServers();\n\n\t\t\tconst added: ILocalMcpServer[] = [];\n\t\t\tconst updated: ILocalMcpServer[] = [];\n\t\t\tconst removed = [...this.local.keys()].filter(name => !current.has(name));\n\n\t\t\tfor (const server of removed) {\n\t\t\t\tthis.local.delete(server);\n\t\t\t}\n\n\t\t\tfor (const [name, server] of current) {\n\t\t\t\tconst previous = this.local.get(name);\n\t\t\t\tif (previous) {\n\t\t\t\t\tif (!equals(previous, server)) {\n\t\t\t\t\t\tupdated.push(server);\n\t\t\t\t\t\tthis.local.set(name, server);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tadded.push(server);\n\t\t\t\t\tthis.local.set(name, server);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const server of removed) {\n\t\t\t\tthis.local.delete(server);\n\t\t\t\tthis._onDidUninstallMcpServer.fire({ name: server, mcpResource: this.mcpResource });\n\t\t\t}\n\n\t\t\tif (updated.length) {\n\t\t\t\tthis._onDidUpdateMcpServers.fire(updated.map(server => ({ name: server.name, local: server, mcpResource: this.mcpResource })));\n\t\t\t}\n\n\t\t\tif (added.length) {\n\t\t\t\tthis._onDidInstallMcpServers.fire(added.map(server => ({ name: server.name, local: server, mcpResource: this.mcpResource })));\n\t\t\t}\n\n\t\t} catch (error) {\n\t\t\tthis.logService.error('Failed to load installed MCP servers:', error);\n\t\t}\n\t}\n\n\tasync getInstalled(): Promise<ILocalMcpServer[]> {\n\t\tawait this.initialize();\n\t\treturn Array.from(this.local.values());\n\t}\n\n\tprotected async scanLocalServer(name: string, config: IMcpServerConfiguration): Promise<ILocalMcpServer> {\n\t\tlet mcpServerInfo = await this.getLocalServerInfo(name, config);\n\t\tif (!mcpServerInfo) {\n\t\t\tmcpServerInfo = { name, version: config.version };\n\t\t}\n\n\t\treturn {\n\t\t\tname,\n\t\t\tconfig,\n\t\t\tmcpResource: this.mcpResource,\n\t\t\tversion: mcpServerInfo.version,\n\t\t\tlocation: mcpServerInfo.location,\n\t\t\tid: mcpServerInfo.id,\n\t\t\tdisplayName: mcpServerInfo.displayName,\n\t\t\tdescription: mcpServerInfo.description,\n\t\t\tpublisher: mcpServerInfo.publisher,\n\t\t\tpublisherDisplayName: mcpServerInfo.publisherDisplayName,\n\t\t\trepositoryUrl: mcpServerInfo.repositoryUrl,\n\t\t\treadmeUrl: mcpServerInfo.readmeUrl,\n\t\t\ticon: mcpServerInfo.icon,\n\t\t\tcodicon: mcpServerInfo.codicon,\n\t\t\tmanifest: mcpServerInfo.manifest,\n\t\t\tsource: config.gallery ? 'gallery' : 'local'\n\t\t};\n\t}\n\n\tasync install(server: IInstallableMcpServer, options?: Omit<InstallOptions, 'mcpResource'>): Promise<ILocalMcpServer> {\n\t\tthis.logService.trace('MCP Management Service: install', server.name);\n\n\t\tthis._onInstallMcpServer.fire({ name: server.name, mcpResource: this.mcpResource });\n\t\ttry {\n\t\t\tawait this.mcpResourceScannerService.addMcpServers([server], this.mcpResource, this.target);\n\t\t\tawait this.updateLocal();\n\t\t\tconst local = this.local.get(server.name);\n\t\t\tif (!local) {\n\t\t\t\tthrow new Error(`Failed to install MCP server: ${server.name}`);\n\t\t\t}\n\t\t\treturn local;\n\t\t} catch (e) {\n\t\t\tthis._onDidInstallMcpServers.fire([{ name: server.name, error: e, mcpResource: this.mcpResource }]);\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tasync uninstall(server: ILocalMcpServer, options?: Omit<UninstallOptions, 'mcpResource'>): Promise<void> {\n\t\tthis.logService.trace('MCP Management Service: uninstall', server.name);\n\t\tthis._onUninstallMcpServer.fire({ name: server.name, mcpResource: this.mcpResource });\n\n\t\ttry {\n\t\t\tconst currentServers = await this.mcpResourceScannerService.scanMcpServers(this.mcpResource, this.target);\n\t\t\tif (!currentServers.servers) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait this.mcpResourceScannerService.removeMcpServers([server.name], this.mcpResource, this.target);\n\t\t\tif (server.location) {\n\t\t\t\tawait this.fileService.del(URI.revive(server.location), { recursive: true });\n\t\t\t}\n\t\t\tawait this.updateLocal();\n\t\t} catch (e) {\n\t\t\tthis._onDidUninstallMcpServer.fire({ name: server.name, error: e, mcpResource: this.mcpResource });\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tprotected toScannedMcpServerAndInputs(manifest: IMcpServerManifest, packageType?: PackageType): { config: IMcpServerConfiguration; inputs?: IMcpServerVariable[] } {\n\t\tif (packageType === undefined) {\n\t\t\tpackageType = manifest.packages?.[0]?.registry_name ?? PackageType.REMOTE;\n\t\t}\n\n\t\tlet config: IMcpServerConfiguration;\n\t\tconst inputs: IMcpServerVariable[] = [];\n\n\t\tif (packageType === PackageType.REMOTE && manifest.remotes?.length) {\n\t\t\tconst headers: Record<string, string> = {};\n\t\t\tfor (const input of manifest.remotes[0].headers ?? []) {\n\t\t\t\tconst variables = input.variables ? this.getVariables(input.variables) : [];\n\t\t\t\tlet value = input.value;\n\t\t\t\tfor (const variable of variables) {\n\t\t\t\t\tvalue = value.replace(`{${variable.id}}`, `{input:${variable.id}}`);\n\t\t\t\t}\n\t\t\t\theaders[input.name] = value;\n\t\t\t\tif (variables.length) {\n\t\t\t\t\tinputs.push(...variables);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconfig = {\n\t\t\t\ttype: McpServerType.REMOTE,\n\t\t\t\turl: manifest.remotes[0].url,\n\t\t\t\theaders: Object.keys(headers).length ? headers : undefined,\n\t\t\t};\n\t\t} else {\n\t\t\tconst serverPackage = manifest.packages?.find(p => p.registry_name === packageType) ?? manifest.packages?.[0];\n\t\t\tif (!serverPackage) {\n\t\t\t\tthrow new Error(`No server package found`);\n\t\t\t}\n\n\t\t\tconst args: string[] = [];\n\t\t\tconst env: Record<string, string> = {};\n\n\t\t\tif (serverPackage.registry_name === PackageType.DOCKER) {\n\t\t\t\targs.push('run');\n\t\t\t\targs.push('-i');\n\t\t\t\targs.push('--rm');\n\t\t\t}\n\n\t\t\tfor (const arg of serverPackage.runtime_arguments ?? []) {\n\t\t\t\tconst variables = arg.variables ? this.getVariables(arg.variables) : [];\n\t\t\t\tif (arg.type === 'positional') {\n\t\t\t\t\tlet value = arg.value;\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tfor (const variable of variables) {\n\t\t\t\t\t\t\tvalue = value.replace(`{${variable.id}}`, `{input:${variable.id}}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\targs.push(value ?? arg.value_hint);\n\t\t\t\t} else if (arg.type === 'named') {\n\t\t\t\t\targs.push(arg.name);\n\t\t\t\t\tif (arg.value) {\n\t\t\t\t\t\tlet value = arg.value;\n\t\t\t\t\t\tfor (const variable of variables) {\n\t\t\t\t\t\t\tvalue = value.replace(`{${variable.id}}`, `{input:${variable.id}}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\targs.push(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (variables.length) {\n\t\t\t\t\tinputs.push(...variables);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const input of serverPackage.environment_variables ?? []) {\n\t\t\t\tconst variables = input.variables ? this.getVariables(input.variables) : [];\n\t\t\t\tlet value = input.value;\n\t\t\t\tfor (const variable of variables) {\n\t\t\t\t\tvalue = value.replace(`{${variable.id}}`, `{input:${variable.id}}`);\n\t\t\t\t}\n\t\t\t\tenv[input.name] = value;\n\t\t\t\tif (variables.length) {\n\t\t\t\t\tinputs.push(...variables);\n\t\t\t\t}\n\t\t\t\tif (serverPackage.registry_name === PackageType.DOCKER) {\n\t\t\t\t\targs.push('-e');\n\t\t\t\t\targs.push(input.name);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (serverPackage.registry_name === PackageType.NODE) {\n\t\t\t\targs.push(serverPackage.version ? `${serverPackage.name}@${serverPackage.version}` : serverPackage.name);\n\t\t\t}\n\t\t\telse if (serverPackage.registry_name === PackageType.PYTHON) {\n\t\t\t\targs.push(serverPackage.version ? `${serverPackage.name}==${serverPackage.version}` : serverPackage.name);\n\t\t\t}\n\t\t\telse if (serverPackage.registry_name === PackageType.DOCKER) {\n\t\t\t\targs.push(serverPackage.version ? `${serverPackage.name}:${serverPackage.version}` : serverPackage.name);\n\t\t\t}\n\n\t\t\tfor (const arg of serverPackage.package_arguments ?? []) {\n\t\t\t\tconst variables = arg.variables ? this.getVariables(arg.variables) : [];\n\t\t\t\tif (arg.type === 'positional') {\n\t\t\t\t\tlet value = arg.value;\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tfor (const variable of variables) {\n\t\t\t\t\t\t\tvalue = value.replace(`{${variable.id}}`, `{input:${variable.id}}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\targs.push(value ?? arg.value_hint);\n\t\t\t\t} else if (arg.type === 'named') {\n\t\t\t\t\targs.push(arg.name);\n\t\t\t\t\tif (arg.value) {\n\t\t\t\t\t\tlet value = arg.value;\n\t\t\t\t\t\tfor (const variable of variables) {\n\t\t\t\t\t\t\tvalue = value.replace(`{${variable.id}}`, `{input:${variable.id}}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\targs.push(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (variables.length) {\n\t\t\t\t\tinputs.push(...variables);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconfig = {\n\t\t\t\ttype: McpServerType.LOCAL,\n\t\t\t\tcommand: this.getCommandName(serverPackage.registry_name),\n\t\t\t\targs: args.length ? args : undefined,\n\t\t\t\tenv: Object.keys(env).length ? env : undefined,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tconfig,\n\t\t\tinputs: inputs.length ? inputs : undefined,\n\t\t};\n\t}\n\n\tprivate getCommandName(packageType: PackageType): string {\n\t\tswitch (packageType) {\n\t\t\tcase PackageType.NODE: return 'npx';\n\t\t\tcase PackageType.DOCKER: return 'docker';\n\t\t\tcase PackageType.PYTHON: return 'uvx';\n\t\t}\n\t\treturn packageType;\n\t}\n\n\tprivate getVariables(variableInputs: Record<string, IMcpServerInput>): IMcpServerVariable[] {\n\t\tconst variables: IMcpServerVariable[] = [];\n\t\tfor (const [key, value] of Object.entries(variableInputs)) {\n\t\t\tvariables.push({\n\t\t\t\tid: key,\n\t\t\t\ttype: value.choices ? McpServerVariableType.PICK : McpServerVariableType.PROMPT,\n\t\t\t\tdescription: value.description ?? '',\n\t\t\t\tpassword: !!value.is_secret,\n\t\t\t\tdefault: value.default,\n\t\t\t\toptions: value.choices,\n\t\t\t});\n\t\t}\n\t\treturn variables;\n\t}\n\n\tabstract installFromGallery(server: IGalleryMcpServer, options?: InstallOptions): Promise<ILocalMcpServer>;\n\tabstract updateMetadata(local: ILocalMcpServer, server: IGalleryMcpServer, profileLocation: URI): Promise<ILocalMcpServer>;\n\tprotected abstract getLocalServerInfo(name: string, mcpServerConfig: IMcpServerConfiguration): Promise<ILocalMcpServerInfo | undefined>;\n}\n\nexport class McpUserResourceManagementService extends AbstractMcpResourceManagementService implements IMcpManagementService {\n\n\tprivate readonly mcpLocation: URI;\n\n\tconstructor(\n\t\tmcpResource: URI,\n\t\t@IMcpGalleryService mcpGalleryService: IMcpGalleryService,\n\t\t@IFileService fileService: IFileService,\n\t\t@IUriIdentityService uriIdentityService: IUriIdentityService,\n\t\t@ILogService logService: ILogService,\n\t\t@IMcpResourceScannerService mcpResourceScannerService: IMcpResourceScannerService,\n\t\t@IEnvironmentService environmentService: IEnvironmentService\n\t) {\n\t\tsuper(mcpResource, ConfigurationTarget.USER, mcpGalleryService, fileService, uriIdentityService, logService, mcpResourceScannerService);\n\t\tthis.mcpLocation = uriIdentityService.extUri.joinPath(environmentService.userRoamingDataHome, 'mcp');\n\t}\n\n\tasync installFromGallery(server: IGalleryMcpServer, options?: InstallOptions): Promise<ILocalMcpServer> {\n\t\tthis.logService.trace('MCP Management Service: installGallery', server.url);\n\n\t\tthis._onInstallMcpServer.fire({ name: server.name, mcpResource: this.mcpResource });\n\n\t\ttry {\n\t\t\tconst manifest = await this.updateMetadataFromGallery(server);\n\t\t\tconst { config, inputs } = this.toScannedMcpServerAndInputs(manifest, options?.packageType);\n\t\t\tconst installable: IInstallableMcpServer = {\n\t\t\t\tname: server.name,\n\t\t\t\tconfig: {\n\t\t\t\t\t...config,\n\t\t\t\t\tgallery: true,\n\t\t\t\t\tversion: server.version\n\t\t\t\t},\n\t\t\t\tinputs\n\t\t\t};\n\n\t\t\tawait this.mcpResourceScannerService.addMcpServers([installable], this.mcpResource, this.target);\n\n\t\t\tawait this.updateLocal();\n\t\t\tconst local = (await this.getInstalled()).find(s => s.name === server.name);\n\t\t\tif (!local) {\n\t\t\t\tthrow new Error(`Failed to install MCP server: ${server.name}`);\n\t\t\t}\n\t\t\treturn local;\n\t\t} catch (e) {\n\t\t\tthis._onDidInstallMcpServers.fire([{ name: server.name, source: server, error: e, mcpResource: this.mcpResource }]);\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tasync updateMetadata(local: ILocalMcpServer, gallery: IGalleryMcpServer): Promise<ILocalMcpServer> {\n\t\tawait this.updateMetadataFromGallery(gallery);\n\t\tawait this.updateLocal();\n\t\tconst updatedLocal = (await this.getInstalled()).find(s => s.name === local.name);\n\t\tif (!updatedLocal) {\n\t\t\tthrow new Error(`Failed to find MCP server: ${local.name}`);\n\t\t}\n\t\treturn updatedLocal;\n\t}\n\n\tprivate async updateMetadataFromGallery(gallery: IGalleryMcpServer): Promise<IMcpServerManifest> {\n\t\tconst manifest = await this.mcpGalleryService.getManifest(gallery, CancellationToken.None);\n\t\tconst location = this.getLocation(gallery.name, gallery.version);\n\t\tconst manifestPath = this.uriIdentityService.extUri.joinPath(location, 'manifest.json');\n\t\tconst local: ILocalMcpServerInfo = {\n\t\t\tid: gallery.id,\n\t\t\tname: gallery.name,\n\t\t\tdisplayName: gallery.displayName,\n\t\t\tdescription: gallery.description,\n\t\t\tversion: gallery.version,\n\t\t\tpublisher: gallery.publisher,\n\t\t\tpublisherDisplayName: gallery.publisherDisplayName,\n\t\t\trepositoryUrl: gallery.repositoryUrl,\n\t\t\tlicenseUrl: gallery.licenseUrl,\n\t\t\ticon: gallery.icon,\n\t\t\tcodicon: gallery.codicon,\n\t\t\tmanifest,\n\t\t};\n\t\tawait this.fileService.writeFile(manifestPath, VSBuffer.fromString(JSON.stringify(local)));\n\n\t\tif (gallery.readmeUrl) {\n\t\t\tconst readme = await this.mcpGalleryService.getReadme(gallery, CancellationToken.None);\n\t\t\tawait this.fileService.writeFile(this.uriIdentityService.extUri.joinPath(location, 'README.md'), VSBuffer.fromString(readme));\n\t\t}\n\n\t\treturn manifest;\n\t}\n\n\tprotected async getLocalServerInfo(name: string, mcpServerConfig: IMcpServerConfiguration): Promise<ILocalMcpServerInfo | undefined> {\n\t\tlet storedMcpServerInfo: ILocalMcpServerInfo | undefined;\n\t\tlet location: URI | undefined;\n\t\tlet readmeUrl: URI | undefined;\n\t\tif (mcpServerConfig.gallery) {\n\t\t\tlocation = this.getLocation(name, mcpServerConfig.version);\n\t\t\tconst manifestLocation = this.uriIdentityService.extUri.joinPath(location, 'manifest.json');\n\t\t\ttry {\n\t\t\t\tconst content = await this.fileService.readFile(manifestLocation);\n\t\t\t\tstoredMcpServerInfo = JSON.parse(content.value.toString()) as ILocalMcpServerInfo;\n\t\t\t\tstoredMcpServerInfo.location = location;\n\t\t\t\treadmeUrl = this.uriIdentityService.extUri.joinPath(location, 'README.md');\n\t\t\t\tif (!await this.fileService.exists(readmeUrl)) {\n\t\t\t\t\treadmeUrl = undefined;\n\t\t\t\t}\n\t\t\t\tstoredMcpServerInfo.readmeUrl = readmeUrl;\n\t\t\t} catch (e) {\n\t\t\t\tthis.logService.error('MCP Management Service: failed to read manifest', location.toString(), e);\n\t\t\t}\n\t\t}\n\t\treturn storedMcpServerInfo;\n\t}\n\n\tprivate getLocation(name: string, version?: string): URI {\n\t\tname = name.replace('/', '.');\n\t\treturn this.uriIdentityService.extUri.joinPath(this.mcpLocation, version ? `${name}-${version}` : name);\n\t}\n\n}\n\nexport class McpManagementService extends Disposable implements IMcpManagementService {\n\n\treadonly _serviceBrand: undefined;\n\n\tprivate readonly _onInstallMcpServer = this._register(new Emitter<InstallMcpServerEvent>());\n\treadonly onInstallMcpServer = this._onInstallMcpServer.event;\n\n\tprivate readonly _onDidInstallMcpServers = this._register(new Emitter<readonly InstallMcpServerResult[]>());\n\treadonly onDidInstallMcpServers = this._onDidInstallMcpServers.event;\n\n\tprivate readonly _onDidUpdateMcpServers = this._register(new Emitter<readonly InstallMcpServerResult[]>());\n\treadonly onDidUpdateMcpServers = this._onDidUpdateMcpServers.event;\n\n\tprivate readonly _onUninstallMcpServer = this._register(new Emitter<UninstallMcpServerEvent>());\n\treadonly onUninstallMcpServer = this._onUninstallMcpServer.event;\n\n\tprivate readonly _onDidUninstallMcpServer = this._register(new Emitter<DidUninstallMcpServerEvent>());\n\treadonly onDidUninstallMcpServer = this._onDidUninstallMcpServer.event;\n\n\tprivate readonly mcpResourceManagementServices = new ResourceMap<{ service: McpUserResourceManagementService } & IDisposable>();\n\n\tconstructor(\n\t\t@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,\n\t\t@IInstantiationService private readonly instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\t}\n\n\tprivate getMcpResourceManagementService(mcpResource: URI): McpUserResourceManagementService {\n\t\tlet mcpResourceManagementService = this.mcpResourceManagementServices.get(mcpResource);\n\t\tif (!mcpResourceManagementService) {\n\t\t\tconst disposables = new DisposableStore();\n\t\t\tconst service = disposables.add(this.instantiationService.createInstance(McpUserResourceManagementService, mcpResource));\n\t\t\tdisposables.add(service.onInstallMcpServer(e => this._onInstallMcpServer.fire(e)));\n\t\t\tdisposables.add(service.onDidInstallMcpServers(e => this._onDidInstallMcpServers.fire(e)));\n\t\t\tdisposables.add(service.onDidUpdateMcpServers(e => this._onDidUpdateMcpServers.fire(e)));\n\t\t\tdisposables.add(service.onUninstallMcpServer(e => this._onUninstallMcpServer.fire(e)));\n\t\t\tdisposables.add(service.onDidUninstallMcpServer(e => this._onDidUninstallMcpServer.fire(e)));\n\t\t\tthis.mcpResourceManagementServices.set(mcpResource, mcpResourceManagementService = { service, dispose: () => disposables.dispose() });\n\t\t}\n\t\treturn mcpResourceManagementService.service;\n\t}\n\n\tasync getInstalled(mcpResource?: URI): Promise<ILocalMcpServer[]> {\n\t\tconst mcpResourceUri = mcpResource || this.userDataProfilesService.defaultProfile.mcpResource;\n\t\treturn this.getMcpResourceManagementService(mcpResourceUri).getInstalled();\n\t}\n\n\tasync install(server: IInstallableMcpServer, options?: InstallOptions): Promise<ILocalMcpServer> {\n\t\tconst mcpResourceUri = options?.mcpResource || this.userDataProfilesService.defaultProfile.mcpResource;\n\t\treturn this.getMcpResourceManagementService(mcpResourceUri).install(server, options);\n\t}\n\n\tasync uninstall(server: ILocalMcpServer, options?: UninstallOptions): Promise<void> {\n\t\tconst mcpResourceUri = options?.mcpResource || this.userDataProfilesService.defaultProfile.mcpResource;\n\t\treturn this.getMcpResourceManagementService(mcpResourceUri).uninstall(server, options);\n\t}\n\n\tasync installFromGallery(server: IGalleryMcpServer, options?: InstallOptions): Promise<ILocalMcpServer> {\n\t\tconst mcpResourceUri = options?.mcpResource || this.userDataProfilesService.defaultProfile.mcpResource;\n\t\treturn this.getMcpResourceManagementService(mcpResourceUri).installFromGallery(server, options);\n\t}\n\n\tasync updateMetadata(local: ILocalMcpServer, gallery: IGalleryMcpServer, mcpResource?: URI): Promise<ILocalMcpServer> {\n\t\treturn this.getMcpResourceManagementService(mcpResource || this.userDataProfilesService.defaultProfile.mcpResource).updateMetadata(local, gallery);\n\t}\n\n\toverride dispose(): void {\n\t\tthis.mcpResourceManagementServices.forEach(service => service.dispose());\n\t\tthis.mcpResourceManagementServices.clear();\n\t\tsuper.dispose();\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../base/common/cancellation.js';\nimport { MarkdownString } from '../../../base/common/htmlContent.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { Schemas } from '../../../base/common/network.js';\nimport { dirname, joinPath } from '../../../base/common/resources.js';\nimport { uppercaseFirstLetter } from '../../../base/common/strings.js';\nimport { isString } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IFileService } from '../../files/common/files.js';\nimport { ILogService } from '../../log/common/log.js';\nimport { IProductService } from '../../product/common/productService.js';\nimport { asJson, asText, IRequestService } from '../../request/common/request.js';\nimport { IGalleryMcpServer, IMcpGalleryService, IMcpServerManifest, IQueryOptions, mcpGalleryServiceUrlConfig, PackageType } from './mcpManagement.js';\n\ninterface IRawGalleryServersResult {\n\treadonly servers: readonly IRawGalleryMcpServer[];\n}\n\ninterface IRawGalleryMcpServer {\n\treadonly id?: string;\n\treadonly name: string;\n\treadonly description: string;\n\treadonly displayName?: string;\n\treadonly iconUrl?: string;\n\treadonly iconUrlDark?: string;\n\treadonly iconUrlLight?: string;\n\treadonly codicon?: string;\n\treadonly repository?: {\n\t\treadonly url: string;\n\t\treadonly source: string;\n\t};\n\treadonly version_detail?: {\n\t\treadonly version: string;\n\t\treadonly release_date: string;\n\t\treadonly is_latest: boolean;\n\t};\n\treadonly readmeUrl: string;\n\treadonly publisher?: {\n\t\treadonly displayName: string;\n\t\treadonly url: string;\n\t\treadonly is_verified: boolean;\n\t};\n\treadonly package_types?: readonly PackageType[];\n\treadonly manifest?: IMcpServerManifest;\n}\n\ntype RawGalleryMcpServerManifest = IRawGalleryMcpServer & IMcpServerManifest;\n\nexport class McpGalleryService extends Disposable implements IMcpGalleryService {\n\n\t_serviceBrand: undefined;\n\n\tconstructor(\n\t\t@IConfigurationService private readonly configurationService: IConfigurationService,\n\t\t@IRequestService private readonly requestService: IRequestService,\n\t\t@IFileService private readonly fileService: IFileService,\n\t\t@IProductService private readonly productService: IProductService,\n\t\t@ILogService private readonly logService: ILogService,\n\t) {\n\t\tsuper();\n\t}\n\n\tisEnabled(): boolean {\n\t\treturn this.getMcpGalleryUrl() !== undefined;\n\t}\n\n\tasync query(options?: IQueryOptions, token: CancellationToken = CancellationToken.None): Promise<IGalleryMcpServer[]> {\n\t\tlet { servers } = await this.fetchGallery(token);\n\n\t\tif (options?.text) {\n\t\t\tconst searchText = options.text.toLowerCase();\n\t\t\tservers = servers.filter(item => item.name.toLowerCase().includes(searchText) || item.description.toLowerCase().includes(searchText));\n\t\t}\n\n\t\tconst galleryServers: IGalleryMcpServer[] = [];\n\t\tfor (const item of servers) {\n\t\t\tgalleryServers.push(this.toGalleryMcpServer(item));\n\t\t}\n\n\t\treturn galleryServers;\n\t}\n\n\tasync getMcpServers(names: string[]): Promise<IGalleryMcpServer[]> {\n\t\tconst mcpUrl = this.getMcpGalleryUrl() ?? this.productService.extensionsGallery?.mcpUrl;\n\t\tif (!mcpUrl) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst { servers } = await this.fetchGallery(mcpUrl, CancellationToken.None);\n\t\tconst filteredServers = servers.filter(item => names.includes(item.name));\n\t\treturn filteredServers.map(item => this.toGalleryMcpServer(item));\n\t}\n\n\tasync getManifest(gallery: IGalleryMcpServer, token: CancellationToken): Promise<IMcpServerManifest> {\n\t\tif (gallery.manifest) {\n\t\t\treturn gallery.manifest;\n\t\t}\n\n\t\tif (!gallery.manifestUrl) {\n\t\t\tthrow new Error(`No manifest URL found for ${gallery.name}`);\n\t\t}\n\n\t\tconst uri = URI.parse(gallery.manifestUrl);\n\t\tif (uri.scheme === Schemas.file) {\n\t\t\ttry {\n\t\t\t\tconst content = await this.fileService.readFile(uri);\n\t\t\t\tconst data = content.value.toString();\n\t\t\t\treturn JSON.parse(data);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.error(`Failed to read file from ${uri}: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\tconst context = await this.requestService.request({\n\t\t\ttype: 'GET',\n\t\t\turl: gallery.manifestUrl,\n\t\t}, token);\n\n\t\tconst result = await asJson<RawGalleryMcpServerManifest>(context);\n\t\tif (!result) {\n\t\t\tthrow new Error(`Failed to fetch manifest from ${gallery.manifestUrl}`);\n\t\t}\n\n\t\treturn {\n\t\t\tpackages: result.packages,\n\t\t\tremotes: result.remotes,\n\t\t};\n\t}\n\n\tasync getReadme(gallery: IGalleryMcpServer, token: CancellationToken): Promise<string> {\n\t\tconst readmeUrl = gallery.readmeUrl;\n\t\tif (!readmeUrl) {\n\t\t\treturn Promise.resolve(localize('noReadme', 'No README available'));\n\t\t}\n\n\t\tconst uri = URI.parse(readmeUrl);\n\t\tif (uri.scheme === Schemas.file) {\n\t\t\ttry {\n\t\t\t\tconst content = await this.fileService.readFile(uri);\n\t\t\t\treturn content.value.toString();\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.error(`Failed to read file from ${uri}: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\tif (uri.authority !== 'raw.githubusercontent.com') {\n\t\t\treturn new MarkdownString(localize('readme.viewInBrowser', \"You can find information about this server [here]({0})\", readmeUrl)).value;\n\t\t}\n\n\t\tconst context = await this.requestService.request({\n\t\t\ttype: 'GET',\n\t\t\turl: readmeUrl,\n\t\t}, token);\n\n\t\tconst result = await asText(context);\n\t\tif (!result) {\n\t\t\tthrow new Error(`Failed to fetch README from ${readmeUrl}`);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate toGalleryMcpServer(item: IRawGalleryMcpServer): IGalleryMcpServer {\n\t\tlet publisher = '';\n\t\tconst nameParts = item.name.split('/');\n\t\tif (nameParts.length > 0) {\n\t\t\tconst domainParts = nameParts[0].split('.');\n\t\t\tif (domainParts.length > 0) {\n\t\t\t\tpublisher = domainParts[domainParts.length - 1]; // Always take the last part as owner\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tid: item.id ?? item.name,\n\t\t\tname: item.name,\n\t\t\tdisplayName: item.displayName ?? nameParts[nameParts.length - 1].split('-').map(s => uppercaseFirstLetter(s)).join(' '),\n\t\t\turl: item.repository?.url,\n\t\t\tdescription: item.description,\n\t\t\tversion: item.version_detail?.version,\n\t\t\tlastUpdated: item.version_detail ? Date.parse(item.version_detail.release_date) : undefined,\n\t\t\trepositoryUrl: item.repository?.url,\n\t\t\tcodicon: item.codicon,\n\t\t\treadmeUrl: item.readmeUrl,\n\t\t\tmanifestUrl: this.getManifestUrl(item),\n\t\t\tpackageTypes: item.package_types ?? [],\n\t\t\tpublisher,\n\t\t\tpublisherDisplayName: item.publisher?.displayName,\n\t\t\tpublisherDomain: item.publisher ? {\n\t\t\t\tlink: item.publisher.url,\n\t\t\t\tverified: item.publisher.is_verified,\n\t\t\t} : undefined,\n\t\t\tmanifest: item.manifest\n\t\t};\n\t}\n\n\tprivate async fetchGallery(token: CancellationToken): Promise<IRawGalleryServersResult>;\n\tprivate async fetchGallery(url: string, token: CancellationToken): Promise<IRawGalleryServersResult>;\n\tprivate async fetchGallery(arg1: any, arg2?: any): Promise<IRawGalleryServersResult> {\n\t\tconst mcpGalleryUrl = isString(arg1) ? arg1 : this.getMcpGalleryUrl();\n\t\tif (!mcpGalleryUrl) {\n\t\t\treturn Promise.resolve({ servers: [] });\n\t\t}\n\n\t\tconst token = isString(arg1) ? arg2 : arg1;\n\t\tconst uri = URI.parse(mcpGalleryUrl);\n\t\tif (uri.scheme === Schemas.file) {\n\t\t\ttry {\n\t\t\t\tconst content = await this.fileService.readFile(uri);\n\t\t\t\tconst data = content.value.toString();\n\t\t\t\treturn JSON.parse(data);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logService.error(`Failed to read file from ${uri}: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\tconst context = await this.requestService.request({\n\t\t\ttype: 'GET',\n\t\t\turl: mcpGalleryUrl,\n\t\t}, token);\n\n\t\tconst result = await asJson<IRawGalleryServersResult>(context);\n\t\treturn result || { servers: [] };\n\t}\n\n\tprivate getManifestUrl(item: IRawGalleryMcpServer): string | undefined {\n\t\tconst mcpGalleryUrl = this.getMcpGalleryUrl();\n\n\t\tif (!mcpGalleryUrl) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst uri = URI.parse(mcpGalleryUrl);\n\t\tif (uri.scheme === Schemas.file) {\n\t\t\treturn joinPath(dirname(uri), item.id ?? item.name).fsPath;\n\t\t}\n\n\t\treturn `${mcpGalleryUrl}/${item.id}`;\n\t}\n\n\tprivate getMcpGalleryUrl(): string | undefined {\n\t\tif (this.productService.quality === 'stable') {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.configurationService.getValue<string>(mcpGalleryServiceUrlConfig);\n\t}\n\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { cloneAndChange } from '../../../base/common/objects.js';\nimport { URI, UriComponents } from '../../../base/common/uri.js';\nimport { DefaultURITransformer, IURITransformer, transformAndReviveIncomingURIs } from '../../../base/common/uriIpc.js';\nimport { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';\nimport { DidUninstallMcpServerEvent, IGalleryMcpServer, ILocalMcpServer, IMcpManagementService, IInstallableMcpServer, InstallMcpServerEvent, InstallMcpServerResult, InstallOptions, UninstallMcpServerEvent, UninstallOptions } from './mcpManagement.js';\n\nfunction transformIncomingURI(uri: UriComponents, transformer: IURITransformer | null): URI;\nfunction transformIncomingURI(uri: UriComponents | undefined, transformer: IURITransformer | null): URI | undefined;\nfunction transformIncomingURI(uri: UriComponents | undefined, transformer: IURITransformer | null): URI | undefined {\n\treturn uri ? URI.revive(transformer ? transformer.transformIncoming(uri) : uri) : undefined;\n}\n\nfunction transformIncomingServer(mcpServer: ILocalMcpServer, transformer: IURITransformer | null): ILocalMcpServer {\n\ttransformer = transformer ? transformer : DefaultURITransformer;\n\tconst manifest = mcpServer.manifest;\n\tconst transformed = transformAndReviveIncomingURIs({ ...mcpServer, ...{ manifest: undefined } }, transformer);\n\treturn { ...transformed, ...{ manifest } };\n}\n\nfunction transformIncomingOptions<O extends { mcpResource?: UriComponents }>(options: O | undefined, transformer: IURITransformer | null): O | undefined {\n\treturn options?.mcpResource ? transformAndReviveIncomingURIs(options, transformer ?? DefaultURITransformer) : options;\n}\n\nfunction transformOutgoingExtension(extension: ILocalMcpServer, transformer: IURITransformer | null): ILocalMcpServer {\n\treturn transformer ? cloneAndChange(extension, value => value instanceof URI ? transformer.transformOutgoingURI(value) : undefined) : extension;\n}\n\nfunction transformOutgoingURI(uri: URI, transformer: IURITransformer | null): URI {\n\treturn transformer ? transformer.transformOutgoingURI(uri) : uri;\n}\n\nexport class McpManagementChannel implements IServerChannel {\n\treadonly onInstallMcpServer: Event<InstallMcpServerEvent>;\n\treadonly onDidInstallMcpServers: Event<readonly InstallMcpServerResult[]>;\n\treadonly onDidUpdateMcpServers: Event<readonly InstallMcpServerResult[]>;\n\treadonly onUninstallMcpServer: Event<UninstallMcpServerEvent>;\n\treadonly onDidUninstallMcpServer: Event<DidUninstallMcpServerEvent>;\n\n\tconstructor(private service: IMcpManagementService, private getUriTransformer: (requestContext: any) => IURITransformer | null) {\n\t\tthis.onInstallMcpServer = Event.buffer(service.onInstallMcpServer, true);\n\t\tthis.onDidInstallMcpServers = Event.buffer(service.onDidInstallMcpServers, true);\n\t\tthis.onDidUpdateMcpServers = Event.buffer(service.onDidUpdateMcpServers, true);\n\t\tthis.onUninstallMcpServer = Event.buffer(service.onUninstallMcpServer, true);\n\t\tthis.onDidUninstallMcpServer = Event.buffer(service.onDidUninstallMcpServer, true);\n\t}\n\n\tlisten(context: any, event: string): Event<any> {\n\t\tconst uriTransformer = this.getUriTransformer(context);\n\t\tswitch (event) {\n\t\t\tcase 'onInstallMcpServer': {\n\t\t\t\treturn Event.map<InstallMcpServerEvent, InstallMcpServerEvent>(this.onInstallMcpServer, event => {\n\t\t\t\t\treturn { ...event, mcpResource: transformOutgoingURI(event.mcpResource, uriTransformer) };\n\t\t\t\t});\n\t\t\t}\n\t\t\tcase 'onDidInstallMcpServers': {\n\t\t\t\treturn Event.map<readonly InstallMcpServerResult[], readonly InstallMcpServerResult[]>(this.onDidInstallMcpServers, results =>\n\t\t\t\t\tresults.map(i => ({\n\t\t\t\t\t\t...i,\n\t\t\t\t\t\tlocal: i.local ? transformOutgoingExtension(i.local, uriTransformer) : i.local,\n\t\t\t\t\t\tmcpResource: transformOutgoingURI(i.mcpResource, uriTransformer)\n\t\t\t\t\t})));\n\t\t\t}\n\t\t\tcase 'onDidUpdateMcpServers': {\n\t\t\t\treturn Event.map<readonly InstallMcpServerResult[], readonly InstallMcpServerResult[]>(this.onDidUpdateMcpServers, results =>\n\t\t\t\t\tresults.map(i => ({\n\t\t\t\t\t\t...i,\n\t\t\t\t\t\tlocal: i.local ? transformOutgoingExtension(i.local, uriTransformer) : i.local,\n\t\t\t\t\t\tmcpResource: transformOutgoingURI(i.mcpResource, uriTransformer)\n\t\t\t\t\t})));\n\t\t\t}\n\t\t\tcase 'onUninstallMcpServer': {\n\t\t\t\treturn Event.map<UninstallMcpServerEvent, UninstallMcpServerEvent>(this.onUninstallMcpServer, event => {\n\t\t\t\t\treturn { ...event, mcpResource: transformOutgoingURI(event.mcpResource, uriTransformer) };\n\t\t\t\t});\n\t\t\t}\n\t\t\tcase 'onDidUninstallMcpServer': {\n\t\t\t\treturn Event.map<DidUninstallMcpServerEvent, DidUninstallMcpServerEvent>(this.onDidUninstallMcpServer, event => {\n\t\t\t\t\treturn { ...event, mcpResource: transformOutgoingURI(event.mcpResource, uriTransformer) };\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error('Invalid listen');\n\t}\n\n\tasync call(context: any, command: string, args?: any): Promise<any> {\n\t\tconst uriTransformer: IURITransformer | null = this.getUriTransformer(context);\n\t\tswitch (command) {\n\t\t\tcase 'getInstalled': {\n\t\t\t\tconst mcpServers = await this.service.getInstalled(transformIncomingURI(args[0], uriTransformer));\n\t\t\t\treturn mcpServers.map(e => transformOutgoingExtension(e, uriTransformer));\n\t\t\t}\n\t\t\tcase 'install': {\n\t\t\t\treturn this.service.install(args[0], transformIncomingOptions(args[1], uriTransformer));\n\t\t\t}\n\t\t\tcase 'installFromGallery': {\n\t\t\t\treturn this.service.installFromGallery(args[0], transformIncomingOptions(args[1], uriTransformer));\n\t\t\t}\n\t\t\tcase 'uninstall': {\n\t\t\t\treturn this.service.uninstall(transformIncomingServer(args[0], uriTransformer), transformIncomingOptions(args[1], uriTransformer));\n\t\t\t}\n\t\t\tcase 'updateMetadata': {\n\t\t\t\treturn this.service.updateMetadata(transformIncomingServer(args[0], uriTransformer), args[1], transformIncomingURI(args[2], uriTransformer));\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error('Invalid call');\n\t}\n}\n\nexport class McpManagementChannelClient extends Disposable implements IMcpManagementService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly _onInstallMcpServer = this._register(new Emitter<InstallMcpServerEvent>());\n\tget onInstallMcpServer() { return this._onInstallMcpServer.event; }\n\n\tprivate readonly _onDidInstallMcpServers = this._register(new Emitter<readonly InstallMcpServerResult[]>());\n\tget onDidInstallMcpServers() { return this._onDidInstallMcpServers.event; }\n\n\tprivate readonly _onUninstallMcpServer = this._register(new Emitter<UninstallMcpServerEvent>());\n\tget onUninstallMcpServer() { return this._onUninstallMcpServer.event; }\n\n\tprivate readonly _onDidUninstallMcpServer = this._register(new Emitter<DidUninstallMcpServerEvent>());\n\tget onDidUninstallMcpServer() { return this._onDidUninstallMcpServer.event; }\n\n\tprivate readonly _onDidUpdateMcpServers = this._register(new Emitter<InstallMcpServerResult[]>());\n\tget onDidUpdateMcpServers() { return this._onDidUpdateMcpServers.event; }\n\n\tconstructor(private readonly channel: IChannel) {\n\t\tsuper();\n\t\tthis._register(this.channel.listen<InstallMcpServerEvent>('onInstallMcpServer')(e => this._onInstallMcpServer.fire(({ ...e, mcpResource: transformIncomingURI(e.mcpResource, null) }))));\n\t\tthis._register(this.channel.listen<readonly InstallMcpServerResult[]>('onDidInstallMcpServers')(results => this._onDidInstallMcpServers.fire(results.map(e => ({ ...e, local: e.local ? transformIncomingServer(e.local, null) : e.local, mcpResource: transformIncomingURI(e.mcpResource, null) })))));\n\t\tthis._register(this.channel.listen<readonly InstallMcpServerResult[]>('onDidUpdateMcpServers')(results => this._onDidUpdateMcpServers.fire(results.map(e => ({ ...e, local: e.local ? transformIncomingServer(e.local, null) : e.local, mcpResource: transformIncomingURI(e.mcpResource, null) })))));\n\t\tthis._register(this.channel.listen<UninstallMcpServerEvent>('onUninstallMcpServer')(e => this._onUninstallMcpServer.fire(({ ...e, mcpResource: transformIncomingURI(e.mcpResource, null) }))));\n\t\tthis._register(this.channel.listen<DidUninstallMcpServerEvent>('onDidUninstallMcpServer')(e => this._onDidUninstallMcpServer.fire(({ ...e, mcpResource: transformIncomingURI(e.mcpResource, null) }))));\n\t}\n\n\tinstall(server: IInstallableMcpServer, options?: InstallOptions): Promise<ILocalMcpServer> {\n\t\treturn Promise.resolve(this.channel.call<ILocalMcpServer>('install', [server, options])).then(local => transformIncomingServer(local, null));\n\t}\n\n\tinstallFromGallery(extension: IGalleryMcpServer, installOptions?: InstallOptions): Promise<ILocalMcpServer> {\n\t\treturn Promise.resolve(this.channel.call<ILocalMcpServer>('installFromGallery', [extension, installOptions])).then(local => transformIncomingServer(local, null));\n\t}\n\n\tuninstall(extension: ILocalMcpServer, options?: UninstallOptions): Promise<void> {\n\t\treturn Promise.resolve(this.channel.call<void>('uninstall', [extension, options]));\n\t}\n\n\tgetInstalled(mcpResource?: URI): Promise<ILocalMcpServer[]> {\n\t\treturn Promise.resolve(this.channel.call<ILocalMcpServer[]>('getInstalled', [mcpResource]))\n\t\t\t.then(servers => servers.map(server => transformIncomingServer(server, null)));\n\t}\n\n\tupdateMetadata(local: ILocalMcpServer, gallery: IGalleryMcpServer, mcpResource?: URI): Promise<ILocalMcpServer> {\n\t\treturn Promise.resolve(this.channel.call<ILocalMcpServer>('updateMetadata', [local, gallery, mcpResource])).then(local => transformIncomingServer(local, null));\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { hostname, release } from 'os';\nimport { promises as fs } from 'fs';\nimport { Emitter, Event } from '../../base/common/event.js';\nimport { DisposableStore, toDisposable } from '../../base/common/lifecycle.js';\nimport { Schemas } from '../../base/common/network.js';\nimport * as path from '../../base/common/path.js';\nimport { IURITransformer } from '../../base/common/uriIpc.js';\nimport { getMachineId, getSqmMachineId, getdevDeviceId } from '../../base/node/id.js';\nimport { Promises } from '../../base/node/pfs.js';\nimport { ClientConnectionEvent, IMessagePassingProtocol, IPCServer, ProxyChannel, StaticRouter } from '../../base/parts/ipc/common/ipc.js';\nimport { ProtocolConstants } from '../../base/parts/ipc/common/ipc.net.js';\nimport { IConfigurationService } from '../../platform/configuration/common/configuration.js';\nimport { ConfigurationService } from '../../platform/configuration/common/configurationService.js';\nimport { ExtensionHostDebugBroadcastChannel } from '../../platform/debug/common/extensionHostDebugIpc.js';\nimport { IDownloadService } from '../../platform/download/common/download.js';\nimport { DownloadServiceChannelClient } from '../../platform/download/common/downloadIpc.js';\nimport { IEnvironmentService, INativeEnvironmentService } from '../../platform/environment/common/environment.js';\nimport { ExtensionGalleryServiceWithNoStorageService } from '../../platform/extensionManagement/common/extensionGalleryService.js';\nimport { IAllowedExtensionsService, IExtensionGalleryService } from '../../platform/extensionManagement/common/extensionManagement.js';\nimport { ExtensionSignatureVerificationService, IExtensionSignatureVerificationService } from '../../platform/extensionManagement/node/extensionSignatureVerificationService.js';\nimport { ExtensionManagementCLI } from '../../platform/extensionManagement/common/extensionManagementCLI.js';\nimport { ExtensionManagementChannel } from '../../platform/extensionManagement/common/extensionManagementIpc.js';\nimport { ExtensionManagementService, INativeServerExtensionManagementService } from '../../platform/extensionManagement/node/extensionManagementService.js';\nimport { IFileService } from '../../platform/files/common/files.js';\nimport { FileService } from '../../platform/files/common/fileService.js';\nimport { DiskFileSystemProvider } from '../../platform/files/node/diskFileSystemProvider.js';\nimport { SyncDescriptor } from '../../platform/instantiation/common/descriptors.js';\nimport { IInstantiationService } from '../../platform/instantiation/common/instantiation.js';\nimport { InstantiationService } from '../../platform/instantiation/common/instantiationService.js';\nimport { ServiceCollection } from '../../platform/instantiation/common/serviceCollection.js';\nimport { ILanguagePackService } from '../../platform/languagePacks/common/languagePacks.js';\nimport { NativeLanguagePackService } from '../../platform/languagePacks/node/languagePacks.js';\nimport { AbstractLogger, DEFAULT_LOG_LEVEL, getLogLevel, ILoggerService, ILogService, log, LogLevel, LogLevelToString } from '../../platform/log/common/log.js';\nimport product from '../../platform/product/common/product.js';\nimport { IProductService } from '../../platform/product/common/productService.js';\nimport { RemoteAgentConnectionContext } from '../../platform/remote/common/remoteAgentEnvironment.js';\nimport { IRequestService } from '../../platform/request/common/request.js';\nimport { RequestChannel } from '../../platform/request/common/requestIpc.js';\nimport { RequestService } from '../../platform/request/node/requestService.js';\nimport { resolveCommonProperties } from '../../platform/telemetry/common/commonProperties.js';\nimport { ITelemetryService, TelemetryLevel } from '../../platform/telemetry/common/telemetry.js';\nimport { ITelemetryServiceConfig } from '../../platform/telemetry/common/telemetryService.js';\nimport { getPiiPathsFromEnvironment, isInternalTelemetry, isLoggingOnly, ITelemetryAppender, NullAppender, supportsTelemetry } from '../../platform/telemetry/common/telemetryUtils.js';\nimport ErrorTelemetry from '../../platform/telemetry/node/errorTelemetry.js';\nimport { IPtyService, TerminalSettingId } from '../../platform/terminal/common/terminal.js';\nimport { PtyHostService } from '../../platform/terminal/node/ptyHostService.js';\nimport { IUriIdentityService } from '../../platform/uriIdentity/common/uriIdentity.js';\nimport { UriIdentityService } from '../../platform/uriIdentity/common/uriIdentityService.js';\nimport { RemoteAgentEnvironmentChannel } from './remoteAgentEnvironmentImpl.js';\nimport { RemoteAgentFileSystemProviderChannel } from './remoteFileSystemProviderServer.js';\nimport { ServerTelemetryChannel } from '../../platform/telemetry/common/remoteTelemetryChannel.js';\nimport { IServerTelemetryService, ServerNullTelemetryService, ServerTelemetryService } from '../../platform/telemetry/common/serverTelemetryService.js';\nimport { RemoteTerminalChannel } from './remoteTerminalChannel.js';\nimport { createURITransformer } from '../../workbench/api/node/uriTransformer.js';\nimport { ServerConnectionToken } from './serverConnectionToken.js';\nimport { ServerEnvironmentService, ServerParsedArgs } from './serverEnvironmentService.js';\nimport { REMOTE_TERMINAL_CHANNEL_NAME } from '../../workbench/contrib/terminal/common/remote/remoteTerminalChannel.js';\nimport { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from '../../workbench/services/remote/common/remoteFileSystemProviderClient.js';\nimport { ExtensionHostStatusService, IExtensionHostStatusService } from './extensionHostStatusService.js';\nimport { IExtensionsScannerService } from '../../platform/extensionManagement/common/extensionsScannerService.js';\nimport { ExtensionsScannerService } from './extensionsScannerService.js';\nimport { IExtensionsProfileScannerService } from '../../platform/extensionManagement/common/extensionsProfileScannerService.js';\nimport { IUserDataProfilesService } from '../../platform/userDataProfile/common/userDataProfile.js';\nimport { TelemetryClient } from './telemetryClient.js';\nimport { NullPolicyService } from '../../platform/policy/common/policy.js';\nimport { OneDataSystemAppender } from '../../platform/telemetry/node/1dsAppender.js';\nimport { LoggerService } from '../../platform/log/node/loggerService.js';\nimport { ServerUserDataProfilesService } from '../../platform/userDataProfile/node/userDataProfile.js';\nimport { ExtensionsProfileScannerService } from '../../platform/extensionManagement/node/extensionsProfileScannerService.js';\nimport { LogService } from '../../platform/log/common/logService.js';\nimport { LoggerChannel } from '../../platform/log/common/logIpc.js';\nimport { localize } from '../../nls.js';\nimport { RemoteExtensionsScannerChannel, RemoteExtensionsScannerService } from './remoteExtensionsScanner.js';\nimport { RemoteExtensionsScannerChannelName } from '../../platform/remote/common/remoteExtensionsScanner.js';\nimport { RemoteUserDataProfilesServiceChannel } from '../../platform/userDataProfile/common/userDataProfileIpc.js';\nimport { NodePtyHostStarter } from '../../platform/terminal/node/nodePtyHostStarter.js';\nimport { CSSDevelopmentService, ICSSDevelopmentService } from '../../platform/cssDev/node/cssDevService.js';\nimport { AllowedExtensionsService } from '../../platform/extensionManagement/common/allowedExtensionsService.js';\nimport { TelemetryLogAppender } from '../../platform/telemetry/common/telemetryLogAppender.js';\nimport { INativeMcpDiscoveryHelperService, NativeMcpDiscoveryHelperChannelName } from '../../platform/mcp/common/nativeMcpDiscoveryHelper.js';\nimport { NativeMcpDiscoveryHelperChannel } from '../../platform/mcp/node/nativeMcpDiscoveryHelperChannel.js';\nimport { NativeMcpDiscoveryHelperService } from '../../platform/mcp/node/nativeMcpDiscoveryHelperService.js';\nimport { IExtensionGalleryManifestService } from '../../platform/extensionManagement/common/extensionGalleryManifest.js';\nimport { ExtensionGalleryManifestIPCService } from '../../platform/extensionManagement/common/extensionGalleryManifestServiceIpc.js';\nimport { IMcpGalleryService, IMcpManagementService } from '../../platform/mcp/common/mcpManagement.js';\nimport { McpManagementService } from '../../platform/mcp/common/mcpManagementService.js';\nimport { McpGalleryService } from '../../platform/mcp/common/mcpGalleryService.js';\nimport { IMcpResourceScannerService, McpResourceScannerService } from '../../platform/mcp/common/mcpResourceScannerService.js';\nimport { McpManagementChannel } from '../../platform/mcp/common/mcpManagementIpc.js';\n\nconst eventPrefix = 'monacoworkbench';\n\nexport async function setupServerServices(connectionToken: ServerConnectionToken, args: ServerParsedArgs, REMOTE_DATA_FOLDER: string, disposables: DisposableStore) {\n\tconst services = new ServiceCollection();\n\tconst socketServer = new SocketServer<RemoteAgentConnectionContext>();\n\n\tconst productService: IProductService = { _serviceBrand: undefined, ...product };\n\tservices.set(IProductService, productService);\n\n\tconst environmentService = new ServerEnvironmentService(args, productService);\n\tservices.set(IEnvironmentService, environmentService);\n\tservices.set(INativeEnvironmentService, environmentService);\n\n\tconst loggerService = new LoggerService(getLogLevel(environmentService), environmentService.logsHome);\n\tservices.set(ILoggerService, loggerService);\n\tsocketServer.registerChannel('logger', new LoggerChannel(loggerService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));\n\n\tconst logger = loggerService.createLogger('remoteagent', { name: localize('remoteExtensionLog', \"Server\") });\n\tconst logService = new LogService(logger, [new ServerLogger(getLogLevel(environmentService))]);\n\tservices.set(ILogService, logService);\n\tsetTimeout(() => cleanupOlderLogs(environmentService.logsHome.with({ scheme: Schemas.file }).fsPath).then(null, err => logService.error(err)), 10000);\n\tlogService.onDidChangeLogLevel(logLevel => log(logService, logLevel, `Log level changed to ${LogLevelToString(logService.getLevel())}`));\n\n\tlogService.trace(`Remote configuration data at ${REMOTE_DATA_FOLDER}`);\n\tlogService.trace('process arguments:', environmentService.args);\n\tif (Array.isArray(productService.serverGreeting)) {\n\t\tlogService.info(`\\n\\n${productService.serverGreeting.join('\\n')}\\n\\n`);\n\t}\n\n\t// ExtensionHost Debug broadcast service\n\tsocketServer.registerChannel(ExtensionHostDebugBroadcastChannel.ChannelName, new ExtensionHostDebugBroadcastChannel());\n\n\t// TODO: @Sandy @Joao need dynamic context based router\n\tconst router = new StaticRouter<RemoteAgentConnectionContext>(ctx => ctx.clientId === 'renderer');\n\n\t// Files\n\tconst fileService = disposables.add(new FileService(logService));\n\tservices.set(IFileService, fileService);\n\tfileService.registerProvider(Schemas.file, disposables.add(new DiskFileSystemProvider(logService)));\n\n\t// URI Identity\n\tconst uriIdentityService = new UriIdentityService(fileService);\n\tservices.set(IUriIdentityService, uriIdentityService);\n\n\t// Configuration\n\tconst configurationService = new ConfigurationService(environmentService.machineSettingsResource, fileService, new NullPolicyService(), logService);\n\tservices.set(IConfigurationService, configurationService);\n\n\t// User Data Profiles\n\tconst userDataProfilesService = new ServerUserDataProfilesService(uriIdentityService, environmentService, fileService, logService);\n\tservices.set(IUserDataProfilesService, userDataProfilesService);\n\tsocketServer.registerChannel('userDataProfiles', new RemoteUserDataProfilesServiceChannel(userDataProfilesService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));\n\n\t// Dev Only: CSS service (for ESM)\n\tservices.set(ICSSDevelopmentService, new SyncDescriptor(CSSDevelopmentService, undefined, true));\n\n\t// Initialize\n\tconst [, , machineId, sqmId, devDeviceId] = await Promise.all([\n\t\tconfigurationService.initialize(),\n\t\tuserDataProfilesService.init(),\n\t\tgetMachineId(logService.error.bind(logService)),\n\t\tgetSqmMachineId(logService.error.bind(logService)),\n\t\tgetdevDeviceId(logService.error.bind(logService))\n\t]);\n\n\tconst extensionHostStatusService = new ExtensionHostStatusService();\n\tservices.set(IExtensionHostStatusService, extensionHostStatusService);\n\n\t// Request\n\tconst requestService = new RequestService('remote', configurationService, environmentService, logService);\n\tservices.set(IRequestService, requestService);\n\n\tlet isContainer = undefined;\n\ttry {\n\t\tawait fs.stat('/run/.containerenv');\n\t\tisContainer = true;\n\t} catch (error) { /* Does not exist, probably. */ }\n\tif (!isContainer) {\n\t\ttry {\n\t\t\tconst content = await fs.readFile('/proc/self/cgroup', 'utf8')\n\t\t\tisContainer = content.includes('docker');\n\t\t} catch (error) { /* Permission denied, probably. */ }\n\t}\n\n\tlet oneDsAppender: ITelemetryAppender = NullAppender;\n\tconst isInternal = isInternalTelemetry(productService, configurationService);\n\tif (supportsTelemetry(productService, environmentService)) {\n\t\tif (!isLoggingOnly(productService, environmentService) && productService.telemetryEndpoint) {\n\t\t\toneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, () => new TelemetryClient(productService.telemetryEndpoint!, machineId, isContainer));\n\t\t\tdisposables.add(toDisposable(() => oneDsAppender?.flush())); // Ensure the AI appender is disposed so that it flushes remaining data\n\t\t}\n\n\t\tconst config: ITelemetryServiceConfig = {\n\t\t\tappenders: [oneDsAppender, new TelemetryLogAppender('', true, loggerService, environmentService, productService)],\n\t\t\tcommonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version + '-remote', machineId, sqmId, devDeviceId, isInternal, productService.date, 'remoteAgent'),\n\t\t\tpiiPaths: getPiiPathsFromEnvironment(environmentService)\n\t\t};\n\t\tconst initialTelemetryLevelArg = environmentService.args['telemetry-level'];\n\t\tlet injectedTelemetryLevel: TelemetryLevel = TelemetryLevel.USAGE;\n\t\t// Convert the passed in CLI argument into a telemetry level for the telemetry service\n\t\tif (initialTelemetryLevelArg === 'all') {\n\t\t\tinjectedTelemetryLevel = TelemetryLevel.USAGE;\n\t\t} else if (initialTelemetryLevelArg === 'error') {\n\t\t\tinjectedTelemetryLevel = TelemetryLevel.ERROR;\n\t\t} else if (initialTelemetryLevelArg === 'crash') {\n\t\t\tinjectedTelemetryLevel = TelemetryLevel.CRASH;\n\t\t} else if (initialTelemetryLevelArg !== undefined) {\n\t\t\tinjectedTelemetryLevel = TelemetryLevel.NONE;\n\t\t}\n\t\tservices.set(IServerTelemetryService, new SyncDescriptor(ServerTelemetryService, [config, injectedTelemetryLevel]));\n\t} else {\n\t\tservices.set(IServerTelemetryService, ServerNullTelemetryService);\n\t}\n\n\tservices.set(IExtensionGalleryManifestService, new ExtensionGalleryManifestIPCService(socketServer, productService));\n\tservices.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryServiceWithNoStorageService));\n\n\tconst downloadChannel = socketServer.getChannel('download', router);\n\tservices.set(IDownloadService, new DownloadServiceChannelClient(downloadChannel, () => getUriTransformer('renderer') /* TODO: @Sandy @Joao need dynamic context based router */));\n\n\tservices.set(IExtensionsProfileScannerService, new SyncDescriptor(ExtensionsProfileScannerService));\n\tservices.set(IExtensionsScannerService, new SyncDescriptor(ExtensionsScannerService));\n\tservices.set(IExtensionSignatureVerificationService, new SyncDescriptor(ExtensionSignatureVerificationService));\n\tservices.set(IAllowedExtensionsService, new SyncDescriptor(AllowedExtensionsService));\n\tservices.set(INativeServerExtensionManagementService, new SyncDescriptor(ExtensionManagementService));\n\tservices.set(INativeMcpDiscoveryHelperService, new SyncDescriptor(NativeMcpDiscoveryHelperService));\n\n\tconst instantiationService: IInstantiationService = new InstantiationService(services);\n\tservices.set(ILanguagePackService, instantiationService.createInstance(NativeLanguagePackService));\n\n\tconst ptyHostStarter = instantiationService.createInstance(\n\t\tNodePtyHostStarter,\n\t\t{\n\t\t\tgraceTime: ProtocolConstants.ReconnectionGraceTime,\n\t\t\tshortGraceTime: ProtocolConstants.ReconnectionShortGraceTime,\n\t\t\tscrollback: configurationService.getValue<number>(TerminalSettingId.PersistentSessionScrollback) ?? 100\n\t\t}\n\t);\n\tconst ptyHostService = instantiationService.createInstance(PtyHostService, ptyHostStarter);\n\tservices.set(IPtyService, ptyHostService);\n\n\tservices.set(IMcpResourceScannerService, new SyncDescriptor(McpResourceScannerService));\n\tservices.set(IMcpGalleryService, new SyncDescriptor(McpGalleryService));\n\tservices.set(IMcpManagementService, new SyncDescriptor(McpManagementService));\n\n\tinstantiationService.invokeFunction(accessor => {\n\t\tconst mcpManagementService = accessor.get(IMcpManagementService);\n\t\tconst extensionManagementService = accessor.get(INativeServerExtensionManagementService);\n\t\tconst extensionsScannerService = accessor.get(IExtensionsScannerService);\n\t\tconst extensionGalleryService = accessor.get(IExtensionGalleryService);\n\t\tconst languagePackService = accessor.get(ILanguagePackService);\n\t\tconst remoteExtensionEnvironmentChannel = new RemoteAgentEnvironmentChannel(connectionToken, environmentService, userDataProfilesService, extensionHostStatusService);\n\t\tsocketServer.registerChannel('remoteextensionsenvironment', remoteExtensionEnvironmentChannel);\n\n\t\tconst telemetryChannel = new ServerTelemetryChannel(accessor.get(IServerTelemetryService), oneDsAppender);\n\t\tsocketServer.registerChannel('telemetry', telemetryChannel);\n\n\t\tsocketServer.registerChannel(REMOTE_TERMINAL_CHANNEL_NAME, new RemoteTerminalChannel(environmentService, logService, ptyHostService, productService, extensionManagementService, configurationService));\n\n\t\tconst remoteExtensionsScanner = new RemoteExtensionsScannerService(instantiationService.createInstance(ExtensionManagementCLI, logService), environmentService, userDataProfilesService, extensionsScannerService, logService, extensionGalleryService, languagePackService, extensionManagementService);\n\t\tsocketServer.registerChannel(RemoteExtensionsScannerChannelName, new RemoteExtensionsScannerChannel(remoteExtensionsScanner, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));\n\n\t\tsocketServer.registerChannel(NativeMcpDiscoveryHelperChannelName, instantiationService.createInstance(NativeMcpDiscoveryHelperChannel, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));\n\n\t\tconst remoteFileSystemChannel = disposables.add(new RemoteAgentFileSystemProviderChannel(logService, environmentService, configurationService));\n\t\tsocketServer.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, remoteFileSystemChannel);\n\n\t\tsocketServer.registerChannel('request', new RequestChannel(accessor.get(IRequestService)));\n\n\t\tconst channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority));\n\t\tsocketServer.registerChannel('extensions', channel);\n\n\t\tsocketServer.registerChannel('mcpManagement', new McpManagementChannel(mcpManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));\n\n\t\tconst languagePackChannel = ProxyChannel.fromService<RemoteAgentConnectionContext>(accessor.get(ILanguagePackService), disposables);\n\t\tsocketServer.registerChannel('languagePacks', languagePackChannel);\n\n\t\t// clean up extensions folder\n\t\tremoteExtensionsScanner.whenExtensionsReady().then(() => extensionManagementService.cleanUp());\n\n\t\tdisposables.add(new ErrorTelemetry(accessor.get(ITelemetryService)));\n\n\t\treturn {\n\t\t\ttelemetryService: accessor.get(ITelemetryService)\n\t\t};\n\t});\n\n\treturn { socketServer, instantiationService };\n}\n\nconst _uriTransformerCache: { [remoteAuthority: string]: IURITransformer } = Object.create(null);\n\nfunction getUriTransformer(remoteAuthority: string): IURITransformer {\n\tif (!_uriTransformerCache[remoteAuthority]) {\n\t\t_uriTransformerCache[remoteAuthority] = createURITransformer(remoteAuthority);\n\t}\n\treturn _uriTransformerCache[remoteAuthority];\n}\n\nexport class SocketServer<TContext = string> extends IPCServer<TContext> {\n\n\tprivate _onDidConnectEmitter: Emitter<ClientConnectionEvent>;\n\n\tconstructor() {\n\t\tconst emitter = new Emitter<ClientConnectionEvent>();\n\t\tsuper(emitter.event);\n\t\tthis._onDidConnectEmitter = emitter;\n\t}\n\n\tpublic acceptConnection(protocol: IMessagePassingProtocol, onDidClientDisconnect: Event<void>): void {\n\t\tthis._onDidConnectEmitter.fire({ protocol, onDidClientDisconnect });\n\t}\n}\n\nclass ServerLogger extends AbstractLogger {\n\tprivate useColors: boolean;\n\n\tconstructor(logLevel: LogLevel = DEFAULT_LOG_LEVEL) {\n\t\tsuper();\n\t\tthis.setLevel(logLevel);\n\t\tthis.useColors = Boolean(process.stdout.isTTY);\n\t}\n\n\ttrace(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Trace)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log(`\\x1b[90m[${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(`[${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\tdebug(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Debug)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log(`\\x1b[90m[${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(`[${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\tinfo(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Info)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.log(`\\x1b[90m[${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.log(`[${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\twarn(message: string | Error, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Warning)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.warn(`\\x1b[93m[${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.warn(`[${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\terror(message: string, ...args: any[]): void {\n\t\tif (this.canLog(LogLevel.Error)) {\n\t\t\tif (this.useColors) {\n\t\t\t\tconsole.error(`\\x1b[91m[${now()}]\\x1b[0m`, message, ...args);\n\t\t\t} else {\n\t\t\t\tconsole.error(`[${now()}]`, message, ...args);\n\t\t\t}\n\t\t}\n\t}\n\n\tflush(): void {\n\t\t// noop\n\t}\n}\n\nfunction now(): string {\n\tconst date = new Date();\n\treturn `${twodigits(date.getHours())}:${twodigits(date.getMinutes())}:${twodigits(date.getSeconds())}`;\n}\n\nfunction twodigits(n: number): string {\n\tif (n < 10) {\n\t\treturn `0${n}`;\n\t}\n\treturn String(n);\n}\n\n/**\n * Cleans up older logs, while keeping the 10 most recent ones.\n */\nasync function cleanupOlderLogs(logsPath: string): Promise<void> {\n\tconst currentLog = path.basename(logsPath);\n\tconst logsRoot = path.dirname(logsPath);\n\tconst children = await Promises.readdir(logsRoot);\n\tconst allSessions = children.filter(name => /^\\d{8}T\\d{6}$/.test(name));\n\tconst oldSessions = allSessions.sort().filter((d) => d !== currentLog);\n\tconst toDelete = oldSessions.slice(0, Math.max(0, oldSessions.length - 9));\n\n\tawait Promise.all(toDelete.map(name => Promises.rm(path.join(logsRoot, name))));\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createReadStream, promises } from 'fs';\nimport * as http from 'http';\nimport * as url from 'url';\nimport * as cookie from 'cookie';\nimport * as crypto from 'crypto';\nimport { isEqualOrParent } from '../../base/common/extpath.js';\nimport { getMediaMime } from '../../base/common/mime.js';\nimport { isLinux } from '../../base/common/platform.js';\nimport { ILogService, LogLevel } from '../../platform/log/common/log.js';\nimport { IServerEnvironmentService } from './serverEnvironmentService.js';\nimport { extname, dirname, join, normalize, posix, resolve } from '../../base/common/path.js';\nimport { FileAccess, connectionTokenCookieName, connectionTokenQueryName, Schemas, builtinExtensionsPath } from '../../base/common/network.js';\nimport { generateUuid } from '../../base/common/uuid.js';\nimport { IProductService } from '../../platform/product/common/productService.js';\nimport { ServerConnectionToken, ServerConnectionTokenType } from './serverConnectionToken.js';\nimport { asTextOrError, IRequestService } from '../../platform/request/common/request.js';\nimport { IHeaders } from '../../base/parts/request/common/request.js';\nimport { CancellationToken } from '../../base/common/cancellation.js';\nimport { URI } from '../../base/common/uri.js';\nimport { streamToBuffer } from '../../base/common/buffer.js';\nimport { IProductConfiguration } from '../../base/common/product.js';\nimport { isString, Mutable } from '../../base/common/types.js';\nimport { getLocaleFromConfig, getBrowserNLSConfiguration } from './remoteLanguagePacks.js';\nimport { CharCode } from '../../base/common/charCode.js';\nimport { IExtensionManifest } from '../../platform/extensions/common/extensions.js';\nimport { ICSSDevelopmentService } from '../../platform/cssDev/node/cssDevService.js';\n\nconst textMimeType: { [ext: string]: string | undefined } = {\n\t'.html': 'text/html',\n\t'.js': 'text/javascript',\n\t'.json': 'application/json',\n\t'.css': 'text/css',\n\t'.svg': 'image/svg+xml',\n};\n\n/**\n * Return an error to the client.\n */\nexport async function serveError(req: http.IncomingMessage, res: http.ServerResponse, errorCode: number, errorMessage: string): Promise<void> {\n\tres.writeHead(errorCode, { 'Content-Type': 'text/plain' });\n\tres.end(errorMessage);\n}\n\nexport const enum CacheControl {\n\tNO_CACHING, ETAG, NO_EXPIRY\n}\n\n/**\n * Serve a file at a given path or 404 if the file is missing.\n */\nexport async function serveFile(filePath: string, cacheControl: CacheControl, logService: ILogService, req: http.IncomingMessage, res: http.ServerResponse, responseHeaders: Record<string, string>): Promise<void> {\n\ttry {\n\t\tconst stat = await promises.stat(filePath); // throws an error if file doesn't exist\n\t\tif (cacheControl === CacheControl.ETAG) {\n\n\t\t\t// Check if file modified since\n\t\t\tconst etag = `W/\"${[stat.ino, stat.size, stat.mtime.getTime()].join('-')}\"`; // weak validator (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)\n\t\t\tif (req.headers['if-none-match'] === etag) {\n\t\t\t\tres.writeHead(304);\n\t\t\t\treturn void res.end();\n\t\t\t}\n\n\t\t\tresponseHeaders['Etag'] = etag;\n\t\t} else if (cacheControl === CacheControl.NO_EXPIRY) {\n\t\t\tresponseHeaders['Cache-Control'] = 'public, max-age=31536000';\n\t\t} else if (cacheControl === CacheControl.NO_CACHING) {\n\t\t\tresponseHeaders['Cache-Control'] = 'no-store';\n\t\t}\n\n\t\tresponseHeaders['Content-Type'] = textMimeType[extname(filePath)] || getMediaMime(filePath) || 'text/plain';\n\n\t\tres.writeHead(200, responseHeaders);\n\n\t\t// Data\n\t\tcreateReadStream(filePath).pipe(res);\n\t} catch (error) {\n\t\tif (error.code !== 'ENOENT') {\n\t\t\tlogService.error(error);\n\t\t\tconsole.error(error.toString());\n\t\t} else {\n\t\t\tconsole.error(`File not found: ${filePath}`);\n\t\t}\n\n\t\tres.writeHead(404, { 'Content-Type': 'text/plain' });\n\t\treturn void res.end('Not found');\n\t}\n}\n\nconst APP_ROOT = dirname(FileAccess.asFileUri('').fsPath);\n\nconst STATIC_PATH = `/static`;\nconst CALLBACK_PATH = `/callback`;\nconst WEB_EXTENSION_PATH = `/web-extension-resource`;\n\nexport class WebClientServer {\n\n\tprivate readonly _webExtensionResourceUrlTemplate: URI | undefined;\n\n\tconstructor(\n\t\tprivate readonly _connectionToken: ServerConnectionToken,\n\t\tprivate readonly _basePath: string,\n\t\tprivate readonly _productPath: string,\n\t\t@IServerEnvironmentService private readonly _environmentService: IServerEnvironmentService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IRequestService private readonly _requestService: IRequestService,\n\t\t@IProductService private readonly _productService: IProductService,\n\t\t@ICSSDevelopmentService private readonly _cssDevService: ICSSDevelopmentService\n\t) {\n\t\tthis._webExtensionResourceUrlTemplate = this._productService.extensionsGallery?.resourceUrlTemplate ? URI.parse(this._productService.extensionsGallery.resourceUrlTemplate) : undefined;\n\t}\n\n\t/**\n\t * Handle web resources (i.e. only needed by the web client).\n\t * **NOTE**: This method is only invoked when the server has web bits.\n\t * **NOTE**: This method is only invoked after the connection token has been validated.\n\t * @param parsedUrl The URL to handle, including base and product path\n\t * @param pathname The pathname of the URL, without base and product path\n\t */\n\tasync handle(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: url.UrlWithParsedQuery, pathname: string): Promise<void> {\n\t\ttry {\n\t\t\tif (pathname.startsWith(STATIC_PATH) && pathname.charCodeAt(STATIC_PATH.length) === CharCode.Slash) {\n\t\t\t\treturn this._handleStatic(req, res, pathname.substring(STATIC_PATH.length));\n\t\t\t}\n\t\t\tif (pathname === '/') {\n\t\t\t\treturn this._handleRoot(req, res, parsedUrl);\n\t\t\t}\n\t\t\tif (pathname === CALLBACK_PATH) {\n\t\t\t\t// callback support\n\t\t\t\treturn this._handleCallback(res);\n\t\t\t}\n\t\t\tif (pathname.startsWith(WEB_EXTENSION_PATH) && pathname.charCodeAt(WEB_EXTENSION_PATH.length) === CharCode.Slash) {\n\t\t\t\t// extension resource support\n\t\t\t\treturn this._handleWebExtensionResource(req, res, pathname.substring(WEB_EXTENSION_PATH.length));\n\t\t\t}\n\n\t\t\treturn serveError(req, res, 404, 'Not found.');\n\t\t} catch (error) {\n\t\t\tthis._logService.error(error);\n\t\t\tconsole.error(error.toString());\n\n\t\t\treturn serveError(req, res, 500, 'Internal Server Error.');\n\t\t}\n\t}\n\t/**\n\t * Handle HTTP requests for /static/*\n\t * @param resourcePath The path after /static/\n\t */\n\tprivate async _handleStatic(req: http.IncomingMessage, res: http.ServerResponse, resourcePath: string): Promise<void> {\n\t\tconst headers: Record<string, string> = Object.create(null);\n\n\t\t// Strip the this._staticRoute from the path\n\t\tconst normalizedPathname = decodeURIComponent(resourcePath); // support paths that are uri-encoded (e.g. spaces => %20)\n\n\t\tconst filePath = join(APP_ROOT, normalizedPathname); // join also normalizes the path\n\t\tif (!isEqualOrParent(filePath, APP_ROOT, !isLinux)) {\n\t\t\treturn serveError(req, res, 400, `Bad request.`);\n\t\t}\n\n\t\treturn serveFile(filePath, this._environmentService.isBuilt ? CacheControl.NO_EXPIRY : CacheControl.ETAG, this._logService, req, res, headers);\n\t}\n\n\tprivate _getResourceURLTemplateAuthority(uri: URI): string | undefined {\n\t\tconst index = uri.authority.indexOf('.');\n\t\treturn index !== -1 ? uri.authority.substring(index + 1) : undefined;\n\t}\n\n\t/**\n\t * Handle extension resources\n\t * @param resourcePath The path after /web-extension-resource/\n\t */\n\tprivate async _handleWebExtensionResource(req: http.IncomingMessage, res: http.ServerResponse, resourcePath: string): Promise<void> {\n\t\tif (!this._webExtensionResourceUrlTemplate) {\n\t\t\treturn serveError(req, res, 500, 'No extension gallery service configured.');\n\t\t}\n\n\t\tconst normalizedPathname = decodeURIComponent(resourcePath); // support paths that are uri-encoded (e.g. spaces => %20)\n\t\tconst path = normalize(normalizedPathname);\n\t\tconst uri = URI.parse(path).with({\n\t\t\tscheme: this._webExtensionResourceUrlTemplate.scheme,\n\t\t\tauthority: path.substring(0, path.indexOf('/')),\n\t\t\tpath: path.substring(path.indexOf('/') + 1)\n\t\t});\n\n\t\tif (this._getResourceURLTemplateAuthority(this._webExtensionResourceUrlTemplate) !== this._getResourceURLTemplateAuthority(uri)) {\n\t\t\treturn serveError(req, res, 403, 'Request Forbidden');\n\t\t}\n\n\t\tconst headers: IHeaders = {};\n\t\tconst setRequestHeader = (header: string) => {\n\t\t\tconst value = req.headers[header];\n\t\t\tif (value && (isString(value) || value[0])) {\n\t\t\t\theaders[header] = isString(value) ? value : value[0];\n\t\t\t} else if (header !== header.toLowerCase()) {\n\t\t\t\tsetRequestHeader(header.toLowerCase());\n\t\t\t}\n\t\t};\n\t\tsetRequestHeader('X-Client-Name');\n\t\tsetRequestHeader('X-Client-Version');\n\t\tsetRequestHeader('X-Machine-Id');\n\t\tsetRequestHeader('X-Client-Commit');\n\n\t\tconst context = await this._requestService.request({\n\t\t\ttype: 'GET',\n\t\t\turl: uri.toString(true),\n\t\t\theaders\n\t\t}, CancellationToken.None);\n\n\t\tconst status = context.res.statusCode || 500;\n\t\tif (status !== 200) {\n\t\t\tlet text: string | null = null;\n\t\t\ttry {\n\t\t\t\ttext = await asTextOrError(context);\n\t\t\t} catch (error) {/* Ignore */ }\n\t\t\treturn serveError(req, res, status, text || `Request failed with status ${status}`);\n\t\t}\n\n\t\tconst responseHeaders: Record<string, string | string[]> = Object.create(null);\n\t\tconst setResponseHeader = (header: string) => {\n\t\t\tconst value = context.res.headers[header];\n\t\t\tif (value) {\n\t\t\t\tresponseHeaders[header] = value;\n\t\t\t} else if (header !== header.toLowerCase()) {\n\t\t\t\tsetResponseHeader(header.toLowerCase());\n\t\t\t}\n\t\t};\n\t\tsetResponseHeader('Cache-Control');\n\t\tsetResponseHeader('Content-Type');\n\t\tres.writeHead(200, responseHeaders);\n\t\tconst buffer = await streamToBuffer(context.stream);\n\t\treturn void res.end(buffer.buffer);\n\t}\n\n\t/**\n\t * Handle HTTP requests for /\n\t */\n\tprivate async _handleRoot(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: url.UrlWithParsedQuery): Promise<void> {\n\n\t\tconst getFirstHeader = (headerName: string) => {\n\t\t\tconst val = req.headers[headerName];\n\t\t\treturn Array.isArray(val) ? val[0] : val;\n\t\t};\n\n\t\t// Prefix routes with basePath for clients\n\t\tconst rootBase = relativeRoot(getOriginalUrl(req))\n\t\tconst vscodeBase = relativePath(getOriginalUrl(req))\n\t\tconst basePath = vscodeBase || getFirstHeader('x-forwarded-prefix') || this._basePath;\n\n\t\tconst queryConnectionToken = parsedUrl.query[connectionTokenQueryName];\n\t\tif (typeof queryConnectionToken === 'string') {\n\t\t\t// We got a connection token as a query parameter.\n\t\t\t// We want to have a clean URL, so we strip it\n\t\t\tconst responseHeaders: Record<string, string> = Object.create(null);\n\t\t\tresponseHeaders['Set-Cookie'] = cookie.serialize(\n\t\t\t\tconnectionTokenCookieName,\n\t\t\t\tqueryConnectionToken,\n\t\t\t\t{\n\t\t\t\t\tsameSite: 'lax',\n\t\t\t\t\tmaxAge: 60 * 60 * 24 * 7 /* 1 week */\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst newQuery = Object.create(null);\n\t\t\tfor (const key in parsedUrl.query) {\n\t\t\t\tif (key !== connectionTokenQueryName) {\n\t\t\t\t\tnewQuery[key] = parsedUrl.query[key];\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst newLocation = url.format({ pathname: basePath, query: newQuery });\n\t\t\tresponseHeaders['Location'] = newLocation;\n\n\t\t\tres.writeHead(302, responseHeaders);\n\t\t\treturn void res.end();\n\t\t}\n\n\t\tconst replacePort = (host: string, port: string) => {\n\t\t\tconst index = host?.indexOf(':');\n\t\t\tif (index !== -1) {\n\t\t\t\thost = host?.substring(0, index);\n\t\t\t}\n\t\t\thost += `:${port}`;\n\t\t\treturn host;\n\t\t};\n\n\t\tconst useTestResolver = (!this._environmentService.isBuilt && this._environmentService.args['use-test-resolver']);\n\t\t// For now we are getting the remote authority from the client to avoid\n\t\t// needing specific configuration for reverse proxies to work.  Set this to\n\t\t// something invalid to make sure we catch code that is using this value\n\t\t// from the backend when it should not.\n\t\tlet remoteAuthority = (\n\t\t\tuseTestResolver\n\t\t\t\t? 'test+test'\n\t\t\t\t: 'remote'\n\t\t);\n\t\tif (!remoteAuthority) {\n\t\t\treturn serveError(req, res, 400, `Bad request.`);\n\t\t}\n\t\tconst forwardedPort = getFirstHeader('x-forwarded-port');\n\t\tif (forwardedPort) {\n\t\t\tremoteAuthority = replacePort(remoteAuthority, forwardedPort);\n\t\t}\n\n\t\tfunction asJSON(value: unknown): string {\n\t\t\treturn JSON.stringify(value).replace(/\"/g, '&quot;');\n\t\t}\n\n\t\tlet _wrapWebWorkerExtHostInIframe: undefined | false = undefined;\n\t\tif (this._environmentService.args['enable-smoke-test-driver']) {\n\t\t\t// integration tests run at a time when the built output is not yet published to the CDN\n\t\t\t// so we must disable the iframe wrapping because the iframe URL will give a 404\n\t\t\t_wrapWebWorkerExtHostInIframe = false;\n\t\t}\n\n\t\tif (this._logService.getLevel() === LogLevel.Trace) {\n\t\t\t['x-original-host', 'x-forwarded-host', 'x-forwarded-port', 'host'].forEach(header => {\n\t\t\t\tconst value = getFirstHeader(header);\n\t\t\t\tif (value) {\n\t\t\t\t\tthis._logService.trace(`[WebClientServer] ${header}: ${value}`);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis._logService.trace(`[WebClientServer] Request URL: ${req.url}, basePath: ${basePath}, remoteAuthority: ${remoteAuthority}`);\n\t\t}\n\n\t\tconst staticRoute = posix.join(basePath, this._productPath, STATIC_PATH);\n\t\tconst callbackRoute = posix.join(basePath, this._productPath, CALLBACK_PATH);\n\n\t\tconst resolveWorkspaceURI = (defaultLocation?: string) => defaultLocation && URI.file(resolve(defaultLocation)).with({ scheme: Schemas.vscodeRemote, authority: remoteAuthority });\n\n\t\tconst filePath = FileAccess.asFileUri(`vs/code/browser/workbench/workbench${this._environmentService.isBuilt ? '' : '-dev'}.html`).fsPath;\n\t\tconst authSessionInfo = !this._environmentService.isBuilt && this._environmentService.args['github-auth'] ? {\n\t\t\tid: generateUuid(),\n\t\t\tproviderId: 'github',\n\t\t\taccessToken: this._environmentService.args['github-auth'],\n\t\t\tscopes: [['user:email'], ['repo']]\n\t\t} : undefined;\n\n\t\tconst linkProtectionTrustedDomains: string[] = [];\n\t\tif (this._environmentService.args['link-protection-trusted-domains']) {\n\t\t\tlinkProtectionTrustedDomains.push(...this._environmentService.args['link-protection-trusted-domains']);\n\t\t}\n\t\tif (this._productService.linkProtectionTrustedDomains) {\n\t\t\tlinkProtectionTrustedDomains.push(...this._productService.linkProtectionTrustedDomains);\n\t\t}\n\n\t\tconst productConfiguration: Partial<Mutable<IProductConfiguration>> = {\n\t\t\tcodeServerVersion: this._productService.codeServerVersion,\n\t\t\trootEndpoint: rootBase,\n\t\t\tupdateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,\n\t\t\tlogoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== \"none\" ? rootBase + '/logout' : undefined,\n\t\t\tproxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/',\n\t\t\tserviceWorker: {\n\t\t\t\tscope: vscodeBase + '/',\n\t\t\t\tpath: rootBase + '/_static/out/browser/serviceWorker.js',\n\t\t\t},\n\t\t\tenableTelemetry: this._productService.enableTelemetry,\n\t\t\ttelemetryEndpoint: this._productService.telemetryEndpoint,\n\t\t\tembedderIdentifier: 'server-distro',\n\t\t\textensionsGallery: this._productService.extensionsGallery,\n\t\t\tlinkProtectionTrustedDomains,\n\t\t};\n\n\t\tconst proposedApi = this._environmentService.args['enable-proposed-api'];\n\t\tif (proposedApi?.length) {\n\t\t\tproductConfiguration.extensionsEnabledWithApiProposalVersion ??= [];\n\t\t\tproductConfiguration.extensionsEnabledWithApiProposalVersion.push(...proposedApi);\n\t\t}\n\n\t\tif (!this._environmentService.isBuilt) {\n\t\t\ttry {\n\t\t\t\tconst productOverrides = JSON.parse((await promises.readFile(join(APP_ROOT, 'product.overrides.json'))).toString());\n\t\t\t\tObject.assign(productConfiguration, productOverrides);\n\t\t\t} catch (err) {/* Ignore Error */ }\n\t\t}\n\n\t\tconst workbenchWebConfiguration = {\n\t\t\tremoteAuthority,\n\t\t\tserverBasePath: basePath,\n\t\t\twebviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',\n\t\t\tuserDataPath: this._environmentService.userDataPath,\n\t\t\tisEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],\n\t\t\tisEnabledFileUploads: !this._environmentService.args['disable-file-uploads'],\n\t\t\tisEnabledCoderGettingStarted: !this._environmentService.args['disable-getting-started-override'],\n\t\t\t_wrapWebWorkerExtHostInIframe,\n\t\t\tdevelopmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() },\n\t\t\tsettingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,\n\t\t\tenableWorkspaceTrust: !this._environmentService.args['disable-workspace-trust'],\n\t\t\tfolderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),\n\t\t\tworkspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),\n\t\t\tproductConfiguration,\n\t\t\tcallbackRoute: callbackRoute\n\t\t};\n\n\t\tconst cookies = cookie.parse(req.headers.cookie || '');\n\t\tconst locale = this._environmentService.args.locale || await getLocaleFromConfig(this._environmentService.argvResource.fsPath) || cookies['vscode.nls.locale'] || req.headers['accept-language']?.split(',')[0]?.toLowerCase() || 'en';\n\t\tlet WORKBENCH_NLS_BASE_URL: string | undefined;\n\t\tlet WORKBENCH_NLS_URL: string;\n\t\tif (!locale.startsWith('en') && this._productService.nlsCoreBaseUrl) {\n\t\t\tWORKBENCH_NLS_BASE_URL = this._productService.nlsCoreBaseUrl;\n\t\t\tWORKBENCH_NLS_URL = `${WORKBENCH_NLS_BASE_URL}${this._productService.commit}/${this._productService.version}/${locale}/nls.messages.js`;\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tconst nlsFile = await getBrowserNLSConfiguration(locale, this._environmentService.userDataPath);\n\t\t\t\tWORKBENCH_NLS_URL = nlsFile\n\t\t\t\t\t? `${vscodeBase}/vscode-remote-resource?path=${encodeURIComponent(nlsFile)}`\n\t\t\t\t\t: '';\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Failed to generate translations\", error);\n\t\t\t\tWORKBENCH_NLS_URL = '';\n\t\t\t}\n\t\t}\n\n\t\tconst values: { [key: string]: string } = {\n\t\t\tWORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),\n\t\t\tWORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',\n\t\t\tWORKBENCH_WEB_BASE_URL: staticRoute,\n\t\t\tWORKBENCH_NLS_URL,\n\t\t\tWORKBENCH_NLS_FALLBACK_URL: `${staticRoute}/out/nls.messages.js`,\n\t\t\tBASE: rootBase,\n\t\t\tVS_BASE: basePath,\n\t\t};\n\n\t\t// DEV ---------------------------------------------------------------------------------------\n\t\t// DEV: This is for development and enables loading CSS via import-statements via import-maps.\n\t\t// DEV: The server needs to send along all CSS modules so that the client can construct the\n\t\t// DEV: import-map.\n\t\t// DEV ---------------------------------------------------------------------------------------\n\t\tif (this._cssDevService.isEnabled) {\n\t\t\tconst cssModules = await this._cssDevService.getCssModules();\n\t\t\tvalues['WORKBENCH_DEV_CSS_MODULES'] = JSON.stringify(cssModules);\n\t\t}\n\n\t\tif (useTestResolver) {\n\t\t\tconst bundledExtensions: { extensionPath: string; packageJSON: IExtensionManifest }[] = [];\n\t\t\tfor (const extensionPath of ['vscode-test-resolver', 'github-authentication']) {\n\t\t\t\tconst packageJSON = JSON.parse((await promises.readFile(FileAccess.asFileUri(`${builtinExtensionsPath}/${extensionPath}/package.json`).fsPath)).toString());\n\t\t\t\tbundledExtensions.push({ extensionPath, packageJSON });\n\t\t\t}\n\t\t\tvalues['WORKBENCH_BUILTIN_EXTENSIONS'] = asJSON(bundledExtensions);\n\t\t}\n\n\t\tlet data;\n\t\ttry {\n\t\t\tconst workbenchTemplate = (await promises.readFile(filePath)).toString();\n\t\t\tdata = workbenchTemplate.replace(/\\{\\{([^}]+)\\}\\}/g, (_, key) => values[key] ?? 'undefined');\n\t\t} catch (e) {\n\t\t\tres.writeHead(404, { 'Content-Type': 'text/plain' });\n\t\t\treturn void res.end('Not found');\n\t\t}\n\n\t\tconst webWorkerExtensionHostIframeScriptSHA = 'sha256-2Q+j4hfT09+1+imS46J2YlkCtHWQt0/BE79PXjJ0ZJ8=';\n\n\t\tconst cspDirectives = [\n\t\t\t'default-src \\'self\\';',\n\t\t\t'img-src \\'self\\' https: data: blob:;',\n\t\t\t'media-src \\'self\\';',\n\t\t\t`script-src 'self' 'unsafe-eval' ${WORKBENCH_NLS_BASE_URL ?? ''} blob: 'nonce-1nline-m4p' ${this._getScriptCspHashes(data).join(' ')} '${webWorkerExtensionHostIframeScriptSHA}' 'sha256-/r7rqQ+yrxt57sxLuQ6AMYcy/lUpvAIzHjIJt/OeLWU=' ${useTestResolver ? '' : ``};`,  // the sha is the same as in src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html\n\t\t\t'child-src \\'self\\';',\n\t\t\t`frame-src 'self' https://*.vscode-cdn.net data:;`,\n\t\t\t'worker-src \\'self\\' data: blob:;',\n\t\t\t'style-src \\'self\\' \\'unsafe-inline\\';',\n\t\t\t'connect-src \\'self\\' ws: wss: https:;',\n\t\t\t'font-src \\'self\\' blob:;',\n\t\t\t'manifest-src \\'self\\';'\n\t\t].join(' ');\n\n\t\tconst headers: http.OutgoingHttpHeaders = {\n\t\t\t'Content-Type': 'text/html',\n\t\t\t'Content-Security-Policy': cspDirectives\n\t\t};\n\t\tif (this._connectionToken.type !== ServerConnectionTokenType.None) {\n\t\t\t// At this point we know the client has a valid cookie\n\t\t\t// and we want to set it prolong it to ensure that this\n\t\t\t// client is valid for another 1 week at least\n\t\t\theaders['Set-Cookie'] = cookie.serialize(\n\t\t\t\tconnectionTokenCookieName,\n\t\t\t\tthis._connectionToken.value,\n\t\t\t\t{\n\t\t\t\t\tsameSite: 'lax',\n\t\t\t\t\tmaxAge: 60 * 60 * 24 * 7 /* 1 week */\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tres.writeHead(200, headers);\n\t\treturn void res.end(data);\n\t}\n\n\tprivate _getScriptCspHashes(content: string): string[] {\n\t\t// Compute the CSP hashes for line scripts. Uses regex\n\t\t// which means it isn't 100% good.\n\t\tconst regex = /<script>([\\s\\S]+?)<\\/script>/img;\n\t\tconst result: string[] = [];\n\t\tlet match: RegExpExecArray | null;\n\t\twhile (match = regex.exec(content)) {\n\t\t\tconst hasher = crypto.createHash('sha256');\n\t\t\t// This only works on Windows if we strip `\\r` from `\\r\\n`.\n\t\t\tconst script = match[1].replace(/\\r\\n/g, '\\n');\n\t\t\tconst hash = hasher\n\t\t\t\t.update(Buffer.from(script))\n\t\t\t\t.digest().toString('base64');\n\n\t\t\tresult.push(`'sha256-${hash}'`);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handle HTTP requests for /callback\n\t */\n\tprivate async _handleCallback(res: http.ServerResponse): Promise<void> {\n\t\tconst filePath = FileAccess.asFileUri('vs/code/browser/workbench/callback.html').fsPath;\n\t\tconst data = (await promises.readFile(filePath)).toString();\n\t\tconst cspDirectives = [\n\t\t\t'default-src \\'self\\';',\n\t\t\t'img-src \\'self\\' https: data: blob:;',\n\t\t\t'media-src \\'none\\';',\n\t\t\t`script-src 'self' ${this._getScriptCspHashes(data).join(' ')};`,\n\t\t\t'style-src \\'self\\' \\'unsafe-inline\\';',\n\t\t\t'font-src \\'self\\' blob:;'\n\t\t].join(' ');\n\n\t\tres.writeHead(200, {\n\t\t\t'Content-Type': 'text/html',\n\t\t\t'Content-Security-Policy': cspDirectives\n\t\t});\n\t\treturn void res.end(data);\n\t}\n}\n\n/**\n * Remove extra slashes in a URL.\n *\n * This is meant to fill the job of `path.join` so you can concatenate paths and\n * then normalize out any extra slashes.\n *\n * If you are using `path.join` you do not need this but note that `path` is for\n * file system paths, not URLs.\n */\nexport const normalizeUrlPath = (url: string, keepTrailing = false): string => {\n\treturn url.replace(/\\/\\/+/g, \"/\").replace(/\\/+$/, keepTrailing ? \"/\" : \"\")\n}\n\n/**\n * Get the relative path that will get us to the root of the page. For each\n * slash we need to go up a directory.  Will not have a trailing slash.\n *\n * For example:\n *\n * / => .\n * /foo => .\n * /foo/ => ./..\n * /foo/bar => ./..\n * /foo/bar/ => ./../..\n *\n * All paths must be relative in order to work behind a reverse proxy since we\n * we do not know the base path.  Anything that needs to be absolute (for\n * example cookies) must get the base path from the frontend.\n *\n * All relative paths must be prefixed with the relative root to ensure they\n * work no matter the depth at which they happen to appear.\n *\n * For Express `req.originalUrl` should be used as they remove the base from the\n * standard `url` property making it impossible to get the true depth.\n */\nexport const relativeRoot = (originalUrl: string): string => {\n\tconst depth = (originalUrl.split(\"?\", 1)[0].match(/\\//g) || []).length\n\treturn normalizeUrlPath(\"./\" + (depth > 1 ? \"../\".repeat(depth - 1) : \"\"))\n}\n\n/**\n * Get the relative path to the current resource.\n *\n * For example:\n *\n * / => .\n * /foo => ./foo\n * /foo/ => .\n * /foo/bar => ./bar\n * /foo/bar/ => .\n */\nexport const relativePath = (originalUrl: string): string => {\n\tconst parts = originalUrl.split(\"?\", 1)[0].split(\"/\")\n\treturn normalizeUrlPath(\"./\" + parts[parts.length - 1])\n}\n\n/**\n * code-server serves Code using Express.  Express removes the base from the url\n * and puts the original in `originalUrl` so we must use this to get the correct\n * depth.  Code is not aware it is behind Express so the types do not match.  We\n * may want to continue moving code into Code and eventually remove the Express\n * wrapper or move the web server back into code-server.\n */\nexport const getOriginalUrl = (req: http.IncomingMessage): string => {\n\treturn (req as any).originalUrl || req.url\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as crypto from 'crypto';\nimport * as fs from 'fs';\nimport * as http from 'http';\nimport * as net from 'net';\nimport { performance } from 'perf_hooks';\nimport * as url from 'url';\nimport { VSBuffer } from '../../base/common/buffer.js';\nimport { CharCode } from '../../base/common/charCode.js';\nimport { isSigPipeError, onUnexpectedError, setUnexpectedErrorHandler } from '../../base/common/errors.js';\nimport { isEqualOrParent } from '../../base/common/extpath.js';\nimport { Disposable, DisposableStore } from '../../base/common/lifecycle.js';\nimport { connectionTokenQueryName, FileAccess, getServerProductSegment, Schemas } from '../../base/common/network.js';\nimport { dirname, join } from '../../base/common/path.js';\nimport * as perf from '../../base/common/performance.js';\nimport * as platform from '../../base/common/platform.js';\nimport { createRegExp, escapeRegExpCharacters } from '../../base/common/strings.js';\nimport { URI } from '../../base/common/uri.js';\nimport { generateUuid } from '../../base/common/uuid.js';\nimport { getOSReleaseInfo } from '../../base/node/osReleaseInfo.js';\nimport { findFreePort } from '../../base/node/ports.js';\nimport { addUNCHostToAllowlist, disableUNCAccessRestrictions } from '../../base/node/unc.js';\nimport { PersistentProtocol } from '../../base/parts/ipc/common/ipc.net.js';\nimport { NodeSocket, WebSocketNodeSocket } from '../../base/parts/ipc/node/ipc.net.js';\nimport { IConfigurationService } from '../../platform/configuration/common/configuration.js';\nimport { IInstantiationService } from '../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { IProductService } from '../../platform/product/common/productService.js';\nimport { ConnectionType, ConnectionTypeRequest, ErrorMessage, HandshakeMessage, IRemoteExtensionHostStartParams, ITunnelConnectionStartParams, SignRequest } from '../../platform/remote/common/remoteAgentConnection.js';\nimport { RemoteAgentConnectionContext } from '../../platform/remote/common/remoteAgentEnvironment.js';\nimport { ITelemetryService } from '../../platform/telemetry/common/telemetry.js';\nimport { ExtensionHostConnection } from './extensionHostConnection.js';\nimport { ManagementConnection } from './remoteExtensionManagement.js';\nimport { determineServerConnectionToken, requestHasValidConnectionToken as httpRequestHasValidConnectionToken, ServerConnectionToken, ServerConnectionTokenParseError, ServerConnectionTokenType } from './serverConnectionToken.js';\nimport { IServerEnvironmentService, ServerParsedArgs } from './serverEnvironmentService.js';\nimport { setupServerServices, SocketServer } from './serverServices.js';\nimport { CacheControl, serveError, serveFile, WebClientServer } from './webClientServer.js';\nimport { createRequire } from 'node:module';\nconst require = createRequire(import.meta.url);\n\nconst SHUTDOWN_TIMEOUT = 5 * 60 * 1000;\n\ndeclare module vsda {\n\t// the signer is a native module that for historical reasons uses a lower case class name\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\texport class signer {\n\t\tsign(arg: string): string;\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\texport class validator {\n\t\tcreateNewMessage(arg: string): string;\n\t\tvalidate(arg: string): 'ok' | 'error';\n\t}\n}\n\nclass RemoteExtensionHostAgentServer extends Disposable implements IServerAPI {\n\n\tprivate readonly _extHostConnections: { [reconnectionToken: string]: ExtensionHostConnection };\n\tprivate readonly _managementConnections: { [reconnectionToken: string]: ManagementConnection };\n\tprivate readonly _allReconnectionTokens: Set<string>;\n\tprivate readonly _webClientServer: WebClientServer | null;\n\tprivate readonly _webEndpointOriginChecker: WebEndpointOriginChecker;\n\n\tprivate readonly _serverBasePath: string | undefined;\n\tprivate readonly _serverProductPath: string;\n\n\tprivate shutdownTimer: Timeout | undefined;\n\n\tconstructor(\n\t\tprivate readonly _socketServer: SocketServer<RemoteAgentConnectionContext>,\n\t\tprivate readonly _connectionToken: ServerConnectionToken,\n\t\tprivate readonly _vsdaMod: typeof vsda | null,\n\t\thasWebClient: boolean,\n\t\tserverBasePath: string | undefined,\n\t\t@IServerEnvironmentService private readonly _environmentService: IServerEnvironmentService,\n\t\t@IProductService private readonly _productService: IProductService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\t\tthis._webEndpointOriginChecker = WebEndpointOriginChecker.create(this._productService);\n\n\t\tif (serverBasePath !== undefined && serverBasePath.charCodeAt(serverBasePath.length - 1) === CharCode.Slash) {\n\t\t\t// Remove trailing slash from base path\n\t\t\tserverBasePath = serverBasePath.substring(0, serverBasePath.length - 1);\n\t\t}\n\t\tthis._serverBasePath = serverBasePath; // undefined or starts with a slash\n\t\tthis._serverProductPath = `/${getServerProductSegment(_productService)}`; // starts with a slash\n\t\tthis._extHostConnections = Object.create(null);\n\t\tthis._managementConnections = Object.create(null);\n\t\tthis._allReconnectionTokens = new Set<string>();\n\t\tthis._webClientServer = (\n\t\t\thasWebClient\n\t\t\t\t? this._instantiationService.createInstance(WebClientServer, this._connectionToken, serverBasePath ?? '/', this._serverProductPath)\n\t\t\t\t: null\n\t\t);\n\t\tthis._logService.info(`Extension host agent started.`);\n\n\t\tthis._waitThenShutdown(true);\n\t}\n\n\tpublic async handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {\n\t\t// Only serve GET requests\n\t\tif (req.method !== 'GET') {\n\t\t\treturn serveError(req, res, 405, `Unsupported method ${req.method}`);\n\t\t}\n\n\t\tif (!req.url) {\n\t\t\treturn serveError(req, res, 400, `Bad request.`);\n\t\t}\n\n\t\tconst parsedUrl = url.parse(req.url, true);\n\t\tlet pathname = parsedUrl.pathname;\n\n\t\tif (!pathname) {\n\t\t\treturn serveError(req, res, 400, `Bad request.`);\n\t\t}\n\n\t\t// Serve from both '/' and serverBasePath\n\t\tif (this._serverBasePath !== undefined && pathname.startsWith(this._serverBasePath)) {\n\t\t\tpathname = pathname.substring(this._serverBasePath.length) || '/';\n\t\t}\n\t\t// for now accept all paths, with or without server product path\n\t\tif (pathname.startsWith(this._serverProductPath) && pathname.charCodeAt(this._serverProductPath.length) === CharCode.Slash) {\n\t\t\tpathname = pathname.substring(this._serverProductPath.length);\n\t\t}\n\n\t\t// Version\n\t\tif (pathname === '/version') {\n\t\t\tres.writeHead(200, { 'Content-Type': 'text/plain' });\n\t\t\treturn void res.end(this._productService.commit || '');\n\t\t}\n\n\t\t// Delay shutdown\n\t\tif (pathname === '/delay-shutdown') {\n\t\t\tthis._delayShutdown();\n\t\t\tres.writeHead(200);\n\t\t\treturn void res.end('OK');\n\t\t}\n\n\t\tif (!httpRequestHasValidConnectionToken(this._connectionToken, req, parsedUrl)) {\n\t\t\t// invalid connection token\n\t\t\treturn serveError(req, res, 403, `Forbidden.`);\n\t\t}\n\n\t\tif (pathname === '/vscode-remote-resource') {\n\t\t\t// Handle HTTP requests for resources rendered in the rich client (images, fonts, etc.)\n\t\t\t// These resources could be files shipped with extensions or even workspace files.\n\t\t\tconst desiredPath = parsedUrl.query['path'];\n\t\t\tif (typeof desiredPath !== 'string') {\n\t\t\t\treturn serveError(req, res, 400, `Bad request.`);\n\t\t\t}\n\n\t\t\tlet filePath: string;\n\t\t\ttry {\n\t\t\t\tfilePath = URI.from({ scheme: Schemas.file, path: desiredPath }).fsPath;\n\t\t\t} catch (err) {\n\t\t\t\treturn serveError(req, res, 400, `Bad request.`);\n\t\t\t}\n\n\t\t\tconst responseHeaders: Record<string, string> = Object.create(null);\n\t\t\tif (this._environmentService.isBuilt) {\n\t\t\t\tif (isEqualOrParent(filePath, this._environmentService.builtinExtensionsPath, !platform.isLinux)\n\t\t\t\t\t|| isEqualOrParent(filePath, this._environmentService.extensionsPath, !platform.isLinux)\n\t\t\t\t) {\n\t\t\t\t\tresponseHeaders['Cache-Control'] = 'public, max-age=31536000';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Allow cross origin requests from the web worker extension host\n\t\t\tresponseHeaders['Vary'] = 'Origin';\n\t\t\tconst requestOrigin = req.headers['origin'];\n\t\t\tif (requestOrigin && this._webEndpointOriginChecker.matches(requestOrigin)) {\n\t\t\t\tresponseHeaders['Access-Control-Allow-Origin'] = requestOrigin;\n\t\t\t}\n\t\t\treturn serveFile(filePath, CacheControl.ETAG, this._logService, req, res, responseHeaders);\n\t\t}\n\n\t\t// workbench web UI\n\t\tif (this._webClientServer) {\n\t\t\tthis._webClientServer.handle(req, res, parsedUrl, pathname);\n\t\t\treturn;\n\t\t}\n\n\t\tres.writeHead(404, { 'Content-Type': 'text/plain' });\n\t\treturn void res.end('Not found');\n\t}\n\n\tpublic handleUpgrade(req: http.IncomingMessage, socket: net.Socket) {\n\t\tlet reconnectionToken = generateUuid();\n\t\tlet isReconnection = false;\n\t\tlet skipWebSocketFrames = false;\n\n\t\tif (req.url) {\n\t\t\tconst query = url.parse(req.url, true).query;\n\t\t\tif (typeof query.reconnectionToken === 'string') {\n\t\t\t\treconnectionToken = query.reconnectionToken;\n\t\t\t}\n\t\t\tif (query.reconnection === 'true') {\n\t\t\t\tisReconnection = true;\n\t\t\t}\n\t\t\tif (query.skipWebSocketFrames === 'true') {\n\t\t\t\tskipWebSocketFrames = true;\n\t\t\t}\n\t\t}\n\n\t\tif (req.headers['upgrade'] === undefined || req.headers['upgrade'].toLowerCase() !== 'websocket') {\n\t\t\tsocket.end('HTTP/1.1 400 Bad Request');\n\t\t\treturn;\n\t\t}\n\n\t\t// https://tools.ietf.org/html/rfc6455#section-4\n\t\tconst requestNonce = req.headers['sec-websocket-key'];\n\t\tconst hash = crypto.createHash('sha1');// CodeQL [SM04514] SHA1 must be used here to respect the WebSocket protocol specification\n\t\thash.update(requestNonce + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11');\n\t\tconst responseNonce = hash.digest('base64');\n\n\t\tconst responseHeaders = [\n\t\t\t`HTTP/1.1 101 Switching Protocols`,\n\t\t\t`Upgrade: websocket`,\n\t\t\t`Connection: Upgrade`,\n\t\t\t`Sec-WebSocket-Accept: ${responseNonce}`\n\t\t];\n\n\t\t// See https://tools.ietf.org/html/rfc7692#page-12\n\t\tlet permessageDeflate = false;\n\t\tif (!skipWebSocketFrames && !this._environmentService.args['disable-websocket-compression'] && req.headers['sec-websocket-extensions']) {\n\t\t\tconst websocketExtensionOptions = Array.isArray(req.headers['sec-websocket-extensions']) ? req.headers['sec-websocket-extensions'] : [req.headers['sec-websocket-extensions']];\n\t\t\tfor (const websocketExtensionOption of websocketExtensionOptions) {\n\t\t\t\tif (/\\b((server_max_window_bits)|(server_no_context_takeover)|(client_no_context_takeover))\\b/.test(websocketExtensionOption)) {\n\t\t\t\t\t// sorry, the server does not support zlib parameter tweaks\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (/\\b(permessage-deflate)\\b/.test(websocketExtensionOption)) {\n\t\t\t\t\tpermessageDeflate = true;\n\t\t\t\t\tresponseHeaders.push(`Sec-WebSocket-Extensions: permessage-deflate`);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (/\\b(x-webkit-deflate-frame)\\b/.test(websocketExtensionOption)) {\n\t\t\t\t\tpermessageDeflate = true;\n\t\t\t\t\tresponseHeaders.push(`Sec-WebSocket-Extensions: x-webkit-deflate-frame`);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsocket.write(responseHeaders.join('\\r\\n') + '\\r\\n\\r\\n');\n\n\t\t// Never timeout this socket due to inactivity!\n\t\tsocket.setTimeout(0);\n\t\t// Disable Nagle's algorithm\n\t\tsocket.setNoDelay(true);\n\t\t// Finally!\n\n\t\tif (skipWebSocketFrames) {\n\t\t\tthis._handleWebSocketConnection(new NodeSocket(socket, `server-connection-${reconnectionToken}`), isReconnection, reconnectionToken);\n\t\t} else {\n\t\t\tthis._handleWebSocketConnection(new WebSocketNodeSocket(new NodeSocket(socket, `server-connection-${reconnectionToken}`), permessageDeflate, null, true), isReconnection, reconnectionToken);\n\t\t}\n\t}\n\n\tpublic handleServerError(err: Error): void {\n\t\tthis._logService.error(`Error occurred in server`);\n\t\tthis._logService.error(err);\n\t}\n\n\t// Eventually cleanup\n\n\tprivate _getRemoteAddress(socket: NodeSocket | WebSocketNodeSocket): string {\n\t\tlet _socket: net.Socket;\n\t\tif (socket instanceof NodeSocket) {\n\t\t\t_socket = socket.socket;\n\t\t} else {\n\t\t\t_socket = socket.socket.socket;\n\t\t}\n\t\treturn _socket.remoteAddress || `<unknown>`;\n\t}\n\n\tprivate async _rejectWebSocketConnection(logPrefix: string, protocol: PersistentProtocol, reason: string): Promise<void> {\n\t\tconst socket = protocol.getSocket();\n\t\tthis._logService.error(`${logPrefix} ${reason}.`);\n\t\tconst errMessage: ErrorMessage = {\n\t\t\ttype: 'error',\n\t\t\treason: reason\n\t\t};\n\t\tprotocol.sendControl(VSBuffer.fromString(JSON.stringify(errMessage)));\n\t\tprotocol.dispose();\n\t\tawait socket.drain();\n\t\tsocket.dispose();\n\t}\n\n\t/**\n\t * NOTE: Avoid using await in this method!\n\t * The problem is that await introduces a process.nextTick due to the implicit Promise.then\n\t * This can lead to some bytes being received and interpreted and a control message being emitted before the next listener has a chance to be registered.\n\t */\n\tprivate _handleWebSocketConnection(socket: NodeSocket | WebSocketNodeSocket, isReconnection: boolean, reconnectionToken: string): void {\n\t\tconst remoteAddress = this._getRemoteAddress(socket);\n\t\tconst logPrefix = `[${remoteAddress}][${reconnectionToken.substr(0, 8)}]`;\n\t\tconst protocol = new PersistentProtocol({ socket });\n\n\t\tconst validator = this._vsdaMod ? new this._vsdaMod.validator() : null;\n\t\tconst signer = this._vsdaMod ? new this._vsdaMod.signer() : null;\n\n\t\tconst enum State {\n\t\t\tWaitingForAuth,\n\t\t\tWaitingForConnectionType,\n\t\t\tDone,\n\t\t\tError\n\t\t}\n\t\tlet state = State.WaitingForAuth;\n\n\t\tconst rejectWebSocketConnection = (msg: string) => {\n\t\t\tstate = State.Error;\n\t\t\tlistener.dispose();\n\t\t\tthis._rejectWebSocketConnection(logPrefix, protocol, msg);\n\t\t};\n\n\t\tconst listener = protocol.onControlMessage((raw) => {\n\t\t\tif (state === State.WaitingForAuth) {\n\t\t\t\tlet msg1: HandshakeMessage;\n\t\t\t\ttry {\n\t\t\t\t\tmsg1 = <HandshakeMessage>JSON.parse(raw.toString());\n\t\t\t\t} catch (err) {\n\t\t\t\t\treturn rejectWebSocketConnection(`Malformed first message`);\n\t\t\t\t}\n\t\t\t\tif (msg1.type !== 'auth') {\n\t\t\t\t\treturn rejectWebSocketConnection(`Invalid first message`);\n\t\t\t\t}\n\n\t\t\t\tif (this._connectionToken.type === ServerConnectionTokenType.Mandatory && !this._connectionToken.validate(msg1.auth)) {\n\t\t\t\t\treturn rejectWebSocketConnection(`Unauthorized client refused: auth mismatch`);\n\t\t\t\t}\n\n\t\t\t\t// Send `sign` request\n\t\t\t\tlet signedData = generateUuid();\n\t\t\t\tif (signer) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsignedData = signer.sign(msg1.data);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlet someText = generateUuid();\n\t\t\t\tif (validator) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsomeText = validator.createNewMessage(someText);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst signRequest: SignRequest = {\n\t\t\t\t\ttype: 'sign',\n\t\t\t\t\tdata: someText,\n\t\t\t\t\tsignedData: signedData\n\t\t\t\t};\n\t\t\t\tprotocol.sendControl(VSBuffer.fromString(JSON.stringify(signRequest)));\n\n\t\t\t\tstate = State.WaitingForConnectionType;\n\n\t\t\t} else if (state === State.WaitingForConnectionType) {\n\n\t\t\t\tlet msg2: HandshakeMessage;\n\t\t\t\ttry {\n\t\t\t\t\tmsg2 = <HandshakeMessage>JSON.parse(raw.toString());\n\t\t\t\t} catch (err) {\n\t\t\t\t\treturn rejectWebSocketConnection(`Malformed second message`);\n\t\t\t\t}\n\t\t\t\tif (msg2.type !== 'connectionType') {\n\t\t\t\t\treturn rejectWebSocketConnection(`Invalid second message`);\n\t\t\t\t}\n\t\t\t\tif (typeof msg2.signedData !== 'string') {\n\t\t\t\t\treturn rejectWebSocketConnection(`Invalid second message field type`);\n\t\t\t\t}\n\n\t\t\t\tconst rendererCommit = msg2.commit;\n\t\t\t\tconst myCommit = this._productService.commit;\n\t\t\t\tif (rendererCommit && myCommit) {\n\t\t\t\t\t// Running in the built version where commits are defined\n\t\t\t\t\tif (rendererCommit !== myCommit) {\n\t\t\t\t\t\treturn rejectWebSocketConnection(`Client refused: version mismatch`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet valid = false;\n\t\t\t\tif (!validator) {\n\t\t\t\t\tvalid = true;\n\t\t\t\t} else if (this._connectionToken.validate(msg2.signedData)) {\n\t\t\t\t\t// web client\n\t\t\t\t\tvalid = true;\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvalid = validator.validate(msg2.signedData) === 'ok';\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!valid) {\n\t\t\t\t\tif (this._environmentService.isBuilt) {\n\t\t\t\t\t\treturn rejectWebSocketConnection(`Unauthorized client refused`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._logService.error(`${logPrefix} Unauthorized client handshake failed but we proceed because of dev mode.`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We have received a new connection.\n\t\t\t\t// This indicates that the server owner has connectivity.\n\t\t\t\t// Therefore we will shorten the reconnection grace period for disconnected connections!\n\t\t\t\tfor (const key in this._managementConnections) {\n\t\t\t\t\tconst managementConnection = this._managementConnections[key];\n\t\t\t\t\tmanagementConnection.shortenReconnectionGraceTimeIfNecessary();\n\t\t\t\t}\n\t\t\t\tfor (const key in this._extHostConnections) {\n\t\t\t\t\tconst extHostConnection = this._extHostConnections[key];\n\t\t\t\t\textHostConnection.shortenReconnectionGraceTimeIfNecessary();\n\t\t\t\t}\n\n\t\t\t\tstate = State.Done;\n\t\t\t\tlistener.dispose();\n\t\t\t\tthis._handleConnectionType(remoteAddress, logPrefix, protocol, socket, isReconnection, reconnectionToken, msg2);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate async _handleConnectionType(remoteAddress: string, _logPrefix: string, protocol: PersistentProtocol, socket: NodeSocket | WebSocketNodeSocket, isReconnection: boolean, reconnectionToken: string, msg: ConnectionTypeRequest): Promise<void> {\n\t\tconst logPrefix = (\n\t\t\tmsg.desiredConnectionType === ConnectionType.Management\n\t\t\t\t? `${_logPrefix}[ManagementConnection]`\n\t\t\t\t: msg.desiredConnectionType === ConnectionType.ExtensionHost\n\t\t\t\t\t? `${_logPrefix}[ExtensionHostConnection]`\n\t\t\t\t\t: _logPrefix\n\t\t);\n\n\t\tif (msg.desiredConnectionType === ConnectionType.Management) {\n\t\t\t// This should become a management connection\n\n\t\t\tif (isReconnection) {\n\t\t\t\t// This is a reconnection\n\t\t\t\tif (!this._managementConnections[reconnectionToken]) {\n\t\t\t\t\tif (!this._allReconnectionTokens.has(reconnectionToken)) {\n\t\t\t\t\t\t// This is an unknown reconnection token\n\t\t\t\t\t\treturn this._rejectWebSocketConnection(logPrefix, protocol, `Unknown reconnection token (never seen)`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a connection that was seen in the past, but is no longer valid\n\t\t\t\t\t\treturn this._rejectWebSocketConnection(logPrefix, protocol, `Unknown reconnection token (seen before)`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tprotocol.sendControl(VSBuffer.fromString(JSON.stringify({ type: 'ok' })));\n\t\t\t\tconst dataChunk = protocol.readEntireBuffer();\n\t\t\t\tprotocol.dispose();\n\t\t\t\tthis._managementConnections[reconnectionToken].acceptReconnection(remoteAddress, socket, dataChunk);\n\n\t\t\t} else {\n\t\t\t\t// This is a fresh connection\n\t\t\t\tif (this._managementConnections[reconnectionToken]) {\n\t\t\t\t\t// Cannot have two concurrent connections using the same reconnection token\n\t\t\t\t\treturn this._rejectWebSocketConnection(logPrefix, protocol, `Duplicate reconnection token`);\n\t\t\t\t}\n\n\t\t\t\tprotocol.sendControl(VSBuffer.fromString(JSON.stringify({ type: 'ok' })));\n\t\t\t\tconst con = new ManagementConnection(this._logService, reconnectionToken, remoteAddress, protocol);\n\t\t\t\tthis._socketServer.acceptConnection(con.protocol, con.onClose);\n\t\t\t\tthis._managementConnections[reconnectionToken] = con;\n\t\t\t\tthis._allReconnectionTokens.add(reconnectionToken);\n\t\t\t\tcon.onClose(() => {\n\t\t\t\t\tdelete this._managementConnections[reconnectionToken];\n\t\t\t\t});\n\n\t\t\t}\n\n\t\t} else if (msg.desiredConnectionType === ConnectionType.ExtensionHost) {\n\n\t\t\t// This should become an extension host connection\n\t\t\tconst startParams0 = <IRemoteExtensionHostStartParams>msg.args || { language: 'en' };\n\t\t\tconst startParams = await this._updateWithFreeDebugPort(startParams0);\n\n\t\t\tif (startParams.port) {\n\t\t\t\tthis._logService.trace(`${logPrefix} - startParams debug port ${startParams.port}`);\n\t\t\t}\n\t\t\tthis._logService.trace(`${logPrefix} - startParams language: ${startParams.language}`);\n\t\t\tthis._logService.trace(`${logPrefix} - startParams env: ${JSON.stringify(startParams.env)}`);\n\n\t\t\tif (isReconnection) {\n\t\t\t\t// This is a reconnection\n\t\t\t\tif (!this._extHostConnections[reconnectionToken]) {\n\t\t\t\t\tif (!this._allReconnectionTokens.has(reconnectionToken)) {\n\t\t\t\t\t\t// This is an unknown reconnection token\n\t\t\t\t\t\treturn this._rejectWebSocketConnection(logPrefix, protocol, `Unknown reconnection token (never seen)`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a connection that was seen in the past, but is no longer valid\n\t\t\t\t\t\treturn this._rejectWebSocketConnection(logPrefix, protocol, `Unknown reconnection token (seen before)`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tprotocol.sendPause();\n\t\t\t\tprotocol.sendControl(VSBuffer.fromString(JSON.stringify(startParams.port ? { debugPort: startParams.port } : {})));\n\t\t\t\tconst dataChunk = protocol.readEntireBuffer();\n\t\t\t\tprotocol.dispose();\n\t\t\t\tthis._extHostConnections[reconnectionToken].acceptReconnection(remoteAddress, socket, dataChunk);\n\n\t\t\t} else {\n\t\t\t\t// This is a fresh connection\n\t\t\t\tif (this._extHostConnections[reconnectionToken]) {\n\t\t\t\t\t// Cannot have two concurrent connections using the same reconnection token\n\t\t\t\t\treturn this._rejectWebSocketConnection(logPrefix, protocol, `Duplicate reconnection token`);\n\t\t\t\t}\n\n\t\t\t\tprotocol.sendPause();\n\t\t\t\tprotocol.sendControl(VSBuffer.fromString(JSON.stringify(startParams.port ? { debugPort: startParams.port } : {})));\n\t\t\t\tconst dataChunk = protocol.readEntireBuffer();\n\t\t\t\tprotocol.dispose();\n\t\t\t\tconst con = this._instantiationService.createInstance(ExtensionHostConnection, reconnectionToken, remoteAddress, socket, dataChunk);\n\t\t\t\tthis._extHostConnections[reconnectionToken] = con;\n\t\t\t\tthis._allReconnectionTokens.add(reconnectionToken);\n\t\t\t\tcon.onClose(() => {\n\t\t\t\t\tcon.dispose();\n\t\t\t\t\tdelete this._extHostConnections[reconnectionToken];\n\t\t\t\t\tthis._onDidCloseExtHostConnection();\n\t\t\t\t});\n\t\t\t\tcon.start(startParams);\n\t\t\t}\n\n\t\t} else if (msg.desiredConnectionType === ConnectionType.Tunnel) {\n\n\t\t\tconst tunnelStartParams = <ITunnelConnectionStartParams>msg.args;\n\t\t\tthis._createTunnel(protocol, tunnelStartParams);\n\n\t\t} else {\n\n\t\t\treturn this._rejectWebSocketConnection(logPrefix, protocol, `Unknown initial data received`);\n\n\t\t}\n\t}\n\n\tprivate async _createTunnel(protocol: PersistentProtocol, tunnelStartParams: ITunnelConnectionStartParams): Promise<void> {\n\t\tconst remoteSocket = (<NodeSocket>protocol.getSocket()).socket;\n\t\tconst dataChunk = protocol.readEntireBuffer();\n\t\tprotocol.dispose();\n\n\t\tremoteSocket.pause();\n\t\tconst localSocket = await this._connectTunnelSocket(tunnelStartParams.host, tunnelStartParams.port);\n\n\t\tif (dataChunk.byteLength > 0) {\n\t\t\tlocalSocket.write(dataChunk.buffer);\n\t\t}\n\n\t\tlocalSocket.on('end', () => remoteSocket.end());\n\t\tlocalSocket.on('close', () => remoteSocket.end());\n\t\tlocalSocket.on('error', () => remoteSocket.destroy());\n\t\tremoteSocket.on('end', () => localSocket.end());\n\t\tremoteSocket.on('close', () => localSocket.end());\n\t\tremoteSocket.on('error', () => localSocket.destroy());\n\n\t\tlocalSocket.pipe(remoteSocket);\n\t\tremoteSocket.pipe(localSocket);\n\t}\n\n\tprivate _connectTunnelSocket(host: string, port: number): Promise<net.Socket> {\n\t\treturn new Promise<net.Socket>((c, e) => {\n\t\t\tconst socket = net.createConnection(\n\t\t\t\t{\n\t\t\t\t\thost: host,\n\t\t\t\t\tport: port,\n\t\t\t\t\tautoSelectFamily: true\n\t\t\t\t}, () => {\n\t\t\t\t\tsocket.removeListener('error', e);\n\t\t\t\t\tsocket.pause();\n\t\t\t\t\tc(socket);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tsocket.once('error', e);\n\t\t});\n\t}\n\n\tprivate _updateWithFreeDebugPort(startParams: IRemoteExtensionHostStartParams): Thenable<IRemoteExtensionHostStartParams> {\n\t\tif (typeof startParams.port === 'number') {\n\t\t\treturn findFreePort(startParams.port, 10 /* try 10 ports */, 5000 /* try up to 5 seconds */).then(freePort => {\n\t\t\t\tstartParams.port = freePort;\n\t\t\t\treturn startParams;\n\t\t\t});\n\t\t}\n\t\t// No port clear debug configuration.\n\t\tstartParams.debugId = undefined;\n\t\tstartParams.port = undefined;\n\t\tstartParams.break = undefined;\n\t\treturn Promise.resolve(startParams);\n\t}\n\n\tprivate async _onDidCloseExtHostConnection(): Promise<void> {\n\t\tif (!this._environmentService.args['enable-remote-auto-shutdown']) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._cancelShutdown();\n\n\t\tconst hasActiveExtHosts = !!Object.keys(this._extHostConnections).length;\n\t\tif (!hasActiveExtHosts) {\n\t\t\tconsole.log('Last EH closed, waiting before shutting down');\n\t\t\tthis._logService.info('Last EH closed, waiting before shutting down');\n\t\t\tthis._waitThenShutdown();\n\t\t}\n\t}\n\n\tprivate _waitThenShutdown(initial = false): void {\n\t\tif (!this._environmentService.args['enable-remote-auto-shutdown']) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._environmentService.args['remote-auto-shutdown-without-delay'] && !initial) {\n\t\t\tthis._shutdown();\n\t\t} else {\n\t\t\tthis.shutdownTimer = setTimeout(() => {\n\t\t\t\tthis.shutdownTimer = undefined;\n\n\t\t\t\tthis._shutdown();\n\t\t\t}, SHUTDOWN_TIMEOUT);\n\t\t}\n\t}\n\n\tprivate _shutdown(): void {\n\t\tconst hasActiveExtHosts = !!Object.keys(this._extHostConnections).length;\n\t\tif (hasActiveExtHosts) {\n\t\t\tconsole.log('New EH opened, aborting shutdown');\n\t\t\tthis._logService.info('New EH opened, aborting shutdown');\n\t\t\treturn;\n\t\t} else {\n\t\t\tconsole.log('Last EH closed, shutting down');\n\t\t\tthis._logService.info('Last EH closed, shutting down');\n\t\t\tthis.dispose();\n\t\t\tprocess.exit(0);\n\t\t}\n\t}\n\n\t/**\n\t * If the server is in a shutdown timeout, cancel it and start over\n\t */\n\tprivate _delayShutdown(): void {\n\t\tif (this.shutdownTimer) {\n\t\t\tconsole.log('Got delay-shutdown request while in shutdown timeout, delaying');\n\t\t\tthis._logService.info('Got delay-shutdown request while in shutdown timeout, delaying');\n\t\t\tthis._cancelShutdown();\n\t\t\tthis._waitThenShutdown();\n\t\t}\n\t}\n\n\tprivate _cancelShutdown(): void {\n\t\tif (this.shutdownTimer) {\n\t\t\tconsole.log('Cancelling previous shutdown timeout');\n\t\t\tthis._logService.info('Cancelling previous shutdown timeout');\n\t\t\tclearTimeout(this.shutdownTimer);\n\t\t\tthis.shutdownTimer = undefined;\n\t\t}\n\t}\n}\n\nexport interface IServerAPI {\n\t/**\n\t * Do not remove!!. Called from server-main.js\n\t */\n\thandleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;\n\t/**\n\t * Do not remove!!. Called from server-main.js\n\t */\n\thandleUpgrade(req: http.IncomingMessage, socket: net.Socket): void;\n\t/**\n\t * Do not remove!!. Called from server-main.js\n\t */\n\thandleServerError(err: Error): void;\n\t/**\n\t * Do not remove!!. Called from server-main.js\n\t */\n\tdispose(): void;\n}\n\nexport async function createServer(address: string | net.AddressInfo | null, args: ServerParsedArgs, REMOTE_DATA_FOLDER: string): Promise<IServerAPI> {\n\n\tconst connectionToken = await determineServerConnectionToken(args);\n\tif (connectionToken instanceof ServerConnectionTokenParseError) {\n\t\tconsole.warn(connectionToken.message);\n\t\tprocess.exit(1);\n\t}\n\n\t// setting up error handlers, first with console.error, then, once available, using the log service\n\n\tfunction initUnexpectedErrorHandler(handler: (err: any) => void) {\n\t\tsetUnexpectedErrorHandler(err => {\n\t\t\t// See https://github.com/microsoft/vscode-remote-release/issues/6481\n\t\t\t// In some circumstances, console.error will throw an asynchronous error. This asynchronous error\n\t\t\t// will end up here, and then it will be logged again, thus creating an endless asynchronous loop.\n\t\t\t// Here we try to break the loop by ignoring EPIPE errors that include our own unexpected error handler in the stack.\n\t\t\tif (isSigPipeError(err) && err.stack && /unexpectedErrorHandler/.test(err.stack)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thandler(err);\n\t\t});\n\t}\n\n\tconst unloggedErrors: any[] = [];\n\tinitUnexpectedErrorHandler((error: any) => {\n\t\tunloggedErrors.push(error);\n\t\tconsole.error(error);\n\t});\n\tlet didLogAboutSIGPIPE = false;\n\tprocess.on('SIGPIPE', () => {\n\t\t// See https://github.com/microsoft/vscode-remote-release/issues/6543\n\t\t// We would normally install a SIGPIPE listener in bootstrap-node.js\n\t\t// But in certain situations, the console itself can be in a broken pipe state\n\t\t// so logging SIGPIPE to the console will cause an infinite async loop\n\t\tif (!didLogAboutSIGPIPE) {\n\t\t\tdidLogAboutSIGPIPE = true;\n\t\t\tonUnexpectedError(new Error(`Unexpected SIGPIPE`));\n\t\t}\n\t});\n\n\tconst disposables = new DisposableStore();\n\tconst { socketServer, instantiationService } = await setupServerServices(connectionToken, args, REMOTE_DATA_FOLDER, disposables);\n\n\t// Set the unexpected error handler after the services have been initialized, to avoid having\n\t// the telemetry service overwrite our handler\n\tinstantiationService.invokeFunction((accessor) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tunloggedErrors.forEach(error => logService.error(error));\n\t\tunloggedErrors.length = 0;\n\n\t\tinitUnexpectedErrorHandler((error: any) => logService.error(error));\n\t});\n\n\t// On Windows, configure the UNC allow list based on settings\n\tinstantiationService.invokeFunction((accessor) => {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\n\t\tif (platform.isWindows) {\n\t\t\tif (configurationService.getValue('security.restrictUNCAccess') === false) {\n\t\t\t\tdisableUNCAccessRestrictions();\n\t\t\t} else {\n\t\t\t\taddUNCHostToAllowlist(configurationService.getValue('security.allowedUNCHosts'));\n\t\t\t}\n\t\t}\n\t});\n\n\t//\n\t// On Windows, exit early with warning message to users about potential security issue\n\t// if there is node_modules folder under home drive or Users folder.\n\t//\n\tinstantiationService.invokeFunction((accessor) => {\n\t\tconst logService = accessor.get(ILogService);\n\n\t\tif (platform.isWindows && process.env.HOMEDRIVE && process.env.HOMEPATH) {\n\t\t\tconst homeDirModulesPath = join(process.env.HOMEDRIVE, 'node_modules');\n\t\t\tconst userDir = dirname(join(process.env.HOMEDRIVE, process.env.HOMEPATH));\n\t\t\tconst userDirModulesPath = join(userDir, 'node_modules');\n\t\t\tif (fs.existsSync(homeDirModulesPath) || fs.existsSync(userDirModulesPath)) {\n\t\t\t\tconst message = `\n\n*\n* !!!! Server terminated due to presence of CVE-2020-1416 !!!!\n*\n* Please remove the following directories and re-try\n* ${homeDirModulesPath}\n* ${userDirModulesPath}\n*\n* For more information on the vulnerability https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-1416\n*\n\n`;\n\t\t\t\tlogService.warn(message);\n\t\t\t\tconsole.warn(message);\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t}\n\t});\n\n\tconst vsdaMod = instantiationService.invokeFunction((accessor) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tconst hasVSDA = fs.existsSync(join(FileAccess.asFileUri('').fsPath, '../node_modules/vsda'));\n\t\tif (hasVSDA) {\n\t\t\ttry {\n\t\t\t\treturn require('vsda');\n\t\t\t} catch (err) {\n\t\t\t\tlogService.error(err);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t});\n\n\tlet serverBasePath = args['server-base-path'];\n\tif (serverBasePath && !serverBasePath.startsWith('/')) {\n\t\tserverBasePath = `/${serverBasePath}`;\n\t}\n\n\tconst hasWebClient = fs.existsSync(FileAccess.asFileUri(`vs/code/browser/workbench/workbench.html`).fsPath);\n\n\tif (hasWebClient && address && typeof address !== 'string') {\n\t\t// ships the web ui!\n\t\tconst queryPart = (connectionToken.type !== ServerConnectionTokenType.None ? `?${connectionTokenQueryName}=${connectionToken.value}` : '');\n\t\tconsole.log(`Web UI available at http://localhost${address.port === 80 ? '' : `:${address.port}`}${serverBasePath ?? ''}${queryPart}`);\n\t}\n\n\tconst remoteExtensionHostAgentServer = instantiationService.createInstance(RemoteExtensionHostAgentServer, socketServer, connectionToken, vsdaMod, hasWebClient, serverBasePath);\n\n\tperf.mark('code/server/ready');\n\tconst currentTime = performance.now();\n\tconst vscodeServerStartTime: number = (<any>global).vscodeServerStartTime;\n\tconst vscodeServerListenTime: number = (<any>global).vscodeServerListenTime;\n\tconst vscodeServerCodeLoadedTime: number = (<any>global).vscodeServerCodeLoadedTime;\n\n\tinstantiationService.invokeFunction(async (accessor) => {\n\t\tconst telemetryService = accessor.get(ITelemetryService);\n\n\t\ttype ServerStartClassification = {\n\t\t\towner: 'alexdima';\n\t\t\tcomment: 'The server has started up';\n\t\t\tstartTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The time the server started at.' };\n\t\t\tstartedTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The time the server began listening for connections.' };\n\t\t\tcodeLoadedTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The time which the code loaded on the server' };\n\t\t\treadyTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The time when the server was completely ready' };\n\t\t};\n\t\ttype ServerStartEvent = {\n\t\t\tstartTime: number;\n\t\t\tstartedTime: number;\n\t\t\tcodeLoadedTime: number;\n\t\t\treadyTime: number;\n\t\t};\n\t\ttelemetryService.publicLog2<ServerStartEvent, ServerStartClassification>('serverStart', {\n\t\t\tstartTime: vscodeServerStartTime,\n\t\t\tstartedTime: vscodeServerListenTime,\n\t\t\tcodeLoadedTime: vscodeServerCodeLoadedTime,\n\t\t\treadyTime: currentTime\n\t\t});\n\n\t\tif (platform.isLinux) {\n\t\t\tconst logService = accessor.get(ILogService);\n\t\t\tconst releaseInfo = await getOSReleaseInfo(logService.error.bind(logService));\n\t\t\tif (releaseInfo) {\n\t\t\t\ttype ServerPlatformInfoClassification = {\n\t\t\t\t\tplatformId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'A string identifying the operating system without any version information.' };\n\t\t\t\t\tplatformVersionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'A string identifying the operating system version excluding any name information or release code.' };\n\t\t\t\t\tplatformIdLike: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'A string identifying the operating system the current OS derivate is closely related to.' };\n\t\t\t\t\towner: 'deepak1556';\n\t\t\t\t\tcomment: 'Provides insight into the distro information on Linux.';\n\t\t\t\t};\n\t\t\t\ttype ServerPlatformInfoEvent = {\n\t\t\t\t\tplatformId: string;\n\t\t\t\t\tplatformVersionId: string | undefined;\n\t\t\t\t\tplatformIdLike: string | undefined;\n\t\t\t\t};\n\t\t\t\ttelemetryService.publicLog2<ServerPlatformInfoEvent, ServerPlatformInfoClassification>('serverPlatformInfo', {\n\t\t\t\t\tplatformId: releaseInfo.id,\n\t\t\t\t\tplatformVersionId: releaseInfo.version_id,\n\t\t\t\t\tplatformIdLike: releaseInfo.id_like\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\n\tif (args['print-startup-performance']) {\n\t\tlet output = '';\n\t\toutput += `Start-up time: ${vscodeServerListenTime - vscodeServerStartTime}\\n`;\n\t\toutput += `Code loading time: ${vscodeServerCodeLoadedTime - vscodeServerStartTime}\\n`;\n\t\toutput += `Initialized time: ${currentTime - vscodeServerStartTime}\\n`;\n\t\toutput += `\\n`;\n\t\tconsole.log(output);\n\t}\n\treturn remoteExtensionHostAgentServer;\n}\n\nclass WebEndpointOriginChecker {\n\n\tpublic static create(productService: IProductService): WebEndpointOriginChecker {\n\t\tconst webEndpointUrlTemplate = productService.webEndpointUrlTemplate;\n\t\tconst commit = productService.commit;\n\t\tconst quality = productService.quality;\n\t\tif (!webEndpointUrlTemplate || !commit || !quality) {\n\t\t\treturn new WebEndpointOriginChecker(null);\n\t\t}\n\n\t\tconst uuid = generateUuid();\n\t\tconst exampleUrl = new URL(\n\t\t\twebEndpointUrlTemplate\n\t\t\t\t.replace('{{uuid}}', uuid)\n\t\t\t\t.replace('{{commit}}', commit)\n\t\t\t\t.replace('{{quality}}', quality)\n\t\t);\n\t\tconst exampleOrigin = exampleUrl.origin;\n\t\tconst originRegExpSource = (\n\t\t\tescapeRegExpCharacters(exampleOrigin)\n\t\t\t\t.replace(uuid, '[a-zA-Z0-9\\\\-]+')\n\t\t);\n\t\ttry {\n\t\t\tconst originRegExp = createRegExp(`^${originRegExpSource}$`, true, { matchCase: false });\n\t\t\treturn new WebEndpointOriginChecker(originRegExp);\n\t\t} catch (err) {\n\t\t\treturn new WebEndpointOriginChecker(null);\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly _originRegExp: RegExp | null\n\t) { }\n\n\tpublic matches(origin: string): boolean {\n\t\tif (!this._originRegExp) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this._originRegExp.test(origin);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as os from 'os';\nimport * as fs from 'fs';\nimport * as net from 'net';\nimport { FileAccess } from '../../base/common/network.js';\nimport { run as runCli } from './remoteExtensionHostAgentCli.js';\nimport { createServer as doCreateServer, IServerAPI } from './remoteExtensionHostAgentServer.js';\nimport { parseArgs, ErrorReporter } from '../../platform/environment/node/argv.js';\nimport { join, dirname } from '../../base/common/path.js';\nimport { performance } from 'perf_hooks';\nimport { serverOptions, ServerParsedArgs } from './serverEnvironmentService.js';\nimport product from '../../platform/product/common/product.js';\nimport * as perf from '../../base/common/performance.js';\n\nperf.mark('code/server/codeLoaded');\n(<any>global).vscodeServerCodeLoadedTime = performance.now();\n\nconst errorReporter: ErrorReporter = {\n\tonMultipleValues: (id: string, usedValue: string) => {\n\t\tconsole.error(`Option '${id}' can only be defined once. Using value ${usedValue}.`);\n\t},\n\tonEmptyValue: (id) => {\n\t\tconsole.error(`Ignoring option '${id}': Value must not be empty.`);\n\t},\n\tonUnknownOption: (id: string) => {\n\t\tconsole.error(`Ignoring option '${id}': not supported for server.`);\n\t},\n\tonDeprecatedOption: (deprecatedOption: string, message) => {\n\t\tconsole.warn(`Option '${deprecatedOption}' is deprecated: ${message}`);\n\t}\n};\n\nfunction parse(): ServerParsedArgs {\n\treturn parseArgs(process.argv.slice(2), serverOptions, errorReporter);\n}\n\nfunction createDirs(args: ServerParsedArgs): string {\n\tconst REMOTE_DATA_FOLDER = args['server-data-dir'] || args['user-data-dir'] || process.env['VSCODE_AGENT_FOLDER'] || join(os.homedir(), product.serverDataFolderName || '.vscode-remote');\n\tconst USER_DATA_PATH = args['user-data-dir'] || join(REMOTE_DATA_FOLDER, 'data');\n\tconst APP_SETTINGS_HOME = join(USER_DATA_PATH, 'User');\n\tconst GLOBAL_STORAGE_HOME = join(APP_SETTINGS_HOME, 'globalStorage');\n\tconst LOCAL_HISTORY_HOME = join(APP_SETTINGS_HOME, 'History');\n\tconst MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine');\n\targs['user-data-dir'] = USER_DATA_PATH;\n\tconst APP_ROOT = dirname(FileAccess.asFileUri('').fsPath);\n\tconst BUILTIN_EXTENSIONS_FOLDER_PATH = args['builtin-extensions-dir'] || join(APP_ROOT, 'extensions');\n\targs['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH;\n\targs['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions');\n\n\t[REMOTE_DATA_FOLDER, args['extensions-dir'], USER_DATA_PATH, APP_SETTINGS_HOME, MACHINE_SETTINGS_HOME, GLOBAL_STORAGE_HOME, LOCAL_HISTORY_HOME].forEach(f => {\n\t\ttry {\n\t\t\tif (!fs.existsSync(f)) {\n\t\t\t\tfs.mkdirSync(f, { mode: 0o700 });\n\t\t\t}\n\t\t} catch (err) { console.error(err); }\n\t});\n\treturn REMOTE_DATA_FOLDER;\n}\n\n/**\n * invoked by server-main.js\n */\nfunction spawnCli(args = parse()): Promise<void> {\n\treturn runCli(args, createDirs(args), serverOptions);\n}\n\n/**\n * invoked by server-main.js\n */\nfunction createServer(address: string | net.AddressInfo | null, args = parse()): Promise<IServerAPI> {\n\treturn doCreateServer(address, args, createDirs(args));\n}\n\n// The aliases prevent the names getting mangled during minification which would\n// make it difficult to import.\nexport { spawnCli as spawnCli, createServer as createServer };\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// Keep bootstrap-esm.js from redefining 'fs'.\ndelete process.env['ELECTRON_RUN_AS_NODE'];\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// Keep bootstrap-esm.js from redefining 'fs'.\ndelete process.env['ELECTRON_RUN_AS_NODE'];\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport './bootstrap-server.js'; // this MUST come before other imports as it changes global state\nimport * as path from 'path';\nimport * as http from 'http';\nimport { AddressInfo } from 'net';\nimport * as os from 'os';\nimport * as readline from 'readline';\nimport { performance } from 'perf_hooks';\nimport { fileURLToPath } from 'url';\nimport minimist from 'minimist';\nimport { devInjectNodeModuleLookupPath, removeGlobalNodeJsModuleLookupPaths } from './bootstrap-node.js';\nimport { bootstrapESM } from './bootstrap-esm.js';\nimport { resolveNLSConfiguration } from './vs/base/node/nls.js';\nimport { product } from './bootstrap-meta.js';\nimport * as perf from './vs/base/common/performance.js';\nimport { INLSConfiguration } from './vs/nls.js';\nimport { IServerAPI } from './vs/server/node/remoteExtensionHostAgentServer.js';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nperf.mark('code/server/start');\n(globalThis as any).vscodeServerStartTime = performance.now();\n\n// This is not indented to make the diff less noisy.  We need to move this out\n// of the top-level so it will not run immediately and we can control the start.\nasync function start() {\n// Do a quick parse to determine if a server or the cli needs to be started\nconst parsedArgs = minimist(process.argv.slice(2), {\n\tboolean: ['start-server', 'list-extensions', 'print-ip-address', 'help', 'version', 'accept-server-license-terms', 'update-extensions'],\n\tstring: ['install-extension', 'install-builtin-extension', 'uninstall-extension', 'locate-extension', 'socket-path', 'host', 'port', 'compatibility'],\n\talias: { help: 'h', version: 'v' }\n});\n['host', 'port', 'accept-server-license-terms'].forEach(e => {\n\tif (!parsedArgs[e]) {\n\t\tconst envValue = process.env[`VSCODE_SERVER_${e.toUpperCase().replace('-', '_')}`];\n\t\tif (envValue) {\n\t\t\tparsedArgs[e] = envValue;\n\t\t}\n\t}\n});\n\nconst extensionLookupArgs = ['list-extensions', 'locate-extension'];\nconst extensionInstallArgs = ['install-extension', 'install-builtin-extension', 'uninstall-extension', 'update-extensions'];\n\nconst shouldSpawnCli = parsedArgs.help || parsedArgs.version || extensionLookupArgs.some(a => !!parsedArgs[a]) || (extensionInstallArgs.some(a => !!parsedArgs[a]) && !parsedArgs['start-server']);\n\nconst nlsConfiguration = await resolveNLSConfiguration({ userLocale: 'en', osLocale: 'en', commit: product.commit, userDataPath: '', nlsMetadataPath: __dirname });\n\nif (shouldSpawnCli) {\n\tloadCode(nlsConfiguration).then((mod) => {\n\t\tmod.spawnCli();\n\t});\n} else {\n\tlet _remoteExtensionHostAgentServer: IServerAPI | null = null;\n\tlet _remoteExtensionHostAgentServerPromise: Promise<IServerAPI> | null = null;\n\tconst getRemoteExtensionHostAgentServer = () => {\n\t\tif (!_remoteExtensionHostAgentServerPromise) {\n\t\t\t_remoteExtensionHostAgentServerPromise = loadCode(nlsConfiguration).then(async (mod) => {\n\t\t\t\tconst server = await mod.createServer(address);\n\t\t\t\t_remoteExtensionHostAgentServer = server;\n\t\t\t\treturn server;\n\t\t\t});\n\t\t}\n\t\treturn _remoteExtensionHostAgentServerPromise;\n\t};\n\n\tif (Array.isArray(product.serverLicense) && product.serverLicense.length) {\n\t\tconsole.log(product.serverLicense.join('\\n'));\n\t\tif (product.serverLicensePrompt && parsedArgs['accept-server-license-terms'] !== true) {\n\t\t\tif (hasStdinWithoutTty()) {\n\t\t\t\tconsole.log('To accept the license terms, start the server with --accept-server-license-terms');\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst accept = await prompt(product.serverLicensePrompt);\n\t\t\t\tif (!accept) {\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log(e);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\t}\n\n\tlet firstRequest = true;\n\tlet firstWebSocket = true;\n\n\tlet address: string | AddressInfo | null = null;\n\tconst server = http.createServer(async (req, res) => {\n\t\tif (firstRequest) {\n\t\t\tfirstRequest = false;\n\t\t\tperf.mark('code/server/firstRequest');\n\t\t}\n\t\tconst remoteExtensionHostAgentServer = await getRemoteExtensionHostAgentServer();\n\t\treturn remoteExtensionHostAgentServer.handleRequest(req, res);\n\t});\n\tserver.on('upgrade', async (req, socket) => {\n\t\tif (firstWebSocket) {\n\t\t\tfirstWebSocket = false;\n\t\t\tperf.mark('code/server/firstWebSocket');\n\t\t}\n\t\tconst remoteExtensionHostAgentServer = await getRemoteExtensionHostAgentServer();\n\t\t// @ts-ignore\n\t\treturn remoteExtensionHostAgentServer.handleUpgrade(req, socket);\n\t});\n\tserver.on('error', async (err) => {\n\t\tconst remoteExtensionHostAgentServer = await getRemoteExtensionHostAgentServer();\n\t\treturn remoteExtensionHostAgentServer.handleServerError(err);\n\t});\n\n\tconst host = sanitizeStringArg(parsedArgs['host']) || (parsedArgs['compatibility'] !== '1.63' ? 'localhost' : undefined);\n\tconst nodeListenOptions = (\n\t\tparsedArgs['socket-path']\n\t\t\t? { path: sanitizeStringArg(parsedArgs['socket-path']) }\n\t\t\t: { host, port: await parsePort(host, sanitizeStringArg(parsedArgs['port'])) }\n\t);\n\tserver.listen(nodeListenOptions, async () => {\n\t\tlet output = Array.isArray(product.serverGreeting) && product.serverGreeting.length ? `\\n\\n${product.serverGreeting.join('\\n')}\\n\\n` : ``;\n\n\t\tif (typeof nodeListenOptions.port === 'number' && parsedArgs['print-ip-address']) {\n\t\t\tconst ifaces = os.networkInterfaces();\n\t\t\tObject.keys(ifaces).forEach(function (ifname) {\n\t\t\t\tifaces[ifname]?.forEach(function (iface) {\n\t\t\t\t\tif (!iface.internal && iface.family === 'IPv4') {\n\t\t\t\t\t\toutput += `IP Address: ${iface.address}\\n`;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\taddress = server.address();\n\t\tif (address === null) {\n\t\t\tthrow new Error('Unexpected server address');\n\t\t}\n\n\t\toutput += `Server bound to ${typeof address === 'string' ? address : `${address.address}:${address.port} (${address.family})`}\\n`;\n\t\t// Do not change this line. VS Code looks for this in the output.\n\t\toutput += `Extension host agent listening on ${typeof address === 'string' ? address : address.port}\\n`;\n\t\tconsole.log(output);\n\n\t\tperf.mark('code/server/started');\n\t\t(globalThis as any).vscodeServerListenTime = performance.now();\n\n\t\tawait getRemoteExtensionHostAgentServer();\n\t});\n\n\tprocess.on('exit', () => {\n\t\tserver.close();\n\t\tif (_remoteExtensionHostAgentServer) {\n\t\t\t_remoteExtensionHostAgentServer.dispose();\n\t\t}\n\t});\n}\n}\n\nfunction sanitizeStringArg(val: any): string | undefined {\n\tif (Array.isArray(val)) { // if an argument is passed multiple times, minimist creates an array\n\t\tval = val.pop(); // take the last item\n\t}\n\treturn typeof val === 'string' ? val : undefined;\n}\n\n/**\n * If `--port` is specified and describes a single port, connect to that port.\n *\n * If `--port`describes a port range\n * then find a free port in that range. Throw error if no\n * free port available in range.\n *\n * In absence of specified ports, connect to port 8000.\n */\nasync function parsePort(host: string | undefined, strPort: string | undefined): Promise<number> {\n\tif (strPort) {\n\t\tlet range: { start: number; end: number } | undefined;\n\t\tif (strPort.match(/^\\d+$/)) {\n\t\t\treturn parseInt(strPort, 10);\n\t\t} else if (range = parseRange(strPort)) {\n\t\t\tconst port = await findFreePort(host, range.start, range.end);\n\t\t\tif (port !== undefined) {\n\t\t\t\treturn port;\n\t\t\t}\n\t\t\t// Remote-SSH extension relies on this exact port error message, treat as an API\n\t\t\tconsole.warn(`--port: Could not find free port in range: ${range.start} - ${range.end} (inclusive).`);\n\t\t\tprocess.exit(1);\n\n\t\t} else {\n\t\t\tconsole.warn(`--port \"${strPort}\" is not a valid number or range. Ranges must be in the form 'from-to' with 'from' an integer larger than 0 and not larger than 'end'.`);\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\treturn 8000;\n}\n\nfunction parseRange(strRange: string): { start: number; end: number } | undefined {\n\tconst match = strRange.match(/^(\\d+)-(\\d+)$/);\n\tif (match) {\n\t\tconst start = parseInt(match[1], 10), end = parseInt(match[2], 10);\n\t\tif (start > 0 && start <= end && end <= 65535) {\n\t\t\treturn { start, end };\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Starting at the `start` port, look for a free port incrementing\n * by 1 until `end` inclusive. If no free port is found, undefined is returned.\n */\nasync function findFreePort(host: string | undefined, start: number, end: number): Promise<number | undefined> {\n\tconst testPort = (port: number) => {\n\t\treturn new Promise((resolve) => {\n\t\t\tconst server = http.createServer();\n\t\t\tserver.listen(port, host, () => {\n\t\t\t\tserver.close();\n\t\t\t\tresolve(true);\n\t\t\t}).on('error', () => {\n\t\t\t\tresolve(false);\n\t\t\t});\n\t\t});\n\t};\n\tfor (let port = start; port <= end; port++) {\n\t\tif (await testPort(port)) {\n\t\t\treturn port;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nasync function loadCode(nlsConfiguration: INLSConfiguration) {\n\n\t// required for `bootstrap-esm` to pick up NLS messages\n\tprocess.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration);\n\n\t// See https://github.com/microsoft/vscode-remote-release/issues/6543\n\t// We would normally install a SIGPIPE listener in bootstrap-node.js\n\t// But in certain situations, the console itself can be in a broken pipe state\n\t// so logging SIGPIPE to the console will cause an infinite async loop\n\tprocess.env['VSCODE_HANDLES_SIGPIPE'] = 'true';\n\n\tif (process.env['VSCODE_DEV']) {\n\t\t// When running out of sources, we need to load node modules from remote/node_modules,\n\t\t// which are compiled against nodejs, not electron\n\t\tprocess.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] = process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] || path.join(__dirname, '..', 'remote', 'node_modules');\n\t\tdevInjectNodeModuleLookupPath(process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH']);\n\t} else {\n\t\tdelete process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'];\n\t}\n\n\t// Remove global paths from the node module lookup (node.js only)\n\tremoveGlobalNodeJsModuleLookupPaths();\n\n\t// Bootstrap ESM\n\tawait bootstrapESM();\n\n\t// Load Server\n\treturn import('./vs/server/node/server.main.js');\n}\n\nfunction hasStdinWithoutTty(): boolean {\n\ttry {\n\t\treturn !process.stdin.isTTY; // Via https://twitter.com/MylesBorins/status/782009479382626304\n\t} catch (error) {\n\t\t// Windows workaround for https://github.com/nodejs/node/issues/11656\n\t}\n\treturn false;\n}\n\nfunction prompt(question: string): Promise<boolean> {\n\tconst rl = readline.createInterface({\n\t\tinput: process.stdin,\n\t\toutput: process.stdout\n\t});\n\treturn new Promise((resolve, reject) => {\n\t\trl.question(question + ' ', async function (data) {\n\t\t\trl.close();\n\t\t\tconst str = data.toString().trim().toLowerCase();\n\t\t\tif (str === '' || str === 'y' || str === 'yes') {\n\t\t\t\tresolve(true);\n\t\t\t} else if (str === 'n' || str === 'no') {\n\t\t\t\tresolve(false);\n\t\t\t} else {\n\t\t\t\tprocess.stdout.write('\\nInvalid Response. Answer either yes (y, yes) or no (n, no)\\n');\n\t\t\t\tresolve(await prompt(question));\n\t\t\t}\n\t\t});\n\t});\n}\n\nasync function loadCodeWithNls() {\n\tconst nlsConfiguration = await resolveNLSConfiguration({\n\t\tuserLocale: 'en',\n\t\tosLocale: 'en',\n\t\tcommit: product.commit,\n\t\tuserDataPath: '',\n\t\tnlsMetadataPath: __dirname,\n\t});\n\treturn loadCode(nlsConfiguration);\n}\n\n// This alias prevents the name getting mangled during minification which would\n// make it difficult to import.\nexport { loadCodeWithNls as loadCodeWithNls };\n\nif (!process.env.CODE_SERVER_PARENT_PID) {\n\tstart();\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { fileURLToPath } from 'url';\nimport { createRequire } from 'node:module';\nimport type { IProductConfiguration } from './vs/base/common/product.js';\n\nconst require = createRequire(import.meta.url);\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst isWindows = process.platform === 'win32';\n\n// increase number of stack frames(from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)\nError.stackTraceLimit = 100;\n\nif (!process.env['VSCODE_HANDLES_SIGPIPE']) {\n\t// Workaround for Electron not installing a handler to ignore SIGPIPE\n\t// (https://github.com/electron/electron/issues/13254)\n\tlet didLogAboutSIGPIPE = false;\n\tprocess.on('SIGPIPE', () => {\n\t\t// See https://github.com/microsoft/vscode-remote-release/issues/6543\n\t\t// In certain situations, the console itself can be in a broken pipe state\n\t\t// so logging SIGPIPE to the console will cause an infinite async loop\n\t\tif (!didLogAboutSIGPIPE) {\n\t\t\tdidLogAboutSIGPIPE = true;\n\t\t\tconsole.error(new Error(`Unexpected SIGPIPE`));\n\t\t}\n\t});\n}\n\n// Setup current working directory in all our node & electron processes\n// - Windows: call `process.chdir()` to always set application folder as cwd\n// -  all OS: store the `process.cwd()` inside `VSCODE_CWD` for consistent lookups\nfunction setupCurrentWorkingDirectory(): void {\n\ttry {\n\n\t\t// Store the `process.cwd()` inside `VSCODE_CWD`\n\t\t// for consistent lookups, but make sure to only\n\t\t// do this once unless defined already from e.g.\n\t\t// a parent process.\n\t\tif (typeof process.env['VSCODE_CWD'] !== 'string') {\n\t\t\tprocess.env['VSCODE_CWD'] = process.cwd();\n\t\t}\n\n\t\t// Windows: always set application folder as current working dir\n\t\tif (process.platform === 'win32') {\n\t\t\tprocess.chdir(path.dirname(process.execPath));\n\t\t}\n\t} catch (err) {\n\t\tconsole.error(err);\n\t}\n}\n\nsetupCurrentWorkingDirectory();\n\n/**\n * Add support for redirecting the loading of node modules\n *\n * Note: only applies when running out of sources.\n */\nexport function devInjectNodeModuleLookupPath(injectPath: string): void {\n\tif (!process.env['VSCODE_DEV']) {\n\t\treturn; // only applies running out of sources\n\t}\n\n\tif (!injectPath) {\n\t\tthrow new Error('Missing injectPath');\n\t}\n\n\t// register a loader hook\n\tconst Module = require('node:module');\n\tModule.register('./bootstrap-import.js', { parentURL: import.meta.url, data: injectPath });\n}\n\nexport function removeGlobalNodeJsModuleLookupPaths(): void {\n\tif (typeof process?.versions?.electron === 'string') {\n\t\treturn; // Electron disables global search paths in https://github.com/electron/electron/blob/3186c2f0efa92d275dc3d57b5a14a60ed3846b0e/shell/common/node_bindings.cc#L653\n\t}\n\n\tconst Module = require('module');\n\tconst globalPaths = Module.globalPaths;\n\n\tconst originalResolveLookupPaths = Module._resolveLookupPaths;\n\n\tModule._resolveLookupPaths = function (moduleName: string, parent: any): string[] {\n\t\tconst paths = originalResolveLookupPaths(moduleName, parent);\n\t\tif (Array.isArray(paths)) {\n\t\t\tlet commonSuffixLength = 0;\n\t\t\twhile (commonSuffixLength < paths.length && paths[paths.length - 1 - commonSuffixLength] === globalPaths[globalPaths.length - 1 - commonSuffixLength]) {\n\t\t\t\tcommonSuffixLength++;\n\t\t\t}\n\n\t\t\treturn paths.slice(0, paths.length - commonSuffixLength);\n\t\t}\n\n\t\treturn paths;\n\t};\n\n\tconst originalNodeModulePaths = Module._nodeModulePaths;\n\tModule._nodeModulePaths = function (from: string): string[] {\n\t\tlet paths: string[] = originalNodeModulePaths(from);\n\t\tif (!isWindows) {\n\t\t\treturn paths;\n\t\t}\n\n\t\t// On Windows, remove drive(s) and users' home directory from search paths,\n\t\t// UNLESS 'from' is explicitly set to one of those.\n\t\tconst isDrive = (p: string) => p.length >= 3 && p.endsWith(':\\\\');\n\n\t\tif (!isDrive(from)) {\n\t\t\tpaths = paths.filter(p => !isDrive(path.dirname(p)));\n\t\t}\n\n\t\tif (process.env.HOMEDRIVE && process.env.HOMEPATH) {\n\t\t\tconst userDir = path.dirname(path.join(process.env.HOMEDRIVE, process.env.HOMEPATH));\n\n\t\t\tconst isUsersDir = (p: string) => path.relative(p, userDir).length === 0;\n\n\t\t\t// Check if 'from' is the same as 'userDir'\n\t\t\tif (!isUsersDir(from)) {\n\t\t\t\tpaths = paths.filter(p => !isUsersDir(path.dirname(p)));\n\t\t\t}\n\t\t}\n\n\t\treturn paths;\n\t};\n}\n\n/**\n * Helper to enable portable mode.\n */\nexport function configurePortable(product: Partial<IProductConfiguration>): { portableDataPath: string; isPortable: boolean } {\n\tconst appRoot = path.dirname(__dirname);\n\n\tfunction getApplicationPath(): string {\n\t\tif (process.env['VSCODE_DEV']) {\n\t\t\treturn appRoot;\n\t\t}\n\n\t\tif (process.platform === 'darwin') {\n\t\t\treturn path.dirname(path.dirname(path.dirname(appRoot)));\n\t\t}\n\n\t\treturn path.dirname(path.dirname(appRoot));\n\t}\n\n\tfunction getPortableDataPath(): string {\n\t\tif (process.env['VSCODE_PORTABLE']) {\n\t\t\treturn process.env['VSCODE_PORTABLE'];\n\t\t}\n\n\t\tif (process.platform === 'win32' || process.platform === 'linux') {\n\t\t\treturn path.join(getApplicationPath(), 'data');\n\t\t}\n\n\t\tconst portableDataName = product.portable || `${product.applicationName}-portable-data`;\n\t\treturn path.join(path.dirname(getApplicationPath()), portableDataName);\n\t}\n\n\tconst portableDataPath = getPortableDataPath();\n\tconst isPortable = !('target' in product) && fs.existsSync(portableDataPath);\n\tconst portableTempPath = path.join(portableDataPath, 'tmp');\n\tconst isTempPortable = isPortable && fs.existsSync(portableTempPath);\n\n\tif (isPortable) {\n\t\tprocess.env['VSCODE_PORTABLE'] = portableDataPath;\n\t} else {\n\t\tdelete process.env['VSCODE_PORTABLE'];\n\t}\n\n\tif (isTempPortable) {\n\t\tif (process.platform === 'win32') {\n\t\t\tprocess.env['TMP'] = portableTempPath;\n\t\t\tprocess.env['TEMP'] = portableTempPath;\n\t\t} else {\n\t\t\tprocess.env['TMPDIR'] = portableTempPath;\n\t\t}\n\t}\n\n\treturn {\n\t\tportableDataPath,\n\t\tisPortable\n\t};\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { fileURLToPath } from 'url';\nimport { createRequire, register } from 'node:module';\nimport { product, pkg } from './bootstrap-meta.js';\nimport './bootstrap-node.js';\nimport * as performance from './vs/base/common/performance.js';\nimport { INLSConfiguration } from './vs/nls.js';\n\nconst require = createRequire(import.meta.url);\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n// Install a hook to module resolution to map 'fs' to 'original-fs'\nif (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {\n\tconst jsCode = `\n\texport async function resolve(specifier, context, nextResolve) {\n\t\tif (specifier === 'fs') {\n\t\t\treturn {\n\t\t\t\tformat: 'builtin',\n\t\t\t\tshortCircuit: true,\n\t\t\t\turl: 'node:original-fs'\n\t\t\t};\n\t\t}\n\n\t\t// Defer to the next hook in the chain, which would be the\n\t\t// Node.js default resolve if this is the last user-specified loader.\n\t\treturn nextResolve(specifier, context);\n\t}`;\n\tregister(`data:text/javascript;base64,${Buffer.from(jsCode).toString('base64')}`, import.meta.url);\n}\n\n// Prepare globals that are needed for running\nglobalThis._VSCODE_PRODUCT_JSON = { ...product };\nif (process.env['VSCODE_DEV']) {\n\ttry {\n\t\tconst overrides: unknown = require('../product.overrides.json');\n\t\tglobalThis._VSCODE_PRODUCT_JSON = Object.assign(globalThis._VSCODE_PRODUCT_JSON, overrides);\n\t} catch (error) { /* ignore */ }\n}\nglobalThis._VSCODE_PACKAGE_JSON = { ...pkg };\nglobalThis._VSCODE_FILE_ROOT = __dirname;\n\n//#region NLS helpers\n\nlet setupNLSResult: Promise<INLSConfiguration | undefined> | undefined = undefined;\n\nfunction setupNLS(): Promise<INLSConfiguration | undefined> {\n\tif (!setupNLSResult) {\n\t\tsetupNLSResult = doSetupNLS();\n\t}\n\n\treturn setupNLSResult;\n}\n\nasync function doSetupNLS(): Promise<INLSConfiguration | undefined> {\n\tperformance.mark('code/willLoadNls');\n\n\tlet nlsConfig: INLSConfiguration | undefined = undefined;\n\n\tlet messagesFile: string | undefined;\n\tif (process.env['VSCODE_NLS_CONFIG']) {\n\t\ttry {\n\t\t\tnlsConfig = JSON.parse(process.env['VSCODE_NLS_CONFIG']);\n\t\t\tif (nlsConfig?.languagePack?.messagesFile) {\n\t\t\t\tmessagesFile = nlsConfig.languagePack.messagesFile;\n\t\t\t} else if (nlsConfig?.defaultMessagesFile) {\n\t\t\t\tmessagesFile = nlsConfig.defaultMessagesFile;\n\t\t\t}\n\n\t\t\tglobalThis._VSCODE_NLS_LANGUAGE = nlsConfig?.resolvedLanguage;\n\t\t} catch (e) {\n\t\t\tconsole.error(`Error reading VSCODE_NLS_CONFIG from environment: ${e}`);\n\t\t}\n\t}\n\n\tif (\n\t\tprocess.env['VSCODE_DEV'] ||\t// no NLS support in dev mode\n\t\t!messagesFile\t\t\t\t\t// no NLS messages file\n\t) {\n\t\treturn undefined;\n\t}\n\n\ttry {\n\t\tglobalThis._VSCODE_NLS_MESSAGES = JSON.parse((await fs.promises.readFile(messagesFile)).toString());\n\t} catch (error) {\n\t\tconsole.error(`Error reading NLS messages file ${messagesFile}: ${error}`);\n\n\t\t// Mark as corrupt: this will re-create the language pack cache next startup\n\t\tif (nlsConfig?.languagePack?.corruptMarkerFile) {\n\t\t\ttry {\n\t\t\t\tawait fs.promises.writeFile(nlsConfig.languagePack.corruptMarkerFile, 'corrupted');\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`Error writing corrupted NLS marker file: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\t// Fallback to the default message file to ensure english translation at least\n\t\tif (nlsConfig?.defaultMessagesFile && nlsConfig.defaultMessagesFile !== messagesFile) {\n\t\t\ttry {\n\t\t\t\tglobalThis._VSCODE_NLS_MESSAGES = JSON.parse((await fs.promises.readFile(nlsConfig.defaultMessagesFile)).toString());\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`Error reading default NLS messages file ${nlsConfig.defaultMessagesFile}: ${error}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tperformance.mark('code/didLoadNls');\n\n\treturn nlsConfig;\n}\n\n//#endregion\n\nexport async function bootstrapESM(): Promise<void> {\n\n\t// NLS\n\tawait setupNLS();\n}\n","/*---------------------------------------------------------------------------------------------\n *  Copyright (c) Microsoft Corporation. All rights reserved.\n *  Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createRequire } from 'node:module';\nimport type { IProductConfiguration } from './vs/base/common/product.js';\n\nconst require = createRequire(import.meta.url);\n\nlet productObj: Partial<IProductConfiguration> & { BUILD_INSERT_PRODUCT_CONFIGURATION?: string } = { BUILD_INSERT_PRODUCT_CONFIGURATION: 'BUILD_INSERT_PRODUCT_CONFIGURATION' }; // DO NOT MODIFY, PATCHED DURING BUILD\nif (productObj['BUILD_INSERT_PRODUCT_CONFIGURATION']) {\n\tproductObj = require('../product.json'); // Running out of sources\n}\n\nlet pkgObj = { BUILD_INSERT_PACKAGE_CONFIGURATION: 'BUILD_INSERT_PACKAGE_CONFIGURATION' }; // DO NOT MODIFY, PATCHED DURING BUILD\nif (pkgObj['BUILD_INSERT_PACKAGE_CONFIGURATION']) {\n\tpkgObj = require('../package.json'); // Running out of sources\n}\n\nexport const product = productObj;\nexport const pkg = pkgObj;\n"],"mappings":";;41VAAAA,GAAAC,GAAA,CAAA,iCAAAC,EAAAC,EAAA,CAAA,aAEA,SAASC,EAAOC,EAAKC,EAAM,CAC1B,IAAIC,EAAIF,EACRC,EAAK,MAAM,EAAG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J,GAAQ,OAChB,aAAc,GACd,gBAAiBhB,GACjB,EACD,OAAO8B,GAAS76F,CAAgB,CACjC,CAMK,QAAQ,IAAI,wBAChBhlF,GAAK","names":["require_minimist","__commonJS","exports","module","hasKey","obj","keys","o","key","isNumber","x","isConstructorOrProto","args","opts","flags","aliases","aliasIsBoolean","y","k","defaults","argv","argDefined","arg","setKey","value","i","lastKey","setArg","val","notFlags","next","m","letters","broken","j","_definePolyfillMarks","timeOrigin","_data","mark","name","markOptions","getMarks","result","_define","entry","_factory","sharedObj","perf","$T","$U","init_performance","__esm","$g","$h","init_nls_messages","_format","message","match","rest","index","isPseudo","localize","data","lookupMessage","fallback","localize2","originalMessage","init_nls","$l","platform","$k","_isWindows","_isMacintosh","_isLinux","_isLinuxSnap","_isNative","_isWeb","_isElectron","_isIOS","_isCI","_isMobile","_locale","_language","_platformLocale","_translationsConfigFile","_userAgent","$globalThis","nodeProcess","isElectronProcess","isElectronRenderer","Platform","_platform","$m","$n","$o","$p","$q","$s","$t","$u","$y","$z","$A","Language","$E","$F","OperatingSystem","OS","$I","$J","$K","$L","$M","init_platform","rawNlsConfig","nlsConfig","isDefaultVariant","isDefault","pending","e","len","candidate","lastId","callback","myId","safeProcess","vscodeGlobal","$Y","$Z","$1","$2","init_process","sandboxProcess","validateObject","pathObject","ErrorInvalidArgType","validateString","isPathSeparator","code","CHAR_FORWARD_SLASH","CHAR_BACKWARD_SLASH","isPosixPathSeparator","isWindowsDeviceRoot","CHAR_UPPERCASE_A","CHAR_UPPERCASE_Z","CHAR_LOWERCASE_A","CHAR_LOWERCASE_Z","normalizeString","path","allowAboveRoot","separator","res","lastSegmentLength","lastSlash","dots","CHAR_DOT","lastSlashIndex","formatExt","ext","sep","dir","base","CHAR_COLON","CHAR_QUESTION_MARK","platformIsWin32","$3","posixCwd","$4","$5","$6","$7","$8","$9","$0","$$","$_","$ab","$bb","$cb","$eb","init_path","expected","actual","determiner","type","msg","pathSegments","resolvedDevice","resolvedTail","resolvedAbsolute","rootEnd","device","isAbsolute","last","firstPart","tail","paths","joined","needsReplace","slashCount","firstLen","from","to","fromOrig","toOrig","fromSplit","toSplit","fromLen","toLen","length","fromStart","fromEnd","toStart","toEnd","lastCommonSep","fromCode","out","resolvedPath","offset","end","matchedSlash","suffix","start","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","ret","regexp","cwd","trailingSeparator","hasRoot","char","$a","groupFn","element","target","_a","$f","init_collections","values","b","callbackfn","thisArg","setUnexpectedErrorHandler","newUnexpectedErrorHandler","$gb","$ib","cast","$kb","$pb","error","$qb","$ob","$sb","$tb","$ub","$wb","err","$fb","$rb","$Ab","$Bb","init_errors","listener","_$rb","_$Ab","_$Bb","$Cb","fn","fnDidRunCallback","_this","didCall","init_functional","$Gb","array","predicate","startIdx","endIdxEx","$Kb","init_arraysFind","_$Kb","item","idx","$Sb","one","other","itemEquals","a","$Ub","comparator","$Vb","compareToKey","low","high","mid","comp","$7b","$8b","$$b","$_b","keyFn","seen","$ec","$fc","$hc","_seed","rand","seed","temp","$mc","$nc","arr","$qc","selector","CompareResult","$sc","$xc","init_arrays","isLessThan","isLessThanOrEqual","isGreaterThan","isNeitherLessOrGreaterThan","_$xc","_callback","iterate","handler","cb","mapFn","first","isEntries","_a2","_b","_c","ResourceMapEntry","$Ic","$Jc","Touch","$Kc","Cache","$Lc","$Pc","init_map","uri","_$Ic","resource","toKey","clb","_","entriesOrKey","_value","touch","state","current","map","iterator","newSize","currentSize","previous","limit","ratio","ok","$Tc","$Uc","condition","messageOrError","init_assert","$Yc","str","$1c","$2c","TypedArray","$3c","$4c","$6c","$7c","$8c","$9c","$$c","$dd","hasOwnProperty","$ed","$hd","constraint","init_types","Iterable","init_iterator","is","thing","_empty","empty","single","wrap","iterableOrElement","iterable","reverse","isEmpty","some","every","find","filter","flatMap","concat","iterables","reduce","reducer","initialValue","count","slice","consume","atMost","consumed","asyncToArray","asyncToArrayFlat","$ld","tracker","disposableTracker","$md","$nd","disposable","setParentOfDisposable","child","parent","setParentOfDisposables","children","$pd","$qd","errors","d","$sd","disposables","$td","self","TRACK_DISPOSABLES","$kd","$ud","$vd","$wd","$Ed","init_lifecycle","_$kd","cache","cacheValue","rootParentCache","v","maxReported","preComputedLeaks","uncoveredLeakingObjs","leakingObjects","info","leakingObjsSet","l","getStackTracePath","leaking","removePrefix","linesToRemove","lines","p","stackTraceStarts","stackTracePath","stackTraceFormattedLines","line","prevStarts","continuations","cont","set","__is_disposable_tracked__","stack","_$ud","oldValue","skipDisposeOnOverwrite","Node","$Gd","init_linkedList","_Node","node","atTheEnd","newNode","oldLast","oldFirst","didRemove","anchor","performanceNow","$0e","init_stopwatch","_$0e","highResolution","_enableDisposeWithListenerWarning","_enableSnapshotPotentialLeakWarning","Event","$_e","_globalLeakWarningThreshold","LeakageMonitor","Stacktrace","$bf","$cf","id","UniqueContainer","compactionThreshold","forEachListener","$df","EventDeliveryQueuePrivate","$gf","$jf","$mf","init_event","_addLeakageTraceLogic","options","origListenerDidAdd","defer","event","debounce","once","thisArgs","didFire","onceIf","snapshot","forEach","each","signal","any","events","addAndReturnDisposable","merge","initial","output","emitter","store","delay","leading","flushOnListenerRemove","leakWarningThreshold","subscription","handle","numDebouncedCalls","doFire","cur","_output","accumulate","latch","equals","firstCall","shouldEmit","split","isT","buffer","flushAfterTimeout","_buffer","flush","chain","sythensize","cs","ChainableSynthesis","HaltChainable","step","fromNodeEventEmitter","eventName","onFirstListenerAdd","onLastListenerRemove","fromDOMEventEmitter","toPromise","cancelRef","promise","resolve","reject","fromPromise","forward","runAndSubscribe","EmitterObserver","_observable","_change","fromObservable","obs","fromObservableLight","observable","didChange","observer","_$_e","listenerCount","elapsed","_LeakageMonitor","threshold","topStack","topCount","_Stacktrace","listeners","tuple","contained","removeMonitor","adjustDeliveryQueue","errorHandler","dq","r","shortcutEvent","CancellationToken","MutableToken","$pf","init_cancellation","context","isCancellationToken","cancel","$sf","t","$tf","init_cache","arg1","arg2","$vf","init_lazy","$yf","$Af","template","_format2Regexp","group","$Df","$If","haystack","needle","needleLen","$Jf","haystackLen","$Mf","searchString","isRegex","modifiers","$Xf","$Yf","aStart","aEnd","bStart","bEnd","codeA","codeB","aLen","bLen","$Zf","$1f","$3f","diff","$4f","$5f","$6f","candidateLength","$9f","charCode","$0f","$$f","highSurrogate","lowSurrogate","$wg","getGraphemeBreakRawData","CSI_SEQUENCE","OSC_SEQUENCE","ESC_SEQUENCE","CONTROL_SEQUENCES","$rg","GraphemeBreakType","GraphemeBreakTree","CodePoint","$Cg","$Dg","init_strings","_GraphemeBreakTree","codePoint","nodeCount","nodeIndex","_$Cg","locales","arrayToMap","mergeMaps","map1","map2","intersectMaps","filteredLocales","languageSpecificMap","locale","commonMap","f","_$Dg","$Fg","$Gg","osPath","$Hg","$Ig","firstLetter","pos","$Ng","$Lg","pathA","pathB","ignoreCase","identityEquals","$Mg","parentCandidate","sepOffset","char0","$Pg","$Qg","pathNormalized","$Rg","isWindowsOS","$Vg","prefix","randomLength","pathCharsTouse","windowsSafePathFirstChars","pathChars","randomFileName","init_extpath","_validateUri","_strict","_schemePattern","_singleSlashStart","_doubleSlashStart","_schemeFix","scheme","_referenceResolution","_slash","$Dc","encodeURIComponentFast","uriComponent","isPath","isAuthority","nativeEncodePos","escaped","encodeTable","encodeURIComponentMinimal","$Ec","keepDriveLetterCasing","_asFormatted","skipEncoding","encoder","authority","query","fragment","userinfo","decodeURIComponentGraceful","percentDecode","_rEncodedAsHex","_regexp","URI","_pathSepMarker","Uri","init_uri","_URI","schemeOrData","change","components","strict","pathFragment","newPath","$2g","product","Schemas","$Yg","$Zg","RemoteAuthoritiesImpl","$1g","$3g","$4g","$5g","$7g","FileAccessImpl","$8g","$9g","$0g","COI","init_network","schema","delegate","serverBasePath","host","port","connectionToken","_FileAccessImpl","resourcePath","uriOrModule","rootUriOrPath","modulePath","coiHeaders","coiSearchParamName","getHeadersFromQuery","url","params","addSearchParam","urlOrSearch","coop","coep","$$g","$_g","$ah","$bh","$ch","$dh","$eh","$fh","$gh","$hh","$ih","$jh","$kh","$lh","$mh","$nh","$oh","$ph","$qh","$rh","$sh","DataUri","init_resources","uri1","uri2","ignoreFragment","dirname","normalizedPath","relativePath","fromPath","toPath","newURI","a1","a2","fsp","isRootSep","parseMetaData","dataUri","metadata","property","mime","$$e","init_symbols","$vh","$wh","source","thenable","isCancelled","onfinally","$Eh","rej","$Mh","millis","token","$7h","task","retries","lastError","$Fh","$Gh","timeoutDeferred","microtaskDeferred","$Ih","$Jh","$Kh","$Rh","$Sh","$Uh","$Yh","$Zh","$1h","$2h","$3h","$4h","$5h","$6h","DeferredOutcome","$0h","Promises","AsyncIterableSourceState","$ai","init_async","promiseFactory","onComplete","promiseTask","timeout","scheduled","defaultDelay","c","maxDegreeOfParalellism","factory","iLimitedTask","queue","extUri","drainListenerId","drainListener","drainer","runner","unit","units","h","timeSinceLastExecution","safeGlobal","_targetWindow","disposed","targetWindow","executor","settled","promises","firstError","withAsyncBody","bodyFn","_$ai","items","writer","onReturn","filterFn","$fi","normalize","nfcCache","form","normalizedCache","cached","nonAsciiCharactersPattern","nfdCache","init_normalization","fs","tmpdir","promisify","rimraf","mode","RimRafMode","moveToPath","rimrafUnlink","rimrafMove","fs3","readdir","handleDirectoryChildren","safeReaddirWithFileTypes","isFile","isDirectory","isSymbolicLink","lstat","readDirsInDir","dirPath","directories","SymlinkSupport","writeFile","writeQueues","ensuredOptions","ensureWriteOptions","doWriteFileAndFlush","configureFlushOnWrite","enabled","canFlush","openError","fd","writeError","syncError","closeError","rename","windowsRetryTimeout","renameWithRetry","copy","startTime","retryTimeout","attempt","abortRetry","stat","doCopy","payload","symbolicLink","doCopySymlink","doCopyDirectory","COPY_MODE_MASK","doCopyFile","files","file","linkTarget","realpath","normalizePath","init_pfs","lstats","existsFile","existsDirectory","position","bytesRead","bytesWritten","$oi","userLocale","osLocale","userDataPath","commit","nlsMetadataPath","defaultNLSConfiguration","languagePacks","getLanguagePackConfigurations","resolvedLanguage","resolveLanguagePackLanguage","languagePack","mainLanguagePackPath","languagePackId","globalLanguagePackCachePath","commitLanguagePackCachePath","languagePackMessagesFile","translationsConfigFile","languagePackCorruptMarkerFile","nlsDefaultKeys","nlsDefaultMessages","nlsPackdata","content","nlsResult","nlsIndex","moduleId","nlsKeys","moduleTranslations","nlsKey","configFile","date","$lj","init_serviceCollection","entries","service","instanceOrDescriptor","exceptionToErrorMessage","exception","verbose","detectSystemErrorMessage","stackToString","$gm","detail","init_errorMessage","$vi","$wi","$xi","WriteableStreamImpl","$yi","readable","chunks","chunk","$zi","maxChunks","lastReadChunk","$Ai","stream","$Bi","$Ci","streamListeners","dataListener","errorListener","endListener","$Fi","$Gi","transformer","init_stream","fullDataBuffer","pendingWritePromises","pendingWritePromise","$Ki","table","indexOfTable","$Ni","$Oi","destination","$Pi","$Qi","$Ri","$Si","$Ti","$Ji","$Ui","$Vi","$Wi","bufferedStream","$Yi","$Zi","$3i","encoded","building","remainder","bufi","append","unpadded","$4i","padded","urlSafe","dictionary","base64UrlSafeAlphabet","base64Alphabet","$5i","byte","hexChars","$6i","hex","decodeHexChar","hasBuffer","textEncoder","textDecoder","init_buffer","_$Ji","byteLength","buffers","totalLength","subarray","$_m","$an","hashVal","$bn","arrayHash","objectHash","$cn","booleanHash","initialHashVal","s","leftRotate","bits","totalBits","delta","mask","toHexString","bufferOrValue","bitsize","SHA1Constant","$en","init_hash","_$en","strLen","buff","buffLen","leftoverHighSurrogate","nextCharCode","ml","bigBlock32","hintDidYouMean","meant","TokenType","hintDidYouForgetToOpenOrCloseQuote","hintDidYouForgetToEscapeSlash","$zn","init_scanner","_$zn","ch","isTripleEq","additional","lexeme","errToken","keyword","inEscape","inCharacterClass","storeServiceDependency","_util","$nj","serviceId","$oj","serviceIdentifier","$mj","init_instantiation","getServiceDependencies","ctor","cmp","withFloatOrStr","n","$Fn","eliminateConstantsInArray","newArr","newExpr","cmp1","key1","key2","cmp2","value1","value2","getTerminals","CONSTANT_VALUES","ContextKeyExprType","defaultConfig","errorEmptyString","hintEmptyString","errorNoInAfterNot","errorClosingParenthesis","errorUnexpectedToken","hintUnexpectedToken","errorUnexpectedEOF","hintUnexpectedEOF","$Bn","$Cn","$Gn","$Hn","$In","$Jn","$Kn","$Ln","$Mn","$Nn","$On","$Pn","$Qn","$Rn","$Sn","$Tn","$Un","$Vn","$Wn","init_contextkey","_$Bn","input","expr","peek","additionalInfo","right","regexLexeme","closingSlashIndex","lexemeReconstruction","followingToken","parenBalance","serializedValue","regex","caseIgnoreFlag","got","serialized","_$Fn","mapFnc","_$Gn","_$Hn","negated","constantValue","_$In","trueValue","_$Jn","valueKey","_$Kn","_$Ln","falseValue","_$Mn","_$Nn","_$On","_$Pn","_$Qn","_$Rn","thisSource","otherSource","_$Sn","_$Tn","_expr","extraRedundantCheck","exprArr","hasTrue","lastElement","secondToLastElement","isFinished","resultElement","el","_$Un","hasFalse","LEFT","RIGHT","all","left","_$Vn","defaultValue","metaOrHide","$6n","$8n","loggerLevel","messageLevel","LogLevel","log","logger","level","format","$ho","environmentService","logLevel","$ko","$7n","$io","$4n","$5n","$0n","$$n","$ao","$co","$do","$eo","$fo","$lo","init_log","loggerResources","loggerResource","resourceOrId","idOrResource","loggerEntry","visibility","existing","$kj","init_descriptors","staticArguments","supportsDelayedInstantiation","$Wu","text","ignoreTrivia","tokenOffset","scanError","scanHexDigits","digits","hexValue","setPosition","newPosition","scanNumber","isDigit","scanString","ch3","isLineBreak","scanNext","isWhitespace","safeLength","commentClosed","isUnknownContentCharacter","scanNextNonTrivia","$Yu","ParseOptions","currentProperty","currentParent","previousParents","onValue","$6u","object","$Zu","ensurePropertyComplete","endOffset","valueNode","$7u","$1u","root","segment","found","propertyNode","visitor","_scanner","toNoArgVisit","visitFunction","toOneArgVisit","onObjectBegin","onObjectProperty","onObjectEnd","onArrayBegin","onArrayEnd","onLiteralValue","onSeparator","onComment","onError","disallowComments","allowTrailingComma","handleError","skipUntilAfter","skipUntil","parseString","isValue","parseLiteral","parseProperty","parseValue","parseObject","needsComma","parseArray","ScanError","SyntaxKind","ParseErrorCode","CharacterCodes","init_json","$gv","documentText","range","initialIndentLevel","formatText","formatTextStart","rangeStart","rangeEnd","$jv","computeIndentLevel","eol","$iv","lineBreak","indentLevel","indentValue","repeat","scanner","hasError","newLineAndIndent","editOperations","addEdit","startOffset","firstToken","firstTokenStart","initialIndent","firstTokenEnd","secondToken","replaceContent","commentTokenStart","secondTokenStart","nChars","tabSize","init_jsonFormatter","$lv","originalPath","formattingOptions","getInsertionIndex","lastSegment","propertyIndex","removeBegin","removeEnd","$mv","newProperty","edit","removalIndex","toRemove","parentEndOffset","newText","$nv","begin","edits","curr","editLength","$ov","sortedEdits","lastModifiedOffset","init_jsonEdit","$5o","$6o","_hasOwnProperty","prop","$7o","changer","_cloneAndChange","changed","r1","r2","i2","$8o","overwrite","$9o","oneKeys","otherKeys","$0o","$_o","lowercaseKey","equivalentKey","init_objects","$Gl","$Hl","$Il","configurationTarget","$Ll","properties","conflictReporter","$Ml","settingsTreeRoot","segments","$Nl","valueTree","doRemoveFromValueTree","$Ol","config","settingPath","accessSetting","component","$Ql","settingKey","$Fl","ConfigurationTarget","init_configuration","$fl","hasDups","equalsByString","nodeToEquals","traverseNodes","eq","newEq","defNodeName","definitions","stringify","_key","defStrings","isObject","visit","collectEntries","toWalk","collectMapEntries","maps","collectArrayEntries","arrays","collectEntryOrArrayEntries","init_jsonSchema","RegistryImpl","$Rl","normalizeId","$Sl","JSONContributionRegistry","jsonContributionRegistry","init_jsonContributionRegistry","unresolvedSchemaContent","normalizedUri","glob","associations","$6l","identifiers","$5l","matches","OVERRIDE_IDENTIFIER_REGEX","identifier","$7l","overrideIdentifiers","overrideIdentifier","$8l","$9l","configurationRegistry","EditPresentationTypes","$Tl","ConfigurationScope","$Ul","$Vl","$Wl","$Xl","$Yl","$Zl","$1l","$2l","contributionRegistry","ConfigurationRegistry","OVERRIDE_IDENTIFIER_PATTERN","$4l","init_configurationRegistry","configuration","validate","configurations","add","remove","configurationDefaults","bucket","overrides","configurationDefaultOverridesForKey","newDefaultOverride","defaultConfigurations","defaultConfiguration","configurationDefaultOverride","configurationDefaultOverrideValue","configurationValueObject","valueSource","existingDefaultOverride","propertyKey","propertyDefaultValue","objectKey","valuesSource","existingDefaultValue","defaultsOverrides","deregisterConfiguration","extensionInfo","restrictedProperties","scope","excluded","policyName","subNodes","configurationDefaultsOverrides","register","overrideIdentifierProperty","resourceLanguagePropertiesSchema","configurationdefaultOverride","defaultSource","freeze","compare","added","removed","updated","compareConfigurationContents","fromOverrideIdentifiers","toOverrideIdentifiers","addedOverrideIdentifiers","removedOverrideIdentifiers","$XA","$YA","$ZA","ConfigurationInspectValue","$1A","$3A","init_configurationModels","_$XA","logService","raw","rawConfigurationModels","parser","section","that","contents","overrideContents","override","overrideConfigurationModel","others","raws","otherOverride","contentsForKey","overrideContentsForKey","contentsForIdentifierOnly","mergeContents","contentsToMerge","g","restricted","hasExcludedProperties","parseErrors","configurationProperties","filtered","filterOverriddenProperties","propertySchema","overrideRaw","keyInOverrideRaw","parseOptions","inspectValue","_$1A","q","workspace","memoryConfiguration","consolidateConfigurationModel","folderConfigurationModel","memoryConfigurationModel","policyConfiguration","applicationConfiguration","localUserConfiguration","remoteUserConfiguration","workspaceConfiguration","fromKeys","toKeys","application","user","folderConfiguration","currentFolderConfiguration","folder","folderConfig","merged","configurationModel","consolidateConfiguration","memoryConfigurationForResource","folderConsolidatedConfiguration","workspaceConsolidateConfiguration","userLocalConfiguration","userRemoteConfiguration","folders","model","$Zt","$2t","init_policy","$4A","$5A","$6A","init_configurations","defaultOverrideValue","policyNames","policyDefinitions","excludedConfigurationProperties","previewFeature","policyConfigurations","trigger","wasEmpty","proprety","policyValue","old","$7A","ConfigurationEditing","init_configurationService","fileService","policyService","defaultModel","policyModel","userModel","arg3","arg4","inspect","existingOverrides","userConfigurationModel","defaultConfigurationModel","configurationChange","insertSpaces","configuredEol","$qo","$ro","$so","$to","$uo","registerProxyConfigurations","useHostProxy","useHostProxyDefault","previousUseHostProxy","previousUseHostProxyDefault","oldProxyConfiguration","proxyConfiguration","$oo","LoggableHeaders","$po","init_request","headers","request","$gl","$hl","init_environment","$Rm","_UUIDPattern","$Sm","init_uuid","_hex","os","getProgramFilesPath","useAlternateBitness","processArch","osArch","findPSCoreWindowsInstallation","findPreview","programFilesPath","powerShellInstallBaseDir","highestSeenVersion","pwshExePath","currentVersion","dashIndex","intPart","IntRegex","exePath","bitness","preview","PossiblePowerShellExe","findPSCoreMsix","msixAppDir","pwshMsixDirRegex","pwshMsixName","PwshPreviewMsixRegex","PwshMsixRegex","subdir","pwshMsixPath","findPSCoreDotnetGlobalTool","dotnetGlobalToolExePath","findPSCoreScoopInstallation","scoopAppsDir","scoopPwsh","findWinPS","winPSPath","enumerateDefaultPowerShellInstallations","pwshExe","$iw","defaultPwsh","$jw","pwsh","Arch","init_powershell","displayName","$5v","env","preserve","keysToRemove","envKey","$6v","Source","TerminateResponseCode","init_processes","$kw","$lw","childProcess","msgQueue","useQueue","send","msgQueueCopy","fileExistsDefault","statValue","$mw","command","fileExists","fullPath","envPath","pathEntry","pathExtsFound","withExtension","foundPromise","userInfo","$ow","getSystemShellWindows","getSystemShellUnixLike","_TERMINAL_DEFAULT_SHELL_UNIX_LIKE","unixLikeTerminal","_TERMINAL_DEFAULT_SHELL_WINDOWS","init_shell","$Sk","errorReporter","ignoringReporter","firstPossibleCommand","alias","stringOptions","booleanOptions","globalOptions","optionId","newArgs","reporter","subcommandOptions","parsedArgs","import_minimist","minimist","cleanedArgs","remainingArgs","deprecatedId","sanitized","formatUsage","option","$Tk","columns","usageTexts","usageText","formatUsageTexts","argLength","ut","descriptionColumns","usage","wrappedDescription","wrapText","keyPadding","indent","$Uk","productName","executableName","version","capabilities","inputFiles","subcommand","help","$Vk","optionsByCategory","subcommands","optionsByCat","helpCategoryKey","categoryOptions","helpCategories","isChat","example","$Wk","$Rk","init_argv","__toESM","$1k","init_argvHelper","$pw","min","max","init_numbers","spawn","$xw","configurationService","unixShellEnvPromise","cts","timeoutValue","configuredTimeoutValue","doResolveUnixShellEnv","runAsNode","noAttach","systemShellUnix","shellArgs","extraArgs","stderr","stderrStr","rawStripped","init_shellEnv","parseUrl","getSystemProxyURI","requestURL","$OB","rawRequestURL","proxyURL","proxyEndpoint","mod","init_proxy","createGunzip","$QB","urlStr","spnConfig","logPrefix","importKerberos","kerberos","spn","getNodeRequest","$RB","endpoint","rawRequest","req","followRedirects","$PB","init_requestService","proxyUrl","strictSSL","shellEnv","agent","authInfo","$wu","init_remoteHosts","getPlatformDetail","hostname","$zu","release","arch","machineId","sqmId","devDeviceId","isInternalTelemetry","releaseDate","seq","platformDetail","$Au","domainList","userDnsDomain","domain","msftDomain","init_commonProperties","$Ro","$To","$1o","$2o","$3o","$4o","TelemetryLevel","TelemetryConfiguration","init_telemetry","$Iu","productService","$Ju","$Ku","newConfig","crashReporterConfig","$Lu","measurements","flat","flatten","$Mu","remoteAuthority","remoteName","telemetryAllowedAuthorities","order","$Nu","configService","msftInternalDomains","internalTesting","$Ou","anonymizeFilePaths","cleanupPatterns","updatedStack","cleanUpIndexes","nodeModulesRegex","fileRegex","lastIndex","overlappingRange","removePropertiesWithPossibleUserInfo","userDataRegexes","secretRegex","$Pu","cleanUpPatterns","$Bu","updatedProperty","$Cu","$Du","$Fu","$Gu","$Hu","init_telemetryUtils","$bz","targetPlatform","$cz","$dz","$ez","allTargetPlatforms","productTargetPlatform","$fz","extensionTargetPlatform","$gz","$qz","location","$vz","isPrivate","galleryManifest","$6y","$7y","$8y","$$y","$_y","$az","ExtensionInstallSource","SortBy","SortOrder","FilterType","StatisticType","InstallOperation","$hz","ExtensionGalleryErrorCode","$iz","ExtensionManagementErrorCode","ExtensionSignatureVerificationCode","$jz","$kz","$nz","$oz","$pz","$rz","$sz","$tz","init_extensionManagement","SEMVER_SPEC_VERSION","parse","valid","coerce","clean","inc","major","minor","patch","prerelease","gt","gte","lt","lte","neq","rcompare","compareIdentifiers","rcompareIdentifiers","compareBuild","sort","rsort","validRange","satisfies","maxSatisfying","minSatisfying","minVersion","gtr","ltr","outside","intersects","SemVer","Comparator","Range","init_semver","H","u","w","E","T","$","S","R","I","O","A","M","V","P","C","L","N","D","X","z","G","Z","B","U","F","K","ee","J","Q","W","Y","re","te","ne","oe","ie","se","ae","ue","ce","pe","fe","le","$mo","$no","offlineName","$Vy","manifest","$Wy","$Zy","enabledApiProposals","proposal","proposalName","$1y","$Ly","$My","$Ny","$Qy","ExtensionType","TargetPlatform","$Ry","$Ty","$2y","init_extensions","aValue","bValue","$wz","$yz","EXTENSION_IDENTIFIER_WITH_VERSION_REGEX","$Az","$zz","publisher","$Bz","$Cz","extensions","getExtensionIdentifier","byExtension","findGroup","extension","$Dz","$Ez","isAlpineLinux","$Hz","alpineLinux","$Iz","malicious","$Jz","extensionOrPublisher","ExtensionKeyRegex","$xz","$Fz","init_extensionManagementUtil","_$xz","Severity","severity_default","init_severity","_error","_warning","_warn","_info","_ignore","fromValue","toString","severity","_allApiProposals","allApiProposals","init_extensionsApiProposals","$Pz","VERSION_REGEXP","$Qz","$Rz","majorBase","majorMustEqual","minorBase","minorMustEqual","patchBase","patchMustEqual","notBefore","NOT_BEFORE_REGEXP","year","month","day","$Sz","_inputVersion","_inputDate","_desiredVersion","productTs","desiredVersion","desiredMajorBase","desiredMinorBase","desiredPatchBase","desiredNotBefore","$Tz","productVersion","productDate","extensionLocation","extensionManifest","extensionIsBuiltin","validateApiVersion","validations","isStringArray","mainLocation","browserLocation","notices","$Uz","notice","incompatibleNotices","$Wz","isVersionValid","$Vz","engine","apiProposals","productApiProposals","incompatibleProposals","parsedProposals","requestedVersion","init_extensionValidator","$fj","$gj","$hj","UriIteratorState","$ij","Undef","TernarySearchTreeNode","Dir","$jj","init_ternarySearchTree","aCode","thisCode","justSeps","_Undef","tmp","_$jj","ignorePathCasing","ignoreQueryAndFragment","iter","oldElement","bf","d1","d2","superStr","stack2","newChild","newChild2","allowValue","nodeIsBalanced","$6j","$8j","provider","$9j","$0j","$$j","$_j","$ak","$bk","$ck","$dk","$gk","$fk","$hk","FileSystemProviderErrorCode","$ik","$jk","$kk","$ok","$nk","$zk","$5j","FileType","FilePermission","FileChangeFilter","FileSystemProviderCapabilities","FileOperation","$lk","FileChangeType","$mk","$pk","$qk","FileOperationResult","FileKind","$yk","$Bk","init_files","_$fk","providerError","operation","_$mk","changes","deleted","types","hasTypesFilter","correlationId","fileOperationResult","size","_$Bk","$on","init_productService","$uu","storageService","uuid","init_serviceMachineId","$Qu","telemetryService","serviceMachineId","init_marketplace","$xm","replacer","$ym","$zm","depth","init_marshalling","StorageHint","StorageState","$yo","init_storage","_$yo","fallbackValue","external","valueStr","updateRequest","$jl","singleFolderIdentifier","$ol","workspaceIdentifier","$El","$wl","$il","WorkbenchState","$vl","$xl","init_workspace","$Ao","init_uriIdentity","$Bo","$Do","profile","$Eo","profilesCacheHome","defaultProfile","ProfileResourceType","$Co","$Fo","init_userDataProfile","profiles","storedProfile","emptyWindows","profileAssociaitions","workspacePath","profileId","workspaces","windowId","namePrefix","nameRegEx","nameIndex","profileCreationPromise","joiners","profilesToUpdate","profileToUpdate","w1","w2","updatedProfile","profileToRemove","profileToSet","transient","currentlyAssociatedProfile","unAssociatedTransientProfiles","windowProfile","allProfiles","transientProfiles","transientProfile","newProfile","storedProfiles","storedProfileAssociations","$Ko","storage","keysRaw","$Io","$Mo","$Oo","applicationPath","profilePath","safeParse","applicationItems","applicationItemsParsed","profileItems","profileItemsParsed","workspaceItems","workspaceItemsParsed","applicationValues","profileValues","workspaceValues","$Ho","$Jo","WillSaveStateReason","StorageScope","StorageTarget","$Lo","_$Lo","reason","keyTargets","applicationStorage","profileStorage","workspaceStorage","preserveData","oldStorage","newStorage","handledkeys","$4y","ExtensionGalleryResourceType","Flag","$3y","init_extensionGalleryManifest","getStatistic","statistics","getCoreTranslationAssets","coreTranslationAssetPrefix","asset","getVersionAsset","getRepositoryAsset","results","AssetType","gitRegExp","getDownloadAsset","getExtensions","getEngine","PropertyType","isPreReleaseVersion","hasPreReleaseForExtension","getExcludeVersionRangeForExtension","isPrivateExtension","executesCode","getEnabledApiProposals","getLocalizedLanguages","getSponsorLink","getSupportLink","getIsPreview","getTargetPlatformForExtensionVersion","getAllTargetPlatforms","rawGalleryExtension","isWebExtension","webTargetPlatformIndex","$C3","versions","preferredTargetPlatform","insertionIndex","setTelemetry","querySource","SEARCH_ACTIVITY_HEADER_NAME","toExtension","galleryExtension","extensionGalleryManifest","queryContext","latestVersion","assets","detailsViewUri","publisherViewUri","ratingViewUri","CURRENT_TARGET_PLATFORM","ACTIVITY_HEADER_NAME","SERVER_HEADER_NAME","END_END_ID_HEADER_NAME","REQUEST_TIME_OUT","DefaultPageSize","DefaultQueryState","VersionKind","Query","$D3","$E3","$F3","init_extensionGalleryService","_Query","criterium","pageNumber","pageSize","filterType","criteria","sortBy","sortOrder","assetTypes","extensionInfos","resourceApi","uuids","extensionInfosByName","updateCheck","latestVersionResource","names","ids","includePreRelease","isQueryForReleaseVersionFromPreReleaseVersion","toQuery","toFetchLatest","resourceUriTemplate","rawGalleryExtensionVersion","compatible","publisherDisplayName","hasPreRelease","excludeVersionRange","extensionId","manifestAsset","quotedCategory","category","quotedTag","tag","runQuery","total","getPage","pageIndex","ct","flag","rawGalleryExtensions","extensionIdentifier","extensionIdentifierWithPreRelease","extensionIdentifierWithVersion","needAllVersions","stopWatch","rawGalleryExtensionVersions","extensionsQueryApi","unpublishedFlag","flagValue","errorCode","galleryExtensions","resultCount","errorMessage","headerValue","Accept","operationParam","downloadAsset","languageId","onlyCompatible","assetType","extensionVersion","commonHeaders","baseOptions","fallbackUrl","firstOptions","fallbackOptions","deprecated","search","autoUpdate","publisherOrExtension","unsupportedPreReleaseExtensionId","preReleaseExtensionInfo","deprecatedExtensionId","deprecationInfo","requestService","allowedExtensionsService","extensionGalleryManifestService","createWriteStream","modeFromEntry","attr","toExtractError","$R3","CORRUPT_ZIP_PATTERN","extractEntry","fileName","targetPath","dirName","targetDirName","targetFileName","istream","extractZip","zipfile","extractedEntriesCount","throttler","readNextEntry","openZipStream","openZip","zipFile","lazy","open","zip","zipPath","ZipFile","zipStream","$T3","sourcePathRegex","read","filePath","$U3","$Q3","init_zip","cause","$w3","init_download","codeBuffer","HangulRangeStartCode","AsciiCode","AsciiCodeCombo","modernConsonants","modernVowels","modernFinalConsonants","compatibilityJamo","init_korean","or","word","wordToMatchAgainst","_matchesPrefix","$tj","$uj","_matchesSubString","join","isLower","$vj","isAlphanumeric","head","nextAnchor","camelCaseWord","_matchesCamelCase","nextUpperIndex","analyzeCamelCaseWord","upper","lower","alpha","numeric","upperPercent","lowerPercent","alphaPercent","numericPercent","isUpperCaseWord","analysis","isCamelCaseWord","isCamelCasePattern","whitespace","$wj","initTable","row","_maxLen","initArr","maxLen","$rj","$sj","wordSeparators","fuzzyContiguousFilter","fuzzySeparateFilter","fuzzyRegExpCache","_minWordMatchPos","_maxWordMatchPos","_diag","_table","_arrows","Arrow","FuzzyScore","$Dj","init_filters","score","firstMatchCanBeWeak","boostFullMatch","$Hj","fontCharacter","_codiconFontCharacters","$Ij","init_codiconsUtil","$Jj","init_codiconsLibrary","$Kj","$Mj","$Lj","init_codicons","ThemeColor","ThemeIcon","init_themables","isThemeColor","ThemeIconIdRegex","asClassNameArray","icon","modifier","classNames","asClassName","asCSSSelector","isThemeIcon","_regexFromString","fromString","fromId","modify","tildeIndex","getModifier","isEqual","ti1","ti2","$Oj","escapeIconsRegex","iconsRegex","markdownEscapedIconsRegex","stripIconsRegex","_parseIconsRegex","init_iconLabels","$Wj","$Uj","$Yj","$Zj","langId","longestFenceLength","desiredFenceLength","$3j","href","dimensions","splitted","parameters","heightFromParams","widthFromParams","height","width","widthIsFinite","heightIsFinite","MarkdownStringTextNewlineStyle","init_htmlContent","_$Uj","dto","markdownString","isTrustedOrOptions","newlineStyle","_match","g1","label","title","$L3","extensionManagementError","reportTelemetry","extensionData","verificationStatus","duration","durationSinceUpdate","$J3","$K3","$M3","init_abstractExtensionManagementService","allowedToInstall","learnLink","currentTargetPlatform","installableExtensions","fromProfileLocation","local","now","participant","pinned","installExtensionResultsMap","installingExtensionsMap","alreadyRequestedInstallations","getInstallExtensionTaskKey","profileLocation","createInstallExtensionTask","existingInstallingExtension","installExtensionTask","isApplicationScoped","installExtensionTaskOptions","existingInstallExtensionTask","preferPreRelease","installed","allDepsAndPackExtensionsToInstall","gallery","otherProfilesToUpdate","isUpdate","getAllDepsAndPacks","allDepsOrPacks","depsOrPacks","getErrorResult","rollbackTasks","depOrPack","rollbackTask","tasks","profileExtensionsCache","installedExtensions","installedExtension","taskToWait","taskToWaitFor","waitingTasks","waitingTask","promiseResults","knownIdentifiers","allDependenciesAndPacks","collectDependenciesAndPackExtensionsToInstall","dependecies","dependenciesAndPackExtensions","galleryIdentifier","isDependency","sameVersion","installPreRelease","compatibleExtension","extensionsControlManifest","incompatibleApiProposalsMessages","getUninstallExtensionTaskKey","uninstallOptions","createUninstallExtensionTask","uninstallExtensionTask","postUninstallExtension","allTasks","processedTasks","alreadyRequestedUninstalls","extensionsToRemove","installedExtensionsMap","getInstalledExtensions","profileExtension","uninstallOptionsWithProfile","packedExtensions","packedExtension","extensionsToUninstall","extensionToUninstall","dependents","remainingDependents","dependent","dependingExtension","checked","extensionsPack","packOfPackedExtensions","isStoredProfileExtension","isUriComponents","ExtensionsProfileScanningErrorCode","$Kz","$Lz","$Mz","init_extensionsProfileScannerService","keepExistingVersions","extensionsToAdd","existingExtensions","extensionToAdd","updatedExtensions","profileExtensions","updateFn","storedProfileExtensions","migrate","oldDefaultProfileExtensionsLocation","oldDefaultProfileExtensionsInitLocation","parsedData","resourceQueue","$Nz","init_jsonErrorMessages","$Xz","translations","fallbackTranslations","replaceNLStrings","messages","originalMessages","processEntry","messageKey","translated","original","localizedString","init_extensionNls","$2z","isUnderDevelopment","Translations","$Yz","$Zz","$1z","ExtensionsScanner","CachedExtensionsScanner","init_extensionsScannerService","aKeys","bKeys","systemExtensionsLocation","userExtensionsLocation","currentProfile","systemScanOptions","userScanOptions","system","scanOptions","defaultSystemExtensions","devSystemExtensions","profileScanOptions","extensionsScannerInput","extensionsScanner","extLoc","extensionDevelopmentLocationURI","extensionType","extensionLocations","scannedExtensions","metaData","manifestLocation","userExtensions","aLastSegment","bLastSegment","development","pickLatest","pick","isDevelopment","language","checkControlFile","devSystemExtensionsList","builtinExtensionControl","devSystemExtensionsLocations","devSystemExtensionsLocation","controlState","mtime","applicationExtensionsLocation","applicationExtensionsLocationMtime","applicationExtensionslocation","applicationExtensionslocationMtime","productCommit","devMode","extensionScannerInput","applicationExtensions","profileResource","scannedProfileExtensions","scannedProfileExtension","isValid","isBuiltin","nlsConfiguration","localizedMessages","localized","defaultPackageNLS","reportErrors","reportInvalidFormat","translationId","translationPath","translationResource","translationBundle","messageBundle","messageBundleContent","originalMessageBundle","originalBundleContent","loop","toCheck","exists","extensionsProfileScannerService","uriIdentityService","cacheFile","cacheContents","cacheRawContents","extensionCacheData","$V3","$W3","vsixPath","$G3","$H3","init_extensionSignatureVerificationService","vsixFilePath","signatureArchiveFilePath","clientTargetPlatform","$X3_1","$X3","init_extensionDownloader","verifySignature","signatureArchiveLocation","attempts","downloadFn","tempLocation","trashRelativePath","folderStat","toDelete","vsixs","signatureArchives","distinct","fork","$Y3","init_extensionLifecycle","script","scriptKey","lifecycleHook","lifecycleType","extensionLifecycleProcess","timeoutHandler","onexit","uninstallHook","extensionUninstallProcess","onStdout","onStderr","onOutput","$Z3","init_extensionsManifestCache","extensionsManagementService","extensionsManifestLocation","$13","init_extensionsWatcher","extensionsToDelete","extensionKeys","extensionsProfileLocation","$23","DELETED_FOLDER_POSTFIX","$33","$43","InstallExtensionInProfileTask","UninstallExtensionInProfileTask","init_extensionManagementService","galleryService","jb","kb","lb","mb","nb","ob","pb","qb","userDataProfilesService","extensionLifecycle","extensionsWatcher","vsix","cleanup","toProfileLocation","extensionsToInstall","donotVerifySignature","extensionKey","shouldRequireSignature","collectFilesFromDirectory","stats","fs4","removedExtensions","addedExtensions","childStat","localExtensions","cacheKey","scanAllExtensionsPromise","scanUserExtensionsPromise","scannedExtension","removeIfExists","folderName","targetExtension","fromExtensions","renamedLocation","extractPath","renamePath","readmeUrl","changelogUrl","latest","existingExtension","existingWithSameVersion","$aB","$bB","init_graph","fromNode","toNode","outgoing","_enableAllTracing","CyclicDependencyError","$cB","TraceType","$dB","init_instantiationService","graph","_$cB","services","_trace","_done","ctorOrDescriptor","serviceDependencies","serviceArgs","dependency","firstServiceArgPos","instance","instanceOrDesc","desc","cycleCount","roots","disposeBucket","earlyListeners","idle","list","rm","_target","printWarning","_$dB","_enableTracing","dur","causedCreation","printChild","trace","nested","product_default","init_product","pkg","$Sw","doReadFileIntoStream","throwIfCancelled","totalBytesRead","allowedRemainingBytes","posInFile","posInBuffer","throwIfTooLarge","lastChunkLength","init_io","$_A_1","$_A","init_fileService","providerDisposables","capability","isPathCaseSensitive","resolveTo","resolveSingleChildDescendants","resolveMetadata","trie","siblings","recurse","providerExtUri","fileStat","resolvedEntries","childResource","toResolve","bufferOrReadableOrStream","writeFileOptions","enforcedAtomicWrite","bufferOrReadableOrStreamOrBufferedStream","peekResult","unlock","cancellableSource","readFileOptions","statPromise","fileStream","sourceProvider","targetProvider","isSameResourceWithDifferentPathCase","sourceFile","sourceFolder","targetFolder","sourceChild","targetChild","directory","directoriesToCreate","useTrash","atomic","deleteFileOptions","enforcedAtomicDelete","recursive","watchDisposed","disposeWatch","fileChangeEmitter","watchHash","watcher","readableOrStreamOrBufferedStream","streamOrBufferedStream","totalBytesWritten","sourceHandle","targetHandle","starsToRegExp","starCount","isLastPattern","NO_PATH_REGEX","PATH_REGEX","$0i","pattern","splitChar","inBraces","inBrackets","curVal","parseRegExp","regEx","$9i","$8i","previousSegmentWasGlobStar","braceVal","bracketVal","braceRegExp","choice","parsePattern","NULL","patternKey","parsedPattern","CACHE","wrapRelativePattern","T1","trivia1","T2","trimForExclusions","trivia2","T3_2","T3","trivia3","T4","trivia4and5","T5","toRegExp","wrappedPattern","basename","slashBase","backslashBase","basenames","parsedPatterns","aggregateBasenameMatches","patternsLength","withBasenames","allPaths","matchPathEnds","usingPosixSep","nativePath","ALL_FORWARD_SLASHES","nativePathEnd","targetPathEnd","regExp","$aj","FALSE","$bj","resultPattern","parsedExpression","rp","expression","parseExpressionPattern","resultExpression","resultPromises","resultPromise","hasSibling","when","clausePattern","matched","basenamePatterns","patterns","aggregate","aggregatedPatterns","$ej","patternsA","patternsB","init_glob","$Dk","$Ek","$Ik","$Jk","coalescer","EventCoalescer","$Kk","$Lk","$Mk","$Nk","filters","$Fk","$Gk","$Hk","init_watcher","_$Fk","failedRequest","requests","verboseLogging","onFileChanges","onLogMessage","existingEvent","keepEvent","currentChangeType","newChangeType","addOrChangeEvents","deletedPaths","e1","e2","deletedPath","$Tw","init_diskFileSystemProvider","usePolling","init_cancelPreviousCalls","$um","descriptor","fnKey","memoizeKey","init_decorators","requestTypeToStr","responseTypeToStr","readIntVQL","reader","writeInt32VQL","vqlZero","v2","scratch","createOneByteBuffer","$Cm","BufferPresets","$Dm","DataType","$Im","cancellationToken","relay","$Jm","channel","didTick","RequestType","ResponseType","State","$Am","$Bm","$Em","RequestInitiator","$Fm","$Gm","$Km","ProxyChannel","init_ipc","bytes","channelName","response","msgLength","header","body","cancellationTokenSource","pendingRequests","timer","disposableWithRequestCancel","doRequest","uninitializedPromise","ctx","onDidClientConnect","ipcLogger","timeoutDelay","protocol","onDidClientDisconnect","onFirstMessage","channelServer","channelClient","connection","routerOrClientFilter","connectionPromise","channelPromise","clientFilter","eventMultiplexer","onDidAddConnection","onDidRemoveConnection","hub","fromService","disableMarshalling","mapEventNameToEvent","propertyIsEvent","eventImpl","propertyIsDynamicEvent","toService","propKey","methodArgs","$Uw","$Vw","parsedArguments","stackArgument","findFirstFrame","newlineIndex","isOneStringArg","topFrame","consoleArgs","color","init_console","$Zw","init_ipc_cp","cancellationTokenListener","forkOpts","onMessageEmitter","rawMessageDisposable","sender","onMessage","onExit","$1w","init_watcherClient","client","watchFile","unwatchFile","$2w","init_baseWatcher","delayed","nonSuspendedRequests","pathNotFound","watchFileCallback","prev","currentPathNotFound","previousPathNotFound","oldPathNotFound","traceMsg","watch","$Ok","init_nodejsWatcherLib","_$Ok","watchDisposable","realPath","watcherDisposables","requestResource","pathBasename","folderChildren","mapPathToStatDisposable","changedFileName","timeoutHandle","skipIncludeExcludeChecks","exclude","include","fileChanges","coalescedFileChanges","filteredEvents","$3w","init_nodejsWatcher","requestsToStart","watchersToStop","mapCorrelationtoRequests","requestsForCorrelation","$4w","init_nodejsClient","$5w","_$5w","existingLock","newLock","lock","tempResource","locks","disableWriteLock","previousLock","lockForHandle","normalizedPos","bytesLength","lastKnownPos","rmMoveToPath","unlinkError","fromFilePath","toFilePath","fromStat","toStat","mkdir","onChange","resultError","fileSystemProviderWriteError","$mn","minute","hour","week","init_date","$sn","isBuilt","$tn","debugArg","debugBrkArg","defaultBuildPort","debugId","environmentString","brk","$qn","$rn","init_environmentService","vscodePortable","cliBuiltinExtensionsDir","cliExtensionsDownloadDir","cliExtensionsDir","vscodeExtensions","extensionDevelopmentPaths","extensionDevelopmentPath","kind","extensionTestsPath","disableExtensions","homedir","$el","cliArgs","doGetUserDataPath","pathsToResolve","portablePath","appDataPath","cliPath","userProfile","init_userDataPath","$vn","$un","$f3","$g3","$h3","init_serverEnvironmentService","notFound","useId","$I3","init_extensionManagementCLI","showVersions","categories","builtinExtensions","installOptions","force","failed","installVSIXInfos","installExtensionInfos","addInstallExtensionInfo","failedGalleryExtensions","installedExtensionsQuery","availableVersions","extensionsToUpdate","newVersion","oldVersion","installationResult","extensionResult","installExtensionInfo","preRelease","_manifest","newer","getId","extensionDescription","uninstalledExtensions","$53","$63","$73","init_languagePacks","allFromMarketplace","lp","languageName","description","countLabel","createHash","isValidLocalization","localization","translation","$83","LanguagePacksCache","extensionGalleryService","pack","languages","localizations","localizationContribution","extensionInLanguagePack","md5","fs5","$C5","init_downloadService","$XB","_registry","InstantiationType","_a3","NIL","$ZB","init_skipList","_$ZB","capacity","didDelete","searchKey","update","lvl","Entry","$1B","init_uriIdentityService","_Entry","schemeIgnoresPathCasingCache","$c3","defaultMessagesFile","nlsConfigurationCache","$e3","messagesFile","nlsFile","path3","$d3","stripComments","init_remoteLanguagePacks","argvResource","_m1","_m2","m3","m4","length_1","$c5","instantiationService","$Po","$Qo","init_state","SaveStrategy","$8u","$9u","$0u","init_stateService","saveStrategy","save","serializedDatabase","$$u_1","$_u_1","$$u","$_u","$av","$eA","$2B","init_logService","primaryLogger","otherLoggers","createSpdLogLogger","logfilePath","filesize","filecount","donotUseFormatters","_spdlog","SpdLogLevel","setLogLevel","$Fv","init_spdlogLog","filepath","rotating","$Gv","init_loggerService","processUNCHostAllowlist","$0k","allowedHost","allowlist","toSafeStringArray","arg0","allowedUNCHosts","$_k","init_unc","isGalleryExtension","isIExtension","VersionRegex","$m5","init_allowedExtensionsService","settingsCommandLink","extensionValue","extensionReason","publisherKey","publisherValue","$p5","init_extensionGalleryManifestService","extensionsGallery","resources","eventuallyExit","run","REMOTE_DATA_FOLDER","optionDescriptions","executable","cliMain","CliMain","init_remoteExtensionHostAgentCli","accessor","loggerService","extensionManagementCLI","inputs","FSConstants","FSPromises","readLines","$_2","errorLogger","osReleaseKeys","releaseInfo","init_osReleaseInfo","net","$qi","startPort","giveUpAfter","stride","done","doFindFreePort","dispose","socket","init_ports","getEmptyBuffer","emptyBuffer","protocolMessageTypeToString","messageType","SocketDiagnosticsEventType","SocketDiagnostics","SocketCloseEventType","$Mm","ProtocolMessageType","ProtocolConstants","ProtocolMessage","ProtocolReader","ProtocolWriter","$Pm","QueueElement","Queue","LoadEstimator","$Qm","init_ipc_net","socketIds","lastUsedSocketId","getSocketId","nativeObject","traceSocketEvent","socketDebugLabel","copiedData","byteCount","advance","resultOffset","chunkIndex","chunkPart","ack","resultLen","it","_LoadEstimator","historyLimit","initialDataChunk","toSend","timeSinceLastIncomingMsg","oldestUnacknowledgedMsg","timeSinceOldestUnacknowledgedMsg","timeSinceLastReceivedSomeData","timeSinceLastTimeout","minimumTimeUntilTimeout","createDeflateRaw","createInflateRaw","unmask","cnt","bytesLeft","m2","m1","$Wm","randomSuffix","basePath","$Vm","validateIPCHandleLength","safeIpcPathLengths","socketEndTimeoutMs","$Tm","Constants","ReadState","$Um","WebSocketFlowManager","ZlibInflateStream","ZlibDeflateStream","debugLabel","endTimeoutHandle","hadError","_listener","adapter","finished","permessageDeflate","inflateBytes","recordInflateBytes","compressed","opcode","headerLen","compressedFlag","opcodeFlag","peekHeader","firstByte","finBit","rsv1Bit","secondByte","hasMask","compressedData","zlibDeflateStream","isCompressed","isLastFrameOfMessage","frameInfo","zlibInflateStream","$a3","$b3","init_extensionHostStatusService","reconnectionToken","$i3","$j3","$k3","$l3","ExtHostConnectionType","init_extensionHostEnv","_$i3","pipeName","_$j3","_$k3","cp","$n3","startParamsEnv","withUserShellEnvironment","userShellEnv","binFolder","remoteCliBinFolder","PATH","readCaseInsensitive","setCaseInsensitive","removeNulls","pathKeys","pathKey","ConnectionData","$o3","init_extensionHostConnection","skipWebSocketFrames","remoteAddress","_str","extHostSocket","connectionData","stopAndCleanup","extensionHostProcess","_socket","startParams","execArgv","extHostNamedPipeServer","namedPipeServer","cp2","pid","messageListener","net2","printTime","ms","_h","_m","_s","_ms","$p3","init_remoteExtensionManagement","cookie","$t3","withoutConnectionToken","connectionTokenFile","$s3","$q3","rawConnectionToken","fs7","connectionTokenRegex","$r3","$u3","storageLocation","$v3","parsedUrl","cookies","ServerConnectionTokenType","init_serverConnectionToken","networkInterfaces","validateMacAddress","tempCandidate","invalidMacAddresses","$Nx","ifaces","networkInterface","mac","init_macAddress","$Px","getMacMachineId","crypto","macAddress","$Qx","Registry","SQM_KEY","$Rx","$Ox","init_id","vmOui","interfaceCount","interfaces","internal","$2v","init_extensionHostDebugIpc","$y3","init_downloadIpc","uriTransformer","toJSON","_transformOutgoingURIs","$8w","_transformIncomingURIs","revive","$9w","$0w","$6w","$7w","init_uriIpc","transformIncomingURI","transformOutgoingURI","transformIncomingExtension","transformIncomingOptions","transformOutgoingExtension","$N3","init_extensionManagementIpc","$93","init_requestIpc","ErrorEvent","$UA","init_errorTelemetry","_$UA","flushDelay","unbind","callstack","$$3","unhandledPromises","$Fw","TerminalSettingPrefix","TerminalSettingId","PosixShellType","WindowsShellType","GeneralShellType","TitleEventSource","TerminalIpcChannels","ProcessPropertyType","$Gw","HeartbeatConstants","TerminalLocation","TerminalLocationString","LocalReconnectConstants","FlowControlConstants","ProfileSource","ShellIntegrationStatus","ShellIntegrationInjectionFailureReason","TerminalExitReason","$Hw","TerminalBackendRegistry","$Iw","$Jw","init_terminal","backend","$lA","$mA","init_logIpc","loggers","$nA","init_requestStore","requestId","tokenSource","resolveRequest","$oA","detectedProfiles","extensionProfiles","createProfileDescription","extensionProfile","createExtensionProfileDescription","init_terminalProfiles","createTerminalProfileMarkdownDescription","$uA","terminalPlatformConfiguration","$vA","extensionContributedProfiles","registry","profileEnum","oldDefaultProfilesConfiguration","defaultProfilesConfiguration","$sA","$tA","terminalProfileBaseProperties","terminalProfileSchema","terminalAutomationProfileSchema","init_terminalPlatformConfiguration","EnvironmentVariableMutatorType","init_environmentVariable","$wA","collection","$xA","descriptionMap","$yA","serializedCollection","$zA","serializableEnvironmentDescription","init_environmentVariableShared","filterScope","mutator","strictFilter","getMissingMutatorsFromArray","otherMutatorExtensions","getChangedMutatorsFromArray","otherMutator","mutatorTypeToLabelMap","$CA","init_environmentVariableCollection","collections","extensionMutator","variableResolver","lowerToActualVariableNames","variable","mutators","actualVariable","otherMutators","currentMutators","filteredMutators","$DA","osVersion","os2","buildNumber","ShellIntegrationExecutable","shellIntegrationArgs","init_terminalEnvironment","$FA","includeDetectedProfiles","fsProvider","testPwshSourcePaths","fs8","detectAvailableWindowsProfiles","detectAvailableUnixProfiles","useWslProfiles","configProfiles","defaultProfileName","is32ProcessOn64Windows","system32Path","useWSLexe","initializeWindowsProfiles","cmderPath","applyConfigProfilesToMap","resultProfiles","transformToTerminalProfiles","getWslProfiles","wslProfile","logIfWslNotInstalled","profileName","getValidatedProfile","originalPaths","profileSources","validateIcon","mapped","resolved","requiresUnsafePath","actualRequiredPath","validatedProfile","validateProfilePaths","gitBashPaths","pwshPaths","getGitBashPaths","getPowershellPaths","gitDirs","gitExePath","gitExeDir","addTruthy","gitDir","wslPath","distroOutput","cp3","stdout","distroNames","distroName","getWslIcon","testPaths","counts","profilesMap","potentialPaths","overrideName","isAutoDetected","isUnsafePath","actualPath","envPaths","$GA","init_ptyHostService","proxy","shellLaunchConfig","cols","rows","unicodeVersion","executableEnv","shouldPersist","workspaceId","workspaceName","titleSource","userInitiated","forcePersist","immediate","charCount","sw","reply","osOverride","direction","instanceId","persistentProcessId","dateTimeFormatLocate","isConnecting","createRawURITransformer","$_3","init_uriTransformer","exec","totalmem","$bx","rootPid","rootItem","totalMemory","addToTree","ppid","cmd","load","mem","findName","UTILITY_NETWORK_HINT","WINDOWS_CRASH_REPORTER","WINPTY","CONPTY","TYPE","JS","cleanUNCPrefix","windowsProcessTree","processList","completeProcessList","processItems","process","commandLine","calculateLinuxCpuUsage","processes","pids","cpuUsage","processInfo","parsePsOutput","ps","PID_CMD","init_ps","$9v","ID","$8v","init_diagnostics","osLib","$8A","workspaceStatsCache","configFilePatterns","fileTypes","configFiles","MAX_FILES","collect","filesToRead","fileType","statsPromise","launchConfigs","$0A","asSortedItems","$9A","machineInfo","cpus","launchConfig","fs9","json","$$A","init_diagnosticsService","remoteData","rootProcess","workspaceInfo","diagnostics","countMessage","memory","vmHint","systemInfo","remoteDiagnostics","window","workspaceStats","col","appendAndWrap","maxShown","gpuFeatures","longestFeatureName","feature","workspaceStatPromises","uriComponents","folderUri","mapProcessToName","mainPid","isRoot","$b4","init_remoteAgentEnvironmentImpl","_$b4","environmentData","diagnosticInfo","processesPromise","workspaceMetadataPromises","workspaceMetadata","isUnsupportedGlibc","glibcVersion","$$w","$_w","init_diskFileSystemProviderServer","_resource","_source","sessionId","sessionEmitter","localChangeEmitter","extraExcludes","$c4","SessionFileWatcher","init_remoteFileSystemProviderServer","supportVSCodeResource","requestResourcePath","fileWatcherPolling","pollingInterval","$g4","init_remoteTelemetryChannel","telemetryLevel","getTelemetryLevelSettingDescription","telemetryText","externalLinksStatement","restartString","crashReportsHeader","errorsHeader","usageHeader","telemetryTableDescription","telemetryTable","deprecatedSettingNote","$ey","init_telemetryService","piiPath","collectableTelemetry","maxCollectableTelemetryLevel","eventLevel","errorEventName","$d4","$e4","$f4","init_serverTelemetryService","injectedTelemetryLevel","_configurationService","_productService","$7B","mapExtToMediaMimes","$9B","mimeType","_simplePattern","$5B","init_mime","$gB","RemoteConnectionType","RemoteAuthorityResolverErrorCode","init_remoteAuthorityResolver","$DL","cell","_padRegexp","_radix","_scheme","$EL","notebook","_lengths","$FL","$GL","$HL","openIn","outputId","parsedCell","outputIndex","notebookUri","cellIndex","$CL","$IL","init_notebookDocumentService","cellUri","document","$3L","CellKind","$QL","$RL","NotebookRunState","NotebookCellExecutionState","NotebookExecutionState","NotebookRendererMatch","RendererMessagingSpec","NotebookCellsChangeType","SelectionStateType","CellEditType","NotebookMetadataUri","CellUri","$WL","$XL","NotebookEditorPriority","NotebookFindScopeType","CellStatusbarAlignment","$2L","$5L","MOVE_CURSOR_1_LINE_COMMAND_BYTES","BACKSPACE_CHARACTER","CARRIAGE_RETURN_CHARACTER","init_notebookCommon","generate","generateCellOutputUriWithId","generateCellOutputUriWithIndex","generateOutputEditorUri","cellId","parseCellOutputUri","generateCellPropertyUri","parseCellPropertyUri","propertyScheme","_$2L","notebookType","viewType","es5ClassCompat","argsList","restArgs","$QY","$RY","selection","rangeStr","computeTaskExecutionId","$y1","cc","$MY_1","$NY_1","$OY_1","$PY_1","$VY_1","$WY_1","$ZY_1","$1Y_1","$8Y_1","$9Y_1","$$Y_1","$eZ_1","$zZ_1","$DZ_1","$EZ_1","$8Z_1","$u1_1","TerminalOutputAnchor","TerminalQuickFixType","$MY","$NY","$OY","$PY","EndOfLine","$VY","$WY","$XY","FileEditType","$YY","$ZY","DiagnosticTag","DiagnosticSeverity","$1Y","$2Y","$3Y","$4Y","$5Y","HoverVerbosityAction","DocumentHighlightKind","$6Y","$7Y","SymbolKind","SymbolTag","$8Y","$9Y","CodeActionTriggerKind","$0Y","$$Y","$_Y","$aZ","$bZ","$cZ","LanguageStatusSeverity","$dZ","$eZ","$fZ","$gZ","$hZ","SignatureHelpTriggerKind","InlayHintKind","$iZ","$jZ","CompletionTriggerKind","CompletionItemKind","CompletionItemTag","$kZ","$lZ","$mZ","$nZ","PartialAcceptTriggerKind","InlineCompletionEndOfLifeReasonKind","ViewColumn","StatusBarAlignment","TextEditorLineNumbersStyle","TextDocumentSaveReason","TextEditorRevealType","TextEditorSelectionChangeKind","TextEditorChangeKind","TextDocumentChangeReason","DecorationRangeBehavior","SyntaxTokenType","$pZ","$qZ","$rZ","$sZ","ColorFormat","SourceControlInputBoxValidationType","TerminalShellExecutionCommandLineConfidence","TerminalShellType","TerminalCompletionItemKind","TaskRevealKind","TaskEventKind","TaskPanelKind","$zZ","$AZ","$BZ","ShellQuoting","TaskScope","$CZ","$DZ","ProgressLocation","ViewBadge","$EZ","TreeItemCollapsibleState","TreeItemCheckboxState","$FZ","$GZ","$HZ","$IZ","$JZ","$KZ","DocumentPasteTriggerKind","$LZ","$NZ","$OZ","$PZ","breakpointIds","$RZ","$SZ","$TZ","$UZ","$VZ","$WZ","$XZ","$YZ","$2Z","InlineCompletionTriggerKind","InlineCompletionsDisposeReasonKind","$3Z","$4Z","$5Z","$6Z","NewSymbolNameTag","NewSymbolNameTriggerKind","$8Z","$9Z","FoldingRangeKind","CommentThreadCollapsibleState","CommentMode","CommentState","CommentThreadState","CommentThreadApplicability","CommentThreadFocus","DebugConsoleMode","QuickInputButtonLocation","$d1","QuickPickItemKind","InputBoxValidationSeverity","ExtensionKind","$f1","ColorThemeKind","$g1","$h1","$i1","$j1","$k1","NotebookCellKind","NotebookCellStatusBarAlignment","NotebookEditorRevealType","NotebookControllerAffinity","NotebookControllerAffinity2","$n1","NotebookVariablesRequestKind","$p1","ExtensionMode","ExtensionRuntime","StandardTokenType","TestResultState","TestRunProfileKind","$s1","$t1","$u1","$v1","$x1","$z1","$A1","$B1","$C1","ExternalUriOpenerPriority","WorkspaceTrustState","PortAutoForwardAction","$D1","InteractiveSessionVoteDirection","ChatCopyKind","ChatVariableLevel","ChatEditingSessionActionOutcome","ChatRequestEditedFileEventKind","InteractiveEditorResponseFeedbackKind","ChatResultFeedbackKind","$Q1","$R1","$S1","$T1","$U1","$V1","$X1","$Y1","$Z1","$11","$21","$31","$41","$51","$61","$71","ChatLocation","ChatResponseReferencePartStatusKind","$_1","$a2","LanguageModelChatMessageRole","$b2","$c2","ChatErrorLevel","$e2","$f2","$g2","$h2","$i2","ChatImageMimeType","$j2","$o2","$p2","LanguageModelChatToolMode","RelatedInformationType","SettingsSearchResultKind","SpeechToTextStatus","TextToSpeechStatus","KeywordRecognitionStatus","init_extHostTypes","inDisposables","#callOnDispose","callOnDispose","positions","character","lineDeltaOrChange","characterDelta","lineDelta","lineOrChange","startLineOrStart","startColumnOrEnd","endLine","endColumn","positionOrRange","startOrChange","anchorLineOrAnchor","anchorColumnOrActive","activeLine","activeColumn","active","newCells","newMetadata","_$XY","snippet","startOrRange","cellData","cellMetadata","editOrTuple","textEdits","textEdit","string","number","rangeOrPosition","canIncreaseVerbosity","canDecreaseVerbosity","highlights","rangeOrContainer","locationOrUri","containerName","selectionRange","parts","fromRanges","#delegate","supportThemeIcons","documentation","isIncomplete","insertText","red","green","blue","varg1","varg2","props","definition","arg5","arg6","problemMatchers","isViewBadge","viewBadgeThing","treeItemThing","checkbox","tooltip","asLightAndDarkThing","collapsibleState","#file","itemId","getData","#items","init","#normalizeMime","_$LZ","baseUri","hitCondition","logMessage","functionName","dataId","canPersist","impl","variableName","caseSensitiveLookup","frameId","messageOrUri","uriOrMessage","terminator","_$g1","_$h1","elem","outputs","executionSummary","cells","_$j1","#encoder","rawStr","mimeNormalized","_$k1","warn","removeIdx","normalMime","_item","idOrMetadata","provides","timestamp","controllerId","continuous","preserveFocus","covered","_$z1","details","statements","branches","decl","branch","coverage","statementCoverage","branchCoverage","declarationCoverage","includesTests","executed","vulnerabilities","buttons","iconPath","isEdit","license","editsOrDone","toolName","reference","callId","isError","_$e2","role","_$f2","part","_$i2","$9C","init_dataTransfer","_getDefaults","changeDefaults","newDefaults","_defaults","escape$1","html","encode","escapeTest","escapeReplace","getEscapeReplacement","escapeTestNoEncode","escapeReplaceNoEncode","opt","valSource","caret","cleanUrl","splitCells","tableRow","rtrim","invert","suffLen","currChar","findClosingBracket","outputLink","cap","link","lexer","indentCodeCompensation","matchIndentToCode","indentToCode","matchIndentInNode","indentInNode","marked","src","markedInstance","escapeReplacements","noopTest","_Tokenizer","newline","blockCode","fences","hr","heading","bullet","lheading","_paragraph","blockText","_blockLabel","def","_tag","_comment","paragraph","blockquote","blockNormal","gfmTable","blockGfm","blockPedantic","escape","inlineCode","br","inlineText","_punctuation","punctuation","blockSkip","emStrongLDelim","emStrongRDelimAst","emStrongRDelimUnd","anyPunctuation","autolink","_inlineComment","_inlineLabel","reflink","nolink","reflinkSearch","inlineNormal","inlinePedantic","inlineGfm","inlineBreaks","block","inline","_Lexer","_Renderer","_TextRenderer","_Parser","_Hooks","Marked","setOptions","use","walkTokens","parseInline","init_marked","trimmed","tokens","inBlockquote","currentLines","currentRaw","currentText","top","lastToken","oldToken","newToken","bull","isordered","itemRegex","endsWithBlankLine","endEarly","itemContents","nextLine","blankLine","nextBulletRegex","hrRegex","fencesBeginRegex","headingBeginRegex","rawLine","istask","ischecked","spacers","hasMultipleLineBreaks","aligns","align","trimmedUrl","rtrimSlash","lastParenIndex","linkLen","links","linkString","maskedSrc","prevChar","lLength","rDelim","rLength","delimTotal","midDelimTotal","endReg","lastCharLength","hasNonSpaceChars","hasSpaceCharsOnBothEnds","prevCapZero","__Lexer","rules","lastParagraphClipped","tabs","cutSrc","extTokenizer","startIndex","tempSrc","tempStart","getStartIndex","errMsg","keepPrevChar","lang","langString","ordered","startAttr","itemBody","cleanHref","__Parser","anyToken","genericToken","textToken","renderer","markdown","tableToken","listToken","childTokens","prevRenderer","extLevel","rendererProp","rendererFunc","tokenizer","tokenizerProp","tokenizerFunc","prevTokenizer","hooks","hooksProp","hooksFunc","prevHook","packWalktokens","origOpt","throwError","silent","async","bfsIterate","unset","$GU","init_prefixTree","onNode","mutate","subtree","onDescend","sizeBefore","sizeAfter","$cC","init_position","_$cC","lineNumber","column","newLineNumber","newColumn","deltaLineNumber","deltaColumn","aLineNumber","bLineNumber","aColumn","bColumn","$dC","init_range","_$dC","startLineNumber","startColumn","endLineNumber","otherRange","resultStartLineNumber","resultStartColumn","resultEndLineNumber","resultEndColumn","otherStartLineNumber","otherStartColumn","otherEndLineNumber","otherEndColumn","lineCount","aStartLineNumber","bStartLineNumber","aStartColumn","bStartColumn","aEndLineNumber","bEndLineNumber","aEndColumn","bEndColumn","init_editOperation","$bD","TokenizationSupportFactoryData","init_tokenizationRegistry","languageIds","support","myData","tokenizationSupport","colorMap","$wD","CompletionItemKinds","CompletionItemInsertTextRule","CodeActionTriggerType","$xD","SymbolKinds","$AD","Command","$CD","init_languages","byKind","toIcon","codicon","toLabel","byCompletionKind","toCompletionKind","completionKind","_$AD","MarkerTag","MarkerSeverity","IMarkerData","$qD","init_markers","_displayStrings","_displayStringsPlural","toStringPlural","fromSeverity","toSeverity","emptyString","makeKey","markerData","makeKeyOptionalMessage","useMessage","$am","$cm","$em","init_actions","cssClass","actionCallback","_$cm","actionLists","_$em","$CK","editor","$JK","$DK","$EK","$GK","$IK","isEditorInputWithPreferredResource","$KK","$LK","$tK","$uK","EditorPaneSelectionChangeReason","EditorPaneSelectionCompareResult","Verbosity","SaveReason","SaveSourceFactory","$HK","EditorInputCapabilities","EditorCloseContext","GroupModelChangeKind","SideBySideEditor","EditorResourceAccessorImpl","EditorCloseMethod","$SK","CloseDirection","EditorFactoryRegistry","EditorsOrder","init_editor","sourceDescriptor","primary","secondary","originalResource","canonicalResource","editorTypeId","$8P","OmittedState","IDiagnosticVariableEntryFilterData","IChatRequestVariableEntry","PromptFileVariableKind","init_chatVariableEntries","fromMarker","marker","toEntry","TrimThreshold","lastSpace","labelStr","toUri","TestIdPathParts","TestPosition","$HU","init_testId","_$HU","rootId","idString","maybeParent","maybeChild","commonPrefix","serializeThingWithLocation","deserializeThingWithLocation","ExtTestRunProfileKind","TestControllerCapability","TestRunProfileBitset","$JU","IRichLocation","TestMessageType","ITestMessageStackFrame","ITestErrorMessage","ITestOutputMessage","ITestMessage","ITestTaskState","testTagDelimiter","$NU","$OU","ITestItem","TestItemExpandState","InternalTestItem","ITestItemUpdate","TestResultItem","ICoverageCount","IFileCoverage","DetailType","CoverageDetails","IBranchCoverage","IDeclarationCoverage","IStatementCoverage","TestDiffOpType","TestsDiffOp","init_testTypes","uriIdentity","ctrlId","tagId","namespaced","$KI","GroupDirection","GroupOrientation","GroupLocation","GroupsArrangement","MergeGroupMode","GroupsOrder","OpenEditorContext","init_editorGroupsService","$OI","$PI","$QI","init_editorService","$PO","$QO","init_implicitActivationEvents","extensionPointName","generator","extensionDescriptions","activationEvents","extPointName","contrib","contribArr","$$O","$_O","$6O","$8O","ExtensionHostStartup","ActivationKind","$VX","$UX","$XX","init_proxyIdentifier","_$UX","sid","TestItemEventOp","strictEqualComparator","diffableProps","diffableEntries","$u2","$v2","$w2","$x2","init_testItemCollection","t1","ctrlA","ctrlB","api","getApi","checkCtor","newMapped","bulk","itemController","eventPrivateApis","$y2","$z2","init_extHostTestingPrivateApi","ChatConfiguration","ChatModeKind","ChatAgentLocation","init_constants","fromRaw","$NX","AiSettingsSearchResultKind","init_aiSettingsSearch","$Ft","deprecationMessage","iconRegistry","initialize","codiconFontCharacters","$xt","IconContribution","IconFontDefinition","$yt","$Et","IconRegistry","$Ht","schemaRegistry","delayer","$It","$Jt","$Kt","$Lt","$Mt","init_iconRegistry","getDefinition","contribution","toJSONObject","iconFont","fromJSONObject","stringOrUndef","enumIndex","iconContribution","sorter","i1","contributions","MCP","init_modelContextProtocol","McpCollectionSortOrder","McpCollectionDefinition","McpServerDefinition","McpServerDefinitionVariableReplacement","LazyCollectionState","$hX","McpServerCacheState","McpServerTransportType","McpServerLaunch","McpConnectionState","McpServerInstallState","McpServerEditorTab","$oX","$pX","$qX","$rX","$tX","McpResourceURI","McpCapability","$uX","McpToolName","$wX","init_mcpTypes","toSerialized","fromSerialized","launch","Kind","mcpWorkbenchService","server","container","emptyAuthorityPlaceholder","fromServer","resourceURI","toServer","serverScheme","$C2","isImageDataPart","Selection","Location","Position","DocumentSelector","Diagnostic","DiagnosticRelatedInformation","MarkdownString","ThemableDecorationAttachmentRenderOptions","ThemableDecorationRenderOptions","DecorationRenderOptions","TextEdit","WorkspaceEdit","WorkspaceSymbol","DocumentSymbol","CallHierarchyItem","CallHierarchyIncomingCall","CallHierarchyOutgoingCall","DefinitionLink","Hover","EvaluatableExpression","InlineValue","InlineValueContext","DocumentHighlight","MultiDocumentHighlight","CompletionContext","CompletionCommand","CompletionItem","ParameterInformation","SignatureInformation","SignatureHelp","InlayHint","InlayHintLabelPart","DocumentLink","ColorPresentation","Color","SelectionRange","FoldingRange","TextEditorOpenOptions","GlobPattern","LanguageSelector","NotebookRange","NotebookCellExecutionSummary","NotebookData","NotebookCellData","NotebookCellOutputItem","NotebookCellOutput","NotebookExclusiveDocumentPattern","NotebookStatusBarItem","NotebookKernelSourceAction","NotebookDocumentContentOptions","NotebookRendererScript","TestMessage","TestTag","TestRunProfile","TestItem","TestResults","TestCoverage","TypeHierarchyItem","DataTransferItem","DataTransfer","ChatFollowup","LanguageModelChatMessage","LanguageModelChatMessage2","ChatResponseMarkdownPart","ChatResponseCodeblockUriPart","ChatResponseMarkdownWithVulnerabilitiesPart","ChatResponseConfirmationPart","ChatResponseFilesPart","ChatResponseAnchorPart","ChatResponseProgressPart","ChatResponseWarningPart","ChatResponseExtensionsPart","ChatResponseMovePart","ChatPrepareToolInvocationPart","ChatTask","ChatTaskResult","ChatResponseCommandButtonPart","ChatResponseTextEditPart","NotebookEdit","ChatResponseNotebookEditPart","ChatResponseReferencePart","ChatResponseCodeCitationPart","ChatResponsePart","ChatAgentRequest","ChatRequestDraft","ChatPromptReference","ChatLanguageModelToolReference","ChatAgentCompletionItem","ChatAgentResult","ChatAgentUserActionEvent","TerminalQuickFix","TerminalCompletionItemDto","TerminalCompletionList","TerminalResourceRequestConfig","PartialAcceptInfo","InlineCompletionEndOfLifeReason","DebugTreeItem","LanguageModelToolDescription","LanguageModelToolResult","LanguageModelToolResult2","IconPath","AiSettingsSearch","init_extHostTypeConverters","selectionStartLineNumber","selectionStartColumn","positionLineNumber","positionColumn","sel","_doTransformDocumentSelector","_transformScheme","fromMany","markup","isCodeblock","resUris","collectUri","_uriMassage","fromStrict","versionInfo","toCreate","isSnippet","editOrSnippetTest","_fromMapping","definitionLink","hover","inlineValue","inlineValueContext","documentHighlight","occurrence","multiDocumentHighlight","converter","_from","_to","suggestion","hint","colorPresentation","style","loc","isRelativePatternShape","isLegacyRelativePatternShape","isExclusivePattern","ep","commandsConverter","preload","profileGroupToBitset","toPlain","convertTestResultItem","tree","fromCoverageCount","fromLocation","toLocation","fromDetails","fromFile","badge","resolveFileData","reviveUriList","stringValue","serializeUriList","fileValue","toDataTransfer","dataTransfer","fromList","followup","messageContent","convert","myUri","treeData","isUri","isSymbolInformation","commandDisposables","mapValue","toContent","location2","tools","toolReferences","variableReferences","requestWithAllProps","varStr","ref","filterSeverity","filterUri","reviveMetadata","ehResult","quickFix","completions","pathSeparator","resourceRequestConfig","convertFn","supersededBy","hasBuffers","fromThemeIcon","fromSettingsSearchResult","fromSettingsSearchResultKind","isHttpConfig","TabInputKind","TabModelOperationKind","WebviewEditorCapabilities","WebviewMessageArrayBufferViewType","CellOutputKind","CandidatePortSource","$IY","ISuggestDataDtoField","ISuggestResultDtoField","ExtHostTestingResource","$KY","$LY","init_extHost_protocol","_$IY","$D2","init_extHostRpcService","testItemPropAccessor","propComparators","evSetProps","makePropDescriptors","$U2","$V2","init_extHostTestItem","toUpdate","newValue","t2","updateProps","sortText","busy","_$U2","$X2","init_extHostInitDataService","UIKind","ExtensionHostExitCode","MessageType","NativeLogMarkers","init_extensionHostProtocol","$12","firstSessionDate","installAge","$Y2","$Z2","$22","init_extHostTelemetry","isWorker","telemetryDetails","supportsTelemetry","productConfig","commonProperties","newLoggers","nonDisposedLoggers","errorEmitted","telemetryEnablements","isUsageEnabled","isErrorsEnabled","updatedData","eventNameOrException","errorData","cleanedErrorData","cleanedError","tempSender","$32","$42","$52","$62","$72","init_extHostCommands","#proxy","#telemetry","#extHostTelemetry","extHostRpc","extHostTelemetry","processor","apiCommand","registration","apiArgs","internalArgs","internalResult","global","retry","toArgs","annotateError","reported","cmdHandler","filterUnderscoreCommands","actualCmd","_$62","_$72","http","$92","$02","init_extHostCLIServer","sendResponse","statusCode","returnObj","fileURIs","folderURIs","forceNewWindow","diffMode","mergeMode","addMode","removeMode","forceReuseWindow","gotoLineMode","waitMarkerFilePath","urisToOpen","waitMarkerFileURI","windowOpenArgs","uriString","urioOpen","toExtOrVSIX","commandArgs","fs10","commands","$W4","$X4","slc","$Z4","configKey","actualKey","_mergeEnvironmentValue","$14","detectLocale","$24","$34","mergeNonNullKeys","resolveConfigurationVariables","languageVariants","$44","shell","userHome","customCwd","unresolved","_resolveCwd","$54","lastActiveWorkspace","configurationResolverService","$64","envFromConfig","baseEnv","allowedEnvFromConfig","$km","Type","init_labels","$$W","VariableKind","$_W","$aX","init_configurationResolver","$bX","init_configurationResolverExpression","_$bX","braceCount","inner","colonIdx","propertyName","replaceKeyName","replacementPath","parsed","locations","newLocation","newReplacements","notifier","replacement","newKey","oldKey","$94","init_variableResolver","_context","_labelService","_userHomePromise","_envVariablesPromise","envVariables","ev","environment","resolvedValue","resolution","displayUri","processEnvironment","commandValueMapping","argument","getFilePath","variableKind","getFolderPathForFile","folderPath","getFolderUri","columnNumber","selectedText","relative","ar","CustomVariableResolver","$04","init_remoteTerminalChannel","workspaceFolders","activeFileResource","resolvedVariables","extensionService","os3","reviveWorkspaceFolder","workspaceData","activeWorkspaceFolder","customVariableResolver","initialCwd","envPlatformKey","envVariableCollections","mergedCollection","workspaceFolder","ipcHandlePath","commandsExecuter","cliServer","commandId","reqId","serializedCommandArgs","serializedPayload","$LJ","$MJ","$NJ","$ZJ","$1J","$5J","$6J","$7J","$8J","$9J","$0J","$pI","init_label","$h4","$$4","$_4","activeWorkspaceRootUri","shouldPersistTerminal","resolverResult","resolverEnv","layout","init_diskFileSystemProviderClient","$a5","init_remoteFileSystemProviderClient","AppInsightsCore","https","$d5","init_telemetryClient","isContainer","os4","$UI","nodeModuleName","pathInsideNodeModule","nodeModulePath","scriptSrc","$TI","AMDModuleImporter","DefineCall","AMDModuleImporterState","init_amdX","dependencies","_AMDModuleImporter","tmpModuleId","moduleResult","defineCall","dependencyObjs","dependencyModules","scriptElement","loadEventListener","errorEventListener","vm","scriptSource","getClient","instrumentationKey","addInternalFlag","xhrOverride","oneDs","postPlugin","appInsightsCore","collectorChannelPlugin","coreConfig","endpointUrl","channelConfig","envelope","endpointHealthUrl","$e5","init_dsAppender","iKeyOrClientFactory","aiClient","makeTelemetryRequest","responseData","makeLegacyTelemetryRequest","httpsOptions","https2","sendPostAsync","oncomplete","telemetryRequestData","requestOptions","$f5","eventPrefix","defaultData","customHttpXHROverride","$g5","systemExtension","userExtension","workspaceExtension","developedExtension","init_extensionsUtil","$j5","$k5","init_remoteExtensionsScanner","builtinExtensionsToInstall","alreadyInstalled","workspaceExtensionLocations","extensionDevelopmentLocations","workspaceInstalledExtensionLocations","workspaceInstalledExtensions","developedExtensions","_mapResourceSchemeValue","_mapResourceRegExpValue","_exprKeyMapper","_massageWhenUser","massaged","_massageWhenUserArr","elements","_massageLocWhenUser","$h5","$i5","$RW","init_userDataProfileIpc","$l5","init_nodePtyHostStarter","ptyHostDebug","$Ay","$By","init_cssDevService","rg","$n5","init_telemetryLogAppender","remote","logSuffix","$LA","$MA","init_nativeMcpDiscoveryHelper","$o5","init_nativeMcpDiscoveryHelperChannel","$NA","init_nativeMcpDiscoveryHelperService","varName","envVar","$q5","init_extensionGalleryManifestServiceIpc","PackageType","$uW","$vW","$wW","init_mcpManagement","$NW","$OW","init_mcpResourceScannerService","mcpResource","servers","scannedMcpServers","updatedInputs","existingServers","existingInputIds","newInputs","serverNames","serverName","workspaceScannedMcpServers","scannedWorkspaceMcpServers","userMcpServers","scannedWorkspaceFolderMcpServers","serverOrConfig","oldScannedMcpServer","$UW","$VW","$WW","init_mcpManagementService","scannedServer","mcpServerInfo","packageType","variables","serverPackage","variableInputs","mcpGalleryService","mcpResourceScannerService","installable","updatedLocal","manifestPath","readme","mcpServerConfig","storedMcpServerInfo","mcpResourceManagementService","mcpResourceUri","$r5","init_mcpGalleryService","searchText","galleryServers","mcpUrl","nameParts","domainParts","mcpGalleryUrl","transformIncomingServer","mcpServer","$PW","init_mcpManagementIpc","$s5","socketServer","$t5","getUriTransformer","ServerLogger","cleanupOlderLogs","router","extensionHostStatusService","oneDsAppender","isInternal","initialTelemetryLevelArg","downloadChannel","ptyHostStarter","ptyHostService","mcpManagementService","extensionManagementService","extensionsScannerService","languagePackService","remoteExtensionEnvironmentChannel","telemetryChannel","remoteExtensionsScanner","remoteFileSystemChannel","languagePackChannel","_uriTransformerCache","twodigits","logsPath","currentLog","logsRoot","oldSessions","init_serverServices","createReadStream","$u5","$v5","cacheControl","responseHeaders","etag","textMimeType","CacheControl","APP_ROOT","STATIC_PATH","CALLBACK_PATH","WEB_EXTENSION_PATH","$w5","$x5","$y5","$z5","$A5","init_webClientServer","pathname","normalizedPathname","setRequestHeader","status","setResponseHeader","getFirstHeader","headerName","rootBase","vscodeBase","queryConnectionToken","cookie2","newQuery","replacePort","useTestResolver","forwardedPort","asJSON","_wrapWebWorkerExtHostInIframe","staticRoute","callbackRoute","resolveWorkspaceURI","defaultLocation","authSessionInfo","linkProtectionTrustedDomains","productConfiguration","proposedApi","productOverrides","workbenchWebConfiguration","WORKBENCH_NLS_BASE_URL","WORKBENCH_NLS_URL","cssModules","bundledExtensions","extensionPath","packageJSON","hasher","crypto2","hash","cspDirectives","keepTrailing","originalUrl","performance","createRequire","$B5","address","initUnexpectedErrorHandler","unloggedErrors","didLogAboutSIGPIPE","homeDirModulesPath","userDir","userDirModulesPath","fs12","vsdaMod","require","hasWebClient","queryPart","remoteExtensionHostAgentServer","RemoteExtensionHostAgentServer","currentTime","vscodeServerStartTime","vscodeServerListenTime","vscodeServerCodeLoadedTime","SHUTDOWN_TIMEOUT","WebEndpointOriginChecker","init_remoteExtensionHostAgentServer","url2","desiredPath","requestOrigin","isReconnection","requestNonce","crypto3","websocketExtensionOptions","websocketExtensionOption","errMessage","validator","signer","rejectWebSocketConnection","msg1","signedData","someText","signRequest","msg2","rendererCommit","myCommit","_logPrefix","dataChunk","con","startParams0","tunnelStartParams","remoteSocket","localSocket","net3","freePort","_WebEndpointOriginChecker","webEndpointUrlTemplate","quality","exampleOrigin","originRegExpSource","originRegExp","origin","server_main_exports","createServer","spawnCli","createDirs","os5","USER_DATA_PATH","APP_SETTINGS_HOME","GLOBAL_STORAGE_HOME","LOCAL_HISTORY_HOME","MACHINE_SETTINGS_HOME","BUILTIN_EXTENSIONS_FOLDER_PATH","fs13","init_server_main","usedValue","deprecatedOption","readline","fileURLToPath","__dirname","isWindows","setupCurrentWorkingDirectory","$Q","injectPath","$R","Module","globalPaths","originalResolveLookupPaths","moduleName","commonSuffixLength","originalNodeModulePaths","isDrive","isUsersDir","productObj","pkgObj","$O","$P","path2","setupNLSResult","setupNLS","doSetupNLS","fs2","$V","path4","import_minimist2","envValue","extensionLookupArgs","extensionInstallArgs","shouldSpawnCli","loadCode","_remoteExtensionHostAgentServer","_remoteExtensionHostAgentServerPromise","getRemoteExtensionHostAgentServer","hasStdinWithoutTty","prompt","firstRequest","firstWebSocket","http3","sanitizeStringArg","nodeListenOptions","parsePort","os6","ifname","iface","strPort","parseRange","findFreePort","strRange","testPort","question","rl","loadCodeWithNls"],"file":"server-main.js"}

CasperSecurity Mini